@map-colonies/react-components 4.8.1 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,24 @@
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("@map-colonies/react-core/dist/linear-progress/styles"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@turf/helpers"),require("@turf/bbox"),require("@turf/bbox-polygon"),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","@map-colonies/react-core/dist/linear-progress/styles","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@turf/helpers","@turf/bbox","@turf/bbox-polygon","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,null,d.viewerCesiumNavigationMixin,null,d.turf,d.bbox,d.bboxPolygon,d.getCaretCoordinates,d.getInputSelection,d.chonky,d.chonkyIconFontawesome,d.filesize,d.Select))})(this,function(d,o,c,ge,Oe,be,Re,ve,K,V,yn,et,vn,Le,En,tt,to,nt,$e,qe,it,rt,Ue,je,Cn,Tn,wn,Ae,Sn,ot,bn,Ln,Mn,st,_n,no,Pn,at,In,On,An,me,S,z,Dn,io,kn,ro,xn,lt,ct,Nn,dt,F,Bn,Fn,ut){"use strict";var Rr=Object.defineProperty;var eo=(d,o,c)=>o in d?Rr(d,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[o]=c;var R=(d,o,c)=>(eo(d,typeof o!="symbol"?o+"":o,c),c);function Ke(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const ht=Ke(c),y=Ke(S),gt=Ke(xn);var ae=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(ae||{}),ue=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(ue||{}),De=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(De||{});const ee={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:ue.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:ue.EN},renderAsButton:!0,offset:0,disableFuture:!0}},ce=e=>{const{children:n,...t}=e;return o.jsx(K.Box,{...t,children:n})},ke=e=>{const n=e.type==="dark";return c.useMemo(()=>pt(e,n),[n,e])},pt=(e,n=!1)=>ve.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}}}),oo="",Vn=2,Hn=.5,Gn=ve.makeStyles(e=>ve.createStyles({container:{padding:e.spacing(Vn),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Hn)}})),ft=e=>{var X,k,q,N;const n=Gn(),t=V.useTheme(),i=ke(t),[s,r]=c.useState(null),[u,g]=c.useState(null),[f,m]=c.useState(ee.DATE_RANGE_PICKER.dateFormat),C=e.controlsLayout??ee.DATE_RANGE_PICKER.controlsLayout,M=e.disableFuture??ee.DATE_RANGE_PICKER.disableFuture,b=((X=e.local)==null?void 0:X.startPlaceHolderText)??ee.DATE_RANGE_PICKER.local.startPlaceHolderText,A=((k=e.local)==null?void 0:k.endPlaceHolderText)??ee.DATE_RANGE_PICKER.local.endPlaceHolderText,x=((q=e.local)==null?void 0:q.setText)??ee.DATE_RANGE_PICKER.local.setText,Q=(((N=e.local)==null?void 0:N.calendarLocale)??ee.DATE_RANGE_PICKER.local.calendarLocale)===ue.HE?Oe.he:Oe.enUS;c.useEffect(()=>{r(e.from??null)},[e.from]),c.useEffect(()=>{g(e.to??null)},[e.to]),c.useEffect(()=>{m(e.dateFormat??ee.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const G=Boolean(ge.isValid(s)&&!u||ge.isValid(u)&&!s||s&&u&&ge.isValid(s)&&ge.isValid(u)&&ge.isBefore(s,u)),Y=()=>{e.onChange({from:s&&ge.isValid(s)?s:void 0,to:u&&ge.isValid(u)?u:void 0})};return o.jsx(K.ThemeProvider,{theme:i,children:o.jsx(ce,{className:`${n.container} drpContainer`,display:"flex",flexDirection:C,width:C==="column"?e.contentWidth:"unset",children:o.jsxs(be.MuiPickersUtilsProvider,{utils:Re,locale:Q,children:[o.jsx(be.KeyboardDateTimePicker,{variant:"inline",placeholder:b,onChange:U=>r(U),value:s,disableFuture:M,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(be.KeyboardDateTimePicker,{variant:"inline",placeholder:A,className:n.margin,onChange:U=>g(U),value:u,disableFuture:M,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(V.ThemeProvider,{options:t,children:o.jsx(V.Button,{className:`${n.setButton} ${n.margin}`,raised:!0,onClick:Y,disabled:!G,children:x})})]})})})},mt=e=>{const{children:n,...t}=e;return o.jsx(K.Popover,{...t,children:n})},so="",zn=e=>{var k,q;const[n,t]=c.useState(null),[i,s]=c.useState(null),[r,u]=c.useState(ee.DATE_RANGE_PICKER.dateFormat),[g,f]=c.useState(null),m=N=>{f(N.currentTarget)},C=N=>{N.currentTarget.tagName==="I"?f(N.currentTarget.previousElementSibling):f(N.currentTarget)},M=()=>{f(null)},b=Boolean(g),A=e.controlsLayout??"column";c.useEffect(()=>{t(e.from??null)},[e.from]),c.useEffect(()=>{s(e.to??null)},[e.to]),c.useEffect(()=>{u(e.dateFormat??ee.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const x=((k=e.local)==null?void 0:k.startPlaceHolderText)??ee.DATE_RANGE_PICKER.local.startPlaceHolderText,W=((q=e.local)==null?void 0:q.endPlaceHolderText)??ee.DATE_RANGE_PICKER.local.endPlaceHolderText,Q=e.renderAsButton===void 0?ee.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,G=e.offset===void 0?ee.DATE_RANGE_PICKER.offset:e.offset,Y=e.disableFuture===void 0?ee.DATE_RANGE_PICKER.disableFuture:e.disableFuture,X=c.useMemo(()=>`${n?ge.format(n,r):x} - ${i?ge.format(i,r):W}`,[n,i,r,x,W]);return o.jsxs(o.Fragment,{children:[Q?o.jsx(V.Button,{style:{width:e.width},raised:!0,onClick:m,className:"drpOpener",children:X}):o.jsx(V.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:X,onClick:C,trailingIcon:{icon:"date_range",tabIndex:0,onClick:C}}),o.jsx(mt,{open:b,anchorEl:g,onClose:M,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:o.jsx(ft,{controlsLayout:A,contentWidth:((g==null?void 0:g.clientWidth)??0)-G,dateFormat:r,disableFuture:Y,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:n??void 0,to:i??void 0,onChange:({from:N,to:U})=>{t(N??null),s(U??null),e.onChange({from:N,to:U}),M()}})})]})},xe=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,Wn=({endDate:e,startDate:n,setEndDate:t=()=>{},setStartDate:i=()=>{},endTimeInputClassName:s="",endTimeLabel:r="",endTimeWrapperClassName:u="",timeRangeInputsWrapperClassName:g="",startTimeInputClassName:f="",startTimeLabel:m="",startTimeWrapperClassName:C=""})=>o.jsxs("div",{className:`timeRangeWrapper ${g}`,children:[o.jsx("div",{className:`startTimeWrapper ${C}`,children:o.jsx(V.TextField,{label:m,disabled:n===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Le(n).format("HH:mm"),onChange:M=>{const b=Le(n),A=Le(M.currentTarget.value,"HH:mm"),x=b.set({hours:A.get("hours"),minutes:A.get("minutes")});i(x.toDate())}})}),o.jsx("div",{className:`endTimeWrapper ${u}`,children:o.jsx(V.TextField,{label:r,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Le(e).format("HH:mm"),onChange:M=>{const b=Le(e),A=Le(M.currentTarget.value,"HH:mm"),x=b.set({hours:A.get("hours"),minutes:A.get("minutes")});t(x.toDate())}})})]}),$n=c.forwardRef(({value:e,onClick:n,onInputClick:t,...i},s)=>o.jsx(V.TextField,{...i,className:"dateRangeCustomInput",readOnly:!0,onClick:r=>{n==null||n(r),t==null||t()},ref:s,value:e})),qn=({setStartDate:e=()=>{},setEndDate:n=()=>{},shortcuts:t,dateRange:i,onShortcut:s})=>{const[r,u]=c.useState(),g=c.useMemo(()=>t.map(f=>f instanceof Function?f():f),[t]);return c.useEffect(()=>{for(const f of g){const m=i.startDate&&i.endDate&&ge.isSameDay(f.startDate,i.startDate)&&ge.isSameDay(f.endDate,i.endDate);r?f.id===r&&(m||u(void 0)):m&&u(f.id)}},[i,r,g]),o.jsx("div",{className:"shortcutsContainer",children:g.map((f,m)=>{const C=()=>{e(f.startDate),n(f.endDate)};return o.jsx(V.Button,{type:"button",className:`shortcut ${r===f.id?"selected":""}`,onClick:M=>{C(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+m)})})},Un=c.forwardRef((e,n)=>{const{calendarClassName:t,dayClassName:i,monthClassName:s,selectsRange:r,onChange:u,inputName:g,showMonthYearDropdown:f,withShortcuts:m,locale:C="en"}=e,[M,b]=c.useState(null),[A,x]=c.useState(null),[W,Q]=c.useState(!1),G=r?{startDate:M,endDate:A}:M;c.useEffect(()=>{C==="he"&&et.registerLocale("he",vn)},[C]),c.useEffect(()=>{var k,q;((k=e.startDate)==null?void 0:k.toString())!==(M==null?void 0:M.toString())&&b(e.startDate),((q=e.endDate)==null?void 0:q.toString())!==(A==null?void 0:A.toString())&&x(e.endDate)},[e.startDate,e.endDate,M,A]);const Y=c.useMemo(()=>{let k="pickerContainer"+(C==="he"?" pickerContainer-rtl":"");return m&&r&&(k+=" pickerContainer-withShortcuts"),k},[C,m,r]),X=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return o.jsx("div",{className:Y,style:{direction:C==="he"?"rtl":"ltr"},children:o.jsx(et,{...e,ref:n,onClickOutside:()=>Q(!1),open:W,startDate:xe(G)?M:void 0,selected:M,endDate:xe(G)?A:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${t}`,weekDayClassName:k=>`pickerWeek ${(i==null?void 0:i(k))??""}`,dayClassName:k=>`pickerDay ${(i==null?void 0:i(k))??""}`,monthClassName:k=>`pickerMonth ${(s==null?void 0:s(k))??""}`,onChange:(k,q)=>{if(Array.isArray(k)){const[N,U]=k;b(N),x(U),u==null||u({startDate:N,endDate:U&&ge.endOfDay(U)},q)}else b(k),u==null||u(k,q)},customInput:o.jsx($n,{name:g,onInputClick:()=>{Q(!0)}}),showTimeInput:!!(m&&r),timeInputLabel:"",customTimeInput:m&&xe(G)&&o.jsx(qn,{onShortcut:k=>{u==null||u(k),Q(!1)},shortcuts:m,setEndDate:x,setStartDate:b,dateRange:G}),showMonthYearDropdown:void 0,...X})})}),ao="",jn=e=>{const n=V.useTheme(),t=ke(n),{format:i=ee.DATE_PICKER.dateFormat,variant:s=ee.DATE_PICKER.variant,disableFuture:r=ee.DATE_PICKER.disableFuture,local:u,onChange:g,showTime:f=ee.DATE_PICKER.showTime,value:m,...C}=e,{placeHolderText:M=ee.DATE_PICKER.local.placeHolderText,calendarLocale:b}=u??{placeHolderText:ee.DATE_PICKER.local.placeHolderText,calendarLocale:ue.EN},A=b===ue.HE?Oe.he:Oe.enUS,x=W=>{g(W)};return o.jsx(K.ThemeProvider,{theme:t,children:o.jsxs(be.MuiPickersUtilsProvider,{utils:Re,locale:A,children:[f&&o.jsx(be.KeyboardDateTimePicker,{variant:s,placeholder:M,onChange:x,value:m,disableFuture:r,format:i,...C}),!f&&o.jsx(be.KeyboardDatePicker,{variant:s,placeholder:M,onChange:x,value:m,disableFuture:r,format:i,...C})]})})},Kn=18,Yn=ve.makeStyles(e=>ve.createStyles({drawingButton:{width:e.spacing(Kn)},fullWidth:{width:"100%",marginTop:"36px"}})),Xn=e=>{const n=Yn(),[t,i]=c.useState(null),{isSelectionEnabled:s,onCancelDraw:r,onStartDraw:u,onReset:g}=e,f=C=>{i(C.currentTarget)},m=()=>{i(null)};return s?o.jsx(V.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:o.jsx(V.Button,{className:n.drawingButton,raised:!0,onClick:r,children:"Cancel Draw"})}):o.jsxs(ce,{position:"relative",children:[o.jsx(V.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:o.jsx(V.Button,{className:n.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),o.jsxs(V.Menu,{className:n.fullWidth,open:Boolean(t),onClose:m,children:[o.jsx(V.MenuItem,{onClick:()=>{u(ae.POLYGON),m()},children:"Polygon"}),o.jsx(V.MenuItem,{onClick:()=>{u(ae.BOX),m()},children:"Box"}),o.jsx(V.MenuItem,{onClick:()=>{g(),m()},children:"Clear"})]})]})},lo="";var pe=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(pe||{});const Ne=5,Be=2,yt=c.createContext(null),Zn=yt.Provider,vt=35,Et=32,Jn=10,Qn=e=>e!==void 0&&e!==pe.WGS84?it.transform([vt,Et],pe.WGS84,e):[vt,Et],Rn=e=>{switch(e){case pe.WEB_MERCATOR:return n=>nt.format(n,"Mercator: {y}m, {x}m",Be);case pe.WGS84:return n=>nt.format(n,"WGS84: {y}°N {x}°E",Ne);default:return n=>""}},Te=()=>{const e=c.useContext(yt);if(e===null)throw new Error("map context is null, please check the provider");return e},Ct=e=>{const n=c.useRef(null),{allowFullScreen:t,showMousePosition:i,projection:s}=e,[r]=c.useState(new tt.Map({view:new tt.View({projection:s??pe.WGS84}),controls:$e.defaults()}));c.useEffect(()=>{r.getView().setCenter(e.center??Qn(e.projection))},[r,e.center,e.projection]),c.useEffect(()=>{r.getView().setZoom(e.zoom??Jn)},[r,e.zoom,e.projection]);const u=(g,f)=>{f.getControls().forEach(C=>{C instanceof g&&f.removeControl(C)})};return c.useEffect(()=>{r.setTarget(n.current),t!==void 0&&t?r.addControl(new $e.FullScreen):u($e.FullScreen,r)},[r,t]),c.useEffect(()=>{i!==void 0&&i?(u(qe,r),r.addControl(new qe({coordinateFormat:Rn(s??pe.WGS84),projection:s??pe.WGS84,undefinedHTML:"&nbsp;"}))):u(qe,r)},[r,i,s]),o.jsxs(Zn,{value:r,children:[o.jsx("div",{className:"map",ref:n}),e.children]})},Tt=c.createContext(null),ei=Tt.Provider,_e=()=>{const e=c.useContext(Tt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},wt=({options:e,children:n})=>{const t=Te(),[i]=c.useState(new rt.Tile(e));return c.useEffect(()=>(t.addLayer(i),()=>{t.removeLayer(i)}),[t,i]),o.jsx(ei,{value:i,children:n})},St=c.createContext(null),ti=St.Provider,bt=()=>{const e=c.useContext(St);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Lt=({children:e})=>{const n=Te(),[t]=c.useState(new rt.Vector);return c.useEffect(()=>(n.addLayer(t),()=>{n.removeLayer(t)}),[n,t]),o.jsx(ti,{value:t,children:e})},Mt=c.createContext(null),ni=Mt.Provider,_t=()=>{const e=c.useContext(Mt);if(e===null)throw new Error("vector source context is null, please check the provider");return e},Pt=({children:e})=>{const n=bt(),[t]=c.useState(new Ue.Vector);return c.useEffect(()=>{n.setSource(t)},[t,n]),o.jsx(ni,{value:t,children:e})},It=({geometry:e,fitOptions:n,fit:t,featureStyle:i})=>{const s=_t(),r=Te();return c.useLayoutEffect(()=>{const g=new je.GeoJSON().readFeature(e);return t&&s.on("addfeature",function(){r.getView().fit(s.getExtent(),n)}),i&&g.setStyle(i),s.addFeature(g),()=>{s.removeFeature(g)}},[e,s,t]),null},Ot=e=>{const n=_e();return c.useEffect(()=>{n.setSource(new Ue.OSM)},[n]),null},At=({drawType:e,onPolygonSelected:n})=>{const t=Te();return c.useEffect(()=>{const i={type:"Circle"};switch(e){case ae.BOX:i.geometryFunction=Tn.createBox();break;case ae.POLYGON:i.type="Polygon";break;default:return}const s=new Cn.Draw(i);t.addInteraction(s);const r=u=>{const f=new je.GeoJSON().writeGeometryObject(u.feature.getGeometry());n==null||n(f)};return s.on("drawend",r),()=>{s.un("drawend",r),t.removeInteraction(s)}},[n,e,t]),null},co="",ii=e=>{const n=t=>{const i=En(t);e.onPolygonSelection(i)};return o.jsxs(Ct,{allowFullScreen:!0,showMousePosition:!0,children:[o.jsx(wt,{children:o.jsx(Ot,{})}),e.selectionPolygon&&o.jsx(Lt,{children:o.jsx(Pt,{children:o.jsx(It,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&o.jsx(At,{drawType:e.drawType,onPolygonSelected:n})]})},Ye=1.5,ri=80,oi=ve.makeStyles(e=>ve.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(Ye),top:e.spacing(Ye)},contentContainer:{marginTop:e.spacing(Ye),width:e.spacing(ri)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),si=e=>{var f;const[n,t]=c.useState(),[i,s]=c.useState(),r=oi(),u=m=>{s(m),t(void 0),e.handlePolygonSelected(m)},g=()=>{s(void 0),e.handlePolygonReset()};return o.jsxs("div",{className:r.map,children:[o.jsxs("div",{className:`${r.absolute}`,children:[o.jsxs(K.Paper,{className:r.filtersContainer,children:[o.jsx(Xn,{onCancelDraw:()=>t(void 0),onReset:g,onStartDraw:t,isSelectionEnabled:n!==void 0}),(f=e.filters)==null?void 0:f.map((m,C)=>o.jsx("div",{className:r.filtersMargin,children:m},C))]}),o.jsx(K.Paper,{color:"red",className:`${r.contentContainer}`,children:e.children})]}),o.jsx(ii,{children:e.mapContent,onPolygonSelection:u,drawType:n,selectionPolygon:i})]})},Dt=new Ae.Fill({color:"rgba(255,255,255,0.4)"}),kt=new Ae.Stroke({color:"#3399CC",width:1.25}),xt=[new Ae.Style({image:new Ae.Circle({fill:Dt,stroke:kt,radius:5}),fill:Dt,stroke:kt})],Nt=c.createContext(null),ai=Nt.Provider,Bt=()=>{const e=c.useContext(Nt);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},li=({children:e,options:n,style:t})=>{const i=Te(),[s]=c.useState(new wn({...n,style:t||xt}));return c.useEffect(()=>(i.addLayer(s),()=>{i.removeLayer(s)}),[i,s]),c.useEffect(()=>{s.setStyle(t||xt)},[s,t]),o.jsx(ai,{value:s,children:e})},Xe=20,ci=256,di=2,ui=2,hi="REST",gi=e=>{const n=it.get(e.projection),t=n.getExtent(),i=new Array(Xe),s=new Array(Xe),r=ot.getWidth(t)/ci,u=e.heightWidthRatio!==void 0?e.heightWidthRatio:ui,g=e.requestEncoding!==void 0?e.requestEncoding:hi;for(let m=0;m<Xe;++m)i[m]=r/Math.pow(di,m)/u,s[m]=m.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:n,tileGrid:new Sn({origin:ot.getTopLeft(t),resolutions:i,matrixIds:s}),style:e.style,requestEncoding:g,wrapX:e.wrapX!==void 0?e.wrapX:!0}},pi=e=>{const n=_e(),{options:t}=e;return c.useEffect(()=>{n.setSource(new Ue.WMTS(t))},[n,t]),null},fi=e=>{const{attributions:n,url:t,params:i,serverType:s,transition:r}=e;return{attributions:n,url:t,params:i,serverType:s,transition:r}},mi=e=>{const n=_e(),{options:t}=e;return c.useEffect(()=>{n.setSource(new bn(t))},[n,t]),null},yi=e=>{const{attributions:n,url:t}=e;return{attributions:n,url:t}},vi=e=>{const n=_e(),{options:t}=e;return c.useEffect(()=>{n.setSource(new Ln(t))},[n,t]),null},Ei=c.createContext(null),Ci=()=>{const e=c.useContext(Ei);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},Ti=e=>{const{url:n}=e;return{url:n,format:new je.MVT}},wi=({children:e,options:n})=>{const t=Bt();return c.useEffect(()=>{t.setSource(new Mn(n))},[n,t]),null},Si=({legendItems:e,title:n,isCollapsed:t})=>{const i=Te();return c.useEffect(()=>{const s=new st({title:n??"",margin:5,maxWidth:300}),r=new _n({legend:s,collapsed:t===void 0?!0:t});i.addControl(r);const u=new st({margin:4});return e.forEach(g=>{u.addItem({title:g.title,style:g.style,typeGeom:"Polygon"})}),s.addItem(u),()=>{i.removeControl(r)}},[i,e,n,t]),o.jsx(o.Fragment,{})};function bi(e){const{headCells:n,order:t,orderBy:i,onRequestSort:s,isCollapseable:r}=e,u=g=>f=>{s(f,g)};return o.jsx(Pn,{children:o.jsxs(K.TableRow,{children:[r&&o.jsx(K.TableCell,{}),n.map(g=>o.jsx(K.TableCell,{align:g.numeric?"right":"left",padding:g.disablePadding?"none":"default",sortDirection:i===g.id?t:!1,children:o.jsx(K.TableSortLabel,{active:i===g.id,direction:i===g.id?t:"asc",onClick:u(g.id),children:g.label})},g.id))]})})}const Li=at.createSvgIcon(ht.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),Mi=at.createSvgIcon(ht.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function _i(e){const{cellsMetadata:n,isRowSelected:t,item:i,onRowSelected:s,rowIndex:r,isCollapseable:u,collapsedElement:g}=e,[f,m]=c.useState(!1),C=n.length,M=()=>{s==null||s(r)};return o.jsxs(o.Fragment,{children:[o.jsxs(K.TableRow,{hover:!0,selected:t,onClick:M,children:[u&&o.jsx(K.TableCell,{padding:"checkbox",children:o.jsx(K.IconButton,{"aria-label":"expand row",size:"small",onClick:b=>{b.stopPropagation(),m(!f)},children:f?o.jsx(Mi,{}):o.jsx(Li,{})})}),n.map(b=>o.jsx(K.TableCell,{align:b.numeric?"right":"left",padding:b.disablePadding?"none":"default",children:b.transform?b.transform(i[b.id]):i[b.id]},b.id+r.toString()))]}),u&&o.jsx(K.TableRow,{children:o.jsx(K.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:C+1,children:o.jsx(K.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:g==null?void 0:g(i)})})})]})}function Pi(e){const[n,t]=c.useState(""),[i,s]=c.useState("asc"),{cellsMetadata:r,items:u,onRequestSort:g,onRowSelected:f,isCollapseable:m,collapsedElement:C,isDense:M,page:b,rowsPerPage:A,count:x,handleChangePage:W,handleChangeRowsPerPage:Q}=e,G=(Y,X)=>{const k=n===X&&i==="asc";s(k?"desc":"asc"),t(X),g(X,k?"desc":"asc")};return o.jsxs(K.TableContainer,{component:K.Paper,children:[o.jsxs(K.Table,{size:M?"small":"medium",children:[o.jsx(bi,{headCells:r,onRequestSort:G,order:i,orderBy:n,isCollapseable:m}),o.jsxs(K.TableBody,{children:[u.map((Y,X)=>o.jsx(_i,{item:Y,rowIndex:X,isCollapseable:m,cellsMetadata:r,collapsedElement:C,isRowSelected:!1,onRowSelected:f},X)),(u.length===0||A>u.length)&&o.jsx(K.TableRow,{style:{height:(M?33:53)*(A-u.length)},children:o.jsx(K.TableCell,{colSpan:m?r.length+1:r.length,children:u.length===0&&o.jsx(K.Typography,{align:"center",children:"No results :("})})})]})]}),o.jsx(K.TablePagination,{rowsPerPage:A,rowsPerPageOptions:[5,10],component:"div",count:x,page:b,onPageChange:W,onRowsPerPageChange:Q})]})}const Ii=e=>{const{children:n,...t}=e;return o.jsx(In,{...t,children:n})},Oi=e=>{const{children:n,...t}=e;return o.jsx(On,{...t,children:n})},Ft=e=>e*Math.PI/180,Fe=e=>e*(180/Math.PI),Ai=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(Ft(85.362/2))/Math.sin(Ft(85.362/2))),uo="",Vt=(e,n,t)=>{let i;if(e.scene.mode!==S.SceneMode.SCENE2D)i=e.scene.pickPosition(new S.Cartesian2(n,t));else{const s=e.scene.globe.ellipsoid;i=e.camera.pickEllipsoid(new S.Cartesian2(n,t),s)}return S.Cartographic.fromCartesian(i)},Di=(e,n,t)=>{const i=Vt(e,n,t);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[S.Math.toDegrees(i.longitude),S.Math.toDegrees(i.latitude)]}}},Ht=(e,n,t)=>{try{const i=Vt(e,n,t);return{longitude:S.Math.toDegrees(i.longitude),latitude:S.Math.toDegrees(i.latitude)}}catch{return}};class ki extends S.PolylineDashMaterialProperty{}class xi extends S.ConstantProperty{}class Ni extends S.ConstantPositionProperty{}class Bi extends S.Cartesian2{}class Fi extends S.Cartesian3{}class Gt extends S.Cartographic{}class Vi extends S.BoundingSphere{}class Hi extends S.Ellipsoid{}class Gi extends S.GeographicTilingScheme{}class zi extends S.Rectangle{}class Wi extends S.Resource{}class $i extends S.EllipsoidTerrainProvider{}class qi extends S.CesiumTerrainProvider{}const Ui=S.VerticalOrigin,ji=S.HorizontalOrigin,Ki=S.LabelStyle,zt=e=>{const n=re(),t=c.useRef(null),[i,s]=c.useState({x:0,y:0});return c.useEffect(()=>{n.screenSpaceEventHandler.setInputAction(r=>{if(r!=null&&r.endPosition){const u={...r.endPosition};u.x=Math.ceil(u.x),u.y=Math.ceil(u.y),s(u)}},S.ScreenSpaceEventType.MOUSE_MOVE)},[t,n]),c.useEffect(()=>{const r=n.scene.globe.ellipsoid;if(i){const u=Ht(n,i.x,i.y);if(u){const g=new Gt(u.longitude,u.latitude);if(t.current){let f="";switch(e.projection){case pe.WEB_MERCATOR:{const C=new S.WebMercatorProjection(r).project(g);f=`Mercator: ${C.y.toFixed(Be)}m, ${C.x.toFixed(Be)}m`,t.current.style.width="220px";break}case pe.WGS84:{const m=g.longitude.toFixed(Ne);f=`WGS84: ${g.latitude.toFixed(Ne)}°N ${m}°E`,t.current.style.width="200px";break}}t.current.innerHTML=f}}}},[i,t,n,e.projection]),o.jsx("div",{className:"trackerPosition",ref:t})},ho="",Ze=[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],Yi=(e,n,t,i)=>{const s=z.get(i,"METERS_UNIT")??"m",r=z.get(i,"KILOMETERS_UNIT")??"km",u={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:n.lastLegendUpdate},g=new S.EllipsoidGeodesic,f=new Date().getTime();if(f<u.lastLegendUpdate+250)return;u.lastLegendUpdate=f;const m=e.scene.canvas.clientWidth,C=e.scene.canvas.clientHeight,M=e.scene.camera.getPickRay(new S.Cartesian2(m/2|0,C-1)),b=e.scene.camera.getPickRay(new S.Cartesian2(1+m/2|0,C-1)),A=e.scene.globe,x=A.pick(M,e.scene),W=A.pick(b,e.scene);if(!x||!W)return;const Q=A.ellipsoid.cartesianToCartographic(x),G=A.ellipsoid.cartesianToCartographic(W);g.setEndPoints(Q,G);const Y=g.surfaceDistance,X=100;let k;for(let q=Ze.length-1;!z.isNumber(k)&&q>=0;--q)Ze[q]/Y<X&&(k=Ze[q]);if(z.isNumber(k)){let q="";k>=1e3?q=`${(k/1e3).toString()} ${r}`:q=`${k.toString()} ${s}`,u.barWidth=k/Y|0,u.distanceLabel=q}t(u)},Wt=e=>{const n=re(),[t,i]=c.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});c.useEffect(()=>{const r=f=>{Yi(n,t,i,e.locale)},u=new S.EventHelper,g=f=>{n.scene.globe.tilesLoaded&&(r(new MouseEvent("mouse")),u.removeAll())};return u.add(n.scene.globe.tileLoadProgressEvent,g),n.camera.moveEnd.addEventListener(r),()=>{try{z.get(n,"_cesiumWidget")!=null&&n.camera.moveEnd.removeEventListener(r)}catch(f){console.log('CESIUM camera "moveEnd" remove listener failed',f)}}},[n,e.locale,t]);const s=r=>5+(125-r)/2;return o.jsx("div",{className:"scalePosition",children:z.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`}})]})})},ie={MORPHING:S.SceneMode.MORPHING,COLUMBUS_VIEW:S.SceneMode.COLUMBUS_VIEW,SCENE2D:S.SceneMode.SCENE2D,SCENE3D:S.SceneMode.SCENE3D},go="",$t=(e,n)=>{const i=z.get(n.scene.globe,"_surface.tileProvider"),s=i._quadtree,r=n.canvas.height,u=z.get(n.camera.frustum,"sseDenominator")??1;for(let g=0;g<=19;g++)if(i.getLevelMaximumGeometricError(g)*r/(e*u)<s.maximumScreenSpaceError)return g;return null},Xi=(e,n)=>{e=e||10;const t=[];let i=1e5,s=0;for(let r=1e8;r>i;r=r-i){const u=$t(r,n);if(u===null)break;if(u!==s){let g=r,f=r+i;for(;f-g>e;)r=g+(f-g)/2,$t(r,n)===u?g=r:f=r;t.push({level:u,height:Math.round(r)}),s=u,t.length>=2&&(i=(t[t.length-2].height-r)/1e3)}}return t},qt=({locale:e=void 0,valueBy:n="RENDERED_TILES"})=>{const t=re(),[i,s]=c.useState(1),r=Xi(1,t),u=c.useCallback(()=>{const C=t.camera,M=.5;let b=0;switch(t.scene.mode){case ie.SCENE3D:b=t.scene.mapProjection.ellipsoid.cartesianToCartographic(C.positionWC).height;break;case ie.SCENE2D:b=(C.frustum.right-C.frustum.left)*M;break;case ie.COLUMBUS_VIEW:b=C.position.z;break;default:b=0;break}if(r.length>0){const A=r.reduce((x,W)=>Math.abs(W.height-b)<Math.abs(x.height-b)?W:x);s(A.level),t.currentZoomLevel=A.level}},[t,r]),g=c.useCallback(()=>{let C=0;t.scene.globe._surface.forEachRenderedTile(function(M){C=Math.max(C,M.level)}),s(C),t.currentZoomLevel=C},[t]),m=c.useMemo(()=>({CALCULATION:u,RENDERED_TILES:g}),[u,g])[n];return c.useEffect(()=>{const C=t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded&&m()});return t.camera.moveEnd.addEventListener(m),()=>{try{typeof z.get(t,"_cesiumWidget")<"u"&&(t.camera.moveEnd.removeEventListener(m),C())}catch(M){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',M)}}},[t,m]),o.jsxs("div",{className:"zoomLevel",children:[o.jsx("div",{className:"zoomLevelValue",children:i}),o.jsx("div",{className:"zoomLevelLabel",children:z.get(e,"ZOOM_LABEL")??"zoom"})]})},po="",Zi=-1,Ji=e=>{const n=re(),[t,i]=c.useState(),{sceneModes:s}=e,r=u=>s.findIndex(g=>g===u)>Zi;return c.useEffect(()=>{i(n.scene.mode)},[]),o.jsxs(o.Fragment,{children:[r(ie.SCENE3D)&&o.jsx(V.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===ie.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(),i(ie.SCENE3D)}}),r(ie.SCENE2D)&&o.jsx(V.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===ie.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(),i(ie.SCENE2D)}}),r(ie.COLUMBUS_VIEW)&&o.jsx(V.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===ie.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(),i(ie.COLUMBUS_VIEW)}})]})},fo="",Qi=ve.makeStyles(e=>ve.createStyles({mapContainer:{width:"60px",height:"60px",border:`${e.palette.background.paper} 2px solid`}})),Ri=e=>{const n=re(),{baseMaps:t}=e,[i,s]=c.useState(" "),[r,u]=c.useState(),g=Qi();c.useEffect(()=>{const m=t==null?void 0:t.maps.find(C=>C.isCurrent);m&&(u(m),s(m.title!==void 0?m.title:" "))},[t]);const f=m=>{var C,M;if(t){(C=n.layersManager)==null||C.removeBaseMapLayers();const b=t.maps.find(A=>A.id===m);b&&((M=n.layersManager)==null||M.setBaseMapLayers(b),u(b),t.maps.forEach(A=>{A.isCurrent=b===A}))}};return o.jsxs(o.Fragment,{children:[o.jsx("label",{className:"mapLabel",children:i}),o.jsx("ul",{className:"mapSelector",children:t==null?void 0:t.maps.map(m=>o.jsx("li",{className:`mapContainer ${g.mapContainer} ${m===r?"mapContainerSelected":""}`,children:o.jsx("img",{alt:"",className:"mapContainerImg",src:m.thumbnail,onMouseOver:()=>{s(m.title)},onMouseOut:()=>{s((r==null?void 0:r.title)!==void 0?r.title:" ")},onClick:()=>{f(m.id)}})},m.id))})]})},mo="",Je="ic_settings_24px",er=e=>{const[n,t]=c.useState(!1),{sceneModes:i,baseMaps:s,locale:r}=e,u=c.useRef(null),g=z.get(r,"MAP_SETTINGS_DIALOG_TITLE")??"Map Settings",f=z.get(r,"MAP_SETTINGS_SCENE_MODE_TITLE")??"Scene Mode",m=z.get(r,"MAP_SETTINGS_BASE_MAP_TITLE")??"Base Map";return c.useEffect(()=>{const C=M=>{var x;const b=M.target,A=z.get(u,"current");A&&!A.contains(b)&&b.id!==Je&&((x=b.parentElement)==null?void 0:x.id)!==Je&&(document.removeEventListener("click",C,!1),t(!1))};return document.addEventListener("click",C,!1),()=>{document.removeEventListener("click",C,!1)}}),o.jsxs(o.Fragment,{children:[o.jsx(V.Icon,{icon:o.jsx("div",{className:"settingsIconContainer",children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",id:Je,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",{id:"dialog-portal-example",className:"settingsDialogPortal",ref:u,children:o.jsxs(V.Dialog,{open:n,onClosed:()=>{t(!1)},children:[o.jsx(V.DialogTitle,{children:g}),o.jsxs(V.DialogContent,{children:[o.jsx("h4",{className:"sectionLabel",children:f}),o.jsx(ce,{className:"mapScenesContainer",children:o.jsx(Ji,{sceneModes:i})}),o.jsx(ce,{className:"baseMapsContainer",children:s&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"sectionLabel",children:m}),o.jsx(Ri,{baseMaps:s})]})})]})]})})]})},yo="",tr=()=>{const e=re(),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=>o.jsx(V.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}))})},vo="",nr=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"})]})}),ir=({onClick:e})=>o.jsx(ce,{onClick:e,className:"mapLegendToggleContainer",children:o.jsx(V.Icon,{icon:nr,className:"mapLegendIcon"})}),rr=({legend:{legendImg:e,legendDoc:n,layer:t},docText:i,imgText:s})=>{const r=c.useCallback(()=>{window.open(e,"_blank")},[e]);c.useCallback(()=>{window.open(n,"_blank")},[n]);const u=c.useCallback(()=>{const m=o.jsx(ce,{className:"layerNameContainer",children:o.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:t})});return(t??"").length>15?o.jsx(V.Tooltip,{content:t,children:m}):m},[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:i})],[e,s,n,i]);return o.jsxs(ce,{className:"mapLegend",children:[u(),o.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:r}),o.jsx(ce,{className:"legendActionsContainer",children:g()})]})},or=({legends:e,actionsTexts:{docText:n,imgText:t},noLegendsText:i})=>{const s=c.useCallback(()=>o.jsx(ce,{className:"noLegendsContainer",children:o.jsx("h2",{className:"noLegendsMsg",children:i})}),[i]),r=c.useCallback(()=>e.length?e.map((u,g)=>o.jsx(rr,{legend:u,docText:n,imgText:t},`${u.layer}_${g}`)):s(),[e]);return o.jsx(ce,{className:"mapLegendsList",children:r()})},sr=({isOpen:e,toggleSidebar:n,title:t="Map Legends",noLegendsText:i="No legends to display...",actionsTexts:s={docText:"Docs",imgText:"View Image"},legends:r=[]})=>e?o.jsxs(V.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[o.jsx(V.DrawerHeader,{className:"sidebarHeaderContainer",children:o.jsx(V.DrawerTitle,{className:"sidebarTitle",children:t})}),o.jsxs(V.DrawerContent,{className:"sidebarContent",children:[o.jsx(V.Icon,{onClick:n,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),o.jsx(or,{noLegendsText:i,legends:r,actionsTexts:s})]})]}):null,ye=document.createElement("canvas"),le=ye.getContext("2d"),Ut=e=>{const i=(e==null?void 0:e.data)??[];for(let s=3;s<i.length;s+=4)if(i[s]<255)return!0;return!1},ar=async(e,n)=>(n&&n.tileTransparencyCheckedCounter++,new Promise((t,i)=>{try{le==null||le.clearRect(0,0,ye.width,ye.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){ye.width=e.width,ye.height=e.height,le==null||le.drawImage(e,0,0);const r=le==null?void 0:le.getImageData(0,0,ye.width,ye.height),u=Ut(r);u&&n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(u);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{ye.width=s.width,ye.height=s.height,le==null||le.drawImage(s,0,0);const r=le==null?void 0:le.getImageData(0,0,ye.width,ye.height);Ut(r)?(n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(!0)):t(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),i(s)}})),Ve=(e,n)=>{const{west:t,east:i,north:s,south:r}=e,{west:u,east:g,north:f,south:m}=n;return t>=u&&i<=g&&s<=f&&r>=m},He=3,Ge="hasTransparency";function Qe(e,n,t,i,s){return setTimeout(()=>{var g;const r=(g=this.layerListInstance.find(f=>{var m,C;return((m=f._imageryProvider._resource)==null?void 0:m._url)===((C=this._resource)==null?void 0:C._url)}))==null?void 0:g.meta,u=z.get(r,Ge)===!0;this.tileTransparencyCheckedCounter<He&&!u&&ar(s==null?void 0:s.url,this).then(f=>{var m;(m=this.mapViewer.layersManager)==null||m.addMetaToLayer({[Ge]:f},C=>C._imageryProvider._resource._url===this._resource._url)})},0),e(n,t,i,s)}class jt extends S.UrlTemplateImageryProvider{constructor(t,i){var s;super(t);R(this,"layerListInstance");R(this,"mapViewer");R(this,"maxTilesForTransparencyCheck",He);R(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=i.layersManager)==null?void 0:s.layerList,this.mapViewer=i}requestImage(t,i,s,r){return Qe.call(this,super.requestImage.bind(this),t,i,s,r)}}class Kt extends S.WebMapServiceImageryProvider{constructor(t,i){var s;super(t);R(this,"layerListInstance");R(this,"mapViewer");R(this,"maxTilesForTransparencyCheck",He);R(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=i.layersManager)==null?void 0:s.layerList,this.mapViewer=i}requestImage(t,i,s,r){return Qe.call(this,super.requestImage.bind(this),t,i,s,r)}}class Yt extends S.WebMapTileServiceImageryProvider{constructor(t,i){var s;super(t);R(this,"layerListInstance");R(this,"mapViewer");R(this,"maxTilesForTransparencyCheck",He);R(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=i.layersManager)==null?void 0:s.layerList,this.mapViewer=i}requestImage(t,i,s,r){return Qe.call(this,super.requestImage.bind(this),t,i,s,r)}}const lr=1,cr=-1,Xt="TRANSPARENT_BASE_LAYER";class dr{constructor(n,t,i,s){R(this,"mapViewer");R(this,"legendsList");R(this,"layerUpdated");R(this,"layers");R(this,"legendsExtractor");R(this,"layerManagerFootprintMetaFieldPath");this.mapViewer=n,this.layers=this.mapViewer.imageryLayers._layers,this.legendsList=[],this.legendsExtractor=t,this.layerUpdated=new S.Event,this.layerManagerFootprintMetaFieldPath=s,i&&this.layerUpdated.addEventListener(i,this),this.mapViewer.shouldOptimizedTileRequests&&(this.layerUpdated.addEventListener(r=>{const u=Object.keys(r);u.length===1&&u[0]===Ge&&(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}addMetaToLayer(n,t){const i=this.layers.map(s=>s.imageryProvider.readyPromise);Promise.all(i).then(s=>{const r=this.layers.find(t);r&&(r.meta={...r.meta??{},...n},this.setLegends(),this.layerUpdated.raiseEvent(n))})}setBaseMapLayers(n){n.baseRasteLayers.sort((i,s)=>i.zIndex-s.zIndex).forEach((i,s)=>{this.addRasterLayer(i,s,n.id)}),this.mapViewer.shouldOptimizedTileRequests&&(this.removeLayer(Xt),this.addTransparentImageryProvider())}addRasterLayer(n,t,i){let s;switch(n.type){case"XYZ_LAYER":{const r=n.options,u=this.mapViewer.shouldOptimizedTileRequests?new jt(r,this.mapViewer):new S.UrlTemplateImageryProvider(r);s=this.mapViewer.imageryLayers.addImageryProvider(u,t);break}case"WMS_LAYER":{const r=n.options,u=this.mapViewer.shouldOptimizedTileRequests?new Kt(r,this.mapViewer):new S.WebMapServiceImageryProvider(r);s=this.mapViewer.imageryLayers.addImageryProvider(u,t);break}case"WMTS_LAYER":{const r=n.options,u=this.mapViewer.shouldOptimizedTileRequests?new Yt(r,this.mapViewer):new S.WebMapTileServiceImageryProvider(r);s=this.mapViewer.imageryLayers.addImageryProvider(u,t);break}}s&&(s.alpha=n.opacity,s.meta={parentBasetMapId:i,...n},n.show!==void 0&&(s.show=n.show))}removeLayer(n){const t=this.findLayerById(n);t&&this.mapViewer.imageryLayers.remove(t,!0)}removeBaseMapLayers(){this.layers.filter(t=>!!z.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}removeNotBaseMapLayers(){this.layers.filter(t=>!z.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}raise(n,t=1){const i=this.findLayerById(n),s=(i==null?void 0:i.meta).zIndex;if(i)for(let r=0;r<t;r++)this.mapViewer.imageryLayers.raise(i);this.updateLayersOrder(n,s,s+t)}lower(n,t=1){const i=this.findLayerById(n),s=(i==null?void 0:i.meta).zIndex,r=this.getBaseLayersCount(),u=this.mapViewer.imageryLayers.indexOf(i);if(u-t<=r&&(t=u-r),i)for(let g=0;g<t;g++)this.mapViewer.imageryLayers.lower(i);this.updateLayersOrder(n,s,s-t)}raiseToTop(n){const t=this.findLayerById(n),i=(t==null?void 0:t.meta).zIndex;t&&this.mapViewer.imageryLayers.raiseToTop(t),this.updateLayersOrder(n,i,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(n){const t=this.findLayerById(n),i=this.getBaseLayersCount(),s=this.mapViewer.imageryLayers.indexOf(t);this.lower(n,s-i)}length(){return this.mapViewer.imageryLayers.length}show(n,t){const i=this.get(n);i!==void 0&&(i.show=t)}showAllNotBase(n){this.layers.filter(i=>!z.get(i.meta,"parentBasetMapId")).forEach(i=>{var s;this.show((s=i.meta)==null?void 0:s.id,n)})}get(n){const t=this.findLayerById(n),i=this.mapViewer.imageryLayers.indexOf(t);return i?this.mapViewer.imageryLayers.get(i):void 0}pickImageryLayers(n){var s;const t=this.mapViewer.camera.getPickRay(n);let i;return t&&(i=(s=this.mapViewer.imageryLayers.pickImageryLayers(t,this.mapViewer.scene))==null?void 0:s.filter(r=>!z.get(r.meta,"parentBasetMapId"))),i}findLayerByPOI(n,t,i=!0){if(this.layerManagerFootprintMetaFieldPath){const s=Di(this.mapViewer,n,t);return this.layers.filter(g=>!z.get(g.meta,"parentBasetMapId")).filter(g=>{const f=z.get(g.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?Dn(s.geometry,{type:"Feature",properties:{},geometry:f})&&(i?g.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",g.meta),!1)}).sort((g,f)=>{var m,C;return((m=f.meta)==null?void 0:m.zIndex)-((C=g.meta)==null?void 0:C.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const n=this.mapViewer.imageryLayers.addImageryProvider(new S.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new S.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);n.meta={id:Xt,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(t=>!!z.get(t.meta,"parentBasetMapId")).length}findLayerById(n){return this.layers.find(t=>t.meta!==void 0?t.meta.id===n:!1)}updateLayersOrder(n,t,i){const s=t>i?lr:cr,r=t<i?t:i,u=t<i?i:t;this.layers.forEach(g=>{var m;if(!z.get(g.meta,"parentBasetMapId")){const C=(m=g.meta)==null?void 0:m.zIndex;g.meta.zIndex=C>=r&&C<=u&&C!==t?C+s:C===t?i:C}})}hideNonRelevantLayers(){var n,t;for(const i of this.layers)((n=i.meta)==null?void 0:n.relevantToExtent)!==i.show&&i.imageryProvider.ready&&(i.show=((t=i.meta)==null?void 0:t.relevantToExtent)??!0)}markRelevantLayersForExtent(){var n,t;try{const i=this.mapViewer.camera.computeViewRectangle();for(let s=this.layers.length-1;s>=0;s--){const r=this.layers[s],u=!z.isEmpty(i)&&!z.isEmpty(r.rectangle)&&S.Rectangle.intersection(i,r.rectangle);for(let g=this.layers.length-1;g>=s;g--){if(((n=r.meta)==null?void 0:n.skipRelevancyCheck)===!0){r.meta={...r.meta,relevantToExtent:!0};continue}const f=this.layers[g],m=((t=f.meta)==null?void 0:t[Ge])===!0;if(r!==f)if(u instanceof S.Rectangle){if(Ve(i,r.rectangle))if(Ve(i,f.rectangle)&&!m){r.meta={...r.meta??{},relevantToExtent:!1};break}else r.meta={...r.meta??{},relevantToExtent:!0};if(Ve(i,f.rectangle)&&!m){r.meta={...r.meta??{},relevantToExtent:!1};break}if(Ve(r.rectangle,f.rectangle)){if(r.meta={...r.meta??{},relevantToExtent:m},!m)break}else r.meta={...r.meta??{},relevantToExtent:!0}}else r.meta={...r.meta??{},relevantToExtent:!1};else s===this.layers.length-1&&(r.meta={...r.meta??{},relevantToExtent:u instanceof S.Rectangle})}}}catch(i){console.error(i)}}}const Eo="",Co="",ur=e=>{const n=re(),{enableCompass:t=!0,enableZoomControls:i=!1,lockCompassNavigation:s=!1,locale:r={DIRECTION:"ltr"}}=e;return c.useEffect(()=>{if(typeof z.get(n,"cesiumNavigation")>"u"){n.extend(kn,{enableCompass:t,enableZoomControls:i,enableDistanceLegend:!1}),n.cesiumNavigation.setNavigationLocked(s);const u=document.querySelector(".compass");u&&r.DIRECTION&&u.classList.add(r.DIRECTION)}},[n,t,i,r.DIRECTION,s]),null},Zt=212,Jt=260,hr=0;class gr extends S.Viewer{constructor(t,i){super(t,i);R(this,"layersManager");R(this,"currentZoomLevel");R(this,"useOptimizedTileRequests")}get shouldOptimizedTileRequests(){return this.useOptimizedTileRequests??!1}set shouldOptimizedTileRequests(t){this.useOptimizedTileRequests=t}}const Qt=c.createContext(null),pr=Qt.Provider,re=()=>{const e=c.useContext(Qt);if(e===null)throw new Error("map context is null, please check the provider");return e},fr=e=>{var $,te,se,Ce,fe,de,he,Ie;const n=c.useRef(null),[t,i]=c.useState(),[s,r]=c.useState(),[u,g]=c.useState(),[f,m]=c.useState(),[C,M]=c.useState(),[b,A]=c.useState(),[x,W]=c.useState(),[Q,G]=c.useState(!1),[Y,X]=c.useState(),k=c.useRef(),[q,N]=c.useState(),[U,oe]=c.useState([]),[a,l]=c.useState(),[T,h]=c.useState(!1),E=c.useRef(),[p,w]=c.useState(void 0),[v,L]=c.useState(!1),[I,P]=c.useState(),[_,O]=c.useState(),D={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:!1,sceneModePicker:!1,imageryProvider:!1,...e},j=(Z,H,ne,we,Se)=>{const Me=t.container,pn=Me.clientWidth,fn=Me.clientHeight,mn=we+Se;return{left:`${pn-Z<ne?Z-(ne-(pn-Z)):Z}px`,top:`${fn-H<mn?H-(mn-(fn-H)):H}px`}},J=c.useCallback(Z=>{if(n.current!==null){const H=n.current.cesiumElement,ne={x:Z.offsetX,y:Z.offsetY};h(!1),w(ne),P(Ht(H,ne.x,ne.y)),h(!0),E.current=Z}},[n]);c.useEffect(()=>{var Z;if(n.current!==null){const H=n.current.cesiumElement;e.imageryContextMenu&&(H.scene.canvas.removeEventListener("contextmenu",J),H.scene.canvas.addEventListener("contextmenu",J))}i((Z=n.current)==null?void 0:Z.cesiumElement)},[n,e.imageryContextMenu]),c.useEffect(()=>{var Z;t&&(t.shouldOptimizedTileRequests=e.useOptimizedTileRequests??!1,t.layersManager=new dr(t,(Z=e.legends)==null?void 0:Z.mapLegendsExtractor,()=>{var H;oe((H=t.layersManager)==null?void 0:H.legendsList)},e.layerManagerFootprintMetaFieldPath))},[t]),c.useEffect(()=>{t&&(t.shouldOptimizedTileRequests=e.useOptimizedTileRequests??!1)},[e.useOptimizedTileRequests,t]),c.useEffect(()=>{N(e.sceneModes??[ie.SCENE2D,ie.SCENE3D,ie.COLUMBUS_VIEW])},[e.sceneModes]),c.useEffect(()=>{var H,ne;l(e.baseMaps);const Z=(H=e.baseMaps)==null?void 0:H.maps.find(we=>we.isCurrent);Z&&t&&((ne=t.layersManager)==null||ne.setBaseMapLayers(Z))},[e.baseMaps,t]),c.useEffect(()=>{r(e.projection??pe.WGS84)},[e.projection]),c.useEffect(()=>{X(e.locale)},[e.locale]),c.useEffect(()=>{g(e.showMousePosition??!0)},[e.showMousePosition]),c.useEffect(()=>{m(e.showZoomLevel??!0)},[e.showZoomLevel]),c.useEffect(()=>{M(e.showScale??!0)},[e.showScale]),c.useEffect(()=>{A(e.showCompass??!0)},[e.showCompass]),c.useEffect(()=>{W(e.showLoadingProgress??!0)},[e.showLoadingProgress]),c.useEffect(()=>{const Z=()=>{if(t===void 0)return{longitude:0,latitude:0,height:0};const H=()=>{const ne=t.camera.positionCartographic;return{longitude:Fe(ne.longitude),latitude:Fe(ne.latitude),height:ne.height}};if(t.scene.mode===S.SceneMode.SCENE3D){const ne=new S.Cartesian2(t.container.clientWidth/2,t.container.clientHeight/2),we=t.scene.camera.getPickRay(ne),Se=t.scene.globe.pick(we,t.scene);if(!Se)return{longitude:0,latitude:0,height:0};const Me=t.scene.globe.ellipsoid.cartesianToCartographic(Se);return Me!==void 0?{longitude:Fe(Me.longitude),latitude:Fe(Me.latitude),height:t.scene.camera.positionCartographic.height}:H()}else return H()};t&&(t.camera.moveEnd.addEventListener(()=>{if(t.scene.mode!==S.SceneMode.MORPHING){const H=t.camera,ne={position:Z(),direction:H.direction.clone(),up:H.up.clone(),right:H.right.clone(),transform:H.transform.clone(),frustum:H.frustum.clone()};k.current=ne}}),x&&t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded===!0?G(!1):G(!0)}))},[t]),c.useEffect(()=>{const Z=()=>{if(t&&k.current){const H=k.current;t.camera.flyTo({destination:S.Cartesian3.fromDegrees(H.position.longitude,H.position.latitude,H.position.height),duration:0})}};return t&&t.scene.morphComplete.addEventListener(Z),()=>{if(t)try{t.scene.morphComplete.removeEventListener(Z)}catch{console.error("morphCompleteHandler event not cleaned")}}},[t]),c.useEffect(()=>{const Z=e.zoom,H=e.center;t&&z.isNumber(Z)&&z.isArray(H)&&t.camera.flyTo({destination:S.Cartesian3.fromDegrees(H[0],H[1],Ai(Z)),duration:0})},[e.zoom,e.center,t]),c.useEffect(()=>{O(e.displayZoomButtons??!0)},[e.displayZoomButtons]);const B=c.useCallback(()=>t&&An.createPortal(o.jsxs(o.Fragment,{children:[x&&Q&&o.jsx(V.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),o.jsxs(ce,{className:"sideToolsContainer",children:[o.jsx(er,{sceneModes:q,baseMaps:a,locale:Y}),o.jsx(ir,{onClick:()=>L(!v)})]}),o.jsxs(ce,{className:"toolsContainer",children:[u&&o.jsx(zt,{projection:s}),f&&o.jsx(qt,{locale:Y,valueBy:"RENDERED_TILES"}),C&&o.jsx(Wt,{locale:Y}),b&&o.jsx(ur,{locale:Y})]}),_&&o.jsx(tr,{})]}),document.querySelector(".cesium-viewer")),[a,Y,t,s,q,u,C,v,Q]);return o.jsx(me.Viewer,{className:"viewer",full:!0,ref:n,...D,children:o.jsxs(pr,{value:t,children:[o.jsx(sr,{title:($=e.legends)==null?void 0:$.title,isOpen:v,toggleSidebar:()=>L(!v),noLegendsText:(te=e.legends)==null?void 0:te.emptyText,legends:((se=e.legends)==null?void 0:se.legendsList)??U,actionsTexts:(Ce=e.legends)==null?void 0:Ce.actionsTexts}),e.children,B(),e.imageryContextMenu&&T&&p&&I&&c.cloneElement(e.imageryContextMenu,{data:(fe=t==null?void 0:t.layersManager)==null?void 0:fe.findLayerByPOI(p.x,p.y,!1),position:{x:p.x,y:p.y},coordinates:I,style:j(p.x,p.y,((de=e.imageryContextMenuSize)==null?void 0:de.width)??Jt,((he=e.imageryContextMenuSize)==null?void 0:he.height)??Zt,((Ie=e.imageryContextMenuSize)==null?void 0:Ie.dynamicHeightIncrement)??hr),size:e.imageryContextMenuSize??{height:Zt,width:Jt},handleClose:()=>{h(!T)},contextEvt:E.current})]})})},mr=0,yr=e=>{const n=re();return o.jsx(me.Cesium3DTileset,{...e,onReady:t=>{e.isZoomTo===!0&&n.zoomTo(t);const i=n.scene;i.globe.depthTestAgainstTerrain=!0;const s=S.Cartographic.fromCartesian(t.boundingSphere.center),r=e.heightFromGround??mr;if(r){const u=S.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),g=S.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+r),f=S.Cartesian3.subtract(g,u,new S.Cartesian3);t.modelMatrix=S.Matrix4.fromTranslation(f)}}})},ze=180,Rt=.001,en=e=>Math.abs(e)/e,tn=e=>{ze-Math.abs(e[0])<Rt&&(e[0]=en(e[0])*(ze-1)),ze/2-Math.abs(e[1])<Rt&&(e[1]=en(e[1])*(ze/2-1))},nn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(n=>{tn(n)});break;case"Polygon":e.coordinates.forEach(n=>{n.forEach(t=>{tn(t)})});break}},vr=e=>{const{data:n,...t}=e,i=z.cloneDeep(n);return i&&(typeof i.features<"u"?i.features.forEach(s=>{nn(s.geometry)}):nn(i)),o.jsx(me.GeoJsonDataSource,{data:i,...t})},Pe=e=>{const{meta:n,...t}=e,i=re();return c.useLayoutEffect(()=>{var s;(s=i.layersManager)==null||s.addMetaToLayer(n,n.searchLayerPredicate)},[n,i]),o.jsx(me.ImageryLayer,{...t})},Er=e=>{const{options:n,...t}=e,i=re(),s=i.shouldOptimizedTileRequests?new Kt(n,i):new S.WebMapServiceImageryProvider(n);return o.jsx(Pe,{...t,imageryProvider:s})},Cr=e=>{const{options:n,...t}=e,i=re(),s=i.shouldOptimizedTileRequests?new Yt(n,i):new S.WebMapTileServiceImageryProvider(n);return o.jsx(Pe,{...t,imageryProvider:s})},Tr=e=>{const{options:n,...t}=e,i=re(),s=i.shouldOptimizedTileRequests?new jt(n,i):new S.UrlTemplateImageryProvider(n);return o.jsx(Pe,{...t,imageryProvider:s})},wr=e=>{const{options:n,...t}=e;return o.jsx(Pe,{...t,imageryProvider:new S.OpenStreetMapImageryProvider(n)})},rn=e=>o.jsx(me.Entity,{...e}),Sr=e=>o.jsx(me.EntityDescription,{...e}),on=e=>o.jsx(me.EntityDescription,{...e}),sn=e=>o.jsx(me.PolygonGraphics,{...e}),an=e=>o.jsx(me.RectangleGraphics,{...e}),ln=e=>o.jsx(me.CustomDataSource,{...e}),br=e=>o.jsx(me.PolylineGraphics,{...e}),To="";var Ee=function(){var e=y.Ellipsoid.WGS84,n,t=y.Material.fromType(y.Material.ColorType);function i(a,l=new y.Color(1,1,0,.5),T=new y.Color(1,1,1,1)){this._scene=a.scene,t.uniforms.color=l,n=T,this._tooltip={setVisible:()=>{},showAt:()=>{}},this._surfaces=[],this.initialiseHandlers(),this.enhancePrimitives()}i.prototype.initialiseHandlers=function(){var a=this._scene,l=this,T=new y.ScreenSpaceEventHandler(a.canvas);function h(p,w){if(l._handlersMuted!=!0){var v=a.pick(w);v&&v.primitive&&v.primitive[p]&&v.primitive[p](w)}}T.setInputAction(function(p){h("leftClick",p.position)},y.ScreenSpaceEventType.LEFT_CLICK),T.setInputAction(function(p){h("leftDoubleClick",p.position)},y.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);var E;T.setInputAction(function(p){if(l._handlersMuted!=!0){var w=a.pick(p.endPosition);E&&(!w||E!=w.primitive)&&(!(E.isDestroyed&&E.isDestroyed())&&E.mouseOut(p.endPosition),E=null),w&&w.primitive&&(w=w.primitive,w.mouseOut&&(E=w),w.mouseMove&&w.mouseMove(p.endPosition))}},y.ScreenSpaceEventType.MOUSE_MOVE),T.setInputAction(function(p){h("leftUp",p.position)},y.ScreenSpaceEventType.LEFT_UP),T.setInputAction(function(p){h("leftDown",p.position)},y.ScreenSpaceEventType.LEFT_DOWN)},i.prototype.setListener=function(a,l,T){a[l]=T},i.prototype.muteHandlers=function(a){this._handlersMuted=a},i.prototype.registerEditableShape=function(a){var l=this;U(a,"mouseMove",function(T){a.setHighlighted(!0),a._editMode||l._tooltip.showAt(T,"Click to edit this shape")}),U(a,"mouseOut",function(T){a.setHighlighted(!1),l._tooltip.setVisible(!1)}),U(a,"leftClick",function(T){a.setEditMode(!0)})},i.prototype.startDrawing=function(a){this.disableAllEditMode(),this.editCleanUp&&this.editCleanUp(),this.editCleanUp=a,this.muteHandlers(!0)},i.prototype.stopDrawing=function(){this.editCleanUp&&(this.editCleanUp(),this.editCleanUp=null),this.muteHandlers(!1)},i.prototype.disableAllHighlights=function(){this.setHighlighted(void 0)},i.prototype.setHighlighted=function(a){this._highlightedSurface&&!this._highlightedSurface.isDestroyed()&&this._highlightedSurface!=a&&this._highlightedSurface.setHighlighted(!1),this._highlightedSurface=a},i.prototype.disableAllEditMode=function(){this.setEdited(void 0)},i.prototype.setEdited=function(a){this._editedSurface&&!this._editedSurface.isDestroyed()&&this._editedSurface.setEditMode(!1),this._editedSurface=a};var s={ellipsoid:y.Ellipsoid.WGS84,textureRotationAngle:0,height:0,asynchronous:!0,show:!0,debugShowBoundingVolume:!1},r=N(s,{appearance:new y.EllipsoidSurfaceAppearance({aboveGround:!1}),material:t,granularity:Math.PI/180}),u=N(s,{}),g=N(s,{}),f=N(s,{}),m=N(r,{rotation:0}),C=N(s,{width:5,geodesic:!0,granularity:1e4,appearance:new y.PolylineMaterialAppearance({aboveGround:!1}),material:t}),M=function(){function a(){}return a.prototype.initialiseOptions=function(l){q(this,l),this._ellipsoid=void 0,this._granularity=void 0,this._height=void 0,this._textureRotationAngle=void 0,this._id=void 0,this._createPrimitive=!0,this._primitive=void 0,this._outlinePolygon=void 0},a.prototype.setAttribute=function(l,T){this[l]=T,this._createPrimitive=!0},a.prototype.getAttribute=function(l){return this[l]},a.prototype.update=function(l,T,h){if(!y.defined(this.ellipsoid))throw new y.DeveloperError("this.ellipsoid must be defined.");if(!y.defined(this.appearance))throw new y.DeveloperError("this.material must be defined.");if(this.granularity<0)throw new y.DeveloperError("this.granularity and scene2D/scene3D overrides must be greater than zero.");if(this.show&&!(!this._createPrimitive&&!y.defined(this._primitive))){if(this._createPrimitive||this._ellipsoid!==this.ellipsoid||this._granularity!==this.granularity||this._height!==this.height||this._textureRotationAngle!==this.textureRotationAngle||this._id!==this.id){var E=this.getGeometry();if(!E)return;this._createPrimitive=!1,this._ellipsoid=this.ellipsoid,this._granularity=this.granularity,this._height=this.height,this._textureRotationAngle=this.textureRotationAngle,this._id=this.id,this._primitive=this._primitive&&this._primitive.destroy(),this._primitive=new y.Primitive({geometryInstances:new y.GeometryInstance({geometry:E,id:this.id,pickPrimitive:this}),appearance:this.appearance,asynchronous:this.asynchronous}),this._outlinePolygon=this._outlinePolygon&&this._outlinePolygon.destroy(),this.strokeColor&&this.getOutlineGeometry&&(this._outlinePolygon=new y.Primitive({geometryInstances:new y.GeometryInstance({geometry:this.getOutlineGeometry(),attributes:{color:y.ColorGeometryInstanceAttribute.fromColor(this.strokeColor)}}),appearance:new y.PerInstanceColorAppearance({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:this.strokeWidth||4}})}))}var p=this._primitive;p.appearance.material=this.material,p.debugShowBoundingVolume=this.debugShowBoundingVolume,p.update(l,T,h),this._outlinePolygon&&this._outlinePolygon.update(l,T,h)}},a.prototype.isDestroyed=function(){return!1},a.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),y.destroyObject(this)},a.prototype.setStrokeStyle=function(l,T){(!this.strokeColor||!this.strokeColor.equals(l)||this.strokeWidth!=T)&&(this._createPrimitive=!0,this.strokeColor=l,this.strokeWidth=T)},a}();i.ExtentPrimitive=function(){function a(l){if(!y.defined(l.extent))throw new y.DeveloperError("Extent is required");l=N(l,r),this.initialiseOptions(l),this.setExtent(l.extent)}return a.prototype=new M,a.prototype.setExtent=function(l){this.setAttribute("extent",l)},a.prototype.getExtent=function(){return this.getAttribute("extent")},a.prototype.getGeometry=function(){if(y.defined(this.extent))return new y.RectangleGeometry({rectangle:this.extent,height:this.height,vertexFormat:y.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return new y.RectangleOutlineGeometry({rectangle:this.extent})},a}(),i.PolygonPrimitive=function(){function a(l){l=N(l,r),this.initialiseOptions(l),this.isPolygon=!0}return a.prototype=new M,a.prototype.setPositions=function(l){this.setAttribute("positions",l)},a.prototype.getPositions=function(){return this.getAttribute("positions")},a.prototype.getGeometry=function(){if(!(!y.defined(this.positions)||this.positions.length<3))return y.PolygonGeometry.fromPositions({positions:this.positions,height:this.height,vertexFormat:y.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return y.PolygonOutlineGeometry.fromPositions({positions:this.getPositions()})},a}(),i.CirclePrimitive=function(){function a(l){if(!(y.defined(l.center)&&y.defined(l.radius)))throw new y.DeveloperError("Center and radius are required");l=N(l,r),this.initialiseOptions(l),this.setRadius(l.radius)}return a.prototype=new M,a.prototype.setCenter=function(l){this.setAttribute("center",l)},a.prototype.setRadius=function(l){this.setAttribute("radius",Math.max(.1,l))},a.prototype.getCenter=function(){return this.getAttribute("center")},a.prototype.getRadius=function(){return this.getAttribute("radius")},a.prototype.getGeometry=function(){if(y.defined(this.center)&&y.defined(this.radius))return new y.CircleGeometry({center:this.center,radius:this.radius,height:this.height,vertexFormat:y.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return new y.CircleOutlineGeometry({center:this.getCenter(),radius:this.getRadius()})},a}(),i.EllipsePrimitive=function(){function a(l){if(!(y.defined(l.center)&&y.defined(l.semiMajorAxis)&&y.defined(l.semiMinorAxis)))throw new y.DeveloperError("Center and semi major and semi minor axis are required");l=N(l,m),this.initialiseOptions(l)}return a.prototype=new M,a.prototype.setCenter=function(l){this.setAttribute("center",l)},a.prototype.setSemiMajorAxis=function(l){l<this.getSemiMinorAxis()||this.setAttribute("semiMajorAxis",l)},a.prototype.setSemiMinorAxis=function(l){l>this.getSemiMajorAxis()||this.setAttribute("semiMinorAxis",l)},a.prototype.setRotation=function(l){return this.setAttribute("rotation",l)},a.prototype.getCenter=function(){return this.getAttribute("center")},a.prototype.getSemiMajorAxis=function(){return this.getAttribute("semiMajorAxis")},a.prototype.getSemiMinorAxis=function(){return this.getAttribute("semiMinorAxis")},a.prototype.getRotation=function(){return this.getAttribute("rotation")},a.prototype.getGeometry=function(){if(y.defined(this.center)&&y.defined(this.semiMajorAxis)&&y.defined(this.semiMinorAxis))return new y.EllipseGeometry({ellipsoid:this.ellipsoid,center:this.center,semiMajorAxis:this.semiMajorAxis,semiMinorAxis:this.semiMinorAxis,rotation:this.rotation,height:this.height,vertexFormat:y.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return new y.EllipseOutlineGeometry({center:this.getCenter(),semiMajorAxis:this.getSemiMajorAxis(),semiMinorAxis:this.getSemiMinorAxis(),rotation:this.getRotation()})},a}(),i.PolylinePrimitive=function(){function a(l){l=N(l,C),this.initialiseOptions(l)}return a.prototype=new M,a.prototype.setPositions=function(l){this.setAttribute("positions",l)},a.prototype.setWidth=function(l){this.setAttribute("width",l)},a.prototype.setGeodesic=function(l){this.setAttribute("geodesic",l)},a.prototype.getPositions=function(){return this.getAttribute("positions")},a.prototype.getWidth=function(){return this.getAttribute("width")},a.prototype.getGeodesic=function(l){return this.getAttribute("geodesic")},a.prototype.getGeometry=function(){if(!(!y.defined(this.positions)||this.positions.length<2))return new y.PolylineGeometry({positions:this.positions,height:this.height,width:this.width<1?1:this.width,vertexFormat:y.EllipsoidSurfaceAppearance.VERTEX_FORMAT,ellipsoid:this.ellipsoid})},a}();var b={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},A={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},x={iconUrl:"./assets/img/dragIconLight.png",shiftX:0,shiftY:0};i.prototype.createBillboardGroup=function(a,l,T){var h=new i.BillboardGroup(this,l);return h.addBillboards(a,T),h},i.BillboardGroup=function(a,l){this._drawHelper=a,this._scene=a._scene,this._options=N(l,b);var T=new y.BillboardCollection;this._scene.primitives.add(T),this._billboards=T,this._orderedBillboards=[]},i.BillboardGroup.prototype.createBillboard=function(a,l){var T=this._billboards.add({show:!0,position:a,pixelOffset:new y.Cartesian2(this._options.shiftX,this._options.shiftY),eyeOffset:new y.Cartesian3(0,0,0),horizontalOrigin:y.HorizontalOrigin.CENTER,verticalOrigin:y.VerticalOrigin.CENTER,scale:1,image:this._options.iconUrl,color:n});if(l){let p=function(v){E.enableRotate=v},w=function(){for(var v=0,L=h._orderedBillboards.length;v<L&&h._orderedBillboards[v]!=T;++v);return v};var h=this,E=this._scene.screenSpaceCameraController;if(l.dragHandlers){var h=this;U(T,"leftDown",function(L){function I(O){T.position=O;for(var D=0,j=h._orderedBillboards.length;D<j&&h._orderedBillboards[D]!=T;++D);l.dragHandlers.onDrag&&l.dragHandlers.onDrag(w(),O)}function P(O){_.destroy(),p(!0),l.dragHandlers.onDragEnd&&l.dragHandlers.onDragEnd(w(),O)}var _=new y.ScreenSpaceEventHandler(h._scene.canvas);_.setInputAction(function(O){var D=h._scene.camera.pickEllipsoid(O.endPosition,e);D?I(D):P(D)},y.ScreenSpaceEventType.MOUSE_MOVE),_.setInputAction(function(O){P(h._scene.camera.pickEllipsoid(O.position,e))},y.ScreenSpaceEventType.LEFT_UP),p(!1),l.dragHandlers.onDragStart&&l.dragHandlers.onDragStart(w(),h._scene.camera.pickEllipsoid(L,e))})}l.onDoubleClick&&U(T,"leftDoubleClick",function(v){l.onDoubleClick(w())}),l.onClick&&U(T,"leftClick",function(v){l.onClick(w())}),l.tooltip&&(U(T,"mouseMove",function(v){h._drawHelper._tooltip.showAt(v,l.tooltip())}),U(T,"mouseOut",function(v){h._drawHelper._tooltip.setVisible(!1)}))}return T},i.BillboardGroup.prototype.insertBillboard=function(a,l,T){this._orderedBillboards.splice(a,0,this.createBillboard(l,T))},i.BillboardGroup.prototype.addBillboard=function(a,l){this._orderedBillboards.push(this.createBillboard(a,l))},i.BillboardGroup.prototype.addBillboards=function(a,l){for(var T=0;T<a.length;T++)this.addBillboard(a[T],l)},i.BillboardGroup.prototype.updateBillboardsPositions=function(a){for(var l=0;l<a.length;l++)this.getBillboard(l).position=a[l]},i.BillboardGroup.prototype.countBillboards=function(){return this._orderedBillboards.length},i.BillboardGroup.prototype.getBillboard=function(a){return this._orderedBillboards[a]},i.BillboardGroup.prototype.removeBillboard=function(a){this._billboards.remove(this.getBillboard(a)),this._orderedBillboards.splice(a,1)},i.BillboardGroup.prototype.remove=function(){this._billboards=this._billboards&&this._billboards.removeAll()&&this._billboards.destroy()},i.BillboardGroup.prototype.setOnTop=function(){this._scene.primitives.raiseToTop(this._billboards)},i.prototype.startDrawingMarker=function(l){var l=N(l,b);this.startDrawing(function(){p.remove(),w.destroy(),E.setVisible(!1)});var T=this,h=this._scene;h.primitives;var E=this._tooltip,p=new i.BillboardGroup(this,l),w=new y.ScreenSpaceEventHandler(h.canvas);w.setInputAction(function(v){if(v.position!=null){var L=h.camera.pickEllipsoid(v.position,e);L&&(p.addBillboard(L),T.stopDrawing(),l.callback(L))}},y.ScreenSpaceEventType.LEFT_CLICK),w.setInputAction(function(v){var L=v.endPosition;if(L!=null){var I=h.camera.pickEllipsoid(L,e);I?E.showAt(L,"<p>Click to add your marker. Position is: </p>"+X(e.cartesianToCartographic(I))):E.showAt(L,"<p>Click on the globe to add your marker.</p>")}},y.ScreenSpaceEventType.MOUSE_MOVE)},i.prototype.startDrawingPolygon=function(l){var l=N(l,r);this.startDrawingPolyshape(!0,l)},i.prototype.startDrawingPolyline=function(l){var l=N(l,C);this.startDrawingPolyshape(!1,l)},i.prototype.startDrawingPolyshape=function(a,l){this.startDrawing(function(){E.remove(v),I.remove(),P.destroy(),p.setVisible(!1),G(h)});var T=this,h=this._scene,E=h.primitives,p=this._tooltip,w=a?3:2,v;a?v=new Ee.PolygonPrimitive(l):v=new Ee.PolylinePrimitive(l),v.asynchronous=!1,E.add(v);var L=[],I=new i.BillboardGroup(this,b),P=new y.ScreenSpaceEventHandler(h.canvas);Q(h),P.setInputAction(function(_){if(_.position!=null){var O=h.camera.pickEllipsoid(_.position,e);O&&(L.length==0&&(L.push(O.clone()),I.addBillboard(L[0])),L.length>=w&&(v.positions=L,v._createPrimitive=!0),L.push(O),I.addBillboard(O))}},y.ScreenSpaceEventType.LEFT_CLICK),P.setInputAction(function(_){var O=_.endPosition;if(O!=null)if(L.length==0)p.showAt(O,"<p>Click to add first point</p>");else{var D=h.camera.pickEllipsoid(O,e);D&&(L.pop(),D.y+=1+Math.random(),L.push(D),L.length>=w&&(v.positions=L,v._createPrimitive=!0),I.getBillboard(L.length-1).position=D,p.showAt(O,"<p>Click to add new point ("+L.length+")</p>"+(L.length>w?"<p>Double click to finish drawing</p>":"")))}},y.ScreenSpaceEventType.MOUSE_MOVE),P.setInputAction(function(_){var O=_.position;if(O!=null){if(L.length<w+2)return;var D=h.camera.pickEllipsoid(O,e);D&&(G(h),T.stopDrawing(),typeof l.callback=="function"&&(L.length-1,l.callback(L)))}},y.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)};function W(a){return e.cartographicArrayToCartesianArray([y.Rectangle.northwest(a),y.Rectangle.northeast(a),y.Rectangle.southeast(a),y.Rectangle.southwest(a)])}function Q(a){a&&(a.canvas.style.cursor="crosshair")}function G(a){a&&(a.canvas.style.cursor="")}i.prototype.startDrawingExtent=function(l){var l=N(l,r);this.startDrawing(function(){v!=null&&E.remove(v),L!=null&&L.remove(),I.destroy(),p.setVisible(!1),G(h)});var T=this,h=this._scene,E=this._scene.primitives,p=this._tooltip,w=null,v=null,L=null,I=new y.ScreenSpaceEventHandler(h.canvas);Q(h);function P(_){v==null&&(v=new Ee.ExtentPrimitive({extent:_,material:l.material}),v.asynchronous=!1,E.add(v)),v.setExtent(_);var O=W(_);L==null?(L=new i.BillboardGroup(T,b),L.addBillboards(O)):L.updateBillboardsPositions(O)}I.setInputAction(function(_){if(_.position!=null){var O=h.camera.pickEllipsoid(_.position,e);if(O)if(v==null){w=e.cartesianToCartographic(O);var D=Y(w,w);P(D)}else T.stopDrawing(),typeof l.callback=="function"&&l.callback(Y(w,e.cartesianToCartographic(O)))}},y.ScreenSpaceEventType.LEFT_DOWN),I.setInputAction(function(_){var O=_.endPosition;if(O!=null)if(v==null)p.showAt(O,"<p>Click to start drawing rectangle</p>");else{var D=h.camera.pickEllipsoid(O,e);if(D){var j=Y(w,e.cartesianToCartographic(D));P(j),p.showAt(O,"<p>Drag to change rectangle extent</p><p>Click again to finish drawing</p>")}}},y.ScreenSpaceEventType.MOUSE_MOVE)},i.prototype.startDrawingCircle=function(l){var l=N(l,r);this.startDrawing(function(){w!=null&&E.remove(w),v.remove(),L.destroy(),p.setVisible(!1)});var T=this,h=this._scene,E=this._scene.primitives,p=this._tooltip,w=null,v=null,L=new y.ScreenSpaceEventHandler(h.canvas);L.setInputAction(function(I){if(I.position!=null){var P=h.camera.pickEllipsoid(I.position,e);P&&(w==null?(w=new i.CirclePrimitive({center:P,radius:0,asynchronous:!1,material:l.material}),E.add(w),v=new i.BillboardGroup(T,b),v.addBillboards([P])):(typeof l.callback=="function"&&l.callback(w.getCenter(),w.getRadius()),T.stopDrawing()))}},y.ScreenSpaceEventType.LEFT_DOWN),L.setInputAction(function(I){var P=I.endPosition;if(P!=null)if(w==null)p.showAt(P,"<p>Click to start drawing the circle</p>");else{var _=h.camera.pickEllipsoid(P,e);_&&(w.setRadius(y.Cartesian3.distance(w.getCenter(),_)),v.updateBillboardsPositions(_),p.showAt(P,"<p>Move mouse to change circle radius</p><p>Click again to finish drawing</p>"))}},y.ScreenSpaceEventType.MOUSE_MOVE)},i.prototype.enhancePrimitives=function(){var a=this;y.Billboard.prototype.setEditable=function(){if(this._editable)return;this._editable=!0;var h=this,E=this;function p(w){a._scene.screenSpaceCameraController.enableRotate=w}U(h,"leftDown",function(w){function v(P){h.position=P,E.executeListeners({name:"drag",positions:P})}function L(P){I.destroy(),p(!0),E.executeListeners({name:"dragEnd",positions:P})}var I=new y.ScreenSpaceEventHandler(a._scene.canvas);I.setInputAction(function(P){var _=a._scene.camera.pickEllipsoid(P.endPosition,e);_?v(_):L(_)},y.ScreenSpaceEventType.MOUSE_MOVE),I.setInputAction(function(P){L(a._scene.camera.pickEllipsoid(P.position,e))},y.ScreenSpaceEventType.LEFT_UP),p(!1)}),oe(h)};function l(h){a._scene,!(this._highlighted&&this._highlighted==h)&&this._editMode!==!0&&(this._highlighted=h,h?(a.setHighlighted(this),this._strokeColor=this.strokeColor,this.setStrokeStyle(y.Color.fromCssColorString("white"),this.strokeWidth)):this._strokeColor?this.setStrokeStyle(this._strokeColor,this.strokeWidth):this.setStrokeStyle(void 0,void 0))}function T(h){if(this._editMode!=h)if(a.disableAllHighlights(),h){a.setEdited(this);var E=a._scene,p=this;if(this._markers==null){let D=function(B,$){var te=B-1<0?$.length-1:B-1;te<v.countBillboards()&&(v.getBillboard(te).position=J(te)),te=B,te<v.countBillboards()&&(v.getBillboard(te).position=J(te))},j=function(){p.executeListeners({name:"onEdited",positions:p.positions})},J=function(B){var $=p.positions;return e.cartographicToCartesian(new y.EllipsoidGeodesic(e.cartesianToCartographic($[B]),e.cartesianToCartographic($[B<$.length-1?B+1:0])).interpolateUsingFraction(.5))};var w=new i.BillboardGroup(a,A),v=new i.BillboardGroup(a,x),L={dragHandlers:{onDrag:function(B,$){p.positions[B]=$,D(B,p.positions),p._createPrimitive=!0},onDragEnd:function(B,$){p._createPrimitive=!0,j()}},onDoubleClick:function(B){p.positions.length<4||(p.positions.splice(B,1),p._createPrimitive=!0,w.removeBillboard(B),v.removeBillboard(B),D(B,p.positions),j())},tooltip:function(){if(p.positions.length>3)return"Double click to remove this point"}};w.addBillboards(p.positions,L),this._markers=w;for(var I=[],P=0,_=p.positions.length+(this.isPolygon?0:-1);P<_;P++)I.push(J(P));var O={dragHandlers:{onDragStart:function(B,$){this.index=B+1,p.positions.splice(this.index,0,$),p._createPrimitive=!0},onDrag:function(B,$){p.positions[this.index]=$,p._createPrimitive=!0},onDragEnd:function(B,$){w.insertBillboard(this.index,$,L),v.getBillboard(this.index-1).position=J(this.index-1),v.insertBillboard(this.index,J(this.index),O),p._createPrimitive=!0,j()}},tooltip:function(){return"Drag to create a new point"}};v.addBillboards(I,O),this._editMarkers=v,this._globeClickhandler=new y.ScreenSpaceEventHandler(E.canvas),this._globeClickhandler.setInputAction(function(B){var $=E.pick(B.position);$&&$.primitive||p.setEditMode(!1)},y.ScreenSpaceEventType.LEFT_CLICK),w.setOnTop(),v.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._editMarkers.remove(),this._markers=null,this._editMarkers=null,this._globeClickhandler.destroy()),this._editMode=!1}Ee.PolylinePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var h=this;h.isPolygon=!1,h.asynchronous=!1,a.registerEditableShape(h),h.setEditMode=T;var E=this.width;h.setHighlighted=function(p){this._editMode!==!0&&(p?(a.setHighlighted(this),this.setWidth(E*2)):this.setWidth(E))},h.getExtent=function(){return y.Rectangle.fromCartographicArray(e.cartesianArrayToCartographicArray(this.positions))},oe(h),h.setEditMode(!1)}},Ee.PolygonPrimitive.prototype.setEditable=function(){var h=this;h.asynchronous=!1,a._scene,a.registerEditableShape(h),h.setEditMode=T,h.setHighlighted=l,oe(h),h.setEditMode(!1)},Ee.ExtentPrimitive.prototype.setEditable=function(){if(!this.setEditMode){var h=this,E=a._scene;a.registerEditableShape(h),h.asynchronous=!1,h.setEditMode=function(p){if(this._editMode!=p)if(a.disableAllHighlights(),p){if(a.setEdited(this),this._markers==null){let L=function(){h.executeListeners({name:"onEdited",extent:h.extent})};var w=new i.BillboardGroup(a,A),v={dragHandlers:{onDrag:function(I,P){var _=w.getBillboard((I+2)%4).position;h.setExtent(Y(e.cartesianToCartographic(_),e.cartesianToCartographic(P))),w.updateBillboardsPositions(W(h.extent))},onDragEnd:function(I,P){L()}},tooltip:function(){return"Drag to change the corners of this extent"}};w.addBillboards(W(h.extent),v),this._markers=w,this._globeClickhandler=new y.ScreenSpaceEventHandler(E.canvas),this._globeClickhandler.setInputAction(function(I){var P=E.pick(I.position);P&&!P.isDestroyed()&&P.primitive||h.setEditMode(!1)},y.ScreenSpaceEventType.LEFT_CLICK),w.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},h.setHighlighted=l,oe(h),h.setEditMode(!1)}},i.EllipsePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var h=this,E=a._scene;h.asynchronous=!1,a.registerEditableShape(h),h.setEditMode=function(p){if(this._editMode!=p)if(a.disableAllHighlights(),p){a.setEdited(this);var w=this;if(this._markers==null){let I=function(){return y.EllipseOutlineGeometry(e,h.getCenter(),h.getSemiMajorAxis(),h.getSemiMinorAxis(),h.getRotation()+Math.PI/2,Math.PI/2).splice(0,4)},P=function(){h.executeListeners({name:"onEdited",center:h.getCenter(),semiMajorAxis:h.getSemiMajorAxis(),semiMinorAxis:h.getSemiMinorAxis(),rotation:0})};var v=new i.BillboardGroup(a,A),L={dragHandlers:{onDrag:function(_,O){var D=y.Cartesian3.distance(h.getCenter(),O);_%2==0?h.setSemiMajorAxis(D):h.setSemiMinorAxis(D),v.updateBillboardsPositions(I())},onDragEnd:function(_,O){P()}},tooltip:function(){return"Drag to change the excentricity and radius"}};v.addBillboards(I(),L),this._markers=v,this._globeClickhandler=new y.ScreenSpaceEventHandler(E.canvas),this._globeClickhandler.setInputAction(function(_){var O=E.pick(_.position);O&&O.primitive||w.setEditMode(!1)},y.ScreenSpaceEventType.LEFT_CLICK),v.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},h.setHighlighted=l,oe(h),h.setEditMode(!1)}},i.CirclePrimitive.prototype.getCircleCartesianCoordinates=function(h){for(var E=y.CircleOutlineGeometry.createGeometry(new y.CircleOutlineGeometry({ellipsoid:e,center:this.getCenter(),radius:this.getRadius(),granularity:h})),p=0,w,v=[];p<E.attributes.position.values.length;p+=3)w=E.attributes.position.values,v.push(new y.Cartesian3(w[p],w[p+1],w[p+2]));return v},i.CirclePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var h=this,E=a._scene;h.asynchronous=!1,a.registerEditableShape(h),h.setEditMode=function(p){if(this._editMode!=p)if(a.disableAllHighlights(),p){a.setEdited(this);var w=this;if(this._markers==null){let I=function(){return w.getCircleCartesianCoordinates(y.Math.PI_OVER_TWO)},P=function(){h.executeListeners({name:"onEdited",center:h.getCenter(),radius:h.getRadius()})};var v=new i.BillboardGroup(a,A),L={dragHandlers:{onDrag:function(_,O){h.setRadius(y.Cartesian3.distance(h.getCenter(),O)),v.updateBillboardsPositions(I())},onDragEnd:function(_,O){P()}},tooltip:function(){return"Drag to change the radius"}};v.addBillboards(I(),L),this._markers=v,this._globeClickhandler=new y.ScreenSpaceEventHandler(E.canvas),this._globeClickhandler.setInputAction(function(_){var O=E.pick(_.position);O&&O.primitive||w.setEditMode(!1)},y.ScreenSpaceEventType.LEFT_CLICK),v.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},h.setHighlighted=l,oe(h),h.setEditMode(!1)}}},i.DrawHelperWidget=function(){function a(l,T){if(!y.defined(T.container))throw new y.DeveloperError("Container is required");var h={markerIcon:"./assets/img/glyphicons_242_google_maps.png",polylineIcon:"./assets/img/glyphicons_097_vector_path_line.png",polygonIcon:"./assets/img/glyphicons_096_vector_path_polygon.png",circleIcon:"./assets/img/glyphicons_095_vector_path_circle.png",extentIcon:"./assets/img/glyphicons_094_vector_path_square.png",clearIcon:"./assets/img/glyphicons_067_cleaning.png",polylineDrawingOptions:C,polygonDrawingOptions:u,extentDrawingOptions:g,circleDrawingOptions:f};q(T,h);var E=this,p=document.createElement("DIV");p.className="toolbar",T.container.appendChild(p);function w(I,P,_,O){var D=document.createElement("DIV");D.className="button",D.title=_,p.appendChild(D),D.onclick=O;var j=document.createElement("SPAN");D.appendChild(j);var J=document.createElement("IMG");return J.src=P,j.appendChild(J),D}var v=l._scene;w("marker",T.markerIcon,"Click to start drawing a 2D marker",function(){l.startDrawingMarker({callback:function(I){E.executeListeners({name:"markerCreated",position:I})}})}),w("polyline",T.polylineIcon,"Click to start drawing a 2D polyline",function(){l.startDrawingPolyline({callback:function(I){E.executeListeners({name:"polylineCreated",positions:I})}})}),w("polygon",T.polygonIcon,"Click to start drawing a 2D polygon",function(){l.startDrawingPolygon({callback:function(I){E.executeListeners({name:"polygonCreated",positions:I})}})}),w("extent",T.extentIcon,"Click to start drawing an Extent",function(){l.startDrawingExtent({callback:function(I){E.executeListeners({name:"extentCreated",extent:I})}})}),w("circle",T.circleIcon,"Click to start drawing a Circle",function(){l.startDrawingCircle({callback:function(I,P){E.executeListeners({name:"circleCreated",center:I,radius:P})}})});var L=document.createElement("DIV");L.className="divider",p.appendChild(L),w("clear",T.clearIcon,"Remove all primitives",function(){v.primitives.removeAll()}),oe(this)}return a}(),i.prototype.addToolbar=function(a,l){return l=N(l,{container:a}),new i.DrawHelperWidget(this,l)};function Y(a,l){var T=new y.Rectangle;T.west=Math.min(a.longitude,l.longitude),T.east=Math.max(a.longitude,l.longitude),T.south=Math.min(a.latitude,l.latitude),T.north=Math.max(a.latitude,l.latitude);var h=y.Math.EPSILON7;return T.east-T.west<h&&(T.east+=h*2),T.north-T.south<h&&(T.north+=h*2),T}function X(a,l){return a.longitude.toFixed(l||3)+", "+a.latitude.toFixed(l||3)}function k(a,l){if(a==null||typeof a!="object"||a.constructor!=Object&&a.constructor!=Array)return a;if(a.constructor==Date||a.constructor==RegExp||a.constructor==Function||a.constructor==String||a.constructor==Number||a.constructor==Boolean)return new a.constructor(a);l=l||new a.constructor;for(var T in a)l[T]=typeof l[T]>"u"?k(a[T],null):l[T];return l}function q(a,l){a=a||{};var T;for(T in l)a[T]===void 0&&(a[T]=k(l[T]))}function N(a,l){var T=k(a),h;for(h in l)T[h]===void 0&&(T[h]=k(l[h]));return T}function U(a,l,T){a[l]=T}function oe(a){a._listeners={},a.addListener=function(l,T){return this._listeners[l]=this._listeners[l]||[],this._listeners[l].push(T),this._listeners[l].length},a.executeListeners=function(l,T){if(this._listeners[l.name]&&this._listeners[l.name].length>0)for(var h=0;h<this._listeners[l.name].length;h++)this._listeners[l.name][h](l);else T&&T(l)}}return i}();const Lr=2,Mr=(e,n)=>{switch(e){case ae.BOX:{if(n.features.length!==Lr)throw new Error(`${e} must have 2 points`);const t=z.find(n.features,s=>{var r;return((r=s.properties)==null?void 0:r.type)===De.BOTTOM_LEFT}),i=z.find(n.features,s=>{var r;return((r=s.properties)==null?void 0:r.type)===De.TOP_RIGHT});if(i&&t){if(t.geometry.coordinates[0]===i.geometry.coordinates[0]&&t.geometry.coordinates[1]===i.geometry.coordinates[1])throw new Error(`${e} must define BOTTOM_LEFT and TOP_RIGHT different points`);return S.Rectangle.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],i.geometry.coordinates[0],i.geometry.coordinates[1])}else throw new Error(`${e} geojson must define BOTTOM_LEFT and TOP_RIGHT points`)}default:throw new Error(`${e} type geoJSON still not supported`)}},cn=e=>{const n=e.map(t=>{const i=S.Cartographic.fromCartesian(t);return[S.Math.toDegrees(i.longitude),S.Math.toDegrees(i.latitude)]});return n.push(n[0]),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}},dn=e=>{const n=gt.lineString([[S.Math.toDegrees(e.west),S.Math.toDegrees(e.south)],[S.Math.toDegrees(e.east),S.Math.toDegrees(e.north)]]);return ct(lt(n))},un=e=>{const n=gt.lineString([[e.west,e.south],[e.east,e.north]]);return ct(lt(n)).geometry.coordinates[0].map(i=>S.Cartesian3.fromRadiansArray(i)[0])};class _r extends S.Color{}const Pr=e=>{const{drawState:n,drawingMaterial:t,drawingVertexColor:i,material:s,hollow:r,outlineWidth:u}=e,g=re(),[f,m]=c.useState();c.useEffect(()=>{m(new Ee(g,t,i))},[]),c.useEffect(()=>{if(f){const M=f;if(n.drawing)switch(n.type){case ae.POLYGON:g.scene.globe.depthTestAgainstTerrain=!1,M.startDrawingPolygon({callback:b=>{n.handler({primitive:b,type:ae.POLYGON,geojson:cn(b)})}});break;case ae.BOX:g.scene.globe.depthTestAgainstTerrain=!1,M.startDrawingExtent({callback:b=>{n.handler({primitive:b,type:ae.BOX,geojson:dn(b)})}});break;default:throw new Error(`[CESIUM DRAW]: ${n.type} unrecognized primitive to draw.`)}else M.stopDrawing(),g.scene.globe.depthTestAgainstTerrain=!0}},[n,f]);const C=M=>{try{let b=M.coordinates!==void 0?M.coordinates:Mr(M.type,M.geojson);if(r!==!0)switch(M.type){case ae.BOX:return o.jsx(an,{coordinates:b,material:s??t});case ae.POLYGON:return o.jsx(sn,{hierarchy:new S.PolygonHierarchy(b),material:s??t});default:return o.jsx(o.Fragment,{})}else{switch(M.type){case ae.BOX:b=un(b);break;case ae.POLYGON:b=[...b,b[0]];break;default:return o.jsx(o.Fragment,{})}return o.jsx(br,{clampToGround:!0,positions:b,width:u??1,material:s??t})}}catch(b){return console.error(b),o.jsx(o.Fragment,{})}};return o.jsx(ln,{...e,children:e.drawings.map((M,b)=>o.jsxs(rn,{name:M.name,children:[o.jsxs(on,{children:[o.jsxs("h1",{children:["Drawed Entity ",M.name]}),o.jsx("p",{children:"This is description of drawed entity"})]}),C(M)]},M.id))})},Ir=e=>{const n=re();return c.useEffect(()=>{n.extend(S.viewerCesiumInspectorMixin)},[n]),o.jsx(o.Fragment,{})},Or=-25,hn=2,Ar=e=>{const n=re(),t=(r,u=",")=>r.slice(r.indexOf(`
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/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/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.bbox,d.getCaretCoordinates,d.getInputSelection,d.chonky,d.chonkyIconFontawesome,d.filesize,d.Select))})(this,function(d,o,c,me,Ae,Le,at,Se,Q,U,bn,lt,Mn,be,_n,ct,wo,dt,Ze,Xe,ut,ht,Je,Qe,Pn,Dn,In,ke,On,gt,An,kn,Nn,pt,xn,Co,Bn,ft,Fn,Vn,Gn,ve,p,q,Hn,Re,mt,Wn,zn,Lo,bo,yt,et,vt,$n,Et,K,Un,qn,St){"use strict";var So=Object.defineProperty;var To=(d,o,c)=>o in d?So(d,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[o]=c;var ne=(d,o,c)=>(To(d,typeof o!="symbol"?o+"":o,c),c);function tt(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 Tt=tt(c),w=tt(p),wt=tt(mt);var he=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(he||{}),fe=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(fe||{}),Ne=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Ne||{});const ie={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:fe.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:fe.EN},renderAsButton:!0,offset:0,disableFuture:!0}},oe=e=>{const{children:n,...t}=e;return o.jsx(Q.Box,{...t,children:n})},xe=e=>{const n=e.type==="dark";return c.useMemo(()=>Ct(e,n),[n,e])},Ct=(e,n=!1)=>Se.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}}}),Mo="",jn=2,Kn=.5,Yn=Se.makeStyles(e=>Se.createStyles({container:{padding:e.spacing(jn),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Kn)}})),Lt=e=>{var Y,V,j,H;const n=Yn(),t=U.useTheme(),r=xe(t),[s,i]=c.useState(null),[u,h]=c.useState(null),[f,m]=c.useState(ie.DATE_RANGE_PICKER.dateFormat),v=e.controlsLayout??ie.DATE_RANGE_PICKER.controlsLayout,M=e.disableFuture??ie.DATE_RANGE_PICKER.disableFuture,b=((Y=e.local)==null?void 0:Y.startPlaceHolderText)??ie.DATE_RANGE_PICKER.local.startPlaceHolderText,T=((V=e.local)==null?void 0:V.endPlaceHolderText)??ie.DATE_RANGE_PICKER.local.endPlaceHolderText,G=((j=e.local)==null?void 0:j.setText)??ie.DATE_RANGE_PICKER.local.setText,Z=(((H=e.local)==null?void 0:H.calendarLocale)??ie.DATE_RANGE_PICKER.local.calendarLocale)===fe.HE?Ae.he:Ae.enUS;c.useEffect(()=>{i(e.from??null)},[e.from]),c.useEffect(()=>{h(e.to??null)},[e.to]),c.useEffect(()=>{m(e.dateFormat??ie.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const $=Boolean(me.isValid(s)&&!u||me.isValid(u)&&!s||s&&u&&me.isValid(s)&&me.isValid(u)&&me.isBefore(s,u)),X=()=>{e.onChange({from:s&&me.isValid(s)?s:void 0,to:u&&me.isValid(u)?u:void 0})};return o.jsx(Q.ThemeProvider,{theme:r,children:o.jsx(oe,{className:`${n.container} drpContainer`,display:"flex",flexDirection:v,width:v==="column"?e.contentWidth:"unset",children:o.jsxs(Le.MuiPickersUtilsProvider,{utils:at,locale:Z,children:[o.jsx(Le.KeyboardDateTimePicker,{variant:"inline",placeholder:b,onChange:W=>i(W),value:s,disableFuture:M,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(Le.KeyboardDateTimePicker,{variant:"inline",placeholder:T,className:n.margin,onChange:W=>h(W),value:u,disableFuture:M,format:f,maxDate:e.maxDate,minDate:e.minDate}),o.jsx(U.ThemeProvider,{options:t,children:o.jsx(U.Button,{className:`${n.setButton} ${n.margin}`,raised:!0,onClick:X,disabled:!$,children:G})})]})})})},bt=e=>{const{children:n,...t}=e;return o.jsx(Q.Popover,{...t,children:n})},_o="",Zn=e=>{var V,j;const[n,t]=c.useState(null),[r,s]=c.useState(null),[i,u]=c.useState(ie.DATE_RANGE_PICKER.dateFormat),[h,f]=c.useState(null),m=H=>{f(H.currentTarget)},v=H=>{H.currentTarget.tagName==="I"?f(H.currentTarget.previousElementSibling):f(H.currentTarget)},M=()=>{f(null)},b=Boolean(h),T=e.controlsLayout??"column";c.useEffect(()=>{t(e.from??null)},[e.from]),c.useEffect(()=>{s(e.to??null)},[e.to]),c.useEffect(()=>{u(e.dateFormat??ie.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const G=((V=e.local)==null?void 0:V.startPlaceHolderText)??ie.DATE_RANGE_PICKER.local.startPlaceHolderText,z=((j=e.local)==null?void 0:j.endPlaceHolderText)??ie.DATE_RANGE_PICKER.local.endPlaceHolderText,Z=e.renderAsButton===void 0?ie.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,$=e.offset===void 0?ie.DATE_RANGE_PICKER.offset:e.offset,X=e.disableFuture===void 0?ie.DATE_RANGE_PICKER.disableFuture:e.disableFuture,Y=c.useMemo(()=>`${n?me.format(n,i):G} - ${r?me.format(r,i):z}`,[n,r,i,G,z]);return o.jsxs(o.Fragment,{children:[Z?o.jsx(U.Button,{style:{width:e.width},raised:!0,onClick:m,className:"drpOpener",children:Y}):o.jsx(U.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:Y,onClick:v,trailingIcon:{icon:"date_range",tabIndex:0,onClick:v}}),o.jsx(bt,{open:b,anchorEl:h,onClose:M,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:o.jsx(Lt,{controlsLayout:T,contentWidth:((h==null?void 0:h.clientWidth)??0)-$,dateFormat:i,disableFuture:X,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:n??void 0,to:r??void 0,onChange:({from:H,to:W})=>{t(H??null),s(W??null),e.onChange({from:H,to:W}),M()}})})]})},Be=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,Xn=({endDate:e,startDate:n,setEndDate:t=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:i="",endTimeWrapperClassName:u="",timeRangeInputsWrapperClassName:h="",startTimeInputClassName:f="",startTimeLabel:m="",startTimeWrapperClassName:v=""})=>o.jsxs("div",{className:`timeRangeWrapper ${h}`,children:[o.jsx("div",{className:`startTimeWrapper ${v}`,children:o.jsx(U.TextField,{label:m,disabled:n===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:be(n).format("HH:mm"),onChange:M=>{const b=be(n),T=be(M.currentTarget.value,"HH:mm"),G=b.set({hours:T.get("hours"),minutes:T.get("minutes")});r(G.toDate())}})}),o.jsx("div",{className:`endTimeWrapper ${u}`,children:o.jsx(U.TextField,{label:i,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:be(e).format("HH:mm"),onChange:M=>{const b=be(e),T=be(M.currentTarget.value,"HH:mm"),G=b.set({hours:T.get("hours"),minutes:T.get("minutes")});t(G.toDate())}})})]}),Jn=c.forwardRef(({value:e,onClick:n,onInputClick:t,...r},s)=>o.jsx(U.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:i=>{n==null||n(i),t==null||t()},ref:s,value:e})),Qn=({setStartDate:e=()=>{},setEndDate:n=()=>{},shortcuts:t,dateRange:r,onShortcut:s})=>{const[i,u]=c.useState(),h=c.useMemo(()=>t.map(f=>f instanceof Function?f():f),[t]);return c.useEffect(()=>{for(const f of h){const m=r.startDate&&r.endDate&&me.isSameDay(f.startDate,r.startDate)&&me.isSameDay(f.endDate,r.endDate);i?f.id===i&&(m||u(void 0)):m&&u(f.id)}},[r,i,h]),o.jsx("div",{className:"shortcutsContainer",children:h.map((f,m)=>{const v=()=>{e(f.startDate),n(f.endDate)};return o.jsx(U.Button,{type:"button",className:`shortcut ${i===f.id?"selected":""}`,onClick:M=>{v(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+m)})})},Rn=c.forwardRef((e,n)=>{const{calendarClassName:t,dayClassName:r,monthClassName:s,selectsRange:i,onChange:u,inputName:h,showMonthYearDropdown:f,withShortcuts:m,locale:v="en"}=e,[M,b]=c.useState(null),[T,G]=c.useState(null),[z,Z]=c.useState(!1),$=i?{startDate:M,endDate:T}:M;c.useEffect(()=>{v==="he"&&lt.registerLocale("he",Mn)},[v]),c.useEffect(()=>{var V,j;((V=e.startDate)==null?void 0:V.toString())!==(M==null?void 0:M.toString())&&b(e.startDate),((j=e.endDate)==null?void 0:j.toString())!==(T==null?void 0:T.toString())&&G(e.endDate)},[e.startDate,e.endDate,M,T]);const X=c.useMemo(()=>{let V="pickerContainer"+(v==="he"?" pickerContainer-rtl":"");return m&&i&&(V+=" pickerContainer-withShortcuts"),V},[v,m,i]),Y=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return o.jsx("div",{className:X,style:{direction:v==="he"?"rtl":"ltr"},children:o.jsx(lt,{...e,ref:n,onClickOutside:()=>Z(!1),open:z,startDate:Be($)?M:void 0,selected:M,endDate:Be($)?T:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${t}`,weekDayClassName:V=>`pickerWeek ${(r==null?void 0:r(V))??""}`,dayClassName:V=>`pickerDay ${(r==null?void 0:r(V))??""}`,monthClassName:V=>`pickerMonth ${(s==null?void 0:s(V))??""}`,onChange:(V,j)=>{if(Array.isArray(V)){const[H,W]=V;b(H),G(W),u==null||u({startDate:H,endDate:W&&me.endOfDay(W)},j)}else b(V),u==null||u(V,j)},customInput:o.jsx(Jn,{name:h,onInputClick:()=>{Z(!0)}}),showTimeInput:!!(m&&i),timeInputLabel:"",customTimeInput:m&&Be($)&&o.jsx(Qn,{onShortcut:V=>{u==null||u(V),Z(!1)},shortcuts:m,setEndDate:G,setStartDate:b,dateRange:$}),showMonthYearDropdown:void 0,...Y})})}),Po="",er=e=>{const n=U.useTheme(),t=xe(n),{format:r=ie.DATE_PICKER.dateFormat,variant:s=ie.DATE_PICKER.variant,disableFuture:i=ie.DATE_PICKER.disableFuture,local:u,onChange:h,showTime:f=ie.DATE_PICKER.showTime,value:m,...v}=e,{placeHolderText:M=ie.DATE_PICKER.local.placeHolderText,calendarLocale:b}=u??{placeHolderText:ie.DATE_PICKER.local.placeHolderText,calendarLocale:fe.EN},T=b===fe.HE?Ae.he:Ae.enUS,G=z=>{h(z)};return o.jsx(Q.ThemeProvider,{theme:t,children:o.jsxs(Le.MuiPickersUtilsProvider,{utils:at,locale:T,children:[f&&o.jsx(Le.KeyboardDateTimePicker,{variant:s,placeholder:M,onChange:G,value:m,disableFuture:i,format:r,...v}),!f&&o.jsx(Le.KeyboardDatePicker,{variant:s,placeholder:M,onChange:G,value:m,disableFuture:i,format:r,...v})]})})},tr=18,nr=Se.makeStyles(e=>Se.createStyles({drawingButton:{width:e.spacing(tr)},fullWidth:{width:"100%",marginTop:"36px"}})),rr=e=>{const n=nr(),[t,r]=c.useState(null),{isSelectionEnabled:s,onCancelDraw:i,onStartDraw:u,onReset:h}=e,f=v=>{r(v.currentTarget)},m=()=>{r(null)};return s?o.jsx(U.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:o.jsx(U.Button,{className:n.drawingButton,raised:!0,onClick:i,children:"Cancel Draw"})}):o.jsxs(oe,{position:"relative",children:[o.jsx(U.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:o.jsx(U.Button,{className:n.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),o.jsxs(U.Menu,{className:n.fullWidth,open:Boolean(t),onClose:m,children:[o.jsx(U.MenuItem,{onClick:()=>{u(he.POLYGON),m()},children:"Polygon"}),o.jsx(U.MenuItem,{onClick:()=>{u(he.BOX),m()},children:"Box"}),o.jsx(U.MenuItem,{onClick:()=>{h(),m()},children:"Clear"})]})]})},Do="";var ye=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(ye||{});const Fe=5,Ve=2,Mt=c.createContext(null),ir=Mt.Provider,_t=35,Pt=32,or=10,sr=e=>e!==void 0&&e!==ye.WGS84?ut.transform([_t,Pt],ye.WGS84,e):[_t,Pt],ar=e=>{switch(e){case ye.WEB_MERCATOR:return n=>dt.format(n,"Mercator: {y}m, {x}m",Ve);case ye.WGS84:return n=>dt.format(n,"WGS84: {y}°N {x}°E",Fe);default:return n=>""}},Ce=()=>{const e=c.useContext(Mt);if(e===null)throw new Error("map context is null, please check the provider");return e},Dt=e=>{const n=c.useRef(null),{allowFullScreen:t,showMousePosition:r,projection:s}=e,[i]=c.useState(new ct.Map({view:new ct.View({projection:s??ye.WGS84}),controls:Ze.defaults()}));c.useEffect(()=>{i.getView().setCenter(e.center??sr(e.projection))},[i,e.center,e.projection]),c.useEffect(()=>{i.getView().setZoom(e.zoom??or)},[i,e.zoom,e.projection]);const u=(h,f)=>{f.getControls().forEach(v=>{v instanceof h&&f.removeControl(v)})};return c.useEffect(()=>{i.setTarget(n.current),t!==void 0&&t?i.addControl(new Ze.FullScreen):u(Ze.FullScreen,i)},[i,t]),c.useEffect(()=>{r!==void 0&&r?(u(Xe,i),i.addControl(new Xe({coordinateFormat:ar(s??ye.WGS84),projection:s??ye.WGS84,undefinedHTML:"&nbsp;"}))):u(Xe,i)},[i,r,s]),o.jsxs(ir,{value:i,children:[o.jsx("div",{className:"map",ref:n}),e.children]})},It=c.createContext(null),lr=It.Provider,_e=()=>{const e=c.useContext(It);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Ot=({options:e,children:n})=>{const t=Ce(),[r]=c.useState(new ht.Tile(e));return c.useEffect(()=>(t.addLayer(r),()=>{t.removeLayer(r)}),[t,r]),o.jsx(lr,{value:r,children:n})},At=c.createContext(null),cr=At.Provider,kt=()=>{const e=c.useContext(At);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Nt=({children:e})=>{const n=Ce(),[t]=c.useState(new ht.Vector);return c.useEffect(()=>(n.addLayer(t),()=>{n.removeLayer(t)}),[n,t]),o.jsx(cr,{value:t,children:e})},xt=c.createContext(null),dr=xt.Provider,Bt=()=>{const e=c.useContext(xt);if(e===null)throw new Error("vector source context is null, please check the provider");return e},Ft=({children:e})=>{const n=kt(),[t]=c.useState(new Je.Vector);return c.useEffect(()=>{n.setSource(t)},[t,n]),o.jsx(dr,{value:t,children:e})},Vt=({geometry:e,fitOptions:n,fit:t,featureStyle:r})=>{const s=Bt(),i=Ce();return c.useLayoutEffect(()=>{const h=new Qe.GeoJSON().readFeature(e);return t&&s.on("addfeature",function(){i.getView().fit(s.getExtent(),n)}),r&&h.setStyle(r),s.addFeature(h),()=>{s.removeFeature(h)}},[e,s,t]),null},Gt=e=>{const n=_e();return c.useEffect(()=>{n.setSource(new Je.OSM)},[n]),null},Ht=({drawType:e,onPolygonSelected:n})=>{const t=Ce();return c.useEffect(()=>{const r={type:"Circle"};switch(e){case he.BOX:r.geometryFunction=Dn.createBox();break;case he.POLYGON:r.type="Polygon";break;default:return}const s=new Pn.Draw(r);t.addInteraction(s);const i=u=>{const f=new Qe.GeoJSON().writeGeometryObject(u.feature.getGeometry());n==null||n(f)};return s.on("drawend",i),()=>{s.un("drawend",i),t.removeInteraction(s)}},[n,e,t]),null},Io="",ur=e=>{const n=t=>{const r=_n(t);e.onPolygonSelection(r)};return o.jsxs(Dt,{allowFullScreen:!0,showMousePosition:!0,children:[o.jsx(Ot,{children:o.jsx(Gt,{})}),e.selectionPolygon&&o.jsx(Nt,{children:o.jsx(Ft,{children:o.jsx(Vt,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&o.jsx(Ht,{drawType:e.drawType,onPolygonSelected:n})]})},nt=1.5,hr=80,gr=Se.makeStyles(e=>Se.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(nt),top:e.spacing(nt)},contentContainer:{marginTop:e.spacing(nt),width:e.spacing(hr)},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=gr(),u=m=>{s(m),t(void 0),e.handlePolygonSelected(m)},h=()=>{s(void 0),e.handlePolygonReset()};return o.jsxs("div",{className:i.map,children:[o.jsxs("div",{className:`${i.absolute}`,children:[o.jsxs(Q.Paper,{className:i.filtersContainer,children:[o.jsx(rr,{onCancelDraw:()=>t(void 0),onReset:h,onStartDraw:t,isSelectionEnabled:n!==void 0}),(f=e.filters)==null?void 0:f.map((m,v)=>o.jsx("div",{className:i.filtersMargin,children:m},v))]}),o.jsx(Q.Paper,{color:"red",className:`${i.contentContainer}`,children:e.children})]}),o.jsx(ur,{children:e.mapContent,onPolygonSelection:u,drawType:n,selectionPolygon:r})]})},Wt=new ke.Fill({color:"rgba(255,255,255,0.4)"}),zt=new ke.Stroke({color:"#3399CC",width:1.25}),$t=[new ke.Style({image:new ke.Circle({fill:Wt,stroke:zt,radius:5}),fill:Wt,stroke:zt})],Ut=c.createContext(null),fr=Ut.Provider,qt=()=>{const e=c.useContext(Ut);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},mr=({children:e,options:n,style:t})=>{const r=Ce(),[s]=c.useState(new In({...n,style:t||$t}));return c.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),c.useEffect(()=>{s.setStyle(t||$t)},[s,t]),o.jsx(fr,{value:s,children:e})},rt=20,yr=256,vr=2,Er=2,Sr="REST",Tr=e=>{const n=ut.get(e.projection),t=n.getExtent(),r=new Array(rt),s=new Array(rt),i=gt.getWidth(t)/yr,u=e.heightWidthRatio!==void 0?e.heightWidthRatio:Er,h=e.requestEncoding!==void 0?e.requestEncoding:Sr;for(let m=0;m<rt;++m)r[m]=i/Math.pow(vr,m)/u,s[m]=m.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:n,tileGrid:new On({origin:gt.getTopLeft(t),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:h,wrapX:e.wrapX!==void 0?e.wrapX:!0}},wr=e=>{const n=_e(),{options:t}=e;return c.useEffect(()=>{n.setSource(new Je.WMTS(t))},[n,t]),null},Cr=e=>{const{attributions:n,url:t,params:r,serverType:s,transition:i}=e;return{attributions:n,url:t,params:r,serverType:s,transition:i}},Lr=e=>{const n=_e(),{options:t}=e;return c.useEffect(()=>{n.setSource(new An(t))},[n,t]),null},br=e=>{const{attributions:n,url:t}=e;return{attributions:n,url:t}},Mr=e=>{const n=_e(),{options:t}=e;return c.useEffect(()=>{n.setSource(new kn(t))},[n,t]),null},_r=c.createContext(null),Pr=()=>{const e=c.useContext(_r);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},Dr=e=>{const{url:n}=e;return{url:n,format:new Qe.MVT}},Ir=({children:e,options:n})=>{const t=qt();return c.useEffect(()=>{t.setSource(new Nn(n))},[n,t]),null},Or=({legendItems:e,title:n,isCollapsed:t})=>{const r=Ce();return c.useEffect(()=>{const s=new pt({title:n??"",margin:5,maxWidth:300}),i=new xn({legend:s,collapsed:t===void 0?!0:t});r.addControl(i);const u=new pt({margin:4});return e.forEach(h=>{u.addItem({title:h.title,style:h.style,typeGeom:"Polygon"})}),s.addItem(u),()=>{r.removeControl(i)}},[r,e,n,t]),o.jsx(o.Fragment,{})};function Ar(e){const{headCells:n,order:t,orderBy:r,onRequestSort:s,isCollapseable:i}=e,u=h=>f=>{s(f,h)};return o.jsx(Bn,{children:o.jsxs(Q.TableRow,{children:[i&&o.jsx(Q.TableCell,{}),n.map(h=>o.jsx(Q.TableCell,{align:h.numeric?"right":"left",padding:h.disablePadding?"none":"default",sortDirection:r===h.id?t:!1,children:o.jsx(Q.TableSortLabel,{active:r===h.id,direction:r===h.id?t:"asc",onClick:u(h.id),children:h.label})},h.id))]})})}const kr=ft.createSvgIcon(Tt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),Nr=ft.createSvgIcon(Tt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function xr(e){const{cellsMetadata:n,isRowSelected:t,item:r,onRowSelected:s,rowIndex:i,isCollapseable:u,collapsedElement:h}=e,[f,m]=c.useState(!1),v=n.length,M=()=>{s==null||s(i)};return o.jsxs(o.Fragment,{children:[o.jsxs(Q.TableRow,{hover:!0,selected:t,onClick:M,children:[u&&o.jsx(Q.TableCell,{padding:"checkbox",children:o.jsx(Q.IconButton,{"aria-label":"expand row",size:"small",onClick:b=>{b.stopPropagation(),m(!f)},children:f?o.jsx(Nr,{}):o.jsx(kr,{})})}),n.map(b=>o.jsx(Q.TableCell,{align:b.numeric?"right":"left",padding:b.disablePadding?"none":"default",children:b.transform?b.transform(r[b.id]):r[b.id]},b.id+i.toString()))]}),u&&o.jsx(Q.TableRow,{children:o.jsx(Q.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:v+1,children:o.jsx(Q.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:h==null?void 0:h(r)})})})]})}function Br(e){const[n,t]=c.useState(""),[r,s]=c.useState("asc"),{cellsMetadata:i,items:u,onRequestSort:h,onRowSelected:f,isCollapseable:m,collapsedElement:v,isDense:M,page:b,rowsPerPage:T,count:G,handleChangePage:z,handleChangeRowsPerPage:Z}=e,$=(X,Y)=>{const V=n===Y&&r==="asc";s(V?"desc":"asc"),t(Y),h(Y,V?"desc":"asc")};return o.jsxs(Q.TableContainer,{component:Q.Paper,children:[o.jsxs(Q.Table,{size:M?"small":"medium",children:[o.jsx(Ar,{headCells:i,onRequestSort:$,order:r,orderBy:n,isCollapseable:m}),o.jsxs(Q.TableBody,{children:[u.map((X,Y)=>o.jsx(xr,{item:X,rowIndex:Y,isCollapseable:m,cellsMetadata:i,collapsedElement:v,isRowSelected:!1,onRowSelected:f},Y)),(u.length===0||T>u.length)&&o.jsx(Q.TableRow,{style:{height:(M?33:53)*(T-u.length)},children:o.jsx(Q.TableCell,{colSpan:m?i.length+1:i.length,children:u.length===0&&o.jsx(Q.Typography,{align:"center",children:"No results :("})})})]})]}),o.jsx(Q.TablePagination,{rowsPerPage:T,rowsPerPageOptions:[5,10],component:"div",count:G,page:b,onPageChange:z,onRowsPerPageChange:Z})]})}const Fr=e=>{const{children:n,...t}=e;return o.jsx(Fn,{...t,children:n})},Vr=e=>{const{children:n,...t}=e;return o.jsx(Vn,{...t,children:n})},jt=e=>e*Math.PI/180,Ge=e=>e*(180/Math.PI),Gr=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(jt(85.362/2))/Math.sin(jt(85.362/2)));class Hr extends p.PolylineDashMaterialProperty{}class Wr extends p.ConstantProperty{}class zr extends p.ConstantPositionProperty{}class $r extends p.Cartesian2{}class Ur extends p.Cartesian3{}class Kt extends p.Cartographic{}class qr extends p.BoundingSphere{}class jr extends p.Ellipsoid{}class Kr extends p.GeographicTilingScheme{}class Yr extends p.Rectangle{}class Zr extends p.Resource{}class Xr extends p.EllipsoidTerrainProvider{}class Jr extends p.CesiumTerrainProvider{}class Qr extends p.PolylineGraphics{}class Rr extends p.JulianDate{}class ei extends p.PositionProperty{}class ti extends p.BillboardGraphics{}const ni=p.VerticalOrigin,ri=p.HorizontalOrigin,ii=p.LabelStyle,oi=p.HeightReference,Yt=(e,n,t)=>{let r;if(e.scene.mode!==p.SceneMode.SCENE2D)r=e.scene.pickPosition(new p.Cartesian2(n,t));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new p.Cartesian2(n,t),s)}return p.Cartographic.fromCartesian(r)},si=(e,n,t)=>{const r=Yt(e,n,t);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[p.Math.toDegrees(r.longitude),p.Math.toDegrees(r.latitude)]}}},Zt=(e,n,t)=>{try{const r=Yt(e,n,t);return{longitude:p.Math.toDegrees(r.longitude),latitude:p.Math.toDegrees(r.latitude)}}catch{return}},Oo="",Xt=e=>{const n=le(),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 u={...i.endPosition};u.x=Math.ceil(u.x),u.y=Math.ceil(u.y),s(u)}},p.ScreenSpaceEventType.MOUSE_MOVE)},[t,n]),c.useEffect(()=>{const i=n.scene.globe.ellipsoid;if(r){const u=Zt(n,r.x,r.y);if(u){const h=new Kt(u.longitude,u.latitude);if(t.current){let f="";switch(e.projection){case ye.WEB_MERCATOR:{const v=new p.WebMercatorProjection(i).project(h);f=`Mercator: ${v.y.toFixed(Ve)}m, ${v.x.toFixed(Ve)}m`,t.current.style.width="220px";break}case ye.WGS84:{const m=h.longitude.toFixed(Fe);f=`WGS84: ${h.latitude.toFixed(Fe)}°N ${m}°E`,t.current.style.width="200px";break}}t.current.innerHTML=f}}}},[r,t,n,e.projection]),o.jsx("div",{className:"trackerPosition",ref:t})},Ao="",it=[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],ai=(e,n,t,r)=>{const s=q.get(r,"METERS_UNIT")??"m",i=q.get(r,"KILOMETERS_UNIT")??"km",u={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:n.lastLegendUpdate},h=new p.EllipsoidGeodesic,f=new Date().getTime();if(f<u.lastLegendUpdate+250)return;u.lastLegendUpdate=f;const m=e.scene.canvas.clientWidth,v=e.scene.canvas.clientHeight,M=e.scene.camera.getPickRay(new p.Cartesian2(m/2|0,v-1)),b=e.scene.camera.getPickRay(new p.Cartesian2(1+m/2|0,v-1)),T=e.scene.globe,G=T.pick(M,e.scene),z=T.pick(b,e.scene);if(!G||!z)return;const Z=T.ellipsoid.cartesianToCartographic(G),$=T.ellipsoid.cartesianToCartographic(z);h.setEndPoints(Z,$);const X=h.surfaceDistance,Y=100;let V;for(let j=it.length-1;!q.isNumber(V)&&j>=0;--j)it[j]/X<Y&&(V=it[j]);if(q.isNumber(V)){let j="";V>=1e3?j=`${(V/1e3).toString()} ${i}`:j=`${V.toString()} ${s}`,u.barWidth=V/X|0,u.distanceLabel=j}t(u)},Jt=e=>{const n=le(),[t,r]=c.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});c.useEffect(()=>{const i=f=>{ai(n,t,r,e.locale)},u=new p.EventHelper,h=f=>{n.scene.globe.tilesLoaded&&(i(new MouseEvent("mouse")),u.removeAll())};return u.add(n.scene.globe.tileLoadProgressEvent,h),n.camera.moveEnd.addEventListener(i),()=>{try{q.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:q.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`}})]})})},ue={MORPHING:p.SceneMode.MORPHING,COLUMBUS_VIEW:p.SceneMode.COLUMBUS_VIEW,SCENE2D:p.SceneMode.SCENE2D,SCENE3D:p.SceneMode.SCENE3D},ko="",Qt=(e,n)=>{const r=q.get(n.scene.globe,"_surface.tileProvider"),s=r._quadtree,i=n.canvas.height,u=q.get(n.camera.frustum,"sseDenominator")??1;for(let h=0;h<=19;h++)if(r.getLevelMaximumGeometricError(h)*i/(e*u)<s.maximumScreenSpaceError)return h;return null},li=(e,n)=>{e=e||10;const t=[];let r=1e5,s=0;for(let i=1e8;i>r;i=i-r){const u=Qt(i,n);if(u===null)break;if(u!==s){let h=i,f=i+r;for(;f-h>e;)i=h+(f-h)/2,Qt(i,n)===u?h=i:f=i;t.push({level:u,height:Math.round(i)}),s=u,t.length>=2&&(r=(t[t.length-2].height-i)/1e3)}}return t},Rt=({locale:e=void 0,valueBy:n="RENDERED_TILES"})=>{const t=le(),[r,s]=c.useState(1),i=li(1,t),u=c.useCallback(()=>{const v=t.camera,M=.5;let b=0;switch(t.scene.mode){case ue.SCENE3D:b=t.scene.mapProjection.ellipsoid.cartesianToCartographic(v.positionWC).height;break;case ue.SCENE2D:b=(v.frustum.right-v.frustum.left)*M;break;case ue.COLUMBUS_VIEW:b=v.position.z;break;default:b=0;break}if(i.length>0){const T=i.reduce((G,z)=>Math.abs(z.height-b)<Math.abs(G.height-b)?z:G);s(T.level),t.currentZoomLevel=T.level}},[t,i]),h=c.useCallback(()=>{let v=0;t.scene.globe._surface.forEachRenderedTile(function(M){v=Math.max(v,M.level)}),s(v),t.currentZoomLevel=v},[t]),m=c.useMemo(()=>({CALCULATION:u,RENDERED_TILES:h}),[u,h])[n];return c.useEffect(()=>{const v=t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded&&m()});return t.camera.moveEnd.addEventListener(m),()=>{try{typeof q.get(t,"_cesiumWidget")<"u"&&(t.camera.moveEnd.removeEventListener(m),v())}catch(M){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',M)}}},[t,m]),o.jsxs("div",{className:"zoomLevel",children:[o.jsx("div",{className:"zoomLevelValue",children:r}),o.jsx("div",{className:"zoomLevelLabel",children:q.get(e,"ZOOM_LABEL")??"zoom"})]})},No="",ci=-1,di=e=>{const n=le(),[t,r]=c.useState(),{sceneModes:s}=e,i=u=>s.findIndex(h=>h===u)>ci;return c.useEffect(()=>{r(n.scene.mode)},[]),o.jsxs(o.Fragment,{children:[i(ue.SCENE3D)&&o.jsx(U.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===ue.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(ue.SCENE3D)}}),i(ue.SCENE2D)&&o.jsx(U.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===ue.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(ue.SCENE2D)}}),i(ue.COLUMBUS_VIEW)&&o.jsx(U.Icon,{icon:o.jsx("div",{className:`mapViewIcon ${t===ue.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(ue.COLUMBUS_VIEW)}})]})},xo="",ui=Se.makeStyles(e=>Se.createStyles({mapContainer:{width:"60px",height:"60px",border:`${e.palette.background.paper} 2px solid`}})),hi=e=>{const n=le(),{baseMaps:t}=e,[r,s]=c.useState(" "),[i,u]=c.useState(),h=ui();c.useEffect(()=>{const m=t==null?void 0:t.maps.find(v=>v.isCurrent);m&&(u(m),s(m.title!==void 0?m.title:" "))},[t]);const f=m=>{var v,M;if(t){(v=n.layersManager)==null||v.removeBaseMapLayers();const b=t.maps.find(T=>T.id===m);b&&((M=n.layersManager)==null||M.setBaseMapLayers(b),u(b),t.maps.forEach(T=>{T.isCurrent=b===T}))}};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(m=>o.jsx("li",{className:`mapContainer ${h.mapContainer} ${m===i?"mapContainerSelected":""}`,children:o.jsx("img",{alt:"",className:"mapContainerImg",src:m.thumbnail,onMouseOver:()=>{s(m.title)},onMouseOut:()=>{s((i==null?void 0:i.title)!==void 0?i.title:" ")},onClick:()=>{f(m.id)}})},m.id))})]})},Bo="",ot="ic_settings_24px",gi=e=>{const[n,t]=c.useState(!1),{sceneModes:r,baseMaps:s,locale:i}=e,u=c.useRef(null),h=q.get(i,"MAP_SETTINGS_DIALOG_TITLE")??"Map Settings",f=q.get(i,"MAP_SETTINGS_SCENE_MODE_TITLE")??"Scene Mode",m=q.get(i,"MAP_SETTINGS_BASE_MAP_TITLE")??"Base Map";return c.useEffect(()=>{const v=M=>{var G;const b=M.target,T=q.get(u,"current");T&&!T.contains(b)&&b.id!==ot&&((G=b.parentElement)==null?void 0:G.id)!==ot&&(document.removeEventListener("click",v,!1),t(!1))};return document.addEventListener("click",v,!1),()=>{document.removeEventListener("click",v,!1)}}),o.jsxs(o.Fragment,{children:[o.jsx(U.Icon,{icon:o.jsx("div",{className:"settingsIconContainer",children:o.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",id:ot,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:u,children:o.jsxs(U.Dialog,{open:n,onClosed:()=>{t(!1)},children:[o.jsx(U.DialogTitle,{children:h}),o.jsxs(U.DialogContent,{children:[o.jsx("h4",{className:"sectionLabel",children:f}),o.jsx(oe,{className:"mapScenesContainer",children:o.jsx(di,{sceneModes:r})}),o.jsx(oe,{className:"baseMapsContainer",children:s&&o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"sectionLabel",children:m}),o.jsx(hi,{baseMaps:s})]})})]})]})})]})},Fo="",pi=()=>{const e=le(),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(U.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))})},Vo="",fi=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"})]})}),mi=({onClick:e})=>o.jsx(oe,{onClick:e,className:"mapLegendToggleContainer",children:o.jsx(U.Icon,{icon:fi,className:"mapLegendIcon"})}),yi=({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 u=c.useCallback(()=>{const m=o.jsx(oe,{className:"layerNameContainer",children:o.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:t})});return(t??"").length>15?o.jsx(U.Tooltip,{content:t,children:m}):m},[t]),h=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(oe,{className:"mapLegend",children:[u(),o.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:i}),o.jsx(oe,{className:"legendActionsContainer",children:h()})]})},vi=({legends:e,actionsTexts:{docText:n,imgText:t},noLegendsText:r})=>{const s=c.useCallback(()=>o.jsx(oe,{className:"noLegendsContainer",children:o.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),i=c.useCallback(()=>e.length?e.map((u,h)=>o.jsx(yi,{legend:u,docText:n,imgText:t},`${u.layer}_${h}`)):s(),[e]);return o.jsx(oe,{className:"mapLegendsList",children:i()})},Ei=({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(U.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[o.jsx(U.DrawerHeader,{className:"sidebarHeaderContainer",children:o.jsx(U.DrawerTitle,{className:"sidebarTitle",children:t})}),o.jsxs(U.DrawerContent,{className:"sidebarContent",children:[o.jsx(U.Icon,{onClick:n,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),o.jsx(vi,{noLegendsText:r,legends:i,actionsTexts:s})]})]}):null,Ee=document.createElement("canvas"),ge=Ee.getContext("2d"),en=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},Si=async(e,n)=>(n&&n.tileTransparencyCheckedCounter++,new Promise((t,r)=>{try{ge==null||ge.clearRect(0,0,Ee.width,Ee.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){Ee.width=e.width,Ee.height=e.height,ge==null||ge.drawImage(e,0,0);const i=ge==null?void 0:ge.getImageData(0,0,Ee.width,Ee.height),u=en(i);u&&n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(u);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{Ee.width=s.width,Ee.height=s.height,ge==null||ge.drawImage(s,0,0);const i=ge==null?void 0:ge.getImageData(0,0,Ee.width,Ee.height);en(i)?(n&&(n.tileTransparencyCheckedCounter=n.maxTilesForTransparencyCheck),t(!0)):t(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),He=(e,n)=>{const{west:t,east:r,north:s,south:i}=e,{west:u,east:h,north:f,south:m}=n;return t>=u&&r<=h&&s<=f&&i>=m},Ti=(e,n)=>Wn(e,Re(n)),wi=e=>{const n=(p.Math.toDegrees(e.west)+p.Math.toDegrees(e.east))/2,t=(p.Math.toDegrees(e.south)+p.Math.toDegrees(e.north))/2;return mt.point([n,t])},Ci=e=>[p.Math.toDegrees(e.west),p.Math.toDegrees(e.south),p.Math.toDegrees(e.east),p.Math.toDegrees(e.north)],Li=(e,n=100)=>{const t=e.scene,r=e.camera,s=t.mode,i=r.computeViewRectangle(t.globe.ellipsoid);if(!p.defined(i)||!i){console.error("computeViewRectangle returned invalid rectangle.");return}if(s!==p.SceneMode.SCENE3D)return i;const u=r.positionCartographic;if(!p.defined(u)){console.error("Camera position is undefined in 3D mode.");return}const h=u.latitude,f=u.longitude;if(h<-p.Math.PI_OVER_TWO||h>p.Math.PI_OVER_TWO||f<-p.Math.PI||f>p.Math.PI){console.error("Invalid latitude or longitude values.");return}const m=111320,v=111320*Math.cos(h);let M=n/m,b=n/v;const T=p.Cartesian3.magnitude(r.positionWC);T>1e7&&(M=10,b=10);const G=r.frustum instanceof p.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let z=1;T<5e5?z=.05:T<2e6&&(z=.1),M*=z*(G/Math.PI),b*=z*(G/Math.PI);const Z=r.pitch;if(Z===void 0)return;const $=Math.PI/4,X=Math.max(0,1-Math.abs(Z)/$);M*=X,b*=X;const Y=5e-4;M=Math.max(M,Y),b=Math.max(b,Y);const V=u.latitude-M,j=u.latitude+M,H=u.longitude-b,W=u.longitude+b,te=p.Math.clamp(V,i.south,i.north),a=p.Math.clamp(j,i.south,i.north),l=p.Math.clamp(H,i.west,i.east),C=p.Math.clamp(W,i.west,i.east),g=Math.min(1,Z/p.Math.PI_OVER_TWO),S=i.north-(i.north-i.south)*g,y=Math.min(a,S);return new p.Rectangle(p.Math.negativePiToPi(l),p.Math.clamp(te,-p.Math.PI_OVER_TWO,p.Math.PI_OVER_TWO),p.Math.negativePiToPi(C),p.Math.clamp(y,-p.Math.PI_OVER_TWO,p.Math.PI_OVER_TWO))},We=3,ze="hasTransparency";function st(e,n,t,r,s){return setTimeout(()=>{var h;const i=(h=this.layerListInstance.find(f=>{var m,v;return((m=f._imageryProvider._resource)==null?void 0:m._url)===((v=this._resource)==null?void 0:v._url)}))==null?void 0:h.meta,u=q.get(i,ze)===!0;this.tileTransparencyCheckedCounter<We&&!u&&Si(s==null?void 0:s.url,this).then(f=>{var m;(m=this.mapViewer.layersManager)==null||m.addMetaToLayer({[ze]:f},v=>v._imageryProvider._resource._url===this._resource._url)})},0),e(n,t,r,s)}class tn extends p.UrlTemplateImageryProvider{constructor(t,r){var s;super(t);ne(this,"layerListInstance");ne(this,"mapViewer");ne(this,"maxTilesForTransparencyCheck",We);ne(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return st.call(this,super.requestImage.bind(this),t,r,s,i)}}class nn extends p.WebMapServiceImageryProvider{constructor(t,r){var s;super(t);ne(this,"layerListInstance");ne(this,"mapViewer");ne(this,"maxTilesForTransparencyCheck",We);ne(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return st.call(this,super.requestImage.bind(this),t,r,s,i)}}class rn extends p.WebMapTileServiceImageryProvider{constructor(t,r){var s;super(t);ne(this,"layerListInstance");ne(this,"mapViewer");ne(this,"maxTilesForTransparencyCheck",We);ne(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(t,r,s,i){return st.call(this,super.requestImage.bind(this),t,r,s,i)}}const bi=1,Mi=-1,on="TRANSPARENT_BASE_LAYER";class _i{constructor(n,t,r,s){ne(this,"mapViewer");ne(this,"legendsList");ne(this,"layerUpdated");ne(this,"dataLayerUpdated");ne(this,"layers");ne(this,"dataLayers");ne(this,"legendsExtractor");ne(this,"layerManagerFootprintMetaFieldPath");this.mapViewer=n,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=t,this.layerUpdated=new p.Event,this.dataLayerUpdated=new p.Event,this.layerManagerFootprintMetaFieldPath=s,r&&this.layerUpdated.addEventListener(r,this),this.mapViewer.shouldOptimizedTileRequests&&(this.layerUpdated.addEventListener(i=>{const u=Object.keys(i);u.length===1&&u[0]===ze&&(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.mapViewer.shouldOptimizedTileRequests&&(this.removeLayer(on),this.addTransparentImageryProvider())}addRasterLayer(n,t,r){let s;switch(n.type){case"XYZ_LAYER":{const i=n.options,u=this.mapViewer.shouldOptimizedTileRequests?new tn(i,this.mapViewer):new p.UrlTemplateImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(u,t);break}case"WMS_LAYER":{const i=n.options,u=this.mapViewer.shouldOptimizedTileRequests?new nn(i,this.mapViewer):new p.WebMapServiceImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(u,t);break}case"WMTS_LAYER":{const i=n.options,u=this.mapViewer.shouldOptimizedTileRequests?new rn(i,this.mapViewer):new p.WebMapTileServiceImageryProvider(i);s=this.mapViewer.imageryLayers.addImageryProvider(u,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=>!!q.get(t.meta,"parentBasetMapId")).forEach(t=>{this.mapViewer.imageryLayers.remove(t,!0)})}removeNotBaseMapLayers(){this.layers.filter(t=>!q.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(),u=this.mapViewer.imageryLayers.indexOf(r);if(u-t<=i&&(t=u-i),r)for(let h=0;h<t;h++)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=>!q.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=>!q.get(i.meta,"parentBasetMapId"))),r}findLayerByPOI(n,t,r=!0){if(this.layerManagerFootprintMetaFieldPath){const s=si(this.mapViewer,n,t);return this.layers.filter(h=>!q.get(h.meta,"parentBasetMapId")).filter(h=>{const f=q.get(h.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?Hn(s.geometry,{type:"Feature",properties:{},geometry:f})&&(r?h.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",h.meta),!1)}).sort((h,f)=>{var m,v;return((m=f.meta)==null?void 0:m.zIndex)-((v=h.meta)==null?void 0:v.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const n=this.mapViewer.imageryLayers.addImageryProvider(new p.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new p.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);n.meta={id:on,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=>!!q.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?bi:Mi,i=t<r?t:r,u=t<r?r:t;this.layers.forEach(h=>{var m;if(!q.get(h.meta,"parentBasetMapId")){const v=(m=h.meta)==null?void 0:m.zIndex;h.meta.zIndex=v>=i&&v<=u&&v!==t?v+s:v===t?r:v}})}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],u=!q.isEmpty(r)&&!q.isEmpty(i.rectangle)&&p.Rectangle.intersection(r,i.rectangle);for(let h=this.layers.length-1;h>=s;h--){if(((n=i.meta)==null?void 0:n.skipRelevancyCheck)===!0){i.meta={...i.meta,relevantToExtent:!0};continue}const f=this.layers[h],m=((t=f.meta)==null?void 0:t[ze])===!0;if(i!==f)if(u instanceof p.Rectangle){if(He(r,i.rectangle))if(He(r,f.rectangle)&&!m){i.meta={...i.meta??{},relevantToExtent:!1};break}else i.meta={...i.meta??{},relevantToExtent:!0};if(He(r,f.rectangle)&&!m){i.meta={...i.meta??{},relevantToExtent:!1};break}if(He(i.rectangle,f.rectangle)){if(i.meta={...i.meta??{},relevantToExtent:m},!m)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:u instanceof p.Rectangle})}}}catch(r){console.error(r)}}}const Go="",Pi=e=>{const n=le(),{enableCompass:t=!0,enableZoomControls:r=!1,lockCompassNavigation:s=!1,locale:i={DIRECTION:"ltr"}}=e;return c.useEffect(()=>{if(typeof q.get(n,"cesiumNavigation")>"u"){n.extend(zn,{enableCompass:t,enableZoomControls:r,enableDistanceLegend:!1}),n.cesiumNavigation.setNavigationLocked(s);const u=document.querySelector(".compass");u&&i.DIRECTION&&u.classList.add(i.DIRECTION)}},[n,t,r,i.DIRECTION,s]),null},Ho="",Di=({children:e,locale:n})=>{const[t,r]=c.useState(!1),s=c.useMemo(()=>q.get(n,"DEBUG_PANEL_TITLE")??"Debugger Tool",[n]);return o.jsxs(o.Fragment,{children:[o.jsx(U.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)}}),o.jsx("div",{className:"debugPanel",children:o.jsxs(U.Dialog,{open:t,onClosed:()=>{r(!1)},children:[o.jsx(U.DialogTitle,{className:"title",children:s}),o.jsx(U.DialogContent,{children:e})]})})]})},Wo="",Ii=({locale:e})=>{var h;const n=le(),[t,r]=c.useState([]),s=c.useMemo(()=>q.get(e,"WFS_TITLE")??"Data Layers",[e]),i=c.useMemo(()=>q.get(e,"WFS_CACHE")??"Cache",[e]),u=c.useMemo(()=>q.get(e,"WFS_EXTENT")??"Extent",[e]);return c.useEffect(()=>{if(!n.layersManager)return;const f=(m,v)=>{var b;m.forEach(T=>{if(v!==void 0&&v!==T.meta.id)return;const{options:G,meta:z}=T,{zoomLevel:Z}=G,{id:$,items:X,total:Y,cache:V,currentZoomLevel:j,featureStructure:H}=z;r(W=>{const te=W.findIndex(a=>a.id===$);if(te>=0){if(JSON.stringify(W[te])!==JSON.stringify({id:$,items:X,total:Y,cache:V,currentZoomLevel:j,featureStructure:H,zoomLevel:Z})){const a=[...W];return a[te]={id:$,items:X,total:Y,cache:V,currentZoomLevel:j,featureStructure:H,zoomLevel:Z},a}}else return[...W,{id:$,items:X,total:Y,cache:V,currentZoomLevel:j,featureStructure:H,zoomLevel:Z}];return W})});const M=new Set((b=n.layersManager)==null?void 0:b.dataLayerList.map(T=>T.meta.id));r(T=>T.filter(G=>M.has(G.id)))};return n.layersManager.addDataLayerUpdatedListener(f),()=>{var m;(m=n.layersManager)==null||m.removeDataLayerUpdatedListener(f)}},[(h=n.layersManager)==null?void 0:h.dataLayerList]),o.jsxs(oe,{className:"wfsContainer",children:[o.jsx(oe,{className:"title",children:s}),t.map((f,m)=>o.jsxs(oe,{className:"featureType",children:[o.jsx(U.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:o.jsxs(oe,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," ",f.id," (",String(f.zoomLevel),"):"]})}),o.jsxs(oe,{className:"info",children:[o.jsxs(oe,{children:[i,": ",f.cache??0]}),f.total>0&&o.jsxs(oe,{className:"spacer",children:[u,": ",f.items," / ",f.total]})]})]},m))]})},zo="",sn=212,an=260,Oi=0;class Ai extends p.Viewer{constructor(t,r){super(t,r);ne(this,"layersManager");ne(this,"currentZoomLevel");ne(this,"useOptimizedTileRequests")}get shouldOptimizedTileRequests(){return this.useOptimizedTileRequests??!1}set shouldOptimizedTileRequests(t){this.useOptimizedTileRequests=t}}const ln=c.createContext(null),ki=ln.Provider,le=()=>{const e=c.useContext(ln);if(e===null)throw new Error("map context is null, please check the provider");return e},Ni=e=>{var re,de,De,qe,je,Ke,Ye,Ie;const n=c.useRef(null),[t,r]=c.useState(),[s,i]=c.useState(),[u,h]=c.useState(),[f,m]=c.useState(),[v,M]=c.useState(),[b,T]=c.useState(),[G,z]=c.useState(),[Z,$]=c.useState(!1),[X,Y]=c.useState(!1),[V,j]=c.useState(),H=c.useRef(),[W,te]=c.useState(),[a,l]=c.useState([]),[C,g]=c.useState(),[S,y]=c.useState(!1),L=c.useRef(),[E,D]=c.useState(void 0),[k,A]=c.useState(!1),[O,x]=c.useState(),[B,_]=c.useState(),[I,P]=c.useState(),F=c.useMemo(()=>Z||X,[Z,X]),N={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:!1,sceneModePicker:!1,imageryProvider:!1,...e},J=(ee,R,ae,pe,Te)=>{const Oe=t.container,Me=Oe.clientWidth,Cn=Oe.clientHeight,Ln=pe+Te;return{left:`${Me-ee<ae?ee-(ae-(Me-ee)):ee}px`,top:`${Cn-R<Ln?R-(Ln-(Cn-R)):R}px`}},se=c.useCallback(ee=>{if(n.current!==null){const R=n.current.cesiumElement,ae={x:ee.offsetX,y:ee.offsetY};y(!1),D(ae),x(Zt(R,ae.x,ae.y)),y(!0),L.current=ee}},[n]);c.useEffect(()=>{var ee;if(n.current!==null){const R=n.current.cesiumElement;e.imageryContextMenu&&(R.scene.canvas.removeEventListener("contextmenu",se),R.scene.canvas.addEventListener("contextmenu",se))}r((ee=n.current)==null?void 0:ee.cesiumElement)},[n,e.imageryContextMenu]),c.useEffect(()=>{var ee;t&&(t.shouldOptimizedTileRequests=e.useOptimizedTileRequests??!1,t.layersManager=new _i(t,(ee=e.legends)==null?void 0:ee.mapLegendsExtractor,()=>{var R;l((R=t.layersManager)==null?void 0:R.legendsList)},e.layerManagerFootprintMetaFieldPath))},[t]),c.useEffect(()=>{t&&(t.shouldOptimizedTileRequests=e.useOptimizedTileRequests??!1)},[e.useOptimizedTileRequests,t]),c.useEffect(()=>{te(e.sceneModes??[ue.SCENE2D,ue.SCENE3D,ue.COLUMBUS_VIEW])},[e.sceneModes]),c.useEffect(()=>{var R,ae;g(e.baseMaps);const ee=(R=e.baseMaps)==null?void 0:R.maps.find(pe=>pe.isCurrent);ee&&t&&((ae=t.layersManager)==null||ae.setBaseMapLayers(ee))},[e.baseMaps,t]),c.useEffect(()=>{i(e.projection??ye.WGS84)},[e.projection]),c.useEffect(()=>{j(e.locale)},[e.locale]),c.useEffect(()=>{h(e.showMousePosition??!0)},[e.showMousePosition]),c.useEffect(()=>{m(e.showZoomLevel??!0)},[e.showZoomLevel]),c.useEffect(()=>{M(e.showScale??!0)},[e.showScale]),c.useEffect(()=>{T(e.showCompass??!0)},[e.showCompass]),c.useEffect(()=>{z(e.showLoadingProgress??!0)},[e.showLoadingProgress]),c.useEffect(()=>{P(e.debugPanel)},[e.debugPanel]),c.useEffect(()=>{var R;const ee=()=>{if(t===void 0)return{longitude:0,latitude:0,height:0};const ae=()=>{const pe=t.camera.positionCartographic;return{longitude:Ge(pe.longitude),latitude:Ge(pe.latitude),height:pe.height}};if(t.scene.mode===p.SceneMode.SCENE3D){const pe=new p.Cartesian2(t.container.clientWidth/2,t.container.clientHeight/2),Te=t.scene.camera.getPickRay(pe),Oe=t.scene.globe.pick(Te,t.scene);if(!Oe)return{longitude:0,latitude:0,height:0};const Me=t.scene.globe.ellipsoid.cartesianToCartographic(Oe);return Me!==void 0?{longitude:Ge(Me.longitude),latitude:Ge(Me.latitude),height:t.scene.camera.positionCartographic.height}:ae()}else return ae()};t&&(t.camera.moveEnd.addEventListener(()=>{if(t.scene.mode!==p.SceneMode.MORPHING){const ae=t.camera,pe={position:ee(),direction:ae.direction.clone(),up:ae.up.clone(),right:ae.right.clone(),transform:ae.transform.clone(),frustum:ae.frustum.clone()};H.current=pe}}),G&&(t.scene.globe.tileLoadProgressEvent.addEventListener(function(){t.scene.globe.tilesLoaded?$(!1):$(!0)}),(R=t.layersManager)==null||R.addDataLayerUpdatedListener(()=>{var pe;let ae=!1;(pe=t.layersManager)==null||pe.dataLayerList.forEach(Te=>{if(typeof Te.meta.items=="number"&&typeof Te.meta.total=="number"&&Te.meta.items>0&&Te.meta.items<Te.meta.total){ae=!0;return}}),Y(ae)})))},[t]),c.useEffect(()=>{const ee=()=>{if(t&&H.current){const R=H.current;t.camera.flyTo({destination:p.Cartesian3.fromDegrees(R.position.longitude,R.position.latitude,R.position.height),duration:0})}};return t&&t.scene.morphComplete.addEventListener(ee),()=>{if(t)try{t.scene.morphComplete.removeEventListener(ee)}catch{console.error("morphCompleteHandler event not cleaned")}}},[t]),c.useEffect(()=>{const ee=e.zoom,R=e.center;t&&q.isNumber(ee)&&q.isArray(R)&&t.camera.flyTo({destination:p.Cartesian3.fromDegrees(R[0],R[1],Gr(ee)),duration:0})},[e.zoom,e.center,t]),c.useEffect(()=>{_(e.displayZoomButtons??!0)},[e.displayZoomButtons]);const ce=c.useCallback(()=>t&&Gn.createPortal(o.jsxs(o.Fragment,{children:[G&&F&&o.jsx(U.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),o.jsxs(oe,{className:"sideToolsContainer",children:[I&&o.jsx(Di,{locale:V,children:I.wfs&&o.jsx(Ii,{locale:V})}),o.jsx(gi,{sceneModes:W,baseMaps:C,locale:V}),o.jsx(mi,{onClick:()=>A(!k)})]}),o.jsxs(oe,{className:"toolsContainer",children:[u&&o.jsx(Xt,{projection:s}),f&&o.jsx(Rt,{locale:V,valueBy:"RENDERED_TILES"}),v&&o.jsx(Jt,{locale:V}),b&&o.jsx(Pi,{locale:V})]}),B&&o.jsx(pi,{})]}),document.querySelector(".cesium-viewer")),[C,V,t,s,W,u,v,k,F]);return o.jsx(ve.Viewer,{className:"viewer",full:!0,ref:n,...N,children:o.jsxs(ki,{value:t,children:[o.jsx(Ei,{title:(re=e.legends)==null?void 0:re.title,isOpen:k,toggleSidebar:()=>A(!k),noLegendsText:(de=e.legends)==null?void 0:de.emptyText,legends:((De=e.legends)==null?void 0:De.legendsList)??a,actionsTexts:(qe=e.legends)==null?void 0:qe.actionsTexts}),e.children,ce(),e.imageryContextMenu&&S&&E&&O&&c.cloneElement(e.imageryContextMenu,{data:(je=t==null?void 0:t.layersManager)==null?void 0:je.findLayerByPOI(E.x,E.y,!1),position:{x:E.x,y:E.y},coordinates:O,style:J(E.x,E.y,((Ke=e.imageryContextMenuSize)==null?void 0:Ke.width)??an,((Ye=e.imageryContextMenuSize)==null?void 0:Ye.height)??sn,((Ie=e.imageryContextMenuSize)==null?void 0:Ie.dynamicHeightIncrement)??Oi),size:e.imageryContextMenuSize??{height:sn,width:an},handleClose:()=>{y(!S)},contextEvt:L.current})]})})},xi=0,Bi=e=>{const n=le();return o.jsx(ve.Cesium3DTileset,{...e,onReady:t=>{e.isZoomTo===!0&&n.zoomTo(t);const r=n.scene;r.globe.depthTestAgainstTerrain=!0;const s=p.Cartographic.fromCartesian(t.boundingSphere.center),i=e.heightFromGround??xi;if(i){const u=p.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),h=p.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+i),f=p.Cartesian3.subtract(h,u,new p.Cartesian3);t.modelMatrix=p.Matrix4.fromTranslation(f)}}})},$e=180,cn=.001,dn=e=>Math.abs(e)/e,un=e=>{$e-Math.abs(e[0])<cn&&(e[0]=dn(e[0])*($e-1)),$e/2-Math.abs(e[1])<cn&&(e[1]=dn(e[1])*($e/2-1))},hn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(n=>{un(n)});break;case"Polygon":e.coordinates.forEach(n=>{n.forEach(t=>{un(t)})});break}},Fi=e=>{const{data:n,...t}=e,r=q.cloneDeep(n);return r&&(typeof r.features<"u"?r.features.forEach(s=>{hn(s.geometry)}):hn(r)),o.jsx(ve.GeoJsonDataSource,{data:r,...t})},Pe=e=>{const{meta:n,...t}=e,r=le();return c.useLayoutEffect(()=>{var s;(s=r.layersManager)==null||s.addMetaToLayer(n,n.searchLayerPredicate)},[n,r]),o.jsx(ve.ImageryLayer,{...t})},Vi=e=>{const{options:n,...t}=e,r=le(),s=r.shouldOptimizedTileRequests?new nn(n,r):new p.WebMapServiceImageryProvider(n);return o.jsx(Pe,{...t,imageryProvider:s})},Gi=e=>{const{options:n,...t}=e,r=le(),s=r.shouldOptimizedTileRequests?new rn(n,r):new p.WebMapTileServiceImageryProvider(n);return o.jsx(Pe,{...t,imageryProvider:s})},Hi=e=>{const{options:n,...t}=e,r=le(),s=r.shouldOptimizedTileRequests?new tn(n,r):new p.UrlTemplateImageryProvider(n);return o.jsx(Pe,{...t,imageryProvider:s})},Wi=e=>{const{options:n,...t}=e;return o.jsx(Pe,{...t,imageryProvider:new p.OpenStreetMapImageryProvider(n)})},zi=e=>{const{options:n,meta:t,visualizationHandler:r}=e,{url:s,featureType:i,style:u,pageSize:h,zoomLevel:f,maxCacheSize:m,keyField:v}=n,{color:M,hover:b}=u,T=le(),G=c.useRef(new Map),z=c.useRef(new Set),Z=c.useRef(0),[$,X]=c.useState(t),Y=c.useMemo(()=>p.Color.fromCssColorString(M??"#01FF1F").withAlpha(.5),[M]),V=c.useMemo(()=>p.Color.fromCssColorString(M??"#01FF1F").withAlpha(.2),[M]),j=c.useMemo(()=>p.Color.fromCssColorString(b??"#24AEE9").withAlpha(.5),[b]),H=c.useMemo(()=>`wfs_${i}_${yt.v4()}`,[i]),W=new p.GeoJsonDataSource(H),te=_=>{const I=[],P=t.featureStructure;if(P&&P.fields)for(const N of P.fields){const{fieldName:J,aliasFieldName:se}=N,ce=se,re=_[J.toLowerCase()]??"N/A";I.push(`
2
+ <tr>
3
+ <td><strong>${ce}:</strong></td>
4
+ <td>${re}</td>
5
+ </tr>
6
+ `)}return`
7
+ <table style="direction: ${P.fields.some(N=>N.aliasFieldName!==N.fieldName)?"rtl":"ltr"};">
8
+ <tbody>
9
+ ${I.join("")}
10
+ </tbody>
11
+ </table>
12
+ `},a=_=>_?_.polyline?"polyline":"polygon":"",l=_=>{var F,N;const I=(N=(F=_==null?void 0:_.polygon)==null?void 0:F.hierarchy)==null?void 0:N.getValue(p.JulianDate.now());if(!I)return null;const P=I.positions;return p.BoundingSphere.fromPoints(P).center},C=_=>{const P=T.scene.drillPick(_).map(N=>N.id).filter(N=>N&&N.polygon&&N.entityCollection.owner.name===H);if(P.length===0)return null;const F=P.map(N=>{const J=l(N);if(!J)return{entity:N,distance:Number.MAX_VALUE};const se=p.SceneTransforms.wgs84ToWindowCoordinates(T.scene,J);if(!se)return{entity:N,distance:Number.MAX_VALUE};const ce=_.x-se.x,re=_.y-se.y,de=Math.sqrt(ce*ce+re*re);return{entity:N,distance:de}});return F.sort((N,J)=>J.distance-N.distance),F[0].entity},g=_=>{let I=null;_.setInputAction(P=>{if(T.scene.mode===p.SceneMode.SCENE2D){const N=T.scene.pick(P.endPosition);N&&N.id&&(N.id.polygon||N.id.polyline)?q.get(I,"id")!==q.get(N.id,"id")&&(I&&(I[a(I)].material=V,T.container.style.cursor="default"),I=N.id,I[a(I)].material=j,T.container.style.cursor="pointer"):I&&(I[a(I)].material=V,I=null,T.container.style.cursor="default")}else{const N=C(P.endPosition);N?q.get(I,"id")!==q.get(N,"id")&&(I&&(I[a(I)].material=Y,T.container.style.cursor="default"),I=N,I[a(I)].material=j,T.container.style.cursor="pointer"):I&&(I[a(I)].material=Y,I=null,T.container.style.cursor="default")}},p.ScreenSpaceEventType.MOUSE_MOVE)},S=(_,I)=>{const P=navigator.hardwareConcurrency||4;let F=Math.ceil(P*1.5);return I==="cpu"&&(F=Math.max(2,Math.ceil(P/2))),_>=m?Math.min(200,F*4):_>1e3?Math.min(100,F*2):_>300?Math.min(50,F):Math.min(10,F)},y=(_=-1,I=-1)=>{X(P=>({...P,...t,cache:z.current.size,items:_,total:I,currentZoomLevel:T.currentZoomLevel}))},L=()=>{W.entities&&W.entities.values.length>0&&(W.show=!1,Z.current=0),y(0,0)},E=async(_,I="GET",P)=>{const F={method:I};P!==void 0&&(F.body=P);const N=await fetch(_,F);if(N.status===200)return await N.json()},D=async(_,I)=>{const P=[];return _.length>0&&await et(_,F=>{if(F.properties){const N=F.properties[v??"id"];z.current.has(N)||(z.current.add(N),F.properties.fetch_id=I,P.push(F))}},{concurrency:S(_.length,"cpu")}),P},k=(_,I)=>Array.from(G.current.values()).filter(P=>JSON.stringify(P.parentBBox)!==JSON.stringify(_)).reduce((P,F)=>{const N=Ti(I,F.bbox);return N>P.distance?{id:F.id,key:F.bbox.join(","),distance:N}:P},{id:"",key:"",distance:-1/0}),A=async _=>{const I=[];await et(W.entities.values,P=>{if(P.properties&&P.properties.fetch_id.getValue()===_){const F=P.properties[v??"id"].getValue();z.current.delete(F),I.push(P)}},{concurrency:S(W.entities.values.length,"cpu")}),I.length>0&&await et(I,P=>{W.entities.remove(P)},{concurrency:S(I.length,"cpu")})},O=async(_,I)=>{for(;z.current.size>m;){const P=k(_,I);if(P.id==="")break;await A(P.id),P.key&&G.current.delete(P.key)}},x=async(_,I,P,F)=>{let N="",J="",se=[];if(_.numberReturned&&_.numberReturned!==0&&(_.bbox&&(J=_.bbox.join(","),G.current.has(J)||(N=yt.v4())),se=await D(_.features,N),_.bbox&&se.length>0&&!G.current.has(J)&&G.current.set(J,{id:N,parentBBox:I,bbox:_.bbox,timestamp:_.timeStamp,items:se.length})),y(_.numberReturned!==0?P+_.numberReturned:_.numberMatched,_.numberMatched),se.length===0){_.numberReturned&&_.numberReturned!==0?B(Z.current++*h):Z.current=0;return}await O(I,F);const ce={type:"FeatureCollection",features:se};await W.process(ce,{describe:te}),T.scene.requestRender();const re=T.dataSources.getByName(H)[0];re&&r(T,re,se.map(de=>de.id)),_.numberReturned&&_.numberReturned!==0?B(Z.current++*h):Z.current=0},B=c.useCallback(async(_=0)=>{if(!T||T.scene.mode===p.SceneMode.MORPHING)return;const I=Li(T);if(!I)return;if(!T.currentZoomLevel||T.currentZoomLevel<f){L();return}W.show=!0;const P=Ci(I),F=wi(I);try{let N=`${s}?service=WFS&version=2.0.0&request=GetFeature&typeNames=${i}&outputFormat=application/json&bbox=${P.join(",")},EPSG:4326&startIndex=${_}&count=${h}`;v&&(N+=`&sortBy=${v}%20ASC`);const J=await E(N);await x(J,P,_,F)}catch(N){console.error("Error fetching WFS data:",N),y(-1,-1)}},[]);return c.useEffect(()=>{const _=T.dataSources.getByName(H)[0];_&&r(T,_,[])},[T.scene.mode]),c.useEffect(()=>{T.layersManager&&T.layersManager.dataLayerList.length>0&&T.layersManager.findDataLayerById(t.id)!==void 0&&T.layersManager.addMetaToDataLayer($)},[$]),c.useEffect(()=>{var _;(_=T.layersManager)==null||_.addDataLayer({options:n,meta:{...$},visualizationHandler:r})},[T.layersManager]),c.useEffect(()=>{T.dataSources.add(W);const _=()=>{B()};T.scene.camera.moveEnd.addEventListener(_);const I=new p.ScreenSpaceEventHandler(T.scene.canvas);return g(I),()=>{var P;q.get(T,"_cesiumWidget")!==void 0&&(z.current.clear(),G.current.clear(),T.dataSources.remove(W,!0),(P=T.layersManager)==null||P.removeDataLayer(t.id),T.scene.camera.moveEnd.removeEventListener(_),I.removeInputAction(p.ScreenSpaceEventType.MOUSE_MOVE))}},[]),null},gn=e=>o.jsx(ve.Entity,{...e}),$i=e=>o.jsx(ve.EntityDescription,{...e}),pn=e=>o.jsx(ve.EntityDescription,{...e}),fn=e=>o.jsx(ve.PolygonGraphics,{...e}),mn=e=>o.jsx(ve.RectangleGraphics,{...e}),yn=e=>o.jsx(ve.CustomDataSource,{...e}),Ui=e=>o.jsx(ve.PolylineGraphics,{...e}),$o="";var we=function(){var e=w.Ellipsoid.WGS84,n,t=w.Material.fromType(w.Material.ColorType);function r(a,l=new w.Color(1,1,0,.5),C=new w.Color(1,1,1,1)){this._scene=a.scene,t.uniforms.color=l,n=C,this._tooltip={setVisible:()=>{},showAt:()=>{}},this._surfaces=[],this.initialiseHandlers(),this.enhancePrimitives()}r.prototype.initialiseHandlers=function(){var a=this._scene,l=this,C=new w.ScreenSpaceEventHandler(a.canvas);function g(y,L){if(l._handlersMuted!=!0){var E=a.pick(L);E&&E.primitive&&E.primitive[y]&&E.primitive[y](L)}}C.setInputAction(function(y){g("leftClick",y.position)},w.ScreenSpaceEventType.LEFT_CLICK),C.setInputAction(function(y){g("leftDoubleClick",y.position)},w.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);var S;C.setInputAction(function(y){if(l._handlersMuted!=!0){var L=a.pick(y.endPosition);S&&(!L||S!=L.primitive)&&(!(S.isDestroyed&&S.isDestroyed())&&S.mouseOut(y.endPosition),S=null),L&&L.primitive&&(L=L.primitive,L.mouseOut&&(S=L),L.mouseMove&&L.mouseMove(y.endPosition))}},w.ScreenSpaceEventType.MOUSE_MOVE),C.setInputAction(function(y){g("leftUp",y.position)},w.ScreenSpaceEventType.LEFT_UP),C.setInputAction(function(y){g("leftDown",y.position)},w.ScreenSpaceEventType.LEFT_DOWN)},r.prototype.setListener=function(a,l,C){a[l]=C},r.prototype.muteHandlers=function(a){this._handlersMuted=a},r.prototype.registerEditableShape=function(a){var l=this;W(a,"mouseMove",function(C){a.setHighlighted(!0),a._editMode||l._tooltip.showAt(C,"Click to edit this shape")}),W(a,"mouseOut",function(C){a.setHighlighted(!1),l._tooltip.setVisible(!1)}),W(a,"leftClick",function(C){a.setEditMode(!0)})},r.prototype.startDrawing=function(a){this.disableAllEditMode(),this.editCleanUp&&this.editCleanUp(),this.editCleanUp=a,this.muteHandlers(!0)},r.prototype.stopDrawing=function(){this.editCleanUp&&(this.editCleanUp(),this.editCleanUp=null),this.muteHandlers(!1)},r.prototype.disableAllHighlights=function(){this.setHighlighted(void 0)},r.prototype.setHighlighted=function(a){this._highlightedSurface&&!this._highlightedSurface.isDestroyed()&&this._highlightedSurface!=a&&this._highlightedSurface.setHighlighted(!1),this._highlightedSurface=a},r.prototype.disableAllEditMode=function(){this.setEdited(void 0)},r.prototype.setEdited=function(a){this._editedSurface&&!this._editedSurface.isDestroyed()&&this._editedSurface.setEditMode(!1),this._editedSurface=a};var s={ellipsoid:w.Ellipsoid.WGS84,textureRotationAngle:0,height:0,asynchronous:!0,show:!0,debugShowBoundingVolume:!1},i=H(s,{appearance:new w.EllipsoidSurfaceAppearance({aboveGround:!1}),material:t,granularity:Math.PI/180}),u=H(s,{}),h=H(s,{}),f=H(s,{}),m=H(i,{rotation:0}),v=H(s,{width:5,geodesic:!0,granularity:1e4,appearance:new w.PolylineMaterialAppearance({aboveGround:!1}),material:t}),M=function(){function a(){}return a.prototype.initialiseOptions=function(l){j(this,l),this._ellipsoid=void 0,this._granularity=void 0,this._height=void 0,this._textureRotationAngle=void 0,this._id=void 0,this._createPrimitive=!0,this._primitive=void 0,this._outlinePolygon=void 0},a.prototype.setAttribute=function(l,C){this[l]=C,this._createPrimitive=!0},a.prototype.getAttribute=function(l){return this[l]},a.prototype.update=function(l,C,g){if(!w.defined(this.ellipsoid))throw new w.DeveloperError("this.ellipsoid must be defined.");if(!w.defined(this.appearance))throw new w.DeveloperError("this.material must be defined.");if(this.granularity<0)throw new w.DeveloperError("this.granularity and scene2D/scene3D overrides must be greater than zero.");if(this.show&&!(!this._createPrimitive&&!w.defined(this._primitive))){if(this._createPrimitive||this._ellipsoid!==this.ellipsoid||this._granularity!==this.granularity||this._height!==this.height||this._textureRotationAngle!==this.textureRotationAngle||this._id!==this.id){var S=this.getGeometry();if(!S)return;this._createPrimitive=!1,this._ellipsoid=this.ellipsoid,this._granularity=this.granularity,this._height=this.height,this._textureRotationAngle=this.textureRotationAngle,this._id=this.id,this._primitive=this._primitive&&this._primitive.destroy(),this._primitive=new w.Primitive({geometryInstances:new w.GeometryInstance({geometry:S,id:this.id,pickPrimitive:this}),appearance:this.appearance,asynchronous:this.asynchronous}),this._outlinePolygon=this._outlinePolygon&&this._outlinePolygon.destroy(),this.strokeColor&&this.getOutlineGeometry&&(this._outlinePolygon=new w.Primitive({geometryInstances:new w.GeometryInstance({geometry:this.getOutlineGeometry(),attributes:{color:w.ColorGeometryInstanceAttribute.fromColor(this.strokeColor)}}),appearance:new w.PerInstanceColorAppearance({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:this.strokeWidth||4}})}))}var y=this._primitive;y.appearance.material=this.material,y.debugShowBoundingVolume=this.debugShowBoundingVolume,y.update(l,C,g),this._outlinePolygon&&this._outlinePolygon.update(l,C,g)}},a.prototype.isDestroyed=function(){return!1},a.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),w.destroyObject(this)},a.prototype.setStrokeStyle=function(l,C){(!this.strokeColor||!this.strokeColor.equals(l)||this.strokeWidth!=C)&&(this._createPrimitive=!0,this.strokeColor=l,this.strokeWidth=C)},a}();r.ExtentPrimitive=function(){function a(l){if(!w.defined(l.extent))throw new w.DeveloperError("Extent is required");l=H(l,i),this.initialiseOptions(l),this.setExtent(l.extent)}return a.prototype=new M,a.prototype.setExtent=function(l){this.setAttribute("extent",l)},a.prototype.getExtent=function(){return this.getAttribute("extent")},a.prototype.getGeometry=function(){if(w.defined(this.extent))return new w.RectangleGeometry({rectangle:this.extent,height:this.height,vertexFormat:w.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return new w.RectangleOutlineGeometry({rectangle:this.extent})},a}(),r.PolygonPrimitive=function(){function a(l){l=H(l,i),this.initialiseOptions(l),this.isPolygon=!0}return a.prototype=new M,a.prototype.setPositions=function(l){this.setAttribute("positions",l)},a.prototype.getPositions=function(){return this.getAttribute("positions")},a.prototype.getGeometry=function(){if(!(!w.defined(this.positions)||this.positions.length<3))return w.PolygonGeometry.fromPositions({positions:this.positions,height:this.height,vertexFormat:w.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return w.PolygonOutlineGeometry.fromPositions({positions:this.getPositions()})},a}(),r.CirclePrimitive=function(){function a(l){if(!(w.defined(l.center)&&w.defined(l.radius)))throw new w.DeveloperError("Center and radius are required");l=H(l,i),this.initialiseOptions(l),this.setRadius(l.radius)}return a.prototype=new M,a.prototype.setCenter=function(l){this.setAttribute("center",l)},a.prototype.setRadius=function(l){this.setAttribute("radius",Math.max(.1,l))},a.prototype.getCenter=function(){return this.getAttribute("center")},a.prototype.getRadius=function(){return this.getAttribute("radius")},a.prototype.getGeometry=function(){if(w.defined(this.center)&&w.defined(this.radius))return new w.CircleGeometry({center:this.center,radius:this.radius,height:this.height,vertexFormat:w.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return new w.CircleOutlineGeometry({center:this.getCenter(),radius:this.getRadius()})},a}(),r.EllipsePrimitive=function(){function a(l){if(!(w.defined(l.center)&&w.defined(l.semiMajorAxis)&&w.defined(l.semiMinorAxis)))throw new w.DeveloperError("Center and semi major and semi minor axis are required");l=H(l,m),this.initialiseOptions(l)}return a.prototype=new M,a.prototype.setCenter=function(l){this.setAttribute("center",l)},a.prototype.setSemiMajorAxis=function(l){l<this.getSemiMinorAxis()||this.setAttribute("semiMajorAxis",l)},a.prototype.setSemiMinorAxis=function(l){l>this.getSemiMajorAxis()||this.setAttribute("semiMinorAxis",l)},a.prototype.setRotation=function(l){return this.setAttribute("rotation",l)},a.prototype.getCenter=function(){return this.getAttribute("center")},a.prototype.getSemiMajorAxis=function(){return this.getAttribute("semiMajorAxis")},a.prototype.getSemiMinorAxis=function(){return this.getAttribute("semiMinorAxis")},a.prototype.getRotation=function(){return this.getAttribute("rotation")},a.prototype.getGeometry=function(){if(w.defined(this.center)&&w.defined(this.semiMajorAxis)&&w.defined(this.semiMinorAxis))return new w.EllipseGeometry({ellipsoid:this.ellipsoid,center:this.center,semiMajorAxis:this.semiMajorAxis,semiMinorAxis:this.semiMinorAxis,rotation:this.rotation,height:this.height,vertexFormat:w.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,granularity:this.granularity})},a.prototype.getOutlineGeometry=function(){return new w.EllipseOutlineGeometry({center:this.getCenter(),semiMajorAxis:this.getSemiMajorAxis(),semiMinorAxis:this.getSemiMinorAxis(),rotation:this.getRotation()})},a}(),r.PolylinePrimitive=function(){function a(l){l=H(l,v),this.initialiseOptions(l)}return a.prototype=new M,a.prototype.setPositions=function(l){this.setAttribute("positions",l)},a.prototype.setWidth=function(l){this.setAttribute("width",l)},a.prototype.setGeodesic=function(l){this.setAttribute("geodesic",l)},a.prototype.getPositions=function(){return this.getAttribute("positions")},a.prototype.getWidth=function(){return this.getAttribute("width")},a.prototype.getGeodesic=function(l){return this.getAttribute("geodesic")},a.prototype.getGeometry=function(){if(!(!w.defined(this.positions)||this.positions.length<2))return new w.PolylineGeometry({positions:this.positions,height:this.height,width:this.width<1?1:this.width,vertexFormat:w.EllipsoidSurfaceAppearance.VERTEX_FORMAT,ellipsoid:this.ellipsoid})},a}();var b={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},T={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},G={iconUrl:"./assets/img/dragIconLight.png",shiftX:0,shiftY:0};r.prototype.createBillboardGroup=function(a,l,C){var g=new r.BillboardGroup(this,l);return g.addBillboards(a,C),g},r.BillboardGroup=function(a,l){this._drawHelper=a,this._scene=a._scene,this._options=H(l,b);var C=new w.BillboardCollection;this._scene.primitives.add(C),this._billboards=C,this._orderedBillboards=[]},r.BillboardGroup.prototype.createBillboard=function(a,l){var C=this._billboards.add({show:!0,position:a,pixelOffset:new w.Cartesian2(this._options.shiftX,this._options.shiftY),eyeOffset:new w.Cartesian3(0,0,0),horizontalOrigin:w.HorizontalOrigin.CENTER,verticalOrigin:w.VerticalOrigin.CENTER,scale:1,image:this._options.iconUrl,color:n});if(l){let y=function(E){S.enableRotate=E},L=function(){for(var E=0,D=g._orderedBillboards.length;E<D&&g._orderedBillboards[E]!=C;++E);return E};var g=this,S=this._scene.screenSpaceCameraController;if(l.dragHandlers){var g=this;W(C,"leftDown",function(D){function k(x){C.position=x;for(var B=0,_=g._orderedBillboards.length;B<_&&g._orderedBillboards[B]!=C;++B);l.dragHandlers.onDrag&&l.dragHandlers.onDrag(L(),x)}function A(x){O.destroy(),y(!0),l.dragHandlers.onDragEnd&&l.dragHandlers.onDragEnd(L(),x)}var O=new w.ScreenSpaceEventHandler(g._scene.canvas);O.setInputAction(function(x){var B=g._scene.camera.pickEllipsoid(x.endPosition,e);B?k(B):A(B)},w.ScreenSpaceEventType.MOUSE_MOVE),O.setInputAction(function(x){A(g._scene.camera.pickEllipsoid(x.position,e))},w.ScreenSpaceEventType.LEFT_UP),y(!1),l.dragHandlers.onDragStart&&l.dragHandlers.onDragStart(L(),g._scene.camera.pickEllipsoid(D,e))})}l.onDoubleClick&&W(C,"leftDoubleClick",function(E){l.onDoubleClick(L())}),l.onClick&&W(C,"leftClick",function(E){l.onClick(L())}),l.tooltip&&(W(C,"mouseMove",function(E){g._drawHelper._tooltip.showAt(E,l.tooltip())}),W(C,"mouseOut",function(E){g._drawHelper._tooltip.setVisible(!1)}))}return C},r.BillboardGroup.prototype.insertBillboard=function(a,l,C){this._orderedBillboards.splice(a,0,this.createBillboard(l,C))},r.BillboardGroup.prototype.addBillboard=function(a,l){this._orderedBillboards.push(this.createBillboard(a,l))},r.BillboardGroup.prototype.addBillboards=function(a,l){for(var C=0;C<a.length;C++)this.addBillboard(a[C],l)},r.BillboardGroup.prototype.updateBillboardsPositions=function(a){for(var l=0;l<a.length;l++)this.getBillboard(l).position=a[l]},r.BillboardGroup.prototype.countBillboards=function(){return this._orderedBillboards.length},r.BillboardGroup.prototype.getBillboard=function(a){return this._orderedBillboards[a]},r.BillboardGroup.prototype.removeBillboard=function(a){this._billboards.remove(this.getBillboard(a)),this._orderedBillboards.splice(a,1)},r.BillboardGroup.prototype.remove=function(){this._billboards=this._billboards&&this._billboards.removeAll()&&this._billboards.destroy()},r.BillboardGroup.prototype.setOnTop=function(){this._scene.primitives.raiseToTop(this._billboards)},r.prototype.startDrawingMarker=function(l){var l=H(l,b);this.startDrawing(function(){y.remove(),L.destroy(),S.setVisible(!1)});var C=this,g=this._scene;g.primitives;var S=this._tooltip,y=new r.BillboardGroup(this,l),L=new w.ScreenSpaceEventHandler(g.canvas);L.setInputAction(function(E){if(E.position!=null){var D=g.camera.pickEllipsoid(E.position,e);D&&(y.addBillboard(D),C.stopDrawing(),l.callback(D))}},w.ScreenSpaceEventType.LEFT_CLICK),L.setInputAction(function(E){var D=E.endPosition;if(D!=null){var k=g.camera.pickEllipsoid(D,e);k?S.showAt(D,"<p>Click to add your marker. Position is: </p>"+Y(e.cartesianToCartographic(k))):S.showAt(D,"<p>Click on the globe to add your marker.</p>")}},w.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.startDrawingPolygon=function(l){var l=H(l,i);this.startDrawingPolyshape(!0,l)},r.prototype.startDrawingPolyline=function(l){var l=H(l,v);this.startDrawingPolyshape(!1,l)},r.prototype.startDrawingPolyshape=function(a,l){this.startDrawing(function(){S.remove(E),k.remove(),A.destroy(),y.setVisible(!1),$(g)});var C=this,g=this._scene,S=g.primitives,y=this._tooltip,L=a?3:2,E;a?E=new we.PolygonPrimitive(l):E=new we.PolylinePrimitive(l),E.asynchronous=!1,S.add(E);var D=[],k=new r.BillboardGroup(this,b),A=new w.ScreenSpaceEventHandler(g.canvas);Z(g),A.setInputAction(function(O){if(O.position!=null){var x=g.camera.pickEllipsoid(O.position,e);x&&(D.length==0&&(D.push(x.clone()),k.addBillboard(D[0])),D.length>=L&&(E.positions=D,E._createPrimitive=!0),D.push(x),k.addBillboard(x))}},w.ScreenSpaceEventType.LEFT_CLICK),A.setInputAction(function(O){var x=O.endPosition;if(x!=null)if(D.length==0)y.showAt(x,"<p>Click to add first point</p>");else{var B=g.camera.pickEllipsoid(x,e);B&&(D.pop(),B.y+=1+Math.random(),D.push(B),D.length>=L&&(E.positions=D,E._createPrimitive=!0),k.getBillboard(D.length-1).position=B,y.showAt(x,"<p>Click to add new point ("+D.length+")</p>"+(D.length>L?"<p>Double click to finish drawing</p>":"")))}},w.ScreenSpaceEventType.MOUSE_MOVE),A.setInputAction(function(O){var x=O.position;if(x!=null){if(D.length<L+2)return;var B=g.camera.pickEllipsoid(x,e);B&&($(g),C.stopDrawing(),typeof l.callback=="function"&&(D.length-1,l.callback(D)))}},w.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)};function z(a){return e.cartographicArrayToCartesianArray([w.Rectangle.northwest(a),w.Rectangle.northeast(a),w.Rectangle.southeast(a),w.Rectangle.southwest(a)])}function Z(a){a&&(a.canvas.style.cursor="crosshair")}function $(a){a&&(a.canvas.style.cursor="")}r.prototype.startDrawingExtent=function(l){var l=H(l,i);this.startDrawing(function(){E!=null&&S.remove(E),D!=null&&D.remove(),k.destroy(),y.setVisible(!1),$(g)});var C=this,g=this._scene,S=this._scene.primitives,y=this._tooltip,L=null,E=null,D=null,k=new w.ScreenSpaceEventHandler(g.canvas);Z(g);function A(O){E==null&&(E=new we.ExtentPrimitive({extent:O,material:l.material}),E.asynchronous=!1,S.add(E)),E.setExtent(O);var x=z(O);D==null?(D=new r.BillboardGroup(C,b),D.addBillboards(x)):D.updateBillboardsPositions(x)}k.setInputAction(function(O){if(O.position!=null){var x=g.camera.pickEllipsoid(O.position,e);if(x)if(E==null){L=e.cartesianToCartographic(x);var B=X(L,L);A(B)}else C.stopDrawing(),typeof l.callback=="function"&&l.callback(X(L,e.cartesianToCartographic(x)))}},w.ScreenSpaceEventType.LEFT_DOWN),k.setInputAction(function(O){var x=O.endPosition;if(x!=null)if(E==null)y.showAt(x,"<p>Click to start drawing rectangle</p>");else{var B=g.camera.pickEllipsoid(x,e);if(B){var _=X(L,e.cartesianToCartographic(B));A(_),y.showAt(x,"<p>Drag to change rectangle extent</p><p>Click again to finish drawing</p>")}}},w.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.startDrawingCircle=function(l){var l=H(l,i);this.startDrawing(function(){L!=null&&S.remove(L),E.remove(),D.destroy(),y.setVisible(!1)});var C=this,g=this._scene,S=this._scene.primitives,y=this._tooltip,L=null,E=null,D=new w.ScreenSpaceEventHandler(g.canvas);D.setInputAction(function(k){if(k.position!=null){var A=g.camera.pickEllipsoid(k.position,e);A&&(L==null?(L=new r.CirclePrimitive({center:A,radius:0,asynchronous:!1,material:l.material}),S.add(L),E=new r.BillboardGroup(C,b),E.addBillboards([A])):(typeof l.callback=="function"&&l.callback(L.getCenter(),L.getRadius()),C.stopDrawing()))}},w.ScreenSpaceEventType.LEFT_DOWN),D.setInputAction(function(k){var A=k.endPosition;if(A!=null)if(L==null)y.showAt(A,"<p>Click to start drawing the circle</p>");else{var O=g.camera.pickEllipsoid(A,e);O&&(L.setRadius(w.Cartesian3.distance(L.getCenter(),O)),E.updateBillboardsPositions(O),y.showAt(A,"<p>Move mouse to change circle radius</p><p>Click again to finish drawing</p>"))}},w.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.enhancePrimitives=function(){var a=this;w.Billboard.prototype.setEditable=function(){if(this._editable)return;this._editable=!0;var g=this,S=this;function y(L){a._scene.screenSpaceCameraController.enableRotate=L}W(g,"leftDown",function(L){function E(A){g.position=A,S.executeListeners({name:"drag",positions:A})}function D(A){k.destroy(),y(!0),S.executeListeners({name:"dragEnd",positions:A})}var k=new w.ScreenSpaceEventHandler(a._scene.canvas);k.setInputAction(function(A){var O=a._scene.camera.pickEllipsoid(A.endPosition,e);O?E(O):D(O)},w.ScreenSpaceEventType.MOUSE_MOVE),k.setInputAction(function(A){D(a._scene.camera.pickEllipsoid(A.position,e))},w.ScreenSpaceEventType.LEFT_UP),y(!1)}),te(g)};function l(g){a._scene,!(this._highlighted&&this._highlighted==g)&&this._editMode!==!0&&(this._highlighted=g,g?(a.setHighlighted(this),this._strokeColor=this.strokeColor,this.setStrokeStyle(w.Color.fromCssColorString("white"),this.strokeWidth)):this._strokeColor?this.setStrokeStyle(this._strokeColor,this.strokeWidth):this.setStrokeStyle(void 0,void 0))}function C(g){if(this._editMode!=g)if(a.disableAllHighlights(),g){a.setEdited(this);var S=a._scene,y=this;if(this._markers==null){let B=function(P,F){var N=P-1<0?F.length-1:P-1;N<E.countBillboards()&&(E.getBillboard(N).position=I(N)),N=P,N<E.countBillboards()&&(E.getBillboard(N).position=I(N))},_=function(){y.executeListeners({name:"onEdited",positions:y.positions})},I=function(P){var F=y.positions;return e.cartographicToCartesian(new w.EllipsoidGeodesic(e.cartesianToCartographic(F[P]),e.cartesianToCartographic(F[P<F.length-1?P+1:0])).interpolateUsingFraction(.5))};var L=new r.BillboardGroup(a,T),E=new r.BillboardGroup(a,G),D={dragHandlers:{onDrag:function(P,F){y.positions[P]=F,B(P,y.positions),y._createPrimitive=!0},onDragEnd:function(P,F){y._createPrimitive=!0,_()}},onDoubleClick:function(P){y.positions.length<4||(y.positions.splice(P,1),y._createPrimitive=!0,L.removeBillboard(P),E.removeBillboard(P),B(P,y.positions),_())},tooltip:function(){if(y.positions.length>3)return"Double click to remove this point"}};L.addBillboards(y.positions,D),this._markers=L;for(var k=[],A=0,O=y.positions.length+(this.isPolygon?0:-1);A<O;A++)k.push(I(A));var x={dragHandlers:{onDragStart:function(P,F){this.index=P+1,y.positions.splice(this.index,0,F),y._createPrimitive=!0},onDrag:function(P,F){y.positions[this.index]=F,y._createPrimitive=!0},onDragEnd:function(P,F){L.insertBillboard(this.index,F,D),E.getBillboard(this.index-1).position=I(this.index-1),E.insertBillboard(this.index,I(this.index),x),y._createPrimitive=!0,_()}},tooltip:function(){return"Drag to create a new point"}};E.addBillboards(k,x),this._editMarkers=E,this._globeClickhandler=new w.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(P){var F=S.pick(P.position);F&&F.primitive||y.setEditMode(!1)},w.ScreenSpaceEventType.LEFT_CLICK),L.setOnTop(),E.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._editMarkers.remove(),this._markers=null,this._editMarkers=null,this._globeClickhandler.destroy()),this._editMode=!1}we.PolylinePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var g=this;g.isPolygon=!1,g.asynchronous=!1,a.registerEditableShape(g),g.setEditMode=C;var S=this.width;g.setHighlighted=function(y){this._editMode!==!0&&(y?(a.setHighlighted(this),this.setWidth(S*2)):this.setWidth(S))},g.getExtent=function(){return w.Rectangle.fromCartographicArray(e.cartesianArrayToCartographicArray(this.positions))},te(g),g.setEditMode(!1)}},we.PolygonPrimitive.prototype.setEditable=function(){var g=this;g.asynchronous=!1,a._scene,a.registerEditableShape(g),g.setEditMode=C,g.setHighlighted=l,te(g),g.setEditMode(!1)},we.ExtentPrimitive.prototype.setEditable=function(){if(!this.setEditMode){var g=this,S=a._scene;a.registerEditableShape(g),g.asynchronous=!1,g.setEditMode=function(y){if(this._editMode!=y)if(a.disableAllHighlights(),y){if(a.setEdited(this),this._markers==null){let D=function(){g.executeListeners({name:"onEdited",extent:g.extent})};var L=new r.BillboardGroup(a,T),E={dragHandlers:{onDrag:function(k,A){var O=L.getBillboard((k+2)%4).position;g.setExtent(X(e.cartesianToCartographic(O),e.cartesianToCartographic(A))),L.updateBillboardsPositions(z(g.extent))},onDragEnd:function(k,A){D()}},tooltip:function(){return"Drag to change the corners of this extent"}};L.addBillboards(z(g.extent),E),this._markers=L,this._globeClickhandler=new w.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(k){var A=S.pick(k.position);A&&!A.isDestroyed()&&A.primitive||g.setEditMode(!1)},w.ScreenSpaceEventType.LEFT_CLICK),L.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},g.setHighlighted=l,te(g),g.setEditMode(!1)}},r.EllipsePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var g=this,S=a._scene;g.asynchronous=!1,a.registerEditableShape(g),g.setEditMode=function(y){if(this._editMode!=y)if(a.disableAllHighlights(),y){a.setEdited(this);var L=this;if(this._markers==null){let k=function(){return w.EllipseOutlineGeometry(e,g.getCenter(),g.getSemiMajorAxis(),g.getSemiMinorAxis(),g.getRotation()+Math.PI/2,Math.PI/2).splice(0,4)},A=function(){g.executeListeners({name:"onEdited",center:g.getCenter(),semiMajorAxis:g.getSemiMajorAxis(),semiMinorAxis:g.getSemiMinorAxis(),rotation:0})};var E=new r.BillboardGroup(a,T),D={dragHandlers:{onDrag:function(O,x){var B=w.Cartesian3.distance(g.getCenter(),x);O%2==0?g.setSemiMajorAxis(B):g.setSemiMinorAxis(B),E.updateBillboardsPositions(k())},onDragEnd:function(O,x){A()}},tooltip:function(){return"Drag to change the excentricity and radius"}};E.addBillboards(k(),D),this._markers=E,this._globeClickhandler=new w.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(O){var x=S.pick(O.position);x&&x.primitive||L.setEditMode(!1)},w.ScreenSpaceEventType.LEFT_CLICK),E.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},g.setHighlighted=l,te(g),g.setEditMode(!1)}},r.CirclePrimitive.prototype.getCircleCartesianCoordinates=function(g){for(var S=w.CircleOutlineGeometry.createGeometry(new w.CircleOutlineGeometry({ellipsoid:e,center:this.getCenter(),radius:this.getRadius(),granularity:g})),y=0,L,E=[];y<S.attributes.position.values.length;y+=3)L=S.attributes.position.values,E.push(new w.Cartesian3(L[y],L[y+1],L[y+2]));return E},r.CirclePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var g=this,S=a._scene;g.asynchronous=!1,a.registerEditableShape(g),g.setEditMode=function(y){if(this._editMode!=y)if(a.disableAllHighlights(),y){a.setEdited(this);var L=this;if(this._markers==null){let k=function(){return L.getCircleCartesianCoordinates(w.Math.PI_OVER_TWO)},A=function(){g.executeListeners({name:"onEdited",center:g.getCenter(),radius:g.getRadius()})};var E=new r.BillboardGroup(a,T),D={dragHandlers:{onDrag:function(O,x){g.setRadius(w.Cartesian3.distance(g.getCenter(),x)),E.updateBillboardsPositions(k())},onDragEnd:function(O,x){A()}},tooltip:function(){return"Drag to change the radius"}};E.addBillboards(k(),D),this._markers=E,this._globeClickhandler=new w.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(O){var x=S.pick(O.position);x&&x.primitive||L.setEditMode(!1)},w.ScreenSpaceEventType.LEFT_CLICK),E.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},g.setHighlighted=l,te(g),g.setEditMode(!1)}}},r.DrawHelperWidget=function(){function a(l,C){if(!w.defined(C.container))throw new w.DeveloperError("Container is required");var g={markerIcon:"./assets/img/glyphicons_242_google_maps.png",polylineIcon:"./assets/img/glyphicons_097_vector_path_line.png",polygonIcon:"./assets/img/glyphicons_096_vector_path_polygon.png",circleIcon:"./assets/img/glyphicons_095_vector_path_circle.png",extentIcon:"./assets/img/glyphicons_094_vector_path_square.png",clearIcon:"./assets/img/glyphicons_067_cleaning.png",polylineDrawingOptions:v,polygonDrawingOptions:u,extentDrawingOptions:h,circleDrawingOptions:f};j(C,g);var S=this,y=document.createElement("DIV");y.className="toolbar",C.container.appendChild(y);function L(k,A,O,x){var B=document.createElement("DIV");B.className="button",B.title=O,y.appendChild(B),B.onclick=x;var _=document.createElement("SPAN");B.appendChild(_);var I=document.createElement("IMG");return I.src=A,_.appendChild(I),B}var E=l._scene;L("marker",C.markerIcon,"Click to start drawing a 2D marker",function(){l.startDrawingMarker({callback:function(k){S.executeListeners({name:"markerCreated",position:k})}})}),L("polyline",C.polylineIcon,"Click to start drawing a 2D polyline",function(){l.startDrawingPolyline({callback:function(k){S.executeListeners({name:"polylineCreated",positions:k})}})}),L("polygon",C.polygonIcon,"Click to start drawing a 2D polygon",function(){l.startDrawingPolygon({callback:function(k){S.executeListeners({name:"polygonCreated",positions:k})}})}),L("extent",C.extentIcon,"Click to start drawing an Extent",function(){l.startDrawingExtent({callback:function(k){S.executeListeners({name:"extentCreated",extent:k})}})}),L("circle",C.circleIcon,"Click to start drawing a Circle",function(){l.startDrawingCircle({callback:function(k,A){S.executeListeners({name:"circleCreated",center:k,radius:A})}})});var D=document.createElement("DIV");D.className="divider",y.appendChild(D),L("clear",C.clearIcon,"Remove all primitives",function(){E.primitives.removeAll()}),te(this)}return a}(),r.prototype.addToolbar=function(a,l){return l=H(l,{container:a}),new r.DrawHelperWidget(this,l)};function X(a,l){var C=new w.Rectangle;C.west=Math.min(a.longitude,l.longitude),C.east=Math.max(a.longitude,l.longitude),C.south=Math.min(a.latitude,l.latitude),C.north=Math.max(a.latitude,l.latitude);var g=w.Math.EPSILON7;return C.east-C.west<g&&(C.east+=g*2),C.north-C.south<g&&(C.north+=g*2),C}function Y(a,l){return a.longitude.toFixed(l||3)+", "+a.latitude.toFixed(l||3)}function V(a,l){if(a==null||typeof a!="object"||a.constructor!=Object&&a.constructor!=Array)return a;if(a.constructor==Date||a.constructor==RegExp||a.constructor==Function||a.constructor==String||a.constructor==Number||a.constructor==Boolean)return new a.constructor(a);l=l||new a.constructor;for(var C in a)l[C]=typeof l[C]>"u"?V(a[C],null):l[C];return l}function j(a,l){a=a||{};var C;for(C in l)a[C]===void 0&&(a[C]=V(l[C]))}function H(a,l){var C=V(a),g;for(g in l)C[g]===void 0&&(C[g]=V(l[g]));return C}function W(a,l,C){a[l]=C}function te(a){a._listeners={},a.addListener=function(l,C){return this._listeners[l]=this._listeners[l]||[],this._listeners[l].push(C),this._listeners[l].length},a.executeListeners=function(l,C){if(this._listeners[l.name]&&this._listeners[l.name].length>0)for(var g=0;g<this._listeners[l.name].length;g++)this._listeners[l.name][g](l);else C&&C(l)}}return r}();const qi=2,ji=(e,n)=>{switch(e){case he.BOX:{if(n.features.length!==qi)throw new Error(`${e} must have 2 points`);const t=q.find(n.features,s=>{var i;return((i=s.properties)==null?void 0:i.type)===Ne.BOTTOM_LEFT}),r=q.find(n.features,s=>{var i;return((i=s.properties)==null?void 0:i.type)===Ne.TOP_RIGHT});if(r&&t){if(t.geometry.coordinates[0]===r.geometry.coordinates[0]&&t.geometry.coordinates[1]===r.geometry.coordinates[1])throw new Error(`${e} must define BOTTOM_LEFT and TOP_RIGHT different points`);return p.Rectangle.fromDegrees(t.geometry.coordinates[0],t.geometry.coordinates[1],r.geometry.coordinates[0],r.geometry.coordinates[1])}else throw new Error(`${e} geojson must define BOTTOM_LEFT and TOP_RIGHT points`)}default:throw new Error(`${e} type geoJSON still not supported`)}},vn=e=>{const n=e.map(t=>{const r=p.Cartographic.fromCartesian(t);return[p.Math.toDegrees(r.longitude),p.Math.toDegrees(r.latitude)]});return n.push(n[0]),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}},En=e=>{const n=wt.lineString([[p.Math.toDegrees(e.west),p.Math.toDegrees(e.south)],[p.Math.toDegrees(e.east),p.Math.toDegrees(e.north)]]);return Re(vt(n))},Sn=e=>{const n=wt.lineString([[e.west,e.south],[e.east,e.north]]);return Re(vt(n)).geometry.coordinates[0].map(r=>p.Cartesian3.fromRadiansArray(r)[0])};class Ki extends p.Color{}const Yi=e=>{const{drawState:n,drawingMaterial:t,drawingVertexColor:r,material:s,hollow:i,outlineWidth:u}=e,h=le(),[f,m]=c.useState();c.useEffect(()=>{m(new we(h,t,r))},[]),c.useEffect(()=>{if(f){const M=f;if(n.drawing)switch(n.type){case he.POLYGON:h.scene.globe.depthTestAgainstTerrain=!1,M.startDrawingPolygon({callback:b=>{n.handler({primitive:b,type:he.POLYGON,geojson:vn(b)})}});break;case he.BOX:h.scene.globe.depthTestAgainstTerrain=!1,M.startDrawingExtent({callback:b=>{n.handler({primitive:b,type:he.BOX,geojson:En(b)})}});break;default:throw new Error(`[CESIUM DRAW]: ${n.type} unrecognized primitive to draw.`)}else M.stopDrawing(),h.scene.globe.depthTestAgainstTerrain=!0}},[n,f]);const v=M=>{try{let b=M.coordinates!==void 0?M.coordinates:ji(M.type,M.geojson);if(i!==!0)switch(M.type){case he.BOX:return o.jsx(mn,{coordinates:b,material:s??t});case he.POLYGON:return o.jsx(fn,{hierarchy:new p.PolygonHierarchy(b),material:s??t});default:return o.jsx(o.Fragment,{})}else{switch(M.type){case he.BOX:b=Sn(b);break;case he.POLYGON:b=[...b,b[0]];break;default:return o.jsx(o.Fragment,{})}return o.jsx(Ui,{clampToGround:!0,positions:b,width:u??1,material:s??t})}}catch(b){return console.error(b),o.jsx(o.Fragment,{})}};return o.jsx(yn,{...e,children:e.drawings.map((M,b)=>o.jsxs(gn,{name:M.name,children:[o.jsxs(pn,{children:[o.jsxs("h1",{children:["Drawed Entity ",M.name]}),o.jsx("p",{children:"This is description of drawed entity"})]}),v(M)]},M.id))})},Zi=e=>{const n=le();return c.useEffect(()=>{n.extend(p.viewerCesiumInspectorMixin)},[n]),o.jsx(o.Fragment,{})},Xi=-25,Tn=2,Ji=e=>{const n=le(),t=(i,u=",")=>i.slice(i.indexOf(`
2
13
  `)+1).split(`
3
- `).map(m=>{const C=m.split(u);return{cartographic:S.Cartographic.fromDegrees(parseFloat(C[0]),parseFloat(C[1])),cartesian:new S.Cartesian2(parseFloat(C[0]),parseFloat(C[1]))}}),i=r=>{var g;r.preventDefault(),r.persist();const u=new FileReader;u.onload=f=>{var b;const m=(b=f.target)==null?void 0:b.result,C=t(m),M=S.Ellipsoid.WGS84;console.log(`Loaded CSV content:
4
- `,m),S.sampleTerrainMostDetailed(n.terrainProvider,C.map(A=>A.cartographic)).then(A=>{console.log(A),A=A.slice(0,A.length-1),n.scene.globe.depthTestAgainstTerrain=!0,n.entities.suspendEvents(),n.entities.removeAll(),A.forEach((x,W)=>{n.entities.add({name:(W+hn).toString(),position:M.cartographicToCartesian(x),billboard:{verticalOrigin:S.VerticalOrigin.BOTTOM,scale:.7,image:"assets/img/map-marker.gif"},label:{text:(W+hn).toString(),font:"14pt monospace",fillColor:S.Color.BLACK,style:S.LabelStyle.FILL_AND_OUTLINE,outlineWidth:4,outlineColor:S.Color.BLACK,verticalOrigin:S.VerticalOrigin.BOTTOM,pixelOffset:new S.Cartesian2(0,Or)},description:`
5
- Long: ${C[W].cartesian.x} </br>
6
- Lat: ${C[W].cartesian.y} </br>
7
- Height(m): <span style="font-weight: 500">${x.height}</span>
8
- `})}),n.entities.resumeEvents(),r.target.files!==null&&(s(`terranian_heights_${r.target.files[0].name}`,C),r.target.value=""),console.log("Pinned point count is ",n.entities.values.length)},A=>{console.error("ERROR while sampleTerrainMostDetailed:",A)})},(g=r.target.files)!=null&&g[0]&&u.readAsText(r.target.files[0])},s=(r,u)=>{const g=b=>{let A="";return A+=b.cartesian.x.toString()+",",A+=b.cartesian.y.toString()+",",A+=b.cartographic.height.toString(),A+`
14
+ `).map(m=>{const v=m.split(u);return{cartographic:p.Cartographic.fromDegrees(parseFloat(v[0]),parseFloat(v[1])),cartesian:new p.Cartesian2(parseFloat(v[0]),parseFloat(v[1]))}}),r=i=>{var h;i.preventDefault(),i.persist();const u=new FileReader;u.onload=f=>{var b;const m=(b=f.target)==null?void 0:b.result,v=t(m),M=p.Ellipsoid.WGS84;console.log(`Loaded CSV content:
15
+ `,m),p.sampleTerrainMostDetailed(n.terrainProvider,v.map(T=>T.cartographic)).then(T=>{console.log(T),T=T.slice(0,T.length-1),n.scene.globe.depthTestAgainstTerrain=!0,n.entities.suspendEvents(),n.entities.removeAll(),T.forEach((G,z)=>{n.entities.add({name:(z+Tn).toString(),position:M.cartographicToCartesian(G),billboard:{verticalOrigin:p.VerticalOrigin.BOTTOM,scale:.7,image:"assets/img/map-marker.gif"},label:{text:(z+Tn).toString(),font:"14pt monospace",fillColor:p.Color.BLACK,style:p.LabelStyle.FILL_AND_OUTLINE,outlineWidth:4,outlineColor:p.Color.BLACK,verticalOrigin:p.VerticalOrigin.BOTTOM,pixelOffset:new p.Cartesian2(0,Xi)},description:`
16
+ Long: ${v[z].cartesian.x} </br>
17
+ Lat: ${v[z].cartesian.y} </br>
18
+ Height(m): <span style="font-weight: 500">${G.height}</span>
19
+ `})}),n.entities.resumeEvents(),i.target.files!==null&&(s(`terranian_heights_${i.target.files[0].name}`,v),i.target.value=""),console.log("Pinned point count is ",n.entities.values.length)},T=>{console.error("ERROR while sampleTerrainMostDetailed:",T)})},(h=i.target.files)!=null&&h[0]&&u.readAsText(i.target.files[0])},s=(i,u)=>{const h=b=>{let T="";return T+=b.cartesian.x.toString()+",",T+=b.cartesian.y.toString()+",",T+=b.cartographic.height.toString(),T+`
9
20
  `};let f=`long,lat,height
10
- `;u.forEach(b=>{f+=g(b)});const m=new Blob([f],{type:"text/csv;charset=utf-8;"}),C=document.createElement("a"),M=URL.createObjectURL(m);C.setAttribute("href",M),C.setAttribute("download",r),C.style.visibility="hidden",document.body.appendChild(C),C.click(),document.body.removeChild(C)};return o.jsx(o.Fragment,{children:o.jsx("input",{type:"file",id:"csvFile",accept:".csv",onChange:r=>{i(r)}})})},wo="",Dr=38,kr=40,xr=13,Nr=14,Br=27,Fr=9,Vr=10,Hr=100,Gr=e=>{const[n,t]=c.useState(e.defaultValue??""),[i,s]=c.useState(!1),[r,u]=c.useState({helperVisible:!1,left:0,right:0,trigger:"",matchLength:0,matchStart:0,options:[],selection:0,top:0,value:"",caret:0,width:"unset"}),g=c.useRef(null);c.useEffect(()=>(window.addEventListener("resize",x),()=>{try{window.removeEventListener("resize",x)}catch(E){console.log('WINDOW "resize" remove listener failed',E)}}),[]),c.useEffect(()=>{typeof e.value<"u"&&t(e.value),typeof e.defaultValue<"u"&&t(e.defaultValue)},[e.value,e.defaultValue]),c.useEffect(()=>{const{options:E}=e,{caret:p}=r;Y(n,p,E)},[e]);const f=(E,p,w)=>{const{trigger:v,matchAny:L,regex:I}=e,P=new RegExp(I);let _=v;Array.isArray(_)||(_=new Array(v)),_.sort();const O={};Array.isArray(w)&&_.forEach(J=>{O[J]=w});const D=m(_,P);let j={};for(let J=0;J<D.length;J++){const{triggerStr:B,triggerMatch:$,triggerLength:te}=D[J];for(let se=p-1;se>=0;--se){const fe=E.substring(se,p).match(P);let de=-1;if(te>0){const he=$?se:se-te+1;if(he<0||(C(B,E,he)&&(de=he+te),!fe&&de<0))break}else{if(fe&&se>0)continue;if(de=se===0&&fe?0:se+1,p-de===0)break}if(de>=0){const he=O[B];if(!Array.isArray(he))continue;const Ie=E.substring(de,p),Z=he.filter(we=>{const Se=we.toLowerCase().indexOf(Ie.toLowerCase());return Se!==-1&&(L||Se===0)}),H=B,ne=Ie.length;j={...j,trigger:H,matchStart:de,matchLength:ne,options:Z}}}}return j},m=(E,p)=>E.map(v=>({triggerStr:v,triggerMatch:v.match(p),triggerLength:v.length})),C=(E,p,w)=>!E||!E.length||p.substr(w,E.length)===E,M=E=>{const{onChange:p,options:w,spaceRemovers:v,spacer:L,value:I}=e,P=n,_=E.target.value,O=dt(b(E.target)).end;if(_.length||G({...r,helperVisible:!1}),t(_),G({...r,caret:O,value:E.target.value}),!_.length||!O)return p(E.target.value);if(i&&v.length&&_.length>2&&L.length){for(let D=0;D<Math.max(P.length,_.length);++D)if(P[D]!==_[D]){if(D>=2&&_[D-1]===L&&v.indexOf(_[D-2])===-1&&v.indexOf(_[D])!==-1&&!z.isEmpty(f(_.substring(0,D-2),O-3,w))){const j=`${_.slice(0,D-1)}${_.slice(D,D+1)}${_.slice(D-1,D)}${_.slice(D+1)}`;return Q(D+1),g.current!==null&&(g.current.value=j),I||G({...r,value:j}),p(j)}break}s(!1)}return Y(_,O,w),p(E.target.value)},b=E=>{if(E!==void 0)if(E.children.length>0){const p=E.getElementsByTagName("textarea");if(p.length>0)return p[0];const w=E.getElementsByTagName("input");if(w.length>0)return w[0]}else return E},A=E=>{const{helperVisible:p,options:w,selection:v}=r,{onKeyDown:L,passThroughEnter:I}=e;if(p)switch(E.keyCode){case Br:E.preventDefault(),X();break;case Dr:E.preventDefault(),G({...r,selection:(w.length+v-1)%w.length});break;case kr:E.preventDefault(),G({...r,selection:(v+1)%w.length});break;case Nr:case xr:I||E.preventDefault(),W(v);break;case Fr:W(v);break;default:L(E);break}else L(E)},x=()=>{G({...r,helperVisible:!1})},W=E=>{const{spacer:p,onSelect:w,changeOnSelect:v}=e,{matchStart:L,matchLength:I,options:P,trigger:_}=r,O=P[E],D=n,j=D.substring(0,L-_.length),J=D.substring(L+I),B={target:g.current},$=v(_,O);B.target!==null&&(B.target.value=`${j}${$}${p}${J}`),M(B),B.target!==null&&w(B.target.value),X(),Q(j.length+$.length+1),s(!0)},Q=E=>{G({...r,caret:E});const p=b(g.current);dt.setCaretPosition(p,E)},G=E=>{setTimeout(()=>{u({...E})},0)},Y=(E,p,w)=>{const v=g.current;if(g.current===null)return;const L=b(v);if(L===void 0)return;const I=v.getBoundingClientRect(),P=f(E,p,w);if(Object.keys(P).length>0&&L!==null){const _=Nn(L,p),O=L.getBoundingClientRect(),{minChars:D,onRequestOptions:j,requestOnlyIfNoOptions:J,mode:B}=e;let $,te,se,Ce="unset";B==="assist"?($=v===L?_.top+L.offsetTop:_.top+I.top,te=Math.min(_.left+L.offsetLeft-Vr,L.offsetLeft+O.width-Hr)):($=I.top+v.offsetHeight,te=v.offsetLeft,se=v.offsetLeft-v.offsetWidth,Ce=`${I.width}px`),P.matchLength>=D&&(P.options.length>1||P.options.length===1&&P.options[0].length!==P.matchLength)?G({...r,value:E,helperVisible:!0,top:$,left:te,right:se,width:Ce,...P}):((!J||!P.options.length)&&j(E.substr(P.matchStart,P.matchLength)),X())}else X()},X=()=>{setTimeout(()=>{G({...r,helperVisible:!1,selection:0})},100)},k=()=>{const{helperVisible:E,left:p,right:w,matchStart:v,matchLength:L,options:I,selection:P,top:_,value:O,width:D}=r;if(!E)return null;const{maxOptions:j,offsetX:J,offsetY:B,direction:$}=e;if(I.length===0)return null;if(P>=I.length)return G({...r,selection:0}),null;const te=j===0?I.length:j,se=I.slice(0,te).map((fe,de)=>{const he=fe.toLowerCase().indexOf(O.substr(v,L).toLowerCase());return o.jsxs("li",{className:de===P?"active":void 0,onClick:()=>{W(de)},onMouseEnter:()=>{G({...r,selection:de})},children:[fe.slice(0,he),o.jsx("strong",{children:fe.substr(he,L)}),fe.slice(he+L)]},fe)}),Ce=$==="ltr"?{left:p+J}:{right:w+J};return o.jsx("ul",{className:"react-autocomplete-input",style:{...Ce,top:_+B,width:D},children:se})},{Component:q,ComponentProps:N,defaultValue:U,disabled:oe,onBlur:a,value:l,...T}=e,h=Object.assign({},T);return Object.keys(e).forEach(E=>{delete h[E]}),o.jsxs(o.Fragment,{children:[c.cloneElement(q,{disabled:oe,onBlur:a,onChange:M,onKeyDown:A,ref:g,value:n,...h,...N}),k()]})},zr={Component:o.jsx("textarea",{}),ComponentProps:{},defaultValue:void 0,disabled:!1,maxOptions:6,onBlur:e=>{},onChange:e=>{},onKeyDown:e=>{},onRequestOptions:e=>{},onSelect:e=>{},changeOnSelect:(e,n)=>`${e}${n}`,options:[],regex:"^[A-Za-z0-9\\-_]+$",matchAny:!1,minChars:0,requestOnlyIfNoOptions:!0,spaceRemovers:[",",".","!","?"],spacer:" ",trigger:"@",offsetX:0,offsetY:0,value:void 0,passThroughEnter:!1,mode:"assist",direction:"ltr"},Wr=e=>{let n={...zr,...e};return e.mode==="autocomplete"&&(n={...n,trigger:"",regex:".",spacer:""}),o.jsx(Gr,{...n})},We={formatFileModDate:(e,n)=>{const t=F.FileHelper.getModDate(n);return t?e.formatDate(t,{dateStyle:"short",timeStyle:"short"}):null},formatFileSize:(e,n)=>{if(!n||typeof n.size!="number")return null;const t=n.size,i=Fn(t,{bits:!1,output:"object"});return i.symbol==="B"?`${Math.round(i.value/10)/100} KB`:i.symbol==="KB"?`${Math.round(i.value)} ${i.symbol}`:`${i.value} ${i.symbol.toUpperCase()}`}},$r={locale:ue.EN,formatters:{...We}},qr={locale:ue.RU,formatters:{...We},messages:{"chonky.toolbar.searchPlaceholder":"Поиск","chonky.toolbar.visibleFileCount":`{fileCount, plural,
21
+ `;u.forEach(b=>{f+=h(b)});const m=new Blob([f],{type:"text/csv;charset=utf-8;"}),v=document.createElement("a"),M=URL.createObjectURL(m);v.setAttribute("href",M),v.setAttribute("download",i),v.style.visibility="hidden",document.body.appendChild(v),v.click(),document.body.removeChild(v)};return o.jsx(o.Fragment,{children:o.jsx("input",{type:"file",id:"csvFile",accept:".csv",onChange:i=>{r(i)}})})},Uo="",Qi=38,Ri=40,eo=13,to=14,no=27,ro=9,io=10,oo=100,so=e=>{const[n,t]=c.useState(e.defaultValue??""),[r,s]=c.useState(!1),[i,u]=c.useState({helperVisible:!1,left:0,right:0,trigger:"",matchLength:0,matchStart:0,options:[],selection:0,top:0,value:"",caret:0,width:"unset"}),h=c.useRef(null);c.useEffect(()=>(window.addEventListener("resize",G),()=>{try{window.removeEventListener("resize",G)}catch(S){console.log('WINDOW "resize" remove listener failed',S)}}),[]),c.useEffect(()=>{typeof e.value<"u"&&t(e.value),typeof e.defaultValue<"u"&&t(e.defaultValue)},[e.value,e.defaultValue]),c.useEffect(()=>{const{options:S}=e,{caret:y}=i;X(n,y,S)},[e]);const f=(S,y,L)=>{const{trigger:E,matchAny:D,regex:k}=e,A=new RegExp(k);let O=E;Array.isArray(O)||(O=new Array(E)),O.sort();const x={};Array.isArray(L)&&O.forEach(I=>{x[I]=L});const B=m(O,A);let _={};for(let I=0;I<B.length;I++){const{triggerStr:P,triggerMatch:F,triggerLength:N}=B[I];for(let J=y-1;J>=0;--J){const ce=S.substring(J,y).match(A);let re=-1;if(N>0){const de=F?J:J-N+1;if(de<0||(v(P,S,de)&&(re=de+N),!ce&&re<0))break}else{if(ce&&J>0)continue;if(re=J===0&&ce?0:J+1,y-re===0)break}if(re>=0){const de=x[P];if(!Array.isArray(de))continue;const De=S.substring(re,y),qe=de.filter(Ye=>{const Ie=Ye.toLowerCase().indexOf(De.toLowerCase());return Ie!==-1&&(D||Ie===0)}),je=P,Ke=De.length;_={..._,trigger:je,matchStart:re,matchLength:Ke,options:qe}}}}return _},m=(S,y)=>S.map(E=>({triggerStr:E,triggerMatch:E.match(y),triggerLength:E.length})),v=(S,y,L)=>!S||!S.length||y.substr(L,S.length)===S,M=S=>{const{onChange:y,options:L,spaceRemovers:E,spacer:D,value:k}=e,A=n,O=S.target.value,x=Et(b(S.target)).end;if(O.length||$({...i,helperVisible:!1}),t(O),$({...i,caret:x,value:S.target.value}),!O.length||!x)return y(S.target.value);if(r&&E.length&&O.length>2&&D.length){for(let B=0;B<Math.max(A.length,O.length);++B)if(A[B]!==O[B]){if(B>=2&&O[B-1]===D&&E.indexOf(O[B-2])===-1&&E.indexOf(O[B])!==-1&&!q.isEmpty(f(O.substring(0,B-2),x-3,L))){const _=`${O.slice(0,B-1)}${O.slice(B,B+1)}${O.slice(B-1,B)}${O.slice(B+1)}`;return Z(B+1),h.current!==null&&(h.current.value=_),k||$({...i,value:_}),y(_)}break}s(!1)}return X(O,x,L),y(S.target.value)},b=S=>{if(S!==void 0)if(S.children.length>0){const y=S.getElementsByTagName("textarea");if(y.length>0)return y[0];const L=S.getElementsByTagName("input");if(L.length>0)return L[0]}else return S},T=S=>{const{helperVisible:y,options:L,selection:E}=i,{onKeyDown:D,passThroughEnter:k}=e;if(y)switch(S.keyCode){case no:S.preventDefault(),Y();break;case Qi:S.preventDefault(),$({...i,selection:(L.length+E-1)%L.length});break;case Ri:S.preventDefault(),$({...i,selection:(E+1)%L.length});break;case to:case eo:k||S.preventDefault(),z(E);break;case ro:z(E);break;default:D(S);break}else D(S)},G=()=>{$({...i,helperVisible:!1})},z=S=>{const{spacer:y,onSelect:L,changeOnSelect:E}=e,{matchStart:D,matchLength:k,options:A,trigger:O}=i,x=A[S],B=n,_=B.substring(0,D-O.length),I=B.substring(D+k),P={target:h.current},F=E(O,x);P.target!==null&&(P.target.value=`${_}${F}${y}${I}`),M(P),P.target!==null&&L(P.target.value),Y(),Z(_.length+F.length+1),s(!0)},Z=S=>{$({...i,caret:S});const y=b(h.current);Et.setCaretPosition(y,S)},$=S=>{setTimeout(()=>{u({...S})},0)},X=(S,y,L)=>{const E=h.current;if(h.current===null)return;const D=b(E);if(D===void 0)return;const k=E.getBoundingClientRect(),A=f(S,y,L);if(Object.keys(A).length>0&&D!==null){const O=$n(D,y),x=D.getBoundingClientRect(),{minChars:B,onRequestOptions:_,requestOnlyIfNoOptions:I,mode:P}=e;let F,N,J,se="unset";P==="assist"?(F=E===D?O.top+D.offsetTop:O.top+k.top,N=Math.min(O.left+D.offsetLeft-io,D.offsetLeft+x.width-oo)):(F=k.top+E.offsetHeight,N=E.offsetLeft,J=E.offsetLeft-E.offsetWidth,se=`${k.width}px`),A.matchLength>=B&&(A.options.length>1||A.options.length===1&&A.options[0].length!==A.matchLength)?$({...i,value:S,helperVisible:!0,top:F,left:N,right:J,width:se,...A}):((!I||!A.options.length)&&_(S.substr(A.matchStart,A.matchLength)),Y())}else Y()},Y=()=>{setTimeout(()=>{$({...i,helperVisible:!1,selection:0})},100)},V=()=>{const{helperVisible:S,left:y,right:L,matchStart:E,matchLength:D,options:k,selection:A,top:O,value:x,width:B}=i;if(!S)return null;const{maxOptions:_,offsetX:I,offsetY:P,direction:F}=e;if(k.length===0)return null;if(A>=k.length)return $({...i,selection:0}),null;const N=_===0?k.length:_,J=k.slice(0,N).map((ce,re)=>{const de=ce.toLowerCase().indexOf(x.substr(E,D).toLowerCase());return o.jsxs("li",{className:re===A?"active":void 0,onClick:()=>{z(re)},onMouseEnter:()=>{$({...i,selection:re})},children:[ce.slice(0,de),o.jsx("strong",{children:ce.substr(de,D)}),ce.slice(de+D)]},ce)}),se=F==="ltr"?{left:y+I}:{right:L+I};return o.jsx("ul",{className:"react-autocomplete-input",style:{...se,top:O+P,width:B},children:J})},{Component:j,ComponentProps:H,defaultValue:W,disabled:te,onBlur:a,value:l,...C}=e,g=Object.assign({},C);return Object.keys(e).forEach(S=>{delete g[S]}),o.jsxs(o.Fragment,{children:[c.cloneElement(j,{disabled:te,onBlur:a,onChange:M,onKeyDown:T,ref:h,value:n,...g,...H}),V()]})},ao={Component:o.jsx("textarea",{}),ComponentProps:{},defaultValue:void 0,disabled:!1,maxOptions:6,onBlur:e=>{},onChange:e=>{},onKeyDown:e=>{},onRequestOptions:e=>{},onSelect:e=>{},changeOnSelect:(e,n)=>`${e}${n}`,options:[],regex:"^[A-Za-z0-9\\-_]+$",matchAny:!1,minChars:0,requestOnlyIfNoOptions:!0,spaceRemovers:[",",".","!","?"],spacer:" ",trigger:"@",offsetX:0,offsetY:0,value:void 0,passThroughEnter:!1,mode:"assist",direction:"ltr"},lo=e=>{let n={...ao,...e};return e.mode==="autocomplete"&&(n={...n,trigger:"",regex:".",spacer:""}),o.jsx(so,{...n})},Ue={formatFileModDate:(e,n)=>{const t=K.FileHelper.getModDate(n);return t?e.formatDate(t,{dateStyle:"short",timeStyle:"short"}):null},formatFileSize:(e,n)=>{if(!n||typeof n.size!="number")return null;const t=n.size,r=qn(t,{bits:!1,output:"object"});return r.symbol==="B"?`${Math.round(r.value/10)/100} KB`:r.symbol==="KB"?`${Math.round(r.value)} ${r.symbol}`:`${r.value} ${r.symbol.toUpperCase()}`}},co={locale:fe.EN,formatters:{...Ue}},uo={locale:fe.RU,formatters:{...Ue},messages:{"chonky.toolbar.searchPlaceholder":"Поиск","chonky.toolbar.visibleFileCount":`{fileCount, plural,
11
22
  one {# файл}
12
23
  few {# файла}
13
24
  other {# файлов}
@@ -19,7 +30,7 @@
19
30
  =0 {}
20
31
  one {# скрыт}
21
32
  other {# скрыто}
22
- }`,"chonky.fileList.nothingToShow":"Здесь пусто!","chonky.contextMenu.browserMenuShortcut":"Меню браузера: {shortcut}",["chonky.actionGroups.Actions"]:"Действия",["chonky.actionGroups.Options"]:"Опции",[`chonky.actions.${F.ChonkyActions.OpenParentFolder.id}.button.name`]:"Открыть родительскую папку",[`chonky.actions.${F.ChonkyActions.CreateFolder.id}.button.name`]:"Новая папка",[`chonky.actions.${F.ChonkyActions.CreateFolder.id}.button.tooltip`]:"Создать новую папку",[`chonky.actions.${F.ChonkyActions.DeleteFiles.id}.button.name`]:"Удалить файлы",[`chonky.actions.${F.ChonkyActions.OpenSelection.id}.button.name`]:"Открыть выделение",[`chonky.actions.${F.ChonkyActions.SelectAllFiles.id}.button.name`]:"Выделить все",[`chonky.actions.${F.ChonkyActions.ClearSelection.id}.button.name`]:"Сбросить выделение",[`chonky.actions.${F.ChonkyActions.EnableListView.id}.button.name`]:"Показать список",[`chonky.actions.${F.ChonkyActions.EnableGridView.id}.button.name`]:"Показать иконки",[`chonky.actions.${F.ChonkyActions.SortFilesByName.id}.button.name`]:"Сорт. по имени",[`chonky.actions.${F.ChonkyActions.SortFilesBySize.id}.button.name`]:"Сорт. по размеру",[`chonky.actions.${F.ChonkyActions.SortFilesByDate.id}.button.name`]:"Сорт. по дате",[`chonky.actions.${F.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"Скрытые файлы",[`chonky.actions.${F.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"Папки в начале"}},Ur={locale:ue.HE,formatters:{...We},messages:{"chonky.toolbar.searchPlaceholder":"חיפוש","chonky.toolbar.visibleFileCount":`{fileCount, plural,
33
+ }`,"chonky.fileList.nothingToShow":"Здесь пусто!","chonky.contextMenu.browserMenuShortcut":"Меню браузера: {shortcut}",["chonky.actionGroups.Actions"]:"Действия",["chonky.actionGroups.Options"]:"Опции",[`chonky.actions.${K.ChonkyActions.OpenParentFolder.id}.button.name`]:"Открыть родительскую папку",[`chonky.actions.${K.ChonkyActions.CreateFolder.id}.button.name`]:"Новая папка",[`chonky.actions.${K.ChonkyActions.CreateFolder.id}.button.tooltip`]:"Создать новую папку",[`chonky.actions.${K.ChonkyActions.DeleteFiles.id}.button.name`]:"Удалить файлы",[`chonky.actions.${K.ChonkyActions.OpenSelection.id}.button.name`]:"Открыть выделение",[`chonky.actions.${K.ChonkyActions.SelectAllFiles.id}.button.name`]:"Выделить все",[`chonky.actions.${K.ChonkyActions.ClearSelection.id}.button.name`]:"Сбросить выделение",[`chonky.actions.${K.ChonkyActions.EnableListView.id}.button.name`]:"Показать список",[`chonky.actions.${K.ChonkyActions.EnableGridView.id}.button.name`]:"Показать иконки",[`chonky.actions.${K.ChonkyActions.SortFilesByName.id}.button.name`]:"Сорт. по имени",[`chonky.actions.${K.ChonkyActions.SortFilesBySize.id}.button.name`]:"Сорт. по размеру",[`chonky.actions.${K.ChonkyActions.SortFilesByDate.id}.button.name`]:"Сорт. по дате",[`chonky.actions.${K.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"Скрытые файлы",[`chonky.actions.${K.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"Папки в начале"}},ho={locale:fe.HE,formatters:{...Ue},messages:{"chonky.toolbar.searchPlaceholder":"חיפוש","chonky.toolbar.visibleFileCount":`{fileCount, plural,
23
34
  one {פריט #}
24
35
  other {# פריטים}
25
36
  }`,"chonky.toolbar.selectedFileCount":`{fileCount, plural,
@@ -30,4 +41,4 @@
30
41
  =0 {}
31
42
  one {# נסתר}
32
43
  other {# נסתרים}
33
- }`,"chonky.fileList.nothingToShow":"ריק","chonky.contextMenu.browserMenuShortcut":"תפריט דפדפן: {shortcut}",["chonky.actionGroups.Actions"]:"פעולות",["chonky.actionGroups.Options"]:"אפשרויות",[`chonky.actions.${F.ChonkyActions.OpenParentFolder.id}.button.name`]:"פתח סיפריית אב",[`chonky.actions.${F.ChonkyActions.CreateFolder.id}.button.name`]:"סיפרייה חדשה",[`chonky.actions.${F.ChonkyActions.CreateFolder.id}.button.tooltip`]:"צור סיפרייה חדשה",[`chonky.actions.${F.ChonkyActions.DeleteFiles.id}.button.name`]:"מחק",[`chonky.actions.${F.ChonkyActions.OpenSelection.id}.button.name`]:"פתח את הבחירה",[`chonky.actions.${F.ChonkyActions.SelectAllFiles.id}.button.name`]:"בחר הכל",[`chonky.actions.${F.ChonkyActions.ClearSelection.id}.button.name`]:"אפס את הבחירה",[`chonky.actions.${F.ChonkyActions.EnableListView.id}.button.name`]:"תצוגת רשימה",[`chonky.actions.${F.ChonkyActions.EnableGridView.id}.button.name`]:"תצוגת גריד",[`chonky.actions.${F.ChonkyActions.SortFilesByName.id}.button.name`]:"מיון לפי שם",[`chonky.actions.${F.ChonkyActions.SortFilesBySize.id}.button.name`]:"מיון לפי גודל",[`chonky.actions.${F.ChonkyActions.SortFilesByDate.id}.button.name`]:"מיון לפי תאריך",[`chonky.actions.${F.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"קבצים נסתרים",[`chonky.actions.${F.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"הצגת תיקיות בראש הרשימה"}},jr={[ue.EN]:$r,[ue.RU]:qr,[ue.HE]:Ur},So="";class Kr extends F.FileHelper{}const Yr=F.ChonkyActions,gn={listView:F.ChonkyActions.EnableListView.id,gridView:F.ChonkyActions.EnableGridView.id};F.setChonkyDefaults({iconComponent:Bn.ChonkyIconFA});const Xr=c.memo(c.forwardRef(({theme:e,styles:n={height:"100%",minWidth:"600px"},defaultView:t=gn.listView,readOnlyMode:i=!1,locale:s,files:r,folderChain:u,onFileAction:g,...f},m)=>{const C=c.useCallback(U=>null,[]);ve.makeStyles({"@global":{".chonky-dropdownList":{backgroundColor:`${e==null?void 0:e.surface} !important`},'li[class*="chonky-activeButton"]':{color:`${e==null?void 0:e.primary} !important`}}})();const M=U=>U.replace(/([A-Z])/g,oe=>"-"+oe.toLowerCase()),b=c.useMemo(()=>e!==void 0?Object.keys(e).reduce((oe,a)=>{const l=e[a];return a=a.startsWith("--")?a:`--fp-theme-${M(a)}`,oe[a]=l,oe},{}):{},[e]),[A,x]=c.useState(!1),[W,Q]=c.useState(),[G,Y]=c.useState(!1),[X,k]=c.useState(),[q,N]=c.useState();return c.useEffect(()=>{e&&x(!0),Q(t),i?Y(!0):k([F.ChonkyActions.CreateFolder,F.ChonkyActions.DeleteFiles]),s!==void 0&&N(jr[s])},[e,t,i,s]),o.jsx(ce,{style:{...n,...b},children:o.jsx(F.FullFileBrowser,{ref:m,files:r??[],folderChain:u,onFileAction:U=>{typeof g=="function"&&g(U)},thumbnailGenerator:C,defaultFileViewActionId:W,disableDragAndDrop:G,fileActions:X,darkMode:A,i18n:q,...f})})})),Zr=e=>o.jsx(ut.components.Option,{...e,children:o.jsx(V.Checkbox,{label:e.label,checked:e.isSelected})}),Jr=e=>{const{styles:n}=e;return o.jsx(ut,{isMulti:!0,components:{Option:Zr},styles:n,isClearable:!0,hideSelectedOptions:!1,closeMenuOnSelect:!1,...e})},Qr=e=>{const{values:n,options:t,onChange:i,placeholder:s,styles:r}=e,u=V.useTheme(),g=ke(u),[f,m]=c.useState(n),C=M=>{m(M),i&&i(M)};return o.jsx(K.ThemeProvider,{theme:g,children:o.jsx(K.Input,{multiline:!0,fullWidth:!0,disableUnderline:!0,inputComponent:Jr,value:f,onChange:C,placeholder:s,id:"react-select-single",inputProps:{styles:r,options:t}})})};d.useMediaQuery=yn,Object.defineProperty(d,"CesiumMath",{enumerable:!0,get:()=>S.Math}),Object.defineProperty(d,"cesiumSampleTerrainMostDetailed",{enumerable:!0,get:()=>S.sampleTerrainMostDetailed}),d.Autocomplete=Wr,d.BboxCorner=De,d.Box=ce,d.COORDINATES_MERCATOR_FRACTION_DIGITS=Be,d.COORDINATES_WGS_FRACTION_DIGITS=Ne,d.Cesium3DTileset=yr,d.CesiumBoundingSphere=Vi,d.CesiumCartesian2=Bi,d.CesiumCartesian3=Fi,d.CesiumCartographic=Gt,d.CesiumCesiumTerrainProvider=qi,d.CesiumColor=_r,d.CesiumConstantPositionProperty=Ni,d.CesiumConstantProperty=xi,d.CesiumCustomDataSource=ln,d.CesiumDrawingsDataSource=Pr,d.CesiumEllipsoid=Hi,d.CesiumEllipsoidTerrainProvider=$i,d.CesiumEntity=rn,d.CesiumEntityDescription=Sr,d.CesiumEntityStaticDescription=on,d.CesiumGeographicTilingScheme=Gi,d.CesiumGeojsonLayer=vr,d.CesiumHorizontalOrigin=ji,d.CesiumImageryLayer=Pe,d.CesiumLabelStyle=Ki,d.CesiumMap=fr,d.CesiumOSMLayer=wr,d.CesiumPolygonGraphics=sn,d.CesiumPolylineDashMaterialProperty=ki,d.CesiumRectangle=zi,d.CesiumRectangleGraphics=an,d.CesiumResource=Wi,d.CesiumSceneMode=ie,d.CesiumVerticalOrigin=Ui,d.CesiumViewer=gr,d.CesiumWMSLayer=Er,d.CesiumWMTSLayer=Cr,d.CesiumXYZLayer=Tr,d.CoordinatesTrackerTool=zt,d.CssBaseline=Ii,d.DateRangePicker=Un,d.DateTimePicker=jn,d.DateTimeRangePicker=ft,d.DateTimeRangePickerFormControl=zn,d.DrawHelper=Ee,d.DrawInteraction=At,d.DrawType=ae,d.FileHelper=Kr,d.FilePicker=Xr,d.FilePickerActions=Yr,d.FilePickerViewObj=gn,d.GeoJSONFeature=It,d.InspectorTool=Ir,d.Legend=Si,d.MVTSource=wi,d.Map=Ct,d.MapFilterContainer=si,d.MultiSelection=Qr,d.Popover=mt,d.Proj=pe,d.ScaleTrackerTool=Wt,d.ScopedCssBaseline=Oi,d.SmartTable=Pi,d.SupportedLocales=ue,d.TerrainianHeightTool=Ar,d.TileLayer=wt,d.TileOsm=Ot,d.TileWMS=mi,d.TileWMTS=pi,d.TileXYZ=vi,d.TimeRangeInput=Wn,d.VectorLayer=Lt,d.VectorSource=Pt,d.VectorTileLayer=li,d.ZoomLevelTrackerTool=qt,d.defaultFormatters=We,d.getMVTOptions=Ti,d.getWMSOptions=fi,d.getWMTSOptions=gi,d.getXYZOptions=yi,d.isDateRange=xe,d.mapMcToMuiTheme=pt,d.polygonToGeoJSON=cn,d.rectangleToGeoJSON=dn,d.rectangleToPositions=un,d.useCesiumMap=re,d.useMap=Te,d.useMappedMuiTheme=ke,d.useTileLayer=_e,d.useVectorLayer=bt,d.useVectorSource=_t,d.useVectorTileLayer=Bt,d.useVectorTileSource=Ci,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
44
+ }`,"chonky.fileList.nothingToShow":"ריק","chonky.contextMenu.browserMenuShortcut":"תפריט דפדפן: {shortcut}",["chonky.actionGroups.Actions"]:"פעולות",["chonky.actionGroups.Options"]:"אפשרויות",[`chonky.actions.${K.ChonkyActions.OpenParentFolder.id}.button.name`]:"פתח סיפריית אב",[`chonky.actions.${K.ChonkyActions.CreateFolder.id}.button.name`]:"סיפרייה חדשה",[`chonky.actions.${K.ChonkyActions.CreateFolder.id}.button.tooltip`]:"צור סיפרייה חדשה",[`chonky.actions.${K.ChonkyActions.DeleteFiles.id}.button.name`]:"מחק",[`chonky.actions.${K.ChonkyActions.OpenSelection.id}.button.name`]:"פתח את הבחירה",[`chonky.actions.${K.ChonkyActions.SelectAllFiles.id}.button.name`]:"בחר הכל",[`chonky.actions.${K.ChonkyActions.ClearSelection.id}.button.name`]:"אפס את הבחירה",[`chonky.actions.${K.ChonkyActions.EnableListView.id}.button.name`]:"תצוגת רשימה",[`chonky.actions.${K.ChonkyActions.EnableGridView.id}.button.name`]:"תצוגת גריד",[`chonky.actions.${K.ChonkyActions.SortFilesByName.id}.button.name`]:"מיון לפי שם",[`chonky.actions.${K.ChonkyActions.SortFilesBySize.id}.button.name`]:"מיון לפי גודל",[`chonky.actions.${K.ChonkyActions.SortFilesByDate.id}.button.name`]:"מיון לפי תאריך",[`chonky.actions.${K.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"קבצים נסתרים",[`chonky.actions.${K.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"הצגת תיקיות בראש הרשימה"}},go={[fe.EN]:co,[fe.RU]:uo,[fe.HE]:ho},qo="";class po extends K.FileHelper{}const fo=K.ChonkyActions,wn={listView:K.ChonkyActions.EnableListView.id,gridView:K.ChonkyActions.EnableGridView.id};K.setChonkyDefaults({iconComponent:Un.ChonkyIconFA});const mo=c.memo(c.forwardRef(({theme:e,styles:n={height:"100%",minWidth:"600px"},defaultView:t=wn.listView,readOnlyMode:r=!1,locale:s,files:i,folderChain:u,onFileAction:h,...f},m)=>{const v=c.useCallback(W=>null,[]);Se.makeStyles({"@global":{".chonky-dropdownList":{backgroundColor:`${e==null?void 0:e.surface} !important`},'li[class*="chonky-activeButton"]':{color:`${e==null?void 0:e.primary} !important`}}})();const M=W=>W.replace(/([A-Z])/g,te=>"-"+te.toLowerCase()),b=c.useMemo(()=>e!==void 0?Object.keys(e).reduce((te,a)=>{const l=e[a];return a=a.startsWith("--")?a:`--fp-theme-${M(a)}`,te[a]=l,te},{}):{},[e]),[T,G]=c.useState(!1),[z,Z]=c.useState(),[$,X]=c.useState(!1),[Y,V]=c.useState(),[j,H]=c.useState();return c.useEffect(()=>{e&&G(!0),Z(t),r?X(!0):V([K.ChonkyActions.CreateFolder,K.ChonkyActions.DeleteFiles]),s!==void 0&&H(go[s])},[e,t,r,s]),o.jsx(oe,{style:{...n,...b},children:o.jsx(K.FullFileBrowser,{ref:m,files:i??[],folderChain:u,onFileAction:W=>{typeof h=="function"&&h(W)},thumbnailGenerator:v,defaultFileViewActionId:z,disableDragAndDrop:$,fileActions:Y,darkMode:T,i18n:j,...f})})})),yo=e=>o.jsx(St.components.Option,{...e,children:o.jsx(U.Checkbox,{label:e.label,checked:e.isSelected})}),vo=e=>{const{styles:n}=e;return o.jsx(St,{isMulti:!0,components:{Option:yo},styles:n,isClearable:!0,hideSelectedOptions:!1,closeMenuOnSelect:!1,...e})},Eo=e=>{const{values:n,options:t,onChange:r,placeholder:s,styles:i}=e,u=U.useTheme(),h=xe(u),[f,m]=c.useState(n),v=M=>{m(M),r&&r(M)};return o.jsx(Q.ThemeProvider,{theme:h,children:o.jsx(Q.Input,{multiline:!0,fullWidth:!0,disableUnderline:!0,inputComponent:vo,value:f,onChange:v,placeholder:s,id:"react-select-single",inputProps:{styles:i,options:t}})})};d.useMediaQuery=bn,Object.defineProperty(d,"CesiumCesiumEntity",{enumerable:!0,get:()=>p.Entity}),Object.defineProperty(d,"CesiumCesiumPolygonGraphics",{enumerable:!0,get:()=>p.PolygonGraphics}),Object.defineProperty(d,"CesiumGeoJsonDataSource",{enumerable:!0,get:()=>p.GeoJsonDataSource}),Object.defineProperty(d,"CesiumMath",{enumerable:!0,get:()=>p.Math}),Object.defineProperty(d,"cesiumSampleTerrainMostDetailed",{enumerable:!0,get:()=>p.sampleTerrainMostDetailed}),d.Autocomplete=lo,d.BboxCorner=Ne,d.Box=oe,d.COORDINATES_MERCATOR_FRACTION_DIGITS=Ve,d.COORDINATES_WGS_FRACTION_DIGITS=Fe,d.Cesium3DTileset=Bi,d.CesiumBoundingSphere=qr,d.CesiumCartesian2=$r,d.CesiumCartesian3=Ur,d.CesiumCartographic=Kt,d.CesiumCesiumBillboardGraphics=ti,d.CesiumCesiumPolylineGraphics=Qr,d.CesiumCesiumTerrainProvider=Jr,d.CesiumColor=Ki,d.CesiumConstantPositionProperty=zr,d.CesiumConstantProperty=Wr,d.CesiumCustomDataSource=yn,d.CesiumDrawingsDataSource=Yi,d.CesiumEllipsoid=jr,d.CesiumEllipsoidTerrainProvider=Xr,d.CesiumEntity=gn,d.CesiumEntityDescription=$i,d.CesiumEntityStaticDescription=pn,d.CesiumGeographicTilingScheme=Kr,d.CesiumGeojsonLayer=Fi,d.CesiumHeightReference=oi,d.CesiumHorizontalOrigin=ri,d.CesiumImageryLayer=Pe,d.CesiumJulianDate=Rr,d.CesiumLabelStyle=ii,d.CesiumMap=Ni,d.CesiumOSMLayer=Wi,d.CesiumPolygonGraphics=fn,d.CesiumPolylineDashMaterialProperty=Hr,d.CesiumPositionProperty=ei,d.CesiumRectangle=Yr,d.CesiumRectangleGraphics=mn,d.CesiumResource=Zr,d.CesiumSceneMode=ue,d.CesiumVerticalOrigin=ni,d.CesiumViewer=Ai,d.CesiumWFSLayer=zi,d.CesiumWMSLayer=Vi,d.CesiumWMTSLayer=Gi,d.CesiumXYZLayer=Hi,d.CoordinatesTrackerTool=Xt,d.CssBaseline=Fr,d.DateRangePicker=Rn,d.DateTimePicker=er,d.DateTimeRangePicker=Lt,d.DateTimeRangePickerFormControl=Zn,d.DrawHelper=we,d.DrawInteraction=Ht,d.DrawType=he,d.FileHelper=po,d.FilePicker=mo,d.FilePickerActions=fo,d.FilePickerViewObj=wn,d.GeoJSONFeature=Vt,d.InspectorTool=Zi,d.Legend=Or,d.MVTSource=Ir,d.Map=Dt,d.MapFilterContainer=pr,d.MultiSelection=Eo,d.Popover=bt,d.Proj=ye,d.ScaleTrackerTool=Jt,d.ScopedCssBaseline=Vr,d.SmartTable=Br,d.SupportedLocales=fe,d.TerrainianHeightTool=Ji,d.TileLayer=Ot,d.TileOsm=Gt,d.TileWMS=Lr,d.TileWMTS=wr,d.TileXYZ=Mr,d.TimeRangeInput=Xn,d.VectorLayer=Nt,d.VectorSource=Ft,d.VectorTileLayer=mr,d.ZoomLevelTrackerTool=Rt,d.defaultFormatters=Ue,d.getMVTOptions=Dr,d.getWMSOptions=Cr,d.getWMTSOptions=Tr,d.getXYZOptions=br,d.isDateRange=Be,d.mapMcToMuiTheme=Ct,d.polygonToGeoJSON=vn,d.rectangleToGeoJSON=En,d.rectangleToPositions=Sn,d.useCesiumMap=le,d.useMap=Ce,d.useMappedMuiTheme=xe,d.useTileLayer=_e,d.useVectorLayer=kt,d.useVectorSource=Bt,d.useVectorTileLayer=qt,d.useVectorTileSource=Pr,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});