@map-colonies/react-components 4.10.0 → 4.10.2

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.
@@ -1,4 +1,4 @@
1
- (function(d,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@material-ui/pickers"),require("@date-io/date-fns"),require("@material-ui/core/styles"),require("@material-ui/core"),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/boolean-point-in-polygon"),require("@turf/bbox-polygon"),require("@turf/helpers"),require("@turf/point-to-polygon-distance"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("uuid"),require("p-map"),require("@turf/area"),require("@turf/intersect"),require("@turf/centroid"),require("@turf/bbox"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@material-ui/pickers","@date-io/date-fns","@material-ui/core/styles","@material-ui/core","@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/boolean-point-in-polygon","@turf/bbox-polygon","@turf/helpers","@turf/point-to-polygon-distance","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","uuid","p-map","@turf/area","@turf/intersect","@turf/centroid","@turf/bbox","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select"],o):(d=typeof globalThis<"u"?globalThis:d||self,o(d.reactComponents={},d.jsxRuntime,d.React,d.dateFns,d.locale,d.pickers,d.DateFnsUtils,d.styles,d.core,d.reactCore,d.useMediaQuery,d.DatePicker,d.datePickerHebrewLocale,d.moment,d.rewind,d.ol,null,d.coordinate,d.control,d.MousePosition,d.proj,d.layer,d.source,d.format,d.interaction,d.Draw,d.VectorTile,d.style,d.WMTSTileGrid,d.extent,d.OlTileWMS,d.OlXYZ,d.VectorTileSource,d.OlExtLegend,d.OlExtLegendCtrl,null,d.TableHead,d.utils,d.CssBaseline,d.ScopedCssBaseline,d.ReactDOM,d.resium,d.Cesium,d.lodash,d.booleanPointInPolygon,d.bboxPolygon,d.turf,d.pointToPolygonDistance,d.viewerCesiumNavigationMixin,null,null,d.uuid,d.pMap,d.area,d.intersect,d.centroid,d.bbox,d.getCaretCoordinates,d.getInputSelection,d.chonky,d.chonkyIconFontawesome,d.filesize,d.Select))})(this,function(d,o,c,Me,Ke,Ge,wt,Oe,se,Y,Fn,St,Vn,He,Gn,Tt,Vo,Ct,at,lt,Lt,Mt,ct,dt,Hn,Wn,zn,Ye,$n,bt,Un,qn,jn,Pt,Kn,Go,Yn,_t,Zn,Xn,Jn,De,u,j,Qn,Ze,Dt,Rn,er,Ho,Wo,It,ut,Ot,At,tr,kt,nr,xt,R,rr,ir,Nt){"use strict";var Bo=Object.defineProperty;var Fo=(d,o,c)=>o in d?Bo(d,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[o]=c;var de=(d,o,c)=>(Fo(d,typeof o!="symbol"?o+"":o,c),c);function ht(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const Bt=ht(c),S=ht(u),Ft=ht(Dt);var Te=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(Te||{}),be=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(be||{}),Xe=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Xe||{});const ge={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:be.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:be.EN},renderAsButton:!0,offset:0,disableFuture:!0}},ue=e=>{const{children:n,...t}=e;return o.jsx(se.Box,{...t,children:n})},Je=e=>{const n=e.type==="dark";return c.useMemo(()=>Vt(e,n),[n,e])},Vt=(e,n=!1)=>Oe.createTheme({palette:{type:n?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:n?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:n?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zo="",or=2,sr=.5,ar=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(or),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(sr)}})),Gt=e=>{var X,F,ee,W;const n=ar(),t=Y.useTheme(),r=Je(t),[s,i]=c.useState(null),[h,g]=c.useState(null),[f,y]=c.useState(ge.DATE_RANGE_PICKER.dateFormat),T=e.controlsLayout??ge.DATE_RANGE_PICKER.controlsLayout,m=e.disableFuture??ge.DATE_RANGE_PICKER.disableFuture,M=((X=e.local)==null?void 0:X.startPlaceHolderText)??ge.DATE_RANGE_PICKER.local.startPlaceHolderText,O=((F=e.local)==null?void 0:F.endPlaceHolderText)??ge.DATE_RANGE_PICKER.local.endPlaceHolderText,_=((ee=e.local)==null?void 0:ee.setText)??ge.DATE_RANGE_PICKER.local.setText,Q=(((W=e.local)==null?void 0:W.calendarLocale)??ge.DATE_RANGE_PICKER.local.calendarLocale)===be.HE?Ke.he:Ke.enUS;c.useEffect(()=>{i(e.from??null)},[e.from]),c.useEffect(()=>{g(e.to??null)},[e.to]),c.useEffect(()=>{y(e.dateFormat??ge.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const $=Boolean(Me.isValid(s)&&!h||Me.isValid(h)&&!s||s&&h&&Me.isValid(s)&&Me.isValid(h)&&Me.isBefore(s,h)),J=()=>{e.onChange({from:s&&Me.isValid(s)?s:void 0,to:h&&Me.isValid(h)?h:void 0})};return o.jsx(se.ThemeProvider,{theme:r,children:o.jsx(ue,{className:`${n.container} drpContainer`,display:"flex",flexDirection:T,width:T==="column"?e.contentWidth:"unset",children:o.jsxs(Ge.MuiPickersUtilsProvider,{utils:wt,locale:Q,children:[o.jsx(Ge.KeyboardDateTimePicker,{variant:"inline",placeholder:M,onChange:Z=>i(Z),value:s,disableFuture:m,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(Ge.KeyboardDateTimePicker,{variant:"inline",placeholder:O,className:n.margin,onChange:Z=>g(Z),value:h,disableFuture:m,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(Y.ThemeProvider,{options:t,children:o.jsx(Y.Button,{className:`${n.setButton} ${n.margin}`,raised:!0,onClick:J,disabled:!$,children:_})})]})})})},Ht=e=>{const{children:n,...t}=e;return o.jsx(se.Popover,{...t,children:n})},$o="",lr=e=>{var F,ee;const[n,t]=c.useState(null),[r,s]=c.useState(null),[i,h]=c.useState(ge.DATE_RANGE_PICKER.dateFormat),[g,f]=c.useState(null),y=W=>{f(W.currentTarget)},T=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},m=()=>{f(null)},M=Boolean(g),O=e.controlsLayout??"column";c.useEffect(()=>{t(e.from??null)},[e.from]),c.useEffect(()=>{s(e.to??null)},[e.to]),c.useEffect(()=>{h(e.dateFormat??ge.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const _=((F=e.local)==null?void 0:F.startPlaceHolderText)??ge.DATE_RANGE_PICKER.local.startPlaceHolderText,z=((ee=e.local)==null?void 0:ee.endPlaceHolderText)??ge.DATE_RANGE_PICKER.local.endPlaceHolderText,Q=e.renderAsButton===void 0?ge.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,$=e.offset===void 0?ge.DATE_RANGE_PICKER.offset:e.offset,J=e.disableFuture===void 0?ge.DATE_RANGE_PICKER.disableFuture:e.disableFuture,X=c.useMemo(()=>`${n?Me.format(n,i):_} - ${r?Me.format(r,i):z}`,[n,r,i,_,z]);return o.jsxs(o.Fragment,{children:[Q?o.jsx(Y.Button,{style:{width:e.width},raised:!0,onClick:y,className:"drpOpener",children:X}):o.jsx(Y.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:X,onClick:T,trailingIcon:{icon:"date_range",tabIndex:0,onClick:T}}),o.jsx(Ht,{open:M,anchorEl:g,onClose:m,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:o.jsx(Gt,{controlsLayout:O,contentWidth:((g==null?void 0:g.clientWidth)??0)-$,dateFormat:i,disableFuture:J,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:n??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{t(W??null),s(Z??null),e.onChange({from:W,to:Z}),m()}})})]})},Qe=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,cr=({endDate:e,startDate:n,setEndDate:t=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:i="",endTimeWrapperClassName:h="",timeRangeInputsWrapperClassName:g="",startTimeInputClassName:f="",startTimeLabel:y="",startTimeWrapperClassName:T=""})=>o.jsxs("div",{className:`timeRangeWrapper ${g}`,children:[o.jsx("div",{className:`startTimeWrapper ${T}`,children:o.jsx(Y.TextField,{label:y,disabled:n===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:He(n).format("HH:mm"),onChange:m=>{const M=He(n),O=He(m.currentTarget.value,"HH:mm"),_=M.set({hours:O.get("hours"),minutes:O.get("minutes")});r(_.toDate())}})}),o.jsx("div",{className:`endTimeWrapper ${h}`,children:o.jsx(Y.TextField,{label:i,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:He(e).format("HH:mm"),onChange:m=>{const M=He(e),O=He(m.currentTarget.value,"HH:mm"),_=M.set({hours:O.get("hours"),minutes:O.get("minutes")});t(_.toDate())}})})]}),dr=c.forwardRef(({value:e,onClick:n,onInputClick:t,...r},s)=>o.jsx(Y.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:i=>{n==null||n(i),t==null||t()},ref:s,value:e})),ur=({setStartDate:e=()=>{},setEndDate:n=()=>{},shortcuts:t,dateRange:r,onShortcut:s})=>{const[i,h]=c.useState(),g=c.useMemo(()=>t.map(f=>f instanceof Function?f():f),[t]);return c.useEffect(()=>{for(const f of g){const y=r.startDate&&r.endDate&&Me.isSameDay(f.startDate,r.startDate)&&Me.isSameDay(f.endDate,r.endDate);i?f.id===i&&(y||h(void 0)):y&&h(f.id)}},[r,i,g]),o.jsx("div",{className:"shortcutsContainer",children:g.map((f,y)=>{const T=()=>{e(f.startDate),n(f.endDate)};return o.jsx(Y.Button,{type:"button",className:`shortcut ${i===f.id?"selected":""}`,onClick:m=>{T(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+y)})})},hr=c.forwardRef((e,n)=>{const{calendarClassName:t,dayClassName:r,monthClassName:s,selectsRange:i,onChange:h,inputName:g,showMonthYearDropdown:f,withShortcuts:y,locale:T="en"}=e,[m,M]=c.useState(null),[O,_]=c.useState(null),[z,Q]=c.useState(!1),$=i?{startDate:m,endDate:O}:m;c.useEffect(()=>{T==="he"&&St.registerLocale("he",Vn)},[T]),c.useEffect(()=>{var F,ee;((F=e.startDate)==null?void 0:F.toString())!==(m==null?void 0:m.toString())&&M(e.startDate),((ee=e.endDate)==null?void 0:ee.toString())!==(O==null?void 0:O.toString())&&_(e.endDate)},[e.startDate,e.endDate,m,O]);const J=c.useMemo(()=>{let F="pickerContainer"+(T==="he"?" pickerContainer-rtl":"");return y&&i&&(F+=" pickerContainer-withShortcuts"),F},[T,y,i]),X=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return o.jsx("div",{className:J,style:{direction:T==="he"?"rtl":"ltr"},children:o.jsx(St,{...e,ref:n,onClickOutside:()=>Q(!1),open:z,startDate:Qe($)?m:void 0,selected:m,endDate:Qe($)?O:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${t}`,weekDayClassName:F=>`pickerWeek ${(r==null?void 0:r(F))??""}`,dayClassName:F=>`pickerDay ${(r==null?void 0:r(F))??""}`,monthClassName:F=>`pickerMonth ${(s==null?void 0:s(F))??""}`,onChange:(F,ee)=>{if(Array.isArray(F)){const[W,Z]=F;M(W),_(Z),h==null||h({startDate:W,endDate:Z&&Me.endOfDay(Z)},ee)}else M(F),h==null||h(F,ee)},customInput:o.jsx(dr,{name:g,onInputClick:()=>{Q(!0)}}),showTimeInput:!!(y&&i),timeInputLabel:"",customTimeInput:y&&Qe($)&&o.jsx(ur,{onShortcut:F=>{h==null||h(F),Q(!1)},shortcuts:y,setEndDate:_,setStartDate:M,dateRange:$}),showMonthYearDropdown:void 0,...X})})}),Uo="",gr=e=>{const n=Y.useTheme(),t=Je(n),{format:r=ge.DATE_PICKER.dateFormat,variant:s=ge.DATE_PICKER.variant,disableFuture:i=ge.DATE_PICKER.disableFuture,local:h,onChange:g,showTime:f=ge.DATE_PICKER.showTime,value:y,...T}=e,{placeHolderText:m=ge.DATE_PICKER.local.placeHolderText,calendarLocale:M}=h??{placeHolderText:ge.DATE_PICKER.local.placeHolderText,calendarLocale:be.EN},O=M===be.HE?Ke.he:Ke.enUS,_=z=>{g(z)};return o.jsx(se.ThemeProvider,{theme:t,children:o.jsxs(Ge.MuiPickersUtilsProvider,{utils:wt,locale:O,children:[f&&o.jsx(Ge.KeyboardDateTimePicker,{variant:s,placeholder:m,onChange:_,value:y,disableFuture:i,format:r,...T}),!f&&o.jsx(Ge.KeyboardDatePicker,{variant:s,placeholder:m,onChange:_,value:y,disableFuture:i,format:r,...T})]})})},pr=18,fr=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(pr)},fullWidth:{width:"100%",marginTop:"36px"}})),mr=e=>{const n=fr(),[t,r]=c.useState(null),{isSelectionEnabled:s,onCancelDraw:i,onStartDraw:h,onReset:g}=e,f=T=>{r(T.currentTarget)},y=()=>{r(null)};return s?o.jsx(Y.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:o.jsx(Y.Button,{className:n.drawingButton,raised:!0,onClick:i,children:"Cancel Draw"})}):o.jsxs(ue,{position:"relative",children:[o.jsx(Y.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:o.jsx(Y.Button,{className:n.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),o.jsxs(Y.Menu,{className:n.fullWidth,open:Boolean(t),onClose:y,children:[o.jsx(Y.MenuItem,{onClick:()=>{h(Te.POLYGON),y()},children:"Polygon"}),o.jsx(Y.MenuItem,{onClick:()=>{h(Te.BOX),y()},children:"Box"}),o.jsx(Y.MenuItem,{onClick:()=>{g(),y()},children:"Clear"})]})]})},qo="";var _e=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(_e||{});const Re=5,et=2,Wt=c.createContext(null),yr=Wt.Provider,zt=35,$t=32,vr=10,Er=e=>e!==void 0&&e!==_e.WGS84?Lt.transform([zt,$t],_e.WGS84,e):[zt,$t],wr=e=>{switch(e){case _e.WEB_MERCATOR:return n=>Ct.format(n,"Mercator: {y}m, {x}m",et);case _e.WGS84:return n=>Ct.format(n,"WGS84: {y}°N {x}°E",Re);default:return n=>""}},Fe=()=>{const e=c.useContext(Wt);if(e===null)throw new Error("map context is null, please check the provider");return e},Ut=e=>{const n=c.useRef(null),{allowFullScreen:t,showMousePosition:r,projection:s}=e,[i]=c.useState(new Tt.Map({view:new Tt.View({projection:s??_e.WGS84}),controls:at.defaults()}));c.useEffect(()=>{i.getView().setCenter(e.center??Er(e.projection))},[i,e.center,e.projection]),c.useEffect(()=>{i.getView().setZoom(e.zoom??vr)},[i,e.zoom,e.projection]);const h=(g,f)=>{f.getControls().forEach(T=>{T instanceof g&&f.removeControl(T)})};return c.useEffect(()=>{i.setTarget(n.current),t!==void 0&&t?i.addControl(new at.FullScreen):h(at.FullScreen,i)},[i,t]),c.useEffect(()=>{r!==void 0&&r?(h(lt,i),i.addControl(new lt({coordinateFormat:wr(s??_e.WGS84),projection:s??_e.WGS84,undefinedHTML:"&nbsp;"}))):h(lt,i)},[i,r,s]),o.jsxs(yr,{value:i,children:[o.jsx("div",{className:"map",ref:n}),e.children]})},qt=c.createContext(null),Sr=qt.Provider,qe=()=>{const e=c.useContext(qt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},jt=({options:e,children:n})=>{const t=Fe(),[r]=c.useState(new Mt.Tile(e));return c.useEffect(()=>(t.addLayer(r),()=>{t.removeLayer(r)}),[t,r]),o.jsx(Sr,{value:r,children:n})},Kt=c.createContext(null),Tr=Kt.Provider,Yt=()=>{const e=c.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Zt=({children:e})=>{const n=Fe(),[t]=c.useState(new Mt.Vector);return c.useEffect(()=>(n.addLayer(t),()=>{n.removeLayer(t)}),[n,t]),o.jsx(Tr,{value:t,children:e})},Xt=c.createContext(null),Cr=Xt.Provider,Jt=()=>{const e=c.useContext(Xt);if(e===null)throw new Error("vector source context is null, please check the provider");return e},Qt=({children:e})=>{const n=Yt(),[t]=c.useState(new ct.Vector);return c.useEffect(()=>{n.setSource(t)},[t,n]),o.jsx(Cr,{value:t,children:e})},Rt=({geometry:e,fitOptions:n,fit:t,featureStyle:r})=>{const s=Jt(),i=Fe();return c.useLayoutEffect(()=>{const g=new dt.GeoJSON().readFeature(e);return t&&s.on("addfeature",function(){i.getView().fit(s.getExtent(),n)}),r&&g.setStyle(r),s.addFeature(g),()=>{s.removeFeature(g)}},[e,s,t]),null},en=e=>{const n=qe();return c.useEffect(()=>{n.setSource(new ct.OSM)},[n]),null},tn=({drawType:e,onPolygonSelected:n})=>{const t=Fe();return c.useEffect(()=>{const r={type:"Circle"};switch(e){case Te.BOX:r.geometryFunction=Wn.createBox();break;case Te.POLYGON:r.type="Polygon";break;default:return}const s=new Hn.Draw(r);t.addInteraction(s);const i=h=>{const f=new dt.GeoJSON().writeGeometryObject(h.feature.getGeometry());n==null||n(f)};return s.on("drawend",i),()=>{s.un("drawend",i),t.removeInteraction(s)}},[n,e,t]),null},jo="",Lr=e=>{const n=t=>{const r=Gn(t);e.onPolygonSelection(r)};return o.jsxs(Ut,{allowFullScreen:!0,showMousePosition:!0,children:[o.jsx(jt,{children:o.jsx(en,{})}),e.selectionPolygon&&o.jsx(Zt,{children:o.jsx(Qt,{children:o.jsx(Rt,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&o.jsx(tn,{drawType:e.drawType,onPolygonSelected:n})]})},gt=1.5,Mr=80,br=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(gt),top:e.spacing(gt)},contentContainer:{marginTop:e.spacing(gt),width:e.spacing(Mr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),Pr=e=>{var f;const[n,t]=c.useState(),[r,s]=c.useState(),i=br(),h=y=>{s(y),t(void 0),e.handlePolygonSelected(y)},g=()=>{s(void 0),e.handlePolygonReset()};return o.jsxs("div",{className:i.map,children:[o.jsxs("div",{className:`${i.absolute}`,children:[o.jsxs(se.Paper,{className:i.filtersContainer,children:[o.jsx(mr,{onCancelDraw:()=>t(void 0),onReset:g,onStartDraw:t,isSelectionEnabled:n!==void 0}),(f=e.filters)==null?void 0:f.map((y,T)=>o.jsx("div",{className:i.filtersMargin,children:y},T))]}),o.jsx(se.Paper,{color:"red",className:`${i.contentContainer}`,children:e.children})]}),o.jsx(Lr,{children:e.mapContent,onPolygonSelection:h,drawType:n,selectionPolygon:r})]})},nn=new Ye.Fill({color:"rgba(255,255,255,0.4)"}),rn=new Ye.Stroke({color:"#3399CC",width:1.25}),on=[new Ye.Style({image:new Ye.Circle({fill:nn,stroke:rn,radius:5}),fill:nn,stroke:rn})],sn=c.createContext(null),_r=sn.Provider,an=()=>{const e=c.useContext(sn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},Dr=({children:e,options:n,style:t})=>{const r=Fe(),[s]=c.useState(new zn({...n,style:t||on}));return c.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),c.useEffect(()=>{s.setStyle(t||on)},[s,t]),o.jsx(_r,{value:s,children:e})},pt=20,Ir=256,Or=2,Ar=2,kr="REST",xr=e=>{const n=Lt.get(e.projection),t=n.getExtent(),r=new Array(pt),s=new Array(pt),i=bt.getWidth(t)/Ir,h=e.heightWidthRatio!==void 0?e.heightWidthRatio:Ar,g=e.requestEncoding!==void 0?e.requestEncoding:kr;for(let y=0;y<pt;++y)r[y]=i/Math.pow(Or,y)/h,s[y]=y.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:n,tileGrid:new $n({origin:bt.getTopLeft(t),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:g,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Nr=e=>{const n=qe(),{options:t}=e;return c.useEffect(()=>{n.setSource(new ct.WMTS(t))},[n,t]),null},Br=e=>{const{attributions:n,url:t,params:r,serverType:s,transition:i}=e;return{attributions:n,url:t,params:r,serverType:s,transition:i}},Fr=e=>{const n=qe(),{options:t}=e;return c.useEffect(()=>{n.setSource(new Un(t))},[n,t]),null},Vr=e=>{const{attributions:n,url:t}=e;return{attributions:n,url:t}},Gr=e=>{const n=qe(),{options:t}=e;return c.useEffect(()=>{n.setSource(new qn(t))},[n,t]),null},Hr=c.createContext(null),Wr=()=>{const e=c.useContext(Hr);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},zr=e=>{const{url:n}=e;return{url:n,format:new dt.MVT}},$r=({children:e,options:n})=>{const t=an();return c.useEffect(()=>{t.setSource(new jn(n))},[n,t]),null},Ur=({legendItems:e,title:n,isCollapsed:t})=>{const r=Fe();return c.useEffect(()=>{const s=new Pt({title:n??"",margin:5,maxWidth:300}),i=new Kn({legend:s,collapsed:t===void 0?!0:t});r.addControl(i);const h=new Pt({margin:4});return e.forEach(g=>{h.addItem({title:g.title,style:g.style,typeGeom:"Polygon"})}),s.addItem(h),()=>{r.removeControl(i)}},[r,e,n,t]),o.jsx(o.Fragment,{})};function qr(e){const{headCells:n,order:t,orderBy:r,onRequestSort:s,isCollapseable:i}=e,h=g=>f=>{s(f,g)};return o.jsx(Yn,{children:o.jsxs(se.TableRow,{children:[i&&o.jsx(se.TableCell,{}),n.map(g=>o.jsx(se.TableCell,{align:g.numeric?"right":"left",padding:g.disablePadding?"none":"default",sortDirection:r===g.id?t:!1,children:o.jsx(se.TableSortLabel,{active:r===g.id,direction:r===g.id?t:"asc",onClick:h(g.id),children:g.label})},g.id))]})})}const jr=_t.createSvgIcon(Bt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),Kr=_t.createSvgIcon(Bt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function Yr(e){const{cellsMetadata:n,isRowSelected:t,item:r,onRowSelected:s,rowIndex:i,isCollapseable:h,collapsedElement:g}=e,[f,y]=c.useState(!1),T=n.length,m=()=>{s==null||s(i)};return o.jsxs(o.Fragment,{children:[o.jsxs(se.TableRow,{hover:!0,selected:t,onClick:m,children:[h&&o.jsx(se.TableCell,{padding:"checkbox",children:o.jsx(se.IconButton,{"aria-label":"expand row",size:"small",onClick:M=>{M.stopPropagation(),y(!f)},children:f?o.jsx(Kr,{}):o.jsx(jr,{})})}),n.map(M=>o.jsx(se.TableCell,{align:M.numeric?"right":"left",padding:M.disablePadding?"none":"default",children:M.transform?M.transform(r[M.id]):r[M.id]},M.id+i.toString()))]}),h&&o.jsx(se.TableRow,{children:o.jsx(se.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:T+1,children:o.jsx(se.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:g==null?void 0:g(r)})})})]})}function Zr(e){const[n,t]=c.useState(""),[r,s]=c.useState("asc"),{cellsMetadata:i,items:h,onRequestSort:g,onRowSelected:f,isCollapseable:y,collapsedElement:T,isDense:m,page:M,rowsPerPage:O,count:_,handleChangePage:z,handleChangeRowsPerPage:Q}=e,$=(J,X)=>{const F=n===X&&r==="asc";s(F?"desc":"asc"),t(X),g(X,F?"desc":"asc")};return o.jsxs(se.TableContainer,{component:se.Paper,children:[o.jsxs(se.Table,{size:m?"small":"medium",children:[o.jsx(qr,{headCells:i,onRequestSort:$,order:r,orderBy:n,isCollapseable:y}),o.jsxs(se.TableBody,{children:[h.map((J,X)=>o.jsx(Yr,{item:J,rowIndex:X,isCollapseable:y,cellsMetadata:i,collapsedElement:T,isRowSelected:!1,onRowSelected:f},X)),(h.length===0||O>h.length)&&o.jsx(se.TableRow,{style:{height:(m?33:53)*(O-h.length)},children:o.jsx(se.TableCell,{colSpan:y?i.length+1:i.length,children:h.length===0&&o.jsx(se.Typography,{align:"center",children:"No results :("})})})]})]}),o.jsx(se.TablePagination,{rowsPerPage:O,rowsPerPageOptions:[5,10],component:"div",count:_,page:M,onPageChange:z,onRowsPerPageChange:Q})]})}const Xr=e=>{const{children:n,...t}=e;return o.jsx(Zn,{...t,children:n})},Jr=e=>{const{children:n,...t}=e;return o.jsx(Xn,{...t,children:n})},ln=e=>e*Math.PI/180,tt=e=>e*(180/Math.PI),Qr=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(ln(85.362/2))/Math.sin(ln(85.362/2))),Ko="",Rr=({children:e,locale:n})=>{var f;const[t,r]=c.useState(!1),[s,i]=c.useState([]),h=c.useMemo(()=>j.get(n,"DEBUG_PANEL_TITLE")??"Debugger Tool",[n]),g=ye();return c.useEffect(()=>{if(!g.layersManager)return;const y=(T,m)=>{var O;T.forEach(_=>{if(m!==void 0&&m!==_.meta.id)return;const{options:z,meta:Q}=_,{zoomLevel:$}=z,{id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z}=Q;i(ae=>{const a=ae.findIndex(l=>l.id===J);if(a>=0){if(JSON.stringify(ae[a])!==JSON.stringify({id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z,zoomLevel:$})){const l=[...ae];return l[a]={id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z,zoomLevel:$},l}}else return[...ae,{id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z,zoomLevel:$}];return ae})});const M=new Set((O=g.layersManager)==null?void 0:O.dataLayerList.map(_=>_.meta.id));i(_=>_.filter(z=>M.has(z.id)))};return g.layersManager.addDataLayerUpdatedListener(y),()=>{var T;(T=g.layersManager)==null||T.removeDataLayerUpdatedListener(y)}},[(f=g.layersManager)==null?void 0:f.dataLayerList]),o.jsxs(o.Fragment,{children:[o.jsx(Y.Icon,{icon:o.jsx("div",{className:"debugPanelIconContainer",children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:o.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"})})}),onClick:()=>{r(!t)}}),t&&o.jsx("div",{className:"debugPanel",children:o.jsxs(Y.Dialog,{open:t,onClosed:()=>{r(!1)},children:[o.jsx(Y.DialogTitle,{className:"title",children:h}),o.jsx(Y.DialogContent,{children:c.Children.map(e,y=>c.isValidElement(y)?c.cloneElement(y,{featureTypes:s}):y)})]})})]})},Yo="",ei=({featureTypes:e,locale:n})=>{const t=c.useMemo(()=>j.get(n,"WFS_TITLE")??"Data Layers",[n]),r=c.useMemo(()=>j.get(n,"WFS_CACHE")??"Cache",[n]),s=c.useMemo(()=>j.get(n,"WFS_EXTENT")??"Extent",[n]),i=c.useMemo(()=>j.get(n,"NO_DATA_LAYERS")??"No layers found",[n]),h=c.useMemo(()=>o.jsx(ue,{className:"title",children:t}),[t]),g=c.useMemo(()=>o.jsx(o.Fragment,{children:e.length>0?e.map((f,y)=>o.jsxs(ue,{className:"featureType",children:[o.jsx(Y.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:o.jsxs(ue,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),o.jsxs(ue,{className:"info",children:[o.jsxs(ue,{children:[r,": ",f.cache??0]}),f.total>0&&o.jsxs(ue,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},y)):o.jsx(ue,{children:i})}),[e]);return o.jsxs(ue,{className:"wfsContainer",children:[h,g]})},cn=(e,n,t)=>{let r;if(e.scene.mode!==u.SceneMode.SCENE2D)r=e.scene.pickPosition(new u.Cartesian2(n,t));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new u.Cartesian2(n,t),s)}return u.Cartographic.fromCartesian(r)},ti=(e,n,t)=>{const r=cn(e,n,t);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[u.Math.toDegrees(r.longitude),u.Math.toDegrees(r.latitude)]}}},dn=(e,n,t)=>{try{const r=cn(e,n,t);return{longitude:u.Math.toDegrees(r.longitude),latitude:u.Math.toDegrees(r.latitude)}}catch{return}},Ie=document.createElement("canvas"),Ce=Ie.getContext("2d"),un=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},ni=async(e,n)=>(n&&n.tileTransparencyCheckedCounter++,new Promise((t,r)=>{try{Ce==null||Ce.clearRect(0,0,Ie.width,Ie.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){Ie.width=e.width,Ie.height=e.height,Ce==null||Ce.drawImage(e,0,0);const i=Ce==null?void 0:Ce.getImageData(0,0,Ie.width,Ie.height),h=un(i);h&&n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(h);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{Ie.width=s.width,Ie.height=s.height,Ce==null||Ce.drawImage(s,0,0);const i=Ce==null?void 0:Ce.getImageData(0,0,Ie.width,Ie.height);un(i)?(n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(!0)):t(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,n)=>{const{west:t,east:r,north:s,south:i}=e,{west:h,east:g,north:f,south:y}=n;return t>=h&&r<=g&&s<=f&&i>=y},ri=(e,n)=>Rn(e,Ze(n)),ii=e=>{const n=(u.Math.toDegrees(e.west)+u.Math.toDegrees(e.east))/2,t=(u.Math.toDegrees(e.south)+u.Math.toDegrees(e.north))/2;return Dt.point([n,t])},oi=e=>[u.Math.toDegrees(e.west),u.Math.toDegrees(e.south),u.Math.toDegrees(e.east),u.Math.toDegrees(e.north)],si=(e,n=100)=>{const t=e.scene,r=e.camera,s=t.mode,i=r.computeViewRectangle(t.globe.ellipsoid);if(!u.defined(i)||!i){console.error("computeViewRectangle returned invalid rectangle.");return}if(s===u.SceneMode.SCENE2D)return i;const h=r.positionCartographic;if(!u.defined(h)){console.error("Camera position is undefined in 3D mode.");return}const g=h.latitude,f=h.longitude;if(g<-u.Math.PI_OVER_TWO||g>u.Math.PI_OVER_TWO||f<-u.Math.PI||f>u.Math.PI){console.error("Invalid latitude or longitude values.");return}const y=111320,T=111320*Math.cos(g);let m=n/y,M=n/T;const O=u.Cartesian3.magnitude(r.positionWC);O>1e7&&(m=10,M=10);const _=r.frustum instanceof u.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let z=1;O<5e5?z=.05:O<2e6&&(z=.1),m*=z*(_/Math.PI),M*=z*(_/Math.PI);const Q=r.pitch;if(Q===void 0)return;const $=Math.PI/4,J=Math.max(0,1-Math.abs(Q)/$);m*=J,M*=J;const X=5e-4;m=Math.max(m,X),M=Math.max(M,X);const F=h.latitude-m,ee=h.latitude+m,W=h.longitude-M,Z=h.longitude+M,ae=u.Math.clamp(F,i.south,i.north),a=u.Math.clamp(ee,i.south,i.north),l=u.Math.clamp(W,i.west,i.east),w=u.Math.clamp(Z,i.west,i.east),p=Math.min(1,Q/u.Math.PI_OVER_TWO),C=i.north-(i.north-i.south)*p,v=Math.min(a,C);return new u.Rectangle(u.Math.negativePiToPi(l),u.Math.clamp(ae,-u.Math.PI_OVER_TWO,u.Math.PI_OVER_TWO),u.Math.negativePiToPi(w),u.Math.clamp(v,-u.Math.PI_OVER_TWO,u.Math.PI_OVER_TWO))},rt=3,it="hasTransparency";function ft(e,n,t,r,s){return setTimeout(()=>{var g;const i=(g=this.layerListInstance.find(f=>{var y,T;return((y=f._imageryProvider._resource)==null?void 0:y._url)===((T=this._resource)==null?void 0:T._url)}))==null?void 0:g.meta,h=j.get(i,it)===!0;this.tileTransparencyCheckedCounter<rt&&!h&&ni(s==null?void 0:s.url,this).then(f=>{var y;(y=this.mapViewer.layersManager)==null||y.addMetaToLayer({[it]:f},T=>T._imageryProvider._resource._url===this._resource._url)})},0),e(n,t,r,s)}class hn extends u.UrlTemplateImageryProvider{constructor(t,r){var s;super(t);de(this,"layerListInstance");de(this,"mapViewer");de(this,"maxTilesForTransparencyCheck",rt);de(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return ft.call(this,super.requestImage.bind(this),t,r,s,i)}}class gn extends u.WebMapServiceImageryProvider{constructor(t,r){var s;super(t);de(this,"layerListInstance");de(this,"mapViewer");de(this,"maxTilesForTransparencyCheck",rt);de(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return ft.call(this,super.requestImage.bind(this),t,r,s,i)}}class pn extends u.WebMapTileServiceImageryProvider{constructor(t,r){var s;super(t);de(this,"layerListInstance");de(this,"mapViewer");de(this,"maxTilesForTransparencyCheck",rt);de(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return ft.call(this,super.requestImage.bind(this),t,r,s,i)}}const ai=1,li=-1,fn="TRANSPARENT_BASE_LAYER";class ci{constructor(n,t,r,s,i){de(this,"mapViewer");de(this,"legendsList");de(this,"layerUpdated");de(this,"dataLayerUpdated");de(this,"layers");de(this,"dataLayers");de(this,"legendsExtractor");de(this,"layerManagerFootprintMetaFieldPath");de(this,"shouldOptimizedTileRequests");this.mapViewer=n,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=t,this.layerUpdated=new u.Event,this.dataLayerUpdated=new u.Event,this.layerManagerFootprintMetaFieldPath=s,this.shouldOptimizedTileRequests=i??!1,r&&this.layerUpdated.addEventListener(r,this),this.shouldOptimizedTileRequests&&(this.layerUpdated.addEventListener(h=>{const g=Object.keys(h);g.length===1&&g[0]===it&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())}),this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}))}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}addDataLayer(n){this.dataLayers.push({...n}),this.dataLayerUpdated.raiseEvent(this.dataLayers)}addMetaToLayer(n,t){const r=this.layers.map(s=>s.imageryProvider.readyPromise);Promise.all(r).then(s=>{const i=this.layers.find(t);i&&(i.meta={...i.meta??{},...n},this.setLegends(),this.layerUpdated.raiseEvent(n))})}addMetaToDataLayer(n){const t=this.findDataLayerById(n.id);t&&(t.meta={...t.meta??{},...n},this.dataLayerUpdated.raiseEvent(this.dataLayers,n.id))}setBaseMapLayers(n){n.baseRasteLayers.sort((r,s)=>r.zIndex-s.zIndex).forEach((r,s)=>{this.addRasterLayer(r,s,n.id)}),this.shouldOptimizedTileRequests&&(this.removeLayer(fn),this.addTransparentImageryProvider())}addRasterLayer(n,t,r){let s;switch(n.type){case"XYZ_LAYER":{const i=n.options,h=this.shouldOptimizedTileRequests?new hn(i,this.mapViewer):new u.UrlTemplateImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(h,t);break}case"WMS_LAYER":{const i=n.options,h=this.shouldOptimizedTileRequests?new gn(i,this.mapViewer):new u.WebMapServiceImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(h,t);break}case"WMTS_LAYER":{const i=n.options,h=this.shouldOptimizedTileRequests?new pn(i,this.mapViewer):new u.WebMapTileServiceImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(h,t);break}}s&&(s.alpha=n.opacity,s.meta={parentBasetMapId:r,...n},n.show!==void 0&&(s.show=n.show))}removeLayer(n){const t=this.findLayerById(n);t&&this.mapViewer.imageryLayers.remove(t,!0)}removeDataLayer(n){const t=this.findDataLayerById(n);if(t){const r=this.dataLayers.indexOf(t);r>-1&&this.dataLayers.splice(r,1),this.dataLayerUpdated.raiseEvent(this.dataLayers)}}removeBaseMapLayers(){this.layers.filter(t=>!!j.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}removeNotBaseMapLayers(){this.layers.filter(t=>!j.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}raise(n,t=1){const r=this.findLayerById(n),s=(r==null?void 0:r.meta).zIndex;if(r)for(let i=0;i<t;i++)this.mapViewer.imageryLayers.raise(r);this.updateLayersOrder(n,s,s+t)}lower(n,t=1){const r=this.findLayerById(n),s=(r==null?void 0:r.meta).zIndex,i=this.getBaseLayersCount(),h=this.mapViewer.imageryLayers.indexOf(r);if(h-t<=i&&(t=h-i),r)for(let g=0;g<t;g++)this.mapViewer.imageryLayers.lower(r);this.updateLayersOrder(n,s,s-t)}raiseToTop(n){const t=this.findLayerById(n),r=(t==null?void 0:t.meta).zIndex;t&&this.mapViewer.imageryLayers.raiseToTop(t),this.updateLayersOrder(n,r,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(n){const t=this.findLayerById(n),r=this.getBaseLayersCount(),s=this.mapViewer.imageryLayers.indexOf(t);this.lower(n,s-r)}length(){return this.mapViewer.imageryLayers.length}show(n,t){const r=this.get(n);r!==void 0&&(r.show=t)}showAllNotBase(n){this.layers.filter(r=>!j.get(r.meta,"parentBasetMapId")).forEach(r=>{var s;this.show((s=r.meta)==null?void 0:s.id,n)})}get(n){const t=this.findLayerById(n),r=this.mapViewer.imageryLayers.indexOf(t);return r?this.mapViewer.imageryLayers.get(r):void 0}pickImageryLayers(n){var s;const t=this.mapViewer.camera.getPickRay(n);let r;return t&&(r=(s=this.mapViewer.imageryLayers.pickImageryLayers(t,this.mapViewer.scene))==null?void 0:s.filter(i=>!j.get(i.meta,"parentBasetMapId"))),r}findLayerByPOI(n,t,r=!0){if(this.layerManagerFootprintMetaFieldPath){const s=ti(this.mapViewer,n,t);return this.layers.filter(g=>!j.get(g.meta,"parentBasetMapId")).filter(g=>{const f=j.get(g.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?Qn(s.geometry,{type:"Feature",properties:{},geometry:f})&&(r?g.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",g.meta),!1)}).sort((g,f)=>{var y,T;return((y=f.meta)==null?void 0:y.zIndex)-((T=g.meta)==null?void 0:T.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const n=this.mapViewer.imageryLayers.addImageryProvider(new u.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new u.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);n.meta={id:fn,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}addDataLayerUpdatedListener(n){this.dataLayerUpdated.addEventListener(n,this)}removeDataLayerUpdatedListener(n){this.dataLayerUpdated.removeEventListener(n,this)}findDataLayerById(n){return this.dataLayers.find(t=>t.meta.id===n)}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(t=>!!j.get(t.meta,"parentBasetMapId")).length}findLayerById(n){return this.layers.find(t=>t.meta!==void 0?t.meta.id===n:!1)}updateLayersOrder(n,t,r){const s=t>r?ai:li,i=t<r?t:r,h=t<r?r:t;this.layers.forEach(g=>{var y;if(!j.get(g.meta,"parentBasetMapId")){const T=(y=g.meta)==null?void 0:y.zIndex;g.meta.zIndex=T>=i&&T<=h&&T!==t?T+s:T===t?r:T}})}hideNonRelevantLayers(){var n,t;for(const r of this.layers)((n=r.meta)==null?void 0:n.relevantToExtent)!==r.show&&r.imageryProvider.ready&&(r.show=((t=r.meta)==null?void 0:t.relevantToExtent)??!0)}markRelevantLayersForExtent(){var n,t;try{const r=this.mapViewer.camera.computeViewRectangle();for(let s=this.layers.length-1;s>=0;s--){const i=this.layers[s],h=!j.isEmpty(r)&&!j.isEmpty(i.rectangle)&&u.Rectangle.intersection(r,i.rectangle);for(let g=this.layers.length-1;g>=s;g--){if(((n=i.meta)==null?void 0:n.skipRelevancyCheck)===!0){i.meta={...i.meta,relevantToExtent:!0};continue}const f=this.layers[g],y=((t=f.meta)==null?void 0:t[it])===!0;if(i!==f)if(h instanceof u.Rectangle){if(nt(r,i.rectangle))if(nt(r,f.rectangle)&&!y){i.meta={...i.meta??{},relevantToExtent:!1};break}else i.meta={...i.meta??{},relevantToExtent:!0};if(nt(r,f.rectangle)&&!y){i.meta={...i.meta??{},relevantToExtent:!1};break}if(nt(i.rectangle,f.rectangle)){if(i.meta={...i.meta??{},relevantToExtent:y},!y)break}else i.meta={...i.meta??{},relevantToExtent:!0}}else i.meta={...i.meta??{},relevantToExtent:!1};else s===this.layers.length-1&&(i.meta={...i.meta??{},relevantToExtent:h instanceof u.Rectangle})}}}catch(r){console.error(r)}}}const Zo="",di=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24",width:"24",viewBox:"0 0 612 612",children:o.jsxs("g",{xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M322.4,173.9l-129,16.2l-4.6,21.4l25.3,4.7c16.5,3.9,19.8,9.9,16.2,26.4l-41.5,195.3c-10.9,50.5,5.9,74.3,45.5,74.3 c30.7,0,66.3-14.2,82.5-33.6l4.9-23.4c-11.3,9.9-27.7,13.9-38.6,13.9c-15.5,0-21.1-10.9-17.1-30L322.4,173.9z"}),o.jsx("circle",{cx:"270.1",cy:"56.3",r:"56.3"})]})}),ui=({onClick:e})=>o.jsx(ue,{onClick:e,className:"mapLegendToggleContainer",children:o.jsx(Y.Icon,{icon:di,className:"mapLegendIcon"})}),hi=({legend:{legendImg:e,legendDoc:n,layer:t},docText:r,imgText:s})=>{const i=c.useCallback(()=>{window.open(e,"_blank")},[e]);c.useCallback(()=>{window.open(n,"_blank")},[n]);const h=c.useCallback(()=>{const y=o.jsx(ue,{className:"layerNameContainer",children:o.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:t})});return(t??"").length>15?o.jsx(Y.Tooltip,{content:t,children:y}):y},[t]),g=c.useCallback(()=>[typeof e=="string"&&o.jsx("a",{className:"legendAction",href:e,target:"_blank",rel:"noreferrer",children:s}),typeof n=="string"&&o.jsx("a",{className:"legendAction",href:n,target:"_blank",rel:"noreferrer",children:r})],[e,s,n,r]);return o.jsxs(ue,{className:"mapLegend",children:[h(),o.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:i}),o.jsx(ue,{className:"legendActionsContainer",children:g()})]})},gi=({legends:e,actionsTexts:{docText:n,imgText:t},noLegendsText:r})=>{const s=c.useCallback(()=>o.jsx(ue,{className:"noLegendsContainer",children:o.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),i=c.useCallback(()=>e.length?e.map((h,g)=>o.jsx(hi,{legend:h,docText:n,imgText:t},`${h.layer}_${g}`)):s(),[e]);return o.jsx(ue,{className:"mapLegendsList",children:i()})},pi=({isOpen:e,toggleSidebar:n,title:t="Map Legends",noLegendsText:r="No legends to display...",actionsTexts:s={docText:"Docs",imgText:"View Image"},legends:i=[]})=>e?o.jsxs(Y.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[o.jsx(Y.DrawerHeader,{className:"sidebarHeaderContainer",children:o.jsx(Y.DrawerTitle,{className:"sidebarTitle",children:t})}),o.jsxs(Y.DrawerContent,{className:"sidebarContent",children:[o.jsx(Y.Icon,{onClick:n,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),o.jsx(gi,{noLegendsText:r,legends:i,actionsTexts:s})]})]}):null;class fi extends u.PolylineDashMaterialProperty{}class mi extends u.ConstantProperty{}class yi extends u.ConstantPositionProperty{}class vi extends u.Cartesian2{}class Ei extends u.Cartesian3{}class mn extends u.Cartographic{}class wi extends u.BoundingSphere{}class Si extends u.Ellipsoid{}class Ti extends u.GeographicTilingScheme{}class Ci extends u.Rectangle{}class Li extends u.Resource{}class Mi extends u.EllipsoidTerrainProvider{}class bi extends u.CesiumTerrainProvider{}class Pi extends u.PolylineGraphics{}class _i extends u.JulianDate{}class Di extends u.PositionProperty{}class Ii extends u.BillboardGraphics{}class Oi extends u.Color{}class Ai extends u.PolygonHierarchy{}class ki extends u.Scene{}const xi=u.VerticalOrigin,Ni=u.HorizontalOrigin,we=u.SceneMode,Bi=u.LabelStyle,Fi=u.HeightReference,Xo="",Vi=Oe.makeStyles(e=>Oe.createStyles({mapContainer:{width:"60px",height:"60px",border:`${e.palette.background.paper} 2px solid`}})),Gi=e=>{const n=ye(),{baseMaps:t}=e,[r,s]=c.useState(" "),[i,h]=c.useState(),g=Vi();c.useEffect(()=>{const y=t==null?void 0:t.maps.find(T=>T.isCurrent);y&&(h(y),s(y.title!==void 0?y.title:" "))},[t]);const f=y=>{var T,m;if(t){(T=n.layersManager)==null||T.removeBaseMapLayers();const M=t.maps.find(O=>O.id===y);M&&((m=n.layersManager)==null||m.setBaseMapLayers(M),h(M),t.maps.forEach(O=>{O.isCurrent=M===O}))}};return o.jsxs(o.Fragment,{children:[o.jsx("label",{className:"mapLabel",children:r}),o.jsx("ul",{className:"mapSelector",children:t==null?void 0:t.maps.map(y=>o.jsx("li",{className:`mapContainer ${g.mapContainer} ${y===i?"mapContainerSelected":""}`,children:o.jsx("img",{alt:"",className:"mapContainerImg",src:y.thumbnail,onMouseOver:()=>{s(y.title)},onMouseOut:()=>{s((i==null?void 0:i.title)!==void 0?i.title:" ")},onClick:()=>{f(y.id)}})},y.id))})]})},Jo="",Hi=-1,Wi=e=>{const n=ye(),[t,r]=c.useState(we.SCENE2D),{sceneModes:s}=e,i=h=>s.findIndex(g=>g===h)>Hi;return c.useEffect(()=>{r(n.scene.mode)},[]),o.jsxs(o.Fragment,{children:[i(we.SCENE3D)&&o.jsx(Y.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===we.SCENE3D?"mapViewCurrent":""}`,children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 64 64",children:o.jsx("path",{d:"m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878 -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132 -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285 11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201 5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461 -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z"})})}),onClick:()=>{n.scene.morphTo3D(),r(we.SCENE3D)}}),i(we.SCENE2D)&&o.jsx(Y.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===we.SCENE2D?"mapViewCurrent":""}`,children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 64 64",children:o.jsx("path",{d:"m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z"})})}),onClick:()=>{n.scene.morphTo2D(),r(we.SCENE2D)}}),i(we.COLUMBUS_VIEW)&&o.jsx(Y.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===we.COLUMBUS_VIEW?"mapViewCurrent":""}`,children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 64 64",children:o.jsx("path",{d:"m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z"})})}),onClick:()=>{n.scene.morphToColumbusView(),r(we.COLUMBUS_VIEW)}})]})},Qo="",mt="ic_settings_24px",zi=e=>{const[n,t]=c.useState(!1),{sceneModes:r,baseMaps:s,locale:i}=e,h=c.useRef(null),g=j.get(i,"MAP_SETTINGS_DIALOG_TITLE")??"Map Settings",f=j.get(i,"MAP_SETTINGS_SCENE_MODE_TITLE")??"Scene Mode",y=j.get(i,"MAP_SETTINGS_BASE_MAP_TITLE")??"Base Map";return c.useEffect(()=>{const T=m=>{var _;const M=m.target,O=j.get(h,"current");O&&!O.contains(M)&&M.id!==mt&&((_=M.parentElement)==null?void 0:_.id)!==mt&&(document.removeEventListener("click",T,!1),t(!1))};return document.addEventListener("click",T,!1),()=>{document.removeEventListener("click",T,!1)}}),o.jsxs(o.Fragment,{children:[o.jsx(Y.Icon,{icon:o.jsx("div",{className:"settingsIconContainer",children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",id:mt,x:"288",y:"24",children:o.jsx("path",{d:"M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65A.488.488 0 0 0 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"})})}),onClick:()=>{t(!n)}}),n&&o.jsx("div",{className:"settingsDialogPortal",ref:h,children:o.jsxs(Y.Dialog,{open:n,onClosed:()=>{t(!1)},children:[o.jsx(Y.DialogTitle,{children:g}),o.jsxs(Y.DialogContent,{children:[o.jsx("h4",{className:"sectionLabel",children:f}),o.jsx(ue,{className:"mapScenesContainer",children:o.jsx(Wi,{sceneModes:r})}),o.jsx(ue,{className:"baseMapsContainer",children:s&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"sectionLabel",children:y}),o.jsx(Gi,{baseMaps:s})]})})]})]})})]})},Ro="",$i=e=>{const n=ye(),{enableCompass:t=!0,enableZoomControls:r=!1,lockCompassNavigation:s=!1,locale:i={DIRECTION:"ltr"}}=e;return c.useEffect(()=>{if(typeof j.get(n,"cesiumNavigation")>"u"){n.extend(er,{enableCompass:t,enableZoomControls:r,enableDistanceLegend:!1}),n.cesiumNavigation.setNavigationLocked(s);const h=document.querySelector(".compass");h&&i.DIRECTION&&h.classList.add(i.DIRECTION)}},[n,t,r,i.DIRECTION,s]),null},es="",yn=e=>{const n=ye(),t=c.useRef(null),[r,s]=c.useState({x:0,y:0});return c.useEffect(()=>{n.screenSpaceEventHandler.setInputAction(i=>{if(i!=null&&i.endPosition){const h={...i.endPosition};h.x=Math.ceil(h.x),h.y=Math.ceil(h.y),s(h)}},u.ScreenSpaceEventType.MOUSE_MOVE)},[t,n]),c.useEffect(()=>{const i=n.scene.globe.ellipsoid;if(r){const h=dn(n,r.x,r.y);if(h){const g=new mn(h.longitude,h.latitude);if(t.current){let f="";switch(e.projection){case _e.WEB_MERCATOR:{const T=new u.WebMercatorProjection(i).project(g);f=`Mercator: ${T.y.toFixed(et)}m, ${T.x.toFixed(et)}m`,t.current.style.width="220px";break}case _e.WGS84:{const y=g.longitude.toFixed(Re);f=`WGS84: ${g.latitude.toFixed(Re)}°N ${y}°E`,t.current.style.width="200px";break}}t.current.innerHTML=f}}}},[r,t,n,e.projection]),o.jsx("div",{className:"trackerPosition",ref:t})},ts="",yt=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],Ui=(e,n,t,r)=>{const s=j.get(r,"METERS_UNIT")??"m",i=j.get(r,"KILOMETERS_UNIT")??"km",h={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:n.lastLegendUpdate},g=new u.EllipsoidGeodesic,f=new Date().getTime();if(f<h.lastLegendUpdate+250)return;h.lastLegendUpdate=f;const y=e.scene.canvas.clientWidth,T=e.scene.canvas.clientHeight,m=e.scene.camera.getPickRay(new u.Cartesian2(y/2|0,T-1)),M=e.scene.camera.getPickRay(new u.Cartesian2(1+y/2|0,T-1)),O=e.scene.globe,_=O.pick(m,e.scene),z=O.pick(M,e.scene);if(!_||!z)return;const Q=O.ellipsoid.cartesianToCartographic(_),$=O.ellipsoid.cartesianToCartographic(z);g.setEndPoints(Q,$);const J=g.surfaceDistance,X=100;let F;for(let ee=yt.length-1;!j.isNumber(F)&&ee>=0;--ee)yt[ee]/J<X&&(F=yt[ee]);if(j.isNumber(F)){let ee="";F>=1e3?ee=`${(F/1e3).toString()} ${i}`:ee=`${F.toString()} ${s}`,h.barWidth=F/J|0,h.distanceLabel=ee}t(h)},vn=e=>{const n=ye(),[t,r]=c.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});c.useEffect(()=>{const i=f=>{Ui(n,t,r,e.locale)},h=new u.EventHelper,g=f=>{n.scene.globe.tilesLoaded&&(i(new MouseEvent("mouse")),h.removeAll())};return h.add(n.scene.globe.tileLoadProgressEvent,g),n.camera.moveEnd.addEventListener(i),()=>{try{j.get(n,"_cesiumWidget")!=null&&n.camera.moveEnd.removeEventListener(i)}catch(f){console.log('CESIUM camera "moveEnd" remove listener failed',f)}}},[n,e.locale,t]);const s=i=>5+(125-i)/2;return o.jsx("div",{className:"scalePosition",children:j.isNumber(t.barWidth)&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"scale-tracker-label",children:o.jsx("bdi",{children:t.distanceLabel})}),o.jsx("div",{className:"scale-tracker-bar",style:{height:"2px",width:`${t.barWidth.toString()}px`,left:`${s(t.barWidth).toString()}px`}})]})})},ns="",En=(e,n)=>{const r=j.get(n.scene.globe,"_surface.tileProvider"),s=r._quadtree,i=n.canvas.height,h=j.get(n.camera.frustum,"sseDenominator")??1;for(let g=0;g<=19;g++)if(r.getLevelMaximumGeometricError(g)*i/(e*h)<s.maximumScreenSpaceError)return g;return null},qi=(e,n)=>{e=e||10;const t=[];let r=1e5,s=0;for(let i=1e8;i>r;i=i-r){const h=En(i,n);if(h===null)break;if(h!==s){let g=i,f=i+r;for(;f-g>e;)i=g+(f-g)/2,En(i,n)===h?g=i:f=i;t.push({level:h,height:Math.round(i)}),s=h,t.length>=2&&(r=(t[t.length-2].height-i)/1e3)}}return t},wn=({locale:e=void 0,valueBy:n="RENDERED_TILES"})=>{const t=ye(),r=We(),[s,i]=c.useState(1),h=qi(1,t),g=c.useCallback(()=>{const m=t.camera,M=.5;let O=0;switch(t.scene.mode){case we.SCENE3D:O=t.scene.mapProjection.ellipsoid.cartesianToCartographic(m.positionWC).height;break;case we.SCENE2D:O=(m.frustum.right-m.frustum.left)*M;break;case we.COLUMBUS_VIEW:O=m.position.z;break;default:O=0;break}if(h.length>0){const _=h.reduce((z,Q)=>Math.abs(Q.height-O)<Math.abs(z.height-O)?Q:z);i(_.level),r.setViewState&&r.setViewState(z=>({...z,currentZoomLevel:_.level}))}},[t,h]),f=c.useCallback(()=>{let m=0;t.scene.globe._surface.forEachRenderedTile(function(M){m=Math.max(m,M.level)}),i(m),r.setViewState&&r.setViewState(M=>({...M,currentZoomLevel:m}))},[t]),T=c.useMemo(()=>({CALCULATION:g,RENDERED_TILES:f}),[g,f])[n];return c.useEffect(()=>{const m=t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded&&T()});return t.camera.moveEnd.addEventListener(T),()=>{try{typeof j.get(t,"_cesiumWidget")<"u"&&(t.camera.moveEnd.removeEventListener(T),m())}catch(M){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',M)}}},[t,T]),o.jsxs("div",{className:"zoomLevel",children:[o.jsx("div",{className:"zoomLevelValue",children:s}),o.jsx("div",{className:"zoomLevelLabel",children:j.get(e,"ZOOM_LABEL")??"zoom"})]})},rs="",ji=()=>{const e=ye(),n=[{onClick:()=>e.camera.zoomIn(),iconPath:"M48 20h-18v-18h-10v18h-18v10h18v18h10v-18h18z"},{onClick:()=>e.camera.zoomOut(),iconPath:"M2 20h46v10h-46z"}];return o.jsx("div",{className:"zoom-buttons-container",children:n.map((t,r)=>o.jsx(Y.Icon,{icon:o.jsx("div",{className:"zoom-button",children:o.jsx("svg",{fill:"#fff",width:"10px",height:"10px",viewBox:"0 -20 50 50",version:"1.2",baseProfile:"tiny",xmlns:"http://www.w3.org/2000/svg",overflow:"inherit",children:o.jsx("path",{d:t.iconPath})})}),onClick:t.onClick},r))})},is="",Sn=212,Tn=260,Ki=0;class Yi extends u.Viewer{constructor(t,r){super(t,r);de(this,"layersManager")}}const vt=c.createContext(null),Zi=vt.Provider,ye=()=>{const e=c.useContext(vt);if(e===null)throw new Error("map context is null, please check the provider");return e.mapViewer},We=()=>{const{mapViewer:e,...n}=c.useContext(vt);if(n===null)throw new Error("map context viewstate is null, please check the provider");return n},Xi=e=>{var b,P,N,G,V,K,oe,ve;const n=c.useRef(null),[t,r]=c.useState(),[s,i]=c.useState(),[h,g]=c.useState(),[f,y]=c.useState(),[T,m]=c.useState(),[M,O]=c.useState(),[_,z]=c.useState(),[Q,$]=c.useState(!1),[J,X]=c.useState(!1),[F,ee]=c.useState(),W=c.useRef(),[Z,ae]=c.useState(),[a,l]=c.useState([]),[w,p]=c.useState(),[C,v]=c.useState(!1),L=c.useRef(),[E,D]=c.useState(void 0),[k,A]=c.useState(!1),[I,x]=c.useState(),[B,ie]=c.useState(),le=c.useMemo(()=>Q||J,[Q,J]),[U,re]=c.useState();c.useEffect(()=>{re({currentZoomLevel:-1,shouldOptimizedTileRequests:e.useOptimizedTileRequests??!1})},[]);const pe={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:!1,sceneModePicker:!1,imageryProvider:!1,...e},fe=(q,te,H,ne,me)=>{const he=t.container,ce=he.clientWidth,Ee=he.clientHeight,Le=ne+me;return{left:`${ce-q<H?q-(H-(ce-q)):q}px`,top:`${Ee-te<Le?te-(Le-(Ee-te)):te}px`}},Ae=c.useCallback(q=>{if(n.current!==null){const te=n.current.cesiumElement,H={x:q.offsetX,y:q.offsetY};v(!1),D(H),x(dn(te,H.x,H.y)),v(!0),L.current=q}},[n]);c.useEffect(()=>{var q;if(n.current!==null){const te=n.current.cesiumElement;e.imageryContextMenu&&(te.scene.canvas.removeEventListener("contextmenu",Ae),te.scene.canvas.addEventListener("contextmenu",Ae))}r((q=n.current)==null?void 0:q.cesiumElement)},[n,e.imageryContextMenu]);const Pe=c.useMemo(()=>{var q;if(t)return{mapViewer:Object.assign(t,{layersManager:new ci(t,(q=e.legends)==null?void 0:q.mapLegendsExtractor,()=>{var te;l((te=t.layersManager)==null?void 0:te.legendsList)},e.layerManagerFootprintMetaFieldPath,U==null?void 0:U.shouldOptimizedTileRequests)}),viewState:U,setViewState:re}},[e.useOptimizedTileRequests,e.legends,e.layerManagerFootprintMetaFieldPath,t,U]);c.useEffect(()=>{ae(e.sceneModes??[we.SCENE2D,we.SCENE3D,we.COLUMBUS_VIEW])},[e.sceneModes]),c.useEffect(()=>{var te,H;p(e.baseMaps);const q=(te=e.baseMaps)==null?void 0:te.maps.find(ne=>ne.isCurrent);q&&t&&((H=t.layersManager)==null||H.setBaseMapLayers(q))},[e.baseMaps,t]),c.useEffect(()=>{i(e.projection??_e.WGS84)},[e.projection]),c.useEffect(()=>{ee(e.locale)},[e.locale]),c.useEffect(()=>{g(e.showMousePosition??!0)},[e.showMousePosition]),c.useEffect(()=>{y(e.showZoomLevel??!0)},[e.showZoomLevel]),c.useEffect(()=>{m(e.showScale??!0)},[e.showScale]),c.useEffect(()=>{O(e.showCompass??!0)},[e.showCompass]),c.useEffect(()=>{z(e.showLoadingProgress??!0)},[e.showLoadingProgress]),c.useEffect(()=>{var te;const q=()=>{if(t===void 0)return{longitude:0,latitude:0,height:0};const H=()=>{const ne=t.camera.positionCartographic;return{longitude:tt(ne.longitude),latitude:tt(ne.latitude),height:ne.height}};if(t.scene.mode===u.SceneMode.SCENE3D){const ne=new u.Cartesian2(t.container.clientWidth/2,t.container.clientHeight/2),me=t.scene.camera.getPickRay(ne),he=t.scene.globe.pick(me,t.scene);if(!he)return{longitude:0,latitude:0,height:0};const ce=t.scene.globe.ellipsoid.cartesianToCartographic(he);return ce!==void 0?{longitude:tt(ce.longitude),latitude:tt(ce.latitude),height:t.scene.camera.positionCartographic.height}:H()}else return H()};t&&(t.camera.moveEnd.addEventListener(()=>{if(t.scene.mode!==u.SceneMode.MORPHING){const H=t.camera,ne={position:q(),direction:H.direction.clone(),up:H.up.clone(),right:H.right.clone(),transform:H.transform.clone(),frustum:H.frustum.clone()};W.current=ne}}),_&&(t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded?$(!1):$(!0)}),(te=t.layersManager)==null||te.addDataLayerUpdatedListener(()=>{var ne;let H=!1;(ne=t.layersManager)==null||ne.dataLayerList.forEach(me=>{if(typeof me.meta.items=="number"&&typeof me.meta.total=="number"&&me.meta.items>0&&me.meta.items<me.meta.total){H=!0;return}}),X(H)})))},[t]),c.useEffect(()=>{const q=()=>{if(t&&W.current){const te=W.current;t.camera.flyTo({destination:u.Cartesian3.fromDegrees(te.position.longitude,te.position.latitude,te.position.height),duration:0})}};return t&&t.scene.morphComplete.addEventListener(q),()=>{if(t)try{t.scene.morphComplete.removeEventListener(q)}catch{console.error("morphCompleteHandler event not cleaned")}}},[t]),c.useEffect(()=>{const q=e.zoom,te=e.center;t&&j.isNumber(q)&&j.isArray(te)&&t.camera.flyTo({destination:u.Cartesian3.fromDegrees(te[0],te[1],Qr(q)),duration:0})},[e.zoom,e.center,t]),c.useEffect(()=>{ie(e.displayZoomButtons??!0)},[e.displayZoomButtons]);const Se=c.useCallback(()=>t&&Jn.createPortal(o.jsxs(o.Fragment,{children:[_&&le&&o.jsx(Y.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),o.jsxs(ue,{className:"sideToolsContainer",children:[e.debugPanel&&o.jsx(Rr,{locale:F,children:e.debugPanel.wfs&&o.jsx(ei,{locale:F,featureTypes:[]})}),o.jsx(zi,{sceneModes:Z,baseMaps:w,locale:F}),o.jsx(ui,{onClick:()=>A(!k)})]}),o.jsxs(ue,{className:"toolsContainer",children:[h&&o.jsx(yn,{projection:s}),f&&o.jsx(wn,{locale:F,valueBy:"RENDERED_TILES"}),T&&o.jsx(vn,{locale:F}),M&&o.jsx($i,{locale:F})]}),B&&o.jsx(ji,{})]}),document.querySelector(".cesium-viewer")),[w,F,t,s,Z,h,T,k,le]);return o.jsx(De.Viewer,{className:"viewer",full:!0,ref:n,...pe,children:o.jsxs(Zi,{value:Pe,children:[o.jsx(pi,{title:(b=e.legends)==null?void 0:b.title,isOpen:k,toggleSidebar:()=>A(!k),noLegendsText:(P=e.legends)==null?void 0:P.emptyText,legends:((N=e.legends)==null?void 0:N.legendsList)??a,actionsTexts:(G=e.legends)==null?void 0:G.actionsTexts}),e.children,Se(),e.imageryContextMenu&&C&&E&&I&&c.cloneElement(e.imageryContextMenu,{data:(V=t==null?void 0:t.layersManager)==null?void 0:V.findLayerByPOI(E.x,E.y,!1),position:{x:E.x,y:E.y},coordinates:I,style:fe(E.x,E.y,((K=e.imageryContextMenuSize)==null?void 0:K.width)??Tn,((oe=e.imageryContextMenuSize)==null?void 0:oe.height)??Sn,((ve=e.imageryContextMenuSize)==null?void 0:ve.dynamicHeightIncrement)??Ki),size:e.imageryContextMenuSize??{height:Sn,width:Tn},handleClose:()=>{v(!C)},contextEvt:L.current})]})})},Ji=0,Qi=e=>{const n=ye();return o.jsx(De.Cesium3DTileset,{...e,onReady:t=>{e.isZoomTo===!0&&n.zoomTo(t);const r=n.scene;r.globe.depthTestAgainstTerrain=!0;const s=u.Cartographic.fromCartesian(t.boundingSphere.center),i=e.heightFromGround??Ji;if(i){const h=u.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),g=u.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+i),f=u.Cartesian3.subtract(g,h,new u.Cartesian3);t.modelMatrix=u.Matrix4.fromTranslation(f)}}})},ot=180,Cn=.001,Ln=e=>Math.abs(e)/e,Mn=e=>{ot-Math.abs(e[0])<Cn&&(e[0]=Ln(e[0])*(ot-1)),ot/2-Math.abs(e[1])<Cn&&(e[1]=Ln(e[1])*(ot/2-1))},bn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(n=>{Mn(n)});break;case"Polygon":e.coordinates.forEach(n=>{n.forEach(t=>{Mn(t)})});break}},Ri=e=>{const{data:n,...t}=e,r=j.cloneDeep(n);return r&&(typeof r.features<"u"?r.features.forEach(s=>{bn(s.geometry)}):bn(r)),o.jsx(De.GeoJsonDataSource,{data:r,...t})},je=e=>{const{meta:n,...t}=e,r=ye();return c.useLayoutEffect(()=>{var s;(s=r.layersManager)==null||s.addMetaToLayer(n,n.searchLayerPredicate)},[n,r]),o.jsx(De.ImageryLayer,{...t})},eo=e=>{const{options:n,...t}=e,r=ye(),{viewState:s}=We(),i=s.shouldOptimizedTileRequests?new gn(n,r):new u.WebMapServiceImageryProvider(n);return o.jsx(je,{...t,imageryProvider:i})},to=e=>{const{options:n,...t}=e,r=ye(),{viewState:s}=We(),i=s.shouldOptimizedTileRequests?new pn(n,r):new u.WebMapTileServiceImageryProvider(n);return o.jsx(je,{...t,imageryProvider:i})},no=e=>{const{options:n,...t}=e,r=ye(),{viewState:s}=We(),i=s.shouldOptimizedTileRequests?new hn(n,r):new u.UrlTemplateImageryProvider(n);return o.jsx(je,{...t,imageryProvider:i})},ro=e=>{const{options:n,...t}=e;return o.jsx(je,{...t,imageryProvider:new u.OpenStreetMapImageryProvider(n)})},io="#FFFF00",oo=e=>{const{options:n,meta:t,visualizationHandler:r}=e,{url:s,featureType:i,style:h,pageSize:g,zoomLevel:f,maxCacheSize:y,keyField:T,labeling:m}=n,{color:M,hover:O}=h,_=ye(),z=We(),Q=c.useRef(z.viewState),$=c.useRef(new Map),J=c.useRef(new Set),X=c.useRef(0),[F,ee]=c.useState(t),W=c.useMemo(()=>u.Color.fromCssColorString(O??"#24AEE9").withAlpha(.5),[O]),Z=c.useMemo(()=>`wfs_${i}_${It.v4()}`,[i]),ae=c.useRef(!1);c.useEffect(()=>{Q.current=z.viewState},[z.viewState]);const a=new u.GeoJsonDataSource(Z),l=b=>{const P=[],N=t.featureStructure;if(N&&N.fields)for(const V of N.fields){const{fieldName:K,aliasFieldName:oe}=V,ve=oe,q=b[K]??"N/A";P.push(`
1
+ (function(d,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@material-ui/pickers"),require("@date-io/date-fns"),require("@material-ui/core/styles"),require("@material-ui/core"),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/boolean-point-in-polygon"),require("@turf/bbox-polygon"),require("@turf/helpers"),require("@turf/point-to-polygon-distance"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("uuid"),require("p-map"),require("@turf/area"),require("@turf/intersect"),require("@turf/centroid"),require("@turf/bbox"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@material-ui/pickers","@date-io/date-fns","@material-ui/core/styles","@material-ui/core","@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/boolean-point-in-polygon","@turf/bbox-polygon","@turf/helpers","@turf/point-to-polygon-distance","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","uuid","p-map","@turf/area","@turf/intersect","@turf/centroid","@turf/bbox","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select"],o):(d=typeof globalThis<"u"?globalThis:d||self,o(d.reactComponents={},d.jsxRuntime,d.React,d.dateFns,d.locale,d.pickers,d.DateFnsUtils,d.styles,d.core,d.reactCore,d.useMediaQuery,d.DatePicker,d.datePickerHebrewLocale,d.moment,d.rewind,d.ol,null,d.coordinate,d.control,d.MousePosition,d.proj,d.layer,d.source,d.format,d.interaction,d.Draw,d.VectorTile,d.style,d.WMTSTileGrid,d.extent,d.OlTileWMS,d.OlXYZ,d.VectorTileSource,d.OlExtLegend,d.OlExtLegendCtrl,null,d.TableHead,d.utils,d.CssBaseline,d.ScopedCssBaseline,d.ReactDOM,d.resium,d.Cesium,d.lodash,d.booleanPointInPolygon,d.bboxPolygon,d.turf,d.pointToPolygonDistance,d.viewerCesiumNavigationMixin,null,null,d.uuid,d.pMap,d.area,d.intersect,d.centroid,d.bbox,d.getCaretCoordinates,d.getInputSelection,d.chonky,d.chonkyIconFontawesome,d.filesize,d.Select))})(this,function(d,o,c,Me,Ke,Ge,wt,Oe,se,Y,Fn,St,Vn,He,Gn,Tt,Vo,Ct,at,lt,Lt,Mt,ct,dt,Hn,Wn,zn,Ye,$n,bt,Un,qn,jn,Pt,Kn,Go,Yn,_t,Zn,Xn,Jn,De,u,j,Qn,Ze,Dt,Rn,er,Ho,Wo,It,ut,Ot,At,tr,kt,nr,xt,R,rr,ir,Nt){"use strict";var Bo=Object.defineProperty;var Fo=(d,o,c)=>o in d?Bo(d,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[o]=c;var de=(d,o,c)=>(Fo(d,typeof o!="symbol"?o+"":o,c),c);function ht(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const Bt=ht(c),S=ht(u),Ft=ht(Dt);var Te=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(Te||{}),be=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(be||{}),Xe=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Xe||{});const ge={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:be.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:be.EN},renderAsButton:!0,offset:0,disableFuture:!0}},ue=e=>{const{children:n,...t}=e;return o.jsx(se.Box,{...t,children:n})},Je=e=>{const n=e.type==="dark";return c.useMemo(()=>Vt(e,n),[n,e])},Vt=(e,n=!1)=>Oe.createTheme({palette:{type:n?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:n?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:n?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zo="",or=2,sr=.5,ar=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(or),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(sr)}})),Gt=e=>{var X,F,ee,W;const n=ar(),t=Y.useTheme(),r=Je(t),[s,i]=c.useState(null),[h,g]=c.useState(null),[f,y]=c.useState(ge.DATE_RANGE_PICKER.dateFormat),T=e.controlsLayout??ge.DATE_RANGE_PICKER.controlsLayout,m=e.disableFuture??ge.DATE_RANGE_PICKER.disableFuture,M=((X=e.local)==null?void 0:X.startPlaceHolderText)??ge.DATE_RANGE_PICKER.local.startPlaceHolderText,O=((F=e.local)==null?void 0:F.endPlaceHolderText)??ge.DATE_RANGE_PICKER.local.endPlaceHolderText,_=((ee=e.local)==null?void 0:ee.setText)??ge.DATE_RANGE_PICKER.local.setText,Q=(((W=e.local)==null?void 0:W.calendarLocale)??ge.DATE_RANGE_PICKER.local.calendarLocale)===be.HE?Ke.he:Ke.enUS;c.useEffect(()=>{i(e.from??null)},[e.from]),c.useEffect(()=>{g(e.to??null)},[e.to]),c.useEffect(()=>{y(e.dateFormat??ge.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const $=Boolean(Me.isValid(s)&&!h||Me.isValid(h)&&!s||s&&h&&Me.isValid(s)&&Me.isValid(h)&&Me.isBefore(s,h)),J=()=>{e.onChange({from:s&&Me.isValid(s)?s:void 0,to:h&&Me.isValid(h)?h:void 0})};return o.jsx(se.ThemeProvider,{theme:r,children:o.jsx(ue,{className:`${n.container} drpContainer`,display:"flex",flexDirection:T,width:T==="column"?e.contentWidth:"unset",children:o.jsxs(Ge.MuiPickersUtilsProvider,{utils:wt,locale:Q,children:[o.jsx(Ge.KeyboardDateTimePicker,{variant:"inline",placeholder:M,onChange:Z=>i(Z),value:s,disableFuture:m,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(Ge.KeyboardDateTimePicker,{variant:"inline",placeholder:O,className:n.margin,onChange:Z=>g(Z),value:h,disableFuture:m,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(Y.ThemeProvider,{options:t,children:o.jsx(Y.Button,{className:`${n.setButton} ${n.margin}`,raised:!0,onClick:J,disabled:!$,children:_})})]})})})},Ht=e=>{const{children:n,...t}=e;return o.jsx(se.Popover,{...t,children:n})},$o="",lr=e=>{var F,ee;const[n,t]=c.useState(null),[r,s]=c.useState(null),[i,h]=c.useState(ge.DATE_RANGE_PICKER.dateFormat),[g,f]=c.useState(null),y=W=>{f(W.currentTarget)},T=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},m=()=>{f(null)},M=Boolean(g),O=e.controlsLayout??"column";c.useEffect(()=>{t(e.from??null)},[e.from]),c.useEffect(()=>{s(e.to??null)},[e.to]),c.useEffect(()=>{h(e.dateFormat??ge.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const _=((F=e.local)==null?void 0:F.startPlaceHolderText)??ge.DATE_RANGE_PICKER.local.startPlaceHolderText,z=((ee=e.local)==null?void 0:ee.endPlaceHolderText)??ge.DATE_RANGE_PICKER.local.endPlaceHolderText,Q=e.renderAsButton===void 0?ge.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,$=e.offset===void 0?ge.DATE_RANGE_PICKER.offset:e.offset,J=e.disableFuture===void 0?ge.DATE_RANGE_PICKER.disableFuture:e.disableFuture,X=c.useMemo(()=>`${n?Me.format(n,i):_} - ${r?Me.format(r,i):z}`,[n,r,i,_,z]);return o.jsxs(o.Fragment,{children:[Q?o.jsx(Y.Button,{style:{width:e.width},raised:!0,onClick:y,className:"drpOpener",children:X}):o.jsx(Y.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:X,onClick:T,trailingIcon:{icon:"date_range",tabIndex:0,onClick:T}}),o.jsx(Ht,{open:M,anchorEl:g,onClose:m,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:o.jsx(Gt,{controlsLayout:O,contentWidth:((g==null?void 0:g.clientWidth)??0)-$,dateFormat:i,disableFuture:J,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:n??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{t(W??null),s(Z??null),e.onChange({from:W,to:Z}),m()}})})]})},Qe=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,cr=({endDate:e,startDate:n,setEndDate:t=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:i="",endTimeWrapperClassName:h="",timeRangeInputsWrapperClassName:g="",startTimeInputClassName:f="",startTimeLabel:y="",startTimeWrapperClassName:T=""})=>o.jsxs("div",{className:`timeRangeWrapper ${g}`,children:[o.jsx("div",{className:`startTimeWrapper ${T}`,children:o.jsx(Y.TextField,{label:y,disabled:n===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:He(n).format("HH:mm"),onChange:m=>{const M=He(n),O=He(m.currentTarget.value,"HH:mm"),_=M.set({hours:O.get("hours"),minutes:O.get("minutes")});r(_.toDate())}})}),o.jsx("div",{className:`endTimeWrapper ${h}`,children:o.jsx(Y.TextField,{label:i,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:He(e).format("HH:mm"),onChange:m=>{const M=He(e),O=He(m.currentTarget.value,"HH:mm"),_=M.set({hours:O.get("hours"),minutes:O.get("minutes")});t(_.toDate())}})})]}),dr=c.forwardRef(({value:e,onClick:n,onInputClick:t,...r},s)=>o.jsx(Y.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:i=>{n==null||n(i),t==null||t()},ref:s,value:e})),ur=({setStartDate:e=()=>{},setEndDate:n=()=>{},shortcuts:t,dateRange:r,onShortcut:s})=>{const[i,h]=c.useState(),g=c.useMemo(()=>t.map(f=>f instanceof Function?f():f),[t]);return c.useEffect(()=>{for(const f of g){const y=r.startDate&&r.endDate&&Me.isSameDay(f.startDate,r.startDate)&&Me.isSameDay(f.endDate,r.endDate);i?f.id===i&&(y||h(void 0)):y&&h(f.id)}},[r,i,g]),o.jsx("div",{className:"shortcutsContainer",children:g.map((f,y)=>{const T=()=>{e(f.startDate),n(f.endDate)};return o.jsx(Y.Button,{type:"button",className:`shortcut ${i===f.id?"selected":""}`,onClick:m=>{T(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+y)})})},hr=c.forwardRef((e,n)=>{const{calendarClassName:t,dayClassName:r,monthClassName:s,selectsRange:i,onChange:h,inputName:g,showMonthYearDropdown:f,withShortcuts:y,locale:T="en"}=e,[m,M]=c.useState(null),[O,_]=c.useState(null),[z,Q]=c.useState(!1),$=i?{startDate:m,endDate:O}:m;c.useEffect(()=>{T==="he"&&St.registerLocale("he",Vn)},[T]),c.useEffect(()=>{var F,ee;((F=e.startDate)==null?void 0:F.toString())!==(m==null?void 0:m.toString())&&M(e.startDate),((ee=e.endDate)==null?void 0:ee.toString())!==(O==null?void 0:O.toString())&&_(e.endDate)},[e.startDate,e.endDate,m,O]);const J=c.useMemo(()=>{let F="pickerContainer"+(T==="he"?" pickerContainer-rtl":"");return y&&i&&(F+=" pickerContainer-withShortcuts"),F},[T,y,i]),X=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return o.jsx("div",{className:J,style:{direction:T==="he"?"rtl":"ltr"},children:o.jsx(St,{...e,ref:n,onClickOutside:()=>Q(!1),open:z,startDate:Qe($)?m:void 0,selected:m,endDate:Qe($)?O:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${t}`,weekDayClassName:F=>`pickerWeek ${(r==null?void 0:r(F))??""}`,dayClassName:F=>`pickerDay ${(r==null?void 0:r(F))??""}`,monthClassName:F=>`pickerMonth ${(s==null?void 0:s(F))??""}`,onChange:(F,ee)=>{if(Array.isArray(F)){const[W,Z]=F;M(W),_(Z),h==null||h({startDate:W,endDate:Z&&Me.endOfDay(Z)},ee)}else M(F),h==null||h(F,ee)},customInput:o.jsx(dr,{name:g,onInputClick:()=>{Q(!0)}}),showTimeInput:!!(y&&i),timeInputLabel:"",customTimeInput:y&&Qe($)&&o.jsx(ur,{onShortcut:F=>{h==null||h(F),Q(!1)},shortcuts:y,setEndDate:_,setStartDate:M,dateRange:$}),showMonthYearDropdown:void 0,...X})})}),Uo="",gr=e=>{const n=Y.useTheme(),t=Je(n),{format:r=ge.DATE_PICKER.dateFormat,variant:s=ge.DATE_PICKER.variant,disableFuture:i=ge.DATE_PICKER.disableFuture,local:h,onChange:g,showTime:f=ge.DATE_PICKER.showTime,value:y,...T}=e,{placeHolderText:m=ge.DATE_PICKER.local.placeHolderText,calendarLocale:M}=h??{placeHolderText:ge.DATE_PICKER.local.placeHolderText,calendarLocale:be.EN},O=M===be.HE?Ke.he:Ke.enUS,_=z=>{g(z)};return o.jsx(se.ThemeProvider,{theme:t,children:o.jsxs(Ge.MuiPickersUtilsProvider,{utils:wt,locale:O,children:[f&&o.jsx(Ge.KeyboardDateTimePicker,{variant:s,placeholder:m,onChange:_,value:y,disableFuture:i,format:r,...T}),!f&&o.jsx(Ge.KeyboardDatePicker,{variant:s,placeholder:m,onChange:_,value:y,disableFuture:i,format:r,...T})]})})},pr=18,fr=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(pr)},fullWidth:{width:"100%",marginTop:"36px"}})),mr=e=>{const n=fr(),[t,r]=c.useState(null),{isSelectionEnabled:s,onCancelDraw:i,onStartDraw:h,onReset:g}=e,f=T=>{r(T.currentTarget)},y=()=>{r(null)};return s?o.jsx(Y.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:o.jsx(Y.Button,{className:n.drawingButton,raised:!0,onClick:i,children:"Cancel Draw"})}):o.jsxs(ue,{position:"relative",children:[o.jsx(Y.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:o.jsx(Y.Button,{className:n.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),o.jsxs(Y.Menu,{className:n.fullWidth,open:Boolean(t),onClose:y,children:[o.jsx(Y.MenuItem,{onClick:()=>{h(Te.POLYGON),y()},children:"Polygon"}),o.jsx(Y.MenuItem,{onClick:()=>{h(Te.BOX),y()},children:"Box"}),o.jsx(Y.MenuItem,{onClick:()=>{g(),y()},children:"Clear"})]})]})},qo="";var _e=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(_e||{});const Re=5,et=2,Wt=c.createContext(null),yr=Wt.Provider,zt=35,$t=32,vr=10,Er=e=>e!==void 0&&e!==_e.WGS84?Lt.transform([zt,$t],_e.WGS84,e):[zt,$t],wr=e=>{switch(e){case _e.WEB_MERCATOR:return n=>Ct.format(n,"Mercator: {y}m, {x}m",et);case _e.WGS84:return n=>Ct.format(n,"WGS84: {y}°N {x}°E",Re);default:return n=>""}},Fe=()=>{const e=c.useContext(Wt);if(e===null)throw new Error("map context is null, please check the provider");return e},Ut=e=>{const n=c.useRef(null),{allowFullScreen:t,showMousePosition:r,projection:s}=e,[i]=c.useState(new Tt.Map({view:new Tt.View({projection:s??_e.WGS84}),controls:at.defaults()}));c.useEffect(()=>{i.getView().setCenter(e.center??Er(e.projection))},[i,e.center,e.projection]),c.useEffect(()=>{i.getView().setZoom(e.zoom??vr)},[i,e.zoom,e.projection]);const h=(g,f)=>{f.getControls().forEach(T=>{T instanceof g&&f.removeControl(T)})};return c.useEffect(()=>{i.setTarget(n.current),t!==void 0&&t?i.addControl(new at.FullScreen):h(at.FullScreen,i)},[i,t]),c.useEffect(()=>{r!==void 0&&r?(h(lt,i),i.addControl(new lt({coordinateFormat:wr(s??_e.WGS84),projection:s??_e.WGS84,undefinedHTML:"&nbsp;"}))):h(lt,i)},[i,r,s]),o.jsxs(yr,{value:i,children:[o.jsx("div",{className:"map",ref:n}),e.children]})},qt=c.createContext(null),Sr=qt.Provider,qe=()=>{const e=c.useContext(qt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},jt=({options:e,children:n})=>{const t=Fe(),[r]=c.useState(new Mt.Tile(e));return c.useEffect(()=>(t.addLayer(r),()=>{t.removeLayer(r)}),[t,r]),o.jsx(Sr,{value:r,children:n})},Kt=c.createContext(null),Tr=Kt.Provider,Yt=()=>{const e=c.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Zt=({children:e})=>{const n=Fe(),[t]=c.useState(new Mt.Vector);return c.useEffect(()=>(n.addLayer(t),()=>{n.removeLayer(t)}),[n,t]),o.jsx(Tr,{value:t,children:e})},Xt=c.createContext(null),Cr=Xt.Provider,Jt=()=>{const e=c.useContext(Xt);if(e===null)throw new Error("vector source context is null, please check the provider");return e},Qt=({children:e})=>{const n=Yt(),[t]=c.useState(new ct.Vector);return c.useEffect(()=>{n.setSource(t)},[t,n]),o.jsx(Cr,{value:t,children:e})},Rt=({geometry:e,fitOptions:n,fit:t,featureStyle:r})=>{const s=Jt(),i=Fe();return c.useLayoutEffect(()=>{const g=new dt.GeoJSON().readFeature(e);return t&&s.on("addfeature",function(){i.getView().fit(s.getExtent(),n)}),r&&g.setStyle(r),s.addFeature(g),()=>{s.removeFeature(g)}},[e,s,t]),null},en=e=>{const n=qe();return c.useEffect(()=>{n.setSource(new ct.OSM)},[n]),null},tn=({drawType:e,onPolygonSelected:n})=>{const t=Fe();return c.useEffect(()=>{const r={type:"Circle"};switch(e){case Te.BOX:r.geometryFunction=Wn.createBox();break;case Te.POLYGON:r.type="Polygon";break;default:return}const s=new Hn.Draw(r);t.addInteraction(s);const i=h=>{const f=new dt.GeoJSON().writeGeometryObject(h.feature.getGeometry());n==null||n(f)};return s.on("drawend",i),()=>{s.un("drawend",i),t.removeInteraction(s)}},[n,e,t]),null},jo="",Lr=e=>{const n=t=>{const r=Gn(t);e.onPolygonSelection(r)};return o.jsxs(Ut,{allowFullScreen:!0,showMousePosition:!0,children:[o.jsx(jt,{children:o.jsx(en,{})}),e.selectionPolygon&&o.jsx(Zt,{children:o.jsx(Qt,{children:o.jsx(Rt,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&o.jsx(tn,{drawType:e.drawType,onPolygonSelected:n})]})},gt=1.5,Mr=80,br=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(gt),top:e.spacing(gt)},contentContainer:{marginTop:e.spacing(gt),width:e.spacing(Mr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),Pr=e=>{var f;const[n,t]=c.useState(),[r,s]=c.useState(),i=br(),h=y=>{s(y),t(void 0),e.handlePolygonSelected(y)},g=()=>{s(void 0),e.handlePolygonReset()};return o.jsxs("div",{className:i.map,children:[o.jsxs("div",{className:`${i.absolute}`,children:[o.jsxs(se.Paper,{className:i.filtersContainer,children:[o.jsx(mr,{onCancelDraw:()=>t(void 0),onReset:g,onStartDraw:t,isSelectionEnabled:n!==void 0}),(f=e.filters)==null?void 0:f.map((y,T)=>o.jsx("div",{className:i.filtersMargin,children:y},T))]}),o.jsx(se.Paper,{color:"red",className:`${i.contentContainer}`,children:e.children})]}),o.jsx(Lr,{children:e.mapContent,onPolygonSelection:h,drawType:n,selectionPolygon:r})]})},nn=new Ye.Fill({color:"rgba(255,255,255,0.4)"}),rn=new Ye.Stroke({color:"#3399CC",width:1.25}),on=[new Ye.Style({image:new Ye.Circle({fill:nn,stroke:rn,radius:5}),fill:nn,stroke:rn})],sn=c.createContext(null),_r=sn.Provider,an=()=>{const e=c.useContext(sn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},Dr=({children:e,options:n,style:t})=>{const r=Fe(),[s]=c.useState(new zn({...n,style:t||on}));return c.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),c.useEffect(()=>{s.setStyle(t||on)},[s,t]),o.jsx(_r,{value:s,children:e})},pt=20,Ir=256,Or=2,Ar=2,kr="REST",xr=e=>{const n=Lt.get(e.projection),t=n.getExtent(),r=new Array(pt),s=new Array(pt),i=bt.getWidth(t)/Ir,h=e.heightWidthRatio!==void 0?e.heightWidthRatio:Ar,g=e.requestEncoding!==void 0?e.requestEncoding:kr;for(let y=0;y<pt;++y)r[y]=i/Math.pow(Or,y)/h,s[y]=y.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:n,tileGrid:new $n({origin:bt.getTopLeft(t),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:g,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Nr=e=>{const n=qe(),{options:t}=e;return c.useEffect(()=>{n.setSource(new ct.WMTS(t))},[n,t]),null},Br=e=>{const{attributions:n,url:t,params:r,serverType:s,transition:i}=e;return{attributions:n,url:t,params:r,serverType:s,transition:i}},Fr=e=>{const n=qe(),{options:t}=e;return c.useEffect(()=>{n.setSource(new Un(t))},[n,t]),null},Vr=e=>{const{attributions:n,url:t}=e;return{attributions:n,url:t}},Gr=e=>{const n=qe(),{options:t}=e;return c.useEffect(()=>{n.setSource(new qn(t))},[n,t]),null},Hr=c.createContext(null),Wr=()=>{const e=c.useContext(Hr);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},zr=e=>{const{url:n}=e;return{url:n,format:new dt.MVT}},$r=({children:e,options:n})=>{const t=an();return c.useEffect(()=>{t.setSource(new jn(n))},[n,t]),null},Ur=({legendItems:e,title:n,isCollapsed:t})=>{const r=Fe();return c.useEffect(()=>{const s=new Pt({title:n??"",margin:5,maxWidth:300}),i=new Kn({legend:s,collapsed:t===void 0?!0:t});r.addControl(i);const h=new Pt({margin:4});return e.forEach(g=>{h.addItem({title:g.title,style:g.style,typeGeom:"Polygon"})}),s.addItem(h),()=>{r.removeControl(i)}},[r,e,n,t]),o.jsx(o.Fragment,{})};function qr(e){const{headCells:n,order:t,orderBy:r,onRequestSort:s,isCollapseable:i}=e,h=g=>f=>{s(f,g)};return o.jsx(Yn,{children:o.jsxs(se.TableRow,{children:[i&&o.jsx(se.TableCell,{}),n.map(g=>o.jsx(se.TableCell,{align:g.numeric?"right":"left",padding:g.disablePadding?"none":"default",sortDirection:r===g.id?t:!1,children:o.jsx(se.TableSortLabel,{active:r===g.id,direction:r===g.id?t:"asc",onClick:h(g.id),children:g.label})},g.id))]})})}const jr=_t.createSvgIcon(Bt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),Kr=_t.createSvgIcon(Bt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function Yr(e){const{cellsMetadata:n,isRowSelected:t,item:r,onRowSelected:s,rowIndex:i,isCollapseable:h,collapsedElement:g}=e,[f,y]=c.useState(!1),T=n.length,m=()=>{s==null||s(i)};return o.jsxs(o.Fragment,{children:[o.jsxs(se.TableRow,{hover:!0,selected:t,onClick:m,children:[h&&o.jsx(se.TableCell,{padding:"checkbox",children:o.jsx(se.IconButton,{"aria-label":"expand row",size:"small",onClick:M=>{M.stopPropagation(),y(!f)},children:f?o.jsx(Kr,{}):o.jsx(jr,{})})}),n.map(M=>o.jsx(se.TableCell,{align:M.numeric?"right":"left",padding:M.disablePadding?"none":"default",children:M.transform?M.transform(r[M.id]):r[M.id]},M.id+i.toString()))]}),h&&o.jsx(se.TableRow,{children:o.jsx(se.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:T+1,children:o.jsx(se.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:g==null?void 0:g(r)})})})]})}function Zr(e){const[n,t]=c.useState(""),[r,s]=c.useState("asc"),{cellsMetadata:i,items:h,onRequestSort:g,onRowSelected:f,isCollapseable:y,collapsedElement:T,isDense:m,page:M,rowsPerPage:O,count:_,handleChangePage:z,handleChangeRowsPerPage:Q}=e,$=(J,X)=>{const F=n===X&&r==="asc";s(F?"desc":"asc"),t(X),g(X,F?"desc":"asc")};return o.jsxs(se.TableContainer,{component:se.Paper,children:[o.jsxs(se.Table,{size:m?"small":"medium",children:[o.jsx(qr,{headCells:i,onRequestSort:$,order:r,orderBy:n,isCollapseable:y}),o.jsxs(se.TableBody,{children:[h.map((J,X)=>o.jsx(Yr,{item:J,rowIndex:X,isCollapseable:y,cellsMetadata:i,collapsedElement:T,isRowSelected:!1,onRowSelected:f},X)),(h.length===0||O>h.length)&&o.jsx(se.TableRow,{style:{height:(m?33:53)*(O-h.length)},children:o.jsx(se.TableCell,{colSpan:y?i.length+1:i.length,children:h.length===0&&o.jsx(se.Typography,{align:"center",children:"No results :("})})})]})]}),o.jsx(se.TablePagination,{rowsPerPage:O,rowsPerPageOptions:[5,10],component:"div",count:_,page:M,onPageChange:z,onRowsPerPageChange:Q})]})}const Xr=e=>{const{children:n,...t}=e;return o.jsx(Zn,{...t,children:n})},Jr=e=>{const{children:n,...t}=e;return o.jsx(Xn,{...t,children:n})},ln=e=>e*Math.PI/180,tt=e=>e*(180/Math.PI),Qr=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(ln(85.362/2))/Math.sin(ln(85.362/2))),Ko="",Rr=({children:e,locale:n})=>{var f;const[t,r]=c.useState(!1),[s,i]=c.useState([]),h=c.useMemo(()=>j.get(n,"DEBUG_PANEL_TITLE")??"Debugger Tool",[n]),g=ye();return c.useEffect(()=>{if(!g.layersManager)return;const y=(T,m)=>{var O;T.forEach(_=>{if(m!==void 0&&m!==_.meta.id)return;const{options:z,meta:Q}=_,{zoomLevel:$}=z,{id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z}=Q;i(ae=>{const a=ae.findIndex(l=>l.id===J);if(a>=0){if(JSON.stringify(ae[a])!==JSON.stringify({id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z,zoomLevel:$})){const l=[...ae];return l[a]={id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z,zoomLevel:$},l}}else return[...ae,{id:J,items:X,total:F,cache:ee,currentZoomLevel:W,featureStructure:Z,zoomLevel:$}];return ae})});const M=new Set((O=g.layersManager)==null?void 0:O.dataLayerList.map(_=>_.meta.id));i(_=>_.filter(z=>M.has(z.id)))};return g.layersManager.addDataLayerUpdatedListener(y),()=>{var T;(T=g.layersManager)==null||T.removeDataLayerUpdatedListener(y)}},[(f=g.layersManager)==null?void 0:f.dataLayerList]),o.jsxs(o.Fragment,{children:[o.jsx(Y.Icon,{icon:o.jsx("div",{className:"debugPanelIconContainer",children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:o.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"})})}),onClick:()=>{r(!t)}}),t&&o.jsx("div",{className:"debugPanel",children:o.jsxs(Y.Dialog,{open:t,onClosed:()=>{r(!1)},children:[o.jsx(Y.DialogTitle,{className:"title",children:h}),o.jsx(Y.DialogContent,{children:c.Children.map(e,y=>c.isValidElement(y)?c.cloneElement(y,{featureTypes:s}):y)})]})})]})},Yo="",ei=({featureTypes:e,locale:n})=>{const t=c.useMemo(()=>j.get(n,"WFS_TITLE")??"Data Layers",[n]),r=c.useMemo(()=>j.get(n,"WFS_CACHE")??"Cache",[n]),s=c.useMemo(()=>j.get(n,"WFS_EXTENT")??"Extent",[n]),i=c.useMemo(()=>j.get(n,"NO_DATA_LAYERS")??"No layers found",[n]),h=c.useMemo(()=>o.jsx(ue,{className:"title",children:t}),[t]),g=c.useMemo(()=>o.jsx(o.Fragment,{children:e.length>0?e.map((f,y)=>o.jsxs(ue,{className:"featureType",children:[o.jsx(Y.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:o.jsxs(ue,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),o.jsxs(ue,{className:"info",children:[o.jsxs(ue,{children:[r,": ",f.cache??0]}),f.total>0&&o.jsxs(ue,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},y)):o.jsx(ue,{children:i})}),[e]);return o.jsxs(ue,{className:"wfsContainer",children:[h,g]})},cn=(e,n,t)=>{let r;if(e.scene.mode!==u.SceneMode.SCENE2D)r=e.scene.pickPosition(new u.Cartesian2(n,t));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new u.Cartesian2(n,t),s)}return u.Cartographic.fromCartesian(r)},ti=(e,n,t)=>{const r=cn(e,n,t);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[u.Math.toDegrees(r.longitude),u.Math.toDegrees(r.latitude)]}}},dn=(e,n,t)=>{try{const r=cn(e,n,t);return{longitude:u.Math.toDegrees(r.longitude),latitude:u.Math.toDegrees(r.latitude)}}catch{return}},Ie=document.createElement("canvas"),Ce=Ie.getContext("2d"),un=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},ni=async(e,n)=>(n&&n.tileTransparencyCheckedCounter++,new Promise((t,r)=>{try{Ce==null||Ce.clearRect(0,0,Ie.width,Ie.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){Ie.width=e.width,Ie.height=e.height,Ce==null||Ce.drawImage(e,0,0);const i=Ce==null?void 0:Ce.getImageData(0,0,Ie.width,Ie.height),h=un(i);h&&n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(h);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{Ie.width=s.width,Ie.height=s.height,Ce==null||Ce.drawImage(s,0,0);const i=Ce==null?void 0:Ce.getImageData(0,0,Ie.width,Ie.height);un(i)?(n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(!0)):t(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,n)=>{const{west:t,east:r,north:s,south:i}=e,{west:h,east:g,north:f,south:y}=n;return t>=h&&r<=g&&s<=f&&i>=y},ri=(e,n)=>Rn(e,Ze(n)),ii=e=>{const n=(u.Math.toDegrees(e.west)+u.Math.toDegrees(e.east))/2,t=(u.Math.toDegrees(e.south)+u.Math.toDegrees(e.north))/2;return Dt.point([n,t])},oi=e=>[u.Math.toDegrees(e.west),u.Math.toDegrees(e.south),u.Math.toDegrees(e.east),u.Math.toDegrees(e.north)],si=(e,n=100)=>{const t=e.scene,r=e.camera,s=t.mode,i=r.computeViewRectangle(t.globe.ellipsoid);if(!u.defined(i)||!i){console.error("computeViewRectangle returned invalid rectangle.");return}if(s===u.SceneMode.SCENE2D)return i;const h=r.positionCartographic;if(!u.defined(h)){console.error("Camera position is undefined in 3D mode.");return}const g=h.latitude,f=h.longitude;if(g<-u.Math.PI_OVER_TWO||g>u.Math.PI_OVER_TWO||f<-u.Math.PI||f>u.Math.PI){console.error("Invalid latitude or longitude values.");return}const y=111320,T=111320*Math.cos(g);let m=n/y,M=n/T;const O=u.Cartesian3.magnitude(r.positionWC);O>1e7&&(m=10,M=10);const _=r.frustum instanceof u.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let z=1;O<5e5?z=.05:O<2e6&&(z=.1),m*=z*(_/Math.PI),M*=z*(_/Math.PI);const Q=r.pitch;if(Q===void 0)return;const $=Math.PI/4,J=Math.max(0,1-Math.abs(Q)/$);m*=J,M*=J;const X=5e-4;m=Math.max(m,X),M=Math.max(M,X);const F=h.latitude-m,ee=h.latitude+m,W=h.longitude-M,Z=h.longitude+M,ae=u.Math.clamp(F,i.south,i.north),a=u.Math.clamp(ee,i.south,i.north),l=u.Math.clamp(W,i.west,i.east),w=u.Math.clamp(Z,i.west,i.east),p=Math.min(1,Q/u.Math.PI_OVER_TWO),C=i.north-(i.north-i.south)*p,v=Math.min(a,C);return new u.Rectangle(u.Math.negativePiToPi(l),u.Math.clamp(ae,-u.Math.PI_OVER_TWO,u.Math.PI_OVER_TWO),u.Math.negativePiToPi(w),u.Math.clamp(v,-u.Math.PI_OVER_TWO,u.Math.PI_OVER_TWO))},rt=3,it="hasTransparency";function ft(e,n,t,r,s){return setTimeout(()=>{var g;const i=(g=this.layerListInstance.find(f=>{var y,T;return((y=f._imageryProvider._resource)==null?void 0:y._url)===((T=this._resource)==null?void 0:T._url)}))==null?void 0:g.meta,h=j.get(i,it)===!0;this.tileTransparencyCheckedCounter<rt&&!h&&ni(s==null?void 0:s.url,this).then(f=>{var y;(y=this.mapViewer.layersManager)==null||y.addMetaToLayer({[it]:f},T=>T._imageryProvider._resource._url===this._resource._url)})},0),e(n,t,r,s)}class hn extends u.UrlTemplateImageryProvider{constructor(t,r){var s;super(t);de(this,"layerListInstance");de(this,"mapViewer");de(this,"maxTilesForTransparencyCheck",rt);de(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return ft.call(this,super.requestImage.bind(this),t,r,s,i)}}class gn extends u.WebMapServiceImageryProvider{constructor(t,r){var s;super(t);de(this,"layerListInstance");de(this,"mapViewer");de(this,"maxTilesForTransparencyCheck",rt);de(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return ft.call(this,super.requestImage.bind(this),t,r,s,i)}}class pn extends u.WebMapTileServiceImageryProvider{constructor(t,r){var s;super(t);de(this,"layerListInstance");de(this,"mapViewer");de(this,"maxTilesForTransparencyCheck",rt);de(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return ft.call(this,super.requestImage.bind(this),t,r,s,i)}}const ai=1,li=-1,fn="TRANSPARENT_BASE_LAYER";class ci{constructor(n,t,r,s,i){de(this,"mapViewer");de(this,"legendsList");de(this,"layerUpdated");de(this,"dataLayerUpdated");de(this,"layers");de(this,"dataLayers");de(this,"legendsExtractor");de(this,"layerManagerFootprintMetaFieldPath");de(this,"shouldOptimizedTileRequests");this.mapViewer=n,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=t,this.layerUpdated=new u.Event,this.dataLayerUpdated=new u.Event,this.layerManagerFootprintMetaFieldPath=s,this.shouldOptimizedTileRequests=i??!1,r&&this.layerUpdated.addEventListener(r,this),this.shouldOptimizedTileRequests&&(this.layerUpdated.addEventListener(h=>{const g=Object.keys(h);g.length===1&&g[0]===it&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())}),this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}))}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}addDataLayer(n){this.dataLayers.push({...n}),this.dataLayerUpdated.raiseEvent(this.dataLayers)}addMetaToLayer(n,t){const r=this.layers.map(s=>s.imageryProvider.readyPromise);Promise.all(r).then(s=>{const i=this.layers.find(t);i&&(i.meta={...i.meta??{},...n},this.setLegends(),this.layerUpdated.raiseEvent(n))})}addMetaToDataLayer(n){const t=this.findDataLayerById(n.id);t&&(t.meta={...t.meta??{},...n},this.dataLayerUpdated.raiseEvent(this.dataLayers,n.id))}setBaseMapLayers(n){n.baseRasteLayers.sort((r,s)=>r.zIndex-s.zIndex).forEach((r,s)=>{this.addRasterLayer(r,s,n.id)}),this.shouldOptimizedTileRequests&&(this.removeLayer(fn),this.addTransparentImageryProvider())}addRasterLayer(n,t,r){let s;switch(n.type){case"XYZ_LAYER":{const i=n.options,h=this.shouldOptimizedTileRequests?new hn(i,this.mapViewer):new u.UrlTemplateImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(h,t);break}case"WMS_LAYER":{const i=n.options,h=this.shouldOptimizedTileRequests?new gn(i,this.mapViewer):new u.WebMapServiceImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(h,t);break}case"WMTS_LAYER":{const i=n.options,h=this.shouldOptimizedTileRequests?new pn(i,this.mapViewer):new u.WebMapTileServiceImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(h,t);break}}s&&(s.alpha=n.opacity,s.meta={parentBasetMapId:r,...n},n.show!==void 0&&(s.show=n.show))}removeLayer(n){const t=this.findLayerById(n);t&&this.mapViewer.imageryLayers.remove(t,!0)}removeDataLayer(n){const t=this.findDataLayerById(n);if(t){const r=this.dataLayers.indexOf(t);r>-1&&this.dataLayers.splice(r,1),this.dataLayerUpdated.raiseEvent(this.dataLayers)}}removeBaseMapLayers(){this.layers.filter(t=>!!j.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}removeNotBaseMapLayers(){this.layers.filter(t=>!j.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}raise(n,t=1){const r=this.findLayerById(n),s=(r==null?void 0:r.meta).zIndex;if(r)for(let i=0;i<t;i++)this.mapViewer.imageryLayers.raise(r);this.updateLayersOrder(n,s,s+t)}lower(n,t=1){const r=this.findLayerById(n),s=(r==null?void 0:r.meta).zIndex,i=this.getBaseLayersCount(),h=this.mapViewer.imageryLayers.indexOf(r);if(h-t<=i&&(t=h-i),r)for(let g=0;g<t;g++)this.mapViewer.imageryLayers.lower(r);this.updateLayersOrder(n,s,s-t)}raiseToTop(n){const t=this.findLayerById(n),r=(t==null?void 0:t.meta).zIndex;t&&this.mapViewer.imageryLayers.raiseToTop(t),this.updateLayersOrder(n,r,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(n){const t=this.findLayerById(n),r=this.getBaseLayersCount(),s=this.mapViewer.imageryLayers.indexOf(t);this.lower(n,s-r)}length(){return this.mapViewer.imageryLayers.length}show(n,t){const r=this.get(n);r!==void 0&&(r.show=t)}showAllNotBase(n){this.layers.filter(r=>!j.get(r.meta,"parentBasetMapId")).forEach(r=>{var s;this.show((s=r.meta)==null?void 0:s.id,n)})}get(n){const t=this.findLayerById(n),r=this.mapViewer.imageryLayers.indexOf(t);return r?this.mapViewer.imageryLayers.get(r):void 0}pickImageryLayers(n){var s;const t=this.mapViewer.camera.getPickRay(n);let r;return t&&(r=(s=this.mapViewer.imageryLayers.pickImageryLayers(t,this.mapViewer.scene))==null?void 0:s.filter(i=>!j.get(i.meta,"parentBasetMapId"))),r}findLayerByPOI(n,t,r=!0){if(this.layerManagerFootprintMetaFieldPath){const s=ti(this.mapViewer,n,t);return this.layers.filter(g=>!j.get(g.meta,"parentBasetMapId")).filter(g=>{const f=j.get(g.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?Qn(s.geometry,{type:"Feature",properties:{},geometry:f})&&(r?g.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",g.meta),!1)}).sort((g,f)=>{var y,T;return((y=f.meta)==null?void 0:y.zIndex)-((T=g.meta)==null?void 0:T.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const n=this.mapViewer.imageryLayers.addImageryProvider(new u.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new u.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);n.meta={id:fn,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}addDataLayerUpdatedListener(n){this.dataLayerUpdated.addEventListener(n,this)}removeDataLayerUpdatedListener(n){this.dataLayerUpdated.removeEventListener(n,this)}findDataLayerById(n){return this.dataLayers.find(t=>t.meta.id===n)}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(t=>!!j.get(t.meta,"parentBasetMapId")).length}findLayerById(n){return this.layers.find(t=>t.meta!==void 0?t.meta.id===n:!1)}updateLayersOrder(n,t,r){const s=t>r?ai:li,i=t<r?t:r,h=t<r?r:t;this.layers.forEach(g=>{var y;if(!j.get(g.meta,"parentBasetMapId")){const T=(y=g.meta)==null?void 0:y.zIndex;g.meta.zIndex=T>=i&&T<=h&&T!==t?T+s:T===t?r:T}})}hideNonRelevantLayers(){var n,t;for(const r of this.layers)((n=r.meta)==null?void 0:n.relevantToExtent)!==r.show&&r.imageryProvider.ready&&(r.show=((t=r.meta)==null?void 0:t.relevantToExtent)??!0)}markRelevantLayersForExtent(){var n,t;try{const r=this.mapViewer.camera.computeViewRectangle();for(let s=this.layers.length-1;s>=0;s--){const i=this.layers[s],h=!j.isEmpty(r)&&!j.isEmpty(i.rectangle)&&u.Rectangle.intersection(r,i.rectangle);for(let g=this.layers.length-1;g>=s;g--){if(((n=i.meta)==null?void 0:n.skipRelevancyCheck)===!0){i.meta={...i.meta,relevantToExtent:!0};continue}const f=this.layers[g],y=((t=f.meta)==null?void 0:t[it])===!0;if(i!==f)if(h instanceof u.Rectangle){if(nt(r,i.rectangle))if(nt(r,f.rectangle)&&!y){i.meta={...i.meta??{},relevantToExtent:!1};break}else i.meta={...i.meta??{},relevantToExtent:!0};if(nt(r,f.rectangle)&&!y){i.meta={...i.meta??{},relevantToExtent:!1};break}if(nt(i.rectangle,f.rectangle)){if(i.meta={...i.meta??{},relevantToExtent:y},!y)break}else i.meta={...i.meta??{},relevantToExtent:!0}}else i.meta={...i.meta??{},relevantToExtent:!1};else s===this.layers.length-1&&(i.meta={...i.meta??{},relevantToExtent:h instanceof u.Rectangle})}}}catch(r){console.error(r)}}}const Zo="",di=o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",enableBackground:"new 0 0 24 24",height:"24",width:"24",viewBox:"0 0 612 612",children:o.jsxs("g",{xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M322.4,173.9l-129,16.2l-4.6,21.4l25.3,4.7c16.5,3.9,19.8,9.9,16.2,26.4l-41.5,195.3c-10.9,50.5,5.9,74.3,45.5,74.3 c30.7,0,66.3-14.2,82.5-33.6l4.9-23.4c-11.3,9.9-27.7,13.9-38.6,13.9c-15.5,0-21.1-10.9-17.1-30L322.4,173.9z"}),o.jsx("circle",{cx:"270.1",cy:"56.3",r:"56.3"})]})}),ui=({onClick:e})=>o.jsx(ue,{onClick:e,className:"mapLegendToggleContainer",children:o.jsx(Y.Icon,{icon:di,className:"mapLegendIcon"})}),hi=({legend:{legendImg:e,legendDoc:n,layer:t},docText:r,imgText:s})=>{const i=c.useCallback(()=>{window.open(e,"_blank")},[e]);c.useCallback(()=>{window.open(n,"_blank")},[n]);const h=c.useCallback(()=>{const y=o.jsx(ue,{className:"layerNameContainer",children:o.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:t})});return(t??"").length>15?o.jsx(Y.Tooltip,{content:t,children:y}):y},[t]),g=c.useCallback(()=>[typeof e=="string"&&o.jsx("a",{className:"legendAction",href:e,target:"_blank",rel:"noreferrer",children:s}),typeof n=="string"&&o.jsx("a",{className:"legendAction",href:n,target:"_blank",rel:"noreferrer",children:r})],[e,s,n,r]);return o.jsxs(ue,{className:"mapLegend",children:[h(),o.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:i}),o.jsx(ue,{className:"legendActionsContainer",children:g()})]})},gi=({legends:e,actionsTexts:{docText:n,imgText:t},noLegendsText:r})=>{const s=c.useCallback(()=>o.jsx(ue,{className:"noLegendsContainer",children:o.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),i=c.useCallback(()=>e.length?e.map((h,g)=>o.jsx(hi,{legend:h,docText:n,imgText:t},`${h.layer}_${g}`)):s(),[e]);return o.jsx(ue,{className:"mapLegendsList",children:i()})},pi=({isOpen:e,toggleSidebar:n,title:t="Map Legends",noLegendsText:r="No legends to display...",actionsTexts:s={docText:"Docs",imgText:"View Image"},legends:i=[]})=>e?o.jsxs(Y.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[o.jsx(Y.DrawerHeader,{className:"sidebarHeaderContainer",children:o.jsx(Y.DrawerTitle,{className:"sidebarTitle",children:t})}),o.jsxs(Y.DrawerContent,{className:"sidebarContent",children:[o.jsx(Y.Icon,{onClick:n,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),o.jsx(gi,{noLegendsText:r,legends:i,actionsTexts:s})]})]}):null;class fi extends u.PolylineDashMaterialProperty{}class mi extends u.ConstantProperty{}class yi extends u.ConstantPositionProperty{}class vi extends u.Cartesian2{}class Ei extends u.Cartesian3{}class mn extends u.Cartographic{}class wi extends u.BoundingSphere{}class Si extends u.Ellipsoid{}class Ti extends u.GeographicTilingScheme{}class Ci extends u.Rectangle{}class Li extends u.Resource{}class Mi extends u.EllipsoidTerrainProvider{}class bi extends u.CesiumTerrainProvider{}class Pi extends u.PolylineGraphics{}class _i extends u.JulianDate{}class Di extends u.PositionProperty{}class Ii extends u.BillboardGraphics{}class Oi extends u.Color{}class Ai extends u.PolygonHierarchy{}class ki extends u.Scene{}const xi=u.VerticalOrigin,Ni=u.HorizontalOrigin,we=u.SceneMode,Bi=u.LabelStyle,Fi=u.HeightReference,Xo="",Vi=Oe.makeStyles(e=>Oe.createStyles({mapContainer:{width:"60px",height:"60px",border:`${e.palette.background.paper} 2px solid`}})),Gi=e=>{const n=ye(),{baseMaps:t}=e,[r,s]=c.useState(" "),[i,h]=c.useState(),g=Vi();c.useEffect(()=>{const y=t==null?void 0:t.maps.find(T=>T.isCurrent);y&&(h(y),s(y.title!==void 0?y.title:" "))},[t]);const f=y=>{var T,m;if(t){(T=n.layersManager)==null||T.removeBaseMapLayers();const M=t.maps.find(O=>O.id===y);M&&((m=n.layersManager)==null||m.setBaseMapLayers(M),h(M),t.maps.forEach(O=>{O.isCurrent=M===O}))}};return o.jsxs(o.Fragment,{children:[o.jsx("label",{className:"mapLabel",children:r}),o.jsx("ul",{className:"mapSelector",children:t==null?void 0:t.maps.map(y=>o.jsx("li",{className:`mapContainer ${g.mapContainer} ${y===i?"mapContainerSelected":""}`,children:o.jsx("img",{alt:"",className:"mapContainerImg",src:y.thumbnail,onMouseOver:()=>{s(y.title)},onMouseOut:()=>{s((i==null?void 0:i.title)!==void 0?i.title:" ")},onClick:()=>{f(y.id)}})},y.id))})]})},Jo="",Hi=-1,Wi=e=>{const n=ye(),[t,r]=c.useState(we.SCENE2D),{sceneModes:s}=e,i=h=>s.findIndex(g=>g===h)>Hi;return c.useEffect(()=>{r(n.scene.mode)},[]),o.jsxs(o.Fragment,{children:[i(we.SCENE3D)&&o.jsx(Y.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===we.SCENE3D?"mapViewCurrent":""}`,children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 64 64",children:o.jsx("path",{d:"m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878 -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132 -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285 11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201 5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461 -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z"})})}),onClick:()=>{n.scene.morphTo3D(),r(we.SCENE3D)}}),i(we.SCENE2D)&&o.jsx(Y.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===we.SCENE2D?"mapViewCurrent":""}`,children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 64 64",children:o.jsx("path",{d:"m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z"})})}),onClick:()=>{n.scene.morphTo2D(),r(we.SCENE2D)}}),i(we.COLUMBUS_VIEW)&&o.jsx(Y.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===we.COLUMBUS_VIEW?"mapViewCurrent":""}`,children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 64 64",children:o.jsx("path",{d:"m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z"})})}),onClick:()=>{n.scene.morphToColumbusView(),r(we.COLUMBUS_VIEW)}})]})},Qo="",mt="ic_settings_24px",zi=e=>{const[n,t]=c.useState(!1),{sceneModes:r,baseMaps:s,locale:i}=e,h=c.useRef(null),g=j.get(i,"MAP_SETTINGS_DIALOG_TITLE")??"Map Settings",f=j.get(i,"MAP_SETTINGS_SCENE_MODE_TITLE")??"Scene Mode",y=j.get(i,"MAP_SETTINGS_BASE_MAP_TITLE")??"Base Map";return c.useEffect(()=>{const T=m=>{var _;const M=m.target,O=j.get(h,"current");O&&!O.contains(M)&&M.id!==mt&&((_=M.parentElement)==null?void 0:_.id)!==mt&&(document.removeEventListener("click",T,!1),t(!1))};return document.addEventListener("click",T,!1),()=>{document.removeEventListener("click",T,!1)}}),o.jsxs(o.Fragment,{children:[o.jsx(Y.Icon,{icon:o.jsx("div",{className:"settingsIconContainer",children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",id:mt,x:"288",y:"24",children:o.jsx("path",{d:"M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65A.488.488 0 0 0 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"})})}),onClick:()=>{t(!n)}}),n&&o.jsx("div",{className:"settingsDialogPortal",ref:h,children:o.jsxs(Y.Dialog,{open:n,onClosed:()=>{t(!1)},children:[o.jsx(Y.DialogTitle,{children:g}),o.jsxs(Y.DialogContent,{children:[o.jsx("h4",{className:"sectionLabel",children:f}),o.jsx(ue,{className:"mapScenesContainer",children:o.jsx(Wi,{sceneModes:r})}),o.jsx(ue,{className:"baseMapsContainer",children:s&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"sectionLabel",children:y}),o.jsx(Gi,{baseMaps:s})]})})]})]})})]})},Ro="",$i=e=>{const n=ye(),{enableCompass:t=!0,enableZoomControls:r=!1,lockCompassNavigation:s=!1,locale:i={DIRECTION:"ltr"}}=e;return c.useEffect(()=>{if(typeof j.get(n,"cesiumNavigation")>"u"){n.extend(er,{enableCompass:t,enableZoomControls:r,enableDistanceLegend:!1}),n.cesiumNavigation.setNavigationLocked(s);const h=document.querySelector(".compass");h&&i.DIRECTION&&h.classList.add(i.DIRECTION)}},[n,t,r,i.DIRECTION,s]),null},es="",yn=e=>{const n=ye(),t=c.useRef(null),[r,s]=c.useState({x:0,y:0});return c.useEffect(()=>{n.screenSpaceEventHandler.setInputAction(i=>{if(i!=null&&i.endPosition){const h={...i.endPosition};h.x=Math.ceil(h.x),h.y=Math.ceil(h.y),s(h)}},u.ScreenSpaceEventType.MOUSE_MOVE)},[t,n]),c.useEffect(()=>{const i=n.scene.globe.ellipsoid;if(r){const h=dn(n,r.x,r.y);if(h){const g=new mn(h.longitude,h.latitude);if(t.current){let f="";switch(e.projection){case _e.WEB_MERCATOR:{const T=new u.WebMercatorProjection(i).project(g);f=`Mercator: ${T.y.toFixed(et)}m, ${T.x.toFixed(et)}m`,t.current.style.width="220px";break}case _e.WGS84:{const y=g.longitude.toFixed(Re);f=`WGS84: ${g.latitude.toFixed(Re)}°N ${y}°E`,t.current.style.width="200px";break}}t.current.innerHTML=f}}}},[r,t,n,e.projection]),o.jsx("div",{className:"trackerPosition",ref:t})},ts="",yt=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],Ui=(e,n,t,r)=>{const s=j.get(r,"METERS_UNIT")??"m",i=j.get(r,"KILOMETERS_UNIT")??"km",h={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:n.lastLegendUpdate},g=new u.EllipsoidGeodesic,f=new Date().getTime();if(f<h.lastLegendUpdate+250)return;h.lastLegendUpdate=f;const y=e.scene.canvas.clientWidth,T=e.scene.canvas.clientHeight,m=e.scene.camera.getPickRay(new u.Cartesian2(y/2|0,T-1)),M=e.scene.camera.getPickRay(new u.Cartesian2(1+y/2|0,T-1)),O=e.scene.globe,_=O.pick(m,e.scene),z=O.pick(M,e.scene);if(!_||!z)return;const Q=O.ellipsoid.cartesianToCartographic(_),$=O.ellipsoid.cartesianToCartographic(z);g.setEndPoints(Q,$);const J=g.surfaceDistance,X=100;let F;for(let ee=yt.length-1;!j.isNumber(F)&&ee>=0;--ee)yt[ee]/J<X&&(F=yt[ee]);if(j.isNumber(F)){let ee="";F>=1e3?ee=`${(F/1e3).toString()} ${i}`:ee=`${F.toString()} ${s}`,h.barWidth=F/J|0,h.distanceLabel=ee}t(h)},vn=e=>{const n=ye(),[t,r]=c.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});c.useEffect(()=>{const i=f=>{Ui(n,t,r,e.locale)},h=new u.EventHelper,g=f=>{n.scene.globe.tilesLoaded&&(i(new MouseEvent("mouse")),h.removeAll())};return h.add(n.scene.globe.tileLoadProgressEvent,g),n.camera.moveEnd.addEventListener(i),()=>{try{j.get(n,"_cesiumWidget")!=null&&n.camera.moveEnd.removeEventListener(i)}catch(f){console.log('CESIUM camera "moveEnd" remove listener failed',f)}}},[n,e.locale,t]);const s=i=>5+(125-i)/2;return o.jsx("div",{className:"scalePosition",children:j.isNumber(t.barWidth)&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"scale-tracker-label",children:o.jsx("bdi",{children:t.distanceLabel})}),o.jsx("div",{className:"scale-tracker-bar",style:{height:"2px",width:`${t.barWidth.toString()}px`,left:`${s(t.barWidth).toString()}px`}})]})})},ns="",En=(e,n)=>{const r=j.get(n.scene.globe,"_surface.tileProvider"),s=r._quadtree,i=n.canvas.height,h=j.get(n.camera.frustum,"sseDenominator")??1;for(let g=0;g<=19;g++)if(r.getLevelMaximumGeometricError(g)*i/(e*h)<s.maximumScreenSpaceError)return g;return null},qi=(e,n)=>{e=e||10;const t=[];let r=1e5,s=0;for(let i=1e8;i>r;i=i-r){const h=En(i,n);if(h===null)break;if(h!==s){let g=i,f=i+r;for(;f-g>e;)i=g+(f-g)/2,En(i,n)===h?g=i:f=i;t.push({level:h,height:Math.round(i)}),s=h,t.length>=2&&(r=(t[t.length-2].height-i)/1e3)}}return t},wn=({locale:e=void 0,valueBy:n="RENDERED_TILES"})=>{const t=ye(),r=We(),[s,i]=c.useState(1),h=qi(1,t),g=c.useCallback(()=>{const m=t.camera,M=.5;let O=0;switch(t.scene.mode){case we.SCENE3D:O=t.scene.mapProjection.ellipsoid.cartesianToCartographic(m.positionWC).height;break;case we.SCENE2D:O=(m.frustum.right-m.frustum.left)*M;break;case we.COLUMBUS_VIEW:O=m.position.z;break;default:O=0;break}if(h.length>0){const _=h.reduce((z,Q)=>Math.abs(Q.height-O)<Math.abs(z.height-O)?Q:z);i(_.level),r.setViewState&&r.setViewState(z=>({...z,currentZoomLevel:_.level}))}},[t,h]),f=c.useCallback(()=>{let m=0;t.scene.globe._surface.forEachRenderedTile(function(M){m=Math.max(m,M.level)}),i(m),r.setViewState&&r.setViewState(M=>({...M,currentZoomLevel:m}))},[t]),T=c.useMemo(()=>({CALCULATION:g,RENDERED_TILES:f}),[g,f])[n];return c.useEffect(()=>{const m=t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded&&T()});return t.camera.moveEnd.addEventListener(T),()=>{try{typeof j.get(t,"_cesiumWidget")<"u"&&(t.camera.moveEnd.removeEventListener(T),m())}catch(M){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',M)}}},[t,T]),o.jsxs("div",{className:"zoomLevel",children:[o.jsx("div",{className:"zoomLevelValue",children:s}),o.jsx("div",{className:"zoomLevelLabel",children:j.get(e,"ZOOM_LABEL")??"zoom"})]})},rs="",ji=()=>{const e=ye(),n=[{onClick:()=>e.camera.zoomIn(),iconPath:"M48 20h-18v-18h-10v18h-18v10h18v18h10v-18h18z"},{onClick:()=>e.camera.zoomOut(),iconPath:"M2 20h46v10h-46z"}];return o.jsx("div",{className:"zoom-buttons-container",children:n.map((t,r)=>o.jsx(Y.Icon,{icon:o.jsx("div",{className:"zoom-button",children:o.jsx("svg",{fill:"#fff",width:"10px",height:"10px",viewBox:"0 -20 50 50",version:"1.2",baseProfile:"tiny",xmlns:"http://www.w3.org/2000/svg",overflow:"inherit",children:o.jsx("path",{d:t.iconPath})})}),onClick:t.onClick},r))})},is="",Sn=212,Tn=260,Ki=0;class Yi extends u.Viewer{constructor(t,r){super(t,r);de(this,"layersManager")}}const vt=c.createContext(null),Zi=vt.Provider,ye=()=>{const e=c.useContext(vt);if(e===null)throw new Error("map context is null, please check the provider");return e.mapViewer},We=()=>{const{mapViewer:e,...n}=c.useContext(vt);if(n===null)throw new Error("map context viewstate is null, please check the provider");return n},Xi=e=>{var b,P,N,G,V,K,oe,ve;const n=c.useRef(null),[t,r]=c.useState(),[s,i]=c.useState(),[h,g]=c.useState(),[f,y]=c.useState(),[T,m]=c.useState(),[M,O]=c.useState(),[_,z]=c.useState(),[Q,$]=c.useState(!1),[J,X]=c.useState(!1),[F,ee]=c.useState(),W=c.useRef(),[Z,ae]=c.useState(),[a,l]=c.useState([]),[w,p]=c.useState(),[C,v]=c.useState(!1),L=c.useRef(),[E,D]=c.useState(void 0),[k,A]=c.useState(!1),[I,x]=c.useState(),[B,ie]=c.useState(),le=c.useMemo(()=>Q||J,[Q,J]),[U,re]=c.useState();c.useEffect(()=>{re({currentZoomLevel:-1,shouldOptimizedTileRequests:e.useOptimizedTileRequests??!1})},[]);const pe={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:!1,sceneModePicker:!1,imageryProvider:!1,...e},fe=(q,te,H,ne,me)=>{const he=t.container,ce=he.clientWidth,Ee=he.clientHeight,Le=ne+me;return{left:`${ce-q<H?q-(H-(ce-q)):q}px`,top:`${Ee-te<Le?te-(Le-(Ee-te)):te}px`}},Ae=c.useCallback(q=>{if(n.current!==null){const te=n.current.cesiumElement,H={x:q.offsetX,y:q.offsetY};v(!1),D(H),x(dn(te,H.x,H.y)),v(!0),L.current=q}},[n]);c.useEffect(()=>{var q;if(n.current!==null){const te=n.current.cesiumElement;e.imageryContextMenu&&(te.scene.canvas.removeEventListener("contextmenu",Ae),te.scene.canvas.addEventListener("contextmenu",Ae))}r((q=n.current)==null?void 0:q.cesiumElement)},[n,e.imageryContextMenu]);const Pe=c.useMemo(()=>{var q;if(t)return{mapViewer:Object.assign(t,{layersManager:new ci(t,(q=e.legends)==null?void 0:q.mapLegendsExtractor,()=>{var te;l((te=t.layersManager)==null?void 0:te.legendsList)},e.layerManagerFootprintMetaFieldPath,U==null?void 0:U.shouldOptimizedTileRequests)}),viewState:U,setViewState:re}},[e.useOptimizedTileRequests,e.legends,e.layerManagerFootprintMetaFieldPath,t,U==null?void 0:U.shouldOptimizedTileRequests]);c.useEffect(()=>{ae(e.sceneModes??[we.SCENE2D,we.SCENE3D,we.COLUMBUS_VIEW])},[e.sceneModes]),c.useEffect(()=>{var te,H;p(e.baseMaps);const q=(te=e.baseMaps)==null?void 0:te.maps.find(ne=>ne.isCurrent);q&&t&&((H=t.layersManager)==null||H.setBaseMapLayers(q))},[e.baseMaps,t]),c.useEffect(()=>{i(e.projection??_e.WGS84)},[e.projection]),c.useEffect(()=>{ee(e.locale)},[e.locale]),c.useEffect(()=>{g(e.showMousePosition??!0)},[e.showMousePosition]),c.useEffect(()=>{y(e.showZoomLevel??!0)},[e.showZoomLevel]),c.useEffect(()=>{m(e.showScale??!0)},[e.showScale]),c.useEffect(()=>{O(e.showCompass??!0)},[e.showCompass]),c.useEffect(()=>{z(e.showLoadingProgress??!0)},[e.showLoadingProgress]),c.useEffect(()=>{var te;const q=()=>{if(t===void 0)return{longitude:0,latitude:0,height:0};const H=()=>{const ne=t.camera.positionCartographic;return{longitude:tt(ne.longitude),latitude:tt(ne.latitude),height:ne.height}};if(t.scene.mode===u.SceneMode.SCENE3D){const ne=new u.Cartesian2(t.container.clientWidth/2,t.container.clientHeight/2),me=t.scene.camera.getPickRay(ne),he=t.scene.globe.pick(me,t.scene);if(!he)return{longitude:0,latitude:0,height:0};const ce=t.scene.globe.ellipsoid.cartesianToCartographic(he);return ce!==void 0?{longitude:tt(ce.longitude),latitude:tt(ce.latitude),height:t.scene.camera.positionCartographic.height}:H()}else return H()};t&&(t.camera.moveEnd.addEventListener(()=>{if(t.scene.mode!==u.SceneMode.MORPHING){const H=t.camera,ne={position:q(),direction:H.direction.clone(),up:H.up.clone(),right:H.right.clone(),transform:H.transform.clone(),frustum:H.frustum.clone()};W.current=ne}}),_&&(t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded?$(!1):$(!0)}),(te=t.layersManager)==null||te.addDataLayerUpdatedListener(()=>{var ne;let H=!1;(ne=t.layersManager)==null||ne.dataLayerList.forEach(me=>{if(typeof me.meta.items=="number"&&typeof me.meta.total=="number"&&me.meta.items>0&&me.meta.items<me.meta.total){H=!0;return}}),X(H)})))},[t]),c.useEffect(()=>{const q=()=>{if(t&&W.current){const te=W.current;t.camera.flyTo({destination:u.Cartesian3.fromDegrees(te.position.longitude,te.position.latitude,te.position.height),duration:0})}};return t&&t.scene.morphComplete.addEventListener(q),()=>{if(t)try{t.scene.morphComplete.removeEventListener(q)}catch{console.error("morphCompleteHandler event not cleaned")}}},[t]),c.useEffect(()=>{const q=e.zoom,te=e.center;t&&j.isNumber(q)&&j.isArray(te)&&t.camera.flyTo({destination:u.Cartesian3.fromDegrees(te[0],te[1],Qr(q)),duration:0})},[e.zoom,e.center,t]),c.useEffect(()=>{ie(e.displayZoomButtons??!0)},[e.displayZoomButtons]);const Se=c.useCallback(()=>t&&Jn.createPortal(o.jsxs(o.Fragment,{children:[_&&le&&o.jsx(Y.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),o.jsxs(ue,{className:"sideToolsContainer",children:[e.debugPanel&&o.jsx(Rr,{locale:F,children:e.debugPanel.wfs&&o.jsx(ei,{locale:F,featureTypes:[]})}),o.jsx(zi,{sceneModes:Z,baseMaps:w,locale:F}),o.jsx(ui,{onClick:()=>A(!k)})]}),o.jsxs(ue,{className:"toolsContainer",children:[h&&o.jsx(yn,{projection:s}),f&&o.jsx(wn,{locale:F,valueBy:"RENDERED_TILES"}),T&&o.jsx(vn,{locale:F}),M&&o.jsx($i,{locale:F})]}),B&&o.jsx(ji,{})]}),document.querySelector(".cesium-viewer")),[w,F,t,s,Z,h,T,k,le]);return o.jsx(De.Viewer,{className:"viewer",full:!0,ref:n,...pe,children:o.jsxs(Zi,{value:Pe,children:[o.jsx(pi,{title:(b=e.legends)==null?void 0:b.title,isOpen:k,toggleSidebar:()=>A(!k),noLegendsText:(P=e.legends)==null?void 0:P.emptyText,legends:((N=e.legends)==null?void 0:N.legendsList)??a,actionsTexts:(G=e.legends)==null?void 0:G.actionsTexts}),e.children,Se(),e.imageryContextMenu&&C&&E&&I&&c.cloneElement(e.imageryContextMenu,{data:(V=t==null?void 0:t.layersManager)==null?void 0:V.findLayerByPOI(E.x,E.y,!1),position:{x:E.x,y:E.y},coordinates:I,style:fe(E.x,E.y,((K=e.imageryContextMenuSize)==null?void 0:K.width)??Tn,((oe=e.imageryContextMenuSize)==null?void 0:oe.height)??Sn,((ve=e.imageryContextMenuSize)==null?void 0:ve.dynamicHeightIncrement)??Ki),size:e.imageryContextMenuSize??{height:Sn,width:Tn},handleClose:()=>{v(!C)},contextEvt:L.current})]})})},Ji=0,Qi=e=>{const n=ye();return o.jsx(De.Cesium3DTileset,{...e,onReady:t=>{e.isZoomTo===!0&&n.zoomTo(t);const r=n.scene;r.globe.depthTestAgainstTerrain=!0;const s=u.Cartographic.fromCartesian(t.boundingSphere.center),i=e.heightFromGround??Ji;if(i){const h=u.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),g=u.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+i),f=u.Cartesian3.subtract(g,h,new u.Cartesian3);t.modelMatrix=u.Matrix4.fromTranslation(f)}}})},ot=180,Cn=.001,Ln=e=>Math.abs(e)/e,Mn=e=>{ot-Math.abs(e[0])<Cn&&(e[0]=Ln(e[0])*(ot-1)),ot/2-Math.abs(e[1])<Cn&&(e[1]=Ln(e[1])*(ot/2-1))},bn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(n=>{Mn(n)});break;case"Polygon":e.coordinates.forEach(n=>{n.forEach(t=>{Mn(t)})});break}},Ri=e=>{const{data:n,...t}=e,r=j.cloneDeep(n);return r&&(typeof r.features<"u"?r.features.forEach(s=>{bn(s.geometry)}):bn(r)),o.jsx(De.GeoJsonDataSource,{data:r,...t})},je=e=>{const{meta:n,...t}=e,r=ye();return c.useLayoutEffect(()=>{var s;(s=r.layersManager)==null||s.addMetaToLayer(n,n.searchLayerPredicate)},[n,r]),o.jsx(De.ImageryLayer,{...t})},eo=e=>{const{options:n,...t}=e,r=ye(),{viewState:s}=We(),i=s.shouldOptimizedTileRequests?new gn(n,r):new u.WebMapServiceImageryProvider(n);return o.jsx(je,{...t,imageryProvider:i})},to=e=>{const{options:n,...t}=e,r=ye(),{viewState:s}=We(),i=s.shouldOptimizedTileRequests?new pn(n,r):new u.WebMapTileServiceImageryProvider(n);return o.jsx(je,{...t,imageryProvider:i})},no=e=>{const{options:n,...t}=e,r=ye(),{viewState:s}=We(),i=s.shouldOptimizedTileRequests?new hn(n,r):new u.UrlTemplateImageryProvider(n);return o.jsx(je,{...t,imageryProvider:i})},ro=e=>{const{options:n,...t}=e;return o.jsx(je,{...t,imageryProvider:new u.OpenStreetMapImageryProvider(n)})},io="#FFFF00",oo=e=>{const{options:n,meta:t,visualizationHandler:r}=e,{url:s,featureType:i,style:h,pageSize:g,zoomLevel:f,maxCacheSize:y,keyField:T,labeling:m}=n,{color:M,hover:O}=h,_=ye(),z=We(),Q=c.useRef(z.viewState),$=c.useRef(new Map),J=c.useRef(new Set),X=c.useRef(0),[F,ee]=c.useState(t),W=c.useMemo(()=>u.Color.fromCssColorString(O??"#24AEE9").withAlpha(.5),[O]),Z=c.useMemo(()=>`wfs_${i}_${It.v4()}`,[i]),ae=c.useRef(!1);c.useEffect(()=>{Q.current=z.viewState},[z.viewState]);const a=new u.GeoJsonDataSource(Z),l=b=>{const P=[],N=t.featureStructure;if(N&&N.fields)for(const V of N.fields){const{fieldName:K,aliasFieldName:oe}=V,ve=oe,q=b[K]??"N/A";P.push(`
2
2
  <tr>
3
3
  <td><strong>${ve}:</strong></td>
4
4
  <td>${q}</td>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-colonies/react-components",
3
- "version": "4.10.0",
3
+ "version": "4.10.2",
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",
@@ -81,5 +81,5 @@
81
81
  "files": [
82
82
  "dist"
83
83
  ],
84
- "gitHead": "aeca7e9739703a6e2f1f443f041196f7b715e13c"
84
+ "gitHead": "d7680886f9a135b338d7da93450e4a3080674c18"
85
85
  }