@3deye-toolkit/react-event-search 0.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-event-search.css +1748 -0
- package/dist/react-event-search.d.ts +945 -0
- package/dist/react-event-search.js +65 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +47 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{format as e,startOfDay as t,endOfDay as r,isSameYear as n,isSameDay as i,subDays as a,subHours as o}from"date-fns/esm";import s from"i18next";import{from as l,Observable as c,Subscription as u,of as d,throwError as h,EMPTY as p,Subject as m}from"rxjs";import{computed as f,makeObservable as b,observable as v,action as g,runInAction as y,reaction as w}from"mobx";import{mergeMap as _,catchError as E,switchMap as C,mapTo as O,concatMap as P,distinctUntilChanged as x,share as j,map as T,debounceTime as S}from"rxjs/operators";import I from"earcut";import{subHours as D}from"date-fns";import{AppContext as M,app as A}from"@3deye-toolkit/core";import*as L from"react";import N,{useRef as R,useState as k,useEffect as z,useMemo as H,useCallback as F,useContext as U,Fragment as B}from"react";import{observer as V,Observer as $,useLocalObservable as W}from"mobx-react-lite";import G,{components as q}from"react-select";import Y from"clsx";import X from"material-colors";import K from"react-ink";import J from"@reach/tooltip";import{MDCSlider as Z}from"@material/slider";import Q from"resize-observer-polyfill";import*as ee from"react-dom";import te from"react-dom";import{FixedSizeGrid as re}from"react-window";import ne from"react-virtualized-auto-sizer";import ie from"react-window-infinite-loader";import ae from"@seznam/compose-react-refs";import{useSpring as oe,animated as se}from"@react-spring/web";import le from"react-datepicker";import{extent as ce,bin as ue,max as de}from"d3-array";import{select as he}from"d3-selection";import{scaleTime as pe,scaleLinear as me}from"d3-scale";import{timeMinute as fe,timeHours as be,timeHour as ve}from"d3-time";import{axisBottom as ge}from"d3-axis";import{brushX as ye}from"d3-brush";import{timeFormat as we}from"d3-time-format";var _e={eventSearchRequestError:"Sorry, an error occured during event search. Please try again later",today:"today",yesterday:"yesterday",selectObjectType:"Select object type",noEventsFound:"no events found"};const Ee=new Map,Ce={detection:{order:["querystring","htmlTag","navigator"],lookupQuerystring:"lang"},fallbackLng:"en",load:"all",interpolation:{escapeValue:!1}},Oe=s.createInstance();function Pe(t,r){const n=Ee.get(Oe.language);return e(t,r,{locale:n})}var xe,je;function Te(e,t=!1){const r=f(e);return new c((e=>{const n=r.observe_((({newValue:t})=>e.next(t)),t);return()=>n()}))}!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.CONNECTED=1]="CONNECTED",e[e.RECONNECTING=2]="RECONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED"}(xe||(xe={})),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"}(je||(je={}));var Se=function(){this.__data__=[],this.size=0};var Ie=function(e,t){return e===t||e!=e&&t!=t};var De=function(e,t){for(var r=e.length;r--;)if(Ie(e[r][0],t))return r;return-1},Me=Array.prototype.splice;var Ae=function(e){var t=this.__data__,r=De(t,e);return!(r<0)&&(r==t.length-1?t.pop():Me.call(t,r,1),--this.size,!0)};var Le=function(e){var t=this.__data__,r=De(t,e);return r<0?void 0:t[r][1]};var Ne=function(e){return De(this.__data__,e)>-1};var Re=function(e,t){var r=this.__data__,n=De(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function ke(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])}}ke.prototype.clear=Se,ke.prototype.delete=Ae,ke.prototype.get=Le,ke.prototype.has=Ne,ke.prototype.set=Re;var ze=ke;var He=function(){this.__data__=new ze,this.size=0};var Fe=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Ue=function(e){return this.__data__.get(e)};var Be=function(e){return this.__data__.has(e)},Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $e(e){var t={exports:{}};return e(t,t.exports),t.exports}var We="object"==typeof Ve&&Ve&&Ve.Object===Object&&Ve,Ge="object"==typeof self&&self&&self.Object===Object&&self,qe=We||Ge||Function("return this")(),Ye=qe.Symbol,Xe=Object.prototype,Ke=Xe.hasOwnProperty,Je=Xe.toString,Ze=Ye?Ye.toStringTag:void 0;var Qe=function(e){var t=Ke.call(e,Ze),r=e[Ze];try{e[Ze]=void 0;var n=!0}catch(e){}var i=Je.call(e);return n&&(t?e[Ze]=r:delete e[Ze]),i},et=Object.prototype.toString;var tt=function(e){return et.call(e)},rt=Ye?Ye.toStringTag:void 0;var nt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":rt&&rt in Object(e)?Qe(e):tt(e)};var it=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var at,ot=function(e){if(!it(e))return!1;var t=nt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},st=qe["__core-js_shared__"],lt=(at=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||""))?"Symbol(src)_1."+at:"";var ct=function(e){return!!lt&< in e},ut=Function.prototype.toString;var dt=function(e){if(null!=e){try{return ut.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ht=/^\[object .+?Constructor\]$/,pt=Function.prototype,mt=Object.prototype,ft=pt.toString,bt=mt.hasOwnProperty,vt=RegExp("^"+ft.call(bt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var gt=function(e){return!(!it(e)||ct(e))&&(ot(e)?vt:ht).test(dt(e))};var yt=function(e,t){return null==e?void 0:e[t]};var wt=function(e,t){var r=yt(e,t);return gt(r)?r:void 0},_t=wt(qe,"Map"),Et=wt(Object,"create");var Ct=function(){this.__data__=Et?Et(null):{},this.size=0};var Ot=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Pt=Object.prototype.hasOwnProperty;var xt=function(e){var t=this.__data__;if(Et){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Pt.call(t,e)?t[e]:void 0},jt=Object.prototype.hasOwnProperty;var Tt=function(e){var t=this.__data__;return Et?void 0!==t[e]:jt.call(t,e)};var St=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Et&&void 0===t?"__lodash_hash_undefined__":t,this};function It(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])}}It.prototype.clear=Ct,It.prototype.delete=Ot,It.prototype.get=xt,It.prototype.has=Tt,It.prototype.set=St;var Dt=It;var Mt=function(){this.size=0,this.__data__={hash:new Dt,map:new(_t||ze),string:new Dt}};var At=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Lt=function(e,t){var r=e.__data__;return At(t)?r["string"==typeof t?"string":"hash"]:r.map};var Nt=function(e){var t=Lt(this,e).delete(e);return this.size-=t?1:0,t};var Rt=function(e){return Lt(this,e).get(e)};var kt=function(e){return Lt(this,e).has(e)};var zt=function(e,t){var r=Lt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Ht(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])}}Ht.prototype.clear=Mt,Ht.prototype.delete=Nt,Ht.prototype.get=Rt,Ht.prototype.has=kt,Ht.prototype.set=zt;var Ft=Ht;var Ut=function(e,t){var r=this.__data__;if(r instanceof ze){var n=r.__data__;if(!_t||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ft(n)}return r.set(e,t),this.size=r.size,this};function Bt(e){var t=this.__data__=new ze(e);this.size=t.size}Bt.prototype.clear=He,Bt.prototype.delete=Fe,Bt.prototype.get=Ue,Bt.prototype.has=Be,Bt.prototype.set=Ut;var Vt=Bt;var $t=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Wt=function(e){return this.__data__.has(e)};function Gt(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Ft;++t<r;)this.add(e[t])}Gt.prototype.add=Gt.prototype.push=$t,Gt.prototype.has=Wt;var qt=Gt;var Yt=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1};var Xt=function(e,t){return e.has(t)};var Kt=function(e,t,r,n,i,a){var o=1&r,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var c=a.get(e),u=a.get(t);if(c&&u)return c==t&&u==e;var d=-1,h=!0,p=2&r?new qt:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],f=t[d];if(n)var b=o?n(f,m,d,t,e,a):n(m,f,d,e,t,a);if(void 0!==b){if(b)continue;h=!1;break}if(p){if(!Yt(t,(function(e,t){if(!Xt(p,t)&&(m===e||i(m,e,r,n,a)))return p.push(t)}))){h=!1;break}}else if(m!==f&&!i(m,f,r,n,a)){h=!1;break}}return a.delete(e),a.delete(t),h},Jt=qe.Uint8Array;var Zt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r};var Qt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},er=Ye?Ye.prototype:void 0,tr=er?er.valueOf:void 0;var rr=function(e,t,r,n,i,a,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Jt(e),new Jt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ie(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Zt;case"[object Set]":var l=1&n;if(s||(s=Qt),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=2,o.set(e,t);var u=Kt(s(e),s(t),n,i,a,o);return o.delete(e),u;case"[object Symbol]":if(tr)return tr.call(e)==tr.call(t)}return!1};var nr=function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e},ir=Array.isArray;var ar=function(e,t,r){var n=t(e);return ir(e)?n:nr(n,r(e))};var or=function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a};var sr=function(){return[]},lr=Object.prototype.propertyIsEnumerable,cr=Object.getOwnPropertySymbols,ur=cr?function(e){return null==e?[]:(e=Object(e),or(cr(e),(function(t){return lr.call(e,t)})))}:sr;var dr=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var hr=function(e){return null!=e&&"object"==typeof e};var pr=function(e){return hr(e)&&"[object Arguments]"==nt(e)},mr=Object.prototype,fr=mr.hasOwnProperty,br=mr.propertyIsEnumerable,vr=pr(function(){return arguments}())?pr:function(e){return hr(e)&&fr.call(e,"callee")&&!br.call(e,"callee")};var gr=function(){return!1},yr=$e((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r?qe.Buffer:void 0,a=(i?i.isBuffer:void 0)||gr;e.exports=a})),wr=/^(?:0|[1-9]\d*)$/;var _r=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&wr.test(e))&&e>-1&&e%1==0&&e<t};var Er=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Cr={};Cr["[object Float32Array]"]=Cr["[object Float64Array]"]=Cr["[object Int8Array]"]=Cr["[object Int16Array]"]=Cr["[object Int32Array]"]=Cr["[object Uint8Array]"]=Cr["[object Uint8ClampedArray]"]=Cr["[object Uint16Array]"]=Cr["[object Uint32Array]"]=!0,Cr["[object Arguments]"]=Cr["[object Array]"]=Cr["[object ArrayBuffer]"]=Cr["[object Boolean]"]=Cr["[object DataView]"]=Cr["[object Date]"]=Cr["[object Error]"]=Cr["[object Function]"]=Cr["[object Map]"]=Cr["[object Number]"]=Cr["[object Object]"]=Cr["[object RegExp]"]=Cr["[object Set]"]=Cr["[object String]"]=Cr["[object WeakMap]"]=!1;var Or=function(e){return hr(e)&&Er(e.length)&&!!Cr[nt(e)]};var Pr=function(e){return function(t){return e(t)}},xr=$e((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r&&We.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a})),jr=xr&&xr.isTypedArray,Tr=jr?Pr(jr):Or,Sr=Object.prototype.hasOwnProperty;var Ir=function(e,t){var r=ir(e),n=!r&&vr(e),i=!r&&!n&&yr(e),a=!r&&!n&&!i&&Tr(e),o=r||n||i||a,s=o?dr(e.length,String):[],l=s.length;for(var c in e)!t&&!Sr.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||_r(c,l))||s.push(c);return s},Dr=Object.prototype;var Mr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Dr)};var Ar=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Lr=Object.prototype.hasOwnProperty;var Nr=function(e){if(!Mr(e))return Ar(e);var t=[];for(var r in Object(e))Lr.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Rr=function(e){return null!=e&&Er(e.length)&&!ot(e)};var kr=function(e){return Rr(e)?Ir(e):Nr(e)};var zr=function(e){return ar(e,kr,ur)},Hr=Object.prototype.hasOwnProperty;var Fr=function(e,t,r,n,i,a){var o=1&r,s=zr(e),l=s.length;if(l!=zr(t).length&&!o)return!1;for(var c=l;c--;){var u=s[c];if(!(o?u in t:Hr.call(t,u)))return!1}var d=a.get(e),h=a.get(t);if(d&&h)return d==t&&h==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++c<l;){var f=e[u=s[c]],b=t[u];if(n)var v=o?n(b,f,u,t,e,a):n(f,b,u,e,t,a);if(!(void 0===v?f===b||i(f,b,r,n,a):v)){p=!1;break}m||(m="constructor"==u)}if(p&&!m){var g=e.constructor,y=t.constructor;g==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y||(p=!1)}return a.delete(e),a.delete(t),p},Ur=wt(qe,"DataView"),Br=wt(qe,"Promise"),Vr=wt(qe,"Set"),$r=wt(qe,"WeakMap"),Wr=dt(Ur),Gr=dt(_t),qr=dt(Br),Yr=dt(Vr),Xr=dt($r),Kr=nt;(Ur&&"[object DataView]"!=Kr(new Ur(new ArrayBuffer(1)))||_t&&"[object Map]"!=Kr(new _t)||Br&&"[object Promise]"!=Kr(Br.resolve())||Vr&&"[object Set]"!=Kr(new Vr)||$r&&"[object WeakMap]"!=Kr(new $r))&&(Kr=function(e){var t=nt(e),r="[object Object]"==t?e.constructor:void 0,n=r?dt(r):"";if(n)switch(n){case Wr:return"[object DataView]";case Gr:return"[object Map]";case qr:return"[object Promise]";case Yr:return"[object Set]";case Xr:return"[object WeakMap]"}return t});var Jr=Kr,Zr="[object Object]",Qr=Object.prototype.hasOwnProperty;var en=function(e,t,r,n,i,a){var o=ir(e),s=ir(t),l=o?"[object Array]":Jr(e),c=s?"[object Array]":Jr(t),u=(l="[object Arguments]"==l?Zr:l)==Zr,d=(c="[object Arguments]"==c?Zr:c)==Zr,h=l==c;if(h&&yr(e)){if(!yr(t))return!1;o=!0,u=!1}if(h&&!u)return a||(a=new Vt),o||Tr(e)?Kt(e,t,r,n,i,a):rr(e,t,l,r,n,i,a);if(!(1&r)){var p=u&&Qr.call(e,"__wrapped__"),m=d&&Qr.call(t,"__wrapped__");if(p||m){var f=p?e.value():e,b=m?t.value():t;return a||(a=new Vt),i(f,b,r,n,a)}}return!!h&&(a||(a=new Vt),Fr(e,t,r,n,i,a))};var tn=function e(t,r,n,i,a){return t===r||(null==t||null==r||!hr(t)&&!hr(r)?t!=t&&r!=r:en(t,r,n,i,e,a))};var rn=function(e,t){return tn(e,t)};class nn{constructor(){Object.defineProperty(this,"api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]})}initWith(e){this.api=e,this.afterInit&&this.afterInit()}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}var an=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a};var on=function(e,t,r){if(!it(r))return!1;var n=typeof t;return!!("number"==n?Rr(r)&&_r(t,r.length):"string"==n&&t in r)&&Ie(r[t],e)},sn=/\s/;var ln=function(e){for(var t=e.length;t--&&sn.test(e.charAt(t)););return t},cn=/^\s+/;var un=function(e){return e?e.slice(0,ln(e)+1).replace(cn,""):e};var dn=function(e){return"symbol"==typeof e||hr(e)&&"[object Symbol]"==nt(e)},hn=/^[-+]0x[0-9a-f]+$/i,pn=/^0b[01]+$/i,mn=/^0o[0-7]+$/i,fn=parseInt;var bn=function(e){if("number"==typeof e)return e;if(dn(e))return NaN;if(it(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=it(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=un(e);var r=pn.test(e);return r||mn.test(e)?fn(e.slice(2),r?2:8):hn.test(e)?NaN:+e};var vn=function(e){return e?Infinity===(e=bn(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var gn=function(e){var t=vn(e),r=t%1;return t==t?r?t-r:t:0},yn=Math.ceil,wn=Math.max;var _n=function(e,t,r){t=(r?on(e,t,r):void 0===t)?1:wn(gn(t),0);var n=null==e?0:e.length;if(!n||t<1)return[];for(var i=0,a=0,o=Array(yn(n/t));i<n;)o[a++]=an(e,i,i+=t);return o};const En=([e,t],[r,n],[i,a])=>{const o=(n-t)*(i-r)-(r-e)*(a-n);return 0===o?0:o>0?1:2},Cn=([e,t],[r,n],[i,a])=>r<=Math.max(e,i)&&r>=Math.min(e,i)&&n<=Math.max(t,a)&&n>=Math.min(t,a),On=(e,t,r)=>!(e<r.x||t<r.y||e>r.x+r.width||t>r.y+r.height),Pn=(e,t,r)=>{const n=r.y1*r.x3-r.x1*r.y3+(r.y3-r.y1)*e+(r.x1-r.x3)*t,i=r.x1*r.y2-r.y1*r.x2+(r.y1-r.y2)*e+(r.x2-r.x1)*t;if(n<0!=i<0)return!1;const a=-r.y2*r.x3+r.y1*(r.x3-r.x2)+r.x1*(r.y2-r.y3)+r.x2*r.y3;return a<0?n<=0&&n+i>=a:n>=0&&n+i<=a},xn=(e,t)=>{if(On(t.x1,t.y1,e))return!0;if(On(t.x2,t.y2,e))return!0;if(On(t.x3,t.y3,e))return!0;if(Pn(e.x,e.y,t))return!0;if(Pn(e.x+e.width,e.y,t))return!0;if(Pn(e.x+e.width,e.y+e.height,t))return!0;if(Pn(e.x,e.y+e.height,t))return!0;const r=[[[e.x,e.y],[e.x+e.width,e.y]],[[e.x+e.width,e.y],[e.x+e.width,e.y+e.height]],[[e.x,e.y+e.height],[e.x+e.width,e.y+e.height]],[[e.x,e.y],[e.x,e.y+e.height]]];return!![[[t.x1,t.y1],[t.x2,t.y2]],[[t.x1,t.y1],[t.x3,t.y3]]].some((e=>r.some((t=>(([e,t],[r,n])=>{const i=En(e,t,r),a=En(e,t,n),o=En(r,n,e),s=En(r,n,t);return i!==a&&o!==s||!(0!==i||!Cn(e,r,t))||!(0!==a||!Cn(e,n,t))||!(0!==o||!Cn(r,e,n))||!(0!==s||!Cn(r,t,n))})(t,e)))))},jn=(e,t)=>{const r=e.map((({x:e,y:t})=>[e,t]));return _n(I(r.flat()),3).some((r=>xn(t,{x1:e[r[0]].x,y1:e[r[0]].y,x2:e[r[1]].x,y2:e[r[1]].y,x3:e[r[2]].x,y3:e[r[2]].y})))},Tn=new Set(["LicensePlate","FaceDetection","Analytic","SpeedDetection","Temperature","PoS","GPS","DigitalInput"]);class Sn{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}),b(this,{id:f,startTime:f,endTime:f,acknowledged:f,isLive:f,raw:v.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=Tn.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!Tn.has(this.type)&&+this.startTime==+this.endTime}get acknowledged(){return"sensorId"in this.raw&&!!this.raw.ackEventType}}class In extends nn{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,"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(_((e=>e.success?d({events:e.resultItems,pageInfo:e.pageInfo}):h(e.error))),E((e=>(console.error(e),this.error=e,d({events:[],pageInfo:null})))))}),b(this,{data:v.ref,cameras:v.struct,detectedObjects:v.struct,from:v,to:v,sortDirection:v,probabilityThreshold:v,pendingData:v.ref,liveUpdateMode:v,updateTrigger:v,colors:v.ref,flushUpdates:g,pageInfo:v.ref,isLive:f,loading:v,loadMoreTrigger:v,retryTrigger:v,error:v.ref,loadMore:g,filterJson:f})}get isLive(){return"DESC"==this.sortDirection&&!this.to}get totalCount(){return this.data.length}get filterJson(){if(1===this.eventTypes.length&&this.eventTypes[0]===je.FaceDetection)return null;const{probabilityThreshold:e}=this;if(null===e)return null;const t={And:[]};return this.detectedObjects.length&&t.And.push({Or:this.detectedObjects.map((e=>({Type:e})))}),this.colors.size&&t.And.push({Or:[...this.colors].map((e=>({ObjectColors:[e]})))}),t.And.push({Or:[{Probability:e}]}),JSON.stringify(t)}initDataLoading(){const e=Te((()=>({from:this.from?+this.from:void 0,to:this.to?+this.to:void 0,sortDirection:this.sortDirection,filter:this.filterJson,cameraFilters:this.cameras,polygons:this.polygons})),!0);this.disposables.push(e.pipe(C((e=>Te((()=>this.retryTrigger),!0).pipe(O(e)))),C((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i,polygons:a})=>(y((()=>{this.loading=!0,this.pageInfo=null,this.error=null,this.data=[]})),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})=>{y((()=>{var r,n,i;if(!t)return;const a=e.map(Dn);this.isLive?this.data=this.uniquelyConcat(this.eventsStore.getEvents({cameraIds:this.cameras,eventTypes:6===this.eventTypes[0]?["FaceDetection"]:[],from:null!==(n=null===(r=a[0])||void 0===r?void 0:r.startTime)&&void 0!==n?n:D(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(C((({from:e,to:t,sortDirection:r,filter:n,cameraFilters:i})=>Te((()=>this.loadMoreTrigger)).pipe(P((()=>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(Dn);this.eventsStore.add(r),y((()=>{this.data=this.data.concat(r),this.pageInfo=t,this.loading=!1}))})))}initLiveUpdates(){this.disposables.push(Te((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(C((({liveUpdateMode:e,isLive:t})=>t&&"auto"===e?Te((()=>this.eventsStore.recentAdditions)):p))).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&&y((()=>{this.data=[...t,...this.data]}))}))),this.disposables.push(Te((()=>({liveUpdateMode:this.liveUpdateMode,isLive:this.isLive})),!0).pipe(C((({liveUpdateMode:e,isLive:t})=>t&&"manual"===e?Te((()=>this.eventsStore.recentAdditions)):(this.pendingData&&y((()=>this.pendingData=[])),p)))).subscribe((e=>{if(!this.data.length)return;const t=this.filter(e.map((e=>this.eventsStore.eventsById.get(e))));t.length&&y((()=>{this.pendingData=[...t,...this.pendingData]}))})))}filter(e){let t=e;const{from:r,to:n}=this;return 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&&6===this.eventTypes[0]&&(t=t.filter((e=>"FaceDetection"===e.type))),this.detectedObjects.length&&(t=t.filter((e=>e.detectedObjects.some((e=>{const{probabilityThreshold:t}=this;return!(null!==t&&e.Probability<t)&&(this.colors.size?this.detectedObjects.includes(e.Type)&&e.Colors.some((e=>this.colors.has(e.Color))):this.detectedObjects.includes(e.Type))}))))),t}uniquelyConcat(e,t){if(!e.length)return t.concat();if(!t.length)return e.concat();const r=e=>[e.id,e];return Array.from(new Map([...e.map(r),...t.map(r)]).values())}dispose(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}function Dn(e){return new Sn(e)}const Mn={Top:0,Left:0,Bottom:1,Right:1};class An extends nn{constructor(e,n,i,a){super(),Object.defineProperty(this,"eventSchema",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"notification",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"heatmaps",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"analyticsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposeReactionToCamera",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"date",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"regions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"filters",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"colors",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"peopleCountingDataLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"heatmapLoading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"heatmap",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"peopleCountingData",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"probabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:.5}),Object.defineProperty(this,"brushFilter",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"eventsLoader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"setDate",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.date=e}}),Object.defineProperty(this,"setFilters",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.filters=e}}),Object.defineProperty(this,"getProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.probabilityThreshold}),Object.defineProperty(this,"setProbabilityThreshold",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.probabilityThreshold=e}}),Object.defineProperty(this,"setBrushFilter",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.brushFilter=e}}),Object.defineProperty(this,"setParams",{enumerable:!0,configurable:!0,writable:!0,value:({cameraId:e,box:t})=>{this.cameraId=e,this.regions=[[{x:t.Left,y:t.Top},{x:t.Right,y:t.Top},{x:t.Right,y:t.Bottom},{x:t.Left,y:t.Bottom}]],this.date||(this.date=new Date)}}),Object.defineProperty(this,"openForPlayer",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e}}),Object.defineProperty(this,"searchFullFrame",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.cameraId=e,this.clear(),this.peopleCountingData=[],this.date||(this.date=new Date)}}),Object.defineProperty(this,"setRegions",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.regions=e.length?e:null}}),Object.defineProperty(this,"toggleHeatmap",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.heatmapHidden=!this.heatmapHidden}}),Object.defineProperty(this,"toggleColor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Set(this.colors);this.colors.has(e)?t.delete(e):t.add(e),this.colors=t}}),Object.defineProperty(this,"clearColors",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.colors=new Set}}),Object.defineProperty(this,"clear",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.date=null,this.regions=null,this.brushFilter=null,this.heatmap=null,this.data=[],this.peopleCountingData=[]}}),Object.defineProperty(this,"initDataFetching",{enumerable:!0,configurable:!0,writable:!0,value:()=>{const e=Te((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId}))).pipe(x(rn),j());this.disposables.push(Te((()=>({date:this.date,regions:this.regions,cameraId:this.cameraId,filters:this.filters,brushFilter:this.brushFilter,colors:this.colors,probabilityThreshold:this.probabilityThreshold}))).pipe(x(rn),j()).subscribe((e=>{y((()=>{if(!e.date||!e.cameraId)return;this.eventsLoader.sortDirection="DESC";const n=t(e.date),i=r(e.date);this.eventsLoader.from=n,this.eventsLoader.to=i;const{brushFilter:a}=e;a&&([this.eventsLoader.from,this.eventsLoader.to]=a),this.eventsLoader.polygons=e.regions?e.regions.map(this.regionToWktPolygon):[],this.eventsLoader.cameras=[e.cameraId],this.eventsLoader.detectedObjects=e.filters.map((e=>e.id)),this.eventsLoader.eventTypes=[je.Analytic],this.eventsLoader.colors=e.colors,this.eventsLoader.probabilityThreshold=e.probabilityThreshold,this.eventsLoader.load()}))})));const n=this.heatmaps;n&&(this.disposables.push(e.pipe(C((e=>{if(!e.date||!e.cameraId)return p;y((()=>{this.peopleCountingDataLoading=!0}));const n=t(e.date),i=r(e.date),a=e.regions?this.boxRegions(e.regions):Mn;return this.api.cameras.GetPeopleCountingData(e.cameraId,n,i,a).pipe(_((e=>e.success?d(e.resultItems):h(e.error)))).pipe(E((e=>(this.notification.error(Oe.t("eventSearchRequestError.peopleCounting")),console.error(e),d([])))))}))).subscribe((e=>{y((()=>{this.peopleCountingData=e,this.peopleCountingDataLoading=!1}))}))),this.disposables.push(Te((()=>({date:this.date,cameraId:this.cameraId}))).pipe(x(rn),C((e=>{if(!e.date||!e.cameraId)return p;y((()=>{this.heatmapLoading=!0}));const i=t(e.date),a=r(e.date);return n.fetchHeatmaps(e.cameraId,i,a,1).pipe(T((e=>e[0]||null))).pipe(E((e=>(this.notification.error(Oe.t("eventSearchRequestError.heatmap")),console.error(e),d(null)))))}))).subscribe((e=>{y((()=>{this.heatmap=e,this.heatmapLoading=!1}))}))))}}),b(this,{cameraId:v,date:v,regions:v.ref,filters:v.ref,colors:v.ref,peopleCountingDataLoading:v,heatmapHidden:v,heatmapLoading:v,data:v.ref,heatmap:v.ref,peopleCountingData:v.ref,probabilityThreshold:v,brushFilter:v.ref,params:f,filteredData:f,filteredPeopleCountingData:f,setDate:g,setFilters:g,setBrushFilter:g,setParams:g,openForPlayer:g,searchFullFrame:g,setRegions:g,toggleHeatmap:g,toggleColor:g,clearColors:g,clear:g}),this.analyticsEnabled=Boolean(a),this.eventsLoader=new In(n),this.eventsLoader.liveUpdateMode="disabled",this.initDataFetching()}get params(){return this.eventSchema.schemaDescription.filter((e=>"filter"===e.parameterType))}get filteredData(){let e=[];const t=this.filters.map((e=>e.id));t.length?(e=this.data.filter((e=>e.detectedObjects.some((e=>t.includes(e.Type)&&e.Probability>=this.probabilityThreshold)))),this.colors.size&&(e=e.filter((e=>e.detectedObjects.some((e=>e.Colors.some((e=>this.colors.has(e.Color))))))))):e=this.data.filter((e=>e.detectedObjects.some((e=>e.Probability>=this.probabilityThreshold))));const{brushFilter:r}=this;r&&(e=e.filter((e=>e.startTime>=r[0]&&e.startTime<=r[1]&&e.detectedObjects.some((e=>"Person"===e.Type)))));const{regions:n}=this;return n&&n.length&&(e=e.filter((e=>e.detectedObjects.some((e=>(!t.length||t.includes(e.Type))&&(!this.colors.size||e.Colors.some((e=>this.colors.has(e.Color))))&&e.Probability>=this.probabilityThreshold&&n.some((t=>jn(t,{x:e.Box.Left,y:e.Box.Top,width:e.Box.Right-e.Box.Left,height:e.Box.Bottom-e.Box.Top})))))))),e}get filteredPeopleCountingData(){const{regions:e}=this;return(null==e?void 0:e.length)?this.peopleCountingData.filter((t=>e.some((e=>jn(e,{x:t.Left,y:t.Top,width:t.Right-t.Left,height:t.Bottom-t.Top}))))):this.peopleCountingData}regionToWktPolygon(e){return e.length?"POLYGON (("+e.concat(e[0]).map((({x:e,y:t})=>`${e} ${t}`)).join(", ")+"))":"POLYGON (())"}boxRegions(e){const t=e.flatMap((e=>e.map((({x:e})=>e)))),r=e.flatMap((e=>e.map((({y:e})=>e))));return{Left:Math.min(...t),Right:Math.max(...t),Top:Math.min(...r),Bottom:Math.max(...r)}}afterInit(){this.eventsLoader.initWith(this.api)}dispose(){this.disposeReactionToCamera&&this.disposeReactionToCamera(),this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()}))}}const Ln=N.createContext(null);function Nn(e){return t=>{const{size:r=24,color:n="currentColor",className:i,...a}=t,o=e.viewBox||"0 0 24 24",s=e.svg;return N.createElement("svg",{preserveAspectRatio:"xMinYMin",className:`icon ${i}`,width:r,fill:n,viewBox:o,height:r,...a},s)}}const Rn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M10.13 3.245a1.994 1.994 0 0 0-1.542.992l-5.491 9.53c-.55.954-.23 2.178.723 2.728l8.66 5c.953.55 2.174.216 2.724-.737l5.509-9.521c.335-.58.349-1.265.087-1.832L17.65 2.54z"}))});Rn.displayName="LabelIcon";const kn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"}))});kn.displayName="CameraIcon";const zn=Nn({viewBox:"0 0 24 24",svg:N.createElement("path",{d:"M17,6h-2V3c0-0.55-0.45-1-1-1h-4C9.45,2,9,2.45,9,3v3H7C5.9,6,5,6.9,5,8v11c0,1.1,0.9,2,2,2c0,0.55,0.45,1,1,1 c0.55,0,1-0.45,1-1h6c0,0.55,0.45,1,1,1c0.55,0,1-0.45,1-1c1.1,0,2-0.9,2-2V8C19,6.9,18.1,6,17,6z M9.5,18H8V9h1.5V18z M12.75,18 h-1.5V9h1.5V18z M13.5,6h-3V3.5h3V6z M16,18h-1.5V9H16V18z"})});zn.displayName="LuggageIcon";const Hn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"}))});Hn.displayName="CarIcon";const Fn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.65 2.62.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"}))});Fn.displayName="BoatIcon";const Un=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M11.74 13.36L14.14 7.71L13.06 5.5H10.5V4H14L14.73 5.5H21.75L20.75 9H16.44L17.11 10.37C17.69 10.13 18.33 10 19 10C21.76 10 24 12.24 24 15C24 17.76 21.76 20 19 20C16.24 20 14 17.76 14 15C14 13.45 14.71 12.06 15.82 11.15L15 9.5L12.25 16H9.9C9.44 18.28 7.42 20 5 20C2.24 20 0 17.76 0 15C0 12.24 2.24 10 5 10C7.59 10 9.72 11.97 10 14.5H10.58L8.3 9H7.5C7.09 9 6.75 8.66 6.75 8.25C6.75 7.84 7.09 7.5 7.5 7.5H10.25C10.66 7.5 11 7.84 11 8.25C11 8.66 10.66 9 10.25 9H9.97L11.74 13.36M5 11.5C3.07 11.5 1.5 13.07 1.5 15C1.5 16.93 3.07 18.5 5 18.5C6.59 18.5 7.93 17.45 8.36 16H4V14.5H8.47C8.22 12.8 6.76 11.5 5 11.5M19 11.5C18.57 11.5 18.15 11.58 17.77 11.72L19.7 15.68L18.35 16.34L16.5 12.55C15.88 13.18 15.5 14.05 15.5 15C15.5 16.93 17.07 18.5 19 18.5C20.93 18.5 22.5 16.93 22.5 15C22.5 13.07 20.93 11.5 19 11.5Z"}))});Un.displayName="BicycleIcon";const Bn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"}))});Bn.displayName="DirectionsWalkIcon";const Vn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("circle",{cx:"4.5",cy:"9.5",r:"2.5"}),N.createElement("circle",{cx:"9",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"15",cy:"5.5",r:"2.5"}),N.createElement("circle",{cx:"19.5",cy:"9.5",r:"2.5"}),N.createElement("path",{d:"M17.34 14.86c-.87-1.02-1.6-1.89-2.48-2.91-.46-.54-1.05-1.08-1.75-1.32-.11-.04-.22-.07-.33-.09-.25-.04-.52-.04-.78-.04s-.53 0-.79.05c-.11.02-.22.05-.33.09-.7.24-1.28.78-1.75 1.32-.87 1.02-1.6 1.89-2.48 2.91-1.31 1.31-2.92 2.76-2.62 4.79.29 1.02 1.02 2.03 2.33 2.32.73.15 3.06-.44 5.54-.44h.18c2.48 0 4.81.58 5.54.44 1.31-.29 2.04-1.31 2.33-2.32.31-2.04-1.3-3.49-2.61-4.8z"}))});Vn.displayName="PetsIcon";const $n=({data:e})=>{const t=16;return e.isEventType?"Luggage"===e.id?N.createElement(zn,{size:t}):"Car"===e.id?N.createElement(Hn,{size:t}):"Person"===e.id?N.createElement(Bn,{size:t}):"Bicycle"===e.id?N.createElement(Un,{size:t}):"Boat"===e.id?N.createElement(Fn,{size:t}):"Animal"===e.id?N.createElement(Vn,{size:t}):N.createElement(Rn,{size:t}):N.createElement(kn,{size:t})},Wn=e=>{const{children:t,innerProps:r,...n}=e,{MultiValueLabel:i}=q,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center"}};return N.createElement(i,{innerProps:o,...n},N.createElement($n,{data:a}),N.createElement("div",{style:{marginLeft:4}},t))},Gn={background:"rgb(0 0 0 / 0.9)",color:"white",border:"none",borderRadius:"4px",padding:"0.5em 1em",fontSize:12},qn=({label:e,children:t})=>N.createElement(J,{label:e,style:Gn},t);qn.displayName="Tooltip";class Yn extends N.Component{render(){const{forwardedRef:e,children:t,className:r,fullwidth:n,type:i,title:a,...o}=this.props,s=Y(r,"x-3deye-button",{fullwidth:n}),l=N.createElement("button",{ref:e,className:s,type:i||"button",...o},t,o.disabled?null:N.createElement(K,null));return a?N.createElement(qn,{label:a},l):l}}const Xn=N.forwardRef(((e,t)=>N.createElement(Yn,{forwardedRef:t,...e}))),Kn=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))});Kn.displayName="CloseIcon";const Jn=Nn({viewBox:"0 0 24 24",svg:N.createElement(N.Fragment,null,N.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),N.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}))});Jn.displayName="DoneIcon";const Zn=[{color:X.red[500],name:"red",highlightColor:X.red[100]},{color:X.green[500],name:"green",highlightColor:X.green[100]},{color:X.blue[500],name:"blue",highlightColor:X.blue[100]},{color:X.yellow[500],name:"yellow",highlightColor:X.yellow[900]},{color:X.black,name:"black",highlightColor:X.white},{color:X.white,name:"white",highlightColor:X.black},{color:X.grey[500],name:"dimgrey",highlightColor:X.grey[100]}],Qn=V((({value:e,clear:t,toggle:r})=>N.createElement("div",{className:"color-selector"},N.createElement("div",null,"COLOR"),N.createElement("div",{className:"color-selector__items"},Zn.map((({color:t,highlightColor:n,name:i})=>N.createElement("button",{key:i,className:Y("color-selector__item",{selected:e.has(i)}),style:{backgroundColor:t,color:n},onClick:r.bind(null,i)},N.createElement(Jn,{size:20})))),N.createElement(Xn,{disabled:!e.size,onClick:t},N.createElement(Kn,{size:20}))))));Qn.displayName="ColorSelector";const ei=({value:e,onChange:t})=>{const r=R(null),n=R(),[i,a]=k(0);return z((()=>{if(!r.current)return;const e=new Z(r.current);return n.current=e,e.listen("MDCSlider:change",(()=>{null==t||t(e.value)})),()=>{n.current=void 0,e.destroy()}}),[]),z((()=>{const e=new Q((e=>{var t;for(const r of e){const e=r.contentRect.width;e!==i&&(null===(t=n.current)||void 0===t||t.layout()),a(e)}}));return e.observe(r.current),()=>e.disconnect()}),[]),z((()=>{n.current&&(n.current.value=e)}),[e]),N.createElement("div",{ref:r,className:"mdc-slider mdc-slider--discrete mdc-slider--display-markers",tabIndex:0,role:"slider","data-step":5,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e,"aria-label":"Select Value"},N.createElement("div",{className:"mdc-slider__track-container"},N.createElement("div",{className:"mdc-slider__track"}),N.createElement("div",{className:"mdc-slider__track-marker-container"})),N.createElement("div",{className:"mdc-slider__thumb-container"},N.createElement("div",{className:"mdc-slider__pin"},N.createElement("span",{className:"mdc-slider__pin-value-marker"})),N.createElement("svg",{className:"mdc-slider__thumb",width:"21",height:"21"},N.createElement("circle",{cx:"10.5",cy:"10.5",r:"7.875"})),N.createElement("div",{className:"mdc-slider__focus-ring"})))};ei.displayName="Slider";const ti=V((({getter:e,setter:t})=>{const[r,n]=k(0),i=R(null),a=Math.floor(100*e());return z((()=>w(e,(e=>{n(Math.floor(100*e))}),{fireImmediately:!0})),[e]),N.createElement("div",{ref:i,style:{paddingLeft:8,paddingRight:8,marginTop:5}},N.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},N.createElement("div",null,"CONFIDENCE"),N.createElement("div",{style:{fontSize:"1.1em"}},a,"%")),N.createElement(ei,{value:r,onChange:e=>{t(e/100)}}))}));ti.displayName="ProbabilitySlider";var ri,ni=(ri=8,{container:e=>({...e,padding:ri}),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,borderRadius:"0 0 4px 4px",marginTop:0,marginLeft:-ri,marginRight:ri}),option:e=>({...e,color:"black"}),multiValueRemove:e=>({...e,color:"black"})}),ii=function(e,t){return(ii=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
6
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
+
|
|
13
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
|
+
and limitations under the License.
|
|
15
|
+
***************************************************************************** */function ai(e,t){function r(){this.constructor=e}ii(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var oi=function(){return(oi=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function si(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function li(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function ci(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function ui(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ci(arguments[t]));return e}
|
|
16
|
+
/*!
|
|
17
|
+
Copyright (c) 2018 Jed Watson.
|
|
18
|
+
Licensed under the MIT License (MIT), see
|
|
19
|
+
http://jedwatson.github.io/classnames
|
|
20
|
+
*/var di=$e((function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e=[],n=0;n<arguments.length;n++){var i=arguments[n];if(i){var a=typeof i;if("string"===a||"number"===a)e.push(i);else if(Array.isArray(i)){if(i.length){var o=r.apply(null,i);o&&e.push(o)}}else if("object"===a)if(i.toString===Object.prototype.toString)for(var s in i)t.call(i,s)&&i[s]&&e.push(s);else e.push(i.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):window.classNames=r}()})),hi={blur:"onBlur",cancel:"onCancel",click:"onClick",close:"onClose",contextmenu:"onContextMenu",copy:"onCopy",cut:"onCut",auxclick:"onAuxClick",doubleclick:"onDoubleClick",dragend:"onDragEnd",dragstart:"onDragStart",drop:"onDrop",focus:"onFocus",input:"onInput",invalid:"onInvalid",keydown:"onKeyDown",keypress:"onKeyPress",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",paste:"onPaste",pause:"onPause",play:"onPlay",pointercancel:"onPointerCancel",pointerdown:"onPointerDown",pointerup:"onPointerUp",ratechange:"onRateChange",reset:"onReset",seeked:"onSeeked",submit:"onSubmit",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchstart:"onTouchStart",volumechange:"onVolumeChange",abort:"onAbort",animationend:"onAnimationEnd",animationiteration:"onAnimationIteration",animationstart:"onAnimationStart",canplay:"onCanPlay",canplaythrough:"onCanPlayThrough",drag:"onDrag",dragenter:"onDragEnter",dragexit:"onDragExit",dragleave:"onDragLeave",dragover:"onDragOver",durationchange:"onDurationChange",emptied:"onEmptied",encrypted:"onEncrypted",ended:"onEnded",error:"onError",gotpointercapture:"onGotPointerCapture",load:"onLoad",loadeddata:"onLoadedData",loadedmetadata:"onLoadedMetadata",loadstart:"onLoadStart",lostpointercapture:"onLostPointerCapture",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseover:"onMouseOver",playing:"onPlaying",pointermove:"onPointerMove",pointerout:"onPointerOut",pointerover:"onPointerOver",progress:"onProgress",scroll:"onScroll",seeking:"onSeeking",stalled:"onStalled",suspend:"onSuspend",timeupdate:"onTimeUpdate",toggle:"onToggle",touchmove:"onTouchMove",transitionend:"onTransitionEnd",waiting:"onWaiting",wheel:"onWheel",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",pointerenter:"onPointerEnter",pointerleave:"onPointerLeave",change:"onChange",select:"onSelect",beforeinput:"onBeforeInput",compositionend:"onCompositionEnd",compositionstart:"onCompositionStart",compositionupdate:"onCompositionUpdate"},pi={bottom:0,height:0,left:0,right:0,top:0,width:0};N.forwardRef((function(e,t){var r=e.tag,n=void 0===r?"div":r;e.theme;var i=e.element,a=si(e,["tag","theme","element"]),o=i?i.props(a):a,s=i?fi(t,i.setRef):t;return N.createElement(n,oi({},o,{ref:s}))}));var mi,fi=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var r,n;try{for(var i=li(e),a=i.next();!a.done;a=i.next()){var o=a.value;"function"==typeof o?o(t):o&&"current"in o&&(o.current=t)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}},bi=function(e,t){"function"==typeof e?e(t):e&&"current"in e&&(e.current=t)},vi=function(e){return hi[e]||e},gi=function(){function e(e){this._classes=new Set,this._events={},this._style={},this._props={},this._ref=null,this._onChange=null,this._onChange=e,this.onChange=this.onChange.bind(this),this.addClass=this.addClass.bind(this),this.removeClass=this.removeClass.bind(this),this.hasClass=this.hasClass.bind(this),this.setProp=this.setProp.bind(this),this.getProp=this.getProp.bind(this),this.removeProp=this.removeProp.bind(this),this.setStyle=this.setStyle.bind(this),this.addEventListener=this.addEventListener.bind(this),this.removeEventListener=this.removeEventListener.bind(this),this.setRef=this.setRef.bind(this)}return e.prototype.onChange=function(){this._onChange&&this._onChange()},e.prototype.destroy=function(){var e=this;this._onChange=null,this._events={},this._style={},this._props={},this._classes=new Set,setTimeout((function(){e._ref=null}))},e.prototype.addClass=function(e){this._classes.has(e)||(this._classes.add(e),this.onChange())},e.prototype.removeClass=function(e){this._classes.has(e)&&(this._classes.delete(e),this.onChange())},e.prototype.hasClass=function(e){return this._classes.has(e)},e.prototype.setProp=function(e,t,r){void 0===r&&(r=!1),this._props[e]!==t&&(this._props[e]=t,!r&&this.onChange())},e.prototype.getProp=function(e){return this._props[e]},e.prototype.removeProp=function(e){void 0!==this._props[e]&&(delete this._props[e],this.onChange())},e.prototype.props=function(e){var t=this,r=e.className,n=void 0===r?"":r,i=e.style,a=void 0===i?{}:i,o=Object.entries(e).reduce((function(e,r){var n=ci(r,2),i=n[0],a=n[1],o=t._events[i];if("function"==typeof a&&"function"==typeof o){e[i]=function(e){return o(e),a(e)}}return e}),oi({},this._events)),s=di(n,ui(this._classes)),l=oi(oi({},this._style),a);return oi(oi(oi(oi({},e),this._props),o),{style:l,className:s})},e.prototype.setStyle=function(e,t){e=e.startsWith("--")?e:e.replace(/(-[a-z])/g,(function(e){return e.toUpperCase().replace("-","")})),this._style[e]!==t&&(this._style[e]=t,this.onChange())},e.prototype.addEventListener=function(e,t){var r=vi(e);this._events[r]!==t&&(this._events[r]=t,this.onChange())},e.prototype.removeEventListener=function(e,t){var r=vi(e);this._events[r]&&(delete this._events[r],this.onChange())},e.prototype.setRef=function(e){e&&(this._ref=e)},Object.defineProperty(e.prototype,"ref",{get:function(){return this._ref},enumerable:!1,configurable:!0}),e}(),yi=function(e){return function(t,r,n){var i;void 0===n&&(n=!1),i=new CustomEvent(t,{detail:r,bubbles:n}),Object.defineProperty(i,"target",{value:r,writable:!1}),Object.defineProperty(i,"currentTarget",{value:r,writable:!1});var a=t;return e[a]&&e[a](i),i}};
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2016 Google Inc.
|
|
24
|
+
*
|
|
25
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
27
|
+
* in the Software without restriction, including without limitation the rights
|
|
28
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
29
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
30
|
+
* furnished to do so, subject to the following conditions:
|
|
31
|
+
*
|
|
32
|
+
* The above copyright notice and this permission notice shall be included in
|
|
33
|
+
* all copies or substantial portions of the Software.
|
|
34
|
+
*
|
|
35
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
37
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
38
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
39
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
40
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
41
|
+
* THE SOFTWARE.
|
|
42
|
+
*/
|
|
43
|
+
var wi,_i=function(){function e(e){void 0===e&&(e={}),this.adapter_=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}(),Ei={BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation",ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded"},Ci={VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top"},Oi={DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,INITIAL_ORIGIN_SCALE:.6,PADDING:10,TAP_DELAY_MS:300},Pi=["touchstart","pointerdown","mousedown","keydown"],xi=["touchend","pointerup","mouseup","contextmenu"],ji=[],Ti=function(e){function t(r){var n=e.call(this,oi({},t.defaultAdapter,r))||this;return n.activationAnimationHasEnded_=!1,n.activationTimer_=0,n.fgDeactivationRemovalTimer_=0,n.fgScale_="0",n.frame_={width:0,height:0},n.initialSize_=0,n.layoutFrame_=0,n.maxRadius_=0,n.unboundedCoords_={left:0,top:0},n.activationState_=n.defaultActivationState_(),n.activationTimerCallback_=function(){n.activationAnimationHasEnded_=!0,n.runDeactivationUXLogicIfReady_()},n.activateHandler_=function(e){return n.activate_(e)},n.deactivateHandler_=function(){return n.deactivate_()},n.focusHandler_=function(){return n.handleFocus()},n.blurHandler_=function(){return n.handleBlur()},n.resizeHandler_=function(){return n.layout()},n}return ai(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return Ei},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return Ci},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return Oi},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},browserSupportsCssVars:function(){return!0},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},containsEventTarget:function(){return!0},deregisterDocumentInteractionHandler:function(){},deregisterInteractionHandler:function(){},deregisterResizeHandler:function(){},getWindowPageOffset:function(){return{x:0,y:0}},isSurfaceActive:function(){return!0},isSurfaceDisabled:function(){return!0},isUnbounded:function(){return!0},registerDocumentInteractionHandler:function(){},registerInteractionHandler:function(){},registerResizeHandler:function(){},removeClass:function(){},updateCssVariable:function(){}}},enumerable:!0,configurable:!0}),t.prototype.init=function(){var e=this,r=this.supportsPressRipple_();if(this.registerRootHandlers_(r),r){var n=t.cssClasses,i=n.ROOT,a=n.UNBOUNDED;requestAnimationFrame((function(){e.adapter_.addClass(i),e.adapter_.isUnbounded()&&(e.adapter_.addClass(a),e.layoutInternal_())}))}},t.prototype.destroy=function(){var e=this;if(this.supportsPressRipple_()){this.activationTimer_&&(clearTimeout(this.activationTimer_),this.activationTimer_=0,this.adapter_.removeClass(t.cssClasses.FG_ACTIVATION)),this.fgDeactivationRemovalTimer_&&(clearTimeout(this.fgDeactivationRemovalTimer_),this.fgDeactivationRemovalTimer_=0,this.adapter_.removeClass(t.cssClasses.FG_DEACTIVATION));var r=t.cssClasses,n=r.ROOT,i=r.UNBOUNDED;requestAnimationFrame((function(){e.adapter_.removeClass(n),e.adapter_.removeClass(i),e.removeCssVars_()}))}this.deregisterRootHandlers_(),this.deregisterDeactivationHandlers_()},t.prototype.activate=function(e){this.activate_(e)},t.prototype.deactivate=function(){this.deactivate_()},t.prototype.layout=function(){var e=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame((function(){e.layoutInternal_(),e.layoutFrame_=0}))},t.prototype.setUnbounded=function(e){var r=t.cssClasses.UNBOUNDED;e?this.adapter_.addClass(r):this.adapter_.removeClass(r)},t.prototype.handleFocus=function(){var e=this;requestAnimationFrame((function(){return e.adapter_.addClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.handleBlur=function(){var e=this;requestAnimationFrame((function(){return e.adapter_.removeClass(t.cssClasses.BG_FOCUSED)}))},t.prototype.supportsPressRipple_=function(){return this.adapter_.browserSupportsCssVars()},t.prototype.defaultActivationState_=function(){return{activationEvent:void 0,hasDeactivationUXRun:!1,isActivated:!1,isProgrammatic:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1}},t.prototype.registerRootHandlers_=function(e){var t=this;e&&(Pi.forEach((function(e){t.adapter_.registerInteractionHandler(e,t.activateHandler_)})),this.adapter_.isUnbounded()&&this.adapter_.registerResizeHandler(this.resizeHandler_)),this.adapter_.registerInteractionHandler("focus",this.focusHandler_),this.adapter_.registerInteractionHandler("blur",this.blurHandler_)},t.prototype.registerDeactivationHandlers_=function(e){var t=this;"keydown"===e.type?this.adapter_.registerInteractionHandler("keyup",this.deactivateHandler_):xi.forEach((function(e){t.adapter_.registerDocumentInteractionHandler(e,t.deactivateHandler_)}))},t.prototype.deregisterRootHandlers_=function(){var e=this;Pi.forEach((function(t){e.adapter_.deregisterInteractionHandler(t,e.activateHandler_)})),this.adapter_.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter_.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter_.isUnbounded()&&this.adapter_.deregisterResizeHandler(this.resizeHandler_)},t.prototype.deregisterDeactivationHandlers_=function(){var e=this;this.adapter_.deregisterInteractionHandler("keyup",this.deactivateHandler_),xi.forEach((function(t){e.adapter_.deregisterDocumentInteractionHandler(t,e.deactivateHandler_)}))},t.prototype.removeCssVars_=function(){var e=this,r=t.strings;Object.keys(r).forEach((function(t){0===t.indexOf("VAR_")&&e.adapter_.updateCssVariable(r[t],null)}))},t.prototype.activate_=function(e){var t=this;if(!this.adapter_.isSurfaceDisabled()){var r=this.activationState_;if(!r.isActivated){var n=this.previousActivationEvent_;if(!(n&&void 0!==e&&n.type!==e.type))r.isActivated=!0,r.isProgrammatic=void 0===e,r.activationEvent=e,r.wasActivatedByPointer=!r.isProgrammatic&&(void 0!==e&&("mousedown"===e.type||"touchstart"===e.type||"pointerdown"===e.type)),void 0!==e&&ji.length>0&&ji.some((function(e){return t.adapter_.containsEventTarget(e)}))?this.resetActivationState_():(void 0!==e&&(ji.push(e.target),this.registerDeactivationHandlers_(e)),r.wasElementMadeActive=this.checkElementMadeActive_(e),r.wasElementMadeActive&&this.animateActivation_(),requestAnimationFrame((function(){ji=[],r.wasElementMadeActive||void 0===e||" "!==e.key&&32!==e.keyCode||(r.wasElementMadeActive=t.checkElementMadeActive_(e),r.wasElementMadeActive&&t.animateActivation_()),r.wasElementMadeActive||(t.activationState_=t.defaultActivationState_())})))}}},t.prototype.checkElementMadeActive_=function(e){return void 0===e||"keydown"!==e.type||this.adapter_.isSurfaceActive()},t.prototype.animateActivation_=function(){var e=this,r=t.strings,n=r.VAR_FG_TRANSLATE_START,i=r.VAR_FG_TRANSLATE_END,a=t.cssClasses,o=a.FG_DEACTIVATION,s=a.FG_ACTIVATION,l=t.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal_();var c="",u="";if(!this.adapter_.isUnbounded()){var d=this.getFgTranslationCoordinates_(),h=d.startPoint,p=d.endPoint;c=h.x+"px, "+h.y+"px",u=p.x+"px, "+p.y+"px"}this.adapter_.updateCssVariable(n,c),this.adapter_.updateCssVariable(i,u),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter_.removeClass(o),this.adapter_.computeBoundingRect(),this.adapter_.addClass(s),this.activationTimer_=setTimeout((function(){return e.activationTimerCallback_()}),l)},t.prototype.getFgTranslationCoordinates_=function(){var e,t=this.activationState_,r=t.activationEvent;return{startPoint:e={x:(e=t.wasActivatedByPointer?function(e,t,r){if(!e)return{x:0,y:0};var n,i,a=t.x,o=t.y,s=a+r.left,l=o+r.top;if("touchstart"===e.type){var c=e;n=c.changedTouches[0].pageX-s,i=c.changedTouches[0].pageY-l}else{var u=e;n=u.pageX-s,i=u.pageY-l}return{x:n,y:i}}(r,this.adapter_.getWindowPageOffset(),this.adapter_.computeBoundingRect()):{x:this.frame_.width/2,y:this.frame_.height/2}).x-this.initialSize_/2,y:e.y-this.initialSize_/2},endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}},t.prototype.runDeactivationUXLogicIfReady_=function(){var e=this,r=t.cssClasses.FG_DEACTIVATION,n=this.activationState_,i=n.hasDeactivationUXRun,a=n.isActivated;(i||!a)&&this.activationAnimationHasEnded_&&(this.rmBoundedActivationClasses_(),this.adapter_.addClass(r),this.fgDeactivationRemovalTimer_=setTimeout((function(){e.adapter_.removeClass(r)}),Oi.FG_DEACTIVATION_MS))},t.prototype.rmBoundedActivationClasses_=function(){var e=t.cssClasses.FG_ACTIVATION;this.adapter_.removeClass(e),this.activationAnimationHasEnded_=!1,this.adapter_.computeBoundingRect()},t.prototype.resetActivationState_=function(){var e=this;this.previousActivationEvent_=this.activationState_.activationEvent,this.activationState_=this.defaultActivationState_(),setTimeout((function(){return e.previousActivationEvent_=void 0}),t.numbers.TAP_DELAY_MS)},t.prototype.deactivate_=function(){var e=this,t=this.activationState_;if(t.isActivated){var r=oi({},t);t.isProgrammatic?(requestAnimationFrame((function(){return e.animateDeactivation_(r)})),this.resetActivationState_()):(this.deregisterDeactivationHandlers_(),requestAnimationFrame((function(){e.activationState_.hasDeactivationUXRun=!0,e.animateDeactivation_(r),e.resetActivationState_()})))}},t.prototype.animateDeactivation_=function(e){var t=e.wasActivatedByPointer,r=e.wasElementMadeActive;(t||r)&&this.runDeactivationUXLogicIfReady_()},t.prototype.layoutInternal_=function(){var e=this;this.frame_=this.adapter_.computeBoundingRect();var r=Math.max(this.frame_.height,this.frame_.width);this.maxRadius_=this.adapter_.isUnbounded()?r:Math.sqrt(Math.pow(e.frame_.width,2)+Math.pow(e.frame_.height,2))+t.numbers.PADDING;var n=Math.floor(r*t.numbers.INITIAL_ORIGIN_SCALE);this.adapter_.isUnbounded()&&n%2!=0?this.initialSize_=n-1:this.initialSize_=n,this.fgScale_=""+this.maxRadius_/this.initialSize_,this.updateLayoutCssVars_()},t.prototype.updateLayoutCssVars_=function(){var e=t.strings,r=e.VAR_FG_SIZE,n=e.VAR_LEFT,i=e.VAR_TOP,a=e.VAR_FG_SCALE;this.adapter_.updateCssVariable(r,this.initialSize_+"px"),this.adapter_.updateCssVariable(a,this.fgScale_),this.adapter_.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter_.updateCssVariable(n,this.unboundedCoords_.left+"px"),this.adapter_.updateCssVariable(i,this.unboundedCoords_.top+"px"))},t}(_i),Si=function(e){var t=R(!1),r=function(e){var t=e.foundation,r=e.props,n=e.elements,i=e.api,a=ci(k(0),2)[1],o=R(r);o.current=r;var s=H((function(){return Object.keys(n).reduce((function(e,t){return e[t]=new gi((function(){a((function(e){return e+1}))})),e}),{})}),[]),l=H((function(){var e=t(oi(oi({},s),{getProps:function(){return o.current},emit:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return yi(o.current).apply(void 0,ui(e))}}));return i&&bi(o.current.apiRef,i(oi({foundation:e},s))),e}),[]);return z((function(){var e=l;return e.init(),i&&bi(o.current.apiRef,i(oi({foundation:e},s))),bi(o.current.foundationRef,e),function(){e.destroy(),bi(o.current.apiRef,null),bi(o.current.foundationRef,null),Object.values(s).map((function(e){return e.destroy()})),o.current={}}}),[l,s]),oi({foundation:l},s)}({props:e,elements:{rootEl:!0,surfaceEl:!0},foundation:function(e){var t=e.rootEl,r=e.surfaceEl,n=e.getProps;return new Ti({browserSupportsCssVars:function(){return function(e,t){void 0===t&&(t=!1);var r,n=e.CSS;if("boolean"==typeof mi&&!t)return mi;if(!n||"function"!=typeof n.supports)return!1;var i=n.supports("--css-vars","yes"),a=n.supports("(--css-vars: yes)")&&n.supports("color","#00000000");return r=i||a,t||(mi=r),r}(window)},isUnbounded:function(){return!!n().unbounded},isSurfaceActive:function(){return!!t.ref&&(e=t.ref,r=":active",(e.matches||e.webkitMatchesSelector||e.msMatchesSelector).call(e,r));var e,r},isSurfaceDisabled:function(){return!!n().disabled},addClass:function(e){r.addClass(e)},removeClass:function(e){r.removeClass(e)},containsEventTarget:function(e){return!!t.ref&&t.ref.contains(e)},registerInteractionHandler:function(e,t){},deregisterInteractionHandler:function(e,t){},registerDocumentInteractionHandler:function(e,t){return document.documentElement.addEventListener(e,t,{passive:!0})},deregisterDocumentInteractionHandler:function(e,t){return document.documentElement.removeEventListener(e,t)},registerResizeHandler:function(e){return window.addEventListener("resize",e)},deregisterResizeHandler:function(e){return window.removeEventListener("resize",e)},updateCssVariable:function(e,t){return r.setStyle(e,t)},computeBoundingRect:function(){return t.ref?t.ref.getBoundingClientRect():pi},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}}})}}),n=r.foundation,i=si(r,["foundation"]),a=i.rootEl,o=F((function(e){e.persist(),n.activate(e)}),[n]),s=F((function(e){e.persist(),n.deactivate()}),[n]),l=F((function(t){var r;null===(r=e.onFocus)||void 0===r||r.call(e,t),n.handleFocus()}),[n,e.onFocus]),c=F((function(t){var r;null===(r=e.onBlur)||void 0===r||r.call(e,t),n.handleBlur()}),[n,e.onBlur]),u=F((function(r){var n;null===(n=e.onMouseDown)||void 0===n||n.call(e,r),t.current||o(r),t.current=!1}),[e.onMouseDown,o]),d=F((function(t){var r;null===(r=e.onMouseUp)||void 0===r||r.call(e,t),s(t)}),[e.onMouseUp,s]),h=F((function(r){var n;t.current=!0,null===(n=e.onTouchStart)||void 0===n||n.call(e,r),o(r)}),[e.onTouchStart,o]),p=F((function(t){var r;null===(r=e.onTouchEnd)||void 0===r||r.call(e,t),s(t)}),[e.onTouchEnd,s]),m=F((function(t){var r;null===(r=e.onKeyDown)||void 0===r||r.call(e,t),o(t)}),[e.onKeyDown,o]),f=F((function(t){var r;null===(r=e.onKeyUp)||void 0===r||r.call(e,t),s(t)}),[e.onKeyUp,s]);return a.setProp("onFocus",l,!0),a.setProp("onBlur",c,!0),a.setProp("onMouseDown",u,!0),a.setProp("onMouseUp",d,!0),a.setProp("onTouchStart",h,!0),a.setProp("onTouchEnd",p,!0),a.setProp("onKeyDown",m,!0),a.setProp("onKeyUp",f,!0),z((function(){a.setRef(e.domNode)}),[a,e.domNode]),z((function(){n.setUnbounded(!!e.unbounded)}),[e.unbounded,n]),z((function(){e.disabled&&n.handleBlur()}),[e.disabled,n]),oi({},i)},Ii=N.createContext({}),Di=(wi=function(e){var t=e.children,r=e.className,n=e.primary,i=e.accent,a=e.unbounded,o=e.surface;e.domNode,e.foundationRef;var s=si(e,["children","className","primary","accent","unbounded","surface","domNode","foundationRef"]),l=Si(e),c=l.rootEl,u=l.surfaceEl,d=N.Children.only(t);if(!N.isValidElement(d))return null;var h=a?{"data-mdc-ripple-is-unbounded":!0}:{},p=o&&a?{}:u.props({style:d.props.style}),m=di(r!==d.props.className&&r,p.className,d.props.className,{"mdc-ripple-surface":"boolean"==typeof o?o:void 0===o,"mdc-ripple-surface--primary":n,"mdc-ripple-surface--accent":i});s.disabled&&(m=m.replace("mdc-ripple-upgraded--background-focused",""));var f=N.cloneElement(d,oi(oi(oi({},d.props),h),c.props(oi(oi(oi(oi({},s),{style:d.props.style}),p),{className:m}))));return N.createElement(Ii.Provider,{value:u.props({style:d.props.style})},f)},function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={domNode:null},t}return ai(t,e),t.prototype.componentDidMount=function(){this.setState({domNode:ee.findDOMNode(this)})},t.prototype.componentDidUpdate=function(){var e=ee.findDOMNode(this);e!==this.state.domNode&&this.setState({rootRippleElement:e})},t.prototype.render=function(){return N.createElement(wi,oi({},this.props,{domNode:this.state.domNode}))},t}(N.Component));
|
|
44
|
+
/**
|
|
45
|
+
* @license
|
|
46
|
+
* Copyright 2016 Google Inc.
|
|
47
|
+
*
|
|
48
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
49
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
50
|
+
* in the Software without restriction, including without limitation the rights
|
|
51
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
52
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
53
|
+
* furnished to do so, subject to the following conditions:
|
|
54
|
+
*
|
|
55
|
+
* The above copyright notice and this permission notice shall be included in
|
|
56
|
+
* all copies or substantial portions of the Software.
|
|
57
|
+
*
|
|
58
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
59
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
60
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
61
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
62
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
63
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
64
|
+
* THE SOFTWARE.
|
|
65
|
+
*/const Mi=document.body;class Ai extends N.Component{constructor(e){super(e),Object.defineProperty(this,"el",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.el=document.createElement("div")}componentDidMount(){Mi.appendChild(this.el)}componentWillUnmount(){Mi.removeChild(this.el)}render(){return te.createPortal(this.props.children,this.el)}}class Li extends N.Component{constructor(e){super(e),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{isOpened:!1,top:0,left:0,bottom:void 0,right:void 0}}),Object.defineProperty(this,"buttonRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"menuRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"windowResizeListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!this.menuRef)return;const{top:t,height:r,left:n,width:i}=e?{...e,width:0,height:0}:this.buttonRef.current.getBoundingClientRect(),{offsetWidth:a,offsetHeight:o}=this.menuRef.current||{offsetHeight:0,offsetWidth:0},s=window.innerHeight,l=window.innerWidth;let c,u=n+i-a,d=t+r;e?(u=n,d=t,u+a>l&&(u-=a),d+o>s&&(d-=o)):(t+r+o>s&&(d=void 0,c=s-t+4),n-a<0&&(u=n+i,c&&(c-=r),d&&(d-=r))),this.setState({top:d,bottom:c,left:u},(()=>{this.forceUpdate()}))}}),Object.defineProperty(this,"toggleMenu",{enumerable:!0,configurable:!0,writable:!0,value:e=>{this.setState((({isOpened:e})=>({isOpened:!e})),(()=>{this.state.isOpened?(this.startOutsideClickListening(),this.startWindowResizeListening(),this.updatePosition(e)):(this.stopOutsideClickListening(),this.stopWindowResizeListening())}))}}),Object.defineProperty(this,"targetClick",{enumerable:!0,configurable:!0,writable:!0,value:e=>{e.stopPropagation(),this.toggleMenu()}}),Object.defineProperty(this,"itemClick",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{t.stopPropagation();const{autoClose:r=!0}=this.props;r&&this.toggleMenu(),this.props.onSelect(e,this.props.options[e])}}),this.outsideClickListener=e=>{const t=e.target;this.menuRef.current&&(this.menuRef.current.contains(t)||this.buttonRef.current.contains(t)||this.toggleMenu())}}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener)}startWindowResizeListening(){this.windowResizeListener&&this.stopWindowResizeListening(),this.windowResizeListener=this.updatePosition.bind(null,void 0),window.addEventListener("resize",this.windowResizeListener)}stopWindowResizeListening(){window.removeEventListener("resize",this.windowResizeListener),this.windowResizeListener=null}componentWillUnmount(){this.stopOutsideClickListening(),this.stopWindowResizeListening()}render(){const{top:e,left:t,bottom:r,right:n,isOpened:i}=this.state,{className:a,itemRenderer:o,containerStyle:s}=this.props,l=Y(a,"menu-items-container"),c=i&&N.createElement(Ai,null,N.createElement("div",{className:l,ref:this.menuRef,style:{zIndex:10000001,position:"absolute",top:e,left:t,bottom:r,right:n}},this.props.options.map(((e,t)=>N.createElement(Xn,{key:t,onClick:this.itemClick.bind(null,t)},o?o(t,e):e))))),u=this.props.target(this.buttonRef,this.targetClick),d=Y(a,"menu",{"menu-opened":i});return N.createElement("div",{className:d,style:s},u,c)}}class Ni{constructor(e){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cameraId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endTime",{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,"duration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chunks",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clipUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{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,"isDownloading",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"archives",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),b(this,{name:v,clipUrl:v,isDownloading:v}),this.update(e)}get isTimelapse(){return this.type.startsWith("Timelaps")}update(e){this.raw=e,this.id=e.id,this.startTime=new Date(e.startTime),this.endTime=new Date(e.endTime),this.type=e.recordType,this.duration=e.duration,this.cameraId=e.cameraId,this.name=e.name||e.tagName,this.description=e.description,this.clipUrl=e.clipUrl,this.version=e.version}}const Ri=()=>!0;function ki(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}const zi=Nn({viewBox:"0 0 24 24",svg:N.createElement("g",null,N.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),N.createElement("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}))});zi.displayName="MoreVertIcon";const Hi=({Type:e,Box:{Top:t,Left:r,Right:n,Bottom:i},Probability:a,height:o})=>{const{eventSchema:s}=U(Ln);let l="top";l=o&&t*o>12||t>.1?"top":1-i-t>.5?"bottom":"top inset";const c={top:"top"===l?-12:"top inset"===l?0:"auto",bottom:"bottom"===l?-12:"auto",left:"top"===l?-2:0};return N.createElement("div",{style:{position:"absolute",top:100*t+"%",left:100*r+"%",bottom:100*(1-i)+"%",right:100*(1-n)+"%",outline:`2px solid ${s.colorsByFoundObjectType.get(e)}`}},N.createElement("div",{style:{color:s.colorsByFoundObjectType.get(e),backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",padding:"0 2px",...c},title:`${e.toLowerCase()} ${Math.floor(100*a)}%`},e.toLowerCase()," ",Math.floor(100*a),"%"))};Hi.displayName="FoundObjectBox";const Fi=V((({data:e,hideCameraName:t,height:r,onClick:a})=>{var o,s,l,c;const u=R(null),d=R(null),[h,p]=k(null),m=U(Ln),{cameras:f,eventSchema:b,thumbnails:v}=m;z((()=>{if(e.thumbnailUrl)return void p(null);const t=v.fetchThumbnail(e.cameraId,e.startTime,e.startTime).subscribe((e=>{p(e||null)}));return()=>t.unsubscribe()}),[e.id]);const g="clipSharing"in m&&!!(4&(null!==(s=null===(o=f.camerasById.get(e.cameraId))||void 0===o?void 0:o.permissions)&&void 0!==s?s:0));let y=null;e.detectedObjects.length&&(y=e.detectedObjects.filter((({Type:e})=>b.foundObjectTypes.includes(e))).map(((e,t)=>N.createElement(Hi,{key:t,...e,height:r}))));let w="",_=!1;if(e.thumbnailUrl?w=e.thumbnailUrl:null===h&&f.loaded?(w=(null===(l=f.camerasById.get(e.cameraId))||void 0===l?void 0:l.imageUrl)||"",_=!0):h&&(w=h.url),e.faces){const{Width:t,Height:r}=JSON.parse(e.raw.data).ThumbnailSize;y||(y=[]);const n=100,i=y.length;y=y.concat(e.faces.map((({Name:e,Box:{Top:a,Left:o,Right:s,Bottom:l},Probability:c},u)=>{const d=n/t/(s-o),h={top:2},p={};return o>=1-s?(h.left=2,p.right=-2):(h.right=2,p.left=-2),a>=1-l?p.bottom="calc(100% + 1px)":p.top="calc(100% + 1px)",N.createElement(B,{key:i+u},N.createElement("div",{className:"event-list-item-face-trigger",style:{position:"absolute",top:100*a+"%",left:100*o+"%",bottom:100*(1-l)+"%",right:100*(1-s)+"%",outline:"1px solid orange"}},N.createElement("div",{style:{color:"orange",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"absolute",fontSize:10,fontFamily:"monospace",...p},title:`${e} ${Math.floor(100*c)}%`},e," ",Math.floor(100*c),"%")),N.createElement("div",{className:"event-list-item-face",style:{overflow:"hidden",width:t*(s-o)*d,height:r*(l-a)*d,...h}},N.createElement("img",{style:{width:t*d,height:r*d,transform:`translate(-${100*o}%, -${100*a}%)`},src:w}),N.createElement("div",{className:"frame"},N.createElement("div",{className:"corner-highlight-tl"}),N.createElement("div",{className:"corner-highlight-tr"}),N.createElement("div",{className:"corner-highlight-br"}),N.createElement("div",{className:"corner-highlight-bl"}))))})))}const E=f.loaded&&(null===(c=f.camerasById.get(e.cameraId))||void 0===c?void 0:c.name)||"...",C=[{name:"share",action:()=>{var t;const{cameraId:r}=e;let{startTime:n,endTime:i}=e;+i-+n<5e3&&(n=new Date(+n-5e3),i=new Date(+i+5e3));const a="clipSharing"in m?m.clipSharing:void 0;null==a||a.openModalWithSelectedClip(new Ni({cameraId:r,startTime:n,endTime:i,name:null===(t=f.camerasById.get(r))||void 0===t?void 0:t.name}))},visible:()=>g},{name:"copy id to clipboard",action:()=>{ki(e.id.toString())},visible:Ri},{name:"copy camera id to clipboard",action:()=>{ki(e.cameraId.toString())},visible:Ri}];return N.createElement(Di,null,N.createElement("div",{onDragStart:t=>{if(!t.dataTransfer)return;t.dataTransfer.setData("x-3deye/event",""+e.id),t.dataTransfer.dropEffect="move";const r=d.current;if(r){const{x:e,y:n}=r.getBoundingClientRect();t.dataTransfer.setDragImage(r,t.clientX-e,t.clientY-n)}},className:"event-list-item",onClick:()=>a(e),onContextMenu:e=>{var t;e.preventDefault(),null===(t=u.current)||void 0===t||t.toggleMenu({top:e.clientY,left:e.clientX})},draggable:!0},w&&N.createElement("img",{key:w,ref:d,style:{position:"absolute",width:"100%",height:"100%",top:0,left:0},src:w}),_?N.createElement("div",{className:"no-preview-overlay"}):null,e.acknowledged?N.createElement("div",{className:"acknowledged-overlay"},"acknowledged"):null,y,N.createElement(Li,{ref:u,containerStyle:{position:"absolute",right:0,top:0},target:(e,t)=>N.createElement(Xn,{ref:e,onClick:t,className:"x-3deye-button--icon camera-list-item-button"},N.createElement(zi,null)),options:C.filter((e=>e.visible())),itemRenderer:(e,t)=>t.name,onSelect:(e,t)=>{t.action(void 0)}}),N.createElement("div",{className:"event-list-item-caption"},N.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?`${Pe(e,r)}`:`${Pe(e,r)} - ${Pe(t,a)}`}(e.startTime,e.endTime)),t?null:N.createElement("div",{className:"event-list-item__camera-name",title:E},E),+e.endTime-+e.startTime>0&&N.createElement("div",{className:"event-list-item__duration"},function(e,t=!0){if((e=Math.round(e/1e3))<60)return`${e}s`;const r=e%60,n=t?`${r}`:`${r}`.padStart(2,"0");let 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)))))}));Fi.displayName="EventListItem";function Ui(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(Ui.Cache||Ft),r}Ui.Cache=Ft;const Bi=Ui((()=>{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})),Vi=({size:e=48})=>N.createElement("svg",{width:e,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid"},N.createElement("rect",{x:"0",y:"0",width:"100",height:"100",fill:"none",className:"bk"}),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(0 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(30 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.08333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(60 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.16666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(90 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.25s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(120 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.3333333333333333s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(150 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.4166666666666667s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(180 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(210 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.5833333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(240 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.6666666666666666s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(270 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.75s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(300 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.8333333333333334s",repeatCount:"indefinite"})),N.createElement("rect",{x:"46.5",y:"38",width:"7",height:"24",rx:"5",ry:"5",fill:"currentColor",transform:"rotate(330 50 50) translate(0 -30)"},N.createElement("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1s",begin:"0.9166666666666666s",repeatCount:"indefinite"})));Vi.displayName="Preloader";class $i extends N.Component{constructor(e){super(e),Object.defineProperty(this,"scrollState",{enumerable:!0,configurable:!0,writable:!0,value:{rowIndex:0,columnIndex:0}}),Object.defineProperty(this,"scrollTop",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"columnCount",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"rowHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastScrollEventTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"scrolls",{enumerable:!0,configurable:!0,writable:!0,value:new m}),Object.defineProperty(this,"updates",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"disposables",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"listRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"setScrollState",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>{this.scrollState.rowIndex=e,this.scrollState.columnIndex=t}}),Object.defineProperty(this,"resetScrollState",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.scrollState.rowIndex=0,this.scrollState.columnIndex=0}}),Object.defineProperty(this,"onScroll",{enumerable:!0,configurable:!0,writable:!0,value:({scrollTop:e})=>{this.scrollTop=e,this.lastScrollEventTimestamp=Date.now(),this.scrolls.next(e),"disabled"!==this.props.store.liveUpdateMode&&y((()=>this.props.store.liveUpdateMode=this.scrollTop?"manual":"auto"))}}),Object.defineProperty(this,"rowRenderer",{enumerable:!0,configurable:!0,writable:!0,value:e=>({columnIndex:t,rowIndex:r,style:n})=>N.createElement($,null,(()=>{var i;const a=r*e+t,o=this.props.store.data[a];return a===this.props.store.data.length?this.props.store.error?N.createElement("div",{style:n},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch more data"),N.createElement(Xn,{onClick:this.props.store.loadMore},"Retry")))):N.createElement("div",{style:n},N.createElement("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center"}},N.createElement(Vi,{size:32}))):!o&&(null===(i=this.props.store.pageInfo)||void 0===i?void 0:i.haveMore)?N.createElement("div",{style:n}):o?N.createElement("div",{style:n},N.createElement(Fi,{data:o,hideCameraName:this.props.hideCameraName,onClick:this.props.onEventClick})):N.createElement("div",{style:n})}))}),Object.defineProperty(this,"loadMoreItems",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>(this.props.store.loadMore(),Promise.resolve())}),b(this,{scrollState:v,setScrollState:g,resetScrollState:g})}componentDidMount(){this.disposables.push(this.scrolls.pipe(S(200)).subscribe((()=>{this.props.store.pendingData.length&&(this.updates=this.props.store.pendingData.length,this.props.store.flushUpdates(),this.forceUpdate())}))),this.disposables.push(w((()=>this.props.store.pendingData),(e=>{e.length&&(Date.now()-this.lastScrollEventTimestamp<200||(this.updates=e.length,this.props.store.flushUpdates(),this.forceUpdate()))})))}componentWillUnmount(){this.disposables.forEach((e=>{e instanceof u?e.closed||e.unsubscribe():e()})),"disabled"!==this.props.store.liveUpdateMode&&y((()=>this.props.store.liveUpdateMode="auto"))}componentDidUpdate(){if(0!==this.scrollTop&&this.listRef.current&&this.updates){const e=this.scrollTop+Math.round(this.updates/this.columnCount)*this.rowHeight;this.listRef.current.scrollTo({scrollTop:e,scrollLeft:0}),this.updates=0}}render(){return N.createElement($,null,(()=>{const{store:e}=this.props;return e.error&&!e.data.length?(this.resetScrollState(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement("div",{style:{textAlign:"center"}},N.createElement("div",null,"Couldn't fetch data"),N.createElement(Xn,{onClick:e.reload},"Retry")))):e.loading?(this.resetScrollState(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},N.createElement(Vi,null))):e.data.length?N.createElement(ne,null,(({width:t,height:r})=>N.createElement($,null,(()=>{var n;const{minColumnWidth:i=180}=this.props,a=Math.floor(t/i)||1,o=t/a/16*9,s=a*Math.floor(r/o)>=e.data.length?0:Bi(),l=Math.max(1,Math.floor((t-s)/i)),c=Math.ceil(this.props.store.data.length/l),u=(t-s)/l/16*9;this.rowHeight=u,this.columnCount=l;return N.createElement(ie,{isItemLoaded:e=>e<c,itemCount:c+((null===(n=e.pageInfo)||void 0===n?void 0:n.haveMore)?1:0),loadMoreItems:this.loadMoreItems},(({onItemsRendered:n,ref:i})=>{var a;return N.createElement(re,{ref:ae(this.listRef,i),columnCount:l,columnWidth:(t-s)/l,height:r,width:t,rowCount:c+((null===(a=e.pageInfo)||void 0===a?void 0:a.haveMore)||e.error?1:0),rowHeight:u,initialScrollTop:u*this.scrollState.rowIndex,onScroll:this.onScroll,onItemsRendered:({visibleRowStartIndex:e,visibleColumnStartIndex:t,visibleRowStopIndex:r,overscanRowStopIndex:i,overscanRowStartIndex:a})=>{this.setScrollState(e,t),n({overscanStartIndex:a,overscanStopIndex:i,visibleStartIndex:e,visibleStopIndex:r})}},this.rowRenderer(l))}))})))):(this.resetScrollState(),N.createElement("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"}},Oe.t("noEventsFound")))}))}}const Wi=e=>{const{className:t,children:r,...n}=e;return N.createElement("div",{className:Y("x-3deye-button-group",t),...n},r)},Gi=e=>`scale(${e})`,qi=({children:e,from:t,style:r})=>{const n=oe({opacity:1,from:{opacity:0},config:{tension:300}});return L.createElement(se.div,{style:{...r,...n,transform:n.opacity.to(Gi),transformOrigin:`${t||"bottom"} center`,width:"max-content"}},e)},Yi=({width:e,height:t,color:r,position:n="top",style:i})=>{const a=[0,"top"===n?t:0],o=[e,a[1]],s=[e/2,t-a[1]],l=[e/4,t*("top"===n?3:1)/4],c=[.325*e,t-a[1]],u=[e-c[0],c[1]],d=[e-l[0],l[1]],h=e=>e.join(","),p=`M ${h(a)} C ${h(l)} ${h(c)} ${h(s)} ${h(u)} ${h(d)} ${h(o)} Z`;return N.createElement("svg",{className:"tip",style:i,width:e,height:t,fill:r},N.createElement("path",{d:p}))};class Xi extends N.Component{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,left:0,bottom:"auto",tipPosition:"bottom",tipOffset:0}}),Object.defineProperty(this,"targetRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"popoverRef",{enumerable:!0,configurable:!0,writable:!0,value:N.createRef()}),Object.defineProperty(this,"outsideClickListener",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=e.target;if(this.popoverRef.current.contains(t))return;const r=this.targetRef.current;r&&r.contains(t)||this.props.onCloseRequest()}}),Object.defineProperty(this,"updatePosition",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.popoverRef)return;const{disablePortal:e}=this.props,t=this.targetRef.current;if(!t)return void console.warn("popover: no target element found");const{top:r,left:n,bottom:i,height:a,width:o}=t.getBoundingClientRect();let s="calc(50% - 12px)",l="auto";const c=this.popoverRef.current;let u="bottom"===this.props.placement?i+10:r-c.clientHeight-10,d=n+o/2-c.clientWidth/2,h="bottom"===this.props.placement?"top":"bottom";u<0&&(u=i+10,h="top"),d<0&&(d=0,s=n+o/2-12),d+c.clientWidth>window.innerWidth&&(d=window.innerWidth-c.clientWidth,s=n-d+o/2-12),e&&(u=a+10,d=0,s=8,"top"===this.props.placement&&(l=u,u="auto")),this.setState({top:u,bottom:l,left:d,tipPosition:h,tipOffset:s},(()=>{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:s,disableAnimation:l}=this.props,c={position:"absolute",left:i};"bottom"===n?c.bottom=-8:c.top=-8;const u=Y(a,"x-3deye-popover-body");let d=null;if(o){const i={zIndex:s?1:100000001,position:"absolute",top:e,bottom:r,left:t},a=N.createElement("div",{className:u,ref:this.popoverRef},this.props.children,N.createElement(Yi,{width:24,height:8,position:n,color:"white",style:c}));d=l?N.createElement("div",{style:i},a):N.createElement(qi,{from:n,style:i},a)}const h=N.cloneElement(this.props.target,{ref:this.targetRef});if(s)return N.createElement("div",{className:"x-3deye-popover",onMouseLeave:this.props.onMouseLeave},h,d);const p=o&&N.createElement(Ai,null,d);return N.createElement(N.Fragment,null,h,p)}startOutsideClickListening(){document.addEventListener("mousedown",this.outsideClickListener,!0)}stopOutsideClickListening(){document.removeEventListener("mousedown",this.outsideClickListener,!0)}}const Ki=V((({store:e})=>{const[t,r]=k(!1),{cameras:n}=U(Ln),{date:s,setDate:l,cameraId:c}=e,u=c?n.camerasById.get(c):void 0,d=a(new Date,1),h=s&&i(s,new Date),p=s&&i(s,d),m=u?o(new Date,u.archiveDuration):new Date,f=()=>r(!1);return N.createElement(Wi,null,N.createElement(Xn,{className:Y({"button-selected":h}),onClick:()=>l(new Date)},Oe.t("today")),c&&!i(new Date,m)?N.createElement(Xn,{className:Y({"button-selected":p}),onClick:()=>l(d)},Oe.t("yesterday")):null,s&&N.createElement(Xi,{target:N.createElement(Xn,{className:"date-button",onClick:()=>r(!t)},Pe(s,"EEE dd MMM")),opened:t,onCloseRequest:f,disableAnimation:!0},N.createElement(le,{selected:s,onChange:l,dateFormat:"EEE dd MMM",inline:!0,minDate:m,maxDate:new Date}),N.createElement("div",{style:{display:"flex"}},N.createElement(Xn,{style:{flex:1},onClick:f,className:"x-3deye-button--save"},"Ok"))))}));Ki.displayName="DateSelector";const Ji=V((()=>{const e=U(Ln),t=R(null),r=R(null),n=W((()=>({width:0,setWidth:e=>n.width=e}))),i=100,a=20,o=20,s=30,l=20;return z((()=>{const c=he(r.current),u=new Q((e=>{for(const t of e){const e=t.contentRect.width;n.setWidth(e)}})),d=fe.every(30);if(u.observe(t.current),!("eventSearchPanel"in e))return;const h=w((()=>({data:e.eventSearchPanel.eventSearch.filteredPeopleCountingData,width:n.width})),(({data:t,width:r})=>{if(!r)return;t.forEach((e=>e.timestamp=new Date(e.TimeStamp)));const n=ce(t,(e=>e.timestamp)),u=be(ve.offset(n[0],-1),ve.offset(n[1],1)),h=ye().extent([[l,a],[r-o,i-s]]).on("end",(function({selection:t,sourceEvent:r}){if(!("eventSearchPanel"in e))return;if(!r)return;if(!t)return void e.eventSearchPanel.eventSearch.setBrushFilter(null);const[n,i]=t.map((e=>d.round(p.invert(e))));e.eventSearchPanel.eventSearch.setBrushFilter([n,i]),he(this).transition().call(h.move,i>n?[n,i].map(p):null)}));const p=pe().domain(ce(u)).nice().range([l,r-o]),m=t.length?ue().value((e=>e.timestamp)).domain(p.domain()).thresholds(p.ticks(24))(t):[],f=me().domain([0,de(m,(e=>e.length))]).nice().range([i-s,a]),b=c.select(".bars").selectAll(".bar").data(m);b.exit().remove();const v=b.enter().append("g").attr("class","bar");if(v.append("rect").attr("x",(e=>p(e.x0)+1)).attr("width",(e=>Math.max(0,p(e.x1)-p(e.x0)-1))).attr("y",(e=>f(e.length))).attr("height",(e=>f(0)-f(e.length))),b.select("rect").attr("x",(e=>p(e.x0)+1)).attr("width",(e=>Math.max(0,p(e.x1)-p(e.x0)-1))).attr("y",(e=>f(e.length))).attr("height",(e=>f(0)-f(e.length))),v.append("text").attr("dy",".75em").attr("y",(e=>f(e.length)-10)).attr("x",(e=>p(e.x0)+1+Math.max(0,p(e.x1)-p(e.x0)-1)/2)).attr("text-anchor","middle").text((function(e){return e.length?e.length:""})),b.select("text").attr("dy",".75em").attr("y",(e=>f(e.length)-10)).attr("x",(e=>p(e.x0)+1+Math.max(0,p(e.x1)-p(e.x0)-1)/2)).attr("text-anchor","middle").text((e=>e.length?e.length:"")),t.length){const[e,t]=p.domain(),[r,n]=p.range(),i=(n-r)/(+t-+e)*3600*1e3,a=30,o=ge(p).ticks(ve.every(1)).tickFormat((e=>i>=a?we("%H:%M")(e):e.getHours()%(Math.floor(a/i)+1)?"":we("%H:%M")(e)));o.scale(p),c.select(".x-axis").attr("transform","translate(0,70)").call(o),c.select(".brush").call(h)}else c.select(".x-axis").html(""),c.select(".brush").call(h),c.select(".brush").html("").call(h.move,null)}),{fireImmediately:!0});return()=>{h(),u.disconnect()}}),[]),N.createElement("div",{ref:t},N.createElement("div",{style:{marginLeft:10}},"People Counting"),N.createElement("svg",{className:"people-histogram",ref:r,width:n.width,height:i,viewBox:`0 0 ${n.width} 100`},N.createElement("g",{className:"bars"}),N.createElement("g",{className:"x-axis"}),N.createElement("g",{className:"brush"})))}));Ji.displayName="PeopleHistogram";const Zi=e=>{const{children:t,innerProps:r,...n}=e,{Option:i}=q,{data:a}=e,o={...r,style:{display:"flex",alignItems:"center",width:"auto"}};return N.createElement(i,{innerProps:o,...n},N.createElement($n,{data:a}),N.createElement("div",{style:{marginLeft:4}},t))},Qi=V((({store:e,onEventClick:t})=>{if(!e)return null;const{filters:r,setFilters:n}=e,{foundObjectTypesForSelect:i}=e.eventSchema;return N.createElement(N.Fragment,null,N.createElement(Ki,{store:e}),N.createElement("div",{style:{zIndex:2}},N.createElement(G,{closeMenuOnSelect:!1,isMulti:!0,onChange:n,getOptionLabel:e=>e.name,getOptionValue:e=>e.id,options:i,placeholder:Oe.t("selectObjectType"),value:r,components:{MultiValueLabel:Wn,Option:Zi},styles:{...ni,multiValue:(e,{data:t})=>t.color?{...e,backgroundColor:t.color,color:"white"}:e,multiValueLabel:(e,{data:t})=>t.color?{...e,color:"white"}:e,multiValueRemove:(e,{data:t})=>t.color?{...e,color:"white"}:e,option:(e,{data:t})=>t.color?{...e,color:t.color}:e}})),N.createElement(ti,{getter:e.getProbabilityThreshold,setter:e.setProbabilityThreshold}),e.filters.length?N.createElement(Qn,{value:e.colors,toggle:e.toggleColor,clear:e.clearColors}):null,e.analyticsEnabled?N.createElement(Ji,null):null,N.createElement("div",{style:{flex:1}},N.createElement($i,{hideCameraName:!0,store:e.eventsLoader,onEventClick:t})))}));Qi.displayName="EventSearch";const ea=e=>{var t;const r=null!==(t=U(M))&&void 0!==t?t:A;return N.createElement(Ln.Provider,{value:r},N.createElement(Qi,{...e}))};var ta;ea.displayName="EventSearch",(ta={resources:{en:{translation:_e}}})&&Object.assign(Ce,ta),l(Oe.init(Ce));const ra=(e=A)=>{const t=new An(e.eventSchema,e.events,e.notification);return t.initWith(e.api),t};export default ea;export{ra as createEventSearchStore};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.18.14"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@3deye-toolkit/react-event-search",
|
|
3
|
+
"version": "0.0.1-alpha.21",
|
|
4
|
+
"module": "dist/react-event-search.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"types": "dist/react-event-search.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@3deye-toolkit/core": "0.0.1-alpha.21",
|
|
11
|
+
"@material/slider": "^5.1.0",
|
|
12
|
+
"@reach/tooltip": "^0.15.3",
|
|
13
|
+
"@react-spring/web": "^9.2.5",
|
|
14
|
+
"@seznam/compose-react-refs": "^1.0.6",
|
|
15
|
+
"clsx": "^1.1.1",
|
|
16
|
+
"d3-array": "^2.12.1",
|
|
17
|
+
"d3-axis": "^2.1.0",
|
|
18
|
+
"d3-brush": "^2.1.0",
|
|
19
|
+
"d3-scale": "^3.3.0",
|
|
20
|
+
"d3-selection": "^2.0.0",
|
|
21
|
+
"d3-time": "^2.1.1",
|
|
22
|
+
"d3-time-format": "^3.0.0",
|
|
23
|
+
"date-fns": "^2.22.1",
|
|
24
|
+
"earcut": "^2.2.3",
|
|
25
|
+
"i18next": "^20.3.3",
|
|
26
|
+
"lodash": "4.17.21",
|
|
27
|
+
"material-colors": "^1.2.6",
|
|
28
|
+
"mobx": "^6.3.2",
|
|
29
|
+
"mobx-react-lite": "^3.2.0",
|
|
30
|
+
"react-datepicker": "^4.1.1",
|
|
31
|
+
"react-ink": "^6.5.1",
|
|
32
|
+
"react-select": "^4.3.1",
|
|
33
|
+
"react-virtualized-auto-sizer": "^1.0.5",
|
|
34
|
+
"react-window": "^1.8.6",
|
|
35
|
+
"react-window-infinite-loader": "^1.0.7",
|
|
36
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
37
|
+
"rxjs": "^6.5.5"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "^16.8.0 || ^17",
|
|
41
|
+
"react-dom": "^16.8.0 || ^17"
|
|
42
|
+
},
|
|
43
|
+
"sideEffects": [
|
|
44
|
+
"*.css"
|
|
45
|
+
],
|
|
46
|
+
"license": "mit"
|
|
47
|
+
}
|