@3deye-toolkit/react-event-list 0.0.1-alpha.26 → 0.0.1-alpha.29
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.
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { default as React_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
declare class CameraEvent {
|
|
4
|
+
cameraId: number;
|
|
5
|
+
type: EventType;
|
|
6
|
+
raw: RawSensorEvent;
|
|
7
|
+
thumbnailUrl: string;
|
|
8
|
+
detectedObjects: DetectedObject[];
|
|
9
|
+
faces: Face[];
|
|
10
|
+
instant: boolean;
|
|
11
|
+
get id(): number;
|
|
12
|
+
get startTime(): Date;
|
|
13
|
+
get endTime(): Date;
|
|
14
|
+
get isLive(): boolean;
|
|
15
|
+
get acknowledged(): boolean;
|
|
16
|
+
constructor(raw: RawSensorEvent);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare interface DetectedObject {
|
|
20
|
+
Type: string;
|
|
21
|
+
Value?: string;
|
|
22
|
+
Number?: string;
|
|
23
|
+
Box: {
|
|
24
|
+
Left: number;
|
|
25
|
+
Top: number;
|
|
26
|
+
Right: number;
|
|
27
|
+
Bottom: number;
|
|
28
|
+
};
|
|
29
|
+
Probability: number;
|
|
30
|
+
Colors?: {
|
|
31
|
+
Color: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare const EventList: React_2.FC<Props>;
|
|
36
|
+
export default EventList;
|
|
37
|
+
|
|
38
|
+
declare type EventType = 'Motion' | 'Tampering' | 'PanTiltZoom' | 'CrossLine' | 'Intrusion' | 'LicensePlate' | 'FaceDetection' | 'Audio' | 'Analytic' | 'SpeedDetection' | 'PeopleCounter' | 'Temperature' | 'PoS' | 'GPS' | 'DigitalInput' | 'Normal' | 'Suspicious' | 'Loitering' | 'Vandalism' | 'Trespass' | 'Emergency' | 'LifeInDanger' | 'ErroneousAlert' | 'Misidentification' | 'Fire' | 'MedicalDuress' | 'HoldUp' | 'CheckIn' | 'CheckOut' | 'ClockIn' | 'ClockOut' | 'ParkingStart' | 'ParkingEnd' | 'ParkingViolation' | 'GateAccess' | 'DoorAccess' | 'TemperatureCheck' | 'IDCheck' | 'PPECheck' | 'WelfareCheck' | 'Uncategorized' | 'Unknown';
|
|
39
|
+
|
|
40
|
+
declare interface Face {
|
|
41
|
+
PersonId: number;
|
|
42
|
+
Name: string;
|
|
43
|
+
Box: {
|
|
44
|
+
Left: number;
|
|
45
|
+
Top: number;
|
|
46
|
+
Right: number;
|
|
47
|
+
Bottom: number;
|
|
48
|
+
};
|
|
49
|
+
Probability: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare interface Props extends React_2.HTMLAttributes<HTMLDivElement> {
|
|
53
|
+
onEventClick: (event: CameraEvent) => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare interface RawSensorEvent {
|
|
57
|
+
message: string;
|
|
58
|
+
data: string | null;
|
|
59
|
+
id: number;
|
|
60
|
+
customerId: number;
|
|
61
|
+
sensorId: number;
|
|
62
|
+
sensorType: 'CameraSensor' | 'MotionSensor' | 'IntrusionSensor' | 'AudioSensor' | 'TemperatureSensor' | 'SpeedSensor' | 'Unknown';
|
|
63
|
+
eventType: EventType;
|
|
64
|
+
ackEventType: string;
|
|
65
|
+
description?: any;
|
|
66
|
+
tags?: any;
|
|
67
|
+
customerData?: any;
|
|
68
|
+
startTime: string;
|
|
69
|
+
endTime: string;
|
|
70
|
+
userId: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { }
|
package/dist/react-event-list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{format as e,subHours as t,startOfHour as r,isSameYear as n,isSameDay as i}from"date-fns/esm";import a from"i18next";import{from as o,Observable as l,Subscription as s,of as c,throwError as d,EMPTY as u}from"rxjs";import*as h from"react";import m,{useContext as p,useRef as f,createContext as b,useState as v,Children as g,useEffect as y,useCallback as E,useLayoutEffect as w}from"react";import{AppContext as C,app as x}from"@3deye-toolkit/core";import{computed as O,makeObservable as P,observable as N,action as L,runInAction as I,reaction as M}from"mobx";import{subHours as j}from"date-fns";import{mergeMap as T,catchError as _,switchMap as k,mapTo as S,concatMap as D}from"rxjs/operators";import F,{components as z}from"react-select";import A from"clsx";import{observer as H,useLocalObservable as $,Observer as R}from"mobx-react-lite";import{useSpring as V,animated as B}from"@react-spring/web";import U from"react-dom";import W from"react-datepicker";import G from"react-ink";import q from"@reach/tooltip";import Y from"@seznam/compose-react-refs";import X from"react-virtualized-auto-sizer";import Z from"react-window-infinite-loader";import{VariableSizeGrid as J}from"react-window";import*as K from"@sentry/browser";var Q={filter:"Filter",button:{ok:"Ok"},noEventsFound:"no events found",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events"};const ee=new Map,te={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},re=a.createInstance();function ne(t,r){const n=ee.get(re.language);return e(t,r,{locale:n})}const ie=m.createContext(null);var ae,oe;function le(e,t=!1){const r=O(e);return new l((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"}(ae||(ae={})),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={}));class se{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 s?e.closed||e.unsubscribe():e()}))}}const ce=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class de{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:O,startTime:O,endTime:O,acknowledged:O,isLive:O,raw:N.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=ce.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!ce.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class ue extends se{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:i,cameras:a,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:a,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==i?void 0:i.nextPageToken},n,o).pipe(T((e=>e.success?c({events:e.resultItems,pageInfo:e.pageInfo}):d((()=>e.error)))),_((e=>(console.error(e),this.error=e,c({events:[],pageInfo:null})))))}),P(this,{data:N.ref,cameras:N.struct,detectedObjects:N.struct,from:N,to:N,sortDirection:N,probabilityThreshold:N,pendingData:N.ref,liveUpdateMode:N,setLiveUpdateMode:L,updateTrigger:N,colors:N.ref,flushUpdates:L,pageInfo:N.ref,isLive:O,loading:N,loadMoreTrigger:N,retryTrigger:N,error:N.ref,loadMore:L,filterJson:O})}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=le((()=>({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(k((e=>le((()=>this.retryTrigger),!0).pipe(S(e)))),k((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,polygons:a})=>(I((()=>{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:i,pageInfo:this.pageInfo,polygons:a}))))).subscribe((({events:e,pageInfo:t})=>{I((()=>{var r,n,i;if(!t)return;const a=e.map(he);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>oe[e])),from:null!==(n=null===(r=a[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:j(new Date,1),to:null,colors:this.colors.size?this.colors:void 0,detectedObjectTypes:this.detectedObjects,probability:null!==(i=this.probabilityThreshold)&&void 0!==i?i:void 0}),a):this.data=a,this.eventsStore.add(a),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(k((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>le((()=>this.loadMoreTrigger)).pipe(D((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(he);this.eventsStore.add(r),I((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(le((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(k((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?le((()=>this.eventsStore.recentAdditions)):u))).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&&I((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(le((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(k((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?le((()=>this.eventsStore.recentAdditions)):(this.pendingData&&I((()=>this.pendingData=[])),u)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&I((()=>{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=>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}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 s?e.closed||e.unsubscribe():e()}))}}function he(e){return new de(e)}const me={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"},pe={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"},fe={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"},be={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"},ve={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"},ge={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"};class ye extends se{constructor(e){super(),Object.defineProperty(this,"cameraFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"objectFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"date",{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,"facesProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.7}),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,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toggleSorting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.sortDirection="ASC"===this.sortDirection?"DESC":"ASC",null===this.date&&(this.date=t(r(new Date),1))}}),Object.defineProperty(this,"applyFilters",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;this.eventsLoader.cameras=this.cameraFilters.map((e=>e.id)),this.eventsLoader.detectedObjects=this.objectFilters.map((e=>e.id)),this.eventsLoader.colors=this.colors,this.eventsLoader.probabilityThreshold=this.objectFilters.length?this.probabilityThreshold:null,"ASC"===this.sortDirection?(this.eventsLoader.sortDirection="ASC",this.eventsLoader.to=void 0,this.eventsLoader.from=this.date):(this.eventsLoader.sortDirection="DESC",this.eventsLoader.from=void 0,this.eventsLoader.to=null!==(e=this.date)&&void 0!==e?e:void 0)}}),Object.defineProperty(this,"getProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e,this.applyFilters()}}),P(this,{cameraFilters:N.ref,objectFilters:N.ref,date:N,sortDirection:N,probabilityThreshold:N,setProbabilityTreshold:L,facesProbabilityThreshold:N,colors:N.ref,someAnalyticsFilterSelected:O,filters:O,setFilters:L,load:L,toggleColor:L.bound,clearColors:L.bound,applyFilters:L,toggleSorting:L}),this.eventsLoader=new ue(e),this.eventsLoader.loading=!0,this.eventsLoader.probabilityThreshold=null}get someAnalyticsFilterSelected(){return!!this.objectFilters.length}get filters(){return this.objectFilters.concat(this.cameraFilters)}load(){this.eventsLoader.load()}setFilters(e){this.cameraFilters=e?e.filter((e=>!("type"in e))):[],this.objectFilters=e?e.filter((e=>"type"in e)):[]}toggleColor(e){const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t,this.applyFilters()}clearColors(){this.colors=new Set,this.applyFilters()}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposables.forEach((e=>{e instanceof s?e.closed||e.unsubscribe():e()})),this.eventsLoader.dispose()}}var Ee,we=(Ee=8,{container:e=>({...e,padding:Ee}),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*Ee}px)`,marginTop:Ee?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%)"})});function Ce(e){return t=>{const{size:r=24,color:n="currentColor",className:i,...a}=t,o=e.viewBox||"0 0 24 24",l=e.svg;return m.createElement("svg",{preserveAspectRatio:"xMinYMin",className:A("icon",i),width:r,fill:n,viewBox:o,...a},l)}}const xe=Ce({viewBox:"0 0 24 24",svg:m.createElement("g",null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}))});xe.displayName="LabelIcon";const Oe=Ce({viewBox:"0 0 24 24",svg:m.createElement("g",null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}))});Oe.displayName="CameraIcon";const Pe=Ce({viewBox:"0 0 24 24",svg:m.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"})});Pe.displayName="LuggageIcon";const Ne=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}))});Ne.displayName="CarIcon";const Le=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}))});Le.displayName="BoatIcon";const Ie=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.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"}))});Ie.displayName="BicycleIcon";const Me=Ce({viewBox:"0 0 24 24",svg:m.createElement("g",null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}))});Me.displayName="DirectionsWalkIcon";const je=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),m.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),m.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),m.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),m.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"}))});je.displayName="PetsIcon";const Te=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}),m.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"}),m.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"}),m.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"}))});Te.displayName="LicensePlateIcon";const _e=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?m.createElement(Oe,{size:t}):"Luggage"===e.id?m.createElement(Pe,{size:t}):"Car"===e.id?m.createElement(Ne,{size:t}):"Person"===e.id?m.createElement(Me,{size:t}):"Bicycle"===e.id?m.createElement(Ie,{size:t}):"Boat"===e.id?m.createElement(Le,{size:t}):"Animal"===e.id?m.createElement(je,{size:t}):"LicensePlate"===e.id?m.createElement(Te,{size:t}):m.createElement(xe,{size:t})},ke=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=z,{data:a}=e;if("licensePlate"===a.type)return m.createElement(i,{innerProps:r,...n},m.createElement("span",{style:{paddingLeft:8,paddingRight:8,borderRadius:4,border:"1px solid black"}},t));if("detectedObject"===a.type){const e={display:"inline-flex",alignItems:"center",width:"auto"},o={...r,style:e};return m.createElement(i,{innerProps:o,...n},m.createElement(_e,{data:a}),m.createElement("div",{style:{marginLeft:4}},t))}return m.createElement(i,{...e})},Se=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=z,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return m.createElement(i,{innerProps:o,...n},m.createElement(_e,{data:a}),m.createElement("div",{style:{marginLeft:4}},t))},De=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});De.displayName="FilterListIcon";const Fe={...we,multiValue:(e,{data:t})=>"color"in t?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>"color"in t?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>"color"in t?{...e,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.7)",color:t.color}}:{...e,color:"hsl(0, 0%, 20%)"},option:(e,{data:t,isFocused:r})=>"color"in t?"type"in t&&"licensePlate"===t.type?{...e,color:t.color,backgroundColor:r?pe[50]:"transparent",":active":{...e[":active"],backgroundColor:pe[100]}}:{...e,color:t.color}:{...e,color:"black"}},ze=e=>{const{children:t,...r}=e;return m.createElement(z.Placeholder,{...r},m.createElement(De,{size:16,style:{position:"relative",top:4}})," ",t)},Ae=H((({addionalFiltersEnabled:e,store:t})=>{const{cameras:r,eventSchema:n}=p(ie),i=f({opened:!1});return m.createElement(F,{closeMenuOnSelect:!1,isMulti:!0,onChange:(e,r)=>{t.setFilters(e),"remove-value"!==r.action||i.current.opened||t.applyFilters()},onMenuOpen:()=>i.current.opened=!0,onMenuClose:()=>{i.current.opened=!1,t.applyFilters()},getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:(()=>{if(!n)return[];const t=e?n.foundObjectTypesForSelect:[];return r.loaded?[].concat(t,r.data.slice()):t})(),placeholder:re.t("filter"),value:t.filters,components:{MultiValueLabel:Se,Option:ke,Placeholder:ze},styles:Fe})}));Ae.displayName="EventsPanelSelect";const He=e=>`scale(${e})`,$e=({children:e,from:t,style:r})=>{const n=V({opacity:1,from:{opacity:0},config:{tension:300}});return h.createElement(B.div,{style:{...r,...n,transform:n.opacity.to(He),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},Re=document.body;class Ve extends m.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){Re.appendChild(this.el)}componentWillUnmount(){Re.removeChild(this.el)}render(){return U.createPortal(this.props.children,this.el)}}const Be=({width:e,height:t,color:r,position:n="top",style:i})=>{const a=[0,"top"===n?t:0],o=[e,a[1]],l=[e/2,t-a[1]],s=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-a[1]],d=[e-c[0],c[1]],u=[e-s[0],s[1]],h=e=>e.join(","),p=`M ${h(a)} C ${h(s)} ${h(c)} ${h(l)} ${h(d)} ${h(u)} ${h(o)} Z`;return m.createElement("svg",{className:"tip",style:i,width:e,height:t,fill:r},m.createElement("path",{d:p}))};class Ue extends m.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:m.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:m.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:i,height:a,width:o}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let d="bottom"===this.props.placement?i+10:r-c.clientHeight-10,u=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";d<0&&(d=i+10,h="top"),u<0&&(u=0,l=n+o/2-12),u+c.clientWidth>window.innerWidth&&(u=window.innerWidth-c.clientWidth,l=n-u+o/2-12),e&&(d=a+10,u=0,l=8,"top"===this.props.placement&&(s=d,d="auto")),this.setState({top:d,bottom:s,left:u,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:i}=this.state,{className:a,opened:o,disablePortal:l,disableAnimation:s}=this.props,c={position:"absolute",left:i};"bottom"===n?c.bottom=-8:c.top=-8;const d=A(a,"x-3deye-popover-body");let u=null;if(o){const i={zIndex:l?1:100000001,position:"absolute",top:e,bottom:r,left:t},a=m.createElement("div",{className:d,ref:this.popoverRef},this.props.children,m.createElement(Be,{width:24,height:8,position:n,color:"white",style:c}));u=s?m.createElement("div",{style:i},a):m.createElement($e,{from:n,style:i},a)}const h=m.cloneElement(this.props.target,{ref:this.targetRef});if(l)return m.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,u);const p=o&&m.createElement(Ve,null,u);return m.createElement(m.Fragment,null,h,p)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const We={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},Ge=({label:e,children:t})=>m.createElement(q,{label:e,style:We},t);Ge.displayName="Tooltip";class qe extends m.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:i,type:a,title:o,...l}=this.props,s=A(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},i?`x-3deye-button--${i}`:void 0),c=m.createElement("button",{ref:e,className:s,type:a||"button",...l},t,l.disabled?null:m.createElement(G,null));return o?m.createElement(Ge,{label:o},c):c}}const Ye=m.forwardRef(((e,t)=>m.createElement(qe,{forwardedRef:t,...e}))),Xe=Ce({viewBox:"0 0 24 24",svg:m.createElement("g",null,m.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"}),m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Xe.displayName="CloseIcon";const Ze=(e,t,r)=>Math.min(Math.max(e,t),r),Je=()=>{},Ke=(e,t,r,n)=>Ze(Math.floor((e-t)/r*n),0,n-1),Qe=b({value:null,onPointerDown:Je,setCurrentValue:Je,state:{currentIdx:0,currentValue:null,options:[]}});class et{constructor(e=0){Object.defineProperty(this,"currentIdx",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"setCurrentIdx",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.currentIdx=e}}),Object.defineProperty(this,"setOptions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.options=e}}),this.currentIdx=e,P(this,{currentIdx:N,options:N.ref,currentValue:O,setCurrentIdx:L,setOptions:L})}get currentValue(){return this.options[this.currentIdx]}}const tt=H((({value:e,onChange:t,children:r,style:n})=>{const[i,a]=v(!1),o=f(null),l=g.map(r,(e=>null==e?void 0:e.props.value))||[],s=$((()=>new et(l.indexOf(e))));s.setOptions(l);const c=g.count(r);y((()=>{s.setCurrentIdx(l.indexOf(e))}),[e]),y((()=>{var e;if(!i)return;const r=null===(e=o.current)||void 0===e?void 0:e.getBoundingClientRect();if(!r)return;const n=({clientX:e})=>{s.setCurrentIdx(Ke(e,r.left,r.width,c))},d=()=>{a(!1),t(l[s.currentIdx])};return document.addEventListener("pointermove",n),document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",d)}}),[i,c]);return m.createElement(Qe.Provider,{value:{value:e,state:s,onPointerDown:e=>{const t=o.current;if(!t)return;const{left:r,width:n}=t.getBoundingClientRect(),i=Ke(e.clientX,r,n,c);i!==s.currentIdx&&s.setCurrentIdx(i),a(!0)},setCurrentValue:e=>{s.setCurrentIdx(l.indexOf(e))}}},m.createElement("div",{className:"segmented-control-wrapper",style:n},m.createElement("div",{role:"radiogroup",ref:o,className:"segmented-control",style:{"--indicator-offset":100*s.currentIdx+"%"}},m.createElement("div",{"aria-hidden":!0,className:A("segmented-control-indicator",{active:i}),style:{width:100/l.length+"%"}},m.createElement("div",{className:"segmented-control-indicator-inner"})),r)))}));tt.displayName="SegmentedControl";const rt=H((({value:e,children:t})=>{const r=p(Qe);return m.createElement("button",{role:"radio","aria-checked":r.state.currentValue===e,tabIndex:0,className:A("segmented-control-button",{current:r.state.currentValue===e}),onPointerDown:r.onPointerDown,onClick:()=>r.setCurrentValue(e)},t)}));rt.displayName="SegmentedControlOption";const nt=H((({store:e})=>{const{date:t,sortDirection:r}=e,n=$((()=>({opened:!1,toggle(){this.opened=!this.opened},close(){this.opened=!1,e.applyFilters()},onDateChange(t){e.date=t},clear(){e.date=null,e.applyFilters()}}))),i=m.createElement("div",{style:{flex:1,display:"flex",position:"relative"}},m.createElement(Ye,{className:"date-button",style:{flex:1,alignItems:"flex-start",borderRadius:0},onClick:n.toggle},t?m.createElement("sup",null,"ASC"===r?"From":"To"):null,m.createElement("span",null,t?ne(t,"MMM d, HH:mm"):"live")),t?m.createElement(Ye,{className:"x-3deye-button--icon",style:{position:"absolute",right:0},onClick:n.clear},m.createElement(Xe,{size:16})):null);return m.createElement("div",{className:"events-panel-datepicker"},m.createElement("div",{style:{position:"relative"}},m.createElement(Ue,{target:i,opened:n.opened,onCloseRequest:n.close,disableAnimation:!0,className:"popover-datetimepicker"},m.createElement(tt,{value:r,onChange:e.toggleSorting},m.createElement(rt,{value:"ASC"},"From"),m.createElement(rt,{value:"DESC"},"To")),m.createElement(W,{selected:t,onChange:n.onDateChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),m.createElement(Ye,{onClick:n.close,variant:"filled",style:{borderRadius:4}},re.t("button.ok")))))}));nt.displayName="EventsPanelDatepicker";const it=e=>Math.round(e),at=m.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:i=!1,labelFormat:a=(e=>`${e}`),style:o},l)=>{const s=f(null),c=f(null),[d,u]=v(!1),[h,p]=v(e);y((()=>{if(!d)return;const e=s.current;if(!e)return;let i=0,a=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(i=Ze(e-o.x,0,o.width),l=i/o.width*100,c.current.style.transform=`translateX(${i}px)`):(a=o.height-Ze(r-o.y,0,o.height),l=a/o.height*100,c.current.style.transform=`translateY(${-a}px)`),p(l),null==t||t(it(l))},h=({clientX:e,clientY:i})=>{if(u(!1),!c.current)return;const a="horizontal"===n?Ze(e-o.x,0,o.width)/o.width*100:100*(1-Ze(i-o.y,0,o.height)/o.height);c.current.style.transform="",p(a),null==t||t(it(a)),null==r||r(it(a))},m=()=>{if(u(!1),!c.current)return;const e="horizontal"===n?i/o.width*100:a/o.height*100;c.current.style.transform="",null==t||t(it(e)),null==r||r(it(e))};return e.addEventListener("pointercancel",m),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",m),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[d,n,t]);const b=E((({clientX:e,clientY:r,pointerId:a})=>{if(!s.current||i)return;u(!0),s.current.setPointerCapture(a);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=Ze(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-Ze(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}p(l),null==t||t(it(l))}),[n,i]),g=E((n=>{if(i)return;let a=null;"ArrowLeft"===n.code?a=Math.max(e-1,0):"ArrowRight"===n.code?a=Math.min(e+1,100):"ArrowDown"===n.code?a=Math.max(e-1,0):"ArrowUp"===n.code&&(a=Math.min(e+1,100)),null!==a&&(n.stopPropagation(),n.preventDefault(),null==t||t(a),null==r||r(a))}),[e,t,r,n,i]);return m.createElement("div",{ref:Y(l,s),tabIndex:0,onKeyDown:g,className:A("x-3deye-slider",n,{disabled:i}),onPointerDown:b,style:o},m.createElement("div",{className:"x-3deye-slider__track"},m.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?h:e}%`:void 0,height:"vertical"===n?`${d?h:e}%`:void 0}})),m.createElement("div",{ref:c,className:A("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"}},m.createElement("div",{className:"x-3deye-slider__label "+(d?"open":"")},a(d?it(h):e))))}));at.displayName="Slider";const ot=H((({getter:e,setter:t})=>{const[r,n]=v(0),i=f(null),a=Math.floor(100*e());return y((()=>M(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),m.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},m.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},m.createElement("div",null,"CONFIDENCE"),m.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),m.createElement("div",{style:{padding:"0 10px"}},m.createElement(at,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));ot.displayName="ProbabilitySlider";const lt=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),m.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});lt.displayName="DoneIcon";const st=[{color:ve[500],name:"red",highlightColor:ve[100]},{color:fe[500],name:"green",highlightColor:fe[100]},{color:me[500],name:"blue",highlightColor:me[100]},{color:ge[500],name:"yellow",highlightColor:ge[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:be[500],name:"dimgrey",highlightColor:be[100]}],ct=H((({value:e,clear:t,toggle:r})=>m.createElement("div",{className:"color-selector"},m.createElement("div",null,"COLOR"),m.createElement("div",{className:"color-selector__items"},st.map((({color:t,highlightColor:n,name:i})=>m.createElement("button",{key:i,className:A("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t},onClick:r.bind(null,i)},m.createElement(lt,{color:n,size:20})))),m.createElement(Ye,{className:"color-selector__clear",disabled:!e.size,onClick:t},m.createElement(Xe,{size:20}))))));ct.displayName="ColorSelector";const dt=({size:e=48})=>m.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},m.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),m.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)"},m.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));dt.displayName="Preloader";var ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ht="object"==typeof ut&&ut&&ut.Object===Object&&ut,mt="object"==typeof self&&self&&self.Object===Object&&self,pt=ht||mt||Function("return this")(),ft=pt.Symbol,bt=ft,vt=Object.prototype,gt=vt.hasOwnProperty,yt=vt.toString,Et=bt?bt.toStringTag:void 0;var wt=function(e){var t=gt.call(e,Et),r=e[Et];try{e[Et]=void 0;var n=!0}catch(e){}var i=yt.call(e);return n&&(t?e[Et]=r:delete e[Et]),i},Ct=Object.prototype.toString;var xt=wt,Ot=function(e){return Ct.call(e)},Pt=ft?ft.toStringTag:void 0;var Nt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Lt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Pt&&Pt in Object(e)?xt(e):Ot(e)},It=Nt;var Mt,jt=function(e){if(!It(e))return!1;var t=Lt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Tt=pt["__core-js_shared__"],_t=(Mt=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||""))?"Symbol(src)_1."+Mt:"";var kt=function(e){return!!_t&&_t in e},St=Function.prototype.toString;var Dt=jt,Ft=kt,zt=Nt,At=function(e){if(null!=e){try{return St.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Ht=/^\[object .+?Constructor\]$/,$t=Function.prototype,Rt=Object.prototype,Vt=$t.toString,Bt=Rt.hasOwnProperty,Ut=RegExp("^"+Vt.call(Bt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Wt=function(e){return!(!zt(e)||Ft(e))&&(Dt(e)?Ut:Ht).test(At(e))},Gt=function(e,t){return null==e?void 0:e[t]};var qt=function(e,t){var r=Gt(e,t);return Wt(r)?r:void 0},Yt=qt(Object,"create"),Xt=Yt;var Zt=function(){this.__data__=Xt?Xt(null):{},this.size=0};var Jt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Kt=Yt,Qt=Object.prototype.hasOwnProperty;var er=function(e){var t=this.__data__;if(Kt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Qt.call(t,e)?t[e]:void 0},tr=Yt,rr=Object.prototype.hasOwnProperty;var nr=function(e){var t=this.__data__;return tr?void 0!==t[e]:rr.call(t,e)},ir=Yt;var ar=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ir&&void 0===t?"__lodash_hash_undefined__":t,this},or=Zt,lr=Jt,sr=er,cr=nr,dr=ar;function ur(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])}}ur.prototype.clear=or,ur.prototype.delete=lr,ur.prototype.get=sr,ur.prototype.has=cr,ur.prototype.set=dr;var hr=ur;var mr=function(){this.__data__=[],this.size=0};var pr=function(e,t){return e===t||e!=e&&t!=t};var fr=function(e,t){for(var r=e.length;r--;)if(pr(e[r][0],t))return r;return-1},br=fr,vr=Array.prototype.splice;var gr=function(e){var t=this.__data__,r=br(t,e);return!(r<0)&&(r==t.length-1?t.pop():vr.call(t,r,1),--this.size,!0)},yr=fr;var Er=function(e){var t=this.__data__,r=yr(t,e);return r<0?void 0:t[r][1]},wr=fr;var Cr=fr;var xr=function(e,t){var r=this.__data__,n=Cr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Or=mr,Pr=gr,Nr=Er,Lr=function(e){return wr(this.__data__,e)>-1},Ir=xr;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=Or,Mr.prototype.delete=Pr,Mr.prototype.get=Nr,Mr.prototype.has=Lr,Mr.prototype.set=Ir;var jr=Mr,Tr=qt(pt,"Map"),_r=hr,kr=jr,Sr=Tr;var Dr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Fr=function(e,t){var r=e.__data__;return Dr(t)?r["string"==typeof t?"string":"hash"]:r.map},zr=Fr;var Ar=Fr;var Hr=Fr;var $r=Fr;var Rr=function(e,t){var r=$r(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr=function(){this.size=0,this.__data__={hash:new _r,map:new(Sr||kr),string:new _r}},Br=function(e){var t=zr(this,e).delete(e);return this.size-=t?1:0,t},Ur=function(e){return Ar(this,e).get(e)},Wr=function(e){return Hr(this,e).has(e)},Gr=Rr;function qr(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])}}qr.prototype.clear=Vr,qr.prototype.delete=Br,qr.prototype.get=Ur,qr.prototype.has=Wr,qr.prototype.set=Gr;var Yr=qr;function Xr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Xr.Cache||Yr),r}Xr.Cache=Yr;const Zr=Xr((()=>{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})),Jr=H((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:i})=>{const a=f(null),o=f(null);return m.createElement("div",{ref:a,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=a.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(),a.current&&(null===(t=o.current)||void 0===t||t.toggleAt(a.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,i&&m.createElement(i,{ref:o,data:e}))}));Jr.displayName="EventListItem";const Kr=({className:e,style:t,box:{Top:r,Left:n,Right:i,Bottom:a}})=>m.createElement(m.Fragment,null,m.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-a)+"%",right:100*(1-i)+"%",...t}}));Kr.displayName="LicensePlateLpr";const Qr=({Type:e,Box:t,Probability:r,width:n,height:i})=>{const{eventSchema:a}=p(ie),o=f(null),{Top:l,Left:s,Right:c,Bottom:d}=t;return w((()=>{if(!n||!i)return;if(!o.current)return;const e=o.current.getBoundingClientRect();let t=(s+c)/2*n-e.width/2,r=l*i-e.height-4;r<0&&(r=d*i+4),t<0&&(t=0),t>n-e.width&&(t=n-e.width),r>i-e.height&&(r=i-e.height),o.current.style.top=`${r}px`,o.current.style.left=`${t}px`})),m.createElement(m.Fragment,null,m.createElement(Kr,{box:t,style:{outline:`2px solid ${a.colorsByFoundObjectType.get(e)}`}}),m.createElement("div",{ref:o,className:"event-list-item__detected-object-label",title:`${e.toLowerCase()} ${Math.floor(100*r)}%`},m.createElement("div",{style:{padding:4,lineHeight:"24px"}},e.toLowerCase()),m.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:a.colorsByFoundObjectType.get(e)}},Math.floor(100*r),"%")))};function en({style:e}){return m.createElement("div",{className:"frame",style:e},m.createElement("div",{className:"corner-highlight-tl"}),m.createElement("div",{className:"corner-highlight-tr"}),m.createElement("div",{className:"corner-highlight-br"}),m.createElement("div",{className:"corner-highlight-bl"}))}Qr.displayName="DetectedObjectHighlight";const tn=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:i,thumbHeight:a,width:o,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:u}=t,h=100/i/(d-c),p={top:2},b=f(null);return w((()=>{if(!b.current)return;const e=b.current.getBoundingClientRect();let t=(c+d)/2*o-e.width/2,r=s*l-e.height-4;r<0&&(r=u*l+4),t<0&&(t=0),t>o-e.width&&(t=o-e.width),b.current.style.top=`${r}px`,b.current.style.left=`${t}px`})),c>=1-d?p.left=2:p.right=2,m.createElement(m.Fragment,null,m.createElement("div",{ref:b,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},m.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),m.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),m.createElement(Kr,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),m.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:i*(d-c)*h,height:a*(u-s)*h,...p}},m.createElement("img",{style:{width:i*h,height:a*h,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),m.createElement(en,null)))};tn.displayName="FaceHighlight";const rn=m.memo((({value:e})=>e?m.createElement(m.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?m.createElement(m.Fragment,{key:t},e):m.createElement("span",{key:t,className:"digit"},e)}))):null));rn.displayName="LicensePlateNumber";const nn=({detectedObject:e,height:t,width:r,url:n,thumbWidth:i,thumbHeight:a})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:u}=e,h=e.Value||e.Number,p=f(null);w((()=>{if(!p.current)return;const e=p.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,i=l*t-e.height-4;i<0&&(i=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),p.current.style.top=`${i}px`,p.current.style.left=`${n}px`}));const b={top:2};s>=1-c?b.left=2:b.right=2;const v=100/i/(c-s);return m.createElement(m.Fragment,null,m.createElement("div",{ref:p,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*u)}%`},m.createElement("div",{style:{padding:4}},m.createElement(rn,{value:h})),m.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*u),"%")),m.createElement(Kr,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),m.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:i*(c-s)*v,height:a*(d-l)*v+16,position:"absolute",...b}},m.createElement("img",{style:{width:i*v,height:a*v,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),m.createElement("div",{className:"plate-number"},m.createElement(rn,{value:h})),m.createElement(en,{style:{height:a*(d-l)*v}})))};nn.displayName="LicensePlateHighlight";const an=Ce({viewBox:"0 0 24 24",svg:m.createElement(m.Fragment,null,m.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),m.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"}))});an.displayName="ThermostatIcon";const on=H((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,m.createElement("div",{className:"event-list-item__temperature"},m.createElement(an,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));on.displayName="Temperature";const ln=H((({data:e,cameraNameHidden:t})=>{var r;const a=p(ie),{cameras:o}=a,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return m.createElement("div",{className:"event-list-item-caption"},m.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",a="";return n(e,new Date)?i(e,new Date)?r=a="HH:mm":i(e,t)?(r="EEE d MMM HH:mm",a="HH:mm"):r=a="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",a="d MMM HH:mm"):r=a="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",a+=":ss"),+e==+t?`${ne(e,r)}`:`${ne(e,r)} - ${ne(t,a)}`}(e.startTime,e.endTime)),t?null:m.createElement("div",{className:"event-list-item__camera-name",title:l},l),+e.endTime-+e.startTime>0&&m.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 i=(e-r)/60;if(i<60)return!r&&t?`${i}m`:`${i}m ${n}s`;const a=Math.floor(i/60);if(i-=60*a,!r&&!i&&t)return`${a}h`;const o=t?`${i}`:`${i}`.padStart(2,"0");return!r&&i&&t?`${a}h ${o}m`:`${a}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),m.createElement(on,{data:e}))}));ln.displayName="EventListItemCaption";const sn=H((({url:e,noPreview:t,width:r})=>m.createElement(m.Fragment,null,e?m.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,m.createElement(G,{radius:r}),t?m.createElement("div",{className:"no-preview-overlay"}):null)));sn.displayName="EventThumbnail";const cn=H((({data:e,width:t,height:r,cameraNameHidden:n,onClick:i,onAuxClick:a,menuComponent:o})=>{const l=p(ie),{eventSchema:s}=l,[c,d]=function(e){var t;const[r,n]=v(null),i=p(ie),{cameras:a,thumbnails:o}=i;y((()=>{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&&a.loaded?(l=(null===(t=a.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let u=null,h=null,f=null;if(e.detectedObjects.length){let n,i;const{ThumbnailSize:a}=JSON.parse(e.raw.data);a&&(n=a.Width,i=a.Height),u=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)).map(((e,n)=>m.createElement(Qr,{key:n,...e,height:r,width:t}))),h=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,a)=>m.createElement(nn,{key:a,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:i,url:c})))}if(e.faces){const{Width:n,Height:i}=JSON.parse(e.raw.data).ThumbnailSize;f=e.faces.map(((e,a)=>m.createElement(tn,{key:a,face:e,url:c,thumbWidth:n,thumbHeight:i,width:t,height:r})))}return m.createElement(Jr,{onClick:i,onAuxClick:a,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},m.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},m.createElement(sn,{url:c,noPreview:d,width:t}),u,h,f,e.acknowledged?m.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,m.createElement(ln,{data:e,cameraNameHidden:n})))}));cn.displayName="EventItem";class dn extends m.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),K.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),K.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 m.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},m.createElement("h1",null,"Oops. Something went wrong"),m.createElement("div",null,"We've been notified about this problem"),m.createElement(Ye,{onClick:()=>this.setState({hasError:!1})},"retry"))}}const un=H((({store:e,captionHeight:t=0,minColumnWidth:r=180,onEventClick:n,onEventAuxClick:i,eventRenderer:a=(({data:e,width:t,height:r})=>m.createElement(cn,{data:e,cameraNameHidden:!1,onClick:n,onAuxClick:i,width:t,height:r}))})=>{const o=f(),l=$((()=>({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(),m.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},m.createElement("div",{style:{textAlign:"center"}},m.createElement("div",null,"Couldn't fetch data"),m.createElement(Ye,{onClick:e.reload},"Retry")));if(e.loading)return l.reset(),m.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},m.createElement(dt,null));if(!e.data.length)return l.reset(),m.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},re.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 m.createElement(X,null,(({width:n,height:i})=>m.createElement(R,null,(()=>{var d;const u=Math.floor(n/r)||1,h=n/u/16*9+t,p=u*Math.floor(i/h)>=e.data.length?0:Zr(),f=Math.max(1,Math.floor((n-p)/r)),b=Math.ceil(e.data.length/f),v=(n-p-2*(f-1))/f,g=v/16*9+t;return m.createElement(m.Fragment,null,m.createElement(Z,{isItemLoaded:e=>e<b,itemCount:b+((null===(d=e.pageInfo)||void 0===d?void 0:d.haveMore)?1:0),loadMoreItems:s},(({onItemsRendered:t,ref:r})=>{var s;return m.createElement(J,{key:`${n}x${i}`,ref:Y(o,r),columnCount:f,columnWidth:e=>v+(e?2:0),height:i,width:n,rowCount:b+((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:i,overscanRowStartIndex:a})=>{l.update(e,r),t({overscanStartIndex:a,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:n})}},(t=>({columnIndex:r,rowIndex:n,style:i})=>m.createElement(R,null,(()=>{var o,l;const s=n*t+r,c=e.data[s];return i={...i,left:i.left+(r?2:0),width:i.width-(r?2:0),top:i.top+(n?2:0),height:i.height-(n?2:0)},s===e.data.length?e.error?m.createElement("div",{style:i},m.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},m.createElement("div",{style:{textAlign:"center"}},m.createElement("div",null,"Couldn't fetch more data"),m.createElement(Ye,{onClick:e.loadMore},"Retry")))):(null===(o=e.pageInfo)||void 0===o?void 0:o.haveMore)?m.createElement("div",{style:i},m.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},m.createElement(dt,{size:32}))):m.createElement("div",{style:i}):!c&&(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?m.createElement("div",{style:i}):c?m.createElement("div",{style:i},m.createElement(dn,null,a({data:c,width:i.width,height:i.height}))):m.createElement("div",{style:i})})))(f))})),m.createElement(R,null,(()=>e.pendingData.length?m.createElement("div",{style:{position:"absolute",top:0,left:0,right:p,pointerEvents:"none",textAlign:"center",padding:8}},m.createElement(Ye,{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")}},re.t("showEvents",{count:e.pendingData.length}))):null)))}))))}));un.displayName="EventGrid";const hn=({onEventClick:e,style:t,...r})=>{var n;const i=null!==(n=p(C))&&void 0!==n?n:x,[a,o]=v();return y((()=>{null==a||a.dispose();const e=new ye(i.events);e.initWith(i.api),e.load(),o(e)}),[i]),m.createElement(ie.Provider,{value:i},a?m.createElement("div",{style:{display:"flex",flexDirection:"column",...t},...r},m.createElement(Ae,{addionalFiltersEnabled:!0,store:a}),m.createElement(nt,{store:a}),a.someAnalyticsFilterSelected&&m.createElement(m.Fragment,null,m.createElement(ot,{getter:a.getProbabilityTreshold,setter:a.setProbabilityTreshold}),m.createElement(ct,{value:a.colors,toggle:a.toggleColor,clear:a.clearColors})),m.createElement("div",{style:{flex:1}},m.createElement(un,{minColumnWidth:1/0,store:a.eventsLoader,eventRenderer:({data:t,width:r,height:n})=>m.createElement(cn,{data:t,cameraNameHidden:!1,onClick:e,width:r,height:n})}))):null)};var mn;hn.displayName="EventList",(mn={resources:{en:{translation:Q}}})&&Object.assign(te,mn),o(re.init(te));export{hn as default};
|
|
1
|
+
import{format as e,subHours as t,startOfHour as r,isSameYear as n,isSameDay as i}from"date-fns/esm";import a from"i18next";import{from as o,Observable as l,Subscription as s,of as c,throwError as d,EMPTY as u}from"rxjs";import h,{useContext as m,useRef as p,createContext as f,useState as b,Children as v,useEffect as g,useCallback as y,useLayoutEffect as E}from"react";import{AppContext as w,app as C}from"@3deye-toolkit/core";import{computed as x,makeObservable as O,observable as P,action as N,runInAction as L,reaction as I}from"mobx";import{subHours as M}from"date-fns";import{mergeMap as j,catchError as T,switchMap as _,mapTo as k,concatMap as S}from"rxjs/operators";import D,{components as F}from"react-select";import z from"clsx";import{observer as A,useLocalObservable as H,Observer as $}from"mobx-react-lite";import{useSpring as R,animated as V}from"@react-spring/web";import B from"react-dom";import U from"react-datepicker";import W from"react-ink";import G from"@reach/tooltip";import q from"@seznam/compose-react-refs";import Y from"react-virtualized-auto-sizer";import X from"react-window-infinite-loader";import{VariableSizeGrid as Z}from"react-window";import*as J from"@sentry/browser";var K={filter:"Filter",button:{ok:"Ok"},noEventsFound:"no events found",showEvents_one:"show {{count}} new event",showEvents_other:"show {{count}} new events"};const Q=new Map,ee={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},te=a.createInstance();function re(t,r){const n=Q.get(te.language);return e(t,r,{locale:n})}const ne=h.createContext(null);var ie,ae;function oe(e,t=!1){const r=x(e);return new l((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"}(ie||(ie={})),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"}(ae||(ae={}));class le{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 s?e.closed||e.unsubscribe():e()}))}}const se=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class ce{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}),O(this,{id:x,startTime:x,endTime:x,acknowledged:x,isLive:x,raw:P.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=se.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!se.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class de extends le{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:i,cameras:a,polygons:o})=>this.api.cameras.GetSensorEventsPage({sensorIds:a,sensorType:"camera",sensorEventTypes:this.eventTypes,startTime:t,endTime:r,isDescending:"DESC"===e,rowsLimit:10,pageToken:null==i?void 0:i.nextPageToken},n,o).pipe(j((e=>e.success?c({events:e.resultItems,pageInfo:e.pageInfo}):d((()=>e.error)))),T((e=>(console.error(e),this.error=e,c({events:[],pageInfo:null})))))}),O(this,{data:P.ref,cameras:P.struct,detectedObjects:P.struct,from:P,to:P,sortDirection:P,probabilityThreshold:P,pendingData:P.ref,liveUpdateMode:P,setLiveUpdateMode:N,updateTrigger:P,colors:P.ref,flushUpdates:N,pageInfo:P.ref,isLive:x,loading:P,loadMoreTrigger:P,retryTrigger:P,error:P.ref,loadMore:N,filterJson:x})}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=oe((()=>({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(_((e=>oe((()=>this.retryTrigger),!0).pipe(k(e)))),_((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,polygons:a})=>(L((()=>{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:i,pageInfo:this.pageInfo,polygons:a}))))).subscribe((({events:e,pageInfo:t})=>{L((()=>{var r,n,i;if(!t)return;const a=e.map(ue);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:this.eventTypes.map((e=>ae[e])),from:null!==(n=null===(r=a[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!==(i=this.probabilityThreshold)&&void 0!==i?i:void 0}),a):this.data=a,this.eventsStore.add(a),this.pageInfo=t,this.loading=!1}))}))),this.disposables.push(e.pipe(_((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>oe((()=>this.loadMoreTrigger)).pipe(S((()=>this.requestData({from:e?new Date(e):void 0,to:t?new Date(t):void 0,sortDirection:r,filter:n,cameras:i,pageInfo:this.pageInfo,polygons:this.polygons}))))))).subscribe((({events:e,pageInfo:t})=>{if(!t)return;const r=e.map(ue);this.eventsStore.add(r),L((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(oe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(_((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?oe((()=>this.eventsStore.recentAdditions)):u))).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&&L((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(oe((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(_((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?oe((()=>this.eventsStore.recentAdditions)):(this.pendingData&&L((()=>this.pendingData=[])),u)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&L((()=>{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=>ae[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 s?e.closed||e.unsubscribe():e()}))}}function ue(e){return new ce(e)}const he={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"},me={50:"#e0f7fa",100:"#b2ebf2",200:"#80deea",300:"#4dd0e1",400:"#26c6da",500:"#00bcd4",600:"#00acc1",700:"#0097a7",800:"#00838f",900:"#006064",A100:"#84ffff",A200:"#18ffff",A400:"#00e5ff",A700:"#00b8d4"},pe={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"},fe={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"},be={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"},ve={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"};class ge extends le{constructor(e){super(),Object.defineProperty(this,"cameraFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"objectFilters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"date",{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,"facesProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.7}),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,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"toggleSorting",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.sortDirection="ASC"===this.sortDirection?"DESC":"ASC",null===this.date&&(this.date=t(r(new Date),1))}}),Object.defineProperty(this,"applyFilters",{enumerable:!0,configurable:!0,writable:!0,value:()=>{var e;this.eventsLoader.cameras=this.cameraFilters.map((e=>e.id)),this.eventsLoader.detectedObjects=this.objectFilters.map((e=>e.id)),this.eventsLoader.colors=this.colors,this.eventsLoader.probabilityThreshold=this.objectFilters.length?this.probabilityThreshold:null,"ASC"===this.sortDirection?(this.eventsLoader.sortDirection="ASC",this.eventsLoader.to=void 0,this.eventsLoader.from=this.date):(this.eventsLoader.sortDirection="DESC",this.eventsLoader.from=void 0,this.eventsLoader.to=null!==(e=this.date)&&void 0!==e?e:void 0)}}),Object.defineProperty(this,"getProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityTreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e,this.applyFilters()}}),O(this,{cameraFilters:P.ref,objectFilters:P.ref,date:P,sortDirection:P,probabilityThreshold:P,setProbabilityTreshold:N,facesProbabilityThreshold:P,colors:P.ref,someAnalyticsFilterSelected:x,filters:x,setFilters:N,load:N,toggleColor:N.bound,clearColors:N.bound,applyFilters:N,toggleSorting:N}),this.eventsLoader=new de(e),this.eventsLoader.loading=!0,this.eventsLoader.probabilityThreshold=null}get someAnalyticsFilterSelected(){return!!this.objectFilters.length}get filters(){return this.objectFilters.concat(this.cameraFilters)}load(){this.eventsLoader.load()}setFilters(e){this.cameraFilters=e?e.filter((e=>!("type"in e))):[],this.objectFilters=e?e.filter((e=>"type"in e)):[]}toggleColor(e){const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t,this.applyFilters()}clearColors(){this.colors=new Set,this.applyFilters()}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposables.forEach((e=>{e instanceof s?e.closed||e.unsubscribe():e()})),this.eventsLoader.dispose()}}var ye,Ee=(ye=8,{container:e=>({...e,padding:ye}),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*ye}px)`,marginTop:ye?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%)"})});function we(e){return t=>{const{size:r=24,color:n="currentColor",className:i,...a}=t,o=e.viewBox||"0 0 24 24",l=e.svg;return h.createElement("svg",{preserveAspectRatio:"xMinYMin",className:z("icon",i),width:r,fill:n,viewBox:o,...a},l)}}const Ce=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Ce.displayName="LabelIcon";const xe=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});xe.displayName="CameraIcon";const Oe=we({viewBox:"0 0 24 24",svg:h.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"})});Oe.displayName="LuggageIcon";const Pe=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Pe.displayName="CarIcon";const Ne=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Ne.displayName="BoatIcon";const Le=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.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"}))});Le.displayName="BicycleIcon";const Ie=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});Ie.displayName="DirectionsWalkIcon";const Me=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),h.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),h.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),h.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),h.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"}))});Me.displayName="PetsIcon";const je=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}),h.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"}),h.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"}),h.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"}))});je.displayName="LicensePlateIcon";const Te=({data:e})=>{const t=16;return"licensePlate"===e.type?null:"detectedObject"!==e.type?h.createElement(xe,{size:t}):"Luggage"===e.id?h.createElement(Oe,{size:t}):"Car"===e.id?h.createElement(Pe,{size:t}):"Person"===e.id?h.createElement(Ie,{size:t}):"Bicycle"===e.id?h.createElement(Le,{size:t}):"Boat"===e.id?h.createElement(Ne,{size:t}):"Animal"===e.id?h.createElement(Me,{size:t}):"LicensePlate"===e.id?h.createElement(je,{size:t}):h.createElement(Ce,{size:t})},_e=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=F,{data:a}=e;if("licensePlate"===a.type)return h.createElement(i,{innerProps:r,...n},h.createElement("span",{style:{paddingLeft:8,paddingRight:8,borderRadius:4,border:"1px solid black"}},t));if("detectedObject"===a.type){const e={display:"inline-flex",alignItems:"center",width:"auto"},o={...r,style:e};return h.createElement(i,{innerProps:o,...n},h.createElement(Te,{data:a}),h.createElement("div",{style:{marginLeft:4}},t))}return h.createElement(i,{...e})},ke=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=F,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return h.createElement(i,{innerProps:o,...n},h.createElement(Te,{data:a}),h.createElement("div",{style:{marginLeft:4}},t))},Se=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"}),h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Se.displayName="FilterListIcon";const De={...Ee,multiValue:(e,{data:t})=>"color"in t?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>"color"in t?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>"color"in t?{...e,color:"white",":hover":{backgroundColor:"rgba(255, 255, 255, 0.7)",color:t.color}}:{...e,color:"hsl(0, 0%, 20%)"},option:(e,{data:t,isFocused:r})=>"color"in t?"type"in t&&"licensePlate"===t.type?{...e,color:t.color,backgroundColor:r?me[50]:"transparent",":active":{...e[":active"],backgroundColor:me[100]}}:{...e,color:t.color}:{...e,color:"black"}},Fe=e=>{const{children:t,...r}=e;return h.createElement(F.Placeholder,{...r},h.createElement(Se,{size:16,style:{position:"relative",top:4}})," ",t)},ze=A((({addionalFiltersEnabled:e,store:t})=>{const{cameras:r,eventSchema:n}=m(ne),i=p({opened:!1});return h.createElement(D,{closeMenuOnSelect:!1,isMulti:!0,onChange:(e,r)=>{t.setFilters(e),"remove-value"!==r.action||i.current.opened||t.applyFilters()},onMenuOpen:()=>i.current.opened=!0,onMenuClose:()=>{i.current.opened=!1,t.applyFilters()},getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:(()=>{if(!n)return[];const t=e?n.foundObjectTypesForSelect:[];return r.loaded?[].concat(t,r.data.slice()):t})(),placeholder:te.t("filter"),value:t.filters,components:{MultiValueLabel:ke,Option:_e,Placeholder:Fe},styles:De})}));ze.displayName="EventsPanelSelect";const Ae=e=>`scale(${e})`,He=({children:e,from:t,style:r})=>{const n=R({opacity:1,from:{opacity:0},config:{tension:300}});return h.createElement(V.div,{style:{...r,...n,transform:n.opacity.to(Ae),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},$e=document.body;class Re extends h.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){$e.appendChild(this.el)}componentWillUnmount(){$e.removeChild(this.el)}render(){return B.createPortal(this.props.children,this.el)}}const Ve=({width:e,height:t,color:r,position:n="top",style:i})=>{const a=[0,"top"===n?t:0],o=[e,a[1]],l=[e/2,t-a[1]],s=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-a[1]],d=[e-c[0],c[1]],u=[e-s[0],s[1]],m=e=>e.join(","),p=`M ${m(a)} C ${m(s)} ${m(c)} ${m(l)} ${m(d)} ${m(u)} ${m(o)} Z`;return h.createElement("svg",{className:"tip",style:i,width:e,height:t,fill:r},h.createElement("path",{d:p}))};class Be extends h.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:h.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:h.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:i,height:a,width:o}=t.getBoundingClientRect();let l="calc(50% - 12px)",s="auto";const c=this.popoverRef.current;let d="bottom"===this.props.placement?i+10:r-c.clientHeight-10,u=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";d<0&&(d=i+10,h="top"),u<0&&(u=0,l=n+o/2-12),u+c.clientWidth>window.innerWidth&&(u=window.innerWidth-c.clientWidth,l=n-u+o/2-12),e&&(d=a+10,u=0,l=8,"top"===this.props.placement&&(s=d,d="auto")),this.setState({top:d,bottom:s,left:u,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:i}=this.state,{className:a,opened:o,disablePortal:l,disableAnimation:s}=this.props,c={position:"absolute",left:i};"bottom"===n?c.bottom=-8:c.top=-8;const d=z(a,"x-3deye-popover-body");let u=null;if(o){const i={zIndex:l?1:100000001,position:"absolute",top:e,bottom:r,left:t},a=h.createElement("div",{className:d,ref:this.popoverRef},this.props.children,h.createElement(Ve,{width:24,height:8,position:n,color:"white",style:c}));u=s?h.createElement("div",{style:i},a):h.createElement(He,{from:n,style:i},a)}const m=h.cloneElement(this.props.target,{ref:this.targetRef});if(l)return h.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},m,u);const p=o&&h.createElement(Re,null,u);return h.createElement(h.Fragment,null,m,p)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const Ue={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},We=({label:e,children:t})=>h.createElement(G,{label:e,style:Ue},t);We.displayName="Tooltip";class Ge extends h.Component{render(){const{forwardedRef:e,children:t,className:r,fullWidth:n,variant:i,type:a,title:o,...l}=this.props,s=z(r,"x-3deye-button",{"x-3deye-button--fullwidth":n},i?`x-3deye-button--${i}`:void 0),c=h.createElement("button",{ref:e,className:s,type:a||"button",...l},t,l.disabled?null:h.createElement(W,null));return o?h.createElement(We,{label:o},c):c}}const qe=h.forwardRef(((e,t)=>h.createElement(Ge,{forwardedRef:t,...e}))),Ye=we({viewBox:"0 0 24 24",svg:h.createElement("g",null,h.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"}),h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Ye.displayName="CloseIcon";const Xe=(e,t,r)=>Math.min(Math.max(e,t),r),Ze=()=>{},Je=(e,t,r,n)=>Xe(Math.floor((e-t)/r*n),0,n-1),Ke=f({value:null,onPointerDown:Ze,setCurrentValue:Ze,state:{currentIdx:0,currentValue:null,options:[]}});class Qe{constructor(e=0){Object.defineProperty(this,"currentIdx",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"setCurrentIdx",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.currentIdx=e}}),Object.defineProperty(this,"setOptions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.options=e}}),this.currentIdx=e,O(this,{currentIdx:P,options:P.ref,currentValue:x,setCurrentIdx:N,setOptions:N})}get currentValue(){return this.options[this.currentIdx]}}const et=A((({value:e,onChange:t,children:r,style:n})=>{const[i,a]=b(!1),o=p(null),l=v.map(r,(e=>null==e?void 0:e.props.value))||[],s=H((()=>new Qe(l.indexOf(e))));s.setOptions(l);const c=v.count(r);g((()=>{s.setCurrentIdx(l.indexOf(e))}),[e]),g((()=>{var e;if(!i)return;const r=null===(e=o.current)||void 0===e?void 0:e.getBoundingClientRect();if(!r)return;const n=({clientX:e})=>{s.setCurrentIdx(Je(e,r.left,r.width,c))},d=()=>{a(!1),t(l[s.currentIdx])};return document.addEventListener("pointermove",n),document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",d)}}),[i,c]);return h.createElement(Ke.Provider,{value:{value:e,state:s,onPointerDown:e=>{const t=o.current;if(!t)return;const{left:r,width:n}=t.getBoundingClientRect(),i=Je(e.clientX,r,n,c);i!==s.currentIdx&&s.setCurrentIdx(i),a(!0)},setCurrentValue:e=>{s.setCurrentIdx(l.indexOf(e))}}},h.createElement("div",{className:"segmented-control-wrapper",style:n},h.createElement("div",{role:"radiogroup",ref:o,className:"segmented-control",style:{"--indicator-offset":100*s.currentIdx+"%"}},h.createElement("div",{"aria-hidden":!0,className:z("segmented-control-indicator",{active:i}),style:{width:100/l.length+"%"}},h.createElement("div",{className:"segmented-control-indicator-inner"})),r)))}));et.displayName="SegmentedControl";const tt=A((({value:e,children:t})=>{const r=m(Ke);return h.createElement("button",{role:"radio","aria-checked":r.state.currentValue===e,tabIndex:0,className:z("segmented-control-button",{current:r.state.currentValue===e}),onPointerDown:r.onPointerDown,onClick:()=>r.setCurrentValue(e)},t)}));tt.displayName="SegmentedControlOption";const rt=A((({store:e})=>{const{date:t,sortDirection:r}=e,n=H((()=>({opened:!1,toggle(){this.opened=!this.opened},close(){this.opened=!1,e.applyFilters()},onDateChange(t){e.date=t},clear(){e.date=null,e.applyFilters()}}))),i=h.createElement("div",{style:{flex:1,display:"flex",position:"relative"}},h.createElement(qe,{className:"date-button",style:{flex:1,alignItems:"flex-start",borderRadius:0},onClick:n.toggle},t?h.createElement("sup",null,"ASC"===r?"From":"To"):null,h.createElement("span",null,t?re(t,"MMM d, HH:mm"):"live")),t?h.createElement(qe,{className:"x-3deye-button--icon",style:{position:"absolute",right:0},onClick:n.clear},h.createElement(Ye,{size:16})):null);return h.createElement("div",{className:"events-panel-datepicker"},h.createElement("div",{style:{position:"relative"}},h.createElement(Be,{target:i,opened:n.opened,onCloseRequest:n.close,disableAnimation:!0,className:"popover-datetimepicker"},h.createElement(et,{value:r,onChange:e.toggleSorting},h.createElement(tt,{value:"ASC"},"From"),h.createElement(tt,{value:"DESC"},"To")),h.createElement(U,{selected:t,onChange:n.onDateChange,showTimeSelect:!0,dateFormat:"MMM d, HH:mm",timeFormat:"HH:mm",inline:!0}),h.createElement(qe,{onClick:n.close,variant:"filled",style:{borderRadius:4}},te.t("button.ok")))))}));rt.displayName="EventsPanelDatepicker";const nt=e=>Math.round(e),it=h.forwardRef((({value:e,onChange:t,onChangeComplete:r,orientation:n="horizontal",disabled:i=!1,labelFormat:a=(e=>`${e}`),style:o},l)=>{const s=p(null),c=p(null),[d,u]=b(!1),[m,f]=b(e);g((()=>{if(!d)return;const e=s.current;if(!e)return;let i=0,a=0;const o=e.getBoundingClientRect();if(!o)return;const l=({clientX:e,clientY:r})=>{if(!c.current)return;let l=0;"horizontal"===n?(i=Xe(e-o.x,0,o.width),l=i/o.width*100,c.current.style.transform=`translateX(${i}px)`):(a=o.height-Xe(r-o.y,0,o.height),l=a/o.height*100,c.current.style.transform=`translateY(${-a}px)`),f(l),null==t||t(nt(l))},h=({clientX:e,clientY:i})=>{if(u(!1),!c.current)return;const a="horizontal"===n?Xe(e-o.x,0,o.width)/o.width*100:100*(1-Xe(i-o.y,0,o.height)/o.height);c.current.style.transform="",f(a),null==t||t(nt(a)),null==r||r(nt(a))},m=()=>{if(u(!1),!c.current)return;const e="horizontal"===n?i/o.width*100:a/o.height*100;c.current.style.transform="",null==t||t(nt(e)),null==r||r(nt(e))};return e.addEventListener("pointercancel",m),e.addEventListener("pointermove",l),e.addEventListener("pointerup",h),()=>{e.removeEventListener("pointercancel",m),e.removeEventListener("pointermove",l),e.removeEventListener("pointerup",h)}}),[d,n,t]);const v=y((({clientX:e,clientY:r,pointerId:a})=>{if(!s.current||i)return;u(!0),s.current.setPointerCapture(a);const o=s.current.getBoundingClientRect();if(!o)return;if(!c.current)return;let l=0;if("horizontal"===n){const t=Xe(e-o.x,0,o.width);l=t/o.width*100,c.current.style.transform=`translateX(${t}px)`}else{const e=o.height-Xe(r-o.y,0,o.height);l=e/o.height*100,c.current.style.transform=`translateY(${-e}px)`}f(l),null==t||t(nt(l))}),[n,i]),E=y((n=>{if(i)return;let a=null;"ArrowLeft"===n.code?a=Math.max(e-1,0):"ArrowRight"===n.code?a=Math.min(e+1,100):"ArrowDown"===n.code?a=Math.max(e-1,0):"ArrowUp"===n.code&&(a=Math.min(e+1,100)),null!==a&&(n.stopPropagation(),n.preventDefault(),null==t||t(a),null==r||r(a))}),[e,t,r,n,i]);return h.createElement("div",{ref:q(l,s),tabIndex:0,onKeyDown:E,className:z("x-3deye-slider",n,{disabled:i}),onPointerDown:v,style:o},h.createElement("div",{className:"x-3deye-slider__track"},h.createElement("div",{className:"x-3deye-slider__bar",style:{width:"horizontal"===n?`${d?m:e}%`:void 0,height:"vertical"===n?`${d?m:e}%`:void 0}})),h.createElement("div",{ref:c,className:z("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"}},h.createElement("div",{className:"x-3deye-slider__label "+(d?"open":"")},a(d?nt(m):e))))}));it.displayName="Slider";const at=A((({getter:e,setter:t})=>{const[r,n]=b(0),i=p(null),a=Math.floor(100*e());return g((()=>I(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),h.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},h.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},h.createElement("div",null,"CONFIDENCE"),h.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),h.createElement("div",{style:{padding:"0 10px"}},h.createElement(it,{value:r,labelFormat:e=>`${e}%`,onChangeComplete:e=>{t(e/100)}})))}));at.displayName="ProbabilitySlider";const ot=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),h.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});ot.displayName="DoneIcon";const lt=[{color:be[500],name:"red",highlightColor:be[100]},{color:pe[500],name:"green",highlightColor:pe[100]},{color:he[500],name:"blue",highlightColor:he[100]},{color:ve[500],name:"yellow",highlightColor:ve[900]},{color:"#000",name:"black",highlightColor:"#fff"},{color:"#fff",name:"white",highlightColor:"#000"},{color:fe[500],name:"dimgrey",highlightColor:fe[100]}],st=A((({value:e,clear:t,toggle:r})=>h.createElement("div",{className:"color-selector"},h.createElement("div",null,"COLOR"),h.createElement("div",{className:"color-selector__items"},lt.map((({color:t,highlightColor:n,name:i})=>h.createElement("button",{key:i,className:z("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t},onClick:r.bind(null,i)},h.createElement(ot,{color:n,size:20})))),h.createElement(qe,{className:"color-selector__clear",disabled:!e.size,onClick:t},h.createElement(Ye,{size:20}))))));st.displayName="ColorSelector";const ct=({size:e=48})=>h.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},h.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),h.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)"},h.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));ct.displayName="Preloader";var dt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ut="object"==typeof dt&&dt&&dt.Object===Object&&dt,ht="object"==typeof self&&self&&self.Object===Object&&self,mt=ut||ht||Function("return this")(),pt=mt.Symbol,ft=pt,bt=Object.prototype,vt=bt.hasOwnProperty,gt=bt.toString,yt=ft?ft.toStringTag:void 0;var Et=function(e){var t=vt.call(e,yt),r=e[yt];try{e[yt]=void 0;var n=!0}catch(e){}var i=gt.call(e);return n&&(t?e[yt]=r:delete e[yt]),i},wt=Object.prototype.toString;var Ct=Et,xt=function(e){return wt.call(e)},Ot=pt?pt.toStringTag:void 0;var Pt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Nt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ot&&Ot in Object(e)?Ct(e):xt(e)},Lt=Pt;var It,Mt=function(e){if(!Lt(e))return!1;var t=Nt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},jt=mt["__core-js_shared__"],Tt=(It=/[^.]+$/.exec(jt&&jt.keys&&jt.keys.IE_PROTO||""))?"Symbol(src)_1."+It:"";var _t=function(e){return!!Tt&&Tt in e},kt=Function.prototype.toString;var St=Mt,Dt=_t,Ft=Pt,zt=function(e){if(null!=e){try{return kt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},At=/^\[object .+?Constructor\]$/,Ht=Function.prototype,$t=Object.prototype,Rt=Ht.toString,Vt=$t.hasOwnProperty,Bt=RegExp("^"+Rt.call(Vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Ut=function(e){return!(!Ft(e)||Dt(e))&&(St(e)?Bt:At).test(zt(e))},Wt=function(e,t){return null==e?void 0:e[t]};var Gt=function(e,t){var r=Wt(e,t);return Ut(r)?r:void 0},qt=Gt(Object,"create"),Yt=qt;var Xt=function(){this.__data__=Yt?Yt(null):{},this.size=0};var Zt=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Jt=qt,Kt=Object.prototype.hasOwnProperty;var Qt=function(e){var t=this.__data__;if(Jt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Kt.call(t,e)?t[e]:void 0},er=qt,tr=Object.prototype.hasOwnProperty;var rr=function(e){var t=this.__data__;return er?void 0!==t[e]:tr.call(t,e)},nr=qt;var ir=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nr&&void 0===t?"__lodash_hash_undefined__":t,this},ar=Xt,or=Zt,lr=Qt,sr=rr,cr=ir;function dr(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])}}dr.prototype.clear=ar,dr.prototype.delete=or,dr.prototype.get=lr,dr.prototype.has=sr,dr.prototype.set=cr;var ur=dr;var hr=function(){this.__data__=[],this.size=0};var mr=function(e,t){return e===t||e!=e&&t!=t};var pr=function(e,t){for(var r=e.length;r--;)if(mr(e[r][0],t))return r;return-1},fr=pr,br=Array.prototype.splice;var vr=function(e){var t=this.__data__,r=fr(t,e);return!(r<0)&&(r==t.length-1?t.pop():br.call(t,r,1),--this.size,!0)},gr=pr;var yr=function(e){var t=this.__data__,r=gr(t,e);return r<0?void 0:t[r][1]},Er=pr;var wr=pr;var Cr=function(e,t){var r=this.__data__,n=wr(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},xr=hr,Or=vr,Pr=yr,Nr=function(e){return Er(this.__data__,e)>-1},Lr=Cr;function Ir(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])}}Ir.prototype.clear=xr,Ir.prototype.delete=Or,Ir.prototype.get=Pr,Ir.prototype.has=Nr,Ir.prototype.set=Lr;var Mr=Ir,jr=Gt(mt,"Map"),Tr=ur,_r=Mr,kr=jr;var Sr=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Dr=function(e,t){var r=e.__data__;return Sr(t)?r["string"==typeof t?"string":"hash"]:r.map},Fr=Dr;var zr=Dr;var Ar=Dr;var Hr=Dr;var $r=function(e,t){var r=Hr(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Rr=function(){this.size=0,this.__data__={hash:new Tr,map:new(kr||_r),string:new Tr}},Vr=function(e){var t=Fr(this,e).delete(e);return this.size-=t?1:0,t},Br=function(e){return zr(this,e).get(e)},Ur=function(e){return Ar(this,e).has(e)},Wr=$r;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=Rr,Gr.prototype.delete=Vr,Gr.prototype.get=Br,Gr.prototype.has=Ur,Gr.prototype.set=Wr;var qr=Gr;function Yr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Yr.Cache||qr),r}Yr.Cache=qr;const Xr=Yr((()=>{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})),Zr=A((({data:e,children:t,onClick:r,onAuxClick:n,menuComponent:i})=>{const a=p(null),o=p(null);return h.createElement("div",{ref:a,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=a.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(),a.current&&(null===(t=o.current)||void 0===t||t.toggleAt(a.current,{top:e.clientY,left:e.clientX}))},draggable:!0},t,i&&h.createElement(i,{ref:o,data:e}))}));Zr.displayName="EventListItem";const Jr=({className:e,style:t,box:{Top:r,Left:n,Right:i,Bottom:a}})=>h.createElement(h.Fragment,null,h.createElement("div",{className:e,style:{position:"absolute",top:100*r+"%",left:100*n+"%",bottom:100*(1-a)+"%",right:100*(1-i)+"%",...t}}));Jr.displayName="LicensePlateLpr";const Kr=({Type:e,Box:t,Probability:r,width:n,height:i})=>{const{eventSchema:a}=m(ne),o=p(null),{Top:l,Left:s,Right:c,Bottom:d}=t;return E((()=>{if(!n||!i)return;if(!o.current)return;const e=o.current.getBoundingClientRect();let t=(s+c)/2*n-e.width/2,r=l*i-e.height-4;r<0&&(r=d*i+4),t<0&&(t=0),t>n-e.width&&(t=n-e.width),r>i-e.height&&(r=i-e.height),o.current.style.top=`${r}px`,o.current.style.left=`${t}px`})),h.createElement(h.Fragment,null,h.createElement(Jr,{box:t,style:{outline:`2px solid ${a.colorsByFoundObjectType.get(e)}`}}),h.createElement("div",{ref:o,className:"event-list-item__detected-object-label",title:`${e.toLowerCase()} ${Math.floor(100*r)}%`},h.createElement("div",{style:{padding:4,lineHeight:"24px"}},e.toLowerCase()),h.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{backgroundColor:a.colorsByFoundObjectType.get(e)}},Math.floor(100*r),"%")))};function Qr({style:e}){return h.createElement("div",{className:"frame",style:e},h.createElement("div",{className:"corner-highlight-tl"}),h.createElement("div",{className:"corner-highlight-tr"}),h.createElement("div",{className:"corner-highlight-br"}),h.createElement("div",{className:"corner-highlight-bl"}))}Kr.displayName="DetectedObjectHighlight";const en=({face:{Name:e,Box:t,Probability:r},url:n,thumbWidth:i,thumbHeight:a,width:o,height:l})=>{const{Top:s,Left:c,Right:d,Bottom:u}=t,m=100/i/(d-c),f={top:2},b=p(null);return E((()=>{if(!b.current)return;const e=b.current.getBoundingClientRect();let t=(c+d)/2*o-e.width/2,r=s*l-e.height-4;r<0&&(r=u*l+4),t<0&&(t=0),t>o-e.width&&(t=o-e.width),b.current.style.top=`${r}px`,b.current.style.left=`${t}px`})),c>=1-d?f.left=2:f.right=2,h.createElement(h.Fragment,null,h.createElement("div",{ref:b,className:"event-list-item__detected-object-label trigger",title:`${e} ${Math.floor(100*r)}%`},h.createElement("div",{style:{padding:4,display:"flex",alignItems:"center",maxWidth:120,whiteSpace:"break-spaces"}},e),h.createElement("div",{className:"event-list-item__detected-object-label__caption",style:{color:"black",backgroundColor:"orange"}},Math.floor(100*r),"%")),h.createElement(Jr,{className:"trigger",box:t,style:{outline:"1px solid orange"}}),h.createElement("div",{className:"event-list-item-face preview",style:{overflow:"hidden",width:i*(d-c)*m,height:a*(u-s)*m,...f}},h.createElement("img",{style:{width:i*m,height:a*m,transform:`translate(-${100*c}%, -${100*s}%)`},src:n}),h.createElement(Qr,null)))};en.displayName="FaceHighlight";const tn=h.memo((({value:e})=>e?h.createElement(h.Fragment,null,e.split("").map(((e,t)=>{const r=e.charCodeAt(0);return r<48||r>57?h.createElement(h.Fragment,{key:t},e):h.createElement("span",{key:t,className:"digit"},e)}))):null));tn.displayName="LicensePlateNumber";const rn=({detectedObject:e,height:t,width:r,url:n,thumbWidth:i,thumbHeight:a})=>{const{Type:o,Box:{Top:l,Left:s,Right:c,Bottom:d},Probability:u}=e,m=e.Value||e.Number,f=p(null);E((()=>{if(!f.current)return;const e=f.current.getBoundingClientRect();let n=(s+c)/2*r-e.width/2,i=l*t-e.height-4;i<0&&(i=d*t+4),n<0&&(n=0),n>r-e.width&&(n=r-e.width),f.current.style.top=`${i}px`,f.current.style.left=`${n}px`}));const b={top:2};s>=1-c?b.left=2:b.right=2;const v=100/i/(c-s);return h.createElement(h.Fragment,null,h.createElement("div",{ref:f,className:"event-list-item__license-plate-label trigger",title:`${o.toLowerCase()} ${Math.floor(100*u)}%`},h.createElement("div",{style:{padding:4}},h.createElement(tn,{value:m})),h.createElement("div",{className:"event-list-item__license-plate-label__caption"},Math.floor(100*u),"%")),h.createElement(Jr,{className:"event-list-item__license-plate-trigger trigger",box:e.Box}),h.createElement("div",{className:"event-list-item__license-plate preview",style:{overflow:"hidden",width:i*(c-s)*v,height:a*(d-l)*v+16,position:"absolute",...b}},h.createElement("img",{style:{width:i*v,height:a*v,transform:`translate(-${100*s}%, -${100*l}%)`},src:n}),h.createElement("div",{className:"plate-number"},h.createElement(tn,{value:m})),h.createElement(Qr,{style:{height:a*(d-l)*v}})))};rn.displayName="LicensePlateHighlight";const nn=we({viewBox:"0 0 24 24",svg:h.createElement(h.Fragment,null,h.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),h.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"}))});nn.displayName="ThermostatIcon";const an=A((({data:e})=>{if("Temperature"!==e.type)return null;let t=Number(e.raw.data);return t=5*(t-32)/9+273.15,h.createElement("div",{className:"event-list-item__temperature"},h.createElement(nn,null),(t-273.15).toFixed(1),"°C / ",(9*t/5-459.67).toFixed(1),"°F")}));an.displayName="Temperature";const on=A((({data:e,cameraNameHidden:t})=>{var r;const a=m(ne),{cameras:o}=a,l=o.loaded&&(null===(r=o.camerasById.get(e.cameraId))||void 0===r?void 0:r.name)||"...";return h.createElement("div",{className:"event-list-item-caption"},h.createElement("div",{className:"event-list-item__time"},function(e,t){let r="",a="";return n(e,new Date)?i(e,new Date)?r=a="HH:mm":i(e,t)?(r="EEE d MMM HH:mm",a="HH:mm"):r=a="EEE d MMM HH:mm":n(e,t)?(r="yyyy d MMM HH:mm",a="d MMM HH:mm"):r=a="yyyy d MMM HH:mm",(e.getSeconds()||t.getSeconds())&&(r+=":ss",a+=":ss"),+e==+t?`${re(e,r)}`:`${re(e,r)} - ${re(t,a)}`}(e.startTime,e.endTime)),t?null:h.createElement("div",{className:"event-list-item__camera-name",title:l},l),+e.endTime-+e.startTime>0&&h.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 i=(e-r)/60;if(i<60)return!r&&t?`${i}m`:`${i}m ${n}s`;const a=Math.floor(i/60);if(i-=60*a,!r&&!i&&t)return`${a}h`;const o=t?`${i}`:`${i}`.padStart(2,"0");return!r&&i&&t?`${a}h ${o}m`:`${a}h ${o}m ${n}s`}(+e.endTime-+e.startTime)),h.createElement(an,{data:e}))}));on.displayName="EventListItemCaption";const ln=A((({url:e,noPreview:t,width:r})=>h.createElement(h.Fragment,null,e?h.createElement("img",{key:e,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:e}):null,h.createElement(W,{radius:r}),t?h.createElement("div",{className:"no-preview-overlay"}):null)));ln.displayName="EventThumbnail";const sn=A((({data:e,width:t,height:r,cameraNameHidden:n,onClick:i,onAuxClick:a,menuComponent:o})=>{const l=m(ne),{eventSchema:s}=l,[c,d]=function(e){var t;const[r,n]=b(null),i=m(ne),{cameras:a,thumbnails:o}=i;g((()=>{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&&a.loaded?(l=(null===(t=a.camerasById.get(e.cameraId))||void 0===t?void 0:t.imageUrl)||"",s=!0):r&&(l=r.url),[l,s]}(e);let u=null,p=null,f=null;if(e.detectedObjects.length){let n,i;const{ThumbnailSize:a}=JSON.parse(e.raw.data);a&&(n=a.Width,i=a.Height),u=e.detectedObjects.filter((({Type:e})=>s.foundObjectTypes.includes(e)&&"LicensePlate"!==e)).map(((e,n)=>h.createElement(Kr,{key:n,...e,height:r,width:t}))),p=e.detectedObjects.filter((({Type:e})=>"LicensePlate"===e)).map(((e,a)=>h.createElement(rn,{key:a,detectedObject:e,width:t,height:r,thumbWidth:n,thumbHeight:i,url:c})))}if(e.faces){const{Width:n,Height:i}=JSON.parse(e.raw.data).ThumbnailSize;f=e.faces.map(((e,a)=>h.createElement(en,{key:a,face:e,url:c,thumbWidth:n,thumbHeight:i,width:t,height:r})))}return h.createElement(Zr,{onClick:i,onAuxClick:a,data:e,width:t,height:r,cameraNameHidden:n,menuComponent:o},h.createElement("div",{style:{position:"absolute",top:0,left:0,bottom:0,right:0}},h.createElement(ln,{url:c,noPreview:d,width:t}),u,p,f,e.acknowledged?h.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,h.createElement(on,{data:e,cameraNameHidden:n})))}));sn.displayName="EventItem";class cn extends h.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{hasError:!1}})}componentDidCatch(e,t){this.setState({hasError:!0}),J.withScope((r=>{Object.keys(t).forEach((e=>{r.setExtra(e,t[e])})),J.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 h.createElement("div",{style:{flex:1,padding:10,display:"grid",placeItems:"center",alignContent:"center",textAlign:"center",...this.props.style},...r},h.createElement("h1",null,"Oops. Something went wrong"),h.createElement("div",null,"We've been notified about this problem"),h.createElement(qe,{onClick:()=>this.setState({hasError:!1})},"retry"))}}const dn=A((({store:e,captionHeight:t=0,minColumnWidth:r=180,onEventClick:n,onEventAuxClick:i,eventRenderer:a=(({data:e,width:t,height:r})=>h.createElement(sn,{data:e,cameraNameHidden:!1,onClick:n,onAuxClick:i,width:t,height:r}))})=>{const o=p(),l=H((()=>({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(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},h.createElement("div",{style:{textAlign:"center"}},h.createElement("div",null,"Couldn't fetch data"),h.createElement(qe,{onClick:e.reload},"Retry")));if(e.loading)return l.reset(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},h.createElement(ct,null));if(!e.data.length)return l.reset(),h.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},te.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 h.createElement(Y,null,(({width:n,height:i})=>h.createElement($,null,(()=>{var d;const u=Math.floor(n/r)||1,m=n/u/16*9+t,p=u*Math.floor(i/m)>=e.data.length?0:Xr(),f=Math.max(1,Math.floor((n-p)/r)),b=Math.ceil(e.data.length/f),v=(n-p-2*(f-1))/f,g=v/16*9+t;return h.createElement(h.Fragment,null,h.createElement(X,{isItemLoaded:e=>e<b,itemCount:b+((null===(d=e.pageInfo)||void 0===d?void 0:d.haveMore)?1:0),loadMoreItems:s},(({onItemsRendered:t,ref:r})=>{var s;return h.createElement(Z,{key:`${n}x${i}`,ref:q(o,r),columnCount:f,columnWidth:e=>v+(e?2:0),height:i,width:n,rowCount:b+((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:i,overscanRowStartIndex:a})=>{l.update(e,r),t({overscanStartIndex:a,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:n})}},(t=>({columnIndex:r,rowIndex:n,style:i})=>h.createElement($,null,(()=>{var o,l;const s=n*t+r,c=e.data[s];return i={...i,left:i.left+(r?2:0),width:i.width-(r?2:0),top:i.top+(n?2:0),height:i.height-(n?2:0)},s===e.data.length?e.error?h.createElement("div",{style:i},h.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},h.createElement("div",{style:{textAlign:"center"}},h.createElement("div",null,"Couldn't fetch more data"),h.createElement(qe,{onClick:e.loadMore},"Retry")))):(null===(o=e.pageInfo)||void 0===o?void 0:o.haveMore)?h.createElement("div",{style:i},h.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},h.createElement(ct,{size:32}))):h.createElement("div",{style:i}):!c&&(null===(l=e.pageInfo)||void 0===l?void 0:l.haveMore)?h.createElement("div",{style:i}):c?h.createElement("div",{style:i},h.createElement(cn,null,a({data:c,width:i.width,height:i.height}))):h.createElement("div",{style:i})})))(f))})),h.createElement($,null,(()=>e.pendingData.length?h.createElement("div",{style:{position:"absolute",top:0,left:0,right:p,pointerEvents:"none",textAlign:"center",padding:8}},h.createElement(qe,{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")}},te.t("showEvents",{count:e.pendingData.length}))):null)))}))))}));dn.displayName="EventGrid";const un=({onEventClick:e,style:t,...r})=>{var n;const i=null!==(n=m(w))&&void 0!==n?n:C,[a,o]=b();return g((()=>{null==a||a.dispose();const e=new ge(i.events);e.initWith(i.api),e.load(),o(e)}),[i]),h.createElement(ne.Provider,{value:i},a?h.createElement("div",{style:{display:"flex",flexDirection:"column",...t},...r},h.createElement(ze,{addionalFiltersEnabled:!0,store:a}),h.createElement(rt,{store:a}),a.someAnalyticsFilterSelected&&h.createElement(h.Fragment,null,h.createElement(at,{getter:a.getProbabilityTreshold,setter:a.setProbabilityTreshold}),h.createElement(st,{value:a.colors,toggle:a.toggleColor,clear:a.clearColors})),h.createElement("div",{style:{flex:1}},h.createElement(dn,{minColumnWidth:1/0,store:a.eventsLoader,eventRenderer:({data:t,width:r,height:n})=>h.createElement(sn,{data:t,cameraNameHidden:!1,onClick:e,width:r,height:n})}))):null)};var hn;un.displayName="EventList",(hn={resources:{en:{translation:K}}})&&Object.assign(ee,hn),o(te.init(ee));export{un as default};
|
package/dist/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3deye-toolkit/react-event-list",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.29",
|
|
4
4
|
"module": "dist/react-event-list.js",
|
|
5
5
|
"types": "dist/react-event-list.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@3deye-toolkit/core": "
|
|
10
|
+
"@3deye-toolkit/core": "0.0.1-alpha.29",
|
|
11
11
|
"@reach/tooltip": "^0.17.0",
|
|
12
12
|
"@react-spring/web": "^9.4.2",
|
|
13
13
|
"@sentry/browser": "^5.15.5",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"*.css"
|
|
35
35
|
],
|
|
36
36
|
"license": "mit",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "5b47d51ae43158bf213709f5ef38f5eb401cfc92"
|
|
38
38
|
}
|