@map-colonies/react-components 4.13.5 → 4.14.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,34 +1,34 @@
1
- (function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@date-io/date-fns"),require("@material-ui/pickers"),require("@material-ui/core"),require("@material-ui/core/styles"),require("@map-colonies/react-core"),require("@material-ui/core/useMediaQuery"),require("react-datepicker"),require("date-fns/locale/he"),require("moment"),require("@turf/rewind"),require("ol"),require("ol/ol.css"),require("ol/coordinate"),require("ol/control"),require("ol/control/MousePosition"),require("ol/proj"),require("ol/layer"),require("ol/source"),require("ol/format"),require("ol/interaction"),require("ol/interaction/Draw"),require("ol/layer/VectorTile"),require("ol/style"),require("ol/tilegrid/WMTS"),require("ol/extent"),require("ol/source/TileWMS"),require("ol/source/XYZ"),require("ol/source/VectorTile"),require("ol-ext/legend/Legend"),require("ol-ext/control/Legend"),require("ol-ext/dist/ol-ext.css"),require("@material-ui/core/TableHead"),require("@material-ui/core/utils"),require("@material-ui/core/CssBaseline"),require("@material-ui/core/ScopedCssBaseline"),require("react-dom"),require("resium"),require("cesium"),require("lodash"),require("@turf/bbox"),require("@turf/invariant"),require("@turf/area"),require("@turf/bbox-polygon"),require("@turf/centroid"),require("@turf/helpers"),require("@turf/intersect"),require("@turf/point-to-polygon-distance"),require("@map-colonies/react-core/dist/list/styles"),require("@map-colonies/react-core/dist/textfield/styles"),require("@turf/boolean-point-in-polygon"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("@map-colonies/react-core/dist/checkbox/styles"),require("p-map"),require("uuid"),require("@turf/boolean-valid"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select"),require("react-circular-progressbar"),require("react-circular-progressbar/dist/styles.css"),require("react-move")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@date-io/date-fns","@material-ui/pickers","@material-ui/core","@material-ui/core/styles","@map-colonies/react-core","@material-ui/core/useMediaQuery","react-datepicker","date-fns/locale/he","moment","@turf/rewind","ol","ol/ol.css","ol/coordinate","ol/control","ol/control/MousePosition","ol/proj","ol/layer","ol/source","ol/format","ol/interaction","ol/interaction/Draw","ol/layer/VectorTile","ol/style","ol/tilegrid/WMTS","ol/extent","ol/source/TileWMS","ol/source/XYZ","ol/source/VectorTile","ol-ext/legend/Legend","ol-ext/control/Legend","ol-ext/dist/ol-ext.css","@material-ui/core/TableHead","@material-ui/core/utils","@material-ui/core/CssBaseline","@material-ui/core/ScopedCssBaseline","react-dom","resium","cesium","lodash","@turf/bbox","@turf/invariant","@turf/area","@turf/bbox-polygon","@turf/centroid","@turf/helpers","@turf/intersect","@turf/point-to-polygon-distance","@map-colonies/react-core/dist/list/styles","@map-colonies/react-core/dist/textfield/styles","@turf/boolean-point-in-polygon","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","@map-colonies/react-core/dist/checkbox/styles","p-map","uuid","@turf/boolean-valid","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select","react-circular-progressbar","react-circular-progressbar/dist/styles.css","react-move"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.reactComponents={},u.jsxRuntime,u.React,u.dateFns,u.locale,u.DateFnsUtils,u.pickers,u.core,u.styles,u.reactCore,u.useMediaQuery,u.DatePicker,u.datePickerHebrewLocale,u.moment,u.rewind,u.ol,null,u.coordinate,u.control,u.MousePosition,u.proj,u.layer,u.source,u.format,u.interaction,u.Draw,u.VectorTile,u.style,u.WMTSTileGrid,u.extent,u.OlTileWMS,u.OlXYZ,u.VectorTileSource,u.OlExtLegend,u.OlExtLegendCtrl,null,u.TableHead,u.utils,u.CssBaseline,u.ScopedCssBaseline,u.ReactDOM,u.resium,u.Cesium,u.lodash,u.bbox,u.invariant,u.area,u.bboxPolygon,u.centroid,u.turf,u.intersect,u.pointToPolygonDistance,null,null,u.booleanPointInPolygon,u.viewerCesiumNavigationMixin,null,null,null,u.pMap,u.uuid,u.booleanValid,u.getCaretCoordinates,u.getInputSelection,u.chonky,u.chonkyIconFontawesome,u.filesize,u.Select,u.reactCircularProgressbar,null,u.reactMove))})(this,function(u,i,a,Le,Ue,bt,Ne,ae,Oe,J,Jn,Ct,Kn,Be,Qn,Mt,ss,_t,at,lt,Pt,It,ct,dt,Rn,er,tr,$e,nr,At,rr,ir,or,Dt,sr,as,ar,Ot,lr,cr,ut,Me,g,$,qe,dr,kt,je,ur,xt,Nt,hr,ls,cs,gr,pr,ds,us,hs,ht,Bt,fr,mr,Ft,re,yr,vr,Gt,Ye,gs,Er){"use strict";var is=Object.defineProperty;var os=(u,i,a)=>i in u?is(u,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[i]=a;var ue=(u,i,a)=>(os(u,typeof i!="symbol"?i+"":i,a),a);function gt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Vt=gt(a),M=gt(g),Ht=gt(xt),Q=e=>{const{children:t,...n}=e;return i.jsx(ae.Box,{...n,children:t})};var we=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(we||{}),Se=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(Se||{}),Ze=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Ze||{});const he={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:Se.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:Se.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Xe=e=>{const t=e.type==="dark";return a.useMemo(()=>Wt(e,t),[t,e])},Wt=(e,t=!1)=>Oe.createTheme({palette:{type:t?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:t?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:t?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zt=e=>a.useMemo(()=>({...e,"cesium-color":"#EDFFFF","cesium-error":e["--mdc-theme-gc-error-medium"]??"#FF3636","cesium-warning":e["--mdc-theme-gc-warning-high"]??"#FFA032","cesium-checkbox-color":"#1A73E8","cesium-checkbox-width":"12px","cesium-checkbox-height":"12px","cesium-font-size":"10pt"}),[e]),ps="",wr=2,Tr=.5,Lr=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(wr),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Tr)}})),Ut=e=>{var X,W,Z,ee;const t=Lr(),n=J.useTheme(),r=Xe(n),[s,o]=a.useState(null),[d,h]=a.useState(null),[f,E]=a.useState(he.DATE_RANGE_PICKER.dateFormat),C=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,b=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,p=((X=e.local)==null?void 0:X.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,v=((W=e.local)==null?void 0:W.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,I=((Z=e.local)==null?void 0:Z.setText)??he.DATE_RANGE_PICKER.local.setText,T=((ee=e.local)==null?void 0:ee.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,F=e.showTime??he.DATE_RANGE_PICKER.showTime,V=T===Se.HE?Ue.he:Ue.enUS;a.useEffect(()=>{o(e.from??null)},[e.from]),a.useEffect(()=>{h(e.to??null)},[e.to]),a.useEffect(()=>{E(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const j=Boolean(Le.isValid(s)&&!d||Le.isValid(d)&&!s||s&&d&&Le.isValid(s)&&Le.isValid(d)&&Le.isBefore(s,d)),Y=()=>{e.onChange({from:s&&Le.isValid(s)?s:void 0,to:d&&Le.isValid(d)?d:void 0})},G=F?Ne.KeyboardDateTimePicker:Ne.KeyboardDatePicker;return i.jsx(ae.ThemeProvider,{theme:r,children:i.jsx(Q,{className:`${t.container} drpContainer`,display:"flex",flexDirection:C,width:C==="column"?e.contentWidth:"unset",children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:V,children:[i.jsx(G,{variant:"inline",placeholder:p,onChange:l=>o(l),value:s,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(G,{variant:"inline",placeholder:v,className:t.margin,onChange:l=>h(l),value:d,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(J.ThemeProvider,{options:n,children:i.jsx(J.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:Y,disabled:!j,children:I})})]})})})},$t=e=>{const{children:t,...n}=e;return i.jsx(ae.Popover,{...n,children:t})},fs="",Sr=e=>{var G,X;const[t,n]=a.useState(null),[r,s]=a.useState(null),[o,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[h,f]=a.useState(null),E=W=>{f(W.currentTarget)},C=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},b=()=>{f(null)},p=Boolean(h),v=e.controlsLayout??"column";a.useEffect(()=>{n(e.from??null)},[e.from]),a.useEffect(()=>{s(e.to??null)},[e.to]),a.useEffect(()=>{d(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const I=((G=e.local)==null?void 0:G.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,T=((X=e.local)==null?void 0:X.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,F=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,V=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,j=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,Y=a.useMemo(()=>`${t?Le.format(t,o):I} - ${r?Le.format(r,o):T}`,[t,r,o,I,T]);return i.jsxs(i.Fragment,{children:[F?i.jsx(J.Button,{style:{width:e.width},raised:!0,onClick:E,className:"drpOpener",children:Y}):i.jsx(J.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:Y,onClick:C,trailingIcon:{icon:"date_range",tabIndex:0,onClick:C}}),i.jsx($t,{open:p,anchorEl:h,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(Ut,{controlsLayout:v,contentWidth:((h==null?void 0:h.clientWidth)??0)-V,dateFormat:o,disableFuture:j,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{n(W??null),s(Z??null),e.onChange({from:W,to:Z}),b()}})})]})},Je=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,br=({endDate:e,startDate:t,setEndDate:n=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:o="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:h="",startTimeInputClassName:f="",startTimeLabel:E="",startTimeWrapperClassName:C=""})=>i.jsxs("div",{className:`timeRangeWrapper ${h}`,children:[i.jsx("div",{className:`startTimeWrapper ${C}`,children:i.jsx(J.TextField,{label:E,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Be(t).format("HH:mm"),onChange:b=>{const p=Be(t),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});r(I.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(J.TextField,{label:o,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Be(e).format("HH:mm"),onChange:b=>{const p=Be(e),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});n(I.toDate())}})})]}),Cr=a.forwardRef(({value:e,onClick:t,onInputClick:n,...r},s)=>i.jsx(J.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:o=>{t==null||t(o),n==null||n()},ref:s,value:e})),Mr=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:n,dateRange:r,onShortcut:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>n.map(f=>f instanceof Function?f():f),[n]);return a.useEffect(()=>{for(const f of h){const E=r.startDate&&r.endDate&&Le.isSameDay(f.startDate,r.startDate)&&Le.isSameDay(f.endDate,r.endDate);o?f.id===o&&(E||d(void 0)):E&&d(f.id)}},[r,o,h]),i.jsx("div",{className:"shortcutsContainer",children:h.map((f,E)=>{const C=()=>{e(f.startDate),t(f.endDate)};return i.jsx(J.Button,{type:"button",className:`shortcut ${o===f.id?"selected":""}`,onClick:b=>{C(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+E)})})},_r=a.forwardRef((e,t)=>{const{calendarClassName:n,dayClassName:r,monthClassName:s,selectsRange:o,onChange:d,inputName:h,showMonthYearDropdown:f,withShortcuts:E,locale:C="en"}=e,[b,p]=a.useState(null),[v,I]=a.useState(null),[T,F]=a.useState(!1),V=o?{startDate:b,endDate:v}:b;a.useEffect(()=>{C==="he"&&Ct.registerLocale("he",Kn)},[C]),a.useEffect(()=>{var G,X;((G=e.startDate)==null?void 0:G.toString())!==(b==null?void 0:b.toString())&&p(e.startDate),((X=e.endDate)==null?void 0:X.toString())!==(v==null?void 0:v.toString())&&I(e.endDate)},[e.startDate,e.endDate,b,v]);const j=a.useMemo(()=>{let G="pickerContainer"+(C==="he"?" pickerContainer-rtl":"");return E&&o&&(G+=" pickerContainer-withShortcuts"),G},[C,E,o]),Y=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:j,style:{direction:C==="he"?"rtl":"ltr"},children:i.jsx(Ct,{...e,ref:t,onClickOutside:()=>F(!1),open:T,startDate:Je(V)?b:void 0,selected:b,endDate:Je(V)?v:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${n}`,weekDayClassName:G=>`pickerWeek ${(r==null?void 0:r(G))??""}`,dayClassName:G=>`pickerDay ${(r==null?void 0:r(G))??""}`,monthClassName:G=>`pickerMonth ${(s==null?void 0:s(G))??""}`,onChange:(G,X)=>{if(Array.isArray(G)){const[W,Z]=G;p(W),I(Z),d==null||d({startDate:W,endDate:Z&&Le.endOfDay(Z)},X)}else p(G),d==null||d(G,X)},customInput:i.jsx(Cr,{name:h,onInputClick:()=>{F(!0)}}),showTimeInput:!!(E&&o),timeInputLabel:"",customTimeInput:E&&Je(V)&&i.jsx(Mr,{onShortcut:G=>{d==null||d(G),F(!1)},shortcuts:E,setEndDate:I,setStartDate:p,dateRange:V}),showMonthYearDropdown:void 0,...Y})})}),ms="",Pr=e=>{const t=J.useTheme(),n=Xe(t),{format:r=he.DATE_PICKER.dateFormat,variant:s=he.DATE_PICKER.variant,disableFuture:o=he.DATE_PICKER.disableFuture,local:d,onChange:h,showTime:f=he.DATE_PICKER.showTime,value:E,...C}=e,{placeHolderText:b=he.DATE_PICKER.local.placeHolderText,calendarLocale:p}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:Se.EN},v=p===Se.HE?Ue.he:Ue.enUS,I=T=>{h(T)};return i.jsx(ae.ThemeProvider,{theme:n,children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:v,children:[f&&i.jsx(Ne.KeyboardDateTimePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C}),!f&&i.jsx(Ne.KeyboardDatePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C})]})})},Ir=18,Ar=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(Ir)},fullWidth:{width:"100%",marginTop:"36px"}})),Dr=e=>{const t=Ar(),[n,r]=a.useState(null),{isSelectionEnabled:s,onCancelDraw:o,onStartDraw:d,onReset:h}=e,f=C=>{r(C.currentTarget)},E=()=>{r(null)};return s?i.jsx(J.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:o,children:"Cancel Draw"})}):i.jsxs(Q,{position:"relative",children:[i.jsx(J.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(J.Menu,{className:t.fullWidth,open:Boolean(n),onClose:E,children:[i.jsx(J.MenuItem,{onClick:()=>{d(we.POLYGON),E()},children:"Polygon"}),i.jsx(J.MenuItem,{onClick:()=>{d(we.BOX),E()},children:"Box"}),i.jsx(J.MenuItem,{onClick:()=>{h(),E()},children:"Clear"})]})]})},ys="";var be=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(be||{});const Ke=5,Qe=2,qt=a.createContext(null),Or=qt.Provider,jt=35,Yt=32,kr=10,xr=e=>e!==void 0&&e!==be.WGS84?Pt.transform([jt,Yt],be.WGS84,e):[jt,Yt],Nr=e=>{switch(e){case be.WEB_MERCATOR:return t=>_t.format(t,"Mercator: {y}m, {x}m",Qe);case be.WGS84:return t=>_t.format(t,"WGS84: {y}°N {x}°E",Ke);default:return t=>""}},ke=()=>{const e=a.useContext(qt);if(e===null)throw new Error("map context is null, please check the provider");return e},Zt=e=>{const t=a.useRef(null),{allowFullScreen:n,showMousePosition:r,projection:s}=e,[o]=a.useState(new Mt.Map({view:new Mt.View({projection:s??be.WGS84}),controls:at.defaults()}));a.useEffect(()=>{o.getView().setCenter(e.center??xr(e.projection))},[o,e.center,e.projection]),a.useEffect(()=>{o.getView().setZoom(e.zoom??kr)},[o,e.zoom,e.projection]);const d=(h,f)=>{f.getControls().forEach(C=>{C instanceof h&&f.removeControl(C)})};return a.useEffect(()=>{o.setTarget(t.current),n!==void 0&&n?o.addControl(new at.FullScreen):d(at.FullScreen,o)},[o,n]),a.useEffect(()=>{r!==void 0&&r?(d(lt,o),o.addControl(new lt({coordinateFormat:Nr(s??be.WGS84),projection:s??be.WGS84,undefinedHTML:"&nbsp;"}))):d(lt,o)},[o,r,s]),i.jsxs(Or,{value:o,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Xt=a.createContext(null),Br=Xt.Provider,Ve=()=>{const e=a.useContext(Xt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Jt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Tile(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Br,{value:r,children:t})},Kt=a.createContext(null),Fr=Kt.Provider,Qt=()=>{const e=a.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Rt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Vector(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Fr,{value:r,children:t})},en=a.createContext(null),Gr=en.Provider,tn=()=>{const e=a.useContext(en);if(e===null)throw new Error("vector source context is null, please check the provider");return e},nn=({children:e})=>{const t=Qt(),[n]=a.useState(new ct.Vector);return a.useEffect(()=>{t.setSource(n)},[n,t]),i.jsx(Gr,{value:n,children:e})},rn=({geometry:e,fitOptions:t,fit:n,featureStyle:r})=>{const s=tn(),o=ke();return a.useLayoutEffect(()=>{const h=new dt.GeoJSON().readFeature(e);return n&&s.on("addfeature",function(){o.getView().fit(s.getExtent(),t)}),r&&h.setStyle(r),s.addFeature(h),()=>{s.removeFeature(h)}},[e,s,n]),null},on=e=>{const t=Ve();return a.useEffect(()=>{t.setSource(new ct.OSM)},[t]),null},sn=({drawType:e,onPolygonSelected:t})=>{const n=ke();return a.useEffect(()=>{const r={type:"Circle"};switch(e){case we.BOX:r.geometryFunction=er.createBox();break;case we.POLYGON:r.type="Polygon";break;default:return}const s=new Rn.Draw(r);n.addInteraction(s);const o=d=>{const f=new dt.GeoJSON().writeGeometryObject(d.feature.getGeometry());t==null||t(f)};return s.on("drawend",o),()=>{s.un("drawend",o),n.removeInteraction(s)}},[t,e,n]),null},vs="",Vr=e=>{const t=n=>{const r=Qn(n);e.onPolygonSelection(r)};return i.jsxs(Zt,{allowFullScreen:!0,showMousePosition:!0,children:[i.jsx(Jt,{children:i.jsx(on,{})}),e.selectionPolygon&&i.jsx(Rt,{children:i.jsx(nn,{children:i.jsx(rn,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&i.jsx(sn,{drawType:e.drawType,onPolygonSelected:t})]})},pt=1.5,Hr=80,Wr=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(pt),top:e.spacing(pt)},contentContainer:{marginTop:e.spacing(pt),width:e.spacing(Hr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),zr=e=>{var f;const[t,n]=a.useState(),[r,s]=a.useState(),o=Wr(),d=E=>{s(E),n(void 0),e.handlePolygonSelected(E)},h=()=>{s(void 0),e.handlePolygonReset()};return i.jsxs("div",{className:o.map,children:[i.jsxs("div",{className:`${o.absolute}`,children:[i.jsxs(ae.Paper,{className:o.filtersContainer,children:[i.jsx(Dr,{onCancelDraw:()=>n(void 0),onReset:h,onStartDraw:n,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((E,C)=>i.jsx("div",{className:o.filtersMargin,children:E},C))]}),i.jsx(ae.Paper,{color:"red",className:`${o.contentContainer}`,children:e.children})]}),i.jsx(Vr,{children:e.mapContent,onPolygonSelection:d,drawType:t,selectionPolygon:r})]})},an=new $e.Fill({color:"rgba(255,255,255,0.4)"}),ln=new $e.Stroke({color:"#3399CC",width:1.25}),cn=[new $e.Style({image:new $e.Circle({fill:an,stroke:ln,radius:5}),fill:an,stroke:ln})],dn=a.createContext(null),Ur=dn.Provider,un=()=>{const e=a.useContext(dn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},$r=({children:e,options:t,style:n})=>{const r=ke(),[s]=a.useState(new tr({...t,style:n||cn}));return a.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),a.useEffect(()=>{s.setStyle(n||cn)},[s,n]),i.jsx(Ur,{value:s,children:e})},ft=20,qr=256,jr=2,Yr=2,Zr="REST",Xr=e=>{const t=Pt.get(e.projection),n=t.getExtent(),r=new Array(ft),s=new Array(ft),o=At.getWidth(n)/qr,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Yr,h=e.requestEncoding!==void 0?e.requestEncoding:Zr;for(let E=0;E<ft;++E)r[E]=o/Math.pow(jr,E)/d,s[E]=E.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new nr({origin:At.getTopLeft(n),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:h,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Jr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ct.WMTS(n))},[t,n]),null},Kr=e=>{const{attributions:t,url:n,params:r,serverType:s,transition:o}=e;return{attributions:t,url:n,params:r,serverType:s,transition:o}},Qr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new rr(n))},[t,n]),null},Rr=e=>{const{attributions:t,url:n}=e;return{attributions:t,url:n}},ei=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ir(n))},[t,n]),null},ti=a.createContext(null),ni=()=>{const e=a.useContext(ti);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},ri=e=>{const{url:t}=e;return{url:t,format:new dt.MVT}},ii=({children:e,options:t})=>{const n=un();return a.useEffect(()=>{n.setSource(new or(t))},[t,n]),null},oi=({legendItems:e,title:t,isCollapsed:n})=>{const r=ke();return a.useEffect(()=>{const s=new Dt({title:t??"",margin:5,maxWidth:300}),o=new sr({legend:s,collapsed:n===void 0?!0:n});r.addControl(o);const d=new Dt({margin:4});return e.forEach(h=>{d.addItem({title:h.title,style:h.style,typeGeom:"Polygon"})}),s.addItem(d),()=>{r.removeControl(o)}},[r,e,t,n]),i.jsx(i.Fragment,{})};function si(e){const{headCells:t,order:n,orderBy:r,onRequestSort:s,isCollapseable:o}=e,d=h=>f=>{s(f,h)};return i.jsx(ar,{children:i.jsxs(ae.TableRow,{children:[o&&i.jsx(ae.TableCell,{}),t.map(h=>i.jsx(ae.TableCell,{align:h.numeric?"right":"left",padding:h.disablePadding?"none":"default",sortDirection:r===h.id?n:!1,children:i.jsx(ae.TableSortLabel,{active:r===h.id,direction:r===h.id?n:"asc",onClick:d(h.id),children:h.label})},h.id))]})})}const ai=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),li=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function ci(e){const{cellsMetadata:t,isRowSelected:n,item:r,onRowSelected:s,rowIndex:o,isCollapseable:d,collapsedElement:h}=e,[f,E]=a.useState(!1),C=t.length,b=()=>{s==null||s(o)};return i.jsxs(i.Fragment,{children:[i.jsxs(ae.TableRow,{hover:!0,selected:n,onClick:b,children:[d&&i.jsx(ae.TableCell,{padding:"checkbox",children:i.jsx(ae.IconButton,{"aria-label":"expand row",size:"small",onClick:p=>{p.stopPropagation(),E(!f)},children:f?i.jsx(li,{}):i.jsx(ai,{})})}),t.map(p=>i.jsx(ae.TableCell,{align:p.numeric?"right":"left",padding:p.disablePadding?"none":"default",children:p.transform?p.transform(r[p.id]):r[p.id]},p.id+o.toString()))]}),d&&i.jsx(ae.TableRow,{children:i.jsx(ae.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:C+1,children:i.jsx(ae.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:h==null?void 0:h(r)})})})]})}function di(e){const[t,n]=a.useState(""),[r,s]=a.useState("asc"),{cellsMetadata:o,items:d,onRequestSort:h,onRowSelected:f,isCollapseable:E,collapsedElement:C,isDense:b,page:p,rowsPerPage:v,count:I,handleChangePage:T,handleChangeRowsPerPage:F}=e,V=(j,Y)=>{const G=t===Y&&r==="asc";s(G?"desc":"asc"),n(Y),h(Y,G?"desc":"asc")};return i.jsxs(ae.TableContainer,{component:ae.Paper,children:[i.jsxs(ae.Table,{size:b?"small":"medium",children:[i.jsx(si,{headCells:o,onRequestSort:V,order:r,orderBy:t,isCollapseable:E}),i.jsxs(ae.TableBody,{children:[d.map((j,Y)=>i.jsx(ci,{item:j,rowIndex:Y,isCollapseable:E,cellsMetadata:o,collapsedElement:C,isRowSelected:!1,onRowSelected:f},Y)),(d.length===0||v>d.length)&&i.jsx(ae.TableRow,{style:{height:(b?33:53)*(v-d.length)},children:i.jsx(ae.TableCell,{colSpan:E?o.length+1:o.length,children:d.length===0&&i.jsx(ae.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(ae.TablePagination,{rowsPerPage:v,rowsPerPageOptions:[5,10],component:"div",count:I,page:p,onPageChange:T,onRowsPerPageChange:F})]})}const ui=e=>{const{children:t,...n}=e;return i.jsx(lr,{...n,children:t})},hi=e=>{const{children:t,...n}=e;return i.jsx(cr,{...n,children:t})},hn=e=>e*Math.PI/180,Re=e=>e*(180/Math.PI),gi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hn(85.362/2))/Math.sin(hn(85.362/2))),pi=({title:e,onClick:t})=>i.jsx("div",{className:"cesium-cesiumInspector-button",onClick:t,children:e}),fi=({title:e,isVisible:t,onClick:n,children:r})=>i.jsxs(Q,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(pi,{title:e,onClick:n}),t&&i.jsx(Q,{className:"cesium-cesiumInspector-dropDown",children:r})]}),Es="",mt="Imagery",yt="Data",mi=({locale:e})=>{var b,p;const t=pe(),[n,r]=a.useState([{id:mt,values:[]},{id:yt,values:[]}]),[s,o]=a.useState({}),d=v=>$.get(e,v.toUpperCase())??v,h=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(v,I)=>{var V;const T=t.imageryLayers.get(I),F=T.meta;return{id:F==null?void 0:F.id,name:$.get(F,"layerRecord.productName")??(F==null?void 0:F.id),rect:T.rectangle,isBaseMap:(V=t.layersManager)==null?void 0:V.isBaseMapLayer(F)}}):[],f=()=>{var v;return((v=t.layersManager)==null?void 0:v.dataLayerList.map(I=>{var T,F;return{id:(T=I.meta)==null?void 0:T.id,name:$.get(I.meta,"featureStructure.aliasLayerName")??I.meta.productName,rect:g.Rectangle.fromDegrees(...qe((F=I.meta)==null?void 0:F.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const I=[{id:mt,values:h()},{id:yt,values:f()}];r(I),o(I.reduce((T,F)=>({...T,[F.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===mt?{...T,values:h()}:T))};return t.layersManager.addLayerUpdatedListener(v),t.imageryLayers.layerRemoved.addEventListener(v),()=>{var I;$.get(t,"_cesiumWidget")!==void 0&&((I=t.layersManager)==null||I.removeLayerUpdatedListener(v),t.imageryLayers.layerRemoved.removeEventListener(v))}},[(b=t.layersManager)==null?void 0:b.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===yt?{...T,values:f()}:T))};return t.layersManager.addDataLayerUpdatedListener(v),()=>{var I;(I=t.layersManager)==null||I.removeDataLayerUpdatedListener(v)}},[(p=t.layersManager)==null?void 0:p.dataLayerList]);const E=v=>{o(I=>({...I,[v]:!I[v]}))},C=v=>{t.camera.flyTo({destination:v})};return i.jsx(Q,{className:"activeLayersPanel",children:n.filter(v=>v.values.length>0).map(v=>i.jsxs(Q,{className:`cesium-cesiumInspector-section ${s[v.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>E(v.id),children:[i.jsx(J.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(v.id)}),i.jsx(Q,{className:"cesium-cesiumInspector-sectionContent",children:v.values.map(I=>i.jsxs(Q,{className:"layer",children:[i.jsx(J.Tooltip,{content:I.name,children:i.jsx(Q,{className:`name ${I.isBaseMap?"disabled":""}`,children:I.name})}),i.jsx(Q,{className:"icons",children:i.jsx(J.Tooltip,{content:$.get(e,"FLY_TO")??"Fly To",children:i.jsx(Q,{className:"icon",onClick:T=>{T.stopPropagation(),C(I.rect)},children:i.jsxs("svg",{fill:"var(--mdc-theme-cesium-color)",width:"100%",height:"100%",viewBox:"0 0 256 256",children:[i.jsx("path",{d:"M236,120H223.66406A96.15352,96.15352,0,0,0,136,32.33618V20a8,8,0,0,0-16,0V32.33618A96.15352,96.15352,0,0,0,32.33594,120H20a8,8,0,0,0,0,16H32.33594A96.15352,96.15352,0,0,0,120,223.66382V236a8,8,0,0,0,16,0V223.66382A96.15352,96.15352,0,0,0,223.66406,136H236a8,8,0,0,0,0-16Zm-40,16h11.59912A80.14164,80.14164,0,0,1,136,207.59912V196a8,8,0,0,0-16,0v11.59912A80.14164,80.14164,0,0,1,48.40088,136H60a8,8,0,0,0,0-16H48.40088A80.14164,80.14164,0,0,1,120,48.40088V60a8,8,0,0,0,16,0V48.40088A80.14164,80.14164,0,0,1,207.59912,120H196a8,8,0,0,0,0,16Z"}),i.jsx("polygon",{points:"128,80 80,170 128,150 176,170",fill:"var(--mdc-theme-cesium-color)"})]})})})})]},I.id))})]},v.id))})},yi=({locale:e})=>{const[t,n]=a.useState(!1),r=a.useMemo(()=>$.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(fi,{title:r,isVisible:t,onClick:()=>n(!t),children:i.jsx(mi,{locale:e})})},et=({onClick:e,children:t})=>i.jsx("div",{className:"cesium-toolbar-button cesium-button",onClick:e,children:t}),vt=({title:e})=>i.jsx(Q,{className:"cesium-mc-title",children:e}),Et=({isVisible:e,children:t,title:n})=>i.jsxs(Q,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[n&&i.jsx(vt,{title:n}),t]}),ws="";function wt(e){return function(n){const r=a.useRef(null),[s,o]=a.useState(!1);return a.useEffect(()=>{if(!s)return;const d=h=>{const f=h.target;r.current&&!r.current.contains(f)&&o(!1)};return document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}},[s]),i.jsx("div",{ref:r,className:"disappear",children:i.jsx(e,{...n,isOpen:s,setIsOpen:o})})}}const gn=({item:e,isSelected:t,onClick:n})=>i.jsxs(Q,{className:`cesium-baseLayerPicker-item ${t?"cesium-baseLayerPicker-selectedItem":""}`,title:e.title,onClick:n,children:[i.jsx("img",{className:"cesium-baseLayerPicker-itemIcon",src:e.thumbnail,alt:e.title}),i.jsx(Q,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),vi=({title:e,baseMaps:t,setCurrent:n})=>{const r=pe(),[s,o]=a.useState();a.useEffect(()=>{const h=t.maps.find(f=>f.isCurrent);h&&(o(h),n(h))},[t]);const d=h=>{var E,C;(E=r.layersManager)==null||E.removeBaseMapLayers();const f=t.maps.find(b=>b.id===h);f&&((C=r.layersManager)==null||C.setBaseMapLayers(f),o(f),n(f),t.maps.forEach(b=>{b.isCurrent=f===b}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.maps.map(h=>i.jsx(gn,{item:h,isSelected:s===h,onClick:()=>d(h.id)},h.id))})]})},Ei=({title:e,terrains:t})=>{const[n,r]=a.useState(),s=pe();a.useEffect(()=>{const d=t.find(h=>h.isCurrent);d&&r(d)},[t]);const o=d=>{const h=t.find(f=>f.id===d);h&&(s.terrainProvider=h.terrainProvider??new g.EllipsoidTerrainProvider({}),r(h),t.forEach(f=>{f.isCurrent=h===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(gn,{item:d,isSelected:n===d,onClick:()=>o(d.id)},d.id))})]})},wi=wt(({baseMaps:e,terrains:t,locale:n,isOpen:r,setIsOpen:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>$.get(n,"BASE_MAP_TITLE")??"Base Map",[n]),f=a.useMemo(()=>$.get(n,"TERRAIN_TITLE")??"Terrain",[n]);return i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>s(!r),children:i.jsx("img",{className:"cesium-baseLayerPicker-selected",src:o==null?void 0:o.thumbnail,title:o==null?void 0:o.title,alt:"Current Map"})}),i.jsxs(Et,{isVisible:r,children:[e&&i.jsx(vi,{title:h,baseMaps:e,setCurrent:d}),t&&i.jsx(Ei,{title:f,terrains:t})]})]})}),Ls="",Ti=({featureTypes:e,locale:t})=>{const n=a.useMemo(()=>$.get(t,"WFS_TITLE")??"Data Layers",[t]),r=a.useMemo(()=>$.get(t,"WFS_CACHE")??"Cache",[t]),s=a.useMemo(()=>$.get(t,"WFS_EXTENT")??"Extent",[t]),o=a.useMemo(()=>$.get(t,"NO_DATA_LAYERS")??"No layers found",[t]),d=a.useMemo(()=>i.jsx(Q,{className:"title",children:n}),[n]),h=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,E)=>i.jsxs(Q,{className:"featureType",children:[i.jsx(J.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(Q,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(Q,{className:"info",children:[i.jsxs(Q,{children:[r,": ",f.cache??0]}),f.total>0&&i.jsxs(Q,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},E)):i.jsx(Q,{children:o})}),[e]);return i.jsxs(Q,{className:"wfsContainer",children:[d,h]})},Li=wt(({locale:e,isOpen:t,setIsOpen:n})=>{var h;const[r,s]=a.useState([]),o=a.useMemo(()=>$.get(e,"DEBUG_PANEL_TITLE")??"Debugger Tool",[e]),d=pe();return a.useEffect(()=>{if(!d.layersManager)return;const f=(E,C)=>{var p;E.forEach(v=>{if(C!==void 0&&C!==v.meta.id)return;const{options:I,meta:T}=v,{zoomLevel:F}=I,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W}=T;s(Z=>{const ee=Z.findIndex(l=>l.id===V);if(ee>=0){if(JSON.stringify(Z[ee])!==JSON.stringify({id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F})){const l=[...Z];return l[ee]={id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F},l}}else return[...Z,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F}];return Z})});const b=new Set((p=d.layersManager)==null?void 0:p.dataLayerList.map(v=>v.meta.id));s(v=>v.filter(I=>b.has(I.id)))};return d.layersManager.addDataLayerUpdatedListener(f),()=>{var E;(E=d.layersManager)==null||E.removeDataLayerUpdatedListener(f)}},[(h=d.layersManager)==null?void 0:h.dataLayerList]),i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>n(!t),children:i.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:i.jsx("path",{d:"M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27-7.38 5.74zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16z",fill:"orange"})})}),i.jsx(Et,{isVisible:t,title:o,children:i.jsx(Ti,{featureTypes:r,locale:e})})]})});class Si extends g.PolylineDashMaterialProperty{}class bi extends g.ConstantProperty{}class Ci extends g.ConstantPositionProperty{}class Mi extends g.Cartesian2{}class _i extends g.Cartesian3{}class pn extends g.Cartographic{}class Pi extends g.BoundingSphere{}class Ii extends g.Ellipsoid{}class Ai extends g.GeographicTilingScheme{}class fn extends g.Rectangle{}class Di extends g.Resource{}class Oi extends g.EllipsoidTerrainProvider{}class ki extends g.CesiumTerrainProvider{}class xi extends g.PolylineGraphics{}class Ni extends g.JulianDate{}class Bi extends g.PositionProperty{}class Fi extends g.BillboardGraphics{}class Gi extends g.Color{}class Vi extends g.PolygonHierarchy{}class Hi extends g.Scene{}const Wi=g.VerticalOrigin,zi=g.HorizontalOrigin,tt=g.SceneMode,Ui=g.LabelStyle,$i=g.HeightReference,_e=document.createElement("canvas"),Te=_e.getContext("2d"),mn=e=>{const r=(e==null?void 0:e.data)??[];for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1},qi=async(e,t)=>(t&&t.tileTransparencyCheckedCounter++,new Promise((n,r)=>{try{Te==null||Te.clearRect(0,0,_e.width,_e.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){_e.width=e.width,_e.height=e.height,Te==null||Te.drawImage(e,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height),d=mn(o);d&&t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(d);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{_e.width=s.width,_e.height=s.height,Te==null||Te.drawImage(s,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height);mn(o)?(t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(!0)):n(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,t)=>{const{west:n,east:r,north:s,south:o}=e,{west:d,east:h,north:f,south:E}=t;return n>=d&&r<=h&&s<=f&&o>=E},ji=(e,t)=>hr(e,je(t)),Yi=e=>{const t=(g.Math.toDegrees(e.west)+g.Math.toDegrees(e.east))/2,n=(g.Math.toDegrees(e.south)+g.Math.toDegrees(e.north))/2;return xt.point([t,n])},yn=e=>[g.Math.toDegrees(e.west),g.Math.toDegrees(e.south),g.Math.toDegrees(e.east),g.Math.toDegrees(e.north)],vn=e=>{const t=e.scene;let r=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!g.defined(r)||!r){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const s=new g.Cartesian2(0,0),o=t.camera.pickEllipsoid(s,t.globe.ellipsoid),d=new g.Cartesian2(t.canvas.width,t.canvas.height),h=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(o),E=t.globe.ellipsoid.cartesianToCartographic(h);r=new g.Rectangle(f.longitude,E.latitude,E.longitude,f.latitude)}return r},Zi=(e,t=100)=>{const n=e.scene,r=e.camera,s=n.mode,o=vn(e);if(!g.defined(o)||!o){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(s===g.SceneMode.SCENE2D)return o;const d=r.positionCartographic;if(!g.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const h=d.latitude,f=d.longitude;if(h<-g.Math.PI_OVER_TWO||h>g.Math.PI_OVER_TWO||f<-g.Math.PI||f>g.Math.PI){console.error("Invalid latitude or longitude values.");return}const E=111320,C=111320*Math.cos(h);let b=t/E,p=t/C;const v=g.Cartesian3.magnitude(r.positionWC);v>1e7&&(b=10,p=10);const I=r.frustum instanceof g.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let T=1;v<5e5?T=.05:v<2e6&&(T=.1),b*=T*(I/Math.PI),p*=T*(I/Math.PI);const F=r.pitch;if(F===void 0)return;const V=Math.PI/4,j=Math.max(0,1-Math.abs(F)/V);b*=j,p*=j;const Y=5e-4;b=Math.max(b,Y),p=Math.max(p,Y);const G=d.latitude-b,X=d.latitude+b,W=d.longitude-p,Z=d.longitude+p,ee=g.Math.clamp(G,o.south,o.north),l=g.Math.clamp(X,o.south,o.north),c=g.Math.clamp(W,o.west,o.east),_=g.Math.clamp(Z,o.west,o.east),y=Math.min(1,F/g.Math.PI_OVER_TWO),S=o.north-(o.north-o.south)*y,w=Math.min(l,S);return new g.Rectangle(g.Math.negativePiToPi(c),g.Math.clamp(ee,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO),g.Math.negativePiToPi(_),g.Math.clamp(w,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO))},En=(e,t,n,r,s,o)=>{const d=e.scene.mode===g.SceneMode.SCENE2D,h=p=>{var v;if(p.polygon)return{type:"Polygon",coordinates:[((v=p.polygon.hierarchy)==null?void 0:v.getValue(g.JulianDate.now())).positions.map(F=>{const V=g.Cartographic.fromCartesian(F),j=new g.Cartographic(g.Math.toDegrees(V.longitude),g.Math.toDegrees(V.latitude),d?500:void 0);return[j.longitude,j.latitude,j.height]})]}},f=(p,v,I,T)=>{const F=g.SceneTransforms.wgs84ToWindowCoordinates(p,v);if(!F)return null;const V=F.x+I,j=F.y+T,Y=new g.Cartesian2(V,F.y),G=new g.Cartesian2(F.x,j),X=p.camera.pickEllipsoid(Y,p.globe.ellipsoid),W=p.camera.pickEllipsoid(G,p.globe.ellipsoid);if(!X||!W)return null;const Z=g.Cartesian3.distance(v,X),ee=g.Cartesian3.distance(v,W);return{widthMeters:Z,heightMeters:ee}},E=(p,v,I)=>{const T=g.Ellipsoid.WGS84,F=p.latitude,V=p.longitude,j=Math.PI/180*T.maximumRadius,Y=Math.PI/180*T.maximumRadius,G=I/2/j,X=v/2/Y,W=F+G,Z=F-G,ee=V+X,l=V-X;return{type:"Polygon",coordinates:[[[l,W],[ee,W],[ee,Z],[l,Z],[l,W]]]}},C=(p,v)=>kt(p)/kt(v);if(!e.dataSources.getByName(t.name)[0])return;const b=[];if(t==null||t.entities.values.forEach(p=>{var v,I;if(s&&o&&d)try{const T=je(s),F=Nt(h(p),T);if(F){const V=(v=p.properties)==null?void 0:v.label.getValue(g.JulianDate.now()),j=ur(F,{properties:{label:V}}),Y={width:V.width,height:V.height},[G,X,W=0]=j.geometry.coordinates,Z=g.Cartesian3.fromDegrees(G,X,W),ee=f(e.scene,Z,Y.width,Y.height);if(ee){const l=E({longitude:G,latitude:X},ee.widthMeters,ee.heightMeters),c=Nt(F,{type:"Feature",properties:{},geometry:l});C(c==null?void 0:c.geometry,l)>.7&&b.push(j)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",p,"extent -->",s)}if(!(n.length>0&&!n.some(T=>p.id.startsWith(T)))&&(p.polygon&&(p.polygon=new g.PolygonGraphics({hierarchy:p.polygon.hierarchy,material:d?g.Color.fromCssColorString(r).withAlpha(.2):g.Color.fromCssColorString(r).withAlpha(.5),outline:!0,outlineColor:g.Color.fromCssColorString(r),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),p.polyline&&(p.polyline=new g.PolylineGraphics({positions:p.polyline.positions,material:g.Color.fromCssColorString(r).withAlpha(.5),clampToGround:!0,width:4})),p.billboard)){const T=(I=p.position)==null?void 0:I.getValue(g.JulianDate.now()),F=g.Cartographic.fromCartesian(T),V=new g.Cartographic(F.longitude,F.latitude,d?500:e.scene.sampleHeight(g.Cartographic.fromCartesian(T))),j=g.Cartesian3.fromRadians(V.longitude,V.latitude,V.height),Y="#FFFF00";p.position=j,p.billboard=new g.BillboardGraphics({image:"data:image/svg+xml;base64,"+btoa(`
1
+ (function(h,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@date-io/date-fns"),require("@material-ui/pickers"),require("@material-ui/core"),require("@material-ui/core/styles"),require("@map-colonies/react-core"),require("@material-ui/core/useMediaQuery"),require("react-datepicker"),require("date-fns/locale/he"),require("moment"),require("@turf/rewind"),require("ol"),require("ol/ol.css"),require("ol/coordinate"),require("ol/control"),require("ol/control/MousePosition"),require("ol/proj"),require("ol/layer"),require("ol/source"),require("ol/format"),require("ol/interaction"),require("ol/interaction/Draw"),require("ol/layer/VectorTile"),require("ol/style"),require("ol/tilegrid/WMTS"),require("ol/extent"),require("ol/source/TileWMS"),require("ol/source/XYZ"),require("ol/source/VectorTile"),require("ol-ext/legend/Legend"),require("ol-ext/control/Legend"),require("ol-ext/dist/ol-ext.css"),require("@material-ui/core/TableHead"),require("@material-ui/core/utils"),require("@material-ui/core/CssBaseline"),require("@material-ui/core/ScopedCssBaseline"),require("react-dom"),require("resium"),require("cesium"),require("lodash"),require("@turf/bbox"),require("@turf/boolean-point-in-polygon"),require("@turf/area"),require("@turf/bbox-polygon"),require("@turf/centroid"),require("@turf/helpers"),require("@turf/intersect"),require("@turf/point-to-polygon-distance"),require("@turf/invariant"),require("@map-colonies/react-core/dist/list/styles"),require("@map-colonies/react-core/dist/textfield/styles"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("@map-colonies/react-core/dist/checkbox/styles"),require("p-map"),require("uuid"),require("@turf/boolean-valid"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select"),require("react-circular-progressbar"),require("react-circular-progressbar/dist/styles.css"),require("react-move")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@date-io/date-fns","@material-ui/pickers","@material-ui/core","@material-ui/core/styles","@map-colonies/react-core","@material-ui/core/useMediaQuery","react-datepicker","date-fns/locale/he","moment","@turf/rewind","ol","ol/ol.css","ol/coordinate","ol/control","ol/control/MousePosition","ol/proj","ol/layer","ol/source","ol/format","ol/interaction","ol/interaction/Draw","ol/layer/VectorTile","ol/style","ol/tilegrid/WMTS","ol/extent","ol/source/TileWMS","ol/source/XYZ","ol/source/VectorTile","ol-ext/legend/Legend","ol-ext/control/Legend","ol-ext/dist/ol-ext.css","@material-ui/core/TableHead","@material-ui/core/utils","@material-ui/core/CssBaseline","@material-ui/core/ScopedCssBaseline","react-dom","resium","cesium","lodash","@turf/bbox","@turf/boolean-point-in-polygon","@turf/area","@turf/bbox-polygon","@turf/centroid","@turf/helpers","@turf/intersect","@turf/point-to-polygon-distance","@turf/invariant","@map-colonies/react-core/dist/list/styles","@map-colonies/react-core/dist/textfield/styles","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","@map-colonies/react-core/dist/checkbox/styles","p-map","uuid","@turf/boolean-valid","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select","react-circular-progressbar","react-circular-progressbar/dist/styles.css","react-move"],i):(h=typeof globalThis<"u"?globalThis:h||self,i(h.reactComponents={},h.jsxRuntime,h.React,h.dateFns,h.locale,h.DateFnsUtils,h.pickers,h.core,h.styles,h.reactCore,h.useMediaQuery,h.DatePicker,h.datePickerHebrewLocale,h.moment,h.rewind,h.ol,null,h.coordinate,h.control,h.MousePosition,h.proj,h.layer,h.source,h.format,h.interaction,h.Draw,h.VectorTile,h.style,h.WMTSTileGrid,h.extent,h.OlTileWMS,h.OlXYZ,h.VectorTileSource,h.OlExtLegend,h.OlExtLegendCtrl,null,h.TableHead,h.utils,h.CssBaseline,h.ScopedCssBaseline,h.ReactDOM,h.resium,h.Cesium,h.lodash,h.bbox,h.booleanPointInPolygon,h.area,h.bboxPolygon,h.centroid,h.turf,h.intersect,h.pointToPolygonDistance,h.invariant,null,null,h.viewerCesiumNavigationMixin,null,null,null,h.pMap,h.uuid,h.booleanValid,h.getCaretCoordinates,h.getInputSelection,h.chonky,h.chonkyIconFontawesome,h.filesize,h.Select,h.reactCircularProgressbar,null,h.reactMove))})(this,function(h,i,a,be,Ye,Ct,Ve,de,Ne,ee,Jr,Mt,Kr,Ge,Qr,_t,ds,It,lt,ct,Pt,At,dt,ut,Rr,en,tn,Ze,rn,Ot,nn,on,sn,Dt,an,us,ln,kt,cn,dn,ht,_e,u,z,Xe,un,Nt,Je,hn,xt,Bt,gn,pn,hs,gs,fn,ps,fs,ms,gt,Ft,mn,yn,Vt,ne,vn,En,Gt,Ke,ys,Tn){"use strict";var ls=Object.defineProperty;var cs=(h,i,a)=>i in h?ls(h,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):h[i]=a;var ce=(h,i,a)=>(cs(h,typeof i!="symbol"?i+"":i,a),a);function pt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Ht=pt(a),_=pt(u),Wt=pt(xt),U=e=>{const{children:t,...r}=e;return i.jsx(de.Box,{...r,children:t})};var Le=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(Le||{}),Se=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(Se||{}),Qe=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Qe||{});const he={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:Se.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:Se.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Re=e=>{const t=e.type==="dark";return a.useMemo(()=>zt(e,t),[t,e])},zt=(e,t=!1)=>Ne.createTheme({palette:{type:t?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:t?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:t?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),Ut=e=>a.useMemo(()=>({...e,"cesium-color":"#EDFFFF","cesium-error":e["--mdc-theme-gc-error-medium"]??"#FF3636","cesium-warning":e["--mdc-theme-gc-warning-high"]??"#FFA032","cesium-checkbox-color":"#1A73E8","cesium-checkbox-width":"12px","cesium-checkbox-height":"12px","cesium-font-size":"10pt"}),[e]),vs="",Ln=2,wn=.5,bn=Ne.makeStyles(e=>Ne.createStyles({container:{padding:e.spacing(Ln),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(wn)}})),qt=e=>{var Z,$,N,X;const t=bn(),r=ee.useTheme(),n=Re(r),[o,s]=a.useState(null),[d,g]=a.useState(null),[f,w]=a.useState(he.DATE_RANGE_PICKER.dateFormat),S=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,C=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,v=((Z=e.local)==null?void 0:Z.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,y=(($=e.local)==null?void 0:$.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,D=((N=e.local)==null?void 0:N.setText)??he.DATE_RANGE_PICKER.local.setText,V=((X=e.local)==null?void 0:X.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,I=e.showTime??he.DATE_RANGE_PICKER.showTime,G=V===Se.HE?Ye.he:Ye.enUS;a.useEffect(()=>{s(e.from??null)},[e.from]),a.useEffect(()=>{g(e.to??null)},[e.to]),a.useEffect(()=>{w(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const q=Boolean(be.isValid(o)&&!d||be.isValid(d)&&!o||o&&d&&be.isValid(o)&&be.isValid(d)&&be.isBefore(o,d)),R=()=>{e.onChange({from:o&&be.isValid(o)?o:void 0,to:d&&be.isValid(d)?d:void 0})},H=I?Ve.KeyboardDateTimePicker:Ve.KeyboardDatePicker;return i.jsx(de.ThemeProvider,{theme:n,children:i.jsx(U,{className:`${t.container} drpContainer`,display:"flex",flexDirection:S,width:S==="column"?e.contentWidth:"unset",children:i.jsxs(Ve.MuiPickersUtilsProvider,{utils:Ct,locale:G,children:[i.jsx(H,{variant:"inline",placeholder:v,onChange:l=>s(l),value:o,disableFuture:C,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(H,{variant:"inline",placeholder:y,className:t.margin,onChange:l=>g(l),value:d,disableFuture:C,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(ee.ThemeProvider,{options:r,children:i.jsx(ee.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:R,disabled:!q,children:D})})]})})})},$t=e=>{const{children:t,...r}=e;return i.jsx(de.Popover,{...r,children:t})},Es="",Sn=e=>{var H,Z;const[t,r]=a.useState(null),[n,o]=a.useState(null),[s,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[g,f]=a.useState(null),w=$=>{f($.currentTarget)},S=$=>{$.currentTarget.tagName==="I"?f($.currentTarget.previousElementSibling):f($.currentTarget)},C=()=>{f(null)},v=Boolean(g),y=e.controlsLayout??"column";a.useEffect(()=>{r(e.from??null)},[e.from]),a.useEffect(()=>{o(e.to??null)},[e.to]),a.useEffect(()=>{d(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const D=((H=e.local)==null?void 0:H.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,V=((Z=e.local)==null?void 0:Z.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,I=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,G=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,q=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,R=a.useMemo(()=>`${t?be.format(t,s):D} - ${n?be.format(n,s):V}`,[t,n,s,D,V]);return i.jsxs(i.Fragment,{children:[I?i.jsx(ee.Button,{style:{width:e.width},raised:!0,onClick:w,className:"drpOpener",children:R}):i.jsx(ee.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:R,onClick:S,trailingIcon:{icon:"date_range",tabIndex:0,onClick:S}}),i.jsx($t,{open:v,anchorEl:g,onClose:C,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(qt,{controlsLayout:y,contentWidth:((g==null?void 0:g.clientWidth)??0)-G,dateFormat:s,disableFuture:q,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:n??void 0,onChange:({from:$,to:N})=>{r($??null),o(N??null),e.onChange({from:$,to:N}),C()}})})]})},et=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,Cn=({endDate:e,startDate:t,setEndDate:r=()=>{},setStartDate:n=()=>{},endTimeInputClassName:o="",endTimeLabel:s="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:g="",startTimeInputClassName:f="",startTimeLabel:w="",startTimeWrapperClassName:S=""})=>i.jsxs("div",{className:`timeRangeWrapper ${g}`,children:[i.jsx("div",{className:`startTimeWrapper ${S}`,children:i.jsx(ee.TextField,{label:w,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Ge(t).format("HH:mm"),onChange:C=>{const v=Ge(t),y=Ge(C.currentTarget.value,"HH:mm"),D=v.set({hours:y.get("hours"),minutes:y.get("minutes")});n(D.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(ee.TextField,{label:s,disabled:e===null,className:`timeRangeInput ${o}`,name:"end-time",type:"time",value:Ge(e).format("HH:mm"),onChange:C=>{const v=Ge(e),y=Ge(C.currentTarget.value,"HH:mm"),D=v.set({hours:y.get("hours"),minutes:y.get("minutes")});r(D.toDate())}})})]}),Mn=a.forwardRef(({value:e,onClick:t,onInputClick:r,...n},o)=>i.jsx(ee.TextField,{...n,className:"dateRangeCustomInput",readOnly:!0,onClick:s=>{t==null||t(s),r==null||r()},ref:o,value:e})),_n=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:r,dateRange:n,onShortcut:o})=>{const[s,d]=a.useState(),g=a.useMemo(()=>r.map(f=>f instanceof Function?f():f),[r]);return a.useEffect(()=>{for(const f of g){const w=n.startDate&&n.endDate&&be.isSameDay(f.startDate,n.startDate)&&be.isSameDay(f.endDate,n.endDate);s?f.id===s&&(w||d(void 0)):w&&d(f.id)}},[n,s,g]),i.jsx("div",{className:"shortcutsContainer",children:g.map((f,w)=>{const S=()=>{e(f.startDate),t(f.endDate)};return i.jsx(ee.Button,{type:"button",className:`shortcut ${s===f.id?"selected":""}`,onClick:C=>{S(),o==null||o({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+w)})})},In=a.forwardRef((e,t)=>{const{calendarClassName:r,dayClassName:n,monthClassName:o,selectsRange:s,onChange:d,inputName:g,showMonthYearDropdown:f,withShortcuts:w,locale:S="en"}=e,[C,v]=a.useState(null),[y,D]=a.useState(null),[V,I]=a.useState(!1),G=s?{startDate:C,endDate:y}:C;a.useEffect(()=>{S==="he"&&Mt.registerLocale("he",Kr)},[S]),a.useEffect(()=>{var H,Z;((H=e.startDate)==null?void 0:H.toString())!==(C==null?void 0:C.toString())&&v(e.startDate),((Z=e.endDate)==null?void 0:Z.toString())!==(y==null?void 0:y.toString())&&D(e.endDate)},[e.startDate,e.endDate,C,y]);const q=a.useMemo(()=>{let H="pickerContainer"+(S==="he"?" pickerContainer-rtl":"");return w&&s&&(H+=" pickerContainer-withShortcuts"),H},[S,w,s]),R=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:q,style:{direction:S==="he"?"rtl":"ltr"},children:i.jsx(Mt,{...e,ref:t,onClickOutside:()=>I(!1),open:V,startDate:et(G)?C:void 0,selected:C,endDate:et(G)?y:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${r}`,weekDayClassName:H=>`pickerWeek ${(n==null?void 0:n(H))??""}`,dayClassName:H=>`pickerDay ${(n==null?void 0:n(H))??""}`,monthClassName:H=>`pickerMonth ${(o==null?void 0:o(H))??""}`,onChange:(H,Z)=>{if(Array.isArray(H)){const[$,N]=H;v($),D(N),d==null||d({startDate:$,endDate:N&&be.endOfDay(N)},Z)}else v(H),d==null||d(H,Z)},customInput:i.jsx(Mn,{name:g,onInputClick:()=>{I(!0)}}),showTimeInput:!!(w&&s),timeInputLabel:"",customTimeInput:w&&et(G)&&i.jsx(_n,{onShortcut:H=>{d==null||d(H),I(!1)},shortcuts:w,setEndDate:D,setStartDate:v,dateRange:G}),showMonthYearDropdown:void 0,...R})})}),Ts="",Pn=e=>{const t=ee.useTheme(),r=Re(t),{format:n=he.DATE_PICKER.dateFormat,variant:o=he.DATE_PICKER.variant,disableFuture:s=he.DATE_PICKER.disableFuture,local:d,onChange:g,showTime:f=he.DATE_PICKER.showTime,value:w,...S}=e,{placeHolderText:C=he.DATE_PICKER.local.placeHolderText,calendarLocale:v}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:Se.EN},y=v===Se.HE?Ye.he:Ye.enUS,D=V=>{g(V)};return i.jsx(de.ThemeProvider,{theme:r,children:i.jsxs(Ve.MuiPickersUtilsProvider,{utils:Ct,locale:y,children:[f&&i.jsx(Ve.KeyboardDateTimePicker,{variant:o,placeholder:C,onChange:D,value:w,disableFuture:s,format:n,...S}),!f&&i.jsx(Ve.KeyboardDatePicker,{variant:o,placeholder:C,onChange:D,value:w,disableFuture:s,format:n,...S})]})})},An=18,On=Ne.makeStyles(e=>Ne.createStyles({drawingButton:{width:e.spacing(An)},fullWidth:{width:"100%",marginTop:"36px"}})),Dn=e=>{const t=On(),[r,n]=a.useState(null),{isSelectionEnabled:o,onCancelDraw:s,onStartDraw:d,onReset:g}=e,f=S=>{n(S.currentTarget)},w=()=>{n(null)};return o?i.jsx(ee.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(ee.Button,{className:t.drawingButton,raised:!0,onClick:s,children:"Cancel Draw"})}):i.jsxs(U,{position:"relative",children:[i.jsx(ee.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(ee.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(ee.Menu,{className:t.fullWidth,open:Boolean(r),onClose:w,children:[i.jsx(ee.MenuItem,{onClick:()=>{d(Le.POLYGON),w()},children:"Polygon"}),i.jsx(ee.MenuItem,{onClick:()=>{d(Le.BOX),w()},children:"Box"}),i.jsx(ee.MenuItem,{onClick:()=>{g(),w()},children:"Clear"})]})]})},Ls="";var Ce=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(Ce||{});const tt=5,rt=2,jt=a.createContext(null),kn=jt.Provider,Yt=35,Zt=32,Nn=10,xn=e=>e!==void 0&&e!==Ce.WGS84?Pt.transform([Yt,Zt],Ce.WGS84,e):[Yt,Zt],Bn=e=>{switch(e){case Ce.WEB_MERCATOR:return t=>It.format(t,"Mercator: {y}m, {x}m",rt);case Ce.WGS84:return t=>It.format(t,"WGS84: {y}°N {x}°E",tt);default:return t=>""}},xe=()=>{const e=a.useContext(jt);if(e===null)throw new Error("map context is null, please check the provider");return e},Xt=e=>{const t=a.useRef(null),{allowFullScreen:r,showMousePosition:n,projection:o}=e,[s]=a.useState(new _t.Map({view:new _t.View({projection:o??Ce.WGS84}),controls:lt.defaults()}));a.useEffect(()=>{s.getView().setCenter(e.center??xn(e.projection))},[s,e.center,e.projection]),a.useEffect(()=>{s.getView().setZoom(e.zoom??Nn)},[s,e.zoom,e.projection]);const d=(g,f)=>{f.getControls().forEach(S=>{S instanceof g&&f.removeControl(S)})};return a.useEffect(()=>{s.setTarget(t.current),r!==void 0&&r?s.addControl(new lt.FullScreen):d(lt.FullScreen,s)},[s,r]),a.useEffect(()=>{n!==void 0&&n?(d(ct,s),s.addControl(new ct({coordinateFormat:Bn(o??Ce.WGS84),projection:o??Ce.WGS84,undefinedHTML:"&nbsp;"}))):d(ct,s)},[s,n,o]),i.jsxs(kn,{value:s,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Jt=a.createContext(null),Fn=Jt.Provider,We=()=>{const e=a.useContext(Jt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Kt=({options:e,children:t})=>{const r=xe(),[n]=a.useState(new At.Tile(e));return a.useEffect(()=>(r.addLayer(n),()=>{r.removeLayer(n)}),[r,n]),i.jsx(Fn,{value:n,children:t})},Qt=a.createContext(null),Vn=Qt.Provider,Rt=()=>{const e=a.useContext(Qt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},er=({options:e,children:t})=>{const r=xe(),[n]=a.useState(new At.Vector(e));return a.useEffect(()=>(r.addLayer(n),()=>{r.removeLayer(n)}),[r,n]),i.jsx(Vn,{value:n,children:t})},tr=a.createContext(null),Gn=tr.Provider,rr=()=>{const e=a.useContext(tr);if(e===null)throw new Error("vector source context is null, please check the provider");return e},nr=({children:e})=>{const t=Rt(),[r]=a.useState(new dt.Vector);return a.useEffect(()=>{t.setSource(r)},[r,t]),i.jsx(Gn,{value:r,children:e})},ir=({geometry:e,fitOptions:t,fit:r,featureStyle:n})=>{const o=rr(),s=xe();return a.useLayoutEffect(()=>{const g=new ut.GeoJSON().readFeature(e);return r&&o.on("addfeature",function(){s.getView().fit(o.getExtent(),t)}),n&&g.setStyle(n),o.addFeature(g),()=>{o.removeFeature(g)}},[e,o,r]),null},or=e=>{const t=We();return a.useEffect(()=>{t.setSource(new dt.OSM)},[t]),null},sr=({drawType:e,onPolygonSelected:t})=>{const r=xe();return a.useEffect(()=>{const n={type:"Circle"};switch(e){case Le.BOX:n.geometryFunction=en.createBox();break;case Le.POLYGON:n.type="Polygon";break;default:return}const o=new Rr.Draw(n);r.addInteraction(o);const s=d=>{const f=new ut.GeoJSON().writeGeometryObject(d.feature.getGeometry());t==null||t(f)};return o.on("drawend",s),()=>{o.un("drawend",s),r.removeInteraction(o)}},[t,e,r]),null},ws="",Hn=e=>{const t=r=>{const n=Qr(r);e.onPolygonSelection(n)};return i.jsxs(Xt,{allowFullScreen:!0,showMousePosition:!0,children:[i.jsx(Kt,{children:i.jsx(or,{})}),e.selectionPolygon&&i.jsx(er,{children:i.jsx(nr,{children:i.jsx(ir,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&i.jsx(sr,{drawType:e.drawType,onPolygonSelected:t})]})},ft=1.5,Wn=80,zn=Ne.makeStyles(e=>Ne.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(ft),top:e.spacing(ft)},contentContainer:{marginTop:e.spacing(ft),width:e.spacing(Wn)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),Un=e=>{var f;const[t,r]=a.useState(),[n,o]=a.useState(),s=zn(),d=w=>{o(w),r(void 0),e.handlePolygonSelected(w)},g=()=>{o(void 0),e.handlePolygonReset()};return i.jsxs("div",{className:s.map,children:[i.jsxs("div",{className:`${s.absolute}`,children:[i.jsxs(de.Paper,{className:s.filtersContainer,children:[i.jsx(Dn,{onCancelDraw:()=>r(void 0),onReset:g,onStartDraw:r,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((w,S)=>i.jsx("div",{className:s.filtersMargin,children:w},S))]}),i.jsx(de.Paper,{color:"red",className:`${s.contentContainer}`,children:e.children})]}),i.jsx(Hn,{children:e.mapContent,onPolygonSelection:d,drawType:t,selectionPolygon:n})]})},ar=new Ze.Fill({color:"rgba(255,255,255,0.4)"}),lr=new Ze.Stroke({color:"#3399CC",width:1.25}),cr=[new Ze.Style({image:new Ze.Circle({fill:ar,stroke:lr,radius:5}),fill:ar,stroke:lr})],dr=a.createContext(null),qn=dr.Provider,ur=()=>{const e=a.useContext(dr);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},$n=({children:e,options:t,style:r})=>{const n=xe(),[o]=a.useState(new tn({...t,style:r||cr}));return a.useEffect(()=>(n.addLayer(o),()=>{n.removeLayer(o)}),[n,o]),a.useEffect(()=>{o.setStyle(r||cr)},[o,r]),i.jsx(qn,{value:o,children:e})},mt=20,jn=256,Yn=2,Zn=2,Xn="REST",Jn=e=>{const t=Pt.get(e.projection),r=t.getExtent(),n=new Array(mt),o=new Array(mt),s=Ot.getWidth(r)/jn,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Zn,g=e.requestEncoding!==void 0?e.requestEncoding:Xn;for(let w=0;w<mt;++w)n[w]=s/Math.pow(Yn,w)/d,o[w]=w.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new rn({origin:Ot.getTopLeft(r),resolutions:n,matrixIds:o}),style:e.style,requestEncoding:g,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Kn=e=>{const t=We(),{options:r}=e;return a.useEffect(()=>{t.setSource(new dt.WMTS(r))},[t,r]),null},Qn=e=>{const{attributions:t,url:r,params:n,serverType:o,transition:s}=e;return{attributions:t,url:r,params:n,serverType:o,transition:s}},Rn=e=>{const t=We(),{options:r}=e;return a.useEffect(()=>{t.setSource(new nn(r))},[t,r]),null},ei=e=>{const{attributions:t,url:r}=e;return{attributions:t,url:r}},ti=e=>{const t=We(),{options:r}=e;return a.useEffect(()=>{t.setSource(new on(r))},[t,r]),null},ri=a.createContext(null),ni=()=>{const e=a.useContext(ri);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},ii=e=>{const{url:t}=e;return{url:t,format:new ut.MVT}},oi=({children:e,options:t})=>{const r=ur();return a.useEffect(()=>{r.setSource(new sn(t))},[t,r]),null},si=({legendItems:e,title:t,isCollapsed:r})=>{const n=xe();return a.useEffect(()=>{const o=new Dt({title:t??"",margin:5,maxWidth:300}),s=new an({legend:o,collapsed:r===void 0?!0:r});n.addControl(s);const d=new Dt({margin:4});return e.forEach(g=>{d.addItem({title:g.title,style:g.style,typeGeom:"Polygon"})}),o.addItem(d),()=>{n.removeControl(s)}},[n,e,t,r]),i.jsx(i.Fragment,{})};function ai(e){const{headCells:t,order:r,orderBy:n,onRequestSort:o,isCollapseable:s}=e,d=g=>f=>{o(f,g)};return i.jsx(ln,{children:i.jsxs(de.TableRow,{children:[s&&i.jsx(de.TableCell,{}),t.map(g=>i.jsx(de.TableCell,{align:g.numeric?"right":"left",padding:g.disablePadding?"none":"default",sortDirection:n===g.id?r:!1,children:i.jsx(de.TableSortLabel,{active:n===g.id,direction:n===g.id?r:"asc",onClick:d(g.id),children:g.label})},g.id))]})})}const li=kt.createSvgIcon(Ht.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),ci=kt.createSvgIcon(Ht.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function di(e){const{cellsMetadata:t,isRowSelected:r,item:n,onRowSelected:o,rowIndex:s,isCollapseable:d,collapsedElement:g}=e,[f,w]=a.useState(!1),S=t.length,C=()=>{o==null||o(s)};return i.jsxs(i.Fragment,{children:[i.jsxs(de.TableRow,{hover:!0,selected:r,onClick:C,children:[d&&i.jsx(de.TableCell,{padding:"checkbox",children:i.jsx(de.IconButton,{"aria-label":"expand row",size:"small",onClick:v=>{v.stopPropagation(),w(!f)},children:f?i.jsx(ci,{}):i.jsx(li,{})})}),t.map(v=>i.jsx(de.TableCell,{align:v.numeric?"right":"left",padding:v.disablePadding?"none":"default",children:v.transform?v.transform(n[v.id]):n[v.id]},v.id+s.toString()))]}),d&&i.jsx(de.TableRow,{children:i.jsx(de.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:S+1,children:i.jsx(de.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:g==null?void 0:g(n)})})})]})}function ui(e){const[t,r]=a.useState(""),[n,o]=a.useState("asc"),{cellsMetadata:s,items:d,onRequestSort:g,onRowSelected:f,isCollapseable:w,collapsedElement:S,isDense:C,page:v,rowsPerPage:y,count:D,handleChangePage:V,handleChangeRowsPerPage:I}=e,G=(q,R)=>{const H=t===R&&n==="asc";o(H?"desc":"asc"),r(R),g(R,H?"desc":"asc")};return i.jsxs(de.TableContainer,{component:de.Paper,children:[i.jsxs(de.Table,{size:C?"small":"medium",children:[i.jsx(ai,{headCells:s,onRequestSort:G,order:n,orderBy:t,isCollapseable:w}),i.jsxs(de.TableBody,{children:[d.map((q,R)=>i.jsx(di,{item:q,rowIndex:R,isCollapseable:w,cellsMetadata:s,collapsedElement:S,isRowSelected:!1,onRowSelected:f},R)),(d.length===0||y>d.length)&&i.jsx(de.TableRow,{style:{height:(C?33:53)*(y-d.length)},children:i.jsx(de.TableCell,{colSpan:w?s.length+1:s.length,children:d.length===0&&i.jsx(de.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(de.TablePagination,{rowsPerPage:y,rowsPerPageOptions:[5,10],component:"div",count:D,page:v,onPageChange:V,onRowsPerPageChange:I})]})}const hi=e=>{const{children:t,...r}=e;return i.jsx(cn,{...r,children:t})},gi=e=>{const{children:t,...r}=e;return i.jsx(dn,{...r,children:t})},hr=e=>e*Math.PI/180,nt=e=>e*(180/Math.PI),pi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hr(85.362/2))/Math.sin(hr(85.362/2))),fi=({title:e,onClick:t})=>i.jsx("div",{className:"cesium-cesiumInspector-button",onClick:t,children:e}),mi=({title:e,isVisible:t,onClick:r,children:n})=>i.jsxs(U,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(fi,{title:e,onClick:r}),t&&i.jsx(U,{className:"cesium-cesiumInspector-dropDown",children:n})]}),gr=(e,t,r)=>{let n;if(e.scene.mode!==u.SceneMode.SCENE2D)n=e.scene.pickPosition(new u.Cartesian2(t,r));else{const o=e.scene.globe.ellipsoid;n=e.camera.pickEllipsoid(new u.Cartesian2(t,r),o)}return u.Cartographic.fromCartesian(n)},yi=(e,t,r)=>{const n=gr(e,t,r);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[u.Math.toDegrees(n.longitude),u.Math.toDegrees(n.latitude)]}}},pr=(e,t,r)=>{try{const n=gr(e,t,r);return{longitude:u.Math.toDegrees(n.longitude),latitude:u.Math.toDegrees(n.latitude)}}catch{return}};class vi extends u.PolylineDashMaterialProperty{}class Ei extends u.ConstantProperty{}class Ti extends u.ConstantPositionProperty{}class Li extends u.Cartesian2{}class wi extends u.Cartesian3{}class fr extends u.Cartographic{}class bi extends u.BoundingSphere{}class Si extends u.Ellipsoid{}class Ci extends u.GeographicTilingScheme{}class mr extends u.Rectangle{}class Mi extends u.Resource{}class _i extends u.EllipsoidTerrainProvider{}class Ii extends u.CesiumTerrainProvider{}class Pi extends u.PolylineGraphics{}class Ai extends u.JulianDate{}class Oi extends u.PositionProperty{}class Di extends u.BillboardGraphics{}class ki extends u.Color{}class Ni extends u.PolygonHierarchy{}class xi extends u.Scene{}const Bi=u.VerticalOrigin,Fi=u.HorizontalOrigin,it=u.SceneMode,Vi=u.LabelStyle,Gi=u.HeightReference,Ie=document.createElement("canvas"),we=Ie.getContext("2d"),yr=e=>{const n=(e==null?void 0:e.data)??[];for(let o=3;o<n.length;o+=4)if(n[o]<255)return!0;return!1},Hi=async(e,t)=>(t&&t.tileTransparencyCheckedCounter++,new Promise((r,n)=>{try{we==null||we.clearRect(0,0,Ie.width,Ie.height);let o;if(e instanceof HTMLImageElement)o=e;else if(e instanceof ImageBitmap){Ie.width=e.width,Ie.height=e.height,we==null||we.drawImage(e,0,0);const s=we==null?void 0:we.getImageData(0,0,Ie.width,Ie.height),d=yr(s);d&&t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),r(d);return}else o=new Image,o.crossOrigin="anonymous",o.src=e;o.onload=()=>{Ie.width=o.width,Ie.height=o.height,we==null||we.drawImage(o,0,0);const s=we==null?void 0:we.getImageData(0,0,Ie.width,Ie.height);yr(s)?(t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),r(!0)):r(!1)}}catch(o){console.error("Could not determine image transparency. Error => ",o),n(o)}})),Wi=(e,t)=>{const{west:r,east:n,north:o,south:s}=e,{west:d,east:g,north:f,south:w}=t;return r>=d&&n<=g&&o<=f&&s>=w},zi=(e,t)=>gn(e,Je(t)),Ui=e=>{const t=(u.Math.toDegrees(e.west)+u.Math.toDegrees(e.east))/2,r=(u.Math.toDegrees(e.south)+u.Math.toDegrees(e.north))/2;return xt.point([t,r])},vr=e=>[u.Math.toDegrees(e.west),u.Math.toDegrees(e.south),u.Math.toDegrees(e.east),u.Math.toDegrees(e.north)],qi=e=>({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[u.Math.toDegrees(e.west),u.Math.toDegrees(e.north)],[u.Math.toDegrees(e.east),u.Math.toDegrees(e.north)],[u.Math.toDegrees(e.east),u.Math.toDegrees(e.south)],[u.Math.toDegrees(e.west),u.Math.toDegrees(e.south)],[u.Math.toDegrees(e.west),u.Math.toDegrees(e.north)]]]}}),Er=e=>{const t=e.scene;let n=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!u.defined(n)||!n){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const o=new u.Cartesian2(0,0),s=t.camera.pickEllipsoid(o,t.globe.ellipsoid),d=new u.Cartesian2(t.canvas.width,t.canvas.height),g=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(s),w=t.globe.ellipsoid.cartesianToCartographic(g);n=new u.Rectangle(f.longitude,w.latitude,w.longitude,f.latitude)}return n},$i=(e,t=100)=>{const r=e.scene,n=e.camera,o=r.mode,s=Er(e);if(!u.defined(s)||!s){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(o===u.SceneMode.SCENE2D)return s;const d=n.positionCartographic;if(!u.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const g=d.latitude,f=d.longitude;if(g<-u.Math.PI_OVER_TWO||g>u.Math.PI_OVER_TWO||f<-u.Math.PI||f>u.Math.PI){console.error("Invalid latitude or longitude values.");return}const w=111320,S=111320*Math.cos(g);let C=t/w,v=t/S;const y=u.Cartesian3.magnitude(n.positionWC);y>1e7&&(C=10,v=10);const D=n.frustum instanceof u.PerspectiveFrustum?n.frustum.fov:Math.PI/3;let V=1;y<5e5?V=.05:y<2e6&&(V=.1),C*=V*(D/Math.PI),v*=V*(D/Math.PI);const I=n.pitch;if(I===void 0)return;const G=Math.PI/4,q=Math.max(0,1-Math.abs(I)/G);C*=q,v*=q;const R=5e-4;C=Math.max(C,R),v=Math.max(v,R);const H=d.latitude-C,Z=d.latitude+C,$=d.longitude-v,N=d.longitude+v,X=u.Math.clamp(H,s.south,s.north),l=u.Math.clamp(Z,s.south,s.north),c=u.Math.clamp($,s.west,s.east),E=u.Math.clamp(N,s.west,s.east),m=Math.min(1,I/u.Math.PI_OVER_TWO),T=s.north-(s.north-s.south)*m,b=Math.min(l,T);return new u.Rectangle(u.Math.negativePiToPi(c),u.Math.clamp(X,-u.Math.PI_OVER_TWO,u.Math.PI_OVER_TWO),u.Math.negativePiToPi(E),u.Math.clamp(b,-u.Math.PI_OVER_TWO,u.Math.PI_OVER_TWO))},Tr=(e,t,r,n,o,s)=>{const d=e.scene.mode===u.SceneMode.SCENE2D,g=v=>{var y;if(v.polygon)return{type:"Polygon",coordinates:[((y=v.polygon.hierarchy)==null?void 0:y.getValue(u.JulianDate.now())).positions.map(I=>{const G=u.Cartographic.fromCartesian(I),q=new u.Cartographic(u.Math.toDegrees(G.longitude),u.Math.toDegrees(G.latitude),d?500:void 0);return[q.longitude,q.latitude,q.height]})]}},f=(v,y,D,V)=>{const I=u.SceneTransforms.wgs84ToWindowCoordinates(v,y);if(!I)return null;const G=I.x+D,q=I.y+V,R=new u.Cartesian2(G,I.y),H=new u.Cartesian2(I.x,q),Z=v.camera.pickEllipsoid(R,v.globe.ellipsoid),$=v.camera.pickEllipsoid(H,v.globe.ellipsoid);if(!Z||!$)return null;const N=u.Cartesian3.distance(y,Z),X=u.Cartesian3.distance(y,$);return{widthMeters:N,heightMeters:X}},w=(v,y,D)=>{const V=u.Ellipsoid.WGS84,I=v.latitude,G=v.longitude,q=Math.PI/180*V.maximumRadius,R=Math.PI/180*V.maximumRadius,H=D/2/q,Z=y/2/R,$=I+H,N=I-H,X=G+Z,l=G-Z;return{type:"Polygon",coordinates:[[[l,$],[X,$],[X,N],[l,N],[l,$]]]}},S=(v,y)=>Nt(v)/Nt(y);if(!e.dataSources.getByName(t.name)[0])return;const C=[];if(t==null||t.entities.values.forEach(v=>{var y,D;if(o&&s&&d)try{const V=Je(o),I=Bt(g(v),V);if(I){const G=(y=v.properties)==null?void 0:y.label.getValue(u.JulianDate.now()),q=hn(I,{properties:{label:G}}),R={width:G.width,height:G.height},[H,Z,$=0]=q.geometry.coordinates,N=u.Cartesian3.fromDegrees(H,Z,$),X=f(e.scene,N,R.width,R.height);if(X){const l=w({longitude:H,latitude:Z},X.widthMeters,X.heightMeters),c=Bt(I,{type:"Feature",properties:{},geometry:l});S(c==null?void 0:c.geometry,l)>.7&&C.push(q)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",v,"extent -->",o)}if(!(r.length>0&&!r.some(V=>v.id.startsWith(V)))&&(v.polygon&&(v.polygon=new u.PolygonGraphics({hierarchy:v.polygon.hierarchy,material:d?u.Color.fromCssColorString(n).withAlpha(.2):u.Color.fromCssColorString(n).withAlpha(.5),outline:!0,outlineColor:u.Color.fromCssColorString(n),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),v.polyline&&(v.polyline=new u.PolylineGraphics({positions:v.polyline.positions,material:u.Color.fromCssColorString(n).withAlpha(.5),clampToGround:!0,width:4})),v.billboard)){const V=(D=v.position)==null?void 0:D.getValue(u.JulianDate.now()),I=u.Cartographic.fromCartesian(V),G=new u.Cartographic(I.longitude,I.latitude,d?500:e.scene.sampleHeight(u.Cartographic.fromCartesian(V))),q=u.Cartesian3.fromRadians(G.longitude,G.latitude,G.height),R="#FFFF00";v.position=q,v.billboard=new u.BillboardGraphics({image:"data:image/svg+xml;base64,"+btoa(`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
3
- <circle cx="8" cy="8" r="6" fill="${r}33" stroke="${Y}80" stroke-width="2"/>
3
+ <circle cx="8" cy="8" r="6" fill="${n}33" stroke="${R}80" stroke-width="2"/>
4
4
  </svg>
5
- `),verticalOrigin:g.VerticalOrigin.BOTTOM,heightReference:g.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})}}),e.dataSources.remove(e.dataSources.getByName(`${o==null?void 0:o.dataSourcePrefix}${t.name}`)[0]),o&&d){const p=new g.GeoJsonDataSource(`${o==null?void 0:o.dataSourcePrefix}${t.name}`);e.dataSources.add(p),p.load({type:"FeatureCollection",features:b}).then(v=>{v==null||v.entities.values.forEach(I=>{var T;I.billboard=new g.BillboardGraphics({image:(T=I.properties)==null?void 0:T.label.getValue(g.JulianDate.now()).dataURL,heightReference:g.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})})})}},Xi=.2,Ji=(e,t=Xi)=>e.width===0?(e.east=e.east+1e-4*t,e.west=e.west-1e-4*t,e.south=e.south-1e-4*t,e.north=e.north+1e-4*t,e):(e.east=e.east+e.width*t,e.west=e.west-e.width*t,e.south=e.south-e.height*t,e.north=e.north+e.height*t,e),bs="",Ki=({options:e,isOpen:t,locale:n})=>{const r=pe(),s=a.useRef(void 0),o=a.useRef(null),[d,h]=a.useState(""),[f,E]=a.useState(!1),[C,b]=a.useState(!0),[p,v]=a.useState(),[I,T]=a.useState(),F=a.useMemo(()=>$.get(n,"SHOW_FEATURE_ON_MAP")??"Show on map",[n]),V=a.useMemo(()=>$.get(n,"IN_MAP_EXTENT")??"Search in extent",[n]),j=a.useMemo(()=>$.get(n,"SEARCH_PLACEHOLDER")??"Search...",[n]),Y=a.useMemo(()=>$.get(n,"NO_RESULTS")??"No Results",[n]),G=a.useMemo(()=>r.scene.mode===g.SceneMode.SCENE2D?!1:(E(!1),!0),[r.scene.mode]),X=300,W=i.jsx("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"white",stroke:"#ccc",strokeWidth:1})}),Z=i.jsxs("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:[i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"#1976d2",stroke:"#1976d2",strokeWidth:1}),i.jsx("path",{d:"M4 8l2 2 6-6",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]});a.useEffect(()=>{e.forEach(m=>{m.baseUrl&&m.endPoint&&!m.url&&(m.url=m.baseUrl+m.endPoint)})},[e]),a.useEffect(()=>{t&&o.current&&o.current.focus()},[t]),a.useEffect(()=>{if(!r)return;if(!s.current){const L=new g.GeoJsonDataSource("geocoderDataSource");s.current=L,r.dataSources.add(L)}const m=s.current;I&&C?(async()=>{const k={type:"FeatureCollection",features:[I]};await m.load(k),En(r,m,[],"#01FF1F")})():m.entities.removeAll()},[r,C,I]);const ee=m=>{switch(typeof m){case"object":return Array.isArray(m)?`[${m.map(L=>`'${L}'`).join(", ")}]`:JSON.stringify(m);case"boolean":case"number":case"string":return m.toString();case"undefined":return}},l=(m,L,k)=>{const N=ee(k);if(N){const A=m.includes("?")?m.endsWith("?")||m.endsWith("&")?"":"&":"?";return`${m}${A}${encodeURIComponent(L)}=${encodeURIComponent(N)}`}return m},c=(m,L)=>(m&&m.forEach(k=>{L=l(L,k[0],k[1])}),L),_=a.useCallback((m,L,k,N)=>((()=>{const O=L.dynamic.queryText,B=typeof O=="string"?O:O.name,te=typeof O=="string"?void 0:O.relatedParams;if(m=l(m,B,k),te&&te.forEach(ne=>{m=l(m,ne[0],ne[1])}),N){const ne=vn(r),q=L.dynamic.geoContext,R=typeof q=="string"?q:q==null?void 0:q.name;if(ne&&R){const ie=yn(ne),ge={bbox:[ie[0],ie[1],ie[2],ie[3]]};m=l(m,R,ge);const ve=typeof q=="string"||q==null?void 0:q.relatedParams;ve&&ve.forEach(oe=>{m=l(m,oe[0],oe[1])})}}})(),m=c(L.static,m),m),[r]),y=a.useCallback(async(m,L)=>{if(!m){v([]);return}const k=e.map(async O=>{if(O.url){const B=_(O.url,O.params,m,L);return fetch(B,{method:"GET"})}else return Promise.reject({message:"No URL provided. Please provide one"})}),N=await Promise.all(k),A=await Promise.all(N.filter(O=>O!==void 0).map(async O=>{var te;const B=await O.json();return B.features=(te=B.features)==null?void 0:te.map(ne=>({...ne,properties:{...ne.properties,headers:O.headers}})),{body:B,status:O.status,url:O.url,headers:Object.fromEntries(O.headers.entries())}}));v(A)},[_,e]),S=a.useMemo(()=>$.debounce((m,L)=>{y(m,L)},X),[y]);a.useEffect(()=>()=>S.cancel(),[S]);const w=(m,L)=>{h(m),S(m,L)};a.useEffect(()=>{y(d,f)},[f]);const P=m=>{const L=dr.getType(m);let k;switch(L){case"Point":k=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"var(--mdc-theme-cesium-color)",children:i.jsx("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})});break;case"LineString":k=i.jsxs("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",children:[i.jsx("path",{fill:"var(--mdc-theme-cesium-color)",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:.5,d:"M21 6h.046l-5.25 9h-.944L10 9.455V7H7v2.926L1.862 18H0v3h3v-2.926L8.138 10h1.01L14 15.545V18h3v-3h-.046l5.25-9H24V3h-3zM8 8h1v1H8zM2 20H1v-1h1zm14-3h-1v-1h1zm7-13v1h-1V4z"}),i.jsx("path",{fill:"none",d:"M0 0h24v24H0z"})]});break;default:k=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M11 4 L20 14 L20 20 L4 20 L4 10 Z"})});break}return i.jsx(Q,{children:k})};return i.jsx(Q,{className:"geocoderContainer",children:i.jsxs(Q,{className:"geocoderForm",children:[i.jsx(J.TextField,{id:"geocoderTextField",className:"cesium-geocoder-input",ref:o,onChange:m=>w(m.target.value,f),placeholder:j,value:d,autoComplete:"off"}),i.jsxs(Q,{className:"search-results",children:[i.jsxs(Q,{className:"checkboxesContainer",children:[i.jsx(J.Checkbox,{className:"checkboxElement",label:F,icon:W,checkedicon:Z,checked:C,onClick:()=>{b(!C)}}),i.jsx(J.Checkbox,{className:"checkboxElement",label:i.jsx(J.Typography,{tag:"span",className:G?"disabled":"",children:V}),checked:f,icon:W,checkedicon:Z,disabled:G,onClick:()=>{E(!f)}})]}),i.jsx(Q,{className:"listsContainer",children:e.map((m,L)=>i.jsxs(J.List,{children:[i.jsx(J.Typography,{className:"bold",tag:"span",children:m.title??m.endPoint}),i.jsx(Q,{className:"listContainer",children:(()=>{var B,te,ne,q,R,ie,ge,ve;const k=(te=(B=p==null?void 0:p[L])==null?void 0:B.body)==null?void 0:te.features,N=(R=(q=(ne=p==null?void 0:p[L])==null?void 0:ne.body)==null?void 0:q.features)==null?void 0:R.length,A=(ge=(ie=p==null?void 0:p[L])==null?void 0:ie.body)==null?void 0:ge.message,O=(ve=p==null?void 0:p[L])==null?void 0:ve.status;return N?k.map((oe,fe)=>{var D,x,H,z,U;return i.jsx(J.ListItem,{className:I===oe?"mdc-ripple-upgraded--background-focused":"",onClick:()=>{var K;r.camera.flyTo({destination:Ji(fn.fromDegrees(...qe(oe.geometry)))}),T(oe),(K=m.callbackFunc)==null||K.call(m,oe,m,fe)},children:i.jsxs(Q,{className:"queryItemResult",children:[i.jsx(J.Tooltip,{content:(x=(D=oe==null?void 0:oe.properties)==null?void 0:D.names)==null?void 0:x.display,children:i.jsx(Q,{children:(U=(z=(H=oe==null?void 0:oe.properties)==null?void 0:H.names)==null?void 0:z.default)==null?void 0:U[0]})}),P(oe)]})},`feature-${fe}`)}):N===0?i.jsx(J.ListItemSecondaryText,{className:"generalListItem queryNoResults",children:Y}):A?i.jsx(J.ListItemSecondaryText,{className:`generalListItem ${O===400?"queryWarning":"queryError"}`,children:A}):i.jsx(J.ListItemSecondaryText,{className:"generalListItem"})})()})]},`option-${L}`))})]})]})})},Qi=wt(({options:e,locale:t,isOpen:n,setIsOpen:r})=>i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>r(!n),children:i.jsx("svg",{className:"cesium-svgPath-svg",width:"32",height:"32",fill:"var(--mdc-theme-cesium-color)",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z"})})}),i.jsx(Et,{isVisible:n,children:i.jsx(Ki,{options:e,isOpen:n,locale:t})})]})),Ri={GLOBAL:{"BM-GOOGLE_TERRAIN-XYZ_LAYER":"https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}","BM-INFRARED_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_ir.cgi?","BM-RADAR_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?","BM-VECTOR_TILES_GPS-XYZ_LAYER":"https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png","BM-VECTOR_TILES-XYZ_LAYER":"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=6170aad10dfd42a38d4d8c709a536f38","BM-WMTS_POPULATION_TILES-WMTS_LAYER":"https://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_Density/MapServer/WMTS/","3D_MODEL":"https://3d.ofek-air.com/3d/Jeru_Old_City_Cesium/ACT/Jeru_Old_City_Cesium_ACT.json"},"WFS Vector layer":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw",vector_geoserver:"http://geoserver-vector-dev.apps.j1lk3njp.eastus.aroapp.io/geoserver/core/ows"},"WFS Vector layer (Visual)":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw"},"WFS PP layer":{raster_pp_geoserver:"https://raster-serving-int-pp-geoserver-nginx-route-manual-integration.apps.j1lk3njp.eastus.aroapp.io/geoserver/wfs?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJkIjpbInJhc3RlciIsInJhc3RlcldtcyIsInJhc3RlckV4cG9ydCIsImRlbSIsInZlY3RvciIsIjNkIl0sImlhdCI6MTY3NDYzMjM0Niwic3ViIjoibWFwY29sb25pZXMtYXBwIiwiaXNzIjoibWFwY29sb25pZXMtdG9rZW4tY2xpIn0.D1u28gFlxf_Z1bzIiRHZonUgrdWwhZy8DtmQj15cIzaABRUrGV2n_OJlgWTuNfrao0SbUZb_s0_qUUW6Gz_zO3ET2bVx5xQjBu0CaIWdmUPDjEYr6tw-eZx8EjFFIyq3rs-Fo0daVY9cX1B2aGW_GeJir1oMnJUURhABYRoh60azzl_utee9UdhDpnr_QElNtzJZIKogngsxCWp7tI7wkTuNCBaQM7aLEcymk0ktxlWEAt1E0nGt1R-bx-HnPeeQyZlxx4UQ1nuYTijpz7N8poaCCExOFeafj9T7megv2BzTrKWgfM1eai8srSgNa3I5wKuW0EyYnGZxdbJe8aseZg"}},Pe=(e,t)=>Ri[e][t],eo=Pe("GLOBAL","DEFAULT_TERRAIN_PROVIDER_URL");Pe("GLOBAL","TERRAIN_SRTM100"),Pe("GLOBAL","TERRAIN_COMBINED"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-INFRARED_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-RADAR_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-WMTS_POPULATION_TILES-WMTS_LAYER");const wn=(e,t,n)=>{let r;if(e.scene.mode!==g.SceneMode.SCENE2D)r=e.scene.pickPosition(new g.Cartesian2(t,n));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new g.Cartesian2(t,n),s)}return g.Cartographic.fromCartesian(r)},to=(e,t,n)=>{const r=wn(e,t,n);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[g.Math.toDegrees(r.longitude),g.Math.toDegrees(r.latitude)]}}},Tn=(e,t,n)=>{try{const r=wn(e,t,n);return{longitude:g.Math.toDegrees(r.longitude),latitude:g.Math.toDegrees(r.latitude)}}catch{return}},rt=3,it="hasTransparency";function Tt(e,t,n,r,s){return setTimeout(()=>{var h;const o=(h=this.layerListInstance.find(f=>{var E,C;return((E=f._imageryProvider._resource)==null?void 0:E._url)===((C=this._resource)==null?void 0:C._url)}))==null?void 0:h.meta,d=$.get(o,it)===!0;this.tileTransparencyCheckedCounter<rt&&!d&&qi(s==null?void 0:s.url,this).then(f=>{var E;(E=this.mapViewer.layersManager)==null||E.addMetaToLayer({[it]:f},C=>C._imageryProvider._resource._url===this._resource._url)})},0),e(t,n,r,s)}class Ln extends g.UrlTemplateImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}class Sn extends g.WebMapServiceImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}class bn extends g.WebMapTileServiceImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}const no=1,ro=-1,Cn="TRANSPARENT_BASE_LAYER";class io{constructor(t,n,r,s,o){ue(this,"mapViewer");ue(this,"legendsList");ue(this,"layerUpdated");ue(this,"dataLayerUpdated");ue(this,"layers");ue(this,"dataLayers");ue(this,"legendsExtractor");ue(this,"layerManagerFootprintMetaFieldPath");ue(this,"shouldOptimizedTileRequests");this.mapViewer=t,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=n,this.layerUpdated=new g.Event,this.dataLayerUpdated=new g.Event,this.layerManagerFootprintMetaFieldPath=s,this.shouldOptimizedTileRequests=o??!1,r&&this.addLayerUpdatedListener(r),this.shouldOptimizedTileRequests&&(this.addLayerUpdatedListener(d=>{const h=Object.keys(d);h.length===1&&h[0]===it&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())}),this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}))}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}isBaseMapLayer(t){return!!$.get(t,"parentBasetMapId")}addDataLayer(t){this.dataLayers.push({...t}),this.dataLayerUpdated.raiseEvent(this.dataLayers)}addMetaToLayer(t,n){const r=this.layers.map(s=>s.imageryProvider.readyPromise);Promise.all(r).then(s=>{const o=this.layers.find(n);o&&(o.meta={...o.meta??{},...t},this.setLegends(),this.layerUpdated.raiseEvent(t))})}addMetaToDataLayer(t){const n=this.findDataLayerById(t.id);n&&(n.meta={...n.meta??{},...t},this.dataLayerUpdated.raiseEvent(this.dataLayers,t.id))}setBaseMapLayers(t){t.baseRasterLayers.sort((r,s)=>r.zIndex-s.zIndex).forEach((r,s)=>{this.addRasterLayer(r,s,t.id)}),this.shouldOptimizedTileRequests&&(this.removeLayer(Cn),this.addTransparentImageryProvider())}addRasterLayer(t,n,r){let s;switch(t.type){case"XYZ_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Ln(o,this.mapViewer):new g.UrlTemplateImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Sn(o,this.mapViewer):new g.WebMapServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMTS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new bn(o,this.mapViewer):new g.WebMapTileServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}}s&&(s.alpha=t.opacity,s.meta={parentBasetMapId:r,...t},t.show!==void 0&&(s.show=t.show))}removeLayer(t){const n=this.findLayerById(t);n&&this.mapViewer.imageryLayers.remove(n,!0)}removeDataLayer(t){const n=this.findDataLayerById(t);if(n){const r=this.dataLayers.indexOf(n);r>-1&&this.dataLayers.splice(r,1),this.dataLayerUpdated.raiseEvent(this.dataLayers)}}removeBaseMapLayers(){this.layers.filter(n=>this.isBaseMapLayer(n.meta)).forEach(n=>{this.mapViewer.imageryLayers.remove(n,!0)})}removeNotBaseMapLayers(){this.layers.filter(n=>!$.get(n.meta,"parentBasetMapId")).forEach(n=>{this.mapViewer.imageryLayers.remove(n,!0)})}raise(t,n=1){const r=this.findLayerById(t),s=(r==null?void 0:r.meta).zIndex;if(r)for(let o=0;o<n;o++)this.mapViewer.imageryLayers.raise(r);this.updateLayersOrder(t,s,s+n)}lower(t,n=1){const r=this.findLayerById(t),s=(r==null?void 0:r.meta).zIndex,o=this.getBaseLayersCount(),d=this.mapViewer.imageryLayers.indexOf(r);if(d-n<=o&&(n=d-o),r)for(let h=0;h<n;h++)this.mapViewer.imageryLayers.lower(r);this.updateLayersOrder(t,s,s-n)}raiseToTop(t){const n=this.findLayerById(t),r=(n==null?void 0:n.meta).zIndex;n&&this.mapViewer.imageryLayers.raiseToTop(n),this.updateLayersOrder(t,r,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(t){const n=this.findLayerById(t),r=this.getBaseLayersCount(),s=this.mapViewer.imageryLayers.indexOf(n);this.lower(t,s-r)}length(){return this.mapViewer.imageryLayers.length}show(t,n){const r=this.get(t);r!==void 0&&(r.show=n)}showAllNotBase(t){this.layers.filter(r=>!$.get(r.meta,"parentBasetMapId")).forEach(r=>{var s;this.show((s=r.meta)==null?void 0:s.id,t)})}get(t){const n=this.findLayerById(t),r=this.mapViewer.imageryLayers.indexOf(n);return r?this.mapViewer.imageryLayers.get(r):void 0}pickImageryLayers(t){var s;const n=this.mapViewer.camera.getPickRay(t);let r;return n&&(r=(s=this.mapViewer.imageryLayers.pickImageryLayers(n,this.mapViewer.scene))==null?void 0:s.filter(o=>!$.get(o.meta,"parentBasetMapId"))),r}findLayerByPOI(t,n,r=!0){if(this.layerManagerFootprintMetaFieldPath){const s=to(this.mapViewer,t,n);return this.layers.filter(h=>!$.get(h.meta,"parentBasetMapId")).filter(h=>{const f=$.get(h.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?gr(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 E,C;return((E=f.meta)==null?void 0:E.zIndex)-((C=h.meta)==null?void 0:C.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const t=this.mapViewer.imageryLayers.addImageryProvider(new g.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new g.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);t.meta={id:Cn,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}addLayerUpdatedListener(t){this.layerUpdated.addEventListener(t,this)}removeLayerUpdatedListener(t){this.layerUpdated.removeEventListener(t,this)}addDataLayerUpdatedListener(t){this.dataLayerUpdated.addEventListener(t,this)}removeDataLayerUpdatedListener(t){this.dataLayerUpdated.removeEventListener(t,this)}findDataLayerById(t){return this.dataLayers.find(n=>n.meta.id===t)}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(n=>!!$.get(n.meta,"parentBasetMapId")).length}findLayerById(t){return this.layers.find(n=>n.meta!==void 0?n.meta.id===t:!1)}updateLayersOrder(t,n,r){const s=n>r?no:ro,o=n<r?n:r,d=n<r?r:n;this.layers.forEach(h=>{var E;if(!$.get(h.meta,"parentBasetMapId")){const C=(E=h.meta)==null?void 0:E.zIndex;h.meta.zIndex=C>=o&&C<=d&&C!==n?C+s:C===n?r:C}})}hideNonRelevantLayers(){var t,n;for(const r of this.layers)((t=r.meta)==null?void 0:t.relevantToExtent)!==r.show&&r.imageryProvider.ready&&(r.show=((n=r.meta)==null?void 0:n.relevantToExtent)??!0)}markRelevantLayersForExtent(){var t,n;try{const r=this.mapViewer.camera.computeViewRectangle();for(let s=this.layers.length-1;s>=0;s--){const o=this.layers[s],d=!$.isEmpty(r)&&!$.isEmpty(o.rectangle)&&g.Rectangle.intersection(r,o.rectangle);for(let h=this.layers.length-1;h>=s;h--){if(((t=o.meta)==null?void 0:t.skipRelevancyCheck)===!0){o.meta={...o.meta,relevantToExtent:!0};continue}const f=this.layers[h],E=((n=f.meta)==null?void 0:n[it])===!0;if(o!==f)if(d instanceof g.Rectangle){if(nt(r,o.rectangle))if(nt(r,f.rectangle)&&!E){o.meta={...o.meta??{},relevantToExtent:!1};break}else o.meta={...o.meta??{},relevantToExtent:!0};if(nt(r,f.rectangle)&&!E){o.meta={...o.meta??{},relevantToExtent:!1};break}if(nt(o.rectangle,f.rectangle)){if(o.meta={...o.meta??{},relevantToExtent:E},!E)break}else o.meta={...o.meta??{},relevantToExtent:!0}}else o.meta={...o.meta??{},relevantToExtent:!1};else s===this.layers.length-1&&(o.meta={...o.meta??{},relevantToExtent:d instanceof g.Rectangle})}}}catch(r){console.error(r)}}}const _s="",oo=({legend:{legendImg:e,legendDoc:t,layer:n},docText:r,imgText:s})=>{const o=a.useCallback(()=>{window.open(e,"_blank")},[e]);a.useCallback(()=>{window.open(t,"_blank")},[t]);const d=a.useCallback(()=>{const E=i.jsx(Q,{className:"layerNameContainer",children:i.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:n})});return(n??"").length>15?i.jsx(J.Tooltip,{content:n,children:E}):E},[n]),h=a.useCallback(()=>[typeof e=="string"&&i.jsx("a",{className:"legendAction",href:e,target:"_blank",rel:"noreferrer",children:s}),typeof t=="string"&&i.jsx("a",{className:"legendAction",href:t,target:"_blank",rel:"noreferrer",children:r})],[e,s,t,r]);return i.jsxs(Q,{className:"mapLegend",children:[d(),i.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:o}),i.jsx(Q,{className:"legendActionsContainer",children:h()})]})},so=({legends:e,actionsTexts:{docText:t,imgText:n},noLegendsText:r})=>{const s=a.useCallback(()=>i.jsx(Q,{className:"noLegendsContainer",children:i.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),o=a.useCallback(()=>e.length?e.map((d,h)=>i.jsx(oo,{legend:d,docText:t,imgText:n},`${d.layer}_${h}`)):s(),[e]);return i.jsx(Q,{className:"mapLegendsList",children:o()})},ao=({isOpen:e,toggleSidebar:t,title:n="Map Legends",noLegendsText:r="No legends to display...",actionsTexts:s={docText:"Docs",imgText:"View Image"},legends:o=[]})=>e?i.jsxs(J.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[i.jsx(J.DrawerHeader,{className:"sidebarHeaderContainer",children:i.jsx(J.DrawerTitle,{className:"sidebarTitle",children:n})}),i.jsxs(J.DrawerContent,{className:"sidebarContent",children:[i.jsx(J.Icon,{onClick:t,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),i.jsx(so,{noLegendsText:r,legends:o,actionsTexts:s})]})]}):null,lo=({legendToggle:e})=>i.jsx(i.Fragment,{children:i.jsx(et,{onClick:e,children:i.jsxs("svg",{height:"100%",width:"100%",viewBox:"-45 -45 650 650",children:[i.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\r
6
- 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`}),i.jsx("circle",{cx:"270.1",cy:"56.3",r:"56.3"})]})})}),Ps="",Mn=e=>{const t=pe(),{enableCompass:n=!0,enableZoomControls:r=!1,lockCompassNavigation:s=!1,locale:o={DIRECTION:"ltr"}}=e;return a.useEffect(()=>{if(typeof $.get(t,"cesiumNavigation")>"u"){t.extend(pr,{enableCompass:n,enableZoomControls:r,enableDistanceLegend:!1}),t.cesiumNavigation.setNavigationLocked(s);const d=document.querySelector(".compass");d&&o.DIRECTION&&d.classList.add(o.DIRECTION)}},[t,n,r,o.DIRECTION,s]),null},Is="",_n=e=>{const t=pe(),n=a.useRef(null),[r,s]=a.useState({x:0,y:0});return a.useEffect(()=>{t.screenSpaceEventHandler.setInputAction(o=>{if(o!=null&&o.endPosition){const d={...o.endPosition};d.x=Math.ceil(d.x),d.y=Math.ceil(d.y),s(d)}},g.ScreenSpaceEventType.MOUSE_MOVE)},[n,t]),a.useEffect(()=>{const o=t.scene.globe.ellipsoid;if(r){const d=Tn(t,r.x,r.y);if(d){const h=new pn(d.longitude,d.latitude);if(n.current){let f="";switch(e.projection){case be.WEB_MERCATOR:{const C=new g.WebMercatorProjection(o).project(h);f=`Mercator: ${C.y.toFixed(Qe)}m, ${C.x.toFixed(Qe)}m`,n.current.style.width="220px";break}case be.WGS84:{const E=h.longitude.toFixed(Ke);f=`WGS84: ${h.latitude.toFixed(Ke)}°N ${E}°E`,n.current.style.width="200px";break}}n.current.innerHTML=f}}}},[r,n,t,e.projection]),i.jsx("div",{className:"coordinatesTracker",ref:n})},As="",Lt=[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],co=(e,t,n,r)=>{const s=$.get(r,"METERS_UNIT")??"m",o=$.get(r,"KILOMETERS_UNIT")??"km",d={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:t.lastLegendUpdate},h=new g.EllipsoidGeodesic,f=new Date().getTime();if(f<d.lastLegendUpdate+250)return;d.lastLegendUpdate=f;const E=e.scene.canvas.clientWidth,C=e.scene.canvas.clientHeight,b=e.scene.camera.getPickRay(new g.Cartesian2(E/2|0,C-1)),p=e.scene.camera.getPickRay(new g.Cartesian2(1+E/2|0,C-1)),v=e.scene.globe,I=v.pick(b,e.scene),T=v.pick(p,e.scene);if(!I||!T)return;const F=v.ellipsoid.cartesianToCartographic(I),V=v.ellipsoid.cartesianToCartographic(T);h.setEndPoints(F,V);const j=h.surfaceDistance,Y=100;let G;for(let X=Lt.length-1;!$.isNumber(G)&&X>=0;--X)Lt[X]/j<Y&&(G=Lt[X]);if($.isNumber(G)){let X="";G>=1e3?X=`${(G/1e3).toString()} ${o}`:X=`${G.toString()} ${s}`,d.barWidth=G/j|0,d.distanceLabel=X}n(d)},Pn=e=>{const t=pe(),[n,r]=a.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});a.useEffect(()=>{const o=f=>{co(t,n,r,e.locale)},d=new g.EventHelper,h=f=>{t.scene.globe.tilesLoaded&&(o(new MouseEvent("mouse")),d.removeAll())};return d.add(t.scene.globe.tileLoadProgressEvent,h),t.camera.moveEnd.addEventListener(o),()=>{try{$.get(t,"_cesiumWidget")!=null&&t.camera.moveEnd.removeEventListener(o)}catch(f){console.log('CESIUM camera "moveEnd" remove listener failed',f)}}},[t,e.locale,n]);const s=o=>5+(125-o)/2;return i.jsx("div",{className:"scaleTracker",children:$.isNumber(n.barWidth)&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"scaleTrackerLabel",children:i.jsx("bdi",{children:n.distanceLabel})}),i.jsx("div",{className:"scaleTrackerBar",style:{height:"2px",width:`${n.barWidth.toString()}px`,left:`${s(n.barWidth).toString()}px`}})]})})},Ds="",In=()=>{const e=pe(),t=[{onClick:()=>e.camera.zoomIn(),iconPath:"M48 20h-18v-18h-10v18h-18v10h18v18h10v-18h18z"},{onClick:()=>e.camera.zoomOut(),iconPath:"M2 20h46v10h-46z"}];return i.jsx("div",{className:"zoomButtons",children:t.map((n,r)=>i.jsx(J.Icon,{icon:i.jsx("div",{className:"zoomButton",children:i.jsx("svg",{fill:"var(--mdc-theme-cesium-color)",width:"12px",height:"12px",viewBox:"0 -20 50 50",version:"1.2",baseProfile:"tiny",xmlns:"http://www.w3.org/2000/svg",overflow:"inherit",children:i.jsx("path",{d:n.iconPath})})}),onClick:n.onClick},r))})},Os="",An=(e,t)=>{const r=$.get(t.scene.globe,"_surface.tileProvider"),s=r._quadtree,o=t.canvas.height,d=$.get(t.camera.frustum,"sseDenominator")??1;for(let h=0;h<=19;h++)if(r.getLevelMaximumGeometricError(h)*o/(e*d)<s.maximumScreenSpaceError)return h;return null},uo=(e,t)=>{e=e||10;const n=[];let r=1e5,s=0;for(let o=1e8;o>r;o=o-r){const d=An(o,t);if(d===null)break;if(d!==s){let h=o,f=o+r;for(;f-h>e;)o=h+(f-h)/2,An(o,t)===d?h=o:f=o;n.push({level:d,height:Math.round(o)}),s=d,n.length>=2&&(r=(n[n.length-2].height-o)/1e3)}}return n},Dn=({locale:e=void 0,valueBy:t="RENDERED_TILES"})=>{const n=pe(),r=Fe(),[s,o]=a.useState(1),d=uo(1,n),h=a.useCallback(()=>{const b=n.camera,p=.5;let v=0;switch(n.scene.mode){case tt.SCENE3D:v=n.scene.mapProjection.ellipsoid.cartesianToCartographic(b.positionWC).height;break;case tt.SCENE2D:v=(b.frustum.right-b.frustum.left)*p;break;case tt.COLUMBUS_VIEW:v=b.position.z;break;default:v=0;break}if(d.length>0){const I=d.reduce((T,F)=>Math.abs(F.height-v)<Math.abs(T.height-v)?F:T);o(I.level),r.setViewState&&r.setViewState(T=>({...T,currentZoomLevel:I.level}))}},[n,d]),f=a.useCallback(()=>{let b=0;n.scene.globe._surface.forEachRenderedTile(function(p){b=Math.max(b,p.level)}),o(b),r.setViewState&&r.setViewState(p=>({...p,currentZoomLevel:b}))},[n]),C=a.useMemo(()=>({CALCULATION:h,RENDERED_TILES:f}),[h,f])[t];return a.useEffect(()=>{const b=n.scene.globe.tileLoadProgressEvent.addEventListener(function(){n.scene.globe.tilesLoaded&&C()});return n.camera.moveEnd.addEventListener(C),()=>{try{typeof $.get(n,"_cesiumWidget")<"u"&&(n.camera.moveEnd.removeEventListener(C),b())}catch(p){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',p)}}},[n,C]),i.jsxs("div",{className:"zoomLevel",children:[i.jsx("div",{className:"zoomLevelValue",children:s}),i.jsx("div",{className:"zoomLevelLabel",children:$.get(e,"ZOOM_LABEL")??"zoom"})]})},ks="",On=2,kn=212,xn=260,ho=0;class go extends g.Viewer{constructor(n,r){super(n,r);ue(this,"layersManager")}}const St=a.createContext(null),po=St.Provider,pe=()=>{const e=a.useContext(St);if(e===null)throw new Error("map context is null, please check the provider");return e.mapViewer},Fe=()=>{const{mapViewer:e,...t}=a.useContext(St);if(t===null)throw new Error("map context viewstate is null, please check the provider");return t},fo=e=>{var me,ye,Ie,Ge,We,jn,Yn,Zn;const t=a.useRef(null),[n,r]=a.useState(),[s,o]=a.useState(),[d,h]=a.useState(),[f,E]=a.useState(),[C,b]=a.useState(),[p,v]=a.useState(),[I,T]=a.useState(),[F,V]=a.useState(),[j,Y]=a.useState(),[G,X]=a.useState(),[W,Z]=a.useState(!1),[ee,l]=a.useState(!1),c=a.useRef(),[_,y]=a.useState([]),[S,w]=a.useState(),[P,m]=a.useState(),[L,k]=a.useState(!1),N=a.useRef(),[A,O]=a.useState(void 0),[B,te]=a.useState(!1),[ne,q]=a.useState(),[R,ie]=a.useState(),ge=J.useTheme(),ve=zt(ge),oe=a.useMemo(()=>W||ee,[W,ee]);a.useEffect(()=>{ie({currentZoomLevel:-1,shouldOptimizedTileRequests:e.useOptimizedTileRequests??!1})},[]);const fe={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:$.isNumber(e.zoom)&&$.isArray(e.center),sceneModePicker:!0,imageryProvider:!1,...e},D=(se,de,le,Ee,Ce)=>{const De=n.container,Ae=De.clientWidth,ze=De.clientHeight,Xn=Ee+Ce;return{left:`${Ae-se<le?se-(le-(Ae-se)):se}px`,top:`${ze-de<Xn?de-(Xn-(ze-de)):de}px`}},x=a.useCallback(se=>{if(t.current!==null){const de=t.current.cesiumElement,le={x:se.offsetX,y:se.offsetY};k(!1),O(le),q(Tn(de,le.x,le.y)),k(!0),N.current=se}},[t]);a.useEffect(()=>{var se;if(t.current!==null){const de=t.current.cesiumElement;e.imageryContextMenu&&(de.scene.canvas.removeEventListener("contextmenu",x),de.scene.canvas.addEventListener("contextmenu",x))}r((se=t.current)==null?void 0:se.cesiumElement)},[t,e.imageryContextMenu]);const H=a.useMemo(()=>{var se;if(n)return{mapViewer:n.layersManager?n:Object.assign(n,{layersManager:new io(n,(se=e.legends)==null?void 0:se.mapLegendsExtractor,()=>{var le;y((le=n.layersManager)==null?void 0:le.legendsList)},e.layerManagerFootprintMetaFieldPath,R==null?void 0:R.shouldOptimizedTileRequests)}),viewState:R,setViewState:ie}},[e.useOptimizedTileRequests,e.legends,e.layerManagerFootprintMetaFieldPath,n,R]);a.useEffect(()=>{var de,le;w(e.baseMaps);const se=(de=e.baseMaps)==null?void 0:de.maps.find(Ee=>Ee.isCurrent);se&&n&&((le=n.layersManager)==null||le.setBaseMapLayers(se))},[e.baseMaps,n]),a.useEffect(()=>{const se=e.terrains||(n&&n.terrainProvider?[{id:"1",url:eo,title:"Default Terrain",thumbnail:"Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png",isCurrent:!0,terrainProvider:n.terrainProvider}]:void 0);m(se)},[e.terrains,n]),a.useEffect(()=>{h(e.projection??be.WGS84)},[e.projection]),a.useEffect(()=>{o(e.locale)},[e.locale]),a.useEffect(()=>{E(e.showMousePosition??!0)},[e.showMousePosition]),a.useEffect(()=>{b(e.showZoomLevel??!0)},[e.showZoomLevel]),a.useEffect(()=>{v(e.showScale??!0)},[e.showScale]),a.useEffect(()=>{T(e.showCompass??!0)},[e.showCompass]),a.useEffect(()=>{X(e.showLoadingProgress??!0)},[e.showLoadingProgress]),a.useEffect(()=>{Y(e.showActiveLayersTool??!0)},[e.showActiveLayersTool]),a.useEffect(()=>{var de;const se=()=>{if(n===void 0)return{longitude:0,latitude:0,height:0};const le=()=>{const Ee=n.camera.positionCartographic;return{longitude:Re(Ee.longitude),latitude:Re(Ee.latitude),height:Ee.height}};if(n.scene.mode===g.SceneMode.SCENE3D){const Ee=new g.Cartesian2(n.container.clientWidth/On,n.container.clientHeight/On),Ce=n.scene.camera.getPickRay(Ee),De=n.scene.globe.pick(Ce,n.scene);if(!De)return{longitude:0,latitude:0,height:0};const Ae=n.scene.globe.ellipsoid.cartesianToCartographic(De);return Ae!==void 0?{longitude:Re(Ae.longitude),latitude:Re(Ae.latitude),height:n.scene.camera.positionCartographic.height}:le()}else return le()};n&&(n.camera.moveEnd.addEventListener(()=>{if(n.scene.mode!==g.SceneMode.MORPHING){const le=n.camera,Ee={position:se(),direction:le.direction.clone(),up:le.up.clone(),right:le.right.clone(),transform:le.transform.clone(),frustum:le.frustum.clone()};c.current=Ee}}),G&&(n.scene.globe.tileLoadProgressEvent.addEventListener(function(){n.scene.globe.tilesLoaded?Z(!1):Z(!0)}),(de=n.layersManager)==null||de.addDataLayerUpdatedListener(()=>{var Ee;let le=!1;(Ee=n.layersManager)==null||Ee.dataLayerList.forEach(Ce=>{if(typeof Ce.meta.items=="number"&&typeof Ce.meta.total=="number"&&Ce.meta.items>0&&Ce.meta.items<Ce.meta.total){le=!0;return}}),l(le)})))},[n]),a.useEffect(()=>{const se=()=>{if(n&&c.current){const de=c.current;n.camera.flyTo({destination:g.Cartesian3.fromDegrees(de.position.longitude,de.position.latitude,de.position.height),duration:0})}};return n&&n.scene.morphComplete.addEventListener(se),()=>{if(n)try{n.scene.morphComplete.removeEventListener(se)}catch{console.error("morphCompleteHandler event not cleaned")}}},[n]),a.useEffect(()=>{const se=e.zoom,de=e.center;if(n&&$.isNumber(se)&&$.isArray(de)){const le=de[0],Ee=de[1],Ce=gi(se);n.camera.flyTo({destination:g.Cartesian3.fromDegrees(le,Ee,Ce),duration:0});const De=n.homeButton.viewModel.command,Ae=function(ze){n.camera.flyTo({destination:g.Cartesian3.fromDegrees(le,Ee,Ce),duration:1}),ze.cancel=!0};return De.beforeExecute.addEventListener(Ae),()=>{De.beforeExecute.removeEventListener(Ae);try{De.beforeExecute.removeEventListener(Ae)}catch{console.error("customHomeButtonHandler event not cleaned")}}}},[e.zoom,e.center,n]),a.useEffect(()=>{V(e.showZoomButtons??!0)},[e.showZoomButtons]);const z=()=>{te(se=>!se)},U=a.useCallback(()=>n&&ut.createPortal(i.jsxs(i.Fragment,{children:[G&&oe&&i.jsx(J.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),I&&i.jsx(Mn,{locale:s}),i.jsxs(Q,{className:"bottomToolsContainer",children:[f&&i.jsx(_n,{projection:d}),C&&i.jsx(Dn,{locale:s,valueBy:"RENDERED_TILES"}),p&&i.jsx(Pn,{locale:s})]}),F&&i.jsx(In,{})]}),document.querySelector(".cesium-viewer")),[n,s,d,f,p,oe]),K=a.useCallback(()=>n&&ut.createPortal(i.jsxs(i.Fragment,{children:[e.geocoderPanel&&i.jsx(Qi,{options:[...e.geocoderPanel],locale:s}),i.jsx(wi,{baseMaps:S,terrains:P,locale:s}),e.showDebuggerTool&&i.jsx(Li,{locale:s}),i.jsx(lo,{legendToggle:z})]}),document.querySelector(".cesium-viewer-toolbar")),[n,s,S,P]),ce=a.useCallback(()=>n&&ut.createPortal(i.jsx(Q,{className:"cesium-viewer-cesiumInspectorContainer widgetsContainer",children:j&&i.jsx(yi,{locale:s})}),document.querySelector(".cesium-widget")),[n,s]);return i.jsx(J.ThemeProvider,{id:"cesiumTheme",options:ve,children:i.jsx(Me.Viewer,{className:"viewer",full:!0,ref:t,...fe,children:i.jsxs(po,{value:H,children:[i.jsx(ao,{title:(me=e.legends)==null?void 0:me.title,isOpen:B,toggleSidebar:z,noLegendsText:(ye=e.legends)==null?void 0:ye.emptyText,legends:((Ie=e.legends)==null?void 0:Ie.legendsList)??_,actionsTexts:(Ge=e.legends)==null?void 0:Ge.actionsTexts}),e.children,U(),K(),ce(),e.imageryContextMenu&&L&&A&&ne&&a.cloneElement(e.imageryContextMenu,{data:(We=n==null?void 0:n.layersManager)==null?void 0:We.findLayerByPOI(A.x,A.y,!1),position:{x:A.x,y:A.y},coordinates:ne,style:D(A.x,A.y,((jn=e.imageryContextMenuSize)==null?void 0:jn.width)??xn,((Yn=e.imageryContextMenuSize)==null?void 0:Yn.height)??kn,((Zn=e.imageryContextMenuSize)==null?void 0:Zn.dynamicHeightIncrement)??ho),size:e.imageryContextMenuSize??{height:kn,width:xn},handleClose:()=>{k(!L)},contextEvt:N.current})]})})})},mo=0,yo=e=>{const t=pe();return i.jsx(Me.Cesium3DTileset,{...e,onReady:n=>{e.isZoomTo===!0&&t.zoomTo(n);const r=t.scene;r.globe.depthTestAgainstTerrain=!0;const s=g.Cartographic.fromCartesian(n.boundingSphere.center),o=e.heightFromGround??mo;if(o){const d=g.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),h=g.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+o),f=g.Cartesian3.subtract(h,d,new g.Cartesian3);n.modelMatrix=g.Matrix4.fromTranslation(f)}}})},ot=180,Nn=.001,Bn=e=>Math.abs(e)/e,Fn=e=>{ot-Math.abs(e[0])<Nn&&(e[0]=Bn(e[0])*(ot-1)),ot/2-Math.abs(e[1])<Nn&&(e[1]=Bn(e[1])*(ot/2-1))},Gn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(t=>{Fn(t)});break;case"Polygon":e.coordinates.forEach(t=>{t.forEach(n=>{Fn(n)})});break}},vo=e=>{const{data:t,...n}=e,r=$.cloneDeep(t);return r&&(typeof r.features<"u"?r.features.forEach(s=>{Gn(s.geometry)}):Gn(r)),i.jsx(Me.GeoJsonDataSource,{data:r,...n})},He=e=>{const{meta:t,...n}=e,r=pe();return a.useLayoutEffect(()=>{var s;(s=r.layersManager)==null||s.addMetaToLayer(t,t.searchLayerPredicate)},[t,r]),i.jsx(Me.ImageryLayer,{...n})},Eo=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=Fe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new Sn(t,r):new g.WebMapServiceImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},wo=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=Fe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new bn(t,r):new g.WebMapTileServiceImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},To=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=Fe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new Ln(t,r):new g.UrlTemplateImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},Lo=e=>{const{options:t,...n}=e;return i.jsx(He,{...n,imageryProvider:new g.OpenStreetMapImageryProvider(t)})},So=e=>{const{options:t,meta:n,visualizationHandler:r,withGeometryValidation:s=!1}=e,{url:o,featureType:d,style:h,pageSize:f,zoomLevel:E,maxCacheSize:C,keyField:b,labeling:p}=t,{color:v,hover:I}=h,T=pe(),F=Fe(),V=a.useRef(F.viewState),j=a.useRef(new Map),Y=a.useRef(new Set),G=a.useRef(0),[X,W]=a.useState(n),Z=a.useMemo(()=>g.Color.fromCssColorString(I??"#24AEE9").withAlpha(.5),[I]),ee=a.useMemo(()=>`wfs_${d}_${Bt.v4()}`,[d]),l=a.useRef(!1);a.useEffect(()=>{V.current=F.viewState},[F.viewState]);const c=new g.GeoJsonDataSource(ee),_=D=>{const x=[],H=n.featureStructure;if(H&&H.fields)for(const U of H.fields){const{fieldName:K,aliasFieldName:ce}=U,me=ce,ye=D[K]??"N/A",Ie=Math.max(100,Math.min(180,me.length*10)),Ge="260px";x.push(`
5
+ `),verticalOrigin:u.VerticalOrigin.BOTTOM,heightReference:u.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})}}),e.dataSources.remove(e.dataSources.getByName(`${s==null?void 0:s.dataSourcePrefix}${t.name}`)[0]),s&&d){const v=new u.GeoJsonDataSource(`${s==null?void 0:s.dataSourcePrefix}${t.name}`);e.dataSources.add(v),v.load({type:"FeatureCollection",features:C}).then(y=>{y==null||y.entities.values.forEach(D=>{var V;D.billboard=new u.BillboardGraphics({image:(V=D.properties)==null?void 0:V.label.getValue(u.JulianDate.now()).dataURL,heightReference:u.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})})})}},ji=.2,Yi=(e,t=ji)=>e.width===0?(e.east=e.east+1e-4*t,e.west=e.west-1e-4*t,e.south=e.south-1e-4*t,e.north=e.north+1e-4*t,e):(e.east=e.east+e.width*t,e.west=e.west-e.width*t,e.south=e.south-e.height*t,e.north=e.north+e.height*t,e),ze=3,Ue="hasTransparency",Lr="examinedTiles";function yt(e,t,r,n,o){return setTimeout(()=>{var g,f;const s=(g=this.layerListInstance.find(w=>{var S,C;return((S=w._imageryProvider._resource)==null?void 0:S._url)===((C=this._resource)==null?void 0:C._url)}))==null?void 0:g.meta,d=z.get(s,Ue)===!0;this.tileTransparencyCheckedCounter<ze&&!d&&(console.log(JSON.stringify({x:t,y:r,level:n})),this.examinedTilesForTransparencyCheck=[...this.examinedTilesForTransparencyCheck,{x:t,y:r,level:n}].slice(0,ze),(f=this.mapViewer.layersManager)==null||f.addMetaToLayer({[Lr]:this.examinedTilesForTransparencyCheck},w=>w._imageryProvider._resource._url===this._resource._url),Hi(o==null?void 0:o.url,this).then(w=>{var S;(S=this.mapViewer.layersManager)==null||S.addMetaToLayer({[Ue]:w},C=>C._imageryProvider._resource._url===this._resource._url)}))},0),e(t,r,n,o)}class wr extends u.UrlTemplateImageryProvider{constructor(r,n){var o;super(r);ce(this,"layerListInstance");ce(this,"mapViewer");ce(this,"maxTilesForTransparencyCheck",ze);ce(this,"tileTransparencyCheckedCounter",0);ce(this,"examinedTilesForTransparencyCheck",[]);this.layerListInstance=(o=n.layersManager)==null?void 0:o.layerList,this.mapViewer=n}requestImage(r,n,o,s){return yt.call(this,super.requestImage.bind(this),r,n,o,s)}}class br extends u.WebMapServiceImageryProvider{constructor(r,n){var o;super(r);ce(this,"layerListInstance");ce(this,"mapViewer");ce(this,"maxTilesForTransparencyCheck",ze);ce(this,"tileTransparencyCheckedCounter",0);ce(this,"examinedTilesForTransparencyCheck",[]);this.layerListInstance=(o=n.layersManager)==null?void 0:o.layerList,this.mapViewer=n}requestImage(r,n,o,s){return yt.call(this,super.requestImage.bind(this),r,n,o,s)}}class Sr extends u.WebMapTileServiceImageryProvider{constructor(r,n){var o;super(r);ce(this,"layerListInstance");ce(this,"mapViewer");ce(this,"maxTilesForTransparencyCheck",ze);ce(this,"tileTransparencyCheckedCounter",0);ce(this,"examinedTilesForTransparencyCheck",[]);this.layerListInstance=(o=n.layersManager)==null?void 0:o.layerList,this.mapViewer=n}requestImage(r,n,o,s){return yt.call(this,super.requestImage.bind(this),r,n,o,s)}}const Zi=1,Xi=-1,Oe="TRANSPARENT_BASE_LAYER";class Ji{constructor(t,r,n,o,s){ce(this,"mapViewer");ce(this,"legendsList");ce(this,"layerUpdated");ce(this,"dataLayerUpdated");ce(this,"layers");ce(this,"dataLayers");ce(this,"legendsExtractor");ce(this,"layerManagerFootprintMetaFieldPath");ce(this,"shouldOptimizedTileRequests");ce(this,"relevancyListenersCleanup");ce(this,"relevancyLayerUpdatedHandler");this.mapViewer=t,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=r,this.layerUpdated=new u.Event,this.dataLayerUpdated=new u.Event,this.layerManagerFootprintMetaFieldPath=o,this.shouldOptimizedTileRequests=s??!1,this.relevancyListenersCleanup=[],n&&this.addLayerUpdatedListener(n),this.shouldOptimizedTileRequests&&this.bindRelevancyListeners()}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}isBaseMapLayer(t){return!!z.get(t,"parentBasetMapId")}addDataLayer(t){this.dataLayers.push({...t}),this.dataLayerUpdated.raiseEvent(this.dataLayers)}addMetaToLayer(t,r){const n=this.layers.map(o=>o.imageryProvider.readyPromise);Promise.all(n).then(()=>{const o=this.layers.find(r);o&&(o.meta={...o.meta??{},...t},this.setLegends(),this.layerUpdated.raiseEvent(t))})}addMetaToDataLayer(t){const r=this.findDataLayerById(t.id);r&&(r.meta={...r.meta??{},...t},this.dataLayerUpdated.raiseEvent(this.dataLayers,t.id))}setBaseMapLayers(t){t.baseRasterLayers.sort((n,o)=>n.zIndex-o.zIndex).forEach((n,o)=>{this.addRasterLayer(n,o,t.id)}),this.shouldOptimizedTileRequests&&(this.removeLayer(Oe),this.addTransparentImageryProvider())}addRasterLayer(t,r,n){let o;switch(t.type){case"XYZ_LAYER":{const s=t.options,d=this.shouldOptimizedTileRequests?new wr(s,this.mapViewer):new u.UrlTemplateImageryProvider(s);o=this.mapViewer.imageryLayers.addImageryProvider(d,r);break}case"WMS_LAYER":{const s=t.options,d=this.shouldOptimizedTileRequests?new br(s,this.mapViewer):new u.WebMapServiceImageryProvider(s);o=this.mapViewer.imageryLayers.addImageryProvider(d,r);break}case"WMTS_LAYER":{const s=t.options,d=this.shouldOptimizedTileRequests?new Sr(s,this.mapViewer):new u.WebMapTileServiceImageryProvider(s);o=this.mapViewer.imageryLayers.addImageryProvider(d,r);break}}o&&(o.alpha=t.opacity,o.meta={parentBasetMapId:n,...t},t.show!==void 0&&(o.show=t.show))}removeLayer(t){const r=this.findLayerById(t);r&&this.mapViewer.imageryLayers.remove(r,!0)}removeDataLayer(t){const r=this.findDataLayerById(t);if(r){const n=this.dataLayers.indexOf(r);n>-1&&this.dataLayers.splice(n,1),this.dataLayerUpdated.raiseEvent(this.dataLayers)}}removeBaseMapLayers(){this.layers.filter(r=>this.isBaseMapLayer(r.meta)).forEach(r=>{this.mapViewer.imageryLayers.remove(r,!0)})}removeNotBaseMapLayers(){this.layers.filter(r=>!z.get(r.meta,"parentBasetMapId")).forEach(r=>{this.mapViewer.imageryLayers.remove(r,!0)})}raise(t,r=1){const n=this.findLayerById(t),o=(n==null?void 0:n.meta).zIndex;if(n)for(let s=0;s<r;s++)this.mapViewer.imageryLayers.raise(n);this.updateLayersOrder(t,o,o+r)}lower(t,r=1){const n=this.findLayerById(t),o=(n==null?void 0:n.meta).zIndex,s=this.getBaseLayersCount(),d=this.mapViewer.imageryLayers.indexOf(n);if(d-r<=s&&(r=d-s),n)for(let g=0;g<r;g++)this.mapViewer.imageryLayers.lower(n);this.updateLayersOrder(t,o,o-r)}raiseToTop(t){const r=this.findLayerById(t),n=(r==null?void 0:r.meta).zIndex;r&&this.mapViewer.imageryLayers.raiseToTop(r),this.updateLayersOrder(t,n,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(t){const r=this.findLayerById(t),n=this.getBaseLayersCount(),o=this.mapViewer.imageryLayers.indexOf(r);this.lower(t,o-n)}length(){return this.mapViewer.imageryLayers.length}show(t,r){const n=this.get(t);n!==void 0&&(n.show=r)}showAllNotBase(t){this.layers.filter(n=>!z.get(n.meta,"parentBasetMapId")).forEach(n=>{var o;this.show((o=n.meta)==null?void 0:o.id,t)})}get(t){const r=this.findLayerById(t),n=this.mapViewer.imageryLayers.indexOf(r);return n?this.mapViewer.imageryLayers.get(n):void 0}pickImageryLayers(t){var o;const r=this.mapViewer.camera.getPickRay(t);let n;return r&&(n=(o=this.mapViewer.imageryLayers.pickImageryLayers(r,this.mapViewer.scene))==null?void 0:o.filter(s=>!z.get(s.meta,"parentBasetMapId"))),n}findLayerByPOI(t,r,n=!0){if(this.layerManagerFootprintMetaFieldPath){const o=yi(this.mapViewer,t,r);return this.layers.filter(g=>!z.get(g.meta,"parentBasetMapId")).filter(g=>{const f=z.get(g.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?un(o.geometry,{type:"Feature",properties:{},geometry:f})&&(n?g.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",g.meta),!1)}).sort((g,f)=>{var w,S;return((w=f.meta)==null?void 0:w.zIndex)-((S=g.meta)==null?void 0:S.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI] layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const t="/assets/img/transparent-tile.png",r=this.mapViewer.imageryLayers.addImageryProvider(new u.SingleTileImageryProvider({url:t,rectangle:new u.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);r.meta={id:Oe,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}addLayerUpdatedListener(t){this.layerUpdated.addEventListener(t,this)}removeLayerUpdatedListener(t){this.layerUpdated.removeEventListener(t,this)}addDataLayerUpdatedListener(t){this.dataLayerUpdated.addEventListener(t,this)}removeDataLayerUpdatedListener(t){this.dataLayerUpdated.removeEventListener(t,this)}setShouldOptimizedTileRequests(t){if(this.shouldOptimizedTileRequests!==t){if(this.shouldOptimizedTileRequests=t,t){this.bindRelevancyListeners(),this.removeLayer(Oe),this.addTransparentImageryProvider(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers();return}this.unbindRelevancyListeners(),this.removeLayer(Oe),this.restoreAllLayersVisibility(),this.clearLayersRelevancy()}}findDataLayerById(t){return this.dataLayers.find(r=>r.meta.id===t)}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(r=>!!z.get(r.meta,"parentBasetMapId")).length}findLayerById(t){return this.layers.find(r=>r.meta!==void 0?r.meta.id===t:!1)}updateLayersOrder(t,r,n){const o=r>n?Zi:Xi,s=r<n?r:n,d=r<n?n:r;this.layers.forEach(g=>{var w;if(!z.get(g.meta,"parentBasetMapId")){const S=(w=g.meta)==null?void 0:w.zIndex;g.meta.zIndex=S>=s&&S<=d&&S!==r?S+o:S===r?n:S}})}hideNonRelevantLayers(){var t,r;for(const n of this.layers){if(((t=n.meta)==null?void 0:t.id)===Oe)continue;const o=(r=n.meta)==null?void 0:r.relevantToExtent;typeof o=="boolean"&&o!==n.show&&n.imageryProvider.ready&&(n.show=o)}}restoreAllLayersVisibility(){var t;for(const r of this.layers)((t=r.meta)==null?void 0:t.id)!==Oe&&r.imageryProvider.ready&&(r.show=!0)}clearLayersRelevancy(){var t;for(const r of this.layers)if(((t=r.meta)==null?void 0:t.id)!==Oe&&r.meta&&"relevantToExtent"in r.meta){const{relevantToExtent:n,...o}=r.meta;r.meta=o}}bindRelevancyListeners(){if(this.relevancyListenersCleanup.length>0)return;this.relevancyLayerUpdatedHandler=s=>{const d=Object.keys(s);d.length===1&&d[0]===Ue&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())},this.addLayerUpdatedListener(this.relevancyLayerUpdatedHandler),this.relevancyListenersCleanup.push(()=>{this.relevancyLayerUpdatedHandler&&this.removeLayerUpdatedListener(this.relevancyLayerUpdatedHandler)});const t=this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()});this.relevancyListenersCleanup.push(t);const r=this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()});this.relevancyListenersCleanup.push(r);const n=this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()});this.relevancyListenersCleanup.push(n);const o=this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()});this.relevancyListenersCleanup.push(o)}unbindRelevancyListeners(){this.relevancyListenersCleanup.forEach(t=>{t()}),this.relevancyListenersCleanup=[],this.relevancyLayerUpdatedHandler=void 0}markRelevantLayersForExtent(){var t,r,n;try{const o=this.mapViewer.camera.computeViewRectangle();if(z.isEmpty(o))return;for(let s=this.layers.length-1;s>=0;s--){const d=this.layers[s],g=!z.isEmpty(d.rectangle)&&u.Rectangle.intersection(o,d.rectangle)instanceof u.Rectangle;if(((t=d.meta)==null?void 0:t.skipRelevancyCheck)===!0){d.meta={...d.meta,relevantToExtent:!0};continue}if(!g){d.meta={...d.meta??{},relevantToExtent:!1};continue}let f=!1;for(let w=this.layers.length-1;w>s;w--){const S=this.layers[w];if(S.show===!1)continue;const C=((r=S.meta)==null?void 0:r[Ue])===!0,v=((n=S.meta)==null?void 0:n[Ue])===!1,y=!z.isEmpty(S.rectangle)&&u.Rectangle.intersection(o,S.rectangle)instanceof u.Rectangle,D=!z.isEmpty(S.rectangle)&&Wi(o,S.rectangle);if(y&&D&&v&&!C){f=!0;break}}d.meta={...d.meta??{},relevantToExtent:!f}}}catch(o){console.error(o)}}}const bs="",vt="Imagery",Et="Data",Ki=({locale:e})=>{var C,v;const t=fe(),[r,n]=a.useState([{id:vt,values:[]},{id:Et,values:[]}]),[o,s]=a.useState({}),d=y=>z.get(e,y.toUpperCase())??y,g=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(y,D)=>{var G;const V=t.imageryLayers.get(D),I=V.meta;return{id:I==null?void 0:I.id,name:z.get(I,"layerRecord.productName")??(I==null?void 0:I.id),rect:V.rectangle,isBaseMap:(G=t.layersManager)==null?void 0:G.isBaseMapLayer(I)}}).filter(y=>y.id!==Oe):[],f=()=>{var y;return((y=t.layersManager)==null?void 0:y.dataLayerList.map(D=>{var V,I;return{id:(V=D.meta)==null?void 0:V.id,name:z.get(D.meta,"featureStructure.aliasLayerName")??D.meta.productName,rect:u.Rectangle.fromDegrees(...Xe((I=D.meta)==null?void 0:I.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const D=[{id:vt,values:g()},{id:Et,values:f()}];n(D),s(D.reduce((V,I)=>({...V,[I.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const y=()=>{n(D=>D.map(V=>V.id===vt?{...V,values:g()}:V))};return t.layersManager.addLayerUpdatedListener(y),t.imageryLayers.layerRemoved.addEventListener(y),()=>{var D;z.get(t,"_cesiumWidget")!==void 0&&((D=t.layersManager)==null||D.removeLayerUpdatedListener(y),t.imageryLayers.layerRemoved.removeEventListener(y))}},[(C=t.layersManager)==null?void 0:C.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const y=()=>{n(D=>D.map(V=>V.id===Et?{...V,values:f()}:V))};return t.layersManager.addDataLayerUpdatedListener(y),()=>{var D;(D=t.layersManager)==null||D.removeDataLayerUpdatedListener(y)}},[(v=t.layersManager)==null?void 0:v.dataLayerList]);const w=y=>{s(D=>({...D,[y]:!D[y]}))},S=y=>{t.camera.flyTo({destination:y})};return i.jsx(U,{className:"activeLayersPanel",children:r.filter(y=>y.values.length>0).map(y=>i.jsxs(U,{className:`cesium-cesiumInspector-section ${o[y.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>w(y.id),children:[i.jsx(ee.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(y.id)}),i.jsx(U,{className:"cesium-cesiumInspector-sectionContent",children:y.values.map(D=>i.jsxs(U,{className:"layer",children:[i.jsx(ee.Tooltip,{content:D.name,children:i.jsx(U,{className:`name ${D.isBaseMap?"disabled":""}`,children:D.name})}),i.jsx(U,{className:"icons",children:i.jsx(ee.Tooltip,{content:z.get(e,"FLY_TO")??"Fly To",children:i.jsx(U,{className:"icon",onClick:V=>{V.stopPropagation(),S(D.rect)},children:i.jsxs("svg",{fill:"var(--mdc-theme-cesium-color)",width:"100%",height:"100%",viewBox:"0 0 256 256",children:[i.jsx("path",{d:"M236,120H223.66406A96.15352,96.15352,0,0,0,136,32.33618V20a8,8,0,0,0-16,0V32.33618A96.15352,96.15352,0,0,0,32.33594,120H20a8,8,0,0,0,0,16H32.33594A96.15352,96.15352,0,0,0,120,223.66382V236a8,8,0,0,0,16,0V223.66382A96.15352,96.15352,0,0,0,223.66406,136H236a8,8,0,0,0,0-16Zm-40,16h11.59912A80.14164,80.14164,0,0,1,136,207.59912V196a8,8,0,0,0-16,0v11.59912A80.14164,80.14164,0,0,1,48.40088,136H60a8,8,0,0,0,0-16H48.40088A80.14164,80.14164,0,0,1,120,48.40088V60a8,8,0,0,0,16,0V48.40088A80.14164,80.14164,0,0,1,207.59912,120H196a8,8,0,0,0,0,16Z"}),i.jsx("polygon",{points:"128,80 80,170 128,150 176,170",fill:"var(--mdc-theme-cesium-color)"})]})})})})]},D.id))})]},y.id))})},Qi=({locale:e})=>{const[t,r]=a.useState(!1),n=a.useMemo(()=>z.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(mi,{title:n,isVisible:t,onClick:()=>r(!t),children:i.jsx(Ki,{locale:e})})},ot=({onClick:e,children:t})=>i.jsx("div",{className:"cesium-toolbar-button cesium-button",onClick:e,children:t}),Tt=({title:e})=>i.jsx(U,{className:"cesium-mc-title",children:e}),Lt=({isVisible:e,children:t,title:r})=>i.jsxs(U,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[r&&i.jsx(Tt,{title:r}),t]}),Ss="";function wt(e){return function(r){const n=a.useRef(null),[o,s]=a.useState(!1);return a.useEffect(()=>{if(!o)return;const d=g=>{const f=g.target;n.current&&!n.current.contains(f)&&s(!1)};return document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}},[o]),i.jsx("div",{ref:n,className:"disappear",children:i.jsx(e,{...r,isOpen:o,setIsOpen:s})})}}const Cr=({item:e,isSelected:t,onClick:r})=>i.jsxs(U,{className:`cesium-baseLayerPicker-item ${t?"cesium-baseLayerPicker-selectedItem":""}`,title:e.title,onClick:r,children:[i.jsx("img",{className:"cesium-baseLayerPicker-itemIcon",src:e.thumbnail,alt:e.title}),i.jsx(U,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),Ri=({title:e,baseMaps:t,setCurrent:r})=>{const n=fe(),[o,s]=a.useState();a.useEffect(()=>{const g=t.maps.find(f=>f.isCurrent);g&&(s(g),r(g))},[t]);const d=g=>{var w,S;(w=n.layersManager)==null||w.removeBaseMapLayers();const f=t.maps.find(C=>C.id===g);f&&((S=n.layersManager)==null||S.setBaseMapLayers(f),s(f),r(f),t.maps.forEach(C=>{C.isCurrent=f===C}))};return i.jsxs(i.Fragment,{children:[i.jsx(Tt,{title:e}),i.jsx(U,{className:"cesium-mc-choices",children:t.maps.map(g=>i.jsx(Cr,{item:g,isSelected:o===g,onClick:()=>d(g.id)},g.id))})]})},eo=({title:e,terrains:t})=>{const[r,n]=a.useState(),o=fe();a.useEffect(()=>{const d=t.find(g=>g.isCurrent);d&&n(d)},[t]);const s=d=>{const g=t.find(f=>f.id===d);g&&(o.terrainProvider=g.terrainProvider??new u.EllipsoidTerrainProvider({}),n(g),t.forEach(f=>{f.isCurrent=g===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(Tt,{title:e}),i.jsx(U,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(Cr,{item:d,isSelected:r===d,onClick:()=>s(d.id)},d.id))})]})},to=wt(({baseMaps:e,terrains:t,locale:r,isOpen:n,setIsOpen:o})=>{const[s,d]=a.useState(),g=a.useMemo(()=>z.get(r,"BASE_MAP_TITLE")??"Base Map",[r]),f=a.useMemo(()=>z.get(r,"TERRAIN_TITLE")??"Terrain",[r]);return i.jsxs(i.Fragment,{children:[i.jsx(ot,{onClick:()=>o(!n),children:i.jsx("img",{className:"cesium-baseLayerPicker-selected",src:s==null?void 0:s.thumbnail,title:s==null?void 0:s.title,alt:"Current Map"})}),i.jsxs(Lt,{isVisible:n,children:[e&&i.jsx(Ri,{title:g,baseMaps:e,setCurrent:d}),t&&i.jsx(eo,{title:f,terrains:t})]})]})}),Ms="",ro=({featureTypes:e,locale:t})=>{const r=a.useMemo(()=>z.get(t,"WFS_TITLE")??"Data Layers",[t]),n=a.useMemo(()=>z.get(t,"WFS_CACHE")??"Cache",[t]),o=a.useMemo(()=>z.get(t,"WFS_EXTENT")??"Extent",[t]),s=a.useMemo(()=>z.get(t,"NO_DATA_LAYERS")??"No DATA layers found",[t]),d=a.useMemo(()=>i.jsx(U,{className:"title",children:r}),[r]),g=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,w)=>i.jsxs(U,{className:"featureType",children:[i.jsx(ee.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(U,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(U,{className:"info",children:[i.jsxs(U,{children:[n,": ",f.cache??0]}),f.total>0&&i.jsxs(U,{className:"spacer",children:[o,": ",f.items," / ",f.total]})]})]},w)):i.jsx(U,{className:"noDataLayers",children:s})}),[e]);return i.jsxs(U,{className:"wfsContainer",children:[d,g]})},_s="",no=wt(({locale:e,isOpen:t,setIsOpen:r})=>{var $;const[n,o]=a.useState([]),[s,d]=a.useState([]),[g,f]=a.useState({data:!1,layers:!1,tools:!1}),w=a.useMemo(()=>z.get(e,"DEBUG_PANEL_TITLE")??"Debug",[e]),S=a.useMemo(()=>z.get(e,"DEBUG_SECTION_DATA")??"Data",[e]),C=a.useMemo(()=>z.get(e,"DEBUG_SECTION_LAYERS")??"Layers",[e]),v=a.useMemo(()=>z.get(e,"DEBUG_SECTION_TOOLS")??"Tools",[e]),y=a.useMemo(()=>z.get(e,"TILE_REQUESTS_OPTIMIZATION_CHECKBOX")??"Tile requests optimization",[e]),D=a.useMemo(()=>z.get(e,"CESIUM_INSPECTOR_CHECKBOX")??"Cesium Inspector",[e]),V=a.useMemo(()=>z.get(e,"WITH_TRANSPARENCY_TOOLTIP")??"This layer has tiles with transparency",[e]),I=a.useMemo(()=>z.get(e,"WITHOUT_TRANSPARENCY_TOOLTIP")??"This layer has tiles WITHOUT transparency",[e]),G=fe(),{viewState:q,setViewState:R}=Be(),H=N=>{f(X=>({...X,[N]:!X[N]}))},Z=()=>{var N;(N=G.layersManager)!=null&&N.layerList&&d(G.layersManager.layerList.filter(X=>{var l;return((l=X.meta)==null?void 0:l.id)!==Oe}).map(X=>{var l;return{layerId:(l=X.meta)==null?void 0:l.id,meta:X.meta}}))};return a.useEffect(()=>{var m;let N;const X=()=>{N!==void 0&&clearTimeout(N),N=setTimeout(()=>{Z()},0)},l=G.scene.globe.tileLoadProgressEvent.addEventListener(T=>{T===0&&(Z(),l())}),c=G.camera.moveEnd.addEventListener(()=>{X()}),E=G.imageryLayers.layerRemoved.addEventListener(()=>{X()});return(m=G.layersManager)==null||m.addLayerUpdatedListener(Z),()=>{var T;N!==void 0&&clearTimeout(N),l(),c(),E(),(T=G.layersManager)==null||T.removeLayerUpdatedListener(Z)}},[]),a.useEffect(()=>{Z()},[q==null?void 0:q.shouldOptimizedTileRequests]),a.useEffect(()=>{if(!G.layersManager)return;const N=(X,l)=>{var E;X.forEach(m=>{if(l!==void 0&&l!==m.meta.id)return;const{options:T,meta:b}=m,{zoomLevel:M}=T,{id:p,items:L,total:A,cache:k,currentZoomLevel:P,featureStructure:O}=b;o(B=>{const Q=B.findIndex(re=>re.id===p);if(Q>=0){if(JSON.stringify(B[Q])!==JSON.stringify({id:p,items:L,total:A,cache:k,currentZoomLevel:P,featureStructure:O,zoomLevel:M})){const re=[...B];return re[Q]={id:p,items:L,total:A,cache:k,currentZoomLevel:P,featureStructure:O,zoomLevel:M},re}}else return[...B,{id:p,items:L,total:A,cache:k,currentZoomLevel:P,featureStructure:O,zoomLevel:M}];return B})});const c=new Set((E=G.layersManager)==null?void 0:E.dataLayerList.map(m=>m.meta.id));o(m=>m.filter(T=>c.has(T.id)))};return G.layersManager.addDataLayerUpdatedListener(N),()=>{var X;(X=G.layersManager)==null||X.removeDataLayerUpdatedListener(N)}},[($=G.layersManager)==null?void 0:$.dataLayerList]),i.jsxs(i.Fragment,{children:[i.jsx(ot,{onClick:()=>r(!t),children:i.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:i.jsx("g",{fill:"var(--mdc-theme-cesium-color)",transform:"translate(4.6 4.6) scale(0.0295)",children:i.jsx("g",{transform:"translate(-1)",children:i.jsx("g",{children:i.jsxs("g",{children:[i.jsx("path",{d:"M508.517,257.027l-106.445-57.318v-20.506c0-4.71-3.814-8.533-8.533-8.533h-25.6v-8.533 c0-6.562-0.683-12.962-1.783-19.217l56.346-24.141c3.14-1.34,5.171-4.429,5.171-7.842V17.07h51.2 c4.719,0,8.533-3.823,8.533-8.533s-3.814-8.533-8.533-8.533h-59.733c-4.719,0-8.533,3.823-8.533,8.533v96.777l-48.751,20.898 c-7.859-22.852-22.886-42.377-42.496-55.757c8.713-6.187,14.447-16.307,14.447-27.784c0-18.825-15.309-34.133-34.133-34.133 c-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c9.412,0,17.067,7.654,17.067,17.067 c0,9.412-7.654,17.067-17.067,17.067c-0.017,0-0.026,0.009-0.043,0.009c-13.133-5.487-27.529-8.542-42.624-8.542 s-29.491,3.055-42.624,8.542c-0.017,0-0.026-0.009-0.043-0.009c-9.412,0-17.067-7.654-17.067-17.067 c0-9.412,7.654-17.067,17.067-17.067c4.719,0,8.533-3.823,8.533-8.533s-3.814-8.533-8.533-8.533 c-18.825,0-34.133,15.309-34.133,34.133c0,11.477,5.734,21.598,14.447,27.784c-19.61,13.38-34.637,32.905-42.496,55.757 l-48.751-20.898V8.537c0-4.71-3.814-8.533-8.533-8.533H35.138c-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533h51.2 v93.867c0,3.413,2.031,6.502,5.171,7.842l56.346,24.141c-1.101,6.255-1.784,12.655-1.784,19.217v8.533h-25.6 c-4.719,0-8.533,3.823-8.533,8.533v20.506L5.494,257.027c-4.147,2.227-5.709,7.407-3.473,11.554 c1.545,2.867,4.489,4.489,7.526,4.489c1.365,0,2.748-0.324,4.036-1.024l108.766-58.564l134.673,75.418l135.202-75.11 l108.203,58.257c1.289,0.7,2.671,1.024,4.036,1.024c3.038,0,5.982-1.621,7.526-4.489 C514.225,264.434,512.664,259.255,508.517,257.027z M350.872,170.67H163.138v-8.533c0-51.755,42.112-93.867,93.867-93.867 c51.755,0,93.867,42.112,93.867,93.867V170.67z"}),i.jsx("path",{d:"M450.208,343.32l-48.136-40.115v-75.366l-136.533,75.853v173.747c76.015-4.454,136.533-67.524,136.533-144.632v-7.381 l32.205,26.837l-39.97,87.945c-1.135,2.492-0.998,5.385,0.358,7.765l34.133,59.733c1.57,2.756,4.446,4.301,7.415,4.301 c1.434,0,2.893-0.367,4.224-1.126c4.096-2.338,5.521-7.552,3.174-11.648l-31.966-55.936l40.858-89.899 C454.1,349.899,453.152,345.777,450.208,343.32z"}),i.jsx("path",{d:"M111.938,303.205L63.802,343.32c-2.944,2.458-3.891,6.579-2.295,10.078l40.858,89.899l-31.966,55.936 c-2.347,4.096-0.922,9.31,3.174,11.648c1.331,0.759,2.79,1.126,4.224,1.126c2.97,0,5.845-1.545,7.415-4.301l34.133-59.733 c1.357-2.381,1.493-5.274,0.358-7.765l-39.97-87.945l32.205-26.837v7.381c0,77.107,60.518,140.177,136.533,144.632V303.674 l-136.533-76.459V303.205z"})]})})})})})}),i.jsx(Lt,{isVisible:t,title:w,children:i.jsxs(U,{className:"debuggerWidgetSections",children:[i.jsxs(U,{className:"debuggerWidgetSection",children:[i.jsxs(U,{className:"debuggerWidgetSectionHeader",onClick:()=>H("data"),children:[i.jsx(U,{className:"debuggerWidgetSectionHeaderToggle",children:g.data?"+":"-"}),i.jsx(U,{className:"debuggerWidgetSectionHeaderLabel",children:S})]}),!g.data&&i.jsx(U,{className:"debuggerWidgetSectionContent",children:i.jsx(ro,{featureTypes:n,locale:e})})]}),i.jsxs(U,{className:"debuggerWidgetSection",children:[i.jsxs(U,{className:"debuggerWidgetSectionHeader",onClick:()=>H("layers"),children:[i.jsx(U,{className:"debuggerWidgetSectionHeaderToggle",children:g.layers?"+":"-"}),i.jsx(U,{className:"debuggerWidgetSectionHeaderLabel",children:C})]}),!g.layers&&i.jsxs(U,{className:"debuggerWidgetSectionContent",children:[i.jsx(ee.Checkbox,{className:"optimizationCheckbox",label:y,checked:(q==null?void 0:q.shouldOptimizedTileRequests)??!1,onClick:()=>{R(N=>({currentZoomLevel:(N==null?void 0:N.currentZoomLevel)??-1,shouldOptimizedTileRequests:!((N==null?void 0:N.shouldOptimizedTileRequests)??!1),showCesiumInspector:(N==null?void 0:N.showCesiumInspector)??!1}))}}),(q==null?void 0:q.shouldOptimizedTileRequests)===!0&&i.jsx(U,{className:"debuggerLayerList",children:[...s].reverse().map((N,X)=>{var A,k,P,O,B;const l=N.layerId??`LAYER-${s.length-X}`,c=z.get(N.meta,"layerRecord.productName")??l,E=((A=N.meta)==null?void 0:A.relevantToExtent)===!0?" → show":((k=N.meta)==null?void 0:k.relevantToExtent)===!1?" → hide":"",m=((P=N.meta)==null?void 0:P.hasTransparency)===!0?V:((O=N.meta)==null?void 0:O.hasTransparency)===!1?I:"",T=z.get(N.meta,Lr),M=(Array.isArray(T)?T:T!==void 0?[T]:[]).filter(Q=>Q.x!==void 0&&Q.y!==void 0&&Q.level!==void 0).map(Q=>`( L: ${String(Q.level)}, X: ${String(Q.x)}, Y: ${String(Q.y)} )`),p=m===""?void 0:i.jsxs(U,{children:[m,": ",M.join(", ")]}),L=((B=N.meta)==null?void 0:B.relevantToExtent)!==!1;return p===void 0?i.jsx(U,{className:`debuggerLayerItem ${L?"relevant":""}`,children:c+E},l):i.jsx(ee.Tooltip,{content:p,children:i.jsx(U,{className:`debuggerLayerItem ${L?"relevant":""}`,"data-has-tooltip":"true",children:c+E})},l)})})]})]}),i.jsxs(U,{className:"debuggerWidgetSection",children:[i.jsxs(U,{className:"debuggerWidgetSectionHeader",onClick:()=>H("tools"),children:[i.jsx(U,{className:"debuggerWidgetSectionHeaderToggle",children:g.tools?"+":"-"}),i.jsx(U,{className:"debuggerWidgetSectionHeaderLabel",children:v})]}),!g.tools&&i.jsx(U,{className:"debuggerWidgetSectionContent",children:i.jsx(ee.Checkbox,{className:"cesiumInspectorCheckbox",label:D,checked:(q==null?void 0:q.showCesiumInspector)??!1,onClick:()=>{R(N=>({currentZoomLevel:(N==null?void 0:N.currentZoomLevel)??-1,shouldOptimizedTileRequests:(N==null?void 0:N.shouldOptimizedTileRequests)??!1,showCesiumInspector:!((N==null?void 0:N.showCesiumInspector)??!1)}))}})})]})]})})]})}),Ps="",io=({options:e,isOpen:t,locale:r})=>{const n=fe(),o=a.useRef(void 0),s=a.useRef(null),[d,g]=a.useState(""),[f,w]=a.useState(!1),[S,C]=a.useState(!0),[v,y]=a.useState(),[D,V]=a.useState(),I=a.useMemo(()=>z.get(r,"SHOW_FEATURE_ON_MAP")??"Show on map",[r]),G=a.useMemo(()=>z.get(r,"IN_MAP_EXTENT")??"Search in extent",[r]),q=a.useMemo(()=>z.get(r,"SEARCH_PLACEHOLDER")??"Search...",[r]),R=a.useMemo(()=>z.get(r,"NO_RESULTS")??"No Results",[r]),H=a.useMemo(()=>n.scene.mode===u.SceneMode.SCENE2D?!1:(w(!1),!0),[n.scene.mode]),Z=300,$=i.jsx("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"white",stroke:"#ccc",strokeWidth:1})}),N=i.jsxs("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:[i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"#1976d2",stroke:"#1976d2",strokeWidth:1}),i.jsx("path",{d:"M4 8l2 2 6-6",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]});a.useEffect(()=>{e.forEach(p=>{p.baseUrl&&p.endPoint&&!p.url&&(p.url=p.baseUrl+p.endPoint)})},[e]),a.useEffect(()=>{t&&s.current&&s.current.focus()},[t]),a.useEffect(()=>{if(!n)return;if(!o.current){const L=new u.GeoJsonDataSource("geocoderDataSource");o.current=L,n.dataSources.add(L)}const p=o.current;D&&S?(async()=>{const A={type:"FeatureCollection",features:[D]};await p.load(A),Tr(n,p,[],"#01FF1F")})():p.entities.removeAll()},[n,S,D]);const X=p=>{switch(typeof p){case"object":return Array.isArray(p)?`[${p.map(L=>`'${L}'`).join(", ")}]`:JSON.stringify(p);case"boolean":case"number":case"string":return p.toString();case"undefined":return}},l=(p,L,A)=>{const k=X(A);if(k){const P=p.includes("?")?p.endsWith("?")||p.endsWith("&")?"":"&":"?";return`${p}${P}${encodeURIComponent(L)}=${encodeURIComponent(k)}`}return p},c=(p,L)=>(p&&p.forEach(A=>{L=l(L,A[0],A[1])}),L),E=a.useCallback((p,L,A,k)=>((()=>{const O=L.dynamic.queryText,B=typeof O=="string"?O:O.name,Q=typeof O=="string"?void 0:O.relatedParams;if(p=l(p,B,A),Q&&Q.forEach(re=>{p=l(p,re[0],re[1])}),k){const re=Er(n),K=L.dynamic.geoContext,J=typeof K=="string"?K:K==null?void 0:K.name;if(re&&J){const ae=vr(re),ge={bbox:[ae[0],ae[1],ae[2],ae[3]]};p=l(p,J,ge);const Te=typeof K=="string"||K==null?void 0:K.relatedParams;Te&&Te.forEach(oe=>{p=l(p,oe[0],oe[1])})}}})(),p=c(L.static,p),p),[n]),m=a.useCallback(async(p,L)=>{if(!p){y([]);return}const A=e.map(async O=>{if(O.url){const B=E(O.url,O.params,p,L);return fetch(B,{method:"GET"})}else return Promise.reject({message:"No URL provided. Please provide one"})}),k=await Promise.all(A),P=await Promise.all(k.filter(O=>O!==void 0).map(async O=>{var Q;const B=await O.json();return B.features=(Q=B.features)==null?void 0:Q.map(re=>({...re,properties:{...re.properties,headers:O.headers}})),{body:B,status:O.status,url:O.url,headers:Object.fromEntries(O.headers.entries())}}));y(P)},[E,e]),T=a.useMemo(()=>z.debounce((p,L)=>{m(p,L)},Z),[m]);a.useEffect(()=>()=>T.cancel(),[T]);const b=(p,L)=>{g(p),T(p,L)};a.useEffect(()=>{m(d,f)},[f]);const M=p=>{const L=pn.getType(p);let A;switch(L){case"Point":A=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"var(--mdc-theme-cesium-color)",children:i.jsx("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})});break;case"LineString":A=i.jsxs("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",children:[i.jsx("path",{fill:"var(--mdc-theme-cesium-color)",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:.5,d:"M21 6h.046l-5.25 9h-.944L10 9.455V7H7v2.926L1.862 18H0v3h3v-2.926L8.138 10h1.01L14 15.545V18h3v-3h-.046l5.25-9H24V3h-3zM8 8h1v1H8zM2 20H1v-1h1zm14-3h-1v-1h1zm7-13v1h-1V4z"}),i.jsx("path",{fill:"none",d:"M0 0h24v24H0z"})]});break;default:A=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M11 4 L20 14 L20 20 L4 20 L4 10 Z"})});break}return i.jsx(U,{children:A})};return i.jsx(U,{className:"geocoderContainer",children:i.jsxs(U,{className:"geocoderForm",children:[i.jsx(ee.TextField,{id:"geocoderTextField",className:"cesium-geocoder-input",ref:s,onChange:p=>b(p.target.value,f),placeholder:q,value:d,autoComplete:"off"}),i.jsxs(U,{className:"search-results",children:[i.jsxs(U,{className:"checkboxesContainer",children:[i.jsx(ee.Checkbox,{className:"checkboxElement",label:I,icon:$,checkedicon:N,checked:S,onClick:()=>{C(!S)}}),i.jsx(ee.Checkbox,{className:"checkboxElement",label:i.jsx(ee.Typography,{tag:"span",className:H?"disabled":"",children:G}),checked:f,icon:$,checkedicon:N,disabled:H,onClick:()=>{w(!f)}})]}),i.jsx(U,{className:"listsContainer",children:e.map((p,L)=>i.jsxs(ee.List,{children:[i.jsx(ee.Typography,{className:"bold",tag:"span",children:p.title??p.endPoint}),i.jsx(U,{className:"listContainer",children:(()=>{var B,Q,re,K,J,ae,ge,Te;const A=(Q=(B=v==null?void 0:v[L])==null?void 0:B.body)==null?void 0:Q.features,k=(J=(K=(re=v==null?void 0:v[L])==null?void 0:re.body)==null?void 0:K.features)==null?void 0:J.length,P=(ge=(ae=v==null?void 0:v[L])==null?void 0:ae.body)==null?void 0:ge.message,O=(Te=v==null?void 0:v[L])==null?void 0:Te.status;return k?A.map((oe,ve)=>{var me,x,F,W,Y;return i.jsx(ee.ListItem,{className:D===oe?"mdc-ripple-upgraded--background-focused":"",onClick:()=>{var j;n.camera.flyTo({destination:Yi(mr.fromDegrees(...Xe(oe.geometry)))}),V(oe),(j=p.callbackFunc)==null||j.call(p,oe,p,ve)},children:i.jsxs(U,{className:"queryItemResult",children:[i.jsx(ee.Tooltip,{content:(x=(me=oe==null?void 0:oe.properties)==null?void 0:me.names)==null?void 0:x.display,children:i.jsx(U,{children:(Y=(W=(F=oe==null?void 0:oe.properties)==null?void 0:F.names)==null?void 0:W.default)==null?void 0:Y[0]})}),M(oe)]})},`feature-${ve}`)}):k===0?i.jsx(ee.ListItemSecondaryText,{className:"generalListItem queryNoResults",children:R}):P?i.jsx(ee.ListItemSecondaryText,{className:`generalListItem ${O===400?"queryWarning":"queryError"}`,children:P}):i.jsx(ee.ListItemSecondaryText,{className:"generalListItem"})})()})]},`option-${L}`))})]})]})})},oo=wt(({options:e,locale:t,isOpen:r,setIsOpen:n})=>i.jsxs(i.Fragment,{children:[i.jsx(ot,{onClick:()=>n(!r),children:i.jsx("svg",{className:"cesium-svgPath-svg",width:"32",height:"32",fill:"var(--mdc-theme-cesium-color)",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z"})})}),i.jsx(Lt,{isVisible:r,children:i.jsx(io,{options:e,isOpen:r,locale:t})})]})),so={GLOBAL:{"BM-GOOGLE_TERRAIN-XYZ_LAYER":"https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}","BM-INFRARED_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_ir.cgi?","BM-RADAR_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?","BM-VECTOR_TILES_GPS-XYZ_LAYER":"https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png","BM-VECTOR_TILES-XYZ_LAYER":"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=6170aad10dfd42a38d4d8c709a536f38","BM-WMTS_POPULATION_TILES-WMTS_LAYER":"https://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_Density/MapServer/WMTS/","3D_MODEL":"https://3d.ofek-air.com/3d/Jeru_Old_City_Cesium/ACT/Jeru_Old_City_Cesium_ACT.json"},"WFS Vector layer":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw",vector_geoserver:"http://geoserver-vector-dev.apps.j1lk3njp.eastus.aroapp.io/geoserver/core/ows"},"WFS Vector layer (Visual)":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw"},"WFS PP layer":{raster_pp_geoserver:"https://raster-serving-int-pp-geoserver-nginx-route-manual-integration.apps.j1lk3njp.eastus.aroapp.io/geoserver/wfs?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJkIjpbInJhc3RlciIsInJhc3RlcldtcyIsInJhc3RlckV4cG9ydCIsImRlbSIsInZlY3RvciIsIjNkIl0sImlhdCI6MTY3NDYzMjM0Niwic3ViIjoibWFwY29sb25pZXMtYXBwIiwiaXNzIjoibWFwY29sb25pZXMtdG9rZW4tY2xpIn0.D1u28gFlxf_Z1bzIiRHZonUgrdWwhZy8DtmQj15cIzaABRUrGV2n_OJlgWTuNfrao0SbUZb_s0_qUUW6Gz_zO3ET2bVx5xQjBu0CaIWdmUPDjEYr6tw-eZx8EjFFIyq3rs-Fo0daVY9cX1B2aGW_GeJir1oMnJUURhABYRoh60azzl_utee9UdhDpnr_QElNtzJZIKogngsxCWp7tI7wkTuNCBaQM7aLEcymk0ktxlWEAt1E0nGt1R-bx-HnPeeQyZlxx4UQ1nuYTijpz7N8poaCCExOFeafj9T7megv2BzTrKWgfM1eai8srSgNa3I5wKuW0EyYnGZxdbJe8aseZg"}},Pe=(e,t)=>so[e][t],ao=Pe("GLOBAL","DEFAULT_TERRAIN_PROVIDER_URL");Pe("GLOBAL","TERRAIN_SRTM100"),Pe("GLOBAL","TERRAIN_COMBINED"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-INFRARED_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-RADAR_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-TRANSPARENT_LABELS_OVERLAY-XYZ_LAYER");const Ds="",lo=({legend:{legendImg:e,legendDoc:t,layer:r},docText:n,imgText:o})=>{const s=a.useCallback(()=>{window.open(e,"_blank")},[e]);a.useCallback(()=>{window.open(t,"_blank")},[t]);const d=a.useCallback(()=>{const w=i.jsx(U,{className:"layerNameContainer",children:i.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:r})});return(r??"").length>15?i.jsx(ee.Tooltip,{content:r,children:w}):w},[r]),g=a.useCallback(()=>[typeof e=="string"&&i.jsx("a",{className:"legendAction",href:e,target:"_blank",rel:"noreferrer",children:o}),typeof t=="string"&&i.jsx("a",{className:"legendAction",href:t,target:"_blank",rel:"noreferrer",children:n})],[e,o,t,n]);return i.jsxs(U,{className:"mapLegend",children:[d(),i.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:s}),i.jsx(U,{className:"legendActionsContainer",children:g()})]})},co=({legends:e,actionsTexts:{docText:t,imgText:r},noLegendsText:n})=>{const o=a.useCallback(()=>i.jsx(U,{className:"noLegendsContainer",children:i.jsx("h2",{className:"noLegendsMsg",children:n})}),[n]),s=a.useCallback(()=>e.length?e.map((d,g)=>i.jsx(lo,{legend:d,docText:t,imgText:r},`${d.layer}_${g}`)):o(),[e]);return i.jsx(U,{className:"mapLegendsList",children:s()})},uo=({isOpen:e,toggleSidebar:t,title:r="Map Legends",noLegendsText:n="No legends to display...",actionsTexts:o={docText:"Docs",imgText:"View Image"},legends:s=[]})=>e?i.jsxs(ee.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[i.jsx(ee.DrawerHeader,{className:"sidebarHeaderContainer",children:i.jsx(ee.DrawerTitle,{className:"sidebarTitle",children:r})}),i.jsxs(ee.DrawerContent,{className:"sidebarContent",children:[i.jsx(ee.Icon,{onClick:t,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),i.jsx(co,{noLegendsText:n,legends:s,actionsTexts:o})]})]}):null,ho=({legendToggle:e})=>i.jsx(i.Fragment,{children:i.jsx(ot,{onClick:e,children:i.jsxs("svg",{height:"100%",width:"100%",viewBox:"-45 -45 650 650",children:[i.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\r
6
+ 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`}),i.jsx("circle",{cx:"270.1",cy:"56.3",r:"56.3"})]})})}),ks="",Mr=e=>{const t=fe(),{enableCompass:r=!0,enableZoomControls:n=!1,lockCompassNavigation:o=!1,locale:s={DIRECTION:"ltr"}}=e;return a.useEffect(()=>{if(typeof z.get(t,"cesiumNavigation")>"u"){t.extend(fn,{enableCompass:r,enableZoomControls:n,enableDistanceLegend:!1}),t.cesiumNavigation.setNavigationLocked(o);const d=document.querySelector(".compass");d&&s.DIRECTION&&d.classList.add(s.DIRECTION)}},[t,r,n,s.DIRECTION,o]),null},Ns="",_r=e=>{const t=fe(),r=a.useRef(null),[n,o]=a.useState({x:0,y:0});return a.useEffect(()=>{t.screenSpaceEventHandler.setInputAction(s=>{if(s!=null&&s.endPosition){const d={...s.endPosition};d.x=Math.ceil(d.x),d.y=Math.ceil(d.y),o(d)}},u.ScreenSpaceEventType.MOUSE_MOVE)},[r,t]),a.useEffect(()=>{const s=t.scene.globe.ellipsoid;if(n){const d=pr(t,n.x,n.y);if(d){const g=new fr(d.longitude,d.latitude);if(r.current){let f="";switch(e.projection){case Ce.WEB_MERCATOR:{const S=new u.WebMercatorProjection(s).project(g);f=`Mercator: ${S.y.toFixed(rt)}m, ${S.x.toFixed(rt)}m`,r.current.style.width="220px";break}case Ce.WGS84:{const w=g.longitude.toFixed(tt);f=`WGS84: ${g.latitude.toFixed(tt)}°N ${w}°E`,r.current.style.width="200px";break}}r.current.innerHTML=f}}}},[n,r,t,e.projection]),i.jsx("div",{className:"coordinatesTracker",ref:r})},go=".cesium-viewer-cesiumInspectorWrapper",po=e=>{e.style.display="",e.style.top="0",e.style.position="relative"},Ir=()=>{const e=fe();return a.useEffect(()=>{var o;const t=e,r=document.querySelector(go);t.cesiumInspector===void 0&&e.extend(u.viewerCesiumInspectorMixin);const n=(o=t.cesiumInspector)==null?void 0:o.container;return n&&(r&&n.parentElement!==r&&r.appendChild(n),po(n)),()=>{n&&(n.style.display="none")}},[e]),i.jsx(U,{className:"cesium-viewer-cesiumInspectorWrapper"})},xs="",bt=[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],fo=(e,t,r,n)=>{const o=z.get(n,"METERS_UNIT")??"m",s=z.get(n,"KILOMETERS_UNIT")??"km",d={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:t.lastLegendUpdate},g=new u.EllipsoidGeodesic,f=new Date().getTime();if(f<d.lastLegendUpdate+250)return;d.lastLegendUpdate=f;const w=e.scene.canvas.clientWidth,S=e.scene.canvas.clientHeight,C=e.scene.camera.getPickRay(new u.Cartesian2(w/2|0,S-1)),v=e.scene.camera.getPickRay(new u.Cartesian2(1+w/2|0,S-1)),y=e.scene.globe,D=y.pick(C,e.scene),V=y.pick(v,e.scene);if(!D||!V)return;const I=y.ellipsoid.cartesianToCartographic(D),G=y.ellipsoid.cartesianToCartographic(V);g.setEndPoints(I,G);const q=g.surfaceDistance,R=100;let H;for(let Z=bt.length-1;!z.isNumber(H)&&Z>=0;--Z)bt[Z]/q<R&&(H=bt[Z]);if(z.isNumber(H)){let Z="";H>=1e3?Z=`${(H/1e3).toString()} ${s}`:Z=`${H.toString()} ${o}`,d.barWidth=H/q|0,d.distanceLabel=Z}r(d)},Pr=e=>{const t=fe(),[r,n]=a.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});a.useEffect(()=>{const s=f=>{fo(t,r,n,e.locale)},d=new u.EventHelper,g=f=>{t.scene.globe.tilesLoaded&&(s(new MouseEvent("mouse")),d.removeAll())};return d.add(t.scene.globe.tileLoadProgressEvent,g),t.camera.moveEnd.addEventListener(s),()=>{try{z.get(t,"_cesiumWidget")!=null&&t.camera.moveEnd.removeEventListener(s)}catch(f){console.log('CESIUM camera "moveEnd" remove listener failed',f)}}},[t,e.locale,r]);const o=s=>5+(125-s)/2;return i.jsx("div",{className:"scaleTracker",children:z.isNumber(r.barWidth)&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"scaleTrackerLabel",children:i.jsx("bdi",{children:r.distanceLabel})}),i.jsx("div",{className:"scaleTrackerBar",style:{height:"2px",width:`${r.barWidth.toString()}px`,left:`${o(r.barWidth).toString()}px`}})]})})},Bs="",Ar=()=>{const e=fe(),t=[{onClick:()=>e.camera.zoomIn(),iconPath:"M48 20h-18v-18h-10v18h-18v10h18v18h10v-18h18z"},{onClick:()=>e.camera.zoomOut(),iconPath:"M2 20h46v10h-46z"}];return i.jsx("div",{className:"zoomButtons",children:t.map((r,n)=>i.jsx(ee.Icon,{icon:i.jsx("div",{className:"zoomButton",children:i.jsx("svg",{fill:"var(--mdc-theme-cesium-color)",width:"12px",height:"12px",viewBox:"0 -20 50 50",version:"1.2",baseProfile:"tiny",xmlns:"http://www.w3.org/2000/svg",overflow:"inherit",children:i.jsx("path",{d:r.iconPath})})}),onClick:r.onClick},n))})},Fs="",Or=(e,t)=>{const n=z.get(t.scene.globe,"_surface.tileProvider"),o=n._quadtree,s=t.canvas.height,d=z.get(t.camera.frustum,"sseDenominator")??1;for(let g=0;g<=19;g++)if(n.getLevelMaximumGeometricError(g)*s/(e*d)<o.maximumScreenSpaceError)return g;return null},mo=(e,t)=>{e=e||10;const r=[];let n=1e5,o=0;for(let s=1e8;s>n;s=s-n){const d=Or(s,t);if(d===null)break;if(d!==o){let g=s,f=s+n;for(;f-g>e;)s=g+(f-g)/2,Or(s,t)===d?g=s:f=s;r.push({level:d,height:Math.round(s)}),o=d,r.length>=2&&(n=(r[r.length-2].height-s)/1e3)}}return r},Dr=({locale:e=void 0,valueBy:t="RENDERED_TILES"})=>{const r=fe(),n=Be(),[o,s]=a.useState(1),d=mo(1,r),g=a.useCallback(()=>{const C=r.camera,v=.5;let y=0;switch(r.scene.mode){case it.SCENE3D:y=r.scene.mapProjection.ellipsoid.cartesianToCartographic(C.positionWC).height;break;case it.SCENE2D:y=(C.frustum.right-C.frustum.left)*v;break;case it.COLUMBUS_VIEW:y=C.position.z;break;default:y=0;break}if(d.length>0){const D=d.reduce((V,I)=>Math.abs(I.height-y)<Math.abs(V.height-y)?I:V);s(D.level),n.setViewState&&n.setViewState(V=>({...V,currentZoomLevel:D.level}))}},[r,d]),f=a.useCallback(()=>{let C=0;r.scene.globe._surface.forEachRenderedTile(function(v){C=Math.max(C,v.level)}),s(C),n.setViewState&&n.setViewState(v=>({...v,currentZoomLevel:C}))},[r]),S=a.useMemo(()=>({CALCULATION:g,RENDERED_TILES:f}),[g,f])[t];return a.useEffect(()=>{const C=r.scene.globe.tileLoadProgressEvent.addEventListener(function(){r.scene.globe.tilesLoaded&&S()});return r.camera.moveEnd.addEventListener(S),()=>{try{typeof z.get(r,"_cesiumWidget")<"u"&&(r.camera.moveEnd.removeEventListener(S),C())}catch(v){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',v)}}},[r,S]),i.jsxs("div",{className:"zoomLevel",children:[i.jsx("div",{className:"zoomLevelValue",children:o}),i.jsx("div",{className:"zoomLevelLabel",children:z.get(e,"ZOOM_LABEL")??"zoom"})]})},Vs="",kr=2,Nr=212,xr=260,yo=0;class vo extends u.Viewer{constructor(r,n){super(r,n);ce(this,"layersManager")}}const St=a.createContext(null),Eo=St.Provider,fe=()=>{const e=a.useContext(St);if(e===null)throw new Error("map context is null, please check the provider");return e.mapViewer},Be=()=>{const{mapViewer:e,...t}=a.useContext(St);if(t===null)throw new Error("map context viewstate is null, please check the provider");return t},To=e=>{var se,pe,ye,Ae,He,$e,Yr,Zr;const t=a.useRef(null),[r,n]=a.useState(),[o,s]=a.useState(),[d,g]=a.useState(),[f,w]=a.useState(),[S,C]=a.useState(),[v,y]=a.useState(),[D,V]=a.useState(),[I,G]=a.useState(),[q,R]=a.useState(),[H,Z]=a.useState(),[$,N]=a.useState(!1),[X,l]=a.useState(!1),c=a.useRef(),[E,m]=a.useState([]),[T,b]=a.useState(),[M,p]=a.useState(),[L,A]=a.useState(!1),k=a.useRef(),[P,O]=a.useState(void 0),[B,Q]=a.useState(!1),[re,K]=a.useState(),[J,ae]=a.useState(),ge=ee.useTheme(),Te=Ut(ge),oe=a.useMemo(()=>$||X,[$,X]);a.useEffect(()=>{ae({currentZoomLevel:-1,shouldOptimizedTileRequests:!1,showCesiumInspector:!1})},[]);const ve={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:z.isNumber(e.zoom)&&z.isArray(e.center),sceneModePicker:!0,imageryProvider:!1,...e},me=(le,ue,ie,Ee,Me)=>{const ke=r.container,De=ke.clientWidth,je=ke.clientHeight,Xr=Ee+Me;return{left:`${De-le<ie?le-(ie-(De-le)):le}px`,top:`${je-ue<Xr?ue-(Xr-(je-ue)):ue}px`}},x=a.useCallback(le=>{if(t.current!==null){const ue=t.current.cesiumElement,ie={x:le.offsetX,y:le.offsetY};A(!1),O(ie),K(pr(ue,ie.x,ie.y)),A(!0),k.current=le}},[t]);a.useEffect(()=>{var le;if(t.current!==null){const ue=t.current.cesiumElement;e.imageryContextMenu&&(ue.scene.canvas.removeEventListener("contextmenu",x),ue.scene.canvas.addEventListener("contextmenu",x))}n((le=t.current)==null?void 0:le.cesiumElement)},[t,e.imageryContextMenu]);const F=a.useMemo(()=>{var le;if(r)return{mapViewer:r.layersManager?r:Object.assign(r,{layersManager:new Ji(r,(le=e.legends)==null?void 0:le.mapLegendsExtractor,()=>{var ie;m((ie=r.layersManager)==null?void 0:ie.legendsList)},e.layerManagerFootprintMetaFieldPath,J==null?void 0:J.shouldOptimizedTileRequests)}),viewState:J,setViewState:ae}},[e.legends,e.layerManagerFootprintMetaFieldPath,r,J]);a.useEffect(()=>{var ue,ie;b(e.baseMaps);const le=(ue=e.baseMaps)==null?void 0:ue.maps.find(Ee=>Ee.isCurrent);le&&r&&((ie=r.layersManager)==null||ie.setBaseMapLayers(le))},[e.baseMaps,r]),a.useEffect(()=>{r!=null&&r.layersManager&&r.layersManager.setShouldOptimizedTileRequests((J==null?void 0:J.shouldOptimizedTileRequests)??!1)},[J==null?void 0:J.shouldOptimizedTileRequests,r]),a.useEffect(()=>{const le=e.terrains||(r&&r.terrainProvider?[{id:"1",url:ao,title:"Default Terrain",thumbnail:"Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png",isCurrent:!0,terrainProvider:r.terrainProvider}]:void 0);p(le)},[e.terrains,r]),a.useEffect(()=>{g(e.projection??Ce.WGS84)},[e.projection]),a.useEffect(()=>{s(e.locale)},[e.locale]),a.useEffect(()=>{w(e.showMousePosition??!0)},[e.showMousePosition]),a.useEffect(()=>{C(e.showZoomLevel??!0)},[e.showZoomLevel]),a.useEffect(()=>{y(e.showScale??!0)},[e.showScale]),a.useEffect(()=>{V(e.showCompass??!0)},[e.showCompass]),a.useEffect(()=>{Z(e.showLoadingProgress??!0)},[e.showLoadingProgress]),a.useEffect(()=>{R(e.showActiveLayersTool??!0)},[e.showActiveLayersTool]),a.useEffect(()=>{var ue;const le=()=>{if(r===void 0)return{longitude:0,latitude:0,height:0};const ie=()=>{const Ee=r.camera.positionCartographic;return{longitude:nt(Ee.longitude),latitude:nt(Ee.latitude),height:Ee.height}};if(r.scene.mode===u.SceneMode.SCENE3D){const Ee=new u.Cartesian2(r.container.clientWidth/kr,r.container.clientHeight/kr),Me=r.scene.camera.getPickRay(Ee),ke=r.scene.globe.pick(Me,r.scene);if(!ke)return{longitude:0,latitude:0,height:0};const De=r.scene.globe.ellipsoid.cartesianToCartographic(ke);return De!==void 0?{longitude:nt(De.longitude),latitude:nt(De.latitude),height:r.scene.camera.positionCartographic.height}:ie()}else return ie()};r&&(r.camera.moveEnd.addEventListener(()=>{if(r.scene.mode!==u.SceneMode.MORPHING){const ie=r.camera,Ee={position:le(),direction:ie.direction.clone(),up:ie.up.clone(),right:ie.right.clone(),transform:ie.transform.clone(),frustum:ie.frustum.clone()};c.current=Ee}}),H&&(r.scene.globe.tileLoadProgressEvent.addEventListener(function(){r.scene.globe.tilesLoaded?N(!1):N(!0)}),(ue=r.layersManager)==null||ue.addDataLayerUpdatedListener(()=>{var Ee;let ie=!1;(Ee=r.layersManager)==null||Ee.dataLayerList.forEach(Me=>{if(typeof Me.meta.items=="number"&&typeof Me.meta.total=="number"&&Me.meta.items>0&&Me.meta.items<Me.meta.total){ie=!0;return}}),l(ie)})))},[r]),a.useEffect(()=>{const le=()=>{if(r&&c.current){const ie=c.current;r.camera.flyTo({destination:u.Cartesian3.fromDegrees(ie.position.longitude,ie.position.latitude,ie.position.height),duration:0})}},ue=r==null?void 0:r.scene.morphComplete.addEventListener(le);return()=>{try{ue==null||ue()}catch(ie){console.error("morphCompleteHandler event not cleaned:",ie)}}},[r]),a.useEffect(()=>{const le=e.zoom,ue=e.center;if(r&&z.isNumber(le)&&z.isArray(ue)){const ie=ue[0],Ee=ue[1],Me=pi(le);r.camera.flyTo({destination:u.Cartesian3.fromDegrees(ie,Ee,Me),duration:0});const ke=r.homeButton.viewModel.command,De=function(je){r.camera.flyTo({destination:u.Cartesian3.fromDegrees(ie,Ee,Me),duration:1}),je.cancel=!0};return ke.beforeExecute.addEventListener(De),()=>{ke.beforeExecute.removeEventListener(De);try{ke.beforeExecute.removeEventListener(De)}catch{console.error("customHomeButtonHandler event not cleaned")}}}},[e.zoom,e.center,r]),a.useEffect(()=>{G(e.showZoomButtons??!0)},[e.showZoomButtons]);const W=()=>{Q(le=>!le)},Y=a.useCallback(()=>r&&ht.createPortal(i.jsxs(i.Fragment,{children:[H&&oe&&i.jsx(ee.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),D&&i.jsx(Mr,{locale:o}),i.jsxs(U,{className:"bottomToolsContainer",children:[f&&i.jsx(_r,{projection:d}),S&&i.jsx(Dr,{locale:o,valueBy:"RENDERED_TILES"}),v&&i.jsx(Pr,{locale:o})]}),I&&i.jsx(Ar,{})]}),document.querySelector(".cesium-viewer")),[r,o,d,f,v,oe]),j=a.useCallback(()=>r&&ht.createPortal(i.jsxs(i.Fragment,{children:[e.geocoderPanel&&i.jsx(oo,{options:[...e.geocoderPanel],locale:o}),i.jsx(to,{baseMaps:T,terrains:M,locale:o}),e.showDebuggerTool&&i.jsx(no,{locale:o}),i.jsx(ho,{legendToggle:W})]}),document.querySelector(".cesium-viewer-toolbar")),[r,o,T,M]),te=a.useCallback(()=>r&&ht.createPortal(i.jsxs(U,{className:"cesium-viewer-cesiumInspectorContainer widgetsContainer",children:[q&&i.jsx(Qi,{locale:o}),(J==null?void 0:J.showCesiumInspector)&&i.jsx(Ir,{})]}),document.querySelector(".cesium-widget")),[r,o,J==null?void 0:J.showCesiumInspector]);return i.jsx(ee.ThemeProvider,{id:"cesiumTheme",options:Te,children:i.jsx(_e.Viewer,{className:"viewer",full:!0,ref:t,...ve,children:i.jsxs(Eo,{value:F,children:[i.jsx(uo,{title:(se=e.legends)==null?void 0:se.title,isOpen:B,toggleSidebar:W,noLegendsText:(pe=e.legends)==null?void 0:pe.emptyText,legends:((ye=e.legends)==null?void 0:ye.legendsList)??E,actionsTexts:(Ae=e.legends)==null?void 0:Ae.actionsTexts}),e.children,Y(),j(),te(),e.imageryContextMenu&&L&&P&&re&&a.cloneElement(e.imageryContextMenu,{data:(He=r==null?void 0:r.layersManager)==null?void 0:He.findLayerByPOI(P.x,P.y,!1),position:{x:P.x,y:P.y},coordinates:re,style:me(P.x,P.y,(($e=e.imageryContextMenuSize)==null?void 0:$e.width)??xr,((Yr=e.imageryContextMenuSize)==null?void 0:Yr.height)??Nr,((Zr=e.imageryContextMenuSize)==null?void 0:Zr.dynamicHeightIncrement)??yo),size:e.imageryContextMenuSize??{height:Nr,width:xr},handleClose:()=>{A(!L)},contextEvt:k.current})]})})})},Lo=0,wo=e=>{const t=fe();return i.jsx(_e.Cesium3DTileset,{...e,onReady:r=>{e.isZoomTo===!0&&t.zoomTo(r);const n=t.scene;n.globe.depthTestAgainstTerrain=!0;const o=u.Cartographic.fromCartesian(r.boundingSphere.center),s=e.heightFromGround??Lo;if(s){const d=u.Cartesian3.fromRadians(o.longitude,o.latitude,o.height),g=u.Cartesian3.fromRadians(o.longitude,o.latitude,o.height+s),f=u.Cartesian3.subtract(g,d,new u.Cartesian3);r.modelMatrix=u.Matrix4.fromTranslation(f)}}})},st=180,Br=.001,Fr=e=>Math.abs(e)/e,Vr=e=>{st-Math.abs(e[0])<Br&&(e[0]=Fr(e[0])*(st-1)),st/2-Math.abs(e[1])<Br&&(e[1]=Fr(e[1])*(st/2-1))},Gr=e=>{switch(e.type){case"LineString":e.coordinates.forEach(t=>{Vr(t)});break;case"Polygon":e.coordinates.forEach(t=>{t.forEach(r=>{Vr(r)})});break}},bo=e=>{const{data:t,...r}=e,n=z.cloneDeep(t);return n&&(typeof n.features<"u"?n.features.forEach(o=>{Gr(o.geometry)}):Gr(n)),i.jsx(_e.GeoJsonDataSource,{data:n,...r})},qe=e=>{const{meta:t,...r}=e,n=fe();return a.useLayoutEffect(()=>{var o;(o=n.layersManager)==null||o.addMetaToLayer(t,t.searchLayerPredicate)},[t,n]),i.jsx(_e.ImageryLayer,{...r})},So=e=>{const{options:t,...r}=e,n=fe(),{viewState:o}=Be(),s=a.useMemo(()=>o.shouldOptimizedTileRequests?new br(t,n):new u.WebMapServiceImageryProvider(t),[o.shouldOptimizedTileRequests]);return i.jsx(qe,{...r,imageryProvider:s},`wms-${String(o.shouldOptimizedTileRequests)}`)},Co=e=>{const{options:t,...r}=e,n=fe(),{viewState:o}=Be(),s=a.useMemo(()=>o.shouldOptimizedTileRequests?new Sr(t,n):new u.WebMapTileServiceImageryProvider(t),[o.shouldOptimizedTileRequests]);return i.jsx(qe,{...r,imageryProvider:s},`wmts-${String(o.shouldOptimizedTileRequests)}`)},Mo=e=>{const{options:t,...r}=e,n=fe(),{viewState:o}=Be(),s=a.useMemo(()=>o.shouldOptimizedTileRequests?new wr(t,n):new u.UrlTemplateImageryProvider(t),[o.shouldOptimizedTileRequests]);return i.jsx(qe,{...r,imageryProvider:s},`xyz-${String(o.shouldOptimizedTileRequests)}`)},_o=e=>{const{options:t,...r}=e;return i.jsx(qe,{...r,imageryProvider:new u.OpenStreetMapImageryProvider(t)})},Io=e=>{const{options:t,meta:r,visualizationHandler:n,withGeometryValidation:o=!1}=e,{url:s,featureType:d,alternativePayload:g,style:f,pageSize:w,zoomLevel:S,maxCacheSize:C,keyField:v,labeling:y}=t,{color:D,hover:V}=f,I=fe(),G=Be(),q=a.useRef(G.viewState),R=a.useRef(new Map),H=a.useRef(new Set),Z=a.useRef(0),[$,N]=a.useState(r),X=a.useMemo(()=>u.Color.fromCssColorString(V??"#24AEE9").withAlpha(.5),[V]),l=a.useMemo(()=>`wfs_${d}_${Ft.v4()}`,[d]),c=a.useRef(!1);a.useEffect(()=>{q.current=G.viewState},[G.viewState]);const E=new u.GeoJsonDataSource(l),m=x=>{const F=[],W=r.featureStructure;if(W&&W.fields)for(const j of W.fields){const{fieldName:te,aliasFieldName:se}=j,pe=se,ye=x[te]??"N/A",Ae=Math.max(100,Math.min(180,pe.length*10)),He="260px";F.push(`
7
7
  <tr>
8
- <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${Ie}px; display: table-cell;">
9
- <strong>${me}:</strong>
8
+ <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${Ae}px; display: table-cell;">
9
+ <strong>${pe}:</strong>
10
10
  </td>
11
- <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${Ge}; display: table-cell;" title="${ye}">
11
+ <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${He}; display: table-cell;" title="${ye}">
12
12
  ${ye}
13
13
  </td>
14
14
  </tr>
15
15
  `)}return`
16
- <table style="width: 100%; direction: ${H.fields.some(U=>U.aliasFieldName!==U.fieldName)?"rtl":"ltr"};">
16
+ <table style="width: 100%; direction: ${W.fields.some(j=>j.aliasFieldName!==j.fieldName)?"rtl":"ltr"};">
17
17
  <tbody>
18
- ${x.join("")}
18
+ ${F.join("")}
19
19
  </tbody>
20
20
  </table>
21
- `},y=D=>D?D.polyline?"polyline":"polygon":"",S=D=>{var z,U;const x=(U=(z=D==null?void 0:D.polygon)==null?void 0:z.hierarchy)==null?void 0:U.getValue(g.JulianDate.now());if(!x)return null;const H=x.positions;return g.BoundingSphere.fromPoints(H).center},w=D=>{const H=T.scene.drillPick(D).map(U=>U.id).filter(U=>U&&U.polygon&&U.entityCollection.owner.name===ee);if(H.length===0)return null;const z=H.map(U=>{const K=S(U);if(!K)return{entity:U,distance:Number.MAX_VALUE};const ce=g.SceneTransforms.wgs84ToWindowCoordinates(T.scene,K);if(!ce)return{entity:U,distance:Number.MAX_VALUE};const me=D.x-ce.x,ye=D.y-ce.y,Ie=Math.sqrt(me*me+ye*ye);return{entity:U,distance:Ie}});return z.sort((U,K)=>K.distance-U.distance),z[0].entity},P=D=>{let x=null,H=null;D.setInputAction(z=>{if(T.scene.mode===g.SceneMode.SCENE2D){const K=T.scene.pick(z.endPosition);K&&K.id&&(K.id.polygon||K.id.polyline)?$.get(x,"id")!==$.get(K.id,"id")&&(x&&(x[y(x)].material=H,T.container.style.cursor="default"),x=K.id,H=x[y(x)].material,x[y(x)].material=Z,T.container.style.cursor="pointer"):x&&(x[y(x)].material=H,x=null,T.container.style.cursor="default")}else{const K=w(z.endPosition);K?$.get(x,"id")!==$.get(K,"id")&&(x&&(x[y(x)].material=H,T.container.style.cursor="default"),x=K,H=x[y(x)].material,x[y(x)].material=Z,T.container.style.cursor="pointer"):x&&(x[y(x)].material=H,x=null,T.container.style.cursor="default")}},g.ScreenSpaceEventType.MOUSE_MOVE)},m=(D,x)=>{const H=navigator.hardwareConcurrency||4;let z=Math.ceil(H*1.5);return x==="cpu"&&(z=Math.max(2,Math.ceil(H/2))),D>=C?Math.min(200,z*4):D>1e3?Math.min(100,z*2):D>300?Math.min(50,z):Math.min(10,z)},L=(D=-1,x=-1)=>{W(H=>({...H,...n,cache:Y.current.size,items:D,total:x,currentZoomLevel:V.current.currentZoomLevel}))},k=()=>{if(c.entities&&c.entities.values.length>0){c.show=!1,G.current=0;const D=T.dataSources.getByName(`${p==null?void 0:p.dataSourcePrefix}${c.name}`)[0];D&&(D.show=!1,T.dataSources.remove(D))}L(0,0)},N=async(D,x="GET",H)=>{const z={method:x};H!==void 0&&(z.body=H);const U=await fetch(D,z);if(U.status===200)return await U.json()},A=document.createElement("canvas"),O=A.getContext("2d"),B=D=>{const x={fontName:"sans-serif",fontSize:14,padding:4,fillStyle:"white",strokeStyle:"black",lineWidth:3},H=D.split(`
22
- `),z=(p==null?void 0:p.fontSize)??x.fontSize,U=(p==null?void 0:p.padding)??x.padding,K=z+2;O.clearRect(0,0,A.width,A.height),O.font=`${z}px ${(p==null?void 0:p.fontName)??x.fontName}`;const ce=Math.max(...H.map(Ie=>O.measureText(Ie).width)),me=document.createElement("canvas");me.width=ce+U*2,me.height=K*H.length+U*2;const ye=me.getContext("2d");return ye.font=`${z}px ${(p==null?void 0:p.fontName)??x.fontName}`,ye.fillStyle=(p==null?void 0:p.fillStyle)??x.fillStyle,ye.strokeStyle=(p==null?void 0:p.strokeStyle)??x.strokeStyle,ye.lineWidth=(p==null?void 0:p.lineWidth)??x.lineWidth,H.forEach((Ie,Ge)=>{const We=U+(Ge+1)*K-4;ye.strokeText(Ie,U,We),ye.fillText(Ie,U,We)}),{dataURL:me.toDataURL(),width:me.width,height:me.height}},te=D=>p==null?void 0:p.text.pattern.replace(/\$\{([^}]+)\}/g,(H,z)=>{const U=p.text.fields.find(ce=>ce.name===z);let K="";if(U)if(U.predicate)K=U.predicate(D.properties[z]);else switch(U.type){case"date":K=Le.format(new Date(D.properties[z]),U.format??"dd/MM/yyyy");break;default:K=D.properties[z];break}return K}),ne=async(D,x)=>{const H=[];return D.length>0&&await ht(D,z=>{if(z.properties){const U=z.properties[b??"id"];let K=!0;if(s)try{K=fr(z.geometry),K||console.error("Skipped invalid WFS feature with",b??"id","->",U)}catch{K=!1,console.error("Skipped invalid WFS feature with",b??"id","->",U)}if(!Y.current.has(U)&&K){Y.current.add(U),z.properties.fetch_id=x;const ce=z.properties.description;if(z.properties.description=void 0,z.properties._description=ce,p){const me=B(te(z));z.properties.label=me}H.push(z)}}},{concurrency:m(D.length,"cpu")}),H},q=(D,x)=>Array.from(j.current.values()).filter(H=>JSON.stringify(H.parentBBox)!==JSON.stringify(D)).reduce((H,z)=>{const U=ji(x,z.bbox);return U>H.distance?{id:z.id,key:z.bbox.join(","),distance:U}:H},{id:"",key:"",distance:-1/0}),R=async D=>{const x=[];await ht(c.entities.values,H=>{if(H.properties&&H.properties.fetch_id.getValue()===D){const z=H.properties[b??"id"].getValue();Y.current.delete(z),x.push(H)}},{concurrency:m(c.entities.values.length,"cpu")}),x.length>0&&await ht(x,H=>{c.entities.remove(H)},{concurrency:m(x.length,"cpu")})},ie=async(D,x)=>{for(;Y.current.size>C;){const H=q(D,x);if(H.id==="")break;await R(H.id),H.key&&j.current.delete(H.key)}},ge=async(D,x,H,z)=>{let U="",K="",ce=[];if(D.numberReturned&&D.numberReturned!==0&&(D.bbox&&(K=D.bbox.join(","),j.current.has(K)||(U=Bt.v4())),ce=await ne(D.features,U),D.bbox&&ce.length>0&&!j.current.has(K)&&j.current.set(K,{id:U,parentBBox:x,bbox:D.bbox,timestamp:D.timeStamp,items:ce.length})),L(D.numberReturned!==0?H+D.numberReturned:D.numberMatched,D.numberMatched),ce.length===0){D.numberReturned&&D.numberReturned!==0?ve(++G.current*f):(G.current=0,fe(T,c,c.entities.values.map(ye=>ye.id),x));return}await ie(x,z);const me={type:"FeatureCollection",features:ce};await c.process(me,{describe:_}),T.scene.requestRender(),fe(T,c,ce.map(ye=>ye.id),x),D.numberReturned&&D.numberReturned!==0?ve(++G.current*f):G.current=0},ve=a.useCallback(async(D=0)=>{if(!T||T.scene.mode===g.SceneMode.MORPHING)return;const x=Zi(T);if(x){if(await oe(),V.current.currentZoomLevel>0&&V.current.currentZoomLevel<E&&(c==null?void 0:c.entities.values.length)>0){k();return}if(V.current.currentZoomLevel>=E){c.show=!0;const H=yn(x),z=Yi(x);try{const U=o.includes("?")?"&":"?";let K=`${o}${U}service=WFS&version=2.0.0&request=GetFeature&typeNames=${d}&outputFormat=application/json&bbox=${H.join(",")},EPSG:4326&startIndex=${D}&count=${f}`;b&&(K+=`&sortBy=${b}%20ASC`);const ce=await N(K);await ge(ce,H,D,z)}catch(U){console.error("Error fetching WFS data:",U),L(-1,-1)}}}},[]),oe=()=>new Promise(D=>{const x=setInterval(()=>{T.scene.globe.tilesLoaded&&(clearInterval(x),D())},100)}),fe=(D,x,H,z)=>{r?r(D,x,H,z):En(D,x,H,v,z,p)};return a.useEffect(()=>{const D=T.dataSources.getByName(ee)[0];D&&fe(T,D,[],void 0)},[T.scene.mode]),a.useEffect(()=>{T.layersManager&&T.layersManager.dataLayerList.length>0&&T.layersManager.findDataLayerById(n.id)!==void 0&&T.layersManager.addMetaToDataLayer(X)},[X]),a.useEffect(()=>{var D;(D=T.layersManager)==null||D.addDataLayer({options:t,meta:{...X},visualizationHandler:r})},[T.layersManager]),a.useEffect(()=>{T.dataSources.add(c);const D=()=>{ve()};T.scene.camera.moveEnd.addEventListener(D);const x=new g.ScreenSpaceEventHandler(T.scene.canvas);return P(x),V.current.currentZoomLevel>0&&(ve(),l.current=!0),()=>{var H;$.get(T,"_cesiumWidget")!==void 0&&(Y.current.clear(),j.current.clear(),T.dataSources.remove(T.dataSources.getByName(`${p==null?void 0:p.dataSourcePrefix}${c.name}`)[0]),T.dataSources.remove(c,!0),(H=T.layersManager)==null||H.removeDataLayer(n.id),T.scene.camera.moveEnd.removeEventListener(D),x.removeInputAction(g.ScreenSpaceEventType.MOUSE_MOVE))}},[]),null},Vn=e=>i.jsx(Me.Entity,{...e}),bo=e=>i.jsx(Me.EntityDescription,{...e}),Hn=e=>i.jsx(Me.EntityDescription,{...e}),Wn=e=>i.jsx(Me.PolygonGraphics,{...e}),zn=e=>i.jsx(Me.RectangleGraphics,{...e}),Un=e=>i.jsx(Me.CustomDataSource,{...e}),Co=e=>i.jsx(Me.PolylineGraphics,{...e}),xs="";var xe=function(){var e=M.Ellipsoid.WGS84,t,n=M.Material.fromType(M.Material.ColorType);function r(l,c=new M.Color(1,1,0,.5),_=new M.Color(1,1,1,1)){this._scene=l.scene,n.uniforms.color=c,t=_,this._tooltip={setVisible:()=>{},showAt:()=>{}},this._surfaces=[],this.initialiseHandlers(),this.enhancePrimitives()}r.prototype.initialiseHandlers=function(){var l=this._scene,c=this,_=new M.ScreenSpaceEventHandler(l.canvas);function y(w,P){if(c._handlersMuted!=!0){var m=l.pick(P);m&&m.primitive&&m.primitive[w]&&m.primitive[w](P)}}_.setInputAction(function(w){y("leftClick",w.position)},M.ScreenSpaceEventType.LEFT_CLICK),_.setInputAction(function(w){y("leftDoubleClick",w.position)},M.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);var S;_.setInputAction(function(w){if(c._handlersMuted!=!0){var P=l.pick(w.endPosition);S&&(!P||S!=P.primitive)&&(!(S.isDestroyed&&S.isDestroyed())&&S.mouseOut(w.endPosition),S=null),P&&P.primitive&&(P=P.primitive,P.mouseOut&&(S=P),P.mouseMove&&P.mouseMove(w.endPosition))}},M.ScreenSpaceEventType.MOUSE_MOVE),_.setInputAction(function(w){y("leftUp",w.position)},M.ScreenSpaceEventType.LEFT_UP),_.setInputAction(function(w){y("leftDown",w.position)},M.ScreenSpaceEventType.LEFT_DOWN)},r.prototype.setListener=function(l,c,_){l[c]=_},r.prototype.muteHandlers=function(l){this._handlersMuted=l},r.prototype.registerEditableShape=function(l){var c=this;Z(l,"mouseMove",function(_){l.setHighlighted(!0),l._editMode||c._tooltip.showAt(_,"Click to edit this shape")}),Z(l,"mouseOut",function(_){l.setHighlighted(!1),c._tooltip.setVisible(!1)}),Z(l,"leftClick",function(_){l.setEditMode(!0)})},r.prototype.startDrawing=function(l){this.disableAllEditMode(),this.editCleanUp&&this.editCleanUp(),this.editCleanUp=l,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(l){this._highlightedSurface&&!this._highlightedSurface.isDestroyed()&&this._highlightedSurface!=l&&this._highlightedSurface.setHighlighted(!1),this._highlightedSurface=l},r.prototype.disableAllEditMode=function(){this.setEdited(void 0)},r.prototype.setEdited=function(l){this._editedSurface&&!this._editedSurface.isDestroyed()&&this._editedSurface.setEditMode(!1),this._editedSurface=l};var s={ellipsoid:M.Ellipsoid.WGS84,textureRotationAngle:0,height:0,asynchronous:!0,show:!0,debugShowBoundingVolume:!1},o=W(s,{appearance:new M.EllipsoidSurfaceAppearance({aboveGround:!1}),material:n,granularity:Math.PI/180}),d=W(s,{}),h=W(s,{}),f=W(s,{}),E=W(o,{rotation:0}),C=W(s,{width:5,geodesic:!0,granularity:1e4,appearance:new M.PolylineMaterialAppearance({aboveGround:!1}),material:n}),b=function(){function l(){}return l.prototype.initialiseOptions=function(c){X(this,c),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},l.prototype.setAttribute=function(c,_){this[c]=_,this._createPrimitive=!0},l.prototype.getAttribute=function(c){return this[c]},l.prototype.update=function(c,_,y){if(!M.defined(this.ellipsoid))throw new M.DeveloperError("this.ellipsoid must be defined.");if(!M.defined(this.appearance))throw new M.DeveloperError("this.material must be defined.");if(this.granularity<0)throw new M.DeveloperError("this.granularity and scene2D/scene3D overrides must be greater than zero.");if(this.show&&!(!this._createPrimitive&&!M.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 M.Primitive({geometryInstances:new M.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 M.Primitive({geometryInstances:new M.GeometryInstance({geometry:this.getOutlineGeometry(),attributes:{color:M.ColorGeometryInstanceAttribute.fromColor(this.strokeColor)}}),appearance:new M.PerInstanceColorAppearance({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:this.strokeWidth||4}})}))}var w=this._primitive;w.appearance.material=this.material,w.debugShowBoundingVolume=this.debugShowBoundingVolume,w.update(c,_,y),this._outlinePolygon&&this._outlinePolygon.update(c,_,y)}},l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),M.destroyObject(this)},l.prototype.setStrokeStyle=function(c,_){(!this.strokeColor||!this.strokeColor.equals(c)||this.strokeWidth!=_)&&(this._createPrimitive=!0,this.strokeColor=c,this.strokeWidth=_)},l}();r.ExtentPrimitive=function(){function l(c){if(!M.defined(c.extent))throw new M.DeveloperError("Extent is required");c=W(c,o),this.initialiseOptions(c),this.setExtent(c.extent)}return l.prototype=new b,l.prototype.setExtent=function(c){this.setAttribute("extent",c)},l.prototype.getExtent=function(){return this.getAttribute("extent")},l.prototype.getGeometry=function(){if(M.defined(this.extent))return new M.RectangleGeometry({rectangle:this.extent,height:this.height,vertexFormat:M.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return new M.RectangleOutlineGeometry({rectangle:this.extent})},l}(),r.PolygonPrimitive=function(){function l(c){c=W(c,o),this.initialiseOptions(c),this.isPolygon=!0}return l.prototype=new b,l.prototype.setPositions=function(c){this.setAttribute("positions",c)},l.prototype.getPositions=function(){return this.getAttribute("positions")},l.prototype.getGeometry=function(){if(!(!M.defined(this.positions)||this.positions.length<3))return M.PolygonGeometry.fromPositions({positions:this.positions,height:this.height,vertexFormat:M.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return M.PolygonOutlineGeometry.fromPositions({positions:this.getPositions()})},l}(),r.CirclePrimitive=function(){function l(c){if(!(M.defined(c.center)&&M.defined(c.radius)))throw new M.DeveloperError("Center and radius are required");c=W(c,o),this.initialiseOptions(c),this.setRadius(c.radius)}return l.prototype=new b,l.prototype.setCenter=function(c){this.setAttribute("center",c)},l.prototype.setRadius=function(c){this.setAttribute("radius",Math.max(.1,c))},l.prototype.getCenter=function(){return this.getAttribute("center")},l.prototype.getRadius=function(){return this.getAttribute("radius")},l.prototype.getGeometry=function(){if(M.defined(this.center)&&M.defined(this.radius))return new M.CircleGeometry({center:this.center,radius:this.radius,height:this.height,vertexFormat:M.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return new M.CircleOutlineGeometry({center:this.getCenter(),radius:this.getRadius()})},l}(),r.EllipsePrimitive=function(){function l(c){if(!(M.defined(c.center)&&M.defined(c.semiMajorAxis)&&M.defined(c.semiMinorAxis)))throw new M.DeveloperError("Center and semi major and semi minor axis are required");c=W(c,E),this.initialiseOptions(c)}return l.prototype=new b,l.prototype.setCenter=function(c){this.setAttribute("center",c)},l.prototype.setSemiMajorAxis=function(c){c<this.getSemiMinorAxis()||this.setAttribute("semiMajorAxis",c)},l.prototype.setSemiMinorAxis=function(c){c>this.getSemiMajorAxis()||this.setAttribute("semiMinorAxis",c)},l.prototype.setRotation=function(c){return this.setAttribute("rotation",c)},l.prototype.getCenter=function(){return this.getAttribute("center")},l.prototype.getSemiMajorAxis=function(){return this.getAttribute("semiMajorAxis")},l.prototype.getSemiMinorAxis=function(){return this.getAttribute("semiMinorAxis")},l.prototype.getRotation=function(){return this.getAttribute("rotation")},l.prototype.getGeometry=function(){if(M.defined(this.center)&&M.defined(this.semiMajorAxis)&&M.defined(this.semiMinorAxis))return new M.EllipseGeometry({ellipsoid:this.ellipsoid,center:this.center,semiMajorAxis:this.semiMajorAxis,semiMinorAxis:this.semiMinorAxis,rotation:this.rotation,height:this.height,vertexFormat:M.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return new M.EllipseOutlineGeometry({center:this.getCenter(),semiMajorAxis:this.getSemiMajorAxis(),semiMinorAxis:this.getSemiMinorAxis(),rotation:this.getRotation()})},l}(),r.PolylinePrimitive=function(){function l(c){c=W(c,C),this.initialiseOptions(c)}return l.prototype=new b,l.prototype.setPositions=function(c){this.setAttribute("positions",c)},l.prototype.setWidth=function(c){this.setAttribute("width",c)},l.prototype.setGeodesic=function(c){this.setAttribute("geodesic",c)},l.prototype.getPositions=function(){return this.getAttribute("positions")},l.prototype.getWidth=function(){return this.getAttribute("width")},l.prototype.getGeodesic=function(c){return this.getAttribute("geodesic")},l.prototype.getGeometry=function(){if(!(!M.defined(this.positions)||this.positions.length<2))return new M.PolylineGeometry({positions:this.positions,height:this.height,width:this.width<1?1:this.width,vertexFormat:M.EllipsoidSurfaceAppearance.VERTEX_FORMAT,ellipsoid:this.ellipsoid})},l}();var p={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},v={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},I={iconUrl:"./assets/img/dragIconLight.png",shiftX:0,shiftY:0};r.prototype.createBillboardGroup=function(l,c,_){var y=new r.BillboardGroup(this,c);return y.addBillboards(l,_),y},r.BillboardGroup=function(l,c){this._drawHelper=l,this._scene=l._scene,this._options=W(c,p);var _=new M.BillboardCollection;this._scene.primitives.add(_),this._billboards=_,this._orderedBillboards=[]},r.BillboardGroup.prototype.createBillboard=function(l,c){var _=this._billboards.add({show:!0,position:l,pixelOffset:new M.Cartesian2(this._options.shiftX,this._options.shiftY),eyeOffset:new M.Cartesian3(0,0,0),horizontalOrigin:M.HorizontalOrigin.CENTER,verticalOrigin:M.VerticalOrigin.CENTER,scale:1,image:this._options.iconUrl,color:t});if(c){let w=function(m){S.enableRotate=m},P=function(){for(var m=0,L=y._orderedBillboards.length;m<L&&y._orderedBillboards[m]!=_;++m);return m};var y=this,S=this._scene.screenSpaceCameraController;if(c.dragHandlers){var y=this;Z(_,"leftDown",function(L){function k(O){_.position=O;for(var B=0,te=y._orderedBillboards.length;B<te&&y._orderedBillboards[B]!=_;++B);c.dragHandlers.onDrag&&c.dragHandlers.onDrag(P(),O)}function N(O){A.destroy(),w(!0),c.dragHandlers.onDragEnd&&c.dragHandlers.onDragEnd(P(),O)}var A=new M.ScreenSpaceEventHandler(y._scene.canvas);A.setInputAction(function(O){var B=y._scene.camera.pickEllipsoid(O.endPosition,e);B?k(B):N(B)},M.ScreenSpaceEventType.MOUSE_MOVE),A.setInputAction(function(O){N(y._scene.camera.pickEllipsoid(O.position,e))},M.ScreenSpaceEventType.LEFT_UP),w(!1),c.dragHandlers.onDragStart&&c.dragHandlers.onDragStart(P(),y._scene.camera.pickEllipsoid(L,e))})}c.onDoubleClick&&Z(_,"leftDoubleClick",function(m){c.onDoubleClick(P())}),c.onClick&&Z(_,"leftClick",function(m){c.onClick(P())}),c.tooltip&&(Z(_,"mouseMove",function(m){y._drawHelper._tooltip.showAt(m,c.tooltip())}),Z(_,"mouseOut",function(m){y._drawHelper._tooltip.setVisible(!1)}))}return _},r.BillboardGroup.prototype.insertBillboard=function(l,c,_){this._orderedBillboards.splice(l,0,this.createBillboard(c,_))},r.BillboardGroup.prototype.addBillboard=function(l,c){this._orderedBillboards.push(this.createBillboard(l,c))},r.BillboardGroup.prototype.addBillboards=function(l,c){for(var _=0;_<l.length;_++)this.addBillboard(l[_],c)},r.BillboardGroup.prototype.updateBillboardsPositions=function(l){for(var c=0;c<l.length;c++)this.getBillboard(c).position=l[c]},r.BillboardGroup.prototype.countBillboards=function(){return this._orderedBillboards.length},r.BillboardGroup.prototype.getBillboard=function(l){return this._orderedBillboards[l]},r.BillboardGroup.prototype.removeBillboard=function(l){this._billboards.remove(this.getBillboard(l)),this._orderedBillboards.splice(l,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(c){var c=W(c,p);this.startDrawing(function(){w.remove(),P.destroy(),S.setVisible(!1)});var _=this,y=this._scene;y.primitives;var S=this._tooltip,w=new r.BillboardGroup(this,c),P=new M.ScreenSpaceEventHandler(y.canvas);P.setInputAction(function(m){if(m.position!=null){var L=y.camera.pickEllipsoid(m.position,e);L&&(w.addBillboard(L),_.stopDrawing(),c.callback(L))}},M.ScreenSpaceEventType.LEFT_CLICK),P.setInputAction(function(m){var L=m.endPosition;if(L!=null){var k=y.camera.pickEllipsoid(L,e);k?S.showAt(L,"<p>Click to add your marker. Position is: </p>"+Y(e.cartesianToCartographic(k))):S.showAt(L,"<p>Click on the globe to add your marker.</p>")}},M.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.startDrawingPolygon=function(c){var c=W(c,o);this.startDrawingPolyshape(!0,c)},r.prototype.startDrawingPolyline=function(c){var c=W(c,C);this.startDrawingPolyshape(!1,c)},r.prototype.startDrawingPolyshape=function(l,c){this.startDrawing(function(){S.remove(m),k.remove(),N.destroy(),w.setVisible(!1),V(y)});var _=this,y=this._scene,S=y.primitives,w=this._tooltip,P=l?3:2,m;l?m=new xe.PolygonPrimitive(c):m=new xe.PolylinePrimitive(c),m.asynchronous=!1,S.add(m);var L=[],k=new r.BillboardGroup(this,p),N=new M.ScreenSpaceEventHandler(y.canvas);F(y),N.setInputAction(function(A){if(A.position!=null){var O=y.camera.pickEllipsoid(A.position,e);O&&(L.length==0&&(L.push(O.clone()),k.addBillboard(L[0])),L.length>=P&&(m.positions=L,m._createPrimitive=!0),L.push(O),k.addBillboard(O))}},M.ScreenSpaceEventType.LEFT_CLICK),N.setInputAction(function(A){var O=A.endPosition;if(O!=null)if(L.length==0)w.showAt(O,"<p>Click to add first point</p>");else{var B=y.camera.pickEllipsoid(O,e);B&&(L.pop(),B.y+=1+Math.random(),L.push(B),L.length>=P&&(m.positions=L,m._createPrimitive=!0),k.getBillboard(L.length-1).position=B,w.showAt(O,"<p>Click to add new point ("+L.length+")</p>"+(L.length>P?"<p>Double click to finish drawing</p>":"")))}},M.ScreenSpaceEventType.MOUSE_MOVE),N.setInputAction(function(A){var O=A.position;if(O!=null){if(L.length<P+2)return;var B=y.camera.pickEllipsoid(O,e);B&&(V(y),_.stopDrawing(),typeof c.callback=="function"&&(L.length-1,c.callback(L)))}},M.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)};function T(l){return e.cartographicArrayToCartesianArray([M.Rectangle.northwest(l),M.Rectangle.northeast(l),M.Rectangle.southeast(l),M.Rectangle.southwest(l)])}function F(l){l&&(l.canvas.style.cursor="crosshair")}function V(l){l&&(l.canvas.style.cursor="")}r.prototype.startDrawingExtent=function(c){var c=W(c,o);this.startDrawing(function(){m!=null&&S.remove(m),L!=null&&L.remove(),k.destroy(),w.setVisible(!1),V(y)});var _=this,y=this._scene,S=this._scene.primitives,w=this._tooltip,P=null,m=null,L=null,k=new M.ScreenSpaceEventHandler(y.canvas);F(y);function N(A){m==null&&(m=new xe.ExtentPrimitive({extent:A,material:c.material}),m.asynchronous=!1,S.add(m)),m.setExtent(A);var O=T(A);L==null?(L=new r.BillboardGroup(_,p),L.addBillboards(O)):L.updateBillboardsPositions(O)}k.setInputAction(function(A){if(A.position!=null){var O=y.camera.pickEllipsoid(A.position,e);if(O)if(m==null){P=e.cartesianToCartographic(O);var B=j(P,P);N(B)}else _.stopDrawing(),typeof c.callback=="function"&&c.callback(j(P,e.cartesianToCartographic(O)))}},M.ScreenSpaceEventType.LEFT_DOWN),k.setInputAction(function(A){var O=A.endPosition;if(O!=null)if(m==null)w.showAt(O,"<p>Click to start drawing rectangle</p>");else{var B=y.camera.pickEllipsoid(O,e);if(B){var te=j(P,e.cartesianToCartographic(B));N(te),w.showAt(O,"<p>Drag to change rectangle extent</p><p>Click again to finish drawing</p>")}}},M.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.startDrawingCircle=function(c){var c=W(c,o);this.startDrawing(function(){P!=null&&S.remove(P),m.remove(),L.destroy(),w.setVisible(!1)});var _=this,y=this._scene,S=this._scene.primitives,w=this._tooltip,P=null,m=null,L=new M.ScreenSpaceEventHandler(y.canvas);L.setInputAction(function(k){if(k.position!=null){var N=y.camera.pickEllipsoid(k.position,e);N&&(P==null?(P=new r.CirclePrimitive({center:N,radius:0,asynchronous:!1,material:c.material}),S.add(P),m=new r.BillboardGroup(_,p),m.addBillboards([N])):(typeof c.callback=="function"&&c.callback(P.getCenter(),P.getRadius()),_.stopDrawing()))}},M.ScreenSpaceEventType.LEFT_DOWN),L.setInputAction(function(k){var N=k.endPosition;if(N!=null)if(P==null)w.showAt(N,"<p>Click to start drawing the circle</p>");else{var A=y.camera.pickEllipsoid(N,e);A&&(P.setRadius(M.Cartesian3.distance(P.getCenter(),A)),m.updateBillboardsPositions(A),w.showAt(N,"<p>Move mouse to change circle radius</p><p>Click again to finish drawing</p>"))}},M.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.enhancePrimitives=function(){var l=this;M.Billboard.prototype.setEditable=function(){if(this._editable)return;this._editable=!0;var y=this,S=this;function w(P){l._scene.screenSpaceCameraController.enableRotate=P}Z(y,"leftDown",function(P){function m(N){y.position=N,S.executeListeners({name:"drag",positions:N})}function L(N){k.destroy(),w(!0),S.executeListeners({name:"dragEnd",positions:N})}var k=new M.ScreenSpaceEventHandler(l._scene.canvas);k.setInputAction(function(N){var A=l._scene.camera.pickEllipsoid(N.endPosition,e);A?m(A):L(A)},M.ScreenSpaceEventType.MOUSE_MOVE),k.setInputAction(function(N){L(l._scene.camera.pickEllipsoid(N.position,e))},M.ScreenSpaceEventType.LEFT_UP),w(!1)}),ee(y)};function c(y){l._scene,!(this._highlighted&&this._highlighted==y)&&this._editMode!==!0&&(this._highlighted=y,y?(l.setHighlighted(this),this._strokeColor=this.strokeColor,this.setStrokeStyle(M.Color.fromCssColorString("white"),this.strokeWidth)):this._strokeColor?this.setStrokeStyle(this._strokeColor,this.strokeWidth):this.setStrokeStyle(void 0,void 0))}function _(y){if(this._editMode!=y)if(l.disableAllHighlights(),y){l.setEdited(this);var S=l._scene,w=this;if(this._markers==null){let B=function(q,R){var ie=q-1<0?R.length-1:q-1;ie<m.countBillboards()&&(m.getBillboard(ie).position=ne(ie)),ie=q,ie<m.countBillboards()&&(m.getBillboard(ie).position=ne(ie))},te=function(){w.executeListeners({name:"onEdited",positions:w.positions})},ne=function(q){var R=w.positions;return e.cartographicToCartesian(new M.EllipsoidGeodesic(e.cartesianToCartographic(R[q]),e.cartesianToCartographic(R[q<R.length-1?q+1:0])).interpolateUsingFraction(.5))};var P=new r.BillboardGroup(l,v),m=new r.BillboardGroup(l,I),L={dragHandlers:{onDrag:function(q,R){w.positions[q]=R,B(q,w.positions),w._createPrimitive=!0},onDragEnd:function(q,R){w._createPrimitive=!0,te()}},onDoubleClick:function(q){w.positions.length<4||(w.positions.splice(q,1),w._createPrimitive=!0,P.removeBillboard(q),m.removeBillboard(q),B(q,w.positions),te())},tooltip:function(){if(w.positions.length>3)return"Double click to remove this point"}};P.addBillboards(w.positions,L),this._markers=P;for(var k=[],N=0,A=w.positions.length+(this.isPolygon?0:-1);N<A;N++)k.push(ne(N));var O={dragHandlers:{onDragStart:function(q,R){this.index=q+1,w.positions.splice(this.index,0,R),w._createPrimitive=!0},onDrag:function(q,R){w.positions[this.index]=R,w._createPrimitive=!0},onDragEnd:function(q,R){P.insertBillboard(this.index,R,L),m.getBillboard(this.index-1).position=ne(this.index-1),m.insertBillboard(this.index,ne(this.index),O),w._createPrimitive=!0,te()}},tooltip:function(){return"Drag to create a new point"}};m.addBillboards(k,O),this._editMarkers=m,this._globeClickhandler=new M.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(q){var R=S.pick(q.position);R&&R.primitive||w.setEditMode(!1)},M.ScreenSpaceEventType.LEFT_CLICK),P.setOnTop(),m.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}xe.PolylinePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this;y.isPolygon=!1,y.asynchronous=!1,l.registerEditableShape(y),y.setEditMode=_;var S=this.width;y.setHighlighted=function(w){this._editMode!==!0&&(w?(l.setHighlighted(this),this.setWidth(S*2)):this.setWidth(S))},y.getExtent=function(){return M.Rectangle.fromCartographicArray(e.cartesianArrayToCartographicArray(this.positions))},ee(y),y.setEditMode(!1)}},xe.PolygonPrimitive.prototype.setEditable=function(){var y=this;y.asynchronous=!1,l._scene,l.registerEditableShape(y),y.setEditMode=_,y.setHighlighted=c,ee(y),y.setEditMode(!1)},xe.ExtentPrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this,S=l._scene;l.registerEditableShape(y),y.asynchronous=!1,y.setEditMode=function(w){if(this._editMode!=w)if(l.disableAllHighlights(),w){if(l.setEdited(this),this._markers==null){let L=function(){y.executeListeners({name:"onEdited",extent:y.extent})};var P=new r.BillboardGroup(l,v),m={dragHandlers:{onDrag:function(k,N){var A=P.getBillboard((k+2)%4).position;y.setExtent(j(e.cartesianToCartographic(A),e.cartesianToCartographic(N))),P.updateBillboardsPositions(T(y.extent))},onDragEnd:function(k,N){L()}},tooltip:function(){return"Drag to change the corners of this extent"}};P.addBillboards(T(y.extent),m),this._markers=P,this._globeClickhandler=new M.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(k){var N=S.pick(k.position);N&&!N.isDestroyed()&&N.primitive||y.setEditMode(!1)},M.ScreenSpaceEventType.LEFT_CLICK),P.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},y.setHighlighted=c,ee(y),y.setEditMode(!1)}},r.EllipsePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this,S=l._scene;y.asynchronous=!1,l.registerEditableShape(y),y.setEditMode=function(w){if(this._editMode!=w)if(l.disableAllHighlights(),w){l.setEdited(this);var P=this;if(this._markers==null){let k=function(){return M.EllipseOutlineGeometry(e,y.getCenter(),y.getSemiMajorAxis(),y.getSemiMinorAxis(),y.getRotation()+Math.PI/2,Math.PI/2).splice(0,4)},N=function(){y.executeListeners({name:"onEdited",center:y.getCenter(),semiMajorAxis:y.getSemiMajorAxis(),semiMinorAxis:y.getSemiMinorAxis(),rotation:0})};var m=new r.BillboardGroup(l,v),L={dragHandlers:{onDrag:function(A,O){var B=M.Cartesian3.distance(y.getCenter(),O);A%2==0?y.setSemiMajorAxis(B):y.setSemiMinorAxis(B),m.updateBillboardsPositions(k())},onDragEnd:function(A,O){N()}},tooltip:function(){return"Drag to change the excentricity and radius"}};m.addBillboards(k(),L),this._markers=m,this._globeClickhandler=new M.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(A){var O=S.pick(A.position);O&&O.primitive||P.setEditMode(!1)},M.ScreenSpaceEventType.LEFT_CLICK),m.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},y.setHighlighted=c,ee(y),y.setEditMode(!1)}},r.CirclePrimitive.prototype.getCircleCartesianCoordinates=function(y){for(var S=M.CircleOutlineGeometry.createGeometry(new M.CircleOutlineGeometry({ellipsoid:e,center:this.getCenter(),radius:this.getRadius(),granularity:y})),w=0,P,m=[];w<S.attributes.position.values.length;w+=3)P=S.attributes.position.values,m.push(new M.Cartesian3(P[w],P[w+1],P[w+2]));return m},r.CirclePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this,S=l._scene;y.asynchronous=!1,l.registerEditableShape(y),y.setEditMode=function(w){if(this._editMode!=w)if(l.disableAllHighlights(),w){l.setEdited(this);var P=this;if(this._markers==null){let k=function(){return P.getCircleCartesianCoordinates(M.Math.PI_OVER_TWO)},N=function(){y.executeListeners({name:"onEdited",center:y.getCenter(),radius:y.getRadius()})};var m=new r.BillboardGroup(l,v),L={dragHandlers:{onDrag:function(A,O){y.setRadius(M.Cartesian3.distance(y.getCenter(),O)),m.updateBillboardsPositions(k())},onDragEnd:function(A,O){N()}},tooltip:function(){return"Drag to change the radius"}};m.addBillboards(k(),L),this._markers=m,this._globeClickhandler=new M.ScreenSpaceEventHandler(S.canvas),this._globeClickhandler.setInputAction(function(A){var O=S.pick(A.position);O&&O.primitive||P.setEditMode(!1)},M.ScreenSpaceEventType.LEFT_CLICK),m.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},y.setHighlighted=c,ee(y),y.setEditMode(!1)}}},r.DrawHelperWidget=function(){function l(c,_){if(!M.defined(_.container))throw new M.DeveloperError("Container is required");var y={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:d,extentDrawingOptions:h,circleDrawingOptions:f};X(_,y);var S=this,w=document.createElement("DIV");w.className="toolbar",_.container.appendChild(w);function P(k,N,A,O){var B=document.createElement("DIV");B.className="button",B.title=A,w.appendChild(B),B.onclick=O;var te=document.createElement("SPAN");B.appendChild(te);var ne=document.createElement("IMG");return ne.src=N,te.appendChild(ne),B}var m=c._scene;P("marker",_.markerIcon,"Click to start drawing a 2D marker",function(){c.startDrawingMarker({callback:function(k){S.executeListeners({name:"markerCreated",position:k})}})}),P("polyline",_.polylineIcon,"Click to start drawing a 2D polyline",function(){c.startDrawingPolyline({callback:function(k){S.executeListeners({name:"polylineCreated",positions:k})}})}),P("polygon",_.polygonIcon,"Click to start drawing a 2D polygon",function(){c.startDrawingPolygon({callback:function(k){S.executeListeners({name:"polygonCreated",positions:k})}})}),P("extent",_.extentIcon,"Click to start drawing an Extent",function(){c.startDrawingExtent({callback:function(k){S.executeListeners({name:"extentCreated",extent:k})}})}),P("circle",_.circleIcon,"Click to start drawing a Circle",function(){c.startDrawingCircle({callback:function(k,N){S.executeListeners({name:"circleCreated",center:k,radius:N})}})});var L=document.createElement("DIV");L.className="divider",w.appendChild(L),P("clear",_.clearIcon,"Remove all primitives",function(){m.primitives.removeAll()}),ee(this)}return l}(),r.prototype.addToolbar=function(l,c){return c=W(c,{container:l}),new r.DrawHelperWidget(this,c)};function j(l,c){var _=new M.Rectangle;_.west=Math.min(l.longitude,c.longitude),_.east=Math.max(l.longitude,c.longitude),_.south=Math.min(l.latitude,c.latitude),_.north=Math.max(l.latitude,c.latitude);var y=M.Math.EPSILON7;return _.east-_.west<y&&(_.east+=y*2),_.north-_.south<y&&(_.north+=y*2),_}function Y(l,c){return l.longitude.toFixed(c||3)+", "+l.latitude.toFixed(c||3)}function G(l,c){if(l==null||typeof l!="object"||l.constructor!=Object&&l.constructor!=Array)return l;if(l.constructor==Date||l.constructor==RegExp||l.constructor==Function||l.constructor==String||l.constructor==Number||l.constructor==Boolean)return new l.constructor(l);c=c||new l.constructor;for(var _ in l)c[_]=typeof c[_]>"u"?G(l[_],null):c[_];return c}function X(l,c){l=l||{};var _;for(_ in c)l[_]===void 0&&(l[_]=G(c[_]))}function W(l,c){var _=G(l),y;for(y in c)_[y]===void 0&&(_[y]=G(c[y]));return _}function Z(l,c,_){l[c]=_}function ee(l){l._listeners={},l.addListener=function(c,_){return this._listeners[c]=this._listeners[c]||[],this._listeners[c].push(_),this._listeners[c].length},l.executeListeners=function(c,_){if(this._listeners[c.name]&&this._listeners[c.name].length>0)for(var y=0;y<this._listeners[c.name].length;y++)this._listeners[c.name][y](c);else _&&_(c)}}return r}();const Mo=e=>{const t=e.map(n=>{const r=g.Cartographic.fromCartesian(n);return[g.Math.toDegrees(r.longitude),g.Math.toDegrees(r.latitude)]});return t.push(t[0]),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[t]}}},_o=e=>{const t=Ht.lineString([[g.Math.toDegrees(e.west),g.Math.toDegrees(e.south)],[g.Math.toDegrees(e.east),g.Math.toDegrees(e.north)]]);return je(qe(t))},Po=2,Io=(e,t)=>{switch(e){case we.BOX:{if(t.features.length!==Po)throw new Error(`${e} must have 2 points`);const n=$.find(t.features,s=>{var o;return((o=s.properties)==null?void 0:o.type)===Ze.BOTTOM_LEFT}),r=$.find(t.features,s=>{var o;return((o=s.properties)==null?void 0:o.type)===Ze.TOP_RIGHT});if(r&&n){if(n.geometry.coordinates[0]===r.geometry.coordinates[0]&&n.geometry.coordinates[1]===r.geometry.coordinates[1])throw new Error(`${e} must define BOTTOM_LEFT and TOP_RIGHT different points`);return g.Rectangle.fromDegrees(n.geometry.coordinates[0],n.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`)}},Ao=e=>{const t=Ht.lineString([[e.west,e.south],[e.east,e.north]]);return je(qe(t)).geometry.coordinates[0].map(r=>g.Cartesian3.fromRadiansArray(r)[0])},Do=e=>{const{drawState:t,drawingMaterial:n,drawingVertexColor:r,material:s,hollow:o,outlineWidth:d}=e,h=pe(),[f,E]=a.useState();a.useEffect(()=>{E(new xe(h,n,r))},[]),a.useEffect(()=>{if(f){const b=f;if(t.drawing)switch(t.type){case we.POLYGON:h.scene.globe.depthTestAgainstTerrain=!1,b.startDrawingPolygon({callback:p=>{t.handler({primitive:p,type:we.POLYGON,geojson:Mo(p)})}});break;case we.BOX:h.scene.globe.depthTestAgainstTerrain=!1,b.startDrawingExtent({callback:p=>{t.handler({primitive:p,type:we.BOX,geojson:_o(p)})}});break;default:throw new Error(`[CESIUM DRAW]: ${t.type} unrecognized primitive to draw.`)}else b.stopDrawing(),h.scene.globe.depthTestAgainstTerrain=!0}},[t,f]);const C=b=>{try{let p=b.coordinates!==void 0?b.coordinates:Io(b.type,b.geojson);if(o!==!0)switch(b.type){case we.BOX:return i.jsx(zn,{coordinates:p,material:s??n});case we.POLYGON:return i.jsx(Wn,{hierarchy:new g.PolygonHierarchy(p),material:s??n});default:return i.jsx(i.Fragment,{})}else{switch(b.type){case we.BOX:p=Ao(p);break;case we.POLYGON:p=[...p,p[0]];break;default:return i.jsx(i.Fragment,{})}return i.jsx(Co,{clampToGround:!0,positions:p,width:d??1,material:s??n})}}catch(p){return console.error(p),i.jsx(i.Fragment,{})}};return i.jsx(Un,{...e,children:e.drawings.map((b,p)=>i.jsxs(Vn,{name:b.name,children:[i.jsxs(Hn,{children:[i.jsxs("h1",{children:["Drawed Entity ",b.name]}),i.jsx("p",{children:"This is description of drawed entity"})]}),C(b)]},b.id))})},Oo=()=>{const e=pe();return a.useEffect(()=>{e.extend(g.viewerCesiumInspectorMixin)},[e]),null},ko=-25,$n=2,xo=e=>{const t=pe(),n=(o,d=",")=>o.slice(o.indexOf(`
21
+ `},T=x=>x?x.polyline?"polyline":"polygon":"",b=x=>{var Y,j;const F=(j=(Y=x==null?void 0:x.polygon)==null?void 0:Y.hierarchy)==null?void 0:j.getValue(u.JulianDate.now());if(!F)return null;const W=F.positions;return u.BoundingSphere.fromPoints(W).center},M=x=>{const W=I.scene.drillPick(x).map(j=>j.id).filter(j=>j&&j.polygon&&j.entityCollection.owner.name===l);if(W.length===0)return null;const Y=W.map(j=>{const te=b(j);if(!te)return{entity:j,distance:Number.MAX_VALUE};const se=u.SceneTransforms.wgs84ToWindowCoordinates(I.scene,te);if(!se)return{entity:j,distance:Number.MAX_VALUE};const pe=x.x-se.x,ye=x.y-se.y,Ae=Math.sqrt(pe*pe+ye*ye);return{entity:j,distance:Ae}});return Y.sort((j,te)=>te.distance-j.distance),Y[0].entity},p=x=>{let F=null,W=null;x.setInputAction(Y=>{if(I.scene.mode===u.SceneMode.SCENE2D){const te=I.scene.pick(Y.endPosition);te&&te.id&&(te.id.polygon||te.id.polyline)?z.get(F,"id")!==z.get(te.id,"id")&&(F&&(F[T(F)].material=W,I.container.style.cursor="default"),F=te.id,W=F[T(F)].material,F[T(F)].material=X,I.container.style.cursor="pointer"):F&&(F[T(F)].material=W,F=null,I.container.style.cursor="default")}else{const te=M(Y.endPosition);te?z.get(F,"id")!==z.get(te,"id")&&(F&&(F[T(F)].material=W,I.container.style.cursor="default"),F=te,W=F[T(F)].material,F[T(F)].material=X,I.container.style.cursor="pointer"):F&&(F[T(F)].material=W,F=null,I.container.style.cursor="default")}},u.ScreenSpaceEventType.MOUSE_MOVE)},L=(x,F)=>{const W=navigator.hardwareConcurrency||4;let Y=Math.ceil(W*1.5);return F==="cpu"&&(Y=Math.max(2,Math.ceil(W/2))),x>=C?Math.min(200,Y*4):x>1e3?Math.min(100,Y*2):x>300?Math.min(50,Y):Math.min(10,Y)},A=(x=-1,F=-1)=>{N(W=>({...W,...r,cache:H.current.size,items:x,total:F,currentZoomLevel:q.current.currentZoomLevel}))},k=()=>{if(E.entities&&E.entities.values.length>0){E.show=!1,Z.current=0;const x=I.dataSources.getByName(`${y==null?void 0:y.dataSourcePrefix}${E.name}`)[0];x&&(x.show=!1,I.dataSources.remove(x))}A(0,0)},P=async(x,F={method:"GET"})=>{const W=await fetch(x,F);if(W.status===200)return await W.json()},O=document.createElement("canvas"),B=O.getContext("2d"),Q=x=>{const F={fontName:"sans-serif",fontSize:14,padding:4,fillStyle:"white",strokeStyle:"black",lineWidth:3},W=x.split(`
22
+ `),Y=(y==null?void 0:y.fontSize)??F.fontSize,j=(y==null?void 0:y.padding)??F.padding,te=Y+2;B.clearRect(0,0,O.width,O.height),B.font=`${Y}px ${(y==null?void 0:y.fontName)??F.fontName}`;const se=Math.max(...W.map(Ae=>B.measureText(Ae).width)),pe=document.createElement("canvas");pe.width=se+j*2,pe.height=te*W.length+j*2;const ye=pe.getContext("2d");return ye.font=`${Y}px ${(y==null?void 0:y.fontName)??F.fontName}`,ye.fillStyle=(y==null?void 0:y.fillStyle)??F.fillStyle,ye.strokeStyle=(y==null?void 0:y.strokeStyle)??F.strokeStyle,ye.lineWidth=(y==null?void 0:y.lineWidth)??F.lineWidth,W.forEach((Ae,He)=>{const $e=j+(He+1)*te-4;ye.strokeText(Ae,j,$e),ye.fillText(Ae,j,$e)}),{dataURL:pe.toDataURL(),width:pe.width,height:pe.height}},re=x=>y==null?void 0:y.text.pattern.replace(/\$\{([^}]+)\}/g,(W,Y)=>{const j=y.text.fields.find(se=>se.name===Y);let te="";if(j)if(j.predicate)te=j.predicate(x.properties[Y]);else switch(j.type){case"date":te=be.format(new Date(x.properties[Y]),j.format??"dd/MM/yyyy");break;default:te=x.properties[Y];break}return te}),K=async(x,F)=>{const W=[];return x.length>0&&await gt(x,Y=>{if(Y.properties){const j=Y.properties[v??"id"];let te=!0;if(o)try{te=mn(Y.geometry),te||console.error("Skipped invalid WFS feature with",v??"id","->",j)}catch{te=!1,console.error("Skipped invalid WFS feature with",v??"id","->",j)}if(!H.current.has(j)&&te){H.current.add(j),Y.properties.fetch_id=F;const se=Y.properties.description;if(Y.properties.description=void 0,Y.properties._description=se,y){const pe=Q(re(Y));Y.properties.label=pe}W.push(Y)}}},{concurrency:L(x.length,"cpu")}),W},J=(x,F)=>Array.from(R.current.values()).filter(W=>JSON.stringify(W.parentBBox)!==JSON.stringify(x)).reduce((W,Y)=>{const j=zi(F,Y.bbox);return j>W.distance?{id:Y.id,key:Y.bbox.join(","),distance:j}:W},{id:"",key:"",distance:-1/0}),ae=async x=>{const F=[];await gt(E.entities.values,W=>{if(W.properties&&W.properties.fetch_id.getValue()===x){const Y=W.properties[v??"id"].getValue();H.current.delete(Y),F.push(W)}},{concurrency:L(E.entities.values.length,"cpu")}),F.length>0&&await gt(F,W=>{E.entities.remove(W)},{concurrency:L(F.length,"cpu")})},ge=async(x,F)=>{for(;H.current.size>C;){const W=J(x,F);if(W.id==="")break;await ae(W.id),W.key&&R.current.delete(W.key)}},Te=async(x,F,W,Y)=>{let j="",te="",se=[];if(x.numberReturned&&x.numberReturned!==0&&(x.bbox&&(te=x.bbox.join(","),R.current.has(te)||(j=Ft.v4())),se=await K(x.features,j),x.bbox&&se.length>0&&!R.current.has(te)&&R.current.set(te,{id:j,parentBBox:F,bbox:x.bbox,timestamp:x.timeStamp,items:se.length})),A(x.numberReturned!==0?W+x.numberReturned:x.numberMatched,x.numberMatched),se.length===0){x.numberReturned&&x.numberReturned!==0?oe(++Z.current*w):(Z.current=0,me(I,E,E.entities.values.map(ye=>ye.id),F));return}await ge(F,Y);const pe={type:"FeatureCollection",features:se};await E.process(pe,{describe:m}),I.scene.requestRender(),me(I,E,se.map(ye=>ye.id),F),x.numberReturned&&x.numberReturned!==0?oe(++Z.current*w):Z.current=0},oe=a.useCallback(async(x=0)=>{if(!I||I.scene.mode===u.SceneMode.MORPHING)return;const F=$i(I);if(F){if(await ve(),q.current.currentZoomLevel>0&&q.current.currentZoomLevel<S&&(E==null?void 0:E.entities.values.length)>0){k();return}if(q.current.currentZoomLevel>=S){E.show=!0;const W=vr(F),Y=Ui(F);try{let j=null;if(g)if(g.type==="gql"){const{variablesDescriptor:te,...se}=g.gql;se.variables.data[te.featureProp]=qi(F),se.variables.data[te.startIndexProp]=x,se.variables.data[te.typeNameProp]=d,se.variables.data[te.countProp]=w,j=await P(s,{method:"POST",body:JSON.stringify(se),headers:{"Content-Type":"application/json"}});const pe=se.query.split("(")[0].replace("query ","");await Te(j==null?void 0:j.data[pe],W,x,Y)}else throw"API as alternative service still not supported";else{const te=s.includes("?")?"&":"?";let se=`${s}${te}service=WFS&version=2.0.0&request=GetFeature&typeNames=${d}&outputFormat=application/json&bbox=${W.join(",")},EPSG:4326&startIndex=${x}&count=${w}`;v&&(se+=`&sortBy=${v}%20ASC`),j=await P(se),await Te(j,W,x,Y)}}catch(j){console.error("Error fetching WFS data:",j),A(-1,-1)}}}},[]),ve=()=>new Promise(x=>{const F=setInterval(()=>{I.scene.globe.tilesLoaded&&(clearInterval(F),x())},100)}),me=(x,F,W,Y)=>{n?n(x,F,W,Y):Tr(x,F,W,D,Y,y)};return a.useEffect(()=>{const x=I.dataSources.getByName(l)[0];x&&me(I,x,[],void 0)},[I.scene.mode]),a.useEffect(()=>{I.layersManager&&I.layersManager.dataLayerList.length>0&&I.layersManager.findDataLayerById(r.id)!==void 0&&I.layersManager.addMetaToDataLayer($)},[$]),a.useEffect(()=>{var x;(x=I.layersManager)==null||x.addDataLayer({options:t,meta:{...$},visualizationHandler:n})},[I.layersManager]),a.useEffect(()=>{I.dataSources.add(E);const x=()=>{oe()};I.scene.camera.moveEnd.addEventListener(x);const F=new u.ScreenSpaceEventHandler(I.scene.canvas);return p(F),q.current.currentZoomLevel>0&&(oe(),c.current=!0),()=>{var W;z.get(I,"_cesiumWidget")!==void 0&&(H.current.clear(),R.current.clear(),I.dataSources.remove(I.dataSources.getByName(`${y==null?void 0:y.dataSourcePrefix}${E.name}`)[0]),I.dataSources.remove(E,!0),(W=I.layersManager)==null||W.removeDataLayer(r.id),I.scene.camera.moveEnd.removeEventListener(x),F.removeInputAction(u.ScreenSpaceEventType.MOUSE_MOVE))}},[]),null},Hr=e=>i.jsx(_e.Entity,{...e}),Po=e=>i.jsx(_e.EntityDescription,{...e}),Wr=e=>i.jsx(_e.EntityDescription,{...e}),zr=e=>i.jsx(_e.PolygonGraphics,{...e}),Ur=e=>i.jsx(_e.RectangleGraphics,{...e}),qr=e=>i.jsx(_e.CustomDataSource,{...e}),Ao=e=>i.jsx(_e.PolylineGraphics,{...e}),Gs="";var Fe=function(){var e=_.Ellipsoid.WGS84,t,r=_.Material.fromType(_.Material.ColorType);function n(l,c=new _.Color(1,1,0,.5),E=new _.Color(1,1,1,1)){this._scene=l.scene,r.uniforms.color=c,t=E,this._tooltip={setVisible:()=>{},showAt:()=>{}},this._surfaces=[],this.initialiseHandlers(),this.enhancePrimitives()}n.prototype.initialiseHandlers=function(){var l=this._scene,c=this,E=new _.ScreenSpaceEventHandler(l.canvas);function m(b,M){if(c._handlersMuted!=!0){var p=l.pick(M);p&&p.primitive&&p.primitive[b]&&p.primitive[b](M)}}E.setInputAction(function(b){m("leftClick",b.position)},_.ScreenSpaceEventType.LEFT_CLICK),E.setInputAction(function(b){m("leftDoubleClick",b.position)},_.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);var T;E.setInputAction(function(b){if(c._handlersMuted!=!0){var M=l.pick(b.endPosition);T&&(!M||T!=M.primitive)&&(!(T.isDestroyed&&T.isDestroyed())&&T.mouseOut(b.endPosition),T=null),M&&M.primitive&&(M=M.primitive,M.mouseOut&&(T=M),M.mouseMove&&M.mouseMove(b.endPosition))}},_.ScreenSpaceEventType.MOUSE_MOVE),E.setInputAction(function(b){m("leftUp",b.position)},_.ScreenSpaceEventType.LEFT_UP),E.setInputAction(function(b){m("leftDown",b.position)},_.ScreenSpaceEventType.LEFT_DOWN)},n.prototype.setListener=function(l,c,E){l[c]=E},n.prototype.muteHandlers=function(l){this._handlersMuted=l},n.prototype.registerEditableShape=function(l){var c=this;N(l,"mouseMove",function(E){l.setHighlighted(!0),l._editMode||c._tooltip.showAt(E,"Click to edit this shape")}),N(l,"mouseOut",function(E){l.setHighlighted(!1),c._tooltip.setVisible(!1)}),N(l,"leftClick",function(E){l.setEditMode(!0)})},n.prototype.startDrawing=function(l){this.disableAllEditMode(),this.editCleanUp&&this.editCleanUp(),this.editCleanUp=l,this.muteHandlers(!0)},n.prototype.stopDrawing=function(){this.editCleanUp&&(this.editCleanUp(),this.editCleanUp=null),this.muteHandlers(!1)},n.prototype.disableAllHighlights=function(){this.setHighlighted(void 0)},n.prototype.setHighlighted=function(l){this._highlightedSurface&&!this._highlightedSurface.isDestroyed()&&this._highlightedSurface!=l&&this._highlightedSurface.setHighlighted(!1),this._highlightedSurface=l},n.prototype.disableAllEditMode=function(){this.setEdited(void 0)},n.prototype.setEdited=function(l){this._editedSurface&&!this._editedSurface.isDestroyed()&&this._editedSurface.setEditMode(!1),this._editedSurface=l};var o={ellipsoid:_.Ellipsoid.WGS84,textureRotationAngle:0,height:0,asynchronous:!0,show:!0,debugShowBoundingVolume:!1},s=$(o,{appearance:new _.EllipsoidSurfaceAppearance({aboveGround:!1}),material:r,granularity:Math.PI/180}),d=$(o,{}),g=$(o,{}),f=$(o,{}),w=$(s,{rotation:0}),S=$(o,{width:5,geodesic:!0,granularity:1e4,appearance:new _.PolylineMaterialAppearance({aboveGround:!1}),material:r}),C=function(){function l(){}return l.prototype.initialiseOptions=function(c){Z(this,c),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},l.prototype.setAttribute=function(c,E){this[c]=E,this._createPrimitive=!0},l.prototype.getAttribute=function(c){return this[c]},l.prototype.update=function(c,E,m){if(!_.defined(this.ellipsoid))throw new _.DeveloperError("this.ellipsoid must be defined.");if(!_.defined(this.appearance))throw new _.DeveloperError("this.material must be defined.");if(this.granularity<0)throw new _.DeveloperError("this.granularity and scene2D/scene3D overrides must be greater than zero.");if(this.show&&!(!this._createPrimitive&&!_.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 T=this.getGeometry();if(!T)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 _.Primitive({geometryInstances:new _.GeometryInstance({geometry:T,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 _.Primitive({geometryInstances:new _.GeometryInstance({geometry:this.getOutlineGeometry(),attributes:{color:_.ColorGeometryInstanceAttribute.fromColor(this.strokeColor)}}),appearance:new _.PerInstanceColorAppearance({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:this.strokeWidth||4}})}))}var b=this._primitive;b.appearance.material=this.material,b.debugShowBoundingVolume=this.debugShowBoundingVolume,b.update(c,E,m),this._outlinePolygon&&this._outlinePolygon.update(c,E,m)}},l.prototype.isDestroyed=function(){return!1},l.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),_.destroyObject(this)},l.prototype.setStrokeStyle=function(c,E){(!this.strokeColor||!this.strokeColor.equals(c)||this.strokeWidth!=E)&&(this._createPrimitive=!0,this.strokeColor=c,this.strokeWidth=E)},l}();n.ExtentPrimitive=function(){function l(c){if(!_.defined(c.extent))throw new _.DeveloperError("Extent is required");c=$(c,s),this.initialiseOptions(c),this.setExtent(c.extent)}return l.prototype=new C,l.prototype.setExtent=function(c){this.setAttribute("extent",c)},l.prototype.getExtent=function(){return this.getAttribute("extent")},l.prototype.getGeometry=function(){if(_.defined(this.extent))return new _.RectangleGeometry({rectangle:this.extent,height:this.height,vertexFormat:_.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return new _.RectangleOutlineGeometry({rectangle:this.extent})},l}(),n.PolygonPrimitive=function(){function l(c){c=$(c,s),this.initialiseOptions(c),this.isPolygon=!0}return l.prototype=new C,l.prototype.setPositions=function(c){this.setAttribute("positions",c)},l.prototype.getPositions=function(){return this.getAttribute("positions")},l.prototype.getGeometry=function(){if(!(!_.defined(this.positions)||this.positions.length<3))return _.PolygonGeometry.fromPositions({positions:this.positions,height:this.height,vertexFormat:_.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return _.PolygonOutlineGeometry.fromPositions({positions:this.getPositions()})},l}(),n.CirclePrimitive=function(){function l(c){if(!(_.defined(c.center)&&_.defined(c.radius)))throw new _.DeveloperError("Center and radius are required");c=$(c,s),this.initialiseOptions(c),this.setRadius(c.radius)}return l.prototype=new C,l.prototype.setCenter=function(c){this.setAttribute("center",c)},l.prototype.setRadius=function(c){this.setAttribute("radius",Math.max(.1,c))},l.prototype.getCenter=function(){return this.getAttribute("center")},l.prototype.getRadius=function(){return this.getAttribute("radius")},l.prototype.getGeometry=function(){if(_.defined(this.center)&&_.defined(this.radius))return new _.CircleGeometry({center:this.center,radius:this.radius,height:this.height,vertexFormat:_.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,ellipsoid:this.ellipsoid,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return new _.CircleOutlineGeometry({center:this.getCenter(),radius:this.getRadius()})},l}(),n.EllipsePrimitive=function(){function l(c){if(!(_.defined(c.center)&&_.defined(c.semiMajorAxis)&&_.defined(c.semiMinorAxis)))throw new _.DeveloperError("Center and semi major and semi minor axis are required");c=$(c,w),this.initialiseOptions(c)}return l.prototype=new C,l.prototype.setCenter=function(c){this.setAttribute("center",c)},l.prototype.setSemiMajorAxis=function(c){c<this.getSemiMinorAxis()||this.setAttribute("semiMajorAxis",c)},l.prototype.setSemiMinorAxis=function(c){c>this.getSemiMajorAxis()||this.setAttribute("semiMinorAxis",c)},l.prototype.setRotation=function(c){return this.setAttribute("rotation",c)},l.prototype.getCenter=function(){return this.getAttribute("center")},l.prototype.getSemiMajorAxis=function(){return this.getAttribute("semiMajorAxis")},l.prototype.getSemiMinorAxis=function(){return this.getAttribute("semiMinorAxis")},l.prototype.getRotation=function(){return this.getAttribute("rotation")},l.prototype.getGeometry=function(){if(_.defined(this.center)&&_.defined(this.semiMajorAxis)&&_.defined(this.semiMinorAxis))return new _.EllipseGeometry({ellipsoid:this.ellipsoid,center:this.center,semiMajorAxis:this.semiMajorAxis,semiMinorAxis:this.semiMinorAxis,rotation:this.rotation,height:this.height,vertexFormat:_.EllipsoidSurfaceAppearance.VERTEX_FORMAT,stRotation:this.textureRotationAngle,granularity:this.granularity})},l.prototype.getOutlineGeometry=function(){return new _.EllipseOutlineGeometry({center:this.getCenter(),semiMajorAxis:this.getSemiMajorAxis(),semiMinorAxis:this.getSemiMinorAxis(),rotation:this.getRotation()})},l}(),n.PolylinePrimitive=function(){function l(c){c=$(c,S),this.initialiseOptions(c)}return l.prototype=new C,l.prototype.setPositions=function(c){this.setAttribute("positions",c)},l.prototype.setWidth=function(c){this.setAttribute("width",c)},l.prototype.setGeodesic=function(c){this.setAttribute("geodesic",c)},l.prototype.getPositions=function(){return this.getAttribute("positions")},l.prototype.getWidth=function(){return this.getAttribute("width")},l.prototype.getGeodesic=function(c){return this.getAttribute("geodesic")},l.prototype.getGeometry=function(){if(!(!_.defined(this.positions)||this.positions.length<2))return new _.PolylineGeometry({positions:this.positions,height:this.height,width:this.width<1?1:this.width,vertexFormat:_.EllipsoidSurfaceAppearance.VERTEX_FORMAT,ellipsoid:this.ellipsoid})},l}();var v={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},y={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},D={iconUrl:"./assets/img/dragIconLight.png",shiftX:0,shiftY:0};n.prototype.createBillboardGroup=function(l,c,E){var m=new n.BillboardGroup(this,c);return m.addBillboards(l,E),m},n.BillboardGroup=function(l,c){this._drawHelper=l,this._scene=l._scene,this._options=$(c,v);var E=new _.BillboardCollection;this._scene.primitives.add(E),this._billboards=E,this._orderedBillboards=[]},n.BillboardGroup.prototype.createBillboard=function(l,c){var E=this._billboards.add({show:!0,position:l,pixelOffset:new _.Cartesian2(this._options.shiftX,this._options.shiftY),eyeOffset:new _.Cartesian3(0,0,0),horizontalOrigin:_.HorizontalOrigin.CENTER,verticalOrigin:_.VerticalOrigin.CENTER,scale:1,image:this._options.iconUrl,color:t});if(c){let b=function(p){T.enableRotate=p},M=function(){for(var p=0,L=m._orderedBillboards.length;p<L&&m._orderedBillboards[p]!=E;++p);return p};var m=this,T=this._scene.screenSpaceCameraController;if(c.dragHandlers){var m=this;N(E,"leftDown",function(L){function A(O){E.position=O;for(var B=0,Q=m._orderedBillboards.length;B<Q&&m._orderedBillboards[B]!=E;++B);c.dragHandlers.onDrag&&c.dragHandlers.onDrag(M(),O)}function k(O){P.destroy(),b(!0),c.dragHandlers.onDragEnd&&c.dragHandlers.onDragEnd(M(),O)}var P=new _.ScreenSpaceEventHandler(m._scene.canvas);P.setInputAction(function(O){var B=m._scene.camera.pickEllipsoid(O.endPosition,e);B?A(B):k(B)},_.ScreenSpaceEventType.MOUSE_MOVE),P.setInputAction(function(O){k(m._scene.camera.pickEllipsoid(O.position,e))},_.ScreenSpaceEventType.LEFT_UP),b(!1),c.dragHandlers.onDragStart&&c.dragHandlers.onDragStart(M(),m._scene.camera.pickEllipsoid(L,e))})}c.onDoubleClick&&N(E,"leftDoubleClick",function(p){c.onDoubleClick(M())}),c.onClick&&N(E,"leftClick",function(p){c.onClick(M())}),c.tooltip&&(N(E,"mouseMove",function(p){m._drawHelper._tooltip.showAt(p,c.tooltip())}),N(E,"mouseOut",function(p){m._drawHelper._tooltip.setVisible(!1)}))}return E},n.BillboardGroup.prototype.insertBillboard=function(l,c,E){this._orderedBillboards.splice(l,0,this.createBillboard(c,E))},n.BillboardGroup.prototype.addBillboard=function(l,c){this._orderedBillboards.push(this.createBillboard(l,c))},n.BillboardGroup.prototype.addBillboards=function(l,c){for(var E=0;E<l.length;E++)this.addBillboard(l[E],c)},n.BillboardGroup.prototype.updateBillboardsPositions=function(l){for(var c=0;c<l.length;c++)this.getBillboard(c).position=l[c]},n.BillboardGroup.prototype.countBillboards=function(){return this._orderedBillboards.length},n.BillboardGroup.prototype.getBillboard=function(l){return this._orderedBillboards[l]},n.BillboardGroup.prototype.removeBillboard=function(l){this._billboards.remove(this.getBillboard(l)),this._orderedBillboards.splice(l,1)},n.BillboardGroup.prototype.remove=function(){this._billboards=this._billboards&&this._billboards.removeAll()&&this._billboards.destroy()},n.BillboardGroup.prototype.setOnTop=function(){this._scene.primitives.raiseToTop(this._billboards)},n.prototype.startDrawingMarker=function(c){var c=$(c,v);this.startDrawing(function(){b.remove(),M.destroy(),T.setVisible(!1)});var E=this,m=this._scene;m.primitives;var T=this._tooltip,b=new n.BillboardGroup(this,c),M=new _.ScreenSpaceEventHandler(m.canvas);M.setInputAction(function(p){if(p.position!=null){var L=m.camera.pickEllipsoid(p.position,e);L&&(b.addBillboard(L),E.stopDrawing(),c.callback(L))}},_.ScreenSpaceEventType.LEFT_CLICK),M.setInputAction(function(p){var L=p.endPosition;if(L!=null){var A=m.camera.pickEllipsoid(L,e);A?T.showAt(L,"<p>Click to add your marker. Position is: </p>"+R(e.cartesianToCartographic(A))):T.showAt(L,"<p>Click on the globe to add your marker.</p>")}},_.ScreenSpaceEventType.MOUSE_MOVE)},n.prototype.startDrawingPolygon=function(c){var c=$(c,s);this.startDrawingPolyshape(!0,c)},n.prototype.startDrawingPolyline=function(c){var c=$(c,S);this.startDrawingPolyshape(!1,c)},n.prototype.startDrawingPolyshape=function(l,c){this.startDrawing(function(){T.remove(p),A.remove(),k.destroy(),b.setVisible(!1),G(m)});var E=this,m=this._scene,T=m.primitives,b=this._tooltip,M=l?3:2,p;l?p=new Fe.PolygonPrimitive(c):p=new Fe.PolylinePrimitive(c),p.asynchronous=!1,T.add(p);var L=[],A=new n.BillboardGroup(this,v),k=new _.ScreenSpaceEventHandler(m.canvas);I(m),k.setInputAction(function(P){if(P.position!=null){var O=m.camera.pickEllipsoid(P.position,e);O&&(L.length==0&&(L.push(O.clone()),A.addBillboard(L[0])),L.length>=M&&(p.positions=L,p._createPrimitive=!0),L.push(O),A.addBillboard(O))}},_.ScreenSpaceEventType.LEFT_CLICK),k.setInputAction(function(P){var O=P.endPosition;if(O!=null)if(L.length==0)b.showAt(O,"<p>Click to add first point</p>");else{var B=m.camera.pickEllipsoid(O,e);B&&(L.pop(),B.y+=1+Math.random(),L.push(B),L.length>=M&&(p.positions=L,p._createPrimitive=!0),A.getBillboard(L.length-1).position=B,b.showAt(O,"<p>Click to add new point ("+L.length+")</p>"+(L.length>M?"<p>Double click to finish drawing</p>":"")))}},_.ScreenSpaceEventType.MOUSE_MOVE),k.setInputAction(function(P){var O=P.position;if(O!=null){if(L.length<M+2)return;var B=m.camera.pickEllipsoid(O,e);B&&(G(m),E.stopDrawing(),typeof c.callback=="function"&&(L.length-1,c.callback(L)))}},_.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)};function V(l){return e.cartographicArrayToCartesianArray([_.Rectangle.northwest(l),_.Rectangle.northeast(l),_.Rectangle.southeast(l),_.Rectangle.southwest(l)])}function I(l){l&&(l.canvas.style.cursor="crosshair")}function G(l){l&&(l.canvas.style.cursor="")}n.prototype.startDrawingExtent=function(c){var c=$(c,s);this.startDrawing(function(){p!=null&&T.remove(p),L!=null&&L.remove(),A.destroy(),b.setVisible(!1),G(m)});var E=this,m=this._scene,T=this._scene.primitives,b=this._tooltip,M=null,p=null,L=null,A=new _.ScreenSpaceEventHandler(m.canvas);I(m);function k(P){p==null&&(p=new Fe.ExtentPrimitive({extent:P,material:c.material}),p.asynchronous=!1,T.add(p)),p.setExtent(P);var O=V(P);L==null?(L=new n.BillboardGroup(E,v),L.addBillboards(O)):L.updateBillboardsPositions(O)}A.setInputAction(function(P){if(P.position!=null){var O=m.camera.pickEllipsoid(P.position,e);if(O)if(p==null){M=e.cartesianToCartographic(O);var B=q(M,M);k(B)}else E.stopDrawing(),typeof c.callback=="function"&&c.callback(q(M,e.cartesianToCartographic(O)))}},_.ScreenSpaceEventType.LEFT_DOWN),A.setInputAction(function(P){var O=P.endPosition;if(O!=null)if(p==null)b.showAt(O,"<p>Click to start drawing rectangle</p>");else{var B=m.camera.pickEllipsoid(O,e);if(B){var Q=q(M,e.cartesianToCartographic(B));k(Q),b.showAt(O,"<p>Drag to change rectangle extent</p><p>Click again to finish drawing</p>")}}},_.ScreenSpaceEventType.MOUSE_MOVE)},n.prototype.startDrawingCircle=function(c){var c=$(c,s);this.startDrawing(function(){M!=null&&T.remove(M),p.remove(),L.destroy(),b.setVisible(!1)});var E=this,m=this._scene,T=this._scene.primitives,b=this._tooltip,M=null,p=null,L=new _.ScreenSpaceEventHandler(m.canvas);L.setInputAction(function(A){if(A.position!=null){var k=m.camera.pickEllipsoid(A.position,e);k&&(M==null?(M=new n.CirclePrimitive({center:k,radius:0,asynchronous:!1,material:c.material}),T.add(M),p=new n.BillboardGroup(E,v),p.addBillboards([k])):(typeof c.callback=="function"&&c.callback(M.getCenter(),M.getRadius()),E.stopDrawing()))}},_.ScreenSpaceEventType.LEFT_DOWN),L.setInputAction(function(A){var k=A.endPosition;if(k!=null)if(M==null)b.showAt(k,"<p>Click to start drawing the circle</p>");else{var P=m.camera.pickEllipsoid(k,e);P&&(M.setRadius(_.Cartesian3.distance(M.getCenter(),P)),p.updateBillboardsPositions(P),b.showAt(k,"<p>Move mouse to change circle radius</p><p>Click again to finish drawing</p>"))}},_.ScreenSpaceEventType.MOUSE_MOVE)},n.prototype.enhancePrimitives=function(){var l=this;_.Billboard.prototype.setEditable=function(){if(this._editable)return;this._editable=!0;var m=this,T=this;function b(M){l._scene.screenSpaceCameraController.enableRotate=M}N(m,"leftDown",function(M){function p(k){m.position=k,T.executeListeners({name:"drag",positions:k})}function L(k){A.destroy(),b(!0),T.executeListeners({name:"dragEnd",positions:k})}var A=new _.ScreenSpaceEventHandler(l._scene.canvas);A.setInputAction(function(k){var P=l._scene.camera.pickEllipsoid(k.endPosition,e);P?p(P):L(P)},_.ScreenSpaceEventType.MOUSE_MOVE),A.setInputAction(function(k){L(l._scene.camera.pickEllipsoid(k.position,e))},_.ScreenSpaceEventType.LEFT_UP),b(!1)}),X(m)};function c(m){l._scene,!(this._highlighted&&this._highlighted==m)&&this._editMode!==!0&&(this._highlighted=m,m?(l.setHighlighted(this),this._strokeColor=this.strokeColor,this.setStrokeStyle(_.Color.fromCssColorString("white"),this.strokeWidth)):this._strokeColor?this.setStrokeStyle(this._strokeColor,this.strokeWidth):this.setStrokeStyle(void 0,void 0))}function E(m){if(this._editMode!=m)if(l.disableAllHighlights(),m){l.setEdited(this);var T=l._scene,b=this;if(this._markers==null){let B=function(K,J){var ae=K-1<0?J.length-1:K-1;ae<p.countBillboards()&&(p.getBillboard(ae).position=re(ae)),ae=K,ae<p.countBillboards()&&(p.getBillboard(ae).position=re(ae))},Q=function(){b.executeListeners({name:"onEdited",positions:b.positions})},re=function(K){var J=b.positions;return e.cartographicToCartesian(new _.EllipsoidGeodesic(e.cartesianToCartographic(J[K]),e.cartesianToCartographic(J[K<J.length-1?K+1:0])).interpolateUsingFraction(.5))};var M=new n.BillboardGroup(l,y),p=new n.BillboardGroup(l,D),L={dragHandlers:{onDrag:function(K,J){b.positions[K]=J,B(K,b.positions),b._createPrimitive=!0},onDragEnd:function(K,J){b._createPrimitive=!0,Q()}},onDoubleClick:function(K){b.positions.length<4||(b.positions.splice(K,1),b._createPrimitive=!0,M.removeBillboard(K),p.removeBillboard(K),B(K,b.positions),Q())},tooltip:function(){if(b.positions.length>3)return"Double click to remove this point"}};M.addBillboards(b.positions,L),this._markers=M;for(var A=[],k=0,P=b.positions.length+(this.isPolygon?0:-1);k<P;k++)A.push(re(k));var O={dragHandlers:{onDragStart:function(K,J){this.index=K+1,b.positions.splice(this.index,0,J),b._createPrimitive=!0},onDrag:function(K,J){b.positions[this.index]=J,b._createPrimitive=!0},onDragEnd:function(K,J){M.insertBillboard(this.index,J,L),p.getBillboard(this.index-1).position=re(this.index-1),p.insertBillboard(this.index,re(this.index),O),b._createPrimitive=!0,Q()}},tooltip:function(){return"Drag to create a new point"}};p.addBillboards(A,O),this._editMarkers=p,this._globeClickhandler=new _.ScreenSpaceEventHandler(T.canvas),this._globeClickhandler.setInputAction(function(K){var J=T.pick(K.position);J&&J.primitive||b.setEditMode(!1)},_.ScreenSpaceEventType.LEFT_CLICK),M.setOnTop(),p.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}Fe.PolylinePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var m=this;m.isPolygon=!1,m.asynchronous=!1,l.registerEditableShape(m),m.setEditMode=E;var T=this.width;m.setHighlighted=function(b){this._editMode!==!0&&(b?(l.setHighlighted(this),this.setWidth(T*2)):this.setWidth(T))},m.getExtent=function(){return _.Rectangle.fromCartographicArray(e.cartesianArrayToCartographicArray(this.positions))},X(m),m.setEditMode(!1)}},Fe.PolygonPrimitive.prototype.setEditable=function(){var m=this;m.asynchronous=!1,l._scene,l.registerEditableShape(m),m.setEditMode=E,m.setHighlighted=c,X(m),m.setEditMode(!1)},Fe.ExtentPrimitive.prototype.setEditable=function(){if(!this.setEditMode){var m=this,T=l._scene;l.registerEditableShape(m),m.asynchronous=!1,m.setEditMode=function(b){if(this._editMode!=b)if(l.disableAllHighlights(),b){if(l.setEdited(this),this._markers==null){let L=function(){m.executeListeners({name:"onEdited",extent:m.extent})};var M=new n.BillboardGroup(l,y),p={dragHandlers:{onDrag:function(A,k){var P=M.getBillboard((A+2)%4).position;m.setExtent(q(e.cartesianToCartographic(P),e.cartesianToCartographic(k))),M.updateBillboardsPositions(V(m.extent))},onDragEnd:function(A,k){L()}},tooltip:function(){return"Drag to change the corners of this extent"}};M.addBillboards(V(m.extent),p),this._markers=M,this._globeClickhandler=new _.ScreenSpaceEventHandler(T.canvas),this._globeClickhandler.setInputAction(function(A){var k=T.pick(A.position);k&&!k.isDestroyed()&&k.primitive||m.setEditMode(!1)},_.ScreenSpaceEventType.LEFT_CLICK),M.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},m.setHighlighted=c,X(m),m.setEditMode(!1)}},n.EllipsePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var m=this,T=l._scene;m.asynchronous=!1,l.registerEditableShape(m),m.setEditMode=function(b){if(this._editMode!=b)if(l.disableAllHighlights(),b){l.setEdited(this);var M=this;if(this._markers==null){let A=function(){return _.EllipseOutlineGeometry(e,m.getCenter(),m.getSemiMajorAxis(),m.getSemiMinorAxis(),m.getRotation()+Math.PI/2,Math.PI/2).splice(0,4)},k=function(){m.executeListeners({name:"onEdited",center:m.getCenter(),semiMajorAxis:m.getSemiMajorAxis(),semiMinorAxis:m.getSemiMinorAxis(),rotation:0})};var p=new n.BillboardGroup(l,y),L={dragHandlers:{onDrag:function(P,O){var B=_.Cartesian3.distance(m.getCenter(),O);P%2==0?m.setSemiMajorAxis(B):m.setSemiMinorAxis(B),p.updateBillboardsPositions(A())},onDragEnd:function(P,O){k()}},tooltip:function(){return"Drag to change the excentricity and radius"}};p.addBillboards(A(),L),this._markers=p,this._globeClickhandler=new _.ScreenSpaceEventHandler(T.canvas),this._globeClickhandler.setInputAction(function(P){var O=T.pick(P.position);O&&O.primitive||M.setEditMode(!1)},_.ScreenSpaceEventType.LEFT_CLICK),p.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},m.setHighlighted=c,X(m),m.setEditMode(!1)}},n.CirclePrimitive.prototype.getCircleCartesianCoordinates=function(m){for(var T=_.CircleOutlineGeometry.createGeometry(new _.CircleOutlineGeometry({ellipsoid:e,center:this.getCenter(),radius:this.getRadius(),granularity:m})),b=0,M,p=[];b<T.attributes.position.values.length;b+=3)M=T.attributes.position.values,p.push(new _.Cartesian3(M[b],M[b+1],M[b+2]));return p},n.CirclePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var m=this,T=l._scene;m.asynchronous=!1,l.registerEditableShape(m),m.setEditMode=function(b){if(this._editMode!=b)if(l.disableAllHighlights(),b){l.setEdited(this);var M=this;if(this._markers==null){let A=function(){return M.getCircleCartesianCoordinates(_.Math.PI_OVER_TWO)},k=function(){m.executeListeners({name:"onEdited",center:m.getCenter(),radius:m.getRadius()})};var p=new n.BillboardGroup(l,y),L={dragHandlers:{onDrag:function(P,O){m.setRadius(_.Cartesian3.distance(m.getCenter(),O)),p.updateBillboardsPositions(A())},onDragEnd:function(P,O){k()}},tooltip:function(){return"Drag to change the radius"}};p.addBillboards(A(),L),this._markers=p,this._globeClickhandler=new _.ScreenSpaceEventHandler(T.canvas),this._globeClickhandler.setInputAction(function(P){var O=T.pick(P.position);O&&O.primitive||M.setEditMode(!1)},_.ScreenSpaceEventType.LEFT_CLICK),p.setOnTop()}this._editMode=!0}else this._markers!=null&&(this._markers.remove(),this._markers=null,this._globeClickhandler.destroy()),this._editMode=!1},m.setHighlighted=c,X(m),m.setEditMode(!1)}}},n.DrawHelperWidget=function(){function l(c,E){if(!_.defined(E.container))throw new _.DeveloperError("Container is required");var m={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:S,polygonDrawingOptions:d,extentDrawingOptions:g,circleDrawingOptions:f};Z(E,m);var T=this,b=document.createElement("DIV");b.className="toolbar",E.container.appendChild(b);function M(A,k,P,O){var B=document.createElement("DIV");B.className="button",B.title=P,b.appendChild(B),B.onclick=O;var Q=document.createElement("SPAN");B.appendChild(Q);var re=document.createElement("IMG");return re.src=k,Q.appendChild(re),B}var p=c._scene;M("marker",E.markerIcon,"Click to start drawing a 2D marker",function(){c.startDrawingMarker({callback:function(A){T.executeListeners({name:"markerCreated",position:A})}})}),M("polyline",E.polylineIcon,"Click to start drawing a 2D polyline",function(){c.startDrawingPolyline({callback:function(A){T.executeListeners({name:"polylineCreated",positions:A})}})}),M("polygon",E.polygonIcon,"Click to start drawing a 2D polygon",function(){c.startDrawingPolygon({callback:function(A){T.executeListeners({name:"polygonCreated",positions:A})}})}),M("extent",E.extentIcon,"Click to start drawing an Extent",function(){c.startDrawingExtent({callback:function(A){T.executeListeners({name:"extentCreated",extent:A})}})}),M("circle",E.circleIcon,"Click to start drawing a Circle",function(){c.startDrawingCircle({callback:function(A,k){T.executeListeners({name:"circleCreated",center:A,radius:k})}})});var L=document.createElement("DIV");L.className="divider",b.appendChild(L),M("clear",E.clearIcon,"Remove all primitives",function(){p.primitives.removeAll()}),X(this)}return l}(),n.prototype.addToolbar=function(l,c){return c=$(c,{container:l}),new n.DrawHelperWidget(this,c)};function q(l,c){var E=new _.Rectangle;E.west=Math.min(l.longitude,c.longitude),E.east=Math.max(l.longitude,c.longitude),E.south=Math.min(l.latitude,c.latitude),E.north=Math.max(l.latitude,c.latitude);var m=_.Math.EPSILON7;return E.east-E.west<m&&(E.east+=m*2),E.north-E.south<m&&(E.north+=m*2),E}function R(l,c){return l.longitude.toFixed(c||3)+", "+l.latitude.toFixed(c||3)}function H(l,c){if(l==null||typeof l!="object"||l.constructor!=Object&&l.constructor!=Array)return l;if(l.constructor==Date||l.constructor==RegExp||l.constructor==Function||l.constructor==String||l.constructor==Number||l.constructor==Boolean)return new l.constructor(l);c=c||new l.constructor;for(var E in l)c[E]=typeof c[E]>"u"?H(l[E],null):c[E];return c}function Z(l,c){l=l||{};var E;for(E in c)l[E]===void 0&&(l[E]=H(c[E]))}function $(l,c){var E=H(l),m;for(m in c)E[m]===void 0&&(E[m]=H(c[m]));return E}function N(l,c,E){l[c]=E}function X(l){l._listeners={},l.addListener=function(c,E){return this._listeners[c]=this._listeners[c]||[],this._listeners[c].push(E),this._listeners[c].length},l.executeListeners=function(c,E){if(this._listeners[c.name]&&this._listeners[c.name].length>0)for(var m=0;m<this._listeners[c.name].length;m++)this._listeners[c.name][m](c);else E&&E(c)}}return n}();const Oo=e=>{const t=e.map(r=>{const n=u.Cartographic.fromCartesian(r);return[u.Math.toDegrees(n.longitude),u.Math.toDegrees(n.latitude)]});return t.push(t[0]),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[t]}}},Do=e=>{const t=Wt.lineString([[u.Math.toDegrees(e.west),u.Math.toDegrees(e.south)],[u.Math.toDegrees(e.east),u.Math.toDegrees(e.north)]]);return Je(Xe(t))},ko=2,No=(e,t)=>{switch(e){case Le.BOX:{if(t.features.length!==ko)throw new Error(`${e} must have 2 points`);const r=z.find(t.features,o=>{var s;return((s=o.properties)==null?void 0:s.type)===Qe.BOTTOM_LEFT}),n=z.find(t.features,o=>{var s;return((s=o.properties)==null?void 0:s.type)===Qe.TOP_RIGHT});if(n&&r){if(r.geometry.coordinates[0]===n.geometry.coordinates[0]&&r.geometry.coordinates[1]===n.geometry.coordinates[1])throw new Error(`${e} must define BOTTOM_LEFT and TOP_RIGHT different points`);return u.Rectangle.fromDegrees(r.geometry.coordinates[0],r.geometry.coordinates[1],n.geometry.coordinates[0],n.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`)}},xo=e=>{const t=Wt.lineString([[e.west,e.south],[e.east,e.north]]);return Je(Xe(t)).geometry.coordinates[0].map(n=>u.Cartesian3.fromRadiansArray(n)[0])},Bo=e=>{const{drawState:t,drawingMaterial:r,drawingVertexColor:n,material:o,hollow:s,outlineWidth:d}=e,g=fe(),[f,w]=a.useState();a.useEffect(()=>{w(new Fe(g,r,n))},[]),a.useEffect(()=>{if(f){const C=f;if(t.drawing)switch(t.type){case Le.POLYGON:g.scene.globe.depthTestAgainstTerrain=!1,C.startDrawingPolygon({callback:v=>{t.handler({primitive:v,type:Le.POLYGON,geojson:Oo(v)})}});break;case Le.BOX:g.scene.globe.depthTestAgainstTerrain=!1,C.startDrawingExtent({callback:v=>{t.handler({primitive:v,type:Le.BOX,geojson:Do(v)})}});break;default:throw new Error(`[CESIUM DRAW]: ${t.type} unrecognized primitive to draw.`)}else C.stopDrawing(),g.scene.globe.depthTestAgainstTerrain=!0}},[t,f]);const S=C=>{try{let v=C.coordinates!==void 0?C.coordinates:No(C.type,C.geojson);if(s!==!0)switch(C.type){case Le.BOX:return i.jsx(Ur,{coordinates:v,material:o??r});case Le.POLYGON:return i.jsx(zr,{hierarchy:new u.PolygonHierarchy(v),material:o??r});default:return i.jsx(i.Fragment,{})}else{switch(C.type){case Le.BOX:v=xo(v);break;case Le.POLYGON:v=[...v,v[0]];break;default:return i.jsx(i.Fragment,{})}return i.jsx(Ao,{clampToGround:!0,positions:v,width:d??1,material:o??r})}}catch(v){return console.error(v),i.jsx(i.Fragment,{})}};return i.jsx(qr,{...e,children:e.drawings.map((C,v)=>i.jsxs(Hr,{name:C.name,children:[i.jsxs(Wr,{children:[i.jsxs("h1",{children:["Drawed Entity ",C.name]}),i.jsx("p",{children:"This is description of drawed entity"})]}),S(C)]},C.id))})},Fo=-25,$r=2,Vo=e=>{const t=fe(),r=(s,d=",")=>s.slice(s.indexOf(`
23
23
  `)+1).split(`
24
- `).map(E=>{const C=E.split(d);return{cartographic:g.Cartographic.fromDegrees(parseFloat(C[0]),parseFloat(C[1])),cartesian:new g.Cartesian2(parseFloat(C[0]),parseFloat(C[1]))}}),r=o=>{var h;o.preventDefault(),o.persist();const d=new FileReader;d.onload=f=>{var p;const E=(p=f.target)==null?void 0:p.result,C=n(E),b=g.Ellipsoid.WGS84;console.log(`Loaded CSV content:
25
- `,E),g.sampleTerrainMostDetailed(t.terrainProvider,C.map(v=>v.cartographic)).then(v=>{console.log(v),v=v.slice(0,v.length-1),t.scene.globe.depthTestAgainstTerrain=!0,t.entities.suspendEvents(),t.entities.removeAll(),v.forEach((I,T)=>{t.entities.add({name:(T+$n).toString(),position:b.cartographicToCartesian(I),billboard:{verticalOrigin:g.VerticalOrigin.BOTTOM,scale:.7,image:"assets/img/map-marker.gif"},label:{text:(T+$n).toString(),font:"14pt monospace",fillColor:g.Color.BLACK,style:g.LabelStyle.FILL_AND_OUTLINE,outlineWidth:4,outlineColor:g.Color.BLACK,verticalOrigin:g.VerticalOrigin.BOTTOM,pixelOffset:new g.Cartesian2(0,ko)},description:`
26
- Long: ${C[T].cartesian.x} </br>
27
- Lat: ${C[T].cartesian.y} </br>
28
- Height(m): <span style="font-weight: 500">${I.height}</span>
29
- `})}),t.entities.resumeEvents(),o.target.files!==null&&(s(`terranian_heights_${o.target.files[0].name}`,C),o.target.value=""),console.log("Pinned point count is ",t.entities.values.length)},v=>{console.error("ERROR while sampleTerrainMostDetailed:",v)})},(h=o.target.files)!=null&&h[0]&&d.readAsText(o.target.files[0])},s=(o,d)=>{const h=p=>{let v="";return v+=p.cartesian.x.toString()+",",v+=p.cartesian.y.toString()+",",v+=p.cartographic.height.toString(),v+`
24
+ `).map(w=>{const S=w.split(d);return{cartographic:u.Cartographic.fromDegrees(parseFloat(S[0]),parseFloat(S[1])),cartesian:new u.Cartesian2(parseFloat(S[0]),parseFloat(S[1]))}}),n=s=>{var g;s.preventDefault(),s.persist();const d=new FileReader;d.onload=f=>{var v;const w=(v=f.target)==null?void 0:v.result,S=r(w),C=u.Ellipsoid.WGS84;console.log(`Loaded CSV content:
25
+ `,w),u.sampleTerrainMostDetailed(t.terrainProvider,S.map(y=>y.cartographic)).then(y=>{console.log(y),y=y.slice(0,y.length-1),t.scene.globe.depthTestAgainstTerrain=!0,t.entities.suspendEvents(),t.entities.removeAll(),y.forEach((D,V)=>{t.entities.add({name:(V+$r).toString(),position:C.cartographicToCartesian(D),billboard:{verticalOrigin:u.VerticalOrigin.BOTTOM,scale:.7,image:"assets/img/map-marker.gif"},label:{text:(V+$r).toString(),font:"14pt monospace",fillColor:u.Color.BLACK,style:u.LabelStyle.FILL_AND_OUTLINE,outlineWidth:4,outlineColor:u.Color.BLACK,verticalOrigin:u.VerticalOrigin.BOTTOM,pixelOffset:new u.Cartesian2(0,Fo)},description:`
26
+ Long: ${S[V].cartesian.x} </br>
27
+ Lat: ${S[V].cartesian.y} </br>
28
+ Height(m): <span style="font-weight: 500">${D.height}</span>
29
+ `})}),t.entities.resumeEvents(),s.target.files!==null&&(o(`terranian_heights_${s.target.files[0].name}`,S),s.target.value=""),console.log("Pinned point count is ",t.entities.values.length)},y=>{console.error("ERROR while sampleTerrainMostDetailed:",y)})},(g=s.target.files)!=null&&g[0]&&d.readAsText(s.target.files[0])},o=(s,d)=>{const g=v=>{let y="";return y+=v.cartesian.x.toString()+",",y+=v.cartesian.y.toString()+",",y+=v.cartographic.height.toString(),y+`
30
30
  `};let f=`long,lat,height
31
- `;d.forEach(p=>{f+=h(p)});const E=new Blob([f],{type:"text/csv;charset=utf-8;"}),C=document.createElement("a"),b=URL.createObjectURL(E);C.setAttribute("href",b),C.setAttribute("download",o),C.style.visibility="hidden",document.body.appendChild(C),C.click(),document.body.removeChild(C)};return i.jsx(i.Fragment,{children:i.jsx("input",{type:"file",id:"csvFile",accept:".csv",onChange:o=>{r(o)}})})},Ns="",No=38,Bo=40,Fo=13,Go=14,Vo=27,Ho=9,Wo=10,zo=100,Uo=e=>{const[t,n]=a.useState(e.defaultValue??""),[r,s]=a.useState(!1),[o,d]=a.useState({helperVisible:!1,left:0,right:0,trigger:"",matchLength:0,matchStart:0,options:[],selection:0,top:0,value:"",caret:0,width:"unset"}),h=a.useRef(null);a.useEffect(()=>(window.addEventListener("resize",I),()=>{try{window.removeEventListener("resize",I)}catch(S){console.log('WINDOW "resize" remove listener failed',S)}}),[]),a.useEffect(()=>{typeof e.value<"u"&&n(e.value),typeof e.defaultValue<"u"&&n(e.defaultValue)},[e.value,e.defaultValue]),a.useEffect(()=>{const{options:S}=e,{caret:w}=o;j(t,w,S)},[e]);const f=(S,w,P)=>{const{trigger:m,matchAny:L,regex:k}=e,N=new RegExp(k);let A=m;Array.isArray(A)||(A=new Array(m)),A.sort();const O={};Array.isArray(P)&&A.forEach(ne=>{O[ne]=P});const B=E(A,N);let te={};for(let ne=0;ne<B.length;ne++){const{triggerStr:q,triggerMatch:R,triggerLength:ie}=B[ne];for(let ge=w-1;ge>=0;--ge){const oe=S.substring(ge,w).match(N);let fe=-1;if(ie>0){const D=R?ge:ge-ie+1;if(D<0||(C(q,S,D)&&(fe=D+ie),!oe&&fe<0))break}else{if(oe&&ge>0)continue;if(fe=ge===0&&oe?0:ge+1,w-fe===0)break}if(fe>=0){const D=O[q];if(!Array.isArray(D))continue;const x=S.substring(fe,w),H=D.filter(K=>{const ce=K.toLowerCase().indexOf(x.toLowerCase());return ce!==-1&&(L||ce===0)}),z=q,U=x.length;te={...te,trigger:z,matchStart:fe,matchLength:U,options:H}}}}return te},E=(S,w)=>S.map(m=>({triggerStr:m,triggerMatch:m.match(w),triggerLength:m.length})),C=(S,w,P)=>!S||!S.length||w.substr(P,S.length)===S,b=S=>{const{onChange:w,options:P,spaceRemovers:m,spacer:L,value:k}=e,N=t,A=S.target.value,O=Ft(p(S.target)).end;if(A.length||V({...o,helperVisible:!1}),n(A),V({...o,caret:O,value:S.target.value}),!A.length||!O)return w(S.target.value);if(r&&m.length&&A.length>2&&L.length){for(let B=0;B<Math.max(N.length,A.length);++B)if(N[B]!==A[B]){if(B>=2&&A[B-1]===L&&m.indexOf(A[B-2])===-1&&m.indexOf(A[B])!==-1&&!$.isEmpty(f(A.substring(0,B-2),O-3,P))){const te=`${A.slice(0,B-1)}${A.slice(B,B+1)}${A.slice(B-1,B)}${A.slice(B+1)}`;return F(B+1),h.current!==null&&(h.current.value=te),k||V({...o,value:te}),w(te)}break}s(!1)}return j(A,O,P),w(S.target.value)},p=S=>{if(S!==void 0)if(S.children.length>0){const w=S.getElementsByTagName("textarea");if(w.length>0)return w[0];const P=S.getElementsByTagName("input");if(P.length>0)return P[0]}else return S},v=S=>{const{helperVisible:w,options:P,selection:m}=o,{onKeyDown:L,passThroughEnter:k}=e;if(w)switch(S.keyCode){case Vo:S.preventDefault(),Y();break;case No:S.preventDefault(),V({...o,selection:(P.length+m-1)%P.length});break;case Bo:S.preventDefault(),V({...o,selection:(m+1)%P.length});break;case Go:case Fo:k||S.preventDefault(),T(m);break;case Ho:T(m);break;default:L(S);break}else L(S)},I=()=>{V({...o,helperVisible:!1})},T=S=>{const{spacer:w,onSelect:P,changeOnSelect:m}=e,{matchStart:L,matchLength:k,options:N,trigger:A}=o,O=N[S],B=t,te=B.substring(0,L-A.length),ne=B.substring(L+k),q={target:h.current},R=m(A,O);q.target!==null&&(q.target.value=`${te}${R}${w}${ne}`),b(q),q.target!==null&&P(q.target.value),Y(),F(te.length+R.length+1),s(!0)},F=S=>{V({...o,caret:S});const w=p(h.current);Ft.setCaretPosition(w,S)},V=S=>{setTimeout(()=>{d({...S})},0)},j=(S,w,P)=>{const m=h.current;if(h.current===null)return;const L=p(m);if(L===void 0)return;const k=m.getBoundingClientRect(),N=f(S,w,P);if(Object.keys(N).length>0&&L!==null){const A=mr(L,w),O=L.getBoundingClientRect(),{minChars:B,onRequestOptions:te,requestOnlyIfNoOptions:ne,mode:q}=e;let R,ie,ge,ve="unset";q==="assist"?(R=m===L?A.top+L.offsetTop:A.top+k.top,ie=Math.min(A.left+L.offsetLeft-Wo,L.offsetLeft+O.width-zo)):(R=k.top+m.offsetHeight,ie=m.offsetLeft,ge=m.offsetLeft-m.offsetWidth,ve=`${k.width}px`),N.matchLength>=B&&(N.options.length>1||N.options.length===1&&N.options[0].length!==N.matchLength)?V({...o,value:S,helperVisible:!0,top:R,left:ie,right:ge,width:ve,...N}):((!ne||!N.options.length)&&te(S.substr(N.matchStart,N.matchLength)),Y())}else Y()},Y=()=>{setTimeout(()=>{V({...o,helperVisible:!1,selection:0})},100)},G=()=>{const{helperVisible:S,left:w,right:P,matchStart:m,matchLength:L,options:k,selection:N,top:A,value:O,width:B}=o;if(!S)return null;const{maxOptions:te,offsetX:ne,offsetY:q,direction:R}=e;if(k.length===0)return null;if(N>=k.length)return V({...o,selection:0}),null;const ie=te===0?k.length:te,ge=k.slice(0,ie).map((oe,fe)=>{const D=oe.toLowerCase().indexOf(O.substr(m,L).toLowerCase());return i.jsxs("li",{className:fe===N?"active":void 0,onClick:()=>{T(fe)},onMouseEnter:()=>{V({...o,selection:fe})},children:[oe.slice(0,D),i.jsx("strong",{children:oe.substr(D,L)}),oe.slice(D+L)]},oe)}),ve=R==="ltr"?{left:w+ne}:{right:P+ne};return i.jsx("ul",{className:"react-autocomplete-input",style:{...ve,top:A+q,width:B},children:ge})},{Component:X,ComponentProps:W,defaultValue:Z,disabled:ee,onBlur:l,value:c,..._}=e,y=Object.assign({},_);return Object.keys(e).forEach(S=>{delete y[S]}),i.jsxs(i.Fragment,{children:[a.cloneElement(X,{disabled:ee,onBlur:l,onChange:b,onKeyDown:v,ref:h,value:t,...y,...W}),G()]})},$o={Component:i.jsx("textarea",{}),ComponentProps:{},defaultValue:void 0,disabled:!1,maxOptions:6,onBlur:e=>{},onChange:e=>{},onKeyDown:e=>{},onRequestOptions:e=>{},onSelect:e=>{},changeOnSelect:(e,t)=>`${e}${t}`,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"},qo=e=>{let t={...$o,...e};return e.mode==="autocomplete"&&(t={...t,trigger:"",regex:".",spacer:""}),i.jsx(Uo,{...t})},st={formatFileModDate:(e,t)=>{const n=re.FileHelper.getModDate(t);return n?e.formatDate(n,{dateStyle:"short",timeStyle:"short"}):null},formatFileSize:(e,t)=>{if(!t||typeof t.size!="number")return null;const n=t.size,r=vr(n,{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()}`}},jo={locale:Se.EN,formatters:{...st}},Yo={locale:Se.RU,formatters:{...st},messages:{"chonky.toolbar.searchPlaceholder":"Поиск","chonky.toolbar.visibleFileCount":`{fileCount, plural,
31
+ `;d.forEach(v=>{f+=g(v)});const w=new Blob([f],{type:"text/csv;charset=utf-8;"}),S=document.createElement("a"),C=URL.createObjectURL(w);S.setAttribute("href",C),S.setAttribute("download",s),S.style.visibility="hidden",document.body.appendChild(S),S.click(),document.body.removeChild(S)};return i.jsx(i.Fragment,{children:i.jsx("input",{type:"file",id:"csvFile",accept:".csv",onChange:s=>{n(s)}})})},Hs="",Go=38,Ho=40,Wo=13,zo=14,Uo=27,qo=9,$o=10,jo=100,Yo=e=>{const[t,r]=a.useState(e.defaultValue??""),[n,o]=a.useState(!1),[s,d]=a.useState({helperVisible:!1,left:0,right:0,trigger:"",matchLength:0,matchStart:0,options:[],selection:0,top:0,value:"",caret:0,width:"unset"}),g=a.useRef(null);a.useEffect(()=>(window.addEventListener("resize",D),()=>{try{window.removeEventListener("resize",D)}catch(T){console.log('WINDOW "resize" remove listener failed',T)}}),[]),a.useEffect(()=>{typeof e.value<"u"&&r(e.value),typeof e.defaultValue<"u"&&r(e.defaultValue)},[e.value,e.defaultValue]),a.useEffect(()=>{const{options:T}=e,{caret:b}=s;q(t,b,T)},[e]);const f=(T,b,M)=>{const{trigger:p,matchAny:L,regex:A}=e,k=new RegExp(A);let P=p;Array.isArray(P)||(P=new Array(p)),P.sort();const O={};Array.isArray(M)&&P.forEach(re=>{O[re]=M});const B=w(P,k);let Q={};for(let re=0;re<B.length;re++){const{triggerStr:K,triggerMatch:J,triggerLength:ae}=B[re];for(let ge=b-1;ge>=0;--ge){const oe=T.substring(ge,b).match(k);let ve=-1;if(ae>0){const me=J?ge:ge-ae+1;if(me<0||(S(K,T,me)&&(ve=me+ae),!oe&&ve<0))break}else{if(oe&&ge>0)continue;if(ve=ge===0&&oe?0:ge+1,b-ve===0)break}if(ve>=0){const me=O[K];if(!Array.isArray(me))continue;const x=T.substring(ve,b),F=me.filter(j=>{const te=j.toLowerCase().indexOf(x.toLowerCase());return te!==-1&&(L||te===0)}),W=K,Y=x.length;Q={...Q,trigger:W,matchStart:ve,matchLength:Y,options:F}}}}return Q},w=(T,b)=>T.map(p=>({triggerStr:p,triggerMatch:p.match(b),triggerLength:p.length})),S=(T,b,M)=>!T||!T.length||b.substr(M,T.length)===T,C=T=>{const{onChange:b,options:M,spaceRemovers:p,spacer:L,value:A}=e,k=t,P=T.target.value,O=Vt(v(T.target)).end;if(P.length||G({...s,helperVisible:!1}),r(P),G({...s,caret:O,value:T.target.value}),!P.length||!O)return b(T.target.value);if(n&&p.length&&P.length>2&&L.length){for(let B=0;B<Math.max(k.length,P.length);++B)if(k[B]!==P[B]){if(B>=2&&P[B-1]===L&&p.indexOf(P[B-2])===-1&&p.indexOf(P[B])!==-1&&!z.isEmpty(f(P.substring(0,B-2),O-3,M))){const Q=`${P.slice(0,B-1)}${P.slice(B,B+1)}${P.slice(B-1,B)}${P.slice(B+1)}`;return I(B+1),g.current!==null&&(g.current.value=Q),A||G({...s,value:Q}),b(Q)}break}o(!1)}return q(P,O,M),b(T.target.value)},v=T=>{if(T!==void 0)if(T.children.length>0){const b=T.getElementsByTagName("textarea");if(b.length>0)return b[0];const M=T.getElementsByTagName("input");if(M.length>0)return M[0]}else return T},y=T=>{const{helperVisible:b,options:M,selection:p}=s,{onKeyDown:L,passThroughEnter:A}=e;if(b)switch(T.keyCode){case Uo:T.preventDefault(),R();break;case Go:T.preventDefault(),G({...s,selection:(M.length+p-1)%M.length});break;case Ho:T.preventDefault(),G({...s,selection:(p+1)%M.length});break;case zo:case Wo:A||T.preventDefault(),V(p);break;case qo:V(p);break;default:L(T);break}else L(T)},D=()=>{G({...s,helperVisible:!1})},V=T=>{const{spacer:b,onSelect:M,changeOnSelect:p}=e,{matchStart:L,matchLength:A,options:k,trigger:P}=s,O=k[T],B=t,Q=B.substring(0,L-P.length),re=B.substring(L+A),K={target:g.current},J=p(P,O);K.target!==null&&(K.target.value=`${Q}${J}${b}${re}`),C(K),K.target!==null&&M(K.target.value),R(),I(Q.length+J.length+1),o(!0)},I=T=>{G({...s,caret:T});const b=v(g.current);Vt.setCaretPosition(b,T)},G=T=>{setTimeout(()=>{d({...T})},0)},q=(T,b,M)=>{const p=g.current;if(g.current===null)return;const L=v(p);if(L===void 0)return;const A=p.getBoundingClientRect(),k=f(T,b,M);if(Object.keys(k).length>0&&L!==null){const P=yn(L,b),O=L.getBoundingClientRect(),{minChars:B,onRequestOptions:Q,requestOnlyIfNoOptions:re,mode:K}=e;let J,ae,ge,Te="unset";K==="assist"?(J=p===L?P.top+L.offsetTop:P.top+A.top,ae=Math.min(P.left+L.offsetLeft-$o,L.offsetLeft+O.width-jo)):(J=A.top+p.offsetHeight,ae=p.offsetLeft,ge=p.offsetLeft-p.offsetWidth,Te=`${A.width}px`),k.matchLength>=B&&(k.options.length>1||k.options.length===1&&k.options[0].length!==k.matchLength)?G({...s,value:T,helperVisible:!0,top:J,left:ae,right:ge,width:Te,...k}):((!re||!k.options.length)&&Q(T.substr(k.matchStart,k.matchLength)),R())}else R()},R=()=>{setTimeout(()=>{G({...s,helperVisible:!1,selection:0})},100)},H=()=>{const{helperVisible:T,left:b,right:M,matchStart:p,matchLength:L,options:A,selection:k,top:P,value:O,width:B}=s;if(!T)return null;const{maxOptions:Q,offsetX:re,offsetY:K,direction:J}=e;if(A.length===0)return null;if(k>=A.length)return G({...s,selection:0}),null;const ae=Q===0?A.length:Q,ge=A.slice(0,ae).map((oe,ve)=>{const me=oe.toLowerCase().indexOf(O.substr(p,L).toLowerCase());return i.jsxs("li",{className:ve===k?"active":void 0,onClick:()=>{V(ve)},onMouseEnter:()=>{G({...s,selection:ve})},children:[oe.slice(0,me),i.jsx("strong",{children:oe.substr(me,L)}),oe.slice(me+L)]},oe)}),Te=J==="ltr"?{left:b+re}:{right:M+re};return i.jsx("ul",{className:"react-autocomplete-input",style:{...Te,top:P+K,width:B},children:ge})},{Component:Z,ComponentProps:$,defaultValue:N,disabled:X,onBlur:l,value:c,...E}=e,m=Object.assign({},E);return Object.keys(e).forEach(T=>{delete m[T]}),i.jsxs(i.Fragment,{children:[a.cloneElement(Z,{disabled:X,onBlur:l,onChange:C,onKeyDown:y,ref:g,value:t,...m,...$}),H()]})},Zo={Component:i.jsx("textarea",{}),ComponentProps:{},defaultValue:void 0,disabled:!1,maxOptions:6,onBlur:e=>{},onChange:e=>{},onKeyDown:e=>{},onRequestOptions:e=>{},onSelect:e=>{},changeOnSelect:(e,t)=>`${e}${t}`,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"},Xo=e=>{let t={...Zo,...e};return e.mode==="autocomplete"&&(t={...t,trigger:"",regex:".",spacer:""}),i.jsx(Yo,{...t})},at={formatFileModDate:(e,t)=>{const r=ne.FileHelper.getModDate(t);return r?e.formatDate(r,{dateStyle:"short",timeStyle:"short"}):null},formatFileSize:(e,t)=>{if(!t||typeof t.size!="number")return null;const r=t.size,n=En(r,{bits:!1,output:"object"});return n.symbol==="B"?`${Math.round(n.value/10)/100} KB`:n.symbol==="KB"?`${Math.round(n.value)} ${n.symbol}`:`${n.value} ${n.symbol.toUpperCase()}`}},Jo={locale:Se.EN,formatters:{...at}},Ko={locale:Se.RU,formatters:{...at},messages:{"chonky.toolbar.searchPlaceholder":"Поиск","chonky.toolbar.visibleFileCount":`{fileCount, plural,
32
32
  one {# файл}
33
33
  few {# файла}
34
34
  other {# файлов}
@@ -40,7 +40,7 @@
40
40
  =0 {}
41
41
  one {# скрыт}
42
42
  other {# скрыто}
43
- }`,"chonky.fileList.nothingToShow":"Здесь пусто!","chonky.contextMenu.browserMenuShortcut":"Меню браузера: {shortcut}",["chonky.actionGroups.Actions"]:"Действия",["chonky.actionGroups.Options"]:"Опции",[`chonky.actions.${re.ChonkyActions.OpenParentFolder.id}.button.name`]:"Открыть родительскую папку",[`chonky.actions.${re.ChonkyActions.CreateFolder.id}.button.name`]:"Новая папка",[`chonky.actions.${re.ChonkyActions.CreateFolder.id}.button.tooltip`]:"Создать новую папку",[`chonky.actions.${re.ChonkyActions.DeleteFiles.id}.button.name`]:"Удалить файлы",[`chonky.actions.${re.ChonkyActions.OpenSelection.id}.button.name`]:"Открыть выделение",[`chonky.actions.${re.ChonkyActions.SelectAllFiles.id}.button.name`]:"Выделить все",[`chonky.actions.${re.ChonkyActions.ClearSelection.id}.button.name`]:"Сбросить выделение",[`chonky.actions.${re.ChonkyActions.EnableListView.id}.button.name`]:"Показать список",[`chonky.actions.${re.ChonkyActions.EnableGridView.id}.button.name`]:"Показать иконки",[`chonky.actions.${re.ChonkyActions.SortFilesByName.id}.button.name`]:"Сорт. по имени",[`chonky.actions.${re.ChonkyActions.SortFilesBySize.id}.button.name`]:"Сорт. по размеру",[`chonky.actions.${re.ChonkyActions.SortFilesByDate.id}.button.name`]:"Сорт. по дате",[`chonky.actions.${re.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"Скрытые файлы",[`chonky.actions.${re.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"Папки в начале"}},Zo={locale:Se.HE,formatters:{...st},messages:{"chonky.toolbar.searchPlaceholder":"חיפוש","chonky.toolbar.visibleFileCount":`{fileCount, plural,
43
+ }`,"chonky.fileList.nothingToShow":"Здесь пусто!","chonky.contextMenu.browserMenuShortcut":"Меню браузера: {shortcut}",["chonky.actionGroups.Actions"]:"Действия",["chonky.actionGroups.Options"]:"Опции",[`chonky.actions.${ne.ChonkyActions.OpenParentFolder.id}.button.name`]:"Открыть родительскую папку",[`chonky.actions.${ne.ChonkyActions.CreateFolder.id}.button.name`]:"Новая папка",[`chonky.actions.${ne.ChonkyActions.CreateFolder.id}.button.tooltip`]:"Создать новую папку",[`chonky.actions.${ne.ChonkyActions.DeleteFiles.id}.button.name`]:"Удалить файлы",[`chonky.actions.${ne.ChonkyActions.OpenSelection.id}.button.name`]:"Открыть выделение",[`chonky.actions.${ne.ChonkyActions.SelectAllFiles.id}.button.name`]:"Выделить все",[`chonky.actions.${ne.ChonkyActions.ClearSelection.id}.button.name`]:"Сбросить выделение",[`chonky.actions.${ne.ChonkyActions.EnableListView.id}.button.name`]:"Показать список",[`chonky.actions.${ne.ChonkyActions.EnableGridView.id}.button.name`]:"Показать иконки",[`chonky.actions.${ne.ChonkyActions.SortFilesByName.id}.button.name`]:"Сорт. по имени",[`chonky.actions.${ne.ChonkyActions.SortFilesBySize.id}.button.name`]:"Сорт. по размеру",[`chonky.actions.${ne.ChonkyActions.SortFilesByDate.id}.button.name`]:"Сорт. по дате",[`chonky.actions.${ne.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"Скрытые файлы",[`chonky.actions.${ne.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"Папки в начале"}},Qo={locale:Se.HE,formatters:{...at},messages:{"chonky.toolbar.searchPlaceholder":"חיפוש","chonky.toolbar.visibleFileCount":`{fileCount, plural,
44
44
  one {פריט #}
45
45
  other {# פריטים}
46
46
  }`,"chonky.toolbar.selectedFileCount":`{fileCount, plural,
@@ -51,4 +51,4 @@
51
51
  =0 {}
52
52
  one {# נסתר}
53
53
  other {# נסתרים}
54
- }`,"chonky.fileList.nothingToShow":"ריק","chonky.contextMenu.browserMenuShortcut":"תפריט דפדפן: {shortcut}",["chonky.actionGroups.Actions"]:"פעולות",["chonky.actionGroups.Options"]:"אפשרויות",[`chonky.actions.${re.ChonkyActions.OpenParentFolder.id}.button.name`]:"פתח סיפריית אב",[`chonky.actions.${re.ChonkyActions.CreateFolder.id}.button.name`]:"סיפרייה חדשה",[`chonky.actions.${re.ChonkyActions.CreateFolder.id}.button.tooltip`]:"צור סיפרייה חדשה",[`chonky.actions.${re.ChonkyActions.DeleteFiles.id}.button.name`]:"מחק",[`chonky.actions.${re.ChonkyActions.OpenSelection.id}.button.name`]:"פתח את הבחירה",[`chonky.actions.${re.ChonkyActions.SelectAllFiles.id}.button.name`]:"בחר הכל",[`chonky.actions.${re.ChonkyActions.ClearSelection.id}.button.name`]:"אפס את הבחירה",[`chonky.actions.${re.ChonkyActions.EnableListView.id}.button.name`]:"תצוגת רשימה",[`chonky.actions.${re.ChonkyActions.EnableGridView.id}.button.name`]:"תצוגת גריד",[`chonky.actions.${re.ChonkyActions.SortFilesByName.id}.button.name`]:"מיון לפי שם",[`chonky.actions.${re.ChonkyActions.SortFilesBySize.id}.button.name`]:"מיון לפי גודל",[`chonky.actions.${re.ChonkyActions.SortFilesByDate.id}.button.name`]:"מיון לפי תאריך",[`chonky.actions.${re.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"קבצים נסתרים",[`chonky.actions.${re.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"הצגת תיקיות בראש הרשימה"}},Xo={[Se.EN]:jo,[Se.RU]:Yo,[Se.HE]:Zo},Bs="";class Jo extends re.FileHelper{}const Ko=re.ChonkyActions,qn={listView:re.ChonkyActions.EnableListView.id,gridView:re.ChonkyActions.EnableGridView.id};re.setChonkyDefaults({iconComponent:yr.ChonkyIconFA});const Qo=a.memo(a.forwardRef(({theme:e,styles:t={height:"100%",minWidth:"600px"},defaultView:n=qn.listView,readOnlyMode:r=!1,locale:s,files:o,folderChain:d,onFileAction:h,...f},E)=>{const C=a.useCallback(Z=>null,[]);Oe.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 b=Z=>Z.replace(/([A-Z])/g,ee=>"-"+ee.toLowerCase()),p=a.useMemo(()=>e!==void 0?Object.keys(e).reduce((ee,l)=>{const c=e[l];return l=l.startsWith("--")?l:`--fp-theme-${b(l)}`,ee[l]=c,ee},{}):{},[e]),[v,I]=a.useState(!1),[T,F]=a.useState(),[V,j]=a.useState(!1),[Y,G]=a.useState(),[X,W]=a.useState();return a.useEffect(()=>{e&&I(!0),F(n),r?j(!0):G([re.ChonkyActions.CreateFolder,re.ChonkyActions.DeleteFiles]),s!==void 0&&W(Xo[s])},[e,n,r,s]),i.jsx(Q,{style:{...t,...p},children:i.jsx(re.FullFileBrowser,{ref:E,files:o??[],folderChain:d,onFileAction:Z=>{typeof h=="function"&&h(Z)},thumbnailGenerator:C,defaultFileViewActionId:T,disableDragAndDrop:V,fileActions:Y,darkMode:v,i18n:X,...f})})})),Ro=e=>i.jsx(Gt.components.Option,{...e,children:i.jsx(J.Checkbox,{label:e.label,checked:e.isSelected})}),es=e=>{const{styles:t}=e;return i.jsx(Gt,{isMulti:!0,components:{Option:Ro},styles:t,isClearable:!0,hideSelectedOptions:!1,closeMenuOnSelect:!1,...e})},ts=e=>{const{values:t,options:n,onChange:r,placeholder:s,styles:o}=e,d=J.useTheme(),h=Xe(d),[f,E]=a.useState(t);a.useEffect(()=>{E(t??[])},[t]);const C=b=>{E(b),r&&r(b)};return i.jsx(ae.ThemeProvider,{theme:h,children:i.jsx(ae.Input,{multiline:!0,fullWidth:!0,disableUnderline:!0,inputComponent:es,value:f,onChange:C,placeholder:s,id:"react-select-single",inputProps:{styles:o,options:n}})})},ns=({value:e,text:t,children:n,strokeWidth:r=8,styles:s,background:o=!1,backgroundPadding:d=0,counterClockwise:h=!1,circleRatio:f=1})=>{const E={value:e,strokeWidth:r,background:o,backgroundPadding:d,counterClockwise:h,circleRatio:f,styles:Ye.buildStyles({...s})};return n?i.jsx(Ye.CircularProgressbarWithChildren,{...E,children:n}):i.jsx(Ye.CircularProgressbar,{...E,text:t})},rs=({values:e,valueStart:t=0,valueEnd:n,duration:r,interval:s=1e3,easingFunction:o,repeat:d,children:h})=>{const[f,E]=a.useState(0),[C,b]=a.useState(t),p=a.useRef(void 0),v=e===void 0&&n!==void 0;return a.useEffect(()=>{if(v)return d?p.current=window.setInterval(()=>{b(I=>I===t?n:t)},r?r*1e3:1e3):b(n||t),()=>{window.clearInterval(p.current)};if(e)return p.current=window.setInterval(()=>{E(I=>(I+1)%e.length),b(e[f])},s),()=>clearInterval(p.current)},[e,n,r,s,d,f]),v?i.jsx(Er.Animate,{start:()=>({value:t}),update:()=>({value:[C],timing:{duration:r?r*1e3:1e3,ease:o}}),children:({value:I})=>i.jsx(i.Fragment,{children:h(I)})}):i.jsx(i.Fragment,{children:h(C)})};u.useMediaQuery=Jn,Object.defineProperty(u,"CesiumCesiumEntity",{enumerable:!0,get:()=>g.Entity}),Object.defineProperty(u,"CesiumCesiumPolygonGraphics",{enumerable:!0,get:()=>g.PolygonGraphics}),Object.defineProperty(u,"CesiumGeoJsonDataSource",{enumerable:!0,get:()=>g.GeoJsonDataSource}),Object.defineProperty(u,"CesiumMath",{enumerable:!0,get:()=>g.Math}),Object.defineProperty(u,"CesiumSceneTransforms",{enumerable:!0,get:()=>g.SceneTransforms}),Object.defineProperty(u,"cesiumSampleTerrainMostDetailed",{enumerable:!0,get:()=>g.sampleTerrainMostDetailed}),Object.defineProperty(u,"buildStyles",{enumerable:!0,get:()=>Ye.buildStyles}),u.AnimatedValuesProvider=rs,u.Autocomplete=qo,u.BboxCorner=Ze,u.Box=Q,u.COORDINATES_MERCATOR_FRACTION_DIGITS=Qe,u.COORDINATES_WGS_FRACTION_DIGITS=Ke,u.Cesium3DTileset=yo,u.CesiumBoundingSphere=Pi,u.CesiumCartesian2=Mi,u.CesiumCartesian3=_i,u.CesiumCartographic=pn,u.CesiumCesiumBillboardGraphics=Fi,u.CesiumCesiumPolylineGraphics=xi,u.CesiumCesiumTerrainProvider=ki,u.CesiumColor=Gi,u.CesiumCompassTool=Mn,u.CesiumConstantPositionProperty=Ci,u.CesiumConstantProperty=bi,u.CesiumCustomDataSource=Un,u.CesiumDrawingsDataSource=Do,u.CesiumEllipsoid=Ii,u.CesiumEllipsoidTerrainProvider=Oi,u.CesiumEntity=Vn,u.CesiumEntityDescription=bo,u.CesiumEntityStaticDescription=Hn,u.CesiumGeographicTilingScheme=Ai,u.CesiumGeojsonLayer=vo,u.CesiumHeightReference=$i,u.CesiumHorizontalOrigin=zi,u.CesiumImageryLayer=He,u.CesiumJulianDate=Ni,u.CesiumLabelStyle=Ui,u.CesiumMap=fo,u.CesiumOSMLayer=Lo,u.CesiumPolygonGraphics=Wn,u.CesiumPolygonHierarchy=Vi,u.CesiumPolylineDashMaterialProperty=Si,u.CesiumPositionProperty=Bi,u.CesiumRectangle=fn,u.CesiumRectangleGraphics=zn,u.CesiumResource=Di,u.CesiumScene=Hi,u.CesiumSceneMode=tt,u.CesiumVerticalOrigin=Wi,u.CesiumViewer=go,u.CesiumWFSLayer=So,u.CesiumWMSLayer=Eo,u.CesiumWMTSLayer=wo,u.CesiumXYZLayer=To,u.CircularProgressBar=ns,u.CoordinatesTrackerTool=_n,u.CssBaseline=ui,u.DateRangePicker=_r,u.DateTimePicker=Pr,u.DateTimeRangePicker=Ut,u.DateTimeRangePickerFormControl=Sr,u.DrawInteraction=sn,u.DrawType=we,u.FileHelper=Jo,u.FilePicker=Qo,u.FilePickerActions=Ko,u.FilePickerViewObj=qn,u.GeoJSONFeature=rn,u.InspectorTool=Oo,u.Legend=oi,u.MVTSource=ii,u.Map=Zt,u.MapFilterContainer=zr,u.MultiSelection=ts,u.Popover=$t,u.Proj=be,u.ScaleTrackerTool=Pn,u.ScopedCssBaseline=hi,u.SmartTable=di,u.SupportedLocales=Se,u.TerrainianHeightTool=xo,u.TileLayer=Jt,u.TileOsm=on,u.TileWMS=Qr,u.TileWMTS=Jr,u.TileXYZ=ei,u.TimeRangeInput=br,u.VectorLayer=Rt,u.VectorSource=nn,u.VectorTileLayer=$r,u.ZoomButtons=In,u.ZoomLevelTrackerTool=Dn,u.defaultFormatters=st,u.getMVTOptions=ri,u.getWMSOptions=Kr,u.getWMTSOptions=Xr,u.getXYZOptions=Rr,u.isDateRange=Je,u.mapMcToMuiTheme=Wt,u.useCesiumMap=pe,u.useCesiumMapViewstate=Fe,u.useMap=ke,u.useMappedCesiumTheme=zt,u.useMappedMuiTheme=Xe,u.useTileLayer=Ve,u.useVectorLayer=Qt,u.useVectorSource=tn,u.useVectorTileLayer=un,u.useVectorTileSource=ni,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
54
+ }`,"chonky.fileList.nothingToShow":"ריק","chonky.contextMenu.browserMenuShortcut":"תפריט דפדפן: {shortcut}",["chonky.actionGroups.Actions"]:"פעולות",["chonky.actionGroups.Options"]:"אפשרויות",[`chonky.actions.${ne.ChonkyActions.OpenParentFolder.id}.button.name`]:"פתח סיפריית אב",[`chonky.actions.${ne.ChonkyActions.CreateFolder.id}.button.name`]:"סיפרייה חדשה",[`chonky.actions.${ne.ChonkyActions.CreateFolder.id}.button.tooltip`]:"צור סיפרייה חדשה",[`chonky.actions.${ne.ChonkyActions.DeleteFiles.id}.button.name`]:"מחק",[`chonky.actions.${ne.ChonkyActions.OpenSelection.id}.button.name`]:"פתח את הבחירה",[`chonky.actions.${ne.ChonkyActions.SelectAllFiles.id}.button.name`]:"בחר הכל",[`chonky.actions.${ne.ChonkyActions.ClearSelection.id}.button.name`]:"אפס את הבחירה",[`chonky.actions.${ne.ChonkyActions.EnableListView.id}.button.name`]:"תצוגת רשימה",[`chonky.actions.${ne.ChonkyActions.EnableGridView.id}.button.name`]:"תצוגת גריד",[`chonky.actions.${ne.ChonkyActions.SortFilesByName.id}.button.name`]:"מיון לפי שם",[`chonky.actions.${ne.ChonkyActions.SortFilesBySize.id}.button.name`]:"מיון לפי גודל",[`chonky.actions.${ne.ChonkyActions.SortFilesByDate.id}.button.name`]:"מיון לפי תאריך",[`chonky.actions.${ne.ChonkyActions.ToggleHiddenFiles.id}.button.name`]:"קבצים נסתרים",[`chonky.actions.${ne.ChonkyActions.ToggleShowFoldersFirst.id}.button.name`]:"הצגת תיקיות בראש הרשימה"}},Ro={[Se.EN]:Jo,[Se.RU]:Ko,[Se.HE]:Qo},Ws="";class es extends ne.FileHelper{}const ts=ne.ChonkyActions,jr={listView:ne.ChonkyActions.EnableListView.id,gridView:ne.ChonkyActions.EnableGridView.id};ne.setChonkyDefaults({iconComponent:vn.ChonkyIconFA});const rs=a.memo(a.forwardRef(({theme:e,styles:t={height:"100%",minWidth:"600px"},defaultView:r=jr.listView,readOnlyMode:n=!1,locale:o,files:s,folderChain:d,onFileAction:g,...f},w)=>{const S=a.useCallback(N=>null,[]);Ne.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 C=N=>N.replace(/([A-Z])/g,X=>"-"+X.toLowerCase()),v=a.useMemo(()=>e!==void 0?Object.keys(e).reduce((X,l)=>{const c=e[l];return l=l.startsWith("--")?l:`--fp-theme-${C(l)}`,X[l]=c,X},{}):{},[e]),[y,D]=a.useState(!1),[V,I]=a.useState(),[G,q]=a.useState(!1),[R,H]=a.useState(),[Z,$]=a.useState();return a.useEffect(()=>{e&&D(!0),I(r),n?q(!0):H([ne.ChonkyActions.CreateFolder,ne.ChonkyActions.DeleteFiles]),o!==void 0&&$(Ro[o])},[e,r,n,o]),i.jsx(U,{style:{...t,...v},children:i.jsx(ne.FullFileBrowser,{ref:w,files:s??[],folderChain:d,onFileAction:N=>{typeof g=="function"&&g(N)},thumbnailGenerator:S,defaultFileViewActionId:V,disableDragAndDrop:G,fileActions:R,darkMode:y,i18n:Z,...f})})})),ns=e=>i.jsx(Gt.components.Option,{...e,children:i.jsx(ee.Checkbox,{label:e.label,checked:e.isSelected})}),is=e=>{const{styles:t}=e;return i.jsx(Gt,{isMulti:!0,components:{Option:ns},styles:t,isClearable:!0,hideSelectedOptions:!1,closeMenuOnSelect:!1,...e})},os=e=>{const{values:t,options:r,onChange:n,placeholder:o,styles:s}=e,d=ee.useTheme(),g=Re(d),[f,w]=a.useState(t);a.useEffect(()=>{w(t??[])},[t]);const S=C=>{w(C),n&&n(C)};return i.jsx(de.ThemeProvider,{theme:g,children:i.jsx(de.Input,{multiline:!0,fullWidth:!0,disableUnderline:!0,inputComponent:is,value:f,onChange:S,placeholder:o,id:"react-select-single",inputProps:{styles:s,options:r}})})},ss=({value:e,text:t,children:r,strokeWidth:n=8,styles:o,background:s=!1,backgroundPadding:d=0,counterClockwise:g=!1,circleRatio:f=1})=>{const w={value:e,strokeWidth:n,background:s,backgroundPadding:d,counterClockwise:g,circleRatio:f,styles:Ke.buildStyles({...o})};return r?i.jsx(Ke.CircularProgressbarWithChildren,{...w,children:r}):i.jsx(Ke.CircularProgressbar,{...w,text:t})},as=({values:e,valueStart:t=0,valueEnd:r,duration:n,interval:o=1e3,easingFunction:s,repeat:d,children:g})=>{const[f,w]=a.useState(0),[S,C]=a.useState(t),v=a.useRef(void 0),y=e===void 0&&r!==void 0;return a.useEffect(()=>{if(y)return d?v.current=window.setInterval(()=>{C(D=>D===t?r:t)},n?n*1e3:1e3):C(r||t),()=>{window.clearInterval(v.current)};if(e)return v.current=window.setInterval(()=>{w(D=>(D+1)%e.length),C(e[f])},o),()=>clearInterval(v.current)},[e,r,n,o,d,f]),y?i.jsx(Tn.Animate,{start:()=>({value:t}),update:()=>({value:[S],timing:{duration:n?n*1e3:1e3,ease:s}}),children:({value:D})=>i.jsx(i.Fragment,{children:g(D)})}):i.jsx(i.Fragment,{children:g(S)})};h.useMediaQuery=Jr,Object.defineProperty(h,"CesiumCesiumEntity",{enumerable:!0,get:()=>u.Entity}),Object.defineProperty(h,"CesiumCesiumPolygonGraphics",{enumerable:!0,get:()=>u.PolygonGraphics}),Object.defineProperty(h,"CesiumGeoJsonDataSource",{enumerable:!0,get:()=>u.GeoJsonDataSource}),Object.defineProperty(h,"CesiumMath",{enumerable:!0,get:()=>u.Math}),Object.defineProperty(h,"CesiumSceneTransforms",{enumerable:!0,get:()=>u.SceneTransforms}),Object.defineProperty(h,"cesiumSampleTerrainMostDetailed",{enumerable:!0,get:()=>u.sampleTerrainMostDetailed}),Object.defineProperty(h,"buildStyles",{enumerable:!0,get:()=>Ke.buildStyles}),h.AnimatedValuesProvider=as,h.Autocomplete=Xo,h.BboxCorner=Qe,h.Box=U,h.COORDINATES_MERCATOR_FRACTION_DIGITS=rt,h.COORDINATES_WGS_FRACTION_DIGITS=tt,h.Cesium3DTileset=wo,h.CesiumBoundingSphere=bi,h.CesiumCartesian2=Li,h.CesiumCartesian3=wi,h.CesiumCartographic=fr,h.CesiumCesiumBillboardGraphics=Di,h.CesiumCesiumPolylineGraphics=Pi,h.CesiumCesiumTerrainProvider=Ii,h.CesiumColor=ki,h.CesiumCompassTool=Mr,h.CesiumConstantPositionProperty=Ti,h.CesiumConstantProperty=Ei,h.CesiumCustomDataSource=qr,h.CesiumDrawingsDataSource=Bo,h.CesiumEllipsoid=Si,h.CesiumEllipsoidTerrainProvider=_i,h.CesiumEntity=Hr,h.CesiumEntityDescription=Po,h.CesiumEntityStaticDescription=Wr,h.CesiumGeographicTilingScheme=Ci,h.CesiumGeojsonLayer=bo,h.CesiumHeightReference=Gi,h.CesiumHorizontalOrigin=Fi,h.CesiumImageryLayer=qe,h.CesiumJulianDate=Ai,h.CesiumLabelStyle=Vi,h.CesiumMap=To,h.CesiumOSMLayer=_o,h.CesiumPolygonGraphics=zr,h.CesiumPolygonHierarchy=Ni,h.CesiumPolylineDashMaterialProperty=vi,h.CesiumPositionProperty=Oi,h.CesiumRectangle=mr,h.CesiumRectangleGraphics=Ur,h.CesiumResource=Mi,h.CesiumScene=xi,h.CesiumSceneMode=it,h.CesiumVerticalOrigin=Bi,h.CesiumViewer=vo,h.CesiumWFSLayer=Io,h.CesiumWMSLayer=So,h.CesiumWMTSLayer=Co,h.CesiumXYZLayer=Mo,h.CircularProgressBar=ss,h.CoordinatesTrackerTool=_r,h.CssBaseline=hi,h.DateRangePicker=In,h.DateTimePicker=Pn,h.DateTimeRangePicker=qt,h.DateTimeRangePickerFormControl=Sn,h.DrawInteraction=sr,h.DrawType=Le,h.FileHelper=es,h.FilePicker=rs,h.FilePickerActions=ts,h.FilePickerViewObj=jr,h.GeoJSONFeature=ir,h.InspectorTool=Ir,h.Legend=si,h.MVTSource=oi,h.Map=Xt,h.MapFilterContainer=Un,h.MultiSelection=os,h.Popover=$t,h.Proj=Ce,h.ScaleTrackerTool=Pr,h.ScopedCssBaseline=gi,h.SmartTable=ui,h.SupportedLocales=Se,h.TRANSPARENT_LAYER_ID=Oe,h.TerrainianHeightTool=Vo,h.TileLayer=Kt,h.TileOsm=or,h.TileWMS=Rn,h.TileWMTS=Kn,h.TileXYZ=ti,h.TimeRangeInput=Cn,h.VectorLayer=er,h.VectorSource=nr,h.VectorTileLayer=$n,h.ZoomButtons=Ar,h.ZoomLevelTrackerTool=Dr,h.defaultFormatters=at,h.getMVTOptions=ii,h.getWMSOptions=Qn,h.getWMTSOptions=Jn,h.getXYZOptions=ei,h.isDateRange=et,h.mapMcToMuiTheme=zt,h.useCesiumMap=fe,h.useCesiumMapViewstate=Be,h.useMap=xe,h.useMappedCesiumTheme=Ut,h.useMappedMuiTheme=Re,h.useTileLayer=We,h.useVectorLayer=Rt,h.useVectorSource=rr,h.useVectorTileLayer=ur,h.useVectorTileSource=ni,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});