@3deye-toolkit/react-event-search 0.0.1-alpha.29 → 0.0.1

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.
@@ -4,24 +4,23 @@
4
4
  border: none;
5
5
  position: relative;
6
6
  padding: 0 8px;
7
- height: 32px;
8
- text-transform: uppercase;
7
+ height: 32px;
9
8
  -webkit-user-select: none;
10
9
  -moz-user-select: none;
11
10
  -ms-user-select: none;
12
11
  user-select: none;
13
- display: inline-flex;
12
+ display: inline-flex;
14
13
  justify-content: center;
15
14
  align-items: center;
16
- border-radius: 4px;
17
- letter-spacing: .0107142857em;
18
- font-weight: 500;
15
+ border-radius: 4px;
16
+ letter-spacing: 0.0107142857em;
17
+ font-weight: 500;
19
18
  }
20
19
 
21
20
  .x-3deye-button sup {
22
- position: relative;
23
- top: -0.5em;
24
- left: 0.25em;
21
+ position: relative;
22
+ top: -0.5em;
23
+ left: 0.25em;
25
24
  }
26
25
 
27
26
  .x-3deye-button.x-3deye-button--fullwidth {
@@ -35,7 +34,7 @@
35
34
 
36
35
  .x-3deye-button--icon {
37
36
  border-radius: 16px;
38
- padding: 4px;
37
+ padding: 4px;
39
38
  width: 32px;
40
39
  height: 32px;
41
40
  display: inline-flex;
@@ -53,22 +52,22 @@
53
52
 
54
53
  .x-3deye-button.x-3deye-button--filled,
55
54
  .x-3deye-button.x-3deye-button--text {
56
- min-width: 80px;
57
- text-transform: capitalize;
58
- font-family: 'Roboto', sans-serif;
59
- font-size: 0.875rem;
60
- font-weight: 500;
61
- border-radius: 0.25rem;
62
- padding: 0 1rem;
55
+ min-width: 80px;
56
+ text-transform: capitalize;
57
+ font-family: 'Roboto', sans-serif;
58
+ font-size: 0.875rem;
59
+ font-weight: 500;
60
+ border-radius: 0.25rem;
61
+ padding: 0 1rem;
63
62
  }
64
63
 
65
64
  .x-3deye-button.x-3deye-button--filled {
66
- background-color: #27b9a1;
67
- color: white;
65
+ background-color: rgb(39, 185, 161);
66
+ color: white;
68
67
  }
69
68
 
70
69
  .x-3deye-button.x-3deye-button--filled:not(:disabled):hover {
71
- background-color: #61beaf;
70
+ background-color: rgb(34, 163, 142);
72
71
  }
73
72
 
74
73
  .x-3deye-button.x-3deye-button--filled:focus {
@@ -87,26 +86,25 @@
87
86
  color: white;
88
87
  }
89
88
 
90
- .x-3deye-button.x-3deye-button--overlay:focus, .x-3deye-button.x-3deye-button--overlay:not(:disabled):hover {
91
- background: rgba(0, 0, 0, 0.5);
89
+ .x-3deye-button.x-3deye-button--overlay:focus,
90
+ .x-3deye-button.x-3deye-button--overlay:not(:disabled):hover {
91
+ background: rgba(0, 0, 0, 0.5);
92
92
  border: 2px solid rgba(255, 255, 255, 0.5);
93
93
  }
94
94
 
95
- :root {
96
- --reach-tooltip: 1;
95
+ .x-3deye-button.x-3deye-button--overlay.x-3deye-button--overlay-danger:not(:disabled),
96
+ .x-3deye-button.x-3deye-button--overlay.x-3deye-button--overlay-danger:not(:disabled):hover {
97
+ background-color: rgba(156, 51, 49, 0.5);
97
98
  }
98
99
 
99
- [data-reach-tooltip] {
100
- z-index: 1;
101
- pointer-events: none;
102
- position: absolute;
103
- padding: 0.25em 0.5em;
104
- box-shadow: 2px 2px 10px hsla(0, 0%, 0%, 0.1);
105
- white-space: nowrap;
106
- font-size: 85%;
107
- background: #f0f0f0;
108
- color: #444;
109
- border: solid 1px #ccc;
100
+ .x-3deye-tooltip {
101
+ background: rgb(0 0 0 / 0.9);
102
+ color: white;
103
+ border: none;
104
+ border-radius: 4px;
105
+ padding: 0.5em 1em;
106
+ font-size: 12px;
107
+ border: rgb(255 255 255 / 0.15) 1px solid;
110
108
  }
111
109
 
112
110
  .color-selector {
@@ -281,14 +279,6 @@
281
279
  border-top: 5px solid var(--primary-color, #0067ac);
282
280
  }
283
281
 
284
- .preloader-container {
285
- color: var(--on-container);
286
- flex: 1;
287
- display: flex;
288
- justify-content: center;
289
- align-items: center;
290
- }
291
-
292
282
  .event-list-item {
293
283
  -webkit-user-select: none;
294
284
  -moz-user-select: none;
@@ -306,10 +296,6 @@
306
296
  --license-plate-color: rgb(0, 229, 255);
307
297
  }
308
298
 
309
- .event-list-item.mdc-ripple-surface {
310
- position: absolute;
311
- }
312
-
313
299
  .event-list-item .x-3deye-button--icon:hover,
314
300
  .event-list-item .x-3deye-button--icon:focus {
315
301
  background-color: rgba(0, 0, 0, 0.2);
@@ -345,7 +331,11 @@
345
331
  }
346
332
 
347
333
  .event-list-item-caption {
348
- background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
334
+ background: linear-gradient(
335
+ to bottom,
336
+ rgba(0, 0, 0, 0) 0%,
337
+ rgba(0, 0, 0, 0.65) 100%
338
+ );
349
339
  padding-left: 8px;
350
340
  padding-bottom: 8px;
351
341
  padding-top: 8px;
@@ -395,15 +385,15 @@
395
385
  }
396
386
 
397
387
  .event-list-item__temperature {
398
- font-size: 14px;
399
- font-weight: bold;
400
- padding: 0 4px;
401
- position: absolute;
402
- right: 2px;
403
- bottom: 4px;
404
- display: flex;
405
- align-items: center;
406
- text-shadow: 0 1px 2px black;
388
+ font-size: 14px;
389
+ font-weight: bold;
390
+ padding: 0 4px;
391
+ position: absolute;
392
+ right: 2px;
393
+ bottom: 4px;
394
+ display: flex;
395
+ align-items: center;
396
+ text-shadow: 0 1px 2px black;
407
397
  }
408
398
 
409
399
  .event-list-item .frame {
@@ -420,7 +410,7 @@
420
410
  position: absolute;
421
411
  pointer-events: none;
422
412
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.75);
423
- transition: opacity 0s linear 0.2s;
413
+ transition: opacity 0s linear 0.2s;
424
414
  }
425
415
 
426
416
  .event-list-item .trigger:hover ~ .preview {
@@ -485,17 +475,17 @@
485
475
  font-size: 13px;
486
476
  font-family: 'Roboto Mono', monospace;
487
477
  white-space: nowrap;
488
- color: white;
489
- font-weight: bold;
490
- min-width: 64px;
478
+ color: white;
479
+ font-weight: bold;
480
+ min-width: 64px;
491
481
  }
492
482
 
493
483
  .event-list-item__detected-object-label__caption {
494
484
  padding-left: 4px;
495
485
  font-size: 9px;
496
- line-height: 14px;
497
- opacity: 0.75;
498
- color: black;
486
+ line-height: 14px;
487
+ opacity: 0.75;
488
+ color: black;
499
489
  }
500
490
 
501
491
  .event-list-item__license-plate-label {
@@ -506,7 +496,7 @@
506
496
  font-size: 14px;
507
497
  font-family: 'Roboto Mono', monospace;
508
498
  white-space: nowrap;
509
- color: white;
499
+ color: white;
510
500
  }
511
501
 
512
502
  .event-list-item__license-plate-label .digit {
@@ -521,7 +511,7 @@
521
511
  padding-left: 4px;
522
512
  background-color: var(--license-plate-color);
523
513
  color: black;
524
- opacity: 0.75;
514
+ opacity: 0.75;
525
515
  font-size: 10px;
526
516
  }
527
517
 
@@ -536,7 +526,6 @@
536
526
  height: 16px;
537
527
  }
538
528
 
539
-
540
529
  .event-list-item__license-plate .frame {
541
530
  --frame-color-hsl: 186 100% 50%;
542
531
  }
@@ -552,6 +541,14 @@
552
541
  right: 0;
553
542
  }
554
543
 
544
+ .preloader-container {
545
+ color: var(--on-container);
546
+ flex: 1;
547
+ display: flex;
548
+ justify-content: center;
549
+ align-items: center;
550
+ }
551
+
555
552
  .frame .corner-highlight-tl {
556
553
  position: absolute;
557
554
  top: -1px;
@@ -1384,6 +1381,41 @@
1384
1381
  font-size: 1.44rem;
1385
1382
  }
1386
1383
 
1384
+ .x-3deye-popover-container.popover-datetimepicker,
1385
+ .x-3deye-popover-container.popover-datepicker {
1386
+ background: white;
1387
+ color: black;
1388
+ }
1389
+
1390
+ .x-3deye-popover-container.popover-datetimepicker .tip,
1391
+ .x-3deye-popover-container.popover-datepicker .tip {
1392
+ --tip-background: white;
1393
+ --tip-border: transparent;
1394
+ }
1395
+
1396
+ .popover-datetimepicker {
1397
+ --surface-inverse: #e1e1e1;
1398
+ }
1399
+
1400
+ .popover-datepicker .react-datepicker {
1401
+ width: 242px;
1402
+ }
1403
+
1404
+ .popover-datetimepicker .react-datepicker {
1405
+ width: 328px;
1406
+ }
1407
+
1408
+ .popover-datetimepicker .react-datepicker__time-list {
1409
+ padding: 0 !important;
1410
+ }
1411
+
1412
+ .popover-datepicker.x-3deye-popover-body,
1413
+ .popover-datetimepicker.x-3deye-popover-body {
1414
+ display: flex;
1415
+ flex-direction: column;
1416
+ gap: 10px;
1417
+ }
1418
+
1387
1419
  .x-3deye-button-group {
1388
1420
  display: flex;
1389
1421
  padding: 4px;
@@ -1394,6 +1426,7 @@
1394
1426
  flex: 1;
1395
1427
  height: 35px;
1396
1428
  font-size: 11px;
1429
+ text-transform: uppercase;
1397
1430
  }
1398
1431
 
1399
1432
  .x-3deye-button-group > .x-3deye-button.button-selected,
@@ -1418,15 +1451,29 @@
1418
1451
  color: var(--container);
1419
1452
  }
1420
1453
 
1421
- .x-3deye-popover {
1422
- position: relative;
1454
+ .x-3deye-popover-container {
1455
+ background: #222;
1456
+ box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgb(0 0 0 / 0.1),
1457
+ inset 0 0 0 1px rgb(255 255 255 /0.05);
1458
+ color: white;
1459
+ border-radius: 6px;
1460
+ padding: 8px;
1461
+ text-align: left;
1462
+ -webkit-animation: slide-in 0.15s ease-in;
1463
+ animation: slide-in 0.15s ease-in;
1423
1464
  }
1424
1465
 
1425
- .x-3deye-popover-body {
1426
- background-color: white;
1427
- padding: 8px;
1428
- border-radius: 8px;
1429
- box-shadow: 0 0 8px 0px black;
1466
+ @media(prefers-reduced-motion: reduce) {
1467
+ .x-3deye-popover-container {
1468
+ -webkit-animation: none;
1469
+ animation: none;
1470
+ }
1471
+ }
1472
+
1473
+
1474
+ .x-3deye-popover-container .tip {
1475
+ --tip-background: #222;
1476
+ --tip-border: rgb(255 255 255 /0.05);
1430
1477
  }
1431
1478
 
1432
1479
  .event-search-results {
@@ -15,7 +15,7 @@ declare class AccountStore extends ApiStore {
15
15
  constructor(notification?: NotificationService | undefined);
16
16
  get userDisplayName(): string | null;
17
17
  protected afterInit(): void;
18
- loadUser(): Observable<RawUser | null>;
18
+ loadUser$(): Observable<RawUser | null>;
19
19
  setUser: (user: User | null) => void;
20
20
  setAuthStore(auth: Auth): void;
21
21
  updateUserPassword(passwordData: {
@@ -384,7 +384,7 @@ declare class EventSearchStore extends ApiStore {
384
384
  filters: DetectedObjectOption[];
385
385
  colors: Set<string>;
386
386
  peopleCountingDataLoading: boolean;
387
- heatmapHidden: boolean;
387
+ heatmapMode: HeatmapMode;
388
388
  heatmapLoading: boolean;
389
389
  data: CameraEvent[];
390
390
  heatmap: Heatmap | null;
@@ -411,20 +411,11 @@ declare class EventSearchStore extends ApiStore {
411
411
  x: number;
412
412
  y: number;
413
413
  }[][]) => void;
414
- toggleHeatmap: () => void;
414
+ setHeatmapMode: (mode: HeatmapMode) => void;
415
415
  toggleColor: (color: string) => void;
416
416
  clearColors: () => void;
417
417
  clear: () => void;
418
418
  initDataFetching: () => void;
419
- /**
420
- * given region as array of vertices in normalized coordinates
421
- * returns its representation in WKT: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
422
- * @param region
423
- */
424
- regionToWktPolygon(region: {
425
- x: number;
426
- y: number;
427
- }[]): string;
428
419
  boxRegions(regions: {
429
420
  x: number;
430
421
  y: number;
@@ -440,9 +431,16 @@ declare class EventSearchStore extends ApiStore {
440
431
 
441
432
  declare class EventsLoader extends ApiStore {
442
433
  private eventsStore;
434
+ readonly mode: 'events' | 'objects';
443
435
  api: ExtendedApi;
444
- data: CameraEvent[];
445
- pendingData: CameraEvent[];
436
+ data: {
437
+ data: CameraEvent;
438
+ objectIdx: number;
439
+ }[];
440
+ pendingData: {
441
+ data: CameraEvent;
442
+ objectIdx: number;
443
+ }[];
446
444
  liveUpdateMode: 'manual' | 'auto' | 'disabled';
447
445
  updateTrigger: number;
448
446
  colors: Set<string>;
@@ -458,13 +456,16 @@ declare class EventsLoader extends ApiStore {
458
456
  to?: Date;
459
457
  cameras: number[];
460
458
  detectedObjects: string[];
461
- polygons: string[];
459
+ regions: {
460
+ x: number;
461
+ y: number;
462
+ }[][] | null;
462
463
  eventTypes: SensorEventType[];
463
464
  private loadingInited;
464
465
  get isLive(): boolean;
465
466
  get totalCount(): number;
466
467
  get filterJson(): string | null;
467
- constructor(eventsStore: EventsStore);
468
+ constructor(eventsStore: EventsStore, mode?: 'events' | 'objects');
468
469
  flushUpdates: () => void;
469
470
  setLiveUpdateMode: (mode: 'manual' | 'auto' | 'disabled') => void;
470
471
  load: () => void;
@@ -474,6 +475,14 @@ declare class EventsLoader extends ApiStore {
474
475
  private initDataLoading;
475
476
  private initLiveUpdates;
476
477
  private filter;
478
+ private toObjects;
479
+ private boxToAabb;
480
+ /**
481
+ * given region as array of vertices in normalized coordinates
482
+ * returns its representation in WKT: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
483
+ * @param region
484
+ */
485
+ private regionToWktPolygon;
477
486
  /**
478
487
  * Joins to arrays leaving only unique events
479
488
  * TODO: check if using map only on joint is more efficient
@@ -625,6 +634,8 @@ declare class Heatmap {
625
634
  constructor(raw: RawHeatmap, cameraId: number, duration: number);
626
635
  }
627
636
 
637
+ declare type HeatmapMode = 'fullframe' | 'selection' | 'none';
638
+
628
639
  declare class HeatmapsStore extends ApiStore {
629
640
  api: ExtendedApi;
630
641
  fetchHeatmaps(cameraId: number, from: Date, to: Date, count: number): Observable<Heatmap[]>;
@@ -654,6 +665,7 @@ declare interface IApi {
654
665
  GetCameras: (camera: {
655
666
  id?: number;
656
667
  } | null, since: Date | null) => Observable<ApiResult<RawCamera>>;
668
+ UpdateCamera: (camera: RawCamera) => Observable<ApiResult<RawCamera>>;
657
669
  GetSensorDataSchema: (eventType: EventType) => Observable<any>;
658
670
  GetSensorEvents: (params: SensorEventsParams, filter: string, box: Box) => Observable<ApiResult<RawSensorEvent>>;
659
671
  GetSensorEventsPage: (request: SensorEventsRequest, filter: string | null, searchPolygons: string[]) => Observable<ApiPageResult<RawSensorEvent>>;
@@ -999,7 +1011,7 @@ declare interface RawUser {
999
1011
  createdAt: Date;
1000
1012
  jsonField: string;
1001
1013
  imageUrl: null;
1002
- permissions: number;
1014
+ uiPermissions: string[];
1003
1015
  version: string;
1004
1016
  }
1005
1017
 
@@ -1151,6 +1163,7 @@ declare class Token {
1151
1163
 
1152
1164
  declare class ToolkitApp {
1153
1165
  readonly name: string;
1166
+ initialized: boolean;
1154
1167
  cameras: CamerasStore;
1155
1168
  archives: ArchivesStore;
1156
1169
  events: EventsStore;
@@ -1 +1 @@
1
- import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as a,subDays as i,subHours as o}from"date-fns/esm";import l from"i18next";import{from as s,Observable as c,Subscription as u,of as d,throwError as h,EMPTY as m}from"rxjs";import{computed as p,makeObservable as f,observable as b,action as g,runInAction as v,reaction as y}from"mobx";import{mergeMap as w,catchError as E,switchMap as x,mapTo as C,concatMap as j,distinctUntilChanged as O,share as P,map as _}from"rxjs/operators";import T from"earcut";import{subHours as L}from"date-fns";import{AppContext as M,app as I}from"@3deye-toolkit/core";import N,{useRef as D,useState as k,useEffect as S,useCallback as A,useContext as z,useLayoutEffect as F}from"react";import{observer as H,useLocalObservable as R,Observer as $}from"mobx-react-lite";import B,{components as U}from"react-select";import V from"clsx";import W from"react-ink";import q from"@reach/tooltip";import G from"@seznam/compose-react-refs";import Y from"react-virtualized-auto-sizer";import Z from"react-window-infinite-loader";import{VariableSizeGrid as J}from"react-window";import*as X from"@sentry/browser";import{useSpring as K,animated as Q}from"@react-spring/web";import ee from"react-dom";import te from"react-datepicker";import{extent as re,bin as ne,max as ae}from"d3-array";import{select as ie}from"d3-selection";import{scaleTime as oe,scaleLinear as le}from"d3-scale";import{timeHours as se,timeHour as ce,timeMinute as ue}from"d3-time";import{axisBottom as de}from"d3-axis";import{brushX as he}from"d3-brush";import{timeFormat as me}from"d3-time-format";import pe from"resize-observer-polyfill";var fe={eventSearchRequestError:{peopleCounting:"Sorry, an error occured during event search. Couldn't fetch people counting data. Please try again later",heatmap:"Sorry, an error occured during event search. Couldn't fetch heatmap. Please try again later"},selectObjectType:"Select object type",noEventsFound:"no events found",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",today:"today",yesterday:"yesterday",button:{ok:"Ok"},peopleCounting:"People Counting",selected:"selected",total:"total"};const be=new Map,ge={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},ve=l.createInstance();function ye(t,r){const n=be.get(ve.language);return e(t,r,{locale:n})}var we,Ee;function xe(e,t=!1){const r=p(e);return new c((e=>{const n=r.observe_((({newValue:t})=>e.next(t)),t);return()=>n()}))}!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(we||(we={})),function(e){e[e.Motion=0]="Motion",e[e.Tampering=1]="Tampering",e[e.PanTiltZoom=2]="PanTiltZoom",e[e.CrossLine=3]="CrossLine",e[e.Intrusion=4]="Intrusion",e[e.LicensePlate=5]="LicensePlate",e[e.FaceDetection=6]="FaceDetection",e[e.Audio=7]="Audio",e[e.Analytic=8]="Analytic",e[e.SpeedDetection=9]="SpeedDetection",e[e.PeopleCounter=10]="PeopleCounter",e[e.Temperature=11]="Temperature",e[e.PoS=12]="PoS",e[e.GPS=13]="GPS",e[e.DigitalInput=14]="DigitalInput",e[e.Normal=15]="Normal",e[e.Suspicious=16]="Suspicious",e[e.Loitering=17]="Loitering",e[e.Vandalism=18]="Vandalism",e[e.Trespass=19]="Trespass",e[e.Emergency=20]="Emergency",e[e.LifeInDanger=21]="LifeInDanger",e[e.ErroneousAlert=22]="ErroneousAlert",e[e.Misidentification=23]="Misidentification",e[e.Fire=24]="Fire",e[e.MedicalDuress=25]="MedicalDuress",e[e.HoldUp=26]="HoldUp",e[e.CheckIn=27]="CheckIn",e[e.CheckOut=28]="CheckOut",e[e.ClockIn=29]="ClockIn",e[e.ClockOut=30]="ClockOut",e[e.ParkingStart=31]="ParkingStart",e[e.ParkingEnd=32]="ParkingEnd",e[e.ParkingViolation=33]="ParkingViolation",e[e.GateAccess=34]="GateAccess",e[e.DoorAccess=35]="DoorAccess",e[e.TemperatureCheck=36]="TemperatureCheck",e[e.IDCheck=37]="IDCheck",e[e.PPECheck=38]="PPECheck",e[e.WelfareCheck=39]="WelfareCheck",e[e.Uncategorized=40]="Uncategorized",e[e.Unknown=999]="Unknown"}(Ee||(Ee={}));var Ce="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var je=function(){this.__data__=[],this.size=0};var Oe=function(e,t){return e===t||e!=e&&t!=t},Pe=Oe;var _e=function(e,t){for(var r=e.length;r--;)if(Pe(e[r][0],t))return r;return-1},Te=_e,Le=Array.prototype.splice;var Me=function(e){var t=this.__data__,r=Te(t,e);return!(r<0)&&(r==t.length-1?t.pop():Le.call(t,r,1),--this.size,!0)},Ie=_e;var Ne=function(e){var t=this.__data__,r=Ie(t,e);return r<0?void 0:t[r][1]},De=_e;var ke=_e;var Se=function(e,t){var r=this.__data__,n=ke(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Ae=je,ze=Me,Fe=Ne,He=function(e){return De(this.__data__,e)>-1},Re=Se;function $e(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$e.prototype.clear=Ae,$e.prototype.delete=ze,$e.prototype.get=Fe,$e.prototype.has=He,$e.prototype.set=Re;var Be=$e,Ue=Be;var Ve=function(){this.__data__=new Ue,this.size=0};var We=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var qe=function(e){return this.__data__.get(e)};var Ge=function(e){return this.__data__.has(e)},Ye="object"==typeof Ce&&Ce&&Ce.Object===Object&&Ce,Ze=Ye,Je="object"==typeof self&&self&&self.Object===Object&&self,Xe=Ze||Je||Function("return this")(),Ke=Xe.Symbol,Qe=Ke,et=Object.prototype,tt=et.hasOwnProperty,rt=et.toString,nt=Qe?Qe.toStringTag:void 0;var at=function(e){var t=tt.call(e,nt),r=e[nt];try{e[nt]=void 0;var n=!0}catch(e){}var a=rt.call(e);return n&&(t?e[nt]=r:delete e[nt]),a},it=Object.prototype.toString;var ot=at,lt=function(e){return it.call(e)},st=Ke?Ke.toStringTag:void 0;var ct=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":st&&st in Object(e)?ot(e):lt(e)};var ut=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},dt=ct,ht=ut;var mt,pt=function(e){if(!ht(e))return!1;var t=dt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ft=Xe["__core-js_shared__"],bt=(mt=/[^.]+$/.exec(ft&&ft.keys&&ft.keys.IE_PROTO||""))?"Symbol(src)_1."+mt:"";var gt=function(e){return!!bt&&bt in e},vt=Function.prototype.toString;var yt=function(e){if(null!=e){try{return vt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},wt=pt,Et=gt,xt=ut,Ct=yt,jt=/^\[object .+?Constructor\]$/,Ot=Function.prototype,Pt=Object.prototype,_t=Ot.toString,Tt=Pt.hasOwnProperty,Lt=RegExp("^"+_t.call(Tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Mt=function(e){return!(!xt(e)||Et(e))&&(wt(e)?Lt:jt).test(Ct(e))},It=function(e,t){return null==e?void 0:e[t]};var Nt=function(e,t){var r=It(e,t);return Mt(r)?r:void 0},Dt=Nt(Xe,"Map"),kt=Nt(Object,"create"),St=kt;var At=function(){this.__data__=St?St(null):{},this.size=0};var zt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ft=kt,Ht=Object.prototype.hasOwnProperty;var Rt=function(e){var t=this.__data__;if(Ft){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ht.call(t,e)?t[e]:void 0},$t=kt,Bt=Object.prototype.hasOwnProperty;var Ut=function(e){var t=this.__data__;return $t?void 0!==t[e]:Bt.call(t,e)},Vt=kt;var Wt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Vt&&void 0===t?"__lodash_hash_undefined__":t,this},qt=At,Gt=zt,Yt=Rt,Zt=Ut,Jt=Wt;function Xt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xt.prototype.clear=qt,Xt.prototype.delete=Gt,Xt.prototype.get=Yt,Xt.prototype.has=Zt,Xt.prototype.set=Jt;var Kt=Xt,Qt=Be,er=Dt;var tr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var rr=function(e,t){var r=e.__data__;return tr(t)?r["string"==typeof t?"string":"hash"]:r.map},nr=rr;var ar=rr;var ir=rr;var or=rr;var lr=function(e,t){var r=or(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},sr=function(){this.size=0,this.__data__={hash:new Kt,map:new(er||Qt),string:new Kt}},cr=function(e){var t=nr(this,e).delete(e);return this.size-=t?1:0,t},ur=function(e){return ar(this,e).get(e)},dr=function(e){return ir(this,e).has(e)},hr=lr;function mr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}mr.prototype.clear=sr,mr.prototype.delete=cr,mr.prototype.get=ur,mr.prototype.has=dr,mr.prototype.set=hr;var pr=mr,fr=Be,br=Dt,gr=pr;var vr=function(e,t){var r=this.__data__;if(r instanceof fr){var n=r.__data__;if(!br||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new gr(n)}return r.set(e,t),this.size=r.size,this},yr=Be,wr=Ve,Er=We,xr=qe,Cr=Ge,jr=vr;function Or(e){var t=this.__data__=new yr(e);this.size=t.size}Or.prototype.clear=wr,Or.prototype.delete=Er,Or.prototype.get=xr,Or.prototype.has=Cr,Or.prototype.set=jr;var Pr=Or;var _r=pr,Tr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Lr=function(e){return this.__data__.has(e)};function Mr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new _r;++t<r;)this.add(e[t])}Mr.prototype.add=Mr.prototype.push=Tr,Mr.prototype.has=Lr;var Ir=Mr,Nr=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},Dr=function(e,t){return e.has(t)};var kr=function(e,t,r,n,a,i){var o=1&r,l=e.length,s=t.length;if(l!=s&&!(o&&s>l))return!1;var c=i.get(e),u=i.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,m=2&r?new Ir:void 0;for(i.set(e,t),i.set(t,e);++d<l;){var p=e[d],f=t[d];if(n)var b=o?n(f,p,d,t,e,i):n(p,f,d,e,t,i);if(void 0!==b){if(b)continue;h=!1;break}if(m){if(!Nr(t,(function(e,t){if(!Dr(m,t)&&(p===e||a(p,e,r,n,i)))return m.push(t)}))){h=!1;break}}else if(p!==f&&!a(p,f,r,n,i)){h=!1;break}}return i.delete(e),i.delete(t),h};var Sr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Ar=Xe.Uint8Array,zr=Oe,Fr=kr,Hr=Sr,Rr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},$r=Ke?Ke.prototype:void 0,Br=$r?$r.valueOf:void 0;var Ur=function(e,t,r,n,a,i,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Ar(e),new Ar(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return zr(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=Hr;case"[object Set]":var s=1&n;if(l||(l=Rr),e.size!=t.size&&!s)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var u=Fr(l(e),l(t),n,a,i,o);return o.delete(e),u;case"[object Symbol]":if(Br)return Br.call(e)==Br.call(t)}return!1};var Vr=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},Wr=Array.isArray,qr=Vr,Gr=Wr;var Yr=function(e,t,r){var n=t(e);return Gr(e)?n:qr(n,r(e))};var Zr=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[a++]=o)}return i},Jr=function(){return[]},Xr=Object.prototype.propertyIsEnumerable,Kr=Object.getOwnPropertySymbols,Qr=Kr?function(e){return null==e?[]:(e=Object(e),Zr(Kr(e),(function(t){return Xr.call(e,t)})))}:Jr;var en=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var tn=function(e){return null!=e&&"object"==typeof e},rn=ct,nn=tn;var an=function(e){return nn(e)&&"[object Arguments]"==rn(e)},on=tn,ln=Object.prototype,sn=ln.hasOwnProperty,cn=ln.propertyIsEnumerable,un=an(function(){return arguments}())?an:function(e){return on(e)&&sn.call(e,"callee")&&!cn.call(e,"callee")},dn={exports:{}};var hn=function(){return!1};!function(e,t){var r=Xe,n=hn,a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a?r.Buffer:void 0,l=(o?o.isBuffer:void 0)||n;e.exports=l}(dn,dn.exports);var mn=/^(?:0|[1-9]\d*)$/;var pn=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&mn.test(e))&&e>-1&&e%1==0&&e<t};var fn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},bn=ct,gn=fn,vn=tn,yn={};yn["[object Float32Array]"]=yn["[object Float64Array]"]=yn["[object Int8Array]"]=yn["[object Int16Array]"]=yn["[object Int32Array]"]=yn["[object Uint8Array]"]=yn["[object Uint8ClampedArray]"]=yn["[object Uint16Array]"]=yn["[object Uint32Array]"]=!0,yn["[object Arguments]"]=yn["[object Array]"]=yn["[object ArrayBuffer]"]=yn["[object Boolean]"]=yn["[object DataView]"]=yn["[object Date]"]=yn["[object Error]"]=yn["[object Function]"]=yn["[object Map]"]=yn["[object Number]"]=yn["[object Object]"]=yn["[object RegExp]"]=yn["[object Set]"]=yn["[object String]"]=yn["[object WeakMap]"]=!1;var wn=function(e){return vn(e)&&gn(e.length)&&!!yn[bn(e)]};var En=function(e){return function(t){return e(t)}},xn={exports:{}};!function(e,t){var r=Ye,n=t&&!t.nodeType&&t,a=n&&e&&!e.nodeType&&e,i=a&&a.exports===n&&r.process,o=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}(xn,xn.exports);var Cn=wn,jn=En,On=xn.exports,Pn=On&&On.isTypedArray,_n=Pn?jn(Pn):Cn,Tn=en,Ln=un,Mn=Wr,In=dn.exports,Nn=pn,Dn=_n,kn=Object.prototype.hasOwnProperty;var Sn=function(e,t){var r=Mn(e),n=!r&&Ln(e),a=!r&&!n&&In(e),i=!r&&!n&&!a&&Dn(e),o=r||n||a||i,l=o?Tn(e.length,String):[],s=l.length;for(var c in e)!t&&!kn.call(e,c)||o&&("length"==c||a&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Nn(c,s))||l.push(c);return l},An=Object.prototype;var zn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||An)};var Fn=function(e,t){return function(r){return e(t(r))}},Hn=Fn(Object.keys,Object),Rn=zn,$n=Hn,Bn=Object.prototype.hasOwnProperty;var Un=pt,Vn=fn;var Wn=function(e){return null!=e&&Vn(e.length)&&!Un(e)},qn=Sn,Gn=function(e){if(!Rn(e))return $n(e);var t=[];for(var r in Object(e))Bn.call(e,r)&&"constructor"!=r&&t.push(r);return t},Yn=Wn;var Zn=Yr,Jn=Qr,Xn=function(e){return Yn(e)?qn(e):Gn(e)};var Kn=function(e){return Zn(e,Xn,Jn)},Qn=Object.prototype.hasOwnProperty;var ea=function(e,t,r,n,a,i){var o=1&r,l=Kn(e),s=l.length;if(s!=Kn(t).length&&!o)return!1;for(var c=s;c--;){var u=l[c];if(!(o?u in t:Qn.call(t,u)))return!1}var d=i.get(e),h=i.get(t);if(d&&h)return d==t&&h==e;var m=!0;i.set(e,t),i.set(t,e);for(var p=o;++c<s;){var f=e[u=l[c]],b=t[u];if(n)var g=o?n(b,f,u,t,e,i):n(f,b,u,e,t,i);if(!(void 0===g?f===b||a(f,b,r,n,i):g)){m=!1;break}p||(p="constructor"==u)}if(m&&!p){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(m=!1)}return i.delete(e),i.delete(t),m},ta=Nt(Xe,"DataView"),ra=Dt,na=Nt(Xe,"Promise"),aa=Nt(Xe,"Set"),ia=Nt(Xe,"WeakMap"),oa=ct,la=yt,sa=la(ta),ca=la(ra),ua=la(na),da=la(aa),ha=la(ia),ma=oa;(ta&&"[object DataView]"!=ma(new ta(new ArrayBuffer(1)))||ra&&"[object Map]"!=ma(new ra)||na&&"[object Promise]"!=ma(na.resolve())||aa&&"[object Set]"!=ma(new aa)||ia&&"[object WeakMap]"!=ma(new ia))&&(ma=function(e){var t=oa(e),r="[object Object]"==t?e.constructor:void 0,n=r?la(r):"";if(n)switch(n){case sa:return"[object DataView]";case ca:return"[object Map]";case ua:return"[object Promise]";case da:return"[object Set]";case ha:return"[object WeakMap]"}return t});var pa=Pr,fa=kr,ba=Ur,ga=ea,va=ma,ya=Wr,wa=dn.exports,Ea=_n,xa="[object Object]",Ca=Object.prototype.hasOwnProperty;var ja=function(e,t,r,n,a,i){var o=ya(e),l=ya(t),s=o?"[object Array]":va(e),c=l?"[object Array]":va(t),u=(s="[object Arguments]"==s?xa:s)==xa,d=(c="[object Arguments]"==c?xa:c)==xa,h=s==c;if(h&&wa(e)){if(!wa(t))return!1;o=!0,u=!1}if(h&&!u)return i||(i=new pa),o||Ea(e)?fa(e,t,r,n,a,i):ba(e,t,s,r,n,a,i);if(!(1&r)){var m=u&&Ca.call(e,"__wrapped__"),p=d&&Ca.call(t,"__wrapped__");if(m||p){var f=m?e.value():e,b=p?t.value():t;return i||(i=new pa),a(f,b,r,n,i)}}return!!h&&(i||(i=new pa),ga(e,t,r,n,a,i))},Oa=tn;var Pa=function e(t,r,n,a,i){return t===r||(null==t||null==r||!Oa(t)&&!Oa(r)?t!=t&&r!=r:ja(t,r,n,a,e,i))},_a=Pa;var Ta=function(e,t){return _a(e,t)};class La{constructor(){Object.defineProperty(this,"api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]})}initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}var Ma=Oe,Ia=Wn,Na=pn,Da=ut;var ka=/\s/;var Sa=function(e){for(var t=e.length;t--&&ka.test(e.charAt(t)););return t},Aa=/^\s+/;var za=ct,Fa=tn;var Ha=function(e){return e?e.slice(0,Sa(e)+1).replace(Aa,""):e},Ra=ut,$a=function(e){return"symbol"==typeof e||Fa(e)&&"[object Symbol]"==za(e)},Ba=/^[-+]0x[0-9a-f]+$/i,Ua=/^0b[01]+$/i,Va=/^0o[0-7]+$/i,Wa=parseInt;var qa=function(e){if("number"==typeof e)return e;if($a(e))return NaN;if(Ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ha(e);var r=Ua.test(e);return r||Va.test(e)?Wa(e.slice(2),r?2:8):Ba.test(e)?NaN:+e};var Ga=function(e){return e?Infinity===(e=qa(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Ya=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n<a;)i[n]=e[n+t];return i},Za=function(e,t,r){if(!Da(r))return!1;var n=typeof t;return!!("number"==n?Ia(r)&&Na(t,r.length):"string"==n&&t in r)&&Ma(r[t],e)},Ja=function(e){var t=Ga(e),r=t%1;return t==t?r?t-r:t:0},Xa=Math.ceil,Ka=Math.max;var Qa=function(e,t,r){t=(r?Za(e,t,r):void 0===t)?1:Ka(Ja(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var a=0,i=0,o=Array(Xa(n/t));a<n;)o[i++]=Ya(e,a,a+=t);return o};const ei=([e,t],[r,n],[a,i])=>{const o=(n-t)*(a-r)-(r-e)*(i-n);return 0===o?0:o>0?1:2},ti=([e,t],[r,n],[a,i])=>r<=Math.max(e,a)&&r>=Math.min(e,a)&&n<=Math.max(t,i)&&n>=Math.min(t,i),ri=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),ni=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,a=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=a<0)return!1;const i=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return i<0?n<=0&&n+a>=i:n>=0&&n+a<=i},ai=(e,t)=>{if(ri(t.x1,t.y1,e))return!0;if(ri(t.x2,t.y2,e))return!0;if(ri(t.x3,t.y3,e))return!0;if(ni(e.x,e.y,t))return!0;if(ni(e.x+e.width,e.y,t))return!0;if(ni(e.x+e.width,e.y+e.height,t))return!0;if(ni(e.x,e.y+e.height,t))return!0;const r=[[[e.x,e.y],[e.x+e.width,e.y]],[[e.x+e.width,e.y],[e.x+e.width,e.y+e.height]],[[e.x,e.y+e.height],[e.x+e.width,e.y+e.height]],[[e.x,e.y],[e.x,e.y+e.height]]];return!![[[t.x1,t.y1],[t.x2,t.y2]],[[t.x1,t.y1],[t.x3,t.y3]]].some((e=>r.some((t=>(([e,t],[r,n])=>{const a=ei(e,t,r),i=ei(e,t,n),o=ei(r,n,e),l=ei(r,n,t);return a!==i&&o!==l||!(0!==a||!ti(e,r,t))||!(0!==i||!ti(e,n,t))||!(0!==o||!ti(r,e,n))||!(0!==l||!ti(r,t,n))})(t,e)))))},ii=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return Qa(T(r.flat()),3).some((r=>ai(t,{x1:e[r[0]].x,y1:e[r[0]].y,x2:e[r[1]].x,y2:e[r[1]].y,x3:e[r[2]].x,y3:e[r[2]].y})))},oi=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class li{constructor(e){if(Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumbnailUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"faces",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),f(this,{id:p,startTime:p,endTime:p,acknowledged:p,isLive:p,raw:b.ref}),this.raw=e,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.type="Analytic",this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=oi.has(this.type),this.detectedObjects||(this.detectedObjects=[])}get id(){return this.raw.id}get startTime(){return new Date(this.raw.startTime)}get endTime(){return new Date(this.raw.endTime)}get isLive(){return!oi.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class si extends La{constructor(e){super(),Object.defineProperty(this,"eventsStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"liveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"updateTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pageInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"loading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"loadMoreTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retryTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"sortDirection",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"to",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameras",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"polygons",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"eventTypes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"loadingInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"flushUpdates",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]}}),Object.defineProperty(this,"setLiveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.liveUpdateMode=e}}),Object.defineProperty(this,"load",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.loadingInited||(this.loadingInited=!0,this.initDataLoading(),this.initLiveUpdates())}}),Object.defineProperty(this,"reload",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)}}),Object.defineProperty(this,"loadMore",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger}}),Object.defineProperty(this,"requestData",{enumerable:!0,configurable:!0,writable:!0,value:({sortDirection:e,from:t,to:r,filter:n,pageInfo:a,cameras:i,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:i,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==a?void 0:a.nextPageToken},n,o).pipe(w((e=>e.success?d({events:e.resultItems,pageInfo:e.pageInfo}):h((()=>e.error)))),E((e=>(console.error(e),this.error=e,d({events:[],pageInfo:null})))))}),f(this,{data:b.ref,cameras:b.struct,detectedObjects:b.struct,from:b,to:b,sortDirection:b,probabilityThreshold:b,pendingData:b.ref,liveUpdateMode:b,setLiveUpdateMode:g,updateTrigger:b,colors:b.ref,flushUpdates:g,pageInfo:b.ref,isLive:p,loading:b,loadMoreTrigger:b,retryTrigger:b,error:b.ref,loadMore:g,filterJson:p})}get isLive(){return"DESC"==this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}initDataLoading(){const e=xe((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,polygons:this.polygons})),!0);this.disposables.push(e.pipe(x((e=>xe((()=>this.retryTrigger),!0).pipe(C(e)))),x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a,polygons:i})=>(v((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[],this.pendingData=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,polygons:i}))))).subscribe((({events:e,pageInfo:t})=>{v((()=>{var r,n,a;if(!t)return;const i=e.map(ci);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>Ee[e])),from:null!==(n=null===(r=i[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:L(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(a=this.probabilityThreshold)&&void 0!==a?a:void 0}),i):this.data=i,this.eventsStore.add(i),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a})=>xe((()=>this.loadMoreTrigger)).pipe(j((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(ci);this.eventsStore.add(r),v((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(xe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?xe((()=>this.eventsStore.recentAdditions)):m))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&v((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(xe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?xe((()=>this.eventsStore.recentAdditions)):(this.pendingData&&v((()=>this.pendingData=[])),m)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&v((()=>{this.pendingData=[...t,...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;if(r&&(t=t.filter((e=>e.startTime>=r))),n&&(t=t.filter((e=>e.startTime<=n))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length){const e=this.eventTypes.map((e=>Ee[e]));t=t.filter((t=>e.includes(t.type)))}return this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{var t;const{probabilityThreshold:r}=this;return!(null!==r&&e.Probability<r)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&(null===(t=e.Colors)||void 0===t?void 0:t.some((e=>this.colors.has(e.Color)))):this.detectedObjects.includes(e.Type))}))))),t}uniquelyConcat(e,t){if(!e.length)return t.concat();if(!t.length)return e.concat();const r=e=>[e.id,e];return Array.from(new Map([...e.map(r),...t.map(r)]).values())}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}function ci(e){return new li(e)}const ui={Top:0,Left:0,Bottom:1,Right:1};class di extends La{constructor(e,n,a,i){super(),Object.defineProperty(this,"eventSchema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"notification",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"analyticsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposeReactionToCamera",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"peopleCountingDataLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"heatmap",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"peopleCountingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"brushFilter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setDate",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.date=e,this.brushFilter=null}}),Object.defineProperty(this,"setFilters",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.filters=e}}),Object.defineProperty(this,"getProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e}}),Object.defineProperty(this,"setBrushFilter",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.brushFilter=e}}),Object.defineProperty(this,"setParams",{enumerable:!0,configurable:!0,writable:!0,value:({cameraId:e,box:t})=>{this.cameraId=e,this.regions=[[{x:t.Left,y:t.Top},{x:t.Right,y:t.Top},{x:t.Right,y:t.Bottom},{x:t.Left,y:t.Bottom}]],this.date||(this.date=new Date)}}),Object.defineProperty(this,"openForPlayer",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e}}),Object.defineProperty(this,"searchFullFrame",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e,this.clear(),this.peopleCountingData=[],this.date||(this.date=new Date)}}),Object.defineProperty(this,"setRegions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.regions=e.length?e:null}}),Object.defineProperty(this,"toggleHeatmap",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.heatmapHidden=!this.heatmapHidden}}),Object.defineProperty(this,"toggleColor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t}}),Object.defineProperty(this,"clearColors",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.colors=new Set}}),Object.defineProperty(this,"clear",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.date=null,this.regions=null,this.brushFilter=null,this.heatmap=null,this.data=[],this.peopleCountingData=[]}}),Object.defineProperty(this,"initDataFetching",{enumerable:!0,configurable:!0,writable:!0,value:()=>{const e=xe((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(O(Ta),P());this.disposables.push(xe((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(O(Ta),P()).subscribe((e=>{v((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),a=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=a;const{brushFilter:i}=e;i&&([this.eventsLoader.from,this.eventsLoader.to]=i),this.eventsLoader.polygons=e.regions?e.regions.map(this.regionToWktPolygon):[],this.eventsLoader.cameras=[e.cameraId],this.eventsLoader.detectedObjects=e.filters.map((e=>e.id)),this.eventsLoader.eventTypes=[Ee.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),a=r(e.date),i=e.regions?this.boxRegions(e.regions):ui;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,a,i).pipe(w((e=>e.success?d(e.resultItems):h((()=>e.error))))).pipe(E((e=>(this.notification.error(ve.t("eventSearchRequestError.peopleCounting")),console.error(e),d([])))))}))).subscribe((e=>{v((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(xe((()=>({date:this.date,cameraId:this.cameraId}))).pipe(O(Ta),x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.heatmapLoading=!0}));const a=t(e.date),i=r(e.date);return n.fetchHeatmaps(e.cameraId,a,i,1).pipe(_((e=>e[0]||null))).pipe(E((e=>(this.notification.error(ve.t("eventSearchRequestError.heatmap")),console.error(e),d(null)))))}))).subscribe((e=>{v((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),f(this,{cameraId:b,date:b,regions:b.ref,filters:b.ref,colors:b.ref,peopleCountingDataLoading:b,heatmapHidden:b,heatmapLoading:b,data:b.ref,heatmap:b.ref,peopleCountingData:b.ref,probabilityThreshold:b,brushFilter:b.ref,params:p,filteredData:p,filteredPeopleCountingData:p,setDate:g,setFilters:g,setBrushFilter:g,setParams:g,openForPlayer:g,searchFullFrame:g,setRegions:g,toggleHeatmap:g,toggleColor:g,clearColors:g,clear:g}),this.analyticsEnabled=Boolean(i),this.eventsLoader=new si(n),this.eventsLoader.liveUpdateMode="disabled",this.initDataFetching()}get params(){return this.eventSchema.schemaDescription.filter((e=>"filter"===e.parameterType))}get filteredData(){let e=[];const t=this.filters.map((e=>e.id));t.length?(e=this.data.filter((e=>e.detectedObjects.some((e=>t.includes(e.Type)&&e.Probability>=this.probabilityThreshold)))),this.colors.size&&(e=e.filter((e=>e.detectedObjects.some((e=>{var t;return null===(t=e.Colors)||void 0===t?void 0:t.some((e=>this.colors.has(e.Color)))})))))):e=this.data.filter((e=>e.detectedObjects.some((e=>e.Probability>=this.probabilityThreshold))));const{brushFilter:r}=this;r&&(e=e.filter((e=>e.startTime>=r[0]&&e.startTime<=r[1]&&e.detectedObjects.some((e=>"Person"===e.Type)))));const{regions:n}=this;return n&&n.length&&(e=e.filter((e=>e.detectedObjects.some((e=>{var r;return(!t.length||t.includes(e.Type))&&(!this.colors.size||(null===(r=e.Colors)||void 0===r?void 0:r.some((e=>this.colors.has(e.Color)))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>ii(t,{x:e.Box.Left,y:e.Box.Top,width:e.Box.Right-e.Box.Left,height:e.Box.Bottom-e.Box.Top})))}))))),e}get filteredPeopleCountingData(){const{regions:e}=this;return(null==e?void 0:e.length)?this.peopleCountingData.filter((t=>e.some((e=>ii(e,{x:t.Left,y:t.Top,width:t.Right-t.Left,height:t.Bottom-t.Top}))))):this.peopleCountingData}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}boxRegions(e){const t=e.flatMap((e=>e.map((({x:e})=>e)))),r=e.flatMap((e=>e.map((({y:e})=>e))));return{Left:Math.min(...t),Right:Math.max(...t),Top:Math.min(...r),Bottom:Math.max(...r)}}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposeReactionToCamera&&this.disposeReactionToCamera(),this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}const hi=N.createContext(null);function mi(e){return t=>{const{size:r=24,color:n="currentColor",className:a,...i}=t,o=e.viewBox||"0 0 24 24",l=e.svg;return N.createElement("svg",{preserveAspectRatio:"xMinYMin",className:V("icon",a),width:r,fill:n,viewBox:o,...i},l)}}const pi=mi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M10.13 3.245a1.994 1.994 0 0 0-1.542.992l-5.491 9.53c-.55.954-.23 2.178.723 2.728l8.66 5c.953.55 2.174.216 2.724-.737l5.509-9.521c.335-.58.349-1.265.087-1.832L17.65 2.54z"}))});pi.displayName="LabelIcon";const fi=mi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"}))});fi.displayName="CameraIcon";const bi=mi({viewBox:"0 0 24 24",svg:N.createElement("path",{d:"M17,6h-2V3c0-0.55-0.45-1-1-1h-4C9.45,2,9,2.45,9,3v3H7C5.9,6,5,6.9,5,8v11c0,1.1,0.9,2,2,2c0,0.55,0.45,1,1,1 c0.55,0,1-0.45,1-1h6c0,0.55,0.45,1,1,1c0.55,0,1-0.45,1-1c1.1,0,2-0.9,2-2V8C19,6.9,18.1,6,17,6z M9.5,18H8V9h1.5V18z M12.75,18 h-1.5V9h1.5V18z M13.5,6h-3V3.5h3V6z M16,18h-1.5V9H16V18z"})});bi.displayName="LuggageIcon";const gi=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"}))});gi.displayName="CarIcon";const vi=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.65 2.62.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"}))});vi.displayName="BoatIcon";const yi=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M11.74 13.36L14.14 7.71L13.06 5.5H10.5V4H14L14.73 5.5H21.75L20.75 9H16.44L17.11 10.37C17.69 10.13 18.33 10 19 10C21.76 10 24 12.24 24 15C24 17.76 21.76 20 19 20C16.24 20 14 17.76 14 15C14 13.45 14.71 12.06 15.82 11.15L15 9.5L12.25 16H9.9C9.44 18.28 7.42 20 5 20C2.24 20 0 17.76 0 15C0 12.24 2.24 10 5 10C7.59 10 9.72 11.97 10 14.5H10.58L8.3 9H7.5C7.09 9 6.75 8.66 6.75 8.25C6.75 7.84 7.09 7.5 7.5 7.5H10.25C10.66 7.5 11 7.84 11 8.25C11 8.66 10.66 9 10.25 9H9.97L11.74 13.36M5 11.5C3.07 11.5 1.5 13.07 1.5 15C1.5 16.93 3.07 18.5 5 18.5C6.59 18.5 7.93 17.45 8.36 16H4V14.5H8.47C8.22 12.8 6.76 11.5 5 11.5M19 11.5C18.57 11.5 18.15 11.58 17.77 11.72L19.7 15.68L18.35 16.34L16.5 12.55C15.88 13.18 15.5 14.05 15.5 15C15.5 16.93 17.07 18.5 19 18.5C20.93 18.5 22.5 16.93 22.5 15C22.5 13.07 20.93 11.5 19 11.5Z"}))});yi.displayName="BicycleIcon";const wi=mi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"}))});wi.displayName="DirectionsWalkIcon";const Ei=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),N.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),N.createElement("path",{d:"M17.34 14.86c-.87-1.02-1.6-1.89-2.48-2.91-.46-.54-1.05-1.08-1.75-1.32-.11-.04-.22-.07-.33-.09-.25-.04-.52-.04-.78-.04s-.53 0-.79.05c-.11.02-.22.05-.33.09-.7.24-1.28.78-1.75 1.32-.87 1.02-1.6 1.89-2.48 2.91-1.31 1.31-2.92 2.76-2.62 4.79.29 1.02 1.02 2.03 2.33 2.32.73.15 3.06-.44 5.54-.44h.18c2.48 0 4.81.58 5.54.44 1.31-.29 2.04-1.31 2.33-2.32.31-2.04-1.3-3.49-2.61-4.8z"}))});Ei.displayName="PetsIcon";const xi=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M4 4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H5Zm0 2h4v2h8V6h4v12H4Z"}),N.createElement("path",{d:"M9.923 10 8.43 12.433 10 15h-.8L8 13.036 6.8 15H6l1.602-2.616L6.136 10h.8l1.093 1.781L9.123 10Z"}),N.createElement("path",{d:"m13.709 10-1.492 2.433L13.787 15h-.8l-1.2-1.964L10.585 15h-.8l1.603-2.616L9.923 10h.799l1.094 1.781L12.91 10Z"}),N.createElement("path",{d:"m17.709 10-1.492 2.433L17.787 15h-.8l-1.2-1.964L14.585 15h-.8l1.603-2.616L13.923 10h.799l1.094 1.781L16.91 10Z"}))});xi.displayName="LicensePlateIcon";const Ci=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?N.createElement(fi,{size:t}):"Luggage"===e.id?N.createElement(bi,{size:t}):"Car"===e.id?N.createElement(gi,{size:t}):"Person"===e.id?N.createElement(wi,{size:t}):"Bicycle"===e.id?N.createElement(yi,{size:t}):"Boat"===e.id?N.createElement(vi,{size:t}):"Animal"===e.id?N.createElement(Ei,{size:t}):"LicensePlate"===e.id?N.createElement(xi,{size:t}):N.createElement(pi,{size:t})},ji=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:a}=U,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Ci,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},Oi={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},Pi={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},_i={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ti={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Li={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"},Mi={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},Ii=({label:e,children:t})=>N.createElement(q,{label:e,style:Mi},t);Ii.displayName="Tooltip";class Ni extends N.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:a,type:i,title:o,...l}=this.props,s=V(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},a?`x-3deye-button--${a}`:void 0),c=N.createElement("button",{ref:e,className:s,type:i||"button",...l},t,l.disabled?null:N.createElement(W,null));return o?N.createElement(Ii,{label:o},c):c}}const Di=N.forwardRef(((e,t)=>N.createElement(Ni,{forwardedRef:t,...e}))),ki=mi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});ki.displayName="CloseIcon";const Si=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),N.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});Si.displayName="DoneIcon";const Ai=[{color:Ti[500],name:"red",highlightColor:Ti[100]},{color:Pi[500],name:"green",highlightColor:Pi[100]},{color:Oi[500],name:"blue",highlightColor:Oi[100]},{color:Li[500],name:"yellow",highlightColor:Li[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:_i[500],name:"dimgrey",highlightColor:_i[100]}],zi=H((({value:e,clear:t,toggle:r})=>N.createElement("div",{className:"color-selector"},N.createElement("div",null,"COLOR"),N.createElement("div",{className:"color-selector__items"},Ai.map((({color:t,highlightColor:n,name:a})=>N.createElement("button",{key:a,className:V("color-selector__item",{selected:e.has(a)}),style:{backgroundColor:t},onClick:r.bind(null,a)},N.createElement(Si,{color:n,size:20})))),N.createElement(Di,{className:"color-selector__clear",disabled:!e.size,onClick:t},N.createElement(ki,{size:20}))))));zi.displayName="ColorSelector";const Fi=(e,t,r)=>Math.min(Math.max(e,t),r),Hi=e=>Math.round(e),Ri=N.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:a=!1,labelFormat:i=(e=>`${e}`),style:o},l)=>{const s=D(null),c=D(null),[u,d]=k(!1),[h,m]=k(e);S((()=>{if(!u)return;const e=s.current;if(!e)return;let a=0,i=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(a=Fi(e-o.x,0,o.width),l=a/o.width*100,c.current.style.transform=`translateX(${a}px)`):(i=o.height-Fi(r-o.y,0,o.height),l=i/o.height*100,c.current.style.transform=`translateY(${-i}px)`),m(l),null==t||t(Hi(l))},h=({clientX:e,clientY:a})=>{if(d(!1),!c.current)return;const i="horizontal"===n?Fi(e-o.x,0,o.width)/o.width*100:100*(1-Fi(a-o.y,0,o.height)/o.height);c.current.style.transform="",m(i),null==t||t(Hi(i)),null==r||r(Hi(i))},p=()=>{if(d(!1),!c.current)return;const e="horizontal"===n?a/o.width*100:i/o.height*100;c.current.style.transform="",null==t||t(Hi(e)),null==r||r(Hi(e))};return e.addEventListener("pointercancel",p),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",p),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[u,n,t]);const p=A((({clientX:e,clientY:r,pointerId:i})=>{if(!s.current||a)return;d(!0),s.current.setPointerCapture(i);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=Fi(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-Fi(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}m(l),null==t||t(Hi(l))}),[n,a]),f=A((n=>{if(a)return;let i=null;"ArrowLeft"===n.code?i=Math.max(e-1,0):"ArrowRight"===n.code?i=Math.min(e+1,100):"ArrowDown"===n.code?i=Math.max(e-1,0):"ArrowUp"===n.code&&(i=Math.min(e+1,100)),null!==i&&(n.stopPropagation(),n.preventDefault(),null==t||t(i),null==r||r(i))}),[e,t,r,n,a]);return N.createElement("div",{ref:G(l,s),tabIndex:0,onKeyDown:f,className:V("x-3deye-slider",n,{disabled:a}),onPointerDown:p,style:o},N.createElement("div",{className:"x-3deye-slider__track"},N.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${u?h:e}%`:void 0,height:"vertical"===n?`${u?h:e}%`:void 0}})),N.createElement("div",{ref:c,className:V("x-3deye-slider__thumb",{active:u}),style:{touchAction:"none",userSelect:"none",position:"absolute",left:"horizontal"===n?u?0:`${e}%`:"auto",bottom:"vertical"===n?u?0:`${e}%`:"auto"}},N.createElement("div",{className:"x-3deye-slider__label "+(u?"open":"")},i(u?Hi(h):e))))}));Ri.displayName="Slider";const $i=H((({getter:e,setter:t})=>{const[r,n]=k(0),a=D(null),i=Math.floor(100*e());return S((()=>y(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),N.createElement("div",{ref:a,style:{paddingLeft:8,paddingRight:8,marginTop:5}},N.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},N.createElement("div",null,"CONFIDENCE"),N.createElement("div",{style:{fontSize:"1.1em"}},i,"%")),N.createElement("div",{style:{padding:"0 10px"}},N.createElement(Ri,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));$i.displayName="ProbabilitySlider";var Bi,Ui=(Bi=8,{container:e=>({...e,padding:Bi}),control:(e,t)=>({...e,borderRadius:8,backgroundColor:t.isFocused?"white":"rgba(0, 0, 0, 0.5)",border:"none",boxShadow:null,"&:hover":{borderColor:null}}),menu:e=>({...e,width:`calc(100% - ${2*Bi}px)`,marginTop:Bi?0:e.marginTop}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"}),placeholder:(e,t)=>({...e,color:t.isFocused?e.color:"hsl(0, 0%, 70%)"})});const Vi=({size:e=48})=>N.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},N.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));Vi.displayName="Preloader";var Wi=pr;function qi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(qi.Cache||Wi),r}qi.Cache=Wi;const Gi=qi((()=>{const e=document.createElement("div");e.style.overflowY="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.append(e);const t=e.offsetWidth;return e.remove(),t})),Yi=H((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:a})=>{const i=D(null),o=D(null);return N.createElement("div",{ref:i,onDragStart:t=>{var r;if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.setData("x-3deye/camera",""+e.cameraId),t.dataTransfer.setData("x-3deye/starttime",e.startTime.toISOString()),t.dataTransfer.dropEffect="move";const n=null===(r=i.current)||void 0===r?void 0:r.querySelector("img");if(n){const{x:e,y:r}=n.getBoundingClientRect();t.dataTransfer.setDragImage(n,t.clientX-e,t.clientY-r)}},className:"event-list-item",onClick:()=>null==r?void 0:r(e),onAuxClick:t=>null==n?void 0:n(t,e),onContextMenu:e=>{var t;e.preventDefault(),i.current&&(null===(t=o.current)||void 0===t||t.toggleAt(i.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,a&&N.createElement(a,{ref:o,data:e}))}));Yi.displayName="EventListItem";const Zi=({className:e,style:t,box:{Top:r,Left:n,Right:a,Bottom:i}})=>N.createElement(N.Fragment,null,N.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-i)+"%",right:100*(1-a)+"%",...t}}));Zi.displayName="LicensePlateLpr";const Ji=({Type:e,Box:t,Probability:r,width:n,height:a})=>{const{eventSchema:i}=z(hi),o=D(null),{Top:l,Left:s,Right:c,Bottom:u}=t;return F((()=>{if(!n||!a)return;if(!o.current)return;const e=o.current.getBoundingClientRect();let t=(s+c)/2*n-e.width/2,r=l*a-e.height-4;r<0&&(r=u*a+4),t<0&&(t=0),t>n-e.width&&(t=n-e.width),r>a-e.height&&(r=a-e.height),o.current.style.top=`${r}px`,o.current.style.left=`${t}px`})),N.createElement(N.Fragment,null,N.createElement(Zi,{box:t,style:{outline:`2px solid ${i.colorsByFoundObjectType.get(e)}`}}),N.createElement("div",{ref:o,className:"event-list-item__detected-object-label",title:`${e.toLowerCase()} ${Math.floor(100*r)}%`},N.createElement("div",{style:{padding:4,lineHeight:"24px"}},e.toLowerCase()),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:i.colorsByFoundObjectType.get(e)}},Math.floor(100*r),"%")))};function Xi({style:e}){return N.createElement("div",{className:"frame",style:e},N.createElement("div",{className:"corner-highlight-tl"}),N.createElement("div",{className:"corner-highlight-tr"}),N.createElement("div",{className:"corner-highlight-br"}),N.createElement("div",{className:"corner-highlight-bl"}))}Ji.displayName="DetectedObjectHighlight";const Ki=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:a,thumbHeight:i,width:o,height:l})=>{const{Top:s,Left:c,Right:u,Bottom:d}=t,h=100/a/(u-c),m={top:2},p=D(null);return F((()=>{if(!p.current)return;const e=p.current.getBoundingClientRect();let t=(c+u)/2*o-e.width/2,r=s*l-e.height-4;r<0&&(r=d*l+4),t<0&&(t=0),t>o-e.width&&(t=o-e.width),p.current.style.top=`${r}px`,p.current.style.left=`${t}px`})),c>=1-u?m.left=2:m.right=2,N.createElement(N.Fragment,null,N.createElement("div",{ref:p,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},N.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),N.createElement(Zi,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),N.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:a*(u-c)*h,height:i*(d-s)*h,...m}},N.createElement("img",{style:{width:a*h,height:i*h,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),N.createElement(Xi,null)))};Ki.displayName="FaceHighlight";const Qi=N.memo((({value:e})=>e?N.createElement(N.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?N.createElement(N.Fragment,{key:t},e):N.createElement("span",{key:t,className:"digit"},e)}))):null));Qi.displayName="LicensePlateNumber";const eo=({detectedObject:e,height:t,width:r,url:n,thumbWidth:a,thumbHeight:i})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:u},Probability:d}=e,h=e.Value||e.Number,m=D(null);F((()=>{if(!m.current)return;const e=m.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,a=l*t-e.height-4;a<0&&(a=u*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),m.current.style.top=`${a}px`,m.current.style.left=`${n}px`}));const p={top:2};s>=1-c?p.left=2:p.right=2;const f=100/a/(c-s);return N.createElement(N.Fragment,null,N.createElement("div",{ref:m,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*d)}%`},N.createElement("div",{style:{padding:4}},N.createElement(Qi,{value:h})),N.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*d),"%")),N.createElement(Zi,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),N.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:a*(c-s)*f,height:i*(u-l)*f+16,position:"absolute",...p}},N.createElement("img",{style:{width:a*f,height:i*f,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),N.createElement("div",{className:"plate-number"},N.createElement(Qi,{value:h})),N.createElement(Xi,{style:{height:i*(u-l)*f}})))};eo.displayName="LicensePlateHighlight";const to=mi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-1v1h1v2h-1v1h1v2h-2V5z"}))});to.displayName="ThermostatIcon";const ro=H((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,N.createElement("div",{className:"event-list-item__temperature"},N.createElement(to,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));ro.displayName="Temperature";const no=H((({data:e,cameraNameHidden:t})=>{var r;const i=z(hi),{cameras:o}=i,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return N.createElement("div",{className:"event-list-item-caption"},N.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",i="";return n(e,new Date)?a(e,new Date)?r=i="HH:mm":a(e,t)?(r="EEE d MMM HH:mm",i="HH:mm"):r=i="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",i="d MMM HH:mm"):r=i="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",i+=":ss"),+e==+t?`${ye(e,r)}`:`${ye(e,r)} - ${ye(t,i)}`}(e.startTime,e.endTime)),t?null:N.createElement("div",{className:"event-list-item__camera-name",title:l},l),+e.endTime-+e.startTime>0&&N.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let a=(e-r)/60;if(a<60)return!r&&t?`${a}m`:`${a}m ${n}s`;const i=Math.floor(a/60);if(a-=60*i,!r&&!a&&t)return`${i}h`;const o=t?`${a}`:`${a}`.padStart(2,"0");return!r&&a&&t?`${i}h ${o}m`:`${i}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),N.createElement(ro,{data:e}))}));no.displayName="EventListItemCaption";const ao=H((({url:e,noPreview:t,width:r})=>N.createElement(N.Fragment,null,e?N.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,N.createElement(W,{radius:r}),t?N.createElement("div",{className:"no-preview-overlay"}):null)));ao.displayName="EventThumbnail";const io=H((({data:e,width:t,height:r,cameraNameHidden:n,onClick:a,onAuxClick:i,menuComponent:o})=>{const l=z(hi),{eventSchema:s}=l,[c,u]=function(e){var t;const[r,n]=k(null),a=z(hi),{cameras:i,thumbnails:o}=a;S((()=>{if(e.thumbnailUrl)return void n(null);const t=o.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{n(e||null)}));return()=>t.unsubscribe()}),[e.id]);let l="",s=!1;return e.thumbnailUrl?l=e.thumbnailUrl:null===r&&i.loaded?(l=(null===(t=i.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let d=null,h=null,m=null;if(e.detectedObjects.length){let n,a;const{ThumbnailSize:i}=JSON.parse(e.raw.data);i&&(n=i.Width,a=i.Height),d=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)).map(((e,n)=>N.createElement(Ji,{key:n,...e,height:r,width:t}))),h=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,i)=>N.createElement(eo,{key:i,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:a,url:c})))}if(e.faces){const{Width:n,Height:a}=JSON.parse(e.raw.data).ThumbnailSize;m=e.faces.map(((e,i)=>N.createElement(Ki,{key:i,face:e,url:c,thumbWidth:n,thumbHeight:a,width:t,height:r})))}return N.createElement(Yi,{onClick:a,onAuxClick:i,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},N.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},N.createElement(ao,{url:c,noPreview:u,width:t}),d,h,m,e.acknowledged?N.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,N.createElement(no,{data:e,cameraNameHidden:n})))}));io.displayName="EventItem";class oo extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),X.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),X.captureException(e)})),console.error(e),console.log(t)}render(){if(!this.state.hasError)return this.props.children;const{style:e,children:t,...r}=this.props;return N.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},N.createElement("h1",null,"Oops. Something went wrong"),N.createElement("div",null,"We've been notified about this problem"),N.createElement(Di,{onClick:()=>this.setState({hasError:!1})},"retry"))}}const lo=H((({store:e,captionHeight:t=0,minColumnWidth:r=180,onEventClick:n,onEventAuxClick:a,eventRenderer:i=(({data:e,width:t,height:r})=>N.createElement(io,{data:e,cameraNameHidden:!1,onClick:n,onAuxClick:a,width:t,height:r}))})=>{const o=D(),l=R((()=>({rowIndex:0,columnIndex:0,update(e,t){this.rowIndex=e,this.columnIndex=t},reset(){this.rowIndex=0,this.columnIndex=0}})));if(e.error&&!e.data.length)return l.reset(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch data"),N.createElement(Di,{onClick:e.reload},"Retry")));if(e.loading)return l.reset(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement(Vi,null));if(!e.data.length)return l.reset(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},ve.t("noEventsFound"));const s=(t,r)=>(e.loadMore(),Promise.resolve()),c=({scrollTop:t})=>{"disabled"!==e.liveUpdateMode&&e.setLiveUpdateMode(t>=1||e.pendingData.length?"manual":"auto")};return N.createElement(Y,null,(({width:n,height:a})=>N.createElement($,null,(()=>{var u;const d=Math.floor(n/r)||1,h=n/d/16*9+t,m=d*Math.floor(a/h)>=e.data.length?0:Gi(),p=Math.max(1,Math.floor((n-m)/r)),f=Math.ceil(e.data.length/p),b=(n-m-2*(p-1))/p,g=b/16*9+t;return N.createElement(N.Fragment,null,N.createElement(Z,{isItemLoaded:e=>e<f,itemCount:f+((null===(u=e.pageInfo)||void 0===u?void 0:u.haveMore)?1:0),loadMoreItems:s},(({onItemsRendered:t,ref:r})=>{var s;return N.createElement(J,{key:`${n}x${a}`,ref:G(o,r),columnCount:p,columnWidth:e=>b+(e?2:0),height:a,width:n,rowCount:f+((null===(s=e.pageInfo)||void 0===s?void 0:s.haveMore)||e.error?1:0),rowHeight:e=>g+(e?2:0),initialScrollTop:g*l.rowIndex,onScroll:c,onItemsRendered:({visibleRowStartIndex:e,visibleColumnStartIndex:r,visibleRowStopIndex:n,overscanRowStopIndex:a,overscanRowStartIndex:i})=>{l.update(e,r),t({overscanStartIndex:i,overscanStopIndex:a,visibleStartIndex:e,visibleStopIndex:n})}},(t=>({columnIndex:r,rowIndex:n,style:a})=>N.createElement($,null,(()=>{var o,l;const s=n*t+r,c=e.data[s];return a={...a,left:a.left+(r?2:0),width:a.width-(r?2:0),top:a.top+(n?2:0),height:a.height-(n?2:0)},s===e.data.length?e.error?N.createElement("div",{style:a},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch more data"),N.createElement(Di,{onClick:e.loadMore},"Retry")))):(null===(o=e.pageInfo)||void 0===o?void 0:o.haveMore)?N.createElement("div",{style:a},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement(Vi,{size:32}))):N.createElement("div",{style:a}):!c&&(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?N.createElement("div",{style:a}):c?N.createElement("div",{style:a},N.createElement(oo,null,i({data:c,width:a.width,height:a.height}))):N.createElement("div",{style:a})})))(p))})),N.createElement($,null,(()=>e.pendingData.length?N.createElement("div",{style:{position:"absolute",top:0,left:0,right:m,pointerEvents:"none",textAlign:"center",padding:8}},N.createElement(Di,{className:"x-3deye-button--overlay",style:{background:"rgba(0, 0, 0, 0.75)",padding:"8px 16px",backdropFilter:"blur(2px)",borderRadius:32,pointerEvents:"auto"},onClick:()=>{var t;e.flushUpdates(),null===(t=o.current)||void 0===t||t.scrollTo({scrollLeft:0,scrollTop:0}),e.setLiveUpdateMode("auto")}},ve.t("showEvents",{count:e.pendingData.length}))):null)))}))))}));lo.displayName="EventGrid";const so=e=>{const{className:t,children:r,...n}=e;return N.createElement("div",{className:V("x-3deye-button-group",t),...n},r)},co=e=>`scale(${e})`,uo=({children:e,from:t,style:r})=>{const n=K({opacity:1,from:{opacity:0},config:{tension:300}});return N.createElement(Q.div,{style:{...r,...n,transform:n.opacity.to(co),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},ho=document.body;class mo extends N.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){ho.appendChild(this.el)}componentWillUnmount(){ho.removeChild(this.el)}render(){return ee.createPortal(this.props.children,this.el)}}const po=({width:e,height:t,color:r,position:n="top",style:a})=>{const i=[0,"top"===n?t:0],o=[e,i[1]],l=[e/2,t-i[1]],s=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-i[1]],u=[e-c[0],c[1]],d=[e-s[0],s[1]],h=e=>e.join(","),m=`M ${h(i)} C ${h(s)} ${h(c)} ${h(l)} ${h(u)} ${h(d)} ${h(o)} Z`;return N.createElement("svg",{className:"tip",style:a,width:e,height:t,fill:r},N.createElement("path",{d:m}))};class fo extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,left:0,bottom:"auto",tipPosition:"bottom",tipOffset:0}}),Object.defineProperty(this,"targetRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=e.target;if(this.popoverRef.current.contains(t))return;const r=this.targetRef.current;r&&r.contains(t)||this.props.onCloseRequest()}}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.popoverRef)return;const{disablePortal:e}=this.props,t=this.targetRef.current;if(!t)return void console.warn("popover: no target element found");const{top:r,left:n,bottom:a,height:i,width:o}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let u="bottom"===this.props.placement?a+10:r-c.clientHeight-10,d=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";u<0&&(u=a+10,h="top"),d<0&&(d=0,l=n+o/2-12),d+c.clientWidth>window.innerWidth&&(d=window.innerWidth-c.clientWidth,l=n-d+o/2-12),e&&(u=i+10,d=0,l=8,"top"===this.props.placement&&(s=u,u="auto")),this.setState({top:u,bottom:s,left:d,tipPosition:h,tipOffset:l},(()=>{this.forceUpdate()}))}})}componentWillUnmount(){this.stopOutsideClickListening()}componentDidUpdate(e){const{ignoreOutsideClick:t}=this.props;this.props.opened&&!e.opened&&(t||this.startOutsideClickListening(),requestAnimationFrame(this.updatePosition)),!this.props.opened&&e.opened&&this.stopOutsideClickListening()}render(){const{top:e,left:t,bottom:r,tipPosition:n,tipOffset:a}=this.state,{className:i,opened:o,disablePortal:l,disableAnimation:s}=this.props,c={position:"absolute",left:a};"bottom"===n?c.bottom=-8:c.top=-8;const u=V(i,"x-3deye-popover-body");let d=null;if(o){const a={zIndex:l?1:100000001,position:"absolute",top:e,bottom:r,left:t},i=N.createElement("div",{className:u,ref:this.popoverRef},this.props.children,N.createElement(po,{width:24,height:8,position:n,color:"white",style:c}));d=s?N.createElement("div",{style:a},i):N.createElement(uo,{from:n,style:a},i)}const h=N.cloneElement(this.props.target,{ref:this.targetRef});if(l)return N.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,d);const m=o&&N.createElement(mo,null,d);return N.createElement(N.Fragment,null,h,m)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const bo=H((({store:e})=>{const[t,r]=k(!1),{cameras:n}=z(hi),{date:l,setDate:s,cameraId:c}=e,u=c?n.camerasById.get(c):void 0,d=i(new Date,1),h=l&&a(l,new Date),m=l&&a(l,d),p=u?o(new Date,u.archiveDuration):new Date,f=()=>r(!1);return N.createElement(so,null,N.createElement(Di,{className:V({"button-selected":h}),onClick:()=>s(new Date)},ve.t("today")),c&&!a(new Date,p)?N.createElement(Di,{className:V({"button-selected":m}),onClick:()=>s(d)},ve.t("yesterday")):null,l&&N.createElement(fo,{target:N.createElement(Di,{className:"date-button",onClick:()=>r(!t)},ye(l,"EEE dd MMM")),opened:t,onCloseRequest:f,disableAnimation:!0},N.createElement(te,{selected:l,onChange:s,dateFormat:"EEE dd MMM",inline:!0,minDate:p,maxDate:new Date}),N.createElement("div",{style:{display:"flex"}},N.createElement(Di,{style:{flex:1},onClick:f,variant:"filled"},ve.t("button.ok")))))}));bo.displayName="DateSelector";const go=H((()=>{const e=z(hi),t=D(null),r=D(null),n=D(null),a=D([]),[i,o]=k(0),l=100,s=20,c=20,u=30,d=20,{eventSearch:h}=e.eventSearchPanel,{filteredPeopleCountingData:m}=h,{brushFilter:p}=h,f=p?a.current.filter((e=>e.x0>=+p[0]&&e.x1<=+p[1])).reduce(((e,t)=>e+t.length),0):null;return S((()=>{const e=new pe((e=>{for(const t of e){const e=t.contentRect.width;o(e)}}));return e.observe(t.current),()=>e.disconnect()}),[]),S((()=>{const e=ie(r.current);if(!i)return;m.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const t=re(m,(e=>e.timestamp)),o=se(ce.offset(t[0],-1),ce.offset(t[1],1)),p=he().extent([[d,s],[i-c,l-u]]).on("end",(function({selection:e,sourceEvent:t}){if(!t)return;if(!e)return void h.setBrushFilter(null);const r=ue.every((+a.current[0].x1-+a.current[0].x0)/6e4||30);let[n,i]=e.map((e=>r.round(f.invert(e))));if(+n==+i&&(n=r.floor(f.invert(e[0])),i=r.ceil(f.invert(e[1])),+n==+i))return ie(this).transition().call(p.move,null),void h.setBrushFilter(null);h.setBrushFilter([n,i]),ie(this).transition().call(p.move,i>n?[n,i].map(f):null)}));n.current=p;const f=oe().domain(re(o)).nice().range([d,i-c]);a.current=m.length?ne().value((e=>e.timestamp)).domain(f.domain()).thresholds(f.ticks(24))(m):[];const b=le().domain([0,ae(a.current,(e=>e.length))]).nice().range([l-u,s]),g=e.select(".bars").selectAll(".bar").data(a.current);g.exit().remove();const v=g.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>f(e.x0)+1)).attr("width",(e=>Math.max(0,f(e.x1)-f(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),g.select("rect").attr("x",(e=>f(e.x0)+1)).attr("width",(e=>Math.max(0,f(e.x1)-f(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>f(e.x0)+1+Math.max(0,f(e.x1)-f(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),g.select("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>f(e.x0)+1+Math.max(0,f(e.x1)-f(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),m.length){const[t,r]=f.domain(),[n,a]=f.range(),i=(a-n)/(+r-+t)*3600*1e3,o=30,l=de(f).ticks(ce.every(1)).tickFormat((e=>i>=o?me("%H:%M")(e):e.getHours()%(Math.floor(o/i)+1)?"":me("%H:%M")(e)));l.scale(f),e.select(".x-axis").attr("transform","translate(0,70)").call(l),e.select(".brush").call(p),h.brushFilter&&e.select(".brush").call(p.move,h.brushFilter.map(f))}else e.select(".x-axis").html(""),e.select(".brush").call(p),e.select(".brush").html("").call(p.move,null)}),[i,m]),S((()=>{n.current&&(h.brushFilter||ie(r.current).select(".brush").call(n.current.move,null))}),[h.brushFilter]),N.createElement("div",{ref:t},N.createElement("div",{style:{paddingLeft:10,paddingRight:10,display:"flex"}},ve.t("peopleCounting"),N.createElement("div",{style:{marginLeft:"auto"}},null===f?null:N.createElement(Ii,{label:ve.t("selected")},N.createElement("span",null,f)),null===f?null:"/",N.createElement(Ii,{label:ve.t("total")},N.createElement("span",null,m.length)))),N.createElement("svg",{className:"people-histogram",ref:r,width:i,height:l,viewBox:`0 0 ${i} 100`},N.createElement("g",{className:"bars"}),N.createElement("g",{className:"x-axis"}),N.createElement("g",{className:"brush"})))}));go.displayName="PeopleHistogram";const vo=e=>{const{children:t,innerProps:r,...n}=e,{Option:a}=U,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Ci,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},yo=H((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:a}=e.eventSchema;return N.createElement(N.Fragment,null,N.createElement(bo,{store:e}),N.createElement("div",{style:{zIndex:2}},N.createElement(B,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:a,placeholder:ve.t("selectObjectType"),value:r,components:{MultiValueLabel:ji,Option:vo},styles:{...Ui,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white"}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e}})),N.createElement($i,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?N.createElement(zi,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?N.createElement(go,null):null,N.createElement("div",{style:{flex:1}},N.createElement(lo,{store:e.eventsLoader,eventRenderer:({data:e,width:r,height:n})=>N.createElement(io,{data:e,cameraNameHidden:!0,onClick:t,width:r,height:n})})))}));yo.displayName="EventSearch";const wo=e=>{var t;const r=null!==(t=z(M))&&void 0!==t?t:I;return N.createElement(hi.Provider,{value:r},N.createElement(yo,{...e}))};var Eo;wo.displayName="EventSearch",(Eo={resources:{en:{translation:fe}}})&&Object.assign(ge,Eo),s(ve.init(ge));const xo=(e=I)=>{const t=new di(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export{xo as createEventSearchStore,wo as default};
1
+ import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as a,subDays as i,subHours as o}from"date-fns/esm";import l from"i18next";import{of as s,from as c,Observable as d,Subscription as u,throwError as h,EMPTY as m}from"rxjs";import{computed as f,makeObservable as p,observable as b,action as g,runInAction as v,reaction as y}from"mobx";import{mergeMap as E,catchError as w,switchMap as x,map as C,exhaustMap as j,distinctUntilChanged as O,share as T}from"rxjs/operators";import P from"earcut";import{subHours as M}from"date-fns";import{AppContext as _,app as L}from"@3deye-toolkit/core";import N,{useState as I,cloneElement as D,useRef as k,useEffect as S,useCallback as z,useContext as A,useLayoutEffect as F}from"react";import{useElementSize as B}from"@mantine/hooks";import{observer as R}from"mobx-react-lite";import H,{components as $}from"react-select";import U from"clsx";import V from"react-ink";import{useFloating as W,offset as G,flip as q,shift as Y,autoUpdate as Z,useInteractions as J,useHover as X,useRole as K,useDismiss as Q,FloatingPortal as ee,arrow as te,FloatingFocusManager as re}from"@floating-ui/react";import ne from"@seznam/compose-react-refs";import*as ae from"@sentry/browser";import ie from"react-datepicker";import{extent as oe,bin as le,max as se}from"d3-array";import{select as ce}from"d3-selection";import{scaleTime as de,scaleLinear as ue}from"d3-scale";import{timeHours as he,timeHour as me,timeMinute as fe}from"d3-time";import{axisBottom as pe}from"d3-axis";import{brushX as be}from"d3-brush";import{timeFormat as ge}from"d3-time-format";import ve from"resize-observer-polyfill";var ye={eventSearchRequestError:{peopleCounting:"Sorry, an error occured during event search. Couldn't fetch people counting data. Please try again later",heatmap:"Sorry, an error occured during event search. Couldn't fetch heatmap. Please try again later"},selectObjectType:"Select object type",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events",noEventsFound:"no events found",today:"today",yesterday:"yesterday",button:{ok:"Ok"},peopleCounting:"People Counting",selected:"selected",total:"total"};const Ee=new Map,we={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},xe=l.createInstance();function Ce(t,r){const n=Ee.get(xe.language);return e(t,r,{locale:n})}var je,Oe;function Te(e,t=!1){const r=f(e);return new d((e=>{const n=r.observe_((({newValue:t})=>e.next(t)),t);return()=>n()}))}!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(je||(je={})),function(e){e[e.Motion=0]="Motion",e[e.Tampering=1]="Tampering",e[e.PanTiltZoom=2]="PanTiltZoom",e[e.CrossLine=3]="CrossLine",e[e.Intrusion=4]="Intrusion",e[e.LicensePlate=5]="LicensePlate",e[e.FaceDetection=6]="FaceDetection",e[e.Audio=7]="Audio",e[e.Analytic=8]="Analytic",e[e.SpeedDetection=9]="SpeedDetection",e[e.PeopleCounter=10]="PeopleCounter",e[e.Temperature=11]="Temperature",e[e.PoS=12]="PoS",e[e.GPS=13]="GPS",e[e.DigitalInput=14]="DigitalInput",e[e.Normal=15]="Normal",e[e.Suspicious=16]="Suspicious",e[e.Loitering=17]="Loitering",e[e.Vandalism=18]="Vandalism",e[e.Trespass=19]="Trespass",e[e.Emergency=20]="Emergency",e[e.LifeInDanger=21]="LifeInDanger",e[e.ErroneousAlert=22]="ErroneousAlert",e[e.Misidentification=23]="Misidentification",e[e.Fire=24]="Fire",e[e.MedicalDuress=25]="MedicalDuress",e[e.HoldUp=26]="HoldUp",e[e.CheckIn=27]="CheckIn",e[e.CheckOut=28]="CheckOut",e[e.ClockIn=29]="ClockIn",e[e.ClockOut=30]="ClockOut",e[e.ParkingStart=31]="ParkingStart",e[e.ParkingEnd=32]="ParkingEnd",e[e.ParkingViolation=33]="ParkingViolation",e[e.GateAccess=34]="GateAccess",e[e.DoorAccess=35]="DoorAccess",e[e.TemperatureCheck=36]="TemperatureCheck",e[e.IDCheck=37]="IDCheck",e[e.PPECheck=38]="PPECheck",e[e.WelfareCheck=39]="WelfareCheck",e[e.Uncategorized=40]="Uncategorized",e[e.Unknown=999]="Unknown"}(Oe||(Oe={}));var Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var Me=function(){this.__data__=[],this.size=0};var _e=function(e,t){return e===t||e!=e&&t!=t},Le=_e;var Ne=function(e,t){for(var r=e.length;r--;)if(Le(e[r][0],t))return r;return-1},Ie=Ne,De=Array.prototype.splice;var ke=function(e){var t=this.__data__,r=Ie(t,e);return!(r<0)&&(r==t.length-1?t.pop():De.call(t,r,1),--this.size,!0)},Se=Ne;var ze=function(e){var t=this.__data__,r=Se(t,e);return r<0?void 0:t[r][1]},Ae=Ne;var Fe=Ne;var Be=function(e,t){var r=this.__data__,n=Fe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Re=Me,He=ke,$e=ze,Ue=function(e){return Ae(this.__data__,e)>-1},Ve=Be;function We(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}We.prototype.clear=Re,We.prototype.delete=He,We.prototype.get=$e,We.prototype.has=Ue,We.prototype.set=Ve;var Ge=We,qe=Ge;var Ye=function(){this.__data__=new qe,this.size=0};var Ze=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Je=function(e){return this.__data__.get(e)};var Xe=function(e){return this.__data__.has(e)},Ke="object"==typeof Pe&&Pe&&Pe.Object===Object&&Pe,Qe=Ke,et="object"==typeof self&&self&&self.Object===Object&&self,tt=Qe||et||Function("return this")(),rt=tt.Symbol,nt=rt,at=Object.prototype,it=at.hasOwnProperty,ot=at.toString,lt=nt?nt.toStringTag:void 0;var st=function(e){var t=it.call(e,lt),r=e[lt];try{e[lt]=void 0;var n=!0}catch(e){}var a=ot.call(e);return n&&(t?e[lt]=r:delete e[lt]),a},ct=Object.prototype.toString;var dt=st,ut=function(e){return ct.call(e)},ht=rt?rt.toStringTag:void 0;var mt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ht&&ht in Object(e)?dt(e):ut(e)};var ft=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},pt=mt,bt=ft;var gt,vt=function(e){if(!bt(e))return!1;var t=pt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},yt=tt["__core-js_shared__"],Et=(gt=/[^.]+$/.exec(yt&&yt.keys&&yt.keys.IE_PROTO||""))?"Symbol(src)_1."+gt:"";var wt=function(e){return!!Et&&Et in e},xt=Function.prototype.toString;var Ct=function(e){if(null!=e){try{return xt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},jt=vt,Ot=wt,Tt=ft,Pt=Ct,Mt=/^\[object .+?Constructor\]$/,_t=Function.prototype,Lt=Object.prototype,Nt=_t.toString,It=Lt.hasOwnProperty,Dt=RegExp("^"+Nt.call(It).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var kt=function(e){return!(!Tt(e)||Ot(e))&&(jt(e)?Dt:Mt).test(Pt(e))},St=function(e,t){return null==e?void 0:e[t]};var zt=function(e,t){var r=St(e,t);return kt(r)?r:void 0},At=zt(tt,"Map"),Ft=zt(Object,"create"),Bt=Ft;var Rt=function(){this.__data__=Bt?Bt(null):{},this.size=0};var Ht=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},$t=Ft,Ut=Object.prototype.hasOwnProperty;var Vt=function(e){var t=this.__data__;if($t){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ut.call(t,e)?t[e]:void 0},Wt=Ft,Gt=Object.prototype.hasOwnProperty;var qt=function(e){var t=this.__data__;return Wt?void 0!==t[e]:Gt.call(t,e)},Yt=Ft;var Zt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Yt&&void 0===t?"__lodash_hash_undefined__":t,this},Jt=Rt,Xt=Ht,Kt=Vt,Qt=qt,er=Zt;function tr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}tr.prototype.clear=Jt,tr.prototype.delete=Xt,tr.prototype.get=Kt,tr.prototype.has=Qt,tr.prototype.set=er;var rr=tr,nr=Ge,ar=At;var ir=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var or=function(e,t){var r=e.__data__;return ir(t)?r["string"==typeof t?"string":"hash"]:r.map},lr=or;var sr=or;var cr=or;var dr=or;var ur=function(e,t){var r=dr(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},hr=function(){this.size=0,this.__data__={hash:new rr,map:new(ar||nr),string:new rr}},mr=function(e){var t=lr(this,e).delete(e);return this.size-=t?1:0,t},fr=function(e){return sr(this,e).get(e)},pr=function(e){return cr(this,e).has(e)},br=ur;function gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}gr.prototype.clear=hr,gr.prototype.delete=mr,gr.prototype.get=fr,gr.prototype.has=pr,gr.prototype.set=br;var vr=gr,yr=Ge,Er=At,wr=vr;var xr=function(e,t){var r=this.__data__;if(r instanceof yr){var n=r.__data__;if(!Er||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new wr(n)}return r.set(e,t),this.size=r.size,this},Cr=Ge,jr=Ye,Or=Ze,Tr=Je,Pr=Xe,Mr=xr;function _r(e){var t=this.__data__=new Cr(e);this.size=t.size}_r.prototype.clear=jr,_r.prototype.delete=Or,_r.prototype.get=Tr,_r.prototype.has=Pr,_r.prototype.set=Mr;var Lr=_r;var Nr=vr,Ir=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Dr=function(e){return this.__data__.has(e)};function kr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Nr;++t<r;)this.add(e[t])}kr.prototype.add=kr.prototype.push=Ir,kr.prototype.has=Dr;var Sr=kr,zr=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},Ar=function(e,t){return e.has(t)};var Fr=function(e,t,r,n,a,i){var o=1&r,l=e.length,s=t.length;if(l!=s&&!(o&&s>l))return!1;var c=i.get(e),d=i.get(t);if(c&&d)return c==t&&d==e;var u=-1,h=!0,m=2&r?new Sr:void 0;for(i.set(e,t),i.set(t,e);++u<l;){var f=e[u],p=t[u];if(n)var b=o?n(p,f,u,t,e,i):n(f,p,u,e,t,i);if(void 0!==b){if(b)continue;h=!1;break}if(m){if(!zr(t,(function(e,t){if(!Ar(m,t)&&(f===e||a(f,e,r,n,i)))return m.push(t)}))){h=!1;break}}else if(f!==p&&!a(f,p,r,n,i)){h=!1;break}}return i.delete(e),i.delete(t),h};var Br=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Rr=tt.Uint8Array,Hr=_e,$r=Fr,Ur=Br,Vr=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Wr=rt?rt.prototype:void 0,Gr=Wr?Wr.valueOf:void 0;var qr=function(e,t,r,n,a,i,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Rr(e),new Rr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Hr(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=Ur;case"[object Set]":var s=1&n;if(l||(l=Vr),e.size!=t.size&&!s)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var d=$r(l(e),l(t),n,a,i,o);return o.delete(e),d;case"[object Symbol]":if(Gr)return Gr.call(e)==Gr.call(t)}return!1};var Yr=function(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e},Zr=Array.isArray,Jr=Yr,Xr=Zr;var Kr=function(e,t,r){var n=t(e);return Xr(e)?n:Jr(n,r(e))};var Qr=function(e,t){for(var r=-1,n=null==e?0:e.length,a=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[a++]=o)}return i},en=function(){return[]},tn=Object.prototype.propertyIsEnumerable,rn=Object.getOwnPropertySymbols,nn=rn?function(e){return null==e?[]:(e=Object(e),Qr(rn(e),(function(t){return tn.call(e,t)})))}:en;var an=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var on=function(e){return null!=e&&"object"==typeof e},ln=mt,sn=on;var cn=function(e){return sn(e)&&"[object Arguments]"==ln(e)},dn=on,un=Object.prototype,hn=un.hasOwnProperty,mn=un.propertyIsEnumerable,fn=cn(function(){return arguments}())?cn:function(e){return dn(e)&&hn.call(e,"callee")&&!mn.call(e,"callee")},pn={exports:{}};var bn=function(){return!1};!function(e,t){var r=tt,n=bn,a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,o=i&&i.exports===a?r.Buffer:void 0,l=(o?o.isBuffer:void 0)||n;e.exports=l}(pn,pn.exports);var gn=/^(?:0|[1-9]\d*)$/;var vn=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&gn.test(e))&&e>-1&&e%1==0&&e<t};var yn=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},En=mt,wn=yn,xn=on,Cn={};Cn["[object Float32Array]"]=Cn["[object Float64Array]"]=Cn["[object Int8Array]"]=Cn["[object Int16Array]"]=Cn["[object Int32Array]"]=Cn["[object Uint8Array]"]=Cn["[object Uint8ClampedArray]"]=Cn["[object Uint16Array]"]=Cn["[object Uint32Array]"]=!0,Cn["[object Arguments]"]=Cn["[object Array]"]=Cn["[object ArrayBuffer]"]=Cn["[object Boolean]"]=Cn["[object DataView]"]=Cn["[object Date]"]=Cn["[object Error]"]=Cn["[object Function]"]=Cn["[object Map]"]=Cn["[object Number]"]=Cn["[object Object]"]=Cn["[object RegExp]"]=Cn["[object Set]"]=Cn["[object String]"]=Cn["[object WeakMap]"]=!1;var jn=function(e){return xn(e)&&wn(e.length)&&!!Cn[En(e)]};var On=function(e){return function(t){return e(t)}},Tn={exports:{}};!function(e,t){var r=Ke,n=t&&!t.nodeType&&t,a=n&&e&&!e.nodeType&&e,i=a&&a.exports===n&&r.process,o=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o}(Tn,Tn.exports);var Pn=jn,Mn=On,_n=Tn.exports,Ln=_n&&_n.isTypedArray,Nn=Ln?Mn(Ln):Pn,In=an,Dn=fn,kn=Zr,Sn=pn.exports,zn=vn,An=Nn,Fn=Object.prototype.hasOwnProperty;var Bn=function(e,t){var r=kn(e),n=!r&&Dn(e),a=!r&&!n&&Sn(e),i=!r&&!n&&!a&&An(e),o=r||n||a||i,l=o?In(e.length,String):[],s=l.length;for(var c in e)!t&&!Fn.call(e,c)||o&&("length"==c||a&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||zn(c,s))||l.push(c);return l},Rn=Object.prototype;var Hn=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Rn)};var $n=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Un=Hn,Vn=$n,Wn=Object.prototype.hasOwnProperty;var Gn=vt,qn=yn;var Yn=function(e){return null!=e&&qn(e.length)&&!Gn(e)},Zn=Bn,Jn=function(e){if(!Un(e))return Vn(e);var t=[];for(var r in Object(e))Wn.call(e,r)&&"constructor"!=r&&t.push(r);return t},Xn=Yn;var Kn=Kr,Qn=nn,ea=function(e){return Xn(e)?Zn(e):Jn(e)};var ta=function(e){return Kn(e,ea,Qn)},ra=Object.prototype.hasOwnProperty;var na=function(e,t,r,n,a,i){var o=1&r,l=ta(e),s=l.length;if(s!=ta(t).length&&!o)return!1;for(var c=s;c--;){var d=l[c];if(!(o?d in t:ra.call(t,d)))return!1}var u=i.get(e),h=i.get(t);if(u&&h)return u==t&&h==e;var m=!0;i.set(e,t),i.set(t,e);for(var f=o;++c<s;){var p=e[d=l[c]],b=t[d];if(n)var g=o?n(b,p,d,t,e,i):n(p,b,d,e,t,i);if(!(void 0===g?p===b||a(p,b,r,n,i):g)){m=!1;break}f||(f="constructor"==d)}if(m&&!f){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(m=!1)}return i.delete(e),i.delete(t),m},aa=zt(tt,"DataView"),ia=At,oa=zt(tt,"Promise"),la=zt(tt,"Set"),sa=zt(tt,"WeakMap"),ca=mt,da=Ct,ua=da(aa),ha=da(ia),ma=da(oa),fa=da(la),pa=da(sa),ba=ca;(aa&&"[object DataView]"!=ba(new aa(new ArrayBuffer(1)))||ia&&"[object Map]"!=ba(new ia)||oa&&"[object Promise]"!=ba(oa.resolve())||la&&"[object Set]"!=ba(new la)||sa&&"[object WeakMap]"!=ba(new sa))&&(ba=function(e){var t=ca(e),r="[object Object]"==t?e.constructor:void 0,n=r?da(r):"";if(n)switch(n){case ua:return"[object DataView]";case ha:return"[object Map]";case ma:return"[object Promise]";case fa:return"[object Set]";case pa:return"[object WeakMap]"}return t});var ga=Lr,va=Fr,ya=qr,Ea=na,wa=ba,xa=Zr,Ca=pn.exports,ja=Nn,Oa="[object Object]",Ta=Object.prototype.hasOwnProperty;var Pa=function(e,t,r,n,a,i){var o=xa(e),l=xa(t),s=o?"[object Array]":wa(e),c=l?"[object Array]":wa(t),d=(s="[object Arguments]"==s?Oa:s)==Oa,u=(c="[object Arguments]"==c?Oa:c)==Oa,h=s==c;if(h&&Ca(e)){if(!Ca(t))return!1;o=!0,d=!1}if(h&&!d)return i||(i=new ga),o||ja(e)?va(e,t,r,n,a,i):ya(e,t,s,r,n,a,i);if(!(1&r)){var m=d&&Ta.call(e,"__wrapped__"),f=u&&Ta.call(t,"__wrapped__");if(m||f){var p=m?e.value():e,b=f?t.value():t;return i||(i=new ga),a(p,b,r,n,i)}}return!!h&&(i||(i=new ga),Ea(e,t,r,n,a,i))},Ma=on;var _a=function e(t,r,n,a,i){return t===r||(null==t||null==r||!Ma(t)&&!Ma(r)?t!=t&&r!=r:Pa(t,r,n,a,e,i))},La=_a;var Na=function(e,t){return La(e,t)};class Ia{constructor(){Object.defineProperty(this,"api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]})}initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}var Da=_e,ka=Yn,Sa=vn,za=ft;var Aa=/\s/;var Fa=function(e){for(var t=e.length;t--&&Aa.test(e.charAt(t)););return t},Ba=/^\s+/;var Ra=mt,Ha=on;var $a=function(e){return e?e.slice(0,Fa(e)+1).replace(Ba,""):e},Ua=ft,Va=function(e){return"symbol"==typeof e||Ha(e)&&"[object Symbol]"==Ra(e)},Wa=/^[-+]0x[0-9a-f]+$/i,Ga=/^0b[01]+$/i,qa=/^0o[0-7]+$/i,Ya=parseInt;var Za=function(e){if("number"==typeof e)return e;if(Va(e))return NaN;if(Ua(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ua(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$a(e);var r=Ga.test(e);return r||qa.test(e)?Ya(e.slice(2),r?2:8):Wa.test(e)?NaN:+e};var Ja=function(e){return e?Infinity===(e=Za(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var Xa=function(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(r=r>a?a:r)<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n<a;)i[n]=e[n+t];return i},Ka=function(e,t,r){if(!za(r))return!1;var n=typeof t;return!!("number"==n?ka(r)&&Sa(t,r.length):"string"==n&&t in r)&&Da(r[t],e)},Qa=function(e){var t=Ja(e),r=t%1;return t==t?r?t-r:t:0},ei=Math.ceil,ti=Math.max;var ri=function(e,t,r){t=(r?Ka(e,t,r):void 0===t)?1:ti(Qa(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var a=0,i=0,o=Array(ei(n/t));a<n;)o[i++]=Xa(e,a,a+=t);return o};const ni=([e,t],[r,n],[a,i])=>{const o=(n-t)*(a-r)-(r-e)*(i-n);return 0===o?0:o>0?1:2},ai=([e,t],[r,n],[a,i])=>r<=Math.max(e,a)&&r>=Math.min(e,a)&&n<=Math.max(t,i)&&n>=Math.min(t,i),ii=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),oi=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,a=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=a<0)return!1;const i=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return i<0?n<=0&&n+a>=i:n>=0&&n+a<=i},li=(e,t)=>{if(ii(t.x1,t.y1,e))return!0;if(ii(t.x2,t.y2,e))return!0;if(ii(t.x3,t.y3,e))return!0;if(oi(e.x,e.y,t))return!0;if(oi(e.x+e.width,e.y,t))return!0;if(oi(e.x+e.width,e.y+e.height,t))return!0;if(oi(e.x,e.y+e.height,t))return!0;const r=[[[e.x,e.y],[e.x+e.width,e.y]],[[e.x+e.width,e.y],[e.x+e.width,e.y+e.height]],[[e.x,e.y+e.height],[e.x+e.width,e.y+e.height]],[[e.x,e.y],[e.x,e.y+e.height]]];return!![[[t.x1,t.y1],[t.x2,t.y2]],[[t.x1,t.y1],[t.x3,t.y3]]].some((e=>r.some((t=>(([e,t],[r,n])=>{const a=ni(e,t,r),i=ni(e,t,n),o=ni(r,n,e),l=ni(r,n,t);return a!==i&&o!==l||!(0!==a||!ai(e,r,t))||!(0!==i||!ai(e,n,t))||!(0!==o||!ai(r,e,n))||!(0!==l||!ai(r,t,n))})(t,e)))))},si=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return ri(P(r.flat()),3).some((r=>li(t,{x1:e[r[0]].x,y1:e[r[0]].y,x2:e[r[1]].x,y2:e[r[1]].y,x3:e[r[2]].x,y3:e[r[2]].y})))},ci=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class di{constructor(e){if(Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumbnailUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"faces",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"instant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),p(this,{id:f,startTime:f,endTime:f,acknowledged:f,isLive:f,raw:b.ref}),this.raw=e,this.type=e.eventType,this.cameraId=e.sensorId,("Analytic"===this.type||"FaceDetection"===this.type)&&e.data)try{const t=JSON.parse(e.data);t.FoundObjects&&(this.type="Analytic",this.detectedObjects=t.FoundObjects),t.Faces&&(this.type="FaceDetection",this.faces=t.Faces),this.thumbnailUrl=t.ThumbnailUrl}catch{console.warn("invalid data",e.data),this.type="Motion"}this.instant=ci.has(this.type),this.detectedObjects||(this.detectedObjects=[])}get id(){return this.raw.id}get startTime(){return new Date(this.raw.startTime)}get endTime(){return new Date(this.raw.endTime)}get isLive(){return!ci.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class ui extends Ia{constructor(e,t="events"){super(),Object.defineProperty(this,"eventsStore",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"liveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"updateTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pageInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"loading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"loadMoreTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retryTrigger",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"sortDirection",{enumerable:!0,configurable:!0,writable:!0,value:"DESC"}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"to",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameras",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"detectedObjects",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"eventTypes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"loadingInited",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"flushUpdates",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.data=[...this.pendingData,...this.data],this.pendingData=[]}}),Object.defineProperty(this,"setLiveUpdateMode",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.liveUpdateMode=e}}),Object.defineProperty(this,"load",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.loadingInited||(this.loadingInited=!0,this.initDataLoading(),this.initLiveUpdates())}}),Object.defineProperty(this,"reload",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error&&(this.retryTrigger=+!this.retryTrigger)}}),Object.defineProperty(this,"loadMore",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.error=null,this.loadMoreTrigger=+!this.loadMoreTrigger}}),Object.defineProperty(this,"requestData",{enumerable:!0,configurable:!0,writable:!0,value:({sortDirection:e,from:t,to:r,filter:n,pageInfo:a,cameras:i,regions:o})=>{var l;return this.api.cameras.GetSensorEventsPage({sensorIds:i,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==a?void 0:a.nextPageToken},n,null!==(l=null==o?void 0:o.map(this.regionToWktPolygon))&&void 0!==l?l:[]).pipe(E((e=>e.success?s({events:e.resultItems,pageInfo:e.pageInfo}):h((()=>e.error)))),w((e=>(console.error(e),this.error=e,s({events:[],pageInfo:null})))))}}),Object.defineProperty(this,"toObjects",{enumerable:!0,configurable:!0,writable:!0,value:e=>"events"===this.mode?[{data:e,objectIdx:-1}]:e.detectedObjects.map(((e,t)=>{var r,n;return this.detectedObjects.length&&!this.detectedObjects.includes(e.Type)||this.colors.size&&!(null===(r=e.Colors)||void 0===r?void 0:r.some((e=>this.colors.has(e.Color))))||null!==this.probabilityThreshold&&e.Probability<this.probabilityThreshold||(null===(n=this.regions)||void 0===n?void 0:n.length)&&!this.regions.some((t=>si(t,this.boxToAabb(e.Box))))?-1:t})).filter((e=>-1!==e)).map((t=>({data:e,objectIdx:t})))}),p(this,{data:b.ref,cameras:b.struct,detectedObjects:b.struct,from:b,to:b,sortDirection:b,probabilityThreshold:b,pendingData:b.ref,liveUpdateMode:b,setLiveUpdateMode:g,updateTrigger:b,colors:b.ref,flushUpdates:g,pageInfo:b.ref,isLive:f,loading:b,loadMoreTrigger:b,retryTrigger:b,error:b.ref,loadMore:g,filterJson:f})}get isLive(){return"DESC"===this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}initDataLoading(){const e=Te((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,regions:this.regions})),!0);this.disposables.push(e.pipe(x((e=>Te((()=>this.retryTrigger),!0).pipe(C((()=>e))))),x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a,regions:i})=>(v((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[],this.pendingData=[]})),this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,regions:i}))))).subscribe((({events:e,pageInfo:t})=>{v((()=>{var r,n,a;if(!t)return;const i=e.map(hi);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>Oe[e])),from:null!==(n=null===(r=i[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:M(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(a=this.probabilityThreshold)&&void 0!==a?a:void 0}),i).flatMap(this.toObjects):this.data=i.flatMap(this.toObjects),this.eventsStore.add(i),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(x((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:a})=>Te((()=>this.loadMoreTrigger)).pipe(j((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:a,pageInfo:this.pageInfo,regions:this.regions}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(hi);this.eventsStore.add(r),v((()=>{this.data=this.data.concat(r.flatMap(this.toObjects)),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(Te((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?Te((()=>this.eventsStore.recentAdditions)):m))).subscribe((e=>{if(this.loading)return;if(!this.pageInfo&&this.error)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&v((()=>{this.data=[...t.flatMap(this.toObjects),...this.data]}))}))),this.disposables.push(Te((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(x((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?Te((()=>this.eventsStore.recentAdditions)):(this.pendingData&&v((()=>this.pendingData=[])),m)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&v((()=>{this.pendingData=[...t.flatMap(this.toObjects),...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;if(r&&(t=t.filter((e=>e.startTime>=r))),n&&(t=t.filter((e=>e.startTime<=n))),this.cameras.length&&(t=t.filter((e=>this.cameras.includes(e.cameraId)))),this.eventTypes.length){const e=this.eventTypes.map((e=>Oe[e]));t=t.filter((t=>e.includes(t.type)))}return this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{var t;const{probabilityThreshold:r}=this;return!(null!==r&&e.Probability<r)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&(null===(t=e.Colors)||void 0===t?void 0:t.some((e=>this.colors.has(e.Color)))):this.detectedObjects.includes(e.Type))}))))),t}boxToAabb(e){return{x:e.Left,y:e.Top,width:e.Right-e.Left,height:e.Bottom-e.Top}}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}uniquelyConcat(e,t){if(!e.length)return t.concat();if(!t.length)return e.concat();const r=e=>[e.id,e];return Array.from(new Map([...e.map(r),...t.map(r)]).values())}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}function hi(e){return new di(e)}const mi={Top:0,Left:0,Bottom:1,Right:1};class fi extends Ia{constructor(e,n,a,i){super(),Object.defineProperty(this,"eventSchema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"notification",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"analyticsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposeReactionToCamera",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"peopleCountingDataLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapMode",{enumerable:!0,configurable:!0,writable:!0,value:"selection"}),Object.defineProperty(this,"heatmapLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"heatmap",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"peopleCountingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"brushFilter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setDate",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.date=e,this.brushFilter=null}}),Object.defineProperty(this,"setFilters",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.filters=e}}),Object.defineProperty(this,"getProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e}}),Object.defineProperty(this,"setBrushFilter",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.brushFilter=e}}),Object.defineProperty(this,"setParams",{enumerable:!0,configurable:!0,writable:!0,value:({cameraId:e,box:t})=>{this.cameraId=e,this.regions=[[{x:t.Left,y:t.Top},{x:t.Right,y:t.Top},{x:t.Right,y:t.Bottom},{x:t.Left,y:t.Bottom}]],this.date||(this.date=new Date)}}),Object.defineProperty(this,"openForPlayer",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e}}),Object.defineProperty(this,"searchFullFrame",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e,this.clear(),this.peopleCountingData=[],this.date||(this.date=new Date)}}),Object.defineProperty(this,"setRegions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.regions=e.length?e:null}}),Object.defineProperty(this,"setHeatmapMode",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.heatmapMode=e}}),Object.defineProperty(this,"toggleColor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t}}),Object.defineProperty(this,"clearColors",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.colors=new Set}}),Object.defineProperty(this,"clear",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.date=null,this.regions=null,this.brushFilter=null,this.heatmap=null,this.data=[],this.peopleCountingData=[]}}),Object.defineProperty(this,"initDataFetching",{enumerable:!0,configurable:!0,writable:!0,value:()=>{const e=Te((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(O(Na),T());this.disposables.push(Te((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(O(Na),T()).subscribe((e=>{v((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),a=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=a;const{brushFilter:i}=e;i&&([this.eventsLoader.from,this.eventsLoader.to]=i),this.eventsLoader.regions=[...e.regions||[]],this.eventsLoader.cameras=[e.cameraId],this.eventsLoader.detectedObjects=e.filters.map((e=>e.id)),this.eventsLoader.eventTypes=[Oe.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),a=r(e.date),i=e.regions?this.boxRegions(e.regions):mi;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,a,i).pipe(E((e=>e.success?s(e.resultItems):h((()=>e.error))))).pipe(w((e=>(this.notification.error(xe.t("eventSearchRequestError.peopleCounting")),console.error(e),s([])))))}))).subscribe((e=>{v((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(Te((()=>({date:this.date,cameraId:this.cameraId}))).pipe(O(Na),x((e=>{if(!e.date||!e.cameraId)return m;v((()=>{this.heatmapLoading=!0}));const a=t(e.date),i=r(e.date);return n.fetchHeatmaps(e.cameraId,a,i,1).pipe(C((e=>e[0]||null))).pipe(w((e=>(this.notification.error(xe.t("eventSearchRequestError.heatmap")),console.error(e),s(null)))))}))).subscribe((e=>{v((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),p(this,{cameraId:b,date:b,regions:b.ref,filters:b.ref,colors:b.ref,peopleCountingDataLoading:b,heatmapMode:b,heatmapLoading:b,data:b.ref,heatmap:b.ref,peopleCountingData:b.ref,probabilityThreshold:b,brushFilter:b.ref,params:f,filteredData:f,filteredPeopleCountingData:f,setDate:g,setFilters:g,setBrushFilter:g,setParams:g,openForPlayer:g,searchFullFrame:g,setRegions:g,setHeatmapMode:g,toggleColor:g,clearColors:g,clear:g}),this.analyticsEnabled=Boolean(i),this.eventsLoader=new ui(n,"objects"),this.eventsLoader.liveUpdateMode="disabled",this.initDataFetching()}get params(){return this.eventSchema.schemaDescription.filter((e=>"filter"===e.parameterType))}get filteredData(){let e=[];const t=this.filters.map((e=>e.id));t.length?(e=this.data.filter((e=>e.detectedObjects.some((e=>t.includes(e.Type)&&e.Probability>=this.probabilityThreshold)))),this.colors.size&&(e=e.filter((e=>e.detectedObjects.some((e=>{var t;return null===(t=e.Colors)||void 0===t?void 0:t.some((e=>this.colors.has(e.Color)))})))))):e=this.data.filter((e=>e.detectedObjects.some((e=>e.Probability>=this.probabilityThreshold))));const{brushFilter:r}=this;r&&(e=e.filter((e=>e.startTime>=r[0]&&e.startTime<=r[1]&&e.detectedObjects.some((e=>"Person"===e.Type)))));const{regions:n}=this;return n&&n.length&&(e=e.filter((e=>e.detectedObjects.some((e=>{var r;return(!t.length||t.includes(e.Type))&&(!this.colors.size||(null===(r=e.Colors)||void 0===r?void 0:r.some((e=>this.colors.has(e.Color)))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>si(t,{x:e.Box.Left,y:e.Box.Top,width:e.Box.Right-e.Box.Left,height:e.Box.Bottom-e.Box.Top})))}))))),e}get filteredPeopleCountingData(){const{regions:e}=this;return(null==e?void 0:e.length)?this.peopleCountingData.filter((t=>e.some((e=>si(e,{x:t.Left,y:t.Top,width:t.Right-t.Left,height:t.Bottom-t.Top}))))):this.peopleCountingData}boxRegions(e){const t=e.flatMap((e=>e.map((({x:e})=>e)))),r=e.flatMap((e=>e.map((({y:e})=>e))));return{Left:Math.min(...t),Right:Math.max(...t),Top:Math.min(...r),Bottom:Math.max(...r)}}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposeReactionToCamera&&this.disposeReactionToCamera(),this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}const pi=N.createContext(null);function bi(e){return N.forwardRef(((t,r)=>{const{size:n=24,color:a="currentColor",className:i,...o}=t,l=e.viewBox||"0 0 24 24",s=e.svg;return N.createElement("svg",{ref:r,preserveAspectRatio:"xMinYMin",className:U("icon",i),width:n,fill:a,viewBox:l,...o},s)}))}const gi=bi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M10.13 3.245a1.994 1.994 0 0 0-1.542.992l-5.491 9.53c-.55.954-.23 2.178.723 2.728l8.66 5c.953.55 2.174.216 2.724-.737l5.509-9.521c.335-.58.349-1.265.087-1.832L17.65 2.54z"}))});gi.displayName="LabelIcon";const vi=bi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"}))});vi.displayName="CameraIcon";const yi=bi({viewBox:"0 0 24 24",svg:N.createElement("path",{d:"M17,6h-2V3c0-0.55-0.45-1-1-1h-4C9.45,2,9,2.45,9,3v3H7C5.9,6,5,6.9,5,8v11c0,1.1,0.9,2,2,2c0,0.55,0.45,1,1,1 c0.55,0,1-0.45,1-1h6c0,0.55,0.45,1,1,1c0.55,0,1-0.45,1-1c1.1,0,2-0.9,2-2V8C19,6.9,18.1,6,17,6z M9.5,18H8V9h1.5V18z M12.75,18 h-1.5V9h1.5V18z M13.5,6h-3V3.5h3V6z M16,18h-1.5V9H16V18z"})});yi.displayName="LuggageIcon";const Ei=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"}))});Ei.displayName="CarIcon";const wi=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.65 2.62.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"}))});wi.displayName="BoatIcon";const xi=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M11.74 13.36L14.14 7.71L13.06 5.5H10.5V4H14L14.73 5.5H21.75L20.75 9H16.44L17.11 10.37C17.69 10.13 18.33 10 19 10C21.76 10 24 12.24 24 15C24 17.76 21.76 20 19 20C16.24 20 14 17.76 14 15C14 13.45 14.71 12.06 15.82 11.15L15 9.5L12.25 16H9.9C9.44 18.28 7.42 20 5 20C2.24 20 0 17.76 0 15C0 12.24 2.24 10 5 10C7.59 10 9.72 11.97 10 14.5H10.58L8.3 9H7.5C7.09 9 6.75 8.66 6.75 8.25C6.75 7.84 7.09 7.5 7.5 7.5H10.25C10.66 7.5 11 7.84 11 8.25C11 8.66 10.66 9 10.25 9H9.97L11.74 13.36M5 11.5C3.07 11.5 1.5 13.07 1.5 15C1.5 16.93 3.07 18.5 5 18.5C6.59 18.5 7.93 17.45 8.36 16H4V14.5H8.47C8.22 12.8 6.76 11.5 5 11.5M19 11.5C18.57 11.5 18.15 11.58 17.77 11.72L19.7 15.68L18.35 16.34L16.5 12.55C15.88 13.18 15.5 14.05 15.5 15C15.5 16.93 17.07 18.5 19 18.5C20.93 18.5 22.5 16.93 22.5 15C22.5 13.07 20.93 11.5 19 11.5Z"}))});xi.displayName="BicycleIcon";const Ci=bi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"}))});Ci.displayName="DirectionsWalkIcon";const ji=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),N.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),N.createElement("path",{d:"M17.34 14.86c-.87-1.02-1.6-1.89-2.48-2.91-.46-.54-1.05-1.08-1.75-1.32-.11-.04-.22-.07-.33-.09-.25-.04-.52-.04-.78-.04s-.53 0-.79.05c-.11.02-.22.05-.33.09-.7.24-1.28.78-1.75 1.32-.87 1.02-1.6 1.89-2.48 2.91-1.31 1.31-2.92 2.76-2.62 4.79.29 1.02 1.02 2.03 2.33 2.32.73.15 3.06-.44 5.54-.44h.18c2.48 0 4.81.58 5.54.44 1.31-.29 2.04-1.31 2.33-2.32.31-2.04-1.3-3.49-2.61-4.8z"}))});ji.displayName="PetsIcon";const Oi=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M4 4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H5Zm0 2h4v2h8V6h4v12H4Z"}),N.createElement("path",{d:"M9.923 10 8.43 12.433 10 15h-.8L8 13.036 6.8 15H6l1.602-2.616L6.136 10h.8l1.093 1.781L9.123 10Z"}),N.createElement("path",{d:"m13.709 10-1.492 2.433L13.787 15h-.8l-1.2-1.964L10.585 15h-.8l1.603-2.616L9.923 10h.799l1.094 1.781L12.91 10Z"}),N.createElement("path",{d:"m17.709 10-1.492 2.433L17.787 15h-.8l-1.2-1.964L14.585 15h-.8l1.603-2.616L13.923 10h.799l1.094 1.781L16.91 10Z"}))});Oi.displayName="LicensePlateIcon";const Ti=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?N.createElement(vi,{size:t}):"Luggage"===e.id?N.createElement(yi,{size:t}):"Car"===e.id?N.createElement(Ei,{size:t}):"Person"===e.id?N.createElement(Ci,{size:t}):"Bicycle"===e.id?N.createElement(xi,{size:t}):"Boat"===e.id?N.createElement(wi,{size:t}):"Animal"===e.id?N.createElement(ji,{size:t}):"LicensePlate"===e.id?N.createElement(Oi,{size:t}):N.createElement(gi,{size:t})},Pi=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:a}=$,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Ti,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},Mi={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},_i={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},Li={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},Ni={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Ii={50:"#fffde7",100:"#fff9c4",200:"#fff59d",300:"#fff176",400:"#ffee58",500:"#ffeb3b",600:"#fdd835",700:"#fbc02d",800:"#f9a825",900:"#f57f17",A100:"#ffff8d",A200:"#ffff00",A400:"#ffea00",A700:"#ffd600"},Di=({children:e,label:t,placement:r="bottom"})=>{const[n,a]=I(!1),{x:i,y:o,reference:l,floating:s,strategy:c,context:d}=W({placement:r,open:n,onOpenChange:a,middleware:[G(5),q(),Y({padding:8})],whileElementsMounted:(e,t,r)=>Z(e,t,r,{animationFrame:!0})}),{getReferenceProps:u,getFloatingProps:h}=J([X(d),K(d,{role:"tooltip"}),Q(d,{referencePress:!0})]);return N.createElement(N.Fragment,null,D(e,u({ref:ne(l,e.ref),...e.props})),N.createElement(ee,{id:"x-3deye-floating-ui-root"},n&&N.createElement("div",{...h({ref:s,className:"x-3deye-tooltip",style:{position:c,top:null!=o?o:0,left:null!=i?i:0}})},t)))};class ki extends N.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:a,type:i,title:o,placement:l,...s}=this.props,c=U(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},a?`x-3deye-button--${a}`:void 0),d=N.createElement("button",{ref:e,className:c,type:i||"button",...s},t,s.disabled?null:N.createElement(V,null));return o?N.createElement(Di,{label:o,placement:l},d):d}}const Si=N.forwardRef(((e,t)=>N.createElement(ki,{forwardedRef:t,...e}))),zi=bi({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});zi.displayName="CloseIcon";const Ai=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),N.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});Ai.displayName="DoneIcon";const Fi=[{color:Ni[500],name:"red",highlightColor:Ni[100]},{color:_i[500],name:"green",highlightColor:_i[100]},{color:Mi[500],name:"blue",highlightColor:Mi[100]},{color:Ii[500],name:"yellow",highlightColor:Ii[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:Li[500],name:"dimgrey",highlightColor:Li[100]}],Bi=R((({value:e,clear:t,toggle:r})=>N.createElement("div",{className:"color-selector"},N.createElement("div",null,"COLOR"),N.createElement("div",{className:"color-selector__items"},Fi.map((({color:t,highlightColor:n,name:a})=>N.createElement("button",{key:a,className:U("color-selector__item",{selected:e.has(a)}),style:{backgroundColor:t},onClick:r.bind(null,a)},N.createElement(Ai,{color:n,size:20})))),N.createElement(Si,{className:"color-selector__clear",disabled:!e.size,onClick:t},N.createElement(zi,{size:20}))))));Bi.displayName="ColorSelector";const Ri=(e,t,r)=>Math.min(Math.max(e,t),r);/Mac|iPod|iPhone|iPad/.test(window.navigator.platform);const Hi=e=>Math.round(e),$i=N.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:a=!1,labelFormat:i=(e=>`${e}`),style:o},l)=>{const s=k(null),c=k(null),[d,u]=I(!1),[h,m]=I(e);S((()=>{if(!d)return;const e=s.current;if(!e)return;let a=0,i=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(a=Ri(e-o.x,0,o.width),l=a/o.width*100,c.current.style.transform=`translateX(${a}px)`):(i=o.height-Ri(r-o.y,0,o.height),l=i/o.height*100,c.current.style.transform=`translateY(${-i}px)`),m(l),null==t||t(Hi(l))},h=({clientX:e,clientY:a})=>{if(u(!1),!c.current)return;const i="horizontal"===n?Ri(e-o.x,0,o.width)/o.width*100:100*(1-Ri(a-o.y,0,o.height)/o.height);c.current.style.transform="",m(i),null==t||t(Hi(i)),null==r||r(Hi(i))},f=()=>{if(u(!1),!c.current)return;const e="horizontal"===n?a/o.width*100:i/o.height*100;c.current.style.transform="",null==t||t(Hi(e)),null==r||r(Hi(e))};return e.addEventListener("pointercancel",f),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",f),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[d,n,t]);const f=z((({clientX:e,clientY:r,pointerId:i})=>{if(!s.current||a)return;u(!0),s.current.setPointerCapture(i);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=Ri(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-Ri(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}m(l),null==t||t(Hi(l))}),[n,a]),p=z((n=>{if(a)return;let i=null;"ArrowLeft"===n.code?i=Math.max(e-1,0):"ArrowRight"===n.code?i=Math.min(e+1,100):"ArrowDown"===n.code?i=Math.max(e-1,0):"ArrowUp"===n.code&&(i=Math.min(e+1,100)),null!==i&&(n.stopPropagation(),n.preventDefault(),null==t||t(i),null==r||r(i))}),[e,t,r,n,a]);return N.createElement("div",{ref:ne(l,s),tabIndex:0,onKeyDown:p,className:U("x-3deye-slider",n,{disabled:a}),onPointerDown:f,style:o},N.createElement("div",{className:"x-3deye-slider__track"},N.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?h:e}%`:void 0,height:"vertical"===n?`${d?h:e}%`:void 0}})),N.createElement("div",{ref:c,className:U("x-3deye-slider__thumb",{active:d}),style:{touchAction:"none",userSelect:"none",position:"absolute",left:"horizontal"===n?d?0:`${e}%`:"auto",bottom:"vertical"===n?d?0:`${e}%`:"auto"}},N.createElement("div",{className:"x-3deye-slider__label "+(d?"open":"")},i(d?Hi(h):e))))}));$i.displayName="Slider";const Ui=R((({getter:e,setter:t})=>{const[r,n]=I(0),a=k(null),i=Math.floor(100*e());return S((()=>y(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),N.createElement("div",{ref:a,style:{paddingLeft:8,paddingRight:8,marginTop:5}},N.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},N.createElement("div",null,"CONFIDENCE"),N.createElement("div",{style:{fontSize:"1.1em"}},i,"%")),N.createElement("div",{style:{padding:"0 10px"}},N.createElement($i,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));Ui.displayName="ProbabilitySlider";var Vi,Wi=(Vi=8,{container:e=>({...e,padding:Vi}),control:(e,t)=>({...e,borderRadius:8,backgroundColor:t.isFocused?"white":"rgba(0, 0, 0, 0.5)",border:"none",boxShadow:null,"&:hover":{borderColor:null}}),menu:e=>({...e,width:`calc(100% - ${2*Vi}px)`,marginTop:Vi?0:e.marginTop}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"}),placeholder:(e,t)=>({...e,color:t.isFocused?e.color:"hsl(0, 0%, 70%)"})});const Gi=R((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:a})=>{const i=k(null),o=k(null);return N.createElement("div",{ref:i,onDragStart:t=>{var r;if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.setData("x-3deye/camera",""+e.cameraId),t.dataTransfer.setData("x-3deye/starttime",e.startTime.toISOString()),t.dataTransfer.dropEffect="move";const n=null===(r=i.current)||void 0===r?void 0:r.querySelector("img");if(n){const{x:e,y:r}=n.getBoundingClientRect();t.dataTransfer.setDragImage(n,t.clientX-e,t.clientY-r)}},className:"event-list-item",onClick:()=>null==r?void 0:r(e),onAuxClick:t=>null==n?void 0:n(t,e),onContextMenu:e=>{var t;e.preventDefault(),i.current&&(null===(t=o.current)||void 0===t||t.toggleAt(i.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,a&&N.createElement(a,{ref:o,data:e}))}));Gi.displayName="EventListItem";const qi=bi({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M15 13V5c0-1.66-1.34-3-3-3S9 3.34 9 5v8c-1.21.91-2 2.37-2 4 0 2.76 2.24 5 5 5s5-2.24 5-5c0-1.63-.79-3.09-2-4zm-4-8c0-.55.45-1 1-1s1 .45 1 1h-1v1h1v2h-1v1h1v2h-2V5z"}))});qi.displayName="ThermostatIcon";const Yi=R((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,N.createElement("div",{className:"event-list-item__temperature"},N.createElement(qi,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));Yi.displayName="Temperature";const Zi=R((({data:e,cameraNameHidden:t})=>{var r;const i=A(pi),{cameras:o}=i,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return N.createElement("div",{className:"event-list-item-caption"},N.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",i="";return n(e,new Date)?a(e,new Date)?r=i="HH:mm":a(e,t)?(r="EEE d MMM HH:mm",i="HH:mm"):r=i="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",i="d MMM HH:mm"):r=i="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",i+=":ss"),+e==+t?`${Ce(e,r)}`:`${Ce(e,r)} - ${Ce(t,i)}`}(e.startTime,e.endTime)),t?null:N.createElement("div",{className:"event-list-item__camera-name",title:l},l),+e.endTime-+e.startTime>0&&N.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let a=(e-r)/60;if(a<60)return!r&&t?`${a}m`:`${a}m ${n}s`;const i=Math.floor(a/60);if(a-=60*i,!r&&!a&&t)return`${i}h`;const o=t?`${a}`:`${a}`.padStart(2,"0");return!r&&a&&t?`${i}h ${o}m`:`${i}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),N.createElement(Yi,{data:e}))}));Zi.displayName="EventListItemCaption";const Ji=R((({data:{data:e,objectIdx:t},width:r,height:n,cameraNameHidden:a,onClick:i,onAuxClick:o,menuComponent:l})=>{let s=null,c=1,d=1,u=0,h=0,m=1,f=1;const{ThumbnailSize:p}=JSON.parse(e.raw.data);p&&(c=p.Width,d=p.Height),s=e.detectedObjects[t];const{Box:{Bottom:b,Left:g,Right:v,Top:y}}=s;u=y*d,h=g*c,f=(b-y)*d,m=(v-g)*c;let E=1,w=0,x=0,C="Person"===(null==s?void 0:s.Type)?.8:1;return r/n>m/f?(E=n/f*C,w=-u*E+(n-f*E)/2,x=-(h+m/2)*E+r/2):(E=r/m*C,w=-(u+f/2)*E+n/2,x=-h*E),N.createElement(Gi,{onClick:i,onAuxClick:o,data:e,width:r,height:n,cameraNameHidden:a,menuComponent:l},N.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},N.createElement("img",{key:e.thumbnailUrl,src:e.thumbnailUrl,style:{position:"absolute",top:w,left:x,width:c*E,height:d*E}}),N.createElement(V,{radius:r}),N.createElement(Zi,{data:e,cameraNameHidden:!0})))}));Ji.displayName="DetectedObjectCell";const Xi=({size:e=48})=>N.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},N.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));Xi.displayName="Preloader";var Ki=vr;function Qi(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(Qi.Cache||Ki),r}Qi.Cache=Ki;const eo=Qi((()=>{const e=document.createElement("div");e.style.overflowY="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.append(e);const t=e.offsetWidth;return e.remove(),t}));function to(e,t,r,n){return e.Top<-n&&(e.Bottom=e.Bottom-e.Top+n,e.Top=-n),e.Left<-n&&(e.Right=e.Right-e.Left+n,e.Left=-n),e.Right+n>t&&(e.Left=e.Left-(e.Right-t)+n,e.Right=t-n),e.Bottom+n>r&&(e.Top=e.Top-(e.Bottom-r)+n,e.Bottom=r-n),e}const ro=({className:e,style:t,box:{Top:r,Left:n,Right:a,Bottom:i}})=>N.createElement(N.Fragment,null,N.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-i)+"%",right:100*(1-a)+"%",...t}}));function no({style:e}){return N.createElement("div",{className:"frame",style:e},N.createElement("div",{className:"corner-highlight-tl"}),N.createElement("div",{className:"corner-highlight-tr"}),N.createElement("div",{className:"corner-highlight-br"}),N.createElement("div",{className:"corner-highlight-bl"}))}function ao({Top:e,Left:t,Bottom:r,Right:n},a,i,o,l){const s=l*e,c=l*r;return s>i?[0,-1]:c>i?[0,1]:o*t>a?[-1,0]:o*n>a?[1,0]:[0,s>c?1:-1]}function io(e,t){return{Top:e.Top+t[1],Left:e.Left+t[0],Bottom:e.Bottom+t[1],Right:e.Right+t[0]}}ro.displayName="LicensePlateLpr";const oo=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:a,thumbHeight:i,width:o,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:u}=t,h=100/a/(d-c),m={top:2},f=k(null);return F((()=>{if(!f.current)return;const{width:e,height:r}=f.current.getBoundingClientRect(),n=ao(t,e,r,o,l);n[0]=n[0]*(e+(d-c)*o)/2,n[1]=n[1]*(r+(u-s)*l)/2;const a=to(io({Top:(s+u)/2*l-r/2,Left:(c+d)/2*o-e/2,Bottom:(s+u)/2*l+r/2,Right:(c+d)/2*o+e/2},n),o,l,0);f.current.style.top=`${a.Top+2*Math.sign(n[1])}px`,f.current.style.left=`${a.Left+2*Math.sign(n[0])}px`})),c>=1-d?m.left=2:m.right=2,N.createElement(N.Fragment,null,N.createElement("div",{ref:f,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},N.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),N.createElement(ro,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),N.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:a*(d-c)*h,height:i*(u-s)*h,...m}},N.createElement("img",{style:{width:a*h,height:i*h,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),N.createElement(no,null)))};oo.displayName="FaceHighlight";const lo=N.memo((({value:e})=>e?N.createElement(N.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?N.createElement(N.Fragment,{key:t},e):N.createElement("span",{key:t,className:"digit"},e)}))):null));lo.displayName="LicensePlateNumber";const so=({detectedObject:e,height:t,width:r,url:n,thumbWidth:a,thumbHeight:i})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:u}=e,h=e.Value||e.Number,m=k(null);F((()=>{if(!m.current)return;const e=m.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,a=l*t-e.height-4;a<0&&(a=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),m.current.style.top=`${a}px`,m.current.style.left=`${n}px`}));const f={top:2};s>=1-c?f.left=2:f.right=2;const p=100/a/(c-s);return N.createElement(N.Fragment,null,N.createElement("div",{ref:m,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*u)}%`},N.createElement("div",{style:{padding:4}},N.createElement(lo,{value:h})),N.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*u),"%")),N.createElement(ro,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),N.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:a*(c-s)*p,height:i*(d-l)*p+16,position:"absolute",...f}},N.createElement("img",{style:{width:a*p,height:i*p,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),N.createElement("div",{className:"plate-number"},N.createElement(lo,{value:h})),N.createElement(no,{style:{height:i*(d-l)*p}})))};so.displayName="LicensePlateHighlight";const co=R((({url:e,noPreview:t,width:r})=>N.createElement(N.Fragment,null,e?N.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,N.createElement(V,{radius:r}),t?N.createElement("div",{className:"no-preview-overlay"}):null)));function uo({Top:e,Left:t,Bottom:r,Right:n}){return[(t+n)/2,(e+r)/2]}function ho(e,t){const[r,n]=uo(e),[a,i]=uo(t);return[a-r,i-n]}function mo(e,t){return!(e.Left>t.Right||e.Top>t.Bottom||e.Right<t.Left||e.Bottom<t.Top)}function fo([e,t]){const r=Math.sqrt(e*e+t*t);return 0===r?[0,0]:[e/r,t/r]}co.displayName="EventThumbnail";const po=R((({data:e,width:t,height:r})=>{const n=k(null),{eventSchema:a}=A(pi);return F((()=>{if(!n.current)return;const a=[],i=[];for(let o=0;o<e.length;o++){const l=n.current.children[2*o+1],s=e[o].Box;a.push({Top:s.Top*r,Left:s.Left*t,Bottom:s.Bottom*r,Right:s.Right*t});const[c,d]=uo(a[o]),{width:u,height:h}=l.getBoundingClientRect(),m=ao(s,u,h,t,r);i.push(io({Top:d-h/2-4,Left:c-u/2-4,Bottom:d+h/2+4,Right:c+u/2+4},m))}let o=!0,l=0;for(;o;){if(o=!1,l++>1e3){console.warn("Reached max iterations for label positioning");break}for(let t=0;t<e.length;t++){const r=i[t],n=[0,0];for(let l=0;l<e.length;l++){const e=a[l],s=i[l];if(mo(r,e)){const t=ho(e,r);n[0]=n[0]+t[0],n[1]=n[1]+t[1],o=!0}if(l!==t&&mo(r,s)){const e=ho(s,r);n[0]=n[0]+e[0],n[1]=n[1]+e[1],o=!0}}[n[0],n[1]]=fo(n),r.Top+=n[1],r.Left+=n[0],r.Bottom+=n[1],r.Right+=n[0]}}for(let a=0;a<e.length;a++){const e=n.current.children[2*a+1],{Top:o,Left:l}=to(i[a],t,r,4);e.style.top=o+4+"px",e.style.left=l+4+"px"}}),[e,t,r]),N.createElement("div",{ref:n},e.map((({Box:e,Probability:t,Type:r},n)=>N.createElement(N.Fragment,{key:n},N.createElement(ro,{box:e,style:{outline:`2px solid ${a.colorsByFoundObjectType.get(r)}`}}),N.createElement("div",{className:"event-list-item__detected-object-label",title:`${r.toLowerCase()} ${Math.floor(100*t)}%`},N.createElement("div",{style:{padding:4,lineHeight:"24px"}},r.toLowerCase()),N.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:a.colorsByFoundObjectType.get(r)}},Math.floor(100*t),"%"))))))}));po.displayName="DetectedObjects";const bo=R((({data:e,width:t,height:r,cameraNameHidden:n,onClick:a,onAuxClick:i,menuComponent:o})=>{const l=A(pi),{eventSchema:s}=l,[c,d]=function(e){var t;const[r,n]=I(null),a=A(pi),{cameras:i,thumbnails:o}=a;S((()=>{if(e.thumbnailUrl)return void n(null);const t=o.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{n(e||null)}));return()=>t.unsubscribe()}),[e.id]);let l="",s=!1;return e.thumbnailUrl?l=e.thumbnailUrl:null===r&&i.loaded?(l=(null===(t=i.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let u=[],h=null,m=null;if(e.detectedObjects.length){let n,a;const{ThumbnailSize:i}=JSON.parse(e.raw.data);i&&(n=i.Width,a=i.Height),u=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)),h=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,i)=>N.createElement(so,{key:i,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:a,url:c})))}if(e.faces){const{Width:n,Height:a}=JSON.parse(e.raw.data).ThumbnailSize;m=e.faces.map(((e,i)=>N.createElement(oo,{key:i,face:e,url:c,thumbWidth:n,thumbHeight:a,width:t,height:r})))}return N.createElement(Gi,{onClick:a,onAuxClick:i,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},N.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},N.createElement(co,{url:c,noPreview:d,width:t}),N.createElement(po,{data:u,width:t,height:r}),h,m,e.acknowledged?N.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,N.createElement(Zi,{data:e,cameraNameHidden:n})))}));bo.displayName="EventItem";class go extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),ae.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),ae.captureException(e)})),console.error(e),console.log(t)}render(){if(!this.state.hasError)return this.props.children;const{style:e,children:t,...r}=this.props;return N.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},N.createElement("h1",null,"Oops. Something went wrong"),N.createElement("div",null,"We've been notified about this problem"),N.createElement(Si,{onClick:()=>this.setState({hasError:!1})},"retry"))}}function vo({count:e,overscan:t=1,itemSize:r,horizontal:n=!1,spacing:a=0}){const[i,o]=I(),[l,s]=I(0),c=z((e=>{o(e||void 0)}),[]);S((()=>{if(!i)return;const e=()=>{s(n?i.scrollLeft:i.scrollTop)};return i.addEventListener("scroll",e,{passive:!0,capture:!0}),()=>{i.removeEventListener("scroll",e)}}),[i,n]);return{parentRef:c,getItems:()=>{if(!i)return[];const o=[],{height:s,width:c}=i.getBoundingClientRect(),d=Math.max(0,Math.floor(l/(r+a))-t),u=Math.ceil((n?c:s)/(r+a))+2*t;for(let t=d;t<Math.min(e,d+u);t++)o.push({idx:t,start:t*(r+a),size:r});return o},getTotalSize:()=>r*e+Math.max(e-1,0)*a}}const yo=R((({columnIndex:e,rowIndex:t,style:r,store:n,columnCount:a,eventRenderer:i})=>{var o,l;const s=t*a+e,c=n.data[s];return s===n.data.length?n.error?N.createElement("div",{style:r},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch more data"),N.createElement(Si,{onClick:n.loadMore},"Retry")))):(null===(o=n.pageInfo)||void 0===o?void 0:o.haveMore)?N.createElement("div",{style:r},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement(Xi,{size:32}))):N.createElement("div",{style:r}):!c&&(null===(l=n.pageInfo)||void 0===l?void 0:l.haveMore)?N.createElement("div",{style:r}):c?N.createElement("div",{style:r},N.createElement(go,null,i({data:c,width:r.width,height:r.height}))):N.createElement("div",{style:r})})),Eo=R((({store:e,scrollWidth:t,onClick:r})=>e.pendingData.length?N.createElement("div",{style:{position:"absolute",top:0,left:0,right:t,pointerEvents:"none",textAlign:"center",padding:8}},N.createElement(Si,{className:"x-3deye-button--overlay",style:{background:"rgba(0, 0, 0, 0.75)",padding:"8px 16px",backdropFilter:"blur(2px)",borderRadius:32,pointerEvents:"auto"},onClick:r},xe.t("showEvents",{count:e.pendingData.length}))):null)),wo=R((({store:e,width:t,height:r,captionHeight:n=0,minColumnWidth:a=180,aspectRatio:i=16/9,onEventClick:o,onEventAuxClick:l,eventRenderer:s})=>{const c=k(null),d=()=>{c.current&&(c.current.scrollTop=0)};if(e.error&&!e.data.length)return d(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch data"),N.createElement(Si,{onClick:e.reload},"Retry")));if(e.loading)return d(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement(Xi,null));if(!e.data.length)return d(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},xe.t("noEventsFound"));const u={store:e,width:t,minColumnWidth:a,aspectRatio:i,captionHeight:n,height:r,onEventClick:o,onEventAuxClick:l,eventRenderer:s,containerRef:c,resetScroll:d};return N.createElement(xo,{...u})}));wo.displayName="EventGrid";const xo=R((({store:e,width:t,height:r,captionHeight:n=0,minColumnWidth:a=180,aspectRatio:i,containerRef:o,onEventClick:l,onEventAuxClick:s,eventRenderer:c=(({data:e,width:t,height:r})=>N.createElement(bo,{data:e.data,cameraNameHidden:!1,onClick:l,onAuxClick:s,width:t,height:r})),resetScroll:d})=>{var u,h;const m=Math.floor(t/a)||1,f=t/m/i+n,p=m*Math.floor(r/f)>=e.data.length?0:eo(),b=Math.max(1,Math.floor((t-p)/a));let g=Math.ceil(e.data.length/b);const v=(t-p-2*(b-1))/b,y=v/i+n;(null===(u=e.pageInfo)||void 0===u?void 0:u.haveMore)&&g*b===e.data.length&&g++;const{parentRef:E,getItems:w,getTotalSize:x}=vo({count:g,overscan:5,itemSize:y,spacing:2}),{parentRef:C,getItems:j,getTotalSize:O}=vo({count:b,overscan:5,itemSize:v,horizontal:!0,spacing:2}),T=w(),P=j();S((()=>{var t;e.error||(null===(t=e.pageInfo)||void 0===t?void 0:t.haveMore)&&(e.loading||T.length&&T.at(-1).idx+1===g&&e.loadMore())}),[e.error,null===(h=e.pageInfo)||void 0===h?void 0:h.haveMore,T]);const M=T.flatMap((({idx:t,size:r,start:n})=>P.map((({idx:a,size:i,start:o})=>{var l;const s=t*b+a;return s>e.data.length?null:s!==e.data.length||(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?N.createElement(yo,{key:e.data[s]?`${e.data[s].data.id}-${e.data[s].objectIdx}`:"loading",columnIndex:a,rowIndex:t,columnCount:b,style:{position:"absolute",top:0,left:0,height:r,width:i,transform:`translate(${o}px, ${n}px)`,display:"flex"},store:e,eventRenderer:c}):null}))));return N.createElement("div",{style:{width:"100%",height:"100%",overflow:"hidden",position:"relative"}},N.createElement("div",{ref:ne(o,E,C),style:{width:t,height:r,overflow:"auto"},onScroll:t=>{const{scrollTop:r}=t.target;"disabled"!==e.liveUpdateMode&&e.setLiveUpdateMode(r>=1||e.pendingData.length?"manual":"auto")}},N.createElement("div",{style:{position:"relative",height:x(),width:O()}},M)),N.createElement(Eo,{store:e,scrollWidth:p,onClick:()=>{e.flushUpdates(),e.setLiveUpdateMode("auto"),d()}}))})),Co=e=>{const{className:t,children:r,...n}=e;return N.createElement("div",{className:U("x-3deye-button-group",t),...n},r)},jo=N.forwardRef((function({width:e,height:t,placement:r="top",style:n},a){const i=[0,"top"===r?t:0],o=[e,i[1]],l=[e/2,t-i[1]],s=[e/4,t*("top"===r?3:1)/4],c=[.325*e,t-i[1]],d=[e-c[0],c[1]],u=[e-s[0],s[1]],h=e=>e.join(","),m=`M ${h(i)} C ${h(s)} ${h(c)} ${h(l)} ${h(d)} ${h(u)} ${h(o)}`,f=`${m} Z`;return N.createElement("svg",{ref:a,className:"tip",style:n,width:e,height:t,fill:"var(--tip-background, #fff)"},N.createElement("path",{className:"tip-body",d:f}),N.createElement("path",{className:"tip-border",d:m,stroke:"var(--tip-border, transparent)",strokeWidth:1}))})),Oo=({opened:e,onOpenChange:t,children:r,target:n,placement:a,className:i,autoDismiss:o=!0,withArrow:l=!1})=>{var s,c,d;const u=k(null),{x:h,y:m,reference:f,floating:p,strategy:b,context:g,middlewareData:v,placement:y,update:E}=W({open:e,onOpenChange:t,middleware:[G(5),q(),Y(),te({element:u})],placement:a,whileElementsMounted:(e,t,r)=>Z(e,t,r,{animationFrame:!0})}),{getReferenceProps:w,getFloatingProps:x}=J([K(g),Q(g,{ancestorScroll:!0,enabled:o})]),C=z((e=>{u.current=e,E()}),[E]),j={top:"bottom",right:"left",bottom:"top",left:"right"}[null!==(s=null==y?void 0:y.split("-")[0])&&void 0!==s?s:"top"]||"top",O=N.createElement("div",{...x({className:U("x-3deye-popover-container",i),ref:p,style:{position:b,top:null!=m?m:0,left:null!=h?h:0}})},l&&N.createElement(jo,{ref:C,width:24,height:8,placement:j,style:{position:"absolute",left:null===(c=v.arrow)||void 0===c?void 0:c.x,top:null===(d=v.arrow)||void 0===d?void 0:d.y,[j]:-7}}),r);return N.createElement(N.Fragment,null,D(n,w({ref:f,...n.props})),N.createElement(ee,{id:"x-3deye-floating-ui-root"},o&&e&&N.createElement(re,{context:g,modal:!1,order:["reference","content"],returnFocus:!1},O),!o&&e&&O))},To=R((({store:e})=>{const[t,r]=I(!1),{cameras:n}=A(pi),{date:l,setDate:s,cameraId:c}=e,d=c?n.camerasById.get(c):void 0,u=i(new Date,1),h=l&&a(l,new Date),m=l&&a(l,u),f=d?o(new Date,d.archiveDuration):new Date;return N.createElement(Co,null,N.createElement(Si,{className:U({"button-selected":h}),onClick:()=>s(new Date)},xe.t("today")),c&&!a(new Date,f)?N.createElement(Si,{className:U({"button-selected":m}),onClick:()=>s(u)},xe.t("yesterday")):null,l&&N.createElement(Oo,{className:"popover-datepicker",target:N.createElement(Si,{className:"date-button",onClick:()=>r(!t)},Ce(l,"EEE dd MMM")),opened:t,withArrow:!0,onOpenChange:r},N.createElement(ie,{selected:l,onChange:s,dateFormat:"EEE dd MMM",inline:!0,minDate:f,maxDate:new Date}),N.createElement("div",{style:{display:"flex"}},N.createElement(Si,{style:{flex:1},onClick:()=>r(!1),variant:"filled"},xe.t("button.ok")))))}));To.displayName="DateSelector";const Po=R((()=>{const e=A(pi),t=k(null),r=k(null),n=k(null),a=k([]),[i,o]=I(0),l=100,s=20,c=20,d=30,u=20,{eventSearch:h}=e.eventSearchPanel,{filteredPeopleCountingData:m}=h,{brushFilter:f}=h,p=f?a.current.filter((e=>e.x0>=+f[0]&&e.x1<=+f[1])).reduce(((e,t)=>e+t.length),0):null;return S((()=>{const e=new ve((e=>{for(const t of e){const e=t.contentRect.width;o(e)}}));return e.observe(t.current),()=>e.disconnect()}),[]),S((()=>{const e=ce(r.current);if(!i)return;m.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const t=oe(m,(e=>e.timestamp)),o=he(me.offset(t[0],-1),me.offset(t[1],1)),f=be().extent([[u,s],[i-c,l-d]]).on("end",(function({selection:e,sourceEvent:t}){if(!t)return;if(!e)return void h.setBrushFilter(null);const r=fe.every((+a.current[0].x1-+a.current[0].x0)/6e4||30);let[n,i]=e.map((e=>r.round(p.invert(e))));if(+n==+i&&(n=r.floor(p.invert(e[0])),i=r.ceil(p.invert(e[1])),+n==+i))return ce(this).transition().call(f.move,null),void h.setBrushFilter(null);h.setBrushFilter([n,i]),ce(this).transition().call(f.move,i>n?[n,i].map(p):null)}));n.current=f;const p=de().domain(oe(o)).nice().range([u,i-c]);a.current=m.length?le().value((e=>e.timestamp)).domain(p.domain()).thresholds(p.ticks(24))(m):[];const b=ue().domain([0,se(a.current,(e=>e.length))]).nice().range([l-d,s]),g=e.select(".bars").selectAll(".bar").data(a.current);g.exit().remove();const v=g.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>p(e.x0)+1)).attr("width",(e=>Math.max(0,p(e.x1)-p(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),g.select("rect").attr("x",(e=>p(e.x0)+1)).attr("width",(e=>Math.max(0,p(e.x1)-p(e.x0)-1))).attr("y",(e=>b(e.length))).attr("height",(e=>b(0)-b(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>p(e.x0)+1+Math.max(0,p(e.x1)-p(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),g.select("text").attr("dy",".75em").attr("y",(e=>b(e.length)-10)).attr("x",(e=>p(e.x0)+1+Math.max(0,p(e.x1)-p(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),m.length){const[t,r]=p.domain(),[n,a]=p.range(),i=(a-n)/(+r-+t)*3600*1e3,o=30,l=pe(p).ticks(me.every(1)).tickFormat((e=>i>=o?ge("%H:%M")(e):e.getHours()%(Math.floor(o/i)+1)?"":ge("%H:%M")(e)));l.scale(p),e.select(".x-axis").attr("transform","translate(0,70)").call(l),e.select(".brush").call(f),h.brushFilter&&e.select(".brush").call(f.move,h.brushFilter.map(p))}else e.select(".x-axis").html(""),e.select(".brush").call(f),e.select(".brush").html("").call(f.move,null)}),[i,m]),S((()=>{n.current&&(h.brushFilter||ce(r.current).select(".brush").call(n.current.move,null))}),[h.brushFilter]),N.createElement("div",{ref:t},N.createElement("div",{style:{paddingLeft:10,paddingRight:10,display:"flex"}},xe.t("peopleCounting"),N.createElement("div",{style:{marginLeft:"auto"}},null===p?null:N.createElement(Di,{label:xe.t("selected")},N.createElement("span",null,p)),null===p?null:"/",N.createElement(Di,{label:xe.t("total")},N.createElement("span",null,m.length)))),N.createElement("svg",{className:"people-histogram",ref:r,width:i,height:l,viewBox:`0 0 ${i} 100`},N.createElement("g",{className:"bars"}),N.createElement("g",{className:"x-axis"}),N.createElement("g",{className:"brush"})))}));Po.displayName="PeopleHistogram";const Mo=e=>{const{children:t,innerProps:r,...n}=e,{Option:a}=$,{data:i}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return N.createElement(a,{innerProps:o,...n},N.createElement(Ti,{data:i}),N.createElement("div",{style:{marginLeft:4}},t))},_o=R((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:a}=e.eventSchema,{ref:i,width:o,height:l}=B();return N.createElement(N.Fragment,null,N.createElement(To,{store:e}),N.createElement("div",{style:{zIndex:2}},N.createElement(H,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:a,placeholder:xe.t("selectObjectType"),value:r,components:{MultiValueLabel:Pi,Option:Mo},styles:{...Wi,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white"}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e}})),N.createElement(Ui,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?N.createElement(Bi,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?N.createElement(Po,null):null,N.createElement("div",{ref:i,style:{flex:1,overflow:"hidden"}},N.createElement(wo,{width:o,height:l,minColumnWidth:120,aspectRatio:1,store:e.eventsLoader,eventRenderer:({data:e,width:r,height:n})=>N.createElement(Ji,{data:e,cameraNameHidden:!0,onClick:t,width:r,height:n})})))}));_o.displayName="EventSearch";const Lo=e=>{var t;const r=null!==(t=A(_))&&void 0!==t?t:L;return N.createElement(pi.Provider,{value:r},N.createElement(_o,{...e}))};var No;Lo.displayName="EventSearch",(No={resources:{en:{translation:ye}}})&&Object.assign(we,No),xe.isInitialized?(we.resources?Object.keys(we.resources).forEach((e=>{xe.addResourceBundle(e,"translation",we.resources[e].translation,!0)})):console.warn("i18n is already initialized"),s(xe.t)):c(xe.init(we));const Io=(e=L)=>{const t=new fi(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export{Io as createEventSearchStore,Lo as default};
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@3deye-toolkit/react-event-search",
3
- "version": "0.0.1-alpha.29",
3
+ "version": "0.0.1",
4
4
  "module": "dist/react-event-search.js",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "types": "dist/react-event-search.d.ts",
9
9
  "dependencies": {
10
- "@3deye-toolkit/core": "0.0.1-alpha.29",
11
- "@reach/tooltip": "^0.17.0",
12
- "@react-spring/web": "^9.4.2",
10
+ "@3deye-toolkit/core": "0.0.1",
11
+ "@floating-ui/react": "^0.14.0",
12
+ "@mantine/hooks": "^5.5.6",
13
13
  "@sentry/browser": "^5.15.5",
14
14
  "@seznam/compose-react-refs": "^1.0.6",
15
15
  "clsx": "^1.1.1",
@@ -27,21 +27,21 @@
27
27
  "mobx": "^6.3.13",
28
28
  "mobx-react-lite": "^3.2.3",
29
29
  "react-datepicker": "^4.6.0",
30
- "react-ink": "^6.5.1",
30
+ "react-ink": "^6.5.3",
31
31
  "react-select": "^5.2.2",
32
- "react-virtualized-auto-sizer": "^1.0.6",
33
- "react-window": "^1.8.6",
34
- "react-window-infinite-loader": "^1.0.7",
35
32
  "resize-observer-polyfill": "^1.5.1",
36
33
  "rxjs": "^7.5.3"
37
34
  },
38
35
  "peerDependencies": {
39
- "react": "^16.8.0 || ^17",
40
- "react-dom": "^16.8.0 || ^17"
36
+ "react": "^16.8.0 || ^17 || ^18",
37
+ "react-dom": "^16.8.0 || ^17 || ^18"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "registry": "https://registry.npmjs.org/"
41
42
  },
42
43
  "sideEffects": [
43
44
  "*.css"
44
45
  ],
45
- "license": "mit",
46
- "gitHead": "5b47d51ae43158bf213709f5ef38f5eb401cfc92"
46
+ "license": "mit"
47
47
  }