@camstack/addon-training 0.1.92 → 0.1.94

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.
Files changed (23) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +18 -12
  3. package/dist/{MotionZonesSettings-Cli21_S4.mjs → MotionZonesSettings-BDIz0ADl.mjs} +2 -2
  4. package/dist/{PrivacyMaskSettings-BqMnLgR4.mjs → PrivacyMaskSettings-Cz_1itEY.mjs} +2 -2
  5. package/dist/{SceneMonitorEditor-TOlMkkSx.mjs → SceneMonitorEditor-DxdQN6e5.mjs} +119 -120
  6. package/dist/_stub.js +5295 -5310
  7. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-Ki3rRnXi.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-DcGxW0BQ.mjs} +4 -4
  8. package/dist/{_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-COkV6wxS.mjs → _virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B6wwfPOo.mjs} +1 -1
  9. package/dist/addon-training.css +1 -1
  10. package/dist/{dist-BYGiAfO5.js → dist-C_f7s2st.js} +38 -7
  11. package/dist/{dist-BLeIfxL-.mjs → dist-mC0XNhcx.mjs} +38 -7
  12. package/dist/{hostInit-SSLNnzqp.mjs → hostInit-DPLOK7Fx.mjs} +3 -3
  13. package/dist/index.js +1 -1
  14. package/dist/orchestrator/training.addon.js +1 -1
  15. package/dist/orchestrator/training.addon.mjs +1 -1
  16. package/dist/{player-overlays-CpnLw8Tf.mjs → player-overlays-ClwLHxNP.mjs} +1 -1
  17. package/dist/providers/modal/training-modal.addon.js +1 -1
  18. package/dist/providers/modal/training-modal.addon.mjs +1 -1
  19. package/dist/remoteEntry.js +1 -1
  20. package/dist/{responsive-wZ7jMF7F.mjs → responsive-Cx4quvGq.mjs} +1 -1
  21. package/dist/{scene-monitor-copy-Cqfs4Vng.mjs → scene-monitor-copy-DIJUg8Ro.mjs} +63 -46
  22. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-CG3LeBz1.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-Ch6HQCmx.mjs} +1 -1
  23. package/package.json +2 -2
@@ -4,9 +4,9 @@ import { r as l, t as u } from "./ui-text-CqJgUCKX.mjs";
4
4
  import { n as d, r as f, t as p } from "./rotate-ccw-Cu6tGrgG.mjs";
5
5
  import { t as m } from "./settings-2-xV0I5Y5U.mjs";
6
6
  import { t as h } from "./trash-2-BKfuhsgY.mjs";
7
- import { c as g, d as _, h as v, p as y, u as b } from "./responsive-wZ7jMF7F.mjs";
8
- import { a as x, c as S, i as C, n as ee, o as w, r as te, s as T, t as E } from "./scene-monitor-copy-Cqfs4Vng.mjs";
9
- import { MaskShapeCanvas as D } from "./MaskShapeCanvas-HNL0xNpy.mjs";
7
+ import { c as g, d as _, h as v, p as y, u as b } from "./responsive-Cx4quvGq.mjs";
8
+ import { a as x, c as S, i as C, l as w, n as T, o as E, r as D, s as ee, t as te } from "./scene-monitor-copy-DIJUg8Ro.mjs";
9
+ import { MaskShapeCanvas as ne } from "./MaskShapeCanvas-HNL0xNpy.mjs";
10
10
  //#region ../ui-library/src/composites/cap-settings/SceneReferenceGallery.tsx
11
11
  i();
12
12
  var O = S("/addon/pipeline-analytics/event-media");
@@ -32,8 +32,8 @@ function j(e) {
32
32
  return e.states.reduce((e, t) => e + t.references.length, 0);
33
33
  }
34
34
  var M = "rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors";
35
- function ne({ monitor: e, disabled: t, onDelete: n }) {
36
- let r = l(), i = A(e), c = j(e), [u, d] = a(null);
35
+ function N({ monitor: e, disabled: t, onDelete: n }) {
36
+ let r = l(), i = A(e), a = j(e), c = w();
37
37
  return i.length === 0 ? /* @__PURE__ */ o("p", {
38
38
  className: `${g} leading-relaxed`,
39
39
  children: r("uiLibrary.sceneReferenceGallery.empty", "No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.")
@@ -44,54 +44,53 @@ function ne({ monitor: e, disabled: t, onDelete: n }) {
44
44
  children: [/* @__PURE__ */ s("p", {
45
45
  className: "text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle",
46
46
  children: [
47
- w(e.condition, r),
47
+ E(e.condition, r),
48
48
  " · ",
49
49
  e.tiles.length
50
50
  ]
51
51
  }), /* @__PURE__ */ o("ul", {
52
52
  className: "flex flex-wrap gap-1.5",
53
53
  children: e.tiles.map((i) => {
54
- let a = `${i.stateId}:${String(i.index)}`, l = c === 1, f = u === a;
54
+ let l = `${i.stateId}:${String(i.index)}`, u = a === 1;
55
55
  return /* @__PURE__ */ s("li", {
56
56
  className: "flex w-24 flex-col gap-1 rounded-md border border-border p-1",
57
57
  children: [
58
- /* @__PURE__ */ o(N, { reference: i.reference }),
58
+ /* @__PURE__ */ o(P, { reference: i.reference }),
59
59
  /* @__PURE__ */ o("span", {
60
60
  className: `${g} tabular-nums`,
61
- children: P(i.reference.capturedAt)
61
+ children: F(i.reference.capturedAt)
62
62
  }),
63
63
  /* @__PURE__ */ s("button", {
64
64
  type: "button",
65
65
  className: M,
66
66
  disabled: t,
67
67
  "aria-label": r("uiLibrary.sceneReferenceGallery.deleteLabel", "Delete the {{variant}} photograph from {{date}}", {
68
- variant: w(e.condition, r).toLowerCase(),
69
- date: P(i.reference.capturedAt)
68
+ variant: E(e.condition, r).toLowerCase(),
69
+ date: F(i.reference.capturedAt)
70
70
  }),
71
71
  onClick: () => {
72
- if (l && !f) {
73
- d(a);
74
- return;
75
- }
76
- d(null), n({
77
- stateId: i.stateId,
78
- index: i.index
79
- });
72
+ (async () => {
73
+ u && !await c({
74
+ title: r("uiLibrary.sceneReferenceGallery.deleteTitle", "Delete the only photograph?"),
75
+ message: r("uiLibrary.sceneReferenceGallery.lastWarning", "This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again."),
76
+ confirmLabel: r("uiLibrary.sceneReferenceGallery.delete", "Delete"),
77
+ variant: "danger"
78
+ }) || n({
79
+ stateId: i.stateId,
80
+ index: i.index
81
+ });
82
+ })();
80
83
  },
81
- children: [/* @__PURE__ */ o(h, { className: "mr-1 inline h-3 w-3" }), f ? r("uiLibrary.sceneReferenceGallery.confirm", "Confirm") : r("uiLibrary.sceneReferenceGallery.delete", "Delete")]
82
- }),
83
- f && /* @__PURE__ */ o("p", {
84
- className: "text-[10px] leading-snug text-warning",
85
- children: r("uiLibrary.sceneReferenceGallery.lastWarning", "This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.")
84
+ children: [/* @__PURE__ */ o(h, { className: "mr-1 inline h-3 w-3" }), r("uiLibrary.sceneReferenceGallery.delete", "Delete")]
86
85
  })
87
86
  ]
88
- }, a);
87
+ }, l);
89
88
  })
90
89
  })]
91
90
  }, e.condition))
92
91
  });
93
92
  }
94
- function N({ reference: e }) {
93
+ function P({ reference: e }) {
95
94
  let t = l(), [n, r] = a(!1), i = e.thumbnailMediaId;
96
95
  return i === void 0 || n ? /* @__PURE__ */ s("div", {
97
96
  className: "flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle",
@@ -108,7 +107,7 @@ function N({ reference: e }) {
108
107
  onError: () => r(!0)
109
108
  });
110
109
  }
111
- function P(e) {
110
+ function F(e) {
112
111
  let t = new Date(e);
113
112
  return `${t.toLocaleDateString()} ${t.toLocaleTimeString([], {
114
113
  hour: "2-digit",
@@ -118,21 +117,21 @@ function P(e) {
118
117
  //#endregion
119
118
  //#region ../ui-library/src/composites/cap-settings/SceneSettingsForm.tsx
120
119
  i();
121
- var F = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50", I = "text-[10px] font-medium text-foreground-subtle", L = "flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2", R = "text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle", z = 5, B = 3600;
122
- function V(e, t) {
120
+ var I = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50", L = "text-[10px] font-medium text-foreground-subtle", R = "flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2", z = "text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle", B = 5, V = 3600;
121
+ function H(e, t) {
123
122
  switch (e) {
124
123
  case "periodic": return t("uiLibrary.sceneSettingsForm.triggerHintPeriodic", "Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.");
125
124
  case "on-motion": return t("uiLibrary.sceneSettingsForm.triggerHintOnMotion", "Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.");
126
125
  case "both": return t("uiLibrary.sceneSettingsForm.triggerHintBoth", "Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.");
127
126
  }
128
127
  }
129
- function H(e, t) {
128
+ function U(e, t) {
130
129
  switch (e) {
131
130
  case "skip": return t("uiLibrary.sceneSettingsForm.uncoveredHintSkip", "Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.");
132
131
  case "judge-anyway": return t("uiLibrary.sceneSettingsForm.uncoveredHintJudge", "Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.");
133
132
  }
134
133
  }
135
- function U(e) {
134
+ function W(e) {
136
135
  return {
137
136
  label: e.label,
138
137
  checkIntervalSec: e.checkIntervalSec ?? 60,
@@ -143,10 +142,10 @@ function U(e) {
143
142
  confirmPrompt: e.confirm?.prompt ?? ""
144
143
  };
145
144
  }
146
- function W({ monitor: t, disabled: n, onPatch: r }) {
147
- let i = l(), [d, f] = a(() => U(t)), [p, m] = a(!1);
145
+ function G({ monitor: t, disabled: n, onPatch: r }) {
146
+ let i = l(), [d, f] = a(() => W(t)), [p, m] = a(!1);
148
147
  e(() => {
149
- p || f(U(t));
148
+ p || f(W(t));
150
149
  }, [t, p]);
151
150
  let h = (e) => {
152
151
  m(!1), r(e);
@@ -162,22 +161,22 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
162
161
  className: "flex flex-col gap-2",
163
162
  children: [
164
163
  /* @__PURE__ */ s("div", {
165
- className: L,
164
+ className: R,
166
165
  children: [
167
166
  /* @__PURE__ */ o("p", {
168
- className: R,
167
+ className: z,
169
168
  children: i("uiLibrary.sceneSettingsForm.whatItWatches", "What it watches")
170
169
  }),
171
170
  /* @__PURE__ */ s("label", {
172
171
  className: "flex flex-col gap-1",
173
172
  children: [/* @__PURE__ */ o("span", {
174
- className: I,
173
+ className: L,
175
174
  children: i("uiLibrary.sceneSettingsForm.name", "Name")
176
175
  }), /* @__PURE__ */ o("input", {
177
176
  type: "text",
178
177
  value: d.label,
179
178
  disabled: n,
180
- className: F,
179
+ className: I,
181
180
  onFocus: () => m(!0),
182
181
  onChange: (e) => f((t) => ({
183
182
  ...t,
@@ -197,7 +196,7 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
197
196
  disabled: n,
198
197
  onChange: (e) => h({ enabled: e.target.checked })
199
198
  }), /* @__PURE__ */ o("span", {
200
- className: I,
199
+ className: L,
201
200
  children: i("uiLibrary.sceneSettingsForm.watching", "Watching")
202
201
  })]
203
202
  }),
@@ -208,12 +207,12 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
208
207
  /* @__PURE__ */ s("label", {
209
208
  className: "flex flex-col gap-1",
210
209
  children: [/* @__PURE__ */ o("span", {
211
- className: I,
210
+ className: L,
212
211
  children: i("uiLibrary.sceneSettingsForm.whenToLook", "When to look")
213
212
  }), /* @__PURE__ */ s("select", {
214
213
  value: t.triggerMode,
215
214
  disabled: n,
216
- className: F,
215
+ className: I,
217
216
  onChange: (e) => {
218
217
  let t = e.target.value;
219
218
  (t === "periodic" || t === "on-motion" || t === "both") && h({ triggerMode: t });
@@ -236,27 +235,27 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
236
235
  }),
237
236
  /* @__PURE__ */ o("p", {
238
237
  className: g,
239
- children: V(t.triggerMode, i)
238
+ children: H(t.triggerMode, i)
240
239
  }),
241
240
  /* @__PURE__ */ s("label", {
242
241
  className: "flex flex-col gap-1",
243
242
  children: [/* @__PURE__ */ o("span", {
244
- className: I,
243
+ className: L,
245
244
  children: i("uiLibrary.sceneSettingsForm.checkEvery", "Check every (seconds)")
246
245
  }), /* @__PURE__ */ o("input", {
247
246
  type: "number",
248
- min: z,
249
- max: B,
247
+ min: B,
248
+ max: V,
250
249
  value: d.checkIntervalSec,
251
250
  disabled: n,
252
- className: F,
251
+ className: I,
253
252
  onFocus: () => m(!0),
254
253
  onChange: (e) => f((t) => ({
255
254
  ...t,
256
255
  checkIntervalSec: Number(e.target.value) || 0
257
256
  })),
258
257
  onBlur: () => {
259
- let e = G(d.checkIntervalSec, z, B);
258
+ let e = K(d.checkIntervalSec, B, V);
260
259
  e === t.checkIntervalSec ? m(!1) : h({ checkIntervalSec: e });
261
260
  }
262
261
  })]
@@ -268,16 +267,16 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
268
267
  ]
269
268
  }),
270
269
  /* @__PURE__ */ s("div", {
271
- className: L,
270
+ className: R,
272
271
  children: [
273
272
  /* @__PURE__ */ o("p", {
274
- className: R,
273
+ className: z,
275
274
  children: i("uiLibrary.sceneSettingsForm.howSure", "How sure it has to be")
276
275
  }),
277
276
  t.check.mode === "similarity" && /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ s("label", {
278
277
  className: "flex flex-col gap-1",
279
278
  children: [/* @__PURE__ */ o("span", {
280
- className: I,
279
+ className: L,
281
280
  children: /* @__PURE__ */ o(u, {
282
281
  uiKey: "uiLibrary.sceneSettingsForm.matchThreshold",
283
282
  fallback: "Match threshold — <0>{{value}}</0>",
@@ -310,7 +309,7 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
310
309
  /* @__PURE__ */ s("label", {
311
310
  className: "flex flex-col gap-1",
312
311
  children: [/* @__PURE__ */ o("span", {
313
- className: I,
312
+ className: L,
314
313
  children: i("uiLibrary.sceneSettingsForm.agreeingChecks", "Agreeing checks before it changes its mind")
315
314
  }), /* @__PURE__ */ o("input", {
316
315
  type: "number",
@@ -318,14 +317,14 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
318
317
  max: 10,
319
318
  value: d.hysteresisCount,
320
319
  disabled: n,
321
- className: F,
320
+ className: I,
322
321
  onFocus: () => m(!0),
323
322
  onChange: (e) => f((t) => ({
324
323
  ...t,
325
324
  hysteresisCount: Number(e.target.value) || 1
326
325
  })),
327
326
  onBlur: () => {
328
- let e = G(d.hysteresisCount, 1, 10);
327
+ let e = K(d.hysteresisCount, 1, 10);
329
328
  e === t.check.hysteresisCount ? m(!1) : h({ check: _({ hysteresisCount: e }) });
330
329
  }
331
330
  })]
@@ -337,7 +336,7 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
337
336
  /* @__PURE__ */ s("label", {
338
337
  className: "flex flex-col gap-1",
339
338
  children: [/* @__PURE__ */ o("span", {
340
- className: I,
339
+ className: L,
341
340
  children: i("uiLibrary.sceneSettingsForm.quietFor", "Quiet for (seconds) before a check counts")
342
341
  }), /* @__PURE__ */ o("input", {
343
342
  type: "number",
@@ -345,14 +344,14 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
345
344
  max: 3600,
346
345
  value: d.quietSeconds,
347
346
  disabled: n,
348
- className: F,
347
+ className: I,
349
348
  onFocus: () => m(!0),
350
349
  onChange: (e) => f((t) => ({
351
350
  ...t,
352
351
  quietSeconds: Number(e.target.value) || 0
353
352
  })),
354
353
  onBlur: () => {
355
- let e = G(d.quietSeconds, 0, 3600);
354
+ let e = K(d.quietSeconds, 0, 3600);
356
355
  e === t.quietSeconds ? m(!1) : h({ quietSeconds: e });
357
356
  }
358
357
  })]
@@ -364,7 +363,7 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
364
363
  /* @__PURE__ */ s("label", {
365
364
  className: "flex flex-col gap-1",
366
365
  children: [/* @__PURE__ */ o("span", {
367
- className: I,
366
+ className: L,
368
367
  children: i("uiLibrary.sceneSettingsForm.minGap", "Minimum gap between counted checks (seconds)")
369
368
  }), /* @__PURE__ */ o("input", {
370
369
  type: "number",
@@ -372,14 +371,14 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
372
371
  max: 3600,
373
372
  value: d.minObservationSpacingSec,
374
373
  disabled: n,
375
- className: F,
374
+ className: I,
376
375
  onFocus: () => m(!0),
377
376
  onChange: (e) => f((t) => ({
378
377
  ...t,
379
378
  minObservationSpacingSec: Number(e.target.value) || 0
380
379
  })),
381
380
  onBlur: () => {
382
- let e = G(d.minObservationSpacingSec, 0, 3600);
381
+ let e = K(d.minObservationSpacingSec, 0, 3600);
383
382
  e === t.minObservationSpacingSec ? m(!1) : h({ minObservationSpacingSec: e });
384
383
  }
385
384
  })]
@@ -391,21 +390,21 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
391
390
  ]
392
391
  }),
393
392
  /* @__PURE__ */ s("div", {
394
- className: L,
393
+ className: R,
395
394
  children: [
396
395
  /* @__PURE__ */ o("p", {
397
- className: R,
396
+ className: z,
398
397
  children: i("uiLibrary.sceneSettingsForm.lighting", "Lighting")
399
398
  }),
400
399
  /* @__PURE__ */ s("label", {
401
400
  className: "flex flex-col gap-1",
402
401
  children: [/* @__PURE__ */ o("span", {
403
- className: I,
402
+ className: L,
404
403
  children: i("uiLibrary.sceneSettingsForm.noReference", "When a light has no reference of its own")
405
404
  }), /* @__PURE__ */ s("select", {
406
405
  value: t.onUncoveredCondition,
407
406
  disabled: n,
408
- className: F,
407
+ className: I,
409
408
  onChange: (e) => {
410
409
  let t = e.target.value;
411
410
  (t === "skip" || t === "judge-anyway") && h({ onUncoveredCondition: t });
@@ -421,26 +420,26 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
421
420
  }),
422
421
  /* @__PURE__ */ o("p", {
423
422
  className: g,
424
- children: H(t.onUncoveredCondition, i)
423
+ children: U(t.onUncoveredCondition, i)
425
424
  })
426
425
  ]
427
426
  }),
428
427
  /* @__PURE__ */ s("div", {
429
- className: L,
428
+ className: R,
430
429
  children: [
431
430
  /* @__PURE__ */ o("p", {
432
- className: R,
431
+ className: z,
433
432
  children: i("uiLibrary.sceneSettingsForm.whatYouGetTold", "What you get told")
434
433
  }),
435
434
  /* @__PURE__ */ s("label", {
436
435
  className: "flex flex-col gap-1",
437
436
  children: [/* @__PURE__ */ o("span", {
438
- className: I,
437
+ className: L,
439
438
  children: i("uiLibrary.sceneSettingsForm.notificationsFollow", "Notifications follow")
440
439
  }), /* @__PURE__ */ s("select", {
441
440
  value: t.emit,
442
441
  disabled: n,
443
- className: F,
442
+ className: I,
444
443
  onChange: (e) => {
445
444
  let t = e.target.value;
446
445
  (t === "latched" || t === "live") && h({ emit: t });
@@ -466,7 +465,7 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
466
465
  disabled: n,
467
466
  onChange: (e) => h({ autoRestore: e.target.checked })
468
467
  }), /* @__PURE__ */ o("span", {
469
- className: I,
468
+ className: L,
470
469
  children: i("uiLibrary.sceneSettingsForm.autoRestore", "Clear the flag by itself when things look normal again")
471
470
  })]
472
471
  }),
@@ -477,10 +476,10 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
477
476
  ]
478
477
  }),
479
478
  /* @__PURE__ */ s("div", {
480
- className: L,
479
+ className: R,
481
480
  children: [
482
481
  /* @__PURE__ */ o("p", {
483
- className: R,
482
+ className: z,
484
483
  children: i("uiLibrary.sceneSettingsForm.aiDoubleCheck", "AI double-check")
485
484
  }),
486
485
  /* @__PURE__ */ s("label", {
@@ -490,25 +489,25 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
490
489
  checked: v,
491
490
  disabled: n || d.confirmPrompt.trim().length === 0,
492
491
  onChange: (e) => h(e.target.checked ? { confirm: {
493
- ...K(d.confirmPrompt.trim()),
492
+ ...q(d.confirmPrompt.trim()),
494
493
  enabled: !0
495
494
  } } : { confirm: null })
496
495
  }), /* @__PURE__ */ o("span", {
497
- className: I,
496
+ className: L,
498
497
  children: i("uiLibrary.sceneSettingsForm.askVision", "Ask a vision model before changing the answer")
499
498
  })]
500
499
  }),
501
500
  /* @__PURE__ */ s("label", {
502
501
  className: "flex flex-col gap-1",
503
502
  children: [/* @__PURE__ */ o("span", {
504
- className: I,
503
+ className: L,
505
504
  children: i("uiLibrary.sceneSettingsForm.question", "The question to ask")
506
505
  }), /* @__PURE__ */ o("input", {
507
506
  type: "text",
508
507
  value: d.confirmPrompt,
509
508
  placeholder: i("uiLibrary.sceneSettingsForm.questionPlaceholder", "e.g. Is the wheelie bin still there?"),
510
509
  disabled: n,
511
- className: F,
510
+ className: I,
512
511
  onFocus: () => m(!0),
513
512
  onChange: (e) => f((t) => ({
514
513
  ...t,
@@ -517,7 +516,7 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
517
516
  onBlur: () => {
518
517
  let e = d.confirmPrompt.trim();
519
518
  e.length > 0 && e !== t.confirm?.prompt ? h({ confirm: {
520
- ...K(e),
519
+ ...q(e),
521
520
  enabled: v
522
521
  } }) : m(!1);
523
522
  }
@@ -536,10 +535,10 @@ function W({ monitor: t, disabled: n, onPatch: r }) {
536
535
  ]
537
536
  });
538
537
  }
539
- function G(e, t, n) {
538
+ function K(e, t, n) {
540
539
  return Math.min(n, Math.max(t, e));
541
540
  }
542
- function K(e) {
541
+ function q(e) {
543
542
  return {
544
543
  enabled: !1,
545
544
  prompt: e,
@@ -551,13 +550,13 @@ function K(e) {
551
550
  //#endregion
552
551
  //#region ../ui-library/src/composites/cap-settings/SceneMonitorEditor.tsx
553
552
  i();
554
- var q = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors", J = "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors", re = "rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors", ie = {
553
+ var J = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors", Y = "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors", re = "rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors", ie = {
555
554
  alarm: "border-danger/50 bg-danger/15 text-danger",
556
555
  ok: "border-success/50 bg-success/15 text-success",
557
556
  unknown: "border-border bg-surface text-foreground-subtle"
558
557
  }, ae = .8, oe = 3;
559
- function Y({ deviceId: i }) {
560
- let u = l(), d = _(v().trpcClient, i), S = y(d?.state.sceneMonitor), O = T(i, { width: 640 }), [k, A] = a(null), [j, M] = a(!1), [N, P] = a(null), [F, I] = a(null), [L, R] = a(null), [z, B] = a(null), [V, H] = a(!1), [U, G] = a(null), [K, Y] = a(""), X = r(!0);
558
+ function X({ deviceId: i }) {
559
+ let u = l(), d = _(v().trpcClient, i), S = y(d?.state.sceneMonitor), w = ee(i, { width: 640 }), [O, k] = a(null), [A, j] = a(!1), [M, P] = a(null), [F, I] = a(null), [L, R] = a(null), [z, B] = a(null), [V, H] = a(!1), [U, W] = a(null), [K, q] = a(""), X = r(!0);
561
560
  e(() => (X.current = !0, () => {
562
561
  X.current = !1;
563
562
  }), []);
@@ -565,16 +564,16 @@ function Y({ deviceId: i }) {
565
564
  if (d) try {
566
565
  let e = await d.sceneMonitor?.listScenes({});
567
566
  if (!X.current) return;
568
- e && A(e);
567
+ e && k(e);
569
568
  } catch (e) {
570
569
  if (!X.current) return;
571
- b(e) ? M(!0) : I(e instanceof Error ? e.message : String(e));
570
+ b(e) ? j(!0) : I(e instanceof Error ? e.message : String(e));
572
571
  }
573
572
  }, [d]);
574
573
  e(() => {
575
- A(null), M(!1), I(null), Z();
574
+ k(null), j(!1), I(null), Z();
576
575
  }, [Z]);
577
- let Q = S?.monitors ?? k?.monitors ?? [], se = Date.now(), $ = n(async (e, t) => {
576
+ let Q = S?.monitors ?? O?.monitors ?? [], se = Date.now(), $ = n(async (e, t) => {
578
577
  P(e), I(null);
579
578
  try {
580
579
  await t(), await Z();
@@ -602,7 +601,7 @@ function Y({ deviceId: i }) {
602
601
  ]), le = n((e, t) => {
603
602
  if (t.kind === "rect") {
604
603
  if (e === "__draft__") {
605
- G(t);
604
+ W(t);
606
605
  return;
607
606
  }
608
607
  $(`roi-${String(e)}`, async () => d?.sceneMonitor?.updateScene({
@@ -611,7 +610,7 @@ function Y({ deviceId: i }) {
611
610
  }));
612
611
  }
613
612
  }, [d, $]), ue = n((e) => {
614
- e.kind === "rect" && G(e);
613
+ e.kind === "rect" && W(e);
615
614
  }, []), de = n(async () => {
616
615
  U === null || K.trim().length === 0 || (await $("create", async () => {
617
616
  await d?.sceneMonitor?.createScene({
@@ -623,7 +622,7 @@ function Y({ deviceId: i }) {
623
622
  hysteresisCount: oe
624
623
  }
625
624
  });
626
- }), G(null), Y(""), H(!1));
625
+ }), W(null), q(""), H(!1));
627
626
  }, [
628
627
  d,
629
628
  U,
@@ -632,7 +631,7 @@ function Y({ deviceId: i }) {
632
631
  ]);
633
632
  return d ? /* @__PURE__ */ o("div", {
634
633
  className: "flex flex-col gap-3",
635
- children: j ? /* @__PURE__ */ o("p", {
634
+ children: A ? /* @__PURE__ */ o("p", {
636
635
  className: `${g} leading-relaxed`,
637
636
  children: u("uiLibrary.sceneMonitor.unsupported", "Scene monitoring is not available for this camera.")
638
637
  }) : /* @__PURE__ */ s(c, { children: [
@@ -642,7 +641,7 @@ function Y({ deviceId: i }) {
642
641
  }),
643
642
  /* @__PURE__ */ o("div", {
644
643
  className: "relative overflow-hidden rounded-md border border-border",
645
- children: /* @__PURE__ */ o(D, {
644
+ children: /* @__PURE__ */ o(ne, {
646
645
  items: ce,
647
646
  supportedShapes: ["rect"],
648
647
  selectedId: L ?? (U === null ? null : "__draft__"),
@@ -650,8 +649,8 @@ function Y({ deviceId: i }) {
650
649
  onShapeChange: le,
651
650
  onDrawComplete: ue,
652
651
  drawingKind: V && U === null ? "rect" : null,
653
- backdrop: O.src === null ? null : /* @__PURE__ */ o("img", {
654
- src: O.src,
652
+ backdrop: w.src === null ? null : /* @__PURE__ */ o("img", {
653
+ src: w.src,
655
654
  alt: "",
656
655
  className: "h-full w-full object-contain",
657
656
  draggable: !1
@@ -662,18 +661,18 @@ function Y({ deviceId: i }) {
662
661
  className: "flex flex-wrap items-center gap-2",
663
662
  children: [/* @__PURE__ */ o("button", {
664
663
  type: "button",
665
- className: V ? J : q,
664
+ className: V ? Y : J,
666
665
  "aria-pressed": V,
667
666
  onClick: () => {
668
- H((e) => !e), G(null);
667
+ H((e) => !e), W(null);
669
668
  },
670
- disabled: N !== null,
669
+ disabled: M !== null,
671
670
  children: V ? u("uiLibrary.sceneMonitor.cancel", "Cancel") : u("uiLibrary.sceneMonitor.newScene", "+ New scene")
672
671
  }), /* @__PURE__ */ o("button", {
673
672
  type: "button",
674
- className: q,
675
- onClick: O.refresh,
676
- disabled: N !== null,
673
+ className: J,
674
+ onClick: w.refresh,
675
+ disabled: M !== null,
677
676
  children: u("uiLibrary.sceneMonitor.refresh", "Refresh frame")
678
677
  })]
679
678
  }),
@@ -693,14 +692,14 @@ function Y({ deviceId: i }) {
693
692
  children: [/* @__PURE__ */ o("input", {
694
693
  type: "text",
695
694
  value: K,
696
- onChange: (e) => Y(e.target.value),
695
+ onChange: (e) => q(e.target.value),
697
696
  placeholder: u("uiLibrary.sceneMonitor.placeholder", "e.g. Immondizia prelevata"),
698
697
  className: "flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground"
699
698
  }), /* @__PURE__ */ o("button", {
700
699
  type: "button",
701
- className: J,
700
+ className: Y,
702
701
  onClick: () => void de(),
703
- disabled: U === null || K.trim().length === 0 || N !== null,
702
+ disabled: U === null || K.trim().length === 0 || M !== null,
704
703
  children: u("uiLibrary.sceneMonitor.create", "Create")
705
704
  })]
706
705
  })
@@ -716,7 +715,7 @@ function Y({ deviceId: i }) {
716
715
  }) : /* @__PURE__ */ o("ul", {
717
716
  className: "flex flex-col gap-2",
718
717
  children: Q.map((e) => {
719
- let t = ee(e, u);
718
+ let t = T(e, u);
720
719
  return /* @__PURE__ */ s("li", {
721
720
  className: `flex flex-col gap-1.5 rounded-md border p-2 ${L === e.id ? "border-primary/50" : "border-border"}`,
722
721
  children: [
@@ -738,11 +737,11 @@ function Y({ deviceId: i }) {
738
737
  }),
739
738
  /* @__PURE__ */ o("p", {
740
739
  className: `${g} tabular-nums`,
741
- children: te(e, u)
740
+ children: D(e, u)
742
741
  }),
743
- /* @__PURE__ */ o(ne, {
742
+ /* @__PURE__ */ o(N, {
744
743
  monitor: e,
745
- disabled: N !== null,
744
+ disabled: M !== null,
746
745
  onDelete: ({ stateId: t, index: n }) => void $(`refdel-${e.id}-${t}-${String(n)}`, async () => d.sceneMonitor?.deleteReference({
747
746
  monitorId: e.id,
748
747
  stateId: t,
@@ -752,20 +751,20 @@ function Y({ deviceId: i }) {
752
751
  /* @__PURE__ */ s("div", {
753
752
  className: "flex flex-wrap items-center gap-1.5",
754
753
  children: [
755
- E.map((t) => {
754
+ te.map((t) => {
756
755
  let n = t === "ir";
757
756
  return /* @__PURE__ */ s("button", {
758
757
  type: "button",
759
- className: q,
760
- disabled: N !== null,
761
- title: n ? u("uiLibrary.sceneMonitor.optionalTitle", "Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.") : u("uiLibrary.sceneMonitor.captureTitle", "Take a fresh photo now and store it as the {{variant}} reference", { variant: w(t, u).toLowerCase() }),
758
+ className: J,
759
+ disabled: M !== null,
760
+ title: n ? u("uiLibrary.sceneMonitor.optionalTitle", "Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.") : u("uiLibrary.sceneMonitor.captureTitle", "Take a fresh photo now and store it as the {{variant}} reference", { variant: E(t, u).toLowerCase() }),
762
761
  onClick: () => void $(`cap-${e.id}-${t}`, async () => d.sceneMonitor?.captureReference({
763
762
  monitorId: e.id,
764
763
  condition: t
765
764
  })),
766
765
  children: [
767
766
  /* @__PURE__ */ o(f, { className: "mr-1 inline h-3 w-3" }),
768
- u("uiLibrary.sceneMonitor.capture", "Capture {{variant}}", { variant: w(t, u).toLowerCase() }),
767
+ u("uiLibrary.sceneMonitor.capture", "Capture {{variant}}", { variant: E(t, u).toLowerCase() }),
769
768
  n && /* @__PURE__ */ o("span", {
770
769
  className: "ml-1 text-foreground-subtle/70",
771
770
  children: u("uiLibrary.sceneMonitor.optional", "(optional)")
@@ -775,40 +774,40 @@ function Y({ deviceId: i }) {
775
774
  }),
776
775
  /* @__PURE__ */ s("button", {
777
776
  type: "button",
778
- className: J,
779
- disabled: N !== null || e.states.length === 0,
777
+ className: Y,
778
+ disabled: M !== null || e.states.length === 0,
780
779
  title: u("uiLibrary.sceneMonitor.resetTitle", "Clear the flag and re-photograph what normal looks like right now"),
781
780
  onClick: () => void $(`reset-${e.id}`, async () => d.sceneMonitor?.resetScene({ monitorId: e.id })),
782
781
  children: [/* @__PURE__ */ o(p, { className: "mr-1 inline h-3 w-3" }), u("uiLibrary.sceneMonitor.reset", "Reset")]
783
782
  }),
784
783
  /* @__PURE__ */ o("button", {
785
784
  type: "button",
786
- className: q,
787
- disabled: N !== null,
785
+ className: J,
786
+ disabled: M !== null,
788
787
  onClick: () => void $(`check-${e.id}`, async () => d.sceneMonitor?.recheckNow({ monitorId: e.id })),
789
788
  children: u("uiLibrary.sceneMonitor.checkNow", "Check now")
790
789
  }),
791
790
  /* @__PURE__ */ s("button", {
792
791
  type: "button",
793
- className: z === e.id ? J : q,
792
+ className: z === e.id ? Y : J,
794
793
  "aria-pressed": z === e.id,
795
794
  "aria-label": u("uiLibrary.sceneMonitor.settingsFor", "Settings for {{label}}", { label: e.label }),
796
- disabled: N !== null,
795
+ disabled: M !== null,
797
796
  onClick: () => B((t) => t === e.id ? null : e.id),
798
797
  children: [/* @__PURE__ */ o(m, { className: "mr-1 inline h-3 w-3" }), u("uiLibrary.sceneMonitor.settings", "Settings")]
799
798
  }),
800
799
  /* @__PURE__ */ o("button", {
801
800
  type: "button",
802
801
  className: re,
803
- disabled: N !== null,
802
+ disabled: M !== null,
804
803
  onClick: () => void $(`del-${e.id}`, async () => d.sceneMonitor?.deleteScene({ monitorId: e.id })),
805
804
  children: /* @__PURE__ */ o(h, { className: "h-3 w-3" })
806
805
  })
807
806
  ]
808
807
  }),
809
- z === e.id && /* @__PURE__ */ o(W, {
808
+ z === e.id && /* @__PURE__ */ o(G, {
810
809
  monitor: e,
811
- disabled: N !== null,
810
+ disabled: M !== null,
812
811
  onPatch: (t) => void $(`tune-${e.id}`, async () => d.sceneMonitor?.updateScene({
813
812
  monitorId: e.id,
814
813
  patch: t
@@ -822,4 +821,4 @@ function Y({ deviceId: i }) {
822
821
  }) : null;
823
822
  }
824
823
  //#endregion
825
- export { Y as SceneMonitorEditor };
824
+ export { X as SceneMonitorEditor };