@map-colonies/react-components 4.13.4 → 4.14.0

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,14 +1,14 @@
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/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):(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.invariant,h.area,h.bboxPolygon,h.centroid,h.turf,h.intersect,h.pointToPolygonDistance,null,null,h.booleanPointInPolygon,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,Le,Ue,Ct,Be,ae,De,K,Kn,St,Qn,Fe,Rn,Mt,ls,_t,at,lt,It,Pt,ct,dt,er,tr,nr,$e,rr,At,ir,or,sr,Ot,ar,cs,lr,Dt,cr,dr,ut,Me,p,$,qe,ur,kt,je,hr,xt,Nt,gr,ds,us,pr,fr,hs,gs,ps,ht,Bt,mr,yr,Ft,re,vr,Er,Vt,Ye,fs,wr){"use strict";var ss=Object.defineProperty;var as=(h,i,a)=>i in h?ss(h,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):h[i]=a;var ue=(h,i,a)=>(as(h,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 Gt=gt(a),_=gt(p),Ht=gt(xt),R=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||{}),be=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(be||{}),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:be.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:be.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Xe=e=>{const t=e.type==="dark";return a.useMemo(()=>Wt(e,t),[t,e])},Wt=(e,t=!1)=>De.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]),ms="",Tr=2,Lr=.5,br=De.makeStyles(e=>De.createStyles({container:{padding:e.spacing(Tr),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Lr)}})),Ut=e=>{var Z,W,J,ee;const t=br(),n=K.useTheme(),r=Xe(n),[s,o]=a.useState(null),[d,g]=a.useState(null),[f,v]=a.useState(he.DATE_RANGE_PICKER.dateFormat),M=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,S=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,u=((Z=e.local)==null?void 0:Z.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,E=((W=e.local)==null?void 0:W.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,P=((J=e.local)==null?void 0:J.setText)??he.DATE_RANGE_PICKER.local.setText,L=((ee=e.local)==null?void 0:ee.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,V=e.showTime??he.DATE_RANGE_PICKER.showTime,G=L===be.HE?Ue.he:Ue.enUS;a.useEffect(()=>{o(e.from??null)},[e.from]),a.useEffect(()=>{g(e.to??null)},[e.to]),a.useEffect(()=>{v(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const Y=Boolean(Le.isValid(s)&&!d||Le.isValid(d)&&!s||s&&d&&Le.isValid(s)&&Le.isValid(d)&&Le.isBefore(s,d)),X=()=>{e.onChange({from:s&&Le.isValid(s)?s:void 0,to:d&&Le.isValid(d)?d:void 0})},F=V?Be.KeyboardDateTimePicker:Be.KeyboardDatePicker;return i.jsx(ae.ThemeProvider,{theme:r,children:i.jsx(R,{className:`${t.container} drpContainer`,display:"flex",flexDirection:M,width:M==="column"?e.contentWidth:"unset",children:i.jsxs(Be.MuiPickersUtilsProvider,{utils:Ct,locale:G,children:[i.jsx(F,{variant:"inline",placeholder:u,onChange:l=>o(l),value:s,disableFuture:S,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(F,{variant:"inline",placeholder:E,className:t.margin,onChange:l=>g(l),value:d,disableFuture:S,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(K.ThemeProvider,{options:n,children:i.jsx(K.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:X,disabled:!Y,children:P})})]})})})},$t=e=>{const{children:t,...n}=e;return i.jsx(ae.Popover,{...n,children:t})},ys="",Cr=e=>{var F,Z;const[t,n]=a.useState(null),[r,s]=a.useState(null),[o,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[g,f]=a.useState(null),v=W=>{f(W.currentTarget)},M=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},S=()=>{f(null)},u=Boolean(g),E=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 P=((F=e.local)==null?void 0:F.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,L=((Z=e.local)==null?void 0:Z.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,V=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,G=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,Y=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,X=a.useMemo(()=>`${t?Le.format(t,o):P} - ${r?Le.format(r,o):L}`,[t,r,o,P,L]);return i.jsxs(i.Fragment,{children:[V?i.jsx(K.Button,{style:{width:e.width},raised:!0,onClick:v,className:"drpOpener",children:X}):i.jsx(K.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:X,onClick:M,trailingIcon:{icon:"date_range",tabIndex:0,onClick:M}}),i.jsx($t,{open:u,anchorEl:g,onClose:S,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(Ut,{controlsLayout:E,contentWidth:((g==null?void 0:g.clientWidth)??0)-G,dateFormat:o,disableFuture:Y,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:r??void 0,onChange:({from:W,to:J})=>{n(W??null),s(J??null),e.onChange({from:W,to:J}),S()}})})]})},Je=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,Sr=({endDate:e,startDate:t,setEndDate:n=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:o="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:g="",startTimeInputClassName:f="",startTimeLabel:v="",startTimeWrapperClassName:M=""})=>i.jsxs("div",{className:`timeRangeWrapper ${g}`,children:[i.jsx("div",{className:`startTimeWrapper ${M}`,children:i.jsx(K.TextField,{label:v,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Fe(t).format("HH:mm"),onChange:S=>{const u=Fe(t),E=Fe(S.currentTarget.value,"HH:mm"),P=u.set({hours:E.get("hours"),minutes:E.get("minutes")});r(P.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(K.TextField,{label:o,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Fe(e).format("HH:mm"),onChange:S=>{const u=Fe(e),E=Fe(S.currentTarget.value,"HH:mm"),P=u.set({hours:E.get("hours"),minutes:E.get("minutes")});n(P.toDate())}})})]}),Mr=a.forwardRef(({value:e,onClick:t,onInputClick:n,...r},s)=>i.jsx(K.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:o=>{t==null||t(o),n==null||n()},ref:s,value:e})),_r=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:n,dateRange:r,onShortcut:s})=>{const[o,d]=a.useState(),g=a.useMemo(()=>n.map(f=>f instanceof Function?f():f),[n]);return a.useEffect(()=>{for(const f of g){const v=r.startDate&&r.endDate&&Le.isSameDay(f.startDate,r.startDate)&&Le.isSameDay(f.endDate,r.endDate);o?f.id===o&&(v||d(void 0)):v&&d(f.id)}},[r,o,g]),i.jsx("div",{className:"shortcutsContainer",children:g.map((f,v)=>{const M=()=>{e(f.startDate),t(f.endDate)};return i.jsx(K.Button,{type:"button",className:`shortcut ${o===f.id?"selected":""}`,onClick:S=>{M(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+v)})})},Ir=a.forwardRef((e,t)=>{const{calendarClassName:n,dayClassName:r,monthClassName:s,selectsRange:o,onChange:d,inputName:g,showMonthYearDropdown:f,withShortcuts:v,locale:M="en"}=e,[S,u]=a.useState(null),[E,P]=a.useState(null),[L,V]=a.useState(!1),G=o?{startDate:S,endDate:E}:S;a.useEffect(()=>{M==="he"&&St.registerLocale("he",Qn)},[M]),a.useEffect(()=>{var F,Z;((F=e.startDate)==null?void 0:F.toString())!==(S==null?void 0:S.toString())&&u(e.startDate),((Z=e.endDate)==null?void 0:Z.toString())!==(E==null?void 0:E.toString())&&P(e.endDate)},[e.startDate,e.endDate,S,E]);const Y=a.useMemo(()=>{let F="pickerContainer"+(M==="he"?" pickerContainer-rtl":"");return v&&o&&(F+=" pickerContainer-withShortcuts"),F},[M,v,o]),X=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:Y,style:{direction:M==="he"?"rtl":"ltr"},children:i.jsx(St,{...e,ref:t,onClickOutside:()=>V(!1),open:L,startDate:Je(G)?S:void 0,selected:S,endDate:Je(G)?E:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${n}`,weekDayClassName:F=>`pickerWeek ${(r==null?void 0:r(F))??""}`,dayClassName:F=>`pickerDay ${(r==null?void 0:r(F))??""}`,monthClassName:F=>`pickerMonth ${(s==null?void 0:s(F))??""}`,onChange:(F,Z)=>{if(Array.isArray(F)){const[W,J]=F;u(W),P(J),d==null||d({startDate:W,endDate:J&&Le.endOfDay(J)},Z)}else u(F),d==null||d(F,Z)},customInput:i.jsx(Mr,{name:g,onInputClick:()=>{V(!0)}}),showTimeInput:!!(v&&o),timeInputLabel:"",customTimeInput:v&&Je(G)&&i.jsx(_r,{onShortcut:F=>{d==null||d(F),V(!1)},shortcuts:v,setEndDate:P,setStartDate:u,dateRange:G}),showMonthYearDropdown:void 0,...X})})}),vs="",Pr=e=>{const t=K.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:g,showTime:f=he.DATE_PICKER.showTime,value:v,...M}=e,{placeHolderText:S=he.DATE_PICKER.local.placeHolderText,calendarLocale:u}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:be.EN},E=u===be.HE?Ue.he:Ue.enUS,P=L=>{g(L)};return i.jsx(ae.ThemeProvider,{theme:n,children:i.jsxs(Be.MuiPickersUtilsProvider,{utils:Ct,locale:E,children:[f&&i.jsx(Be.KeyboardDateTimePicker,{variant:s,placeholder:S,onChange:P,value:v,disableFuture:o,format:r,...M}),!f&&i.jsx(Be.KeyboardDatePicker,{variant:s,placeholder:S,onChange:P,value:v,disableFuture:o,format:r,...M})]})})},Ar=18,Or=De.makeStyles(e=>De.createStyles({drawingButton:{width:e.spacing(Ar)},fullWidth:{width:"100%",marginTop:"36px"}})),Dr=e=>{const t=Or(),[n,r]=a.useState(null),{isSelectionEnabled:s,onCancelDraw:o,onStartDraw:d,onReset:g}=e,f=M=>{r(M.currentTarget)},v=()=>{r(null)};return s?i.jsx(K.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(K.Button,{className:t.drawingButton,raised:!0,onClick:o,children:"Cancel Draw"})}):i.jsxs(R,{position:"relative",children:[i.jsx(K.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(K.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(K.Menu,{className:t.fullWidth,open:Boolean(n),onClose:v,children:[i.jsx(K.MenuItem,{onClick:()=>{d(we.POLYGON),v()},children:"Polygon"}),i.jsx(K.MenuItem,{onClick:()=>{d(we.BOX),v()},children:"Box"}),i.jsx(K.MenuItem,{onClick:()=>{g(),v()},children:"Clear"})]})]})},Es="";var Ce=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(Ce||{});const Ke=5,Qe=2,qt=a.createContext(null),kr=qt.Provider,jt=35,Yt=32,xr=10,Nr=e=>e!==void 0&&e!==Ce.WGS84?It.transform([jt,Yt],Ce.WGS84,e):[jt,Yt],Br=e=>{switch(e){case Ce.WEB_MERCATOR:return t=>_t.format(t,"Mercator: {y}m, {x}m",Qe);case Ce.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??Ce.WGS84}),controls:at.defaults()}));a.useEffect(()=>{o.getView().setCenter(e.center??Nr(e.projection))},[o,e.center,e.projection]),a.useEffect(()=>{o.getView().setZoom(e.zoom??xr)},[o,e.zoom,e.projection]);const d=(g,f)=>{f.getControls().forEach(M=>{M instanceof g&&f.removeControl(M)})};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:Br(s??Ce.WGS84),projection:s??Ce.WGS84,undefinedHTML:"&nbsp;"}))):d(lt,o)},[o,r,s]),i.jsxs(kr,{value:o,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Xt=a.createContext(null),Fr=Xt.Provider,Ge=()=>{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 Pt.Tile(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Fr,{value:r,children:t})},Kt=a.createContext(null),Vr=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 Pt.Vector(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Vr,{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 g=new dt.GeoJSON().readFeature(e);return n&&s.on("addfeature",function(){o.getView().fit(s.getExtent(),t)}),r&&g.setStyle(r),s.addFeature(g),()=>{s.removeFeature(g)}},[e,s,n]),null},on=e=>{const t=Ge();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=tr.createBox();break;case we.POLYGON:r.type="Polygon";break;default:return}const s=new er.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},ws="",Hr=e=>{const t=n=>{const r=Rn(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,Wr=80,zr=De.makeStyles(e=>De.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(Wr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),Ur=e=>{var f;const[t,n]=a.useState(),[r,s]=a.useState(),o=zr(),d=v=>{s(v),n(void 0),e.handlePolygonSelected(v)},g=()=>{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:g,onStartDraw:n,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((v,M)=>i.jsx("div",{className:o.filtersMargin,children:v},M))]}),i.jsx(ae.Paper,{color:"red",className:`${o.contentContainer}`,children:e.children})]}),i.jsx(Hr,{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),$r=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},qr=({children:e,options:t,style:n})=>{const r=ke(),[s]=a.useState(new nr({...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($r,{value:s,children:e})},ft=20,jr=256,Yr=2,Zr=2,Xr="REST",Jr=e=>{const t=It.get(e.projection),n=t.getExtent(),r=new Array(ft),s=new Array(ft),o=At.getWidth(n)/jr,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Zr,g=e.requestEncoding!==void 0?e.requestEncoding:Xr;for(let v=0;v<ft;++v)r[v]=o/Math.pow(Yr,v)/d,s[v]=v.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new rr({origin:At.getTopLeft(n),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:g,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Kr=e=>{const t=Ge(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ct.WMTS(n))},[t,n]),null},Qr=e=>{const{attributions:t,url:n,params:r,serverType:s,transition:o}=e;return{attributions:t,url:n,params:r,serverType:s,transition:o}},Rr=e=>{const t=Ge(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ir(n))},[t,n]),null},ei=e=>{const{attributions:t,url:n}=e;return{attributions:t,url:n}},ti=e=>{const t=Ge(),{options:n}=e;return a.useEffect(()=>{t.setSource(new or(n))},[t,n]),null},ni=a.createContext(null),ri=()=>{const e=a.useContext(ni);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 dt.MVT}},oi=({children:e,options:t})=>{const n=un();return a.useEffect(()=>{n.setSource(new sr(t))},[t,n]),null},si=({legendItems:e,title:t,isCollapsed:n})=>{const r=ke();return a.useEffect(()=>{const s=new Ot({title:t??"",margin:5,maxWidth:300}),o=new ar({legend:s,collapsed:n===void 0?!0:n});r.addControl(o);const d=new Ot({margin:4});return e.forEach(g=>{d.addItem({title:g.title,style:g.style,typeGeom:"Polygon"})}),s.addItem(d),()=>{r.removeControl(o)}},[r,e,t,n]),i.jsx(i.Fragment,{})};function ai(e){const{headCells:t,order:n,orderBy:r,onRequestSort:s,isCollapseable:o}=e,d=g=>f=>{s(f,g)};return i.jsx(lr,{children:i.jsxs(ae.TableRow,{children:[o&&i.jsx(ae.TableCell,{}),t.map(g=>i.jsx(ae.TableCell,{align:g.numeric?"right":"left",padding:g.disablePadding?"none":"default",sortDirection:r===g.id?n:!1,children:i.jsx(ae.TableSortLabel,{active:r===g.id,direction:r===g.id?n:"asc",onClick:d(g.id),children:g.label})},g.id))]})})}const li=Dt.createSvgIcon(Gt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),ci=Dt.createSvgIcon(Gt.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:n,item:r,onRowSelected:s,rowIndex:o,isCollapseable:d,collapsedElement:g}=e,[f,v]=a.useState(!1),M=t.length,S=()=>{s==null||s(o)};return i.jsxs(i.Fragment,{children:[i.jsxs(ae.TableRow,{hover:!0,selected:n,onClick:S,children:[d&&i.jsx(ae.TableCell,{padding:"checkbox",children:i.jsx(ae.IconButton,{"aria-label":"expand row",size:"small",onClick:u=>{u.stopPropagation(),v(!f)},children:f?i.jsx(ci,{}):i.jsx(li,{})})}),t.map(u=>i.jsx(ae.TableCell,{align:u.numeric?"right":"left",padding:u.disablePadding?"none":"default",children:u.transform?u.transform(r[u.id]):r[u.id]},u.id+o.toString()))]}),d&&i.jsx(ae.TableRow,{children:i.jsx(ae.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:M+1,children:i.jsx(ae.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:g==null?void 0:g(r)})})})]})}function ui(e){const[t,n]=a.useState(""),[r,s]=a.useState("asc"),{cellsMetadata:o,items:d,onRequestSort:g,onRowSelected:f,isCollapseable:v,collapsedElement:M,isDense:S,page:u,rowsPerPage:E,count:P,handleChangePage:L,handleChangeRowsPerPage:V}=e,G=(Y,X)=>{const F=t===X&&r==="asc";s(F?"desc":"asc"),n(X),g(X,F?"desc":"asc")};return i.jsxs(ae.TableContainer,{component:ae.Paper,children:[i.jsxs(ae.Table,{size:S?"small":"medium",children:[i.jsx(ai,{headCells:o,onRequestSort:G,order:r,orderBy:t,isCollapseable:v}),i.jsxs(ae.TableBody,{children:[d.map((Y,X)=>i.jsx(di,{item:Y,rowIndex:X,isCollapseable:v,cellsMetadata:o,collapsedElement:M,isRowSelected:!1,onRowSelected:f},X)),(d.length===0||E>d.length)&&i.jsx(ae.TableRow,{style:{height:(S?33:53)*(E-d.length)},children:i.jsx(ae.TableCell,{colSpan:v?o.length+1:o.length,children:d.length===0&&i.jsx(ae.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(ae.TablePagination,{rowsPerPage:E,rowsPerPageOptions:[5,10],component:"div",count:P,page:u,onPageChange:L,onRowsPerPageChange:V})]})}const hi=e=>{const{children:t,...n}=e;return i.jsx(cr,{...n,children:t})},gi=e=>{const{children:t,...n}=e;return i.jsx(dr,{...n,children:t})},hn=e=>e*Math.PI/180,Re=e=>e*(180/Math.PI),pi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hn(85.362/2))/Math.sin(hn(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:n,children:r})=>i.jsxs(R,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(fi,{title:e,onClick:n}),t&&i.jsx(R,{className:"cesium-cesiumInspector-dropDown",children:r})]}),Ts="",mt="Imagery",yt="Data",yi=({locale:e})=>{var S,u;const t=pe(),[n,r]=a.useState([{id:mt,values:[]},{id:yt,values:[]}]),[s,o]=a.useState({}),d=E=>$.get(e,E.toUpperCase())??E,g=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(E,P)=>{var G;const L=t.imageryLayers.get(P),V=L.meta;return{id:V==null?void 0:V.id,name:$.get(V,"layerRecord.productName")??(V==null?void 0:V.id),rect:L.rectangle,isBaseMap:(G=t.layersManager)==null?void 0:G.isBaseMapLayer(V)}}):[],f=()=>{var E;return((E=t.layersManager)==null?void 0:E.dataLayerList.map(P=>{var L,V;return{id:(L=P.meta)==null?void 0:L.id,name:$.get(P.meta,"featureStructure.aliasLayerName")??P.meta.productName,rect:p.Rectangle.fromDegrees(...qe((V=P.meta)==null?void 0:V.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const P=[{id:mt,values:g()},{id:yt,values:f()}];r(P),o(P.reduce((L,V)=>({...L,[V.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const E=()=>{r(P=>P.map(L=>L.id===mt?{...L,values:g()}:L))};return t.layersManager.addLayerUpdatedListener(E),t.imageryLayers.layerRemoved.addEventListener(E),()=>{var P;$.get(t,"_cesiumWidget")!==void 0&&((P=t.layersManager)==null||P.removeLayerUpdatedListener(E),t.imageryLayers.layerRemoved.removeEventListener(E))}},[(S=t.layersManager)==null?void 0:S.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const E=()=>{r(P=>P.map(L=>L.id===yt?{...L,values:f()}:L))};return t.layersManager.addDataLayerUpdatedListener(E),()=>{var P;(P=t.layersManager)==null||P.removeDataLayerUpdatedListener(E)}},[(u=t.layersManager)==null?void 0:u.dataLayerList]);const v=E=>{o(P=>({...P,[E]:!P[E]}))},M=E=>{t.camera.flyTo({destination:E})};return i.jsx(R,{className:"activeLayersPanel",children:n.filter(E=>E.values.length>0).map(E=>i.jsxs(R,{className:`cesium-cesiumInspector-section ${s[E.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>v(E.id),children:[i.jsx(K.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(E.id)}),i.jsx(R,{className:"cesium-cesiumInspector-sectionContent",children:E.values.map(P=>i.jsxs(R,{className:"layer",children:[i.jsx(K.Tooltip,{content:P.name,children:i.jsx(R,{className:`name ${P.isBaseMap?"disabled":""}`,children:P.name})}),i.jsx(R,{className:"icons",children:i.jsx(K.Tooltip,{content:$.get(e,"FLY_TO")??"Fly To",children:i.jsx(R,{className:"icon",onClick:L=>{L.stopPropagation(),M(P.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)"})]})})})})]},P.id))})]},E.id))})},vi=({locale:e})=>{const[t,n]=a.useState(!1),r=a.useMemo(()=>$.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(mi,{title:r,isVisible:t,onClick:()=>n(!t),children:i.jsx(yi,{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(R,{className:"cesium-mc-title",children:e}),Et=({isVisible:e,children:t,title:n})=>i.jsxs(R,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[n&&i.jsx(vt,{title:n}),t]}),Ls="";function wt(e){return function(n){const r=a.useRef(null),[s,o]=a.useState(!1);return a.useEffect(()=>{if(!s)return;const d=g=>{const f=g.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(R,{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(R,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),Ei=({title:e,baseMaps:t,setCurrent:n})=>{const r=pe(),[s,o]=a.useState();a.useEffect(()=>{const g=t.maps.find(f=>f.isCurrent);g&&(o(g),n(g))},[t]);const d=g=>{var v,M;(v=r.layersManager)==null||v.removeBaseMapLayers();const f=t.maps.find(S=>S.id===g);f&&((M=r.layersManager)==null||M.setBaseMapLayers(f),o(f),n(f),t.maps.forEach(S=>{S.isCurrent=f===S}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(R,{className:"cesium-mc-choices",children:t.maps.map(g=>i.jsx(gn,{item:g,isSelected:s===g,onClick:()=>d(g.id)},g.id))})]})},wi=({title:e,terrains:t})=>{const[n,r]=a.useState(),s=pe();a.useEffect(()=>{const d=t.find(g=>g.isCurrent);d&&r(d)},[t]);const o=d=>{const g=t.find(f=>f.id===d);g&&(s.terrainProvider=g.terrainProvider??new p.EllipsoidTerrainProvider({}),r(g),t.forEach(f=>{f.isCurrent=g===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(R,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(gn,{item:d,isSelected:n===d,onClick:()=>o(d.id)},d.id))})]})},Ti=wt(({baseMaps:e,terrains:t,locale:n,isOpen:r,setIsOpen:s})=>{const[o,d]=a.useState(),g=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(Ei,{title:g,baseMaps:e,setCurrent:d}),t&&i.jsx(wi,{title:f,terrains:t})]})]})}),Cs="",Li=({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(R,{className:"title",children:n}),[n]),g=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,v)=>i.jsxs(R,{className:"featureType",children:[i.jsx(K.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(R,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(R,{className:"info",children:[i.jsxs(R,{children:[r,": ",f.cache??0]}),f.total>0&&i.jsxs(R,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},v)):i.jsx(R,{children:o})}),[e]);return i.jsxs(R,{className:"wfsContainer",children:[d,g]})},bi=wt(({locale:e,isOpen:t,setIsOpen:n})=>{var S;const[r,s]=a.useState([]),o=a.useMemo(()=>$.get(e,"DEBUG_PANEL_TITLE")??"Debugger Tool",[e]),d=a.useMemo(()=>$.get(e,"TILE_REQUESTS_OPTIMIZATION_CHECKBOX")??"Tile requests optimization",[e]),g=a.useMemo(()=>$.get(e,"CESIUM_INSPECTOR_CHECKBOX")??"Cesium Inspector",[e]),f=pe(),{viewState:v,setViewState:M}=xe();return a.useEffect(()=>{if(!f.layersManager)return;const u=(E,P)=>{var V;E.forEach(G=>{if(P!==void 0&&P!==G.meta.id)return;const{options:Y,meta:X}=G,{zoomLevel:F}=Y,{id:Z,items:W,total:J,cache:ee,currentZoomLevel:l,featureStructure:c}=X;s(C=>{const y=C.findIndex(w=>w.id===Z);if(y>=0){if(JSON.stringify(C[y])!==JSON.stringify({id:Z,items:W,total:J,cache:ee,currentZoomLevel:l,featureStructure:c,zoomLevel:F})){const w=[...C];return w[y]={id:Z,items:W,total:J,cache:ee,currentZoomLevel:l,featureStructure:c,zoomLevel:F},w}}else return[...C,{id:Z,items:W,total:J,cache:ee,currentZoomLevel:l,featureStructure:c,zoomLevel:F}];return C})});const L=new Set((V=f.layersManager)==null?void 0:V.dataLayerList.map(G=>G.meta.id));s(G=>G.filter(Y=>L.has(Y.id)))};return f.layersManager.addDataLayerUpdatedListener(u),()=>{var E;(E=f.layersManager)==null||E.removeDataLayerUpdatedListener(u)}},[(S=f.layersManager)==null?void 0:S.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("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.jsxs(Et,{isVisible:t,title:o,children:[i.jsx(K.Checkbox,{className:"optimizationCheckbox",label:d,checked:(v==null?void 0:v.shouldOptimizedTileRequests)??!1,onClick:()=>{M(u=>({currentZoomLevel:(u==null?void 0:u.currentZoomLevel)??-1,shouldOptimizedTileRequests:!((u==null?void 0:u.shouldOptimizedTileRequests)??!1),showCesiumInspector:(u==null?void 0:u.showCesiumInspector)??!1}))}}),i.jsx(K.Checkbox,{className:"cesiumInspectorCheckbox",label:g,checked:(v==null?void 0:v.showCesiumInspector)??!1,onClick:()=>{M(u=>({currentZoomLevel:(u==null?void 0:u.currentZoomLevel)??-1,shouldOptimizedTileRequests:(u==null?void 0:u.shouldOptimizedTileRequests)??!1,showCesiumInspector:!((u==null?void 0:u.showCesiumInspector)??!1)}))}}),i.jsx(Li,{featureTypes:r,locale:e})]})]})});class Ci extends p.PolylineDashMaterialProperty{}class Si extends p.ConstantProperty{}class Mi extends p.ConstantPositionProperty{}class _i extends p.Cartesian2{}class Ii extends p.Cartesian3{}class pn extends p.Cartographic{}class Pi extends p.BoundingSphere{}class Ai extends p.Ellipsoid{}class Oi extends p.GeographicTilingScheme{}class fn extends p.Rectangle{}class Di extends p.Resource{}class ki extends p.EllipsoidTerrainProvider{}class xi extends p.CesiumTerrainProvider{}class Ni extends p.PolylineGraphics{}class Bi extends p.JulianDate{}class Fi extends p.PositionProperty{}class Vi extends p.BillboardGraphics{}class Gi extends p.Color{}class Hi extends p.PolygonHierarchy{}class Wi extends p.Scene{}const zi=p.VerticalOrigin,Ui=p.HorizontalOrigin,tt=p.SceneMode,$i=p.LabelStyle,qi=p.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},ji=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:g,north:f,south:v}=t;return n>=d&&r<=g&&s<=f&&o>=v},Yi=(e,t)=>gr(e,je(t)),Zi=e=>{const t=(p.Math.toDegrees(e.west)+p.Math.toDegrees(e.east))/2,n=(p.Math.toDegrees(e.south)+p.Math.toDegrees(e.north))/2;return xt.point([t,n])},yn=e=>[p.Math.toDegrees(e.west),p.Math.toDegrees(e.south),p.Math.toDegrees(e.east),p.Math.toDegrees(e.north)],vn=e=>{const t=e.scene;let r=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!p.defined(r)||!r){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const s=new p.Cartesian2(0,0),o=t.camera.pickEllipsoid(s,t.globe.ellipsoid),d=new p.Cartesian2(t.canvas.width,t.canvas.height),g=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(o),v=t.globe.ellipsoid.cartesianToCartographic(g);r=new p.Rectangle(f.longitude,v.latitude,v.longitude,f.latitude)}return r},Xi=(e,t=100)=>{const n=e.scene,r=e.camera,s=n.mode,o=vn(e);if(!p.defined(o)||!o){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(s===p.SceneMode.SCENE2D)return o;const d=r.positionCartographic;if(!p.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const g=d.latitude,f=d.longitude;if(g<-p.Math.PI_OVER_TWO||g>p.Math.PI_OVER_TWO||f<-p.Math.PI||f>p.Math.PI){console.error("Invalid latitude or longitude values.");return}const v=111320,M=111320*Math.cos(g);let S=t/v,u=t/M;const E=p.Cartesian3.magnitude(r.positionWC);E>1e7&&(S=10,u=10);const P=r.frustum instanceof p.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let L=1;E<5e5?L=.05:E<2e6&&(L=.1),S*=L*(P/Math.PI),u*=L*(P/Math.PI);const V=r.pitch;if(V===void 0)return;const G=Math.PI/4,Y=Math.max(0,1-Math.abs(V)/G);S*=Y,u*=Y;const X=5e-4;S=Math.max(S,X),u=Math.max(u,X);const F=d.latitude-S,Z=d.latitude+S,W=d.longitude-u,J=d.longitude+u,ee=p.Math.clamp(F,o.south,o.north),l=p.Math.clamp(Z,o.south,o.north),c=p.Math.clamp(W,o.west,o.east),C=p.Math.clamp(J,o.west,o.east),y=Math.min(1,V/p.Math.PI_OVER_TWO),w=o.north-(o.north-o.south)*y,T=Math.min(l,w);return new p.Rectangle(p.Math.negativePiToPi(c),p.Math.clamp(ee,-p.Math.PI_OVER_TWO,p.Math.PI_OVER_TWO),p.Math.negativePiToPi(C),p.Math.clamp(T,-p.Math.PI_OVER_TWO,p.Math.PI_OVER_TWO))},En=(e,t,n,r,s,o)=>{const d=e.scene.mode===p.SceneMode.SCENE2D,g=u=>{var E;if(u.polygon)return{type:"Polygon",coordinates:[((E=u.polygon.hierarchy)==null?void 0:E.getValue(p.JulianDate.now())).positions.map(V=>{const G=p.Cartographic.fromCartesian(V),Y=new p.Cartographic(p.Math.toDegrees(G.longitude),p.Math.toDegrees(G.latitude),d?500:void 0);return[Y.longitude,Y.latitude,Y.height]})]}},f=(u,E,P,L)=>{const V=p.SceneTransforms.wgs84ToWindowCoordinates(u,E);if(!V)return null;const G=V.x+P,Y=V.y+L,X=new p.Cartesian2(G,V.y),F=new p.Cartesian2(V.x,Y),Z=u.camera.pickEllipsoid(X,u.globe.ellipsoid),W=u.camera.pickEllipsoid(F,u.globe.ellipsoid);if(!Z||!W)return null;const J=p.Cartesian3.distance(E,Z),ee=p.Cartesian3.distance(E,W);return{widthMeters:J,heightMeters:ee}},v=(u,E,P)=>{const L=p.Ellipsoid.WGS84,V=u.latitude,G=u.longitude,Y=Math.PI/180*L.maximumRadius,X=Math.PI/180*L.maximumRadius,F=P/2/Y,Z=E/2/X,W=V+F,J=V-F,ee=G+Z,l=G-Z;return{type:"Polygon",coordinates:[[[l,W],[ee,W],[ee,J],[l,J],[l,W]]]}},M=(u,E)=>kt(u)/kt(E);if(!e.dataSources.getByName(t.name)[0])return;const S=[];if(t==null||t.entities.values.forEach(u=>{var E,P;if(s&&o&&d)try{const L=je(s),V=Nt(g(u),L);if(V){const G=(E=u.properties)==null?void 0:E.label.getValue(p.JulianDate.now()),Y=hr(V,{properties:{label:G}}),X={width:G.width,height:G.height},[F,Z,W=0]=Y.geometry.coordinates,J=p.Cartesian3.fromDegrees(F,Z,W),ee=f(e.scene,J,X.width,X.height);if(ee){const l=v({longitude:F,latitude:Z},ee.widthMeters,ee.heightMeters),c=Nt(V,{type:"Feature",properties:{},geometry:l});M(c==null?void 0:c.geometry,l)>.7&&S.push(Y)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",u,"extent -->",s)}if(!(n.length>0&&!n.some(L=>u.id.startsWith(L)))&&(u.polygon&&(u.polygon=new p.PolygonGraphics({hierarchy:u.polygon.hierarchy,material:d?p.Color.fromCssColorString(r).withAlpha(.2):p.Color.fromCssColorString(r).withAlpha(.5),outline:!0,outlineColor:p.Color.fromCssColorString(r),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),u.polyline&&(u.polyline=new p.PolylineGraphics({positions:u.polyline.positions,material:p.Color.fromCssColorString(r).withAlpha(.5),clampToGround:!0,width:4})),u.billboard)){const L=(P=u.position)==null?void 0:P.getValue(p.JulianDate.now()),V=p.Cartographic.fromCartesian(L),G=new p.Cartographic(V.longitude,V.latitude,d?500:e.scene.sampleHeight(p.Cartographic.fromCartesian(L))),Y=p.Cartesian3.fromRadians(G.longitude,G.latitude,G.height),X="#FFFF00";u.position=Y,u.billboard=new p.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="${r}33" stroke="${X}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"})})()})]}))})]})]})})},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:p.VerticalOrigin.BOTTOM,heightReference:p.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 u=new p.GeoJsonDataSource(`${o==null?void 0:o.dataSourcePrefix}${t.name}`);e.dataSources.add(u),u.load({type:"FeatureCollection",features:S}).then(E=>{E==null||E.entities.values.forEach(P=>{var L;P.billboard=new p.BillboardGraphics({image:(L=P.properties)==null?void 0:L.label.getValue(p.JulianDate.now()).dataURL,heightReference:p.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})})})}},Ji=.2,Ki=(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),Ms="",Qi=({options:e,isOpen:t,locale:n})=>{const r=pe(),s=a.useRef(void 0),o=a.useRef(null),[d,g]=a.useState(""),[f,v]=a.useState(!1),[M,S]=a.useState(!0),[u,E]=a.useState(),[P,L]=a.useState(),V=a.useMemo(()=>$.get(n,"SHOW_FEATURE_ON_MAP")??"Show on map",[n]),G=a.useMemo(()=>$.get(n,"IN_MAP_EXTENT")??"Search in extent",[n]),Y=a.useMemo(()=>$.get(n,"SEARCH_PLACEHOLDER")??"Search...",[n]),X=a.useMemo(()=>$.get(n,"NO_RESULTS")??"No Results",[n]),F=a.useMemo(()=>r.scene.mode===p.SceneMode.SCENE2D?!1:(v(!1),!0),[r.scene.mode]),Z=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})}),J=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 b=new p.GeoJsonDataSource("geocoderDataSource");s.current=b,r.dataSources.add(b)}const m=s.current;P&&M?(async()=>{const k={type:"FeatureCollection",features:[P]};await m.load(k),En(r,m,[],"#01FF1F")})():m.entities.removeAll()},[r,M,P]);const ee=m=>{switch(typeof m){case"object":return Array.isArray(m)?`[${m.map(b=>`'${b}'`).join(", ")}]`:JSON.stringify(m);case"boolean":case"number":case"string":return m.toString();case"undefined":return}},l=(m,b,k)=>{const N=ee(k);if(N){const A=m.includes("?")?m.endsWith("?")||m.endsWith("&")?"":"&":"?";return`${m}${A}${encodeURIComponent(b)}=${encodeURIComponent(N)}`}return m},c=(m,b)=>(m&&m.forEach(k=>{b=l(b,k[0],k[1])}),b),C=a.useCallback((m,b,k,N)=>((()=>{const D=b.dynamic.queryText,B=typeof D=="string"?D:D.name,te=typeof D=="string"?void 0:D.relatedParams;if(m=l(m,B,k),te&&te.forEach(ne=>{m=l(m,ne[0],ne[1])}),N){const ne=vn(r),j=b.dynamic.geoContext,q=typeof j=="string"?j:j==null?void 0:j.name;if(ne&&q){const ie=yn(ne),ge={bbox:[ie[0],ie[1],ie[2],ie[3]]};m=l(m,q,ge);const ve=typeof j=="string"||j==null?void 0:j.relatedParams;ve&&ve.forEach(oe=>{m=l(m,oe[0],oe[1])})}}})(),m=c(b.static,m),m),[r]),y=a.useCallback(async(m,b)=>{if(!m){E([]);return}const k=e.map(async D=>{if(D.url){const B=C(D.url,D.params,m,b);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(D=>D!==void 0).map(async D=>{var te;const B=await D.json();return B.features=(te=B.features)==null?void 0:te.map(ne=>({...ne,properties:{...ne.properties,headers:D.headers}})),{body:B,status:D.status,url:D.url,headers:Object.fromEntries(D.headers.entries())}}));E(A)},[C,e]),w=a.useMemo(()=>$.debounce((m,b)=>{y(m,b)},Z),[y]);a.useEffect(()=>()=>w.cancel(),[w]);const T=(m,b)=>{g(m),w(m,b)};a.useEffect(()=>{y(d,f)},[f]);const I=m=>{const b=ur.getType(m);let k;switch(b){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(R,{children:k})};return i.jsx(R,{className:"geocoderContainer",children:i.jsxs(R,{className:"geocoderForm",children:[i.jsx(K.TextField,{id:"geocoderTextField",className:"cesium-geocoder-input",ref:o,onChange:m=>T(m.target.value,f),placeholder:Y,value:d,autoComplete:"off"}),i.jsxs(R,{className:"search-results",children:[i.jsxs(R,{className:"checkboxesContainer",children:[i.jsx(K.Checkbox,{className:"checkboxElement",label:V,icon:W,checkedicon:J,checked:M,onClick:()=>{S(!M)}}),i.jsx(K.Checkbox,{className:"checkboxElement",label:i.jsx(K.Typography,{tag:"span",className:F?"disabled":"",children:G}),checked:f,icon:W,checkedicon:J,disabled:F,onClick:()=>{v(!f)}})]}),i.jsx(R,{className:"listsContainer",children:e.map((m,b)=>i.jsxs(K.List,{children:[i.jsx(K.Typography,{className:"bold",tag:"span",children:m.title??m.endPoint}),i.jsx(R,{className:"listContainer",children:(()=>{var B,te,ne,j,q,ie,ge,ve;const k=(te=(B=u==null?void 0:u[b])==null?void 0:B.body)==null?void 0:te.features,N=(q=(j=(ne=u==null?void 0:u[b])==null?void 0:ne.body)==null?void 0:j.features)==null?void 0:q.length,A=(ge=(ie=u==null?void 0:u[b])==null?void 0:ie.body)==null?void 0:ge.message,D=(ve=u==null?void 0:u[b])==null?void 0:ve.status;return N?k.map((oe,fe)=>{var O,x,H,z,U;return i.jsx(K.ListItem,{className:P===oe?"mdc-ripple-upgraded--background-focused":"",onClick:()=>{var Q;r.camera.flyTo({destination:Ki(fn.fromDegrees(...qe(oe.geometry)))}),L(oe),(Q=m.callbackFunc)==null||Q.call(m,oe,m,fe)},children:i.jsxs(R,{className:"queryItemResult",children:[i.jsx(K.Tooltip,{content:(x=(O=oe==null?void 0:oe.properties)==null?void 0:O.names)==null?void 0:x.display,children:i.jsx(R,{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]})}),I(oe)]})},`feature-${fe}`)}):N===0?i.jsx(K.ListItemSecondaryText,{className:"generalListItem queryNoResults",children:X}):A?i.jsx(K.ListItemSecondaryText,{className:`generalListItem ${D===400?"queryWarning":"queryError"}`,children:A}):i.jsx(K.ListItemSecondaryText,{className:"generalListItem"})})()})]},`option-${b}`))})]})]})})},Ri=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(Qi,{options:e,isOpen:n,locale:t})})]})),eo={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"}},Ie=(e,t)=>eo[e][t],to=Ie("GLOBAL","DEFAULT_TERRAIN_PROVIDER_URL");Ie("GLOBAL","TERRAIN_SRTM100"),Ie("GLOBAL","TERRAIN_COMBINED"),Ie("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Ie("GLOBAL","BM-INFRARED_RASTER-WMS_LAYER"),Ie("GLOBAL","BM-RADAR_RASTER-WMS_LAYER"),Ie("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Ie("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Ie("GLOBAL","BM-VECTOR_TILES-XYZ_LAYER"),Ie("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Ie("GLOBAL","BM-WMTS_POPULATION_TILES-WMTS_LAYER");const wn=(e,t,n)=>{let r;if(e.scene.mode!==p.SceneMode.SCENE2D)r=e.scene.pickPosition(new p.Cartesian2(t,n));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new p.Cartesian2(t,n),s)}return p.Cartographic.fromCartesian(r)},no=(e,t,n)=>{const r=wn(e,t,n);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[p.Math.toDegrees(r.longitude),p.Math.toDegrees(r.latitude)]}}},Tn=(e,t,n)=>{try{const r=wn(e,t,n);return{longitude:p.Math.toDegrees(r.longitude),latitude:p.Math.toDegrees(r.latitude)}}catch{return}},rt=3,it="hasTransparency";function Tt(e,t,n,r,s){return setTimeout(()=>{var g;const o=(g=this.layerListInstance.find(f=>{var v,M;return((v=f._imageryProvider._resource)==null?void 0:v._url)===((M=this._resource)==null?void 0:M._url)}))==null?void 0:g.meta,d=$.get(o,it)===!0;this.tileTransparencyCheckedCounter<rt&&!d&&ji(s==null?void 0:s.url,this).then(f=>{var v;(v=this.mapViewer.layersManager)==null||v.addMetaToLayer({[it]:f},M=>M._imageryProvider._resource._url===this._resource._url)})},0),e(t,n,r,s)}class Ln extends p.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 bn extends p.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 Cn extends p.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 ro=1,io=-1,Sn="TRANSPARENT_BASE_LAYER";class oo{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 p.Event,this.dataLayerUpdated=new p.Event,this.layerManagerFootprintMetaFieldPath=s,this.shouldOptimizedTileRequests=o??!1,r&&this.addLayerUpdatedListener(r),this.shouldOptimizedTileRequests&&(this.addLayerUpdatedListener(d=>{const g=Object.keys(d);g.length===1&&g[0]===it&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())}),this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}))}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}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(Sn),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 p.UrlTemplateImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new bn(o,this.mapViewer):new p.WebMapServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMTS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Cn(o,this.mapViewer):new p.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 g=0;g<n;g++)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=no(this.mapViewer,t,n);return this.layers.filter(g=>!$.get(g.meta,"parentBasetMapId")).filter(g=>{const f=$.get(g.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?pr(s.geometry,{type:"Feature",properties:{},geometry:f})&&(r?g.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",g.meta),!1)}).sort((g,f)=>{var v,M;return((v=f.meta)==null?void 0:v.zIndex)-((M=g.meta)==null?void 0:M.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const t=this.mapViewer.imageryLayers.addImageryProvider(new p.SingleTileImageryProvider({url:window.location.origin+window.location.pathname+"/assets/img/transparent-tile.png",rectangle:new p.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);t.meta={id:Sn,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){this.shouldOptimizedTileRequests=t}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?ro:io,o=n<r?n:r,d=n<r?r:n;this.layers.forEach(g=>{var v;if(!$.get(g.meta,"parentBasetMapId")){const M=(v=g.meta)==null?void 0:v.zIndex;g.meta.zIndex=M>=o&&M<=d&&M!==n?M+s:M===n?r:M}})}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)&&p.Rectangle.intersection(r,o.rectangle);for(let g=this.layers.length-1;g>=s;g--){if(((t=o.meta)==null?void 0:t.skipRelevancyCheck)===!0){o.meta={...o.meta,relevantToExtent:!0};continue}const f=this.layers[g],v=((n=f.meta)==null?void 0:n[it])===!0;if(o!==f)if(d instanceof p.Rectangle){if(nt(r,o.rectangle))if(nt(r,f.rectangle)&&!v){o.meta={...o.meta??{},relevantToExtent:!1};break}else o.meta={...o.meta??{},relevantToExtent:!0};if(nt(r,f.rectangle)&&!v){o.meta={...o.meta??{},relevantToExtent:!1};break}if(nt(o.rectangle,f.rectangle)){if(o.meta={...o.meta??{},relevantToExtent:v},!v)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 p.Rectangle})}}}catch(r){console.error(r)}}}const Ps="",so=({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 v=i.jsx(R,{className:"layerNameContainer",children:i.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:n})});return(n??"").length>15?i.jsx(K.Tooltip,{content:n,children:v}):v},[n]),g=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(R,{className:"mapLegend",children:[d(),i.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:o}),i.jsx(R,{className:"legendActionsContainer",children:g()})]})},ao=({legends:e,actionsTexts:{docText:t,imgText:n},noLegendsText:r})=>{const s=a.useCallback(()=>i.jsx(R,{className:"noLegendsContainer",children:i.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),o=a.useCallback(()=>e.length?e.map((d,g)=>i.jsx(so,{legend:d,docText:t,imgText:n},`${d.layer}_${g}`)):s(),[e]);return i.jsx(R,{className:"mapLegendsList",children:o()})},lo=({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(K.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[i.jsx(K.DrawerHeader,{className:"sidebarHeaderContainer",children:i.jsx(K.DrawerTitle,{className:"sidebarTitle",children:n})}),i.jsxs(K.DrawerContent,{className:"sidebarContent",children:[i.jsx(K.Icon,{onClick:t,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),i.jsx(ao,{noLegendsText:r,legends:o,actionsTexts:s})]})]}):null,co=({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"})]})})}),As="",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(fr,{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},Os="",_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)}},p.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 g=new pn(d.longitude,d.latitude);if(n.current){let f="";switch(e.projection){case Ce.WEB_MERCATOR:{const M=new p.WebMercatorProjection(o).project(g);f=`Mercator: ${M.y.toFixed(Qe)}m, ${M.x.toFixed(Qe)}m`,n.current.style.width="220px";break}case Ce.WGS84:{const v=g.longitude.toFixed(Ke);f=`WGS84: ${g.latitude.toFixed(Ke)}°N ${v}°E`,n.current.style.width="200px";break}}n.current.innerHTML=f}}}},[r,n,t,e.projection]),i.jsx("div",{className:"coordinatesTracker",ref:n})},uo=".cesium-viewer-cesiumInspectorWrapper",ho=e=>{e.style.display="",e.style.top="0",e.style.position="relative"},In=()=>{const e=pe();return a.useEffect(()=>{var s;const t=e,n=document.querySelector(uo);t.cesiumInspector===void 0&&e.extend(p.viewerCesiumInspectorMixin);const r=(s=t.cesiumInspector)==null?void 0:s.container;return r&&(n&&r.parentElement!==n&&n.appendChild(r),ho(r)),()=>{r&&(r.style.display="none")}},[e]),i.jsx(R,{className:"cesium-viewer-cesiumInspectorWrapper"})},Ds="",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],go=(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},g=new p.EllipsoidGeodesic,f=new Date().getTime();if(f<d.lastLegendUpdate+250)return;d.lastLegendUpdate=f;const v=e.scene.canvas.clientWidth,M=e.scene.canvas.clientHeight,S=e.scene.camera.getPickRay(new p.Cartesian2(v/2|0,M-1)),u=e.scene.camera.getPickRay(new p.Cartesian2(1+v/2|0,M-1)),E=e.scene.globe,P=E.pick(S,e.scene),L=E.pick(u,e.scene);if(!P||!L)return;const V=E.ellipsoid.cartesianToCartographic(P),G=E.ellipsoid.cartesianToCartographic(L);g.setEndPoints(V,G);const Y=g.surfaceDistance,X=100;let F;for(let Z=Lt.length-1;!$.isNumber(F)&&Z>=0;--Z)Lt[Z]/Y<X&&(F=Lt[Z]);if($.isNumber(F)){let Z="";F>=1e3?Z=`${(F/1e3).toString()} ${o}`:Z=`${F.toString()} ${s}`,d.barWidth=F/Y|0,d.distanceLabel=Z}n(d)},Pn=e=>{const t=pe(),[n,r]=a.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});a.useEffect(()=>{const o=f=>{go(t,n,r,e.locale)},d=new p.EventHelper,g=f=>{t.scene.globe.tilesLoaded&&(o(new MouseEvent("mouse")),d.removeAll())};return d.add(t.scene.globe.tileLoadProgressEvent,g),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`}})]})})},ks="",An=()=>{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(K.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))})},xs="",On=(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 g=0;g<=19;g++)if(r.getLevelMaximumGeometricError(g)*o/(e*d)<s.maximumScreenSpaceError)return g;return null},po=(e,t)=>{e=e||10;const n=[];let r=1e5,s=0;for(let o=1e8;o>r;o=o-r){const d=On(o,t);if(d===null)break;if(d!==s){let g=o,f=o+r;for(;f-g>e;)o=g+(f-g)/2,On(o,t)===d?g=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=xe(),[s,o]=a.useState(1),d=po(1,n),g=a.useCallback(()=>{const S=n.camera,u=.5;let E=0;switch(n.scene.mode){case tt.SCENE3D:E=n.scene.mapProjection.ellipsoid.cartesianToCartographic(S.positionWC).height;break;case tt.SCENE2D:E=(S.frustum.right-S.frustum.left)*u;break;case tt.COLUMBUS_VIEW:E=S.position.z;break;default:E=0;break}if(d.length>0){const P=d.reduce((L,V)=>Math.abs(V.height-E)<Math.abs(L.height-E)?V:L);o(P.level),r.setViewState&&r.setViewState(L=>({...L,currentZoomLevel:P.level}))}},[n,d]),f=a.useCallback(()=>{let S=0;n.scene.globe._surface.forEachRenderedTile(function(u){S=Math.max(S,u.level)}),o(S),r.setViewState&&r.setViewState(u=>({...u,currentZoomLevel:S}))},[n]),M=a.useMemo(()=>({CALCULATION:g,RENDERED_TILES:f}),[g,f])[t];return a.useEffect(()=>{const S=n.scene.globe.tileLoadProgressEvent.addEventListener(function(){n.scene.globe.tilesLoaded&&M()});return n.camera.moveEnd.addEventListener(M),()=>{try{typeof $.get(n,"_cesiumWidget")<"u"&&(n.camera.moveEnd.removeEventListener(M),S())}catch(u){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',u)}}},[n,M]),i.jsxs("div",{className:"zoomLevel",children:[i.jsx("div",{className:"zoomLevelValue",children:s}),i.jsx("div",{className:"zoomLevelLabel",children:$.get(e,"ZOOM_LABEL")??"zoom"})]})},Ns="",kn=2,xn=212,Nn=260,fo=0;class mo extends p.Viewer{constructor(n,r){super(n,r);ue(this,"layersManager")}}const bt=a.createContext(null),yo=bt.Provider,pe=()=>{const e=a.useContext(bt);if(e===null)throw new Error("map context is null, please check the provider");return e.mapViewer},xe=()=>{const{mapViewer:e,...t}=a.useContext(bt);if(t===null)throw new Error("map context viewstate is null, please check the provider");return t},vo=e=>{var me,ye,Pe,Ve,We,Yn,Zn,Xn;const t=a.useRef(null),[n,r]=a.useState(),[s,o]=a.useState(),[d,g]=a.useState(),[f,v]=a.useState(),[M,S]=a.useState(),[u,E]=a.useState(),[P,L]=a.useState(),[V,G]=a.useState(),[Y,X]=a.useState(),[F,Z]=a.useState(),[W,J]=a.useState(!1),[ee,l]=a.useState(!1),c=a.useRef(),[C,y]=a.useState([]),[w,T]=a.useState(),[I,m]=a.useState(),[b,k]=a.useState(!1),N=a.useRef(),[A,D]=a.useState(void 0),[B,te]=a.useState(!1),[ne,j]=a.useState(),[q,ie]=a.useState(),ge=K.useTheme(),ve=zt(ge),oe=a.useMemo(()=>W||ee,[W,ee]);a.useEffect(()=>{ie({currentZoomLevel:-1,shouldOptimizedTileRequests:!1,showCesiumInspector:!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},O=(se,de,le,Ee,Se)=>{const Oe=n.container,Ae=Oe.clientWidth,ze=Oe.clientHeight,Jn=Ee+Se;return{left:`${Ae-se<le?se-(le-(Ae-se)):se}px`,top:`${ze-de<Jn?de-(Jn-(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),D(le),j(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 oo(n,(se=e.legends)==null?void 0:se.mapLegendsExtractor,()=>{var le;y((le=n.layersManager)==null?void 0:le.legendsList)},e.layerManagerFootprintMetaFieldPath,q==null?void 0:q.shouldOptimizedTileRequests)}),viewState:q,setViewState:ie}},[e.legends,e.layerManagerFootprintMetaFieldPath,n,q]);a.useEffect(()=>{var de,le;T(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(()=>{n!=null&&n.layersManager&&n.layersManager.setShouldOptimizedTileRequests((q==null?void 0:q.shouldOptimizedTileRequests)??!1)},[q==null?void 0:q.shouldOptimizedTileRequests,n]),a.useEffect(()=>{const se=e.terrains||(n&&n.terrainProvider?[{id:"1",url:to,title:"Default Terrain",thumbnail:"Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png",isCurrent:!0,terrainProvider:n.terrainProvider}]:void 0);m(se)},[e.terrains,n]),a.useEffect(()=>{g(e.projection??Ce.WGS84)},[e.projection]),a.useEffect(()=>{o(e.locale)},[e.locale]),a.useEffect(()=>{v(e.showMousePosition??!0)},[e.showMousePosition]),a.useEffect(()=>{S(e.showZoomLevel??!0)},[e.showZoomLevel]),a.useEffect(()=>{E(e.showScale??!0)},[e.showScale]),a.useEffect(()=>{L(e.showCompass??!0)},[e.showCompass]),a.useEffect(()=>{Z(e.showLoadingProgress??!0)},[e.showLoadingProgress]),a.useEffect(()=>{X(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===p.SceneMode.SCENE3D){const Ee=new p.Cartesian2(n.container.clientWidth/kn,n.container.clientHeight/kn),Se=n.scene.camera.getPickRay(Ee),Oe=n.scene.globe.pick(Se,n.scene);if(!Oe)return{longitude:0,latitude:0,height:0};const Ae=n.scene.globe.ellipsoid.cartesianToCartographic(Oe);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!==p.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}}),F&&(n.scene.globe.tileLoadProgressEvent.addEventListener(function(){n.scene.globe.tilesLoaded?J(!1):J(!0)}),(de=n.layersManager)==null||de.addDataLayerUpdatedListener(()=>{var Ee;let le=!1;(Ee=n.layersManager)==null||Ee.dataLayerList.forEach(Se=>{if(typeof Se.meta.items=="number"&&typeof Se.meta.total=="number"&&Se.meta.items>0&&Se.meta.items<Se.meta.total){le=!0;return}}),l(le)})))},[n]),a.useEffect(()=>{const se=()=>{if(n&&c.current){const de=c.current;n.camera.flyTo({destination:p.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],Se=pi(se);n.camera.flyTo({destination:p.Cartesian3.fromDegrees(le,Ee,Se),duration:0});const Oe=n.homeButton.viewModel.command,Ae=function(ze){n.camera.flyTo({destination:p.Cartesian3.fromDegrees(le,Ee,Se),duration:1}),ze.cancel=!0};return Oe.beforeExecute.addEventListener(Ae),()=>{Oe.beforeExecute.removeEventListener(Ae);try{Oe.beforeExecute.removeEventListener(Ae)}catch{console.error("customHomeButtonHandler event not cleaned")}}}},[e.zoom,e.center,n]),a.useEffect(()=>{G(e.showZoomButtons??!0)},[e.showZoomButtons]);const z=()=>{te(se=>!se)},U=a.useCallback(()=>n&&ut.createPortal(i.jsxs(i.Fragment,{children:[F&&oe&&i.jsx(K.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),P&&i.jsx(Mn,{locale:s}),i.jsxs(R,{className:"bottomToolsContainer",children:[f&&i.jsx(_n,{projection:d}),M&&i.jsx(Dn,{locale:s,valueBy:"RENDERED_TILES"}),u&&i.jsx(Pn,{locale:s})]}),V&&i.jsx(An,{})]}),document.querySelector(".cesium-viewer")),[n,s,d,f,u,oe]),Q=a.useCallback(()=>n&&ut.createPortal(i.jsxs(i.Fragment,{children:[e.geocoderPanel&&i.jsx(Ri,{options:[...e.geocoderPanel],locale:s}),i.jsx(Ti,{baseMaps:w,terrains:I,locale:s}),e.showDebuggerTool&&i.jsx(bi,{locale:s}),i.jsx(co,{legendToggle:z})]}),document.querySelector(".cesium-viewer-toolbar")),[n,s,w,I]),ce=a.useCallback(()=>n&&ut.createPortal(i.jsxs(R,{className:"cesium-viewer-cesiumInspectorContainer widgetsContainer",children:[Y&&i.jsx(vi,{locale:s}),(q==null?void 0:q.showCesiumInspector)&&i.jsx(In,{})]}),document.querySelector(".cesium-widget")),[n,s,q==null?void 0:q.showCesiumInspector]);return i.jsx(K.ThemeProvider,{id:"cesiumTheme",options:ve,children:i.jsx(Me.Viewer,{className:"viewer",full:!0,ref:t,...fe,children:i.jsxs(yo,{value:H,children:[i.jsx(lo,{title:(me=e.legends)==null?void 0:me.title,isOpen:B,toggleSidebar:z,noLegendsText:(ye=e.legends)==null?void 0:ye.emptyText,legends:((Pe=e.legends)==null?void 0:Pe.legendsList)??C,actionsTexts:(Ve=e.legends)==null?void 0:Ve.actionsTexts}),e.children,U(),Q(),ce(),e.imageryContextMenu&&b&&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:O(A.x,A.y,((Yn=e.imageryContextMenuSize)==null?void 0:Yn.width)??Nn,((Zn=e.imageryContextMenuSize)==null?void 0:Zn.height)??xn,((Xn=e.imageryContextMenuSize)==null?void 0:Xn.dynamicHeightIncrement)??fo),size:e.imageryContextMenuSize??{height:xn,width:Nn},handleClose:()=>{k(!b)},contextEvt:N.current})]})})})},Eo=0,wo=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=p.Cartographic.fromCartesian(n.boundingSphere.center),o=e.heightFromGround??Eo;if(o){const d=p.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),g=p.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+o),f=p.Cartesian3.subtract(g,d,new p.Cartesian3);n.modelMatrix=p.Matrix4.fromTranslation(f)}}})},ot=180,Bn=.001,Fn=e=>Math.abs(e)/e,Vn=e=>{ot-Math.abs(e[0])<Bn&&(e[0]=Fn(e[0])*(ot-1)),ot/2-Math.abs(e[1])<Bn&&(e[1]=Fn(e[1])*(ot/2-1))},Gn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(t=>{Vn(t)});break;case"Polygon":e.coordinates.forEach(t=>{t.forEach(n=>{Vn(n)})});break}},To=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})},Lo=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=xe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new bn(t,r):new p.WebMapServiceImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},bo=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=xe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new Cn(t,r):new p.WebMapTileServiceImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},Co=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=xe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new Ln(t,r):new p.UrlTemplateImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},So=e=>{const{options:t,...n}=e;return i.jsx(He,{...n,imageryProvider:new p.OpenStreetMapImageryProvider(t)})},Mo=e=>{const{options:t,meta:n,visualizationHandler:r,withGeometryValidation:s=!1}=e,{url:o,featureType:d,style:g,pageSize:f,zoomLevel:v,maxCacheSize:M,keyField:S,labeling:u}=t,{color:E,hover:P}=g,L=pe(),V=xe(),G=a.useRef(V.viewState),Y=a.useRef(new Map),X=a.useRef(new Set),F=a.useRef(0),[Z,W]=a.useState(n),J=a.useMemo(()=>p.Color.fromCssColorString(P??"#24AEE9").withAlpha(.5),[P]),ee=a.useMemo(()=>`wfs_${d}_${Bt.v4()}`,[d]),l=a.useRef(!1);a.useEffect(()=>{G.current=V.viewState},[V.viewState]);const c=new p.GeoJsonDataSource(ee),C=O=>{const x=[],H=n.featureStructure;if(H&&H.fields)for(const U of H.fields){const{fieldName:Q,aliasFieldName:ce}=U,me=ce,ye=O[Q]??"N/A",Pe=Math.max(100,Math.min(180,me.length*10)),Ve="260px";x.push(`
7
7
  <tr>
8
- <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${Ie}px; display: table-cell;">
8
+ <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${Pe}px; display: table-cell;">
9
9
  <strong>${me}:</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: ${Ve}; display: table-cell;" title="${ye}">
12
12
  ${ye}
13
13
  </td>
14
14
  </tr>
@@ -18,17 +18,17 @@
18
18
  ${x.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
+ `},y=O=>O?O.polyline?"polyline":"polygon":"",w=O=>{var z,U;const x=(U=(z=O==null?void 0:O.polygon)==null?void 0:z.hierarchy)==null?void 0:U.getValue(p.JulianDate.now());if(!x)return null;const H=x.positions;return p.BoundingSphere.fromPoints(H).center},T=O=>{const H=L.scene.drillPick(O).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 Q=w(U);if(!Q)return{entity:U,distance:Number.MAX_VALUE};const ce=p.SceneTransforms.wgs84ToWindowCoordinates(L.scene,Q);if(!ce)return{entity:U,distance:Number.MAX_VALUE};const me=O.x-ce.x,ye=O.y-ce.y,Pe=Math.sqrt(me*me+ye*ye);return{entity:U,distance:Pe}});return z.sort((U,Q)=>Q.distance-U.distance),z[0].entity},I=O=>{let x=null,H=null;O.setInputAction(z=>{if(L.scene.mode===p.SceneMode.SCENE2D){const Q=L.scene.pick(z.endPosition);Q&&Q.id&&(Q.id.polygon||Q.id.polyline)?$.get(x,"id")!==$.get(Q.id,"id")&&(x&&(x[y(x)].material=H,L.container.style.cursor="default"),x=Q.id,H=x[y(x)].material,x[y(x)].material=J,L.container.style.cursor="pointer"):x&&(x[y(x)].material=H,x=null,L.container.style.cursor="default")}else{const Q=T(z.endPosition);Q?$.get(x,"id")!==$.get(Q,"id")&&(x&&(x[y(x)].material=H,L.container.style.cursor="default"),x=Q,H=x[y(x)].material,x[y(x)].material=J,L.container.style.cursor="pointer"):x&&(x[y(x)].material=H,x=null,L.container.style.cursor="default")}},p.ScreenSpaceEventType.MOUSE_MOVE)},m=(O,x)=>{const H=navigator.hardwareConcurrency||4;let z=Math.ceil(H*1.5);return x==="cpu"&&(z=Math.max(2,Math.ceil(H/2))),O>=M?Math.min(200,z*4):O>1e3?Math.min(100,z*2):O>300?Math.min(50,z):Math.min(10,z)},b=(O=-1,x=-1)=>{W(H=>({...H,...n,cache:X.current.size,items:O,total:x,currentZoomLevel:G.current.currentZoomLevel}))},k=()=>{if(c.entities&&c.entities.values.length>0){c.show=!1,F.current=0;const O=L.dataSources.getByName(`${u==null?void 0:u.dataSourcePrefix}${c.name}`)[0];O&&(O.show=!1,L.dataSources.remove(O))}b(0,0)},N=async(O,x="GET",H)=>{const z={method:x};H!==void 0&&(z.body=H);const U=await fetch(O,z);if(U.status===200)return await U.json()},A=document.createElement("canvas"),D=A.getContext("2d"),B=O=>{const x={fontName:"sans-serif",fontSize:14,padding:4,fillStyle:"white",strokeStyle:"black",lineWidth:3},H=O.split(`
22
+ `),z=(u==null?void 0:u.fontSize)??x.fontSize,U=(u==null?void 0:u.padding)??x.padding,Q=z+2;D.clearRect(0,0,A.width,A.height),D.font=`${z}px ${(u==null?void 0:u.fontName)??x.fontName}`;const ce=Math.max(...H.map(Pe=>D.measureText(Pe).width)),me=document.createElement("canvas");me.width=ce+U*2,me.height=Q*H.length+U*2;const ye=me.getContext("2d");return ye.font=`${z}px ${(u==null?void 0:u.fontName)??x.fontName}`,ye.fillStyle=(u==null?void 0:u.fillStyle)??x.fillStyle,ye.strokeStyle=(u==null?void 0:u.strokeStyle)??x.strokeStyle,ye.lineWidth=(u==null?void 0:u.lineWidth)??x.lineWidth,H.forEach((Pe,Ve)=>{const We=U+(Ve+1)*Q-4;ye.strokeText(Pe,U,We),ye.fillText(Pe,U,We)}),{dataURL:me.toDataURL(),width:me.width,height:me.height}},te=O=>u==null?void 0:u.text.pattern.replace(/\$\{([^}]+)\}/g,(H,z)=>{const U=u.text.fields.find(ce=>ce.name===z);let Q="";if(U)if(U.predicate)Q=U.predicate(O.properties[z]);else switch(U.type){case"date":Q=Le.format(new Date(O.properties[z]),U.format??"dd/MM/yyyy");break;default:Q=O.properties[z];break}return Q}),ne=async(O,x)=>{const H=[];return O.length>0&&await ht(O,z=>{if(z.properties){const U=z.properties[S??"id"];let Q=!0;if(s)try{Q=mr(z.geometry),Q||console.error("Skipped invalid WFS feature with",S??"id","->",U)}catch{Q=!1,console.error("Skipped invalid WFS feature with",S??"id","->",U)}if(!X.current.has(U)&&Q){X.current.add(U),z.properties.fetch_id=x;const ce=z.properties.description;if(z.properties.description=void 0,z.properties._description=ce,u){const me=B(te(z));z.properties.label=me}H.push(z)}}},{concurrency:m(O.length,"cpu")}),H},j=(O,x)=>Array.from(Y.current.values()).filter(H=>JSON.stringify(H.parentBBox)!==JSON.stringify(O)).reduce((H,z)=>{const U=Yi(x,z.bbox);return U>H.distance?{id:z.id,key:z.bbox.join(","),distance:U}:H},{id:"",key:"",distance:-1/0}),q=async O=>{const x=[];await ht(c.entities.values,H=>{if(H.properties&&H.properties.fetch_id.getValue()===O){const z=H.properties[S??"id"].getValue();X.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(O,x)=>{for(;X.current.size>M;){const H=j(O,x);if(H.id==="")break;await q(H.id),H.key&&Y.current.delete(H.key)}},ge=async(O,x,H,z)=>{let U="",Q="",ce=[];if(O.numberReturned&&O.numberReturned!==0&&(O.bbox&&(Q=O.bbox.join(","),Y.current.has(Q)||(U=Bt.v4())),ce=await ne(O.features,U),O.bbox&&ce.length>0&&!Y.current.has(Q)&&Y.current.set(Q,{id:U,parentBBox:x,bbox:O.bbox,timestamp:O.timeStamp,items:ce.length})),b(O.numberReturned!==0?H+O.numberReturned:O.numberMatched,O.numberMatched),ce.length===0){O.numberReturned&&O.numberReturned!==0?ve(++F.current*f):(F.current=0,fe(L,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:C}),L.scene.requestRender(),fe(L,c,ce.map(ye=>ye.id),x),O.numberReturned&&O.numberReturned!==0?ve(++F.current*f):F.current=0},ve=a.useCallback(async(O=0)=>{if(!L||L.scene.mode===p.SceneMode.MORPHING)return;const x=Xi(L);if(x){if(await oe(),G.current.currentZoomLevel>0&&G.current.currentZoomLevel<v&&(c==null?void 0:c.entities.values.length)>0){k();return}if(G.current.currentZoomLevel>=v){c.show=!0;const H=yn(x),z=Zi(x);try{const U=o.includes("?")?"&":"?";let Q=`${o}${U}service=WFS&version=2.0.0&request=GetFeature&typeNames=${d}&outputFormat=application/json&bbox=${H.join(",")},EPSG:4326&startIndex=${O}&count=${f}`;S&&(Q+=`&sortBy=${S}%20ASC`);const ce=await N(Q);await ge(ce,H,O,z)}catch(U){console.error("Error fetching WFS data:",U),b(-1,-1)}}}},[]),oe=()=>new Promise(O=>{const x=setInterval(()=>{L.scene.globe.tilesLoaded&&(clearInterval(x),O())},100)}),fe=(O,x,H,z)=>{r?r(O,x,H,z):En(O,x,H,E,z,u)};return a.useEffect(()=>{const O=L.dataSources.getByName(ee)[0];O&&fe(L,O,[],void 0)},[L.scene.mode]),a.useEffect(()=>{L.layersManager&&L.layersManager.dataLayerList.length>0&&L.layersManager.findDataLayerById(n.id)!==void 0&&L.layersManager.addMetaToDataLayer(Z)},[Z]),a.useEffect(()=>{var O;(O=L.layersManager)==null||O.addDataLayer({options:t,meta:{...Z},visualizationHandler:r})},[L.layersManager]),a.useEffect(()=>{L.dataSources.add(c);const O=()=>{ve()};L.scene.camera.moveEnd.addEventListener(O);const x=new p.ScreenSpaceEventHandler(L.scene.canvas);return I(x),G.current.currentZoomLevel>0&&(ve(),l.current=!0),()=>{var H;$.get(L,"_cesiumWidget")!==void 0&&(X.current.clear(),Y.current.clear(),L.dataSources.remove(L.dataSources.getByName(`${u==null?void 0:u.dataSourcePrefix}${c.name}`)[0]),L.dataSources.remove(c,!0),(H=L.layersManager)==null||H.removeDataLayer(n.id),L.scene.camera.moveEnd.removeEventListener(O),x.removeInputAction(p.ScreenSpaceEventType.MOUSE_MOVE))}},[]),null},Hn=e=>i.jsx(Me.Entity,{...e}),_o=e=>i.jsx(Me.EntityDescription,{...e}),Wn=e=>i.jsx(Me.EntityDescription,{...e}),zn=e=>i.jsx(Me.PolygonGraphics,{...e}),Un=e=>i.jsx(Me.RectangleGraphics,{...e}),$n=e=>i.jsx(Me.CustomDataSource,{...e}),Io=e=>i.jsx(Me.PolylineGraphics,{...e}),Bs="";var Ne=function(){var e=_.Ellipsoid.WGS84,t,n=_.Material.fromType(_.Material.ColorType);function r(l,c=new _.Color(1,1,0,.5),C=new _.Color(1,1,1,1)){this._scene=l.scene,n.uniforms.color=c,t=C,this._tooltip={setVisible:()=>{},showAt:()=>{}},this._surfaces=[],this.initialiseHandlers(),this.enhancePrimitives()}r.prototype.initialiseHandlers=function(){var l=this._scene,c=this,C=new _.ScreenSpaceEventHandler(l.canvas);function y(T,I){if(c._handlersMuted!=!0){var m=l.pick(I);m&&m.primitive&&m.primitive[T]&&m.primitive[T](I)}}C.setInputAction(function(T){y("leftClick",T.position)},_.ScreenSpaceEventType.LEFT_CLICK),C.setInputAction(function(T){y("leftDoubleClick",T.position)},_.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);var w;C.setInputAction(function(T){if(c._handlersMuted!=!0){var I=l.pick(T.endPosition);w&&(!I||w!=I.primitive)&&(!(w.isDestroyed&&w.isDestroyed())&&w.mouseOut(T.endPosition),w=null),I&&I.primitive&&(I=I.primitive,I.mouseOut&&(w=I),I.mouseMove&&I.mouseMove(T.endPosition))}},_.ScreenSpaceEventType.MOUSE_MOVE),C.setInputAction(function(T){y("leftUp",T.position)},_.ScreenSpaceEventType.LEFT_UP),C.setInputAction(function(T){y("leftDown",T.position)},_.ScreenSpaceEventType.LEFT_DOWN)},r.prototype.setListener=function(l,c,C){l[c]=C},r.prototype.muteHandlers=function(l){this._handlersMuted=l},r.prototype.registerEditableShape=function(l){var c=this;J(l,"mouseMove",function(C){l.setHighlighted(!0),l._editMode||c._tooltip.showAt(C,"Click to edit this shape")}),J(l,"mouseOut",function(C){l.setHighlighted(!1),c._tooltip.setVisible(!1)}),J(l,"leftClick",function(C){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:_.Ellipsoid.WGS84,textureRotationAngle:0,height:0,asynchronous:!0,show:!0,debugShowBoundingVolume:!1},o=W(s,{appearance:new _.EllipsoidSurfaceAppearance({aboveGround:!1}),material:n,granularity:Math.PI/180}),d=W(s,{}),g=W(s,{}),f=W(s,{}),v=W(o,{rotation:0}),M=W(s,{width:5,geodesic:!0,granularity:1e4,appearance:new _.PolylineMaterialAppearance({aboveGround:!1}),material:n}),S=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,C){this[c]=C,this._createPrimitive=!0},l.prototype.getAttribute=function(c){return this[c]},l.prototype.update=function(c,C,y){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 w=this.getGeometry();if(!w)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:w,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 T=this._primitive;T.appearance.material=this.material,T.debugShowBoundingVolume=this.debugShowBoundingVolume,T.update(c,C,y),this._outlinePolygon&&this._outlinePolygon.update(c,C,y)}},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,C){(!this.strokeColor||!this.strokeColor.equals(c)||this.strokeWidth!=C)&&(this._createPrimitive=!0,this.strokeColor=c,this.strokeWidth=C)},l}();r.ExtentPrimitive=function(){function l(c){if(!_.defined(c.extent))throw new _.DeveloperError("Extent is required");c=W(c,o),this.initialiseOptions(c),this.setExtent(c.extent)}return l.prototype=new S,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}(),r.PolygonPrimitive=function(){function l(c){c=W(c,o),this.initialiseOptions(c),this.isPolygon=!0}return l.prototype=new S,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}(),r.CirclePrimitive=function(){function l(c){if(!(_.defined(c.center)&&_.defined(c.radius)))throw new _.DeveloperError("Center and radius are required");c=W(c,o),this.initialiseOptions(c),this.setRadius(c.radius)}return l.prototype=new S,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}(),r.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=W(c,v),this.initialiseOptions(c)}return l.prototype=new S,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}(),r.PolylinePrimitive=function(){function l(c){c=W(c,M),this.initialiseOptions(c)}return l.prototype=new S,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 u={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},E={iconUrl:"./assets/img/dragIcon.png",shiftX:0,shiftY:0},P={iconUrl:"./assets/img/dragIconLight.png",shiftX:0,shiftY:0};r.prototype.createBillboardGroup=function(l,c,C){var y=new r.BillboardGroup(this,c);return y.addBillboards(l,C),y},r.BillboardGroup=function(l,c){this._drawHelper=l,this._scene=l._scene,this._options=W(c,u);var C=new _.BillboardCollection;this._scene.primitives.add(C),this._billboards=C,this._orderedBillboards=[]},r.BillboardGroup.prototype.createBillboard=function(l,c){var C=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 T=function(m){w.enableRotate=m},I=function(){for(var m=0,b=y._orderedBillboards.length;m<b&&y._orderedBillboards[m]!=C;++m);return m};var y=this,w=this._scene.screenSpaceCameraController;if(c.dragHandlers){var y=this;J(C,"leftDown",function(b){function k(D){C.position=D;for(var B=0,te=y._orderedBillboards.length;B<te&&y._orderedBillboards[B]!=C;++B);c.dragHandlers.onDrag&&c.dragHandlers.onDrag(I(),D)}function N(D){A.destroy(),T(!0),c.dragHandlers.onDragEnd&&c.dragHandlers.onDragEnd(I(),D)}var A=new _.ScreenSpaceEventHandler(y._scene.canvas);A.setInputAction(function(D){var B=y._scene.camera.pickEllipsoid(D.endPosition,e);B?k(B):N(B)},_.ScreenSpaceEventType.MOUSE_MOVE),A.setInputAction(function(D){N(y._scene.camera.pickEllipsoid(D.position,e))},_.ScreenSpaceEventType.LEFT_UP),T(!1),c.dragHandlers.onDragStart&&c.dragHandlers.onDragStart(I(),y._scene.camera.pickEllipsoid(b,e))})}c.onDoubleClick&&J(C,"leftDoubleClick",function(m){c.onDoubleClick(I())}),c.onClick&&J(C,"leftClick",function(m){c.onClick(I())}),c.tooltip&&(J(C,"mouseMove",function(m){y._drawHelper._tooltip.showAt(m,c.tooltip())}),J(C,"mouseOut",function(m){y._drawHelper._tooltip.setVisible(!1)}))}return C},r.BillboardGroup.prototype.insertBillboard=function(l,c,C){this._orderedBillboards.splice(l,0,this.createBillboard(c,C))},r.BillboardGroup.prototype.addBillboard=function(l,c){this._orderedBillboards.push(this.createBillboard(l,c))},r.BillboardGroup.prototype.addBillboards=function(l,c){for(var C=0;C<l.length;C++)this.addBillboard(l[C],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,u);this.startDrawing(function(){T.remove(),I.destroy(),w.setVisible(!1)});var C=this,y=this._scene;y.primitives;var w=this._tooltip,T=new r.BillboardGroup(this,c),I=new _.ScreenSpaceEventHandler(y.canvas);I.setInputAction(function(m){if(m.position!=null){var b=y.camera.pickEllipsoid(m.position,e);b&&(T.addBillboard(b),C.stopDrawing(),c.callback(b))}},_.ScreenSpaceEventType.LEFT_CLICK),I.setInputAction(function(m){var b=m.endPosition;if(b!=null){var k=y.camera.pickEllipsoid(b,e);k?w.showAt(b,"<p>Click to add your marker. Position is: </p>"+X(e.cartesianToCartographic(k))):w.showAt(b,"<p>Click on the globe to add your marker.</p>")}},_.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,M);this.startDrawingPolyshape(!1,c)},r.prototype.startDrawingPolyshape=function(l,c){this.startDrawing(function(){w.remove(m),k.remove(),N.destroy(),T.setVisible(!1),G(y)});var C=this,y=this._scene,w=y.primitives,T=this._tooltip,I=l?3:2,m;l?m=new Ne.PolygonPrimitive(c):m=new Ne.PolylinePrimitive(c),m.asynchronous=!1,w.add(m);var b=[],k=new r.BillboardGroup(this,u),N=new _.ScreenSpaceEventHandler(y.canvas);V(y),N.setInputAction(function(A){if(A.position!=null){var D=y.camera.pickEllipsoid(A.position,e);D&&(b.length==0&&(b.push(D.clone()),k.addBillboard(b[0])),b.length>=I&&(m.positions=b,m._createPrimitive=!0),b.push(D),k.addBillboard(D))}},_.ScreenSpaceEventType.LEFT_CLICK),N.setInputAction(function(A){var D=A.endPosition;if(D!=null)if(b.length==0)T.showAt(D,"<p>Click to add first point</p>");else{var B=y.camera.pickEllipsoid(D,e);B&&(b.pop(),B.y+=1+Math.random(),b.push(B),b.length>=I&&(m.positions=b,m._createPrimitive=!0),k.getBillboard(b.length-1).position=B,T.showAt(D,"<p>Click to add new point ("+b.length+")</p>"+(b.length>I?"<p>Double click to finish drawing</p>":"")))}},_.ScreenSpaceEventType.MOUSE_MOVE),N.setInputAction(function(A){var D=A.position;if(D!=null){if(b.length<I+2)return;var B=y.camera.pickEllipsoid(D,e);B&&(G(y),C.stopDrawing(),typeof c.callback=="function"&&(b.length-1,c.callback(b)))}},_.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)};function L(l){return e.cartographicArrayToCartesianArray([_.Rectangle.northwest(l),_.Rectangle.northeast(l),_.Rectangle.southeast(l),_.Rectangle.southwest(l)])}function V(l){l&&(l.canvas.style.cursor="crosshair")}function G(l){l&&(l.canvas.style.cursor="")}r.prototype.startDrawingExtent=function(c){var c=W(c,o);this.startDrawing(function(){m!=null&&w.remove(m),b!=null&&b.remove(),k.destroy(),T.setVisible(!1),G(y)});var C=this,y=this._scene,w=this._scene.primitives,T=this._tooltip,I=null,m=null,b=null,k=new _.ScreenSpaceEventHandler(y.canvas);V(y);function N(A){m==null&&(m=new Ne.ExtentPrimitive({extent:A,material:c.material}),m.asynchronous=!1,w.add(m)),m.setExtent(A);var D=L(A);b==null?(b=new r.BillboardGroup(C,u),b.addBillboards(D)):b.updateBillboardsPositions(D)}k.setInputAction(function(A){if(A.position!=null){var D=y.camera.pickEllipsoid(A.position,e);if(D)if(m==null){I=e.cartesianToCartographic(D);var B=Y(I,I);N(B)}else C.stopDrawing(),typeof c.callback=="function"&&c.callback(Y(I,e.cartesianToCartographic(D)))}},_.ScreenSpaceEventType.LEFT_DOWN),k.setInputAction(function(A){var D=A.endPosition;if(D!=null)if(m==null)T.showAt(D,"<p>Click to start drawing rectangle</p>");else{var B=y.camera.pickEllipsoid(D,e);if(B){var te=Y(I,e.cartesianToCartographic(B));N(te),T.showAt(D,"<p>Drag to change rectangle extent</p><p>Click again to finish drawing</p>")}}},_.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.startDrawingCircle=function(c){var c=W(c,o);this.startDrawing(function(){I!=null&&w.remove(I),m.remove(),b.destroy(),T.setVisible(!1)});var C=this,y=this._scene,w=this._scene.primitives,T=this._tooltip,I=null,m=null,b=new _.ScreenSpaceEventHandler(y.canvas);b.setInputAction(function(k){if(k.position!=null){var N=y.camera.pickEllipsoid(k.position,e);N&&(I==null?(I=new r.CirclePrimitive({center:N,radius:0,asynchronous:!1,material:c.material}),w.add(I),m=new r.BillboardGroup(C,u),m.addBillboards([N])):(typeof c.callback=="function"&&c.callback(I.getCenter(),I.getRadius()),C.stopDrawing()))}},_.ScreenSpaceEventType.LEFT_DOWN),b.setInputAction(function(k){var N=k.endPosition;if(N!=null)if(I==null)T.showAt(N,"<p>Click to start drawing the circle</p>");else{var A=y.camera.pickEllipsoid(N,e);A&&(I.setRadius(_.Cartesian3.distance(I.getCenter(),A)),m.updateBillboardsPositions(A),T.showAt(N,"<p>Move mouse to change circle radius</p><p>Click again to finish drawing</p>"))}},_.ScreenSpaceEventType.MOUSE_MOVE)},r.prototype.enhancePrimitives=function(){var l=this;_.Billboard.prototype.setEditable=function(){if(this._editable)return;this._editable=!0;var y=this,w=this;function T(I){l._scene.screenSpaceCameraController.enableRotate=I}J(y,"leftDown",function(I){function m(N){y.position=N,w.executeListeners({name:"drag",positions:N})}function b(N){k.destroy(),T(!0),w.executeListeners({name:"dragEnd",positions:N})}var k=new _.ScreenSpaceEventHandler(l._scene.canvas);k.setInputAction(function(N){var A=l._scene.camera.pickEllipsoid(N.endPosition,e);A?m(A):b(A)},_.ScreenSpaceEventType.MOUSE_MOVE),k.setInputAction(function(N){b(l._scene.camera.pickEllipsoid(N.position,e))},_.ScreenSpaceEventType.LEFT_UP),T(!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(_.Color.fromCssColorString("white"),this.strokeWidth)):this._strokeColor?this.setStrokeStyle(this._strokeColor,this.strokeWidth):this.setStrokeStyle(void 0,void 0))}function C(y){if(this._editMode!=y)if(l.disableAllHighlights(),y){l.setEdited(this);var w=l._scene,T=this;if(this._markers==null){let B=function(j,q){var ie=j-1<0?q.length-1:j-1;ie<m.countBillboards()&&(m.getBillboard(ie).position=ne(ie)),ie=j,ie<m.countBillboards()&&(m.getBillboard(ie).position=ne(ie))},te=function(){T.executeListeners({name:"onEdited",positions:T.positions})},ne=function(j){var q=T.positions;return e.cartographicToCartesian(new _.EllipsoidGeodesic(e.cartesianToCartographic(q[j]),e.cartesianToCartographic(q[j<q.length-1?j+1:0])).interpolateUsingFraction(.5))};var I=new r.BillboardGroup(l,E),m=new r.BillboardGroup(l,P),b={dragHandlers:{onDrag:function(j,q){T.positions[j]=q,B(j,T.positions),T._createPrimitive=!0},onDragEnd:function(j,q){T._createPrimitive=!0,te()}},onDoubleClick:function(j){T.positions.length<4||(T.positions.splice(j,1),T._createPrimitive=!0,I.removeBillboard(j),m.removeBillboard(j),B(j,T.positions),te())},tooltip:function(){if(T.positions.length>3)return"Double click to remove this point"}};I.addBillboards(T.positions,b),this._markers=I;for(var k=[],N=0,A=T.positions.length+(this.isPolygon?0:-1);N<A;N++)k.push(ne(N));var D={dragHandlers:{onDragStart:function(j,q){this.index=j+1,T.positions.splice(this.index,0,q),T._createPrimitive=!0},onDrag:function(j,q){T.positions[this.index]=q,T._createPrimitive=!0},onDragEnd:function(j,q){I.insertBillboard(this.index,q,b),m.getBillboard(this.index-1).position=ne(this.index-1),m.insertBillboard(this.index,ne(this.index),D),T._createPrimitive=!0,te()}},tooltip:function(){return"Drag to create a new point"}};m.addBillboards(k,D),this._editMarkers=m,this._globeClickhandler=new _.ScreenSpaceEventHandler(w.canvas),this._globeClickhandler.setInputAction(function(j){var q=w.pick(j.position);q&&q.primitive||T.setEditMode(!1)},_.ScreenSpaceEventType.LEFT_CLICK),I.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}Ne.PolylinePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this;y.isPolygon=!1,y.asynchronous=!1,l.registerEditableShape(y),y.setEditMode=C;var w=this.width;y.setHighlighted=function(T){this._editMode!==!0&&(T?(l.setHighlighted(this),this.setWidth(w*2)):this.setWidth(w))},y.getExtent=function(){return _.Rectangle.fromCartographicArray(e.cartesianArrayToCartographicArray(this.positions))},ee(y),y.setEditMode(!1)}},Ne.PolygonPrimitive.prototype.setEditable=function(){var y=this;y.asynchronous=!1,l._scene,l.registerEditableShape(y),y.setEditMode=C,y.setHighlighted=c,ee(y),y.setEditMode(!1)},Ne.ExtentPrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this,w=l._scene;l.registerEditableShape(y),y.asynchronous=!1,y.setEditMode=function(T){if(this._editMode!=T)if(l.disableAllHighlights(),T){if(l.setEdited(this),this._markers==null){let b=function(){y.executeListeners({name:"onEdited",extent:y.extent})};var I=new r.BillboardGroup(l,E),m={dragHandlers:{onDrag:function(k,N){var A=I.getBillboard((k+2)%4).position;y.setExtent(Y(e.cartesianToCartographic(A),e.cartesianToCartographic(N))),I.updateBillboardsPositions(L(y.extent))},onDragEnd:function(k,N){b()}},tooltip:function(){return"Drag to change the corners of this extent"}};I.addBillboards(L(y.extent),m),this._markers=I,this._globeClickhandler=new _.ScreenSpaceEventHandler(w.canvas),this._globeClickhandler.setInputAction(function(k){var N=w.pick(k.position);N&&!N.isDestroyed()&&N.primitive||y.setEditMode(!1)},_.ScreenSpaceEventType.LEFT_CLICK),I.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,w=l._scene;y.asynchronous=!1,l.registerEditableShape(y),y.setEditMode=function(T){if(this._editMode!=T)if(l.disableAllHighlights(),T){l.setEdited(this);var I=this;if(this._markers==null){let k=function(){return _.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,E),b={dragHandlers:{onDrag:function(A,D){var B=_.Cartesian3.distance(y.getCenter(),D);A%2==0?y.setSemiMajorAxis(B):y.setSemiMinorAxis(B),m.updateBillboardsPositions(k())},onDragEnd:function(A,D){N()}},tooltip:function(){return"Drag to change the excentricity and radius"}};m.addBillboards(k(),b),this._markers=m,this._globeClickhandler=new _.ScreenSpaceEventHandler(w.canvas),this._globeClickhandler.setInputAction(function(A){var D=w.pick(A.position);D&&D.primitive||I.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},y.setHighlighted=c,ee(y),y.setEditMode(!1)}},r.CirclePrimitive.prototype.getCircleCartesianCoordinates=function(y){for(var w=_.CircleOutlineGeometry.createGeometry(new _.CircleOutlineGeometry({ellipsoid:e,center:this.getCenter(),radius:this.getRadius(),granularity:y})),T=0,I,m=[];T<w.attributes.position.values.length;T+=3)I=w.attributes.position.values,m.push(new _.Cartesian3(I[T],I[T+1],I[T+2]));return m},r.CirclePrimitive.prototype.setEditable=function(){if(!this.setEditMode){var y=this,w=l._scene;y.asynchronous=!1,l.registerEditableShape(y),y.setEditMode=function(T){if(this._editMode!=T)if(l.disableAllHighlights(),T){l.setEdited(this);var I=this;if(this._markers==null){let k=function(){return I.getCircleCartesianCoordinates(_.Math.PI_OVER_TWO)},N=function(){y.executeListeners({name:"onEdited",center:y.getCenter(),radius:y.getRadius()})};var m=new r.BillboardGroup(l,E),b={dragHandlers:{onDrag:function(A,D){y.setRadius(_.Cartesian3.distance(y.getCenter(),D)),m.updateBillboardsPositions(k())},onDragEnd:function(A,D){N()}},tooltip:function(){return"Drag to change the radius"}};m.addBillboards(k(),b),this._markers=m,this._globeClickhandler=new _.ScreenSpaceEventHandler(w.canvas),this._globeClickhandler.setInputAction(function(A){var D=w.pick(A.position);D&&D.primitive||I.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},y.setHighlighted=c,ee(y),y.setEditMode(!1)}}},r.DrawHelperWidget=function(){function l(c,C){if(!_.defined(C.container))throw new _.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:M,polygonDrawingOptions:d,extentDrawingOptions:g,circleDrawingOptions:f};Z(C,y);var w=this,T=document.createElement("DIV");T.className="toolbar",C.container.appendChild(T);function I(k,N,A,D){var B=document.createElement("DIV");B.className="button",B.title=A,T.appendChild(B),B.onclick=D;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;I("marker",C.markerIcon,"Click to start drawing a 2D marker",function(){c.startDrawingMarker({callback:function(k){w.executeListeners({name:"markerCreated",position:k})}})}),I("polyline",C.polylineIcon,"Click to start drawing a 2D polyline",function(){c.startDrawingPolyline({callback:function(k){w.executeListeners({name:"polylineCreated",positions:k})}})}),I("polygon",C.polygonIcon,"Click to start drawing a 2D polygon",function(){c.startDrawingPolygon({callback:function(k){w.executeListeners({name:"polygonCreated",positions:k})}})}),I("extent",C.extentIcon,"Click to start drawing an Extent",function(){c.startDrawingExtent({callback:function(k){w.executeListeners({name:"extentCreated",extent:k})}})}),I("circle",C.circleIcon,"Click to start drawing a Circle",function(){c.startDrawingCircle({callback:function(k,N){w.executeListeners({name:"circleCreated",center:k,radius:N})}})});var b=document.createElement("DIV");b.className="divider",T.appendChild(b),I("clear",C.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 Y(l,c){var C=new _.Rectangle;C.west=Math.min(l.longitude,c.longitude),C.east=Math.max(l.longitude,c.longitude),C.south=Math.min(l.latitude,c.latitude),C.north=Math.max(l.latitude,c.latitude);var y=_.Math.EPSILON7;return C.east-C.west<y&&(C.east+=y*2),C.north-C.south<y&&(C.north+=y*2),C}function X(l,c){return l.longitude.toFixed(c||3)+", "+l.latitude.toFixed(c||3)}function F(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 C in l)c[C]=typeof c[C]>"u"?F(l[C],null):c[C];return c}function Z(l,c){l=l||{};var C;for(C in c)l[C]===void 0&&(l[C]=F(c[C]))}function W(l,c){var C=F(l),y;for(y in c)C[y]===void 0&&(C[y]=F(c[y]));return C}function J(l,c,C){l[c]=C}function ee(l){l._listeners={},l.addListener=function(c,C){return this._listeners[c]=this._listeners[c]||[],this._listeners[c].push(C),this._listeners[c].length},l.executeListeners=function(c,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&&C(c)}}return r}();const Po=e=>{const t=e.map(n=>{const r=p.Cartographic.fromCartesian(n);return[p.Math.toDegrees(r.longitude),p.Math.toDegrees(r.latitude)]});return t.push(t[0]),{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[t]}}},Ao=e=>{const t=Ht.lineString([[p.Math.toDegrees(e.west),p.Math.toDegrees(e.south)],[p.Math.toDegrees(e.east),p.Math.toDegrees(e.north)]]);return je(qe(t))},Oo=2,Do=(e,t)=>{switch(e){case we.BOX:{if(t.features.length!==Oo)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 p.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`)}},ko=e=>{const t=Ht.lineString([[e.west,e.south],[e.east,e.north]]);return je(qe(t)).geometry.coordinates[0].map(r=>p.Cartesian3.fromRadiansArray(r)[0])},xo=e=>{const{drawState:t,drawingMaterial:n,drawingVertexColor:r,material:s,hollow:o,outlineWidth:d}=e,g=pe(),[f,v]=a.useState();a.useEffect(()=>{v(new Ne(g,n,r))},[]),a.useEffect(()=>{if(f){const S=f;if(t.drawing)switch(t.type){case we.POLYGON:g.scene.globe.depthTestAgainstTerrain=!1,S.startDrawingPolygon({callback:u=>{t.handler({primitive:u,type:we.POLYGON,geojson:Po(u)})}});break;case we.BOX:g.scene.globe.depthTestAgainstTerrain=!1,S.startDrawingExtent({callback:u=>{t.handler({primitive:u,type:we.BOX,geojson:Ao(u)})}});break;default:throw new Error(`[CESIUM DRAW]: ${t.type} unrecognized primitive to draw.`)}else S.stopDrawing(),g.scene.globe.depthTestAgainstTerrain=!0}},[t,f]);const M=S=>{try{let u=S.coordinates!==void 0?S.coordinates:Do(S.type,S.geojson);if(o!==!0)switch(S.type){case we.BOX:return i.jsx(Un,{coordinates:u,material:s??n});case we.POLYGON:return i.jsx(zn,{hierarchy:new p.PolygonHierarchy(u),material:s??n});default:return i.jsx(i.Fragment,{})}else{switch(S.type){case we.BOX:u=ko(u);break;case we.POLYGON:u=[...u,u[0]];break;default:return i.jsx(i.Fragment,{})}return i.jsx(Io,{clampToGround:!0,positions:u,width:d??1,material:s??n})}}catch(u){return console.error(u),i.jsx(i.Fragment,{})}};return i.jsx($n,{...e,children:e.drawings.map((S,u)=>i.jsxs(Hn,{name:S.name,children:[i.jsxs(Wn,{children:[i.jsxs("h1",{children:["Drawed Entity ",S.name]}),i.jsx("p",{children:"This is description of drawed entity"})]}),M(S)]},S.id))})},No=-25,qn=2,Bo=e=>{const t=pe(),n=(o,d=",")=>o.slice(o.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(v=>{const M=v.split(d);return{cartographic:p.Cartographic.fromDegrees(parseFloat(M[0]),parseFloat(M[1])),cartesian:new p.Cartesian2(parseFloat(M[0]),parseFloat(M[1]))}}),r=o=>{var g;o.preventDefault(),o.persist();const d=new FileReader;d.onload=f=>{var u;const v=(u=f.target)==null?void 0:u.result,M=n(v),S=p.Ellipsoid.WGS84;console.log(`Loaded CSV content:
25
+ `,v),p.sampleTerrainMostDetailed(t.terrainProvider,M.map(E=>E.cartographic)).then(E=>{console.log(E),E=E.slice(0,E.length-1),t.scene.globe.depthTestAgainstTerrain=!0,t.entities.suspendEvents(),t.entities.removeAll(),E.forEach((P,L)=>{t.entities.add({name:(L+qn).toString(),position:S.cartographicToCartesian(P),billboard:{verticalOrigin:p.VerticalOrigin.BOTTOM,scale:.7,image:"assets/img/map-marker.gif"},label:{text:(L+qn).toString(),font:"14pt monospace",fillColor:p.Color.BLACK,style:p.LabelStyle.FILL_AND_OUTLINE,outlineWidth:4,outlineColor:p.Color.BLACK,verticalOrigin:p.VerticalOrigin.BOTTOM,pixelOffset:new p.Cartesian2(0,No)},description:`
26
+ Long: ${M[L].cartesian.x} </br>
27
+ Lat: ${M[L].cartesian.y} </br>
28
+ Height(m): <span style="font-weight: 500">${P.height}</span>
29
+ `})}),t.entities.resumeEvents(),o.target.files!==null&&(s(`terranian_heights_${o.target.files[0].name}`,M),o.target.value=""),console.log("Pinned point count is ",t.entities.values.length)},E=>{console.error("ERROR while sampleTerrainMostDetailed:",E)})},(g=o.target.files)!=null&&g[0]&&d.readAsText(o.target.files[0])},s=(o,d)=>{const g=u=>{let E="";return E+=u.cartesian.x.toString()+",",E+=u.cartesian.y.toString()+",",E+=u.cartographic.height.toString(),E+`
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(u=>{f+=g(u)});const v=new Blob([f],{type:"text/csv;charset=utf-8;"}),M=document.createElement("a"),S=URL.createObjectURL(v);M.setAttribute("href",S),M.setAttribute("download",o),M.style.visibility="hidden",document.body.appendChild(M),M.click(),document.body.removeChild(M)};return i.jsx(i.Fragment,{children:i.jsx("input",{type:"file",id:"csvFile",accept:".csv",onChange:o=>{r(o)}})})},Fs="",Fo=38,Vo=40,Go=13,Ho=14,Wo=27,zo=9,Uo=10,$o=100,qo=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"}),g=a.useRef(null);a.useEffect(()=>(window.addEventListener("resize",P),()=>{try{window.removeEventListener("resize",P)}catch(w){console.log('WINDOW "resize" remove listener failed',w)}}),[]),a.useEffect(()=>{typeof e.value<"u"&&n(e.value),typeof e.defaultValue<"u"&&n(e.defaultValue)},[e.value,e.defaultValue]),a.useEffect(()=>{const{options:w}=e,{caret:T}=o;Y(t,T,w)},[e]);const f=(w,T,I)=>{const{trigger:m,matchAny:b,regex:k}=e,N=new RegExp(k);let A=m;Array.isArray(A)||(A=new Array(m)),A.sort();const D={};Array.isArray(I)&&A.forEach(ne=>{D[ne]=I});const B=v(A,N);let te={};for(let ne=0;ne<B.length;ne++){const{triggerStr:j,triggerMatch:q,triggerLength:ie}=B[ne];for(let ge=T-1;ge>=0;--ge){const oe=w.substring(ge,T).match(N);let fe=-1;if(ie>0){const O=q?ge:ge-ie+1;if(O<0||(M(j,w,O)&&(fe=O+ie),!oe&&fe<0))break}else{if(oe&&ge>0)continue;if(fe=ge===0&&oe?0:ge+1,T-fe===0)break}if(fe>=0){const O=D[j];if(!Array.isArray(O))continue;const x=w.substring(fe,T),H=O.filter(Q=>{const ce=Q.toLowerCase().indexOf(x.toLowerCase());return ce!==-1&&(b||ce===0)}),z=j,U=x.length;te={...te,trigger:z,matchStart:fe,matchLength:U,options:H}}}}return te},v=(w,T)=>w.map(m=>({triggerStr:m,triggerMatch:m.match(T),triggerLength:m.length})),M=(w,T,I)=>!w||!w.length||T.substr(I,w.length)===w,S=w=>{const{onChange:T,options:I,spaceRemovers:m,spacer:b,value:k}=e,N=t,A=w.target.value,D=Ft(u(w.target)).end;if(A.length||G({...o,helperVisible:!1}),n(A),G({...o,caret:D,value:w.target.value}),!A.length||!D)return T(w.target.value);if(r&&m.length&&A.length>2&&b.length){for(let B=0;B<Math.max(N.length,A.length);++B)if(N[B]!==A[B]){if(B>=2&&A[B-1]===b&&m.indexOf(A[B-2])===-1&&m.indexOf(A[B])!==-1&&!$.isEmpty(f(A.substring(0,B-2),D-3,I))){const te=`${A.slice(0,B-1)}${A.slice(B,B+1)}${A.slice(B-1,B)}${A.slice(B+1)}`;return V(B+1),g.current!==null&&(g.current.value=te),k||G({...o,value:te}),T(te)}break}s(!1)}return Y(A,D,I),T(w.target.value)},u=w=>{if(w!==void 0)if(w.children.length>0){const T=w.getElementsByTagName("textarea");if(T.length>0)return T[0];const I=w.getElementsByTagName("input");if(I.length>0)return I[0]}else return w},E=w=>{const{helperVisible:T,options:I,selection:m}=o,{onKeyDown:b,passThroughEnter:k}=e;if(T)switch(w.keyCode){case Wo:w.preventDefault(),X();break;case Fo:w.preventDefault(),G({...o,selection:(I.length+m-1)%I.length});break;case Vo:w.preventDefault(),G({...o,selection:(m+1)%I.length});break;case Ho:case Go:k||w.preventDefault(),L(m);break;case zo:L(m);break;default:b(w);break}else b(w)},P=()=>{G({...o,helperVisible:!1})},L=w=>{const{spacer:T,onSelect:I,changeOnSelect:m}=e,{matchStart:b,matchLength:k,options:N,trigger:A}=o,D=N[w],B=t,te=B.substring(0,b-A.length),ne=B.substring(b+k),j={target:g.current},q=m(A,D);j.target!==null&&(j.target.value=`${te}${q}${T}${ne}`),S(j),j.target!==null&&I(j.target.value),X(),V(te.length+q.length+1),s(!0)},V=w=>{G({...o,caret:w});const T=u(g.current);Ft.setCaretPosition(T,w)},G=w=>{setTimeout(()=>{d({...w})},0)},Y=(w,T,I)=>{const m=g.current;if(g.current===null)return;const b=u(m);if(b===void 0)return;const k=m.getBoundingClientRect(),N=f(w,T,I);if(Object.keys(N).length>0&&b!==null){const A=yr(b,T),D=b.getBoundingClientRect(),{minChars:B,onRequestOptions:te,requestOnlyIfNoOptions:ne,mode:j}=e;let q,ie,ge,ve="unset";j==="assist"?(q=m===b?A.top+b.offsetTop:A.top+k.top,ie=Math.min(A.left+b.offsetLeft-Uo,b.offsetLeft+D.width-$o)):(q=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)?G({...o,value:w,helperVisible:!0,top:q,left:ie,right:ge,width:ve,...N}):((!ne||!N.options.length)&&te(w.substr(N.matchStart,N.matchLength)),X())}else X()},X=()=>{setTimeout(()=>{G({...o,helperVisible:!1,selection:0})},100)},F=()=>{const{helperVisible:w,left:T,right:I,matchStart:m,matchLength:b,options:k,selection:N,top:A,value:D,width:B}=o;if(!w)return null;const{maxOptions:te,offsetX:ne,offsetY:j,direction:q}=e;if(k.length===0)return null;if(N>=k.length)return G({...o,selection:0}),null;const ie=te===0?k.length:te,ge=k.slice(0,ie).map((oe,fe)=>{const O=oe.toLowerCase().indexOf(D.substr(m,b).toLowerCase());return i.jsxs("li",{className:fe===N?"active":void 0,onClick:()=>{L(fe)},onMouseEnter:()=>{G({...o,selection:fe})},children:[oe.slice(0,O),i.jsx("strong",{children:oe.substr(O,b)}),oe.slice(O+b)]},oe)}),ve=q==="ltr"?{left:T+ne}:{right:I+ne};return i.jsx("ul",{className:"react-autocomplete-input",style:{...ve,top:A+j,width:B},children:ge})},{Component:Z,ComponentProps:W,defaultValue:J,disabled:ee,onBlur:l,value:c,...C}=e,y=Object.assign({},C);return Object.keys(e).forEach(w=>{delete y[w]}),i.jsxs(i.Fragment,{children:[a.cloneElement(Z,{disabled:ee,onBlur:l,onChange:S,onKeyDown:E,ref:g,value:t,...y,...W}),F()]})},jo={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"},Yo=e=>{let t={...jo,...e};return e.mode==="autocomplete"&&(t={...t,trigger:"",regex:".",spacer:""}),i.jsx(qo,{...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=Er(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()}`}},Zo={locale:be.EN,formatters:{...st}},Xo={locale:be.RU,formatters:{...st},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.${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`]:"Папки в начале"}},Jo={locale:be.HE,formatters:{...st},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.${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`]:"הצגת תיקיות בראש הרשימה"}},Ko={[be.EN]:Zo,[be.RU]:Xo,[be.HE]:Jo},Vs="";class Qo extends re.FileHelper{}const Ro=re.ChonkyActions,jn={listView:re.ChonkyActions.EnableListView.id,gridView:re.ChonkyActions.EnableGridView.id};re.setChonkyDefaults({iconComponent:vr.ChonkyIconFA});const es=a.memo(a.forwardRef(({theme:e,styles:t={height:"100%",minWidth:"600px"},defaultView:n=jn.listView,readOnlyMode:r=!1,locale:s,files:o,folderChain:d,onFileAction:g,...f},v)=>{const M=a.useCallback(J=>null,[]);De.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 S=J=>J.replace(/([A-Z])/g,ee=>"-"+ee.toLowerCase()),u=a.useMemo(()=>e!==void 0?Object.keys(e).reduce((ee,l)=>{const c=e[l];return l=l.startsWith("--")?l:`--fp-theme-${S(l)}`,ee[l]=c,ee},{}):{},[e]),[E,P]=a.useState(!1),[L,V]=a.useState(),[G,Y]=a.useState(!1),[X,F]=a.useState(),[Z,W]=a.useState();return a.useEffect(()=>{e&&P(!0),V(n),r?Y(!0):F([re.ChonkyActions.CreateFolder,re.ChonkyActions.DeleteFiles]),s!==void 0&&W(Ko[s])},[e,n,r,s]),i.jsx(R,{style:{...t,...u},children:i.jsx(re.FullFileBrowser,{ref:v,files:o??[],folderChain:d,onFileAction:J=>{typeof g=="function"&&g(J)},thumbnailGenerator:M,defaultFileViewActionId:L,disableDragAndDrop:G,fileActions:X,darkMode:E,i18n:Z,...f})})})),ts=e=>i.jsx(Vt.components.Option,{...e,children:i.jsx(K.Checkbox,{label:e.label,checked:e.isSelected})}),ns=e=>{const{styles:t}=e;return i.jsx(Vt,{isMulti:!0,components:{Option:ts},styles:t,isClearable:!0,hideSelectedOptions:!1,closeMenuOnSelect:!1,...e})},rs=e=>{const{values:t,options:n,onChange:r,placeholder:s,styles:o}=e,d=K.useTheme(),g=Xe(d),[f,v]=a.useState(t);a.useEffect(()=>{v(t??[])},[t]);const M=S=>{v(S),r&&r(S)};return i.jsx(ae.ThemeProvider,{theme:g,children:i.jsx(ae.Input,{multiline:!0,fullWidth:!0,disableUnderline:!0,inputComponent:ns,value:f,onChange:M,placeholder:s,id:"react-select-single",inputProps:{styles:o,options:n}})})},is=({value:e,text:t,children:n,strokeWidth:r=8,styles:s,background:o=!1,backgroundPadding:d=0,counterClockwise:g=!1,circleRatio:f=1})=>{const v={value:e,strokeWidth:r,background:o,backgroundPadding:d,counterClockwise:g,circleRatio:f,styles:Ye.buildStyles({...s})};return n?i.jsx(Ye.CircularProgressbarWithChildren,{...v,children:n}):i.jsx(Ye.CircularProgressbar,{...v,text:t})},os=({values:e,valueStart:t=0,valueEnd:n,duration:r,interval:s=1e3,easingFunction:o,repeat:d,children:g})=>{const[f,v]=a.useState(0),[M,S]=a.useState(t),u=a.useRef(void 0),E=e===void 0&&n!==void 0;return a.useEffect(()=>{if(E)return d?u.current=window.setInterval(()=>{S(P=>P===t?n:t)},r?r*1e3:1e3):S(n||t),()=>{window.clearInterval(u.current)};if(e)return u.current=window.setInterval(()=>{v(P=>(P+1)%e.length),S(e[f])},s),()=>clearInterval(u.current)},[e,n,r,s,d,f]),E?i.jsx(wr.Animate,{start:()=>({value:t}),update:()=>({value:[M],timing:{duration:r?r*1e3:1e3,ease:o}}),children:({value:P})=>i.jsx(i.Fragment,{children:g(P)})}):i.jsx(i.Fragment,{children:g(M)})};h.useMediaQuery=Kn,Object.defineProperty(h,"CesiumCesiumEntity",{enumerable:!0,get:()=>p.Entity}),Object.defineProperty(h,"CesiumCesiumPolygonGraphics",{enumerable:!0,get:()=>p.PolygonGraphics}),Object.defineProperty(h,"CesiumGeoJsonDataSource",{enumerable:!0,get:()=>p.GeoJsonDataSource}),Object.defineProperty(h,"CesiumMath",{enumerable:!0,get:()=>p.Math}),Object.defineProperty(h,"CesiumSceneTransforms",{enumerable:!0,get:()=>p.SceneTransforms}),Object.defineProperty(h,"cesiumSampleTerrainMostDetailed",{enumerable:!0,get:()=>p.sampleTerrainMostDetailed}),Object.defineProperty(h,"buildStyles",{enumerable:!0,get:()=>Ye.buildStyles}),h.AnimatedValuesProvider=os,h.Autocomplete=Yo,h.BboxCorner=Ze,h.Box=R,h.COORDINATES_MERCATOR_FRACTION_DIGITS=Qe,h.COORDINATES_WGS_FRACTION_DIGITS=Ke,h.Cesium3DTileset=wo,h.CesiumBoundingSphere=Pi,h.CesiumCartesian2=_i,h.CesiumCartesian3=Ii,h.CesiumCartographic=pn,h.CesiumCesiumBillboardGraphics=Vi,h.CesiumCesiumPolylineGraphics=Ni,h.CesiumCesiumTerrainProvider=xi,h.CesiumColor=Gi,h.CesiumCompassTool=Mn,h.CesiumConstantPositionProperty=Mi,h.CesiumConstantProperty=Si,h.CesiumCustomDataSource=$n,h.CesiumDrawingsDataSource=xo,h.CesiumEllipsoid=Ai,h.CesiumEllipsoidTerrainProvider=ki,h.CesiumEntity=Hn,h.CesiumEntityDescription=_o,h.CesiumEntityStaticDescription=Wn,h.CesiumGeographicTilingScheme=Oi,h.CesiumGeojsonLayer=To,h.CesiumHeightReference=qi,h.CesiumHorizontalOrigin=Ui,h.CesiumImageryLayer=He,h.CesiumJulianDate=Bi,h.CesiumLabelStyle=$i,h.CesiumMap=vo,h.CesiumOSMLayer=So,h.CesiumPolygonGraphics=zn,h.CesiumPolygonHierarchy=Hi,h.CesiumPolylineDashMaterialProperty=Ci,h.CesiumPositionProperty=Fi,h.CesiumRectangle=fn,h.CesiumRectangleGraphics=Un,h.CesiumResource=Di,h.CesiumScene=Wi,h.CesiumSceneMode=tt,h.CesiumVerticalOrigin=zi,h.CesiumViewer=mo,h.CesiumWFSLayer=Mo,h.CesiumWMSLayer=Lo,h.CesiumWMTSLayer=bo,h.CesiumXYZLayer=Co,h.CircularProgressBar=is,h.CoordinatesTrackerTool=_n,h.CssBaseline=hi,h.DateRangePicker=Ir,h.DateTimePicker=Pr,h.DateTimeRangePicker=Ut,h.DateTimeRangePickerFormControl=Cr,h.DrawInteraction=sn,h.DrawType=we,h.FileHelper=Qo,h.FilePicker=es,h.FilePickerActions=Ro,h.FilePickerViewObj=jn,h.GeoJSONFeature=rn,h.InspectorTool=In,h.Legend=si,h.MVTSource=oi,h.Map=Zt,h.MapFilterContainer=Ur,h.MultiSelection=rs,h.Popover=$t,h.Proj=Ce,h.ScaleTrackerTool=Pn,h.ScopedCssBaseline=gi,h.SmartTable=ui,h.SupportedLocales=be,h.TerrainianHeightTool=Bo,h.TileLayer=Jt,h.TileOsm=on,h.TileWMS=Rr,h.TileWMTS=Kr,h.TileXYZ=ti,h.TimeRangeInput=Sr,h.VectorLayer=Rt,h.VectorSource=nn,h.VectorTileLayer=qr,h.ZoomButtons=An,h.ZoomLevelTrackerTool=Dn,h.defaultFormatters=st,h.getMVTOptions=ii,h.getWMSOptions=Qr,h.getWMTSOptions=Jr,h.getXYZOptions=ei,h.isDateRange=Je,h.mapMcToMuiTheme=Wt,h.useCesiumMap=pe,h.useCesiumMapViewstate=xe,h.useMap=ke,h.useMappedCesiumTheme=zt,h.useMappedMuiTheme=Xe,h.useTileLayer=Ge,h.useVectorLayer=Qt,h.useVectorSource=tn,h.useVectorTileLayer=un,h.useVectorTileSource=ri,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});