@camstack/addon-post-analysis 1.1.26 → 1.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
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
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-C6LbOCa9.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-DBgBsiUM.mjs";
4
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
5
  //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
6
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) => {
@@ -191,7 +191,7 @@ function M({ presets: e, value: t, onChange: n }) {
191
191
  }, e))
192
192
  });
193
193
  }
194
- function ee(t = 0) {
194
+ function N(t = 0) {
195
195
  let n = e(null), [a, o] = r(0);
196
196
  return i(() => {
197
197
  let e = n.current;
@@ -205,28 +205,28 @@ function ee(t = 0) {
205
205
  return i.observe(e), () => i.disconnect();
206
206
  }, [t]), [n, a];
207
207
  }
208
- function te(e, t) {
208
+ function ee(e, t) {
209
209
  let n = new Date(e), r = String(n.getHours()).padStart(2, "0"), i = String(n.getMinutes()).padStart(2, "0");
210
210
  return t <= 1440 * 60 * 1e3 ? `${r}:${i}` : `${String(n.getDate()).padStart(2, "0")}/${String(n.getMonth() + 1).padStart(2, "0")} ${r}:${i}`;
211
211
  }
212
- function N(e, t, n, r, i) {
212
+ function P(e, t, n, r, i) {
213
213
  if (t <= 1) return r;
214
214
  let a = n - r - i;
215
215
  return r + e / (t - 1) * a;
216
216
  }
217
- function ne(e, t, n, r, i, a) {
217
+ function te(e, t, n, r, i, a) {
218
218
  if (t <= e) return [];
219
219
  let o = t - e, s = [], c = n - r - i;
220
220
  for (let t = 0; t < a; t++) {
221
221
  let n = t / Math.max(1, a - 1), i = e + o * n;
222
222
  s.push({
223
223
  x: r + n * c,
224
- label: te(i, o)
224
+ label: ee(i, o)
225
225
  });
226
226
  }
227
227
  return s;
228
228
  }
229
- var P = [
229
+ var F = [
230
230
  "#3b82f6",
231
231
  "#a855f7",
232
232
  "#10b981",
@@ -236,17 +236,17 @@ var P = [
236
236
  "#6366f1",
237
237
  "#ef4444"
238
238
  ];
239
- function re(e) {
240
- return P[e % P.length] ?? "#64748b";
239
+ function ne(e) {
240
+ return F[e % F.length] ?? "#64748b";
241
241
  }
242
- function F() {
242
+ function I() {
243
243
  let [e, t] = r(null);
244
244
  return {
245
245
  state: e,
246
246
  bindHover: t
247
247
  };
248
248
  }
249
- function I({ state: e, containerWidth: t }) {
249
+ function L({ state: e, containerWidth: t }) {
250
250
  if (!e) return null;
251
251
  let n = Math.max(114, t - 110 - 4), r = Math.max(114, Math.min(n, e.anchorX)), i = e.anchorX - r;
252
252
  return /* @__PURE__ */ h("div", {
@@ -293,7 +293,7 @@ function I({ state: e, containerWidth: t }) {
293
293
  }
294
294
  //#endregion
295
295
  //#region src/pipeline-analytics/widgets/AudioHistoryChart.tsx
296
- var L = {
296
+ var re = {
297
297
  "5m": {
298
298
  label: "5 min",
299
299
  windowSec: 300,
@@ -315,15 +315,15 @@ var L = {
315
315
  }, ie = [
316
316
  {
317
317
  id: "5m",
318
- label: L["5m"].label
318
+ label: re["5m"].label
319
319
  },
320
320
  {
321
321
  id: "1h",
322
- label: L["1h"].label
322
+ label: re["1h"].label
323
323
  },
324
324
  {
325
325
  id: "24h",
326
- label: L["24h"].label
326
+ label: re["24h"].label
327
327
  }
328
328
  ], R = 140, z = {
329
329
  top: 16,
@@ -342,11 +342,11 @@ function oe(e) {
342
342
  return e ? ae[e.toLowerCase()] ?? "#6366f1" : "#71717a";
343
343
  }
344
344
  function se({ deviceId: n }) {
345
- let i = s(p().trpcClient, n), [a, c] = r("5m"), l = L[a], [u, d] = ee(), f = F(), _ = e(null), v = (e) => {
345
+ let i = s(l().trpcClient, n), [a, c] = r("5m"), u = re[a], [d, f] = N(), p = I(), _ = e(null), v = (e) => {
346
346
  let t = _.current;
347
347
  if (!t) return e;
348
348
  let n = t.getBoundingClientRect();
349
- return n.width === 0 ? e : e / d * n.width;
349
+ return n.width === 0 ? e : e / f * n.width;
350
350
  }, y = o({
351
351
  queryKey: [
352
352
  "audio-metrics",
@@ -355,21 +355,21 @@ function se({ deviceId: n }) {
355
355
  a
356
356
  ],
357
357
  queryFn: async () => i ? await i.audioMetrics?.getHistory({
358
- windowSec: l.windowSec,
359
- sampleEveryMs: l.sampleEveryMs
358
+ windowSec: u.windowSec,
359
+ sampleEveryMs: u.sampleEveryMs
360
360
  }) ?? null : null,
361
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), [
362
+ refetchInterval: u.pollIntervalMs,
363
+ staleTime: Math.max(1e3, u.pollIntervalMs / 2)
364
+ }), b = y.data, x = b?.points ?? [], S = t(() => fe(x), [x]), C = t(() => ue(x, f, S), [
365
365
  x,
366
- d,
366
+ f,
367
367
  S
368
- ]), w = t(() => de(x, d, S), [
368
+ ]), w = t(() => de(x, f, S), [
369
369
  x,
370
- d,
370
+ f,
371
371
  S
372
- ]), E = t(() => pe(S), [S]), D = t(() => me(x, d), [x, d]);
372
+ ]), E = t(() => pe(S), [S]), D = t(() => me(x, f), [x, f]);
373
373
  return /* @__PURE__ */ h("div", {
374
374
  className: "rounded-lg border border-border bg-surface overflow-hidden",
375
375
  children: [/* @__PURE__ */ h("div", {
@@ -386,25 +386,25 @@ function se({ deviceId: n }) {
386
386
  onChange: c
387
387
  })]
388
388
  }), /* @__PURE__ */ h("div", {
389
- ref: u,
389
+ ref: d,
390
390
  className: "p-3 min-w-0 relative",
391
391
  children: [x.length === 0 ? /* @__PURE__ */ m("div", {
392
392
  className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
393
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", {
394
+ }) : f === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ h("svg", {
395
395
  ref: _,
396
396
  role: "img",
397
397
  "aria-label": "Audio dBFS history",
398
398
  width: "100%",
399
399
  height: R,
400
- viewBox: `0 0 ${d} ${R}`,
400
+ viewBox: `0 0 ${f} ${R}`,
401
401
  preserveAspectRatio: "none",
402
402
  className: "block",
403
- onMouseLeave: () => f.bindHover(null),
403
+ onMouseLeave: () => p.bindHover(null),
404
404
  children: [
405
405
  E.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
406
406
  x1: z.left,
407
- x2: d - z.right,
407
+ x2: f - z.right,
408
408
  y1: e,
409
409
  y2: e,
410
410
  stroke: "currentColor",
@@ -440,7 +440,7 @@ function se({ deviceId: n }) {
440
440
  strokeWidth: 1.5
441
441
  }),
442
442
  x.map((e, t) => e.topClass === null ? null : /* @__PURE__ */ m("circle", {
443
- cx: B(t, x.length, d),
443
+ cx: B(t, x.length, f),
444
444
  cy: ce(e.dbfs, S),
445
445
  r: 3,
446
446
  fill: oe(e.topClass),
@@ -449,7 +449,7 @@ function se({ deviceId: n }) {
449
449
  strokeWidth: .5
450
450
  }, `dot-${t}`)),
451
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;
452
+ let n = B(t, x.length, f), r = ce(e.dbfs, S), i = R - z.top - z.bottom, a = x.length > 1 ? (f - z.left - z.right) / (x.length - 1) : 24;
453
453
  return /* @__PURE__ */ m("rect", {
454
454
  x: n - a / 2,
455
455
  y: z.top,
@@ -457,7 +457,7 @@ function se({ deviceId: n }) {
457
457
  height: i,
458
458
  fill: "transparent",
459
459
  onMouseEnter: () => {
460
- f.bindHover({
460
+ p.bindHover({
461
461
  anchorX: v(n),
462
462
  anchorY: r,
463
463
  title: `${he(e.ts)} · ${e.dbfs?.toFixed(1) ?? "—"} dB`,
@@ -481,15 +481,15 @@ function se({ deviceId: n }) {
481
481
  }, `hit-${t}`);
482
482
  })
483
483
  ]
484
- }), /* @__PURE__ */ m(I, {
485
- state: f.state,
486
- containerWidth: d
484
+ }), /* @__PURE__ */ m(L, {
485
+ state: p.state,
486
+ containerWidth: f
487
487
  })] }), x.length > 0 && /* @__PURE__ */ h("div", {
488
488
  className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
489
489
  children: [/* @__PURE__ */ h("span", { children: [
490
490
  x.length,
491
491
  " samples · ~",
492
- Math.round((b?.effectiveSampleEveryMs ?? l.sampleEveryMs) / 1e3),
492
+ Math.round((b?.effectiveSampleEveryMs ?? u.sampleEveryMs) / 1e3),
493
493
  "s spacing"
494
494
  ] }), /* @__PURE__ */ h("span", { children: [
495
495
  "peak ",
@@ -580,7 +580,7 @@ function ge(e) {
580
580
  return !Number.isFinite(e) || e <= 0 ? 60 : Math.round(e > 600 ? e / 1e3 : e);
581
581
  }
582
582
  function _e({ dev: e, deviceId: t, title: n = "Audio Metrics", variant: r = "full" }) {
583
- let i = u(p().trpcClient, e === void 0 && t !== void 0 ? t : null, (e) => e.audioMetrics), a = f(e ? e.state.audioMetrics : void 0), o = e === void 0 ? i : a;
583
+ let i = u(l().trpcClient, e === void 0 && t !== void 0 ? t : null, (e) => e.audioMetrics), a = f(e ? e.state.audioMetrics : void 0), o = e === void 0 ? i : a;
584
584
  return o ? /* @__PURE__ */ m(ve, {
585
585
  title: n,
586
586
  variant: r,
@@ -790,7 +790,7 @@ var V = {
790
790
  left: 32
791
791
  }, W = "__all__";
792
792
  function we({ deviceId: n }) {
793
- let a = s(p().trpcClient, n), [c, l] = r("5m"), [u, d] = r(W), _ = V[c], [v, y] = ee(), b = F(), x = e(null), S = (e) => {
793
+ let a = s(l().trpcClient, n), [c, u] = r("5m"), [d, p] = r(W), _ = V[c], [v, y] = N(), b = I(), x = e(null), S = (e) => {
794
794
  let t = x.current;
795
795
  if (!t) return e;
796
796
  let n = t.getBoundingClientRect();
@@ -802,15 +802,15 @@ function we({ deviceId: n }) {
802
802
  return [...e].toSorted();
803
803
  }, [C]);
804
804
  i(() => {
805
- u !== W && !w.includes(u) && d(W);
806
- }, [u, w]);
805
+ d !== W && !w.includes(d) && p(W);
806
+ }, [d, w]);
807
807
  let T = o({
808
808
  queryKey: [
809
809
  "zone-analytics",
810
810
  n,
811
811
  "cameraHistory",
812
812
  c,
813
- u
813
+ d
814
814
  ],
815
815
  queryFn: async () => {
816
816
  if (!a) return [];
@@ -819,7 +819,7 @@ function we({ deviceId: n }) {
819
819
  from: e - _.windowMs,
820
820
  to: e,
821
821
  resolution: _.resolution,
822
- ...u === W ? {} : { className: u }
822
+ ...d === W ? {} : { className: d }
823
823
  }) ?? [];
824
824
  },
825
825
  enabled: !!a,
@@ -833,11 +833,11 @@ function we({ deviceId: n }) {
833
833
  E,
834
834
  y,
835
835
  A
836
- ]), te = t(() => ne(k, D, y, U.left, U.right, 5), [
836
+ ]), ee = t(() => te(k, D, y, U.left, U.right, 5), [
837
837
  k,
838
838
  D,
839
839
  y
840
- ]), P = t(() => De(A), [A]);
840
+ ]), F = t(() => De(A), [A]);
841
841
  return /* @__PURE__ */ h("div", {
842
842
  className: "rounded-lg border border-border bg-surface overflow-hidden",
843
843
  children: [/* @__PURE__ */ h("div", {
@@ -851,8 +851,8 @@ function we({ deviceId: n }) {
851
851
  }), /* @__PURE__ */ h("div", {
852
852
  className: "flex items-center gap-2",
853
853
  children: [w.length > 0 && /* @__PURE__ */ h("select", {
854
- value: u,
855
- onChange: (e) => d(e.target.value),
854
+ value: d,
855
+ onChange: (e) => p(e.target.value),
856
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
857
  title: "Filter by detected class",
858
858
  children: [/* @__PURE__ */ m("option", {
@@ -865,7 +865,7 @@ function we({ deviceId: n }) {
865
865
  }), /* @__PURE__ */ m(M, {
866
866
  presets: Ce,
867
867
  value: c,
868
- onChange: l
868
+ onChange: u
869
869
  })]
870
870
  })]
871
871
  }), /* @__PURE__ */ h("div", {
@@ -885,7 +885,7 @@ function we({ deviceId: n }) {
885
885
  className: "block",
886
886
  onMouseLeave: () => b.bindHover(null),
887
887
  children: [
888
- P.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
888
+ F.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
889
889
  x1: U.left,
890
890
  x2: y - U.right,
891
891
  y1: e,
@@ -900,7 +900,7 @@ function we({ deviceId: n }) {
900
900
  className: "text-[9px] fill-foreground-subtle",
901
901
  children: t
902
902
  })] }, `y-${n}`)),
903
- te.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
903
+ ee.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
904
904
  x: e,
905
905
  y: H - U.bottom + 12,
906
906
  textAnchor: "middle",
@@ -915,7 +915,7 @@ function we({ deviceId: n }) {
915
915
  strokeWidth: 1.5
916
916
  }),
917
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;
918
+ let n = P(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
919
  return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("circle", {
920
920
  cx: n,
921
921
  cy: r,
@@ -935,7 +935,7 @@ function we({ deviceId: n }) {
935
935
  title: `${Oe(e.ts)} · ${e.count} object${e.count === 1 ? "" : "s"}`,
936
936
  rows: [{
937
937
  label: "Class",
938
- value: u === W ? "all" : u
938
+ value: d === W ? "all" : d
939
939
  }, {
940
940
  label: "Bucket",
941
941
  value: _.resolution
@@ -945,7 +945,7 @@ function we({ deviceId: n }) {
945
945
  })] }, `${e.ts}-${t}`);
946
946
  })
947
947
  ]
948
- }), /* @__PURE__ */ m(I, {
948
+ }), /* @__PURE__ */ m(L, {
949
949
  state: b.state,
950
950
  containerWidth: y
951
951
  })] }), E.length > 0 && /* @__PURE__ */ h("div", {
@@ -975,7 +975,7 @@ function Ee(e, t, n) {
975
975
  if (e.length === 0) return null;
976
976
  let r = [];
977
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);
978
+ let a = P(i, e.length, t, U.left, U.right), o = Te(e[i].count, n);
979
979
  r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
980
980
  }
981
981
  return r.join(" ");
@@ -1036,11 +1036,11 @@ var G = {
1036
1036
  left: 32
1037
1037
  };
1038
1038
  function je({ deviceId: n }) {
1039
- let i = s(p().trpcClient, n), [a, c] = r("1h"), l = G[a], [u, d] = ee(), f = F(), _ = e(null), v = (e) => {
1039
+ let i = s(l().trpcClient, n), [a, c] = r("1h"), u = G[a], [d, f] = N(), p = I(), _ = e(null), v = (e) => {
1040
1040
  let t = _.current;
1041
1041
  if (!t) return e;
1042
1042
  let n = t.getBoundingClientRect();
1043
- return n.width === 0 ? e : e / d * n.width;
1043
+ return n.width === 0 ? e : e / f * n.width;
1044
1044
  }, y = o({
1045
1045
  queryKey: [
1046
1046
  "pipeline-analytics",
@@ -1050,28 +1050,28 @@ function je({ deviceId: n }) {
1050
1050
  ],
1051
1051
  queryFn: async () => {
1052
1052
  if (!i) return [];
1053
- let e = Date.now() - l.windowMs;
1053
+ let e = Date.now() - u.windowMs;
1054
1054
  return await i.pipelineAnalytics?.getMotionEvents({
1055
1055
  since: e,
1056
1056
  limit: Ae
1057
1057
  }) ?? [];
1058
1058
  },
1059
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), [
1060
+ refetchInterval: u.pollIntervalMs,
1061
+ staleTime: Math.max(1e3, u.pollIntervalMs / 2)
1062
+ }), b = y.data ?? [], x = y.dataUpdatedAt > 0 ? y.dataUpdatedAt : Date.now(), S = x - u.windowMs, C = t(() => Me(b, S, x, u.bucketMs), [
1063
1063
  b,
1064
1064
  S,
1065
1065
  x,
1066
- l.bucketMs
1066
+ u.bucketMs
1067
1067
  ]), w = t(() => {
1068
1068
  if (C.length === 0) return 1;
1069
1069
  let e = C.reduce((e, t) => Math.max(e, t.count), 0);
1070
1070
  return Math.max(1, Math.ceil(e * 1.15));
1071
- }, [C]), E = t(() => ne(S, x, d, q.left, q.right, 5), [
1071
+ }, [C]), E = t(() => te(S, x, f, q.left, q.right, 5), [
1072
1072
  S,
1073
1073
  x,
1074
- d
1074
+ f
1075
1075
  ]), D = t(() => Pe(w), [w]), O = b.length;
1076
1076
  return /* @__PURE__ */ h("div", {
1077
1077
  className: "rounded-lg border border-border bg-surface overflow-hidden",
@@ -1089,25 +1089,25 @@ function je({ deviceId: n }) {
1089
1089
  onChange: c
1090
1090
  })]
1091
1091
  }), /* @__PURE__ */ h("div", {
1092
- ref: u,
1092
+ ref: d,
1093
1093
  className: "p-3 min-w-0 relative",
1094
1094
  children: [O === 0 ? /* @__PURE__ */ m("div", {
1095
1095
  className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
1096
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", {
1097
+ }) : f === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ h("svg", {
1098
1098
  ref: _,
1099
1099
  role: "img",
1100
1100
  "aria-label": "Motion event histogram",
1101
1101
  width: "100%",
1102
1102
  height: K,
1103
- viewBox: `0 0 ${d} ${K}`,
1103
+ viewBox: `0 0 ${f} ${K}`,
1104
1104
  preserveAspectRatio: "none",
1105
1105
  className: "block",
1106
- onMouseLeave: () => f.bindHover(null),
1106
+ onMouseLeave: () => p.bindHover(null),
1107
1107
  children: [
1108
1108
  D.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
1109
1109
  x1: q.left,
1110
- x2: d - q.right,
1110
+ x2: f - q.right,
1111
1111
  y1: e,
1112
1112
  y2: e,
1113
1113
  stroke: "currentColor",
@@ -1128,7 +1128,7 @@ function je({ deviceId: n }) {
1128
1128
  children: t
1129
1129
  }, `x-${n}`)),
1130
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;
1131
+ let { x: n, w: r } = Ne(e.bucketStart, u.bucketMs, S, x, f), i = K - q.top - q.bottom, a = e.count / w * i, o = q.top + (i - a), s = e.bucketStart + u.bucketMs;
1132
1132
  return /* @__PURE__ */ h("g", { children: [e.count > 0 && /* @__PURE__ */ m("rect", {
1133
1133
  x: n,
1134
1134
  y: o,
@@ -1144,13 +1144,13 @@ function je({ deviceId: n }) {
1144
1144
  height: i,
1145
1145
  fill: "transparent",
1146
1146
  onMouseEnter: () => {
1147
- f.bindHover({
1147
+ p.bindHover({
1148
1148
  anchorX: v(n + r / 2),
1149
1149
  anchorY: o,
1150
1150
  title: `${Fe(e.bucketStart, s)} · ${e.count} event${e.count === 1 ? "" : "s"}`,
1151
1151
  rows: [{
1152
1152
  label: "Bucket",
1153
- value: Ie(l.bucketMs)
1153
+ value: Ie(u.bucketMs)
1154
1154
  }, {
1155
1155
  label: "Count",
1156
1156
  value: `${e.count}`
@@ -1160,9 +1160,9 @@ function je({ deviceId: n }) {
1160
1160
  })] }, `${e.bucketStart}-${t}`);
1161
1161
  })
1162
1162
  ]
1163
- }), /* @__PURE__ */ m(I, {
1164
- state: f.state,
1165
- containerWidth: d
1163
+ }), /* @__PURE__ */ m(L, {
1164
+ state: p.state,
1165
+ containerWidth: f
1166
1166
  })] }), O > 0 && /* @__PURE__ */ h("div", {
1167
1167
  className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
1168
1168
  children: [/* @__PURE__ */ h("span", { children: [
@@ -1170,7 +1170,7 @@ function je({ deviceId: n }) {
1170
1170
  " event",
1171
1171
  O === 1 ? "" : "s",
1172
1172
  " · ",
1173
- Ie(l.bucketMs),
1173
+ Ie(u.bucketMs),
1174
1174
  " ",
1175
1175
  "buckets"
1176
1176
  ] }), /* @__PURE__ */ h("span", { children: [
@@ -1265,7 +1265,7 @@ var J = {
1265
1265
  left: 32
1266
1266
  };
1267
1267
  function Be({ deviceId: n }) {
1268
- let a = s(p().trpcClient, n), [c, l] = r("1h"), [u, d] = r(X), f = J[c], [_, v] = ee(), y = F(), b = e(null), x = o({
1268
+ let a = s(l().trpcClient, n), [c, u] = r("1h"), [d, f] = r(X), p = J[c], [_, v] = N(), y = I(), b = e(null), x = o({
1269
1269
  queryKey: [
1270
1270
  "pipeline-analytics",
1271
1271
  n,
@@ -1274,45 +1274,45 @@ function Be({ deviceId: n }) {
1274
1274
  ],
1275
1275
  queryFn: async () => {
1276
1276
  if (!a) return [];
1277
- let e = Date.now() - f.windowMs;
1277
+ let e = Date.now() - p.windowMs;
1278
1278
  return await a.pipelineAnalytics?.getObjectEvents({
1279
1279
  since: e,
1280
1280
  limit: Re
1281
1281
  }) ?? [];
1282
1282
  },
1283
1283
  enabled: !!a,
1284
- refetchInterval: f.pollIntervalMs,
1285
- staleTime: Math.max(1e3, f.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 - f.windowMs, E = t(() => {
1284
+ refetchInterval: p.pollIntervalMs,
1285
+ staleTime: Math.max(1e3, p.pollIntervalMs / 2)
1286
+ }), S = x.data ?? [], C = t(() => d === X ? S : S.filter((e) => e.className === d), [S, d]), w = x.dataUpdatedAt > 0 ? x.dataUpdatedAt : Date.now(), T = w - p.windowMs, E = t(() => {
1287
1287
  let e = /* @__PURE__ */ new Set();
1288
1288
  for (let t of S) e.add(t.className);
1289
- return u !== X && e.add(u), [...e].toSorted();
1290
- }, [S, u]);
1289
+ return d !== X && e.add(d), [...e].toSorted();
1290
+ }, [S, d]);
1291
1291
  i(() => {
1292
- u !== X && S.length > 0 && !E.includes(u) && d(X);
1292
+ d !== X && S.length > 0 && !E.includes(d) && f(X);
1293
1293
  }, [
1294
- u,
1294
+ d,
1295
1295
  S,
1296
1296
  E
1297
1297
  ]);
1298
- let O = t(() => Ve(C, ze), [C]), k = t(() => He(C, T, w, f.bucketMs, O), [
1298
+ let O = t(() => Ve(C, ze), [C]), k = t(() => He(C, T, w, p.bucketMs, O), [
1299
1299
  C,
1300
1300
  T,
1301
1301
  w,
1302
- f.bucketMs,
1302
+ p.bucketMs,
1303
1303
  O
1304
1304
  ]), A = t(() => {
1305
1305
  if (k.length === 0) return 1;
1306
1306
  let e = k.reduce((e, t) => Math.max(e, t.total), 0);
1307
1307
  return Math.max(1, Math.ceil(e * 1.15));
1308
- }, [k]), j = t(() => ne(T, w, v, Q.left, Q.right, 5), [
1308
+ }, [k]), j = t(() => te(T, w, v, Q.left, Q.right, 5), [
1309
1309
  T,
1310
1310
  w,
1311
1311
  v
1312
- ]), te = t(() => We(A), [A]), N = t(() => {
1312
+ ]), ee = t(() => We(A), [A]), P = t(() => {
1313
1313
  let e = O.map((e) => e.className);
1314
1314
  return C.some((e) => !O.some((t) => t.className === e.className)) && e.push(Y), e;
1315
- }, [C, O]), P = (e) => {
1315
+ }, [C, O]), F = (e) => {
1316
1316
  let t = b.current;
1317
1317
  if (!t) return e;
1318
1318
  let n = t.getBoundingClientRect();
@@ -1331,8 +1331,8 @@ function Be({ deviceId: n }) {
1331
1331
  }), /* @__PURE__ */ h("div", {
1332
1332
  className: "flex items-center gap-2",
1333
1333
  children: [E.length > 0 && /* @__PURE__ */ h("select", {
1334
- value: u,
1335
- onChange: (e) => d(e.target.value),
1334
+ value: d,
1335
+ onChange: (e) => f(e.target.value),
1336
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
1337
  title: "Filter by detected class",
1338
1338
  children: [/* @__PURE__ */ m("option", {
@@ -1345,7 +1345,7 @@ function Be({ deviceId: n }) {
1345
1345
  }), /* @__PURE__ */ m(M, {
1346
1346
  presets: Le,
1347
1347
  value: c,
1348
- onChange: l
1348
+ onChange: u
1349
1349
  })]
1350
1350
  })]
1351
1351
  }), /* @__PURE__ */ h("div", {
@@ -1366,7 +1366,7 @@ function Be({ deviceId: n }) {
1366
1366
  className: "block",
1367
1367
  onMouseLeave: () => y.bindHover(null),
1368
1368
  children: [
1369
- te.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
1369
+ ee.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
1370
1370
  x1: Q.left,
1371
1371
  x2: v - Q.right,
1372
1372
  y1: e,
@@ -1390,12 +1390,12 @@ function Be({ deviceId: n }) {
1390
1390
  }, `x-${n}`)),
1391
1391
  k.map((e, t) => {
1392
1392
  if (e.total === 0) return null;
1393
- let { x: n, w: r } = Ue(e.bucketStart, f.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) => {
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 = P.map((t, a) => {
1394
1394
  let o = e.byClass[t] ?? 0;
1395
1395
  if (o === 0) return null;
1396
1396
  let c = o / A * i, l = Q.top + (i - s - c);
1397
1397
  s += c;
1398
- let u = t === Y ? "#94a3b8" : re(a);
1398
+ let u = t === Y ? "#94a3b8" : ne(a);
1399
1399
  return /* @__PURE__ */ m("rect", {
1400
1400
  x: n,
1401
1401
  y: l,
@@ -1404,7 +1404,7 @@ function Be({ deviceId: n }) {
1404
1404
  fill: u,
1405
1405
  opacity: .9
1406
1406
  }, `${e.bucketStart}-${t}`);
1407
- }).filter((e) => e !== null), l = e.bucketStart + f.bucketMs;
1407
+ }).filter((e) => e !== null), l = e.bucketStart + p.bucketMs;
1408
1408
  return /* @__PURE__ */ h("g", { children: [c, /* @__PURE__ */ m("rect", {
1409
1409
  x: n,
1410
1410
  y: Q.top,
@@ -1413,15 +1413,15 @@ function Be({ deviceId: n }) {
1413
1413
  fill: "transparent",
1414
1414
  onMouseEnter: () => {
1415
1415
  y.bindHover({
1416
- anchorX: P(n + r / 2),
1416
+ anchorX: F(n + r / 2),
1417
1417
  anchorY: o,
1418
- title: `${Ge(e.bucketStart, l, f.bucketMs)} · ${e.total} detection${e.total === 1 ? "" : "s"}`,
1419
- rows: N.map((t, n) => {
1418
+ title: `${Ge(e.bucketStart, l, p.bucketMs)} · ${e.total} detection${e.total === 1 ? "" : "s"}`,
1419
+ rows: P.map((t, n) => {
1420
1420
  let r = e.byClass[t] ?? 0;
1421
1421
  return r === 0 ? null : {
1422
1422
  label: t === Y ? "other" : t,
1423
1423
  value: `${r}`,
1424
- colour: t === Y ? "#94a3b8" : re(n)
1424
+ colour: t === Y ? "#94a3b8" : ne(n)
1425
1425
  };
1426
1426
  }).filter((e) => e !== null)
1427
1427
  });
@@ -1430,11 +1430,11 @@ function Be({ deviceId: n }) {
1430
1430
  })
1431
1431
  ]
1432
1432
  }),
1433
- /* @__PURE__ */ m(I, {
1433
+ /* @__PURE__ */ m(L, {
1434
1434
  state: y.state,
1435
1435
  containerWidth: v
1436
1436
  }),
1437
- /* @__PURE__ */ m(qe, { stackOrder: N })
1437
+ /* @__PURE__ */ m(qe, { stackOrder: P })
1438
1438
  ] }), C.length > 0 && /* @__PURE__ */ h("div", {
1439
1439
  className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
1440
1440
  children: [/* @__PURE__ */ h("span", { children: [
@@ -1443,7 +1443,7 @@ function Be({ deviceId: n }) {
1443
1443
  C.length === 1 ? "" : "s",
1444
1444
  " ·",
1445
1445
  " ",
1446
- Ke(f.bucketMs),
1446
+ Ke(p.bucketMs),
1447
1447
  " buckets"
1448
1448
  ] }), /* @__PURE__ */ h("span", { children: [
1449
1449
  "peak ",
@@ -1515,7 +1515,7 @@ function qe({ stackOrder: e }) {
1515
1515
  className: "inline-flex items-center gap-1 text-[10px] text-foreground-subtle",
1516
1516
  children: [/* @__PURE__ */ m("span", {
1517
1517
  className: "inline-block h-2 w-2 rounded-sm",
1518
- style: { backgroundColor: e === Y ? "#94a3b8" : re(t) }
1518
+ style: { backgroundColor: e === Y ? "#94a3b8" : ne(t) }
1519
1519
  }), /* @__PURE__ */ m("span", { children: e === Y ? "other" : e })]
1520
1520
  }, e))
1521
1521
  });
@@ -1523,7 +1523,7 @@ function qe({ stackOrder: e }) {
1523
1523
  //#endregion
1524
1524
  //#region src/pipeline-analytics/widgets/OccupancyPanel.tsx
1525
1525
  function Je({ dev: e, deviceId: t, title: n = "Live Occupancy", variant: r = "full" }) {
1526
- let i = s(p().trpcClient, e === void 0 && t !== void 0 ? t : null), a = e ?? i, o = f(a?.state.zoneAnalytics);
1526
+ let i = s(l().trpcClient, e === void 0 && t !== void 0 ? t : null), a = e ?? i, o = f(a?.state.zoneAnalytics);
1527
1527
  return o ? /* @__PURE__ */ m(Ye, {
1528
1528
  title: n,
1529
1529
  variant: r,
@@ -1669,7 +1669,7 @@ function nt({ deviceId: e }) {
1669
1669
  className: d,
1670
1670
  children: [
1671
1671
  /* @__PURE__ */ h("div", {
1672
- className: `grid ${l}`,
1672
+ className: `grid ${p}`,
1673
1673
  style: { gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 340px), 1fr))" },
1674
1674
  children: [/* @__PURE__ */ m(c, {
1675
1675
  widgetId: "pipeline-analytics/live-occupancy-panel",