@sentinel-nvr/web 0.20.2 → 0.21.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 +21 -0
- package/dist/chunk-KUDATN2V.js +324 -0
- package/dist/chunk-KUDATN2V.js.map +1 -0
- package/dist/glas/index.d.ts +76 -0
- package/dist/glas/index.js +949 -0
- package/dist/glas/index.js.map +1 -0
- package/dist/glas-data-CSRWRmcF.d.ts +368 -0
- package/dist/ui/glas.css +1250 -0
- package/dist/ui/index.d.ts +68 -96
- package/dist/ui/index.js +782 -683
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/locales/de.json +14 -0
- package/dist/ui/locales/en.json +14 -0
- package/dist/ui/locales/es.json +14 -0
- package/dist/ui/locales/fr.json +14 -0
- package/dist/ui/locales/it.json +14 -0
- package/dist/ui/locales/pt.json +14 -0
- package/dist/ui/locales/sv.json +14 -0
- package/dist/ui/ui.css +44 -0
- package/package.json +9 -2
package/dist/ui/index.js
CHANGED
|
@@ -35,6 +35,18 @@ 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
|
+
isThemeName,
|
|
46
|
+
resolveMode,
|
|
47
|
+
resolveThemeMode,
|
|
48
|
+
watchSystemMode
|
|
49
|
+
} from "../chunk-KUDATN2V.js";
|
|
38
50
|
|
|
39
51
|
// src/ui/context.tsx
|
|
40
52
|
import { createContext, useContext } from "react";
|
|
@@ -100,316 +112,6 @@ var UI_LOCALE_LABELS = {
|
|
|
100
112
|
sv: "Svenska"
|
|
101
113
|
};
|
|
102
114
|
|
|
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
115
|
// src/ui/format.tsx
|
|
414
116
|
function fmtRelative(ts, t, nowMs = Date.now()) {
|
|
415
117
|
const s = Math.max(0, (nowMs - ts) / 1e3);
|
|
@@ -675,6 +377,245 @@ function CameraGrid({ cameras, icon }) {
|
|
|
675
377
|
] });
|
|
676
378
|
}
|
|
677
379
|
|
|
380
|
+
// src/ui/components/Glass.tsx
|
|
381
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
382
|
+
import { Camera as Camera2, Cctv, ChevronLeft, ChevronRight, Zap } from "lucide-react";
|
|
383
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
384
|
+
var RETRY_MS = 3e4;
|
|
385
|
+
function useSnapshotTick(ms) {
|
|
386
|
+
const [tick, setTick] = useState2(() => Date.now());
|
|
387
|
+
const [count, setCount] = useState2(0);
|
|
388
|
+
useEffect2(() => {
|
|
389
|
+
const id = setInterval(() => {
|
|
390
|
+
if (document.visibilityState !== "visible") return;
|
|
391
|
+
setTick(Date.now());
|
|
392
|
+
setCount((n) => n + 1);
|
|
393
|
+
}, ms);
|
|
394
|
+
return () => clearInterval(id);
|
|
395
|
+
}, [ms]);
|
|
396
|
+
return { tick, retry: Math.floor(count * ms / RETRY_MS) };
|
|
397
|
+
}
|
|
398
|
+
function GlassSnapshot({ cam, tick, retry }) {
|
|
399
|
+
const { client } = useSentinelUi();
|
|
400
|
+
const src = client.snapshotUrl(cam.id, tick, tileSnapshotWidth());
|
|
401
|
+
const fallback = cam.latestThumbId ? client.segmentThumbUrl(cam.latestThumbId) : null;
|
|
402
|
+
const [failed, setFailed] = useState2(0);
|
|
403
|
+
const now = useRef({ failed, src });
|
|
404
|
+
now.current = { failed, src };
|
|
405
|
+
useEffect2(() => {
|
|
406
|
+
if (now.current.failed === 0) return void 0;
|
|
407
|
+
const probe = new Image();
|
|
408
|
+
probe.crossOrigin = "anonymous";
|
|
409
|
+
probe.onload = () => setFailed(0);
|
|
410
|
+
probe.src = now.current.src;
|
|
411
|
+
return () => {
|
|
412
|
+
probe.onload = null;
|
|
413
|
+
};
|
|
414
|
+
}, [retry]);
|
|
415
|
+
const [last2, setLast] = useState2(() => hasLastTileSnapshot(cam.id));
|
|
416
|
+
const drawLast = useCallback2(
|
|
417
|
+
(canvas) => void (canvas && drawLastTileSnapshot(cam.id, canvas)),
|
|
418
|
+
[cam.id]
|
|
419
|
+
);
|
|
420
|
+
const url = failed === 0 ? src : failed === 1 && fallback ? fallback : null;
|
|
421
|
+
return url ? /* @__PURE__ */ jsxs3("span", { className: "nvr-camtile__pic", children: [
|
|
422
|
+
last2 && /* @__PURE__ */ jsx5("canvas", { className: "nvr-camtile__img nvr-camtile__img--last", ref: drawLast, "aria-hidden": "true" }),
|
|
423
|
+
/* @__PURE__ */ jsx5(
|
|
424
|
+
"img",
|
|
425
|
+
{
|
|
426
|
+
className: "nvr-camtile__img",
|
|
427
|
+
src: url,
|
|
428
|
+
alt: "",
|
|
429
|
+
crossOrigin: "anonymous",
|
|
430
|
+
onLoad: (e) => {
|
|
431
|
+
const img = e.currentTarget;
|
|
432
|
+
if (failed === 0) rememberTileSnapshot(cam.id, img);
|
|
433
|
+
if (!last2) return;
|
|
434
|
+
const drop = () => setLast(false);
|
|
435
|
+
if (typeof img.decode === "function") img.decode().then(drop, drop);
|
|
436
|
+
else drop();
|
|
437
|
+
},
|
|
438
|
+
onError: () => {
|
|
439
|
+
if (failed > 0 || !fallback) setLast(false);
|
|
440
|
+
setFailed((f) => Math.min(2, f + 1));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
)
|
|
444
|
+
] }) : /* @__PURE__ */ jsx5("span", { className: "nvr-camtile__placeholder", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(Camera2, { size: 22, strokeWidth: 1.5 }) });
|
|
445
|
+
}
|
|
446
|
+
function GlassStrip({
|
|
447
|
+
className,
|
|
448
|
+
count,
|
|
449
|
+
children
|
|
450
|
+
}) {
|
|
451
|
+
const ref = useRef(null);
|
|
452
|
+
const [ends, setEnds] = useState2({ prev: false, next: false });
|
|
453
|
+
useEffect2(() => {
|
|
454
|
+
const el = ref.current;
|
|
455
|
+
if (!el) return void 0;
|
|
456
|
+
const update = () => {
|
|
457
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
458
|
+
const prev = el.scrollLeft > 1;
|
|
459
|
+
const next = el.scrollLeft < max - 1;
|
|
460
|
+
setEnds((o) => o.prev === prev && o.next === next ? o : { prev, next });
|
|
461
|
+
};
|
|
462
|
+
update();
|
|
463
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
464
|
+
const ro = typeof ResizeObserver === "function" ? new ResizeObserver(update) : null;
|
|
465
|
+
ro?.observe(el);
|
|
466
|
+
if (ro && el.firstElementChild) ro.observe(el.firstElementChild);
|
|
467
|
+
return () => {
|
|
468
|
+
el.removeEventListener("scroll", update);
|
|
469
|
+
ro?.disconnect();
|
|
470
|
+
};
|
|
471
|
+
}, [count]);
|
|
472
|
+
const go = (dir) => {
|
|
473
|
+
const el = ref.current;
|
|
474
|
+
if (!el) return;
|
|
475
|
+
const reduce = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
476
|
+
el.scrollBy({ left: dir * el.clientWidth * 0.8, behavior: reduce ? "auto" : "smooth" });
|
|
477
|
+
};
|
|
478
|
+
const paddle = (dir) => /* @__PURE__ */ jsx5(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
type: "button",
|
|
482
|
+
className: "nvr-gl__paddle nvr-glass",
|
|
483
|
+
"data-dir": dir < 0 ? "prev" : "next",
|
|
484
|
+
tabIndex: -1,
|
|
485
|
+
"aria-hidden": "true",
|
|
486
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
487
|
+
onClick: () => go(dir),
|
|
488
|
+
children: dir < 0 ? /* @__PURE__ */ jsx5(ChevronLeft, { size: 20, strokeWidth: 2.25 }) : /* @__PURE__ */ jsx5(ChevronRight, { size: 20, strokeWidth: 2.25 })
|
|
489
|
+
}
|
|
490
|
+
);
|
|
491
|
+
return /* @__PURE__ */ jsxs3("div", { className: `nvr-gl__strip ${className}`, children: [
|
|
492
|
+
children(ref),
|
|
493
|
+
ends.prev && paddle(-1),
|
|
494
|
+
ends.next && paddle(1)
|
|
495
|
+
] });
|
|
496
|
+
}
|
|
497
|
+
function GlassCameras({ cameras, loading = false, refreshMs = 5e3 }) {
|
|
498
|
+
const { tick, retry } = useSnapshotTick(refreshMs);
|
|
499
|
+
return /* @__PURE__ */ jsx5(GlassCameraTiles, { cameras, loading, tick, retry });
|
|
500
|
+
}
|
|
501
|
+
function GlassCameraTiles({
|
|
502
|
+
cameras,
|
|
503
|
+
loading,
|
|
504
|
+
tick,
|
|
505
|
+
retry
|
|
506
|
+
}) {
|
|
507
|
+
const { t, nav } = useSentinelUi();
|
|
508
|
+
if (cameras.length === 0) {
|
|
509
|
+
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") });
|
|
510
|
+
}
|
|
511
|
+
return /* @__PURE__ */ jsx5(GlassStrip, { className: "nvr-gl__strip--cams", count: cameras.length, children: (ref) => /* @__PURE__ */ jsx5(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
ref,
|
|
515
|
+
className: "nvr-gl__cams",
|
|
516
|
+
role: "list",
|
|
517
|
+
"aria-label": t("nvr.cameras.title"),
|
|
518
|
+
"data-several": cameras.length > 1 ? "" : void 0,
|
|
519
|
+
children: cameras.map((c) => {
|
|
520
|
+
const rec = sentinelRecordingState(c);
|
|
521
|
+
const state = rec === "ok" ? t("nvr.cameras.live") : rec === "offline" ? t("nvr.cameras.offline") : rec === "stalled" ? t("nvr.cameras.stalled") : null;
|
|
522
|
+
const today = [
|
|
523
|
+
t("nvr.cameras.eventsToday", { count: c.eventsToday }),
|
|
524
|
+
c.lastEventTs ? fmtRelative(c.lastEventTs, t) : null
|
|
525
|
+
].filter(Boolean).join(" \xB7 ");
|
|
526
|
+
return /* @__PURE__ */ jsx5("div", { role: "listitem", className: "nvr-gl__cam-item", children: /* @__PURE__ */ jsxs3(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
type: "button",
|
|
530
|
+
className: "nvr-gl__cam",
|
|
531
|
+
"data-state": rec,
|
|
532
|
+
"data-nvr-camera": c.id,
|
|
533
|
+
onClick: () => nav.openCamera(c.id),
|
|
534
|
+
"aria-label": [c.name, state, today].filter(Boolean).join(", "),
|
|
535
|
+
children: [
|
|
536
|
+
/* @__PURE__ */ jsx5(GlassSnapshot, { cam: c, tick, retry }),
|
|
537
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__shade", "aria-hidden": "true" }),
|
|
538
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__pill nvr-glass nvr-glass--clear", "aria-hidden": "true", children: [
|
|
539
|
+
rec !== "off" && /* @__PURE__ */ jsx5("span", { className: "nvr-gl__dot" }),
|
|
540
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__pill-text", children: state ? `${c.name} \xB7 ${state}` : c.name })
|
|
541
|
+
] }),
|
|
542
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__caption", "aria-hidden": "true", children: [
|
|
543
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__title", children: [
|
|
544
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__name", children: c.name }),
|
|
545
|
+
state && /* @__PURE__ */ jsx5("span", { className: "nvr-gl__badge", children: rec === "ok" ? t("nvr.live") : state })
|
|
546
|
+
] }),
|
|
547
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-gl__today", children: today })
|
|
548
|
+
] })
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
) }, c.id);
|
|
552
|
+
})
|
|
553
|
+
}
|
|
554
|
+
) });
|
|
555
|
+
}
|
|
556
|
+
function GlassEvents({ events, several }) {
|
|
557
|
+
const { client, t, locale, nav } = useSentinelUi();
|
|
558
|
+
if (events.length === 0) return null;
|
|
559
|
+
const now = Date.now();
|
|
560
|
+
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) => {
|
|
561
|
+
const day = fmtDayPrefix(e.ts, locale, now);
|
|
562
|
+
const time = fmtTime(e.ts, locale);
|
|
563
|
+
return /* @__PURE__ */ jsx5("li", { className: "nvr-gl__ev-item", children: /* @__PURE__ */ jsxs3(
|
|
564
|
+
"button",
|
|
565
|
+
{
|
|
566
|
+
type: "button",
|
|
567
|
+
className: "nvr-gl__ev",
|
|
568
|
+
onClick: () => nav.openCamera(e.camera, sentinelEventPlayTs(e), e.ts),
|
|
569
|
+
children: [
|
|
570
|
+
/* @__PURE__ */ jsx5("img", { className: "nvr-gl__ev-img", src: client.eventThumbUrl(e.camera, e.ts), alt: "", loading: "lazy" }),
|
|
571
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-text", children: [
|
|
572
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-time", children: [
|
|
573
|
+
day && /* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-day", children: [
|
|
574
|
+
day,
|
|
575
|
+
" "
|
|
576
|
+
] }),
|
|
577
|
+
time
|
|
578
|
+
] }),
|
|
579
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-sub", children: [
|
|
580
|
+
eventLabel(t, e),
|
|
581
|
+
several && ` \xB7 ${e.cameraName}`,
|
|
582
|
+
/* @__PURE__ */ jsxs3("span", { className: "nvr-gl__ev-ago", children: [
|
|
583
|
+
" \xB7 ",
|
|
584
|
+
fmtRelative(e.ts, t)
|
|
585
|
+
] })
|
|
586
|
+
] })
|
|
587
|
+
] })
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
) }, `${e.camera}-${e.ts}`);
|
|
591
|
+
}) }) });
|
|
592
|
+
}
|
|
593
|
+
function GlassNvr({ cameras, events, loading = false, refreshMs = 5e3 }) {
|
|
594
|
+
return /* @__PURE__ */ jsxs3("div", { className: "nvr-gl", children: [
|
|
595
|
+
/* @__PURE__ */ jsx5(GlassCameras, { cameras, loading, refreshMs }),
|
|
596
|
+
/* @__PURE__ */ jsx5(GlassEvents, { events, several: cameras.length > 1 })
|
|
597
|
+
] });
|
|
598
|
+
}
|
|
599
|
+
function GlassSections({ cameras, events }) {
|
|
600
|
+
const { t } = useSentinelUi();
|
|
601
|
+
return /* @__PURE__ */ jsxs3("div", { className: "nvr-gl-page", children: [
|
|
602
|
+
/* @__PURE__ */ jsxs3("section", { className: "nvr-section nvr-gl-page__cams", children: [
|
|
603
|
+
/* @__PURE__ */ jsxs3("h2", { className: "nvr-section__label", children: [
|
|
604
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-section__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(Cctv, { size: 18, strokeWidth: 2 }) }),
|
|
605
|
+
t("nvr.cameras.title")
|
|
606
|
+
] }),
|
|
607
|
+
/* @__PURE__ */ jsx5(GlassCameras, { cameras })
|
|
608
|
+
] }),
|
|
609
|
+
events.length > 0 && /* @__PURE__ */ jsxs3("section", { className: "nvr-section nvr-gl-page__events", children: [
|
|
610
|
+
/* @__PURE__ */ jsxs3("h2", { className: "nvr-section__label", children: [
|
|
611
|
+
/* @__PURE__ */ jsx5("span", { className: "nvr-section__icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(Zap, { size: 18, strokeWidth: 2 }) }),
|
|
612
|
+
t("nvr.events.title")
|
|
613
|
+
] }),
|
|
614
|
+
/* @__PURE__ */ jsx5("div", { className: "nvr-gl-page__list", children: /* @__PURE__ */ jsx5(GlassEvents, { events, several: cameras.length > 1 }) })
|
|
615
|
+
] })
|
|
616
|
+
] });
|
|
617
|
+
}
|
|
618
|
+
|
|
678
619
|
// src/ui/outside.ts
|
|
679
620
|
function isIosHomeScreenApp(nav = globalThis.navigator ?? {}) {
|
|
680
621
|
return nav.standalone === true;
|
|
@@ -696,7 +637,7 @@ function outsideAppHref(url, env = {
|
|
|
696
637
|
// src/ui/components/EventList.tsx
|
|
697
638
|
import { Fragment as Fragment3 } from "react";
|
|
698
639
|
import { Download } from "lucide-react";
|
|
699
|
-
import { Fragment as Fragment4, jsx as
|
|
640
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
700
641
|
function EventList({
|
|
701
642
|
camId,
|
|
702
643
|
events,
|
|
@@ -706,30 +647,30 @@ function EventList({
|
|
|
706
647
|
}) {
|
|
707
648
|
const { client, t, locale } = useSentinelUi();
|
|
708
649
|
const evs = events.filter((e) => !sentinelEventHidden(e, filterOff)).slice().sort((a, b) => b.timestamp - a.timestamp);
|
|
709
|
-
if (!evs.length) return /* @__PURE__ */
|
|
650
|
+
if (!evs.length) return /* @__PURE__ */ jsx6("p", { className: "nvr-muted nvr-evlist__empty", children: t("nvr.events.none") });
|
|
710
651
|
let lastDay = "";
|
|
711
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsx6("div", { className: "nvr-evlist", children: evs.map((ev) => {
|
|
712
653
|
const d = new Date(ev.timestamp).toDateString();
|
|
713
654
|
const head = d !== lastDay;
|
|
714
655
|
lastDay = d;
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
head && /* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
/* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
657
|
+
head && /* @__PURE__ */ jsx6("div", { className: "nvr-evlist__day nvr-data", children: fmtDay(ev.timestamp, locale) }),
|
|
658
|
+
/* @__PURE__ */ jsxs4("div", { className: "nvr-evrow-wrap" + (onClip ? " nvr-evrow-wrap--clip" : ""), children: [
|
|
659
|
+
/* @__PURE__ */ jsxs4("button", { type: "button", className: "nvr-evrow", onClick: () => onPick(ev), children: [
|
|
660
|
+
/* @__PURE__ */ jsx6("img", { className: "nvr-evrow__img", src: client.eventThumbUrl(camId, ev.timestamp), alt: "", loading: "lazy" }),
|
|
661
|
+
/* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__text", children: [
|
|
662
|
+
/* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__cls", children: [
|
|
663
|
+
/* @__PURE__ */ jsx6(EventBadges, { ev, size: 16, t }),
|
|
723
664
|
" ",
|
|
724
665
|
eventLabel(t, ev)
|
|
725
666
|
] }),
|
|
726
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__t nvr-data", children: [
|
|
727
668
|
fmtTimeSec(ev.timestamp, locale),
|
|
728
|
-
/* @__PURE__ */
|
|
669
|
+
/* @__PURE__ */ jsx6(EventSpanNote, { ev, t })
|
|
729
670
|
] })
|
|
730
671
|
] })
|
|
731
672
|
] }),
|
|
732
|
-
onClip && /* @__PURE__ */
|
|
673
|
+
onClip && /* @__PURE__ */ jsx6(
|
|
733
674
|
"button",
|
|
734
675
|
{
|
|
735
676
|
type: "button",
|
|
@@ -737,7 +678,7 @@ function EventList({
|
|
|
737
678
|
"aria-label": `${t("nvr.clip.event")} ${fmtTimeSec(ev.timestamp, locale)}`,
|
|
738
679
|
title: t("nvr.clip.event"),
|
|
739
680
|
onClick: () => onClip(ev),
|
|
740
|
-
children: /* @__PURE__ */
|
|
681
|
+
children: /* @__PURE__ */ jsx6(Download, { size: 16 })
|
|
741
682
|
}
|
|
742
683
|
)
|
|
743
684
|
] })
|
|
@@ -747,25 +688,25 @@ function EventList({
|
|
|
747
688
|
function EventSpanNote({ ev, t }) {
|
|
748
689
|
const sp = sentinelEventSpan(ev);
|
|
749
690
|
if (!sp) return null;
|
|
750
|
-
return sp.open ? /* @__PURE__ */
|
|
691
|
+
return sp.open ? /* @__PURE__ */ jsxs4("span", { className: "nvr-evrow__open", children: [
|
|
751
692
|
" \xB7 ",
|
|
752
693
|
t("nvr.events.running")
|
|
753
|
-
] }) : /* @__PURE__ */
|
|
694
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
754
695
|
" \xB7 ",
|
|
755
696
|
sentinelDuration(sp.end - sp.start)
|
|
756
697
|
] });
|
|
757
698
|
}
|
|
758
699
|
|
|
759
700
|
// src/ui/components/DatePickerPanel.tsx
|
|
760
|
-
import { useState as
|
|
761
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
762
|
-
import { Fragment as Fragment5, jsx as
|
|
701
|
+
import { useState as useState3 } from "react";
|
|
702
|
+
import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
|
|
703
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
763
704
|
function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
764
705
|
const { t, locale } = useSentinelUi();
|
|
765
706
|
const base = new Date(dayStart);
|
|
766
|
-
const [view, setView] =
|
|
767
|
-
const [sel, setSel] =
|
|
768
|
-
const [time, setTime] =
|
|
707
|
+
const [view, setView] = useState3(new Date(base.getFullYear(), base.getMonth(), 1));
|
|
708
|
+
const [sel, setSel] = useState3(new Date(base.getFullYear(), base.getMonth(), base.getDate()));
|
|
709
|
+
const [time, setTime] = useState3(hhmmInput(timeTs));
|
|
769
710
|
const y = view.getFullYear(), m = view.getMonth();
|
|
770
711
|
const startIdx = (new Date(y, m, 1).getDay() + 6) % 7;
|
|
771
712
|
const dim = new Date(y, m + 1, 0).getDate();
|
|
@@ -790,33 +731,33 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
790
731
|
setView(new Date(n.getFullYear(), n.getMonth(), 1));
|
|
791
732
|
setSel(new Date(n.getFullYear(), n.getMonth(), n.getDate()));
|
|
792
733
|
};
|
|
793
|
-
const grid = /* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
734
|
+
const grid = /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
735
|
+
/* @__PURE__ */ jsxs5("div", { className: "nvr-dt__head", children: [
|
|
736
|
+
/* @__PURE__ */ jsx7(
|
|
796
737
|
"button",
|
|
797
738
|
{
|
|
798
739
|
type: "button",
|
|
799
740
|
className: "nvr-dt__nav",
|
|
800
741
|
onClick: () => setView(new Date(y, m - 1, 1)),
|
|
801
742
|
"aria-label": t("nvr.date.prevMonth"),
|
|
802
|
-
children: /* @__PURE__ */
|
|
743
|
+
children: /* @__PURE__ */ jsx7(ChevronLeft2, { size: 18 })
|
|
803
744
|
}
|
|
804
745
|
),
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
746
|
+
/* @__PURE__ */ jsx7("span", { className: "nvr-dt__month", children: fmtMonthYear(view.getTime(), locale) }),
|
|
747
|
+
/* @__PURE__ */ jsx7(
|
|
807
748
|
"button",
|
|
808
749
|
{
|
|
809
750
|
type: "button",
|
|
810
751
|
className: "nvr-dt__nav",
|
|
811
752
|
onClick: () => setView(new Date(y, m + 1, 1)),
|
|
812
753
|
"aria-label": t("nvr.date.nextMonth"),
|
|
813
|
-
children: /* @__PURE__ */
|
|
754
|
+
children: /* @__PURE__ */ jsx7(ChevronRight2, { size: 18 })
|
|
814
755
|
}
|
|
815
756
|
)
|
|
816
757
|
] }),
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
weekdayShorts(locale).map((w) => /* @__PURE__ */
|
|
819
|
-
cells.map((c, i) => /* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ jsxs5("div", { className: "nvr-dt__grid", children: [
|
|
759
|
+
weekdayShorts(locale).map((w) => /* @__PURE__ */ jsx7("span", { className: "nvr-dt__wd", children: w }, w)),
|
|
760
|
+
cells.map((c, i) => /* @__PURE__ */ jsx7(
|
|
820
761
|
"button",
|
|
821
762
|
{
|
|
822
763
|
type: "button",
|
|
@@ -829,9 +770,9 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
829
770
|
))
|
|
830
771
|
] })
|
|
831
772
|
] });
|
|
832
|
-
const footer = /* @__PURE__ */
|
|
833
|
-
/* @__PURE__ */
|
|
834
|
-
/* @__PURE__ */
|
|
773
|
+
const footer = /* @__PURE__ */ jsxs5("div", { className: "nvr-dt__foot", children: [
|
|
774
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "nvr-btn nvr-btn--ghost", onClick: goToday, children: t("nvr.date.today") }),
|
|
775
|
+
/* @__PURE__ */ jsx7(
|
|
835
776
|
"input",
|
|
836
777
|
{
|
|
837
778
|
className: "nvr-input nvr-dt__time nvr-data",
|
|
@@ -844,21 +785,22 @@ function useDatePicker({ dayStart, timeTs, oldestAllowed = -Infinity, onGo }) {
|
|
|
844
785
|
"aria-label": t("nvr.date.time")
|
|
845
786
|
}
|
|
846
787
|
),
|
|
847
|
-
/* @__PURE__ */
|
|
788
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "nvr-btn nvr-btn--primary", onClick: submit, children: t("nvr.date.go") })
|
|
848
789
|
] });
|
|
849
790
|
return { grid, footer, submit, goToday };
|
|
850
791
|
}
|
|
851
792
|
function DatePickerPanel(props) {
|
|
852
793
|
const { grid, footer } = useDatePicker(props);
|
|
853
|
-
return /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ jsxs5("div", { className: "nvr-dt", children: [
|
|
854
795
|
grid,
|
|
855
796
|
footer
|
|
856
797
|
] });
|
|
857
798
|
}
|
|
858
799
|
|
|
859
800
|
// src/ui/components/Stats.tsx
|
|
860
|
-
import {
|
|
861
|
-
import {
|
|
801
|
+
import { Fragment as Fragment6 } from "react";
|
|
802
|
+
import { Cctv as Cctv2, Video, Database, Clock, Zap as Zap2, Gauge, BarChart3, HardDrive, CalendarClock, CircleDot } from "lucide-react";
|
|
803
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
862
804
|
function StatTile({
|
|
863
805
|
icon,
|
|
864
806
|
label,
|
|
@@ -866,13 +808,13 @@ function StatTile({
|
|
|
866
808
|
unit,
|
|
867
809
|
tone = "neutral"
|
|
868
810
|
}) {
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */
|
|
811
|
+
return /* @__PURE__ */ jsxs6("div", { className: `nvr-stat nvr-stat--${tone}`, children: [
|
|
812
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-stat__icon", "aria-hidden": "true", children: icon }),
|
|
813
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-stat__body", children: [
|
|
814
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-stat__label", children: label }),
|
|
815
|
+
/* @__PURE__ */ jsxs6("span", { className: "nvr-stat__value nvr-data", children: [
|
|
874
816
|
value,
|
|
875
|
-
unit && /* @__PURE__ */
|
|
817
|
+
unit && /* @__PURE__ */ jsxs6("span", { className: "nvr-stat__unit", children: [
|
|
876
818
|
" ",
|
|
877
819
|
unit
|
|
878
820
|
] })
|
|
@@ -887,16 +829,24 @@ function CardTitle({
|
|
|
887
829
|
tone = "accent",
|
|
888
830
|
action
|
|
889
831
|
}) {
|
|
890
|
-
return /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
sub && /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-ctitle", children: [
|
|
833
|
+
/* @__PURE__ */ jsx8("span", { className: `nvr-ctitle__chip nvr-ctitle__chip--${tone}`, "aria-hidden": "true", children: icon }),
|
|
834
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-ctitle__text", children: [
|
|
835
|
+
/* @__PURE__ */ jsx8("div", { className: "nvr-ctitle__title", children: title }),
|
|
836
|
+
sub && /* @__PURE__ */ jsx8("div", { className: "nvr-ctitle__sub", children: sub })
|
|
895
837
|
] }),
|
|
896
|
-
action && /* @__PURE__ */
|
|
838
|
+
action && /* @__PURE__ */ jsx8("div", { className: "nvr-ctitle__action", children: action })
|
|
897
839
|
] });
|
|
898
840
|
}
|
|
899
|
-
function Hero({
|
|
841
|
+
function Hero({
|
|
842
|
+
cameras,
|
|
843
|
+
stats,
|
|
844
|
+
appearance
|
|
845
|
+
}) {
|
|
846
|
+
if (appearance === "glass") return /* @__PURE__ */ jsx8(GlassHero, { cameras, stats });
|
|
847
|
+
return /* @__PURE__ */ jsx8(ClassicHero, { cameras, stats });
|
|
848
|
+
}
|
|
849
|
+
function ClassicHero({ cameras, stats }) {
|
|
900
850
|
const { t, locale } = useSentinelUi();
|
|
901
851
|
const stalled = cameras.filter((c) => sentinelRecordingState(c) === "stalled").length;
|
|
902
852
|
const online = cameras.filter((c) => c.online || sentinelRecordingState(c) === "stalled").length;
|
|
@@ -908,62 +858,62 @@ function Hero({ cameras, stats }) {
|
|
|
908
858
|
const fc = sentinelStorageForecast(stats);
|
|
909
859
|
const bytes = sentinelHumanBytes(stats.bytes, locale);
|
|
910
860
|
const span = fc.spanDays ? fmtDays(fc.spanDays, t).split(" ") : ["\u2013"];
|
|
911
|
-
return /* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-card nvr-hero", children: [
|
|
862
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-hero__head", children: [
|
|
863
|
+
/* @__PURE__ */ jsx8(CardTitle, { icon: /* @__PURE__ */ jsx8(Gauge, { size: 16, strokeWidth: 1.75 }), title: t("nvr.hero.title"), sub: t("nvr.hero.sub") }),
|
|
914
864
|
stats.storageOk === false ? (
|
|
915
865
|
// storage guard: the share is gone — nothing is recorded until it is back (outranks the camera status)
|
|
916
|
-
/* @__PURE__ */
|
|
917
|
-
/* @__PURE__ */
|
|
866
|
+
/* @__PURE__ */ jsxs6("span", { className: "nvr-pill nvr-pill--danger", title: stats.storageProblem, children: [
|
|
867
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
918
868
|
t("nvr.hero.storageProblem")
|
|
919
869
|
] })
|
|
920
|
-
) : /* @__PURE__ */
|
|
921
|
-
/* @__PURE__ */
|
|
870
|
+
) : /* @__PURE__ */ jsxs6("span", { className: `nvr-pill ${problems.length ? "nvr-pill--danger" : "nvr-pill--positive"}`, children: [
|
|
871
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-pill__dot", "aria-hidden": "true" }),
|
|
922
872
|
problems.length ? problems.join(" \xB7 ") : t("nvr.hero.allOnline")
|
|
923
873
|
] })
|
|
924
874
|
] }),
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-hero__primary", children: [
|
|
876
|
+
/* @__PURE__ */ jsxs6("span", { className: "nvr-hero__primary-label", children: [
|
|
877
|
+
/* @__PURE__ */ jsx8(Zap2, { size: 14, strokeWidth: 2 }),
|
|
928
878
|
t("nvr.hero.eventsToday")
|
|
929
879
|
] }),
|
|
930
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-hero__primary-value nvr-data", children: fmtCount(stats.eventsToday, locale) })
|
|
931
881
|
] }),
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-hero__stats", children: [
|
|
883
|
+
/* @__PURE__ */ jsx8(
|
|
934
884
|
StatTile,
|
|
935
885
|
{
|
|
936
|
-
icon: /* @__PURE__ */
|
|
886
|
+
icon: /* @__PURE__ */ jsx8(Cctv2, { size: 16, strokeWidth: 1.75 }),
|
|
937
887
|
label: t("nvr.hero.camerasOnline"),
|
|
938
888
|
value: `${online}`,
|
|
939
889
|
unit: `/ ${stats.cameras}`,
|
|
940
890
|
tone: offline > 0 ? "danger" : "positive"
|
|
941
891
|
}
|
|
942
892
|
),
|
|
943
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ jsx8(
|
|
944
894
|
StatTile,
|
|
945
895
|
{
|
|
946
|
-
icon: /* @__PURE__ */
|
|
896
|
+
icon: /* @__PURE__ */ jsx8(Video, { size: 16, strokeWidth: 1.75 }),
|
|
947
897
|
label: t("nvr.hero.recording"),
|
|
948
898
|
value: `${stats.recording}`,
|
|
949
899
|
unit: `/ ${stats.cameras}`,
|
|
950
900
|
tone: "accent"
|
|
951
901
|
}
|
|
952
902
|
),
|
|
953
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ jsx8(
|
|
954
904
|
StatTile,
|
|
955
905
|
{
|
|
956
|
-
icon: /* @__PURE__ */
|
|
906
|
+
icon: /* @__PURE__ */ jsx8(Database, { size: 16, strokeWidth: 1.75 }),
|
|
957
907
|
label: t("nvr.hero.storageUsed"),
|
|
958
908
|
value: bytes.value,
|
|
959
909
|
unit: bytes.unit,
|
|
960
910
|
tone: "info"
|
|
961
911
|
}
|
|
962
912
|
),
|
|
963
|
-
/* @__PURE__ */
|
|
913
|
+
/* @__PURE__ */ jsx8(
|
|
964
914
|
StatTile,
|
|
965
915
|
{
|
|
966
|
-
icon: /* @__PURE__ */
|
|
916
|
+
icon: /* @__PURE__ */ jsx8(Clock, { size: 16, strokeWidth: 1.75 }),
|
|
967
917
|
label: t("nvr.hero.retention"),
|
|
968
918
|
value: span[0] ?? "\u2013",
|
|
969
919
|
unit: span.slice(1).join(" ") || void 0
|
|
@@ -972,35 +922,121 @@ function Hero({ cameras, stats }) {
|
|
|
972
922
|
] })
|
|
973
923
|
] });
|
|
974
924
|
}
|
|
925
|
+
var TAFEL_ICON = 15;
|
|
926
|
+
function splitCount(text) {
|
|
927
|
+
const m = /^(\d+)\s+(.+)$/.exec(text);
|
|
928
|
+
return m ? { value: m[1], unit: m[2] } : { value: text };
|
|
929
|
+
}
|
|
930
|
+
function GlassHero({ cameras, stats }) {
|
|
931
|
+
const { t, locale } = useSentinelUi();
|
|
932
|
+
const stalled = cameras.filter((c) => sentinelRecordingState(c) === "stalled").length;
|
|
933
|
+
const online = cameras.filter((c) => c.online || sentinelRecordingState(c) === "stalled").length;
|
|
934
|
+
const offline = Math.max(0, stats.cameras - online);
|
|
935
|
+
const problems = [
|
|
936
|
+
offline > 0 ? t("nvr.hero.offline", { count: offline }) : null,
|
|
937
|
+
stalled > 0 ? t("nvr.hero.stalled", { count: stalled }) : null
|
|
938
|
+
].filter((p) => p !== null);
|
|
939
|
+
const storageLost = stats.storageOk === false;
|
|
940
|
+
const ok = !storageLost && problems.length === 0;
|
|
941
|
+
const parts = storageLost ? [t("nvr.hero.storageProblem")] : ok ? [t("nvr.hero.allOnline")] : problems;
|
|
942
|
+
const fc = sentinelStorageForecast(stats);
|
|
943
|
+
const bytes = sentinelHumanBytes(stats.bytes, locale);
|
|
944
|
+
const retention = fc.spanDays ? splitCount(fmtDays(fc.spanDays, t)) : { value: "\u2013" };
|
|
945
|
+
const tone = ok ? "ok" : "danger";
|
|
946
|
+
const items = [
|
|
947
|
+
{
|
|
948
|
+
key: "events",
|
|
949
|
+
icon: /* @__PURE__ */ jsx8(Zap2, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
950
|
+
label: t("nvr.hero.eventsToday"),
|
|
951
|
+
value: fmtCount(stats.eventsToday, locale),
|
|
952
|
+
tone: "none"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
key: "recording",
|
|
956
|
+
icon: /* @__PURE__ */ jsx8(CircleDot, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
957
|
+
label: t("nvr.hero.recording"),
|
|
958
|
+
value: `${fmtCount(stats.recording, locale)}/${fmtCount(stats.cameras, locale)}`,
|
|
959
|
+
tone: "none"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
key: "storage",
|
|
963
|
+
icon: /* @__PURE__ */ jsx8(HardDrive, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
964
|
+
label: t("nvr.hero.storageUsed"),
|
|
965
|
+
value: bytes.value,
|
|
966
|
+
unit: bytes.unit,
|
|
967
|
+
tone: "none"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
key: "retention",
|
|
971
|
+
icon: /* @__PURE__ */ jsx8(CalendarClock, { size: TAFEL_ICON, strokeWidth: 2 }),
|
|
972
|
+
label: t("nvr.hero.retention"),
|
|
973
|
+
value: retention.value,
|
|
974
|
+
...retention.unit ? { unit: retention.unit } : {},
|
|
975
|
+
// the retention target out of reach: the storage card says why
|
|
976
|
+
tone: fc.status === "unreachable" ? "warn" : "none"
|
|
977
|
+
}
|
|
978
|
+
];
|
|
979
|
+
return /* @__PURE__ */ jsxs6("div", { className: `nvr-card nvr-tafel nvr-tafel--${ok ? "ok" : "problem"}`, children: [
|
|
980
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-tafel__head", children: [
|
|
981
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-tafel__badge", "data-tone": tone, "aria-hidden": "true", children: /* @__PURE__ */ jsx8(Cctv2, { size: 28, strokeWidth: 1.75 }) }),
|
|
982
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-tafel__head-text", children: [
|
|
983
|
+
/* @__PURE__ */ jsx8("p", { className: "nvr-tafel__kicker", children: t("nvr.hero.title") }),
|
|
984
|
+
/* @__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: [
|
|
985
|
+
i > 0 && " \xB7 ",
|
|
986
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-tafel__part", children: part })
|
|
987
|
+
] }, i)) })
|
|
988
|
+
] })
|
|
989
|
+
] }),
|
|
990
|
+
/* @__PURE__ */ jsx8(
|
|
991
|
+
"dl",
|
|
992
|
+
{
|
|
993
|
+
className: "nvr-tafel__grid",
|
|
994
|
+
"data-kind": "number",
|
|
995
|
+
"data-min": 130,
|
|
996
|
+
style: { "--nvr-tafel-min": "130px", "--nvr-tafel-max": 4 },
|
|
997
|
+
children: items.map((f) => /* @__PURE__ */ jsxs6("div", { className: "nvr-tafel__cell", "data-tone": f.tone, "data-tafel": f.key, children: [
|
|
998
|
+
/* @__PURE__ */ jsxs6("dt", { className: "nvr-tafel__label", children: [
|
|
999
|
+
f.icon,
|
|
1000
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-tafel__label-text", children: f.label })
|
|
1001
|
+
] }),
|
|
1002
|
+
/* @__PURE__ */ jsxs6("dd", { className: "nvr-tafel__value", children: [
|
|
1003
|
+
f.value,
|
|
1004
|
+
f.unit && /* @__PURE__ */ jsx8("span", { className: "nvr-tafel__unit", children: `\xA0${f.unit}` })
|
|
1005
|
+
] })
|
|
1006
|
+
] }, f.key))
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
] });
|
|
1010
|
+
}
|
|
975
1011
|
function HistogramCard({ histogram }) {
|
|
976
1012
|
const { t } = useSentinelUi();
|
|
977
1013
|
const buckets = histogram.length === 24 ? histogram : Array.from({ length: 24 }, (_, i) => histogram[i] ?? 0);
|
|
978
1014
|
const max = Math.max(1, ...buckets);
|
|
979
1015
|
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
980
|
-
return /* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
1016
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-card nvr-card--pad nvr-statcard", children: [
|
|
1017
|
+
/* @__PURE__ */ jsx8(
|
|
982
1018
|
CardTitle,
|
|
983
1019
|
{
|
|
984
|
-
icon: /* @__PURE__ */
|
|
1020
|
+
icon: /* @__PURE__ */ jsx8(BarChart3, { size: 16, strokeWidth: 1.75 }),
|
|
985
1021
|
title: t("nvr.histogram.title"),
|
|
986
1022
|
sub: t("nvr.histogram.sub")
|
|
987
1023
|
}
|
|
988
1024
|
),
|
|
989
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ jsx8("div", { className: "nvr-chart", role: "img", "aria-label": t("nvr.histogram.title"), children: buckets.map((v, i) => /* @__PURE__ */ jsx8(
|
|
990
1026
|
"div",
|
|
991
1027
|
{
|
|
992
1028
|
className: `nvr-chart__col${i === hour ? " nvr-chart__col--now" : ""}`,
|
|
993
1029
|
title: `${String(i).padStart(2, "0")}:00 \u2013 ${v}`,
|
|
994
|
-
children: /* @__PURE__ */
|
|
1030
|
+
children: /* @__PURE__ */ jsx8("div", { className: "nvr-chart__bar", style: { height: `${v / max * 100}%` } })
|
|
995
1031
|
},
|
|
996
1032
|
i
|
|
997
1033
|
)) }),
|
|
998
|
-
/* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-chart__axis nvr-data", children: [
|
|
1035
|
+
/* @__PURE__ */ jsx8("span", { children: "00" }),
|
|
1036
|
+
/* @__PURE__ */ jsx8("span", { children: "06" }),
|
|
1037
|
+
/* @__PURE__ */ jsx8("span", { children: "12" }),
|
|
1038
|
+
/* @__PURE__ */ jsx8("span", { children: "18" }),
|
|
1039
|
+
/* @__PURE__ */ jsx8("span", { children: "24" })
|
|
1004
1040
|
] })
|
|
1005
1041
|
] });
|
|
1006
1042
|
}
|
|
@@ -1026,83 +1062,83 @@ function StorageCard({ stats }) {
|
|
|
1026
1062
|
default:
|
|
1027
1063
|
note = t("nvr.storage.note.unknown");
|
|
1028
1064
|
}
|
|
1029
|
-
return /* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1065
|
+
return /* @__PURE__ */ jsxs6("div", { className: "nvr-card nvr-card--pad nvr-statcard", children: [
|
|
1066
|
+
/* @__PURE__ */ jsx8(
|
|
1031
1067
|
CardTitle,
|
|
1032
1068
|
{
|
|
1033
|
-
icon: /* @__PURE__ */
|
|
1069
|
+
icon: /* @__PURE__ */ jsx8(HardDrive, { size: 16, strokeWidth: 1.75 }),
|
|
1034
1070
|
title: t("nvr.storage.title"),
|
|
1035
1071
|
sub: t("nvr.storage.sub"),
|
|
1036
1072
|
tone: "info"
|
|
1037
1073
|
}
|
|
1038
1074
|
),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-meter", role: "img", "aria-label": t("nvr.storage.title"), children: [
|
|
1076
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-meter__rec", style: { width: pct(stats.bytes) } }),
|
|
1077
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-meter__other", style: { left: pct(stats.bytes), width: pct(fc.other) } }),
|
|
1078
|
+
/* @__PURE__ */ jsx8("span", { className: "nvr-meter__reserve", style: { width: pct(reserveShown) } })
|
|
1043
1079
|
] }),
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsxs6("div", { className: "nvr-legend", children: [
|
|
1081
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1082
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--rec" }),
|
|
1047
1083
|
t("nvr.storage.recordings"),
|
|
1048
1084
|
" ",
|
|
1049
1085
|
humanBytes(stats.bytes, locale)
|
|
1050
1086
|
] }),
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1087
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1088
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--other" }),
|
|
1053
1089
|
t("nvr.storage.system"),
|
|
1054
1090
|
" ",
|
|
1055
1091
|
humanBytes(fc.other, locale)
|
|
1056
1092
|
] }),
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1093
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1094
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--free" }),
|
|
1059
1095
|
t("nvr.storage.free"),
|
|
1060
1096
|
" ",
|
|
1061
1097
|
humanBytes(stats.diskFree, locale)
|
|
1062
1098
|
] }),
|
|
1063
|
-
/* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1100
|
+
/* @__PURE__ */ jsx8("i", { className: "nvr-legend__sw nvr-legend__sw--reserve" }),
|
|
1065
1101
|
t("nvr.storage.reserve"),
|
|
1066
1102
|
" ",
|
|
1067
1103
|
humanBytes(fc.reserve, locale)
|
|
1068
1104
|
] })
|
|
1069
1105
|
] }),
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1106
|
+
/* @__PURE__ */ jsxs6("ul", { className: "nvr-kv", children: [
|
|
1107
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1108
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.rate") }),
|
|
1109
|
+
/* @__PURE__ */ jsx8("b", { className: "nvr-data", children: fc.ratePerDay ? t("nvr.storage.perDay", { value: humanBytes(fc.ratePerDay, locale) }) : "\u2013" })
|
|
1074
1110
|
] }),
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1112
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.capacity") }),
|
|
1113
|
+
/* @__PURE__ */ jsxs6("b", { className: "nvr-data", children: [
|
|
1078
1114
|
humanBytes(fc.capacity, locale),
|
|
1079
|
-
fc.ratePerDay ? /* @__PURE__ */
|
|
1115
|
+
fc.ratePerDay ? /* @__PURE__ */ jsxs6("em", { children: [
|
|
1080
1116
|
" \u2248 ",
|
|
1081
1117
|
fmtDays(fc.fitsDays, t)
|
|
1082
1118
|
] }) : null
|
|
1083
1119
|
] })
|
|
1084
1120
|
] }),
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1121
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1122
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.retention") }),
|
|
1123
|
+
/* @__PURE__ */ jsxs6("b", { className: "nvr-data", children: [
|
|
1088
1124
|
fc.spanDays ? `~${fmtDays(fc.spanDays, t)}` : "\u2013",
|
|
1089
|
-
/* @__PURE__ */
|
|
1125
|
+
/* @__PURE__ */ jsxs6("em", { children: [
|
|
1090
1126
|
" / ",
|
|
1091
1127
|
t("nvr.storage.target", { days: stats.retentionDays })
|
|
1092
1128
|
] })
|
|
1093
1129
|
] })
|
|
1094
1130
|
] }),
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ jsxs6("li", { children: [
|
|
1132
|
+
/* @__PURE__ */ jsx8("span", { children: t("nvr.storage.segments") }),
|
|
1133
|
+
/* @__PURE__ */ jsx8("b", { className: "nvr-data", children: fmtCount(stats.segments, locale) })
|
|
1098
1134
|
] })
|
|
1099
1135
|
] }),
|
|
1100
|
-
/* @__PURE__ */
|
|
1136
|
+
/* @__PURE__ */ jsx8("p", { className: `nvr-note${fc.status === "unreachable" ? " nvr-note--warn" : ""}`, children: note })
|
|
1101
1137
|
] });
|
|
1102
1138
|
}
|
|
1103
1139
|
|
|
1104
1140
|
// src/ui/components/VerticalTimeline.tsx
|
|
1105
|
-
import { useEffect as
|
|
1141
|
+
import { useEffect as useEffect3, useLayoutEffect, useMemo, useRef as useRef2, useState as useState4 } from "react";
|
|
1106
1142
|
import { Plus, Minus, ArrowUp } from "lucide-react";
|
|
1107
1143
|
|
|
1108
1144
|
// src/ui/timeline-groups.ts
|
|
@@ -1143,15 +1179,15 @@ function groupCountLabel(n) {
|
|
|
1143
1179
|
}
|
|
1144
1180
|
|
|
1145
1181
|
// src/ui/components/VerticalTimeline.tsx
|
|
1146
|
-
import { Fragment as
|
|
1182
|
+
import { Fragment as Fragment7, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1147
1183
|
function VerticalTimeline(p) {
|
|
1148
1184
|
const { client, t, locale } = useSentinelUi();
|
|
1149
1185
|
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 =
|
|
1186
|
+
const scroll = useRef2(null);
|
|
1187
|
+
const [vh, setVh] = useState4(600);
|
|
1188
|
+
const [px, setPx] = useState4(0);
|
|
1189
|
+
const [, tick] = useState4(0);
|
|
1190
|
+
const VT = useRef2({
|
|
1155
1191
|
user: 0,
|
|
1156
1192
|
down: false,
|
|
1157
1193
|
moved: false,
|
|
@@ -1170,7 +1206,7 @@ function VerticalTimeline(p) {
|
|
|
1170
1206
|
lastForeignLog: 0,
|
|
1171
1207
|
touching: false
|
|
1172
1208
|
});
|
|
1173
|
-
|
|
1209
|
+
useEffect3(() => {
|
|
1174
1210
|
const el = scroll.current;
|
|
1175
1211
|
const ro = new ResizeObserver(() => setVh(el.clientHeight || 600));
|
|
1176
1212
|
ro.observe(el);
|
|
@@ -1178,7 +1214,7 @@ function VerticalTimeline(p) {
|
|
|
1178
1214
|
return () => ro.disconnect();
|
|
1179
1215
|
}, []);
|
|
1180
1216
|
const minPx = vh / (3 * SENTINEL_DAY_MS), maxPx = vh / (2 * 60 * 1e3);
|
|
1181
|
-
|
|
1217
|
+
useEffect3(() => {
|
|
1182
1218
|
if (!px && vh) setPx(vh / (2 * 3600 * 1e3));
|
|
1183
1219
|
}, [vh, px]);
|
|
1184
1220
|
const HEAD = 0.35;
|
|
@@ -1186,8 +1222,8 @@ function VerticalTimeline(p) {
|
|
|
1186
1222
|
const span = p.rangeEnd - p.rangeStart;
|
|
1187
1223
|
const yFor = (ts) => PAD + (p.rangeEnd - ts) * px;
|
|
1188
1224
|
const tsForY = (y) => p.rangeEnd - (y - PAD) / px;
|
|
1189
|
-
const zoomAnchor =
|
|
1190
|
-
const geo =
|
|
1225
|
+
const zoomAnchor = useRef2(null);
|
|
1226
|
+
const geo = useRef2({ rangeStart: p.rangeStart, rangeEnd: p.rangeEnd, px, vh, PAD });
|
|
1191
1227
|
geo.current = { rangeStart: p.rangeStart, rangeEnd: p.rangeEnd, px, vh, PAD };
|
|
1192
1228
|
const centerTs = () => {
|
|
1193
1229
|
const g = geo.current;
|
|
@@ -1225,13 +1261,13 @@ function VerticalTimeline(p) {
|
|
|
1225
1261
|
const top2 = yFor(ts) - vh * HEAD;
|
|
1226
1262
|
if (Math.abs(el.scrollTop - top2) > 0.5) setTop(el, top2, why);
|
|
1227
1263
|
};
|
|
1228
|
-
const init =
|
|
1229
|
-
|
|
1264
|
+
const init = useRef2(false);
|
|
1265
|
+
useEffect3(() => {
|
|
1230
1266
|
if (!px || init.current) return;
|
|
1231
1267
|
init.current = true;
|
|
1232
1268
|
scrollCenter(Date.now());
|
|
1233
1269
|
}, [px]);
|
|
1234
|
-
const prevEnd =
|
|
1270
|
+
const prevEnd = useRef2(p.rangeEnd);
|
|
1235
1271
|
useLayoutEffect(() => {
|
|
1236
1272
|
const d = p.rangeEnd - prevEnd.current;
|
|
1237
1273
|
prevEnd.current = p.rangeEnd;
|
|
@@ -1250,10 +1286,10 @@ function VerticalTimeline(p) {
|
|
|
1250
1286
|
tick((n) => n + 1);
|
|
1251
1287
|
}
|
|
1252
1288
|
}, [px]);
|
|
1253
|
-
|
|
1289
|
+
useEffect3(() => {
|
|
1254
1290
|
if (p.jump && px) scrollCenter(p.jump.ts, "jump");
|
|
1255
1291
|
}, [p.jump?.n, px]);
|
|
1256
|
-
|
|
1292
|
+
useEffect3(() => {
|
|
1257
1293
|
const on = () => {
|
|
1258
1294
|
VT.current.touching = true;
|
|
1259
1295
|
};
|
|
@@ -1291,9 +1327,9 @@ function VerticalTimeline(p) {
|
|
|
1291
1327
|
notifyCenter();
|
|
1292
1328
|
tick((n) => n + 1);
|
|
1293
1329
|
};
|
|
1294
|
-
const followRef =
|
|
1330
|
+
const followRef = useRef2(followTick);
|
|
1295
1331
|
followRef.current = followTick;
|
|
1296
|
-
|
|
1332
|
+
useEffect3(() => {
|
|
1297
1333
|
const t2 = setInterval(() => followRef.current(), 100);
|
|
1298
1334
|
return () => clearInterval(t2);
|
|
1299
1335
|
}, []);
|
|
@@ -1339,9 +1375,9 @@ function VerticalTimeline(p) {
|
|
|
1339
1375
|
clearTimeout(v.relT);
|
|
1340
1376
|
v.relT = window.setTimeout(userIdle, 250);
|
|
1341
1377
|
};
|
|
1342
|
-
const releaseRef =
|
|
1378
|
+
const releaseRef = useRef2(release);
|
|
1343
1379
|
releaseRef.current = release;
|
|
1344
|
-
|
|
1380
|
+
useEffect3(() => {
|
|
1345
1381
|
const h = () => releaseRef.current();
|
|
1346
1382
|
for (const n of ["pointerup", "pointercancel", "touchend"]) window.addEventListener(n, h);
|
|
1347
1383
|
return () => {
|
|
@@ -1403,9 +1439,9 @@ function VerticalTimeline(p) {
|
|
|
1403
1439
|
const y = e.clientY - r.top;
|
|
1404
1440
|
applyZoom(px * Math.exp(-e.deltaY * 2e-3), tsForY(el.scrollTop + y), y);
|
|
1405
1441
|
};
|
|
1406
|
-
const wheelRef =
|
|
1442
|
+
const wheelRef = useRef2(onWheel);
|
|
1407
1443
|
wheelRef.current = onWheel;
|
|
1408
|
-
|
|
1444
|
+
useEffect3(() => {
|
|
1409
1445
|
const el = scroll.current;
|
|
1410
1446
|
const h = (e) => wheelRef.current(e);
|
|
1411
1447
|
el.addEventListener("wheel", h, { passive: false });
|
|
@@ -1468,12 +1504,12 @@ function VerticalTimeline(p) {
|
|
|
1468
1504
|
VT.current.down = true;
|
|
1469
1505
|
markUser();
|
|
1470
1506
|
};
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1507
|
+
return /* @__PURE__ */ jsxs7("div", { className: "nvr-vtl vtl-wrap", children: [
|
|
1508
|
+
/* @__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: [
|
|
1509
|
+
/* @__PURE__ */ jsx9("div", { className: "vtl-daybg", style: { top: 0, height: span * px + PAD } }),
|
|
1474
1510
|
ticks.map((t2) => {
|
|
1475
1511
|
const w = sentinelWallSeconds(t2);
|
|
1476
|
-
return /* @__PURE__ */
|
|
1512
|
+
return /* @__PURE__ */ jsx9(
|
|
1477
1513
|
"div",
|
|
1478
1514
|
{
|
|
1479
1515
|
className: "vtick" + (w % stepSec === 0 ? " vtick--l" : w % (stepSec / 2) === 0 ? " vtick--m" : ""),
|
|
@@ -1482,9 +1518,9 @@ function VerticalTimeline(p) {
|
|
|
1482
1518
|
"t" + t2
|
|
1483
1519
|
);
|
|
1484
1520
|
}),
|
|
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__ */
|
|
1521
|
+
axis.map((t2) => /* @__PURE__ */ jsx9("div", { className: "vaxis nvr-data", style: { top: yFor(t2) }, children: hhmm(t2) }, t2)),
|
|
1522
|
+
midnights.map((t2) => /* @__PURE__ */ jsx9("div", { className: "vday", style: { top: yFor(t2) }, children: /* @__PURE__ */ jsx9("span", { className: "nvr-data", children: dayLbl(t2) }) }, "d" + t2)),
|
|
1523
|
+
p.clip && inWin(Math.min(p.clip.from, p.clip.to), Math.max(p.clip.from, p.clip.to)) && /* @__PURE__ */ jsx9(
|
|
1488
1524
|
"div",
|
|
1489
1525
|
{
|
|
1490
1526
|
className: "vclip" + (p.clip.edge ? ` vclip--${p.clip.edge}` : "") + (p.clip.bad ? " vclip--bad" : ""),
|
|
@@ -1493,10 +1529,10 @@ function VerticalTimeline(p) {
|
|
|
1493
1529
|
}
|
|
1494
1530
|
),
|
|
1495
1531
|
runs.map(
|
|
1496
|
-
(r, i) => inWin(r.s, r.e) && /* @__PURE__ */
|
|
1532
|
+
(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
1533
|
),
|
|
1498
1534
|
p.motion.map(
|
|
1499
|
-
(m, i) => inWin(m[0], m[1]) && /* @__PURE__ */
|
|
1535
|
+
(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
1536
|
),
|
|
1501
1537
|
groups.map((g) => {
|
|
1502
1538
|
if (!inWin(g.oldest.timestamp, g.newest.timestamp)) return null;
|
|
@@ -1506,10 +1542,10 @@ function VerticalTimeline(p) {
|
|
|
1506
1542
|
const k = n > 1 ? g.cls : sentinelClassOf(ev);
|
|
1507
1543
|
const thumb = y - lastThumbY >= thumbGap && px > vh / (8 * 3600 * 1e3);
|
|
1508
1544
|
if (thumb) lastThumbY = y;
|
|
1509
|
-
return /* @__PURE__ */
|
|
1545
|
+
return /* @__PURE__ */ jsxs7("div", { children: [
|
|
1510
1546
|
g.events.map((m) => {
|
|
1511
1547
|
const sp = sentinelEventSpan(m, now);
|
|
1512
|
-
return sp && /* @__PURE__ */
|
|
1548
|
+
return sp && /* @__PURE__ */ jsx9(
|
|
1513
1549
|
"div",
|
|
1514
1550
|
{
|
|
1515
1551
|
className: "vspan" + (sp.open ? " vspan--open" : ""),
|
|
@@ -1522,7 +1558,7 @@ function VerticalTimeline(p) {
|
|
|
1522
1558
|
m.id
|
|
1523
1559
|
);
|
|
1524
1560
|
}),
|
|
1525
|
-
n > 1 ? /* @__PURE__ */
|
|
1561
|
+
n > 1 ? /* @__PURE__ */ jsx9(
|
|
1526
1562
|
"button",
|
|
1527
1563
|
{
|
|
1528
1564
|
className: "vev vev--group",
|
|
@@ -1532,7 +1568,7 @@ function VerticalTimeline(p) {
|
|
|
1532
1568
|
title: `${n} \xD7 ${hhmmss(g.oldest.timestamp)}\u2013${hhmmss(ev.timestamp)}`,
|
|
1533
1569
|
children: groupCountLabel(n)
|
|
1534
1570
|
}
|
|
1535
|
-
) : /* @__PURE__ */
|
|
1571
|
+
) : /* @__PURE__ */ jsx9(
|
|
1536
1572
|
"button",
|
|
1537
1573
|
{
|
|
1538
1574
|
className: "vev" + (thumb ? "" : " vev--minor"),
|
|
@@ -1542,33 +1578,33 @@ function VerticalTimeline(p) {
|
|
|
1542
1578
|
title: hhmmss(sentinelEventPlayTs(ev))
|
|
1543
1579
|
}
|
|
1544
1580
|
),
|
|
1545
|
-
thumb && /* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
/* @__PURE__ */
|
|
1581
|
+
thumb && /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
|
1582
|
+
/* @__PURE__ */ jsxs7("div", { className: "vlink", style: { top: y }, children: [
|
|
1583
|
+
/* @__PURE__ */ jsx9("span", { className: "vlink-badges", children: /* @__PURE__ */ jsx9(EventBadges, { ev, t }) }),
|
|
1584
|
+
/* @__PURE__ */ jsx9("i", {})
|
|
1549
1585
|
] }),
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1586
|
+
/* @__PURE__ */ jsxs7("button", { className: "vthumb", style: { top: y }, onClick: () => p.onEvent(ev), children: [
|
|
1587
|
+
/* @__PURE__ */ jsx9("img", { src: client.eventThumbUrl(p.camId, ev.timestamp), alt: "", loading: "lazy" }),
|
|
1588
|
+
/* @__PURE__ */ jsx9("span", { className: "tt nvr-data", children: hhmmss(ev.timestamp) })
|
|
1553
1589
|
] })
|
|
1554
1590
|
] })
|
|
1555
1591
|
] }, ev.id);
|
|
1556
1592
|
}),
|
|
1557
|
-
inWin(now) && /* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1559
|
-
/* @__PURE__ */
|
|
1593
|
+
inWin(now) && /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
|
1594
|
+
/* @__PURE__ */ jsx9("div", { className: "vlive-line", style: { top: yFor(now) } }),
|
|
1595
|
+
/* @__PURE__ */ jsx9("button", { className: "vlive-chip", style: { top: yFor(now) }, onClick: p.onGoLive, children: t("nvr.live") })
|
|
1560
1596
|
] })
|
|
1561
1597
|
] }) }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ jsx9("div", { className: "vcenter", children: /* @__PURE__ */ jsxs7("span", { className: "vcenter-t nvr-data", "data-ts": Math.round(center), children: [
|
|
1563
1599
|
centerIsToday ? "" : dayLbl(center) + " ",
|
|
1564
1600
|
hhmmss(center)
|
|
1565
1601
|
] }) }),
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ jsxs7("div", { className: "vtl-zoom", children: [
|
|
1603
|
+
/* @__PURE__ */ jsx9("button", { type: "button", className: "tool", onClick: () => zoomStep(1.7), "aria-label": t("nvr.timeline.zoomIn"), children: /* @__PURE__ */ jsx9(Plus, { size: 16 }) }),
|
|
1604
|
+
/* @__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
1605
|
] }),
|
|
1570
|
-
!p.live && /* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1606
|
+
!p.live && /* @__PURE__ */ jsxs7("button", { type: "button", className: "livejump", onClick: p.onGoLive, children: [
|
|
1607
|
+
/* @__PURE__ */ jsx9(ArrowUp, { size: 14 }),
|
|
1572
1608
|
" ",
|
|
1573
1609
|
t("nvr.live")
|
|
1574
1610
|
] })
|
|
@@ -1576,12 +1612,12 @@ function VerticalTimeline(p) {
|
|
|
1576
1612
|
}
|
|
1577
1613
|
|
|
1578
1614
|
// src/ui/components/CameraPage.tsx
|
|
1579
|
-
import { useCallback as
|
|
1615
|
+
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef4, useState as useState6 } from "react";
|
|
1580
1616
|
import {
|
|
1581
1617
|
Calendar,
|
|
1582
|
-
Camera as
|
|
1583
|
-
ChevronLeft as
|
|
1584
|
-
ChevronRight as
|
|
1618
|
+
Camera as Camera3,
|
|
1619
|
+
ChevronLeft as ChevronLeft3,
|
|
1620
|
+
ChevronRight as ChevronRight3,
|
|
1585
1621
|
Download as Download2,
|
|
1586
1622
|
FastForward,
|
|
1587
1623
|
Maximize2,
|
|
@@ -1755,9 +1791,9 @@ function clipErrorKind(status, code) {
|
|
|
1755
1791
|
}
|
|
1756
1792
|
|
|
1757
1793
|
// src/ui/components/ClipBar.tsx
|
|
1758
|
-
import { useCallback as
|
|
1794
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
|
|
1759
1795
|
import { Share2, X } from "lucide-react";
|
|
1760
|
-
import { Fragment as
|
|
1796
|
+
import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1761
1797
|
function canShareFiles() {
|
|
1762
1798
|
try {
|
|
1763
1799
|
const n = navigator;
|
|
@@ -1776,29 +1812,29 @@ function viewerTz() {
|
|
|
1776
1812
|
}
|
|
1777
1813
|
function ClipBar(p) {
|
|
1778
1814
|
const { client, t, locale } = useSentinelUi();
|
|
1779
|
-
const [job, setJobState] =
|
|
1780
|
-
const [edges, setEdges] =
|
|
1815
|
+
const [job, setJobState] = useState5({ s: "idle" });
|
|
1816
|
+
const [edges, setEdges] = useState5({ cur: p.edge, was: null });
|
|
1781
1817
|
if (edges.cur !== p.edge) setEdges({ cur: p.edge, was: edges.cur });
|
|
1782
|
-
const jobRef =
|
|
1783
|
-
const setJob =
|
|
1818
|
+
const jobRef = useRef3(job);
|
|
1819
|
+
const setJob = useCallback3((j) => {
|
|
1784
1820
|
jobRef.current = j;
|
|
1785
1821
|
setJobState(j);
|
|
1786
1822
|
}, []);
|
|
1787
|
-
const gen =
|
|
1788
|
-
const alive =
|
|
1789
|
-
const abort =
|
|
1823
|
+
const gen = useRef3(0);
|
|
1824
|
+
const alive = useRef3(true);
|
|
1825
|
+
const abort = useRef3(null);
|
|
1790
1826
|
const standalone = isIosHomeScreenApp();
|
|
1791
|
-
const release =
|
|
1827
|
+
const release = useCallback3(() => {
|
|
1792
1828
|
abort.current?.abort();
|
|
1793
1829
|
abort.current = null;
|
|
1794
1830
|
const j = jobRef.current;
|
|
1795
1831
|
if (j.s === "ready" && j.blobUrl) URL.revokeObjectURL(j.blobUrl);
|
|
1796
1832
|
}, []);
|
|
1797
|
-
const cancelRunning =
|
|
1833
|
+
const cancelRunning = useCallback3(() => {
|
|
1798
1834
|
const j = jobRef.current;
|
|
1799
1835
|
if (j.s === "running") void client.cancelExport(j.id);
|
|
1800
1836
|
}, [client]);
|
|
1801
|
-
|
|
1837
|
+
useEffect4(() => {
|
|
1802
1838
|
alive.current = true;
|
|
1803
1839
|
return () => {
|
|
1804
1840
|
alive.current = false;
|
|
@@ -1808,8 +1844,8 @@ function ClipBar(p) {
|
|
|
1808
1844
|
};
|
|
1809
1845
|
}, [cancelRunning, release]);
|
|
1810
1846
|
const rangeKey = `${p.range.from}|${p.range.to}`;
|
|
1811
|
-
const lastKey =
|
|
1812
|
-
|
|
1847
|
+
const lastKey = useRef3(rangeKey);
|
|
1848
|
+
useEffect4(() => {
|
|
1813
1849
|
if (lastKey.current === rangeKey) return;
|
|
1814
1850
|
lastKey.current = rangeKey;
|
|
1815
1851
|
if (jobRef.current.s === "idle") return;
|
|
@@ -1818,14 +1854,14 @@ function ClipBar(p) {
|
|
|
1818
1854
|
release();
|
|
1819
1855
|
setJob({ s: "idle" });
|
|
1820
1856
|
}, [rangeKey, cancelRunning, release, setJob]);
|
|
1821
|
-
const fail =
|
|
1857
|
+
const fail = useCallback3(
|
|
1822
1858
|
(kind, vars, extra) => {
|
|
1823
1859
|
rlog("clip", { ok: false, err: kind, standalone, ...extra });
|
|
1824
1860
|
setJob(vars ? { s: "error", kind, vars } : { s: "error", kind });
|
|
1825
1861
|
},
|
|
1826
1862
|
[setJob, standalone]
|
|
1827
1863
|
);
|
|
1828
|
-
const errorOf =
|
|
1864
|
+
const errorOf = useCallback3(
|
|
1829
1865
|
(e) => {
|
|
1830
1866
|
const st2 = e instanceof SentinelHttpError ? e.status : 0;
|
|
1831
1867
|
const code = e instanceof SentinelHttpError ? e.code : void 0;
|
|
@@ -1842,7 +1878,7 @@ function ClipBar(p) {
|
|
|
1842
1878
|
},
|
|
1843
1879
|
[fail, locale]
|
|
1844
1880
|
);
|
|
1845
|
-
const finish =
|
|
1881
|
+
const finish = useCallback3(
|
|
1846
1882
|
async (g, d) => {
|
|
1847
1883
|
const crossOrigin = isCrossOrigin(client.exportFileUrl(d.id));
|
|
1848
1884
|
const ways = clipWays({ bytes: d.bytes, canShareFiles: canShareFiles(), standalone, crossOrigin });
|
|
@@ -1882,7 +1918,7 @@ function ClipBar(p) {
|
|
|
1882
1918
|
[client, fail, setJob, standalone]
|
|
1883
1919
|
);
|
|
1884
1920
|
const running = job.s === "running" ? job.id : null;
|
|
1885
|
-
|
|
1921
|
+
useEffect4(() => {
|
|
1886
1922
|
if (!running) return;
|
|
1887
1923
|
const g = gen.current;
|
|
1888
1924
|
let timer = 0;
|
|
@@ -1940,7 +1976,7 @@ function ClipBar(p) {
|
|
|
1940
1976
|
};
|
|
1941
1977
|
}, [running, client, finish, fail, setJob]);
|
|
1942
1978
|
const expiresAt = job.s === "ready" || job.s === "loading" ? job.expiresAt : void 0;
|
|
1943
|
-
|
|
1979
|
+
useEffect4(() => {
|
|
1944
1980
|
if (!expiresAt) return;
|
|
1945
1981
|
const g = gen.current;
|
|
1946
1982
|
const i = window.setTimeout(
|
|
@@ -1956,7 +1992,7 @@ function ClipBar(p) {
|
|
|
1956
1992
|
);
|
|
1957
1993
|
return () => window.clearTimeout(i);
|
|
1958
1994
|
}, [expiresAt, release, setJob]);
|
|
1959
|
-
const create =
|
|
1995
|
+
const create = useCallback3(async () => {
|
|
1960
1996
|
const j = jobRef.current;
|
|
1961
1997
|
if (j.s === "starting" || j.s === "running" || j.s === "loading") return;
|
|
1962
1998
|
gen.current++;
|
|
@@ -1977,7 +2013,7 @@ function ClipBar(p) {
|
|
|
1977
2013
|
errorOf(e);
|
|
1978
2014
|
}
|
|
1979
2015
|
}, [client, p, release, setJob, errorOf]);
|
|
1980
|
-
const cancel =
|
|
2016
|
+
const cancel = useCallback3(() => {
|
|
1981
2017
|
cancelRunning();
|
|
1982
2018
|
gen.current++;
|
|
1983
2019
|
release();
|
|
@@ -2012,7 +2048,7 @@ function ClipBar(p) {
|
|
|
2012
2048
|
const bad = e === "to" && hints.tooLong;
|
|
2013
2049
|
const k = t(e === "from" ? "nvr.clip.from" : "nvr.clip.to");
|
|
2014
2050
|
const v = fmtClipTime(ts, locale);
|
|
2015
|
-
return /* @__PURE__ */
|
|
2051
|
+
return /* @__PURE__ */ jsxs8(
|
|
2016
2052
|
"button",
|
|
2017
2053
|
{
|
|
2018
2054
|
type: "button",
|
|
@@ -2022,9 +2058,9 @@ function ClipBar(p) {
|
|
|
2022
2058
|
disabled: busy,
|
|
2023
2059
|
onClick: () => p.onEdge(active ? null : e),
|
|
2024
2060
|
children: [
|
|
2025
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipchip__k", children: k }),
|
|
2026
2062
|
" ",
|
|
2027
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipchip__v nvr-data", children: v })
|
|
2028
2064
|
]
|
|
2029
2065
|
}
|
|
2030
2066
|
);
|
|
@@ -2054,10 +2090,10 @@ function ClipBar(p) {
|
|
|
2054
2090
|
if (job.s === "starting" || job.s === "running") {
|
|
2055
2091
|
pct = job.s === "running" ? Math.round(job.pct * 100) : 0;
|
|
2056
2092
|
state = t("nvr.clip.preparing", { pct });
|
|
2057
|
-
actions = /* @__PURE__ */
|
|
2093
|
+
actions = /* @__PURE__ */ jsx10("button", { type: "button", className: "nvr-btn nvr-btn--ghost", onClick: cancel, children: t("nvr.clip.cancel") });
|
|
2058
2094
|
} else if (ready) {
|
|
2059
2095
|
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__ */
|
|
2096
|
+
const save = ready.ways.save === "safari" ? /* @__PURE__ */ jsx10(
|
|
2061
2097
|
"a",
|
|
2062
2098
|
{
|
|
2063
2099
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2067,7 +2103,7 @@ function ClipBar(p) {
|
|
|
2067
2103
|
onClick: () => log("safari"),
|
|
2068
2104
|
children: t("nvr.player.openInSafari")
|
|
2069
2105
|
}
|
|
2070
|
-
) : ready.ways.save === "blob" ? job.s === "ready" && job.blobUrl ? /* @__PURE__ */
|
|
2106
|
+
) : ready.ways.save === "blob" ? job.s === "ready" && job.blobUrl ? /* @__PURE__ */ jsx10(
|
|
2071
2107
|
"a",
|
|
2072
2108
|
{
|
|
2073
2109
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2076,9 +2112,9 @@ function ClipBar(p) {
|
|
|
2076
2112
|
onClick: () => log("blob"),
|
|
2077
2113
|
children: t("nvr.clip.save")
|
|
2078
2114
|
}
|
|
2079
|
-
) : /* @__PURE__ */
|
|
2115
|
+
) : /* @__PURE__ */ jsx10("button", { type: "button", className: "nvr-btn nvr-btn--primary", disabled: true, children: t("nvr.clip.save") }) : ready.ways.save === "tab" ? (
|
|
2080
2116
|
// another origin, too large for the page: a new tab saves it (attachment), the host page stays
|
|
2081
|
-
/* @__PURE__ */
|
|
2117
|
+
/* @__PURE__ */ jsx10(
|
|
2082
2118
|
"a",
|
|
2083
2119
|
{
|
|
2084
2120
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2089,7 +2125,7 @@ function ClipBar(p) {
|
|
|
2089
2125
|
children: t("nvr.clip.save")
|
|
2090
2126
|
}
|
|
2091
2127
|
)
|
|
2092
|
-
) : /* @__PURE__ */
|
|
2128
|
+
) : /* @__PURE__ */ jsx10(
|
|
2093
2129
|
"a",
|
|
2094
2130
|
{
|
|
2095
2131
|
className: "nvr-btn nvr-btn--primary",
|
|
@@ -2099,9 +2135,9 @@ function ClipBar(p) {
|
|
|
2099
2135
|
children: t("nvr.clip.save")
|
|
2100
2136
|
}
|
|
2101
2137
|
);
|
|
2102
|
-
actions = /* @__PURE__ */
|
|
2138
|
+
actions = /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2103
2139
|
save,
|
|
2104
|
-
ready.ways.share && /* @__PURE__ */
|
|
2140
|
+
ready.ways.share && /* @__PURE__ */ jsxs8(
|
|
2105
2141
|
"button",
|
|
2106
2142
|
{
|
|
2107
2143
|
type: "button",
|
|
@@ -2109,7 +2145,7 @@ function ClipBar(p) {
|
|
|
2109
2145
|
disabled: !(job.s === "ready" && job.file),
|
|
2110
2146
|
onClick: share,
|
|
2111
2147
|
children: [
|
|
2112
|
-
/* @__PURE__ */
|
|
2148
|
+
/* @__PURE__ */ jsx10(Share2, { size: 16 }),
|
|
2113
2149
|
t("nvr.clip.share")
|
|
2114
2150
|
]
|
|
2115
2151
|
}
|
|
@@ -2117,7 +2153,7 @@ function ClipBar(p) {
|
|
|
2117
2153
|
] });
|
|
2118
2154
|
} else {
|
|
2119
2155
|
const again = job.s === "error" && job.kind === "expired";
|
|
2120
|
-
actions = /* @__PURE__ */
|
|
2156
|
+
actions = /* @__PURE__ */ jsx10(
|
|
2121
2157
|
"button",
|
|
2122
2158
|
{
|
|
2123
2159
|
type: "button",
|
|
@@ -2128,53 +2164,53 @@ function ClipBar(p) {
|
|
|
2128
2164
|
}
|
|
2129
2165
|
);
|
|
2130
2166
|
}
|
|
2131
|
-
return /* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2133
|
-
p.immersive ? /* @__PURE__ */
|
|
2167
|
+
return /* @__PURE__ */ jsxs8("div", { className: "nvr-clipbar", role: "group", "aria-label": t("nvr.clip.download"), children: [
|
|
2168
|
+
/* @__PURE__ */ jsxs8("div", { className: "nvr-clipbar__row", children: [
|
|
2169
|
+
p.immersive ? /* @__PURE__ */ jsxs8("div", { className: "nvr-clipbar__edges", "data-edge": p.edge ?? void 0, "data-was": edges.was ?? void 0, children: [
|
|
2134
2170
|
chip("from"),
|
|
2135
2171
|
chip("to")
|
|
2136
|
-
] }) : /* @__PURE__ */
|
|
2172
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2137
2173
|
chip("from"),
|
|
2138
2174
|
chip("to")
|
|
2139
2175
|
] }),
|
|
2140
|
-
/* @__PURE__ */
|
|
2176
|
+
/* @__PURE__ */ jsx10(
|
|
2141
2177
|
"button",
|
|
2142
2178
|
{
|
|
2143
2179
|
type: "button",
|
|
2144
2180
|
className: "nvr-iconbtn nvr-clipbar__close",
|
|
2145
2181
|
"aria-label": t("nvr.clip.close"),
|
|
2146
2182
|
onClick: p.onClose,
|
|
2147
|
-
children: /* @__PURE__ */
|
|
2183
|
+
children: /* @__PURE__ */ jsx10(X, { size: 16 })
|
|
2148
2184
|
}
|
|
2149
2185
|
)
|
|
2150
2186
|
] }),
|
|
2151
|
-
/* @__PURE__ */
|
|
2187
|
+
/* @__PURE__ */ jsxs8(
|
|
2152
2188
|
"div",
|
|
2153
2189
|
{
|
|
2154
2190
|
className: "nvr-clipbar__note" + (note?.tone === "bad" ? " nvr-clipbar__note--bad" : ""),
|
|
2155
2191
|
title: [lenText, state, note?.text].filter(Boolean).join(" \xB7 "),
|
|
2156
2192
|
children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
state && /* @__PURE__ */
|
|
2193
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipbar__len nvr-data", children: lenText }),
|
|
2194
|
+
/* @__PURE__ */ jsxs8("span", { role: "status", children: [
|
|
2195
|
+
state && /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2160
2196
|
" \xB7 ",
|
|
2161
|
-
/* @__PURE__ */
|
|
2197
|
+
/* @__PURE__ */ jsx10("span", { className: "nvr-clipbar__state", children: state })
|
|
2162
2198
|
] }),
|
|
2163
|
-
note && /* @__PURE__ */
|
|
2199
|
+
note && /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
2164
2200
|
" \xB7 ",
|
|
2165
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsx10("span", { className: note.tone === "bad" ? "nvr-clipbar__bad" : void 0, children: note.text })
|
|
2166
2202
|
] })
|
|
2167
2203
|
] })
|
|
2168
2204
|
]
|
|
2169
2205
|
}
|
|
2170
2206
|
),
|
|
2171
|
-
pct != null && /* @__PURE__ */
|
|
2172
|
-
/* @__PURE__ */
|
|
2207
|
+
pct != null && /* @__PURE__ */ jsx10("div", { className: "nvr-clipbar__prog", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("i", { style: { width: `${pct}%` } }) }),
|
|
2208
|
+
/* @__PURE__ */ jsx10("div", { className: "nvr-clipbar__row nvr-clipbar__actions", children: actions })
|
|
2173
2209
|
] });
|
|
2174
2210
|
}
|
|
2175
2211
|
|
|
2176
2212
|
// src/ui/components/CameraPage.tsx
|
|
2177
|
-
import { jsx as
|
|
2213
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2178
2214
|
var IDLE = {
|
|
2179
2215
|
live: true,
|
|
2180
2216
|
label: "live",
|
|
@@ -2195,42 +2231,42 @@ function CameraTitle({
|
|
|
2195
2231
|
}) {
|
|
2196
2232
|
const { t, locale } = useSentinelUi();
|
|
2197
2233
|
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__ */
|
|
2234
|
+
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;
|
|
2235
|
+
const h1 = /* @__PURE__ */ jsx11("h1", { className: "nvr-cam__h1", children: name });
|
|
2236
|
+
return /* @__PURE__ */ jsxs9("div", { className: "nvr-cam__head", children: [
|
|
2237
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-cam__title", children: [
|
|
2238
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: "nvr-iconbtn", "aria-label": t("nvr.back"), onClick: onBack, children: /* @__PURE__ */ jsx11(ChevronLeft3, { size: 20 }) }),
|
|
2239
|
+
badge ? /* @__PURE__ */ jsxs9("span", { className: "nvr-cam__name", children: [
|
|
2204
2240
|
h1,
|
|
2205
2241
|
badge
|
|
2206
2242
|
] }) : h1
|
|
2207
2243
|
] }),
|
|
2208
|
-
children ? /* @__PURE__ */
|
|
2244
|
+
children ? /* @__PURE__ */ jsx11("div", { className: "nvr-cam__actions", children }) : null
|
|
2209
2245
|
] });
|
|
2210
2246
|
}
|
|
2211
2247
|
function CameraPage(p) {
|
|
2212
2248
|
const { client, t, locale } = useSentinelUi();
|
|
2213
2249
|
const { camId, name, earliest, startAt = 0, posterTs = 0 } = p;
|
|
2214
|
-
const [days, setDays] =
|
|
2215
|
-
const [nowTick, setNowTick] =
|
|
2216
|
-
|
|
2250
|
+
const [days, setDays] = useState6({});
|
|
2251
|
+
const [nowTick, setNowTick] = useState6(Date.now());
|
|
2252
|
+
useEffect5(() => {
|
|
2217
2253
|
const i = setInterval(() => setNowTick(Date.now()), 3e4);
|
|
2218
2254
|
return () => clearInterval(i);
|
|
2219
2255
|
}, []);
|
|
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
|
-
|
|
2256
|
+
const [centerDay, setCenterDay] = useState6(todayStart());
|
|
2257
|
+
const [jump, setJump] = useState6(null);
|
|
2258
|
+
const [tab, setTab] = useState6("tl");
|
|
2259
|
+
const [filterOff, setFilterOff] = useState6({});
|
|
2260
|
+
const [ps, setPs] = useState6(IDLE);
|
|
2261
|
+
const [loadError, setLoadError] = useState6(false);
|
|
2262
|
+
const [dt, setDt] = useState6(false);
|
|
2263
|
+
const [pipNote, setPipNote] = useState6(null);
|
|
2264
|
+
useEffect5(() => {
|
|
2229
2265
|
if (!pipNote) return;
|
|
2230
2266
|
const i = setTimeout(() => setPipNote(null), 15e3);
|
|
2231
2267
|
return () => clearTimeout(i);
|
|
2232
2268
|
}, [pipNote]);
|
|
2233
|
-
const onPip =
|
|
2269
|
+
const onPip = useCallback4(() => {
|
|
2234
2270
|
const c = ctl.current;
|
|
2235
2271
|
if (!c) return;
|
|
2236
2272
|
void c.pip().then((r) => {
|
|
@@ -2238,35 +2274,35 @@ function CameraPage(p) {
|
|
|
2238
2274
|
else if (r === "entered") setPipNote(null);
|
|
2239
2275
|
});
|
|
2240
2276
|
}, []);
|
|
2241
|
-
const body =
|
|
2242
|
-
const stage =
|
|
2243
|
-
const video =
|
|
2244
|
-
const freeze =
|
|
2245
|
-
const img =
|
|
2246
|
-
const ctl =
|
|
2247
|
-
const psRef =
|
|
2277
|
+
const body = useRef4(null);
|
|
2278
|
+
const stage = useRef4(null);
|
|
2279
|
+
const video = useRef4(null);
|
|
2280
|
+
const freeze = useRef4(null);
|
|
2281
|
+
const img = useRef4(null);
|
|
2282
|
+
const ctl = useRef4(null);
|
|
2283
|
+
const psRef = useRef4(ps);
|
|
2248
2284
|
psRef.current = ps;
|
|
2249
|
-
const loading =
|
|
2250
|
-
const daysRef =
|
|
2285
|
+
const loading = useRef4(/* @__PURE__ */ new Set());
|
|
2286
|
+
const daysRef = useRef4(days);
|
|
2251
2287
|
daysRef.current = days;
|
|
2252
|
-
const camRef =
|
|
2288
|
+
const camRef = useRef4(camId);
|
|
2253
2289
|
camRef.current = camId;
|
|
2254
|
-
const deepRef =
|
|
2255
|
-
const [clip, setClip] =
|
|
2256
|
-
const [clipEdge, setClipEdge] =
|
|
2257
|
-
const clipRef =
|
|
2290
|
+
const deepRef = useRef4("");
|
|
2291
|
+
const [clip, setClip] = useState6(null);
|
|
2292
|
+
const [clipEdge, setClipEdge] = useState6(null);
|
|
2293
|
+
const clipRef = useRef4(clip);
|
|
2258
2294
|
clipRef.current = clip;
|
|
2259
|
-
const clipEdgeRef =
|
|
2295
|
+
const clipEdgeRef = useRef4(clipEdge);
|
|
2260
2296
|
clipEdgeRef.current = clipEdge;
|
|
2261
|
-
const lineTs =
|
|
2262
|
-
const gestureAt =
|
|
2297
|
+
const lineTs = useRef4(null);
|
|
2298
|
+
const gestureAt = useRef4(0);
|
|
2263
2299
|
const merged = useMemo2(() => {
|
|
2264
2300
|
const m = sentinelMergeDays(days);
|
|
2265
2301
|
const rangeStart = m.oldestDay ?? todayStart();
|
|
2266
2302
|
const rangeEnd = Math.min(sentinelDayEnd(todayStart()), nowTick + 20 * 6e4);
|
|
2267
2303
|
return { ...m, rangeStart, rangeEnd };
|
|
2268
2304
|
}, [days, nowTick]);
|
|
2269
|
-
const mergedNow =
|
|
2305
|
+
const mergedNow = useCallback4(() => {
|
|
2270
2306
|
const m = sentinelMergeDays(daysRef.current);
|
|
2271
2307
|
return {
|
|
2272
2308
|
...m,
|
|
@@ -2274,11 +2310,11 @@ function CameraPage(p) {
|
|
|
2274
2310
|
rangeEnd: Math.min(sentinelDayEnd(todayStart()), Date.now() + 20 * 6e4)
|
|
2275
2311
|
};
|
|
2276
2312
|
}, []);
|
|
2277
|
-
|
|
2313
|
+
useEffect5(() => {
|
|
2278
2314
|
ctl.current?.setClips(merged.clips, merged.codecs, merged.rangeStart, merged.rangeEnd);
|
|
2279
2315
|
}, [merged]);
|
|
2280
|
-
const frameServer =
|
|
2281
|
-
const fetchDay =
|
|
2316
|
+
const frameServer = useCallback4(() => Object.values(daysRef.current).some((d) => sentinelHasFeature(d, "frame")), []);
|
|
2317
|
+
const fetchDay = useCallback4(
|
|
2282
2318
|
async (ds) => {
|
|
2283
2319
|
const d = await client.getJson(
|
|
2284
2320
|
`api/clips?camera=${encodeURIComponent(camId)}&start=${ds}&end=${sentinelDayEnd(ds)}`
|
|
@@ -2290,7 +2326,7 @@ function CameraPage(p) {
|
|
|
2290
2326
|
},
|
|
2291
2327
|
[client, camId]
|
|
2292
2328
|
);
|
|
2293
|
-
const ensureDay =
|
|
2329
|
+
const ensureDay = useCallback4(
|
|
2294
2330
|
async (ds, force = false) => {
|
|
2295
2331
|
if (ds > todayStart()) return;
|
|
2296
2332
|
if (earliest && sentinelAddDays(ds, 1) < sentinelDayOf(earliest)) return;
|
|
@@ -2308,7 +2344,7 @@ function CameraPage(p) {
|
|
|
2308
2344
|
},
|
|
2309
2345
|
[fetchDay, earliest, camId]
|
|
2310
2346
|
);
|
|
2311
|
-
const onCenter =
|
|
2347
|
+
const onCenter = useCallback4(
|
|
2312
2348
|
(ts) => {
|
|
2313
2349
|
lineTs.current = ts;
|
|
2314
2350
|
const d = sentinelDayOf(ts);
|
|
@@ -2317,7 +2353,7 @@ function CameraPage(p) {
|
|
|
2317
2353
|
},
|
|
2318
2354
|
[ensureDay]
|
|
2319
2355
|
);
|
|
2320
|
-
|
|
2356
|
+
useEffect5(() => {
|
|
2321
2357
|
const st = stage.current, cd = body.current;
|
|
2322
2358
|
if (!st || !cd) return;
|
|
2323
2359
|
const sync = () => {
|
|
@@ -2330,7 +2366,7 @@ function CameraPage(p) {
|
|
|
2330
2366
|
mo.observe(st, { attributes: true, attributeFilter: ["style"] });
|
|
2331
2367
|
return () => mo.disconnect();
|
|
2332
2368
|
}, []);
|
|
2333
|
-
|
|
2369
|
+
useEffect5(() => {
|
|
2334
2370
|
const c = new PlayerController(client, {
|
|
2335
2371
|
onState: (s) => setPs(s),
|
|
2336
2372
|
onClipsRefresh: async () => {
|
|
@@ -2349,7 +2385,7 @@ function CameraPage(p) {
|
|
|
2349
2385
|
delete window.__snvr;
|
|
2350
2386
|
};
|
|
2351
2387
|
}, [client]);
|
|
2352
|
-
|
|
2388
|
+
useEffect5(() => {
|
|
2353
2389
|
const c = ctl.current;
|
|
2354
2390
|
if (!c || !camId) return;
|
|
2355
2391
|
c.setCamera(camId, name);
|
|
@@ -2394,7 +2430,7 @@ function CameraPage(p) {
|
|
|
2394
2430
|
});
|
|
2395
2431
|
deepRef.current = `${camId}|${startAt}`;
|
|
2396
2432
|
}, [camId, client]);
|
|
2397
|
-
|
|
2433
|
+
useEffect5(() => {
|
|
2398
2434
|
const key = `${camId}|${startAt}`;
|
|
2399
2435
|
if (!startAt || !ctl.current || key === deepRef.current) return;
|
|
2400
2436
|
deepRef.current = key;
|
|
@@ -2403,10 +2439,10 @@ function CameraPage(p) {
|
|
|
2403
2439
|
if (posterTs) c.posterEvent(posterTs, frameServer() ? startAt : void 0);
|
|
2404
2440
|
goToDay(sentinelDayOf(startAt), startAt).catch(() => setLoadError(true));
|
|
2405
2441
|
}, [startAt, posterTs]);
|
|
2406
|
-
|
|
2442
|
+
useEffect5(() => {
|
|
2407
2443
|
if (ctl.current && name) ctl.current.camName = name;
|
|
2408
2444
|
}, [name]);
|
|
2409
|
-
|
|
2445
|
+
useEffect5(() => {
|
|
2410
2446
|
const i = setInterval(() => {
|
|
2411
2447
|
const ok = todayRefreshAllowed({
|
|
2412
2448
|
hidden: document.visibilityState === "hidden",
|
|
@@ -2430,11 +2466,11 @@ function CameraPage(p) {
|
|
|
2430
2466
|
[merged.events, filterOff]
|
|
2431
2467
|
);
|
|
2432
2468
|
const dayCount = useMemo2(() => eventsOnDay(visEvents, centerDay), [visEvents, centerDay]);
|
|
2433
|
-
const goLive =
|
|
2469
|
+
const goLive = useCallback4(() => {
|
|
2434
2470
|
ctl.current?.goLive();
|
|
2435
2471
|
setJump({ ts: Date.now(), n: Date.now() });
|
|
2436
2472
|
}, []);
|
|
2437
|
-
const playEvent =
|
|
2473
|
+
const playEvent = useCallback4(
|
|
2438
2474
|
(ev) => {
|
|
2439
2475
|
const c = ctl.current;
|
|
2440
2476
|
if (!c) return;
|
|
@@ -2446,7 +2482,7 @@ function CameraPage(p) {
|
|
|
2446
2482
|
},
|
|
2447
2483
|
[frameServer]
|
|
2448
2484
|
);
|
|
2449
|
-
const seekTo =
|
|
2485
|
+
const seekTo = useCallback4(
|
|
2450
2486
|
(ts) => {
|
|
2451
2487
|
const c = ctl.current;
|
|
2452
2488
|
if (!c) return;
|
|
@@ -2459,7 +2495,7 @@ function CameraPage(p) {
|
|
|
2459
2495
|
},
|
|
2460
2496
|
[goLive]
|
|
2461
2497
|
);
|
|
2462
|
-
const jumpEvent =
|
|
2498
|
+
const jumpEvent = useCallback4(
|
|
2463
2499
|
(dir) => {
|
|
2464
2500
|
const c = ctl.current;
|
|
2465
2501
|
if (!c) return;
|
|
@@ -2479,7 +2515,7 @@ function CameraPage(p) {
|
|
|
2479
2515
|
},
|
|
2480
2516
|
[visEvents, playEvent]
|
|
2481
2517
|
);
|
|
2482
|
-
const goToDay =
|
|
2518
|
+
const goToDay = useCallback4(
|
|
2483
2519
|
async (ds, at2) => {
|
|
2484
2520
|
const c = ctl.current;
|
|
2485
2521
|
if (!c) return;
|
|
@@ -2507,7 +2543,7 @@ function CameraPage(p) {
|
|
|
2507
2543
|
);
|
|
2508
2544
|
const canExport = useMemo2(() => Object.values(days).some((d) => sentinelHasFeature(d, "export")), [days]);
|
|
2509
2545
|
const oldestRec = earliest ?? merged.clips[0]?.startTime;
|
|
2510
|
-
const clipEvent =
|
|
2546
|
+
const clipEvent = useCallback4(
|
|
2511
2547
|
(ev) => {
|
|
2512
2548
|
const now = Date.now();
|
|
2513
2549
|
const r = clipRangeForEvent(ev, now);
|
|
@@ -2523,11 +2559,11 @@ function CameraPage(p) {
|
|
|
2523
2559
|
},
|
|
2524
2560
|
[oldestRec, frameServer]
|
|
2525
2561
|
);
|
|
2526
|
-
const closeClip =
|
|
2562
|
+
const closeClip = useCallback4(() => {
|
|
2527
2563
|
setClip(null);
|
|
2528
2564
|
setClipEdge(null);
|
|
2529
2565
|
}, []);
|
|
2530
|
-
const toggleClip =
|
|
2566
|
+
const toggleClip = useCallback4(() => {
|
|
2531
2567
|
if (clipRef.current) {
|
|
2532
2568
|
closeClip();
|
|
2533
2569
|
return;
|
|
@@ -2545,7 +2581,7 @@ function CameraPage(p) {
|
|
|
2545
2581
|
setClipEdge(null);
|
|
2546
2582
|
setTab("tl");
|
|
2547
2583
|
}, [closeClip, visEvents, oldestRec]);
|
|
2548
|
-
const activateEdge =
|
|
2584
|
+
const activateEdge = useCallback4((e) => {
|
|
2549
2585
|
setClipEdge(e);
|
|
2550
2586
|
const r = clipRef.current;
|
|
2551
2587
|
if (!e || !r) return;
|
|
@@ -2558,7 +2594,7 @@ function CameraPage(p) {
|
|
|
2558
2594
|
c.playAt(ts, {});
|
|
2559
2595
|
}
|
|
2560
2596
|
}, []);
|
|
2561
|
-
const onUserCenter =
|
|
2597
|
+
const onUserCenter = useCallback4((ts) => {
|
|
2562
2598
|
lineTs.current = ts;
|
|
2563
2599
|
const e = clipEdgeRef.current, r = clipRef.current;
|
|
2564
2600
|
if (!e || !r) return;
|
|
@@ -2566,7 +2602,7 @@ function CameraPage(p) {
|
|
|
2566
2602
|
setClip({ ...n.range, open: false });
|
|
2567
2603
|
if (n.edge !== e) setClipEdge(n.edge);
|
|
2568
2604
|
}, []);
|
|
2569
|
-
const setEdgeToLine =
|
|
2605
|
+
const setEdgeToLine = useCallback4((e) => {
|
|
2570
2606
|
const r = clipRef.current;
|
|
2571
2607
|
if (!r) return;
|
|
2572
2608
|
const s = psRef.current;
|
|
@@ -2576,7 +2612,7 @@ function CameraPage(p) {
|
|
|
2576
2612
|
setClip({ ...n.range, open: false });
|
|
2577
2613
|
if (clipEdgeRef.current) setClipEdge(n.edge);
|
|
2578
2614
|
}, []);
|
|
2579
|
-
const onTimelineEvent =
|
|
2615
|
+
const onTimelineEvent = useCallback4(
|
|
2580
2616
|
(ev) => clipRef.current ? clipEvent(ev) : playEvent(ev),
|
|
2581
2617
|
[clipEvent, playEvent]
|
|
2582
2618
|
);
|
|
@@ -2605,7 +2641,7 @@ function CameraPage(p) {
|
|
|
2605
2641
|
}),
|
|
2606
2642
|
[]
|
|
2607
2643
|
);
|
|
2608
|
-
|
|
2644
|
+
useEffect5(() => {
|
|
2609
2645
|
const k = (e) => {
|
|
2610
2646
|
if (dt || !shouldHandleKey(e)) return;
|
|
2611
2647
|
const c = ctl.current;
|
|
@@ -2640,15 +2676,15 @@ function CameraPage(p) {
|
|
|
2640
2676
|
const header = typeof p.header === "function" ? p.header(at, { live: ps.live }) : p.header;
|
|
2641
2677
|
const immersive = p.appearance === "immersive";
|
|
2642
2678
|
const externalUrl = typeof p.externalUrl === "function" ? p.externalUrl(at) : p.externalUrl;
|
|
2643
|
-
return /* @__PURE__ */
|
|
2679
|
+
return /* @__PURE__ */ jsxs9("div", { className: "nvr-cam", "data-nvr-appearance": immersive ? "immersive" : void 0, children: [
|
|
2644
2680
|
header,
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2649
|
-
/* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2651
|
-
!mjpeg && /* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-cam__body" + (clip ? " nvr-cam__body--clip" : ""), ref: body, children: [
|
|
2682
|
+
/* @__PURE__ */ jsx11("div", { className: "nvr-cam__left", children: /* @__PURE__ */ jsxs9("div", { className: "nvr-card nvr-stage-card", children: [
|
|
2683
|
+
/* @__PURE__ */ jsx11("div", { className: "nvr-stage-wrap", children: /* @__PURE__ */ jsxs9("div", { className: "nvr-stage", ref: stage, children: [
|
|
2684
|
+
/* @__PURE__ */ jsx11("video", { ref: video, playsInline: true, autoPlay: true, muted: true, crossOrigin: cors, className: "nvr-stage__video" }),
|
|
2685
|
+
/* @__PURE__ */ jsx11("img", { ref: img, crossOrigin: cors, className: "nvr-stage__video nvr-stage__img hidden", alt: "" }),
|
|
2686
|
+
/* @__PURE__ */ jsx11("canvas", { ref: freeze, className: "nvr-stage__video nvr-stage__freeze hidden" }),
|
|
2687
|
+
!mjpeg && /* @__PURE__ */ jsx11(
|
|
2652
2688
|
"button",
|
|
2653
2689
|
{
|
|
2654
2690
|
type: "button",
|
|
@@ -2656,21 +2692,21 @@ function CameraPage(p) {
|
|
|
2656
2692
|
"aria-label": t("nvr.player.sound"),
|
|
2657
2693
|
"aria-pressed": ps.sound,
|
|
2658
2694
|
onClick: () => ctl.current?.setSound(!ps.sound),
|
|
2659
|
-
children: ps.sound && !ps.muted ? /* @__PURE__ */
|
|
2695
|
+
children: ps.sound && !ps.muted ? /* @__PURE__ */ jsx11(Volume2, { size: 18 }) : /* @__PURE__ */ jsx11(VolumeX, { size: 18 })
|
|
2660
2696
|
}
|
|
2661
2697
|
),
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-pill-ctl" + (ps.live ? " nvr-pill-ctl--live" : ""), children: [
|
|
2699
|
+
/* @__PURE__ */ jsx11(
|
|
2664
2700
|
"button",
|
|
2665
2701
|
{
|
|
2666
2702
|
type: "button",
|
|
2667
2703
|
className: "nvr-pb",
|
|
2668
2704
|
"aria-label": t("nvr.player.back15"),
|
|
2669
2705
|
onClick: () => ctl.current?.skip(-15e3),
|
|
2670
|
-
children: /* @__PURE__ */
|
|
2706
|
+
children: /* @__PURE__ */ jsx11(Rewind, { size: 18 })
|
|
2671
2707
|
}
|
|
2672
2708
|
),
|
|
2673
|
-
/* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsx11(
|
|
2674
2710
|
"button",
|
|
2675
2711
|
{
|
|
2676
2712
|
type: "button",
|
|
@@ -2678,10 +2714,10 @@ function CameraPage(p) {
|
|
|
2678
2714
|
"aria-label": ps.paused ? t("nvr.player.play") : t("nvr.player.pause"),
|
|
2679
2715
|
disabled: ps.live,
|
|
2680
2716
|
onClick: () => ctl.current?.togglePlayPause(),
|
|
2681
|
-
children: ps.paused ? /* @__PURE__ */
|
|
2717
|
+
children: ps.paused ? /* @__PURE__ */ jsx11(Play, { size: 18 }) : /* @__PURE__ */ jsx11(Pause, { size: 18 })
|
|
2682
2718
|
}
|
|
2683
2719
|
),
|
|
2684
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ jsx11(
|
|
2685
2721
|
"button",
|
|
2686
2722
|
{
|
|
2687
2723
|
type: "button",
|
|
@@ -2689,10 +2725,10 @@ function CameraPage(p) {
|
|
|
2689
2725
|
"aria-label": t("nvr.player.fwd15"),
|
|
2690
2726
|
disabled: ps.live,
|
|
2691
2727
|
onClick: () => ctl.current?.skip(15e3),
|
|
2692
|
-
children: /* @__PURE__ */
|
|
2728
|
+
children: /* @__PURE__ */ jsx11(FastForward, { size: 18 })
|
|
2693
2729
|
}
|
|
2694
2730
|
),
|
|
2695
|
-
/* @__PURE__ */
|
|
2731
|
+
/* @__PURE__ */ jsxs9(
|
|
2696
2732
|
"button",
|
|
2697
2733
|
{
|
|
2698
2734
|
type: "button",
|
|
@@ -2708,24 +2744,24 @@ function CameraPage(p) {
|
|
|
2708
2744
|
)
|
|
2709
2745
|
] })
|
|
2710
2746
|
] }) }),
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2747
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-stage-bar", children: [
|
|
2748
|
+
/* @__PURE__ */ jsx11("span", { className: "nvr-statusdot" + (ps.live ? " nvr-statusdot--live" : ""), "aria-hidden": "true" }),
|
|
2749
|
+
/* @__PURE__ */ jsxs9("span", { className: "nvr-stage-title", children: [
|
|
2750
|
+
/* @__PURE__ */ jsx11("b", { children: name }),
|
|
2751
|
+
/* @__PURE__ */ jsx11("small", { children: statusText })
|
|
2716
2752
|
] }),
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsxs9("span", { className: "nvr-stage-actions", children: [
|
|
2754
|
+
/* @__PURE__ */ jsx11(
|
|
2719
2755
|
"button",
|
|
2720
2756
|
{
|
|
2721
2757
|
type: "button",
|
|
2722
2758
|
className: "nvr-iconbtn",
|
|
2723
2759
|
"aria-label": t("nvr.player.snapshot"),
|
|
2724
2760
|
onClick: () => ctl.current?.snapshot(),
|
|
2725
|
-
children: /* @__PURE__ */
|
|
2761
|
+
children: /* @__PURE__ */ jsx11(Camera3, { size: 16 })
|
|
2726
2762
|
}
|
|
2727
2763
|
),
|
|
2728
|
-
canExport && /* @__PURE__ */
|
|
2764
|
+
canExport && /* @__PURE__ */ jsx11(
|
|
2729
2765
|
"button",
|
|
2730
2766
|
{
|
|
2731
2767
|
type: "button",
|
|
@@ -2734,25 +2770,25 @@ function CameraPage(p) {
|
|
|
2734
2770
|
title: t("nvr.clip.download"),
|
|
2735
2771
|
"aria-pressed": !!clip,
|
|
2736
2772
|
onClick: toggleClip,
|
|
2737
|
-
children: /* @__PURE__ */
|
|
2773
|
+
children: /* @__PURE__ */ jsx11(Download2, { size: 16 })
|
|
2738
2774
|
}
|
|
2739
2775
|
),
|
|
2740
|
-
/* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: "nvr-iconbtn", "aria-label": t("nvr.player.pip"), onClick: onPip, children: /* @__PURE__ */ jsx11(PictureInPicture2, { size: 16 }) }),
|
|
2777
|
+
/* @__PURE__ */ jsx11(
|
|
2742
2778
|
"button",
|
|
2743
2779
|
{
|
|
2744
2780
|
type: "button",
|
|
2745
2781
|
className: "nvr-iconbtn",
|
|
2746
2782
|
"aria-label": t("nvr.player.fullscreen"),
|
|
2747
2783
|
onClick: () => ctl.current?.fullscreen(),
|
|
2748
|
-
children: /* @__PURE__ */
|
|
2784
|
+
children: /* @__PURE__ */ jsx11(Maximize2, { size: 16 })
|
|
2749
2785
|
}
|
|
2750
2786
|
)
|
|
2751
2787
|
] })
|
|
2752
2788
|
] }),
|
|
2753
|
-
pipNote && /* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
2755
|
-
pipNote === "homescreen" && externalUrl && /* @__PURE__ */
|
|
2789
|
+
pipNote && /* @__PURE__ */ jsxs9("div", { className: "nvr-pipnote", role: "status", children: [
|
|
2790
|
+
/* @__PURE__ */ jsx11("span", { children: t(pipNote === "homescreen" ? "nvr.player.pipHomeScreen" : "nvr.player.pipUnsupported") }),
|
|
2791
|
+
pipNote === "homescreen" && externalUrl && /* @__PURE__ */ jsx11(
|
|
2756
2792
|
"a",
|
|
2757
2793
|
{
|
|
2758
2794
|
className: "nvr-pipnote__open",
|
|
@@ -2763,21 +2799,21 @@ function CameraPage(p) {
|
|
|
2763
2799
|
children: t("nvr.player.openInSafari")
|
|
2764
2800
|
}
|
|
2765
2801
|
),
|
|
2766
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ jsx11(
|
|
2767
2803
|
"button",
|
|
2768
2804
|
{
|
|
2769
2805
|
type: "button",
|
|
2770
2806
|
className: "nvr-iconbtn nvr-pipnote__close",
|
|
2771
2807
|
"aria-label": t("nvr.player.dismiss"),
|
|
2772
2808
|
onClick: () => setPipNote(null),
|
|
2773
|
-
children: /* @__PURE__ */
|
|
2809
|
+
children: /* @__PURE__ */ jsx11(X2, { size: 14 })
|
|
2774
2810
|
}
|
|
2775
2811
|
)
|
|
2776
2812
|
] })
|
|
2777
2813
|
] }) }),
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2814
|
+
/* @__PURE__ */ jsxs9("aside", { className: "nvr-card nvr-cam__right" + (clip ? " nvr-cam__right--clip" : ""), children: [
|
|
2815
|
+
/* @__PURE__ */ jsxs9("div", { className: "nvr-tabs", role: "tablist", "data-active": immersive ? tab : void 0, children: [
|
|
2816
|
+
/* @__PURE__ */ jsx11(
|
|
2781
2817
|
"button",
|
|
2782
2818
|
{
|
|
2783
2819
|
type: "button",
|
|
@@ -2788,7 +2824,7 @@ function CameraPage(p) {
|
|
|
2788
2824
|
children: t("nvr.tab.timeline")
|
|
2789
2825
|
}
|
|
2790
2826
|
),
|
|
2791
|
-
/* @__PURE__ */
|
|
2827
|
+
/* @__PURE__ */ jsxs9(
|
|
2792
2828
|
"button",
|
|
2793
2829
|
{
|
|
2794
2830
|
type: "button",
|
|
@@ -2803,7 +2839,7 @@ function CameraPage(p) {
|
|
|
2803
2839
|
}
|
|
2804
2840
|
)
|
|
2805
2841
|
] }),
|
|
2806
|
-
/* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ jsx11("div", { className: "nvr-filters", children: SENTINEL_EVENT_CLASSES.filter((k) => present[k]).map((k) => /* @__PURE__ */ jsxs9(
|
|
2807
2843
|
"button",
|
|
2808
2844
|
{
|
|
2809
2845
|
type: "button",
|
|
@@ -2812,13 +2848,13 @@ function CameraPage(p) {
|
|
|
2812
2848
|
title: classLabel(t, k),
|
|
2813
2849
|
"aria-pressed": !filterOff[k],
|
|
2814
2850
|
children: [
|
|
2815
|
-
/* @__PURE__ */
|
|
2851
|
+
/* @__PURE__ */ jsx11(ClassBadge, { cls: k, size: 18 }),
|
|
2816
2852
|
present[k]
|
|
2817
2853
|
]
|
|
2818
2854
|
},
|
|
2819
2855
|
k
|
|
2820
2856
|
)) }),
|
|
2821
|
-
tab === "tl" ? /* @__PURE__ */
|
|
2857
|
+
tab === "tl" ? /* @__PURE__ */ jsx11(
|
|
2822
2858
|
VerticalTimeline,
|
|
2823
2859
|
{
|
|
2824
2860
|
camId,
|
|
@@ -2841,7 +2877,7 @@ function CameraPage(p) {
|
|
|
2841
2877
|
hold: !!clip && !!clipEdge,
|
|
2842
2878
|
onUserCenter
|
|
2843
2879
|
}
|
|
2844
|
-
) : /* @__PURE__ */
|
|
2880
|
+
) : /* @__PURE__ */ jsx11(
|
|
2845
2881
|
EventList,
|
|
2846
2882
|
{
|
|
2847
2883
|
camId,
|
|
@@ -2851,7 +2887,7 @@ function CameraPage(p) {
|
|
|
2851
2887
|
onClip: canExport ? clipEvent : void 0
|
|
2852
2888
|
}
|
|
2853
2889
|
),
|
|
2854
|
-
clip && /* @__PURE__ */
|
|
2890
|
+
clip && /* @__PURE__ */ jsx11(
|
|
2855
2891
|
ClipBar,
|
|
2856
2892
|
{
|
|
2857
2893
|
camId,
|
|
@@ -2865,18 +2901,18 @@ function CameraPage(p) {
|
|
|
2865
2901
|
},
|
|
2866
2902
|
camId
|
|
2867
2903
|
),
|
|
2868
|
-
!clip && /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
2904
|
+
!clip && /* @__PURE__ */ jsxs9("div", { className: "nvr-datechip" + (ps.live ? "" : " nvr-datechip--rec"), children: [
|
|
2905
|
+
/* @__PURE__ */ jsx11(
|
|
2870
2906
|
"button",
|
|
2871
2907
|
{
|
|
2872
2908
|
type: "button",
|
|
2873
2909
|
onClick: () => goToDay(sentinelAddDays(centerDay, -1)).catch(() => setLoadError(true)),
|
|
2874
2910
|
disabled: nav.prevDisabled,
|
|
2875
2911
|
"aria-label": t("nvr.date.prevDay"),
|
|
2876
|
-
children: /* @__PURE__ */
|
|
2912
|
+
children: /* @__PURE__ */ jsx11(ChevronLeft3, { size: 14 })
|
|
2877
2913
|
}
|
|
2878
2914
|
),
|
|
2879
|
-
/* @__PURE__ */
|
|
2915
|
+
/* @__PURE__ */ jsxs9(
|
|
2880
2916
|
"button",
|
|
2881
2917
|
{
|
|
2882
2918
|
type: "button",
|
|
@@ -2884,19 +2920,19 @@ function CameraPage(p) {
|
|
|
2884
2920
|
onClick: () => setDt(true),
|
|
2885
2921
|
"aria-label": t("nvr.date.title"),
|
|
2886
2922
|
children: [
|
|
2887
|
-
/* @__PURE__ */
|
|
2923
|
+
/* @__PURE__ */ jsx11(Calendar, { size: 13 }),
|
|
2888
2924
|
fmtDay(centerDay, locale)
|
|
2889
2925
|
]
|
|
2890
2926
|
}
|
|
2891
2927
|
),
|
|
2892
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ jsx11(
|
|
2893
2929
|
"button",
|
|
2894
2930
|
{
|
|
2895
2931
|
type: "button",
|
|
2896
2932
|
onClick: () => goToDay(sentinelAddDays(centerDay, 1)).catch(() => setLoadError(true)),
|
|
2897
2933
|
disabled: nav.nextDisabled,
|
|
2898
2934
|
"aria-label": t("nvr.date.nextDay"),
|
|
2899
|
-
children: /* @__PURE__ */
|
|
2935
|
+
children: /* @__PURE__ */ jsx11(ChevronRight3, { size: 14 })
|
|
2900
2936
|
}
|
|
2901
2937
|
)
|
|
2902
2938
|
] })
|
|
@@ -2917,9 +2953,11 @@ function CameraPage(p) {
|
|
|
2917
2953
|
}
|
|
2918
2954
|
|
|
2919
2955
|
// src/ui/components/Appearance.tsx
|
|
2920
|
-
import { useState as
|
|
2921
|
-
import { ChevronDown, Languages, Palette, Sun } from "lucide-react";
|
|
2922
|
-
import { jsx as
|
|
2956
|
+
import { useState as useState7 } from "react";
|
|
2957
|
+
import { Blend, ChevronDown, Contrast, Languages, Layers, Palette, Sun } from "lucide-react";
|
|
2958
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2959
|
+
var STYLES = ["classic", "glas"];
|
|
2960
|
+
var STRENGTHS = ["clear", "tinted", "opaque"];
|
|
2923
2961
|
function hexHue(hex) {
|
|
2924
2962
|
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
2963
|
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
@@ -2939,7 +2977,7 @@ function ThemeSwatch({
|
|
|
2939
2977
|
ariaLabel
|
|
2940
2978
|
}) {
|
|
2941
2979
|
const c = THEMES[name][previewMode];
|
|
2942
|
-
return /* @__PURE__ */
|
|
2980
|
+
return /* @__PURE__ */ jsxs10(
|
|
2943
2981
|
"button",
|
|
2944
2982
|
{
|
|
2945
2983
|
type: "button",
|
|
@@ -2948,8 +2986,8 @@ function ThemeSwatch({
|
|
|
2948
2986
|
"aria-label": ariaLabel,
|
|
2949
2987
|
"aria-pressed": active,
|
|
2950
2988
|
children: [
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-swatch__preview", style: { background: c.bg }, "aria-hidden": "true", children: [
|
|
2990
|
+
/* @__PURE__ */ jsx12(
|
|
2953
2991
|
"div",
|
|
2954
2992
|
{
|
|
2955
2993
|
style: {
|
|
@@ -2964,7 +3002,7 @@ function ThemeSwatch({
|
|
|
2964
3002
|
}
|
|
2965
3003
|
}
|
|
2966
3004
|
),
|
|
2967
|
-
/* @__PURE__ */
|
|
3005
|
+
/* @__PURE__ */ jsx12(
|
|
2968
3006
|
"div",
|
|
2969
3007
|
{
|
|
2970
3008
|
style: {
|
|
@@ -2978,7 +3016,7 @@ function ThemeSwatch({
|
|
|
2978
3016
|
}
|
|
2979
3017
|
}
|
|
2980
3018
|
),
|
|
2981
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx12(
|
|
2982
3020
|
"div",
|
|
2983
3021
|
{
|
|
2984
3022
|
style: {
|
|
@@ -2993,7 +3031,7 @@ function ThemeSwatch({
|
|
|
2993
3031
|
}
|
|
2994
3032
|
}
|
|
2995
3033
|
),
|
|
2996
|
-
/* @__PURE__ */
|
|
3034
|
+
/* @__PURE__ */ jsx12(
|
|
2997
3035
|
"div",
|
|
2998
3036
|
{
|
|
2999
3037
|
style: {
|
|
@@ -3009,7 +3047,7 @@ function ThemeSwatch({
|
|
|
3009
3047
|
}
|
|
3010
3048
|
)
|
|
3011
3049
|
] }),
|
|
3012
|
-
/* @__PURE__ */
|
|
3050
|
+
/* @__PURE__ */ jsx12("span", { className: "nvr-swatch__name", children: THEME_LABELS[name] })
|
|
3013
3051
|
]
|
|
3014
3052
|
}
|
|
3015
3053
|
);
|
|
@@ -3018,19 +3056,71 @@ function AppearanceSection(p) {
|
|
|
3018
3056
|
const { t } = useSentinelUi();
|
|
3019
3057
|
const resolved = resolveMode(p.mode);
|
|
3020
3058
|
const defaultHue = (name) => hexHue(THEMES[name][resolved].accent);
|
|
3021
|
-
const [localHue, setLocalHue] =
|
|
3059
|
+
const [localHue, setLocalHue] = useState7(p.accentHue ?? defaultHue(p.theme));
|
|
3022
3060
|
const previewColor = p.accentHue !== void 0 ? `hsl(${p.accentHue}, 78%, ${resolved === "dark" ? 60 : 50}%)` : THEMES[p.theme][resolved].accent;
|
|
3023
3061
|
const modes = ["light", "dark", "auto"];
|
|
3024
|
-
const chip = (bg, fg, icon) => /* @__PURE__ */
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3062
|
+
const chip = (bg, fg, icon) => /* @__PURE__ */ jsx12("span", { className: "nvr-set__chip", style: { background: bg, color: fg }, children: icon });
|
|
3063
|
+
const seg = (label, values, value, key, on) => /* @__PURE__ */ jsx12("div", { className: "nvr-seg", role: "group", "aria-label": label, children: values.map((v) => /* @__PURE__ */ jsx12(
|
|
3064
|
+
"button",
|
|
3065
|
+
{
|
|
3066
|
+
type: "button",
|
|
3067
|
+
className: "nvr-seg__btn" + (value === v ? " nvr-seg__btn--active" : ""),
|
|
3068
|
+
onClick: () => on(v),
|
|
3069
|
+
"aria-pressed": value === v,
|
|
3070
|
+
children: t(`${key}.${v}`)
|
|
3071
|
+
},
|
|
3072
|
+
v
|
|
3073
|
+
)) });
|
|
3074
|
+
const glas = !!p.onUiStyle && p.uiStyle === "glas";
|
|
3075
|
+
return /* @__PURE__ */ jsxs10("section", { className: "nvr-set__section", children: [
|
|
3076
|
+
/* @__PURE__ */ jsx12("div", { className: "nvr-section__label", children: t("nvr.settings.appearance") }),
|
|
3077
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-card nvr-set-card", children: [
|
|
3078
|
+
p.onUiStyle && /* @__PURE__ */ jsxs10("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3079
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3080
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx12(Layers, { size: 14, strokeWidth: 1.75 })),
|
|
3081
|
+
t("nvr.settings.style")
|
|
3082
|
+
] }),
|
|
3083
|
+
seg(t("nvr.settings.style.groupAria"), STYLES, p.uiStyle ?? "classic", "nvr.settings.style", p.onUiStyle),
|
|
3084
|
+
/* @__PURE__ */ jsx12("p", { className: "nvr-set__hint", children: t("nvr.settings.style.hint") })
|
|
3085
|
+
] }),
|
|
3086
|
+
glas && p.onGlassStrength && /* @__PURE__ */ jsxs10("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3087
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3088
|
+
chip("var(--info-soft)", "var(--info)", /* @__PURE__ */ jsx12(Blend, { size: 14, strokeWidth: 1.75 })),
|
|
3089
|
+
t("nvr.settings.glassStrength")
|
|
3090
|
+
] }),
|
|
3091
|
+
seg(
|
|
3092
|
+
t("nvr.settings.glassStrength.groupAria"),
|
|
3093
|
+
STRENGTHS,
|
|
3094
|
+
p.glassStrength ?? "clear",
|
|
3095
|
+
"nvr.settings.glassStrength",
|
|
3096
|
+
p.onGlassStrength
|
|
3097
|
+
)
|
|
3098
|
+
] }),
|
|
3099
|
+
glas && p.onReduceTransparency && /* @__PURE__ */ jsxs10("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3100
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3101
|
+
chip("var(--info-soft)", "var(--info)", /* @__PURE__ */ jsx12(Contrast, { size: 14, strokeWidth: 1.75 })),
|
|
3102
|
+
t("nvr.settings.reduceTransparency")
|
|
3103
|
+
] }),
|
|
3104
|
+
/* @__PURE__ */ jsx12(
|
|
3105
|
+
"button",
|
|
3106
|
+
{
|
|
3107
|
+
type: "button",
|
|
3108
|
+
role: "switch",
|
|
3109
|
+
"aria-checked": !!p.reduceTransparency,
|
|
3110
|
+
"aria-label": t("nvr.settings.reduceTransparency"),
|
|
3111
|
+
className: "nvr-switch" + (p.reduceTransparency ? " nvr-switch--on" : ""),
|
|
3112
|
+
onClick: () => p.onReduceTransparency?.(!p.reduceTransparency),
|
|
3113
|
+
children: /* @__PURE__ */ jsx12("span", { className: "nvr-switch__thumb" })
|
|
3114
|
+
}
|
|
3115
|
+
),
|
|
3116
|
+
/* @__PURE__ */ jsx12("p", { className: "nvr-set__hint", children: t("nvr.settings.reduceTransparency.hint") })
|
|
3117
|
+
] }),
|
|
3118
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3119
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3120
|
+
chip("var(--warning-soft)", "var(--warning)", /* @__PURE__ */ jsx12(Sun, { size: 14, strokeWidth: 1.75 })),
|
|
3031
3121
|
t("nvr.settings.mode")
|
|
3032
3122
|
] }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3123
|
+
/* @__PURE__ */ jsx12("div", { className: "nvr-seg", role: "group", "aria-label": t("nvr.settings.mode"), children: modes.map((m) => /* @__PURE__ */ jsx12(
|
|
3034
3124
|
"button",
|
|
3035
3125
|
{
|
|
3036
3126
|
type: "button",
|
|
@@ -3042,13 +3132,13 @@ function AppearanceSection(p) {
|
|
|
3042
3132
|
m
|
|
3043
3133
|
)) })
|
|
3044
3134
|
] }),
|
|
3045
|
-
/* @__PURE__ */
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */
|
|
3135
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3136
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3137
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx12(Languages, { size: 14, strokeWidth: 1.75 })),
|
|
3048
3138
|
t("nvr.settings.language")
|
|
3049
3139
|
] }),
|
|
3050
|
-
/* @__PURE__ */
|
|
3051
|
-
/* @__PURE__ */
|
|
3140
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-select", children: [
|
|
3141
|
+
/* @__PURE__ */ jsxs10(
|
|
3052
3142
|
"select",
|
|
3053
3143
|
{
|
|
3054
3144
|
className: "nvr-select__native",
|
|
@@ -3056,20 +3146,26 @@ function AppearanceSection(p) {
|
|
|
3056
3146
|
onChange: (e) => p.onLanguage(e.target.value),
|
|
3057
3147
|
"aria-label": t("nvr.settings.language"),
|
|
3058
3148
|
children: [
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
p.languages.map((l) => /* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ jsx12("option", { value: "auto", children: t("nvr.settings.language.auto") }),
|
|
3150
|
+
p.languages.map((l) => /* @__PURE__ */ jsx12("option", { value: l.id, children: l.label }, l.id))
|
|
3061
3151
|
]
|
|
3062
3152
|
}
|
|
3063
3153
|
),
|
|
3064
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ jsx12(ChevronDown, { size: 14, strokeWidth: 2, className: "nvr-select__chevron", "aria-hidden": "true" })
|
|
3065
3155
|
] })
|
|
3066
3156
|
] }),
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3069
|
-
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */
|
|
3157
|
+
glas ? /* @__PURE__ */ jsxs10("div", { className: "nvr-set__row nvr-set__row--inline", children: [
|
|
3158
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3159
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx12(Palette, { size: 14, strokeWidth: 1.75 })),
|
|
3160
|
+
t("nvr.settings.theme")
|
|
3161
|
+
] }),
|
|
3162
|
+
/* @__PURE__ */ jsx12("p", { className: "nvr-set__hint", children: t("nvr.settings.theme.glasHint") })
|
|
3163
|
+
] }) : /* @__PURE__ */ jsxs10("div", { className: "nvr-set__row", children: [
|
|
3164
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-set__label", children: [
|
|
3165
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx12(Palette, { size: 14, strokeWidth: 1.75 })),
|
|
3070
3166
|
t("nvr.settings.theme")
|
|
3071
3167
|
] }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3168
|
+
/* @__PURE__ */ jsx12("div", { className: "nvr-swatches", children: THEME_NAMES.map((n) => /* @__PURE__ */ jsx12(
|
|
3073
3169
|
ThemeSwatch,
|
|
3074
3170
|
{
|
|
3075
3171
|
name: n,
|
|
@@ -3084,14 +3180,14 @@ function AppearanceSection(p) {
|
|
|
3084
3180
|
n
|
|
3085
3181
|
)) })
|
|
3086
3182
|
] }),
|
|
3087
|
-
/* @__PURE__ */
|
|
3088
|
-
/* @__PURE__ */
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ jsx12("div", { className: "nvr-set__row", children: /* @__PURE__ */ jsxs10("div", { className: "nvr-accent", children: [
|
|
3184
|
+
/* @__PURE__ */ jsxs10("div", { className: "nvr-accent__label", children: [
|
|
3185
|
+
/* @__PURE__ */ jsxs10("span", { className: "nvr-set__label", children: [
|
|
3186
|
+
chip("var(--accent-soft)", "var(--accent)", /* @__PURE__ */ jsx12(Palette, { size: 14, strokeWidth: 1.75 })),
|
|
3091
3187
|
t("nvr.settings.accent"),
|
|
3092
|
-
/* @__PURE__ */
|
|
3188
|
+
/* @__PURE__ */ jsx12("span", { className: "nvr-accent__dot", style: { background: previewColor }, "aria-hidden": "true" })
|
|
3093
3189
|
] }),
|
|
3094
|
-
p.accentHue !== void 0 && /* @__PURE__ */
|
|
3190
|
+
p.accentHue !== void 0 && /* @__PURE__ */ jsx12(
|
|
3095
3191
|
"button",
|
|
3096
3192
|
{
|
|
3097
3193
|
type: "button",
|
|
@@ -3104,7 +3200,7 @@ function AppearanceSection(p) {
|
|
|
3104
3200
|
}
|
|
3105
3201
|
)
|
|
3106
3202
|
] }),
|
|
3107
|
-
/* @__PURE__ */
|
|
3203
|
+
/* @__PURE__ */ jsx12(
|
|
3108
3204
|
"input",
|
|
3109
3205
|
{
|
|
3110
3206
|
type: "range",
|
|
@@ -3136,6 +3232,10 @@ export {
|
|
|
3136
3232
|
EventBadges,
|
|
3137
3233
|
EventList,
|
|
3138
3234
|
EventsStrip,
|
|
3235
|
+
GlassCameras,
|
|
3236
|
+
GlassEvents,
|
|
3237
|
+
GlassNvr,
|
|
3238
|
+
GlassSections,
|
|
3139
3239
|
Hero,
|
|
3140
3240
|
HistogramCard,
|
|
3141
3241
|
SentinelUiProvider,
|
|
@@ -3176,5 +3276,4 @@ export {
|
|
|
3176
3276
|
useSentinelUi,
|
|
3177
3277
|
watchSystemMode
|
|
3178
3278
|
};
|
|
3179
|
-
/*! Theme tokens derived from HAPulse (https://github.com/jlnbln/HAPulse) — MIT License, Copyright (c) 2026 Julian */
|
|
3180
3279
|
//# sourceMappingURL=index.js.map
|