@sentinel-nvr/web 0.20.2 → 0.22.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/README.md +23 -0
- package/dist/chunk-Z5USWUIE.js +1102 -0
- package/dist/chunk-Z5USWUIE.js.map +1 -0
- package/dist/glas/index.d.ts +76 -0
- package/dist/glas/index.js +221 -0
- package/dist/glas/index.js.map +1 -0
- package/dist/glas-data-CSRWRmcF.d.ts +368 -0
- package/dist/ui/glas.css +1629 -0
- package/dist/ui/index.d.ts +68 -96
- package/dist/ui/index.js +925 -685
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/locales/de.json +15 -1
- package/dist/ui/locales/en.json +14 -0
- package/dist/ui/locales/es.json +15 -1
- package/dist/ui/locales/fr.json +15 -1
- package/dist/ui/locales/it.json +15 -1
- package/dist/ui/locales/pt.json +15 -1
- package/dist/ui/locales/sv.json +15 -1
- package/dist/ui/ui.css +44 -0
- package/package.json +9 -2
package/dist/ui/index.js
CHANGED
|
@@ -35,6 +35,19 @@ import {
|
|
|
35
35
|
sentinelWallSeconds,
|
|
36
36
|
weekdayShorts
|
|
37
37
|
} from "../chunk-P7VKKFVA.js";
|
|
38
|
+
import {
|
|
39
|
+
THEMES,
|
|
40
|
+
THEME_LABELS,
|
|
41
|
+
THEME_NAMES,
|
|
42
|
+
TOKEN_TO_VAR,
|
|
43
|
+
accentOverride,
|
|
44
|
+
applyTheme,
|
|
45
|
+
glasAccent,
|
|
46
|
+
isThemeName,
|
|
47
|
+
resolveMode,
|
|
48
|
+
resolveThemeMode,
|
|
49
|
+
watchSystemMode
|
|
50
|
+
} from "../chunk-Z5USWUIE.js";
|
|
38
51
|
|
|
39
52
|
// src/ui/context.tsx
|
|
40
53
|
import { createContext, useContext } from "react";
|
|
@@ -100,316 +113,6 @@ var UI_LOCALE_LABELS = {
|
|
|
100
113
|
sv: "Svenska"
|
|
101
114
|
};
|
|
102
115
|
|
|
103
|
-
// src/ui/themes-data.ts
|
|
104
|
-
var THEME_NAMES = ["aurora", "sunset", "ocean", "forest"];
|
|
105
|
-
var THEME_LABELS = {
|
|
106
|
-
aurora: "Aurora",
|
|
107
|
-
sunset: "Sunset",
|
|
108
|
-
ocean: "Ocean",
|
|
109
|
-
forest: "Forest"
|
|
110
|
-
};
|
|
111
|
-
var THEMES = {
|
|
112
|
-
// Aurora — the default: neutral surfaces, warm orange accent (matches mockups)
|
|
113
|
-
aurora: {
|
|
114
|
-
light: {
|
|
115
|
-
bg: "#f3f4f6",
|
|
116
|
-
bgRaised: "#ffffff",
|
|
117
|
-
bgCard: "#ffffff",
|
|
118
|
-
bgCardHover: "#f8f9fb",
|
|
119
|
-
bgSubtle: "#f1f3f5",
|
|
120
|
-
text: "#1a1d23",
|
|
121
|
-
textDim: "#697079",
|
|
122
|
-
textFaint: "#9aa1ab",
|
|
123
|
-
accent: "#f2941c",
|
|
124
|
-
accentSoft: "rgba(242, 148, 28, 0.12)",
|
|
125
|
-
onAccent: "#ffffff",
|
|
126
|
-
line: "rgba(20, 24, 30, 0.07)",
|
|
127
|
-
border: "#e8eaee",
|
|
128
|
-
positive: "#16a34a",
|
|
129
|
-
positiveSoft: "rgba(22, 163, 74, 0.12)",
|
|
130
|
-
warning: "#e59411",
|
|
131
|
-
warningSoft: "rgba(229, 148, 17, 0.12)",
|
|
132
|
-
danger: "#e5484d",
|
|
133
|
-
dangerSoft: "rgba(229, 72, 77, 0.10)",
|
|
134
|
-
info: "#3b82f6",
|
|
135
|
-
infoSoft: "rgba(59, 130, 246, 0.12)",
|
|
136
|
-
shadowCard: "0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)",
|
|
137
|
-
shadowElevated: "0 12px 32px -8px rgba(16, 24, 40, 0.16)",
|
|
138
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(242, 148, 28, 0.30)"
|
|
139
|
-
},
|
|
140
|
-
dark: {
|
|
141
|
-
bg: "#0f1116",
|
|
142
|
-
bgRaised: "#171a21",
|
|
143
|
-
bgCard: "#171a21",
|
|
144
|
-
bgCardHover: "#1e222b",
|
|
145
|
-
bgSubtle: "#22262f",
|
|
146
|
-
text: "#f2f4f7",
|
|
147
|
-
textDim: "#9aa1ad",
|
|
148
|
-
textFaint: "#646b76",
|
|
149
|
-
accent: "#f5a623",
|
|
150
|
-
accentSoft: "rgba(245, 166, 35, 0.16)",
|
|
151
|
-
onAccent: "#1a1205",
|
|
152
|
-
line: "rgba(255, 255, 255, 0.08)",
|
|
153
|
-
border: "rgba(255, 255, 255, 0.09)",
|
|
154
|
-
positive: "#3ad07f",
|
|
155
|
-
positiveSoft: "rgba(58, 208, 127, 0.15)",
|
|
156
|
-
warning: "#f5b53d",
|
|
157
|
-
warningSoft: "rgba(245, 181, 61, 0.15)",
|
|
158
|
-
danger: "#f0686d",
|
|
159
|
-
dangerSoft: "rgba(240, 104, 109, 0.15)",
|
|
160
|
-
info: "#5fa0f5",
|
|
161
|
-
infoSoft: "rgba(95, 160, 245, 0.15)",
|
|
162
|
-
shadowCard: "0 2px 8px -2px rgba(0, 0, 0, 0.5)",
|
|
163
|
-
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.7)",
|
|
164
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(245, 166, 35, 0.30)"
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
// Sunset — warm amber identity, warm-tinted surfaces
|
|
168
|
-
sunset: {
|
|
169
|
-
light: {
|
|
170
|
-
bg: "#f6f1ea",
|
|
171
|
-
bgRaised: "#fffdfa",
|
|
172
|
-
bgCard: "#fffdfa",
|
|
173
|
-
bgCardHover: "#f7f1e9",
|
|
174
|
-
bgSubtle: "#f1e9dd",
|
|
175
|
-
text: "#241d15",
|
|
176
|
-
textDim: "#7c6f5e",
|
|
177
|
-
textFaint: "#b3a692",
|
|
178
|
-
accent: "#d98324",
|
|
179
|
-
accentSoft: "rgba(217, 131, 36, 0.13)",
|
|
180
|
-
onAccent: "#ffffff",
|
|
181
|
-
line: "rgba(40, 30, 18, 0.09)",
|
|
182
|
-
border: "#ece2d3",
|
|
183
|
-
positive: "#3f8a5d",
|
|
184
|
-
positiveSoft: "rgba(63, 138, 93, 0.13)",
|
|
185
|
-
warning: "#c98a1e",
|
|
186
|
-
warningSoft: "rgba(201, 138, 30, 0.14)",
|
|
187
|
-
danger: "#c75a44",
|
|
188
|
-
dangerSoft: "rgba(199, 90, 68, 0.12)",
|
|
189
|
-
info: "#3f7da0",
|
|
190
|
-
infoSoft: "rgba(63, 125, 160, 0.13)",
|
|
191
|
-
shadowCard: "0 1px 3px rgba(80, 55, 20, 0.07)",
|
|
192
|
-
shadowElevated: "0 12px 32px -8px rgba(80, 55, 20, 0.18)",
|
|
193
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(217, 131, 36, 0.30)"
|
|
194
|
-
},
|
|
195
|
-
dark: {
|
|
196
|
-
bg: "#161310",
|
|
197
|
-
bgRaised: "#1f1b16",
|
|
198
|
-
bgCard: "#241f19",
|
|
199
|
-
bgCardHover: "#2a241d",
|
|
200
|
-
bgSubtle: "#2f2820",
|
|
201
|
-
text: "#f2ece2",
|
|
202
|
-
textDim: "#a39a8c",
|
|
203
|
-
textFaint: "#6f675c",
|
|
204
|
-
accent: "#e8a84b",
|
|
205
|
-
accentSoft: "rgba(232, 168, 75, 0.16)",
|
|
206
|
-
onAccent: "#1c1610",
|
|
207
|
-
line: "rgba(242, 236, 226, 0.08)",
|
|
208
|
-
border: "rgba(242, 236, 226, 0.09)",
|
|
209
|
-
positive: "#8fc7a2",
|
|
210
|
-
positiveSoft: "rgba(143, 199, 162, 0.16)",
|
|
211
|
-
warning: "#e8a84b",
|
|
212
|
-
warningSoft: "rgba(232, 168, 75, 0.16)",
|
|
213
|
-
danger: "#e08a78",
|
|
214
|
-
dangerSoft: "rgba(224, 138, 120, 0.16)",
|
|
215
|
-
info: "#8fb7c7",
|
|
216
|
-
infoSoft: "rgba(143, 183, 199, 0.16)",
|
|
217
|
-
shadowCard: "0 2px 10px -3px rgba(0, 0, 0, 0.5)",
|
|
218
|
-
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.66)",
|
|
219
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(232, 168, 75, 0.28)"
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
// Ocean — cool steel-blue identity
|
|
223
|
-
ocean: {
|
|
224
|
-
light: {
|
|
225
|
-
bg: "#eef1f5",
|
|
226
|
-
bgRaised: "#ffffff",
|
|
227
|
-
bgCard: "#ffffff",
|
|
228
|
-
bgCardHover: "#f4f7fa",
|
|
229
|
-
bgSubtle: "#eaeef3",
|
|
230
|
-
text: "#172029",
|
|
231
|
-
textDim: "#5f6c7a",
|
|
232
|
-
textFaint: "#9aa6b3",
|
|
233
|
-
accent: "#2f7fd6",
|
|
234
|
-
accentSoft: "rgba(47, 127, 214, 0.12)",
|
|
235
|
-
onAccent: "#ffffff",
|
|
236
|
-
line: "rgba(20, 30, 45, 0.08)",
|
|
237
|
-
border: "#e3e8ee",
|
|
238
|
-
positive: "#159a6e",
|
|
239
|
-
positiveSoft: "rgba(21, 154, 110, 0.12)",
|
|
240
|
-
warning: "#e09112",
|
|
241
|
-
warningSoft: "rgba(224, 145, 18, 0.13)",
|
|
242
|
-
danger: "#e0495a",
|
|
243
|
-
dangerSoft: "rgba(224, 73, 90, 0.11)",
|
|
244
|
-
info: "#2f7fd6",
|
|
245
|
-
infoSoft: "rgba(47, 127, 214, 0.12)",
|
|
246
|
-
shadowCard: "0 1px 3px rgba(20, 35, 60, 0.07)",
|
|
247
|
-
shadowElevated: "0 12px 32px -8px rgba(20, 35, 60, 0.16)",
|
|
248
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(47, 127, 214, 0.28)"
|
|
249
|
-
},
|
|
250
|
-
dark: {
|
|
251
|
-
bg: "#0a0c10",
|
|
252
|
-
bgRaised: "#0f1218",
|
|
253
|
-
bgCard: "#12151c",
|
|
254
|
-
bgCardHover: "#181c25",
|
|
255
|
-
bgSubtle: "#1d2230",
|
|
256
|
-
text: "#e8ecf2",
|
|
257
|
-
textDim: "#8a9ab0",
|
|
258
|
-
textFaint: "#566173",
|
|
259
|
-
accent: "#5fa8e8",
|
|
260
|
-
accentSoft: "rgba(95, 168, 232, 0.16)",
|
|
261
|
-
onAccent: "#06090f",
|
|
262
|
-
line: "rgba(232, 236, 242, 0.08)",
|
|
263
|
-
border: "rgba(232, 236, 242, 0.09)",
|
|
264
|
-
positive: "#4dc596",
|
|
265
|
-
positiveSoft: "rgba(77, 197, 150, 0.16)",
|
|
266
|
-
warning: "#e3b256",
|
|
267
|
-
warningSoft: "rgba(227, 178, 86, 0.16)",
|
|
268
|
-
danger: "#e68086",
|
|
269
|
-
dangerSoft: "rgba(230, 128, 134, 0.16)",
|
|
270
|
-
info: "#5fa8e8",
|
|
271
|
-
infoSoft: "rgba(95, 168, 232, 0.16)",
|
|
272
|
-
shadowCard: "0 2px 12px -3px rgba(0, 0, 0, 0.6)",
|
|
273
|
-
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.72)",
|
|
274
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(95, 168, 232, 0.30)"
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
// Forest — muted green identity
|
|
278
|
-
forest: {
|
|
279
|
-
light: {
|
|
280
|
-
bg: "#edf1ec",
|
|
281
|
-
bgRaised: "#ffffff",
|
|
282
|
-
bgCard: "#ffffff",
|
|
283
|
-
bgCardHover: "#f3f7f2",
|
|
284
|
-
bgSubtle: "#e8eee7",
|
|
285
|
-
text: "#1b2620",
|
|
286
|
-
textDim: "#5f6f64",
|
|
287
|
-
textFaint: "#9aa89f",
|
|
288
|
-
accent: "#3f9a63",
|
|
289
|
-
accentSoft: "rgba(63, 154, 99, 0.13)",
|
|
290
|
-
onAccent: "#ffffff",
|
|
291
|
-
line: "rgba(24, 36, 28, 0.08)",
|
|
292
|
-
border: "#e0e8e1",
|
|
293
|
-
positive: "#2f9a5e",
|
|
294
|
-
positiveSoft: "rgba(47, 154, 94, 0.13)",
|
|
295
|
-
warning: "#cf9120",
|
|
296
|
-
warningSoft: "rgba(207, 145, 32, 0.13)",
|
|
297
|
-
danger: "#cf5746",
|
|
298
|
-
dangerSoft: "rgba(207, 87, 70, 0.11)",
|
|
299
|
-
info: "#3f86a0",
|
|
300
|
-
infoSoft: "rgba(63, 134, 160, 0.13)",
|
|
301
|
-
shadowCard: "0 1px 3px rgba(24, 45, 32, 0.07)",
|
|
302
|
-
shadowElevated: "0 12px 32px -8px rgba(24, 45, 32, 0.16)",
|
|
303
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 20px -8px rgba(63, 154, 99, 0.28)"
|
|
304
|
-
},
|
|
305
|
-
dark: {
|
|
306
|
-
bg: "#0c110d",
|
|
307
|
-
bgRaised: "#121812",
|
|
308
|
-
bgCard: "#161d17",
|
|
309
|
-
bgCardHover: "#1d261e",
|
|
310
|
-
bgSubtle: "#212c22",
|
|
311
|
-
text: "#e9efe9",
|
|
312
|
-
textDim: "#8ba091",
|
|
313
|
-
textFaint: "#586860",
|
|
314
|
-
accent: "#5cc486",
|
|
315
|
-
accentSoft: "rgba(92, 196, 134, 0.16)",
|
|
316
|
-
onAccent: "#06120a",
|
|
317
|
-
line: "rgba(233, 239, 233, 0.08)",
|
|
318
|
-
border: "rgba(233, 239, 233, 0.09)",
|
|
319
|
-
positive: "#5cc486",
|
|
320
|
-
positiveSoft: "rgba(92, 196, 134, 0.16)",
|
|
321
|
-
warning: "#e0b455",
|
|
322
|
-
warningSoft: "rgba(224, 180, 85, 0.16)",
|
|
323
|
-
danger: "#e6807a",
|
|
324
|
-
dangerSoft: "rgba(230, 128, 122, 0.16)",
|
|
325
|
-
info: "#62b0c4",
|
|
326
|
-
infoSoft: "rgba(98, 176, 196, 0.16)",
|
|
327
|
-
shadowCard: "0 2px 12px -3px rgba(0, 0, 0, 0.55)",
|
|
328
|
-
shadowElevated: "0 16px 40px -12px rgba(0, 0, 0, 0.7)",
|
|
329
|
-
shadowActive: "0 0 0 1px var(--accent-soft), 0 6px 24px -8px rgba(92, 196, 134, 0.30)"
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
function resolveThemeMode(mode, systemPrefersDark) {
|
|
334
|
-
if (mode === "light" || mode === "dark") return mode;
|
|
335
|
-
return systemPrefersDark ? "dark" : "light";
|
|
336
|
-
}
|
|
337
|
-
function accentOverride(hue, resolvedMode) {
|
|
338
|
-
const isDark = resolvedMode === "dark";
|
|
339
|
-
const l = isDark ? 60 : 50;
|
|
340
|
-
const s = 78;
|
|
341
|
-
return {
|
|
342
|
-
accent: `hsl(${hue}, ${s}%, ${l}%)`,
|
|
343
|
-
accentSoft: `hsla(${hue}, ${s}%, ${l}%, ${isDark ? 0.16 : 0.12})`,
|
|
344
|
-
onAccent: isDark ? "#140e04" : "#ffffff"
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// src/ui/theme.ts
|
|
349
|
-
var TOKEN_TO_VAR = {
|
|
350
|
-
bg: "--bg",
|
|
351
|
-
bgRaised: "--bg-raised",
|
|
352
|
-
bgCard: "--bg-card",
|
|
353
|
-
bgCardHover: "--bg-card-hover",
|
|
354
|
-
bgSubtle: "--bg-subtle",
|
|
355
|
-
text: "--text",
|
|
356
|
-
textDim: "--text-dim",
|
|
357
|
-
textFaint: "--text-faint",
|
|
358
|
-
accent: "--accent",
|
|
359
|
-
accentSoft: "--accent-soft",
|
|
360
|
-
onAccent: "--on-accent",
|
|
361
|
-
line: "--line",
|
|
362
|
-
border: "--border",
|
|
363
|
-
positive: "--positive",
|
|
364
|
-
positiveSoft: "--positive-soft",
|
|
365
|
-
warning: "--warning",
|
|
366
|
-
warningSoft: "--warning-soft",
|
|
367
|
-
danger: "--danger",
|
|
368
|
-
dangerSoft: "--danger-soft",
|
|
369
|
-
info: "--info",
|
|
370
|
-
infoSoft: "--info-soft",
|
|
371
|
-
shadowCard: "--shadow-card",
|
|
372
|
-
shadowElevated: "--shadow-elevated",
|
|
373
|
-
shadowActive: "--shadow-active"
|
|
374
|
-
};
|
|
375
|
-
var darkMql = () => typeof window !== "undefined" && window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
|
|
376
|
-
function resolveMode(mode) {
|
|
377
|
-
return resolveThemeMode(mode, darkMql()?.matches ?? false);
|
|
378
|
-
}
|
|
379
|
-
function isThemeName(name) {
|
|
380
|
-
return THEME_NAMES.includes(name);
|
|
381
|
-
}
|
|
382
|
-
function applyTheme(name, mode = "light", accentHue) {
|
|
383
|
-
const root = document.documentElement;
|
|
384
|
-
const theme = isThemeName(name) ? name : "aurora";
|
|
385
|
-
const resolved = resolveMode(mode);
|
|
386
|
-
const tokens = THEMES[theme][resolved];
|
|
387
|
-
for (const key of Object.keys(TOKEN_TO_VAR))
|
|
388
|
-
root.style.setProperty(TOKEN_TO_VAR[key], tokens[key]);
|
|
389
|
-
root.setAttribute("data-theme", theme);
|
|
390
|
-
root.setAttribute("data-mode", resolved);
|
|
391
|
-
root.style.setProperty("color-scheme", resolved);
|
|
392
|
-
if (accentHue !== void 0) {
|
|
393
|
-
const o = accentOverride(accentHue, resolved);
|
|
394
|
-
root.style.setProperty("--accent", o.accent);
|
|
395
|
-
root.style.setProperty("--accent-soft", o.accentSoft);
|
|
396
|
-
root.style.setProperty("--on-accent", o.onAccent);
|
|
397
|
-
}
|
|
398
|
-
return resolved;
|
|
399
|
-
}
|
|
400
|
-
function watchSystemMode(getState) {
|
|
401
|
-
const mql = darkMql();
|
|
402
|
-
if (!mql)
|
|
403
|
-
return () => {
|
|
404
|
-
};
|
|
405
|
-
const on = () => {
|
|
406
|
-
const s = getState();
|
|
407
|
-
if (s.mode === "auto") applyTheme(s.theme, s.mode, s.accentHue);
|
|
408
|
-
};
|
|
409
|
-
mql.addEventListener("change", on);
|
|
410
|
-
return () => mql.removeEventListener("change", on);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
116
|
// src/ui/format.tsx
|
|
414
117
|
function fmtRelative(ts, t, nowMs = Date.now()) {
|
|
415
118
|
const s = Math.max(0, (nowMs - ts) / 1e3);
|
|
@@ -675,6 +378,245 @@ function CameraGrid({ cameras, icon }) {
|
|
|
675
378
|
] });
|
|
676
379
|
}
|
|
677
380
|
|
|
381
|
+
// src/ui/components/Glass.tsx
|
|
382
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
383
|
+
import { Camera as Camera2, Cctv, ChevronLeft, ChevronRight, Zap } from "lucide-react";
|
|
384
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
385
|
+
var RETRY_MS = 3e4;
|
|
386
|
+
function useSnapshotTick(ms) {
|
|
387
|
+
const [tick, setTick] = useState2(() => Date.now());
|
|
388
|
+
const [count, setCount] = useState2(0);
|
|
389
|
+
useEffect2(() => {
|
|
390
|
+
const id = setInterval(() => {
|
|
391
|
+
if (document.visibilityState !== "visible") return;
|
|
392
|
+
setTick(Date.now());
|
|
393
|
+
setCount((n) => n + 1);
|
|
394
|
+
}, ms);
|
|
395
|
+
return () => clearInterval(id);
|
|
396
|
+
}, [ms]);
|
|
397
|
+
return { tick, retry: Math.floor(count * ms / RETRY_MS) };
|
|
398
|
+
}
|
|
399
|
+
function GlassSnapshot({ cam, tick, retry }) {
|
|
400
|
+
const { client } = useSentinelUi();
|
|
401
|
+
const src = client.snapshotUrl(cam.id, tick, tileSnapshotWidth());
|
|
402
|
+
const fallback = cam.latestThumbId ? client.segmentThumbUrl(cam.latestThumbId) : null;
|
|
403
|
+
const [failed, setFailed] = useState2(0);
|
|
404
|
+
const now = useRef({ failed, src });
|
|
405
|
+
now.current = { failed, src };
|
|
406
|
+
useEffect2(() => {
|
|
407
|
+
if (now.current.failed === 0) return void 0;
|
|
408
|
+
const probe = new Image();
|
|
409
|
+
probe.crossOrigin = "anonymous";
|
|
410
|
+
probe.onload = () => setFailed(0);
|
|
411
|
+
probe.src = now.current.src;
|
|
412
|
+
return () => {
|
|
413
|
+
probe.onload = null;
|
|
414
|
+
};
|
|
415
|
+
}, [retry]);
|
|
416
|
+
const [last2, setLast] = useState2(() => hasLastTileSnapshot(cam.id));
|
|
417
|
+
const drawLast = useCallback2(
|
|
418
|
+
(canvas) => void (canvas && drawLastTileSnapshot(cam.id, canvas)),
|
|
419
|
+
[cam.id]
|
|
420
|
+
);
|
|
421
|
+
const url = failed === 0 ? src : failed === 1 && fallback ? fallback : null;
|
|
422
|
+
return url ? /* @__PURE__ */ jsxs3("span", { className: "nvr-camtile__pic", children: [
|
|
423
|
+
last2 && /* @__PURE__ */ jsx5("canvas", { className: "nvr-camtile__img nvr-camtile__img--last", ref: drawLast, "aria-hidden": "true" }),
|
|
424
|
+
/* @__PURE__ */ jsx5(
|
|
425
|
+
"img",
|
|
426
|
+
{
|
|
427
|
+
className: "nvr-camtile__img",
|
|
428
|
+
src: url,
|
|
429
|
+
alt: "",
|
|
430
|
+
crossOrigin: "anonymous",
|
|
431
|
+
onLoad: (e) => {
|
|
432
|
+
const img = e.currentTarget;
|
|
433
|
+
if (failed === 0) rememberTileSnapshot(cam.id, img);
|
|
434
|
+
if (!last2) return;
|
|
435
|
+
const drop = () => setLast(false);
|
|
436
|
+
if (typeof img.decode === "function") img.decode().then(drop, drop);
|
|
437
|
+
else drop();
|
|
438
|
+
},
|
|
439
|
+
onError: () => {
|
|
440
|
+
if (failed > 0 || !fallback) setLast(false);
|
|
441
|
+
setFailed((f) => Math.min(2, f + 1));
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] }) : /* @__PURE__ */ jsx5("span", { className: "nvr-camtile__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(Camera2, { size: 22, strokeWidth: 1.5 }) });
|
|
446
|
+
}
|
|
447
|
+
function GlassStrip({
|
|
448
|
+
className,
|
|
449
|
+
count,
|
|
450
|
+
children
|
|
451
|
+
}) {
|
|
452
|
+
const ref = useRef(null);
|
|
453
|
+
const [ends, setEnds] = useState2({ prev: false, next: false });
|
|
454
|
+
useEffect2(() => {
|
|
455
|
+
const el = ref.current;
|
|
456
|
+
if (!el) return void 0;
|
|
457
|
+
const update = () => {
|
|
458
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
459
|
+
const prev = el.scrollLeft > 1;
|
|
460
|
+
const next = el.scrollLeft < max - 1;
|
|
461
|
+
setEnds((o) => o.prev === prev && o.next === next ? o : { prev, next });
|
|
462
|
+
};
|
|
463
|
+
update();
|
|
464
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
465
|
+
const ro = typeof ResizeObserver === "function" ? new ResizeObserver(update) : null;
|
|
466
|
+
ro?.observe(el);
|
|
467
|
+
if (ro && el.firstElementChild) ro.observe(el.firstElementChild);
|
|
468
|
+
return () => {
|
|
469
|
+
el.removeEventListener("scroll", update);
|
|
470
|
+
ro?.disconnect();
|
|
471
|
+
};
|
|
472
|
+
}, [count]);
|
|
473
|
+
const go = (dir) => {
|
|
474
|
+
const el = ref.current;
|
|
475
|
+
if (!el) return;
|
|
476
|
+
const reduce = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
477
|
+
el.scrollBy({ left: dir * el.clientWidth * 0.8, behavior: reduce ? "auto" : "smooth" });
|
|
478
|
+
};
|
|
479
|
+
const paddle = (dir) => /* @__PURE__ */ jsx5(
|
|
480
|
+
"button",
|
|
481
|
+
{
|
|
482
|
+
type: "button",
|
|
483
|
+
className: "nvr-gl__paddle nvr-glass",
|
|
484
|
+
"data-dir": dir < 0 ? "prev" : "next",
|
|
485
|
+
tabIndex: -1,
|
|
486
|
+
"aria-hidden": "true",
|
|
487
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
488
|
+
onClick: () => go(dir),
|
|
489
|
+
children: dir < 0 ? /* @__PURE__ */ jsx5(ChevronLeft, { size: 20, strokeWidth: 2.25 }) : /* @__PURE__ */ jsx5(ChevronRight, { size: 20, strokeWidth: 2.25 })
|
|
490
|
+
}
|
|
491
|
+
);
|
|
492
|
+
return /* @__PURE__ */ jsxs3("div", { className: `nvr-gl__strip ${className}`, children: [
|
|
493
|
+
children(ref),
|
|
494
|
+
ends.prev && paddle(-1),
|
|
495
|
+
ends.next && paddle(1)
|
|
496
|
+
] });
|
|
497
|
+
}
|
|
498
|
+
function GlassCameras({ cameras, loading = false, refreshMs = 5e3 }) {
|
|
499
|
+
const { tick, retry } = useSnapshotTick(refreshMs);
|
|
500
|
+
return /* @__PURE__ */ jsx5(GlassCameraTiles, { cameras, loading, tick, retry });
|
|
501
|
+
}
|
|
502
|
+
function GlassCameraTiles({
|
|
503
|
+
cameras,
|
|
504
|
+
loading,
|
|
505
|
+
tick,
|
|
506
|
+
retry
|
|
507
|
+
}) {
|
|
508
|
+
const { t, nav } = useSentinelUi();
|
|
509
|
+
if (cameras.length === 0) {
|
|
510
|
+
return loading ? /* @__PURE__ */ jsx5("div", { className: "nvr-gl__cams", "aria-hidden": "true", children: /* @__PURE__ */ jsx5("div", { className: "nvr-gl__wait" }) }) : /* @__PURE__ */ jsx5("p", { className: "nvr-gl__empty", children: t("nvr.cameras.none") });
|
|
511
|
+
}
|
|
512
|
+
return /* @__PURE__ */ jsx5(GlassStrip, { className: "nvr-gl__strip--cams", count: cameras.length, children: (ref) => /* @__PURE__ */ jsx5(
|
|
513
|
+
"div",
|
|
514
|
+
{
|
|
515
|
+
ref,
|
|
516
|
+
className: "nvr-gl__cams",
|
|
517
|
+
role: "list",
|
|
518
|
+
"aria-label": t("nvr.cameras.title"),
|
|
519
|
+
"data-several": cameras.length > 1 ? "" : void 0,
|
|
520
|
+
children: cameras.map((c) => {
|
|
521
|
+
const rec = sentinelRecordingState(c);
|
|
522
|
+
const state = rec === "ok" ? t("nvr.cameras.live") : rec === "offline" ? t("nvr.cameras.offline") : rec === "stalled" ? t("nvr.cameras.stalled") : null;
|
|
523
|
+
const today = [
|
|
524
|
+
t("nvr.cameras.eventsToday", { count: c.eventsToday }),
|
|
525
|
+
c.lastEventTs ? fmtRelative(c.lastEventTs, t) : null
|
|
526
|
+
].filter(Boolean).join(" \xB7 ");
|
|
527
|
+
return /* @__PURE__ */ jsx5("div", { role: "listitem", className: "nvr-gl__cam-item", children: /* @__PURE__ */ jsxs3(
|
|
528
|
+
"button",
|
|
529
|
+
{
|
|
530
|
+
type: "button",
|
|
531
|
+
className: "nvr-gl__cam",
|
|
532
|
+
"data-state": rec,
|
|
533
|
+
"data-nvr-camera": c.id,
|
|
534
|
+
onClick: () => nav.openCamera(c.id),
|
|
535
|
+
"aria-label": [c.name, state, today].filter(Boolean).join(", "),
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ jsx5(GlassSnapshot, { cam: c, tick, retry }),
|
|
538
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__shade", "aria-hidden": "true" }),
|
|
539
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__pill nvr-glass nvr-glass--clear", "aria-hidden": "true", children: [
|
|
540
|
+
rec !== "off" && /* @__PURE__ */ jsx5("span", { className: "nvr-gl__dot" }),
|
|
541
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__pill-text", children: state ? `${c.name} \xB7 ${state}` : c.name })
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__caption", "aria-hidden": "true", children: [
|
|
544
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__title", children: [
|
|
545
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__name", children: c.name }),
|
|
546
|
+
state && /* @__PURE__ */ jsx5("span", { className: "nvr-gl__badge", children: rec === "ok" ? t("nvr.live") : state })
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__today", children: today })
|
|
549
|
+
] })
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
) }, c.id);
|
|
553
|
+
})
|
|
554
|
+
}
|
|
555
|
+
) });
|
|
556
|
+
}
|
|
557
|
+
function GlassEvents({ events, several }) {
|
|
558
|
+
const { client, t, locale, nav } = useSentinelUi();
|
|
559
|
+
if (events.length === 0) return null;
|
|
560
|
+
const now = Date.now();
|
|
561
|
+
return /* @__PURE__ */ jsx5(GlassStrip, { className: "nvr-gl__strip--events", count: events.length, children: (ref) => /* @__PURE__ */ jsx5("ul", { ref, className: "nvr-gl__events", "aria-label": t("nvr.events.title"), children: events.map((e) => {
|
|
562
|
+
const day = fmtDayPrefix(e.ts, locale, now);
|
|
563
|
+
const time = fmtTime(e.ts, locale);
|
|
564
|
+
return /* @__PURE__ */ jsx5("li", { className: "nvr-gl__ev-item", children: /* @__PURE__ */ jsxs3(
|
|
565
|
+
"button",
|
|
566
|
+
{
|
|
567
|
+
type: "button",
|
|
568
|
+
className: "nvr-gl__ev",
|
|
569
|
+
onClick: () => nav.openCamera(e.camera, sentinelEventPlayTs(e), e.ts),
|
|
570
|
+
children: [
|
|
571
|
+
/* @__PURE__ */ jsx5("img", { className: "nvr-gl__ev-img", src: client.eventThumbUrl(e.camera, e.ts), alt: "", loading: "lazy" }),
|
|
572
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-text", children: [
|
|
573
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-time", children: [
|
|
574
|
+
day && /* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-day", children: [
|
|
575
|
+
day,
|
|
576
|
+
" "
|
|
577
|
+
] }),
|
|
578
|
+
time
|
|
579
|
+
] }),
|
|
580
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-sub", children: [
|
|
581
|
+
eventLabel(t, e),
|
|
582
|
+
several && ` \xB7 ${e.cameraName}`,
|
|
583
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-ago", children: [
|
|
584
|
+
" \xB7 ",
|
|
585
|
+
fmtRelative(e.ts, t)
|
|
586
|
+
] })
|
|
587
|
+
] })
|
|
588
|
+
] })
|
|
589
|
+
]
|
|
590
|
+
}
|
|
591
|
+
) }, `${e.camera}-${e.ts}`);
|
|
592
|
+
}) }) });
|
|
593
|
+
}
|
|
594
|
+
function GlassNvr({ cameras, events, loading = false, refreshMs = 5e3 }) {
|
|
595
|
+
return /* @__PURE__ */ jsxs3("div", { className: "nvr-gl", children: [
|
|
596
|
+
/* @__PURE__ */ jsx5(GlassCameras, { cameras, loading, refreshMs }),
|
|
597
|
+
/* @__PURE__ */ jsx5(GlassEvents, { events, several: cameras.length > 1 })
|
|
598
|
+
] });
|
|
599
|
+
}
|
|
600
|
+
function GlassSections({ cameras, events }) {
|
|
601
|
+
const { t } = useSentinelUi();
|
|
602
|
+
return /* @__PURE__ */ jsxs3("div", { className: "nvr-gl-page", children: [
|
|
603
|
+
/* @__PURE__ */ jsxs3("section", { className: "nvr-section nvr-gl-page__cams", children: [
|
|
604
|
+
/* @__PURE__ */ jsxs3("h2", { className: "nvr-section__label", children: [
|
|
605
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-section__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(Cctv, { size: 18, strokeWidth: 2 }) }),
|
|
606
|
+
t("nvr.cameras.title")
|
|
607
|
+
] }),
|
|
608
|
+
/* @__PURE__ */ jsx5(GlassCameras, { cameras })
|
|
609
|
+
] }),
|
|
610
|
+
events.length > 0 && /* @__PURE__ */ jsxs3("section", { className: "nvr-section nvr-gl-page__events", children: [
|
|
611
|
+
/* @__PURE__ */ jsxs3("h2", { className: "nvr-section__label", children: [
|
|
612
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-section__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(Zap, { size: 18, strokeWidth: 2 }) }),
|
|
613
|
+
t("nvr.events.title")
|
|
614
|
+
] }),
|
|
615
|
+
/* @__PURE__ */ jsx5("div", { className: "nvr-gl-page__list", children: /* @__PURE__ */ jsx5(GlassEvents, { events, several: cameras.length > 1 }) })
|
|
616
|
+
] })
|
|
617
|
+
] });
|
|
618
|
+
}
|
|
619
|
+
|
|
678
620
|
// src/ui/outside.ts
|
|
679
621
|
function isIosHomeScreenApp(nav = globalThis.navigator ?? {}) {
|
|
680
622
|
return nav.standalone === true;
|
|
@@ -696,7 +638,7 @@ function outsideAppHref(url, env = {
|
|
|
696
638
|
// src/ui/components/EventList.tsx
|
|
697
639
|
import { Fragment as Fragment3 } from "react";
|
|
698
640
|
import { Download } from "lucide-react";
|
|
699
|
-
import { Fragment as Fragment4, jsx as
|
|
641
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
700
642
|
function EventList({
|
|
701
643
|
camId,
|
|
702
644
|
events,
|
|
@@ -706,30 +648,30 @@ function EventList({
|
|
|
706
648
|
}) {
|
|
707
649
|
const { client, t, locale } = useSentinelUi();
|
|
708
650
|
const evs = events.filter((e) => !sentinelEventHidden(e, filterOff)).slice().sort((a, b) => b.timestamp - a.timestamp);
|
|
709
|
-
if (!evs.length) return /* @__PURE__ */
|
|
651
|
+
if (!evs.length) return /* @__PURE__ */ jsx6("p", { className: "nvr-muted nvr-evlist__empty", children: t("nvr.events.none") });
|
|
710
652
|
let lastDay = "";
|
|
711
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ jsx6("div", { className: "nvr-evlist", children: evs.map((ev) => {
|
|
712
654
|
const d = new Date(ev.timestamp).toDateString();
|
|
713
655
|
const head = d !== lastDay;
|
|
714
656
|
lastDay = d;
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
head && /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
658
|
+
head && /* @__PURE__ */ jsx6("div", { className: "nvr-evlist__day nvr-data", children: fmtDay(ev.timestamp, locale) }),
|
|
659
|
+
/* @__PURE__ */ jsxs4("div", { className: "nvr-evrow-wrap" + (onClip ? " nvr-evrow-wrap--clip" : ""), children: [
|
|
660
|
+
/* @__PURE__ */ jsxs4("button", { type: "button", className: "nvr-evrow", onClick: () => onPick(ev), children: [
|
|
661
|
+
/* @__PURE__ */ jsx6("img", { className: "nvr-evrow__img", src: client.eventThumbUrl(camId, ev.timestamp), alt: "", loading: "lazy" }),
|
|
662
|
+
/* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__text", children: [
|
|
663
|
+
/* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__cls", children: [
|
|
664
|
+
/* @__PURE__ */ jsx6(EventBadges, { ev, size: 16, t }),
|
|
723
665
|
" ",
|
|
724
666
|
eventLabel(t, ev)
|
|
725
667
|
] }),
|
|
726
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__t nvr-data", children: [
|
|
727
669
|
fmtTimeSec(ev.timestamp, locale),
|
|
728
|
-
/* @__PURE__ */
|
|
670
|
+
/* @__PURE__ */ jsx6(EventSpanNote, { ev, t })
|
|
729
671
|
] })
|
|
730
672
|
] })
|
|
731
673
|
] }),
|
|
732
|
-
onClip && /* @__PURE__ */
|
|
674
|
+
onClip && /* @__PURE__ */ jsx6(
|
|
733
675
|
"button",
|
|
734
676
|
{
|
|
735
677
|
type: "button",
|
|
@@ -737,7 +679,7 @@ function EventList({
|
|
|
737
679
|
"aria-label": `${t("nvr.clip.event")} ${fmtTimeSec(ev.timestamp, locale)}`,
|
|
738
680
|
title: t("nvr.clip.event"),
|
|
739
681
|
onClick: () => onClip(ev),
|
|
740
|
-
children: /* @__PURE__ */
|
|
682
|
+
children: /* @__PURE__ */ jsx6(Download, { size: 16 })
|
|
741
683
|
}
|
|
742
684
|
)
|
|
743
685
|
] })
|
|
@@ -747,25 +689,25 @@ function EventList({
|
|
|
747
689
|
function EventSpanNote({ ev, t }) {
|
|
748
690
|
const sp = sentinelEventSpan(ev);
|
|
749
691
|
if (!sp) return null;
|
|
750
|
-
return sp.open ? /* @__PURE__ */
|
|
692
|
+
return sp.open ? /* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__open", children: [
|
|
751
693
|
" \xB7 ",
|
|
752
694
|
t("nvr.events.running")
|
|
753
|
-
] }) : /* @__PURE__ */
|
|
695
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
754
696
|
" \xB7 ",
|
|
755
697
|
sentinelDuration(sp.end - sp.start)
|
|
756
698
|
] });
|
|
757
699
|
}
|
|
758
700
|
|
|
759
701
|
// src/ui/components/DatePickerPanel.tsx
|
|
760
|
-
import { useState as
|
|
761
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
762
|
-
import { Fragment as Fragment5, jsx as
|
|
702
|
+
import { useState as useState3 } from "react";
|
|
703
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
704
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
763
705
|
function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
764
706
|
const { t, locale } = useSentinelUi();
|
|
765
707
|
const base = new Date(dayStart);
|
|
766
|
-
const [view, setView] =
|
|
767
|
-
const [sel, setSel] =
|
|
768
|
-
const [time, setTime] =
|
|
708
|
+
const [view, setView] = useState3(new Date(base.getFullYear(), base.getMonth(), 1));
|
|
709
|
+
const [sel, setSel] = useState3(new Date(base.getFullYear(), base.getMonth(), base.getDate()));
|
|
710
|
+
const [time, setTime] = useState3(hhmmInput(timeTs));
|
|
769
711
|
const y = view.getFullYear(), m = view.getMonth();
|
|
770
712
|
const startIdx = (new Date(y, m, 1).getDay() + 6) % 7;
|
|
771
713
|
const dim = new Date(y, m + 1, 0).getDate();
|
|
@@ -790,33 +732,33 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
790
732
|
setView(new Date(n.getFullYear(), n.getMonth(), 1));
|
|
791
733
|
setSel(new Date(n.getFullYear(), n.getMonth(), n.getDate()));
|
|
792
734
|
};
|
|
793
|
-
const grid = /* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
735
|
+
const grid = /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
736
|
+
/* @__PURE__ */ jsxs5("div", { className: "nvr-dt__head", children: [
|
|
737
|
+
/* @__PURE__ */ jsx7(
|
|
796
738
|
"button",
|
|
797
739
|
{
|
|
798
740
|
type: "button",
|
|
799
741
|
className: "nvr-dt__nav",
|
|
800
742
|
onClick: () => setView(new Date(y, m - 1, 1)),
|
|
801
743
|
"aria-label": t("nvr.date.prevMonth"),
|
|
802
|
-
children: /* @__PURE__ */
|
|
744
|
+
children: /* @__PURE__ */ jsx7(ChevronLeft2, { size: 18 })
|
|
803
745
|
}
|
|
804
746
|
),
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ jsx7("span", { className: "nvr-dt__month", children: fmtMonthYear(view.getTime(), locale) }),
|
|
748
|
+
/* @__PURE__ */ jsx7(
|
|
807
749
|
"button",
|
|
808
750
|
{
|
|
809
751
|
type: "button",
|
|
810
752
|
className: "nvr-dt__nav",
|
|
811
753
|
onClick: () => setView(new Date(y, m + 1, 1)),
|
|
812
754
|
"aria-label": t("nvr.date.nextMonth"),
|
|
813
|
-
children: /* @__PURE__ */
|
|
755
|
+
children: /* @__PURE__ */ jsx7(ChevronRight2, { size: 18 })
|
|
814
756
|
}
|
|
815
757
|
)
|
|
816
758
|
] }),
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
weekdayShorts(locale).map((w) => /* @__PURE__ */
|
|
819
|
-
cells.map((c, i) => /* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ jsxs5("div", { className: "nvr-dt__grid", children: [
|
|
760
|
+
weekdayShorts(locale).map((w) => /* @__PURE__ */ jsx7("span", { className: "nvr-dt__wd", children: w }, w)),
|
|
761
|
+
cells.map((c, i) => /* @__PURE__ */ jsx7(
|
|
820
762
|
"button",
|
|
821
763
|
{
|
|
822
764
|
type: "button",
|
|
@@ -829,9 +771,9 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
829
771
|
))
|
|
830
772
|
] })
|
|
831
773
|
] });
|
|
832
|
-
const footer = /* @__PURE__ */
|
|
833
|
-
/* @__PURE__ */
|
|
834
|
-
/* @__PURE__ */
|
|
774
|
+
const footer = /* @__PURE__ */ jsxs5("div", { className: "nvr-dt__foot", children: [
|
|
775
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "nvr-btn nvr-btn--ghost", onClick: goToday, children: t("nvr.date.today") }),
|
|
776
|
+
/* @__PURE__ */ jsx7(
|
|
835
777
|
"input",
|
|
836
778
|
{
|
|
837
779
|
className: "nvr-input nvr-dt__time nvr-data",
|
|
@@ -844,21 +786,22 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
844
786
|
"aria-label": t("nvr.date.time")
|
|
845
787
|
}
|
|
846
788
|
),
|
|
847
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "nvr-btn nvr-btn--primary", onClick: submit, children: t("nvr.date.go") })
|
|
848
790
|
] });
|
|
849
791
|
return { grid, footer, submit, goToday };
|
|
850
792
|
}
|
|
851
793
|
function DatePickerPanel(props) {
|
|
852
794
|
const { grid, footer } = useDatePicker(props);
|
|
853
|
-
return /* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ jsxs5("div", { className: "nvr-dt", children: [
|
|
854
796
|
grid,
|
|
855
797
|
footer
|
|
856
798
|
] });
|
|
857
799
|
}
|
|
858
800
|
|
|
859
801
|
// src/ui/components/Stats.tsx
|
|
860
|
-
import {
|
|
861
|
-
import {
|
|
802
|
+
import { Fragment as Fragment6 } from "react";
|
|
803
|
+
import { Cctv as Cctv2, Video, Database, Clock, Zap as Zap2, Gauge, BarChart3, HardDrive, CalendarClock, CircleDot } from "lucide-react";
|
|
804
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
862
805
|
function StatTile({
|
|
863
806
|
icon,
|
|
864
807
|
label,
|
|
@@ -866,13 +809,13 @@ function StatTile({
|
|
|
866
809
|
unit,
|
|
867
810
|
tone = "neutral"
|
|
868
811
|
}) {
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsxs6("div", { className: `nvr-stat nvr-stat--${tone}`, children: [
|
|
813
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-stat__icon", "aria-hidden": "true", children: icon }),
|
|
814
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-stat__body", children: [
|
|
815
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-stat__label", children: label }),
|
|
816
|
+
/* @__PURE__ */ jsxs6("span", { className: "nvr-stat__value nvr-data", children: [
|
|
874
817
|
value,
|
|
875
|
-
unit && /* @__PURE__ */
|
|
818
|
+
unit && /* @__PURE__ */ jsxs6("span", { className: "nvr-stat__unit", children: [
|
|
876
819
|
" ",
|
|
877
820
|
unit
|
|
878
821
|
] })
|
|
@@ -887,16 +830,24 @@ function CardTitle({
|
|
|
887
830
|
tone = "accent",
|
|
888
831
|
action
|
|
889
832
|
}) {
|
|
890
|
-
return /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
sub && /* @__PURE__ */
|
|
833
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-ctitle", children: [
|
|
834
|
+
/* @__PURE__ */ jsx8("span", { className: `nvr-ctitle__chip nvr-ctitle__chip--${tone}`, "aria-hidden": "true", children: icon }),
|
|
835
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-ctitle__text", children: [
|
|
836
|
+
/* @__PURE__ */ jsx8("div", { className: "nvr-ctitle__title", children: title }),
|
|
837
|
+
sub && /* @__PURE__ */ jsx8("div", { className: "nvr-ctitle__sub", children: sub })
|
|
895
838
|
] }),
|
|
896
|
-
action && /* @__PURE__ */
|
|
839
|
+
action && /* @__PURE__ */ jsx8("div", { className: "nvr-ctitle__action", children: action })
|
|
897
840
|
] });
|
|
898
841
|
}
|
|
899
|
-
function Hero({
|
|
842
|
+
function Hero({
|
|
843
|
+
cameras,
|
|
844
|
+
stats,
|
|
845
|
+
appearance
|
|
846
|
+
}) {
|
|
847
|
+
if (appearance === "glass") return /* @__PURE__ */ jsx8(GlassHero, { cameras, stats });
|
|
848
|
+
return /* @__PURE__ */ jsx8(ClassicHero, { cameras, stats });
|
|
849
|
+
}
|
|
850
|
+
function ClassicHero({ cameras, stats }) {
|
|
900
851
|
const { t, locale } = useSentinelUi();
|
|
901
852
|
const stalled = cameras.filter((c) => sentinelRecordingState(c) === "stalled").length;
|
|
902
853
|
const online = cameras.filter((c) => c.online || sentinelRecordingState(c) === "stalled").length;
|
|
@@ -908,62 +859,62 @@ function Hero({ cameras, stats }) {
|
|
|
908
859
|
const fc = sentinelStorageForecast(stats);
|
|
909
860
|
const bytes = sentinelHumanBytes(stats.bytes, locale);
|
|
910
861
|
const span = fc.spanDays ? fmtDays(fc.spanDays, t).split(" ") : ["\u2013"];
|
|
911
|
-
return /* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-card nvr-hero", children: [
|
|
863
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-hero__head", children: [
|
|
864
|
+
/* @__PURE__ */ jsx8(CardTitle, { icon: /* @__PURE__ */ jsx8(Gauge, { size: 16, strokeWidth: 1.75 }), title: t("nvr.hero.title"), sub: t("nvr.hero.sub") }),
|
|
914
865
|
stats.storageOk === false ? (
|
|
915
866
|
// storage guard: the share is gone — nothing is recorded until it is back (outranks the camera status)
|
|
916
|
-
/* @__PURE__ */
|
|
917
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ jsxs6("span", { className: "nvr-pill nvr-pill--danger", title: stats.storageProblem, children: [
|
|
868
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
918
869
|
t("nvr.hero.storageProblem")
|
|
919
870
|
] })
|
|
920
|
-
) : /* @__PURE__ */
|
|
921
|
-
/* @__PURE__ */
|
|
871
|
+
) : /* @__PURE__ */ jsxs6("span", { className: `nvr-pill ${problems.length ? "nvr-pill--danger" : "nvr-pill--positive"}`, children: [
|
|
872
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
922
873
|
problems.length ? problems.join(" \xB7 ") : t("nvr.hero.allOnline")
|
|
923
874
|
] })
|
|
924
875
|
] }),
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-hero__primary", children: [
|
|
877
|
+
/* @__PURE__ */ jsxs6("span", { className: "nvr-hero__primary-label", children: [
|
|
878
|
+
/* @__PURE__ */ jsx8(Zap2, { size: 14, strokeWidth: 2 }),
|
|
928
879
|
t("nvr.hero.eventsToday")
|
|
929
880
|
] }),
|
|
930
|
-
/* @__PURE__ */
|
|
881
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-hero__primary-value nvr-data", children: fmtCount(stats.eventsToday, locale) })
|
|
931
882
|
] }),
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-hero__stats", children: [
|
|
884
|
+
/* @__PURE__ */ jsx8(
|
|
934
885
|
StatTile,
|
|
935
886
|
{
|
|
936
|
-
icon: /* @__PURE__ */
|
|
887
|
+
icon: /* @__PURE__ */ jsx8(Cctv2, { size: 16, strokeWidth: 1.75 }),
|
|
937
888
|
label: t("nvr.hero.camerasOnline"),
|
|
938
889
|
value: `${online}`,
|
|
939
890
|
unit: `/ ${stats.cameras}`,
|
|
940
891
|
tone: offline > 0 ? "danger" : "positive"
|
|
941
892
|
}
|
|
942
893
|
),
|
|
943
|
-
/* @__PURE__ */
|
|
894
|
+
/* @__PURE__ */ jsx8(
|
|
944
895
|
StatTile,
|
|
945
896
|
{
|
|
946
|
-
icon: /* @__PURE__ */
|
|
897
|
+
icon: /* @__PURE__ */ jsx8(Video, { size: 16, strokeWidth: 1.75 }),
|
|
947
898
|
label: t("nvr.hero.recording"),
|
|
948
899
|
value: `${stats.recording}`,
|
|
949
900
|
unit: `/ ${stats.cameras}`,
|
|
950
901
|
tone: "accent"
|
|
951
902
|
}
|
|
952
903
|
),
|
|
953
|
-
/* @__PURE__ */
|
|
904
|
+
/* @__PURE__ */ jsx8(
|
|
954
905
|
StatTile,
|
|
955
906
|
{
|
|
956
|
-
icon: /* @__PURE__ */
|
|
907
|
+
icon: /* @__PURE__ */ jsx8(Database, { size: 16, strokeWidth: 1.75 }),
|
|
957
908
|
label: t("nvr.hero.storageUsed"),
|
|
958
909
|
value: bytes.value,
|
|
959
910
|
unit: bytes.unit,
|
|
960
911
|
tone: "info"
|
|
961
912
|
}
|
|
962
913
|
),
|
|
963
|
-
/* @__PURE__ */
|
|
914
|
+
/* @__PURE__ */ jsx8(
|
|
964
915
|
StatTile,
|
|
965
916
|
{
|
|
966
|
-
icon: /* @__PURE__ */
|
|
917
|
+
icon: /* @__PURE__ */ jsx8(Clock, { size: 16, strokeWidth: 1.75 }),
|
|
967
918
|
label: t("nvr.hero.retention"),
|
|
968
919
|
value: span[0] ?? "\u2013",
|
|
969
920
|
unit: span.slice(1).join(" ") || void 0
|
|
@@ -972,35 +923,121 @@ function Hero({ cameras, stats }) {
|
|
|
972
923
|
] })
|
|
973
924
|
] });
|
|
974
925
|
}
|
|
926
|
+
var TAFEL_ICON = 15;
|
|
927
|
+
function splitCount(text) {
|
|
928
|
+
const m = /^(\d+)\s+(.+)$/.exec(text);
|
|
929
|
+
return m ? { value: m[1], unit: m[2] } : { value: text };
|
|
930
|
+
}
|
|
931
|
+
function GlassHero({ cameras, stats }) {
|
|
932
|
+
const { t, locale } = useSentinelUi();
|
|
933
|
+
const stalled = cameras.filter((c) => sentinelRecordingState(c) === "stalled").length;
|
|
934
|
+
const online = cameras.filter((c) => c.online || sentinelRecordingState(c) === "stalled").length;
|
|
935
|
+
const offline = Math.max(0, stats.cameras - online);
|
|
936
|
+
const problems = [
|
|
937
|
+
offline > 0 ? t("nvr.hero.offline", { count: offline }) : null,
|
|
938
|
+
stalled > 0 ? t("nvr.hero.stalled", { count: stalled }) : null
|
|
939
|
+
].filter((p) => p !== null);
|
|
940
|
+
const storageLost = stats.storageOk === false;
|
|
941
|
+
const ok = !storageLost && problems.length === 0;
|
|
942
|
+
const parts = storageLost ? [t("nvr.hero.storageProblem")] : ok ? [t("nvr.hero.allOnline")] : problems;
|
|
943
|
+
const fc = sentinelStorageForecast(stats);
|
|
944
|
+
const bytes = sentinelHumanBytes(stats.bytes, locale);
|
|
945
|
+
const retention = fc.spanDays ? splitCount(fmtDays(fc.spanDays, t)) : { value: "\u2013" };
|
|
946
|
+
const tone = ok ? "ok" : "danger";
|
|
947
|
+
const items = [
|
|
948
|
+
{
|
|
949
|
+
key: "events",
|
|
950
|
+
icon: /* @__PURE__ */ jsx8(Zap2, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
951
|
+
label: t("nvr.hero.eventsToday"),
|
|
952
|
+
value: fmtCount(stats.eventsToday, locale),
|
|
953
|
+
tone: "none"
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
key: "recording",
|
|
957
|
+
icon: /* @__PURE__ */ jsx8(CircleDot, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
958
|
+
label: t("nvr.hero.recording"),
|
|
959
|
+
value: `${fmtCount(stats.recording, locale)}/${fmtCount(stats.cameras, locale)}`,
|
|
960
|
+
tone: "none"
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
key: "storage",
|
|
964
|
+
icon: /* @__PURE__ */ jsx8(HardDrive, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
965
|
+
label: t("nvr.hero.storageUsed"),
|
|
966
|
+
value: bytes.value,
|
|
967
|
+
unit: bytes.unit,
|
|
968
|
+
tone: "none"
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
key: "retention",
|
|
972
|
+
icon: /* @__PURE__ */ jsx8(CalendarClock, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
973
|
+
label: t("nvr.hero.retention"),
|
|
974
|
+
value: retention.value,
|
|
975
|
+
...retention.unit ? { unit: retention.unit } : {},
|
|
976
|
+
// the retention target out of reach: the storage card says why
|
|
977
|
+
tone: fc.status === "unreachable" ? "warn" : "none"
|
|
978
|
+
}
|
|
979
|
+
];
|
|
980
|
+
return /* @__PURE__ */ jsxs6("div", { className: `nvr-card nvr-tafel nvr-tafel--${ok ? "ok" : "problem"}`, children: [
|
|
981
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-tafel__head", children: [
|
|
982
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-tafel__badge", "data-tone": tone, "aria-hidden": "true", children: /* @__PURE__ */ jsx8(Cctv2, { size: 28, strokeWidth: 1.75 }) }),
|
|
983
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-tafel__head-text", children: [
|
|
984
|
+
/* @__PURE__ */ jsx8("p", { className: "nvr-tafel__kicker", children: t("nvr.hero.title") }),
|
|
985
|
+
/* @__PURE__ */ jsx8("p", { className: "nvr-tafel__title", "data-tone": tone, title: storageLost ? stats.storageProblem : void 0, children: parts.map((part, i) => /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
986
|
+
i > 0 && " \xB7 ",
|
|
987
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-tafel__part", children: part })
|
|
988
|
+
] }, i)) })
|
|
989
|
+
] })
|
|
990
|
+
] }),
|
|
991
|
+
/* @__PURE__ */ jsx8(
|
|
992
|
+
"dl",
|
|
993
|
+
{
|
|
994
|
+
className: "nvr-tafel__grid",
|
|
995
|
+
"data-kind": "number",
|
|
996
|
+
"data-min": 130,
|
|
997
|
+
style: { "--nvr-tafel-min": "130px", "--nvr-tafel-max": 4 },
|
|
998
|
+
children: items.map((f) => /* @__PURE__ */ jsxs6("div", { className: "nvr-tafel__cell", "data-tone": f.tone, "data-tafel": f.key, children: [
|
|
999
|
+
/* @__PURE__ */ jsxs6("dt", { className: "nvr-tafel__label", children: [
|
|
1000
|
+
f.icon,
|
|
1001
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-tafel__label-text", children: f.label })
|
|
1002
|
+
] }),
|
|
1003
|
+
/* @__PURE__ */ jsxs6("dd", { className: "nvr-tafel__value", children: [
|
|
1004
|
+
f.value,
|
|
1005
|
+
f.unit && /* @__PURE__ */ jsx8("span", { className: "nvr-tafel__unit", children: `\xA0${f.unit}` })
|
|
1006
|
+
] })
|
|
1007
|
+
] }, f.key))
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
] });
|
|
1011
|
+
}
|
|
975
1012
|
function HistogramCard({ histogram }) {
|
|
976
1013
|
const { t } = useSentinelUi();
|
|
977
1014
|
const buckets = histogram.length === 24 ? histogram : Array.from({ length: 24 }, (_, i) => histogram[i] ?? 0);
|
|
978
1015
|
const max = Math.max(1, ...buckets);
|
|
979
1016
|
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
980
|
-
return /* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-card nvr-card--pad nvr-statcard", children: [
|
|
1018
|
+
/* @__PURE__ */ jsx8(
|
|
982
1019
|
CardTitle,
|
|
983
1020
|
{
|
|
984
|
-
icon: /* @__PURE__ */
|
|
1021
|
+
icon: /* @__PURE__ */ jsx8(BarChart3, { size: 16, strokeWidth: 1.75 }),
|
|
985
1022
|
title: t("nvr.histogram.title"),
|
|
986
1023
|
sub: t("nvr.histogram.sub")
|
|
987
1024
|
}
|
|
988
1025
|
),
|
|
989
|
-
/* @__PURE__ */
|
|
1026
|
+
/* @__PURE__ */ jsx8("div", { className: "nvr-chart", role: "img", "aria-label": t("nvr.histogram.title"), children: buckets.map((v, i) => /* @__PURE__ */ jsx8(
|
|
990
1027
|
"div",
|
|
991
1028
|
{
|
|
992
1029
|
className: `nvr-chart__col${i === hour ? " nvr-chart__col--now" : ""}`,
|
|
993
1030
|
title: `${String(i).padStart(2, "0")}:00 \u2013 ${v}`,
|
|
994
|
-
children: /* @__PURE__ */
|
|
1031
|
+
children: /* @__PURE__ */ jsx8("div", { className: "nvr-chart__bar", style: { height: `${v / max * 100}%` } })
|
|
995
1032
|
},
|
|
996
1033
|
i
|
|
997
1034
|
)) }),
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-chart__axis nvr-data", children: [
|
|
1036
|
+
/* @__PURE__ */ jsx8("span", { children: "00" }),
|
|
1037
|
+
/* @__PURE__ */ jsx8("span", { children: "06" }),
|
|
1038
|
+
/* @__PURE__ */ jsx8("span", { children: "12" }),
|
|
1039
|
+
/* @__PURE__ */ jsx8("span", { children: "18" }),
|
|
1040
|
+
/* @__PURE__ */ jsx8("span", { children: "24" })
|
|
1004
1041
|
] })
|
|
1005
1042
|
] });
|
|
1006
1043
|
}
|
|
@@ -1026,83 +1063,83 @@ function StorageCard({ stats }) {
|
|
|
1026
1063
|
default:
|
|
1027
1064
|
note = t("nvr.storage.note.unknown");
|
|
1028
1065
|
}
|
|
1029
|
-
return /* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1066
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-card nvr-card--pad nvr-statcard", children: [
|
|
1067
|
+
/* @__PURE__ */ jsx8(
|
|
1031
1068
|
CardTitle,
|
|
1032
1069
|
{
|
|
1033
|
-
icon: /* @__PURE__ */
|
|
1070
|
+
icon: /* @__PURE__ */ jsx8(HardDrive, { size: 16, strokeWidth: 1.75 }),
|
|
1034
1071
|
title: t("nvr.storage.title"),
|
|
1035
1072
|
sub: t("nvr.storage.sub"),
|
|
1036
1073
|
tone: "info"
|
|
1037
1074
|
}
|
|
1038
1075
|
),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-meter", role: "img", "aria-label": t("nvr.storage.title"), children: [
|
|
1077
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-meter__rec", style: { width: pct(stats.bytes) } }),
|
|
1078
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-meter__other", style: { left: pct(stats.bytes), width: pct(fc.other) } }),
|
|
1079
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-meter__reserve", style: { width: pct(reserveShown) } })
|
|
1043
1080
|
] }),
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-legend", children: [
|
|
1082
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1083
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--rec" }),
|
|
1047
1084
|
t("nvr.storage.recordings"),
|
|
1048
1085
|
" ",
|
|
1049
1086
|
humanBytes(stats.bytes, locale)
|
|
1050
1087
|
] }),
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1089
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--other" }),
|
|
1053
1090
|
t("nvr.storage.system"),
|
|
1054
1091
|
" ",
|
|
1055
1092
|
humanBytes(fc.other, locale)
|
|
1056
1093
|
] }),
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1094
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1095
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--free" }),
|
|
1059
1096
|
t("nvr.storage.free"),
|
|
1060
1097
|
" ",
|
|
1061
1098
|
humanBytes(stats.diskFree, locale)
|
|
1062
1099
|
] }),
|
|
1063
|
-
/* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
1100
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1101
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--reserve" }),
|
|
1065
1102
|
t("nvr.storage.reserve"),
|
|
1066
1103
|
" ",
|
|
1067
1104
|
humanBytes(fc.reserve, locale)
|
|
1068
1105
|
] })
|
|
1069
1106
|
] }),
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ jsxs6("ul", { className: "nvr-kv", children: [
|
|
1108
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1109
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.rate") }),
|
|
1110
|
+
/* @__PURE__ */ jsx8("b", { className: "nvr-data", children: fc.ratePerDay ? t("nvr.storage.perDay", { value: humanBytes(fc.ratePerDay, locale) }) : "\u2013" })
|
|
1074
1111
|
] }),
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
1112
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1113
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.capacity") }),
|
|
1114
|
+
/* @__PURE__ */ jsxs6("b", { className: "nvr-data", children: [
|
|
1078
1115
|
humanBytes(fc.capacity, locale),
|
|
1079
|
-
fc.ratePerDay ? /* @__PURE__ */
|
|
1116
|
+
fc.ratePerDay ? /* @__PURE__ */ jsxs6("em", { children: [
|
|
1080
1117
|
" \u2248 ",
|
|
1081
1118
|
fmtDays(fc.fitsDays, t)
|
|
1082
1119
|
] }) : null
|
|
1083
1120
|
] })
|
|
1084
1121
|
] }),
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1122
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1123
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.retention") }),
|
|
1124
|
+
/* @__PURE__ */ jsxs6("b", { className: "nvr-data", children: [
|
|
1088
1125
|
fc.spanDays ? `~${fmtDays(fc.spanDays, t)}` : "\u2013",
|
|
1089
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsxs6("em", { children: [
|
|
1090
1127
|
" / ",
|
|
1091
1128
|
t("nvr.storage.target", { days: stats.retentionDays })
|
|
1092
1129
|
] })
|
|
1093
1130
|
] })
|
|
1094
1131
|
] }),
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1133
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.segments") }),
|
|
1134
|
+
/* @__PURE__ */ jsx8("b", { className: "nvr-data", children: fmtCount(stats.segments, locale) })
|
|
1098
1135
|
] })
|
|
1099
1136
|
] }),
|
|
1100
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ jsx8("p", { className: `nvr-note${fc.status === "unreachable" ? " nvr-note--warn" : ""}`, children: note })
|
|
1101
1138
|
] });
|
|
1102
1139
|
}
|
|
1103
1140
|
|
|
1104
1141
|
// src/ui/components/VerticalTimeline.tsx
|
|
1105
|
-
import { useEffect as
|
|
1142
|
+
import { useEffect as useEffect3, useLayoutEffect, useMemo, useRef as useRef2, useState as useState4 } from "react";
|
|
1106
1143
|
import { Plus, Minus, ArrowUp } from "lucide-react";
|
|
1107
1144
|
|
|
1108
1145
|
// src/ui/timeline-groups.ts
|
|
@@ -1143,15 +1180,15 @@ function groupCountLabel(n) {
|
|
|
1143
1180
|
}
|
|
1144
1181
|
|
|
1145
1182
|
// src/ui/components/VerticalTimeline.tsx
|
|
1146
|
-
import { Fragment as
|
|
1183
|
+
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1147
1184
|
function VerticalTimeline(p) {
|
|
1148
1185
|
const { client, t, locale } = useSentinelUi();
|
|
1149
1186
|
const hhmm = (ts) => fmtTime(ts, locale), hhmmss = (ts) => fmtTimeSec(ts, locale), dayLbl = (ts) => fmtDay(ts, locale);
|
|
1150
|
-
const scroll =
|
|
1151
|
-
const [vh, setVh] =
|
|
1152
|
-
const [px, setPx] =
|
|
1153
|
-
const [, tick] =
|
|
1154
|
-
const VT =
|
|
1187
|
+
const scroll = useRef2(null);
|
|
1188
|
+
const [vh, setVh] = useState4(600);
|
|
1189
|
+
const [px, setPx] = useState4(0);
|
|
1190
|
+
const [, tick] = useState4(0);
|
|
1191
|
+
const VT = useRef2({
|
|
1155
1192
|
user: 0,
|
|
1156
1193
|
down: false,
|
|
1157
1194
|
moved: false,
|
|
@@ -1170,7 +1207,7 @@ function VerticalTimeline(p) {
|
|
|
1170
1207
|
lastForeignLog: 0,
|
|
1171
1208
|
touching: false
|
|
1172
1209
|
});
|
|
1173
|
-
|
|
1210
|
+
useEffect3(() => {
|
|
1174
1211
|
const el = scroll.current;
|
|
1175
1212
|
const ro = new ResizeObserver(() => setVh(el.clientHeight || 600));
|
|
1176
1213
|
ro.observe(el);
|
|
@@ -1178,7 +1215,7 @@ function VerticalTimeline(p) {
|
|
|
1178
1215
|
return () => ro.disconnect();
|
|
1179
1216
|
}, []);
|
|
1180
1217
|
const minPx = vh / (3 * SENTINEL_DAY_MS), maxPx = vh / (2 * 60 * 1e3);
|
|
1181
|
-
|
|
1218
|
+
useEffect3(() => {
|
|
1182
1219
|
if (!px && vh) setPx(vh / (2 * 3600 * 1e3));
|
|
1183
1220
|
}, [vh, px]);
|
|
1184
1221
|
const HEAD = 0.35;
|
|
@@ -1186,8 +1223,8 @@ function VerticalTimeline(p) {
|
|
|
1186
1223
|
const span = p.rangeEnd - p.rangeStart;
|
|
1187
1224
|
const yFor = (ts) => PAD + (p.rangeEnd - ts) * px;
|
|
1188
1225
|
const tsForY = (y) => p.rangeEnd - (y - PAD) / px;
|
|
1189
|
-
const zoomAnchor =
|
|
1190
|
-
const geo =
|
|
1226
|
+
const zoomAnchor = useRef2(null);
|
|
1227
|
+
const geo = useRef2({ rangeStart: p.rangeStart, rangeEnd: p.rangeEnd, px, vh, PAD });
|
|
1191
1228
|
geo.current = { rangeStart: p.rangeStart, rangeEnd: p.rangeEnd, px, vh, PAD };
|
|
1192
1229
|
const centerTs = () => {
|
|
1193
1230
|
const g = geo.current;
|
|
@@ -1225,13 +1262,13 @@ function VerticalTimeline(p) {
|
|
|
1225
1262
|
const top2 = yFor(ts) - vh * HEAD;
|
|
1226
1263
|
if (Math.abs(el.scrollTop - top2) > 0.5) setTop(el, top2, why);
|
|
1227
1264
|
};
|
|
1228
|
-
const init =
|
|
1229
|
-
|
|
1265
|
+
const init = useRef2(false);
|
|
1266
|
+
useEffect3(() => {
|
|
1230
1267
|
if (!px || init.current) return;
|
|
1231
1268
|
init.current = true;
|
|
1232
1269
|
scrollCenter(Date.now());
|
|
1233
1270
|
}, [px]);
|
|
1234
|
-
const prevEnd =
|
|
1271
|
+
const prevEnd = useRef2(p.rangeEnd);
|
|
1235
1272
|
useLayoutEffect(() => {
|
|
1236
1273
|
const d = p.rangeEnd - prevEnd.current;
|
|
1237
1274
|
prevEnd.current = p.rangeEnd;
|
|
@@ -1250,10 +1287,10 @@ function VerticalTimeline(p) {
|
|
|
1250
1287
|
tick((n) => n + 1);
|
|
1251
1288
|
}
|
|
1252
1289
|
}, [px]);
|
|
1253
|
-
|
|
1290
|
+
useEffect3(() => {
|
|
1254
1291
|
if (p.jump && px) scrollCenter(p.jump.ts, "jump");
|
|
1255
1292
|
}, [p.jump?.n, px]);
|
|
1256
|
-
|
|
1293
|
+
useEffect3(() => {
|
|
1257
1294
|
const on = () => {
|
|
1258
1295
|
VT.current.touching = true;
|
|
1259
1296
|
};
|
|
@@ -1291,9 +1328,9 @@ function VerticalTimeline(p) {
|
|
|
1291
1328
|
notifyCenter();
|
|
1292
1329
|
tick((n) => n + 1);
|
|
1293
1330
|
};
|
|
1294
|
-
const followRef =
|
|
1331
|
+
const followRef = useRef2(followTick);
|
|
1295
1332
|
followRef.current = followTick;
|
|
1296
|
-
|
|
1333
|
+
useEffect3(() => {
|
|
1297
1334
|
const t2 = setInterval(() => followRef.current(), 100);
|
|
1298
1335
|
return () => clearInterval(t2);
|
|
1299
1336
|
}, []);
|
|
@@ -1339,9 +1376,9 @@ function VerticalTimeline(p) {
|
|
|
1339
1376
|
clearTimeout(v.relT);
|
|
1340
1377
|
v.relT = window.setTimeout(userIdle, 250);
|
|
1341
1378
|
};
|
|
1342
|
-
const releaseRef =
|
|
1379
|
+
const releaseRef = useRef2(release);
|
|
1343
1380
|
releaseRef.current = release;
|
|
1344
|
-
|
|
1381
|
+
useEffect3(() => {
|
|
1345
1382
|
const h = () => releaseRef.current();
|
|
1346
1383
|
for (const n of ["pointerup", "pointercancel", "touchend"]) window.addEventListener(n, h);
|
|
1347
1384
|
return () => {
|
|
@@ -1403,9 +1440,9 @@ function VerticalTimeline(p) {
|
|
|
1403
1440
|
const y = e.clientY - r.top;
|
|
1404
1441
|
applyZoom(px * Math.exp(-e.deltaY * 2e-3), tsForY(el.scrollTop + y), y);
|
|
1405
1442
|
};
|
|
1406
|
-
const wheelRef =
|
|
1443
|
+
const wheelRef = useRef2(onWheel);
|
|
1407
1444
|
wheelRef.current = onWheel;
|
|
1408
|
-
|
|
1445
|
+
useEffect3(() => {
|
|
1409
1446
|
const el = scroll.current;
|
|
1410
1447
|
const h = (e) => wheelRef.current(e);
|
|
1411
1448
|
el.addEventListener("wheel", h, { passive: false });
|
|
@@ -1468,12 +1505,12 @@ function VerticalTimeline(p) {
|
|
|
1468
1505
|
VT.current.down = true;
|
|
1469
1506
|
markUser();
|
|
1470
1507
|
};
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1508
|
+
return /* @__PURE__ */ jsxs7("div", { className: "nvr-vtl vtl-wrap", children: [
|
|
1509
|
+
/* @__PURE__ */ jsx9("div", { className: "vtl-scroll", ref: scroll, onScroll, onPointerDown: down, onTouchStart: down, children: /* @__PURE__ */ jsxs7("div", { className: "vtl-content", style: { height: span * px + PAD + PAD_BOT }, children: [
|
|
1510
|
+
/* @__PURE__ */ jsx9("div", { className: "vtl-daybg", style: { top: 0, height: span * px + PAD } }),
|
|
1474
1511
|
ticks.map((t2) => {
|
|
1475
1512
|
const w = sentinelWallSeconds(t2);
|
|
1476
|
-
return /* @__PURE__ */
|
|
1513
|
+
return /* @__PURE__ */ jsx9(
|
|
1477
1514
|
"div",
|
|
1478
1515
|
{
|
|
1479
1516
|
className: "vtick" + (w % stepSec === 0 ? " vtick--l" : w % (stepSec / 2) === 0 ? " vtick--m" : ""),
|
|
@@ -1482,9 +1519,9 @@ function VerticalTimeline(p) {
|
|
|
1482
1519
|
"t" + t2
|
|
1483
1520
|
);
|
|
1484
1521
|
}),
|
|
1485
|
-
axis.map((t2) => /* @__PURE__ */
|
|
1486
|
-
midnights.map((t2) => /* @__PURE__ */
|
|
1487
|
-
p.clip && inWin(Math.min(p.clip.from, p.clip.to), Math.max(p.clip.from, p.clip.to)) && /* @__PURE__ */
|
|
1522
|
+
axis.map((t2) => /* @__PURE__ */ jsx9("div", { className: "vaxis nvr-data", style: { top: yFor(t2) }, children: hhmm(t2) }, t2)),
|
|
1523
|
+
midnights.map((t2) => /* @__PURE__ */ jsx9("div", { className: "vday", style: { top: yFor(t2) }, children: /* @__PURE__ */ jsx9("span", { className: "nvr-data", children: dayLbl(t2) }) }, "d" + t2)),
|
|
1524
|
+
p.clip && inWin(Math.min(p.clip.from, p.clip.to), Math.max(p.clip.from, p.clip.to)) && /* @__PURE__ */ jsx9(
|
|
1488
1525
|
"div",
|
|
1489
1526
|
{
|
|
1490
1527
|
className: "vclip" + (p.clip.edge ? ` vclip--${p.clip.edge}` : "") + (p.clip.bad ? " vclip--bad" : ""),
|
|
@@ -1493,10 +1530,10 @@ function VerticalTimeline(p) {
|
|
|
1493
1530
|
}
|
|
1494
1531
|
),
|
|
1495
1532
|
runs.map(
|
|
1496
|
-
(r, i) => inWin(r.s, r.e) && /* @__PURE__ */
|
|
1533
|
+
(r, i) => inWin(r.s, r.e) && /* @__PURE__ */ jsx9("div", { className: "vseg", style: { top: yFor(r.e), height: Math.max(2, (r.e - r.s) * px) } }, i)
|
|
1497
1534
|
),
|
|
1498
1535
|
p.motion.map(
|
|
1499
|
-
(m, i) => inWin(m[0], m[1]) && /* @__PURE__ */
|
|
1536
|
+
(m, i) => inWin(m[0], m[1]) && /* @__PURE__ */ jsx9("div", { className: "vmot", style: { top: yFor(m[1]), height: Math.max(4, (m[1] - m[0]) * px) } }, i)
|
|
1500
1537
|
),
|
|
1501
1538
|
groups.map((g) => {
|
|
1502
1539
|
if (!inWin(g.oldest.timestamp, g.newest.timestamp)) return null;
|
|
@@ -1506,10 +1543,10 @@ function VerticalTimeline(p) {
|
|
|
1506
1543
|
const k = n > 1 ? g.cls : sentinelClassOf(ev);
|
|
1507
1544
|
const thumb = y - lastThumbY >= thumbGap && px > vh / (8 * 3600 * 1e3);
|
|
1508
1545
|
if (thumb) lastThumbY = y;
|
|
1509
|
-
return /* @__PURE__ */
|
|
1546
|
+
return /* @__PURE__ */ jsxs7("div", { children: [
|
|
1510
1547
|
g.events.map((m) => {
|
|
1511
1548
|
const sp = sentinelEventSpan(m, now);
|
|
1512
|
-
return sp && /* @__PURE__ */
|
|
1549
|
+
return sp && /* @__PURE__ */ jsx9(
|
|
1513
1550
|
"div",
|
|
1514
1551
|
{
|
|
1515
1552
|
className: "vspan" + (sp.open ? " vspan--open" : ""),
|
|
@@ -1522,7 +1559,7 @@ function VerticalTimeline(p) {
|
|
|
1522
1559
|
m.id
|
|
1523
1560
|
);
|
|
1524
1561
|
}),
|
|
1525
|
-
n > 1 ? /* @__PURE__ */
|
|
1562
|
+
n > 1 ? /* @__PURE__ */ jsx9(
|
|
1526
1563
|
"button",
|
|
1527
1564
|
{
|
|
1528
1565
|
className: "vev vev--group",
|
|
@@ -1532,7 +1569,7 @@ function VerticalTimeline(p) {
|
|
|
1532
1569
|
title: `${n} \xD7 ${hhmmss(g.oldest.timestamp)}\u2013${hhmmss(ev.timestamp)}`,
|
|
1533
1570
|
children: groupCountLabel(n)
|
|
1534
1571
|
}
|
|
1535
|
-
) : /* @__PURE__ */
|
|
1572
|
+
) : /* @__PURE__ */ jsx9(
|
|
1536
1573
|
"button",
|
|
1537
1574
|
{
|
|
1538
1575
|
className: "vev" + (thumb ? "" : " vev--minor"),
|
|
@@ -1542,33 +1579,33 @@ function VerticalTimeline(p) {
|
|
|
1542
1579
|
title: hhmmss(sentinelEventPlayTs(ev))
|
|
1543
1580
|
}
|
|
1544
1581
|
),
|
|
1545
|
-
thumb && /* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
/* @__PURE__ */
|
|
1582
|
+
thumb && /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
|
1583
|
+
/* @__PURE__ */ jsxs7("div", { className: "vlink", style: { top: y }, children: [
|
|
1584
|
+
/* @__PURE__ */ jsx9("span", { className: "vlink-badges", children: /* @__PURE__ */ jsx9(EventBadges, { ev, t }) }),
|
|
1585
|
+
/* @__PURE__ */ jsx9("i", {})
|
|
1549
1586
|
] }),
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsxs7("button", { className: "vthumb", style: { top: y }, onClick: () => p.onEvent(ev), children: [
|
|
1588
|
+
/* @__PURE__ */ jsx9("img", { src: client.eventThumbUrl(p.camId, ev.timestamp), alt: "", loading: "lazy" }),
|
|
1589
|
+
/* @__PURE__ */ jsx9("span", { className: "tt nvr-data", children: hhmmss(ev.timestamp) })
|
|
1553
1590
|
] })
|
|
1554
1591
|
] })
|
|
1555
1592
|
] }, ev.id);
|
|
1556
1593
|
}),
|
|
1557
|
-
inWin(now) && /* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1594
|
+
inWin(now) && /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
|
1595
|
+
/* @__PURE__ */ jsx9("div", { className: "vlive-line", style: { top: yFor(now) } }),
|
|
1596
|
+
/* @__PURE__ */ jsx9("button", { className: "vlive-chip", style: { top: yFor(now) }, onClick: p.onGoLive, children: t("nvr.live") })
|
|
1560
1597
|
] })
|
|
1561
1598
|
] }) }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ jsx9("div", { className: "vcenter", children: /* @__PURE__ */ jsxs7("span", { className: "vcenter-t nvr-data", "data-ts": Math.round(center), children: [
|
|
1563
1600
|
centerIsToday ? "" : dayLbl(center) + " ",
|
|
1564
1601
|
hhmmss(center)
|
|
1565
1602
|
] }) }),
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1603
|
+
/* @__PURE__ */ jsxs7("div", { className: "vtl-zoom", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: "tool", onClick: () => zoomStep(1.7), "aria-label": t("nvr.timeline.zoomIn"), children: /* @__PURE__ */ jsx9(Plus, { size: 16 }) }),
|
|
1605
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: "tool", onClick: () => zoomStep(1 / 1.7), "aria-label": t("nvr.timeline.zoomOut"), children: /* @__PURE__ */ jsx9(Minus, { size: 16 }) })
|
|
1569
1606
|
] }),
|
|
1570
|
-
!p.live && /* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1607
|
+
!p.live && /* @__PURE__ */ jsxs7("button", { type: "button", className: "livejump", onClick: p.onGoLive, children: [
|
|
1608
|
+
/* @__PURE__ */ jsx9(ArrowUp, { size: 14 }),
|
|
1572
1609
|
" ",
|
|
1573
1610
|
t("nvr.live")
|
|
1574
1611
|
] })
|
|
@@ -1576,12 +1613,12 @@ function VerticalTimeline(p) {
|
|
|
1576
1613
|
}
|
|
1577
1614
|
|
|
1578
1615
|
// src/ui/components/CameraPage.tsx
|
|
1579
|
-
import { useCallback as
|
|
1616
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef4, useState as useState6 } from "react";
|
|
1580
1617
|
import {
|
|
1581
1618
|
Calendar,
|
|
1582
|
-
Camera as
|
|
1583
|
-
ChevronLeft as
|
|
1584
|
-
ChevronRight as
|
|
1619
|
+
Camera as Camera3,
|
|
1620
|
+
ChevronLeft as ChevronLeft3,
|
|
1621
|
+
ChevronRight as ChevronRight3,
|
|
1585
1622
|
Download as Download2,
|
|
1586
1623
|
FastForward,
|
|
1587
1624
|
Maximize2,
|
|
@@ -1755,9 +1792,9 @@ function clipErrorKind(status, code) {
|
|
|
1755
1792
|
}
|
|
1756
1793
|
|
|
1757
1794
|
// src/ui/components/ClipBar.tsx
|
|
1758
|
-
import { useCallback as
|
|
1795
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
|
|
1759
1796
|
import { Share2, X } from "lucide-react";
|
|
1760
|
-
import { Fragment as
|
|
1797
|
+
import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1761
1798
|
function canShareFiles() {
|
|
1762
1799
|
try {
|
|
1763
1800
|
const n = navigator;
|
|
@@ -1776,29 +1813,29 @@ function viewerTz() {
|
|
|
1776
1813
|
}
|
|
1777
1814
|
function ClipBar(p) {
|
|
1778
1815
|
const { client, t, locale } = useSentinelUi();
|
|
1779
|
-
const [job, setJobState] =
|
|
1780
|
-
const [edges, setEdges] =
|
|
1816
|
+
const [job, setJobState] = useState5({ s: "idle" });
|
|
1817
|
+
const [edges, setEdges] = useState5({ cur: p.edge, was: null });
|
|
1781
1818
|
if (edges.cur !== p.edge) setEdges({ cur: p.edge, was: edges.cur });
|
|
1782
|
-
const jobRef =
|
|
1783
|
-
const setJob =
|
|
1819
|
+
const jobRef = useRef3(job);
|
|
1820
|
+
const setJob = useCallback3((j) => {
|
|
1784
1821
|
jobRef.current = j;
|
|
1785
1822
|
setJobState(j);
|
|
1786
1823
|
}, []);
|
|
1787
|
-
const gen =
|
|
1788
|
-
const alive =
|
|
1789
|
-
const abort =
|
|
1824
|
+
const gen = useRef3(0);
|
|
1825
|
+
const alive = useRef3(true);
|
|
1826
|
+
const abort = useRef3(null);
|
|
1790
1827
|
const standalone = isIosHomeScreenApp();
|
|
1791
|
-
const release =
|
|
1828
|
+
const release = useCallback3(() => {
|
|
1792
1829
|
abort.current?.abort();
|
|
1793
1830
|
abort.current = null;
|
|
1794
1831
|
const j = jobRef.current;
|
|
1795
1832
|
if (j.s === "ready" && j.blobUrl) URL.revokeObjectURL(j.blobUrl);
|
|
1796
1833
|
}, []);
|
|
1797
|
-
const cancelRunning =
|
|
1834
|
+
const cancelRunning = useCallback3(() => {
|
|
1798
1835
|
const j = jobRef.current;
|
|
1799
1836
|
if (j.s === "running") void client.cancelExport(j.id);
|
|
1800
1837
|
}, [client]);
|
|
1801
|
-
|
|
1838
|
+
useEffect4(() => {
|
|
1802
1839
|
alive.current = true;
|
|
1803
1840
|
return () => {
|
|
1804
1841
|
alive.current = false;
|
|
@@ -1808,8 +1845,8 @@ function ClipBar(p) {
|
|
|
1808
1845
|
};
|
|
1809
1846
|
}, [cancelRunning, release]);
|
|
1810
1847
|
const rangeKey = `${p.range.from}|${p.range.to}`;
|
|
1811
|
-
const lastKey =
|
|
1812
|
-
|
|
1848
|
+
const lastKey = useRef3(rangeKey);
|
|
1849
|
+
useEffect4(() => {
|
|
1813
1850
|
if (lastKey.current === rangeKey) return;
|
|
1814
1851
|
lastKey.current = rangeKey;
|
|
1815
1852
|
if (jobRef.current.s === "idle") return;
|
|
@@ -1818,14 +1855,14 @@ function ClipBar(p) {
|
|
|
1818
1855
|
release();
|
|
1819
1856
|
setJob({ s: "idle" });
|
|
1820
1857
|
}, [rangeKey, cancelRunning, release, setJob]);
|
|
1821
|
-
const fail =
|
|
1858
|
+
const fail = useCallback3(
|
|
1822
1859
|
(kind, vars, extra) => {
|
|
1823
1860
|
rlog("clip", { ok: false, err: kind, standalone, ...extra });
|
|
1824
1861
|
setJob(vars ? { s: "error", kind, vars } : { s: "error", kind });
|
|
1825
1862
|
},
|
|
1826
1863
|
[setJob, standalone]
|
|
1827
1864
|
);
|
|
1828
|
-
const errorOf =
|
|
1865
|
+
const errorOf = useCallback3(
|
|
1829
1866
|
(e) => {
|
|
1830
1867
|
const st2 = e instanceof SentinelHttpError ? e.status : 0;
|
|
1831
1868
|
const code = e instanceof SentinelHttpError ? e.code : void 0;
|
|
@@ -1842,7 +1879,7 @@ function ClipBar(p) {
|
|
|
1842
1879
|
},
|
|
1843
1880
|
[fail, locale]
|
|
1844
1881
|
);
|
|
1845
|
-
const finish =
|
|
1882
|
+
const finish = useCallback3(
|
|
1846
1883
|
async (g, d) => {
|
|
1847
1884
|
const crossOrigin = isCrossOrigin(client.exportFileUrl(d.id));
|
|
1848
1885
|
const ways = clipWays({ bytes: d.bytes, canShareFiles: canShareFiles(), standalone, crossOrigin });
|
|
@@ -1882,7 +1919,7 @@ function ClipBar(p) {
|
|
|
1882
1919
|
[client, fail, setJob, standalone]
|
|
1883
1920
|
);
|
|
1884
1921
|
const running = job.s === "running" ? job.id : null;
|
|
1885
|
-
|
|
1922
|
+
useEffect4(() => {
|
|
1886
1923
|
if (!running) return;
|
|
1887
1924
|
const g = gen.current;
|
|
1888
1925
|
let timer = 0;
|
|
@@ -1940,7 +1977,7 @@ function ClipBar(p) {
|
|
|
1940
1977
|
};
|
|
1941
1978
|
}, [running, client, finish, fail, setJob]);
|
|
1942
1979
|
const expiresAt = job.s === "ready" || job.s === "loading" ? job.expiresAt : void 0;
|
|
1943
|
-
|
|
1980
|
+
useEffect4(() => {
|
|
1944
1981
|
if (!expiresAt) return;
|
|
1945
1982
|
const g = gen.current;
|
|
1946
1983
|
const i = window.setTimeout(
|
|
@@ -1956,7 +1993,7 @@ function ClipBar(p) {
|
|
|
1956
1993
|
);
|
|
1957
1994
|
return () => window.clearTimeout(i);
|
|
1958
1995
|
}, [expiresAt, release, setJob]);
|
|
1959
|
-
const create =
|
|
1996
|
+
const create = useCallback3(async () => {
|
|
1960
1997
|
const j = jobRef.current;
|
|
1961
1998
|
if (j.s === "starting" || j.s === "running" || j.s === "loading") return;
|
|
1962
1999
|
gen.current++;
|
|
@@ -1977,7 +2014,7 @@ function ClipBar(p) {
|
|
|
1977
2014
|
errorOf(e);
|
|
1978
2015
|
}
|
|
1979
2016
|
}, [client, p, release, setJob, errorOf]);
|
|
1980
|
-
const cancel =
|
|
2017
|
+
const cancel = useCallback3(() => {
|
|
1981
2018
|
cancelRunning();
|
|
1982
2019
|
gen.current++;
|
|
1983
2020
|
release();
|
|
@@ -2012,7 +2049,7 @@ function ClipBar(p) {
|
|
|
2012
2049
|
const bad = e === "to" && hints.tooLong;
|
|
2013
2050
|
const k = t(e === "from" ? "nvr.clip.from" : "nvr.clip.to");
|
|
2014
2051
|
const v = fmtClipTime(ts, locale);
|
|
2015
|
-
return /* @__PURE__ */
|
|
2052
|
+
return /* @__PURE__ */ jsxs8(
|
|
2016
2053
|
"button",
|
|
2017
2054
|
{
|
|
2018
2055
|
type: "button",
|
|
@@ -2022,9 +2059,9 @@ function ClipBar(p) {
|
|
|
2022
2059
|
disabled: busy,
|
|
2023
2060
|
onClick: () => p.onEdge(active ? null : e),
|
|
2024
2061
|
children: [
|
|
2025
|
-
/* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipchip__k", children: k }),
|
|
2026
2063
|
" ",
|
|
2027
|
-
/* @__PURE__ */
|
|
2064
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipchip__v nvr-data", children: v })
|
|
2028
2065
|
]
|
|
2029
2066
|
}
|
|
2030
2067
|
);
|
|
@@ -2054,10 +2091,10 @@ function ClipBar(p) {
|
|
|
2054
2091
|
if (job.s === "starting" || job.s === "running") {
|
|
2055
2092
|
pct = job.s === "running" ? Math.round(job.pct * 100) : 0;
|
|
2056
2093
|
state = t("nvr.clip.preparing", { pct });
|
|
2057
|
-
actions = /* @__PURE__ */
|
|
2094
|
+
actions = /* @__PURE__ */ jsx10("button", { type: "button", className: "nvr-btn nvr-btn--ghost", onClick: cancel, children: t("nvr.clip.cancel") });
|
|
2058
2095
|
} else if (ready) {
|
|
2059
2096
|
state = job.s === "loading" ? t("nvr.clip.loading") : t("nvr.clip.ready", { size: humanBytes(ready.bytes, locale) });
|
|
2060
|
-
const save = ready.ways.save === "safari" ? /* @__PURE__ */
|
|
2097
|
+
const save = ready.ways.save === "safari" ? /* @__PURE__ */ jsx10(
|
|
2061
2098
|
"a",
|
|
2062
2099
|
{
|
|
2063
2100
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2067,7 +2104,7 @@ function ClipBar(p) {
|
|
|
2067
2104
|
onClick: () => log("safari"),
|
|
2068
2105
|
children: t("nvr.player.openInSafari")
|
|
2069
2106
|
}
|
|
2070
|
-
) : ready.ways.save === "blob" ? job.s === "ready" && job.blobUrl ? /* @__PURE__ */
|
|
2107
|
+
) : ready.ways.save === "blob" ? job.s === "ready" && job.blobUrl ? /* @__PURE__ */ jsx10(
|
|
2071
2108
|
"a",
|
|
2072
2109
|
{
|
|
2073
2110
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2076,9 +2113,9 @@ function ClipBar(p) {
|
|
|
2076
2113
|
onClick: () => log("blob"),
|
|
2077
2114
|
children: t("nvr.clip.save")
|
|
2078
2115
|
}
|
|
2079
|
-
) : /* @__PURE__ */
|
|
2116
|
+
) : /* @__PURE__ */ jsx10("button", { type: "button", className: "nvr-btn nvr-btn--primary", disabled: true, children: t("nvr.clip.save") }) : ready.ways.save === "tab" ? (
|
|
2080
2117
|
// another origin, too large for the page: a new tab saves it (attachment), the host page stays
|
|
2081
|
-
/* @__PURE__ */
|
|
2118
|
+
/* @__PURE__ */ jsx10(
|
|
2082
2119
|
"a",
|
|
2083
2120
|
{
|
|
2084
2121
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2089,7 +2126,7 @@ function ClipBar(p) {
|
|
|
2089
2126
|
children: t("nvr.clip.save")
|
|
2090
2127
|
}
|
|
2091
2128
|
)
|
|
2092
|
-
) : /* @__PURE__ */
|
|
2129
|
+
) : /* @__PURE__ */ jsx10(
|
|
2093
2130
|
"a",
|
|
2094
2131
|
{
|
|
2095
2132
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2099,9 +2136,9 @@ function ClipBar(p) {
|
|
|
2099
2136
|
children: t("nvr.clip.save")
|
|
2100
2137
|
}
|
|
2101
2138
|
);
|
|
2102
|
-
actions = /* @__PURE__ */
|
|
2139
|
+
actions = /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2103
2140
|
save,
|
|
2104
|
-
ready.ways.share && /* @__PURE__ */
|
|
2141
|
+
ready.ways.share && /* @__PURE__ */ jsxs8(
|
|
2105
2142
|
"button",
|
|
2106
2143
|
{
|
|
2107
2144
|
type: "button",
|
|
@@ -2109,7 +2146,7 @@ function ClipBar(p) {
|
|
|
2109
2146
|
disabled: !(job.s === "ready" && job.file),
|
|
2110
2147
|
onClick: share,
|
|
2111
2148
|
children: [
|
|
2112
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ jsx10(Share2, { size: 16 }),
|
|
2113
2150
|
t("nvr.clip.share")
|
|
2114
2151
|
]
|
|
2115
2152
|
}
|
|
@@ -2117,7 +2154,7 @@ function ClipBar(p) {
|
|
|
2117
2154
|
] });
|
|
2118
2155
|
} else {
|
|
2119
2156
|
const again = job.s === "error" && job.kind === "expired";
|
|
2120
|
-
actions = /* @__PURE__ */
|
|
2157
|
+
actions = /* @__PURE__ */ jsx10(
|
|
2121
2158
|
"button",
|
|
2122
2159
|
{
|
|
2123
2160
|
type: "button",
|
|
@@ -2128,53 +2165,53 @@ function ClipBar(p) {
|
|
|
2128
2165
|
}
|
|
2129
2166
|
);
|
|
2130
2167
|
}
|
|
2131
|
-
return /* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2133
|
-
p.immersive ? /* @__PURE__ */
|
|
2168
|
+
return /* @__PURE__ */ jsxs8("div", { className: "nvr-clipbar", role: "group", "aria-label": t("nvr.clip.download"), children: [
|
|
2169
|
+
/* @__PURE__ */ jsxs8("div", { className: "nvr-clipbar__row", children: [
|
|
2170
|
+
p.immersive ? /* @__PURE__ */ jsxs8("div", { className: "nvr-clipbar__edges", "data-edge": p.edge ?? void 0, "data-was": edges.was ?? void 0, children: [
|
|
2134
2171
|
chip("from"),
|
|
2135
2172
|
chip("to")
|
|
2136
|
-
] }) : /* @__PURE__ */
|
|
2173
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2137
2174
|
chip("from"),
|
|
2138
2175
|
chip("to")
|
|
2139
2176
|
] }),
|
|
2140
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ jsx10(
|
|
2141
2178
|
"button",
|
|
2142
2179
|
{
|
|
2143
2180
|
type: "button",
|
|
2144
2181
|
className: "nvr-iconbtn nvr-clipbar__close",
|
|
2145
2182
|
"aria-label": t("nvr.clip.close"),
|
|
2146
2183
|
onClick: p.onClose,
|
|
2147
|
-
children: /* @__PURE__ */
|
|
2184
|
+
children: /* @__PURE__ */ jsx10(X, { size: 16 })
|
|
2148
2185
|
}
|
|
2149
2186
|
)
|
|
2150
2187
|
] }),
|
|
2151
|
-
/* @__PURE__ */
|
|
2188
|
+
/* @__PURE__ */ jsxs8(
|
|
2152
2189
|
"div",
|
|
2153
2190
|
{
|
|
2154
2191
|
className: "nvr-clipbar__note" + (note?.tone === "bad" ? " nvr-clipbar__note--bad" : ""),
|
|
2155
2192
|
title: [lenText, state, note?.text].filter(Boolean).join(" \xB7 "),
|
|
2156
2193
|
children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
state && /* @__PURE__ */
|
|
2194
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipbar__len nvr-data", children: lenText }),
|
|
2195
|
+
/* @__PURE__ */ jsxs8("span", { role: "status", children: [
|
|
2196
|
+
state && /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2160
2197
|
" \xB7 ",
|
|
2161
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipbar__state", children: state })
|
|
2162
2199
|
] }),
|
|
2163
|
-
note && /* @__PURE__ */
|
|
2200
|
+
note && /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2164
2201
|
" \xB7 ",
|
|
2165
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsx10("span", { className: note.tone === "bad" ? "nvr-clipbar__bad" : void 0, children: note.text })
|
|
2166
2203
|
] })
|
|
2167
2204
|
] })
|
|
2168
2205
|
]
|
|
2169
2206
|
}
|
|
2170
2207
|
),
|
|
2171
|
-
pct != null && /* @__PURE__ */
|
|
2172
|
-
/* @__PURE__ */
|
|
2208
|
+
pct != null && /* @__PURE__ */ jsx10("div", { className: "nvr-clipbar__prog", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("i", { style: { width: `${pct}%` } }) }),
|
|
2209
|
+
/* @__PURE__ */ jsx10("div", { className: "nvr-clipbar__row nvr-clipbar__actions", children: actions })
|
|
2173
2210
|
] });
|
|
2174
2211
|
}
|
|
2175
2212
|
|
|
2176
2213
|
// src/ui/components/CameraPage.tsx
|
|
2177
|
-
import { jsx as
|
|
2214
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2178
2215
|
var IDLE = {
|
|
2179
2216
|
live: true,
|
|
2180
2217
|
label: "live",
|
|
@@ -2195,42 +2232,42 @@ function CameraTitle({
|
|
|
2195
2232
|
}) {
|
|
2196
2233
|
const { t, locale } = useSentinelUi();
|
|
2197
2234
|
const day = !live && at != null ? fmtDayPrefix(at, locale) : "";
|
|
2198
|
-
const badge = live ? /* @__PURE__ */
|
|
2199
|
-
const h1 = /* @__PURE__ */
|
|
2200
|
-
return /* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
badge ? /* @__PURE__ */
|
|
2235
|
+
const badge = live ? /* @__PURE__ */ jsx11("span", { className: "nvr-cam__badge nvr-cam__badge--live", children: t("nvr.live") }) : at != null ? /* @__PURE__ */ jsx11("span", { className: "nvr-cam__badge nvr-cam__badge--time nvr-data", children: day ? `${day} ${fmtTimeSec(at, locale)}` : fmtTimeSec(at, locale) }) : null;
|
|
2236
|
+
const h1 = /* @__PURE__ */ jsx11("h1", { className: "nvr-cam__h1", children: name });
|
|
2237
|
+
return /* @__PURE__ */ jsxs9("div", { className: "nvr-cam__head", children: [
|
|
2238
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-cam__title", children: [
|
|
2239
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: "nvr-iconbtn", "aria-label": t("nvr.back"), onClick: onBack, children: /* @__PURE__ */ jsx11(ChevronLeft3, { size: 20 }) }),
|
|
2240
|
+
badge ? /* @__PURE__ */ jsxs9("span", { className: "nvr-cam__name", children: [
|
|
2204
2241
|
h1,
|
|
2205
2242
|
badge
|
|
2206
2243
|
] }) : h1
|
|
2207
2244
|
] }),
|
|
2208
|
-
children ? /* @__PURE__ */
|
|
2245
|
+
children ? /* @__PURE__ */ jsx11("div", { className: "nvr-cam__actions", children }) : null
|
|
2209
2246
|
] });
|
|
2210
2247
|
}
|
|
2211
2248
|
function CameraPage(p) {
|
|
2212
2249
|
const { client, t, locale } = useSentinelUi();
|
|
2213
2250
|
const { camId, name, earliest, startAt = 0, posterTs = 0 } = p;
|
|
2214
|
-
const [days, setDays] =
|
|
2215
|
-
const [nowTick, setNowTick] =
|
|
2216
|
-
|
|
2251
|
+
const [days, setDays] = useState6({});
|
|
2252
|
+
const [nowTick, setNowTick] = useState6(Date.now());
|
|
2253
|
+
useEffect5(() => {
|
|
2217
2254
|
const i = setInterval(() => setNowTick(Date.now()), 3e4);
|
|
2218
2255
|
return () => clearInterval(i);
|
|
2219
2256
|
}, []);
|
|
2220
|
-
const [centerDay, setCenterDay] =
|
|
2221
|
-
const [jump, setJump] =
|
|
2222
|
-
const [tab, setTab] =
|
|
2223
|
-
const [filterOff, setFilterOff] =
|
|
2224
|
-
const [ps, setPs] =
|
|
2225
|
-
const [loadError, setLoadError] =
|
|
2226
|
-
const [dt, setDt] =
|
|
2227
|
-
const [pipNote, setPipNote] =
|
|
2228
|
-
|
|
2257
|
+
const [centerDay, setCenterDay] = useState6(todayStart());
|
|
2258
|
+
const [jump, setJump] = useState6(null);
|
|
2259
|
+
const [tab, setTab] = useState6("tl");
|
|
2260
|
+
const [filterOff, setFilterOff] = useState6({});
|
|
2261
|
+
const [ps, setPs] = useState6(IDLE);
|
|
2262
|
+
const [loadError, setLoadError] = useState6(false);
|
|
2263
|
+
const [dt, setDt] = useState6(false);
|
|
2264
|
+
const [pipNote, setPipNote] = useState6(null);
|
|
2265
|
+
useEffect5(() => {
|
|
2229
2266
|
if (!pipNote) return;
|
|
2230
2267
|
const i = setTimeout(() => setPipNote(null), 15e3);
|
|
2231
2268
|
return () => clearTimeout(i);
|
|
2232
2269
|
}, [pipNote]);
|
|
2233
|
-
const onPip =
|
|
2270
|
+
const onPip = useCallback4(() => {
|
|
2234
2271
|
const c = ctl.current;
|
|
2235
2272
|
if (!c) return;
|
|
2236
2273
|
void c.pip().then((r) => {
|
|
@@ -2238,35 +2275,35 @@ function CameraPage(p) {
|
|
|
2238
2275
|
else if (r === "entered") setPipNote(null);
|
|
2239
2276
|
});
|
|
2240
2277
|
}, []);
|
|
2241
|
-
const body =
|
|
2242
|
-
const stage =
|
|
2243
|
-
const video =
|
|
2244
|
-
const freeze =
|
|
2245
|
-
const img =
|
|
2246
|
-
const ctl =
|
|
2247
|
-
const psRef =
|
|
2278
|
+
const body = useRef4(null);
|
|
2279
|
+
const stage = useRef4(null);
|
|
2280
|
+
const video = useRef4(null);
|
|
2281
|
+
const freeze = useRef4(null);
|
|
2282
|
+
const img = useRef4(null);
|
|
2283
|
+
const ctl = useRef4(null);
|
|
2284
|
+
const psRef = useRef4(ps);
|
|
2248
2285
|
psRef.current = ps;
|
|
2249
|
-
const loading =
|
|
2250
|
-
const daysRef =
|
|
2286
|
+
const loading = useRef4(/* @__PURE__ */ new Set());
|
|
2287
|
+
const daysRef = useRef4(days);
|
|
2251
2288
|
daysRef.current = days;
|
|
2252
|
-
const camRef =
|
|
2289
|
+
const camRef = useRef4(camId);
|
|
2253
2290
|
camRef.current = camId;
|
|
2254
|
-
const deepRef =
|
|
2255
|
-
const [clip, setClip] =
|
|
2256
|
-
const [clipEdge, setClipEdge] =
|
|
2257
|
-
const clipRef =
|
|
2291
|
+
const deepRef = useRef4("");
|
|
2292
|
+
const [clip, setClip] = useState6(null);
|
|
2293
|
+
const [clipEdge, setClipEdge] = useState6(null);
|
|
2294
|
+
const clipRef = useRef4(clip);
|
|
2258
2295
|
clipRef.current = clip;
|
|
2259
|
-
const clipEdgeRef =
|
|
2296
|
+
const clipEdgeRef = useRef4(clipEdge);
|
|
2260
2297
|
clipEdgeRef.current = clipEdge;
|
|
2261
|
-
const lineTs =
|
|
2262
|
-
const gestureAt =
|
|
2298
|
+
const lineTs = useRef4(null);
|
|
2299
|
+
const gestureAt = useRef4(0);
|
|
2263
2300
|
const merged = useMemo2(() => {
|
|
2264
2301
|
const m = sentinelMergeDays(days);
|
|
2265
2302
|
const rangeStart = m.oldestDay ?? todayStart();
|
|
2266
2303
|
const rangeEnd = Math.min(sentinelDayEnd(todayStart()), nowTick + 20 * 6e4);
|
|
2267
2304
|
return { ...m, rangeStart, rangeEnd };
|
|
2268
2305
|
}, [days, nowTick]);
|
|
2269
|
-
const mergedNow =
|
|
2306
|
+
const mergedNow = useCallback4(() => {
|
|
2270
2307
|
const m = sentinelMergeDays(daysRef.current);
|
|
2271
2308
|
return {
|
|
2272
2309
|
...m,
|
|
@@ -2274,11 +2311,11 @@ function CameraPage(p) {
|
|
|
2274
2311
|
rangeEnd: Math.min(sentinelDayEnd(todayStart()), Date.now() + 20 * 6e4)
|
|
2275
2312
|
};
|
|
2276
2313
|
}, []);
|
|
2277
|
-
|
|
2314
|
+
useEffect5(() => {
|
|
2278
2315
|
ctl.current?.setClips(merged.clips, merged.codecs, merged.rangeStart, merged.rangeEnd);
|
|
2279
2316
|
}, [merged]);
|
|
2280
|
-
const frameServer =
|
|
2281
|
-
const fetchDay =
|
|
2317
|
+
const frameServer = useCallback4(() => Object.values(daysRef.current).some((d) => sentinelHasFeature(d, "frame")), []);
|
|
2318
|
+
const fetchDay = useCallback4(
|
|
2282
2319
|
async (ds) => {
|
|
2283
2320
|
const d = await client.getJson(
|
|
2284
2321
|
`api/clips?camera=${encodeURIComponent(camId)}&start=${ds}&end=${sentinelDayEnd(ds)}`
|
|
@@ -2290,7 +2327,7 @@ function CameraPage(p) {
|
|
|
2290
2327
|
},
|
|
2291
2328
|
[client, camId]
|
|
2292
2329
|
);
|
|
2293
|
-
const ensureDay =
|
|
2330
|
+
const ensureDay = useCallback4(
|
|
2294
2331
|
async (ds, force = false) => {
|
|
2295
2332
|
if (ds > todayStart()) return;
|
|
2296
2333
|
if (earliest && sentinelAddDays(ds, 1) < sentinelDayOf(earliest)) return;
|
|
@@ -2308,7 +2345,7 @@ function CameraPage(p) {
|
|
|
2308
2345
|
},
|
|
2309
2346
|
[fetchDay, earliest, camId]
|
|
2310
2347
|
);
|
|
2311
|
-
const onCenter =
|
|
2348
|
+
const onCenter = useCallback4(
|
|
2312
2349
|
(ts) => {
|
|
2313
2350
|
lineTs.current = ts;
|
|
2314
2351
|
const d = sentinelDayOf(ts);
|
|
@@ -2317,7 +2354,7 @@ function CameraPage(p) {
|
|
|
2317
2354
|
},
|
|
2318
2355
|
[ensureDay]
|
|
2319
2356
|
);
|
|
2320
|
-
|
|
2357
|
+
useEffect5(() => {
|
|
2321
2358
|
const st = stage.current, cd = body.current;
|
|
2322
2359
|
if (!st || !cd) return;
|
|
2323
2360
|
const sync = () => {
|
|
@@ -2330,7 +2367,7 @@ function CameraPage(p) {
|
|
|
2330
2367
|
mo.observe(st, { attributes: true, attributeFilter: ["style"] });
|
|
2331
2368
|
return () => mo.disconnect();
|
|
2332
2369
|
}, []);
|
|
2333
|
-
|
|
2370
|
+
useEffect5(() => {
|
|
2334
2371
|
const c = new PlayerController(client, {
|
|
2335
2372
|
onState: (s) => setPs(s),
|
|
2336
2373
|
onClipsRefresh: async () => {
|
|
@@ -2349,7 +2386,7 @@ function CameraPage(p) {
|
|
|
2349
2386
|
delete window.__snvr;
|
|
2350
2387
|
};
|
|
2351
2388
|
}, [client]);
|
|
2352
|
-
|
|
2389
|
+
useEffect5(() => {
|
|
2353
2390
|
const c = ctl.current;
|
|
2354
2391
|
if (!c || !camId) return;
|
|
2355
2392
|
c.setCamera(camId, name);
|
|
@@ -2394,7 +2431,7 @@ function CameraPage(p) {
|
|
|
2394
2431
|
});
|
|
2395
2432
|
deepRef.current = `${camId}|${startAt}`;
|
|
2396
2433
|
}, [camId, client]);
|
|
2397
|
-
|
|
2434
|
+
useEffect5(() => {
|
|
2398
2435
|
const key = `${camId}|${startAt}`;
|
|
2399
2436
|
if (!startAt || !ctl.current || key === deepRef.current) return;
|
|
2400
2437
|
deepRef.current = key;
|
|
@@ -2403,10 +2440,10 @@ function CameraPage(p) {
|
|
|
2403
2440
|
if (posterTs) c.posterEvent(posterTs, frameServer() ? startAt : void 0);
|
|
2404
2441
|
goToDay(sentinelDayOf(startAt), startAt).catch(() => setLoadError(true));
|
|
2405
2442
|
}, [startAt, posterTs]);
|
|
2406
|
-
|
|
2443
|
+
useEffect5(() => {
|
|
2407
2444
|
if (ctl.current && name) ctl.current.camName = name;
|
|
2408
2445
|
}, [name]);
|
|
2409
|
-
|
|
2446
|
+
useEffect5(() => {
|
|
2410
2447
|
const i = setInterval(() => {
|
|
2411
2448
|
const ok = todayRefreshAllowed({
|
|
2412
2449
|
hidden: document.visibilityState === "hidden",
|
|
@@ -2430,11 +2467,11 @@ function CameraPage(p) {
|
|
|
2430
2467
|
[merged.events, filterOff]
|
|
2431
2468
|
);
|
|
2432
2469
|
const dayCount = useMemo2(() => eventsOnDay(visEvents, centerDay), [visEvents, centerDay]);
|
|
2433
|
-
const goLive =
|
|
2470
|
+
const goLive = useCallback4(() => {
|
|
2434
2471
|
ctl.current?.goLive();
|
|
2435
2472
|
setJump({ ts: Date.now(), n: Date.now() });
|
|
2436
2473
|
}, []);
|
|
2437
|
-
const playEvent =
|
|
2474
|
+
const playEvent = useCallback4(
|
|
2438
2475
|
(ev) => {
|
|
2439
2476
|
const c = ctl.current;
|
|
2440
2477
|
if (!c) return;
|
|
@@ -2446,7 +2483,7 @@ function CameraPage(p) {
|
|
|
2446
2483
|
},
|
|
2447
2484
|
[frameServer]
|
|
2448
2485
|
);
|
|
2449
|
-
const seekTo =
|
|
2486
|
+
const seekTo = useCallback4(
|
|
2450
2487
|
(ts) => {
|
|
2451
2488
|
const c = ctl.current;
|
|
2452
2489
|
if (!c) return;
|
|
@@ -2459,7 +2496,7 @@ function CameraPage(p) {
|
|
|
2459
2496
|
},
|
|
2460
2497
|
[goLive]
|
|
2461
2498
|
);
|
|
2462
|
-
const jumpEvent =
|
|
2499
|
+
const jumpEvent = useCallback4(
|
|
2463
2500
|
(dir) => {
|
|
2464
2501
|
const c = ctl.current;
|
|
2465
2502
|
if (!c) return;
|
|
@@ -2479,7 +2516,7 @@ function CameraPage(p) {
|
|
|
2479
2516
|
},
|
|
2480
2517
|
[visEvents, playEvent]
|
|
2481
2518
|
);
|
|
2482
|
-
const goToDay =
|
|
2519
|
+
const goToDay = useCallback4(
|
|
2483
2520
|
async (ds, at2) => {
|
|
2484
2521
|
const c = ctl.current;
|
|
2485
2522
|
if (!c) return;
|
|
@@ -2507,7 +2544,7 @@ function CameraPage(p) {
|
|
|
2507
2544
|
);
|
|
2508
2545
|
const canExport = useMemo2(() => Object.values(days).some((d) => sentinelHasFeature(d, "export")), [days]);
|
|
2509
2546
|
const oldestRec = earliest ?? merged.clips[0]?.startTime;
|
|
2510
|
-
const clipEvent =
|
|
2547
|
+
const clipEvent = useCallback4(
|
|
2511
2548
|
(ev) => {
|
|
2512
2549
|
const now = Date.now();
|
|
2513
2550
|
const r = clipRangeForEvent(ev, now);
|
|
@@ -2523,11 +2560,11 @@ function CameraPage(p) {
|
|
|
2523
2560
|
},
|
|
2524
2561
|
[oldestRec, frameServer]
|
|
2525
2562
|
);
|
|
2526
|
-
const closeClip =
|
|
2563
|
+
const closeClip = useCallback4(() => {
|
|
2527
2564
|
setClip(null);
|
|
2528
2565
|
setClipEdge(null);
|
|
2529
2566
|
}, []);
|
|
2530
|
-
const toggleClip =
|
|
2567
|
+
const toggleClip = useCallback4(() => {
|
|
2531
2568
|
if (clipRef.current) {
|
|
2532
2569
|
closeClip();
|
|
2533
2570
|
return;
|
|
@@ -2545,7 +2582,7 @@ function CameraPage(p) {
|
|
|
2545
2582
|
setClipEdge(null);
|
|
2546
2583
|
setTab("tl");
|
|
2547
2584
|
}, [closeClip, visEvents, oldestRec]);
|
|
2548
|
-
const activateEdge =
|
|
2585
|
+
const activateEdge = useCallback4((e) => {
|
|
2549
2586
|
setClipEdge(e);
|
|
2550
2587
|
const r = clipRef.current;
|
|
2551
2588
|
if (!e || !r) return;
|
|
@@ -2558,7 +2595,7 @@ function CameraPage(p) {
|
|
|
2558
2595
|
c.playAt(ts, {});
|
|
2559
2596
|
}
|
|
2560
2597
|
}, []);
|
|
2561
|
-
const onUserCenter =
|
|
2598
|
+
const onUserCenter = useCallback4((ts) => {
|
|
2562
2599
|
lineTs.current = ts;
|
|
2563
2600
|
const e = clipEdgeRef.current, r = clipRef.current;
|
|
2564
2601
|
if (!e || !r) return;
|
|
@@ -2566,7 +2603,7 @@ function CameraPage(p) {
|
|
|
2566
2603
|
setClip({ ...n.range, open: false });
|
|
2567
2604
|
if (n.edge !== e) setClipEdge(n.edge);
|
|
2568
2605
|
}, []);
|
|
2569
|
-
const setEdgeToLine =
|
|
2606
|
+
const setEdgeToLine = useCallback4((e) => {
|
|
2570
2607
|
const r = clipRef.current;
|
|
2571
2608
|
if (!r) return;
|
|
2572
2609
|
const s = psRef.current;
|
|
@@ -2576,7 +2613,7 @@ function CameraPage(p) {
|
|
|
2576
2613
|
setClip({ ...n.range, open: false });
|
|
2577
2614
|
if (clipEdgeRef.current) setClipEdge(n.edge);
|
|
2578
2615
|
}, []);
|
|
2579
|
-
const onTimelineEvent =
|
|
2616
|
+
const onTimelineEvent = useCallback4(
|
|
2580
2617
|
(ev) => clipRef.current ? clipEvent(ev) : playEvent(ev),
|
|
2581
2618
|
[clipEvent, playEvent]
|
|
2582
2619
|
);
|
|
@@ -2605,7 +2642,7 @@ function CameraPage(p) {
|
|
|
2605
2642
|
}),
|
|
2606
2643
|
[]
|
|
2607
2644
|
);
|
|
2608
|
-
|
|
2645
|
+
useEffect5(() => {
|
|
2609
2646
|
const k = (e) => {
|
|
2610
2647
|
if (dt || !shouldHandleKey(e)) return;
|
|
2611
2648
|
const c = ctl.current;
|
|
@@ -2640,15 +2677,15 @@ function CameraPage(p) {
|
|
|
2640
2677
|
const header = typeof p.header === "function" ? p.header(at, { live: ps.live }) : p.header;
|
|
2641
2678
|
const immersive = p.appearance === "immersive";
|
|
2642
2679
|
const externalUrl = typeof p.externalUrl === "function" ? p.externalUrl(at) : p.externalUrl;
|
|
2643
|
-
return /* @__PURE__ */
|
|
2680
|
+
return /* @__PURE__ */ jsxs9("div", { className: "nvr-cam", "data-nvr-appearance": immersive ? "immersive" : void 0, children: [
|
|
2644
2681
|
header,
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2649
|
-
/* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
!mjpeg && /* @__PURE__ */
|
|
2682
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-cam__body" + (clip ? " nvr-cam__body--clip" : ""), ref: body, children: [
|
|
2683
|
+
/* @__PURE__ */ jsx11("div", { className: "nvr-cam__left", children: /* @__PURE__ */ jsxs9("div", { className: "nvr-card nvr-stage-card", children: [
|
|
2684
|
+
/* @__PURE__ */ jsx11("div", { className: "nvr-stage-wrap", children: /* @__PURE__ */ jsxs9("div", { className: "nvr-stage", ref: stage, children: [
|
|
2685
|
+
/* @__PURE__ */ jsx11("video", { ref: video, playsInline: true, autoPlay: true, muted: true, crossOrigin: cors, className: "nvr-stage__video" }),
|
|
2686
|
+
/* @__PURE__ */ jsx11("img", { ref: img, crossOrigin: cors, className: "nvr-stage__video nvr-stage__img hidden", alt: "" }),
|
|
2687
|
+
/* @__PURE__ */ jsx11("canvas", { ref: freeze, className: "nvr-stage__video nvr-stage__freeze hidden" }),
|
|
2688
|
+
!mjpeg && /* @__PURE__ */ jsx11(
|
|
2652
2689
|
"button",
|
|
2653
2690
|
{
|
|
2654
2691
|
type: "button",
|
|
@@ -2656,21 +2693,21 @@ function CameraPage(p) {
|
|
|
2656
2693
|
"aria-label": t("nvr.player.sound"),
|
|
2657
2694
|
"aria-pressed": ps.sound,
|
|
2658
2695
|
onClick: () => ctl.current?.setSound(!ps.sound),
|
|
2659
|
-
children: ps.sound && !ps.muted ? /* @__PURE__ */
|
|
2696
|
+
children: ps.sound && !ps.muted ? /* @__PURE__ */ jsx11(Volume2, { size: 18 }) : /* @__PURE__ */ jsx11(VolumeX, { size: 18 })
|
|
2660
2697
|
}
|
|
2661
2698
|
),
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
/* @__PURE__ */
|
|
2699
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-pill-ctl" + (ps.live ? " nvr-pill-ctl--live" : ""), children: [
|
|
2700
|
+
/* @__PURE__ */ jsx11(
|
|
2664
2701
|
"button",
|
|
2665
2702
|
{
|
|
2666
2703
|
type: "button",
|
|
2667
2704
|
className: "nvr-pb",
|
|
2668
2705
|
"aria-label": t("nvr.player.back15"),
|
|
2669
2706
|
onClick: () => ctl.current?.skip(-15e3),
|
|
2670
|
-
children: /* @__PURE__ */
|
|
2707
|
+
children: /* @__PURE__ */ jsx11(Rewind, { size: 18 })
|
|
2671
2708
|
}
|
|
2672
2709
|
),
|
|
2673
|
-
/* @__PURE__ */
|
|
2710
|
+
/* @__PURE__ */ jsx11(
|
|
2674
2711
|
"button",
|
|
2675
2712
|
{
|
|
2676
2713
|
type: "button",
|
|
@@ -2678,10 +2715,10 @@ function CameraPage(p) {
|
|
|
2678
2715
|
"aria-label": ps.paused ? t("nvr.player.play") : t("nvr.player.pause"),
|
|
2679
2716
|
disabled: ps.live,
|
|
2680
2717
|
onClick: () => ctl.current?.togglePlayPause(),
|
|
2681
|
-
children: ps.paused ? /* @__PURE__ */
|
|
2718
|
+
children: ps.paused ? /* @__PURE__ */ jsx11(Play, { size: 18 }) : /* @__PURE__ */ jsx11(Pause, { size: 18 })
|
|
2682
2719
|
}
|
|
2683
2720
|
),
|
|
2684
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ jsx11(
|
|
2685
2722
|
"button",
|
|
2686
2723
|
{
|
|
2687
2724
|
type: "button",
|
|
@@ -2689,10 +2726,10 @@ function CameraPage(p) {
|
|
|
2689
2726
|
"aria-label": t("nvr.player.fwd15"),
|
|
2690
2727
|
disabled: ps.live,
|
|
2691
2728
|
onClick: () => ctl.current?.skip(15e3),
|
|
2692
|
-
children: /* @__PURE__ */
|
|
2729
|
+
children: /* @__PURE__ */ jsx11(FastForward, { size: 18 })
|
|
2693
2730
|
}
|
|
2694
2731
|
),
|
|
2695
|
-
/* @__PURE__ */
|
|
2732
|
+
/* @__PURE__ */ jsxs9(
|
|
2696
2733
|
"button",
|
|
2697
2734
|
{
|
|
2698
2735
|
type: "button",
|
|
@@ -2708,24 +2745,24 @@ function CameraPage(p) {
|
|
|
2708
2745
|
)
|
|
2709
2746
|
] })
|
|
2710
2747
|
] }) }),
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-stage-bar", children: [
|
|
2749
|
+
/* @__PURE__ */ jsx11("span", { className: "nvr-statusdot" + (ps.live ? " nvr-statusdot--live" : ""), "aria-hidden": "true" }),
|
|
2750
|
+
/* @__PURE__ */ jsxs9("span", { className: "nvr-stage-title", children: [
|
|
2751
|
+
/* @__PURE__ */ jsx11("b", { children: name }),
|
|
2752
|
+
/* @__PURE__ */ jsx11("small", { children: statusText })
|
|
2716
2753
|
] }),
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2754
|
+
/* @__PURE__ */ jsxs9("span", { className: "nvr-stage-actions", children: [
|
|
2755
|
+
/* @__PURE__ */ jsx11(
|
|
2719
2756
|
"button",
|
|
2720
2757
|
{
|
|
2721
2758
|
type: "button",
|
|
2722
2759
|
className: "nvr-iconbtn",
|
|
2723
2760
|
"aria-label": t("nvr.player.snapshot"),
|
|
2724
2761
|
onClick: () => ctl.current?.snapshot(),
|
|
2725
|
-
children: /* @__PURE__ */
|
|
2762
|
+
children: /* @__PURE__ */ jsx11(Camera3, { size: 16 })
|
|
2726
2763
|
}
|
|
2727
2764
|
),
|
|
2728
|
-
canExport && /* @__PURE__ */
|
|
2765
|
+
canExport && /* @__PURE__ */ jsx11(
|
|
2729
2766
|
"button",
|
|
2730
2767
|
{
|
|
2731
2768
|
type: "button",
|
|
@@ -2734,25 +2771,25 @@ function CameraPage(p) {
|
|
|
2734
2771
|
title: t("nvr.clip.download"),
|
|
2735
2772
|
"aria-pressed": !!clip,
|
|
2736
2773
|
onClick: toggleClip,
|
|
2737
|
-
children: /* @__PURE__ */
|
|
2774
|
+
children: /* @__PURE__ */ jsx11(Download2, { size: 16 })
|
|
2738
2775
|
}
|
|
2739
2776
|
),
|
|
2740
|
-
/* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2777
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: "nvr-iconbtn", "aria-label": t("nvr.player.pip"), onClick: onPip, children: /* @__PURE__ */ jsx11(PictureInPicture2, { size: 16 }) }),
|
|
2778
|
+
/* @__PURE__ */ jsx11(
|
|
2742
2779
|
"button",
|
|
2743
2780
|
{
|
|
2744
2781
|
type: "button",
|
|
2745
2782
|
className: "nvr-iconbtn",
|
|
2746
2783
|
"aria-label": t("nvr.player.fullscreen"),
|
|
2747
2784
|
onClick: () => ctl.current?.fullscreen(),
|
|
2748
|
-
children: /* @__PURE__ */
|
|
2785
|
+
children: /* @__PURE__ */ jsx11(Maximize2, { size: 16 })
|
|
2749
2786
|
}
|
|
2750
2787
|
)
|
|
2751
2788
|
] })
|
|
2752
2789
|
] }),
|
|
2753
|
-
pipNote && /* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
2755
|
-
pipNote === "homescreen" && externalUrl && /* @__PURE__ */
|
|
2790
|
+
pipNote && /* @__PURE__ */ jsxs9("div", { className: "nvr-pipnote", role: "status", children: [
|
|
2791
|
+
/* @__PURE__ */ jsx11("span", { children: t(pipNote === "homescreen" ? "nvr.player.pipHomeScreen" : "nvr.player.pipUnsupported") }),
|
|
2792
|
+
pipNote === "homescreen" && externalUrl && /* @__PURE__ */ jsx11(
|
|
2756
2793
|
"a",
|
|
2757
2794
|
{
|
|
2758
2795
|
className: "nvr-pipnote__open",
|
|
@@ -2763,21 +2800,21 @@ function CameraPage(p) {
|
|
|
2763
2800
|
children: t("nvr.player.openInSafari")
|
|
2764
2801
|
}
|
|
2765
2802
|
),
|
|
2766
|
-
/* @__PURE__ */
|
|
2803
|
+
/* @__PURE__ */ jsx11(
|
|
2767
2804
|
"button",
|
|
2768
2805
|
{
|
|
2769
2806
|
type: "button",
|
|
2770
2807
|
className: "nvr-iconbtn nvr-pipnote__close",
|
|
2771
2808
|
"aria-label": t("nvr.player.dismiss"),
|
|
2772
2809
|
onClick: () => setPipNote(null),
|
|
2773
|
-
children: /* @__PURE__ */
|
|
2810
|
+
children: /* @__PURE__ */ jsx11(X2, { size: 14 })
|
|
2774
2811
|
}
|
|
2775
2812
|
)
|
|
2776
2813
|
] })
|
|
2777
2814
|
] }) }),
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ jsxs9("aside", { className: "nvr-card nvr-cam__right" + (clip ? " nvr-cam__right--clip" : ""), children: [
|
|
2816
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-tabs", role: "tablist", "data-active": immersive ? tab : void 0, children: [
|
|
2817
|
+
/* @__PURE__ */ jsx11(
|
|
2781
2818
|
"button",
|
|
2782
2819
|
{
|
|
2783
2820
|
type: "button",
|
|
@@ -2788,7 +2825,7 @@ function CameraPage(p) {
|
|
|
2788
2825
|
children: t("nvr.tab.timeline")
|
|
2789
2826
|
}
|
|
2790
2827
|
),
|
|
2791
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ jsxs9(
|
|
2792
2829
|
"button",
|
|
2793
2830
|
{
|
|
2794
2831
|
type: "button",
|
|
@@ -2803,7 +2840,7 @@ function CameraPage(p) {
|
|
|
2803
2840
|
}
|
|
2804
2841
|
)
|
|
2805
2842
|
] }),
|
|
2806
|
-
/* @__PURE__ */
|
|
2843
|
+
/* @__PURE__ */ jsx11("div", { className: "nvr-filters", children: SENTINEL_EVENT_CLASSES.filter((k) => present[k]).map((k) => /* @__PURE__ */ jsxs9(
|
|
2807
2844
|
"button",
|
|
2808
2845
|
{
|
|
2809
2846
|
type: "button",
|
|
@@ -2812,13 +2849,13 @@ function CameraPage(p) {
|
|
|
2812
2849
|
title: classLabel(t, k),
|
|
2813
2850
|
"aria-pressed": !filterOff[k],
|
|
2814
2851
|
children: [
|
|
2815
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsx11(ClassBadge, { cls: k, size: 18 }),
|
|
2816
2853
|
present[k]
|
|
2817
2854
|
]
|
|
2818
2855
|
},
|
|
2819
2856
|
k
|
|
2820
2857
|
)) }),
|
|
2821
|
-
tab === "tl" ? /* @__PURE__ */
|
|
2858
|
+
tab === "tl" ? /* @__PURE__ */ jsx11(
|
|
2822
2859
|
VerticalTimeline,
|
|
2823
2860
|
{
|
|
2824
2861
|
camId,
|
|
@@ -2841,7 +2878,7 @@ function CameraPage(p) {
|
|
|
2841
2878
|
hold: !!clip && !!clipEdge,
|
|
2842
2879
|
onUserCenter
|
|
2843
2880
|
}
|
|
2844
|
-
) : /* @__PURE__ */
|
|
2881
|
+
) : /* @__PURE__ */ jsx11(
|
|
2845
2882
|
EventList,
|
|
2846
2883
|
{
|
|
2847
2884
|
camId,
|
|
@@ -2851,7 +2888,7 @@ function CameraPage(p) {
|
|
|
2851
2888
|
onClip: canExport ? clipEvent : void 0
|
|
2852
2889
|
}
|
|
2853
2890
|
),
|
|
2854
|
-
clip && /* @__PURE__ */
|
|
2891
|
+
clip && /* @__PURE__ */ jsx11(
|
|
2855
2892
|
ClipBar,
|
|
2856
2893
|
{
|
|
2857
2894
|
camId,
|
|
@@ -2865,18 +2902,18 @@ function CameraPage(p) {
|
|
|
2865
2902
|
},
|
|
2866
2903
|
camId
|
|
2867
2904
|
),
|
|
2868
|
-
!clip && /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2905
|
+
!clip && /* @__PURE__ */ jsxs9("div", { className: "nvr-datechip" + (ps.live ? "" : " nvr-datechip--rec"), children: [
|
|
2906
|
+
/* @__PURE__ */ jsx11(
|
|
2870
2907
|
"button",
|
|
2871
2908
|
{
|
|
2872
2909
|
type: "button",
|
|
2873
2910
|
onClick: () => goToDay(sentinelAddDays(centerDay, -1)).catch(() => setLoadError(true)),
|
|
2874
2911
|
disabled: nav.prevDisabled,
|
|
2875
2912
|
"aria-label": t("nvr.date.prevDay"),
|
|
2876
|
-
children: /* @__PURE__ */
|
|
2913
|
+
children: /* @__PURE__ */ jsx11(ChevronLeft3, { size: 14 })
|
|
2877
2914
|
}
|
|
2878
2915
|
),
|
|
2879
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsxs9(
|
|
2880
2917
|
"button",
|
|
2881
2918
|
{
|
|
2882
2919
|
type: "button",
|
|
@@ -2884,19 +2921,19 @@ function CameraPage(p) {
|
|
|
2884
2921
|
onClick: () => setDt(true),
|
|
2885
2922
|
"aria-label": t("nvr.date.title"),
|
|
2886
2923
|
children: [
|
|
2887
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx11(Calendar, { size: 13 }),
|
|
2888
2925
|
fmtDay(centerDay, locale)
|
|
2889
2926
|
]
|
|
2890
2927
|
}
|
|
2891
2928
|
),
|
|
2892
|
-
/* @__PURE__ */
|
|
2929
|
+
/* @__PURE__ */ jsx11(
|
|
2893
2930
|
"button",
|
|
2894
2931
|
{
|
|
2895
2932
|
type: "button",
|
|
2896
2933
|
onClick: () => goToDay(sentinelAddDays(centerDay, 1)).catch(() => setLoadError(true)),
|
|
2897
2934
|
disabled: nav.nextDisabled,
|
|
2898
2935
|
"aria-label": t("nvr.date.nextDay"),
|
|
2899
|
-
children: /* @__PURE__ */
|
|
2936
|
+
children: /* @__PURE__ */ jsx11(ChevronRight3, { size: 14 })
|
|
2900
2937
|
}
|
|
2901
2938
|
)
|
|
2902
2939
|
] })
|
|
@@ -2917,9 +2954,122 @@ function CameraPage(p) {
|
|
|
2917
2954
|
}
|
|
2918
2955
|
|
|
2919
2956
|
// src/ui/components/Appearance.tsx
|
|
2920
|
-
import { useState as
|
|
2921
|
-
import { ChevronDown, Languages, Palette, Sun } from "lucide-react";
|
|
2922
|
-
|
|
2957
|
+
import { useEffect as useEffect6, useRef as useRef6, useState as useState8 } from "react";
|
|
2958
|
+
import { Blend, ChevronDown, Contrast, Languages, Layers, Palette, Sun } from "lucide-react";
|
|
2959
|
+
|
|
2960
|
+
// src/ui/components/GlassSegment.tsx
|
|
2961
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState7 } from "react";
|
|
2962
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2963
|
+
var measureCtx;
|
|
2964
|
+
function textWidth(text, font) {
|
|
2965
|
+
if (measureCtx === void 0) {
|
|
2966
|
+
try {
|
|
2967
|
+
measureCtx = document.createElement("canvas").getContext("2d");
|
|
2968
|
+
} catch {
|
|
2969
|
+
measureCtx = null;
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
if (!measureCtx) return 0;
|
|
2973
|
+
measureCtx.font = font;
|
|
2974
|
+
return measureCtx.measureText(text).width;
|
|
2975
|
+
}
|
|
2976
|
+
function GlassSegment({
|
|
2977
|
+
options,
|
|
2978
|
+
value,
|
|
2979
|
+
onChange,
|
|
2980
|
+
label,
|
|
2981
|
+
className,
|
|
2982
|
+
activation = "auto"
|
|
2983
|
+
}) {
|
|
2984
|
+
const ref = useRef5(null);
|
|
2985
|
+
const [cursor, setCursor] = useState7(null);
|
|
2986
|
+
const n = options.length;
|
|
2987
|
+
const found = options.findIndex((o) => o.value === value);
|
|
2988
|
+
const index = Math.max(0, found);
|
|
2989
|
+
const stop = cursor !== null && cursor < n ? cursor : index;
|
|
2990
|
+
const labels = options.map((o) => o.label).join("\n");
|
|
2991
|
+
useLayoutEffect2(() => {
|
|
2992
|
+
const el = ref.current;
|
|
2993
|
+
if (!el || !labels.trim()) return;
|
|
2994
|
+
let alive = true;
|
|
2995
|
+
const fit = () => {
|
|
2996
|
+
el.removeAttribute("data-tight");
|
|
2997
|
+
const opts = [...el.querySelectorAll(".nvr-gl-seg__opt")];
|
|
2998
|
+
const cs = opts[0] ? getComputedStyle(opts[0]) : null;
|
|
2999
|
+
if (!opts[0] || !cs) return;
|
|
3000
|
+
const font = `600 ${cs.fontSize} ${cs.fontFamily}`;
|
|
3001
|
+
const need = Math.max(...opts.map((o) => textWidth(o.textContent ?? "", font)));
|
|
3002
|
+
const room = opts[0].offsetWidth - parseFloat(cs.paddingLeft) - parseFloat(cs.paddingRight);
|
|
3003
|
+
el.toggleAttribute("data-tight", need + 1 > room);
|
|
3004
|
+
};
|
|
3005
|
+
fit();
|
|
3006
|
+
const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(fit);
|
|
3007
|
+
ro?.observe(el);
|
|
3008
|
+
void document.fonts?.ready.then(() => {
|
|
3009
|
+
if (alive) fit();
|
|
3010
|
+
});
|
|
3011
|
+
return () => {
|
|
3012
|
+
alive = false;
|
|
3013
|
+
ro?.disconnect();
|
|
3014
|
+
};
|
|
3015
|
+
}, [labels]);
|
|
3016
|
+
function onKeyDown(e) {
|
|
3017
|
+
const from = activation === "manual" ? stop : found;
|
|
3018
|
+
let i = null;
|
|
3019
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") i = from < 0 ? 0 : (from + 1) % n;
|
|
3020
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") i = from < 0 ? n - 1 : (from - 1 + n) % n;
|
|
3021
|
+
else if (e.key === "Home") i = 0;
|
|
3022
|
+
else if (e.key === "End") i = n - 1;
|
|
3023
|
+
const next = i === null ? void 0 : options[i];
|
|
3024
|
+
if (i === null || !next) return;
|
|
3025
|
+
e.preventDefault();
|
|
3026
|
+
if (activation === "manual") setCursor(i);
|
|
3027
|
+
else if (next.value !== value) onChange(next.value);
|
|
3028
|
+
ref.current?.querySelectorAll(".nvr-gl-seg__opt")[i]?.focus();
|
|
3029
|
+
}
|
|
3030
|
+
function choose(o) {
|
|
3031
|
+
setCursor(null);
|
|
3032
|
+
if (o.value !== value) onChange(o.value);
|
|
3033
|
+
}
|
|
3034
|
+
return /* @__PURE__ */ jsxs10(
|
|
3035
|
+
"div",
|
|
3036
|
+
{
|
|
3037
|
+
ref,
|
|
3038
|
+
role: "radiogroup",
|
|
3039
|
+
"aria-label": label,
|
|
3040
|
+
className: className ? `nvr-gl-seg ${className}` : "nvr-gl-seg",
|
|
3041
|
+
"data-none": found < 0 ? "" : void 0,
|
|
3042
|
+
style: { "--nvr-gl-seg-n": n, "--nvr-gl-seg-i": index },
|
|
3043
|
+
onKeyDown,
|
|
3044
|
+
onBlur: (e) => {
|
|
3045
|
+
if (cursor !== null && !e.currentTarget.contains(e.relatedTarget)) setCursor(null);
|
|
3046
|
+
},
|
|
3047
|
+
children: [
|
|
3048
|
+
/* @__PURE__ */ jsx12("span", { className: "nvr-gl-seg__track", "aria-hidden": "true" }),
|
|
3049
|
+
/* @__PURE__ */ jsx12("span", { className: "nvr-gl-seg__lens", "aria-hidden": "true" }),
|
|
3050
|
+
options.map((o, i) => /* @__PURE__ */ jsx12(
|
|
3051
|
+
"button",
|
|
3052
|
+
{
|
|
3053
|
+
type: "button",
|
|
3054
|
+
role: "radio",
|
|
3055
|
+
"aria-checked": i === found,
|
|
3056
|
+
tabIndex: i === stop ? 0 : -1,
|
|
3057
|
+
className: "nvr-gl-seg__opt",
|
|
3058
|
+
"data-value": o.value,
|
|
3059
|
+
onClick: () => choose(o),
|
|
3060
|
+
children: o.label
|
|
3061
|
+
},
|
|
3062
|
+
o.value
|
|
3063
|
+
))
|
|
3064
|
+
]
|
|
3065
|
+
}
|
|
3066
|
+
);
|
|
3067
|
+
}
|
|
3068
|
+
|
|
3069
|
+
// src/ui/components/Appearance.tsx
|
|
3070
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3071
|
+
var STYLES = ["classic", "glas"];
|
|
3072
|
+
var STRENGTHS = ["clear", "tinted", "opaque"];
|
|
2923
3073
|
function hexHue(hex) {
|
|
2924
3074
|
const r = parseInt(hex.slice(1, 3), 16) / 255, g = parseInt(hex.slice(3, 5), 16) / 255, b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
2925
3075
|
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
@@ -2939,7 +3089,7 @@ function ThemeSwatch({
|
|
|
2939
3089
|
ariaLabel
|
|
2940
3090
|
}) {
|
|
2941
3091
|
const c = THEMES[name][previewMode];
|
|
2942
|
-
return /* @__PURE__ */
|
|
3092
|
+
return /* @__PURE__ */ jsxs11(
|
|
2943
3093
|
"button",
|
|
2944
3094
|
{
|
|
2945
3095
|
type: "button",
|
|
@@ -2948,8 +3098,8 @@ function ThemeSwatch({
|
|
|
2948
3098
|
"aria-label": ariaLabel,
|
|
2949
3099
|
"aria-pressed": active,
|
|
2950
3100
|
children: [
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-swatch__preview", style: { background: c.bg }, "aria-hidden": "true", children: [
|
|
3102
|
+
/* @__PURE__ */ jsx13(
|
|
2953
3103
|
"div",
|
|
2954
3104
|
{
|
|
2955
3105
|
style: {
|
|
@@ -2964,7 +3114,7 @@ function ThemeSwatch({
|
|
|
2964
3114
|
}
|
|
2965
3115
|
}
|
|
2966
3116
|
),
|
|
2967
|
-
/* @__PURE__ */
|
|
3117
|
+
/* @__PURE__ */ jsx13(
|
|
2968
3118
|
"div",
|
|
2969
3119
|
{
|
|
2970
3120
|
style: {
|
|
@@ -2978,7 +3128,7 @@ function ThemeSwatch({
|
|
|
2978
3128
|
}
|
|
2979
3129
|
}
|
|
2980
3130
|
),
|
|
2981
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsx13(
|
|
2982
3132
|
"div",
|
|
2983
3133
|
{
|
|
2984
3134
|
style: {
|
|
@@ -2993,7 +3143,7 @@ function ThemeSwatch({
|
|
|
2993
3143
|
}
|
|
2994
3144
|
}
|
|
2995
3145
|
),
|
|
2996
|
-
/* @__PURE__ */
|
|
3146
|
+
/* @__PURE__ */ jsx13(
|
|
2997
3147
|
"div",
|
|
2998
3148
|
{
|
|
2999
3149
|
style: {
|
|
@@ -3009,7 +3159,7 @@ function ThemeSwatch({
|
|
|
3009
3159
|
}
|
|
3010
3160
|
)
|
|
3011
3161
|
] }),
|
|
3012
|
-
/* @__PURE__ */
|
|
3162
|
+
/* @__PURE__ */ jsx13("span", { className: "nvr-swatch__name", children: THEME_LABELS[name] })
|
|
3013
3163
|
]
|
|
3014
3164
|
}
|
|
3015
3165
|
);
|
|
@@ -3017,20 +3167,101 @@ function ThemeSwatch({
|
|
|
3017
3167
|
function AppearanceSection(p) {
|
|
3018
3168
|
const { t } = useSentinelUi();
|
|
3019
3169
|
const resolved = resolveMode(p.mode);
|
|
3020
|
-
const
|
|
3021
|
-
const
|
|
3022
|
-
const
|
|
3170
|
+
const glas = !!p.onUiStyle && p.uiStyle === "glas";
|
|
3171
|
+
const ownAccent = (name) => glas ? glasAccent(void 0, resolved).accent : THEMES[name][resolved].accent;
|
|
3172
|
+
const defaultHue = (name) => hexHue(ownAccent(name));
|
|
3173
|
+
const [localHue, setLocalHue] = useState8(p.accentHue ?? defaultHue(p.theme));
|
|
3174
|
+
const [hueForGlas, setHueForGlas] = useState8(glas);
|
|
3175
|
+
if (hueForGlas !== glas) {
|
|
3176
|
+
setHueForGlas(glas);
|
|
3177
|
+
if (p.accentHue === void 0) setLocalHue(defaultHue(p.theme));
|
|
3178
|
+
}
|
|
3179
|
+
const previewColor = p.accentHue !== void 0 ? `hsl(${p.accentHue}, 78%, ${resolved === "dark" ? 60 : 50}%)` : ownAccent(p.theme);
|
|
3023
3180
|
const modes = ["light", "dark", "auto"];
|
|
3024
|
-
const chip = (bg, fg, icon) => /* @__PURE__ */
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3181
|
+
const chip = (bg, fg, icon) => /* @__PURE__ */ jsx13("span", { className: "nvr-set__chip", style: { background: bg, color: fg }, children: icon });
|
|
3182
|
+
const seg = (label, values, value, key, on) => glas ? /* @__PURE__ */ jsx13(
|
|
3183
|
+
GlassSegment,
|
|
3184
|
+
{
|
|
3185
|
+
className: "nvr-gl-seg--settings",
|
|
3186
|
+
label,
|
|
3187
|
+
value,
|
|
3188
|
+
onChange: on,
|
|
3189
|
+
activation: "manual",
|
|
3190
|
+
options: values.map((v) => ({ value: v, label: t(`${key}.${v}`) }))
|
|
3191
|
+
}
|
|
3192
|
+
) : /* @__PURE__ */ jsx13("div", { className: "nvr-seg", role: "group", "aria-label": label, children: values.map((v) => /* @__PURE__ */ jsx13(
|
|
3193
|
+
"button",
|
|
3194
|
+
{
|
|
3195
|
+
type: "button",
|
|
3196
|
+
className: "nvr-seg__btn" + (value === v ? " nvr-seg__btn--active" : ""),
|
|
3197
|
+
onClick: () => on(v),
|
|
3198
|
+
"aria-pressed": value === v,
|
|
3199
|
+
"data-value": key === "nvr.settings.style" ? v : void 0,
|
|
3200
|
+
children: t(`${key}.${v}`)
|
|
3201
|
+
},
|
|
3202
|
+
v
|
|
3203
|
+
)) });
|
|
3204
|
+
const styleRow = useRef6(null);
|
|
3205
|
+
const refocus = useRef6(false);
|
|
3206
|
+
useEffect6(() => {
|
|
3207
|
+
if (!refocus.current) return;
|
|
3208
|
+
refocus.current = false;
|
|
3209
|
+
if (document.activeElement && document.activeElement !== document.body) return;
|
|
3210
|
+
styleRow.current?.querySelector(`[data-value="${p.uiStyle ?? "classic"}"]`)?.focus();
|
|
3211
|
+
}, [p.uiStyle]);
|
|
3212
|
+
const chooseStyle = (v) => {
|
|
3213
|
+
if (v !== (p.uiStyle ?? "classic")) refocus.current = true;
|
|
3214
|
+
p.onUiStyle?.(v);
|
|
3215
|
+
};
|
|
3216
|
+
return /* @__PURE__ */ jsxs11("section", { className: "nvr-set__section", children: [
|
|
3217
|
+
/* @__PURE__ */ jsx13("div", { className: "nvr-section__label", children: t("nvr.settings.appearance") }),
|
|
3218
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-card nvr-set-card", children: [
|
|
3219
|
+
p.onUiStyle && /* @__PURE__ */ jsxs11("div", { ref: styleRow, className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3220
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3221
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx13(Layers, { size: 14, strokeWidth: 1.75 })),
|
|
3222
|
+
t("nvr.settings.style")
|
|
3223
|
+
] }),
|
|
3224
|
+
seg(t("nvr.settings.style.groupAria"), STYLES, p.uiStyle ?? "classic", "nvr.settings.style", chooseStyle),
|
|
3225
|
+
/* @__PURE__ */ jsx13("p", { className: "nvr-set__hint", children: t("nvr.settings.style.hint") })
|
|
3226
|
+
] }),
|
|
3227
|
+
glas && p.onGlassStrength && /* @__PURE__ */ jsxs11("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3228
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3229
|
+
chip("var(--info-soft)", "var(--info)", /* @__PURE__ */ jsx13(Blend, { size: 14, strokeWidth: 1.75 })),
|
|
3230
|
+
t("nvr.settings.glassStrength")
|
|
3231
|
+
] }),
|
|
3232
|
+
seg(
|
|
3233
|
+
t("nvr.settings.glassStrength.groupAria"),
|
|
3234
|
+
STRENGTHS,
|
|
3235
|
+
p.glassStrength ?? "clear",
|
|
3236
|
+
"nvr.settings.glassStrength",
|
|
3237
|
+
p.onGlassStrength
|
|
3238
|
+
)
|
|
3239
|
+
] }),
|
|
3240
|
+
glas && p.onReduceTransparency && /* @__PURE__ */ jsxs11("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3241
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3242
|
+
chip("var(--info-soft)", "var(--info)", /* @__PURE__ */ jsx13(Contrast, { size: 14, strokeWidth: 1.75 })),
|
|
3243
|
+
t("nvr.settings.reduceTransparency")
|
|
3244
|
+
] }),
|
|
3245
|
+
/* @__PURE__ */ jsx13(
|
|
3246
|
+
"button",
|
|
3247
|
+
{
|
|
3248
|
+
type: "button",
|
|
3249
|
+
role: "switch",
|
|
3250
|
+
"aria-checked": !!p.reduceTransparency,
|
|
3251
|
+
"aria-label": t("nvr.settings.reduceTransparency"),
|
|
3252
|
+
className: "nvr-switch" + (p.reduceTransparency ? " nvr-switch--on" : ""),
|
|
3253
|
+
onClick: () => p.onReduceTransparency?.(!p.reduceTransparency),
|
|
3254
|
+
children: /* @__PURE__ */ jsx13("span", { className: "nvr-switch__thumb" })
|
|
3255
|
+
}
|
|
3256
|
+
),
|
|
3257
|
+
/* @__PURE__ */ jsx13("p", { className: "nvr-set__hint", children: t("nvr.settings.reduceTransparency.hint") })
|
|
3258
|
+
] }),
|
|
3259
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3260
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3261
|
+
chip("var(--warning-soft)", "var(--warning)", /* @__PURE__ */ jsx13(Sun, { size: 14, strokeWidth: 1.75 })),
|
|
3031
3262
|
t("nvr.settings.mode")
|
|
3032
3263
|
] }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3264
|
+
glas ? seg(t("nvr.settings.mode"), modes, p.mode, "nvr.settings.mode", p.onMode) : /* @__PURE__ */ jsx13("div", { className: "nvr-seg", role: "group", "aria-label": t("nvr.settings.mode"), children: modes.map((m) => /* @__PURE__ */ jsx13(
|
|
3034
3265
|
"button",
|
|
3035
3266
|
{
|
|
3036
3267
|
type: "button",
|
|
@@ -3042,13 +3273,13 @@ function AppearanceSection(p) {
|
|
|
3042
3273
|
m
|
|
3043
3274
|
)) })
|
|
3044
3275
|
] }),
|
|
3045
|
-
/* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */
|
|
3276
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3277
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3278
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx13(Languages, { size: 14, strokeWidth: 1.75 })),
|
|
3048
3279
|
t("nvr.settings.language")
|
|
3049
3280
|
] }),
|
|
3050
|
-
/* @__PURE__ */
|
|
3051
|
-
/* @__PURE__ */
|
|
3281
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-select", children: [
|
|
3282
|
+
/* @__PURE__ */ jsxs11(
|
|
3052
3283
|
"select",
|
|
3053
3284
|
{
|
|
3054
3285
|
className: "nvr-select__native",
|
|
@@ -3056,20 +3287,26 @@ function AppearanceSection(p) {
|
|
|
3056
3287
|
onChange: (e) => p.onLanguage(e.target.value),
|
|
3057
3288
|
"aria-label": t("nvr.settings.language"),
|
|
3058
3289
|
children: [
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
p.languages.map((l) => /* @__PURE__ */
|
|
3290
|
+
/* @__PURE__ */ jsx13("option", { value: "auto", children: t("nvr.settings.language.auto") }),
|
|
3291
|
+
p.languages.map((l) => /* @__PURE__ */ jsx13("option", { value: l.id, children: l.label }, l.id))
|
|
3061
3292
|
]
|
|
3062
3293
|
}
|
|
3063
3294
|
),
|
|
3064
|
-
/* @__PURE__ */
|
|
3295
|
+
/* @__PURE__ */ jsx13(ChevronDown, { size: 14, strokeWidth: 2, className: "nvr-select__chevron", "aria-hidden": "true" })
|
|
3065
3296
|
] })
|
|
3066
3297
|
] }),
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */
|
|
3298
|
+
glas ? /* @__PURE__ */ jsxs11("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3299
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3300
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx13(Palette, { size: 14, strokeWidth: 1.75 })),
|
|
3301
|
+
t("nvr.settings.theme")
|
|
3302
|
+
] }),
|
|
3303
|
+
/* @__PURE__ */ jsx13("p", { className: "nvr-set__hint", children: t("nvr.settings.theme.glasHint") })
|
|
3304
|
+
] }) : /* @__PURE__ */ jsxs11("div", { className: "nvr-set__row", children: [
|
|
3305
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-set__label", children: [
|
|
3306
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx13(Palette, { size: 14, strokeWidth: 1.75 })),
|
|
3070
3307
|
t("nvr.settings.theme")
|
|
3071
3308
|
] }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3309
|
+
/* @__PURE__ */ jsx13("div", { className: "nvr-swatches", children: THEME_NAMES.map((n) => /* @__PURE__ */ jsx13(
|
|
3073
3310
|
ThemeSwatch,
|
|
3074
3311
|
{
|
|
3075
3312
|
name: n,
|
|
@@ -3084,14 +3321,14 @@ function AppearanceSection(p) {
|
|
|
3084
3321
|
n
|
|
3085
3322
|
)) })
|
|
3086
3323
|
] }),
|
|
3087
|
-
/* @__PURE__ */
|
|
3088
|
-
/* @__PURE__ */
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */
|
|
3324
|
+
/* @__PURE__ */ jsx13("div", { className: "nvr-set__row", children: /* @__PURE__ */ jsxs11("div", { className: "nvr-accent", children: [
|
|
3325
|
+
/* @__PURE__ */ jsxs11("div", { className: "nvr-accent__label", children: [
|
|
3326
|
+
/* @__PURE__ */ jsxs11("span", { className: "nvr-set__label", children: [
|
|
3327
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx13(Palette, { size: 14, strokeWidth: 1.75 })),
|
|
3091
3328
|
t("nvr.settings.accent"),
|
|
3092
|
-
/* @__PURE__ */
|
|
3329
|
+
/* @__PURE__ */ jsx13("span", { className: "nvr-accent__dot", style: { background: previewColor }, "aria-hidden": "true" })
|
|
3093
3330
|
] }),
|
|
3094
|
-
p.accentHue !== void 0 && /* @__PURE__ */
|
|
3331
|
+
p.accentHue !== void 0 && /* @__PURE__ */ jsx13(
|
|
3095
3332
|
"button",
|
|
3096
3333
|
{
|
|
3097
3334
|
type: "button",
|
|
@@ -3104,7 +3341,7 @@ function AppearanceSection(p) {
|
|
|
3104
3341
|
}
|
|
3105
3342
|
)
|
|
3106
3343
|
] }),
|
|
3107
|
-
/* @__PURE__ */
|
|
3344
|
+
/* @__PURE__ */ jsx13(
|
|
3108
3345
|
"input",
|
|
3109
3346
|
{
|
|
3110
3347
|
type: "range",
|
|
@@ -3136,6 +3373,10 @@ export {
|
|
|
3136
3373
|
EventBadges,
|
|
3137
3374
|
EventList,
|
|
3138
3375
|
EventsStrip,
|
|
3376
|
+
GlassCameras,
|
|
3377
|
+
GlassEvents,
|
|
3378
|
+
GlassNvr,
|
|
3379
|
+
GlassSections,
|
|
3139
3380
|
Hero,
|
|
3140
3381
|
HistogramCard,
|
|
3141
3382
|
SentinelUiProvider,
|
|
@@ -3176,5 +3417,4 @@ export {
|
|
|
3176
3417
|
useSentinelUi,
|
|
3177
3418
|
watchSystemMode
|
|
3178
3419
|
};
|
|
3179
|
-
/*! Theme tokens derived from HAPulse (https://github.com/jlnbln/HAPulse) — MIT License, Copyright (c) 2026 Julian */
|
|
3180
3420
|
//# sourceMappingURL=index.js.map
|