@map-colonies/react-components 4.13.3 → 4.13.4

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.
@@ -606,11 +606,11 @@ const Ft = 5, Gt = 2, Qn = ze(null), Mo = Qn.Provider, gn = 35, fn = 32, Io = 10
606
606
  if (e === null)
607
607
  throw new Error("vector layer context is null, please check the provider");
608
608
  return e;
609
- }, No = ({ children: e }) => {
610
- const t = Xe(), [n] = B(new Zi());
611
- return O(() => (t.addLayer(n), () => {
612
- t.removeLayer(n);
613
- }), [t, n]), /* @__PURE__ */ a(Oo, { value: n, children: e });
609
+ }, No = ({ options: e, children: t }) => {
610
+ const n = Xe(), [i] = B(new Zi(e));
611
+ return O(() => (n.addLayer(i), () => {
612
+ n.removeLayer(i);
613
+ }), [n, i]), /* @__PURE__ */ a(Oo, { value: i, children: t });
614
614
  }, ni = ze(null), Bo = ni.Provider, Fo = () => {
615
615
  const e = Ve(ni);
616
616
  if (e === null)
@@ -1,4 +1,4 @@
1
- (function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@date-io/date-fns"),require("@material-ui/pickers"),require("@material-ui/core"),require("@material-ui/core/styles"),require("@map-colonies/react-core"),require("@material-ui/core/useMediaQuery"),require("react-datepicker"),require("date-fns/locale/he"),require("moment"),require("@turf/rewind"),require("ol"),require("ol/ol.css"),require("ol/coordinate"),require("ol/control"),require("ol/control/MousePosition"),require("ol/proj"),require("ol/layer"),require("ol/source"),require("ol/format"),require("ol/interaction"),require("ol/interaction/Draw"),require("ol/layer/VectorTile"),require("ol/style"),require("ol/tilegrid/WMTS"),require("ol/extent"),require("ol/source/TileWMS"),require("ol/source/XYZ"),require("ol/source/VectorTile"),require("ol-ext/legend/Legend"),require("ol-ext/control/Legend"),require("ol-ext/dist/ol-ext.css"),require("@material-ui/core/TableHead"),require("@material-ui/core/utils"),require("@material-ui/core/CssBaseline"),require("@material-ui/core/ScopedCssBaseline"),require("react-dom"),require("resium"),require("cesium"),require("lodash"),require("@turf/bbox"),require("@turf/invariant"),require("@turf/area"),require("@turf/bbox-polygon"),require("@turf/centroid"),require("@turf/helpers"),require("@turf/intersect"),require("@turf/point-to-polygon-distance"),require("@map-colonies/react-core/dist/list/styles"),require("@map-colonies/react-core/dist/textfield/styles"),require("@turf/boolean-point-in-polygon"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("@map-colonies/react-core/dist/checkbox/styles"),require("p-map"),require("uuid"),require("@turf/boolean-valid"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select"),require("react-circular-progressbar"),require("react-circular-progressbar/dist/styles.css"),require("react-move")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@date-io/date-fns","@material-ui/pickers","@material-ui/core","@material-ui/core/styles","@map-colonies/react-core","@material-ui/core/useMediaQuery","react-datepicker","date-fns/locale/he","moment","@turf/rewind","ol","ol/ol.css","ol/coordinate","ol/control","ol/control/MousePosition","ol/proj","ol/layer","ol/source","ol/format","ol/interaction","ol/interaction/Draw","ol/layer/VectorTile","ol/style","ol/tilegrid/WMTS","ol/extent","ol/source/TileWMS","ol/source/XYZ","ol/source/VectorTile","ol-ext/legend/Legend","ol-ext/control/Legend","ol-ext/dist/ol-ext.css","@material-ui/core/TableHead","@material-ui/core/utils","@material-ui/core/CssBaseline","@material-ui/core/ScopedCssBaseline","react-dom","resium","cesium","lodash","@turf/bbox","@turf/invariant","@turf/area","@turf/bbox-polygon","@turf/centroid","@turf/helpers","@turf/intersect","@turf/point-to-polygon-distance","@map-colonies/react-core/dist/list/styles","@map-colonies/react-core/dist/textfield/styles","@turf/boolean-point-in-polygon","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","@map-colonies/react-core/dist/checkbox/styles","p-map","uuid","@turf/boolean-valid","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select","react-circular-progressbar","react-circular-progressbar/dist/styles.css","react-move"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.reactComponents={},u.jsxRuntime,u.React,u.dateFns,u.locale,u.DateFnsUtils,u.pickers,u.core,u.styles,u.reactCore,u.useMediaQuery,u.DatePicker,u.datePickerHebrewLocale,u.moment,u.rewind,u.ol,null,u.coordinate,u.control,u.MousePosition,u.proj,u.layer,u.source,u.format,u.interaction,u.Draw,u.VectorTile,u.style,u.WMTSTileGrid,u.extent,u.OlTileWMS,u.OlXYZ,u.VectorTileSource,u.OlExtLegend,u.OlExtLegendCtrl,null,u.TableHead,u.utils,u.CssBaseline,u.ScopedCssBaseline,u.ReactDOM,u.resium,u.Cesium,u.lodash,u.bbox,u.invariant,u.area,u.bboxPolygon,u.centroid,u.turf,u.intersect,u.pointToPolygonDistance,null,null,u.booleanPointInPolygon,u.viewerCesiumNavigationMixin,null,null,null,u.pMap,u.uuid,u.booleanValid,u.getCaretCoordinates,u.getInputSelection,u.chonky,u.chonkyIconFontawesome,u.filesize,u.Select,u.reactCircularProgressbar,null,u.reactMove))})(this,function(u,i,a,Le,Ue,bt,Ne,ae,Oe,J,Jn,Ct,Kn,Be,Qn,Mt,ss,_t,at,lt,Pt,It,ct,dt,Rn,er,tr,$e,nr,At,rr,ir,or,Dt,sr,as,ar,Ot,lr,cr,ut,Me,g,$,qe,dr,kt,je,ur,xt,Nt,hr,ls,cs,gr,pr,ds,us,hs,ht,Bt,fr,mr,Ft,re,yr,vr,Gt,Ye,gs,Er){"use strict";var is=Object.defineProperty;var os=(u,i,a)=>i in u?is(u,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[i]=a;var ue=(u,i,a)=>(os(u,typeof i!="symbol"?i+"":i,a),a);function gt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Vt=gt(a),M=gt(g),Ht=gt(xt),Q=e=>{const{children:t,...n}=e;return i.jsx(ae.Box,{...n,children:t})};var we=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(we||{}),Se=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(Se||{}),Ze=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Ze||{});const he={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:Se.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:Se.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Xe=e=>{const t=e.type==="dark";return a.useMemo(()=>Wt(e,t),[t,e])},Wt=(e,t=!1)=>Oe.createTheme({palette:{type:t?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:t?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:t?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zt=e=>a.useMemo(()=>({...e,"cesium-color":"#EDFFFF","cesium-error":e["--mdc-theme-gc-error-medium"]??"#FF3636","cesium-warning":e["--mdc-theme-gc-warning-high"]??"#FFA032","cesium-checkbox-color":"#1A73E8","cesium-checkbox-width":"12px","cesium-checkbox-height":"12px","cesium-font-size":"10pt"}),[e]),ps="",wr=2,Tr=.5,Lr=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(wr),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Tr)}})),Ut=e=>{var X,W,Z,ee;const t=Lr(),n=J.useTheme(),r=Xe(n),[s,o]=a.useState(null),[d,h]=a.useState(null),[f,E]=a.useState(he.DATE_RANGE_PICKER.dateFormat),C=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,b=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,p=((X=e.local)==null?void 0:X.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,v=((W=e.local)==null?void 0:W.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,I=((Z=e.local)==null?void 0:Z.setText)??he.DATE_RANGE_PICKER.local.setText,T=((ee=e.local)==null?void 0:ee.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,F=e.showTime??he.DATE_RANGE_PICKER.showTime,V=T===Se.HE?Ue.he:Ue.enUS;a.useEffect(()=>{o(e.from??null)},[e.from]),a.useEffect(()=>{h(e.to??null)},[e.to]),a.useEffect(()=>{E(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const j=Boolean(Le.isValid(s)&&!d||Le.isValid(d)&&!s||s&&d&&Le.isValid(s)&&Le.isValid(d)&&Le.isBefore(s,d)),Y=()=>{e.onChange({from:s&&Le.isValid(s)?s:void 0,to:d&&Le.isValid(d)?d:void 0})},G=F?Ne.KeyboardDateTimePicker:Ne.KeyboardDatePicker;return i.jsx(ae.ThemeProvider,{theme:r,children:i.jsx(Q,{className:`${t.container} drpContainer`,display:"flex",flexDirection:C,width:C==="column"?e.contentWidth:"unset",children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:V,children:[i.jsx(G,{variant:"inline",placeholder:p,onChange:l=>o(l),value:s,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(G,{variant:"inline",placeholder:v,className:t.margin,onChange:l=>h(l),value:d,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(J.ThemeProvider,{options:n,children:i.jsx(J.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:Y,disabled:!j,children:I})})]})})})},$t=e=>{const{children:t,...n}=e;return i.jsx(ae.Popover,{...n,children:t})},fs="",Sr=e=>{var G,X;const[t,n]=a.useState(null),[r,s]=a.useState(null),[o,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[h,f]=a.useState(null),E=W=>{f(W.currentTarget)},C=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},b=()=>{f(null)},p=Boolean(h),v=e.controlsLayout??"column";a.useEffect(()=>{n(e.from??null)},[e.from]),a.useEffect(()=>{s(e.to??null)},[e.to]),a.useEffect(()=>{d(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const I=((G=e.local)==null?void 0:G.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,T=((X=e.local)==null?void 0:X.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,F=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,V=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,j=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,Y=a.useMemo(()=>`${t?Le.format(t,o):I} - ${r?Le.format(r,o):T}`,[t,r,o,I,T]);return i.jsxs(i.Fragment,{children:[F?i.jsx(J.Button,{style:{width:e.width},raised:!0,onClick:E,className:"drpOpener",children:Y}):i.jsx(J.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:Y,onClick:C,trailingIcon:{icon:"date_range",tabIndex:0,onClick:C}}),i.jsx($t,{open:p,anchorEl:h,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(Ut,{controlsLayout:v,contentWidth:((h==null?void 0:h.clientWidth)??0)-V,dateFormat:o,disableFuture:j,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{n(W??null),s(Z??null),e.onChange({from:W,to:Z}),b()}})})]})},Je=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,br=({endDate:e,startDate:t,setEndDate:n=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:o="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:h="",startTimeInputClassName:f="",startTimeLabel:E="",startTimeWrapperClassName:C=""})=>i.jsxs("div",{className:`timeRangeWrapper ${h}`,children:[i.jsx("div",{className:`startTimeWrapper ${C}`,children:i.jsx(J.TextField,{label:E,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Be(t).format("HH:mm"),onChange:b=>{const p=Be(t),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});r(I.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(J.TextField,{label:o,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Be(e).format("HH:mm"),onChange:b=>{const p=Be(e),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});n(I.toDate())}})})]}),Cr=a.forwardRef(({value:e,onClick:t,onInputClick:n,...r},s)=>i.jsx(J.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:o=>{t==null||t(o),n==null||n()},ref:s,value:e})),Mr=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:n,dateRange:r,onShortcut:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>n.map(f=>f instanceof Function?f():f),[n]);return a.useEffect(()=>{for(const f of h){const E=r.startDate&&r.endDate&&Le.isSameDay(f.startDate,r.startDate)&&Le.isSameDay(f.endDate,r.endDate);o?f.id===o&&(E||d(void 0)):E&&d(f.id)}},[r,o,h]),i.jsx("div",{className:"shortcutsContainer",children:h.map((f,E)=>{const C=()=>{e(f.startDate),t(f.endDate)};return i.jsx(J.Button,{type:"button",className:`shortcut ${o===f.id?"selected":""}`,onClick:b=>{C(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+E)})})},_r=a.forwardRef((e,t)=>{const{calendarClassName:n,dayClassName:r,monthClassName:s,selectsRange:o,onChange:d,inputName:h,showMonthYearDropdown:f,withShortcuts:E,locale:C="en"}=e,[b,p]=a.useState(null),[v,I]=a.useState(null),[T,F]=a.useState(!1),V=o?{startDate:b,endDate:v}:b;a.useEffect(()=>{C==="he"&&Ct.registerLocale("he",Kn)},[C]),a.useEffect(()=>{var G,X;((G=e.startDate)==null?void 0:G.toString())!==(b==null?void 0:b.toString())&&p(e.startDate),((X=e.endDate)==null?void 0:X.toString())!==(v==null?void 0:v.toString())&&I(e.endDate)},[e.startDate,e.endDate,b,v]);const j=a.useMemo(()=>{let G="pickerContainer"+(C==="he"?" pickerContainer-rtl":"");return E&&o&&(G+=" pickerContainer-withShortcuts"),G},[C,E,o]),Y=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:j,style:{direction:C==="he"?"rtl":"ltr"},children:i.jsx(Ct,{...e,ref:t,onClickOutside:()=>F(!1),open:T,startDate:Je(V)?b:void 0,selected:b,endDate:Je(V)?v:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${n}`,weekDayClassName:G=>`pickerWeek ${(r==null?void 0:r(G))??""}`,dayClassName:G=>`pickerDay ${(r==null?void 0:r(G))??""}`,monthClassName:G=>`pickerMonth ${(s==null?void 0:s(G))??""}`,onChange:(G,X)=>{if(Array.isArray(G)){const[W,Z]=G;p(W),I(Z),d==null||d({startDate:W,endDate:Z&&Le.endOfDay(Z)},X)}else p(G),d==null||d(G,X)},customInput:i.jsx(Cr,{name:h,onInputClick:()=>{F(!0)}}),showTimeInput:!!(E&&o),timeInputLabel:"",customTimeInput:E&&Je(V)&&i.jsx(Mr,{onShortcut:G=>{d==null||d(G),F(!1)},shortcuts:E,setEndDate:I,setStartDate:p,dateRange:V}),showMonthYearDropdown:void 0,...Y})})}),ms="",Pr=e=>{const t=J.useTheme(),n=Xe(t),{format:r=he.DATE_PICKER.dateFormat,variant:s=he.DATE_PICKER.variant,disableFuture:o=he.DATE_PICKER.disableFuture,local:d,onChange:h,showTime:f=he.DATE_PICKER.showTime,value:E,...C}=e,{placeHolderText:b=he.DATE_PICKER.local.placeHolderText,calendarLocale:p}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:Se.EN},v=p===Se.HE?Ue.he:Ue.enUS,I=T=>{h(T)};return i.jsx(ae.ThemeProvider,{theme:n,children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:v,children:[f&&i.jsx(Ne.KeyboardDateTimePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C}),!f&&i.jsx(Ne.KeyboardDatePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C})]})})},Ir=18,Ar=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(Ir)},fullWidth:{width:"100%",marginTop:"36px"}})),Dr=e=>{const t=Ar(),[n,r]=a.useState(null),{isSelectionEnabled:s,onCancelDraw:o,onStartDraw:d,onReset:h}=e,f=C=>{r(C.currentTarget)},E=()=>{r(null)};return s?i.jsx(J.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:o,children:"Cancel Draw"})}):i.jsxs(Q,{position:"relative",children:[i.jsx(J.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(J.Menu,{className:t.fullWidth,open:Boolean(n),onClose:E,children:[i.jsx(J.MenuItem,{onClick:()=>{d(we.POLYGON),E()},children:"Polygon"}),i.jsx(J.MenuItem,{onClick:()=>{d(we.BOX),E()},children:"Box"}),i.jsx(J.MenuItem,{onClick:()=>{h(),E()},children:"Clear"})]})]})},ys="";var be=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(be||{});const Ke=5,Qe=2,qt=a.createContext(null),Or=qt.Provider,jt=35,Yt=32,kr=10,xr=e=>e!==void 0&&e!==be.WGS84?Pt.transform([jt,Yt],be.WGS84,e):[jt,Yt],Nr=e=>{switch(e){case be.WEB_MERCATOR:return t=>_t.format(t,"Mercator: {y}m, {x}m",Qe);case be.WGS84:return t=>_t.format(t,"WGS84: {y}°N {x}°E",Ke);default:return t=>""}},ke=()=>{const e=a.useContext(qt);if(e===null)throw new Error("map context is null, please check the provider");return e},Zt=e=>{const t=a.useRef(null),{allowFullScreen:n,showMousePosition:r,projection:s}=e,[o]=a.useState(new Mt.Map({view:new Mt.View({projection:s??be.WGS84}),controls:at.defaults()}));a.useEffect(()=>{o.getView().setCenter(e.center??xr(e.projection))},[o,e.center,e.projection]),a.useEffect(()=>{o.getView().setZoom(e.zoom??kr)},[o,e.zoom,e.projection]);const d=(h,f)=>{f.getControls().forEach(C=>{C instanceof h&&f.removeControl(C)})};return a.useEffect(()=>{o.setTarget(t.current),n!==void 0&&n?o.addControl(new at.FullScreen):d(at.FullScreen,o)},[o,n]),a.useEffect(()=>{r!==void 0&&r?(d(lt,o),o.addControl(new lt({coordinateFormat:Nr(s??be.WGS84),projection:s??be.WGS84,undefinedHTML:"&nbsp;"}))):d(lt,o)},[o,r,s]),i.jsxs(Or,{value:o,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Xt=a.createContext(null),Br=Xt.Provider,Ve=()=>{const e=a.useContext(Xt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Jt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Tile(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Br,{value:r,children:t})},Kt=a.createContext(null),Fr=Kt.Provider,Qt=()=>{const e=a.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Rt=({children:e})=>{const t=ke(),[n]=a.useState(new It.Vector);return a.useEffect(()=>(t.addLayer(n),()=>{t.removeLayer(n)}),[t,n]),i.jsx(Fr,{value:n,children:e})},en=a.createContext(null),Gr=en.Provider,tn=()=>{const e=a.useContext(en);if(e===null)throw new Error("vector source context is null, please check the provider");return e},nn=({children:e})=>{const t=Qt(),[n]=a.useState(new ct.Vector);return a.useEffect(()=>{t.setSource(n)},[n,t]),i.jsx(Gr,{value:n,children:e})},rn=({geometry:e,fitOptions:t,fit:n,featureStyle:r})=>{const s=tn(),o=ke();return a.useLayoutEffect(()=>{const h=new dt.GeoJSON().readFeature(e);return n&&s.on("addfeature",function(){o.getView().fit(s.getExtent(),t)}),r&&h.setStyle(r),s.addFeature(h),()=>{s.removeFeature(h)}},[e,s,n]),null},on=e=>{const t=Ve();return a.useEffect(()=>{t.setSource(new ct.OSM)},[t]),null},sn=({drawType:e,onPolygonSelected:t})=>{const n=ke();return a.useEffect(()=>{const r={type:"Circle"};switch(e){case we.BOX:r.geometryFunction=er.createBox();break;case we.POLYGON:r.type="Polygon";break;default:return}const s=new Rn.Draw(r);n.addInteraction(s);const o=d=>{const f=new dt.GeoJSON().writeGeometryObject(d.feature.getGeometry());t==null||t(f)};return s.on("drawend",o),()=>{s.un("drawend",o),n.removeInteraction(s)}},[t,e,n]),null},vs="",Vr=e=>{const t=n=>{const r=Qn(n);e.onPolygonSelection(r)};return i.jsxs(Zt,{allowFullScreen:!0,showMousePosition:!0,children:[i.jsx(Jt,{children:i.jsx(on,{})}),e.selectionPolygon&&i.jsx(Rt,{children:i.jsx(nn,{children:i.jsx(rn,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&i.jsx(sn,{drawType:e.drawType,onPolygonSelected:t})]})},pt=1.5,Hr=80,Wr=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(pt),top:e.spacing(pt)},contentContainer:{marginTop:e.spacing(pt),width:e.spacing(Hr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),zr=e=>{var f;const[t,n]=a.useState(),[r,s]=a.useState(),o=Wr(),d=E=>{s(E),n(void 0),e.handlePolygonSelected(E)},h=()=>{s(void 0),e.handlePolygonReset()};return i.jsxs("div",{className:o.map,children:[i.jsxs("div",{className:`${o.absolute}`,children:[i.jsxs(ae.Paper,{className:o.filtersContainer,children:[i.jsx(Dr,{onCancelDraw:()=>n(void 0),onReset:h,onStartDraw:n,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((E,C)=>i.jsx("div",{className:o.filtersMargin,children:E},C))]}),i.jsx(ae.Paper,{color:"red",className:`${o.contentContainer}`,children:e.children})]}),i.jsx(Vr,{children:e.mapContent,onPolygonSelection:d,drawType:t,selectionPolygon:r})]})},an=new $e.Fill({color:"rgba(255,255,255,0.4)"}),ln=new $e.Stroke({color:"#3399CC",width:1.25}),cn=[new $e.Style({image:new $e.Circle({fill:an,stroke:ln,radius:5}),fill:an,stroke:ln})],dn=a.createContext(null),Ur=dn.Provider,un=()=>{const e=a.useContext(dn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},$r=({children:e,options:t,style:n})=>{const r=ke(),[s]=a.useState(new tr({...t,style:n||cn}));return a.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),a.useEffect(()=>{s.setStyle(n||cn)},[s,n]),i.jsx(Ur,{value:s,children:e})},ft=20,qr=256,jr=2,Yr=2,Zr="REST",Xr=e=>{const t=Pt.get(e.projection),n=t.getExtent(),r=new Array(ft),s=new Array(ft),o=At.getWidth(n)/qr,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Yr,h=e.requestEncoding!==void 0?e.requestEncoding:Zr;for(let E=0;E<ft;++E)r[E]=o/Math.pow(jr,E)/d,s[E]=E.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new nr({origin:At.getTopLeft(n),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:h,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Jr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ct.WMTS(n))},[t,n]),null},Kr=e=>{const{attributions:t,url:n,params:r,serverType:s,transition:o}=e;return{attributions:t,url:n,params:r,serverType:s,transition:o}},Qr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new rr(n))},[t,n]),null},Rr=e=>{const{attributions:t,url:n}=e;return{attributions:t,url:n}},ei=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ir(n))},[t,n]),null},ti=a.createContext(null),ni=()=>{const e=a.useContext(ti);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},ri=e=>{const{url:t}=e;return{url:t,format:new dt.MVT}},ii=({children:e,options:t})=>{const n=un();return a.useEffect(()=>{n.setSource(new or(t))},[t,n]),null},oi=({legendItems:e,title:t,isCollapsed:n})=>{const r=ke();return a.useEffect(()=>{const s=new Dt({title:t??"",margin:5,maxWidth:300}),o=new sr({legend:s,collapsed:n===void 0?!0:n});r.addControl(o);const d=new Dt({margin:4});return e.forEach(h=>{d.addItem({title:h.title,style:h.style,typeGeom:"Polygon"})}),s.addItem(d),()=>{r.removeControl(o)}},[r,e,t,n]),i.jsx(i.Fragment,{})};function si(e){const{headCells:t,order:n,orderBy:r,onRequestSort:s,isCollapseable:o}=e,d=h=>f=>{s(f,h)};return i.jsx(ar,{children:i.jsxs(ae.TableRow,{children:[o&&i.jsx(ae.TableCell,{}),t.map(h=>i.jsx(ae.TableCell,{align:h.numeric?"right":"left",padding:h.disablePadding?"none":"default",sortDirection:r===h.id?n:!1,children:i.jsx(ae.TableSortLabel,{active:r===h.id,direction:r===h.id?n:"asc",onClick:d(h.id),children:h.label})},h.id))]})})}const ai=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),li=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function ci(e){const{cellsMetadata:t,isRowSelected:n,item:r,onRowSelected:s,rowIndex:o,isCollapseable:d,collapsedElement:h}=e,[f,E]=a.useState(!1),C=t.length,b=()=>{s==null||s(o)};return i.jsxs(i.Fragment,{children:[i.jsxs(ae.TableRow,{hover:!0,selected:n,onClick:b,children:[d&&i.jsx(ae.TableCell,{padding:"checkbox",children:i.jsx(ae.IconButton,{"aria-label":"expand row",size:"small",onClick:p=>{p.stopPropagation(),E(!f)},children:f?i.jsx(li,{}):i.jsx(ai,{})})}),t.map(p=>i.jsx(ae.TableCell,{align:p.numeric?"right":"left",padding:p.disablePadding?"none":"default",children:p.transform?p.transform(r[p.id]):r[p.id]},p.id+o.toString()))]}),d&&i.jsx(ae.TableRow,{children:i.jsx(ae.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:C+1,children:i.jsx(ae.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:h==null?void 0:h(r)})})})]})}function di(e){const[t,n]=a.useState(""),[r,s]=a.useState("asc"),{cellsMetadata:o,items:d,onRequestSort:h,onRowSelected:f,isCollapseable:E,collapsedElement:C,isDense:b,page:p,rowsPerPage:v,count:I,handleChangePage:T,handleChangeRowsPerPage:F}=e,V=(j,Y)=>{const G=t===Y&&r==="asc";s(G?"desc":"asc"),n(Y),h(Y,G?"desc":"asc")};return i.jsxs(ae.TableContainer,{component:ae.Paper,children:[i.jsxs(ae.Table,{size:b?"small":"medium",children:[i.jsx(si,{headCells:o,onRequestSort:V,order:r,orderBy:t,isCollapseable:E}),i.jsxs(ae.TableBody,{children:[d.map((j,Y)=>i.jsx(ci,{item:j,rowIndex:Y,isCollapseable:E,cellsMetadata:o,collapsedElement:C,isRowSelected:!1,onRowSelected:f},Y)),(d.length===0||v>d.length)&&i.jsx(ae.TableRow,{style:{height:(b?33:53)*(v-d.length)},children:i.jsx(ae.TableCell,{colSpan:E?o.length+1:o.length,children:d.length===0&&i.jsx(ae.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(ae.TablePagination,{rowsPerPage:v,rowsPerPageOptions:[5,10],component:"div",count:I,page:p,onPageChange:T,onRowsPerPageChange:F})]})}const ui=e=>{const{children:t,...n}=e;return i.jsx(lr,{...n,children:t})},hi=e=>{const{children:t,...n}=e;return i.jsx(cr,{...n,children:t})},hn=e=>e*Math.PI/180,Re=e=>e*(180/Math.PI),gi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hn(85.362/2))/Math.sin(hn(85.362/2))),pi=({title:e,onClick:t})=>i.jsx("div",{className:"cesium-cesiumInspector-button",onClick:t,children:e}),fi=({title:e,isVisible:t,onClick:n,children:r})=>i.jsxs(Q,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(pi,{title:e,onClick:n}),t&&i.jsx(Q,{className:"cesium-cesiumInspector-dropDown",children:r})]}),Es="",mt="Imagery",yt="Data",mi=({locale:e})=>{var b,p;const t=pe(),[n,r]=a.useState([{id:mt,values:[]},{id:yt,values:[]}]),[s,o]=a.useState({}),d=v=>$.get(e,v.toUpperCase())??v,h=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(v,I)=>{var V;const T=t.imageryLayers.get(I),F=T.meta;return{id:F==null?void 0:F.id,name:$.get(F,"layerRecord.productName")??(F==null?void 0:F.id),rect:T.rectangle,isBaseMap:(V=t.layersManager)==null?void 0:V.isBaseMapLayer(F)}}):[],f=()=>{var v;return((v=t.layersManager)==null?void 0:v.dataLayerList.map(I=>{var T,F;return{id:(T=I.meta)==null?void 0:T.id,name:$.get(I.meta,"featureStructure.aliasLayerName")??I.meta.productName,rect:g.Rectangle.fromDegrees(...qe((F=I.meta)==null?void 0:F.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const I=[{id:mt,values:h()},{id:yt,values:f()}];r(I),o(I.reduce((T,F)=>({...T,[F.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===mt?{...T,values:h()}:T))};return t.layersManager.addLayerUpdatedListener(v),t.imageryLayers.layerRemoved.addEventListener(v),()=>{var I;$.get(t,"_cesiumWidget")!==void 0&&((I=t.layersManager)==null||I.removeLayerUpdatedListener(v),t.imageryLayers.layerRemoved.removeEventListener(v))}},[(b=t.layersManager)==null?void 0:b.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===yt?{...T,values:f()}:T))};return t.layersManager.addDataLayerUpdatedListener(v),()=>{var I;(I=t.layersManager)==null||I.removeDataLayerUpdatedListener(v)}},[(p=t.layersManager)==null?void 0:p.dataLayerList]);const E=v=>{o(I=>({...I,[v]:!I[v]}))},C=v=>{t.camera.flyTo({destination:v})};return i.jsx(Q,{className:"activeLayersPanel",children:n.filter(v=>v.values.length>0).map(v=>i.jsxs(Q,{className:`cesium-cesiumInspector-section ${s[v.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>E(v.id),children:[i.jsx(J.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(v.id)}),i.jsx(Q,{className:"cesium-cesiumInspector-sectionContent",children:v.values.map(I=>i.jsxs(Q,{className:"layer",children:[i.jsx(J.Tooltip,{content:I.name,children:i.jsx(Q,{className:`name ${I.isBaseMap?"disabled":""}`,children:I.name})}),i.jsx(Q,{className:"icons",children:i.jsx(J.Tooltip,{content:$.get(e,"FLY_TO")??"Fly To",children:i.jsx(Q,{className:"icon",onClick:T=>{T.stopPropagation(),C(I.rect)},children:i.jsxs("svg",{fill:"var(--mdc-theme-cesium-color)",width:"100%",height:"100%",viewBox:"0 0 256 256",children:[i.jsx("path",{d:"M236,120H223.66406A96.15352,96.15352,0,0,0,136,32.33618V20a8,8,0,0,0-16,0V32.33618A96.15352,96.15352,0,0,0,32.33594,120H20a8,8,0,0,0,0,16H32.33594A96.15352,96.15352,0,0,0,120,223.66382V236a8,8,0,0,0,16,0V223.66382A96.15352,96.15352,0,0,0,223.66406,136H236a8,8,0,0,0,0-16Zm-40,16h11.59912A80.14164,80.14164,0,0,1,136,207.59912V196a8,8,0,0,0-16,0v11.59912A80.14164,80.14164,0,0,1,48.40088,136H60a8,8,0,0,0,0-16H48.40088A80.14164,80.14164,0,0,1,120,48.40088V60a8,8,0,0,0,16,0V48.40088A80.14164,80.14164,0,0,1,207.59912,120H196a8,8,0,0,0,0,16Z"}),i.jsx("polygon",{points:"128,80 80,170 128,150 176,170",fill:"var(--mdc-theme-cesium-color)"})]})})})})]},I.id))})]},v.id))})},yi=({locale:e})=>{const[t,n]=a.useState(!1),r=a.useMemo(()=>$.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(fi,{title:r,isVisible:t,onClick:()=>n(!t),children:i.jsx(mi,{locale:e})})},et=({onClick:e,children:t})=>i.jsx("div",{className:"cesium-toolbar-button cesium-button",onClick:e,children:t}),vt=({title:e})=>i.jsx(Q,{className:"cesium-mc-title",children:e}),Et=({isVisible:e,children:t,title:n})=>i.jsxs(Q,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[n&&i.jsx(vt,{title:n}),t]}),ws="";function wt(e){return function(n){const r=a.useRef(null),[s,o]=a.useState(!1);return a.useEffect(()=>{if(!s)return;const d=h=>{const f=h.target;r.current&&!r.current.contains(f)&&o(!1)};return document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}},[s]),i.jsx("div",{ref:r,className:"disappear",children:i.jsx(e,{...n,isOpen:s,setIsOpen:o})})}}const gn=({item:e,isSelected:t,onClick:n})=>i.jsxs(Q,{className:`cesium-baseLayerPicker-item ${t?"cesium-baseLayerPicker-selectedItem":""}`,title:e.title,onClick:n,children:[i.jsx("img",{className:"cesium-baseLayerPicker-itemIcon",src:e.thumbnail,alt:e.title}),i.jsx(Q,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),vi=({title:e,baseMaps:t,setCurrent:n})=>{const r=pe(),[s,o]=a.useState();a.useEffect(()=>{const h=t.maps.find(f=>f.isCurrent);h&&(o(h),n(h))},[t]);const d=h=>{var E,C;(E=r.layersManager)==null||E.removeBaseMapLayers();const f=t.maps.find(b=>b.id===h);f&&((C=r.layersManager)==null||C.setBaseMapLayers(f),o(f),n(f),t.maps.forEach(b=>{b.isCurrent=f===b}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.maps.map(h=>i.jsx(gn,{item:h,isSelected:s===h,onClick:()=>d(h.id)},h.id))})]})},Ei=({title:e,terrains:t})=>{const[n,r]=a.useState(),s=pe();a.useEffect(()=>{const d=t.find(h=>h.isCurrent);d&&r(d)},[t]);const o=d=>{const h=t.find(f=>f.id===d);h&&(s.terrainProvider=h.terrainProvider??new g.EllipsoidTerrainProvider({}),r(h),t.forEach(f=>{f.isCurrent=h===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(gn,{item:d,isSelected:n===d,onClick:()=>o(d.id)},d.id))})]})},wi=wt(({baseMaps:e,terrains:t,locale:n,isOpen:r,setIsOpen:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>$.get(n,"BASE_MAP_TITLE")??"Base Map",[n]),f=a.useMemo(()=>$.get(n,"TERRAIN_TITLE")??"Terrain",[n]);return i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>s(!r),children:i.jsx("img",{className:"cesium-baseLayerPicker-selected",src:o==null?void 0:o.thumbnail,title:o==null?void 0:o.title,alt:"Current Map"})}),i.jsxs(Et,{isVisible:r,children:[e&&i.jsx(vi,{title:h,baseMaps:e,setCurrent:d}),t&&i.jsx(Ei,{title:f,terrains:t})]})]})}),Ls="",Ti=({featureTypes:e,locale:t})=>{const n=a.useMemo(()=>$.get(t,"WFS_TITLE")??"Data Layers",[t]),r=a.useMemo(()=>$.get(t,"WFS_CACHE")??"Cache",[t]),s=a.useMemo(()=>$.get(t,"WFS_EXTENT")??"Extent",[t]),o=a.useMemo(()=>$.get(t,"NO_DATA_LAYERS")??"No layers found",[t]),d=a.useMemo(()=>i.jsx(Q,{className:"title",children:n}),[n]),h=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,E)=>i.jsxs(Q,{className:"featureType",children:[i.jsx(J.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(Q,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(Q,{className:"info",children:[i.jsxs(Q,{children:[r,": ",f.cache??0]}),f.total>0&&i.jsxs(Q,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},E)):i.jsx(Q,{children:o})}),[e]);return i.jsxs(Q,{className:"wfsContainer",children:[d,h]})},Li=wt(({locale:e,isOpen:t,setIsOpen:n})=>{var h;const[r,s]=a.useState([]),o=a.useMemo(()=>$.get(e,"DEBUG_PANEL_TITLE")??"Debugger Tool",[e]),d=pe();return a.useEffect(()=>{if(!d.layersManager)return;const f=(E,C)=>{var p;E.forEach(v=>{if(C!==void 0&&C!==v.meta.id)return;const{options:I,meta:T}=v,{zoomLevel:F}=I,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W}=T;s(Z=>{const ee=Z.findIndex(l=>l.id===V);if(ee>=0){if(JSON.stringify(Z[ee])!==JSON.stringify({id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F})){const l=[...Z];return l[ee]={id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F},l}}else return[...Z,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F}];return Z})});const b=new Set((p=d.layersManager)==null?void 0:p.dataLayerList.map(v=>v.meta.id));s(v=>v.filter(I=>b.has(I.id)))};return d.layersManager.addDataLayerUpdatedListener(f),()=>{var E;(E=d.layersManager)==null||E.removeDataLayerUpdatedListener(f)}},[(h=d.layersManager)==null?void 0:h.dataLayerList]),i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>n(!t),children:i.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:i.jsx("path",{d:"M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27-7.38 5.74zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16z",fill:"orange"})})}),i.jsx(Et,{isVisible:t,title:o,children:i.jsx(Ti,{featureTypes:r,locale:e})})]})});class Si extends g.PolylineDashMaterialProperty{}class bi extends g.ConstantProperty{}class Ci extends g.ConstantPositionProperty{}class Mi extends g.Cartesian2{}class _i extends g.Cartesian3{}class pn extends g.Cartographic{}class Pi extends g.BoundingSphere{}class Ii extends g.Ellipsoid{}class Ai extends g.GeographicTilingScheme{}class fn extends g.Rectangle{}class Di extends g.Resource{}class Oi extends g.EllipsoidTerrainProvider{}class ki extends g.CesiumTerrainProvider{}class xi extends g.PolylineGraphics{}class Ni extends g.JulianDate{}class Bi extends g.PositionProperty{}class Fi extends g.BillboardGraphics{}class Gi extends g.Color{}class Vi extends g.PolygonHierarchy{}class Hi extends g.Scene{}const Wi=g.VerticalOrigin,zi=g.HorizontalOrigin,tt=g.SceneMode,Ui=g.LabelStyle,$i=g.HeightReference,_e=document.createElement("canvas"),Te=_e.getContext("2d"),mn=e=>{const r=(e==null?void 0:e.data)??[];for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1},qi=async(e,t)=>(t&&t.tileTransparencyCheckedCounter++,new Promise((n,r)=>{try{Te==null||Te.clearRect(0,0,_e.width,_e.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){_e.width=e.width,_e.height=e.height,Te==null||Te.drawImage(e,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height),d=mn(o);d&&t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(d);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{_e.width=s.width,_e.height=s.height,Te==null||Te.drawImage(s,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height);mn(o)?(t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(!0)):n(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,t)=>{const{west:n,east:r,north:s,south:o}=e,{west:d,east:h,north:f,south:E}=t;return n>=d&&r<=h&&s<=f&&o>=E},ji=(e,t)=>hr(e,je(t)),Yi=e=>{const t=(g.Math.toDegrees(e.west)+g.Math.toDegrees(e.east))/2,n=(g.Math.toDegrees(e.south)+g.Math.toDegrees(e.north))/2;return xt.point([t,n])},yn=e=>[g.Math.toDegrees(e.west),g.Math.toDegrees(e.south),g.Math.toDegrees(e.east),g.Math.toDegrees(e.north)],vn=e=>{const t=e.scene;let r=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!g.defined(r)||!r){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const s=new g.Cartesian2(0,0),o=t.camera.pickEllipsoid(s,t.globe.ellipsoid),d=new g.Cartesian2(t.canvas.width,t.canvas.height),h=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(o),E=t.globe.ellipsoid.cartesianToCartographic(h);r=new g.Rectangle(f.longitude,E.latitude,E.longitude,f.latitude)}return r},Zi=(e,t=100)=>{const n=e.scene,r=e.camera,s=n.mode,o=vn(e);if(!g.defined(o)||!o){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(s===g.SceneMode.SCENE2D)return o;const d=r.positionCartographic;if(!g.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const h=d.latitude,f=d.longitude;if(h<-g.Math.PI_OVER_TWO||h>g.Math.PI_OVER_TWO||f<-g.Math.PI||f>g.Math.PI){console.error("Invalid latitude or longitude values.");return}const E=111320,C=111320*Math.cos(h);let b=t/E,p=t/C;const v=g.Cartesian3.magnitude(r.positionWC);v>1e7&&(b=10,p=10);const I=r.frustum instanceof g.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let T=1;v<5e5?T=.05:v<2e6&&(T=.1),b*=T*(I/Math.PI),p*=T*(I/Math.PI);const F=r.pitch;if(F===void 0)return;const V=Math.PI/4,j=Math.max(0,1-Math.abs(F)/V);b*=j,p*=j;const Y=5e-4;b=Math.max(b,Y),p=Math.max(p,Y);const G=d.latitude-b,X=d.latitude+b,W=d.longitude-p,Z=d.longitude+p,ee=g.Math.clamp(G,o.south,o.north),l=g.Math.clamp(X,o.south,o.north),c=g.Math.clamp(W,o.west,o.east),_=g.Math.clamp(Z,o.west,o.east),y=Math.min(1,F/g.Math.PI_OVER_TWO),S=o.north-(o.north-o.south)*y,w=Math.min(l,S);return new g.Rectangle(g.Math.negativePiToPi(c),g.Math.clamp(ee,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO),g.Math.negativePiToPi(_),g.Math.clamp(w,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO))},En=(e,t,n,r,s,o)=>{const d=e.scene.mode===g.SceneMode.SCENE2D,h=p=>{var v;if(p.polygon)return{type:"Polygon",coordinates:[((v=p.polygon.hierarchy)==null?void 0:v.getValue(g.JulianDate.now())).positions.map(F=>{const V=g.Cartographic.fromCartesian(F),j=new g.Cartographic(g.Math.toDegrees(V.longitude),g.Math.toDegrees(V.latitude),d?500:void 0);return[j.longitude,j.latitude,j.height]})]}},f=(p,v,I,T)=>{const F=g.SceneTransforms.wgs84ToWindowCoordinates(p,v);if(!F)return null;const V=F.x+I,j=F.y+T,Y=new g.Cartesian2(V,F.y),G=new g.Cartesian2(F.x,j),X=p.camera.pickEllipsoid(Y,p.globe.ellipsoid),W=p.camera.pickEllipsoid(G,p.globe.ellipsoid);if(!X||!W)return null;const Z=g.Cartesian3.distance(v,X),ee=g.Cartesian3.distance(v,W);return{widthMeters:Z,heightMeters:ee}},E=(p,v,I)=>{const T=g.Ellipsoid.WGS84,F=p.latitude,V=p.longitude,j=Math.PI/180*T.maximumRadius,Y=Math.PI/180*T.maximumRadius,G=I/2/j,X=v/2/Y,W=F+G,Z=F-G,ee=V+X,l=V-X;return{type:"Polygon",coordinates:[[[l,W],[ee,W],[ee,Z],[l,Z],[l,W]]]}},C=(p,v)=>kt(p)/kt(v);if(!e.dataSources.getByName(t.name)[0])return;const b=[];if(t==null||t.entities.values.forEach(p=>{var v,I;if(s&&o&&d)try{const T=je(s),F=Nt(h(p),T);if(F){const V=(v=p.properties)==null?void 0:v.label.getValue(g.JulianDate.now()),j=ur(F,{properties:{label:V}}),Y={width:V.width,height:V.height},[G,X,W=0]=j.geometry.coordinates,Z=g.Cartesian3.fromDegrees(G,X,W),ee=f(e.scene,Z,Y.width,Y.height);if(ee){const l=E({longitude:G,latitude:X},ee.widthMeters,ee.heightMeters),c=Nt(F,{type:"Feature",properties:{},geometry:l});C(c==null?void 0:c.geometry,l)>.7&&b.push(j)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",p,"extent -->",s)}if(!(n.length>0&&!n.some(T=>p.id.startsWith(T)))&&(p.polygon&&(p.polygon=new g.PolygonGraphics({hierarchy:p.polygon.hierarchy,material:d?g.Color.fromCssColorString(r).withAlpha(.2):g.Color.fromCssColorString(r).withAlpha(.5),outline:!0,outlineColor:g.Color.fromCssColorString(r),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),p.polyline&&(p.polyline=new g.PolylineGraphics({positions:p.polyline.positions,material:g.Color.fromCssColorString(r).withAlpha(.5),clampToGround:!0,width:4})),p.billboard)){const T=(I=p.position)==null?void 0:I.getValue(g.JulianDate.now()),F=g.Cartographic.fromCartesian(T),V=new g.Cartographic(F.longitude,F.latitude,d?500:e.scene.sampleHeight(g.Cartographic.fromCartesian(T))),j=g.Cartesian3.fromRadians(V.longitude,V.latitude,V.height),Y="#FFFF00";p.position=j,p.billboard=new g.BillboardGraphics({image:"data:image/svg+xml;base64,"+btoa(`
1
+ (function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@date-io/date-fns"),require("@material-ui/pickers"),require("@material-ui/core"),require("@material-ui/core/styles"),require("@map-colonies/react-core"),require("@material-ui/core/useMediaQuery"),require("react-datepicker"),require("date-fns/locale/he"),require("moment"),require("@turf/rewind"),require("ol"),require("ol/ol.css"),require("ol/coordinate"),require("ol/control"),require("ol/control/MousePosition"),require("ol/proj"),require("ol/layer"),require("ol/source"),require("ol/format"),require("ol/interaction"),require("ol/interaction/Draw"),require("ol/layer/VectorTile"),require("ol/style"),require("ol/tilegrid/WMTS"),require("ol/extent"),require("ol/source/TileWMS"),require("ol/source/XYZ"),require("ol/source/VectorTile"),require("ol-ext/legend/Legend"),require("ol-ext/control/Legend"),require("ol-ext/dist/ol-ext.css"),require("@material-ui/core/TableHead"),require("@material-ui/core/utils"),require("@material-ui/core/CssBaseline"),require("@material-ui/core/ScopedCssBaseline"),require("react-dom"),require("resium"),require("cesium"),require("lodash"),require("@turf/bbox"),require("@turf/invariant"),require("@turf/area"),require("@turf/bbox-polygon"),require("@turf/centroid"),require("@turf/helpers"),require("@turf/intersect"),require("@turf/point-to-polygon-distance"),require("@map-colonies/react-core/dist/list/styles"),require("@map-colonies/react-core/dist/textfield/styles"),require("@turf/boolean-point-in-polygon"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("@map-colonies/react-core/dist/checkbox/styles"),require("p-map"),require("uuid"),require("@turf/boolean-valid"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select"),require("react-circular-progressbar"),require("react-circular-progressbar/dist/styles.css"),require("react-move")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@date-io/date-fns","@material-ui/pickers","@material-ui/core","@material-ui/core/styles","@map-colonies/react-core","@material-ui/core/useMediaQuery","react-datepicker","date-fns/locale/he","moment","@turf/rewind","ol","ol/ol.css","ol/coordinate","ol/control","ol/control/MousePosition","ol/proj","ol/layer","ol/source","ol/format","ol/interaction","ol/interaction/Draw","ol/layer/VectorTile","ol/style","ol/tilegrid/WMTS","ol/extent","ol/source/TileWMS","ol/source/XYZ","ol/source/VectorTile","ol-ext/legend/Legend","ol-ext/control/Legend","ol-ext/dist/ol-ext.css","@material-ui/core/TableHead","@material-ui/core/utils","@material-ui/core/CssBaseline","@material-ui/core/ScopedCssBaseline","react-dom","resium","cesium","lodash","@turf/bbox","@turf/invariant","@turf/area","@turf/bbox-polygon","@turf/centroid","@turf/helpers","@turf/intersect","@turf/point-to-polygon-distance","@map-colonies/react-core/dist/list/styles","@map-colonies/react-core/dist/textfield/styles","@turf/boolean-point-in-polygon","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","@map-colonies/react-core/dist/checkbox/styles","p-map","uuid","@turf/boolean-valid","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select","react-circular-progressbar","react-circular-progressbar/dist/styles.css","react-move"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.reactComponents={},u.jsxRuntime,u.React,u.dateFns,u.locale,u.DateFnsUtils,u.pickers,u.core,u.styles,u.reactCore,u.useMediaQuery,u.DatePicker,u.datePickerHebrewLocale,u.moment,u.rewind,u.ol,null,u.coordinate,u.control,u.MousePosition,u.proj,u.layer,u.source,u.format,u.interaction,u.Draw,u.VectorTile,u.style,u.WMTSTileGrid,u.extent,u.OlTileWMS,u.OlXYZ,u.VectorTileSource,u.OlExtLegend,u.OlExtLegendCtrl,null,u.TableHead,u.utils,u.CssBaseline,u.ScopedCssBaseline,u.ReactDOM,u.resium,u.Cesium,u.lodash,u.bbox,u.invariant,u.area,u.bboxPolygon,u.centroid,u.turf,u.intersect,u.pointToPolygonDistance,null,null,u.booleanPointInPolygon,u.viewerCesiumNavigationMixin,null,null,null,u.pMap,u.uuid,u.booleanValid,u.getCaretCoordinates,u.getInputSelection,u.chonky,u.chonkyIconFontawesome,u.filesize,u.Select,u.reactCircularProgressbar,null,u.reactMove))})(this,function(u,i,a,Le,Ue,bt,Ne,ae,Oe,J,Jn,Ct,Kn,Be,Qn,Mt,ss,_t,at,lt,Pt,It,ct,dt,Rn,er,tr,$e,nr,At,rr,ir,or,Dt,sr,as,ar,Ot,lr,cr,ut,Me,g,$,qe,dr,kt,je,ur,xt,Nt,hr,ls,cs,gr,pr,ds,us,hs,ht,Bt,fr,mr,Ft,re,yr,vr,Gt,Ye,gs,Er){"use strict";var is=Object.defineProperty;var os=(u,i,a)=>i in u?is(u,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[i]=a;var ue=(u,i,a)=>(os(u,typeof i!="symbol"?i+"":i,a),a);function gt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Vt=gt(a),M=gt(g),Ht=gt(xt),Q=e=>{const{children:t,...n}=e;return i.jsx(ae.Box,{...n,children:t})};var we=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(we||{}),Se=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(Se||{}),Ze=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Ze||{});const he={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:Se.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:Se.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Xe=e=>{const t=e.type==="dark";return a.useMemo(()=>Wt(e,t),[t,e])},Wt=(e,t=!1)=>Oe.createTheme({palette:{type:t?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:t?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:t?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zt=e=>a.useMemo(()=>({...e,"cesium-color":"#EDFFFF","cesium-error":e["--mdc-theme-gc-error-medium"]??"#FF3636","cesium-warning":e["--mdc-theme-gc-warning-high"]??"#FFA032","cesium-checkbox-color":"#1A73E8","cesium-checkbox-width":"12px","cesium-checkbox-height":"12px","cesium-font-size":"10pt"}),[e]),ps="",wr=2,Tr=.5,Lr=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(wr),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Tr)}})),Ut=e=>{var X,W,Z,ee;const t=Lr(),n=J.useTheme(),r=Xe(n),[s,o]=a.useState(null),[d,h]=a.useState(null),[f,E]=a.useState(he.DATE_RANGE_PICKER.dateFormat),C=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,b=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,p=((X=e.local)==null?void 0:X.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,v=((W=e.local)==null?void 0:W.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,I=((Z=e.local)==null?void 0:Z.setText)??he.DATE_RANGE_PICKER.local.setText,T=((ee=e.local)==null?void 0:ee.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,F=e.showTime??he.DATE_RANGE_PICKER.showTime,V=T===Se.HE?Ue.he:Ue.enUS;a.useEffect(()=>{o(e.from??null)},[e.from]),a.useEffect(()=>{h(e.to??null)},[e.to]),a.useEffect(()=>{E(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const j=Boolean(Le.isValid(s)&&!d||Le.isValid(d)&&!s||s&&d&&Le.isValid(s)&&Le.isValid(d)&&Le.isBefore(s,d)),Y=()=>{e.onChange({from:s&&Le.isValid(s)?s:void 0,to:d&&Le.isValid(d)?d:void 0})},G=F?Ne.KeyboardDateTimePicker:Ne.KeyboardDatePicker;return i.jsx(ae.ThemeProvider,{theme:r,children:i.jsx(Q,{className:`${t.container} drpContainer`,display:"flex",flexDirection:C,width:C==="column"?e.contentWidth:"unset",children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:V,children:[i.jsx(G,{variant:"inline",placeholder:p,onChange:l=>o(l),value:s,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(G,{variant:"inline",placeholder:v,className:t.margin,onChange:l=>h(l),value:d,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(J.ThemeProvider,{options:n,children:i.jsx(J.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:Y,disabled:!j,children:I})})]})})})},$t=e=>{const{children:t,...n}=e;return i.jsx(ae.Popover,{...n,children:t})},fs="",Sr=e=>{var G,X;const[t,n]=a.useState(null),[r,s]=a.useState(null),[o,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[h,f]=a.useState(null),E=W=>{f(W.currentTarget)},C=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},b=()=>{f(null)},p=Boolean(h),v=e.controlsLayout??"column";a.useEffect(()=>{n(e.from??null)},[e.from]),a.useEffect(()=>{s(e.to??null)},[e.to]),a.useEffect(()=>{d(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const I=((G=e.local)==null?void 0:G.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,T=((X=e.local)==null?void 0:X.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,F=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,V=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,j=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,Y=a.useMemo(()=>`${t?Le.format(t,o):I} - ${r?Le.format(r,o):T}`,[t,r,o,I,T]);return i.jsxs(i.Fragment,{children:[F?i.jsx(J.Button,{style:{width:e.width},raised:!0,onClick:E,className:"drpOpener",children:Y}):i.jsx(J.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:Y,onClick:C,trailingIcon:{icon:"date_range",tabIndex:0,onClick:C}}),i.jsx($t,{open:p,anchorEl:h,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(Ut,{controlsLayout:v,contentWidth:((h==null?void 0:h.clientWidth)??0)-V,dateFormat:o,disableFuture:j,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{n(W??null),s(Z??null),e.onChange({from:W,to:Z}),b()}})})]})},Je=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,br=({endDate:e,startDate:t,setEndDate:n=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:o="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:h="",startTimeInputClassName:f="",startTimeLabel:E="",startTimeWrapperClassName:C=""})=>i.jsxs("div",{className:`timeRangeWrapper ${h}`,children:[i.jsx("div",{className:`startTimeWrapper ${C}`,children:i.jsx(J.TextField,{label:E,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Be(t).format("HH:mm"),onChange:b=>{const p=Be(t),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});r(I.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(J.TextField,{label:o,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Be(e).format("HH:mm"),onChange:b=>{const p=Be(e),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});n(I.toDate())}})})]}),Cr=a.forwardRef(({value:e,onClick:t,onInputClick:n,...r},s)=>i.jsx(J.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:o=>{t==null||t(o),n==null||n()},ref:s,value:e})),Mr=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:n,dateRange:r,onShortcut:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>n.map(f=>f instanceof Function?f():f),[n]);return a.useEffect(()=>{for(const f of h){const E=r.startDate&&r.endDate&&Le.isSameDay(f.startDate,r.startDate)&&Le.isSameDay(f.endDate,r.endDate);o?f.id===o&&(E||d(void 0)):E&&d(f.id)}},[r,o,h]),i.jsx("div",{className:"shortcutsContainer",children:h.map((f,E)=>{const C=()=>{e(f.startDate),t(f.endDate)};return i.jsx(J.Button,{type:"button",className:`shortcut ${o===f.id?"selected":""}`,onClick:b=>{C(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+E)})})},_r=a.forwardRef((e,t)=>{const{calendarClassName:n,dayClassName:r,monthClassName:s,selectsRange:o,onChange:d,inputName:h,showMonthYearDropdown:f,withShortcuts:E,locale:C="en"}=e,[b,p]=a.useState(null),[v,I]=a.useState(null),[T,F]=a.useState(!1),V=o?{startDate:b,endDate:v}:b;a.useEffect(()=>{C==="he"&&Ct.registerLocale("he",Kn)},[C]),a.useEffect(()=>{var G,X;((G=e.startDate)==null?void 0:G.toString())!==(b==null?void 0:b.toString())&&p(e.startDate),((X=e.endDate)==null?void 0:X.toString())!==(v==null?void 0:v.toString())&&I(e.endDate)},[e.startDate,e.endDate,b,v]);const j=a.useMemo(()=>{let G="pickerContainer"+(C==="he"?" pickerContainer-rtl":"");return E&&o&&(G+=" pickerContainer-withShortcuts"),G},[C,E,o]),Y=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:j,style:{direction:C==="he"?"rtl":"ltr"},children:i.jsx(Ct,{...e,ref:t,onClickOutside:()=>F(!1),open:T,startDate:Je(V)?b:void 0,selected:b,endDate:Je(V)?v:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${n}`,weekDayClassName:G=>`pickerWeek ${(r==null?void 0:r(G))??""}`,dayClassName:G=>`pickerDay ${(r==null?void 0:r(G))??""}`,monthClassName:G=>`pickerMonth ${(s==null?void 0:s(G))??""}`,onChange:(G,X)=>{if(Array.isArray(G)){const[W,Z]=G;p(W),I(Z),d==null||d({startDate:W,endDate:Z&&Le.endOfDay(Z)},X)}else p(G),d==null||d(G,X)},customInput:i.jsx(Cr,{name:h,onInputClick:()=>{F(!0)}}),showTimeInput:!!(E&&o),timeInputLabel:"",customTimeInput:E&&Je(V)&&i.jsx(Mr,{onShortcut:G=>{d==null||d(G),F(!1)},shortcuts:E,setEndDate:I,setStartDate:p,dateRange:V}),showMonthYearDropdown:void 0,...Y})})}),ms="",Pr=e=>{const t=J.useTheme(),n=Xe(t),{format:r=he.DATE_PICKER.dateFormat,variant:s=he.DATE_PICKER.variant,disableFuture:o=he.DATE_PICKER.disableFuture,local:d,onChange:h,showTime:f=he.DATE_PICKER.showTime,value:E,...C}=e,{placeHolderText:b=he.DATE_PICKER.local.placeHolderText,calendarLocale:p}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:Se.EN},v=p===Se.HE?Ue.he:Ue.enUS,I=T=>{h(T)};return i.jsx(ae.ThemeProvider,{theme:n,children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:v,children:[f&&i.jsx(Ne.KeyboardDateTimePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C}),!f&&i.jsx(Ne.KeyboardDatePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C})]})})},Ir=18,Ar=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(Ir)},fullWidth:{width:"100%",marginTop:"36px"}})),Dr=e=>{const t=Ar(),[n,r]=a.useState(null),{isSelectionEnabled:s,onCancelDraw:o,onStartDraw:d,onReset:h}=e,f=C=>{r(C.currentTarget)},E=()=>{r(null)};return s?i.jsx(J.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:o,children:"Cancel Draw"})}):i.jsxs(Q,{position:"relative",children:[i.jsx(J.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(J.Menu,{className:t.fullWidth,open:Boolean(n),onClose:E,children:[i.jsx(J.MenuItem,{onClick:()=>{d(we.POLYGON),E()},children:"Polygon"}),i.jsx(J.MenuItem,{onClick:()=>{d(we.BOX),E()},children:"Box"}),i.jsx(J.MenuItem,{onClick:()=>{h(),E()},children:"Clear"})]})]})},ys="";var be=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(be||{});const Ke=5,Qe=2,qt=a.createContext(null),Or=qt.Provider,jt=35,Yt=32,kr=10,xr=e=>e!==void 0&&e!==be.WGS84?Pt.transform([jt,Yt],be.WGS84,e):[jt,Yt],Nr=e=>{switch(e){case be.WEB_MERCATOR:return t=>_t.format(t,"Mercator: {y}m, {x}m",Qe);case be.WGS84:return t=>_t.format(t,"WGS84: {y}°N {x}°E",Ke);default:return t=>""}},ke=()=>{const e=a.useContext(qt);if(e===null)throw new Error("map context is null, please check the provider");return e},Zt=e=>{const t=a.useRef(null),{allowFullScreen:n,showMousePosition:r,projection:s}=e,[o]=a.useState(new Mt.Map({view:new Mt.View({projection:s??be.WGS84}),controls:at.defaults()}));a.useEffect(()=>{o.getView().setCenter(e.center??xr(e.projection))},[o,e.center,e.projection]),a.useEffect(()=>{o.getView().setZoom(e.zoom??kr)},[o,e.zoom,e.projection]);const d=(h,f)=>{f.getControls().forEach(C=>{C instanceof h&&f.removeControl(C)})};return a.useEffect(()=>{o.setTarget(t.current),n!==void 0&&n?o.addControl(new at.FullScreen):d(at.FullScreen,o)},[o,n]),a.useEffect(()=>{r!==void 0&&r?(d(lt,o),o.addControl(new lt({coordinateFormat:Nr(s??be.WGS84),projection:s??be.WGS84,undefinedHTML:"&nbsp;"}))):d(lt,o)},[o,r,s]),i.jsxs(Or,{value:o,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Xt=a.createContext(null),Br=Xt.Provider,Ve=()=>{const e=a.useContext(Xt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Jt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Tile(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Br,{value:r,children:t})},Kt=a.createContext(null),Fr=Kt.Provider,Qt=()=>{const e=a.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Rt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Vector(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Fr,{value:r,children:t})},en=a.createContext(null),Gr=en.Provider,tn=()=>{const e=a.useContext(en);if(e===null)throw new Error("vector source context is null, please check the provider");return e},nn=({children:e})=>{const t=Qt(),[n]=a.useState(new ct.Vector);return a.useEffect(()=>{t.setSource(n)},[n,t]),i.jsx(Gr,{value:n,children:e})},rn=({geometry:e,fitOptions:t,fit:n,featureStyle:r})=>{const s=tn(),o=ke();return a.useLayoutEffect(()=>{const h=new dt.GeoJSON().readFeature(e);return n&&s.on("addfeature",function(){o.getView().fit(s.getExtent(),t)}),r&&h.setStyle(r),s.addFeature(h),()=>{s.removeFeature(h)}},[e,s,n]),null},on=e=>{const t=Ve();return a.useEffect(()=>{t.setSource(new ct.OSM)},[t]),null},sn=({drawType:e,onPolygonSelected:t})=>{const n=ke();return a.useEffect(()=>{const r={type:"Circle"};switch(e){case we.BOX:r.geometryFunction=er.createBox();break;case we.POLYGON:r.type="Polygon";break;default:return}const s=new Rn.Draw(r);n.addInteraction(s);const o=d=>{const f=new dt.GeoJSON().writeGeometryObject(d.feature.getGeometry());t==null||t(f)};return s.on("drawend",o),()=>{s.un("drawend",o),n.removeInteraction(s)}},[t,e,n]),null},vs="",Vr=e=>{const t=n=>{const r=Qn(n);e.onPolygonSelection(r)};return i.jsxs(Zt,{allowFullScreen:!0,showMousePosition:!0,children:[i.jsx(Jt,{children:i.jsx(on,{})}),e.selectionPolygon&&i.jsx(Rt,{children:i.jsx(nn,{children:i.jsx(rn,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&i.jsx(sn,{drawType:e.drawType,onPolygonSelected:t})]})},pt=1.5,Hr=80,Wr=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(pt),top:e.spacing(pt)},contentContainer:{marginTop:e.spacing(pt),width:e.spacing(Hr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),zr=e=>{var f;const[t,n]=a.useState(),[r,s]=a.useState(),o=Wr(),d=E=>{s(E),n(void 0),e.handlePolygonSelected(E)},h=()=>{s(void 0),e.handlePolygonReset()};return i.jsxs("div",{className:o.map,children:[i.jsxs("div",{className:`${o.absolute}`,children:[i.jsxs(ae.Paper,{className:o.filtersContainer,children:[i.jsx(Dr,{onCancelDraw:()=>n(void 0),onReset:h,onStartDraw:n,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((E,C)=>i.jsx("div",{className:o.filtersMargin,children:E},C))]}),i.jsx(ae.Paper,{color:"red",className:`${o.contentContainer}`,children:e.children})]}),i.jsx(Vr,{children:e.mapContent,onPolygonSelection:d,drawType:t,selectionPolygon:r})]})},an=new $e.Fill({color:"rgba(255,255,255,0.4)"}),ln=new $e.Stroke({color:"#3399CC",width:1.25}),cn=[new $e.Style({image:new $e.Circle({fill:an,stroke:ln,radius:5}),fill:an,stroke:ln})],dn=a.createContext(null),Ur=dn.Provider,un=()=>{const e=a.useContext(dn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},$r=({children:e,options:t,style:n})=>{const r=ke(),[s]=a.useState(new tr({...t,style:n||cn}));return a.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),a.useEffect(()=>{s.setStyle(n||cn)},[s,n]),i.jsx(Ur,{value:s,children:e})},ft=20,qr=256,jr=2,Yr=2,Zr="REST",Xr=e=>{const t=Pt.get(e.projection),n=t.getExtent(),r=new Array(ft),s=new Array(ft),o=At.getWidth(n)/qr,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Yr,h=e.requestEncoding!==void 0?e.requestEncoding:Zr;for(let E=0;E<ft;++E)r[E]=o/Math.pow(jr,E)/d,s[E]=E.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new nr({origin:At.getTopLeft(n),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:h,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Jr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ct.WMTS(n))},[t,n]),null},Kr=e=>{const{attributions:t,url:n,params:r,serverType:s,transition:o}=e;return{attributions:t,url:n,params:r,serverType:s,transition:o}},Qr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new rr(n))},[t,n]),null},Rr=e=>{const{attributions:t,url:n}=e;return{attributions:t,url:n}},ei=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ir(n))},[t,n]),null},ti=a.createContext(null),ni=()=>{const e=a.useContext(ti);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},ri=e=>{const{url:t}=e;return{url:t,format:new dt.MVT}},ii=({children:e,options:t})=>{const n=un();return a.useEffect(()=>{n.setSource(new or(t))},[t,n]),null},oi=({legendItems:e,title:t,isCollapsed:n})=>{const r=ke();return a.useEffect(()=>{const s=new Dt({title:t??"",margin:5,maxWidth:300}),o=new sr({legend:s,collapsed:n===void 0?!0:n});r.addControl(o);const d=new Dt({margin:4});return e.forEach(h=>{d.addItem({title:h.title,style:h.style,typeGeom:"Polygon"})}),s.addItem(d),()=>{r.removeControl(o)}},[r,e,t,n]),i.jsx(i.Fragment,{})};function si(e){const{headCells:t,order:n,orderBy:r,onRequestSort:s,isCollapseable:o}=e,d=h=>f=>{s(f,h)};return i.jsx(ar,{children:i.jsxs(ae.TableRow,{children:[o&&i.jsx(ae.TableCell,{}),t.map(h=>i.jsx(ae.TableCell,{align:h.numeric?"right":"left",padding:h.disablePadding?"none":"default",sortDirection:r===h.id?n:!1,children:i.jsx(ae.TableSortLabel,{active:r===h.id,direction:r===h.id?n:"asc",onClick:d(h.id),children:h.label})},h.id))]})})}const ai=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),li=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function ci(e){const{cellsMetadata:t,isRowSelected:n,item:r,onRowSelected:s,rowIndex:o,isCollapseable:d,collapsedElement:h}=e,[f,E]=a.useState(!1),C=t.length,b=()=>{s==null||s(o)};return i.jsxs(i.Fragment,{children:[i.jsxs(ae.TableRow,{hover:!0,selected:n,onClick:b,children:[d&&i.jsx(ae.TableCell,{padding:"checkbox",children:i.jsx(ae.IconButton,{"aria-label":"expand row",size:"small",onClick:p=>{p.stopPropagation(),E(!f)},children:f?i.jsx(li,{}):i.jsx(ai,{})})}),t.map(p=>i.jsx(ae.TableCell,{align:p.numeric?"right":"left",padding:p.disablePadding?"none":"default",children:p.transform?p.transform(r[p.id]):r[p.id]},p.id+o.toString()))]}),d&&i.jsx(ae.TableRow,{children:i.jsx(ae.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:C+1,children:i.jsx(ae.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:h==null?void 0:h(r)})})})]})}function di(e){const[t,n]=a.useState(""),[r,s]=a.useState("asc"),{cellsMetadata:o,items:d,onRequestSort:h,onRowSelected:f,isCollapseable:E,collapsedElement:C,isDense:b,page:p,rowsPerPage:v,count:I,handleChangePage:T,handleChangeRowsPerPage:F}=e,V=(j,Y)=>{const G=t===Y&&r==="asc";s(G?"desc":"asc"),n(Y),h(Y,G?"desc":"asc")};return i.jsxs(ae.TableContainer,{component:ae.Paper,children:[i.jsxs(ae.Table,{size:b?"small":"medium",children:[i.jsx(si,{headCells:o,onRequestSort:V,order:r,orderBy:t,isCollapseable:E}),i.jsxs(ae.TableBody,{children:[d.map((j,Y)=>i.jsx(ci,{item:j,rowIndex:Y,isCollapseable:E,cellsMetadata:o,collapsedElement:C,isRowSelected:!1,onRowSelected:f},Y)),(d.length===0||v>d.length)&&i.jsx(ae.TableRow,{style:{height:(b?33:53)*(v-d.length)},children:i.jsx(ae.TableCell,{colSpan:E?o.length+1:o.length,children:d.length===0&&i.jsx(ae.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(ae.TablePagination,{rowsPerPage:v,rowsPerPageOptions:[5,10],component:"div",count:I,page:p,onPageChange:T,onRowsPerPageChange:F})]})}const ui=e=>{const{children:t,...n}=e;return i.jsx(lr,{...n,children:t})},hi=e=>{const{children:t,...n}=e;return i.jsx(cr,{...n,children:t})},hn=e=>e*Math.PI/180,Re=e=>e*(180/Math.PI),gi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hn(85.362/2))/Math.sin(hn(85.362/2))),pi=({title:e,onClick:t})=>i.jsx("div",{className:"cesium-cesiumInspector-button",onClick:t,children:e}),fi=({title:e,isVisible:t,onClick:n,children:r})=>i.jsxs(Q,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(pi,{title:e,onClick:n}),t&&i.jsx(Q,{className:"cesium-cesiumInspector-dropDown",children:r})]}),Es="",mt="Imagery",yt="Data",mi=({locale:e})=>{var b,p;const t=pe(),[n,r]=a.useState([{id:mt,values:[]},{id:yt,values:[]}]),[s,o]=a.useState({}),d=v=>$.get(e,v.toUpperCase())??v,h=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(v,I)=>{var V;const T=t.imageryLayers.get(I),F=T.meta;return{id:F==null?void 0:F.id,name:$.get(F,"layerRecord.productName")??(F==null?void 0:F.id),rect:T.rectangle,isBaseMap:(V=t.layersManager)==null?void 0:V.isBaseMapLayer(F)}}):[],f=()=>{var v;return((v=t.layersManager)==null?void 0:v.dataLayerList.map(I=>{var T,F;return{id:(T=I.meta)==null?void 0:T.id,name:$.get(I.meta,"featureStructure.aliasLayerName")??I.meta.productName,rect:g.Rectangle.fromDegrees(...qe((F=I.meta)==null?void 0:F.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const I=[{id:mt,values:h()},{id:yt,values:f()}];r(I),o(I.reduce((T,F)=>({...T,[F.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===mt?{...T,values:h()}:T))};return t.layersManager.addLayerUpdatedListener(v),t.imageryLayers.layerRemoved.addEventListener(v),()=>{var I;$.get(t,"_cesiumWidget")!==void 0&&((I=t.layersManager)==null||I.removeLayerUpdatedListener(v),t.imageryLayers.layerRemoved.removeEventListener(v))}},[(b=t.layersManager)==null?void 0:b.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===yt?{...T,values:f()}:T))};return t.layersManager.addDataLayerUpdatedListener(v),()=>{var I;(I=t.layersManager)==null||I.removeDataLayerUpdatedListener(v)}},[(p=t.layersManager)==null?void 0:p.dataLayerList]);const E=v=>{o(I=>({...I,[v]:!I[v]}))},C=v=>{t.camera.flyTo({destination:v})};return i.jsx(Q,{className:"activeLayersPanel",children:n.filter(v=>v.values.length>0).map(v=>i.jsxs(Q,{className:`cesium-cesiumInspector-section ${s[v.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>E(v.id),children:[i.jsx(J.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(v.id)}),i.jsx(Q,{className:"cesium-cesiumInspector-sectionContent",children:v.values.map(I=>i.jsxs(Q,{className:"layer",children:[i.jsx(J.Tooltip,{content:I.name,children:i.jsx(Q,{className:`name ${I.isBaseMap?"disabled":""}`,children:I.name})}),i.jsx(Q,{className:"icons",children:i.jsx(J.Tooltip,{content:$.get(e,"FLY_TO")??"Fly To",children:i.jsx(Q,{className:"icon",onClick:T=>{T.stopPropagation(),C(I.rect)},children:i.jsxs("svg",{fill:"var(--mdc-theme-cesium-color)",width:"100%",height:"100%",viewBox:"0 0 256 256",children:[i.jsx("path",{d:"M236,120H223.66406A96.15352,96.15352,0,0,0,136,32.33618V20a8,8,0,0,0-16,0V32.33618A96.15352,96.15352,0,0,0,32.33594,120H20a8,8,0,0,0,0,16H32.33594A96.15352,96.15352,0,0,0,120,223.66382V236a8,8,0,0,0,16,0V223.66382A96.15352,96.15352,0,0,0,223.66406,136H236a8,8,0,0,0,0-16Zm-40,16h11.59912A80.14164,80.14164,0,0,1,136,207.59912V196a8,8,0,0,0-16,0v11.59912A80.14164,80.14164,0,0,1,48.40088,136H60a8,8,0,0,0,0-16H48.40088A80.14164,80.14164,0,0,1,120,48.40088V60a8,8,0,0,0,16,0V48.40088A80.14164,80.14164,0,0,1,207.59912,120H196a8,8,0,0,0,0,16Z"}),i.jsx("polygon",{points:"128,80 80,170 128,150 176,170",fill:"var(--mdc-theme-cesium-color)"})]})})})})]},I.id))})]},v.id))})},yi=({locale:e})=>{const[t,n]=a.useState(!1),r=a.useMemo(()=>$.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(fi,{title:r,isVisible:t,onClick:()=>n(!t),children:i.jsx(mi,{locale:e})})},et=({onClick:e,children:t})=>i.jsx("div",{className:"cesium-toolbar-button cesium-button",onClick:e,children:t}),vt=({title:e})=>i.jsx(Q,{className:"cesium-mc-title",children:e}),Et=({isVisible:e,children:t,title:n})=>i.jsxs(Q,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[n&&i.jsx(vt,{title:n}),t]}),ws="";function wt(e){return function(n){const r=a.useRef(null),[s,o]=a.useState(!1);return a.useEffect(()=>{if(!s)return;const d=h=>{const f=h.target;r.current&&!r.current.contains(f)&&o(!1)};return document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}},[s]),i.jsx("div",{ref:r,className:"disappear",children:i.jsx(e,{...n,isOpen:s,setIsOpen:o})})}}const gn=({item:e,isSelected:t,onClick:n})=>i.jsxs(Q,{className:`cesium-baseLayerPicker-item ${t?"cesium-baseLayerPicker-selectedItem":""}`,title:e.title,onClick:n,children:[i.jsx("img",{className:"cesium-baseLayerPicker-itemIcon",src:e.thumbnail,alt:e.title}),i.jsx(Q,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),vi=({title:e,baseMaps:t,setCurrent:n})=>{const r=pe(),[s,o]=a.useState();a.useEffect(()=>{const h=t.maps.find(f=>f.isCurrent);h&&(o(h),n(h))},[t]);const d=h=>{var E,C;(E=r.layersManager)==null||E.removeBaseMapLayers();const f=t.maps.find(b=>b.id===h);f&&((C=r.layersManager)==null||C.setBaseMapLayers(f),o(f),n(f),t.maps.forEach(b=>{b.isCurrent=f===b}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.maps.map(h=>i.jsx(gn,{item:h,isSelected:s===h,onClick:()=>d(h.id)},h.id))})]})},Ei=({title:e,terrains:t})=>{const[n,r]=a.useState(),s=pe();a.useEffect(()=>{const d=t.find(h=>h.isCurrent);d&&r(d)},[t]);const o=d=>{const h=t.find(f=>f.id===d);h&&(s.terrainProvider=h.terrainProvider??new g.EllipsoidTerrainProvider({}),r(h),t.forEach(f=>{f.isCurrent=h===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(gn,{item:d,isSelected:n===d,onClick:()=>o(d.id)},d.id))})]})},wi=wt(({baseMaps:e,terrains:t,locale:n,isOpen:r,setIsOpen:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>$.get(n,"BASE_MAP_TITLE")??"Base Map",[n]),f=a.useMemo(()=>$.get(n,"TERRAIN_TITLE")??"Terrain",[n]);return i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>s(!r),children:i.jsx("img",{className:"cesium-baseLayerPicker-selected",src:o==null?void 0:o.thumbnail,title:o==null?void 0:o.title,alt:"Current Map"})}),i.jsxs(Et,{isVisible:r,children:[e&&i.jsx(vi,{title:h,baseMaps:e,setCurrent:d}),t&&i.jsx(Ei,{title:f,terrains:t})]})]})}),Ls="",Ti=({featureTypes:e,locale:t})=>{const n=a.useMemo(()=>$.get(t,"WFS_TITLE")??"Data Layers",[t]),r=a.useMemo(()=>$.get(t,"WFS_CACHE")??"Cache",[t]),s=a.useMemo(()=>$.get(t,"WFS_EXTENT")??"Extent",[t]),o=a.useMemo(()=>$.get(t,"NO_DATA_LAYERS")??"No layers found",[t]),d=a.useMemo(()=>i.jsx(Q,{className:"title",children:n}),[n]),h=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,E)=>i.jsxs(Q,{className:"featureType",children:[i.jsx(J.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(Q,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(Q,{className:"info",children:[i.jsxs(Q,{children:[r,": ",f.cache??0]}),f.total>0&&i.jsxs(Q,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},E)):i.jsx(Q,{children:o})}),[e]);return i.jsxs(Q,{className:"wfsContainer",children:[d,h]})},Li=wt(({locale:e,isOpen:t,setIsOpen:n})=>{var h;const[r,s]=a.useState([]),o=a.useMemo(()=>$.get(e,"DEBUG_PANEL_TITLE")??"Debugger Tool",[e]),d=pe();return a.useEffect(()=>{if(!d.layersManager)return;const f=(E,C)=>{var p;E.forEach(v=>{if(C!==void 0&&C!==v.meta.id)return;const{options:I,meta:T}=v,{zoomLevel:F}=I,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W}=T;s(Z=>{const ee=Z.findIndex(l=>l.id===V);if(ee>=0){if(JSON.stringify(Z[ee])!==JSON.stringify({id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F})){const l=[...Z];return l[ee]={id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F},l}}else return[...Z,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F}];return Z})});const b=new Set((p=d.layersManager)==null?void 0:p.dataLayerList.map(v=>v.meta.id));s(v=>v.filter(I=>b.has(I.id)))};return d.layersManager.addDataLayerUpdatedListener(f),()=>{var E;(E=d.layersManager)==null||E.removeDataLayerUpdatedListener(f)}},[(h=d.layersManager)==null?void 0:h.dataLayerList]),i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>n(!t),children:i.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:i.jsx("path",{d:"M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27-7.38 5.74zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16z",fill:"orange"})})}),i.jsx(Et,{isVisible:t,title:o,children:i.jsx(Ti,{featureTypes:r,locale:e})})]})});class Si extends g.PolylineDashMaterialProperty{}class bi extends g.ConstantProperty{}class Ci extends g.ConstantPositionProperty{}class Mi extends g.Cartesian2{}class _i extends g.Cartesian3{}class pn extends g.Cartographic{}class Pi extends g.BoundingSphere{}class Ii extends g.Ellipsoid{}class Ai extends g.GeographicTilingScheme{}class fn extends g.Rectangle{}class Di extends g.Resource{}class Oi extends g.EllipsoidTerrainProvider{}class ki extends g.CesiumTerrainProvider{}class xi extends g.PolylineGraphics{}class Ni extends g.JulianDate{}class Bi extends g.PositionProperty{}class Fi extends g.BillboardGraphics{}class Gi extends g.Color{}class Vi extends g.PolygonHierarchy{}class Hi extends g.Scene{}const Wi=g.VerticalOrigin,zi=g.HorizontalOrigin,tt=g.SceneMode,Ui=g.LabelStyle,$i=g.HeightReference,_e=document.createElement("canvas"),Te=_e.getContext("2d"),mn=e=>{const r=(e==null?void 0:e.data)??[];for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1},qi=async(e,t)=>(t&&t.tileTransparencyCheckedCounter++,new Promise((n,r)=>{try{Te==null||Te.clearRect(0,0,_e.width,_e.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){_e.width=e.width,_e.height=e.height,Te==null||Te.drawImage(e,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height),d=mn(o);d&&t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(d);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{_e.width=s.width,_e.height=s.height,Te==null||Te.drawImage(s,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height);mn(o)?(t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(!0)):n(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,t)=>{const{west:n,east:r,north:s,south:o}=e,{west:d,east:h,north:f,south:E}=t;return n>=d&&r<=h&&s<=f&&o>=E},ji=(e,t)=>hr(e,je(t)),Yi=e=>{const t=(g.Math.toDegrees(e.west)+g.Math.toDegrees(e.east))/2,n=(g.Math.toDegrees(e.south)+g.Math.toDegrees(e.north))/2;return xt.point([t,n])},yn=e=>[g.Math.toDegrees(e.west),g.Math.toDegrees(e.south),g.Math.toDegrees(e.east),g.Math.toDegrees(e.north)],vn=e=>{const t=e.scene;let r=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!g.defined(r)||!r){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const s=new g.Cartesian2(0,0),o=t.camera.pickEllipsoid(s,t.globe.ellipsoid),d=new g.Cartesian2(t.canvas.width,t.canvas.height),h=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(o),E=t.globe.ellipsoid.cartesianToCartographic(h);r=new g.Rectangle(f.longitude,E.latitude,E.longitude,f.latitude)}return r},Zi=(e,t=100)=>{const n=e.scene,r=e.camera,s=n.mode,o=vn(e);if(!g.defined(o)||!o){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(s===g.SceneMode.SCENE2D)return o;const d=r.positionCartographic;if(!g.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const h=d.latitude,f=d.longitude;if(h<-g.Math.PI_OVER_TWO||h>g.Math.PI_OVER_TWO||f<-g.Math.PI||f>g.Math.PI){console.error("Invalid latitude or longitude values.");return}const E=111320,C=111320*Math.cos(h);let b=t/E,p=t/C;const v=g.Cartesian3.magnitude(r.positionWC);v>1e7&&(b=10,p=10);const I=r.frustum instanceof g.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let T=1;v<5e5?T=.05:v<2e6&&(T=.1),b*=T*(I/Math.PI),p*=T*(I/Math.PI);const F=r.pitch;if(F===void 0)return;const V=Math.PI/4,j=Math.max(0,1-Math.abs(F)/V);b*=j,p*=j;const Y=5e-4;b=Math.max(b,Y),p=Math.max(p,Y);const G=d.latitude-b,X=d.latitude+b,W=d.longitude-p,Z=d.longitude+p,ee=g.Math.clamp(G,o.south,o.north),l=g.Math.clamp(X,o.south,o.north),c=g.Math.clamp(W,o.west,o.east),_=g.Math.clamp(Z,o.west,o.east),y=Math.min(1,F/g.Math.PI_OVER_TWO),S=o.north-(o.north-o.south)*y,w=Math.min(l,S);return new g.Rectangle(g.Math.negativePiToPi(c),g.Math.clamp(ee,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO),g.Math.negativePiToPi(_),g.Math.clamp(w,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO))},En=(e,t,n,r,s,o)=>{const d=e.scene.mode===g.SceneMode.SCENE2D,h=p=>{var v;if(p.polygon)return{type:"Polygon",coordinates:[((v=p.polygon.hierarchy)==null?void 0:v.getValue(g.JulianDate.now())).positions.map(F=>{const V=g.Cartographic.fromCartesian(F),j=new g.Cartographic(g.Math.toDegrees(V.longitude),g.Math.toDegrees(V.latitude),d?500:void 0);return[j.longitude,j.latitude,j.height]})]}},f=(p,v,I,T)=>{const F=g.SceneTransforms.wgs84ToWindowCoordinates(p,v);if(!F)return null;const V=F.x+I,j=F.y+T,Y=new g.Cartesian2(V,F.y),G=new g.Cartesian2(F.x,j),X=p.camera.pickEllipsoid(Y,p.globe.ellipsoid),W=p.camera.pickEllipsoid(G,p.globe.ellipsoid);if(!X||!W)return null;const Z=g.Cartesian3.distance(v,X),ee=g.Cartesian3.distance(v,W);return{widthMeters:Z,heightMeters:ee}},E=(p,v,I)=>{const T=g.Ellipsoid.WGS84,F=p.latitude,V=p.longitude,j=Math.PI/180*T.maximumRadius,Y=Math.PI/180*T.maximumRadius,G=I/2/j,X=v/2/Y,W=F+G,Z=F-G,ee=V+X,l=V-X;return{type:"Polygon",coordinates:[[[l,W],[ee,W],[ee,Z],[l,Z],[l,W]]]}},C=(p,v)=>kt(p)/kt(v);if(!e.dataSources.getByName(t.name)[0])return;const b=[];if(t==null||t.entities.values.forEach(p=>{var v,I;if(s&&o&&d)try{const T=je(s),F=Nt(h(p),T);if(F){const V=(v=p.properties)==null?void 0:v.label.getValue(g.JulianDate.now()),j=ur(F,{properties:{label:V}}),Y={width:V.width,height:V.height},[G,X,W=0]=j.geometry.coordinates,Z=g.Cartesian3.fromDegrees(G,X,W),ee=f(e.scene,Z,Y.width,Y.height);if(ee){const l=E({longitude:G,latitude:X},ee.widthMeters,ee.heightMeters),c=Nt(F,{type:"Feature",properties:{},geometry:l});C(c==null?void 0:c.geometry,l)>.7&&b.push(j)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",p,"extent -->",s)}if(!(n.length>0&&!n.some(T=>p.id.startsWith(T)))&&(p.polygon&&(p.polygon=new g.PolygonGraphics({hierarchy:p.polygon.hierarchy,material:d?g.Color.fromCssColorString(r).withAlpha(.2):g.Color.fromCssColorString(r).withAlpha(.5),outline:!0,outlineColor:g.Color.fromCssColorString(r),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),p.polyline&&(p.polyline=new g.PolylineGraphics({positions:p.polyline.positions,material:g.Color.fromCssColorString(r).withAlpha(.5),clampToGround:!0,width:4})),p.billboard)){const T=(I=p.position)==null?void 0:I.getValue(g.JulianDate.now()),F=g.Cartographic.fromCartesian(T),V=new g.Cartographic(F.longitude,F.latitude,d?500:e.scene.sampleHeight(g.Cartographic.fromCartesian(T))),j=g.Cartesian3.fromRadians(V.longitude,V.latitude,V.height),Y="#FFFF00";p.position=j,p.billboard=new g.BillboardGraphics({image:"data:image/svg+xml;base64,"+btoa(`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
3
3
  <circle cx="8" cy="8" r="6" fill="${r}33" stroke="${Y}80" stroke-width="2"/>
4
4
  </svg>
@@ -1,4 +1,9 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { Vector } from 'ol/layer';
3
+ import { Options } from 'ol/layer/Base';
4
+ interface VectorLayerProps {
5
+ options?: Options;
6
+ }
3
7
  export declare const useVectorLayer: () => Vector<any>;
4
- export declare const VectorLayer: React.FC<PropsWithChildren>;
8
+ export declare const VectorLayer: React.FC<PropsWithChildren<VectorLayerProps>>;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-colonies/react-components",
3
- "version": "4.13.3",
3
+ "version": "4.13.4",
4
4
  "main": "./dist/@map-colonies/react-components.umd.js",
5
5
  "module": "./dist/@map-colonies/react-components.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -87,5 +87,5 @@
87
87
  "files": [
88
88
  "dist"
89
89
  ],
90
- "gitHead": "ca1537313869391ce27ae3bbacc19cfda4ba1c0b"
90
+ "gitHead": "d0a0e470e0fbae04b03753162dd07a56bbf24620"
91
91
  }