@vcmap/ui 5.0.0-rc.14 → 5.0.0-rc.16
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.
- package/README.md +33 -31
- package/build/build.js +9 -0
- package/build/buildHelpers.js +12 -10
- package/build/commonViteConfig.js +3 -10
- package/config/base.config.json +30 -24
- package/config/dev.config.json +13 -1
- package/config/www.config.json +104 -17
- package/dist/assets/cesium.430460.js +137226 -0
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/core.5089ba.js +16024 -0
- package/dist/assets/core.js +1 -1
- package/dist/assets/index.854f8e2b.js +1 -0
- package/dist/assets/ol.9be53a.js +44279 -0
- package/dist/assets/ol.js +1 -1
- package/dist/assets/{ui.15ef6a.css → ui.49010a.css} +1 -1
- package/dist/assets/ui.49010a.js +16776 -0
- package/dist/assets/ui.js +1 -1
- package/dist/assets/vue.247c1c.js +4675 -0
- package/dist/assets/vue.js +5 -2
- package/dist/assets/{vuetify.202322.css → vuetify.735e58.css} +1 -1
- package/dist/assets/vuetify.735e58.js +21019 -0
- package/dist/assets/vuetify.js +5 -2
- package/dist/index.html +1 -1
- package/index.html +77 -0
- package/index.js +8 -1
- package/package.json +12 -10
- package/plugins/@vcmap/create-link/fallbackCreateLink.vue +4 -1
- package/plugins/@vcmap/create-link/index.js +4 -1
- package/plugins/@vcmap/pluginExample/exampleActions.js +45 -0
- package/plugins/@vcmap/pluginExample/index.js +38 -1
- package/plugins/@vcmap/pluginExample/pluginExampleComponent.vue +152 -98
- package/plugins/@vcmap/project-selector/ContextsListComponent.vue +8 -1
- package/plugins/@vcmap/project-selector/ProjectSelectorComponent.vue +27 -1
- package/plugins/@vcmap/search-nominatim/LICENSE.md +14 -0
- package/plugins/@vcmap/search-nominatim/README.md +2 -0
- package/plugins/@vcmap/search-nominatim/config.json +4 -0
- package/plugins/@vcmap/search-nominatim/index.js +26 -0
- package/plugins/@vcmap/search-nominatim/nominatim.js +170 -0
- package/plugins/@vcmap/search-nominatim/package.json +43 -0
- package/plugins/@vcmap/theme-changer/ThemeChangerComponent.vue +26 -0
- package/plugins/buttonExamples/ButtonExamples.vue +28 -1
- package/plugins/categoryTest/Categories.vue +16 -0
- package/plugins/categoryTest/Category.vue +30 -4
- package/plugins/example/mySuperComponent.vue +12 -1
- package/plugins/notifier/index.js +31 -0
- package/plugins/notifier/notifierTester.vue +88 -0
- package/plugins/package.json +2 -1
- package/plugins/simple-graph/SimpleGraphComponent.vue +5 -11
- package/plugins/test/allIconsComponent.vue +16 -0
- package/plugins/test/editor.vue +3 -0
- package/plugins/test/emptyComponent.vue +3 -0
- package/plugins/test/index.js +22 -0
- package/plugins/test/myCustomHeader.vue +9 -1
- package/plugins/test/testList.vue +287 -0
- package/plugins/test/vcsContent.vue +3 -0
- package/plugins/test/windowManagerExample.vue +3 -0
- package/plugins/wizardExample/index.js +41 -0
- package/plugins/wizardExample/wizardExample.vue +77 -0
- package/src/actions/actionHelper.js +103 -2
- package/src/actions/styleSelector.vue +9 -0
- package/src/application/VcsApp.vue +95 -17
- package/src/application/VcsAttributions.vue +63 -0
- package/src/application/VcsAttributionsFooter.vue +87 -0
- package/src/application/{Navbar.vue → VcsNavbar.vue} +35 -2
- package/src/application/VcsSettings.vue +4 -0
- package/src/application/attributionsHelper.js +150 -0
- package/src/application/vcsAppWrapper.vue +5 -1
- package/src/components/buttons/VcsActionButtonList.vue +8 -1
- package/src/components/buttons/VcsButton.vue +7 -1
- package/src/components/form-inputs-controls/VcsCheckbox.vue +7 -2
- package/src/components/form-inputs-controls/VcsColorPicker.vue +4 -0
- package/src/components/form-inputs-controls/VcsFormSection.vue +55 -9
- package/src/components/form-inputs-controls/VcsRadio.vue +7 -1
- package/src/components/form-inputs-controls/VcsSelect.vue +38 -2
- package/src/components/form-inputs-controls/VcsTextArea.vue +2 -0
- package/src/components/form-inputs-controls/VcsTextField.vue +16 -4
- package/src/components/form-inputs-controls/VcsWizard.vue +133 -0
- package/src/components/imageElementInjector.vue +22 -0
- package/src/components/lists/VcsActionList.vue +12 -1
- package/src/components/lists/VcsList.vue +466 -0
- package/src/components/lists/VcsTreeview.vue +7 -3
- package/src/components/lists/VcsTreeviewLeaf.vue +23 -51
- package/src/components/lists/VcsTreeviewSearchbar.vue +6 -23
- package/src/components/notification/VcsTooltip.vue +14 -9
- package/src/components/tables/VcsTable.vue +129 -38
- package/src/contentTree/LayerTree.vue +1 -1
- package/src/contentTree/contentTreeItem.js +13 -13
- package/src/contentTree/subContentTreeItem.js +1 -1
- package/src/contentTree/vcsObjectContentTreeItem.js +1 -1
- package/src/featureInfo/AddressBalloonComponent.vue +17 -1
- package/src/featureInfo/BalloonComponent.vue +63 -27
- package/src/featureInfo/balloonFeatureInfoView.js +14 -14
- package/src/featureInfo/balloonHelper.js +4 -0
- package/src/featureInfo/featureInfo.js +23 -2
- package/src/featureInfo/featureInfoInteraction.js +1 -1
- package/src/i18n/de.js +22 -0
- package/src/i18n/en.js +22 -0
- package/src/icons/+all.js +4 -0
- package/src/icons/WandIcon.vue +63 -0
- package/src/legend/legendHelper.js +18 -12
- package/src/legend/styleLegendItem.vue +20 -1
- package/src/legend/vcsLegend.vue +29 -3
- package/src/manager/toolbox/GroupToolboxComponent.vue +13 -1
- package/src/manager/toolbox/SelectToolboxComponent.vue +13 -1
- package/src/manager/toolbox/ToolboxManager.vue +3 -0
- package/src/manager/window/WindowComponent.vue +15 -2
- package/src/manager/window/WindowComponentHeader.vue +38 -7
- package/src/manager/window/WindowManager.vue +1 -0
- package/src/manager/window/windowManager.js +11 -1
- package/src/navigation/mapNavigation.vue +15 -36
- package/src/navigation/orientationToolsButton.vue +6 -1
- package/src/navigation/overviewMap.js +19 -47
- package/src/navigation/tiltSlider.vue +3 -0
- package/src/navigation/vcsCompass.vue +2 -0
- package/src/notifier/notifier.js +121 -0
- package/src/notifier/notifierComponent.vue +84 -0
- package/src/search/resultItem.vue +89 -0
- package/src/search/resultsComponent.vue +98 -0
- package/src/search/search.js +326 -0
- package/src/search/searchComponent.vue +90 -0
- package/src/styles/_typography.scss +3 -0
- package/src/styles/utils/_cursor.scss +4 -0
- package/src/styles/variables.scss +23 -4
- package/src/vcsUiApp.js +35 -1
- package/src/vuePlugins/vuetify.js +2 -0
- package/dist/assets/cesium.9489f8.js +0 -8699
- package/dist/assets/core.aa346a.js +0 -4
- package/dist/assets/index.3cd4fffa.js +0 -1
- package/dist/assets/ol.39651b.js +0 -439
- package/dist/assets/ui.15ef6a.js +0 -71
- package/dist/assets/vue.cbe9d8.js +0 -9
- package/dist/assets/vuetify.202322.js +0 -148
@@ -1,4 +0,0 @@
|
|
1
|
-
var Pd=Object.defineProperty,Ld=Object.defineProperties;var Td=Object.getOwnPropertyDescriptors;var Wo=Object.getOwnPropertySymbols;var Nd=Object.prototype.hasOwnProperty,Dd=Object.prototype.propertyIsEnumerable;var Xo=(i,e,t)=>e in i?Pd(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,S=(i,e)=>{for(var t in e||(e={}))Nd.call(e,t)&&Xo(i,t,e[t]);if(Wo)for(var t of Wo(e))Dd.call(e,t)&&Xo(i,t,e[t]);return i},T=(i,e)=>Ld(i,Td(e));import{ol$geom$Circle as at,ol$geom$GeometryCollection as Es,ol$Feature as Z,ol$proj$getTransform as ye,ol$proj$get as Fd,ol$proj$equivalent as Ad,ol$proj$proj4$register as Yo,ol$style$Style as _e,ol$style$Fill as gt,ol$style$Stroke as ot,ol$style$Text as An,ol$has$DEVICE_PIXEL_RATIO as Rd,ol$style$RegularShape as Rn,ol$style$Circle as Is,ol$style$Icon as Ps,ol$style$Image as Gd,ol$Map as kd,ol$interaction$defaults as zd,ol$Observable$unByKey as Ce,ol$View as Gn,ol$easing$inAndOut as jd,ol$extent$containsXY as Zo,ol$extent$boundingExtent as Ls,ol$extent$getBottomLeft as kn,ol$geom$Point as Bt,ol$geom$LineString as br,ol$geom$MultiPoint as Ko,ol$geom$MultiLineString as Jo,ol$geom$MultiPolygon as Or,ol$sphere$offset as Er,ol$layer$Vector as Qo,ol$geom$Polygon$circular as Hd,ol$ImageState as Ir,ol$geom$Polygon as Ts,ol$extent$getBottomRight as el,ol$extent$getTopRight as tl,ol$extent$getTopLeft as Pr,ol$proj$transform as ri,ol$geom$Polygon$fromCircle as $d,ol$source$Vector as Ns,ol$tilegrid$createXYZ as il,ol$proj$Projection as Vd,ol$tilegrid$TileGrid as sl,ol$source$TileImage as Bd,ol$layer$Tile as Ri,ol$extent$containsCoordinate as Ud,ol$extent$buffer as rl,ol$extent$getCenter as zn,ol$proj$transformExtent as nl,ol$sphere$getDistance as qd,ol$format$GeoJSON as al,Feature as ol,ol$extent$getWidth as jn,ol$source$TileWMS as Wd,ol$format$GML2 as Hn,ol$format$WFS as ll,ol$format$GML3 as $n,ol$extent$createEmpty as hl,ol$structs$LRUCache as Xd,ol$extent$createOrUpdateFromCoordinate as Yd,ol$render$canvas$Immediate as Zd,ol$geom$flat$transform$transform2D as Kd,ol$extent$intersects as Jd,ol$geom$SimpleGeometry$transformGeom2D as Qd,ol$transform$scale as ef,ol$transform$create as tf,ol$transform$compose as sf,ol$extent$extend as cl,ol$source$OSM as rf,ol$layer$Image as nf,ol$source$ImageStatic as af,ol$source$TileDebug as of,ol$source$XYZ as lf,ol$source$VectorTile as hf,ol$TileState as cf,ol$layer$VectorTile as uf,ol$tilegrid$WMTS as df,ol$source$WMTS as ff,ol$format$MVT as gf,ol$geom$LinearRing as mf,ol$interaction$DragPan as pf}from"./ol.39651b.js";import{Cartesian3 as M,Math as P,Material as Gi,Cartesian2 as K,Cesium3DTilePointFeature as Ut,Cesium3DTileFeature as qt,Matrix3 as We,Quaternion as yf,Color as Ne,Entity as ni,EasingFunction as _f,Cesium3DTileStyle as Vn,Cesium3DTileColorBlendMode as Lr,VerticalOrigin as Xe,ConditionsExpression as vf,Expression as Sf,HeightReference as Qe,ClassificationType as ki,NearFarScalar as Ds,SceneTransforms as Mf,MaterialAppearance as Cf,GeometryInstance as Tr,ColorGeometryInstanceAttribute as ul,PerInstanceColorAppearance as Bn,ShadowMode as Fs,ClassificationPrimitive as dl,GroundPrimitive as fl,Primitive as Un,PolylineMaterialAppearance as xf,GroundPolylinePrimitive as gl,PolygonGeometry as wf,PolygonOutlineGeometry as bf,GroundPolylineGeometry as qn,PolylineGeometry as Wn,PolygonHierarchy as ml,CircleGeometry as Of,CircleOutlineGeometry as Ef,Cartographic as se,WallGeometry as If,WallOutlineGeometry as Pf,LabelStyle as Xn,HorizontalOrigin as Yn,HeadingPitchRoll as Lf,Matrix4 as k,Transforms as pl,Model as Tf,sampleTerrainMostDetailed as Nr,ModelAnimationLoop as Nf,PrimitiveCollection as Zn,BillboardCollection as Df,LabelCollection as Ff,CesiumTerrainProvider as yl,Cartesian4 as _l,sampleTerrain as Af,Ellipsoid as Kn,Clock as Rf,DataSourceClock as Gf,JulianDate as vl,KeyboardEventModifier as Jn,ScreenSpaceEventType as Wt,CesiumWidget as kf,DataSourceDisplay as Sl,DataSourceCollection as Ml,RequestScheduler as zf,ScreenSpaceEventHandler as jf,Ray as Hf,Camera as $f,ImageryLayer as ai,CustomDataSource as Cl,Cesium3DTileset as As,BoundingSphere as xl,Intersect as Vf,CesiumInspector as Bf,Cesium3DTilesInspector as Uf,BillboardVisualizer as qf,LabelVisualizer as Wf,PointVisualizer as Xf,Rectangle as Ye,Composite3DTileContent as Yf,HeadingPitchRange as Zf,BoundingSphereState as wl,OpenStreetMapImageryProvider as Kf,SingleTileImageryProvider as Jf,WebMercatorTilingScheme as Qn,GeographicTilingScheme as bl,SplitDirection as J,TileMapServiceImageryProvider as Qf,Event as eg,WebMapServiceImageryProvider as tg,WebMapTileServiceImageryProvider as ig,EntityCollection as sg,CzmlDataSource as rg,Plane as Pt,ClippingPlaneCollection as oi,ClippingPlane as li,ConstantProperty as ng,Globe as ag}from"./cesium.9489f8.js";const Rs=[[String,"string"],[Number,"number"],[Boolean,"boolean"],[Function,"function"],[void 0,"undefined"],[Symbol,"symbol"]];function Dr(i){const e={};if(!i||e.toString(i)!=="[object Object]")return!1;const t=Object.getPrototypeOf(i);if(!t)return!0;const s=e.hasOwnProperty,r=s.call(t,"constructor")&&t.constructor;return typeof r=="function"&&s.toString.call(r)===s.toString.call(Object)}function lt(i,e){if(i===null)return"null";if(typeof i=="undefined")return"undefined";if(e)return typeof i;let t;if(Array.isArray(i))t=`[${i.map(r=>lt(r,e)).join(",")}]`;else try{t=JSON.stringify(i)}catch{t=typeof i}return t=t||typeof i,t.length>20?`${t.substr(0,20)}...`:t}function og(i,e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"?i===e?!1:`Expected ${lt(i)} to equal ${e.toString()}`:null}function lg(i,e,t){if(Array.isArray(e)){if(e.length!==1)throw new Error("Array patterns may only have on type");if(Array.isArray(i)){let s=!1;return i.findIndex(n=>{try{v(n,e[0],t)}catch(a){s=a.message.replace(/Match failed:\s/,"")}return s})>-1?`${s} in ${lt(i)}`:!1}return`Expected ${lt(i)} to be an Array`}return null}function ea(i,e,t){const s=t?`${t}.`:"";if(!Dr(i))return`Expected ${lt(i)} to be a plain Object`;let n=!1;const a=Object.keys(e).find(o=>{const l=i[o];if(Dr(e[o]))n=ea(l,e[o],s+o);else try{v(l,e[o])}catch(h){n=h.message.replace(/Match failed:\s/,"")}return n});return a?`${n} in object.${s}${a}`:!1}function hg(i,e){if(e===Number)return Number.isFinite(i)?!1:`expected ${lt(i)} to be a number, excluding NaN`;for(let t=Rs.length;t--;)if(e===Rs[t][0])return typeof i===Rs[t][1]?!1:`expected ${lt(i)} to be a ${Rs[t][1]}`;return null}function ta(i){if(i===null)return"null";const e=Rs.find(r=>r[0]===i);if(e)return e[1];let t=i.toString();if(i.className)return i.className;const s=t.match(/function (.*)\(/);if(s&&s.length>1)return s[1];if(Dr(i)){const r={};Object.keys(i).forEach(n=>{r[n]=ta(i[n])});try{t=`Object of ${JSON.stringify(r)}`}catch{t="Object"}}return t}function Ol(i,e,t){const s=t?`${t}.`:"";let r=!1;return Object.keys(i).find(a=>{if(Dr(e[a])){const o=i[a];r=Ol(o,e[a],s+a)}else e[a]||(r=`Found additional key ${s}${a}`);return r=r?r.replace(/\sin.*/,""):!1,r})?`${r} in ${lt(i)}`:!1}function El(i,e,t){const s=function(a,o){if(o==null)return a===o?!1:`Expected ${lt(a)} to be ${o}`;const l=hg(a,o);if(l!==null)return l;const h=og(a,o);if(h!==null)return h;if(Array.isArray(o))return lg(a,o,t);if(o instanceof Function)return a instanceof o?!1:`Expected ${lt(a,!0)} to be of Type ${ta(o)}`;if(o===Object)return ea(a,{});if(typeof o!="object")throw new Error(`Cannot handler pattern ${o}`);const c=ea(a,o);return c||(t?Ol(a,o):!1)};let r;return Array.isArray(e)&&e.length>1?e.every(a=>s(i,a))&&(r=`Expected ${lt(i)} to be a ${e.map(a=>ta(a)).join(" or ")}`):r=s(i,e),r}function ia(i,e,t){return!El(i,e,t)}function v(i,e,t){const s=El(i,e,t);if(s)throw new Error(`Match failed: ${s}`);return!1}function re(i,e,t){const s=[null,void 0];return Array.isArray(e)&&e.length>1?e.forEach(r=>{s.push(r)}):s.push(e),v(i,s.reverse(),t)}function cg(i,e,t){const r=P.toRadians(t),n=P.toRadians(i[1]),a=P.toRadians(i[0]),o=Math.asin(Math.sin(n)*Math.cos(e/6371e3)+Math.cos(n)*Math.sin(e/6371e3)*Math.cos(r)),l=a+Math.atan2(Math.sin(r)*Math.sin(e/6371e3)*Math.cos(n),Math.cos(e/6371e3)-Math.sin(n)*Math.sin(o));return[parseFloat(P.toDegrees(l).toFixed(5)),parseFloat(P.toDegrees(o).toFixed(5))]}function ug(i,e){const t=P.toRadians(i[0]),s=P.toRadians(i[1]),r=P.toRadians(e[0]),n=P.toRadians(e[1]),a=Math.sin(r-t)*Math.cos(n),o=Math.cos(s)*Math.sin(n)-Math.sin(s)*Math.cos(n)*Math.cos(r-t);let l=P.toDegrees(Math.atan2(a,o));return l=(l+360)%360,l}function mt(i,e){const t=i[0]-e[0],s=i[1]-e[1];return Math.sqrt(t**2+s**2)}function Il(i,e){const t=M.fromElements(i[0],i[1],i[2]),s=M.fromElements(e[0],e[1],e[2]);return M.distance(t,s)}function Fr(i,e){return(i%e+e)%e}at.prototype.getCoordinates=function(){return[this.getCenter(),this.getLastCoordinate()]},at.prototype.setCoordinates=function(e,t){v(e,[[Number]]),v(e.length,2);const s=t||this.getLayout(),r=/XYM?/.test(s)?mt:Il;this.setCenterAndRadius(e[0],r(e[0],e[1]),t)},Es.prototype.getCoordinates=function(){return this.getGeometries().map(e=>e.getCoordinates())},Es.prototype.setCoordinates=function(e,t){v(e,Array),v(e.length,this.getGeometries().length),this.setGeometries(this.getGeometries().map((s,r)=>(s.setCoordinates(e[r],t),s)))},Es.prototype.getLayout=function(){const e=this.getGeometries()[0];return e?e.getLayout():"XYZ"},Z.prototype.getProperty=function(e){if(e==="attributes"){const t=this.getProperties();return this.getGeometryName()&&delete t[this.getGeometryName()],t}else if(e==="olcs_geometryType"){const t=this.getGeometry().getType();return t==="Polygon"?1:t==="LineString"?2:t==="Point"?3:t==="Circle"||t==="MultiPolygon"?1:t==="MultiLineString"?2:t==="MultiPoint"?3:void 0}return this.get(e)},Z.prototype.getPropertyInherited=function(e){return this.getProperty(e)},Gi._materialCache.addMaterial("Wallpaper",{fabric:{type:"Wallpaper",uniforms:{image:Gi.DefaultImageId,anchor:new K(0,0)},components:{diffuse:"texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).rgb",alpha:"texture2D(image, fract((gl_FragCoord.xy - anchor.xy) / vec2(imageDimensions.xy))).a"}},translucent:!1}),Ut.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},qt.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},new M,new We,new yf,new Ne,ni.prototype.getId=function(){return this.id},ni.prototype.getProperty=function(e){return this[e]},ni.prototype.getPropertyInherited=function(e){return this.getProperty(e)};var Ar,dg=new Uint8Array(16);function fg(){if(!Ar&&(Ar=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ar))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ar(dg)}var gg=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Pl(i){return typeof i=="string"&&gg.test(i)}for(var xe=[],sa=0;sa<256;++sa)xe.push((sa+256).toString(16).substr(1));function Ll(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(xe[i[e+0]]+xe[i[e+1]]+xe[i[e+2]]+xe[i[e+3]]+"-"+xe[i[e+4]]+xe[i[e+5]]+"-"+xe[i[e+6]]+xe[i[e+7]]+"-"+xe[i[e+8]]+xe[i[e+9]]+"-"+xe[i[e+10]]+xe[i[e+11]]+xe[i[e+12]]+xe[i[e+13]]+xe[i[e+14]]+xe[i[e+15]]).toLowerCase();if(!Pl(t))throw TypeError("Stringified UUID is invalid");return t}function mg(i){if(!Pl(i))throw TypeError("Invalid UUID");var e,t=new Uint8Array(16);return t[0]=(e=parseInt(i.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(i.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(i.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(i.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(i.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}function pg(i){i=unescape(encodeURIComponent(i));for(var e=[],t=0;t<i.length;++t)e.push(i.charCodeAt(t));return e}var yg="6ba7b810-9dad-11d1-80b4-00c04fd430c8",_g="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function vg(i,e,t){function s(r,n,a,o){if(typeof r=="string"&&(r=pg(r)),typeof n=="string"&&(n=mg(n)),n.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+r.length);if(l.set(n),l.set(r,n.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,a){o=o||0;for(var h=0;h<16;++h)a[o+h]=l[h];return a}return Ll(l)}try{s.name=i}catch{}return s.DNS=yg,s.URL=_g,s}function et(i,e,t){i=i||{};var s=i.random||(i.rng||fg)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){t=t||0;for(var r=0;r<16;++r)e[t+r]=s[r];return e}return Ll(s)}function Sg(i,e,t,s){switch(i){case 0:return e&t^~e&s;case 1:return e^t^s;case 2:return e&t^e&s^t&s;case 3:return e^t^s}}function ra(i,e){return i<<e|i>>>32-e}function Mg(i){var e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof i=="string"){var s=unescape(encodeURIComponent(i));i=[];for(var r=0;r<s.length;++r)i.push(s.charCodeAt(r))}else Array.isArray(i)||(i=Array.prototype.slice.call(i));i.push(128);for(var n=i.length/4+2,a=Math.ceil(n/16),o=new Array(a),l=0;l<a;++l){for(var h=new Uint32Array(16),c=0;c<16;++c)h[c]=i[l*64+c*4]<<24|i[l*64+c*4+1]<<16|i[l*64+c*4+2]<<8|i[l*64+c*4+3];o[l]=h}o[a-1][14]=(i.length-1)*8/Math.pow(2,32),o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(i.length-1)*8&4294967295;for(var u=0;u<a;++u){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=o[u][f];for(var g=16;g<80;++g)d[g]=ra(d[g-3]^d[g-8]^d[g-14]^d[g-16],1);for(var m=t[0],p=t[1],y=t[2],_=t[3],w=t[4],L=0;L<80;++L){var E=Math.floor(L/20),A=ra(m,5)+Sg(E,p,y,_)+w+e[E]+d[L]>>>0;w=_,_=y,y=ra(p,30)>>>0,p=m,m=A}t[0]=t[0]+m>>>0,t[1]=t[1]+p>>>0,t[2]=t[2]+y>>>0,t[3]=t[3]+_>>>0,t[4]=t[4]+w>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}var Cg=vg("v5",80,Mg),xg=Cg;const ne={OFF:1,ERROR:2,WARN:4,INFO:8,DEBUG:16},Lt={ERROR:0,WARN:0,INFO:0,DEBUG:0};Lt.ERROR=ne.ERROR|ne.WARN|ne.INFO|ne.DEBUG,Lt.WARN=ne.WARN|ne.INFO|ne.DEBUG,Lt.INFO=ne.INFO|ne.DEBUG,Lt.DEBUG=ne.DEBUG;const Gs={useTimestamp:!1,logLevel:ne.INFO},ks=new Map;ks.set(ne.ERROR,"error"),ks.set(ne.WARN,"warn"),ks.set(ne.INFO,"info"),ks.set(ne.DEBUG,"log");class Tl{constructor(e){this.className=e,this.deprecations=new Map}error(e,...t){Gs.logLevel&Lt.ERROR&&this._log(String(e),ne.ERROR,t)}warning(e,...t){Gs.logLevel&Lt.WARN&&this._log(String(e),ne.WARN,t)}deprecate(e,t){const s=String(e),r=t?String(t):null;if(!this.deprecations.has(s)){this.deprecations.set(s,r||null);let n=`${s} has been deprecated and will be removed`;r&&(n=`${n}. ${r}`),this.warning(n)}}info(e,...t){Gs.logLevel&Lt.INFO&&this._log(String(e),ne.INFO,t)}debug(e,...t){Gs.logLevel&Lt.DEBUG&&this._log(String(e),ne.DEBUG,t)}log(e,...t){Gs.logLevel&Lt.DEBUG&&this._log(String(e),ne.DEBUG,t)}_log(e,t,s){let r=e;this.className&&(r=`[${this.className}] ${r}`),console[ks.get(t)](r,...s),t&ne.ERROR&&(console.group(),console.trace(),console.groupEnd())}}const na=new Map;let aa;function wg(){return aa||(aa=new Tl),aa}function bg(i){const e=new Tl(i);return na.set(i,e),e}function Ie(i){return i?na.has(i)?na.get(i):bg(i):wg()}function B(i,e){if(i!=null){const t=Number.parseInt(String(i),10);if(t!=null&&!Number.isNaN(t))return t}return e}function N(i,e){if(i!=null){const t=Number.parseFloat(String(i));if(t!=null&&!Number.isNaN(t))return t}return e}function Rr(i,e,t,s){const r=N(i,e);return r<t?t:r>s?s:r}function ae(i,e){return i==null?e:typeof i=="boolean"?i:i===1?!0:i===0?!1:typeof i=="string"&&(i.toLowerCase()==="true"||i.toLowerCase()==="1")?!0:typeof i=="string"&&(i.toLowerCase()==="false"||i.toLowerCase()==="0")?!1:e}function oa(i,e,t){if(i!=null){const s=Object.values(e).find(r=>r==i);if(s!=null)return s}return t}function Xt(i,e,t){if(i!=null){const s=Object.keys(e).find(r=>r==i);if(s!=null)return e[s]}return t}function Og(i){i("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),i("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),i("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),i.WGS84=i["EPSG:4326"],i["EPSG:3785"]=i["EPSG:3857"],i.GOOGLE=i["EPSG:3857"],i["EPSG:900913"]=i["EPSG:3857"],i["EPSG:102113"]=i["EPSG:3857"]}var hi=1,ci=2,Gr=3,Eg=4,la=5,Nl=6378137,Ig=6356752314e-3,Dl=.0066943799901413165,zs=484813681109536e-20,C=Math.PI/2,Pg=.16666666666666666,Lg=.04722222222222222,Tg=.022156084656084655,x=1e-10,we=.017453292519943295,pt=57.29577951308232,H=Math.PI/4,js=Math.PI*2,oe=3.14159265359,ke={};ke.greenwich=0,ke.lisbon=-9.131906111111,ke.paris=2.337229166667,ke.bogota=-74.080916666667,ke.madrid=-3.687938888889,ke.rome=12.452333333333,ke.bern=7.439583333333,ke.jakarta=106.807719444444,ke.ferro=-17.666666666667,ke.brussels=4.367975,ke.stockholm=18.058277777778,ke.athens=23.7163375,ke.oslo=10.722916666667;var Ng={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},Fl=/[\s_\-\/\(\)]/g;function Yt(i,e){if(i[e])return i[e];for(var t=Object.keys(i),s=e.toLowerCase().replace(Fl,""),r=-1,n,a;++r<t.length;)if(n=t[r],a=n.toLowerCase().replace(Fl,""),a===s)return i[n]}function ha(i){var e={},t=i.split("+").map(function(o){return o.trim()}).filter(function(o){return o}).reduce(function(o,l){var h=l.split("=");return h.push(!0),o[h[0].toLowerCase()]=h[1],o},{}),s,r,n,a={proj:"projName",datum:"datumCode",rf:function(o){e.rf=parseFloat(o)},lat_0:function(o){e.lat0=o*we},lat_1:function(o){e.lat1=o*we},lat_2:function(o){e.lat2=o*we},lat_ts:function(o){e.lat_ts=o*we},lon_0:function(o){e.long0=o*we},lon_1:function(o){e.long1=o*we},lon_2:function(o){e.long2=o*we},alpha:function(o){e.alpha=parseFloat(o)*we},gamma:function(o){e.rectified_grid_angle=parseFloat(o)},lonc:function(o){e.longc=o*we},x_0:function(o){e.x0=parseFloat(o)},y_0:function(o){e.y0=parseFloat(o)},k_0:function(o){e.k0=parseFloat(o)},k:function(o){e.k0=parseFloat(o)},a:function(o){e.a=parseFloat(o)},b:function(o){e.b=parseFloat(o)},r_a:function(){e.R_A=!0},zone:function(o){e.zone=parseInt(o,10)},south:function(){e.utmSouth=!0},towgs84:function(o){e.datum_params=o.split(",").map(function(l){return parseFloat(l)})},to_meter:function(o){e.to_meter=parseFloat(o)},units:function(o){e.units=o;var l=Yt(Ng,o);l&&(e.to_meter=l.to_meter)},from_greenwich:function(o){e.from_greenwich=o*we},pm:function(o){var l=Yt(ke,o);e.from_greenwich=(l||parseFloat(o))*we},nadgrids:function(o){o==="@null"?e.datumCode="none":e.nadgrids=o},axis:function(o){var l="ewnsud";o.length===3&&l.indexOf(o.substr(0,1))!==-1&&l.indexOf(o.substr(1,1))!==-1&&l.indexOf(o.substr(2,1))!==-1&&(e.axis=o)},approx:function(){e.approx=!0}};for(s in t)r=t[s],s in a?(n=a[s],typeof n=="function"?n(r):e[n]=r):e[s]=r;return typeof e.datumCode=="string"&&e.datumCode!=="WGS84"&&(e.datumCode=e.datumCode.toLowerCase()),e}var Hs=1,Al=2,Rl=3,kr=4,Gl=5,ca=-1,Dg=/\s/,Fg=/[A-Za-z]/,Ag=/[A-Za-z84_]/,zr=/[,\]]/,kl=/[\d\.E\-\+]/;function Tt(i){if(typeof i!="string")throw new Error("not a string");this.text=i.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Hs}Tt.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==kr)for(;Dg.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Hs:return this.neutral(i);case Al:return this.keyword(i);case kr:return this.quoted(i);case Gl:return this.afterquote(i);case Rl:return this.number(i);case ca:return}},Tt.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=kr;return}if(zr.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)},Tt.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Hs;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Hs,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ca);return}},Tt.prototype.number=function(i){if(kl.test(i)){this.word+=i;return}if(zr.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)},Tt.prototype.quoted=function(i){if(i==='"'){this.state=Gl;return}this.word+=i},Tt.prototype.keyword=function(i){if(Ag.test(i)){this.word+=i;return}if(i==="["){var e=[];e.push(this.word),this.level++,this.root===null?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,this.state=Hs;return}if(zr.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)},Tt.prototype.neutral=function(i){if(Fg.test(i)){this.word=i,this.state=Al;return}if(i==='"'){this.word="",this.state=kr;return}if(kl.test(i)){this.word=i,this.state=Rl;return}if(zr.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)},Tt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ca)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Rg(i){var e=new Tt(i);return e.output()}function zl(i,e,t){Array.isArray(e)&&(t.unshift(e),e=null);var s=e?{}:i,r=t.reduce(function(n,a){return zi(a,n),n},s);e&&(i[e]=r)}function zi(i,e){if(!Array.isArray(i)){e[i]=!0;return}var t=i.shift();if(t==="PARAMETER"&&(t=i.shift()),i.length===1){if(Array.isArray(i[0])){e[t]={},zi(i[0],e[t]);return}e[t]=i[0];return}if(!i.length){e[t]=!0;return}if(t==="TOWGS84"){e[t]=i;return}if(t==="AXIS"){t in e||(e[t]=[]),e[t].push(i);return}Array.isArray(t)||(e[t]={});var s;switch(t){case"UNIT":case"PRIMEM":case"VERT_DATUM":e[t]={name:i[0].toLowerCase(),convert:i[1]},i.length===3&&zi(i[2],e[t]);return;case"SPHEROID":case"ELLIPSOID":e[t]={name:i[0],a:i[1],rf:i[2]},i.length===4&&zi(i[3],e[t]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":i[0]=["name",i[0]],zl(e,t,i);return;default:for(s=-1;++s<i.length;)if(!Array.isArray(i[s]))return zi(i,e[t]);return zl(e,t,i)}}var Gg=.017453292519943295;function kg(i,e){var t=e[0],s=e[1];!(t in i)&&s in i&&(i[t]=i[s],e.length===3&&(i[t]=e[2](i[t])))}function Nt(i){return i*Gg}function zg(i){if(i.type==="GEOGCS"?i.projName="longlat":i.type==="LOCAL_CS"?(i.projName="identity",i.local=!0):typeof i.PROJECTION=="object"?i.projName=Object.keys(i.PROJECTION)[0]:i.projName=i.PROJECTION,i.AXIS){for(var e="",t=0,s=i.AXIS.length;t<s;++t){var r=[i.AXIS[t][0].toLowerCase(),i.AXIS[t][1].toLowerCase()];r[0].indexOf("north")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="north"?e+="n":r[0].indexOf("south")!==-1||(r[0]==="y"||r[0]==="lat")&&r[1]==="south"?e+="s":r[0].indexOf("east")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="east"?e+="e":(r[0].indexOf("west")!==-1||(r[0]==="x"||r[0]==="lon")&&r[1]==="west")&&(e+="w")}e.length===2&&(e+="u"),e.length===3&&(i.axis=e)}i.UNIT&&(i.units=i.UNIT.name.toLowerCase(),i.units==="metre"&&(i.units="meter"),i.UNIT.convert&&(i.type==="GEOGCS"?i.DATUM&&i.DATUM.SPHEROID&&(i.to_meter=i.UNIT.convert*i.DATUM.SPHEROID.a):i.to_meter=i.UNIT.convert));var n=i.GEOGCS;i.type==="GEOGCS"&&(n=i),n&&(n.DATUM?i.datumCode=n.DATUM.name.toLowerCase():i.datumCode=n.name.toLowerCase(),i.datumCode.slice(0,2)==="d_"&&(i.datumCode=i.datumCode.slice(2)),(i.datumCode==="new_zealand_geodetic_datum_1949"||i.datumCode==="new_zealand_1949")&&(i.datumCode="nzgd49"),(i.datumCode==="wgs_1984"||i.datumCode==="world_geodetic_system_1984")&&(i.PROJECTION==="Mercator_Auxiliary_Sphere"&&(i.sphere=!0),i.datumCode="wgs84"),i.datumCode.slice(-6)==="_ferro"&&(i.datumCode=i.datumCode.slice(0,-6)),i.datumCode.slice(-8)==="_jakarta"&&(i.datumCode=i.datumCode.slice(0,-8)),~i.datumCode.indexOf("belge")&&(i.datumCode="rnb72"),n.DATUM&&n.DATUM.SPHEROID&&(i.ellps=n.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),i.ellps.toLowerCase().slice(0,13)==="international"&&(i.ellps="intl"),i.a=n.DATUM.SPHEROID.a,i.rf=parseFloat(n.DATUM.SPHEROID.rf,10)),n.DATUM&&n.DATUM.TOWGS84&&(i.datum_params=n.DATUM.TOWGS84),~i.datumCode.indexOf("osgb_1936")&&(i.datumCode="osgb36"),~i.datumCode.indexOf("osni_1952")&&(i.datumCode="osni52"),(~i.datumCode.indexOf("tm65")||~i.datumCode.indexOf("geodetic_datum_of_1965"))&&(i.datumCode="ire65"),i.datumCode==="ch1903+"&&(i.datumCode="ch1903"),~i.datumCode.indexOf("israel")&&(i.datumCode="isr93")),i.b&&!isFinite(i.b)&&(i.b=i.a);function a(h){var c=i.to_meter||1;return h*c}var o=function(h){return kg(i,h)},l=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Nt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Nt],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Nt],["lat0","latitude_of_origin",Nt],["lat0","standard_parallel_1",Nt],["lat1","standard_parallel_1",Nt],["lat2","standard_parallel_2",Nt],["azimuth","Azimuth"],["alpha","azimuth",Nt],["srsCode","name"]];l.forEach(o),!i.long0&&i.longc&&(i.projName==="Albers_Conic_Equal_Area"||i.projName==="Lambert_Azimuthal_Equal_Area")&&(i.long0=i.longc),!i.lat_ts&&i.lat1&&(i.projName==="Stereographic_South_Pole"||i.projName==="Polar Stereographic (variant B)")&&(i.lat0=Nt(i.lat1>0?90:-90),i.lat_ts=i.lat1)}function jl(i){var e=Rg(i),t=e.shift(),s=e.shift();e.unshift(["name",s]),e.unshift(["type",t]);var r={};return zi(e,r),zg(r),r}function De(i){var e=this;if(arguments.length===2){var t=arguments[1];typeof t=="string"?t.charAt(0)==="+"?De[i]=ha(arguments[1]):De[i]=jl(arguments[1]):De[i]=t}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(s){Array.isArray(s)?De.apply(e,s):De(s)});if(typeof i=="string"){if(i in De)return De[i]}else"EPSG"in i?De["EPSG:"+i.EPSG]=i:"ESRI"in i?De["ESRI:"+i.ESRI]=i:"IAU2000"in i?De["IAU2000:"+i.IAU2000]=i:console.log(i);return}}Og(De);function jg(i){return typeof i=="string"}function Hg(i){return i in De}var $g=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Vg(i){return $g.some(function(e){return i.indexOf(e)>-1})}var Bg=["3857","900913","3785","102113"];function Ug(i){var e=Yt(i,"authority");if(!!e){var t=Yt(e,"epsg");return t&&Bg.indexOf(t)>-1}}function qg(i){var e=Yt(i,"extension");if(!!e)return Yt(e,"proj4")}function Wg(i){return i[0]==="+"}function Xg(i){if(jg(i)){if(Hg(i))return De[i];if(Vg(i)){var e=jl(i);if(Ug(e))return De["EPSG:3857"];var t=qg(e);return t?ha(t):e}if(Wg(i))return ha(i)}else return i}function Hl(i,e){i=i||{};var t,s;if(!e)return i;for(s in e)t=e[s],t!==void 0&&(i[s]=t);return i}function yt(i,e,t){var s=i*e;return t/Math.sqrt(1-s*s)}function $s(i){return i<0?-1:1}function O(i){return Math.abs(i)<=oe?i:i-$s(i)*js}function ht(i,e,t){var s=i*t,r=.5*i;return s=Math.pow((1-s)/(1+s),r),Math.tan(.5*(C-e))/s}function Vs(i,e){for(var t=.5*i,s,r,n=C-2*Math.atan(e),a=0;a<=15;a++)if(s=i*Math.sin(n),r=C-2*Math.atan(e*Math.pow((1-s)/(1+s),t))-n,n+=r,Math.abs(r)<=1e-10)return n;return-9999}function Yg(){var i=this.b/this.a;this.es=1-i*i,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=yt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Zg(i){var e=i.x,t=i.y;if(t*pt>90&&t*pt<-90&&e*pt>180&&e*pt<-180)return null;var s,r;if(Math.abs(Math.abs(t)-C)<=x)return null;if(this.sphere)s=this.x0+this.a*this.k0*O(e-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(H+.5*t));else{var n=Math.sin(t),a=ht(this.e,t,n);s=this.x0+this.a*this.k0*O(e-this.long0),r=this.y0-this.a*this.k0*Math.log(a)}return i.x=s,i.y=r,i}function Kg(i){var e=i.x-this.x0,t=i.y-this.y0,s,r;if(this.sphere)r=C-2*Math.atan(Math.exp(-t/(this.a*this.k0)));else{var n=Math.exp(-t/(this.a*this.k0));if(r=Vs(this.e,n),r===-9999)return null}return s=O(this.long0+e/(this.a*this.k0)),i.x=s,i.y=r,i}var Jg=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Qg={init:Yg,forward:Zg,inverse:Kg,names:Jg};function em(){}function $l(i){return i}var tm=["longlat","identity"],im={init:em,forward:$l,inverse:$l,names:tm},sm=[Qg,im],jr={},Hr=[];function Vl(i,e){var t=Hr.length;return i.names?(Hr[t]=i,i.names.forEach(function(s){jr[s.toLowerCase()]=t}),this):(console.log(e),!0)}function rm(i){if(!i)return!1;var e=i.toLowerCase();if(typeof jr[e]!="undefined"&&Hr[jr[e]])return Hr[jr[e]]}function nm(){sm.forEach(Vl)}var am={start:nm,add:Vl,get:rm},F={};F.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},F.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},F.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},F.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},F.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},F.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},F.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},F.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},F.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},F.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},F.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},F.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},F.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},F.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},F.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},F.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},F.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},F.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},F.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},F.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},F.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},F.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},F.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},F.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},F.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},F.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},F.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},F.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},F.hough={a:6378270,rf:297,ellipseName:"Hough"},F.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},F.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},F.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},F.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},F.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},F.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},F.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},F.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},F.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},F.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},F.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},F.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var om=F.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};F.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function lm(i,e,t,s){var r=i*i,n=e*e,a=(r-n)/r,o=0;s?(i*=1-a*(Pg+a*(Lg+a*Tg)),r=i*i,a=0):o=Math.sqrt(a);var l=(r-n)/n;return{es:a,e:o,ep2:l}}function hm(i,e,t,s,r){if(!i){var n=Yt(F,s);n||(n=om),i=n.a,e=n.b,t=n.rf}return t&&!e&&(e=(1-1/t)*i),(t===0||Math.abs(i-e)<x)&&(r=!0,e=i),{a:i,b:e,rf:t,sphere:r}}var ve={};ve.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ve.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ve.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},ve.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},ve.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},ve.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},ve.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},ve.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},ve.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ve.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},ve.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},ve.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},ve.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},ve.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},ve.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},ve.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},ve.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function cm(i,e,t,s,r,n,a){var o={};return i===void 0||i==="none"?o.datum_type=la:o.datum_type=Eg,e&&(o.datum_params=e.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=hi),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=ci,o.datum_params[3]*=zs,o.datum_params[4]*=zs,o.datum_params[5]*=zs,o.datum_params[6]=o.datum_params[6]/1e6+1)),a&&(o.datum_type=Gr,o.grids=a),o.a=t,o.b=s,o.es=r,o.ep2=n,o}var Bl={};function um(i,e){var t=new DataView(e),s=gm(t),r=mm(t,s);r.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var n=pm(t,r,s),a={header:r,subgrids:n};return Bl[i]=a,a}function dm(i){if(i===void 0)return null;var e=i.split(",");return e.map(fm)}function fm(i){if(i.length===0)return null;var e=i[0]==="@";return e&&(i=i.slice(1)),i==="null"?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:i,mandatory:!e,grid:Bl[i]||null,isNull:!1}}function ji(i){return i/3600*Math.PI/180}function gm(i){var e=i.getInt32(8,!1);return e===11?!1:(e=i.getInt32(8,!0),e!==11&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function mm(i,e){return{nFields:i.getInt32(8,e),nSubgridFields:i.getInt32(24,e),nSubgrids:i.getInt32(40,e),shiftType:ua(i,56,56+8).trim(),fromSemiMajorAxis:i.getFloat64(120,e),fromSemiMinorAxis:i.getFloat64(136,e),toSemiMajorAxis:i.getFloat64(152,e),toSemiMinorAxis:i.getFloat64(168,e)}}function ua(i,e,t){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(e,t)))}function pm(i,e,t){for(var s=176,r=[],n=0;n<e.nSubgrids;n++){var a=_m(i,s,t),o=vm(i,s,a,t),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),h=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[ji(a.lowerLongitude),ji(a.lowerLatitude)],del:[ji(a.longitudeInterval),ji(a.latitudeInterval)],lim:[l,h],count:a.gridNodeCount,cvs:ym(o)})}return r}function ym(i){return i.map(function(e){return[ji(e.longitudeShift),ji(e.latitudeShift)]})}function _m(i,e,t){return{name:ua(i,e+8,e+16).trim(),parent:ua(i,e+24,e+24+8).trim(),lowerLatitude:i.getFloat64(e+72,t),upperLatitude:i.getFloat64(e+88,t),lowerLongitude:i.getFloat64(e+104,t),upperLongitude:i.getFloat64(e+120,t),latitudeInterval:i.getFloat64(e+136,t),longitudeInterval:i.getFloat64(e+152,t),gridNodeCount:i.getInt32(e+168,t)}}function vm(i,e,t,s){for(var r=e+176,n=16,a=[],o=0;o<t.gridNodeCount;o++){var l={latitudeShift:i.getFloat32(r+o*n,s),longitudeShift:i.getFloat32(r+o*n+4,s),latitudeAccuracy:i.getFloat32(r+o*n+8,s),longitudeAccuracy:i.getFloat32(r+o*n+12,s)};a.push(l)}return a}function _t(i,e){if(!(this instanceof _t))return new _t(i);e=e||function(h){if(h)throw h};var t=Xg(i);if(typeof t!="object"){e(i);return}var s=_t.projections.get(t.projName);if(!s){e(i);return}if(t.datumCode&&t.datumCode!=="none"){var r=Yt(ve,t.datumCode);r&&(t.datum_params=t.datum_params||(r.towgs84?r.towgs84.split(","):null),t.ellps=r.ellipse,t.datumName=r.datumName?r.datumName:t.datumCode)}t.k0=t.k0||1,t.axis=t.axis||"enu",t.ellps=t.ellps||"wgs84",t.lat1=t.lat1||t.lat0;var n=hm(t.a,t.b,t.rf,t.ellps,t.sphere),a=lm(n.a,n.b,n.rf,t.R_A),o=dm(t.nadgrids),l=t.datum||cm(t.datumCode,t.datum_params,n.a,n.b,a.es,a.ep2,o);Hl(this,t),Hl(this,s),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=a.es,this.e=a.e,this.ep2=a.ep2,this.datum=l,this.init(),e(null,this)}_t.projections=am,_t.projections.start();function Sm(i,e){return i.datum_type!==e.datum_type||i.a!==e.a||Math.abs(i.es-e.es)>5e-11?!1:i.datum_type===hi?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]:i.datum_type===ci?i.datum_params[0]===e.datum_params[0]&&i.datum_params[1]===e.datum_params[1]&&i.datum_params[2]===e.datum_params[2]&&i.datum_params[3]===e.datum_params[3]&&i.datum_params[4]===e.datum_params[4]&&i.datum_params[5]===e.datum_params[5]&&i.datum_params[6]===e.datum_params[6]:!0}function Ul(i,e,t){var s=i.x,r=i.y,n=i.z?i.z:0,a,o,l,h;if(r<-C&&r>-1.001*C)r=-C;else if(r>C&&r<1.001*C)r=C;else{if(r<-C)return{x:-1/0,y:-1/0,z:i.z};if(r>C)return{x:1/0,y:1/0,z:i.z}}return s>Math.PI&&(s-=2*Math.PI),o=Math.sin(r),h=Math.cos(r),l=o*o,a=t/Math.sqrt(1-e*l),{x:(a+n)*h*Math.cos(s),y:(a+n)*h*Math.sin(s),z:(a*(1-e)+n)*o}}function ql(i,e,t,s){var r=1e-12,n=r*r,a=30,o,l,h,c,u,d,f,g,m,p,y,_,w,L=i.x,E=i.y,A=i.z?i.z:0,Y,V,Ee;if(o=Math.sqrt(L*L+E*E),l=Math.sqrt(L*L+E*E+A*A),o/t<r){if(Y=0,l/t<r)return V=C,Ee=-s,{x:i.x,y:i.y,z:i.z}}else Y=Math.atan2(E,L);h=A/l,c=o/l,u=1/Math.sqrt(1-e*(2-e)*c*c),g=c*(1-e)*u,m=h*u,w=0;do w++,f=t/Math.sqrt(1-e*m*m),Ee=o*g+A*m-f*(1-e*m*m),d=e*f/(f+Ee),u=1/Math.sqrt(1-d*(2-d)*c*c),p=c*(1-d)*u,y=h*u,_=y*g-p*m,g=p,m=y;while(_*_>n&&w<a);return V=Math.atan(y/Math.abs(p)),{x:Y,y:V,z:Ee}}function Mm(i,e,t){if(e===hi)return{x:i.x+t[0],y:i.y+t[1],z:i.z+t[2]};if(e===ci){var s=t[0],r=t[1],n=t[2],a=t[3],o=t[4],l=t[5],h=t[6];return{x:h*(i.x-l*i.y+o*i.z)+s,y:h*(l*i.x+i.y-a*i.z)+r,z:h*(-o*i.x+a*i.y+i.z)+n}}}function Cm(i,e,t){if(e===hi)return{x:i.x-t[0],y:i.y-t[1],z:i.z-t[2]};if(e===ci){var s=t[0],r=t[1],n=t[2],a=t[3],o=t[4],l=t[5],h=t[6],c=(i.x-s)/h,u=(i.y-r)/h,d=(i.z-n)/h;return{x:c+l*u-o*d,y:-l*c+u+a*d,z:o*c-a*u+d}}}function $r(i){return i===hi||i===ci}function xm(i,e,t){if(Sm(i,e)||i.datum_type===la||e.datum_type===la)return t;var s=i.a,r=i.es;if(i.datum_type===Gr){var n=Wl(i,!1,t);if(n!==0)return;s=Nl,r=Dl}var a=e.a,o=e.b,l=e.es;if(e.datum_type===Gr&&(a=Nl,o=Ig,l=Dl),r===l&&s===a&&!$r(i.datum_type)&&!$r(e.datum_type))return t;if(t=Ul(t,r,s),$r(i.datum_type)&&(t=Mm(t,i.datum_type,i.datum_params)),$r(e.datum_type)&&(t=Cm(t,e.datum_type,e.datum_params)),t=ql(t,l,a,o),e.datum_type===Gr){var h=Wl(e,!0,t);if(h!==0)return}return t}function Wl(i,e,t){if(i.grids===null||i.grids.length===0)return console.log("Grid shift grids not found"),-1;for(var s={x:-t.x,y:t.y},r={x:Number.NaN,y:Number.NaN},n=[],a=0;a<i.grids.length;a++){var o=i.grids[a];if(n.push(o.name),o.isNull){r=s;break}if(o.mandatory,o.grid===null){if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1;continue}var l=o.grid.subgrids[0],h=(Math.abs(l.del[1])+Math.abs(l.del[0]))/1e4,c=l.ll[0]-h,u=l.ll[1]-h,d=l.ll[0]+(l.lim[0]-1)*l.del[0]+h,f=l.ll[1]+(l.lim[1]-1)*l.del[1]+h;if(!(u>s.y||c>s.x||f<s.y||d<s.x)&&(r=wm(s,e,l),!isNaN(r.x)))break}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*pt+" "+s.y*pt+" tried: '"+n+"'"),-1):(t.x=-r.x,t.y=r.y,0)}function wm(i,e,t){var s={x:Number.NaN,y:Number.NaN};if(isNaN(i.x))return s;var r={x:i.x,y:i.y};r.x-=t.ll[0],r.y-=t.ll[1],r.x=O(r.x-Math.PI)+Math.PI;var n=Xl(r,t);if(e){if(isNaN(n.x))return s;n.x=r.x-n.x,n.y=r.y-n.y;var a=9,o=1e-12,l,h;do{if(h=Xl(n,t),isNaN(h.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}l={x:r.x-(h.x+n.x),y:r.y-(h.y+n.y)},n.x+=l.x,n.y+=l.y}while(a--&&Math.abs(l.x)>o&&Math.abs(l.y)>o);if(a<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=O(n.x+t.ll[0]),s.y=n.y+t.ll[1]}else isNaN(n.x)||(s.x=i.x+n.x,s.y=i.y+n.y);return s}function Xl(i,e){var t={x:i.x/e.del[0],y:i.y/e.del[1]},s={x:Math.floor(t.x),y:Math.floor(t.y)},r={x:t.x-1*s.x,y:t.y-1*s.y},n={x:Number.NaN,y:Number.NaN},a;if(s.x<0||s.x>=e.lim[0]||s.y<0||s.y>=e.lim[1])return n;a=s.y*e.lim[0]+s.x;var o={x:e.cvs[a][0],y:e.cvs[a][1]};a++;var l={x:e.cvs[a][0],y:e.cvs[a][1]};a+=e.lim[0];var h={x:e.cvs[a][0],y:e.cvs[a][1]};a--;var c={x:e.cvs[a][0],y:e.cvs[a][1]},u=r.x*r.y,d=r.x*(1-r.y),f=(1-r.x)*(1-r.y),g=(1-r.x)*r.y;return n.x=f*o.x+d*l.x+g*c.x+u*h.x,n.y=f*o.y+d*l.y+g*c.y+u*h.y,n}function Yl(i,e,t){var s=t.x,r=t.y,n=t.z||0,a,o,l,h={};for(l=0;l<3;l++)if(!(e&&l===2&&t.z===void 0))switch(l===0?(a=s,"ew".indexOf(i.axis[l])!==-1?o="x":o="y"):l===1?(a=r,"ns".indexOf(i.axis[l])!==-1?o="y":o="x"):(a=n,o="z"),i.axis[l]){case"e":h[o]=a;break;case"w":h[o]=-a;break;case"n":h[o]=a;break;case"s":h[o]=-a;break;case"u":t[o]!==void 0&&(h.z=a);break;case"d":t[o]!==void 0&&(h.z=-a);break;default:return null}return h}function Zl(i){var e={x:i[0],y:i[1]};return i.length>2&&(e.z=i[2]),i.length>3&&(e.m=i[3]),e}function bm(i){Kl(i.x),Kl(i.y)}function Kl(i){if(typeof Number.isFinite=="function"){if(Number.isFinite(i))return;throw new TypeError("coordinates must be finite numbers")}if(typeof i!="number"||i!==i||!isFinite(i))throw new TypeError("coordinates must be finite numbers")}function Om(i,e){return(i.datum.datum_type===hi||i.datum.datum_type===ci)&&e.datumCode!=="WGS84"||(e.datum.datum_type===hi||e.datum.datum_type===ci)&&i.datumCode!=="WGS84"}function Vr(i,e,t,s){var r;if(Array.isArray(t)&&(t=Zl(t)),bm(t),i.datum&&e.datum&&Om(i,e)&&(r=new _t("WGS84"),t=Vr(i,r,t,s),i=r),s&&i.axis!=="enu"&&(t=Yl(i,!1,t)),i.projName==="longlat")t={x:t.x*we,y:t.y*we,z:t.z||0};else if(i.to_meter&&(t={x:t.x*i.to_meter,y:t.y*i.to_meter,z:t.z||0}),t=i.inverse(t),!t)return;if(i.from_greenwich&&(t.x+=i.from_greenwich),t=xm(i.datum,e.datum,t),!!t)return e.from_greenwich&&(t={x:t.x-e.from_greenwich,y:t.y,z:t.z||0}),e.projName==="longlat"?t={x:t.x*pt,y:t.y*pt,z:t.z||0}:(t=e.forward(t),e.to_meter&&(t={x:t.x/e.to_meter,y:t.y/e.to_meter,z:t.z||0})),s&&e.axis!=="enu"?Yl(e,!0,t):t}var Jl=_t("WGS84");function da(i,e,t,s){var r,n,a;return Array.isArray(t)?(r=Vr(i,e,t,s)||{x:NaN,y:NaN},t.length>2?typeof i.name!="undefined"&&i.name==="geocent"||typeof e.name!="undefined"&&e.name==="geocent"?typeof r.z=="number"?[r.x,r.y,r.z].concat(t.splice(3)):[r.x,r.y,t[2]].concat(t.splice(3)):[r.x,r.y].concat(t.splice(2)):[r.x,r.y]):(n=Vr(i,e,t,s),a=Object.keys(t),a.length===2||a.forEach(function(o){if(typeof i.name!="undefined"&&i.name==="geocent"||typeof e.name!="undefined"&&e.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;n[o]=t[o]}),n)}function Ql(i){return i instanceof _t?i:i.oProj?i.oProj:_t(i)}function fe(i,e,t){i=Ql(i);var s=!1,r;return typeof e=="undefined"?(e=i,i=Jl,s=!0):(typeof e.x!="undefined"||Array.isArray(e))&&(t=e,e=i,i=Jl,s=!0),e=Ql(e),t?da(i,e,t):(r={forward:function(n,a){return da(i,e,n,a)},inverse:function(n,a){return da(e,i,n,a)}},s&&(r.oProj=e),r)}var eh=6,th="AJSAJS",ih="AFAFAF",Hi=65,ze=73,tt=79,Bs=86,Us=90,Em={forward:sh,inverse:Im,toPoint:rh};function sh(i,e){return e=e||5,Tm(Pm({lat:i[1],lon:i[0]}),e)}function Im(i){var e=ga(oh(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function rh(i){var e=ga(oh(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function fa(i){return i*(Math.PI/180)}function nh(i){return 180*(i/Math.PI)}function Pm(i){var e=i.lat,t=i.lon,s=6378137,r=.00669438,n=.9996,a,o,l,h,c,u,d,f=fa(e),g=fa(t),m,p;p=Math.floor((t+180)/6)+1,t===180&&(p=60),e>=56&&e<64&&t>=3&&t<12&&(p=32),e>=72&&e<84&&(t>=0&&t<9?p=31:t>=9&&t<21?p=33:t>=21&&t<33?p=35:t>=33&&t<42&&(p=37)),a=(p-1)*6-180+3,m=fa(a),o=r/(1-r),l=s/Math.sqrt(1-r*Math.sin(f)*Math.sin(f)),h=Math.tan(f)*Math.tan(f),c=o*Math.cos(f)*Math.cos(f),u=Math.cos(f)*(g-m),d=s*((1-r/4-3*r*r/64-5*r*r*r/256)*f-(3*r/8+3*r*r/32+45*r*r*r/1024)*Math.sin(2*f)+(15*r*r/256+45*r*r*r/1024)*Math.sin(4*f)-35*r*r*r/3072*Math.sin(6*f));var y=n*l*(u+(1-h+c)*u*u*u/6+(5-18*h+h*h+72*c-58*o)*u*u*u*u*u/120)+5e5,_=n*(d+l*Math.tan(f)*(u*u/2+(5-h+9*c+4*c*c)*u*u*u*u/24+(61-58*h+h*h+600*c-330*o)*u*u*u*u*u*u/720));return e<0&&(_+=1e7),{northing:Math.round(_),easting:Math.round(y),zoneNumber:p,zoneLetter:Lm(e)}}function ga(i){var e=i.northing,t=i.easting,s=i.zoneLetter,r=i.zoneNumber;if(r<0||r>60)return null;var n=.9996,a=6378137,o=.00669438,l,h=(1-Math.sqrt(1-o))/(1+Math.sqrt(1-o)),c,u,d,f,g,m,p,y,_,w=t-5e5,L=e;s<"N"&&(L-=1e7),p=(r-1)*6-180+3,l=o/(1-o),m=L/n,y=m/(a*(1-o/4-3*o*o/64-5*o*o*o/256)),_=y+(3*h/2-27*h*h*h/32)*Math.sin(2*y)+(21*h*h/16-55*h*h*h*h/32)*Math.sin(4*y)+151*h*h*h/96*Math.sin(6*y),c=a/Math.sqrt(1-o*Math.sin(_)*Math.sin(_)),u=Math.tan(_)*Math.tan(_),d=l*Math.cos(_)*Math.cos(_),f=a*(1-o)/Math.pow(1-o*Math.sin(_)*Math.sin(_),1.5),g=w/(c*n);var E=_-c*Math.tan(_)/f*(g*g/2-(5+3*u+10*d-4*d*d-9*l)*g*g*g*g/24+(61+90*u+298*d+45*u*u-252*l-3*d*d)*g*g*g*g*g*g/720);E=nh(E);var A=(g-(1+2*u+d)*g*g*g/6+(5-2*d+28*u-3*d*d+8*l+24*u*u)*g*g*g*g*g/120)/Math.cos(_);A=p+nh(A);var Y;if(i.accuracy){var V=ga({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});Y={top:V.lat,right:V.lon,bottom:E,left:A}}else Y={lat:E,lon:A};return Y}function Lm(i){var e="Z";return 84>=i&&i>=72?e="X":72>i&&i>=64?e="W":64>i&&i>=56?e="V":56>i&&i>=48?e="U":48>i&&i>=40?e="T":40>i&&i>=32?e="S":32>i&&i>=24?e="R":24>i&&i>=16?e="Q":16>i&&i>=8?e="P":8>i&&i>=0?e="N":0>i&&i>=-8?e="M":-8>i&&i>=-16?e="L":-16>i&&i>=-24?e="K":-24>i&&i>=-32?e="J":-32>i&&i>=-40?e="H":-40>i&&i>=-48?e="G":-48>i&&i>=-56?e="F":-56>i&&i>=-64?e="E":-64>i&&i>=-72?e="D":-72>i&&i>=-80&&(e="C"),e}function Tm(i,e){var t="00000"+i.easting,s="00000"+i.northing;return i.zoneNumber+i.zoneLetter+Nm(i.easting,i.northing,i.zoneNumber)+t.substr(t.length-5,e)+s.substr(s.length-5,e)}function Nm(i,e,t){var s=ah(t),r=Math.floor(i/1e5),n=Math.floor(e/1e5)%20;return Dm(r,n,s)}function ah(i){var e=i%eh;return e===0&&(e=eh),e}function Dm(i,e,t){var s=t-1,r=th.charCodeAt(s),n=ih.charCodeAt(s),a=r+i-1,o=n+e,l=!1;a>Us&&(a=a-Us+Hi-1,l=!0),(a===ze||r<ze&&a>ze||(a>ze||r<ze)&&l)&&a++,(a===tt||r<tt&&a>tt||(a>tt||r<tt)&&l)&&(a++,a===ze&&a++),a>Us&&(a=a-Us+Hi-1),o>Bs?(o=o-Bs+Hi-1,l=!0):l=!1,(o===ze||n<ze&&o>ze||(o>ze||n<ze)&&l)&&o++,(o===tt||n<tt&&o>tt||(o>tt||n<tt)&&l)&&(o++,o===ze&&o++),o>Bs&&(o=o-Bs+Hi-1);var h=String.fromCharCode(a)+String.fromCharCode(o);return h}function oh(i){if(i&&i.length===0)throw"MGRSPoint coverting from nothing";for(var e=i.length,t=null,s="",r,n=0;!/[A-Z]/.test(r=i.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+i;s+=r,n++}var a=parseInt(s,10);if(n===0||n+3>e)throw"MGRSPoint bad conversion from: "+i;var o=i.charAt(n++);if(o<="A"||o==="B"||o==="Y"||o>="Z"||o==="I"||o==="O")throw"MGRSPoint zone letter "+o+" not handled: "+i;t=i.substring(n,n+=2);for(var l=ah(a),h=Fm(t.charAt(0),l),c=Am(t.charAt(1),l);c<Rm(o);)c+=2e6;var u=e-n;if(u%2!==0)throw`MGRSPoint has to have an even number
|
2
|
-
of digits after the zone letter and two 100km letters - front
|
3
|
-
half for easting meters, second half for
|
4
|
-
northing meters`+i;var d=u/2,f=0,g=0,m,p,y,_,w;return d>0&&(m=1e5/Math.pow(10,d),p=i.substring(n,n+d),f=parseFloat(p)*m,y=i.substring(n+d),g=parseFloat(y)*m),_=f+h,w=g+c,{easting:_,northing:w,zoneLetter:o,zoneNumber:a,accuracy:m}}function Fm(i,e){for(var t=th.charCodeAt(e-1),s=1e5,r=!1;t!==i.charCodeAt(0);){if(t++,t===ze&&t++,t===tt&&t++,t>Us){if(r)throw"Bad character: "+i;t=Hi,r=!0}s+=1e5}return s}function Am(i,e){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var t=ih.charCodeAt(e-1),s=0,r=!1;t!==i.charCodeAt(0);){if(t++,t===ze&&t++,t===tt&&t++,t>Bs){if(r)throw"Bad character: "+i;t=Hi,r=!0}s+=1e5}return s}function Rm(i){var e;switch(i){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+i}function $i(i,e,t){if(!(this instanceof $i))return new $i(i,e,t);if(Array.isArray(i))this.x=i[0],this.y=i[1],this.z=i[2]||0;else if(typeof i=="object")this.x=i.x,this.y=i.y,this.z=i.z||0;else if(typeof i=="string"&&typeof e=="undefined"){var s=i.split(",");this.x=parseFloat(s[0],10),this.y=parseFloat(s[1],10),this.z=parseFloat(s[2],10)||0}else this.x=i,this.y=e,this.z=t||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}$i.fromMGRS=function(i){return new $i(rh(i))},$i.prototype.toMGRS=function(i){return sh([this.x,this.y],i)};var Gm=1,km=.25,lh=.046875,hh=.01953125,ch=.01068115234375,zm=.75,jm=.46875,Hm=.013020833333333334,$m=.007120768229166667,Vm=.3645833333333333,Bm=.005696614583333333,Um=.3076171875;function uh(i){var e=[];e[0]=Gm-i*(km+i*(lh+i*(hh+i*ch))),e[1]=i*(zm-i*(lh+i*(hh+i*ch)));var t=i*i;return e[2]=t*(jm-i*(Hm+i*$m)),t*=i,e[3]=t*(Vm-i*Bm),e[4]=t*i*Um,e}function Br(i,e,t,s){return t*=e,e*=e,s[0]*i-t*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}var qm=20;function dh(i,e,t){for(var s=1/(1-e),r=i,n=qm;n;--n){var a=Math.sin(r),o=1-e*a*a;if(o=(Br(r,a,Math.cos(r),t)-i)*(o*Math.sqrt(o))*s,r-=o,Math.abs(o)<x)return r}return r}function Wm(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=uh(this.es),this.ml0=Br(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Xm(i){var e=i.x,t=i.y,s=O(e-this.long0),r,n,a,o=Math.sin(t),l=Math.cos(t);if(this.es){var c=l*s,u=Math.pow(c,2),d=this.ep2*Math.pow(l,2),f=Math.pow(d,2),g=Math.abs(l)>x?Math.tan(t):0,m=Math.pow(g,2),p=Math.pow(m,2);r=1-this.es*Math.pow(o,2),c=c/Math.sqrt(r);var y=Br(t,o,l,this.en);n=this.a*(this.k0*c*(1+u/6*(1-m+d+u/20*(5-18*m+p+14*d-58*m*d+u/42*(61+179*p-p*m-479*m)))))+this.x0,a=this.a*(this.k0*(y-this.ml0+o*s*c/2*(1+u/12*(5-m+9*d+4*f+u/30*(61+p-58*m+270*d-330*m*d+u/56*(1385+543*p-p*m-3111*m))))))+this.y0}else{var h=l*Math.sin(s);if(Math.abs(Math.abs(h)-1)<x)return 93;if(n=.5*this.a*this.k0*Math.log((1+h)/(1-h))+this.x0,a=l*Math.cos(s)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>x)return 93;a=0}else a=Math.acos(a);t<0&&(a=-a),a=this.a*this.k0*(a-this.lat0)+this.y0}return i.x=n,i.y=a,i}function Ym(i){var e,t,s,r,n=(i.x-this.x0)*(1/this.a),a=(i.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+a/this.k0,t=dh(e,this.es,this.en),Math.abs(t)<C){var u=Math.sin(t),d=Math.cos(t),f=Math.abs(d)>x?Math.tan(t):0,g=this.ep2*Math.pow(d,2),m=Math.pow(g,2),p=Math.pow(f,2),y=Math.pow(p,2);e=1-this.es*Math.pow(u,2);var _=n*Math.sqrt(e)/this.k0,w=Math.pow(_,2);e=e*f,s=t-e*w/(1-this.es)*.5*(1-w/12*(5+3*p-9*g*p+g-4*m-w/30*(61+90*p-252*g*p+45*y+46*g-w/56*(1385+3633*p+4095*y+1574*y*p)))),r=O(this.long0+_*(1-w/6*(1+2*p+g-w/20*(5+28*p+24*y+8*g*p+6*g-w/42*(61+662*p+1320*y+720*y*p))))/d)}else s=C*$s(a),r=0;else{var o=Math.exp(n/this.k0),l=.5*(o-1/o),h=this.lat0+a/this.k0,c=Math.cos(h);e=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(l,2))),s=Math.asin(e),a<0&&(s=-s),l===0&&c===0?r=0:r=O(Math.atan2(l,c)+this.long0)}return i.x=r,i.y=s,i}var Zm=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Ur={init:Wm,forward:Xm,inverse:Ym,names:Zm};function fh(i){var e=Math.exp(i);return e=(e-1/e)/2,e}function ct(i,e){i=Math.abs(i),e=Math.abs(e);var t=Math.max(i,e),s=Math.min(i,e)/(t||1);return t*Math.sqrt(1+Math.pow(s,2))}function Km(i){var e=1+i,t=e-1;return t===0?i:i*Math.log(e)/t}function Jm(i){var e=Math.abs(i);return e=Km(e*(1+e/(ct(1,e)+1))),i<0?-e:e}function ma(i,e){for(var t=2*Math.cos(2*e),s=i.length-1,r=i[s],n=0,a;--s>=0;)a=-n+t*r+i[s],n=r,r=a;return e+a*Math.sin(2*e)}function Qm(i,e){for(var t=2*Math.cos(e),s=i.length-1,r=i[s],n=0,a;--s>=0;)a=-n+t*r+i[s],n=r,r=a;return Math.sin(e)*a}function ep(i){var e=Math.exp(i);return e=(e+1/e)/2,e}function gh(i,e,t){for(var s=Math.sin(e),r=Math.cos(e),n=fh(t),a=ep(t),o=2*r*a,l=-2*s*n,h=i.length-1,c=i[h],u=0,d=0,f=0,g,m;--h>=0;)g=d,m=u,d=c,u=f,c=-g+o*d-l*u+i[h],f=-m+l*d+o*u;return o=s*a,l=r*n,[o*c-l*f,o*f+l*c]}function tp(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Ur.init.apply(this),this.forward=Ur.forward,this.inverse=Ur.inverse),this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var i=this.es/(1+Math.sqrt(1-this.es)),e=i/(2-i),t=e;this.cgb[0]=e*(2+e*(-2/3+e*(-2+e*(116/45+e*(26/45+e*(-2854/675)))))),this.cbg[0]=e*(-2+e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))),t=t*e,this.cgb[1]=t*(7/3+e*(-8/5+e*(-227/45+e*(2704/315+e*(2323/945))))),this.cbg[1]=t*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),t=t*e,this.cgb[2]=t*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=t*(-26/15+e*(34/21+e*(8/5+e*(-12686/2835)))),t=t*e,this.cgb[3]=t*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=t*(1237/630+e*(-12/5+e*(-24832/14175))),t=t*e,this.cgb[4]=t*(4174/315+e*(-144838/6237)),this.cbg[4]=t*(-734/315+e*(109598/31185)),t=t*e,this.cgb[5]=t*(601676/22275),this.cbg[5]=t*(444337/155925),t=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+t*(1/4+t*(1/64+t/256))),this.utg[0]=e*(-.5+e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=t*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=t*(13/48+e*(-3/5+e*(557/1440+e*(281/630+e*(-1983433/1935360))))),t=t*e,this.utg[2]=t*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=t*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),t=t*e,this.utg[3]=t*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=t*(49561/161280+e*(-179/168+e*(6601661/7257600))),t=t*e,this.utg[4]=t*(-4583/161280+e*(108847/3991680)),this.gtu[4]=t*(34729/80640+e*(-3418889/1995840)),t=t*e,this.utg[5]=t*(-20648693/638668800),this.gtu[5]=t*(212378941/319334400);var s=ma(this.cbg,this.lat0);this.Zb=-this.Qn*(s+Qm(this.gtu,2*s))}function ip(i){var e=O(i.x-this.long0),t=i.y;t=ma(this.cbg,t);var s=Math.sin(t),r=Math.cos(t),n=Math.sin(e),a=Math.cos(e);t=Math.atan2(s,a*r),e=Math.atan2(n*r,ct(s,r*a)),e=Jm(Math.tan(e));var o=gh(this.gtu,2*t,2*e);t=t+o[0],e=e+o[1];var l,h;return Math.abs(e)<=2.623395162778?(l=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*t+this.Zb)+this.y0):(l=1/0,h=1/0),i.x=l,i.y=h,i}function sp(i){var e=(i.x-this.x0)*(1/this.a),t=(i.y-this.y0)*(1/this.a);t=(t-this.Zb)/this.Qn,e=e/this.Qn;var s,r;if(Math.abs(e)<=2.623395162778){var n=gh(this.utg,2*t,2*e);t=t+n[0],e=e+n[1],e=Math.atan(fh(e));var a=Math.sin(t),o=Math.cos(t),l=Math.sin(e),h=Math.cos(e);t=Math.atan2(a*h,ct(l,h*o)),e=Math.atan2(l,h*o),s=O(e+this.long0),r=ma(this.cgb,t)}else s=1/0,r=1/0;return i.x=s,i.y=r,i}var rp=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],qr={init:tp,forward:ip,inverse:sp,names:rp};function np(i,e){if(i===void 0){if(i=Math.floor((O(e)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var ap="etmerc";function op(){var i=np(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*we,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,qr.init.apply(this),this.forward=qr.forward,this.inverse=qr.inverse}var lp=["Universal Transverse Mercator System","utm"],hp={init:op,names:lp,dependsOn:ap};function pa(i,e){return Math.pow((1-i)/(1+i),e)}var cp=20;function up(){var i=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*i*i),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(i/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+H)/(Math.pow(Math.tan(.5*this.lat0+H),this.C)*pa(this.e*i,this.ratexp))}function dp(i){var e=i.x,t=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*t+H),this.C)*pa(this.e*Math.sin(t),this.ratexp))-C,i.x=this.C*e,i}function fp(i){for(var e=1e-14,t=i.x/this.C,s=i.y,r=Math.pow(Math.tan(.5*s+H)/this.K,1/this.C),n=cp;n>0&&(s=2*Math.atan(r*pa(this.e*Math.sin(i.y),-.5*this.e))-C,!(Math.abs(s-i.y)<e));--n)i.y=s;return n?(i.x=t,i.y=s,i):null}var gp=["gauss"],ya={init:up,forward:dp,inverse:fp,names:gp};function mp(){ya.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function pp(i){var e,t,s,r;return i.x=O(i.x-this.long0),ya.forward.apply(this,[i]),e=Math.sin(i.y),t=Math.cos(i.y),s=Math.cos(i.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*t*s),i.x=r*t*Math.sin(i.x),i.y=r*(this.cosc0*e-this.sinc0*t*s),i.x=this.a*i.x+this.x0,i.y=this.a*i.y+this.y0,i}function yp(i){var e,t,s,r,n;if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,n=Math.sqrt(i.x*i.x+i.y*i.y)){var a=2*Math.atan2(n,this.R2);e=Math.sin(a),t=Math.cos(a),r=Math.asin(t*this.sinc0+i.y*e*this.cosc0/n),s=Math.atan2(i.x*e,n*this.cosc0*t-i.y*this.sinc0*e)}else r=this.phic0,s=0;return i.x=s,i.y=r,ya.inverse.apply(this,[i]),i.x=O(i.x+this.long0),i}var _p=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],vp={init:mp,forward:pp,inverse:yp,names:_p};function Sp(i,e,t){return e*=t,Math.tan(.5*(C+i))*Math.pow((1-e)/(1+e),.5*t)}function Mp(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=x&&(this.k0=.5*(1+$s(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=x&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=x&&(this.k0=.5*this.cons*yt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/ht(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=yt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-C,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Cp(i){var e=i.x,t=i.y,s=Math.sin(t),r=Math.cos(t),n,a,o,l,h,c,u=O(e-this.long0);return Math.abs(Math.abs(e-this.long0)-Math.PI)<=x&&Math.abs(t+this.lat0)<=x?(i.x=NaN,i.y=NaN,i):this.sphere?(n=2*this.k0/(1+this.sinlat0*s+this.coslat0*r*Math.cos(u)),i.x=this.a*n*r*Math.sin(u)+this.x0,i.y=this.a*n*(this.coslat0*s-this.sinlat0*r*Math.cos(u))+this.y0,i):(a=2*Math.atan(this.ssfn_(t,s,this.e))-C,l=Math.cos(a),o=Math.sin(a),Math.abs(this.coslat0)<=x?(h=ht(this.e,t*this.con,this.con*s),c=2*this.a*this.k0*h/this.cons,i.x=this.x0+c*Math.sin(e-this.long0),i.y=this.y0-this.con*c*Math.cos(e-this.long0),i):(Math.abs(this.sinlat0)<x?(n=2*this.a*this.k0/(1+l*Math.cos(u)),i.y=n*o):(n=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*o+this.cosX0*l*Math.cos(u))),i.y=n*(this.cosX0*o-this.sinX0*l*Math.cos(u))+this.y0),i.x=n*l*Math.sin(u)+this.x0,i))}function xp(i){i.x-=this.x0,i.y-=this.y0;var e,t,s,r,n,a=Math.sqrt(i.x*i.x+i.y*i.y);if(this.sphere){var o=2*Math.atan(a/(2*this.a*this.k0));return e=this.long0,t=this.lat0,a<=x?(i.x=e,i.y=t,i):(t=Math.asin(Math.cos(o)*this.sinlat0+i.y*Math.sin(o)*this.coslat0/a),Math.abs(this.coslat0)<x?this.lat0>0?e=O(this.long0+Math.atan2(i.x,-1*i.y)):e=O(this.long0+Math.atan2(i.x,i.y)):e=O(this.long0+Math.atan2(i.x*Math.sin(o),a*this.coslat0*Math.cos(o)-i.y*this.sinlat0*Math.sin(o))),i.x=e,i.y=t,i)}else if(Math.abs(this.coslat0)<=x){if(a<=x)return t=this.lat0,e=this.long0,i.x=e,i.y=t,i;i.x*=this.con,i.y*=this.con,s=a*this.cons/(2*this.a*this.k0),t=this.con*Vs(this.e,s),e=this.con*O(this.con*this.long0+Math.atan2(i.x,-1*i.y))}else r=2*Math.atan(a*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,a<=x?n=this.X0:(n=Math.asin(Math.cos(r)*this.sinX0+i.y*Math.sin(r)*this.cosX0/a),e=O(this.long0+Math.atan2(i.x*Math.sin(r),a*this.cosX0*Math.cos(r)-i.y*this.sinX0*Math.sin(r)))),t=-1*Vs(this.e,Math.tan(.5*(C+n)));return i.x=e,i.y=t,i}var wp=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],bp={init:Mp,forward:Cp,inverse:xp,names:wp,ssfn_:Sp};function Op(){var i=this.lat0;this.lambda0=this.long0;var e=Math.sin(i),t=this.a,s=this.rf,r=1/s,n=2*r-Math.pow(r,2),a=this.e=Math.sqrt(n);this.R=this.k0*t*Math.sqrt(1-n)/(1-n*Math.pow(e,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(i),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+i/2)),h=Math.log((1+a*e)/(1-a*e));this.K=o-this.alpha*l+this.alpha*a/2*h}function Ep(i){var e=Math.log(Math.tan(Math.PI/4-i.y/2)),t=this.e/2*Math.log((1+this.e*Math.sin(i.y))/(1-this.e*Math.sin(i.y))),s=-this.alpha*(e+t)+this.K,r=2*(Math.atan(Math.exp(s))-Math.PI/4),n=this.alpha*(i.x-this.lambda0),a=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(n))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(n));return i.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,i.x=this.R*a+this.x0,i}function Ip(i){for(var e=i.x-this.x0,t=i.y-this.y0,s=e/this.R,r=2*(Math.atan(Math.exp(t/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(s)),a=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+a/this.alpha,l=0,h=n,c=-1e3,u=0;Math.abs(h-c)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),c=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return i.x=o,i.y=h,i}var Pp=["somerc"],Lp={init:Op,forward:Ep,inverse:Ip,names:Pp},Vi=1e-7;function Tp(i){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],t=typeof i.PROJECTION=="object"?Object.keys(i.PROJECTION)[0]:i.PROJECTION;return"no_uoff"in i||"no_off"in i||e.indexOf(t)!==-1}function Np(){var i,e,t,s,r,n,a,o,l,h,c=0,u,d=0,f=0,g=0,m=0,p=0,y=0;this.no_off=Tp(this),this.no_rot="no_rot"in this;var _=!1;"alpha"in this&&(_=!0);var w=!1;if("rectified_grid_angle"in this&&(w=!0),_&&(y=this.alpha),w&&(c=this.rectified_grid_angle*we),_||w)d=this.longc;else if(f=this.long1,m=this.lat1,g=this.long2,p=this.lat2,Math.abs(m-p)<=Vi||(i=Math.abs(m))<=Vi||Math.abs(i-C)<=Vi||Math.abs(Math.abs(this.lat0)-C)<=Vi||Math.abs(Math.abs(p)-C)<=Vi)throw new Error;var L=1-this.es;e=Math.sqrt(L),Math.abs(this.lat0)>x?(o=Math.sin(this.lat0),t=Math.cos(this.lat0),i=1-this.es*o*o,this.B=t*t,this.B=Math.sqrt(1+this.es*this.B*this.B/L),this.A=this.B*this.k0*e/i,s=this.B*e/(t*Math.sqrt(i)),r=s*s-1,r<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=s,this.E*=Math.pow(ht(this.e,this.lat0,o),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=r=1),_||w?(_?(u=Math.asin(Math.sin(y)/s),w||(c=y)):(u=c,y=Math.asin(s*Math.sin(u))),this.lam0=d-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(n=Math.pow(ht(this.e,m,Math.sin(m)),this.B),a=Math.pow(ht(this.e,p,Math.sin(p)),this.B),r=this.E/n,l=(a-n)/(a+n),h=this.E*this.E,h=(h-a*n)/(h+a*n),i=f-g,i<-Math.pi?g-=js:i>Math.pi&&(g+=js),this.lam0=O(.5*(f+g)-Math.atan(h*Math.tan(.5*this.B*(f-g))/l)/this.B),u=Math.atan(2*Math.sin(this.B*O(f-this.lam0))/(r-1/r)),c=y=Math.asin(s*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(c),this.cosrot=Math.cos(c),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A*this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(y))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(H-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(H+r))}function Dp(i){var e={},t,s,r,n,a,o,l,h;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-C)>x){if(a=this.E/Math.pow(ht(this.e,i.y,Math.sin(i.y)),this.B),o=1/a,t=.5*(a-o),s=.5*(a+o),n=Math.sin(this.B*i.x),r=(t*this.singam-n*this.cosgam)/s,Math.abs(Math.abs(r)-1)<x)throw new Error;h=.5*this.ArB*Math.log((1-r)/(1+r)),o=Math.cos(this.B*i.x),Math.abs(o)<Vi?l=this.A*i.x:l=this.ArB*Math.atan2(t*this.cosgam+n*this.singam,o)}else h=i.y>0?this.v_pole_n:this.v_pole_s,l=this.ArB*i.y;return this.no_rot?(e.x=l,e.y=h):(l-=this.u_0,e.x=h*this.cosrot+l*this.sinrot,e.y=l*this.cosrot-h*this.sinrot),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Fp(i){var e,t,s,r,n,a,o,l={};if(i.x=(i.x-this.x0)*(1/this.a),i.y=(i.y-this.y0)*(1/this.a),this.no_rot?(t=i.y,e=i.x):(t=i.x*this.cosrot-i.y*this.sinrot,e=i.y*this.cosrot+i.x*this.sinrot+this.u_0),s=Math.exp(-this.BrA*t),r=.5*(s-1/s),n=.5*(s+1/s),a=Math.sin(this.BrA*e),o=(a*this.cosgam+r*this.singam)/n,Math.abs(Math.abs(o)-1)<x)l.x=0,l.y=o<0?-C:C;else{if(l.y=this.E/Math.sqrt((1+o)/(1-o)),l.y=Vs(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-a*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l}var Ap=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],Rp={init:Np,forward:Dp,inverse:Fp,names:Ap};function Gp(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<x)){var i=this.b/this.a;this.e=Math.sqrt(1-i*i);var e=Math.sin(this.lat1),t=Math.cos(this.lat1),s=yt(this.e,e,t),r=ht(this.e,this.lat1,e),n=Math.sin(this.lat2),a=Math.cos(this.lat2),o=yt(this.e,n,a),l=ht(this.e,this.lat2,n),h=ht(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>x?this.ns=Math.log(s/o)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function kp(i){var e=i.x,t=i.y;Math.abs(2*Math.abs(t)-Math.PI)<=x&&(t=$s(t)*(C-2*x));var s=Math.abs(Math.abs(t)-C),r,n;if(s>x)r=ht(this.e,t,Math.sin(t)),n=this.a*this.f0*Math.pow(r,this.ns);else{if(s=t*this.ns,s<=0)return null;n=0}var a=this.ns*O(e-this.long0);return i.x=this.k0*(n*Math.sin(a))+this.x0,i.y=this.k0*(this.rh-n*Math.cos(a))+this.y0,i}function zp(i){var e,t,s,r,n,a=(i.x-this.x0)/this.k0,o=this.rh-(i.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(a*a+o*o),t=1):(e=-Math.sqrt(a*a+o*o),t=-1);var l=0;if(e!==0&&(l=Math.atan2(t*a,t*o)),e!==0||this.ns>0){if(t=1/this.ns,s=Math.pow(e/(this.a*this.f0),t),r=Vs(this.e,s),r===-9999)return null}else r=-C;return n=O(l/this.ns+this.long0),i.x=n,i.y=r,i}var jp=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],Hp={init:Gp,forward:kp,inverse:zp,names:jp};function $p(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Vp(i){var e,t,s,r,n,a,o,l=i.x,h=i.y,c=O(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),t=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),s=-c*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(t)+Math.sin(this.ad)*Math.cos(t)*Math.cos(s)),n=Math.asin(Math.cos(t)*Math.sin(s)/Math.cos(r)),a=this.n*n,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),i.y=o*Math.cos(a)/1,i.x=o*Math.sin(a)/1,this.czech||(i.y*=-1,i.x*=-1),i}function Bp(i){var e,t,s,r,n,a,o,l,h=i.x;i.x=i.y,i.y=h,this.czech||(i.y*=-1,i.x*=-1),a=Math.sqrt(i.x*i.x+i.y*i.y),n=Math.atan2(i.y,i.x),r=n/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(r)),t=Math.asin(Math.cos(s)*Math.sin(r)/Math.cos(e)),i.x=this.long0-t/this.alfa,o=e,l=0;var c=0;do i.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-i.y)<1e-10&&(l=1),o=i.y,c+=1;while(l===0&&c<15);return c>=15?null:i}var Up=["Krovak","krovak"],qp={init:$p,forward:Vp,inverse:Bp,names:Up};function Fe(i,e,t,s,r){return i*r-e*Math.sin(2*r)+t*Math.sin(4*r)-s*Math.sin(6*r)}function qs(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function Ws(i){return .375*i*(1+.25*i*(1+.46875*i))}function Xs(i){return .05859375*i*i*(1+.75*i)}function Ys(i){return i*i*i*(35/3072)}function Bi(i,e,t){var s=e*t;return i/Math.sqrt(1-s*s)}function Ui(i){return Math.abs(i)<C?i:i-$s(i)*Math.PI}function Wr(i,e,t,s,r){var n,a;n=i/e;for(var o=0;o<15;o++)if(a=(i-(e*n-t*Math.sin(2*n)+s*Math.sin(4*n)-r*Math.sin(6*n)))/(e-2*t*Math.cos(2*n)+4*s*Math.cos(4*n)-6*r*Math.cos(6*n)),n+=a,Math.abs(a)<=1e-10)return n;return NaN}function Wp(){this.sphere||(this.e0=qs(this.es),this.e1=Ws(this.es),this.e2=Xs(this.es),this.e3=Ys(this.es),this.ml0=this.a*Fe(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Xp(i){var e,t,s=i.x,r=i.y;if(s=O(s-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(s)),t=this.a*(Math.atan2(Math.tan(r),Math.cos(s))-this.lat0);else{var n=Math.sin(r),a=Math.cos(r),o=Bi(this.a,this.e,n),l=Math.tan(r)*Math.tan(r),h=s*Math.cos(r),c=h*h,u=this.es*a*a/(1-this.es),d=this.a*Fe(this.e0,this.e1,this.e2,this.e3,r);e=o*h*(1-c*l*(1/6-(8-l+8*u)*c/120)),t=d-this.ml0+o*n/a*c*(.5+(5-l+6*u)*c/24)}return i.x=e+this.x0,i.y=t+this.y0,i}function Yp(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,s,r;if(this.sphere){var n=t+this.lat0;s=Math.asin(Math.sin(n)*Math.cos(e)),r=Math.atan2(Math.tan(e),Math.cos(n))}else{var a=this.ml0/this.a+t,o=Wr(a,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-C)<=x)return i.x=this.long0,i.y=C,t<0&&(i.y*=-1),i;var l=Bi(this.a,this.e,Math.sin(o)),h=l*l*l/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(o),2),u=e*this.a/l,d=u*u;s=o-l*Math.tan(o)/h*u*u*(.5-(1+3*c)*u*u/24),r=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(o)}return i.x=O(r+this.long0),i.y=Ui(s),i}var Zp=["Cassini","Cassini_Soldner","cass"],Kp={init:Wp,forward:Xp,inverse:Yp,names:Zp};function Zt(i,e){var t;return i>1e-7?(t=i*e,(1-i*i)*(e/(1-t*t)-.5/i*Math.log((1-t)/(1+t)))):2*e}var Jp=1,Qp=2,ey=3,ty=4;function iy(){var i=Math.abs(this.lat0);if(Math.abs(i-C)<x?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(i)<x?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var e;switch(this.qp=Zt(this.e,1),this.mmf=.5/(1-this.es),this.apa=uy(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=Zt(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function sy(i){var e,t,s,r,n,a,o,l,h,c,u=i.x,d=i.y;if(u=O(u-this.long0),this.sphere){if(n=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t=this.mode===this.EQUIT?1+c*s:1+this.sinph0*n+this.cosph0*c*s,t<=x)return null;t=Math.sqrt(2/t),e=t*c*Math.sin(u),t*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<x)return null;t=H-d*.5,t=2*(this.mode===this.S_POLE?Math.cos(t):Math.sin(t)),e=t*Math.sin(u),t*=s}}else{switch(o=0,l=0,h=0,s=Math.cos(u),r=Math.sin(u),n=Math.sin(d),a=Zt(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=a/this.qp,l=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:h=1+this.sinb1*o+this.cosb1*l*s;break;case this.EQUIT:h=1+l*s;break;case this.N_POLE:h=C+d,a=this.qp-a;break;case this.S_POLE:h=d-C,a=this.qp+a;break}if(Math.abs(h)<x)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),this.mode===this.OBLIQ?t=this.ymf*h*(this.cosb1*o-this.sinb1*l*s):t=(h=Math.sqrt(2/(1+l*s)))*o*this.ymf,e=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:a>=0?(e=(h=Math.sqrt(a))*r,t=s*(this.mode===this.S_POLE?h:-h)):e=t=0;break}}return i.x=this.a*e+this.x0,i.y=this.a*t+this.y0,i}function ry(i){i.x-=this.x0,i.y-=this.y0;var e=i.x/this.a,t=i.y/this.a,s,r,n,a,o,l,h;if(this.sphere){var c=0,u,d=0;if(u=Math.sqrt(e*e+t*t),r=u*.5,r>1)return null;switch(r=2*Math.asin(r),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(r),c=Math.cos(r)),this.mode){case this.EQUIT:r=Math.abs(u)<=x?0:Math.asin(t*d/u),e*=d,t=c*u;break;case this.OBLIQ:r=Math.abs(u)<=x?this.lat0:Math.asin(c*this.sinph0+t*d*this.cosph0/u),e*=d*this.cosph0,t=(c-Math.sin(r)*this.sinph0)*u;break;case this.N_POLE:t=-t,r=C-r;break;case this.S_POLE:r-=C;break}s=t===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(e,t)}else{if(h=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(e/=this.dd,t*=this.dd,l=Math.sqrt(e*e+t*t),l<x)return i.x=this.long0,i.y=this.lat0,i;a=2*Math.asin(.5*l/this.rq),n=Math.cos(a),e*=a=Math.sin(a),this.mode===this.OBLIQ?(h=n*this.sinb1+t*a*this.cosb1/l,o=this.qp*h,t=l*this.cosb1*n-t*this.sinb1*a):(h=t*a/l,o=this.qp*h,t=l*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(t=-t),o=e*e+t*t,!o)return i.x=this.long0,i.y=this.lat0,i;h=1-o/this.qp,this.mode===this.S_POLE&&(h=-h)}s=Math.atan2(e,t),r=dy(Math.asin(h),this.apa)}return i.x=O(this.long0+s),i.y=r,i}var ny=.3333333333333333,ay=.17222222222222222,oy=.10257936507936508,ly=.06388888888888888,hy=.0664021164021164,cy=.016415012942191543;function uy(i){var e,t=[];return t[0]=i*ny,e=i*i,t[0]+=e*ay,t[1]=e*ly,e*=i,t[0]+=e*oy,t[1]+=e*hy,t[2]=e*cy,t}function dy(i,e){var t=i+i;return i+e[0]*Math.sin(t)+e[1]*Math.sin(t+t)+e[2]*Math.sin(t+t+t)}var fy=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],gy={init:iy,forward:sy,inverse:ry,names:fy,S_POLE:Jp,N_POLE:Qp,EQUIT:ey,OBLIQ:ty};function Kt(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function my(){Math.abs(this.lat1+this.lat2)<x||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=yt(this.e3,this.sin_po,this.cos_po),this.qs1=Zt(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=yt(this.e3,this.sin_po,this.cos_po),this.qs2=Zt(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Zt(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>x?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function py(i){var e=i.x,t=i.y;this.sin_phi=Math.sin(t),this.cos_phi=Math.cos(t);var s=Zt(this.e3,this.sin_phi,this.cos_phi),r=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,n=this.ns0*O(e-this.long0),a=r*Math.sin(n)+this.x0,o=this.rh-r*Math.cos(n)+this.y0;return i.x=a,i.y=o,i}function yy(i){var e,t,s,r,n,a;return i.x-=this.x0,i.y=this.rh-i.y+this.y0,this.ns0>=0?(e=Math.sqrt(i.x*i.x+i.y*i.y),s=1):(e=-Math.sqrt(i.x*i.x+i.y*i.y),s=-1),r=0,e!==0&&(r=Math.atan2(s*i.x,s*i.y)),s=e*this.ns0/this.a,this.sphere?a=Math.asin((this.c-s*s)/(2*this.ns0)):(t=(this.c-s*s)/this.ns0,a=this.phi1z(this.e3,t)),n=O(r/this.ns0+this.long0),i.x=n,i.y=a,i}function _y(i,e){var t,s,r,n,a,o=Kt(.5*e);if(i<x)return o;for(var l=i*i,h=1;h<=25;h++)if(t=Math.sin(o),s=Math.cos(o),r=i*t,n=1-r*r,a=.5*n*n/s*(e/(1-l)-t/n+.5/i*Math.log((1-r)/(1+r))),o=o+a,Math.abs(a)<=1e-7)return o;return null}var vy=["Albers_Conic_Equal_Area","Albers","aea"],Sy={init:my,forward:py,inverse:yy,names:vy,phi1z:_y};function My(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Cy(i){var e,t,s,r,n,a,o,l,h=i.x,c=i.y;return s=O(h-this.long0),e=Math.sin(c),t=Math.cos(c),r=Math.cos(s),a=this.sin_p14*e+this.cos_p14*t*r,n=1,a>0||Math.abs(a)<=x?(o=this.x0+this.a*n*t*Math.sin(s)/a,l=this.y0+this.a*n*(this.cos_p14*e-this.sin_p14*t*r)/a):(o=this.x0+this.infinity_dist*t*Math.sin(s),l=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*t*r)),i.x=o,i.y=l,i}function xy(i){var e,t,s,r,n,a;return i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,i.x/=this.k0,i.y/=this.k0,(e=Math.sqrt(i.x*i.x+i.y*i.y))?(r=Math.atan2(e,this.rc),t=Math.sin(r),s=Math.cos(r),a=Kt(s*this.sin_p14+i.y*t*this.cos_p14/e),n=Math.atan2(i.x*t,e*this.cos_p14*s-i.y*this.sin_p14*t),n=O(this.long0+n)):(a=this.phic0,n=0),i.x=n,i.y=a,i}var wy=["gnom"],by={init:My,forward:Cy,inverse:xy,names:wy};function Oy(i,e){var t=1-(1-i*i)/(2*i)*Math.log((1-i)/(1+i));if(Math.abs(Math.abs(e)-t)<1e-6)return e<0?-1*C:C;for(var s=Math.asin(.5*e),r,n,a,o,l=0;l<30;l++)if(n=Math.sin(s),a=Math.cos(s),o=i*n,r=Math.pow(1-o*o,2)/(2*a)*(e/(1-i*i)-n/(1-o*o)+.5/i*Math.log((1-o)/(1+o))),s+=r,Math.abs(r)<=1e-10)return s;return NaN}function Ey(){this.sphere||(this.k0=yt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Iy(i){var e=i.x,t=i.y,s,r,n=O(e-this.long0);if(this.sphere)s=this.x0+this.a*n*Math.cos(this.lat_ts),r=this.y0+this.a*Math.sin(t)/Math.cos(this.lat_ts);else{var a=Zt(this.e,Math.sin(t));s=this.x0+this.a*this.k0*n,r=this.y0+this.a*a*.5/this.k0}return i.x=s,i.y=r,i}function Py(i){i.x-=this.x0,i.y-=this.y0;var e,t;return this.sphere?(e=O(this.long0+i.x/this.a/Math.cos(this.lat_ts)),t=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(t=Oy(this.e,2*i.y*this.k0/this.a),e=O(this.long0+i.x/(this.a*this.k0))),i.x=e,i.y=t,i}var Ly=["cea"],Ty={init:Ey,forward:Iy,inverse:Py,names:Ly};function Ny(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function Dy(i){var e=i.x,t=i.y,s=O(e-this.long0),r=Ui(t-this.lat0);return i.x=this.x0+this.a*s*this.rc,i.y=this.y0+this.a*r,i}function Fy(i){var e=i.x,t=i.y;return i.x=O(this.long0+(e-this.x0)/(this.a*this.rc)),i.y=Ui(this.lat0+(t-this.y0)/this.a),i}var Ay=["Equirectangular","Equidistant_Cylindrical","eqc"],Ry={init:Ny,forward:Dy,inverse:Fy,names:Ay},mh=20;function Gy(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=qs(this.es),this.e1=Ws(this.es),this.e2=Xs(this.es),this.e3=Ys(this.es),this.ml0=this.a*Fe(this.e0,this.e1,this.e2,this.e3,this.lat0)}function ky(i){var e=i.x,t=i.y,s,r,n,a=O(e-this.long0);if(n=a*Math.sin(t),this.sphere)Math.abs(t)<=x?(s=this.a*a,r=-1*this.a*this.lat0):(s=this.a*Math.sin(n)/Math.tan(t),r=this.a*(Ui(t-this.lat0)+(1-Math.cos(n))/Math.tan(t)));else if(Math.abs(t)<=x)s=this.a*a,r=-1*this.ml0;else{var o=Bi(this.a,this.e,Math.sin(t))/Math.tan(t);s=o*Math.sin(n),r=this.a*Fe(this.e0,this.e1,this.e2,this.e3,t)-this.ml0+o*(1-Math.cos(n))}return i.x=s+this.x0,i.y=r+this.y0,i}function zy(i){var e,t,s,r,n,a,o,l,h;if(s=i.x-this.x0,r=i.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=x)e=O(s/this.a+this.long0),t=0;else{a=this.lat0+r/this.a,o=s*s/this.a/this.a+a*a,l=a;var c;for(n=mh;n;--n)if(c=Math.tan(l),h=-1*(a*(l*c+1)-l-.5*(l*l+o)*c)/((l-a)/c-1),l+=h,Math.abs(h)<=x){t=l;break}e=O(this.long0+Math.asin(s*Math.tan(l)/this.a)/Math.sin(t))}else if(Math.abs(r+this.ml0)<=x)t=0,e=O(this.long0+s/this.a);else{a=(this.ml0+r)/this.a,o=s*s/this.a/this.a+a*a,l=a;var u,d,f,g,m;for(n=mh;n;--n)if(m=this.e*Math.sin(l),u=Math.sqrt(1-m*m)*Math.tan(l),d=this.a*Fe(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),g=d/this.a,h=(a*(u*g+1)-g-.5*u*(g*g+o))/(this.es*Math.sin(2*l)*(g*g+o-2*a*g)/(4*u)+(a-g)*(u*f-2/Math.sin(2*l))-f),l-=h,Math.abs(h)<=x){t=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(t),2))*Math.tan(t),e=O(this.long0+Math.asin(s*u/this.a)/Math.sin(t))}return i.x=e,i.y=t,i}var jy=["Polyconic","poly"],Hy={init:Gy,forward:ky,inverse:zy,names:jy};function $y(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function Vy(i){var e,t=i.x,s=i.y,r=s-this.lat0,n=t-this.long0,a=r/zs*1e-5,o=n,l=1,h=0;for(e=1;e<=10;e++)l=l*a,h=h+this.A[e]*l;var c=h,u=o,d=1,f=0,g,m,p=0,y=0;for(e=1;e<=6;e++)g=d*c-f*u,m=f*c+d*u,d=g,f=m,p=p+this.B_re[e]*d-this.B_im[e]*f,y=y+this.B_im[e]*d+this.B_re[e]*f;return i.x=y*this.a+this.x0,i.y=p*this.a+this.y0,i}function By(i){var e,t=i.x,s=i.y,r=t-this.x0,n=s-this.y0,a=n/this.a,o=r/this.a,l=1,h=0,c,u,d=0,f=0;for(e=1;e<=6;e++)c=l*a-h*o,u=h*a+l*o,l=c,h=u,d=d+this.C_re[e]*l-this.C_im[e]*h,f=f+this.C_im[e]*l+this.C_re[e]*h;for(var g=0;g<this.iterations;g++){var m=d,p=f,y,_,w=a,L=o;for(e=2;e<=6;e++)y=m*d-p*f,_=p*d+m*f,m=y,p=_,w=w+(e-1)*(this.B_re[e]*m-this.B_im[e]*p),L=L+(e-1)*(this.B_im[e]*m+this.B_re[e]*p);m=1,p=0;var E=this.B_re[1],A=this.B_im[1];for(e=2;e<=6;e++)y=m*d-p*f,_=p*d+m*f,m=y,p=_,E=E+e*(this.B_re[e]*m-this.B_im[e]*p),A=A+e*(this.B_im[e]*m+this.B_re[e]*p);var Y=E*E+A*A;d=(w*E+L*A)/Y,f=(L*E-w*A)/Y}var V=d,Ee=f,qe=1,It=0;for(e=1;e<=9;e++)qe=qe*V,It=It+this.D[e]*qe;var wr=this.lat0+It*zs*1e5,Id=this.long0+Ee;return i.x=Id,i.y=wr,i}var Uy=["New_Zealand_Map_Grid","nzmg"],qy={init:$y,forward:Vy,inverse:By,names:Uy};function Wy(){}function Xy(i){var e=i.x,t=i.y,s=O(e-this.long0),r=this.x0+this.a*s,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+t/2.5))*1.25;return i.x=r,i.y=n,i}function Yy(i){i.x-=this.x0,i.y-=this.y0;var e=O(this.long0+i.x/this.a),t=2.5*(Math.atan(Math.exp(.8*i.y/this.a))-Math.PI/4);return i.x=e,i.y=t,i}var Zy=["Miller_Cylindrical","mill"],Ky={init:Wy,forward:Xy,inverse:Yy,names:Zy},Jy=20;function Qy(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=uh(this.es)}function e0(i){var e,t,s=i.x,r=i.y;if(s=O(s-this.long0),this.sphere){if(!this.m)r=this.n!==1?Math.asin(this.n*Math.sin(r)):r;else for(var n=this.n*Math.sin(r),a=Jy;a;--a){var o=(this.m*r+Math.sin(r)-n)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<x)break}e=this.a*this.C_x*s*(this.m+Math.cos(r)),t=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);t=this.a*Br(r,l,h,this.en),e=this.a*s*h/Math.sqrt(1-this.es*l*l)}return i.x=e,i.y=t,i}function t0(i){var e,t,s,r;return i.x-=this.x0,s=i.x/this.a,i.y-=this.y0,e=i.y/this.a,this.sphere?(e/=this.C_y,s=s/(this.C_x*(this.m+Math.cos(e))),this.m?e=Kt((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=Kt(Math.sin(e)/this.n)),s=O(s+this.long0),e=Ui(e)):(e=dh(i.y/this.a,this.es,this.en),r=Math.abs(e),r<C?(r=Math.sin(e),t=this.long0+i.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(e)),s=O(t)):r-x<C&&(s=this.long0)),i.x=s,i.y=e,i}var i0=["Sinusoidal","sinu"],s0={init:Qy,forward:e0,inverse:t0,names:i0};function r0(){}function n0(i){for(var e=i.x,t=i.y,s=O(e-this.long0),r=t,n=Math.PI*Math.sin(t);;){var a=-(r+Math.sin(r)-n)/(1+Math.cos(r));if(r+=a,Math.abs(a)<x)break}r/=2,Math.PI/2-Math.abs(t)<x&&(s=0);var o=.900316316158*this.a*s*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return i.x=o,i.y=l,i}function a0(i){var e,t;i.x-=this.x0,i.y-=this.y0,t=i.y/(1.4142135623731*this.a),Math.abs(t)>.999999999999&&(t=.999999999999),e=Math.asin(t);var s=O(this.long0+i.x/(.900316316158*this.a*Math.cos(e)));s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),t=(2*e+Math.sin(2*e))/Math.PI,Math.abs(t)>1&&(t=1);var r=Math.asin(t);return i.x=s,i.y=r,i}var o0=["Mollweide","moll"],l0={init:r0,forward:n0,inverse:a0,names:o0};function h0(){Math.abs(this.lat1+this.lat2)<x||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=qs(this.es),this.e1=Ws(this.es),this.e2=Xs(this.es),this.e3=Ys(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=yt(this.e,this.sinphi,this.cosphi),this.ml1=Fe(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<x?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=yt(this.e,this.sinphi,this.cosphi),this.ml2=Fe(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Fe(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function c0(i){var e=i.x,t=i.y,s;if(this.sphere)s=this.a*(this.g-t);else{var r=Fe(this.e0,this.e1,this.e2,this.e3,t);s=this.a*(this.g-r)}var n=this.ns*O(e-this.long0),a=this.x0+s*Math.sin(n),o=this.y0+this.rh-s*Math.cos(n);return i.x=a,i.y=o,i}function u0(i){i.x-=this.x0,i.y=this.rh-i.y+this.y0;var e,t,s,r;this.ns>=0?(t=Math.sqrt(i.x*i.x+i.y*i.y),e=1):(t=-Math.sqrt(i.x*i.x+i.y*i.y),e=-1);var n=0;if(t!==0&&(n=Math.atan2(e*i.x,e*i.y)),this.sphere)return r=O(this.long0+n/this.ns),s=Ui(this.g-t/this.a),i.x=r,i.y=s,i;var a=this.g-t/this.a;return s=Wr(a,this.e0,this.e1,this.e2,this.e3),r=O(this.long0+n/this.ns),i.x=r,i.y=s,i}var d0=["Equidistant_Conic","eqdc"],f0={init:h0,forward:c0,inverse:u0,names:d0};function g0(){this.R=this.a}function m0(i){var e=i.x,t=i.y,s=O(e-this.long0),r,n;Math.abs(t)<=x&&(r=this.x0+this.R*s,n=this.y0);var a=Kt(2*Math.abs(t/Math.PI));(Math.abs(s)<=x||Math.abs(Math.abs(t)-C)<=x)&&(r=this.x0,t>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*a):n=this.y0+Math.PI*this.R*-Math.tan(.5*a));var o=.5*Math.abs(Math.PI/s-s/Math.PI),l=o*o,h=Math.sin(a),c=Math.cos(a),u=c/(h+c-1),d=u*u,f=u*(2/h-1),g=f*f,m=Math.PI*this.R*(o*(u-g)+Math.sqrt(l*(u-g)*(u-g)-(g+l)*(d-g)))/(g+l);s<0&&(m=-m),r=this.x0+m;var p=l+u;return m=Math.PI*this.R*(f*p-o*Math.sqrt((g+l)*(l+1)-p*p))/(g+l),t>=0?n=this.y0+m:n=this.y0-m,i.x=r,i.y=n,i}function p0(i){var e,t,s,r,n,a,o,l,h,c,u,d,f;return i.x-=this.x0,i.y-=this.y0,u=Math.PI*this.R,s=i.x/u,r=i.y/u,n=s*s+r*r,a=-Math.abs(r)*(1+n),o=a-2*r*r+s*s,l=-2*a+1+2*r*r+n*n,f=r*r/l+(2*o*o*o/l/l/l-9*a*o/l/l)/27,h=(a-o*o/3/l)/l,c=2*Math.sqrt(-h/3),u=3*f/h/c,Math.abs(u)>1&&(u>=0?u=1:u=-1),d=Math.acos(u)/3,i.y>=0?t=(-c*Math.cos(d+Math.PI/3)-o/3/l)*Math.PI:t=-(-c*Math.cos(d+Math.PI/3)-o/3/l)*Math.PI,Math.abs(s)<x?e=this.long0:e=O(this.long0+Math.PI*(n-1+Math.sqrt(1+2*(s*s-r*r)+n*n))/2/s),i.x=e,i.y=t,i}var y0=["Van_der_Grinten_I","VanDerGrinten","vandg"],_0={init:g0,forward:m0,inverse:p0,names:y0};function v0(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function S0(i){var e=i.x,t=i.y,s=Math.sin(i.y),r=Math.cos(i.y),n=O(e-this.long0),a,o,l,h,c,u,d,f,g,m,p,y,_,w,L,E,A,Y,V,Ee,qe,It,wr;return this.sphere?Math.abs(this.sin_p12-1)<=x?(i.x=this.x0+this.a*(C-t)*Math.sin(n),i.y=this.y0-this.a*(C-t)*Math.cos(n),i):Math.abs(this.sin_p12+1)<=x?(i.x=this.x0+this.a*(C+t)*Math.sin(n),i.y=this.y0+this.a*(C+t)*Math.cos(n),i):(Y=this.sin_p12*s+this.cos_p12*r*Math.cos(n),E=Math.acos(Y),A=E?E/Math.sin(E):1,i.x=this.x0+this.a*A*r*Math.sin(n),i.y=this.y0+this.a*A*(this.cos_p12*s-this.sin_p12*r*Math.cos(n)),i):(a=qs(this.es),o=Ws(this.es),l=Xs(this.es),h=Ys(this.es),Math.abs(this.sin_p12-1)<=x?(c=this.a*Fe(a,o,l,h,C),u=this.a*Fe(a,o,l,h,t),i.x=this.x0+(c-u)*Math.sin(n),i.y=this.y0-(c-u)*Math.cos(n),i):Math.abs(this.sin_p12+1)<=x?(c=this.a*Fe(a,o,l,h,C),u=this.a*Fe(a,o,l,h,t),i.x=this.x0+(c+u)*Math.sin(n),i.y=this.y0+(c+u)*Math.cos(n),i):(d=s/r,f=Bi(this.a,this.e,this.sin_p12),g=Bi(this.a,this.e,s),m=Math.atan((1-this.es)*d+this.es*f*this.sin_p12/(g*r)),p=Math.atan2(Math.sin(n),this.cos_p12*Math.tan(m)-this.sin_p12*Math.cos(n)),p===0?V=Math.asin(this.cos_p12*Math.sin(m)-this.sin_p12*Math.cos(m)):Math.abs(Math.abs(p)-Math.PI)<=x?V=-Math.asin(this.cos_p12*Math.sin(m)-this.sin_p12*Math.cos(m)):V=Math.asin(Math.sin(n)*Math.cos(m)/Math.sin(p)),y=this.e*this.sin_p12/Math.sqrt(1-this.es),_=this.e*this.cos_p12*Math.cos(p)/Math.sqrt(1-this.es),w=y*_,L=_*_,Ee=V*V,qe=Ee*V,It=qe*V,wr=It*V,E=f*V*(1-Ee*L*(1-L)/6+qe/8*w*(1-2*L)+It/120*(L*(4-7*L)-3*y*y*(1-7*L))-wr/48*w),i.x=this.x0+E*Math.sin(p),i.y=this.y0+E*Math.cos(p),i))}function M0(i){i.x-=this.x0,i.y-=this.y0;var e,t,s,r,n,a,o,l,h,c,u,d,f,g,m,p,y,_,w,L,E,A,Y,V;return this.sphere?(e=Math.sqrt(i.x*i.x+i.y*i.y),e>2*C*this.a?void 0:(t=e/this.a,s=Math.sin(t),r=Math.cos(t),n=this.long0,Math.abs(e)<=x?a=this.lat0:(a=Kt(r*this.sin_p12+i.y*s*this.cos_p12/e),o=Math.abs(this.lat0)-C,Math.abs(o)<=x?this.lat0>=0?n=O(this.long0+Math.atan2(i.x,-i.y)):n=O(this.long0-Math.atan2(-i.x,i.y)):n=O(this.long0+Math.atan2(i.x*s,e*this.cos_p12*r-i.y*this.sin_p12*s))),i.x=n,i.y=a,i)):(l=qs(this.es),h=Ws(this.es),c=Xs(this.es),u=Ys(this.es),Math.abs(this.sin_p12-1)<=x?(d=this.a*Fe(l,h,c,u,C),e=Math.sqrt(i.x*i.x+i.y*i.y),f=d-e,a=Wr(f/this.a,l,h,c,u),n=O(this.long0+Math.atan2(i.x,-1*i.y)),i.x=n,i.y=a,i):Math.abs(this.sin_p12+1)<=x?(d=this.a*Fe(l,h,c,u,C),e=Math.sqrt(i.x*i.x+i.y*i.y),f=e-d,a=Wr(f/this.a,l,h,c,u),n=O(this.long0+Math.atan2(i.x,i.y)),i.x=n,i.y=a,i):(e=Math.sqrt(i.x*i.x+i.y*i.y),p=Math.atan2(i.x,i.y),g=Bi(this.a,this.e,this.sin_p12),y=Math.cos(p),_=this.e*this.cos_p12*y,w=-_*_/(1-this.es),L=3*this.es*(1-w)*this.sin_p12*this.cos_p12*y/(1-this.es),E=e/g,A=E-w*(1+w)*Math.pow(E,3)/6-L*(1+3*w)*Math.pow(E,4)/24,Y=1-w*A*A/2-E*A*A*A/6,m=Math.asin(this.sin_p12*Math.cos(A)+this.cos_p12*Math.sin(A)*y),n=O(this.long0+Math.asin(Math.sin(p)*Math.sin(A)/Math.cos(m))),V=Math.sin(m),a=Math.atan2((V-this.es*Y*this.sin_p12)*Math.tan(m),V*(1-this.es)),i.x=n,i.y=a,i))}var C0=["Azimuthal_Equidistant","aeqd"],x0={init:v0,forward:S0,inverse:M0,names:C0};function w0(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function b0(i){var e,t,s,r,n,a,o,l,h=i.x,c=i.y;return s=O(h-this.long0),e=Math.sin(c),t=Math.cos(c),r=Math.cos(s),a=this.sin_p14*e+this.cos_p14*t*r,n=1,(a>0||Math.abs(a)<=x)&&(o=this.a*n*t*Math.sin(s),l=this.y0+this.a*n*(this.cos_p14*e-this.sin_p14*t*r)),i.x=o,i.y=l,i}function O0(i){var e,t,s,r,n,a,o;return i.x-=this.x0,i.y-=this.y0,e=Math.sqrt(i.x*i.x+i.y*i.y),t=Kt(e/this.a),s=Math.sin(t),r=Math.cos(t),a=this.long0,Math.abs(e)<=x?(o=this.lat0,i.x=a,i.y=o,i):(o=Kt(r*this.sin_p14+i.y*s*this.cos_p14/e),n=Math.abs(this.lat0)-C,Math.abs(n)<=x?(this.lat0>=0?a=O(this.long0+Math.atan2(i.x,-i.y)):a=O(this.long0-Math.atan2(-i.x,i.y)),i.x=a,i.y=o,i):(a=O(this.long0+Math.atan2(i.x*s,e*this.cos_p14*r-i.y*this.sin_p14*s)),i.x=a,i.y=o,i))}var E0=["ortho"],I0={init:w0,forward:b0,inverse:O0,names:E0},Q={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},$={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function P0(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=C-H/2?this.face=Q.TOP:this.lat0<=-(C-H/2)?this.face=Q.BOTTOM:Math.abs(this.long0)<=H?this.face=Q.FRONT:Math.abs(this.long0)<=C+H?this.face=this.long0>0?Q.RIGHT:Q.LEFT:this.face=Q.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function L0(i){var e={x:0,y:0},t,s,r,n,a,o,l={value:0};if(i.x-=this.long0,this.es!==0?t=Math.atan(this.one_minus_f_squared*Math.tan(i.y)):t=i.y,s=i.x,this.face===Q.TOP)n=C-t,s>=H&&s<=C+H?(l.value=$.AREA_0,r=s-C):s>C+H||s<=-(C+H)?(l.value=$.AREA_1,r=s>0?s-oe:s+oe):s>-(C+H)&&s<=-H?(l.value=$.AREA_2,r=s+C):(l.value=$.AREA_3,r=s);else if(this.face===Q.BOTTOM)n=C+t,s>=H&&s<=C+H?(l.value=$.AREA_0,r=-s+C):s<H&&s>=-H?(l.value=$.AREA_1,r=-s):s<-H&&s>=-(C+H)?(l.value=$.AREA_2,r=-s-C):(l.value=$.AREA_3,r=s>0?-s+oe:-s-oe);else{var h,c,u,d,f,g,m;this.face===Q.RIGHT?s=qi(s,+C):this.face===Q.BACK?s=qi(s,+oe):this.face===Q.LEFT&&(s=qi(s,-C)),d=Math.sin(t),f=Math.cos(t),g=Math.sin(s),m=Math.cos(s),h=f*m,c=f*g,u=d,this.face===Q.FRONT?(n=Math.acos(h),r=Xr(n,u,c,l)):this.face===Q.RIGHT?(n=Math.acos(c),r=Xr(n,u,-h,l)):this.face===Q.BACK?(n=Math.acos(-h),r=Xr(n,u,-c,l)):this.face===Q.LEFT?(n=Math.acos(-c),r=Xr(n,u,h,l)):(n=r=0,l.value=$.AREA_0)}return o=Math.atan(12/oe*(r+Math.acos(Math.sin(r)*Math.cos(H))-C)),a=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),l.value===$.AREA_1?o+=C:l.value===$.AREA_2?o+=oe:l.value===$.AREA_3&&(o+=1.5*oe),e.x=a*Math.cos(o),e.y=a*Math.sin(o),e.x=e.x*this.a+this.x0,e.y=e.y*this.a+this.y0,i.x=e.x,i.y=e.y,i}function T0(i){var e={lam:0,phi:0},t,s,r,n,a,o,l,h,c,u={value:0};if(i.x=(i.x-this.x0)/this.a,i.y=(i.y-this.y0)/this.a,s=Math.atan(Math.sqrt(i.x*i.x+i.y*i.y)),t=Math.atan2(i.y,i.x),i.x>=0&&i.x>=Math.abs(i.y)?u.value=$.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=$.AREA_1,t-=C):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=$.AREA_2,t=t<0?t+oe:t-oe):(u.value=$.AREA_3,t+=C),c=oe/12*Math.tan(t),a=Math.sin(c)/(Math.cos(c)-1/Math.sqrt(2)),o=Math.atan(a),r=Math.cos(t),n=Math.tan(s),l=1-r*r*n*n*(1-Math.cos(Math.atan(1/Math.cos(o)))),l<-1?l=-1:l>1&&(l=1),this.face===Q.TOP)h=Math.acos(l),e.phi=C-h,u.value===$.AREA_0?e.lam=o+C:u.value===$.AREA_1?e.lam=o<0?o+oe:o-oe:u.value===$.AREA_2?e.lam=o-C:e.lam=o;else if(this.face===Q.BOTTOM)h=Math.acos(l),e.phi=h-C,u.value===$.AREA_0?e.lam=-o+C:u.value===$.AREA_1?e.lam=-o:u.value===$.AREA_2?e.lam=-o-C:e.lam=o<0?-o-oe:-o+oe;else{var d,f,g;d=l,c=d*d,c>=1?g=0:g=Math.sqrt(1-c)*Math.sin(o),c+=g*g,c>=1?f=0:f=Math.sqrt(1-c),u.value===$.AREA_1?(c=f,f=-g,g=c):u.value===$.AREA_2?(f=-f,g=-g):u.value===$.AREA_3&&(c=f,f=g,g=-c),this.face===Q.RIGHT?(c=d,d=-f,f=c):this.face===Q.BACK?(d=-d,f=-f):this.face===Q.LEFT&&(c=d,d=f,f=-c),e.phi=Math.acos(-g)-C,e.lam=Math.atan2(f,d),this.face===Q.RIGHT?e.lam=qi(e.lam,-C):this.face===Q.BACK?e.lam=qi(e.lam,-oe):this.face===Q.LEFT&&(e.lam=qi(e.lam,+C))}if(this.es!==0){var m,p,y;m=e.phi<0?1:0,p=Math.tan(e.phi),y=this.b/Math.sqrt(p*p+this.one_minus_f_squared),e.phi=Math.atan(Math.sqrt(this.a*this.a-y*y)/(this.one_minus_f*y)),m&&(e.phi=-e.phi)}return e.lam+=this.long0,i.x=e.lam,i.y=e.phi,i}function Xr(i,e,t,s){var r;return i<x?(s.value=$.AREA_0,r=0):(r=Math.atan2(e,t),Math.abs(r)<=H?s.value=$.AREA_0:r>H&&r<=C+H?(s.value=$.AREA_1,r-=C):r>C+H||r<=-(C+H)?(s.value=$.AREA_2,r=r>=0?r-oe:r+oe):(s.value=$.AREA_3,r+=C)),r}function qi(i,e){var t=i+e;return t<-oe?t+=js:t>+oe&&(t-=js),t}var N0=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],D0={init:P0,forward:L0,inverse:T0,names:N0},_a=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Zs=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],ph=.8487,yh=1.3523,_h=pt/5,F0=1/_h,Wi=18,Yr=function(i,e){return i[0]+e*(i[1]+e*(i[2]+e*i[3]))},A0=function(i,e){return i[1]+e*(2*i[2]+e*3*i[3])};function R0(i,e,t,s){for(var r=e;s;--s){var n=i(r);if(r-=n,Math.abs(n)<t)break}return r}function G0(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function k0(i){var e=O(i.x-this.long0),t=Math.abs(i.y),s=Math.floor(t*_h);s<0?s=0:s>=Wi&&(s=Wi-1),t=pt*(t-F0*s);var r={x:Yr(_a[s],t)*e,y:Yr(Zs[s],t)};return i.y<0&&(r.y=-r.y),r.x=r.x*this.a*ph+this.x0,r.y=r.y*this.a*yh+this.y0,r}function z0(i){var e={x:(i.x-this.x0)/(this.a*ph),y:Math.abs(i.y-this.y0)/(this.a*yh)};if(e.y>=1)e.x/=_a[Wi][0],e.y=i.y<0?-C:C;else{var t=Math.floor(e.y*Wi);for(t<0?t=0:t>=Wi&&(t=Wi-1);;)if(Zs[t][0]>e.y)--t;else if(Zs[t+1][0]<=e.y)++t;else break;var s=Zs[t],r=5*(e.y-s[0])/(Zs[t+1][0]-s[0]);r=R0(function(n){return(Yr(s,n)-e.y)/A0(s,n)},r,x,100),e.x/=Yr(_a[t],r),e.y=(5*t+r)*we,i.y<0&&(e.y=-e.y)}return e.x=O(e.x+this.long0),e}var j0=["Robinson","robin"],H0={init:G0,forward:k0,inverse:z0,names:j0};function $0(){this.name="geocent"}function V0(i){var e=Ul(i,this.es,this.a);return e}function B0(i){var e=ql(i,this.es,this.a,this.b);return e}var U0=["Geocentric","geocentric","geocent","Geocent"],q0={init:$0,forward:V0,inverse:B0,names:U0},Pe={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Ks={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function W0(){if(Object.keys(Ks).forEach(function(t){if(typeof this[t]=="undefined")this[t]=Ks[t].def;else{if(Ks[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Ks[t].num&&(this[t]=parseFloat(this[t]))}Ks[t].degrees&&(this[t]=this[t]*we)}.bind(this)),Math.abs(Math.abs(this.lat0)-C)<x?this.mode=this.lat0<0?Pe.S_POLE:Pe.N_POLE:Math.abs(this.lat0)<x?this.mode=Pe.EQUIT:(this.mode=Pe.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var i=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(i),this.sw=Math.sin(i)}function X0(i){i.x-=this.long0;var e=Math.sin(i.y),t=Math.cos(i.y),s=Math.cos(i.x),r,n;switch(this.mode){case Pe.OBLIQ:n=this.sinph0*e+this.cosph0*t*s;break;case Pe.EQUIT:n=t*s;break;case Pe.S_POLE:n=-e;break;case Pe.N_POLE:n=e;break}switch(n=this.pn1/(this.p-n),r=n*t*Math.sin(i.x),this.mode){case Pe.OBLIQ:n*=this.cosph0*e-this.sinph0*t*s;break;case Pe.EQUIT:n*=e;break;case Pe.N_POLE:n*=-(t*s);break;case Pe.S_POLE:n*=t*s;break}var a,o;return a=n*this.cg+r*this.sg,o=1/(a*this.sw*this.h1+this.cw),r=(r*this.cg-n*this.sg)*this.cw*o,n=a*o,i.x=r*this.a,i.y=n*this.a,i}function Y0(i){i.x/=this.a,i.y/=this.a;var e={x:i.x,y:i.y},t,s,r;r=1/(this.pn1-i.y*this.sw),t=this.pn1*i.x*r,s=this.pn1*i.y*this.cw*r,i.x=t*this.cg+s*this.sg,i.y=s*this.cg-t*this.sg;var n=ct(i.x,i.y);if(Math.abs(n)<x)e.x=0,e.y=i.y;else{var a,o;switch(o=1-n*n*this.pfact,o=(this.p-Math.sqrt(o))/(this.pn1/n+n/this.pn1),a=Math.sqrt(1-o*o),this.mode){case Pe.OBLIQ:e.y=Math.asin(a*this.sinph0+i.y*o*this.cosph0/n),i.y=(a-this.sinph0*Math.sin(e.y))*n,i.x*=o*this.cosph0;break;case Pe.EQUIT:e.y=Math.asin(i.y*o/n),i.y=a*n,i.x*=o;break;case Pe.N_POLE:e.y=Math.asin(a),i.y=-i.y;break;case Pe.S_POLE:e.y=-Math.asin(a);break}e.x=Math.atan2(i.x,i.y)}return i.x=e.x+this.long0,i.y=e.y,i}var Z0=["Tilted_Perspective","tpers"],K0={init:W0,forward:X0,inverse:Y0,names:Z0};function J0(){if(this.flip_axis=this.sweep==="x"?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var i=1-this.es,e=1/i;this.radius_p=Math.sqrt(i),this.radius_p2=i,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function Q0(i){var e=i.x,t=i.y,s,r,n,a;if(e=e-this.long0,this.shape==="ellipse"){t=Math.atan(this.radius_p2*Math.tan(t));var o=this.radius_p/ct(this.radius_p*Math.cos(t),Math.sin(t));if(r=o*Math.cos(e)*Math.cos(t),n=o*Math.sin(e)*Math.cos(t),a=o*Math.sin(t),(this.radius_g-r)*r-n*n-a*a*this.radius_p_inv2<0)return i.x=Number.NaN,i.y=Number.NaN,i;s=this.radius_g-r,this.flip_axis?(i.x=this.radius_g_1*Math.atan(n/ct(a,s)),i.y=this.radius_g_1*Math.atan(a/s)):(i.x=this.radius_g_1*Math.atan(n/s),i.y=this.radius_g_1*Math.atan(a/ct(n,s)))}else this.shape==="sphere"&&(s=Math.cos(t),r=Math.cos(e)*s,n=Math.sin(e)*s,a=Math.sin(t),s=this.radius_g-r,this.flip_axis?(i.x=this.radius_g_1*Math.atan(n/ct(a,s)),i.y=this.radius_g_1*Math.atan(a/s)):(i.x=this.radius_g_1*Math.atan(n/s),i.y=this.radius_g_1*Math.atan(a/ct(n,s))));return i.x=i.x*this.a,i.y=i.y*this.a,i}function e_(i){var e=-1,t=0,s=0,r,n,a,o;if(i.x=i.x/this.a,i.y=i.y/this.a,this.shape==="ellipse"){this.flip_axis?(s=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*ct(1,s)):(t=Math.tan(i.x/this.radius_g_1),s=Math.tan(i.y/this.radius_g_1)*ct(1,t));var l=s/this.radius_p;if(r=t*t+l*l+e*e,n=2*this.radius_g*e,a=n*n-4*r*this.C,a<0)return i.x=Number.NaN,i.y=Number.NaN,i;o=(-n-Math.sqrt(a))/(2*r),e=this.radius_g+o*e,t*=o,s*=o,i.x=Math.atan2(t,e),i.y=Math.atan(s*Math.cos(i.x)/e),i.y=Math.atan(this.radius_p_inv2*Math.tan(i.y))}else if(this.shape==="sphere"){if(this.flip_axis?(s=Math.tan(i.y/this.radius_g_1),t=Math.tan(i.x/this.radius_g_1)*Math.sqrt(1+s*s)):(t=Math.tan(i.x/this.radius_g_1),s=Math.tan(i.y/this.radius_g_1)*Math.sqrt(1+t*t)),r=t*t+s*s+e*e,n=2*this.radius_g*e,a=n*n-4*r*this.C,a<0)return i.x=Number.NaN,i.y=Number.NaN,i;o=(-n-Math.sqrt(a))/(2*r),e=this.radius_g+o*e,t*=o,s*=o,i.x=Math.atan2(t,e),i.y=Math.atan(s*Math.cos(i.x)/e)}return i.x=i.x+this.long0,i}var t_=["Geostationary Satellite View","Geostationary_Satellite","geos"],i_={init:J0,forward:Q0,inverse:e_,names:t_};function s_(i){i.Proj.projections.add(Ur),i.Proj.projections.add(qr),i.Proj.projections.add(hp),i.Proj.projections.add(vp),i.Proj.projections.add(bp),i.Proj.projections.add(Lp),i.Proj.projections.add(Rp),i.Proj.projections.add(Hp),i.Proj.projections.add(qp),i.Proj.projections.add(Kp),i.Proj.projections.add(gy),i.Proj.projections.add(Sy),i.Proj.projections.add(by),i.Proj.projections.add(Ty),i.Proj.projections.add(Ry),i.Proj.projections.add(Hy),i.Proj.projections.add(qy),i.Proj.projections.add(Ky),i.Proj.projections.add(s0),i.Proj.projections.add(l0),i.Proj.projections.add(f0),i.Proj.projections.add(_0),i.Proj.projections.add(x0),i.Proj.projections.add(I0),i.Proj.projections.add(D0),i.Proj.projections.add(H0),i.Proj.projections.add(q0),i.Proj.projections.add(K0),i.Proj.projections.add(i_)}fe.defaultDatum="WGS84",fe.Proj=_t,fe.WGS84=new fe.Proj("WGS84"),fe.Point=$i,fe.toPoint=Zl,fe.defs=De,fe.nadgrid=um,fe.transform=Vr,fe.mgrs=Em,fe.version="__VERSION__",s_(fe);const Js=ye("EPSG:4326","EPSG:3857"),va=ye("EPSG:3857","EPSG:4326");let Sa={epsg:"EPSG:4326"};function Ma(i,e="EPSG:"){const t=new RegExp(`^(?:${e})?(\\d+)`,"i"),s=`${i}`.match(t);return s&&s[1]?`${e}${s[1]}`:""}function vh(i){let e=null;if(i.epsg)try{e=fe(Ma(i.epsg))}catch{e=null}if(i.proj4)try{e=fe(i.proj4)}catch{e=null}return e!=null}function Sh(i){const e={prefix:i.prefix};return i.epsg&&(e.epsg=Ma(i.epsg,i.prefix),e.epsg&&(i.proj4&&(e.proj4=i.proj4,fe.defs(e.epsg,i.proj4),Yo(fe)),i.alias&&Array.isArray(i.alias)&&(e.alias=i.alias,e.alias.forEach(t=>{fe.defs(t,fe.defs(e.epsg)),Yo(fe)})))),e}function Mh(i){if(v(i,{epsg:[String,Number],proj4:[String,void 0,null]}),!vh(i))throw new Error("Cannot set invalid projection options as default options");Sa=Sh(i)}class D{static get className(){return"Projection"}constructor(e={epsg:""}){const t=Sh(e);this._proj4=t.proj4,this._epsg=t.epsg,this.proj||(this._epsg=D.parseEPSGCode(Sa.epsg)),this._alias=t.alias,this._prefix=t.prefix}get epsg(){return this._epsg}get proj4(){return this._proj4}get proj(){return Fd(this.epsg)}equals(e){return Ad(this.proj,e.proj)}static transform(e,t,s){const r=ye(t.proj,e.proj),n=new Array(2);return r([s[0],s[1]],n,2),s.length>2&&n.push(s[2]),n}transformTo(e,t){return D.transform(e,this,t)}static transformCoordinates(e,t,s){const r=[];for(let n=0;n<s.length;n++)r.push(D.transform(e,t,s[n]));return r}static getTransformer(e,t){return ye(t.proj,e.proj)}transformFrom(e,t){return D.transform(this,e,t)}toJSON(){const e={type:D.className,epsg:this.epsg};return this.proj4&&(e.proj4=this.proj4),Array.isArray(this._alias)&&this._alias.length>0&&(e.alias=this._alias.slice()),this._prefix&&(e.prefix=this._prefix),e}static mercatorToWgs84(e,t){return va(e,t?e:void 0,e.length)}static wgs84ToMercator(e,t){return Js(e,t?e:void 0,e.length)}static validateOptions(e){return vh(e)}static parseEPSGCode(e,t="EPSG:"){return Ma(e,t)}}function Ch(){return new D(Sa)}const U=new D({epsg:4326}),R=new D({epsg:3857});class ut{static get className(){return"VcsObject"}constructor(e){this.name=e.name||et(),this.properties=e.properties||{}}get className(){return this.constructor.className}getLogger(){return Ie(this.className)}toJSON(){const e={type:this.className,name:this.name};return Object.keys(this.properties).length>0&&(e.properties=S({},this.properties)),e}destroy(){this.isDestroyed=!0,this.properties={}}}function xh(i){return!i||!Array.isArray(i)||i.length!==4||!Number.isFinite(i[0])||!Number.isFinite(i[1])||!Number.isFinite(i[2])||!Number.isFinite(i[3])?!1:i[0]<=i[2]&&i[1]<=i[3]}class Me{static get className(){return"Extent"}constructor(e={}){this.projection=new D(e.projection),this.extent=e.coordinates||this.projection.proj.getExtent()}getCoordinatesInProjection(e,t){if(e.epsg===this.projection.epsg)return t?t.splice(0,4,...this.extent):this.extent.slice();const s=D.getTransformer(e,this.projection),r=t||[];return s(this.extent,r,2),r}isValid(){return xh(this.extent)}toJSON(){return{coordinates:this.extent.slice(),projection:this.projection.toJSON(),type:Me.className}}clone(){return new Me(this.toJSON())}equals(e){return this===e?!0:this.isValid()&&e.isValid()&&this.extent.every((t,s)=>t===e.extent[s])&&this.projection.equals(e.projection)}static validateOptions(e){return D.validateOptions(e.projection||{})&&xh(e.coordinates)}static get WGS_84_EXTENT(){return[-180,-90,180,90]}}function Ca(i,e,t){return Math.abs(i-e)<=t}function Zr(i,e,t){const s=i-e-Math.trunc((i-e)/360)*360;return Math.abs(s)<=t}function xa(i,e,t){return i!==null&&e!==null&&i.every((s,r)=>Ca(s,e[r],t))}class ft extends ut{static get className(){return"Viewpoint"}constructor(e){super(e),this.cameraPosition=null,Array.isArray(e.cameraPosition)&&e.cameraPosition.length===3&&(this.cameraPosition=e.cameraPosition.map(t=>Number(t))),this.groundPosition=null,Array.isArray(e.groundPosition)&&(this.groundPosition=e.groundPosition.map(t=>Number(t))),this.distance=N(e.distance,this.cameraPosition?this.cameraPosition[2]:1e3),this.heading=N(e.heading,0),this.pitch=N(e.pitch,-90),this.roll=N(e.roll,0),this.animate=ae(e.animate,!1),this.duration=e.duration||null,this.easingFunctionName=e.easingFunctionName||null}get easingFunction(){return this.easingFunctionName?_f[this.easingFunctionName]:null}toJSON(){return T(S({},super.toJSON()),{distance:this.distance,cameraPosition:this.cameraPosition?this.cameraPosition.slice():null,groundPosition:this.groundPosition?this.groundPosition.slice():null,heading:this.heading,pitch:this.pitch,roll:this.roll,animate:this.animate,duration:this.duration,easingFunctionName:this.easingFunctionName})}clone(){return new ft(this.toJSON())}toString(){return`Viewpoint: [Ground:${String(this.groundPosition?this.groundPosition:null)}][Camera:${String(this.cameraPosition?this.cameraPosition:null)}][Distance:${this.distance}][heading:${this.distance}][pitch:${this.distance}][roll:${this.distance}]`}static createViewpointFromExtent(e){const t=e instanceof Me?e.getCoordinatesInProjection(U):e;if(t&&t.length===4){const s=t[0],r=t[1],n=t[2],a=t[3],o=[(n-s)/2+s,(a-r)/2+r];let l=0;const h=Math.max(n-s,a-r);return h<.001?l=400:l=h*3e5,new ft({name:"viewpointFromExtend",distance:l,groundPosition:o,heading:360,pitch:-90,roll:0,animate:!0})}return null}static parseURLparameter(e){let{cameraPosition:t,groundPosition:s}=e;if(t!=null&&(t=t.split(",").map(n=>Number(n))),s!=null&&(s=s.split(",").map(n=>Number(n))),e.epsg!=null){const{epsg:n,proj4:a}=e,o=new D({epsg:n,proj4:a}),l=U;s&&(s=D.transform(l,o,s)),t&&(t=D.transform(l,o,t))}const r={cameraPosition:t,groundPosition:s,distance:Number(e.distance),pitch:Number(e.pitch),heading:Number(e.heading),roll:Number(e.roll)};return new ft(r)}isValid(){const e=this.cameraPosition&&Array.isArray(this.cameraPosition)&&this.cameraPosition.length===3&&this.cameraPosition.every(s=>Number.isFinite(s));return!(!(this.groundPosition&&Array.isArray(this.groundPosition)&&this.groundPosition.length>1&&this.groundPosition.length<4&&this.groundPosition.every(s=>Number.isFinite(s)))&&!e||!e&&!Number.isFinite(this.distance)||!Number.isFinite(this.heading)||!Number.isFinite(this.pitch)||!Number.isFinite(this.roll))}equals(e,t=0){return e===this||e!==null&&Ca(e.distance,this.distance,t)&&Zr(e.heading,this.heading,t)&&Zr(e.pitch,this.pitch,t)&&Zr(e.roll,this.roll,t)&&(xa(e.cameraPosition,this.cameraPosition,t)||xa(e.groundPosition,this.groundPosition,t))}}class I{constructor(){this._listeners=new Set}get numberOfListeners(){return this._listeners.size}addEventListener(e){return this._listeners.add(e),()=>{this.removeEventListener(e)}}removeEventListener(e){return this._listeners.has(e)?(this._listeners.delete(e),!0):!1}raiseEvent(e){[...this._listeners].forEach(t=>{t(e)})}async awaitRaisedEvent(e){const t=new Array(this._listeners.size);let s=0;[...this._listeners].forEach(r=>{t[s]=r(e),s+=1}),await Promise.all(t)}destroy(){this._listeners.clear()}}function r_(){return Ie("OverrideClassRegistry")}class vt{constructor(e){this._coreClassRegistry=e,this._classMap=new Map,this._classShadows=new Map,this.replaced=new I,this.removed=new I}getClassNames(){return[...new Set([...this._classMap.keys(),...this._coreClassRegistry.getClassNames()])]}registerClass(e,t,s){v(e,String),v(t,String),v(s,Function);const r={contextId:e,ctor:s},n=this.hasClass(t);this._classMap.has(t)&&(this._classShadows.has(t)||this._classShadows.set(t,[]),this._classShadows.get(t).push(this._classMap.get(t))),this._classMap.set(t,r),n&&this.replaced.raiseEvent(t)}unregisterClass(e,t){if(v(e,String),v(t,String),this._classShadows.has(t)){const s=this._classShadows.get(t),r=s.filter(n=>n.contextId!==e);r.length===0?this._classShadows.delete(t):r.length!==s.length&&this._classShadows.set(t,r)}this._classMap.has(t)&&this._classMap.get(t).contextId===e&&(this._classMap.delete(t),this._classShadows.has(t)?(this._classMap.set(t,this._classShadows.get(t).pop()),this._classShadows.get(t).length===0&&this._classShadows.delete(t),this.replaced.raiseEvent(t)):this._coreClassRegistry.hasClass(t)?this.replaced.raiseEvent(t):this.removed.raiseEvent(t))}getClass(e){return v(e,String),this._classMap.has(e)?this._classMap.get(e).ctor:this._coreClassRegistry.getClass(e)}hasClass(e){return v(e,String),this._classMap.has(e)||this._coreClassRegistry.hasClass(e)}create(e,...t){v(e,String);const s=this.getClass(e);if(!s){r_().error(`could not find constructor ${e}`);return}return new s(...t)}createFromTypeOptions(e,...t){return v(e,{type:String}),this.create(e.type,e,...t)}removeContext(e){v(e,String),this._classMap.forEach((t,s)=>{this.unregisterClass(e,s)})}destroy(){this._coreClassRegistry=null,this._classMap.clear(),this._classShadows.clear(),this.replaced.destroy(),this.removed.destroy()}}function Qs(){return Ie("ClassRegistry")}class Dt{constructor(){this._classMap=new Map}getClassNames(){return[...this._classMap.keys()]}registerClass(e,t){if(v(e,String),v(t,Function),this._classMap.has(e))throw new Error("a constructor with this className has already been registered");this._classMap.set(e,t)}getClass(e){if(v(e,String),this._classMap.has(e))return this._classMap.get(e)}hasClass(e){return v(e,String),this._classMap.has(e)}create(e,...t){v(e,String);const s=this.getClass(e);if(!s){Qs().error(`could not find constructor ${e}`);return}return new s(...t)}createFromTypeOptions(e,...t){return v(e,{type:String}),this.create(e.type,e,...t)}}const ue=new Dt,ui=new Dt,Kr=new Dt,di=new Dt,Xi=new Dt,Jr=new Dt;function St(i,e,...t){if(!ia(i,[Dt,vt]))return Qs().error(`ObjectCreation failed: no class registry provided for ${e}`),null;if(!(e!=null&&e.type))return Qs().warning(`ObjectCreation failed: could not find type in options ${e}`),null;let s;try{s=i.createFromTypeOptions(e,...t)}catch(r){Qs().warning(`Error: ${r}`)}return s||(Qs().warning("ObjectCreation failed: could not create new Object"),null)}function n_(){return Ie("init")}const Le=Symbol("contextId");function wa(i,e){const t=St(i.mapClassRegistry,e);return t&&(t.layerCollection=i.layers),t}function wh(i){const e=new ft(i);return e&&e.isValid()?e:(n_().warning(`Viewpoint ${i.name} is not valid`),null)}function ba(i,e){let t;e.style&&(typeof e.style=="string"?t=i.styles.getByKey(e.style):t=St(i.styleClassRegistry,e.style));let s;e.tileProvider&&(s=St(i.tileProviderClassRegistry,e.tileProvider));let r;return e.featureProvider&&(r=St(i.featureProviderClassRegistry,e.featureProvider)),St(i.layerClassRegistry,T(S({},e),{style:t,tileProvider:s,featureProvider:r}))}function bh(i,e){var s;const t=e.toJSON();return t.zIndex=e[i.layers.zIndexSymbol],((s=t==null?void 0:t.style)==null?void 0:s.name)&&i.styles.hasKey(t.style.name)&&(t.style=t.style.name),t}function Oh(i,e,t){return i.zIndex!==e.zIndex?null:t}function Mt(i){[...i].forEach(e=>{e.destroy&&!e.isDestroyed&&e.destroy()}),i.destroy()}class wt{static from(e,t){const s=new wt(t);if(e)for(const r of e)s.add(r);return s}constructor(e){this._array=[],this._uniqueKey="name",typeof e=="string"||typeof e=="symbol"?this._uniqueKey=e:e===!1&&(this._uniqueKey=void 0),this.added=new I,this.removed=new I}*[Symbol.iterator](){const e=this._array.length;for(let t=0;t<e;t++)yield this._array[t]}get uniqueKey(){return this._uniqueKey}get size(){return this._array.length}getByKey(e){if(!!this._uniqueKey)return this._array.find(t=>t[this._uniqueKey]===e)}_checkUniqueness(e){if(this._uniqueKey){if(e==null||typeof e!="object")return!1;const t=e[this._uniqueKey];if(t==null||this.getByKey(t)!=null)return!1}return!0}add(e){return this._checkUniqueness(e)?(this._array.push(e),this.added.raiseEvent(e),this._array.length-1):null}_remove(e){const t=this._array.indexOf(e);return t>-1&&this._array.splice(t,1),t}remove(e){this._remove(e)>-1&&this.removed.raiseEvent(e)}has(e){return this._array.includes(e)}hasKey(e){if(!!this._uniqueKey)return this._array.some(t=>t[this._uniqueKey]===e)}clear(){this._array.forEach(e=>{this.removed.raiseEvent(e)}),this._array.splice(0)}destroy(){this._array=[],this.added.destroy(),this.removed.destroy()}}function a_(){return Ie("OverrideCollection")}const Qr=Symbol("OverrideCollection");function fi(i,e,t,s,r,n){v(i,wt);const a=i;if(a[Qr])throw new Error("Cannot transform collection, collection already is an OverrideCollection");a[Qr]=!0;const o=s||(u=>u),l=t||(u=>u.toJSON?u.toJSON():u),h=n||((u,d,f)=>f);a.shadowMap=new Map,a.override=function(d){let f,g;const m=d[a.uniqueKey];if(a.hasKey(m)){f=a.getByKey(m),g=a._remove(f),a.shadowMap.has(m)||a.shadowMap.set(m,[]);const y=a.shadowMap.get(m),_=l(f);_[Le]=f[Le],y.push(_)}const p=f?h(f,d,g):null;return f&&(a.replaced.raiseEvent({old:f,new:d}),f.destroy&&f.destroy()),a.add(d,p)>=0?d:null},a.parseItems=async function(d,f){Array.isArray(d)&&(await Promise.all(d.map(async m=>{const p=await o(m);return!p||r&&!(p instanceof r)?(a_().warning(`Could not load item ${m[a.uniqueKey]} of type ${m.type}`),null):(p[Le]=f,p)}))).filter(m=>m).forEach(m=>{a.override(m)})},a.removed.addEventListener(async u=>{const d=u[a.uniqueKey];if(a.shadowMap.has(d)){const f=a.shadowMap.get(d).pop();if(f){const g=await o(f);g[Le]=f[Le];const m=h(g,u,u[a.previousIndexSymbol]);a.add(g,m)}a.shadowMap.get(d).length===0&&a.shadowMap.delete(d)}}),a.added.addEventListener(u=>{u[Le]||(u[Le]=e())}),a.removeContext=async function(d){a.shadowMap.forEach((f,g)=>{const m=f.filter(p=>p[Le]!==d);m.length===0?a.shadowMap.delete(g):m.length!==f.length&&a.shadowMap.set(g,m)}),await Promise.all([...a].filter(f=>f[Le]===d).map(async f=>{a.remove(f),f.destroy&&f.destroy()}))},a.replaced=new I,a.serializeContext=function(d){return[...a].map(f=>f[Le]===d?l(f):a.shadowMap.has(f[a.uniqueKey])?a.shadowMap.get(f[a.uniqueKey]).find(g=>g[Le]===d):null).filter(f=>f)};const c=a.destroy.bind(a);return a.destroy=function(){c(),a.shadowMap.clear(),a.replaced.destroy()},a}const j=Symbol("vcsLayerName"),ee={INACTIVE:1,ACTIVE:2,LOADING:4};var o_=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Ft=function i(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!i(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var a=n[r];if(!i(e[a],t[a]))return!1}return!0}return e!==e&&t!==t};class dt extends ut{static get className(){return"StyleItem"}constructor(e){super(e),this.supportedLayers=[],this.cesiumStyle=new Vn({show:!0}),this.styleChanged=new I,this.colorBlendMode=oa(e.colorBlendMode,Lr,Lr.HIGHLIGHT),this._style=null}get style(){return this._style}set style(e){this._style=e}isSupported(e){return this.supportedLayers.length===0||this.supportedLayers.indexOf(e)>-1}toJSON(){const e=super.toJSON();return this.colorBlendMode!==Lr.HIGHLIGHT&&(e.colorBlendMode=this.colorBlendMode),e}clone(e){return e}assign(e){return this.properties=JSON.parse(JSON.stringify(e.properties)),this}equals(e){if(this!==e){const t=this.toJSON();delete t.name;const s=e.toJSON();return delete s.name,Ft(t,s)}return!0}_styleChanged(){this.styleChanged.raiseEvent()}destroy(){this.cesiumStyle=null,this.styleChanged.destroy(),super.destroy()}}Xi.registerClass(dt.className,dt);function Eh(){return Ie("StyleHelpers")}const Oa={NWSE:1,SWNE:2,DIAGONALCROSS:3,NS:4,WE:5,CROSS:6};function Ih(i,e){let t=i.substring(1);return t.length===3&&(t=t.replace(/([\w\d])/g,"$1$1")),[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16),e!=null?e:1]}function At(i){const e=i.toBytes();return e[3]/=255,e}function l_(i){return Ne.fromBytes(i[0],i[1],i[2],i[3]*255)}function Te(i,e){if(Array.isArray(i))return i.length===3&&i.push(1),i;if(typeof i=="string"){if(/^#/.test(i))return Ih(i);if(/^rgba?\((\d+(,\s?)?){3}((0|1)(\.\d+)?)?\)/.test(i)){const t=i.replace(/^rgba?\(([\s\S]+?)\)/,"$1").replace(/\s/,"").split(",").map(s=>Number(s));return t.length===3&&t.push(1),t}}if(i instanceof CanvasPattern)return[255,255,255,.4];if(e)return e;throw new Error(`Cannot parse color ${i}`)}function gi(i,e){const t=Te(i,e);return Ne.fromBytes(t[0],t[1],t[2],t[3]*255)}function je(i){return`rgba(${Te(i).join(",")})`}function Ph(i,e){const t=Rd,s=e||document.createElement("canvas");(!e||!s.width)&&(s.width=(i.pattern.size||10)*t,s.height=(i.pattern.size||10)*t);const r=s.getContext("2d"),n=s.width;r.fillStyle=je(i.color),r.fillRect(0,0,n,n);function a(o,l){r.strokeStyle=je(i.pattern.color),r.lineWidth=i.pattern.width,r.lineCap="square",r.beginPath(),r.moveTo(o[0],o[1]),r.lineTo(l[0],l[1]),r.stroke()}switch(i.pattern.type){case 1:a([n/2,n],[n,n/2]),a([0,n/2],[n/2,0]);break;case 2:a([n/2,n],[0,n/2]),a([n,n/2],[n/2,0]);break;case 3:a([n/2,n],[n,n/2]),a([0,n/2],[n/2,0]),a([n/2,n],[0,n/2]),a([n,n/2],[n/2,0]);break;case 4:a([n/2,0],[n/2,n]);break;case 5:a([0,n/2],[n,n/2]);break;case 6:a([n/2,0],[n/2,n]),a([0,n/2],[n,n/2]);break;default:return null}return r.createPattern(s,"repeat")}function Ea(i){function e(t){const s=t.toString(16);return s.length===1?`0${s}`:s}return i.slice(0,3).reduce((t,s)=>`${t}${e(s)}`,"#")}function h_(i){return/^#[0-9a-f]{6}$/.test(i)}function c_(i){if(typeof i!="string")return i;let e=null,t=null,s="normal",r="normal",n="normal",a="normal";return i.split(/\s+/).forEach(o=>{switch(o){case"normal":break;case"italic":case"oblique":s=o;break;case"small-caps":n=o;break;case"bold":case"bolder":case"lighter":case"100":case"200":case"300":case"400":case"500":case"600":case"700":case"800":case"900":r=o;break;default:if(!t){const l=o.split("/");t=l[0],l.length>1&&(a=l[1]);break}e?e=`${e} ${o}`:e=o;break}}),{fontStyle:s,fontVariant:n,fontWeight:r,fontSize:t,lineHeight:a,fontFamily:e}}function Lh(i){const e=["fontStyle","fontVariant","fontWeight","fontSize","fontFamily"];let t=null;return Object.entries(i).filter(s=>s[1]!=="normal"&&s[0]!=="lineWeight").sort((s,r)=>{const n=e.indexOf(s[0]),a=e.indexOf(r[0]);return n<a?-1:n>a?1:0}).forEach(s=>{t?t=`${t} ${s[1]}`:t=s[1]}),t||""}function u_(i,e,t,s){const r=s||[0,0],n=i.getImageData(r[0],r[1],t[0],t[1]),{data:a}=n,[o,l,h]=e,c=a.length;for(let u=0;u<c;u+=4)a[u]=o,a[u+1]=l,a[u+2]=h;i.putImageData(n,r[0],r[1])}function en(i){if(i.getFill()){let e=i.getFill().getColor();try{e=Te(e).slice()}catch(t){Eh().warning(t.message)}return{color:e}}}function er(i){let e=i.getColor();if(e)try{e=Te(e).slice()}catch(t){Eh().warning(t.message)}return{color:e,width:i.getWidth(),lineDash:i.getLineDash()}}function Th(i){return{font:i.getFont(),fill:en(i),stroke:i.getStroke()?er(i.getStroke()):void 0,textBaseline:i.getTextBaseline(),offsetY:i.getOffsetY(),offsetX:i.getOffsetX()}}function Nh(i){const e=S({},i);return e.fill&&!(e.fill instanceof gt)&&(e.fill=new gt(e.fill)),e.stroke&&!(e.stroke instanceof ot)&&(e.stroke=new ot(e.stroke)),e.font&&typeof e.font!="string"&&(e.font=Lh(e.font)),new An(e)}function d_(i){const e={font:i.getFont(),textShadow:void 0,color:void 0};if(i.getStroke()){let t=i.getStroke().getWidth();t=t>1?1:t;const s=Ea(Te(i.getStroke().getColor()));e.textShadow=`-${t}px ${t}px 0 ${s},${t}px ${t}px 0 ${s},${t}px -${t}px 0 ${s},-${t}px -${t}px 0 ${s}`}return i.getFill()&&(e.color=Ea(Te(i.getFill().getColor()))),e}const Yi=new _e({}),f_=[0,0,0,0],tr=[255,255,255,1],tn=[0,0,0,1];function Ia(){return{image:{fill:{color:[255,255,255,.4]},stroke:{color:tn,width:1},radius:5},stroke:{color:[51,153,204,1],width:1.25},fill:{color:[255,255,255,.4]},text:{font:"bold 18px sans-serif",textBaseline:"bottom",offsetY:-15,offsetX:0}}}const g_={olcs_color:je(tr),olcs_scale:"1.0",olcs_outlineWidth:"0.0",olcs_outlineColor:je(tn),olcs_pointSize:"8.0",olcs_image:null,olcs_font:`'${Ia().text.font}'`,olcs_fontColor:je(tn),olcs_fontOutlineWidth:"1.0",olcs_fontOutlineColor:je(tr),olcs_labelText:null,olcs_anchorLineColor:je(tr)};function te(i,e){const t=`Boolean(\${${i}})===true`,s=e?`color(\${${i}})`:`\${${i}}`;return[[t,s],["true",g_[i]]]}const m_="${attributes} !== undefined && ${attributes} !== null && ${attributes.olcs_extrudedHeight} !== undefined && ${attributes.olcs_extrudedHeight}!==null";function Pa(i){return i.fill&&!(i.fill instanceof gt)&&(i.fill=new gt(i.fill)),i.stroke&&!(i.stroke instanceof ot)&&(i.stroke=new ot(i.stroke)),i.points?new Rn(i):new Is(i)}class p_{constructor(){this.shapes=[]}addImage(e){const s=Pa(S({},e)).getImage(1);e.src=s.toDataURL(),this.shapes.push(e)}}const Dh=new p_,Fh={fill:new gt({color:[255,255,255,1]}),stroke:new ot({color:[0,0,0,1],width:1}),radius:16};[null,{points:3},{points:3,angle:Math.PI},{points:4,angle:Math.PI/4},{points:6}].forEach(i=>{const e=i?Object.assign(i,Fh):Fh;Dh.addImage(e)});const La={POLYGON:1,POLYLINE:2,POINT:3},Ae=Symbol("VcsVectorStyleItem");class W extends dt{static get className(){return"VectorStyleItem"}constructor(e){super(e),this.validateOptions(e),this.exclude={fill:e.fill===!1,stroke:e.stroke===!1,image:e.image===!1},this._fillOptions=null,this._fill=void 0,this._stroke=e.stroke?new ot(e.stroke):void 0,this._text=void 0,e.text&&(this._text=Nh(e.text)),this._label=e.label,this.label=this._label,this._cesiumColor=new Ne,this._image=void 0,e.image&&(this._image=e.image.radius?Pa(S({},e.image)):new Ps(e.image)),this._style=new _e({image:this._image,stroke:this._stroke,text:this._text}),e.fill?(this._fillOptions=e.fill,this._setFill()):this.updateCesiumStyle()}validateOptions(e){const t=r=>{try{r.color=Te(r.color),v(r.color,[Number]),v(r.color.length,[3,4])}catch(n){this.getLogger().error(n.message),r.color=[255,255,255,.4]}},s=r=>{t(r),r.width||(this.getLogger().error("missing width for stroke, setting to 1.5"),r.width=1.5)};e.fill&&(t(e.fill),e.fill.pattern&&(s(e.fill.pattern),e.fill.pattern.type&&Object.values(Oa).includes(e.fill.pattern.type)||(this.getLogger().error(`Cannot find pattern ${e.fill.pattern.type}`),e.fill.pattern.type=Oa.NWSE))),e.stroke&&s(e.stroke),e.image&&(e.image.icon?e.image=e.image.icon:e.image.circle&&(e.image=e.image.circle),e.image.src||e.image.radius||(this.getLogger().error("missing source or label in style, setting default circle"),e.image={fill:{color:"rgba(255,255,255,0.4)"},stroke:{color:"#3399CC",width:1},radius:5}),e.image.radius&&(e.image.radius=Number(e.image.radius),Number.isFinite(e.image.radius)||(this.getLogger().error("radius must be a number"),e.image.radius=5),e.image.fill&&t(e.image.fill),e.image.stroke&&s(e.image.stroke)))}get fillColor(){return this._fillOptions?this._fillOptions.color:null}get cesiumFillColor(){const e=this.fillColor?this.fillColor.slice():null;return e?(e[3]=e[3]||1,e[3]*=255,Ne.fromBytes(...e,this._cesiumColor)):Ne.RED.clone(this._cesiumColor)}set fillColor(e){this.exclude.fill=!1,this._style instanceof _e?e?(this._fillOptions?this._fillOptions.color=Te(e):this._fillOptions={color:Te(e)},this._setFill()):(this._fillOptions=null,this._fill=void 0,this._style.setFill(this._fill),this.updateCesiumStyleColor(!0)):this.getLogger().info("trying to set fill on a style function")}get pattern(){return this._fillOptions&&this._fillOptions.pattern?this._fillOptions.pattern:null}set pattern(e){if(!this._fillOptions){this.getLogger().error("Missing fill color");return}e?(re(e,{color:[String,[Number]],width:Number,type:Number,size:[Number,void 0,null]},!0),this._fillOptions.pattern=e):this._fillOptions.pattern=void 0,this._setFill()}get stroke(){return this._stroke}set stroke(e){this.exclude.stroke=!1,this._style instanceof _e?(re(e,ot),this._style.setStroke(e),this._stroke=e,this.updateCesiumStyleColor(!0)):this.getLogger().info("trying to set stroke on a style function")}get label(){return this._label}set label(e){re(e,String),e?this._label=e:this._label=void 0,this._text&&this._text.setText(e)}get text(){return this._text}set text(e){this._style instanceof _e?(re(e,An),this._text=e,this._text.setText(this._label),this._style.setText(this._text)):this.getLogger().info("trying to set text on a style function")}get image(){return this._image}set image(e){this.exclude.image=!1,this._style instanceof _e?(re(e,Gd),this._image=e,this._style.setImage(this._image),this.updateCesiumStyle()):this.getLogger().info("trying to set text on a style function")}get style(){return this._style}set style(e){re(e,[_e,Function]),e instanceof _e?(this._stroke=e.getStroke(),this._fill=e.getFill(),this._text=e.getText(),this._image=e.getImage()):(this._stroke=void 0,this._fill=void 0,this._text=void 0,this._image=void 0),this._style=e,this._fill&&this._fill.getColor()&&(this._fillOptions={color:Te(this._fill.getColor())}),this._text&&this._text.setText(this._label),this.updateCesiumStyle()}_setFill(){if(this._style instanceof _e){const e=this._fillOptions.pattern?Ph(this._fillOptions):this._fillOptions.color;this._fill?this._fill.setColor(e):(this._fill=new gt({color:e}),this._style.setFill(this._fill)),this._fillOptions.pattern&&(this._fill.fallBackColor=this._fillOptions.color),this.updateCesiumStyle()}}updateCesiumStyle(){this.updateCesiumStyleColor(!0),this.updateCesiumStyleImage(!0),this.updateCesiumStyleText(!0),this._styleChanged()}updateCesiumStyleColor(e){const t=te("olcs_color",!0);this.stroke&&this.stroke.getColor()&&t.splice(1,0,[`\${olcs_geometryType}===${La.POLYLINE}`,je(this.stroke.getColor())]),this._image instanceof Is&&this._image.getFill()&&t.splice(1,0,[`\${olcs_geometryType}===${La.POINT}`,je(this._image.getFill().getColor())]),this.fillColor&&t.splice(-1,1,["true",je(this.fillColor)]),this.cesiumStyle.color={conditions:t},e||this._styleChanged()}updateCesiumStyleImage(e){const t=te("olcs_scale"),s=te("olcs_outlineWidth"),r=te("olcs_outlineColor",!0),n=te("olcs_pointSize"),a=te("olcs_image");if(this._image)if(this._image.getScale()!=null&&t.splice(1,1,["true",`${this._image.getScale()}`]),this._image instanceof Is){const o=this._image.getStroke();let l=this._image.getRadius()*2;if(o){this._image.getStroke().getColor()&&r.splice(1,1,["true",je(this._image.getStroke().getColor())]);const h=this._image.getStroke().getWidth();s.splice(1,1,["true",`${h}`]),l-=h}n.splice(1,1,["true",`${l}`])}else if(this._image instanceof Rn){const o=this._image.getImage(1).toDataURL();a.splice(1,1,["true",`"${o}"`])}else this._image instanceof Ps&&a.splice(1,1,["true",`"${this._image.getSrc()}"`]);this.cesiumStyle.scale={conditions:t},this.cesiumStyle.pointOutlineWidth={conditions:s},this.cesiumStyle.pointOutlineColor={conditions:r},this.cesiumStyle.pointSize={conditions:n},this.cesiumStyle.image={conditions:a},this.cesiumStyle.verticalOrigin="1",this.cesiumStyle.horizontalOrigin="0",e||this._styleChanged()}updateCesiumStyleText(e){const t=te("olcs_font"),s=te("olcs_labelText"),r=te("olcs_fontColor",!0),n=te("olcs_fontOutlineWidth"),a=te("olcs_fontOutlineColor",!0);this._text&&(this._text.getFont()&&t.splice(1,1,["true",`'${this._text.getFont()}'`]),this._text.getText()&&s.splice(1,1,["true",`'${this._text.getText()}'`]),this._text.getFill()&&this._text.getFill().getColor()&&r.splice(1,1,["true",je(this._text.getFill().getColor())]),this._text.getStroke()&&this._text.getStroke().getColor()&&(a.splice(1,1,["true",je(this._text.getStroke().getColor())]),n.splice(1,1,["true",`${this._text.getStroke().getWidth()||1.25}`]))),this.cesiumStyle.font={conditions:t},this.cesiumStyle.labelText={conditions:s},this.cesiumStyle.labelColor={conditions:r},this.cesiumStyle.labelOutlineWidth={conditions:n},this.cesiumStyle.labelOutlineColor={conditions:a},this.cesiumStyle.labelStyle="Boolean(${olcs_fontOutlineWidth}) === true ? 2 : 0",this.cesiumStyle.labelHorizontalOrigin="0";let o=Xe.CENTER;if(this._text)switch(this._text.getTextBaseline()){case"top":o=Xe.TOP;break;case"middle":o=Xe.CENTER;break;case"bottom":o=Xe.BOTTOM;break;case"alphabetic":o=Xe.TOP;break;case"hanging":o=Xe.BOTTOM;break}this.cesiumStyle.labelVerticalOrigin=o,e||this._styleChanged()}clone(e){if(e)return e.style=this._style instanceof _e?this._style.clone():this._style,this._fillOptions&&this._fillOptions.color&&(e.fillColor=this._fillOptions.color.slice(),this._fillOptions.pattern&&(e.pattern=S({},this._fillOptions.pattern))),Object.keys(this.exclude).forEach(s=>{this.exclude[s]&&e.unset(s)}),e;const t=this.toJSON();return delete t.name,new W(t)}assign(e){return super.assign(e),e.fillColor&&(this.fillColor=e.fillColor.slice()),e.pattern?this.pattern=S({},e.pattern):this.pattern=void 0,e.stroke&&(this.stroke=e.stroke.clone()),e.image&&(this.image=e.image.clone()),e.text&&(this.text=e.text.clone()),e.label&&(this.label=e.label),Object.keys(e.exclude).forEach(t=>{e.exclude[t]&&this.unset(t)}),this}toJSON(){const e=super.toJSON();return this._fillOptions?(e.fill={color:Te(this._fillOptions.color).slice()},this._fillOptions.pattern&&(e.fill.pattern=S({},this._fillOptions.pattern))):this.exclude.fill&&(e.fill=!1),this._stroke?e.stroke=er(this._stroke):this.exclude.stroke&&(e.stroke=!1),this._text&&(e.text=Th(this._text)),this._label&&(e.label=this._label),this._image instanceof Ps?e.image={src:this._image.getSrc(),scale:this._image.getScale(),opacity:this._image.getOpacity()}:this._image instanceof Is?e.image={scale:this._image.getScale(),fill:en(this._image),radius:this._image.getRadius(),stroke:this._image.getStroke()?er(this._image.getStroke()):void 0}:this._image instanceof Rn?e.image={scale:this._image.getScale(),fill:en(this._image),points:this._image.getPoints(),angle:this._image.getAngle(),radius:this._image.getRadius(),stroke:this._image.getStroke()?er(this._image.getStroke()):void 0}:this.exclude.image&&(e.image=!1),e}getOptionsForFeature(e){const t=e.getGeometry().getType(),s=e.get("olcs_extrudedHeight")||e.get("olcs_storeyHeight")&&e.get("olcs_storeyNumber"),r=new Set;t==="Point"||t==="MultiPoint"?(e[Ae].label!=null&&(r.add("text"),r.add("label")),r.add("image"),s&&r.add("stroke")):t==="LineString"||t==="MultiLineString"?(r.add("stroke"),s&&r.add("fill")):t==="Polygon"||t==="MultiPolygon"||t==="Circle"?(r.add("stroke"),r.add("fill")):t==="GeometryCollection"&&(r.add("stroke"),r.add("fill"),r.add("image"),r.add("text"));const n=this.toJSON(),a={};return r.forEach(o=>{a[o]=n[o]}),a}unset(e){v(e,Object.keys(this.exclude)),e==="fill"?this.fillColor=void 0:this[e]=void 0,this.exclude[e]=!0}destroy(){this._image=null,this._stroke=null,this._fill=null,this._label=null,this._text=null,this._style=null,super.destroy()}}const mi=new W(Ia());Xi.registerClass(W.className,W);function Ah(i){const e=i.toBytes();return e[3]/=255,new W({fill:{color:e},stroke:{color:e,width:mi.stroke.getWidth()}})}const Ct=Symbol("originalStyle"),Re=Symbol("highlighted"),He=Symbol("hidden"),$e=Symbol("globalHidden");function Zi(i){return i&&i.content&&!i.content.isDestroyed()&&!i.content.batchTable.isDestroyed()}function Ta(i){(i instanceof qt||i instanceof Ut)&&Zi(i)||i instanceof ni?i.show=!1:i instanceof Z&&i.setStyle(Yi.clone())}function sn(i){Reflect.has(i,Ct)||((i instanceof qt||i instanceof Ut)&&Zi(i)?i[Ct]=i.color.clone():i instanceof Z&&(i[Ct]=i.getStyle()))}function Rh(i){if(!(i[$e]||i[He]||i[Re])){const e=i[Ct];(i instanceof qt||i instanceof Ut)&&Zi(i)?i.color=e:i instanceof Z&&i.setStyle(e),delete i[Ct]}}function rn(i){if(!(i[$e]||i[He])){const e=i[Re];(i instanceof qt||i instanceof Ut)&&Zi(i)?i.color=e.cesiumFillColor:i instanceof Z&&i.setStyle(e.style)}}function Na(i){delete i[Ct],sn(i),i[He]||i[$e]?Ta(i):i[Re]&&rn(i)}function y_(i){delete i[Re],Rh(i)}function Gh(i,e){delete i[e],i[He]||i[$e]||(((i instanceof qt||i instanceof Ut)&&Zi(i)||i instanceof ni)&&(i.show=!0),i[Re]?rn(i):Rh(i))}const X={HIGHLIGHT:1,UNHIGHLIGHT:2,HIDE:3,SHOW:4};function kh(i,e){function t({action:n,ids:a}){if(n===X.HIGHLIGHT){const o={};a.forEach(l=>{o[l]=i.highlightedObjects[l].style}),e.highlight(o)}else n===X.UNHIGHLIGHT?e.unHighlight(a):n===X.HIDE?e.hideObjects(a):n===X.SHOW&&e.showObjects(a)}const s=Object.keys(i.highlightedObjects);s.length>0&&t({action:X.HIGHLIGHT,ids:s});const r=Object.keys(i.hiddenObjects);return r.length>0&&t({action:X.HIDE,ids:r}),i.changed.addEventListener(t)}class nn{constructor(){this.hiddenObjects={},this.highlightedObjects={},this.lastUpdated=Date.now(),this.changed=new I}highlight(e){const t=[];Object.entries(e).forEach(([s,r])=>{let n=r;r instanceof Ne?n=Ah(r):r instanceof _e&&(n=new W({}),r.getText()&&r.getText().getText()&&!Array.isArray(r.getText().getText())&&(n.label=String(r.getText().getText())),n.style=r),n=n,this.highlightedObjects[s]?this.highlightedObjects[s].style!==n&&(this.highlightedObjects[s].style=n,this.highlightedObjects[s].features.forEach((a,o)=>{o[Re]=n,rn(o)})):(this.highlightedObjects[s]={style:n,features:new Set},t.push(s))}),t.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:X.HIGHLIGHT,ids:t}))}unHighlight(e){const t=[];e.forEach(s=>{this.highlightedObjects[s]&&(this.highlightedObjects[s].features.forEach(r=>{y_(r)}),delete this.highlightedObjects[s],t.push(s))}),t.length>0&&this.changed.raiseEvent({action:X.UNHIGHLIGHT,ids:t})}clearHighlighting(){this.unHighlight(Object.keys(this.highlightedObjects))}hasHighlightFeature(e,t){return this.highlightedObjects[e]&&this.highlightedObjects[e].features.has(t)}addHighlightFeature(e,t){this.highlightedObjects[e]&&(sn(t),this.highlightedObjects[e].features.add(t),t[Re]=this.highlightedObjects[e].style,rn(t))}hideObjects(e){const t=[];e.forEach(s=>{this.hiddenObjects[s]||(this.hiddenObjects[s]=new Set,t.push(s))}),t.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:X.HIDE,ids:t}))}showObjects(e){const t=[];e.forEach(s=>{this.hiddenObjects[s]&&(this.hiddenObjects[s].forEach(r=>{Gh(r,He)}),delete this.hiddenObjects[s],t.push(s))}),t.length>0&&this.changed.raiseEvent({action:X.SHOW,ids:t})}clearHiddenObjects(){this.showObjects(Object.keys(this.hiddenObjects))}hasHiddenFeature(e,t){return this.hiddenObjects[e]&&this.hiddenObjects[e].has(t)}addHiddenFeature(e,t){this.hiddenObjects[e]&&(sn(t),this.hiddenObjects[e].add(t),t[He]=!0,Ta(t))}destroy(){Object.values(this.hiddenObjects).forEach(e=>{e.clear()}),this.hiddenObjects={},Object.values(this.highlightedObjects).forEach(({features:e})=>{e.clear()}),this.highlightedObjects={},this.changed.destroy()}}class an{constructor(){this.hiddenObjects={},this._hiddenObjectFeatures={},this.lastUpdated=Date.now(),this.changed=new I}hideObjects(e){v(e,[String]);const t=[];e.forEach(s=>{this.hiddenObjects[s]||(t.push(s),this.hiddenObjects[s]=0),this.hiddenObjects[s]+=1}),t.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:X.HIDE,ids:t}))}showObjects(e){v(e,[String]);const t=[];e.forEach(s=>{this.hiddenObjects[s]&&(this.hiddenObjects[s]-=1,this.hiddenObjects[s]===0&&(this._hiddenObjectFeatures[s]&&(this._hiddenObjectFeatures[s].forEach(r=>{Gh(r,$e)}),this._hiddenObjectFeatures[s].clear()),delete this.hiddenObjects[s],t.push(s)))}),t.length>0&&this.changed.raiseEvent({action:X.SHOW,ids:t})}addFeature(e,t){this._hiddenObjectFeatures[e]||(this._hiddenObjectFeatures[e]=new Set),sn(t),this._hiddenObjectFeatures[e].add(t),t[$e]=!0,Ta(t)}hasFeature(e,t){return this._hiddenObjectFeatures[e]?this._hiddenObjectFeatures[e].has(t):!1}destroy(){this.hiddenObjects={},Object.values(this._hiddenObjectFeatures).forEach(e=>{e.clear()}),this._hiddenObjectFeatures={},this.changed.destroy()}}const Da="2.0";class de extends ut{static get className(){return"Layer"}static get vcsLayerNameSymbol(){return j}static getDefaultOptions(){return{name:void 0,extent:void 0,activeOnStartup:!1,allowPicking:!0,exclusiveGroups:[],mapNames:[],url:void 0,hiddenObjectIds:[],copyright:void 0}}constructor(e){super(e);const t=de.getDefaultOptions();this.extent=e.extent?new Me(e.extent):null,this.activeOnStartup=ae(e.activeOnStartup,t.activeOnStartup),this._allowPicking=ae(e.allowPicking,t.allowPicking),this._state=ee.INACTIVE,this._loadingPromise=null,this._initialized=!1,this.mapNames=e.mapNames||t.mapNames,this._supportedMaps=[],this._url=e.url,this._zIndex=B(e.zIndex,0),this.zIndexChanged=new I,this._hiddenObjectIds=Array.isArray(e.hiddenObjectIds)?e.hiddenObjectIds:t.hiddenObjectIds,this._globalHider=null,this._exclusiveGroups=Array.isArray(e.exclusiveGroups)?e.exclusiveGroups.slice():t.exclusiveGroups,this.exclusiveGroupsChanged=new I,this.copyright=e.copyright||t.copyright,this._implementations=new Map,this._activeMaps=new Set,this.stateChanged=new I,this.featureProvider=void 0,this._locale="en"}get initialized(){return this._initialized}get active(){return this._state===ee.ACTIVE}get loading(){return!!(this._state&ee.LOADING)}get state(){return this._state}get allowPicking(){return this._allowPicking}set allowPicking(e){this._allowPicking=e}get url(){return this._url?typeof this._url=="string"?this._url:this._url[this._locale]?this._url[this._locale]:Object.values(this._url)[0]:""}set url(e){v(e,[String,Object]),this._url!==e&&(this._url=e,this.reload())}get hiddenObjectIds(){return this._hiddenObjectIds}set hiddenObjectIds(e){v(e,[String]),this._globalHider&&this.active&&this._globalHider.hideObjects(e),this._hiddenObjectIds=e}get globalHider(){return this._globalHider}setGlobalHider(e){re(e,an),e&&this.active&&e.hideObjects(this.hiddenObjectIds),this._globalHider=e}get exclusive(){return this._exclusiveGroups.length>0}get exclusiveGroups(){return this._exclusiveGroups.slice()}set exclusiveGroups(e){v(e,[[String,Symbol]]),(e.length!==this._exclusiveGroups.length||!e.every(t=>this._exclusiveGroups.includes(t)))&&(this._exclusiveGroups=e.slice(),this.exclusiveGroupsChanged.raiseEvent(e))}get zIndex(){return this._zIndex}set zIndex(e){v(e,Number),this._zIndex!==e&&(this._zIndex=e,this.zIndexChanged.raiseEvent(e))}get locale(){return this._locale}set locale(e){v(e,String),this._locale!==e&&(this._locale=e,this._url&&typeof this._url=="object"&&this._url[this._locale]&&this.reload())}createImplementationsForMap(e){return[]}getImplementationsForMap(e){return this._implementations.has(e)||(this.isSupported(e)?this._implementations.set(e,this.createImplementationsForMap(e)):this._implementations.set(e,[])),this._implementations.get(e)}getImplementations(){return[...this._implementations.values()].flat()}getImplementationOptions(){return{name:this.name,url:this.url}}reload(){return this.forceRedraw()}async forceRedraw(){const t=[...this._implementations.keys()].map(s=>(this.removedFromMap(s),s.active?this.mapActivated(s):Promise.resolve()));await Promise.all(t)}getExtent(){return this.extent}getZoomToExtent(){return this.extent&&this.extent.isValid()?this.extent:null}initialize(){return this._initialized=!0,Promise.resolve()}async mapActivated(e){this.getLogger().debug(`Layer: ${this.name} mapActivated is called from Map: ${e.name}`),this._activeMaps.add(e),(this.active||this.loading&&this.initialized)&&await this._activateImplsForMap(e)}mapDeactivated(e){this.getLogger().debug(`Layer: ${this.name} mapDeactivated is called from Map: ${e.name}`),this._activeMaps.delete(e),(this.active||this.loading)&&this.getImplementationsForMap(e).forEach(t=>{t.deactivate()})}removedFromMap(e){this._activeMaps.delete(e),this.getImplementationsForMap(e).forEach(t=>{t.destroy()}),this._implementations.delete(e)}isSupported(e){return e&&this._supportedMaps.includes(e.className)&&(this.mapNames.length===0||this.mapNames.indexOf(e.name)>=0)}async _activateImplsForMap(e){const t=this.getImplementationsForMap(e);try{await Promise.all(t.map(s=>s.activate()))}catch(s){this.getLogger().error(`Layer ${this.name} could not activate impl for map ${e.name}`),this.getLogger().error(s),this._implementations.set(e,[]),t.forEach(r=>{r.destroy()})}}async _activate(){this._state=ee.LOADING;try{this.stateChanged.raiseEvent(ee.LOADING)}catch(e){this.getLogger().debug(`Error on raising LayerState.LOADING event for layer ${this.name} : ${e.message}`)}if(await this.initialize(),this._state===ee.LOADING&&(await Promise.all([...this._activeMaps].map(e=>this._activateImplsForMap(e))),this._state===ee.LOADING)){this._globalHider&&this._globalHider.hideObjects(this.hiddenObjectIds),this._state=ee.ACTIVE;try{this.stateChanged.raiseEvent(ee.ACTIVE)}catch(e){this.getLogger().debug(`Error on raising LayerState.ACTIVE event for layer ${this.name} : ${e.message}`)}this._loadingPromise=null}}activate(){return this._loadingPromise?this._loadingPromise:this._state===ee.INACTIVE?(this._loadingPromise=this._activate().catch(e=>(this._state=ee.INACTIVE,Promise.reject(e))),this._loadingPromise):Promise.resolve()}deactivate(){if(this._loadingPromise&&(this._loadingPromise=null),this._state!==ee.INACTIVE){this.getImplementations().forEach(e=>{(e.loading||e.active)&&e.deactivate()}),this._globalHider&&this._globalHider.showObjects(this.hiddenObjectIds),this._state=ee.INACTIVE;try{this.stateChanged.raiseEvent(ee.INACTIVE)}catch(e){this.getLogger().debug(`Error on raising LayerState.INACTIVE event for layer ${this.name} : ${e.message}`)}}}toJSON(){const e=super.toJSON(),t=de.getDefaultOptions();return this.activeOnStartup!==t.activeOnStartup&&(e.activeOnStartup=this.activeOnStartup),this.allowPicking!==t.allowPicking&&(e.allowPicking=this.allowPicking),this.mapNames.length>0&&(e.mapNames=this.mapNames.slice()),this.hiddenObjectIds.length>0&&(e.hiddenObjectIds=this.hiddenObjectIds.slice()),this._url&&(e.url=this._url),this.extent&&this.extent.isValid()&&(e.extent=this.extent.toJSON()),this._exclusiveGroups.length>0&&(e.exclusiveGroups=this._exclusiveGroups.slice()),this.copyright!==t.copyright&&(e.copyright=S({},this.copyright)),e}destroy(){super.destroy(),this.featureProvider&&this.featureProvider.destroy(),this._activeMaps.clear(),this.getImplementations().forEach(e=>{e.destroy()}),this._initialized=!1,this._implementations.clear(),this.stateChanged.destroy(),this.zIndexChanged.destroy(),this.exclusiveGroupsChanged.destroy()}}ue.registerClass(de.className,de);const zh=Symbol("alreadyTransformedToMercator"),Ge=Symbol("alreadyTransformedToImage"),Rt=Symbol("obliqueGeometry"),Fa=Symbol("doNotTransform"),Jt=Symbol("OriginalFeature"),Ki=Symbol("ActuallyIsCircle"),Gt=Symbol("createSync"),pi=new Ne,__=new An({font:"30px sans-serif",fill:new gt({color:tr}),textAlign:"left",offsetY:-15});function jh(i,e,t){t[e].conditions?i[e]=new vf(t[e],t.defines):i[e]=new Sf(t[e],t.defines)}class Oe extends dt{static get className(){return"DeclarativeStyleItem"}constructor(e){super(e);const t=e.declarativeStyle||{};t.show=t.show!=null?t.show:!0,this.cesiumStyle=new Vn(t),this._style=this._styleFunction.bind(this),t.strokeColor&&jh(this.cesiumStyle,"strokeColor",t),t.strokeWidth&&jh(this.cesiumStyle,"strokeWidth",t),this._styleOptions=t,this._circleCache=new Map}get styleOptions(){return JSON.parse(JSON.stringify(this._styleOptions))}toJSON(){const e=super.toJSON();return e.declarativeStyle=Object.fromEntries(Object.entries(this.cesiumStyle.style).filter(([,t])=>t!=null).map(([t,s])=>ia(s,Boolean)?[t,s.toString()]:[t,s])),e}clone(e){if(e)return e.assign(this);const t=this.toJSON();return delete t.name,new Oe(t)}assign(e){return super.assign(e),this._styleOptions=e.cesiumStyle.style,this.cesiumStyle=new Vn(this._styleOptions),this}_styleFunction(e){const t=e[Jt]||e;if(!this.cesiumStyle.show.evaluate(t))return Yi;const s=t.getGeometry().getType();return s==="Point"?this._stylePoint(t):s==="Polygon"?this._stylePolygon(t):s==="LineString"?this._styleLineString(t):s==="Circle"?this._stylePolygon(t):s==="MultiPoint"?this._stylePoint(t):s==="MultiPolygon"?this._stylePolygon(t):s==="MultiLineString"?this._styleLineString(t):(this.getLogger().warning(`could not style geometry type: ${s}`),Yi)}_stylePolygon(e){const t=new _e({}),s=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(e,pi):Ne.WHITE;return s&&t.setFill(new gt({color:At(s)})),this._evaluateStroke(e,t),t}_styleLineString(e){const t=new _e({}),s=e.get("olcs_extrudedHeight")||e.get("olcs_storeyHeight")&&e.get("olcs_storeyNumber"),r=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(e,pi):Ne.WHITE;if(r)if(s)t.setFill(new gt({color:At(r)}));else{const n=this.cesiumStyle.strokeWidth?this.cesiumStyle.strokeWidth.evaluate(e):1;t.setStroke(new ot({width:Number.isFinite(n)?n:1,color:At(r)}))}return s&&this._evaluateStroke(e,t),t}_stylePoint(e){const t=new _e({});if(this.cesiumStyle.labelText){const s=this.cesiumStyle.labelText.evaluate(e);if(s){const r=__.clone();if(r.setText(s.toString()),this.cesiumStyle.font){const n=this.cesiumStyle.font.evaluate(e);n&&r.setFont(n)}if(this.cesiumStyle.labelColor){const n=this.cesiumStyle.labelColor.evaluateColor(e,pi);n&&r.getFill().setColor(At(n))}if(this.cesiumStyle.labelOutlineColor){const n=this.cesiumStyle.labelOutlineColor.evaluate(e,pi);if(n){const a=this.cesiumStyle.labelOutlineWidth?this.cesiumStyle.labelOutlineWidth.evaluate(e):1;r.setStroke(new ot({color:At(n),width:a}))}}t.setText(r)}}if(this.cesiumStyle.image){const s=this.cesiumStyle.image.evaluate(e);s&&t.setImage(new Ps({src:s}))}else{const s=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(e,pi):Ne.WHITE;let r=4;this.cesiumStyle.pointSize&&(r=this.cesiumStyle.pointSize.evaluate(e)/2);const n=this.cesiumStyle.pointOutlineWidth?this.cesiumStyle.pointOutlineWidth.evaluate(e):0;let a=Ne.BLACK;n&&(this.cesiumStyle.pointOutlineColor&&(a=this.cesiumStyle.pointOutlineColor.evaluateColor(e,pi)),r+=n/2);const o=`${r}${s}${n}${a}`;if(!this._circleCache.has(o)){const l={radius:r,fill:new gt({color:At(s)})};n&&(l.stroke=new ot({color:At(a),width:n})),this._circleCache.set(o,new Is(l))}t.setImage(this._circleCache.get(o))}if(this.cesiumStyle.scale&&t.getImage()){const s=this.cesiumStyle.scale.evaluate(e);Number.isFinite(s)&&t.getImage().setScale(s)}return this._evaluateStroke(e,t),t}_evaluateStroke(e,t){if(this.cesiumStyle.strokeColor){const s=this.cesiumStyle.strokeColor.evaluateColor(e,pi);if(s){const r=this.cesiumStyle.strokeWidth?this.cesiumStyle.strokeWidth.evaluate(e):1;t.setStroke(new ot({width:Number.isFinite(r)?r:1,color:At(s)}))}}}get show(){return this._styleOptions.show}set show(e){this._styleOptions.show=e,this.cesiumStyle.show=e,this._styleChanged()}get color(){return this._styleOptions.color}set color(e){this._styleOptions.color=e,this.cesiumStyle.color=e,this._styleChanged()}get strokeColor(){return this._styleOptions.strokeColor}set strokeColor(e){this._styleOptions.strokeColor=e,this.cesiumStyle.strokeColor=e,this._styleChanged()}get strokeWidth(){return this._styleOptions.strokeWidth}set strokeWidth(e){this._styleOptions.strokeWidth=e,this.cesiumStyle.strokeWidth=e,this._styleChanged()}get image(){return this._styleOptions.image}set image(e){this._styleOptions.image=e,this.cesiumStyle.image=e,this._styleChanged()}get labelText(){return this._styleOptions.labelText}set labelText(e){this._styleOptions.labelText=e,this.cesiumStyle.labelText=e,this._styleChanged()}get labelColor(){return this._styleOptions.labelColor}set labelColor(e){this._styleOptions.labelColor=e,this.cesiumStyle.labelColor=e,this._styleChanged()}get font(){return this._styleOptions.font}set font(e){this._styleOptions.font=e,this.cesiumStyle.font=e,this._styleChanged()}get pointSize(){return this._styleOptions.pointSize}set pointSize(e){this._styleOptions.pointSize=e,this.cesiumStyle.pointSize=e,this._styleChanged()}destroy(){this._circleCache.clear(),super.destroy()}}Xi.registerClass(Oe.className,Oe);const Hh=new Oe({declarativeStyle:{show:!0,color:{conditions:te("olcs_color",!0)},scale:{conditions:te("olcs_scale")},pointOutlineWidth:{conditions:te("olcs_outlineWidth")},pointOutlineColor:{conditions:te("olcs_outlineColor",!0)},pointSize:{conditions:te("olcs_pointSize")},image:{conditions:te("olcs_image")},font:{conditions:te("olcs_font")},labelStyle:"2",labelText:{conditions:te("olcs_labelText")},labelColor:{conditions:te("olcs_fontColor",!0)},labelOutlineWidth:{conditions:te("olcs_fontOutlineWidth")},labelOutlineColor:{conditions:te("olcs_fontOutlineColor",!0)},verticalOrigin:"1",horizontalOrigin:"0",labelHorizontalOrigin:"0",labelVerticalOrigin:"1"}});function Aa(i,e){if(i.image&&i.image.src&&/^data:/.test(i.image.src))if(e){let t=e.indexOf(i.image.src);t===-1&&(e.push(i.image.src),t=e.length-1),i.image.src=`:${t}`}else i.image={radius:5};return i}function $h(i,e={}){return i instanceof W?e.style=Aa(i.toJSON(),e.embeddedIcons):i instanceof Oe&&(e.style=i.toJSON()),e}function Ra(){return Ie("VectorProperties")}const yi={clampToGround:Qe.CLAMP_TO_GROUND,absolute:Qe.NONE,relativeToGround:Qe.RELATIVE_TO_GROUND},_i={both:ki.BOTH,cesium3DTile:ki.CESIUM_3D_TILE,terrain:ki.TERRAIN};function on(i,e){if(Array.isArray(i)){const t=i.map(s=>N(s,null)).filter(s=>s!=null);if(t.length===4)return new Ds(t[0],t[1],t[2],t[3])}return e}function ln(i,e){if(Array.isArray(i)){const t=i.map(s=>N(s,null)).filter(s=>s!=null);if(t.length===3)return new M(t[0],t[1],t[2])}return e}function vi(i,e){if(Array.isArray(i))return i.map(t=>N(t,null)).filter(t=>t!==null&&t>0);{const t=N(i,null);if(t&&t>0)return[t]}return Array.isArray(e)?e:[e]}function ir(i){return Object.keys(yi).find(e=>yi[e]===i)}function hn(i){return Object.keys(_i).find(e=>_i[e]===i)}function cn(i){return i?Ds.pack(i,[]):void 0}function un(i){return i?M.pack(i,[]):void 0}class nt{static getDefaultOptions(){return{altitudeMode:"clampToGround",allowPicking:!0,classificationType:void 0,scaleByDistance:void 0,eyeOffset:void 0,heightAboveGround:0,skirt:0,groundLevel:void 0,extrudedHeight:0,storeysAboveGround:0,storeysBelowGround:0,storeyHeightsAboveGround:[],storeyHeightsBelowGround:[],storeyHeight:void 0,modelUrl:void 0,modelScaleX:1,modelScaleY:1,modelScaleZ:1,modelHeading:0,modelPitch:0,modelRoll:0,modelOptions:void 0,baseUrl:void 0}}constructor(e){const t=nt.getDefaultOptions();this._altitudeMode=Xt(e.altitudeMode,yi,Qe.CLAMP_TO_GROUND),this._allowPicking=ae(e.allowPicking,t.allowPicking),this._classificationType=Xt(e.classificationType,_i,void 0),this._scaleByDistance=on(e.scaleByDistance,void 0),this._eyeOffset=ln(e.eyeOffset,void 0),this._heightAboveGround=N(e.heightAboveGround,t.heightAboveGround),this._skirt=N(e.skirt,t.skirt),this._groundLevel=N(e.groundLevel,t.groundLevel),this._extrudedHeight=N(e.extrudedHeight,t.extrudedHeight),this._storeysAboveGround=B(e.storeysAboveGround,t.storeysAboveGround),this._storeysBelowGround=B(e.storeysBelowGround,t.storeysBelowGround),this._storeyHeightsAboveGround=vi(e.storeyHeightsAboveGround,t.storeyHeightsAboveGround),this._storeyHeightsBelowGround=vi(e.storeyHeightsBelowGround,t.storeyHeightsBelowGround),this._storeyHeight=N(e.storeyHeight,t.storeyHeight),this._modelUrl=e.modelUrl||t.modelUrl,this._modelScaleX=N(e.modelScaleX,t.modelScaleX),this._modelScaleY=N(e.modelScaleY,t.modelScaleY),this._modelScaleZ=N(e.modelScaleZ,t.modelScaleZ),this._modelHeading=N(e.modelHeading,t.modelHeading),this._modelPitch=N(e.modelPitch,t.modelPitch),this._modelRoll=N(e.modelRoll,t.modelRoll),this._baseUrl=e.baseUrl||t.baseUrl,this._modelOptions=e.modelOptions||t.modelOptions,this.propertyChanged=new I}get altitudeMode(){return this._altitudeMode}set altitudeMode(e){e!==this._altitudeMode&&(v(e,Object.values(Qe)),this._altitudeMode=e,this.propertyChanged.raiseEvent(["altitudeMode"]))}getAltitudeMode(e){const t=e.get("olcs_altitudeMode");return Xt(t,yi,this._altitudeMode)}get allowPicking(){return this._allowPicking}set allowPicking(e){e!==this._allowPicking&&(v(e,Boolean),this._allowPicking=e,this.propertyChanged.raiseEvent(["allowPicking"]))}getAllowPicking(e){const t=e.get("olcs_allowPicking");return ae(t,this._allowPicking)}get classificationType(){return this._classificationType}set classificationType(e){e!==this._classificationType&&(re(e,Object.values(ki)),this._classificationType=e,this.propertyChanged.raiseEvent(["classificationType"]))}getClassificationType(e){const t=e.get("olcs_classificationType");return Xt(t,_i,this.classificationType)}get scaleByDistance(){return this._scaleByDistance}set scaleByDistance(e){Ds.equals(e,this._scaleByDistance)||(re(e,Ds),this._scaleByDistance=e,this.propertyChanged.raiseEvent(["scaleByDistance"]))}getScaleByDistance(e){const t=e.get("olcs_scaleByDistance");return on(t,this.scaleByDistance)}get eyeOffset(){return this._eyeOffset}set eyeOffset(e){M.equals(this.eyeOffset,e)||(re(e,M),this._eyeOffset=e,this.propertyChanged.raiseEvent(["eyeOffset"]))}getEyeOffset(e){const t=e.get("olcs_eyeOffset");if(!t){const s=e.get("olcs_zCoordinateEyeOffset");if(s)return Ra().deprecate("zCoordinateEyeOffset","use eyeOffset and provide [0,0,value]"),new M(0,0,N(s,0))}return ln(t,this.eyeOffset)}get heightAboveGround(){return this._heightAboveGround}set heightAboveGround(e){e!==this._heightAboveGround&&(v(e,Number),this._heightAboveGround=e,this.propertyChanged.raiseEvent(["heightAboveGround"]))}getHeightAboveGround(e){const t=e.get("olcs_heightAboveGround");return N(t,this.heightAboveGround)}get skirt(){return this._skirt}set skirt(e){e!==this._skirt&&(v(e,Number),this._skirt=e,this.propertyChanged.raiseEvent(["skirt"]))}getSkirt(e){const t=e.get("olcs_skirt");return N(t,this.skirt)}get groundLevel(){return this._groundLevel}set groundLevel(e){e!==this._groundLevel&&(re(e,Number),this._groundLevel=e,this.propertyChanged.raiseEvent(["groundLevel"]))}getGroundLevel(e){const t=e.get("olcs_groundLevel");return N(t,this.groundLevel)}get extrudedHeight(){return this._extrudedHeight}set extrudedHeight(e){e!==this._extrudedHeight&&(v(e,Number),this._extrudedHeight=e,this.propertyChanged.raiseEvent(["extrudedHeight"]))}getExtrudedHeight(e){const t=e.get("olcs_extrudedHeight");return N(t,this.extrudedHeight)}get storeysAboveGround(){return this._storeysAboveGround}set storeysAboveGround(e){e!==this._storeysAboveGround&&(v(e,Number),this._storeysAboveGround=Math.trunc(e),this.propertyChanged.raiseEvent(["storeysAboveGround"]))}getStoreysAboveGround(e){const t=e.get("olcs_storeysAboveGround");return B(t,this.storeysAboveGround)}get storeysBelowGround(){return this._storeysBelowGround}set storeysBelowGround(e){e!==this._storeysBelowGround&&(v(e,Number),this._storeysBelowGround=Math.trunc(e),this.propertyChanged.raiseEvent(["storeysBelowGround"]))}getStoreysBelowGround(e){const t=e.get("olcs_storeysBelowGround");return B(t,this.storeysBelowGround)}get storeyHeightsAboveGround(){return this._storeyHeightsAboveGround.slice()}set storeyHeightsAboveGround(e){Ft(e,this._storeyHeightsAboveGround)||(v(e,[Number]),this._storeyHeightsAboveGround=e,this.propertyChanged.raiseEvent(["storeyHeightsAboveGround"]))}getStoreyHeightsAboveGround(e){const t=e.get("olcs_storeyHeightsAboveGround");return vi(t,this.storeyHeightsAboveGround)}get storeyHeightsBelowGround(){return this._storeyHeightsBelowGround.slice()}set storeyHeightsBelowGround(e){Ft(e,this._storeyHeightsBelowGround)||(v(e,[Number]),this._storeyHeightsBelowGround=e,this.propertyChanged.raiseEvent(["storeyHeightsBelowGround"]))}getStoreyHeightsBelowGround(e){const t=e.get("olcs_storeyHeightsBelowGround");return vi(t,this.storeyHeightsBelowGround)}get storeyHeight(){return this._storeyHeight}set storeyHeight(e){e!==this._storeyHeight&&(Ra().deprecate("storeyHeight","use storeyHeightAboveGround"),v(e,Number),this._storeyHeight=e,this.propertyChanged.raiseEvent(["storeyHeight"]))}get modelUrl(){return this._modelUrl}set modelUrl(e){v(e,String),this._modelUrl!==e&&(this._modelUrl=e,this.propertyChanged.raiseEvent(["modelUrl"]))}getModelUrl(e){const t=e.get("olcs_modelUrl");return t!==void 0?t:this.modelUrl}get modelScaleX(){return this._modelScaleX}set modelScaleX(e){v(e,Number),this._modelScaleX!==e&&(this._modelScaleX=e,this.propertyChanged.raiseEvent(["modelScaleX"]))}getModelScaleX(e){const t=e.get("olcs_modelScaleX");return N(t,this.modelScaleX)}get modelScaleY(){return this._modelScaleY}set modelScaleY(e){v(e,Number),this._modelScaleY!==e&&(this._modelScaleY=e,this.propertyChanged.raiseEvent(["modelScaleY"]))}getModelScaleY(e){const t=e.get("olcs_modelScaleY");return N(t,this.modelScaleY)}get modelScaleZ(){return this._modelScaleZ}set modelScaleZ(e){v(e,Number),this._modelScaleZ!==e&&(this._modelScaleZ=e,this.propertyChanged.raiseEvent(["modelScaleZ"]))}getModelScaleZ(e){const t=e.get("olcs_modelScaleZ");return N(t,this.modelScaleZ)}get modelHeading(){return this._modelHeading}set modelHeading(e){v(e,Number),this._modelHeading!==e&&(this._modelHeading=e,this.propertyChanged.raiseEvent(["modelHeading"]))}getModelHeading(e){const t=e.get("olcs_modelHeading");return N(t,this.modelHeading)}get modelPitch(){return this._modelPitch}set modelPitch(e){v(e,Number),this._modelPitch!==e&&(this._modelPitch=e,this.propertyChanged.raiseEvent(["modelPitch"]))}getModelPitch(e){const t=e.get("olcs_modelPitch");return N(t,this.modelPitch)}get modelRoll(){return this._modelRoll}set modelRoll(e){v(e,Number),this._modelRoll!==e&&(this._modelRoll=e,this.propertyChanged.raiseEvent(["modelRoll"]))}getModelRoll(e){const t=e.get("olcs_modelRoll");return N(t,this.modelRoll)}get modelOptions(){return this._modelOptions}set modelOptions(e){re(e,Object),this._modelOptions!==e&&(this._modelOptions=e,this.propertyChanged.raiseEvent(["modelOptions"]))}getModelOptions(e){const t=e.get("olcs_modelOptions");return t||(this.modelOptions?this.modelOptions:{})}get baseUrl(){return this._baseUrl}set baseUrl(e){v(e,String),this._baseUrl!==e&&(this._baseUrl=e,this.propertyChanged.raiseEvent(["baseUrl"]))}getBaseUrl(e){const t=e.get("olcs_baseUrl");return t!==void 0?t:this.baseUrl}getModel(e){let t=this.getModelUrl(e);if(!t)return null;const s=this.getBaseUrl(e);return s&&(t=new URL(t,s).toString()),{url:t,scale:[this.getModelScaleX(e),this.getModelScaleY(e),this.getModelScaleZ(e)],heading:this.getModelHeading(e),pitch:this.getModelPitch(e),roll:this.getModelRoll(e)}}setVcsMeta(e){const t=nt.getDefaultOptions();e.altitudeMode||(e.altitudeMode=ir(this.altitudeMode)),Object.assign(t,e),this.setValues(t)}setValues(e){const t=nt.getDefaultOptions(),s=[];if("altitudeMode"in e){const r=Xt(t.altitudeMode,yi,void 0),n=Xt(e.altitudeMode,yi,r);this._altitudeMode!==n&&(this._altitudeMode=n,s.push("altitudeMode"))}if("allowPicking"in e){const r=ae(e.allowPicking,t.allowPicking);this._allowPicking!==r&&(this._allowPicking=r,s.push("allowPicking"))}if("classificationType"in e){const r=Xt(t.classificationType,_i,void 0),n=Xt(e.classificationType,_i,r);this._classificationType!==n&&(this._classificationType=n,s.push("classificationType"))}if("scaleByDistance"in e){const r=on(e.scaleByDistance,void 0);Ds.equals(r,this._scaleByDistance)||(this._scaleByDistance=r,s.push("scaleByDistance"))}if("eyeOffset"in e){const r=ln(e.eyeOffset,void 0);M.equals(r,this._eyeOffset)||(this._eyeOffset=r,s.push("eyeOffset"))}if("heightAboveGround"in e){const r=N(e.heightAboveGround,t.heightAboveGround);r!==this._heightAboveGround&&(this._heightAboveGround=r,s.push("heightAboveGround"))}if("skirt"in e){const r=N(e.skirt,t.skirt);r!==this._skirt&&(this._skirt=r,s.push("skirt"))}if("groundLevel"in e){const r=N(e.groundLevel,t.groundLevel);r!==this._groundLevel&&(this._groundLevel=r,s.push("groundLevel"))}if("extrudedHeight"in e){const r=N(e.extrudedHeight,t.extrudedHeight);r!==this._extrudedHeight&&(this._extrudedHeight=r,s.push("extrudedHeight"))}if("storeysAboveGround"in e){const r=B(e.storeysAboveGround,t.storeysAboveGround);r!==this._storeysAboveGround&&(this._storeysAboveGround=r,s.push("storeysAboveGround"))}if("storeysBelowGround"in e){const r=B(e.storeysBelowGround,t.storeysBelowGround);r!==this._storeysBelowGround&&(this._storeysBelowGround=r,s.push("storeysBelowGround"))}if("storeyHeightsAboveGround"in e){const r=vi(e.storeyHeightsAboveGround,t.storeyHeightsAboveGround);Ft(r,this._storeyHeightsAboveGround)||(this._storeyHeightsAboveGround=r,s.push("storeyHeightsAboveGround"))}if("storeyHeightsBelowGround"in e){const r=vi(e.storeyHeightsBelowGround,t.storeyHeightsBelowGround);Ft(r,this._storeyHeightsBelowGround)||(this._storeyHeightsBelowGround=r,s.push("storeyHeightsBelowGround"))}if("storeyHeight"in e){const r=N(e.storeyHeight,t.storeyHeight);r!==this._storeyHeight&&(Ra().deprecate("storeyHeight","use storeyHeightAboveGround"),this._storeyHeight=r,s.push("storeyHeight"))}if("modelUrl"in e&&e.modelUrl!==this._modelUrl&&(this._modelUrl=e.modelUrl,s.push("modelUrl")),"modelScaleX"in e){const r=N(e.modelScaleX,t.modelScaleX);r!==this._modelScaleX&&(this._modelScaleX=r,s.push("modelScaleX"))}if("modelScaleY"in e){const r=N(e.modelScaleY,t.modelScaleY);r!==this._modelScaleY&&(this._modelScaleY=r,s.push("modelScaleY"))}if("modelScaleZ"in e){const r=N(e.modelScaleZ,t.modelScaleZ);r!==this._modelScaleZ&&(this._modelScaleZ=r,s.push("modelScaleZ"))}if("modelHeading"in e){const r=N(e.modelHeading,t.modelHeading);r!==this._modelHeading&&(this._modelHeading=r,s.push("modelHeading"))}if("modelPitch"in e){const r=N(e.modelPitch,t.modelPitch);r!==this._modelPitch&&(this._modelPitch=r,s.push("modelPitch"))}if("modelRoll"in e){const r=N(e.modelRoll,t.modelRoll);r!==this._modelRoll&&(this._modelRoll=r,s.push("modelRoll"))}"baseUrl"in e&&e.baseUrl!==this._baseUrl&&(this._baseUrl=e.baseUrl,s.push("baseUrl")),s.length&&this.propertyChanged.raiseEvent(s)}getValues(){return{altitudeMode:ir(this.altitudeMode),allowPicking:this.allowPicking,classificationType:hn(this.classificationType),scaleByDistance:cn(this.scaleByDistance),eyeOffset:un(this.eyeOffset),heightAboveGround:this.heightAboveGround,skirt:this.skirt,groundLevel:this.groundLevel,extrudedHeight:this.extrudedHeight,storeysAboveGround:this.storeysAboveGround,storeysBelowGround:this.storeysBelowGround,storeyHeightsAboveGround:this.storeyHeightsAboveGround,storeyHeightsBelowGround:this.storeyHeightsBelowGround,storeyHeight:this.storeyHeight,modelUrl:this.modelUrl,modelScaleX:this.modelScaleX,modelScaleY:this.modelScaleY,modelScaleZ:this.modelScaleZ,modelHeading:this.modelHeading,modelPitch:this.modelPitch,modelRoll:this.modelRoll,baseUrl:this.baseUrl}}getVcsMeta(e){const t=e||nt.getDefaultOptions(),s={};return ir(this.altitudeMode)!==t.altitudeMode&&(s.altitudeMode=ir(this.altitudeMode)),this.allowPicking!==t.allowPicking&&(s.allowPicking=this.allowPicking),hn(this.classificationType)!==t.classificationType&&(s.classificationType=hn(this.classificationType)),Ft(cn(this.scaleByDistance),t.scaleByDistance)||(s.scaleByDistance=cn(this.scaleByDistance)),Ft(un(this.eyeOffset),t.eyeOffset)||(s.eyeOffset=un(this.eyeOffset)),this.heightAboveGround!==t.heightAboveGround&&(s.heightAboveGround=this.heightAboveGround),this.skirt!==t.skirt&&(s.skirt=this.skirt),this.groundLevel!==t.groundLevel&&(s.groundLevel=this.groundLevel),this.extrudedHeight!==t.extrudedHeight&&(s.extrudedHeight=this.extrudedHeight),this.storeysAboveGround!==t.storeysAboveGround&&(s.storeysAboveGround=this.storeysAboveGround),this.storeysBelowGround!==t.storeysBelowGround&&(s.storeysBelowGround=this.storeysBelowGround),Ft(this.storeyHeightsAboveGround,t.storeyHeightsAboveGround)||(s.storeyHeightsAboveGround=this.storeyHeightsAboveGround),Ft(this.storeyHeightsBelowGround,t.storeyHeightsBelowGround)||(s.storeyHeightsBelowGround=this.storeyHeightsBelowGround),this.storeyHeight!==t.storeyHeight&&(s.storeyHeight=this.storeyHeight),this.modelUrl!==t.modelUrl&&(s.modelUrl=this.modelUrl),this.modelScaleX!==t.modelScaleX&&(s.modelScaleX=this.modelScaleX),this.modelScaleY!==t.modelScaleY&&(s.modelScaleY=this.modelScaleY),this.modelScaleZ!==t.modelScaleZ&&(s.modelScaleZ=this.modelScaleZ),this.modelHeading!==t.modelHeading&&(s.modelHeading=this.modelHeading),this.modelPitch!==t.modelPitch&&(s.modelPitch=this.modelPitch),this.modelRoll!==t.modelRoll&&(s.modelRoll=this.modelRoll),this.baseUrl!==t.baseUrl&&(s.baseUrl=this.baseUrl),s}destroy(){this.propertyChanged.destroy()}}function sr(i,e){if(ia(i,[dt,{type:String}])){if(i instanceof dt)return i;{const t=Xi.createFromTypeOptions(i);if(t)return t instanceof W&&e instanceof W?e.assign(t):t}}return e||Hh.clone()}class bt extends de{static get className(){return"FeatureLayer"}static getDefaultOptions(){return T(S({},de.getDefaultOptions()),{style:void 0,balloonHeightOffset:10,genericFeatureProperties:{}})}constructor(e){super(e);const t=bt.getDefaultOptions();this._style=this.getStyleOrDefaultStyle(e.style),this._defaultStyle=this._style,this.styleChanged=new I,this._genericFeatureProperties=e.genericFeatureProperties||t.genericFeatureProperties,this.balloonHeightOffset=B(e.balloonHeightOffset,t.balloonHeightOffset),this.featureVisibility=e.featureVisibility||new nn}get defaultStyle(){return this._defaultStyle}get style(){return this._style}get genericFeatureProperties(){return this._genericFeatureProperties}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{globalHider:this.globalHider,featureVisibility:this.featureVisibility,style:this.style})}setGlobalHider(e){super.setGlobalHider(e),this.forceRedraw()}objectClickedHandler(e){return null}getGenericFeatureFromClickedObject(e){return this.getLogger().warning("This method should be implemented by any specific layers"),null}assignGenericFeatureProperties(e){v(e,Object),Object.assign(this._genericFeatureProperties,e)}getStyleOrDefaultStyle(e,t){return sr(e,t)}setStyle(e,t){v(e,[_e,dt,Function]),e instanceof dt?this._style=e:(this._style=new W({}),this._style.style=e),this.getImplementations().forEach(s=>{s.updateStyle(this._style,t)}),this.styleChanged.raiseEvent(this._style)}clearStyle(){this.setStyle(this.defaultStyle)}toJSON(){const e=super.toJSON();return this.getStyleOrDefaultStyle().equals(this._style)||(e.style=this.style.toJSON()),Object.keys(this._genericFeatureProperties).length>0&&(e.genericFeatureProperties=S({},this._genericFeatureProperties)),e}destroy(){this.featureVisibility&&this.featureVisibility.destroy(),this.styleChanged.destroy(),super.destroy()}}ue.registerClass(bt.className,bt);class Di extends wt{static from(e,t){const s=new Di(t);if(e)for(const r of e)s.add(r);return s}constructor(e){super(e),this.moved=new I,this._previousIndexSymbol=Symbol("previousIndex")}get previousIndexSymbol(){return this._previousIndexSymbol}get(e){return this._array[e]}add(e,t){if(this._checkUniqueness(e)){let s=this._array.length;return t!=null&&t<this._array.length?(s=t>=0?t:0,this._array.splice(s,0,e)):this._array.push(e),this.added.raiseEvent(e),s}return null}remove(e){e[this._previousIndexSymbol]=this._array.indexOf(e),super.remove(e)}_move(e,t,s){let r=s;return r=r>=0?r:0,r=r<this._array.length?r:this._array.length-1,this._array.splice(t,1),this._array.splice(r,0,e),this.moved.raiseEvent(e),r}lower(e,t=1){const s=this._array.indexOf(e);return s>-1?this._move(e,s,s-Math.ceil(t)):null}raise(e,t=1){const s=this._array.indexOf(e);return s>-1?this._move(e,s,s+Math.ceil(t)):null}indexOf(e){return this._array.indexOf(e)}indexOfKey(e){if(!!this.uniqueKey)return this._array.findIndex(t=>t[this.uniqueKey]===e)}destroy(){super.destroy(),this.moved.destroy()}}class Vh{constructor(){this.layers=new Map}registerLayer(e){const{exclusiveGroups:t}=e;t.length>0&&(t.forEach(s=>{this.layers.has(s)||this.layers.set(s,new Set),this.layers.get(s).add(e)}),e.active&&this.handleLayerActivated(e))}unregisterLayer(e){const{exclusiveGroups:t}=e;t.length>0&&t.forEach(s=>{this.layers.get(s).delete(e)})}handleSplitDirectionChanged(e){e.active&&this.handleLayerActivated(e)}handleLayerActivated(e){const{exclusiveGroups:t}=e;if(t.length>0){const s=e.splitDirection||0;t.forEach(r=>{this.layers.has(r)&&this.layers.get(r).forEach(n=>{n!==e&&!(s&&n.splitDirection&&n.splitDirection!==s)&&n.deactivate()})})}}handleExclusiveGroupsChanged(e){[...this.layers.values()].forEach(t=>{t.delete(e)}),this.registerLayer(e)}getActiveLayersForGroup(e){const t=this.layers.get(e);if(t){const s=[];return t.forEach(r=>{r.active&&s.push(r)}),s}return[]}clear(){this.layers.clear()}destroy(){this.clear()}}const Bh=Number.MAX_SAFE_INTEGER;class Ht extends Di{static from(e){const t=new Ht;if(e)for(const s of e)t.add(s);return t}constructor(){super(),this._layerEventListeners={},this._zIndexSymbol=Symbol("zIndex"),this.stateChanged=new I,this.exclusiveManager=new Vh,this._globalHider=new an,this._locale="en"}get zIndexSymbol(){return this._zIndexSymbol}get globalHider(){return this._globalHider}set globalHider(e){v(e,an),this._globalHider=e,this._array.forEach(t=>{t.setGlobalHider(this._globalHider)})}get locale(){return this._locale}set locale(e){v(e,String),this._locale!==e&&(this._locale=e,[...this].forEach(t=>{t.locale=this._locale}))}_listenToLayerEvents(e){const t=e.stateChanged.addEventListener(a=>{a===ee.ACTIVE&&this.exclusiveManager.handleLayerActivated(e),this.stateChanged.raiseEvent(e)}),s=e.zIndexChanged.addEventListener(()=>{this._zIndexChanged(e)}),r=e.exclusiveGroupsChanged.addEventListener(()=>{this.exclusiveManager.handleExclusiveGroupsChanged(e)}),n=[t,s,r];e.splitDirectionChanged&&n.push(e.splitDirectionChanged.addEventListener(()=>{this.exclusiveManager.handleSplitDirectionChanged(e)})),this._layerEventListeners[e.name]=n}_findZIndexPosition(e){const t=this._array.findIndex(s=>s[this._zIndexSymbol]>e);return t>-1?t:null}_zIndexChanged(e){const t=this.indexOf(e);if(t>-1){e[this._zIndexSymbol]=e.zIndex;let s=this._findZIndexPosition(e.zIndex);s>0&&s>t&&(s-=1),s=s!=null?s:this._array.length-1,this._move(e,t,s),this._ensureLocalZIndex(e)}}_ensureLocalZIndex(e){const t=this.indexOf(e);if(t>0){const s=this._array[t-1][this._zIndexSymbol];s>e[this._zIndexSymbol]&&(e[this._zIndexSymbol]=s)}if(t<this._array.length-1){const s=this._array[t+1][this._zIndexSymbol];s<e[this._zIndexSymbol]&&(e[this._zIndexSymbol]=s)}}add(e,t){let s=t;t==null&&(s=this._findZIndexPosition(e.zIndex));const r=super.add(e,s);return r!=null&&(e[this._zIndexSymbol]=e.zIndex,e.setGlobalHider(this._globalHider),e.locale=this.locale,this._ensureLocalZIndex(e),this._listenToLayerEvents(e),this.exclusiveManager.registerLayer(e)),r}_remove(e){return this._layerEventListeners[e.name]&&(this._layerEventListeners[e.name].forEach(t=>{t()}),delete this._layerEventListeners[e.name]),delete e[this._zIndexSymbol],e.setGlobalHider(null),this.exclusiveManager.unregisterLayer(e),super._remove(e)}clear(){Object.values(this._layerEventListeners).flat().forEach(e=>{e()}),this._array.forEach(e=>{delete e[this._zIndexSymbol]}),this.exclusiveManager.clear(),this._layerEventListeners={},super.clear()}destroy(){Object.values(this._layerEventListeners).flat().forEach(e=>{e()}),this._layerEventListeners={},this.exclusiveManager.destroy(),this._globalHider.destroy(),super.destroy()}}const it={INACTIVE:1,ACTIVE:2,LOADING:4},v_={};class kt extends ut{static get className(){return"VcsMap"}static get specificLayerImpl(){return v_}static getDefaultOptions(){return{fallbackMap:void 0}}constructor(e){super(e),this.mapElement=document.createElement("div"),this.mapElement.setAttribute("id",et()),this.mapElement.classList.add("mapElement"),this.mapElement.style.display="none",this._target=null,e.target&&this.setTarget(e.target),this._layerCollection=e.layerCollection||new Ht,this.destroyLayerCollection=!e.layerCollection,this._collectionListeners=[],this._setLayerCollectionListeners(),this.initialized=!1,this.movementDisabled=!1,this.fallbackMap=e.fallbackMap||null,this._visualizations=new Map,this._state=it.INACTIVE,this.stateChanged=new I,this.pointerInteractionEvent=new I,this.splitScreen=null}get active(){return this._state===it.ACTIVE}get loading(){return this._state===it.LOADING}get target(){return this._target}get layerCollection(){return this._layerCollection}set layerCollection(e){v(e,Ht),this.destroyLayerCollection=!1,[...this._layerCollection].forEach(t=>{t.removedFromMap(this)}),this._layerCollection=e,this.active&&[...this._layerCollection].forEach(t=>{t.mapActivated(this)}),this._setLayerCollectionListeners()}_setLayerCollectionListeners(){this._collectionListeners.forEach(e=>{e()}),this._collectionListeners=[this.layerCollection.moved.addEventListener(e=>{this.indexChanged(e)}),this.layerCollection.added.addEventListener(e=>{this._layerAdded(e)}),this.layerCollection.removed.addEventListener(e=>{this._layerRemoved(e)})]}canShowViewpoint(e){return Promise.resolve(!0)}setTarget(e){re(e,[String,HTMLElement]),this._target&&this._target.removeChild(this.mapElement),this._target=typeof e=="string"?document.getElementById(e):e,this._target&&this._target.appendChild(this.mapElement)}async initialize(){}indexChanged(e){}_layerAdded(e){this.active&&e.mapActivated(this)}_layerRemoved(e){e.removedFromMap(this)}validateVisualization(e){const t=e[j];return t==null?(this.getLogger().warning("item is missing vcsLayerName symbol"),!1):this.layerCollection.hasKey(t)}addVisualization(e){if(!this.validateVisualization(e))throw new Error("Visualization item is not valid, validate before adding");const t=e[j];this._visualizations.has(t)||this._visualizations.set(t,new Set),this._visualizations.get(t).add(e)}removeVisualization(e){const t=e[j],s=this._visualizations.get(t);s&&(s.delete(e),s.size===0&&this._visualizations.delete(t))}getVisualizationsForLayer(e){return this._visualizations.get(e.name)}getVisualizations(){return[...this._visualizations.values()].map(e=>[...e]).flat()}async activate(){if(this._state===it.INACTIVE){if(this._state=it.LOADING,this.stateChanged.raiseEvent(it.LOADING),this.mapElement.style.display="",await this.initialize(),this._state!==it.LOADING||(this._state=it.ACTIVE,await Promise.all([...this.layerCollection].map(e=>e.mapActivated(this))),this._state!==it.ACTIVE))return;this.stateChanged.raiseEvent(this._state)}}deactivate(){this._state!==it.INACTIVE&&(this.mapElement.style.display="none",this._state=it.INACTIVE,[...this.layerCollection].forEach(e=>{e.mapDeactivated(this)}),this.stateChanged.raiseEvent(this._state))}disableMovement(e){this.movementDisabled=e}gotoViewpoint(e,t){return Promise.resolve()}async getViewpoint(){return null}getViewpointSync(){return null}getCurrentResolution(e){return 1}pointIsVisible(e){return!1}requestRender(){}toJSON(){const e=super.toJSON();return this.fallbackMap&&(e.fallbackMap=this.fallbackMap),e}destroy(){super.destroy(),this.mapElement&&(this.mapElement.parentElement&&this.mapElement.parentElement.removeChild(this.mapElement),this.mapElement=null),this._target=null,this._collectionListeners.forEach(e=>{e()}),this._collectionListeners=[],this.layerCollection&&[...this.layerCollection].forEach(e=>{e.removedFromMap(this)}),this.stateChanged&&(this.stateChanged.destroy(),this.stateChanged=null),this.destroyLayerCollection&&this.layerCollection&&this.layerCollection.destroy(),this.pointerInteractionEvent&&(this.pointerInteractionEvent.destroy(),this.pointerInteractionEvent=null),this._layerCollection=null}}di.registerClass(kt.className,kt);let q=1;class Ve{static get interactionTypeCounter(){return q}static getNextBit(e){return e<<1}}const G={NONE:q=Ve.getNextBit(q),ALT:q=Ve.getNextBit(q),CTRL:q=Ve.getNextBit(q),SHIFT:q=Ve.getNextBit(q),ALL:0};G.ALL=G.NONE|G.ALT|G.CTRL|G.SHIFT;const b={NONE:0,CLICK:q=Ve.getNextBit(q),DBLCLICK:q=Ve.getNextBit(q),DRAG:q=Ve.getNextBit(q),DRAGSTART:q=Ve.getNextBit(q),DRAGEND:q=Ve.getNextBit(q),MOVE:q=Ve.getNextBit(q),DRAGEVENTS:0,CLICKMOVE:0,ALL:0};b.DRAGEVENTS=b.DRAG|b.DRAGEND|b.DRAGSTART,b.CLICKMOVE=b.CLICK|b.MOVE,b.ALL=Object.values(b).reduce((i,e)=>i|e,0);const le={LEFT:q=Ve.getNextBit(q),RIGHT:q=Ve.getNextBit(q),MIDDLE:q=Ve.getNextBit(q),ALL:0};le.ALL=le.LEFT|le.RIGHT|le.MIDDLE;const Be={DOWN:1,UP:2,MOVE:3};function Uh(i,e,t){const s=t.indexOfKey(e[j]);if(s>-1){const r=i.getArray();if(!r.includes(e)){let n=r.findIndex(a=>t.indexOfKey(a[j])>s);n===-1&&(n=r.length),i.insertAt(n,e)}}}class rr extends kt{static get className(){return"BaseOLMap"}constructor(e){super(e),this._olMap=null,this._olListeners=[]}get olMap(){return this._olMap}_raisePointerInteraction(e,t){const s={"-1":le.ALL,0:le.LEFT,1:le.MIDDLE,2:le.RIGHT};let r=e.originalEvent.shiftKey?G.SHIFT:G.NONE;r=e.originalEvent.ctrlKey?G.CTRL:r,r=e.originalEvent.altKey?G.ALT:r,r!==G.NONE&&e.preventDefault(),e.originalEvent.preventDefault();const n=[e.coordinate[0],e.coordinate[1],0];this.pointerInteractionEvent.raiseEvent({map:this,position:n,positionOrPixel:n,windowPosition:K.fromArray(e.pixel,0,new K),key:r,pointer:s[e.originalEvent.button||0],pointerEvent:t})}setTarget(e){super.setTarget(e),this._olMap&&this.target&&this._olMap.updateSize()}async initialize(){if(!this._olMap){this._olMap=new kd({layers:[],controls:[],interactions:zd({altShiftDragRotate:!1,pinchRotate:!1,shiftDragZoom:!1,doubleClickZoom:!1}),target:this.mapElement});const e=this.olMap.on("pointerdown",r=>{this._raisePointerInteraction(r,Be.DOWN)}),t=this.olMap.on("pointerup",r=>{this._raisePointerInteraction(r,Be.UP)}),s=this.olMap.on("pointermove",r=>{this._raisePointerInteraction(r,Be.MOVE)});this._olListeners.push(e,t,s)}}async activate(){await super.activate(),this.active&&this._olMap.updateSize()}indexChanged(e){const t=this.getVisualizationsForLayer(e);t&&t.forEach(s=>{const r=this._olMap.getLayers();r.remove(s),Uh(r,s,this.layerCollection)})}addOLLayer(e){this.validateVisualization(e)&&(this.addVisualization(e),Uh(this._olMap.getLayers(),e,this.layerCollection))}removeOLLayer(e){this.removeVisualization(e),this._olMap.getLayers().remove(e)}disableMovement(e){super.disableMovement(e),this._olMap&&this._olMap.getInteractions().forEach(t=>{t.setActive(!e)})}getCurrentResolution(e){const t=this.olMap?this.olMap.getView():null;return t?t.getResolution():1}requestRender(){this._olMap&&this._olMap.render()}destroy(){this._olMap&&this._olMap.setTarget(null),Ce(this._olListeners),super.destroy()}}di.registerClass(rr.className,rr);class ie extends rr{static get className(){return"OpenlayersMap"}static getDefaultOptions(){return T(S({},kt.getDefaultOptions()),{fixedNorthOrientation:!0})}constructor(e){super(e);const t=ie.getDefaultOptions();this.fixedNorthOrientation=ae(e.fixedNorthOrientation,t.fixedNorthOrientation)}async initialize(){this.initialized||(await super.initialize(),this.olMap.setView(new Gn({center:[1.2309226203948376e6,6350766117974091e-9],zoom:13})),this.initialized=!0)}async getViewpoint(){return this.getViewpointSync()}getViewpointSync(){const e=this.olMap.getView(),t=e.getCenter(),s=ye(e.getProjection(),"EPSG:4326"),r=Math.PI/3,n=this.olMap.getViewport(),a={};a.height=n.offsetHeight||1,a.width=n.offsetWidth||1;const o=a.width/a.height,l=Math.atan(Math.tan(r*.5)/o)*2,h=s(t.slice(0,2),void 0,void 0),c=e.getProjection().getMetersPerUnit(),d=e.getResolution()*a.height,f=Math.cos(Math.abs(P.toRadians(h[1]))),g=d*c*f,m=Math.abs(g/2/Math.tan(l/2)),p=-P.toDegrees(e.getRotation()),y=h,_=-90;return new ft({groundPosition:y,pitch:_,heading:p,distance:m})}gotoViewpoint(e){if(this.movementDisabled||!e.isValid())return Promise.resolve();this.fixedNorthOrientation&&(e.heading=0);const t=this.olMap.getView(),s=ye("EPSG:4326",t.getProjection());let r=[];e.groundPosition?r=e.groundPosition.slice(0,2):r=e.cameraPosition.slice(0,2);const{distance:n}=e,a=s(r,void 0,void 0),o=Math.PI/3,l=this.olMap.getViewport(),h={};h.height=l.offsetHeight?l.offsetHeight:1,h.width=l.offsetWidth?l.offsetWidth:1;const c=h.width/h.height,u=Math.atan(Math.tan(o*.5)/c)*2,d=2*n*Math.tan(u/2),f=t.getProjection().getMetersPerUnit(),g=Math.cos(Math.abs(P.toRadians(r[1]))),p=d/f/g/h.height;if(e.animate){let y=0;return!this.fixedNorthOrientation&&e.heading!=null&&(y=-P.toRadians(e.heading)),new Promise(_=>{t.animate({duration:e.duration?e.duration*1e3:100,center:a,easing:jd,resolution:p,rotation:y},()=>{_()})})}else t.setCenter(a),t.setResolution(p),!this.fixedNorthOrientation&&e.heading!=null&&t.setRotation(-P.toRadians(e.heading));return Promise.resolve()}pointIsVisible(e){const t=this.olMap.getView(),s=t.calculateExtent(this.olMap.getSize()),r=ye(t.getProjection(),"EPSG:4326"),n=[s[0],s[3]],a=[s[2],s[1]],o=[r(n,void 0,void 0),r(a,void 0,void 0)];return Zo(Ls(o),e[0],e[1])}toJSON(){const e=super.toJSON(),t=ie.getDefaultOptions();return this.fixedNorthOrientation!==t.fixedNorthOrientation&&(e.fixedNorthOrientation=this.fixedNorthOrientation),e}}di.registerClass(ie.className,ie);class Qt extends ut{static get className(){return"LayerImplementation"}constructor(e,t){super(t),this.map=e,this.url=t.url,this._state=ee.INACTIVE,this._initialized=!1}get initialized(){return this._initialized}get active(){return this._state===ee.ACTIVE}get loading(){return this._state===ee.LOADING}async initialize(){this._initialized=!0}async activate(){this.map.active&&!this.active&&(this._state=ee.LOADING,await this.initialize(),this.loading&&(this._state=ee.ACTIVE))}deactivate(){this._state=ee.INACTIVE}destroy(){this._initialized=!1,this._state=ee.INACTIVE,this.map=null,super.destroy()}}class nr extends Qt{static get className(){return"LayerOpenlayersImpl"}constructor(e,t){super(e,t),this.olLayer=null}initialize(){return this.initialized||(this.olLayer=this.getOLLayer(),this.olLayer[j]=this.name,this.map.addOLLayer(this.olLayer)),super.initialize()}async activate(){await super.activate(),this.active&&this.olLayer.setVisible(!0)}deactivate(){super.deactivate(),this.olLayer&&this.olLayer.setVisible(!1)}getOLLayer(){throw new Error}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,super.destroy()}}function qh(i,e,t){const s={flat:!0,renderState:{depthTest:{enabled:!0}}},r=e.getColor();if(r instanceof CanvasPattern){const n=document.createElement("canvas"),a=n.getContext("2d");a.fillStyle=r,a.fillRect(0,0,300,300),s.material=Gi.fromType("Wallpaper",{image:n,anchor:Mf.wgs84ToDrawingBufferCoordinates(i,M.fromDegreesArray(kn(t.getGeometry().getExtent()))[0])})}else{const n=gi(r,[0,0,0,1]);s.material=Gi.fromType("Color",{color:n}),s.translucent=n.alpha!==1}return new Cf(s)}function Wh(i,e,t,s){const r=e.map(o=>new Tr({geometry:o,attributes:{color:ul.fromColor(t)}})),n=new Bn({flat:!1,renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:t.alpha!==1}),a=T(S({},i),{geometryInstances:r,appearance:n,shadows:Fs.ENABLED,classificationType:s});return new dl(a)}function Xh(i,e,t,s,r,n,a){const o=e.getClassificationType(s),l={shadows:Fs.ENABLED,allowPicking:t,asynchronous:!s[Gt]};let h;if(o!==void 0&&!a){if(!dl.isSupported(i))return null;const c=gi(n.getFill().getColor(),[0,0,0,1]);h=Wh(l,r,c,o)}else{const c=r.map(d=>new Tr({geometry:d}));l.geometryInstances=c;const u=qh(i,n.getFill(),s);if(l.appearance=u,a){if(!fl.isSupported(i))return null;l.classificationType=o||ki.TERRAIN,h=new fl(l)}else h=new Un(l)}return h}function Yh(i,e,t,s,r,n){const a=gi(n.getStroke().getColor(),[0,0,0,1]),o=r.map(u=>new Tr({geometry:u,attributes:{color:ul.fromColor(a)}})),l=new Bn({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:a.alpha!==1}),h={geometryInstances:o,appearance:l,shadows:Fs.ENABLED,allowPicking:t,asynchronous:!s[Gt]};return new Un(h)}function Ga(i,e,t,s,r,n,a){const o=e.getClassificationType(s),l=r.map(g=>new Tr({geometry:g})),h=gi(n.getStroke().getColor(),[0,0,0,1]);let c;n.getStroke().getLineDash()?c=Gi.fromType("Stripe",{horizontal:!1,repeat:500,evenColor:h,oddColor:new Ne(0,0,0,0)}):c=Gi.fromType("Color",{color:h});const u=new xf({renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:h.alpha!==1,material:c}),d={geometryInstances:l,appearance:u,shadows:Fs.ENABLED,allowPicking:t,asynchronous:!s[Gt]};let f;if(a){if(!gl.isSupported(i))return null;d.classificationType=o||ki.TERRAIN,f=new gl(d)}else f=new Un(d);return f}function Zh(i,e){if(i!=null&&Number.isFinite(Number(i)))return i;if(e){let t=1/0;for(let s=0;s<e.length;s++)t=e[s][2]<t?e[s][2]:t;if(Number.isFinite(t))return t}return 0}function ka(i,e,t){const s=Math.abs(i),r=[];if(e.length){let n=0;for(let o=0;o<e.length;o++)if(n+=e[o],n<s)r.push(e[o]);else return r.push(e[o]-(n-s)),r;const a=e[e.length-1];for(;n<s;)if(n+=a,n<s)r.push(a);else return r.push(a-(n-s)),r}else if(t)return new Array(t).fill(s/t);return[s]}function za(i,e){if(i&&e.length){const t=i-e.length;t>0?e.push(...new Array(t).fill(e[e.length-1])):t<0&&e.splice(e.length+t),i>100&&e.splice(100)}else e.splice(0)}function Kh(i,e,t){return e===Qe.RELATIVE_TO_GROUND?t.getHeightAboveGround(i):0}function dn(i,e,t){const s=e.getExtrudedHeight(i),r=Math.abs(B(i.get("olcs_storeyNumber"),0)),n=Math.abs(N(i.get("olcs_storeyHeight"),0));let a=0,o=0,l=[],h=[];if(n||r)if(s&&s>0&&n)a=Math.ceil(s/n),l=new Array(a-1).fill(n),l.push(s-(a-1)*n);else if(s&&s<0&&n)o=Math.ceil(Math.abs(s/n)),h=new Array(o-1).fill(n),h.push(Math.abs(s)-(o-1)*n);else if(s&&s>0&&r){a=r;const _=Math.abs(s/r);l=new Array(r).fill(_)}else if(s&&s<0&&r){o=r;const _=Math.abs(s/r);h=new Array(r).fill(_)}else r&&n?(a=r,l=new Array(r).fill(n)):r&&e.storeyHeight&&(a=r,l=new Array(r).fill(e.storeyHeight));!(a&&l.length)&&!(o&&h.length)&&(a=e.getStoreysAboveGround(i),o=e.getStoreysBelowGround(i),l=e.getStoreyHeightsAboveGround(i),h=e.getStoreyHeightsBelowGround(i),s&&(s>0?(l=ka(s,l,a),a=l.length,h=[],o=0):s<0&&(h=ka(s,h,o),o=h.length,l=[],a=0))),za(a,l),za(o,h);const c=e.getSkirt(i),u=e.getGroundLevel(i),d=e.getAltitudeMode(i),f=Kh(i,d,e),g=Zh(u,t)+f,m=!!t.find(_=>_[2]),p=!!(l.length||h.length||c),y=m&&u==null&&(!p||p&&l.length+h.length===1);return{extruded:p,storeyHeightsAboveGround:l,storeyHeightsBelowGround:h,skirt:c,groundLevel:g,perPositionHeight:y,heightReference:d,heightAboveGroundAdjustment:f}}function ja(i,e,t,s){const r=t?-1:1;let n=e;const a=i.length,o=new Array(a);for(let l=0;l<a;l++){const h=n+r*i[l];o[l]={currentHeight:n,extrudedHeight:h},n=h}return s?(s.push(...o),s):o}function fn(i,e,t,s,r,n,a){if(!t.length)return;const o=[],l=[],h=[],c=dn(i,s,n.getCoordinates(t)),u=!!e.getFill(),d=!!e.getStroke();let f=!1;t.forEach(p=>{const y=n.getGeometryOptions(p,c.heightAboveGroundAdjustment),_=ja(c.storeyHeightsAboveGround,c.groundLevel);if(ja(c.storeyHeightsBelowGround,c.groundLevel,!0,_),u&&_.forEach(w=>{o.push(...n.createSolidGeometries(y,w.currentHeight,c.perPositionHeight,w.extrudedHeight))}),d&&_.forEach(w=>{l.push(...n.createOutlineGeometries(y,w.currentHeight,c.perPositionHeight,w.extrudedHeight))}),c.skirt){const w=c.groundLevel-c.storeyHeightsBelowGround.reduce((A,Y)=>A+Y,0),L=w-c.skirt,E=c.storeyHeightsBelowGround.length?!1:c.perPositionHeight;u&&o.push(...n.createSolidGeometries(y,w,E,L)),d&&l.push(...n.createOutlineGeometries(y,w,E,L))}c.extruded||(c.heightReference===Qe.CLAMP_TO_GROUND&&(f=!0),u&&o.push(...n.createFillGeometries(y,c.groundLevel,c.perPositionHeight)),d&&(c.heightReference===Qe.CLAMP_TO_GROUND?h.push(...n.createGroundLineGeometries(y,e)):h.push(...n.createLineGeometries(y,e))))});const g=s.getAllowPicking(i),m=[];if(h.length){const p=Ga(r,s,g,i,h,e,f);p&&m.push(p)}if(o.length){const p=Xh(r,s,g,i,o,e,f);p&&m.push(p)}if(l.length){const p=Yh(r,s,g,i,l,e);p&&m.push(p)}a.addPrimitives(m,i,g)}class S_{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var Jh=S_,M_={PROPERTYCHANGE:"propertychange"};class C_{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var x_=C_;function w_(i,e){return i>e?1:i<e?-1:0}function b_(i,e){const t=Array.isArray(e)?e:[e],s=t.length;for(let r=0;r<s;r++)i[i.length]=t[r]}function O_(i,e){const t=i.length;if(t!==e.length)return!1;for(let s=0;s<t;s++)if(i[s]!==e[s])return!1;return!0}function Qh(){}function E_(i){let e=!1,t,s,r;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==r||!O_(n,s))&&(e=!0,r=this,s=n,t=i.apply(this,arguments)),t}}function ec(i){for(const e in i)delete i[e]}function I_(i){let e;for(e in i)return!1;return!e}class P_ extends x_{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const s=this.listeners_||(this.listeners_={}),r=s[e]||(s[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t=typeof e=="string",s=t?e:e.type,r=this.listeners_&&this.listeners_[s];if(!r)return;const n=t?new Jh(e):e;n.target||(n.target=this.eventTarget_||this);const a=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});s in a||(a[s]=0,o[s]=0),++a[s];let l;for(let h=0,c=r.length;h<c;++h)if("handleEvent"in r[h]?l=r[h].handleEvent(n):l=r[h].call(this,n),l===!1||n.propagationStopped){l=!1;break}if(--a[s]===0){let h=o[s];for(delete o[s];h--;)this.removeEventListener(s,Qh);delete a[s]}return l}disposeInternal(){this.listeners_&&ec(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){const s=this.listeners_&&this.listeners_[e];if(s){const r=s.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(s[r]=Qh,++this.pendingRemovals_[e]):(s.splice(r,1),s.length===0&&delete this.listeners_[e]))}}}var L_=P_,T_={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function Ha(i,e,t,s,r){if(s&&s!==i&&(t=t.bind(s)),r){const a=t;t=function(){i.removeEventListener(e,t),a.apply(this,arguments)}}const n={target:i,type:e,listener:t};return i.addEventListener(e,t),n}function tc(i,e,t,s){return Ha(i,e,t,s,!0)}function ic(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),ec(i))}class gn extends L_{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(T_.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const s=e.length,r=new Array(s);for(let n=0;n<s;++n)r[n]=Ha(this,e[n],t);return r}else return Ha(this,e,t)}onceInternal(e,t){let s;if(Array.isArray(e)){const r=e.length;s=new Array(r);for(let n=0;n<r;++n)s[n]=tc(this,e[n],t)}else s=tc(this,e,t);return t.ol_key=s,s}unInternal(e,t){const s=t.ol_key;if(s)N_(s);else if(Array.isArray(e))for(let r=0,n=e.length;r<n;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}}gn.prototype.on,gn.prototype.once,gn.prototype.un;function N_(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ic(i[e]);else ic(i)}var D_=gn;function st(){throw new Error("Unimplemented abstract method.")}let F_=0;function A_(i){return i.ol_uid||(i.ol_uid=String(++F_))}class sc extends Jh{constructor(e,t,s){super(e),this.key=t,this.oldValue=s}}class R_ extends D_{constructor(e){super(),this.on,this.once,this.un,A_(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let s;s=`change:${e}`,this.hasListener(s)&&this.dispatchEvent(new sc(s,e,t)),s=M_.PROPERTYCHANGE,this.hasListener(s)&&this.dispatchEvent(new sc(s,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,s){const r=this.values_||(this.values_={});if(s)r[e]=t;else{const n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(const s in e)this.set(s,e[s],t)}applyProperties(e){!e.values_||Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const s=this.values_[e];delete this.values_[e],I_(this.values_)&&(this.values_=null),t||this.notify(e,s)}}}var G_=R_;new Array(6);function k_(){return[1,0,0,1,0,0]}function z_(i,e,t,s,r,n,a,o){const l=Math.sin(n),h=Math.cos(n);return i[0]=s*h,i[1]=r*l,i[2]=-s*l,i[3]=r*h,i[4]=a*s*h-o*s*l+e,i[5]=a*r*l+o*r*h+t,i}var be={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function rc(i,e,t){let s,r;return e<i[0]?s=i[0]-e:i[2]<e?s=e-i[2]:s=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,s*s+r*r}function j_(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function H_(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function nc(i,e){const t=i[0],s=i[1],r=i[2],n=i[3],a=e[0],o=e[1];let l=be.UNKNOWN;return a<t?l=l|be.LEFT:a>r&&(l=l|be.RIGHT),o<s?l=l|be.BELOW:o>n&&(l=l|be.ABOVE),l===be.UNKNOWN&&(l=be.INTERSECTING),l}function ac(){return[1/0,1/0,-1/0,-1/0]}function oc(i,e,t,s,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=s,r):[i,e,t,s]}function lc(i){return oc(1/0,1/0,-1/0,-1/0,i)}function $_(i,e){const t=i[0],s=i[1];return oc(t,s,t,s,e)}function V_(i,e,t,s,r){const n=lc(r);return hc(n,i,e,t,s)}function hc(i,e,t,s,r){for(;t<s;t+=r)B_(i,e[t],e[t+1]);return i}function B_(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function U_(i,e){let t;return t=e(q_(i)),t||(t=e(W_(i)),t)||(t=e(Y_(i)),t)||(t=e(X_(i)),t)?t:!1}function q_(i){return[i[0],i[1]]}function W_(i){return[i[2],i[1]]}function cc(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function uc(i){return i[3]-i[1]}function X_(i){return[i[0],i[3]]}function Y_(i){return[i[2],i[3]]}function Z_(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function K_(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function J_(i,e,t){let s=!1;const r=nc(i,e),n=nc(i,t);if(r===be.INTERSECTING||n===be.INTERSECTING)s=!0;else{const a=i[0],o=i[1],l=i[2],h=i[3],c=e[0],u=e[1],d=t[0],f=t[1],g=(f-u)/(d-c);let m,p;!!(n&be.ABOVE)&&!(r&be.ABOVE)&&(m=d-(f-h)/g,s=m>=a&&m<=l),!s&&!!(n&be.RIGHT)&&!(r&be.RIGHT)&&(p=f-(d-l)*g,s=p>=o&&p<=h),!s&&!!(n&be.BELOW)&&!(r&be.BELOW)&&(m=d-(f-o)/g,s=m>=a&&m<=l),!s&&!!(n&be.LEFT)&&!(r&be.LEFT)&&(p=f-(d-a)*g,s=p>=o&&p<=h)}return s}const Q_={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class ev{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Q_[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}var dc=ev;const ar=6378137,Ji=Math.PI*ar,tv=[-Ji,-Ji,Ji,Ji],iv=[-180,-85,180,85],mn=ar*Math.log(Math.tan(Math.PI/2));class Qi extends dc{constructor(e){super({code:e,units:"m",extent:tv,global:!0,worldExtent:iv,getPointResolution:function(t,s){return t/Math.cosh(s[1]/ar)}})}}const fc=[new Qi("EPSG:3857"),new Qi("EPSG:102100"),new Qi("EPSG:102113"),new Qi("EPSG:900913"),new Qi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Qi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function sv(i,e,t){const s=i.length;t=t>1?t:2,e===void 0&&(t>2?e=i.slice():e=new Array(s));for(let r=0;r<s;r+=t){e[r]=Ji*i[r]/180;let n=ar*Math.log(Math.tan(Math.PI*(+i[r+1]+90)/360));n>mn?n=mn:n<-mn&&(n=-mn),e[r+1]=n}return e}function rv(i,e,t){const s=i.length;t=t>1?t:2,e===void 0&&(t>2?e=i.slice():e=new Array(s));for(let r=0;r<s;r+=t)e[r]=180*i[r]/Ji,e[r+1]=360*Math.atan(Math.exp(i[r+1]/ar))/Math.PI-90;return e}const nv=6378137,gc=[-180,-90,180,90],av=Math.PI*nv/180;class Si extends dc{constructor(e,t){super({code:e,units:"degrees",extent:gc,axisOrientation:t,global:!0,metersPerUnit:av,worldExtent:gc})}}const mc=[new Si("CRS:84"),new Si("EPSG:4326","neu"),new Si("urn:ogc:def:crs:OGC:1.3:CRS84"),new Si("urn:ogc:def:crs:OGC:2:84"),new Si("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Si("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Si("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let $a={};function ov(i){return $a[i]||$a[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function lv(i,e){$a[i]=e}let es={};function pn(i,e,t){const s=i.getCode(),r=e.getCode();s in es||(es[s]={}),es[s][r]=t}function hv(i,e){let t;return i in es&&e in es[i]&&(t=es[i][e]),t}function cv(i,e,t,s,r,n){const a=r-t,o=n-s;if(a!==0||o!==0){const l=((i-t)*a+(e-s)*o)/(a*a+o*o);l>1?(t=r,s=n):l>0&&(t+=a*l,s+=o*l)}return ts(i,e,t,s)}function ts(i,e,t,s){const r=t-i,n=s-e;return r*r+n*n}function uv(i,e){const t=i%e;return t*e<0?t+e:t}function dv(i,e,t){return i+t*(e-i)}function pc(i,e,t){if(e!==void 0){for(let s=0,r=i.length;s<r;++s)e[s]=i[s];e=e}else e=i.slice();return e}function fv(i,e,t){if(e!==void 0&&i!==e){for(let s=0,r=i.length;s<r;++s)e[s]=i[s];i=e}return i}function gv(i){lv(i.getCode(),i),pn(i,i,pc)}function mv(i){i.forEach(gv)}function Va(i){return typeof i=="string"?ov(i):i||null}function yc(i){mv(i),i.forEach(function(e){i.forEach(function(t){e!==t&&pn(e,t,pc)})})}function pv(i,e,t,s){i.forEach(function(r){e.forEach(function(n){pn(r,n,t),pn(n,r,s)})})}function yv(i,e){const t=i.getCode(),s=e.getCode();let r=hv(t,s);return r||(r=fv),r}function _c(i,e){const t=Va(i),s=Va(e);return yv(t,s)}function _v(){yc(fc),yc(mc),pv(mc,fc,sv,rv)}_v();function vv(i,e,t,s,r,n){n=n||[];let a=0;for(let o=e;o<t;o+=s){const l=i[o],h=i[o+1];n[a++]=r[0]*l+r[2]*h+r[4],n[a++]=r[1]*l+r[3]*h+r[5]}return n&&n.length!=a&&(n.length=a),n}function Sv(i,e,t,s,r,n,a){a=a||[];const o=Math.cos(r),l=Math.sin(r),h=n[0],c=n[1];let u=0;for(let d=e;d<t;d+=s){const f=i[d]-h,g=i[d+1]-c;a[u++]=h+f*o-g*l,a[u++]=c+f*l+g*o;for(let m=d+2;m<d+s;++m)a[u++]=i[m]}return a&&a.length!=u&&(a.length=u),a}function Mv(i,e,t,s,r,n,a,o){o=o||[];const l=a[0],h=a[1];let c=0;for(let u=e;u<t;u+=s){const d=i[u]-l,f=i[u+1]-h;o[c++]=l+r*d,o[c++]=h+n*f;for(let g=u+2;g<u+s;++g)o[c++]=i[g]}return o&&o.length!=c&&(o.length=c),o}function Cv(i,e,t,s,r,n,a){a=a||[];let o=0;for(let l=e;l<t;l+=s){a[o++]=i[l]+r,a[o++]=i[l+1]+n;for(let h=l+2;h<l+s;++h)a[o++]=i[h]}return a&&a.length!=o&&(a.length=o),a}const vc=k_();class xv extends G_{constructor(){super(),this.extent_=ac(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=E_(function(e,t,s){if(!s)return this.getSimplifiedGeometry(t);const r=this.clone();return r.applyTransform(s),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return st()}closestPointXY(e,t,s,r){return st()}containsXY(e,t){const s=this.getClosestPoint([e,t]);return s[0]===e&&s[1]===t}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return st()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&lc(t),this.extentRevision_=this.getRevision()}return K_(this.extent_,e)}rotate(e,t){st()}scale(e,t,s){st()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return st()}getType(){return st()}applyTransform(e){st()}intersectsExtent(e){return st()}translate(e,t){st()}transform(e,t){const s=Va(e),r=s.getUnits()=="tile-pixels"?function(n,a,o){const l=s.getExtent(),h=s.getWorldExtent(),c=uc(h)/uc(l);return z_(vc,h[0],h[3],c,-c,0,0,0),vv(n,0,n.length,o,vc,a),_c(s,t)(n,a,o)}:_c(s,t);return this.applyTransform(r),this}}var wv=xv;class bv extends wv{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(e){return V_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return st()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Sc(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){st()}setLayout(e,t,s){let r;if(e)r=Sc(e);else{for(let n=0;n<s;++n)if(t.length===0){this.layout="XY",this.stride=2;return}else t=t[0];r=t.length,e=Ov(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(e,t){const s=this.getFlatCoordinates();if(s){const r=this.getStride();Sv(s,0,s.length,r,e,t,s),this.changed()}}scale(e,t,s){t===void 0&&(t=e),s||(s=cc(this.getExtent()));const r=this.getFlatCoordinates();if(r){const n=this.getStride();Mv(r,0,r.length,n,e,t,s,r),this.changed()}}translate(e,t){const s=this.getFlatCoordinates();if(s){const r=this.getStride();Cv(s,0,s.length,r,e,t,s),this.changed()}}}function Ov(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function Sc(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}var Ba=bv;function Mc(i,e,t,s,r,n,a){const o=i[e],l=i[e+1],h=i[t]-o,c=i[t+1]-l;let u;if(h===0&&c===0)u=e;else{const d=((r-o)*h+(n-l)*c)/(h*h+c*c);if(d>1)u=t;else if(d>0){for(let f=0;f<s;++f)a[f]=dv(i[e+f],i[t+f],d);a.length=s;return}else u=e}for(let d=0;d<s;++d)a[d]=i[u+d];a.length=s}function Cc(i,e,t,s,r){let n=i[e],a=i[e+1];for(e+=s;e<t;e+=s){const o=i[e],l=i[e+1],h=ts(n,a,o,l);h>r&&(r=h),n=o,a=l}return r}function Ev(i,e,t,s,r){for(let n=0,a=t.length;n<a;++n){const o=t[n];r=Cc(i,e,o,s,r),e=o}return r}function xc(i,e,t,s,r,n,a,o,l,h,c){if(e==t)return h;let u,d;if(r===0)if(d=ts(a,o,i[e],i[e+1]),d<h){for(u=0;u<s;++u)l[u]=i[e+u];return l.length=s,d}else return h;c=c||[NaN,NaN];let f=e+s;for(;f<t;)if(Mc(i,f-s,f,s,a,o,c),d=ts(a,o,c[0],c[1]),d<h){for(h=d,u=0;u<s;++u)l[u]=c[u];l.length=s,f+=s}else f+=s*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(n&&(Mc(i,t-s,e,s,a,o,c),d=ts(a,o,c[0],c[1]),d<h)){for(h=d,u=0;u<s;++u)l[u]=c[u];l.length=s}return h}function Iv(i,e,t,s,r,n,a,o,l,h,c){c=c||[NaN,NaN];for(let u=0,d=t.length;u<d;++u){const f=t[u];h=xc(i,e,f,s,r,n,a,o,l,h,c),e=f}return h}function Pv(i,e,t,s){for(let r=0,n=t.length;r<n;++r)i[e++]=t[r];return e}function wc(i,e,t,s){for(let r=0,n=t.length;r<n;++r){const a=t[r];for(let o=0;o<s;++o)i[e++]=a[o]}return e}function Lv(i,e,t,s,r){r=r||[];let n=0;for(let a=0,o=t.length;a<o;++a){const l=wc(i,e,t[a],s);r[n++]=l,e=l}return r.length=n,r}function Tv(i,e,t,s,r,n,a){const o=(t-e)/s;if(o<3){for(;e<t;e+=s)n[a++]=i[e],n[a++]=i[e+1];return a}const l=new Array(o);l[0]=1,l[o-1]=1;const h=[e,t-s];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let f=0;const g=i[d],m=i[d+1],p=i[u],y=i[u+1];for(let _=d+s;_<u;_+=s){const w=i[_],L=i[_+1],E=cv(w,L,g,m,p,y);E>f&&(c=_,f=E)}f>r&&(l[(c-e)/s]=1,d+s<c&&h.push(d,c),c+s<u&&h.push(c,u))}for(let u=0;u<o;++u)l[u]&&(n[a++]=i[e+u*s],n[a++]=i[e+u*s+1]);return a}function is(i,e){return e*Math.round(i/e)}function Nv(i,e,t,s,r,n,a){if(e==t)return a;let o=is(i[e],r),l=is(i[e+1],r);e+=s,n[a++]=o,n[a++]=l;let h,c;do if(h=is(i[e],r),c=is(i[e+1],r),e+=s,e==t)return n[a++]=h,n[a++]=c,a;while(h==o&&c==l);for(;e<t;){const u=is(i[e],r),d=is(i[e+1],r);if(e+=s,u==h&&d==c)continue;const f=h-o,g=c-l,m=u-o,p=d-l;if(f*p==g*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(g<0&&p<g||g==p||g>0&&p>g)){h=u,c=d;continue}n[a++]=h,n[a++]=c,o=h,l=c,h=u,c=d}return n[a++]=h,n[a++]=c,a}function Dv(i,e,t,s,r,n,a,o){for(let l=0,h=t.length;l<h;++l){const c=t[l];a=Nv(i,e,c,s,r,n,a),o.push(a),e=c}return a}function bc(i,e,t,s,r){r=r!==void 0?r:[];let n=0;for(let a=e;a<t;a+=s)r[n++]=i.slice(a,a+s);return r.length=n,r}function Fv(i,e,t,s,r){r=r!==void 0?r:[];let n=0;for(let a=0,o=t.length;a<o;++a){const l=t[a];r[n++]=bc(i,e,l,s,r[n]),e=l}return r.length=n,r}function Oc(i,e,t,s){let r=0,n=i[t-s],a=i[t-s+1];for(;e<t;e+=s){const o=i[e],l=i[e+1];r+=a*o-n*l,n=o,a=l}return r/2}function Av(i,e,t,s){let r=0;for(let n=0,a=t.length;n<a;++n){const o=t[n];r+=Oc(i,e,o,s),e=o}return r}class Nn extends Ba{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new Nn(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,s,r){return r<rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Cc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,s,r))}getArea(){return Oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=Tv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Nn(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=wc(this.flatCoordinates,0,e,this.stride),this.changed()}}var Ec=Nn;class qo extends Ba{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new qo(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,s,r){const n=this.flatCoordinates,a=ts(e,t,n[0],n[1]);if(a<r){const o=this.stride;for(let l=0;l<o;++l)s[l]=n[l];return s.length=o,a}else return r}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(e){return $_(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return H_(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Pv(this.flatCoordinates,0,e,this.stride),this.changed()}}var Rv=qo;function Gv(i,e,t,s,r){return!U_(r,function(a){return!Mi(i,e,t,s,a[0],a[1])})}function Mi(i,e,t,s,r,n){let a=0,o=i[t-s],l=i[t-s+1];for(;e<t;e+=s){const h=i[e],c=i[e+1];l<=n?c>n&&(h-o)*(n-l)-(r-o)*(c-l)>0&&a++:c<=n&&(h-o)*(n-l)-(r-o)*(c-l)<0&&a--,o=h,l=c}return a!==0}function Ic(i,e,t,s,r,n){if(t.length===0||!Mi(i,e,t[0],s,r,n))return!1;for(let a=1,o=t.length;a<o;++a)if(Mi(i,t[a-1],t[a],s,r,n))return!1;return!0}function kv(i,e,t,s,r,n,a){let o,l,h,c,u,d,f;const g=r[n+1],m=[];for(let _=0,w=t.length;_<w;++_){const L=t[_];for(c=i[L-s],d=i[L-s+1],o=e;o<L;o+=s)u=i[o],f=i[o+1],(g<=d&&f<=g||d<=g&&g<=f)&&(h=(g-d)/(f-d)*(u-c)+c,m.push(h)),c=u,d=f}let p=NaN,y=-1/0;for(m.sort(w_),c=m[0],o=1,l=m.length;o<l;++o){u=m[o];const _=Math.abs(u-c);_>y&&(h=(c+u)/2,Ic(i,e,t,s,h,g)&&(p=h,y=_)),c=u}return isNaN(p)&&(p=r[n]),a?(a.push(p,g,y),a):[p,g,y]}function zv(i,e,t,s,r){let n;for(e+=s;e<t;e+=s)if(n=r(i.slice(e-s,e),i.slice(e,e+s)),n)return n;return!1}function Pc(i,e,t,s,r){const n=hc(ac(),i,e,t,s);return Z_(r,n)?j_(r,n)||n[0]>=r[0]&&n[2]<=r[2]||n[1]>=r[1]&&n[3]<=r[3]?!0:zv(i,e,t,s,function(a,o){return J_(r,a,o)}):!1}function jv(i,e,t,s,r){return!!(Pc(i,e,t,s,r)||Mi(i,e,t,s,r[0],r[1])||Mi(i,e,t,s,r[0],r[3])||Mi(i,e,t,s,r[2],r[1])||Mi(i,e,t,s,r[2],r[3]))}function Hv(i,e,t,s,r){if(!jv(i,e,t[0],s,r))return!1;if(t.length===1)return!0;for(let n=1,a=t.length;n<a;++n)if(Gv(i,t[n-1],t[n],s,r)&&!Pc(i,t[n-1],t[n],s,r))return!1;return!0}function $v(i,e,t,s){for(;e<t-s;){for(let r=0;r<s;++r){const n=i[e+r];i[e+r]=i[t-s+r],i[t-s+r]=n}e+=s,t-=s}}function Lc(i,e,t,s){let r=0,n=i[t-s],a=i[t-s+1];for(;e<t;e+=s){const o=i[e],l=i[e+1];r+=(o-n)*(l+a),n=o,a=l}return r===0?void 0:r>0}function Vv(i,e,t,s,r){r=r!==void 0?r:!1;for(let n=0,a=t.length;n<a;++n){const o=t[n],l=Lc(i,e,o,s);if(n===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=o}return!0}function Tc(i,e,t,s,r){r=r!==void 0?r:!1;for(let n=0,a=t.length;n<a;++n){const o=t[n],l=Lc(i,e,o,s);(n===0?r&&l||!r&&!l:r&&!l||!r&&l)&&$v(i,e,o,s),e=o}return e}class ps extends Ba{constructor(e,t,s){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&s?(this.setFlatCoordinates(t,e),this.ends_=s):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?b_(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new ps(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,s,r){return r<rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ev(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Iv(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,s,r))}containsXY(e,t){return Ic(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Av(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Tc(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Fv(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=cc(this.getExtent());this.flatInteriorPoint_=kv(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Rv(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Ec(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,s=this.ends_,r=[];let n=0;for(let a=0,o=s.length;a<o;++a){const l=s[a],h=new Ec(t.slice(n,l),e);r.push(h),n=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;Vv(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Tc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],s=[];return t.length=Dv(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,s),new ps(t,"XY",s)}getType(){return"Polygon"}intersectsExtent(e){return Hv(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const s=Lv(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=s.length===0?0:s[s.length-1],this.changed()}}var yn=ps;function Bv(i){const e=i[0],t=i[1],s=i[2],r=i[3],n=[e,t,e,r,s,r,s,t,e,t];return new ps(n,"XY",[n.length])}function Uv(i,e,t){e=e||32;const s=i.getStride(),r=i.getLayout(),n=i.getCenter(),a=s*(e+1),o=new Array(a);for(let c=0;c<a;c+=s){o[c]=0,o[c+1]=0;for(let u=2;u<s;u++)o[c+u]=n[u]}const l=[o.length],h=new ps(o,r,l);return qv(h,n,i.getRadius(),t),h}function qv(i,e,t,s){const r=i.getFlatCoordinates(),n=i.getStride(),a=r.length/n-1,o=s||0;for(let l=0;l<=a;++l){const h=l*n,c=o+uv(l,a)*2*Math.PI/a;r[h]=e[0]+t*Math.cos(c),r[h+1]=e[1]+t*Math.sin(c)}i.changed()}function Ua(i){const e=i.getStride(),t=i.getFlatCoordinates();if(t.length){const s=Math.floor(t.length/e),r=new Array(s);for(let n=0;n<s;n++){const a=n*e,o=new Array(e);for(let l=0;l<e;l++)o[l]=t[a+l];r[n]=o}return r}return[]}function ss(i,e){const t=e||i.getCoordinates();let s=null;return i instanceof Bt?s=[t]:i instanceof br?s=t:i instanceof yn?s=t.reduce((r,n)=>r.concat(n)):i instanceof Ko?s=t:i instanceof Jo?s=t.reduce((r,n)=>r.concat(n)):i instanceof Or?s=t.reduce((r,n)=>r.concat(n)).reduce((r,n)=>r.concat(n)):i instanceof at?s=t:i instanceof Es&&(s=i.getGeometries().map((r,n)=>ss(r,t[n])).reduce((r,n)=>r.concat(n))),s}function qa(i,e){const t=Er(D.mercatorToWgs84(i),e,Math.PI/2),s=D.wgs84ToMercator(t),r=i[0]-s[0],n=i[1]-s[1],a=r*r,o=n*n,l=Math.sqrt(a+o);return new at(i,l,"XYZ")}function Wa(i){return i instanceof at?Uv(i):(i instanceof yn&&i.unset("_vcsGeomType"),i)}function _n(i){const[e,t]=i[i.length-1];i[0][0]===e&&i[0][1]===t||i.push(i[0].slice())}function Xa(i){const[e,t]=i[i.length-1];i[0][0]===e&&i[0][1]===t&&i.pop()}function Ya(i){if(i instanceof yn){const e=i.getCoordinates();e.forEach(t=>{Xa(t)}),i.setCoordinates(e)}else if(i instanceof Or){const e=i.getCoordinates();e.forEach(t=>{t.forEach(s=>{Xa(s)})}),i.setCoordinates(e)}}function Wv(i){let e=0;const t=i.length;for(let s=0;s<=t-2;s++){const r=i[s],n=i[s+1];e+=r[0]*n[1]-r[1]*n[0]}return e/=2,e}function Nc(i){return Wv(i)<0&&i.reverse(),i}class Vt{static fromArray(e){return v(e,[Number]),v(e.length,6),new Vt(e[0],e[1],e[2],e[3],e[4],e[5])}static fromGeometry(e){const t=new Vt;return t.extendWithGeometry(e),t}static fromHeightInfo(e){const t=new Vt;return t.extendWithHeightInfo(e),t}constructor(e=1/0,t=1/0,s=1/0,r=-1/0,n=-1/0,a=-1/0){this.minX=e,this.minY=t,this.minZ=s,this.maxX=r,this.maxY=n,this.maxZ=a}extendWithGeometry(e){if(e.getType()==="GeometryCollection")e.getGeometriesArray().forEach(t=>{this.extendWithGeometry(t)});else if(e.getType()==="Circle"){const t=e.getFlatCoordinates(),s=e.getStride(),r=t[s]-t[0];this.extendXY(t[0]-r,t[1]-r),this.extendXY(t[0]+r,t[1]+r),s>2&&this.extendZ(t[2])}else{const t=e.getFlatCoordinates(),s=e.getStride();this.extendFlatCoordinates(t,s)}}extendWithHeightInfo(e){if(e.extruded){const t=e.groundLevel+e.storeyHeightsAboveGround.reduce((r,n)=>r+n,0);this.extendZ(t);const s=e.groundLevel-e.storeyHeightsBelowGround.reduce((r,n)=>r+n,0);this.extendZ(s)}}extendXYZ(e,t,s){this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,t),this.minZ=Math.min(this.minZ,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,t),this.maxZ=Math.max(this.maxZ,s)}extendXY(e,t){this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,t),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,t)}extendZ(e){this.minZ=Math.min(this.minZ,e),this.maxZ=Math.max(this.maxZ,e)}extendFlatCoordinates(e,t){const{length:s}=e;for(let r=0;r<s;r+=t)t>2?this.extendXYZ(e[r],e[r+1],e[r+2]):this.extendXY(e[r],e[r+1])}to2D(){return[this.minX,this.minY,this.maxX,this.maxY]}toArray(){return[this.minX,this.minY,this.minZ,this.maxX,this.maxY,this.maxZ]}}const Ci=Symbol("FVlastUpdated"),rs=Symbol("GlobalHiderLastUpdated");function Dc(i,e){Object.keys(i.highlightedObjects).forEach(t=>{const s=e.getFeatureById(t);s&&!i.hasHighlightFeature(t,s)&&i.addHighlightFeature(t,s)}),Object.keys(i.hiddenObjects).forEach(t=>{const s=e.getFeatureById(t);s&&!i.hasHiddenFeature(t,s)&&i.addHiddenFeature(t,s)}),e[Ci]=Date.now()}function Fc(i,e){Object.keys(i.hiddenObjects).forEach(t=>{const s=e.getFeatureById(t);s&&!i.hasFeature(t,s)&&i.addFeature(t,s)}),e[rs]=Date.now()}function vn(i,e,t){const s=e.on("addfeature",({feature:r})=>{const n=r.getId();i.highlightedObjects[n]&&i.addHighlightFeature(n,r),i.hiddenObjects[n]&&i.addHiddenFeature(n,r),t.hiddenObjects[n]&&t.addFeature(n,r);const a=Date.now();e[Ci]=a,e[rs]=a});return(!e[Ci]||e[Ci]<i.lastUpdated)&&Dc(i,e),(!e[rs]||e[rs]<i.lastUpdated)&&Fc(t,e),[i.changed.addEventListener(({action:r,ids:n})=>{r===X.HIGHLIGHT?(n.forEach(a=>{const o=e.getFeatureById(a);o&&i.addHighlightFeature(a,o)}),e[Ci]=Date.now()):r===X.HIDE&&(n.forEach(a=>{const o=e.getFeatureById(a);o&&i.addHiddenFeature(a,o)}),e[Ci]=Date.now())}),t.changed.addEventListener(({action:r,ids:n})=>{r===X.HIDE&&(n.forEach(a=>{const o=e.getFeatureById(a);o&&t.addFeature(a,o)}),e[rs]=Date.now())}),()=>{Ce(s)}]}function Za(i,e){if(!(i instanceof Z))return null;const t=i.getProperties();delete t[i.getGeometryName()];const{clickedPosition:s}=i;if(!s)return null;let{latitude:r,longitude:n}=s;const a=i.getGeometry();let o=s.height,l=!o;a||(l=!1);let h=!o;const c=D.wgs84ToMercator([s.longitude,s.latitude,s.height]);if(a&&!a.intersectsCoordinate(c)){const u=a.getClosestPoint(c);[n,r]=D.mercatorToWgs84(u),l=!0}if(l){const u=ss(a),d=dn(i,e.vectorProperties,u);if(d.perPositionHeight||d.extruded){const f=Vt.fromGeometry(a);f.extendWithHeightInfo(d),o=f.maxZ}!d.extruded&&(a.getType()==="Point"||a.getType()==="MultiPoint")&&(d.heightReference===Qe.RELATIVE_TO_GROUND||d.heightReference===Qe.CLAMP_TO_GROUND)?(o=d.heightAboveGroundAdjustment,h=!0):o+=d.heightAboveGroundAdjustment}return delete t.clickedPosition,o=Number.isFinite(o)?o:0,{layerName:e.name,layerClass:e.className,attributes:S(S({},e.genericFeatureProperties),t),longitude:n,latitude:r,height:o+e.balloonHeightOffset,relativeToGround:h}}class Ka extends nr{static get className(){return"VectorOpenlayersImpl"}constructor(e,t){super(e,t),this.source=t.source,this.style=t.style,this.maxResolution=t.maxResolution,this.minResolution=t.minResolution,this.featureVisibility=t.featureVisibility,this._featureVisibilityListeners=[],this.olLayer=null,this.globalHider=t.globalHider}updateStyle(e,t){this.style=e,this.initialized&&this.olLayer.setStyle(this.style.style)}getOLLayer(){const e=new Qo({visible:!1,source:this.source,style:this.style.style});return this.minResolution&&e.setMinResolution(this.minResolution),this.maxResolution&&e.setMaxResolution(this.maxResolution),e}async activate(){this.active||(await super.activate(),this.active&&this._featureVisibilityListeners.length===0&&(this._featureVisibilityListeners=vn(this.featureVisibility,this.source,this.globalHider)))}deactivate(){super.deactivate(),this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[]}setVisibility(e){this.initialized&&this.olLayer.setVisible(e)}destroy(){this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[],super.destroy()}}function Ac(i,e,t,s){const r=T(S({},i),{perPositionHeight:t,extrudedHeight:s});return t||(r.height=e),[new wf(r)]}function Xv(i,e,t,s){return[new bf(T(S({},i),{height:t?void 0:e,extrudedHeight:s,perPositionHeight:t,vertexFormat:Bn.FLAT_VERTEX_FORMAT}))]}function Yv(i,e,t){return Ac(i,e,t,void 0)}function Rc(i,e){const t=N(e.getStroke().getWidth(),1),s=[];return s.push({positions:i.polygonHierarchy.positions,width:t}),i.polygonHierarchy.holes.forEach(r=>{s.push({positions:r.positions,width:t})}),s}function Zv(i,e){return Rc(i,e).map(t=>new qn(t))}function Kv(i,e){return Rc(i,e).map(t=>new Wn(t))}function Jv(i,e){let t;const s=[],r=i.getLinearRings();for(let n=0;n<r.length;n++){const o=r[n].getCoordinates().map(l=>{const h=D.mercatorToWgs84(l);return h[2]!=null&&(h[2]+=e),M.fromDegrees(h[0],h[1],h[2])});M.equals(o[0],o[o.length-1])||o.push(o[0]),n===0?t=o:s.push(new ml(o))}return{polygonHierarchy:new ml(t,s)}}function Qv(i){const e=[];return i.forEach(t=>{e.push(...Ua(t))}),e}let Ja=null;function e1(){return Ja||(Ja={getCoordinates:Qv,getGeometryOptions:Jv,createSolidGeometries:Ac,createOutlineGeometries:Xv,createFillGeometries:Yv,createGroundLineGeometries:Zv,createLineGeometries:Kv}),Ja}function Qa(i){if(i.getType()!=="Polygon")return!1;const e=i.getFlatCoordinates(),t=i.getEnds(),s=i.getStride();if(!t.every((a,o)=>{const l=o?t[o-1]:0;return a-l>=s*3}))return!1;const n=s*3*i.getLinearRingCount();return e&&e.length>=n&&i.getLinearRingCount()?e.every(a=>Number.isFinite(a)):!1}function eo(i,e,t,s,r,n){if(!e.getFill()&&!e.getStroke())return;const a=e1(),o=t.filter(l=>Qa(l));fn(i,e,o,s,r,a,n)}function Gc(i,e,t,s){return[new Of(T(S({},i),{height:e,granularity:.02,extrudedHeight:s}))]}function t1(i,e,t,s){return[new Ef(T(S({},i),{height:e,extrudedHeight:s,granularity:.02}))]}function i1(i,e,t){return Gc(i,e,t,void 0)}function kc(i,e){const t=N(e.getStroke().getWidth(),1),{center:s,radius:r}=i,n=se.fromCartesian(s),a=[P.toDegrees(n.longitude),P.toDegrees(n.latitude)];return{positions:Hd(a,r,40).getLinearRing(0).getCoordinates().map(c=>M.fromDegrees(c[0],c[1],n.height)),width:t}}function s1(i,e){const t=kc(i,e);return[new qn(t)]}function r1(i,e){const t=kc(i,e);return[new Wn(t)]}function n1(i,e){const t=i.getCenter(),s=t.slice();s[0]+=i.getRadius();const r=D.mercatorToWgs84(t,!0);r[2]!=null&&(r[2]+=e);const n=D.mercatorToWgs84(s,!0),a=M.fromDegrees(r[0],r[1],r[2]),o=M.fromDegrees(n[0],n[1],r[2]);return{radius:M.distance(a,o),center:a}}function a1(i){return i.map(e=>e.getCenter())}let to=null;function o1(){return to||(to={getCoordinates:a1,getGeometryOptions:n1,createSolidGeometries:Gc,createOutlineGeometries:t1,createFillGeometries:i1,createGroundLineGeometries:s1,createLineGeometries:r1}),to}function io(i){if(i.getType()!=="Circle")return!1;const e=i.getFlatCoordinates(),t=i.getStride();return e&&e.length>=t+1&&e[t]!==e[0]?e.every(s=>Number.isFinite(s)):!1}function zc(i,e,t,s,r,n){if(!e.getFill()&&!e.getStroke())return;const a=o1(),o=t.filter(l=>io(l));fn(i,e,o,s,r,a,n)}function l1(i,e,t,s){return[If.fromConstantHeights(T(S({},i),{maximumHeight:t?void 0:e,minimumHeight:s}))]}function h1(i,e,t,s){return[Pf.fromConstantHeights(T(S({},i),{maximumHeight:t?void 0:e,minimumHeight:s}))]}function c1(i,e,t){return[]}function u1(i,e){const t=N(e.getStroke().getWidth(),1);return[new qn(T(S({},i),{width:t}))]}function jc(i,e){const t=N(e.getStroke().getWidth(),1);return[new Wn(T(S({},i),{width:t}))]}function d1(i,e){return{positions:i.getCoordinates().map(r=>{const n=D.mercatorToWgs84(r);return n[2]!=null&&(n[2]+=e),M.fromDegrees(n[0],n[1],n[2])})}}function f1(i){const e=[];return i.forEach(t=>{e.push(...Ua(t))}),e}let so=null;function g1(){return so||(so={getCoordinates:f1,getGeometryOptions:d1,createSolidGeometries:l1,createOutlineGeometries:h1,createFillGeometries:c1,createGroundLineGeometries:u1,createLineGeometries:jc}),so}function ro(i){if(i.getType()!=="LineString")return!1;const e=i.getFlatCoordinates(),t=i.getStride()*2;return e&&e.length>=t?e.every(s=>Number.isFinite(s)):!1}function no(i,e,t,s,r,n){if(!e.getFill()&&!e.getStroke())return;const a=g1(),o=t.filter(l=>ro(l));fn(i,e,o,s,r,a,n)}function m1(i){return i.map(e=>e.getCoordinates())}function Hc(i,e,t,s){const r=e.getImage();if(r){const n=new Ne(1,1,1,r.getOpacity());let a=null;r instanceof Ps&&(r.load(),r.getImageState()===Ir.LOADING&&(a=new Promise((l,h)=>{const c=()=>{r.getImageState()===Ir.LOADED||r.getImageState()===Ir.EMPTY?(l(r.getImage(1)),r.unlistenImageChange(c)):r.getImageState()===Ir.ERROR&&(h(),r.unlistenImageChange(c))};r.listenImageChange(c)}))),a||(a=r.getImage(1));const o={image:a,color:n,scale:r.getScale(),heightReference:t,verticalOrigin:Xe.BOTTOM,id:i.getId()};return o.eyeOffset=s.getEyeOffset(i),o.scaleByDistance=s.getScaleByDistance(i),o}return null}function $c(i,e,t,s){var a,o;const r=e.getText(),n=r?r.getText():null;if(n){const l={};l.text=n,l.heightReference=t;const h=(a=r.getOffsetX())!=null?a:0,c=(o=r.getOffsetY())!=null?o:0;l.pixelOffset=new K(h,c);const u=r.getScale();u&&(l.scale=Array.isArray(u)?u[0]:u);const d=r.getFont();d&&(l.font=d);const f=r.getFill(),g=r.getStroke();let m;f&&(l.fillColor=gi(f.getColor(),[0,0,0,1]),m=Xn.FILL),g&&(l.outlineWidth=N(g.getWidth(),1),l.outlineColor=gi(g.getColor(),[0,0,0,1]),m=Xn.OUTLINE),f&&g&&(m=Xn.FILL_AND_OUTLINE),l.style=m;let p;switch(r.getTextAlign()){case"left":p=Yn.LEFT;break;case"right":p=Yn.RIGHT;break;case"center":default:p=Yn.CENTER}l.horizontalOrigin=p;let y;switch(r.getTextBaseline()){case"top":y=Xe.TOP;break;case"middle":y=Xe.CENTER;break;case"bottom":y=Xe.BOTTOM;break;case"alphabetic":y=Xe.TOP;break;case"hanging":y=Xe.BOTTOM;break;default:y=Xe.BASELINE}return l.verticalOrigin=y,l.eyeOffset=s.getEyeOffset(i),l.scaleByDistance=s.getScaleByDistance(i),l}return null}function Vc(i,e,t,s,r){const n=s.getModel(i);if(n){const a=M.fromArray(n.scale),o=Lf.fromDegrees(n.heading,n.pitch,n.roll);return t.map((l,h)=>{const c=k.multiply(pl.headingPitchRollToFixedFrame(l,o),k.fromScale(a),new k),u=s.getModelOptions(i),d=Tf.fromGltf(S({url:n.url,modelMatrix:c},u));return e[h][2]||Nr(r.globe.terrainProvider,[se.fromCartesian(l)]).then(([f])=>{d.isDestroyed()||(d.modelMatrix=k.multiply(pl.headingPitchRollToFixedFrame(se.toCartesian(f),o),k.fromScale(a),new k))}).catch(()=>{}),d.readyPromise.then(()=>{d.activeAnimations.addAll({loop:Nf.REPEAT})}),d})}return null}function ao(i){if(i.getType()!=="Point")return!1;const e=i.getFlatCoordinates();return e&&e.length>=2?e.every(t=>Number.isFinite(t)):!1}function Bc(i,e){const t=new Array(i.length),s=new Array(i.length),r=e.groundLevel+e.storeyHeightsAboveGround.reduce((n,a)=>n+a,0);return i.forEach((n,a)=>{t[a]=D.mercatorToWgs84(n,!0);let o=null;e.heightReference===Qe.RELATIVE_TO_GROUND?o=e.heightAboveGroundAdjustment:o=r,s[a]=M.fromDegrees(n[0],n[1],o)}),{positions:s,wgs84Positions:t}}function p1(i,e,t,s){const r=[],n=e.skirt+e.storeyHeightsBelowGround.reduce((a,o)=>a+o,0);for(let a=0;a<i.length;a++){const o=i[a];let l=o[2]!=null?o[2]:e.groundLevel;l-=n;const h=M.fromDegrees(o[0],o[1],l),c=[t[a],h];r.push(...jc({positions:c},s))}return r}function oo(i,e,t,s,r,n){if(!e.getImage()&&!(e.getText()&&e.getText().getText()))return;const a=t.filter(g=>ao(g));if(!a.length)return;const o=m1(a),l=dn(i,s,o);let{heightReference:h}=l;const c=s.getAllowPicking(i),{positions:u,wgs84Positions:d}=Bc(o,l),f=Vc(i,d,u,s,r);if(f)n.addPrimitives(f,i,c);else{if(l.extruded&&e.getStroke()){const p=p1(d,l,u,e);if(p.length){h=Qe.NONE;const y=Ga(r,s,c,i,p,e,!1);y&&n.addPrimitives([y],i,c)}}const g=Hc(i,e,h,s);if(g){const p=u.map(y=>T(S({},g),{position:y}));n.addBillboards(p,i,c)}const m=$c(i,e,h,s);if(m){const p=u.map(y=>T(S({},m),{position:y}));n.addLabels(p,i,c)}}}function Uc(i,e,t,s,r,n){e instanceof Bt?oo(i,t,[e],s,r,n):e instanceof Ts?eo(i,t,[e],s,r,n):e instanceof br?no(i,t,[e],s,r,n):e instanceof at?zc(i,t,[e],s,r,n):e instanceof Ko?oo(i,t,e.getPoints(),s,r,n):e instanceof Or?eo(i,t,e.getPolygons(),s,r,n):e instanceof Jo?no(i,t,e.getLineStrings(),s,r,n):e instanceof Es&&e.getGeometries().forEach(a=>{Uc(i,a,t,s,r,n)})}function or(i,e,t=1){const s=[];return typeof i=="function"?s.push(...or(i(e,t),e,t)):Array.isArray(i)?i.forEach(r=>{s.push(...or(r,e,t))}):i instanceof _e&&s.push(i),s}function qc(i,e,t,s,r){or(i.getStyle()||e,i,0).forEach(a=>{const o=a.getGeometryFunction()(i);o&&Uc(i,o,a,t,r,s)})}function Wc(i,e){e.olFeature=i}function xi(i,e){e&&e.forEach(t=>{i.remove(t)})}function ns(i,e,t){xi(t,e.get(i)),e.delete(i)}function as(i,e,t,s,r){if(i.length){const n=i.map(a=>{const o=s.add(a);return t&&Wc(e,o),o});r.has(e)?r.get(e).push(...n):r.set(e,n)}}class Xc{constructor(e,t){this.primitives=new Zn,this.billboards=new Df({scene:e}),this.labels=new Ff({scene:e}),this.featureToPrimitiveMap=new Map,this.featureToBillboardMap=new Map,this.featureToLabelMap=new Map,t.add(this.primitives),t.add(this.billboards),t.add(this.labels)}addPrimitives(e,t,s){as(e,t,s,this.primitives,this.featureToPrimitiveMap)}addBillboards(e,t,s){as(e,t,s,this.billboards,this.featureToBillboardMap)}addLabels(e,t,s){as(e,t,s,this.labels,this.featureToLabelMap)}removeFeature(e){ns(e,this.featureToPrimitiveMap,this.primitives),ns(e,this.featureToBillboardMap,this.billboards),ns(e,this.featureToLabelMap,this.labels)}createFeatureCache(e){const t={};return t.primitives=this.featureToPrimitiveMap.get(e),this.featureToPrimitiveMap.delete(e),t.billboards=this.featureToBillboardMap.get(e),this.featureToBillboardMap.delete(e),t.labels=this.featureToLabelMap.get(e),this.featureToLabelMap.delete(e),t}clearFeatureCache(e){xi(this.primitives,e.primitives),xi(this.billboards,e.billboards),xi(this.labels,e.labels)}clear(){this.primitives.removeAll(),this.billboards.removeAll(),this.labels.removeAll(),this.featureToBillboardMap.clear(),this.featureToLabelMap.clear(),this.featureToPrimitiveMap.clear()}}class Yc extends Qt{static get className(){return"VectorCesiumImpl"}constructor(e,t){super(e,t),this.vectorProperties=t.vectorProperties,this.source=t.source,this.style=t.style,this.featureVisibility=t.featureVisibility,this._featureVisibilityListeners=[],this._removeVectorPropertiesChangeHandler=()=>{},this._rootCollection=new Zn,this._rootCollection[j]=t.name,this._olListeners=[],this._featureToAdd=new Set,this._context=null,this._scene=null,this.globalHider=t.globalHider}_addListeners(){this._olListeners.push(this.source.on("addfeature",e=>{this._addFeature(e.feature)})),this._olListeners.push(this.source.on("removefeature",e=>{this._removeFeature(e.feature)})),this._olListeners.push(this.source.on("changefeature",e=>{this._featureChanged(e.feature)})),this._removeVectorPropertiesChangeHandler=this.vectorProperties.propertyChanged.addEventListener(this.refresh.bind(this))}async _setupContext(e){const t=this._rootCollection;this._context=new Xc(this._scene,t),e.addPrimitiveCollection(t)}async initialize(){this.initialized||(this._scene=this.map.getScene(),this._addListeners(),this._addFeatures(this.source.getFeatures()),await this._setupContext(this.map)),await super.initialize()}_addFeatures(e){e.forEach(t=>{this._addFeature(t)})}_addFeature(e){this.active?qc(e,this.style.style,this.vectorProperties,this._context,this._scene):this._featureToAdd.add(e)}refresh(){this._context.clear(),this._addFeatures(this.source.getFeatures())}_removeFeature(e){this._context.removeFeature(e),this._featureToAdd.delete(e)}_featureChanged(e){const t=this._context.createFeatureCache(e);this._featureToAdd.delete(e),this._addFeature(e),this._context.clearFeatureCache(t)}async activate(){this.active||(await super.activate(),this.active&&(this._addFeatures([...this._featureToAdd]),this._featureToAdd.clear(),this._rootCollection.show=!0,this._featureVisibilityListeners.length===0&&(this._featureVisibilityListeners=vn(this.featureVisibility,this.source,this.globalHider))))}deactivate(){super.deactivate(),this._rootCollection.show=!1,this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[]}updateStyle(e,t){this.style=e,this.initialized&&!t&&this.source.getFeatures().filter(r=>!r.getStyle()).forEach(r=>{this._featureChanged(r)})}_destroyCollection(){this.map.removePrimitiveCollection(this._rootCollection)}destroy(){this.initialized&&(this._context.clear(),this._destroyCollection()),this._context=null,this._scene=null,this._removeVectorPropertiesChangeHandler(),this._olListeners.forEach(e=>{Ce(e)}),this._olListeners=[],this._featureToAdd.clear(),this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[],this.source=null,this.vectorProperties=null,this.featureVisibility=null,this.style=null,this.globalHider=null,this._rootCollection=null,super.destroy()}}const ge={NORTH:1,EAST:2,SOUTH:3,WEST:4,NADIR:5},Sn={north:ge.NORTH,east:ge.EAST,south:ge.SOUTH,west:ge.WEST,nadir:ge.NADIR};function y1(i){return Object.keys(Sn).find(e=>Sn[e]===i)}const os={};function ls(i){if(!os[i.url])return os[i.url]=new yl(i),os[i.url];let e=os[i.url];return(i.requestVertexNormals!==void 0&&e.requestVertexNormals!==i.requestVertexNormals||i.requestWaterMask!==void 0&&e.requestWaterMask!==i.requestWaterMask)&&(os[i.url]=new yl(i),e=os[i.url]),e}function wi(i,e,t,s){const r=t?ye(t.proj,U.proj):null,n=e.map(o=>{const l=r?r(o,o.slice(),o.length):o;return se.fromDegrees(l[0],l[1])}),a=s||e.map(o=>o.slice());return Nr(i,n).then(o=>(o.forEach((l,h)=>{a[h][2]=l.height||0}),a))}function Zc(i,e,t){if(!i.ready)return!1;const s=i.tilingScheme.positionToTileXY(t,e,new K);return i.getTileDataAvailable(s.x,s.y,e)}let lo=new K,ho=new K;function co(i,e=!1){const t=i.slice(),s=Ls(t);let n=[kn(s),el(s),tl(s),Pr(s)].map(a=>{let o=0,l=1/0;return t.forEach((h,c)=>{const u=mt(a,h);u<l&&(l=u,o=c)}),t.splice(o,1)[0]});return e===ge.EAST?n=[n[3],n[0],n[1],n[2]]:e===ge.SOUTH?n=[n[2],n[3],n[0],n[1]]:e===ge.WEST&&(n=[n[1],n[2],n[3],n[0]]),n}function lr(i,e){return lo=K.fromElements(i[0],i[1],lo),ho=K.fromElements(e[0],e[1],ho),K.angleBetween(lo,ho)}function uo(i,e){const[[t,s],[r,n]]=i,[[a,o],[l,h]]=e;let c,u;const d={x:null,y:null,onLine1:!1,onLine2:!1},f=(h-o)*(r-t)-(l-a)*(n-s);if(f===0)return d;c=s-o,u=t-a;const g=(l-a)*c-(h-o)*u,m=(r-t)*c-(n-s)*u;return c=g/f,u=m/f,d.x=t+c*(r-t),d.y=s+c*(n-s),c>0&&c<1&&(d.onLine1=!0),u>0&&u<1&&(d.onLine2=!0),d}function Kc(i,e,t,s,r){const n=co(i,t?!1:r),a=co(e,t?r:!1),o=[];for(let c=0;c<n.length;++c){const u=[];for(let g=0;g<n.length;++g){const m=g===n.length-1?0:g+1;if(c===g||c===m||g===3&&m===0||g===1&&m===2)continue;const p=uo([n[c],s],[n[g],n[m]]);if(p.x==null||p.y==null)continue;const y=[s[0]-n[c][0],s[1]-n[c][1]],_=[p.x-n[c][0],p.y-n[c][1]],w=lr(y,_);if(w==null||w/(Math.PI*180)>5)continue;const L=[n[g][0]-n[m][0],n[g][1]-n[m][1]],E=[n[m][0]-n[g][0],n[m][1]-n[g][1]],A=lr(y,L);if(A==null)continue;const Y=lr(y,E);if(Y==null)continue;const V=mt(n[g],n[m]);if(V===0)continue;const Ee=mt(n[g],[p.x,p.y])/V;let qe=0;Ee!==0&&(qe=lr(E,[p.x-n[g][0],p.y-n[g][1]]),qe==null)||u.push({cornerPoint:c,intrX:p.x,intrY:p.y,angle:A<=Y?A:Y,edgeStart:g,edgeEnd:m,ratioStart2End:qe/Math.PI*180>5?Ee*-1:Ee})}let d=-1,f=-1;for(let g=0;g<u.length;++g)u[g].angle>d&&(d=u[g].angle,f=g);f!==-1&&o.push(u[f])}if(o.length<2)return null;const l=[];for(let c=0;c<o.length;++c)for(let u=c+1;u<o.length;++u)l.push([o[c].angle+o[u].angle,c,u]);let h=null;return l.sort().reverse().find(c=>{const u=[o[c[1]],o[c[2]]],d=a[u[0].edgeEnd],f=a[u[0].edgeStart],g=[d[0]-f[0],d[1]-f[1]],m=[f[0]+g[0]*u[0].ratioStart2End,f[1]+g[1]*u[0].ratioStart2End],p=a[u[1].edgeEnd],y=a[u[1].edgeStart],_=[p[0]-y[0],p[1]-y[1]],w=[y[0]+_[0]*u[1].ratioStart2End,y[1]+_[1]*u[1].ratioStart2End],L=[m[0]-a[u[0].cornerPoint][0],m[1]-a[u[0].cornerPoint][1]],E=[w[0]-a[u[1].cornerPoint][0],w[1]-a[u[1].cornerPoint][1]];return!(lr(L,E)==null||(h=uo([a[u[0].cornerPoint],m],[a[u[1].cornerPoint],w]),h.x==null||h.y==null))}),h}function _1(i,e,t={}){let s;t.dataProjection&&t.dataProjection===i.meta.projection?s=e:s=t.dataProjection?ri(e,t.dataProjection.proj,i.meta.projection.proj):ri(e,R.proj,i.meta.projection.proj);function r(){return{coords:i.transformRealWorld2Image(s),height:i.averageHeight,estimate:!0}}if(e[2]){const n=i.transformRealWorld2Image(s,e[2]);return Promise.resolve({coords:n,height:e[2],estimate:!1})}return!t.dontUseTerrain&&i.meta.terrainProvider?wi(i.meta.terrainProvider,[s],i.meta.projection).then(([n])=>n[2]?{coords:i.transformRealWorld2Image(s,n[2]),height:s[2],estimate:!1}:(console.warn("The configured terrain on the oblique layer could not be queried, position might be inaccurate"),r())).catch(()=>r()):Promise.resolve(r())}function Jc(i){i.count+=1;const{image:e,worldCoordinate:t,imageCoordinate:s,terrainErrorThreshold:r,terrainErrorCountThreshold:n,count:a,height:o}=i;return wi(e.meta.terrainProvider,[t]).then(([l])=>{if(l[2]!=null){const h=ri(e.transformImage2RealWorld(s,l[2]),e.meta.projection.proj,U.proj);return h[2]=l[2],Math.abs(o-l[2])<r||a>n?{coords:h,estimate:!1}:(i.height=h[2],i.worldCoordinate=l,Jc(i))}return console.log("The configured terrain on the oblique layer could not be queried, position might be inaccurate"),{coords:l,estimate:!0}}).catch(()=>({coords:t,estimate:!0}))}async function hs(i,e,t={}){const s=ri(i.transformImage2RealWorld(e,i.averageHeight),i.meta.projection.proj,U.proj),r=t.terrainErrorThreshold||1,n=t.terrainErrorCountThreshold||3;let a={coords:s,estimate:!0};return!t.dontUseTerrain&&i.meta.terrainProvider&&(a=await Jc({worldCoordinate:s,imageCoordinate:e,image:i,count:0,height:i.averageHeight,terrainErrorThreshold:r,terrainErrorCountThreshold:n})),a.coords=t.dataProjection?ri(a.coords,U.proj,t.dataProjection.proj):ri(a.coords,U.proj,R.proj),a}function Qc(i){if(!/^[a-z][a-z0-9+.-]*:/.test(i)||/^data:/.test(i))return!0;const e=new URL(window.location.href),t=new URL(i);return e.host.toLowerCase()===t.host.toLocaleLowerCase()}function eu(i){let e=0;for(let t=0;t<i.length;t++){let s=t+1;s>=i.length&&(s=0);const r=i[t],n=i[s],a=mt(r,n);a>e&&(e=a)}return e}function fo(i,e){const t=eu(e.groundCoordinates),s=Math.PI/3,r=i.getViewport(),n={height:r.offsetHeight||1,width:r.offsetWidth||1},a=n.width/n.height,o=Math.atan(Math.tan(s*.5)/a)*2,[l,h]=e.meta.size,c=l>h?l:h,u=t/c;return{size:n,fovy:o,metersPerUnit:u}}function tu(i,e,t){const{size:s,fovy:r,metersPerUnit:n}=fo(i,e),l=2*t*Math.tan(r/2)/n/s.height;return i.getView().getZoomForResolution(l)}async function iu(i,e,t){const s=i instanceof at?$d(i):i,r=s.getCoordinates(),n=ss(s,r);let a=ye(R.proj,t.meta.projection.proj),o=[];if(t.meta.terrainProvider){const l=n.map(h=>(D.mercatorToWgs84(h,!0),se.fromDegrees(h[0],h[1])));a=ye(U.proj,t.meta.projection.proj),o=await Nr(t.meta.terrainProvider,l)}return n.forEach((l,h)=>{a(l,l,3);const c=o[h]?o[h].height:null,u=t.transformRealWorld2Image(l,c||l[2]||t.averageHeight);n[h][0]=u[0],n[h][1]=u[1]}),e.setCoordinates(r),e}function su(i,e,t){const s=i.getCoordinates(),n=ss(i,s).map(a=>hs(t,a).then(o=>{a[0]=o.coords[0],a[1]=o.coords[1],a[2]=o.coords[2]}));return Promise.all(n).then(()=>(e.setCoordinates(s),e))}function go(i,e=!1){const t=i.getGeometry();if((t.get("_vcsGeomType")==="bbox"||t.get("_vcsGeomType")==="rectangle")&&e)return t;const r=t instanceof at,n=Wa(t);return n[Ki]=r,n}function mo(i,e){const t=i.getGeometry(),s=i.getGeometry().clone();e.setGeometry(t[Ge]?s:Wa(s)),t[Ge]&&e.getGeometry().setProperties(i.getGeometry().getProperties(),!1),i[Rt]=e.getGeometry()}class ru extends Qt{constructor(e,t){super(e,t),this.olLayer=null}initialize(){return this.initialized||(this.olLayer=this.getOLLayer(),this.olLayer[j]=this.name,this.map.addOLLayer(this.olLayer)),super.initialize()}async activate(){await super.activate(),this.active&&this.olLayer.setVisible(!0)}deactivate(){super.deactivate(),this.olLayer&&this.olLayer.setVisible(!1)}getOLLayer(){throw new Error}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,super.destroy()}}class po extends ru{static get className(){return"VectorObliqueImpl"}constructor(e,t){super(e,t),this.obliqueSource=new Ns({}),this._featureListeners={},this._sourceListener=[],this.currentExtent=null,this.fetchedFeaturesForImageName=null,this._updatingMercator={},this._updatingOblique={},this._featureVisibilityListeners=[],this.globalHider=t.globalHider,this.source=t.source,this.style=t.style,this.featureVisibility=t.featureVisibility,this.olLayer=null}getOLLayer(){return new Qo({visible:!1,source:this.obliqueSource,style:this.style.style})}updateStyle(e,t){this.style=e,this.initialized&&this.olLayer.setStyle(this.style.style)}_onObliqueImageChanged(){this._clearCurrentImage(),this._fetchFeaturesInView()}_featureInExtent(e){if(this.currentExtent){const t=e.getGeometry();if(t)return t[Ge]||t.intersectsExtent(this.currentExtent)}return!1}_addSourceListeners(){this._sourceListener.push(this.source.on("addfeature",e=>{const{feature:t}=e;this._featureInExtent(t)&&this.addFeature(e.feature)})),this._sourceListener.push(this.source.on("removefeature",e=>{this.removeFeature(e.feature)})),this._sourceListener.push(this.source.on("changefeature",e=>{const{feature:t}=e,s=t.getId();!this._featureListeners[s]&&this._featureInExtent(t)&&this.addFeature(t)}))}async activate(){this.active||(await super.activate(),this.active&&(this.olLayer.setVisible(!0),this._featureVisibilityListeners.length===0&&(this._featureVisibilityListeners=vn(this.featureVisibility,this.source,this.globalHider)),this._addSourceListeners(),this._imageChangedListener=this.map.imageChanged.addEventListener(this._onObliqueImageChanged.bind(this)),await this._fetchFeaturesInView()))}addFeature(e){if(this.active||(this.fetchedFeaturesForImageName=null),this.active&&this.currentExtent){const t=e.getId(),s=e.getGeometry();if(e[Fa])return s&&!this.obliqueSource.getFeatureById(t)&&this.obliqueSource.addFeature(e),Promise.resolve();if(this.obliqueSource.getFeatureById(t))return Promise.resolve();const r=new Z({});return r.setId(t),r[Jt]=e,mo(e,r),r.setStyle(e.getStyle()),this._setFeatureListeners(e,r),this._convertToOblique(e,r).then(()=>{this.obliqueSource.addFeature(r)})}return Promise.resolve()}_originalGeometryChanged(e,t,s){Ce(e.originalGeometryChanged),Ce(e.obliqueGeometryChanged),mo(t,s),this.updateObliqueGeometry(t,s),e.originalGeometryChanged=t.getGeometry().on("change",this.updateObliqueGeometry.bind(this,t,s)),e.obliqueGeometryChanged=s.getGeometry().on("change",this.updateMercatorGeometry.bind(this,t,s))}_setFeatureListeners(e,t){const s=t.getId(),r={originalFeatureGeometryChanged:e.on("change:geometry",()=>{const n=e.getGeometry();if(n[Ki]){Ce(r.originalGeometryChanged),r.originalGeometryChanged=e.getGeometry().on("change",()=>{this._updatingMercator[s]||(delete n[Ki],this._originalGeometryChanged(r,e,t))});return}this._originalGeometryChanged(r,e,t)}),originalFeatureChanged:e.on("change",()=>{t.setStyle(e.getStyle())}),originalGeometryChanged:e.getGeometry().on("change",this.updateObliqueGeometry.bind(this,e,t)),obliqueGeometryChanged:t.getGeometry().on("change",this.updateMercatorGeometry.bind(this,e,t))};this._featureListeners[s]=r}async _convertToOblique(e,t){const s=e.getId(),r=e.getGeometry(),n=t.getGeometry();this._updatingOblique[s]=!0,r[Ge]?t.getGeometry().setCoordinates(r.getCoordinates()):await iu(r,n,this.map.currentImage),this._updatingOblique[s]=null}updateObliqueGeometry(e,t){const s=e.getId();this._updatingMercator[s]||(this._updatingOblique[s]!=null&&clearTimeout(this._updatingOblique[s]),e.getGeometry()[Ge]?this._convertToOblique(e,t):this._updatingOblique[s]=setTimeout(()=>{this._convertToOblique(e,t)},200))}updateMercatorGeometry(e,t){const s=e.getId();if(this._updatingOblique[s])return;this._updatingMercator[s]!=null&&clearTimeout(this._updatingMercator[s]);const r=this.fetchedFeaturesForImageName;this._updatingMercator[s]=setTimeout(async()=>{const n=go(e,!1);n[Ki]&&e.setGeometry(n);const a=go(t,!0);this._updatingMercator[s]=!0,await su(a,n,this.map.collection.getImageByName(r)),this._updatingMercator[s]=null},200)}_clearCurrentImage(){Object.values(this._featureListeners).forEach(e=>{Ce(Object.values(e))}),this._featureListeners={},this._updatingOblique={},this._updatingMercator={},this.obliqueSource.getFeatures().forEach(e=>{const t=e[Jt];if(t){delete t[Rt];const s=t.getGeometry();s[Ge]&&this.updateMercatorGeometry(t,e),delete s[Ge]}}),this.obliqueSource.clear(!0),this.fetchedFeaturesForImageName=null}_fetchFeaturesInView(){this.active&&this.map.currentImage&&this.fetchedFeaturesForImageName!==this.map.currentImage.name&&(this.currentExtent=this.map.getExtentOfCurrentImage().getCoordinatesInProjection(R),this.source.forEachFeatureInExtent(this.currentExtent,e=>{this.addFeature(e)}),this.source.forEachFeature(e=>{e.getGeometry()[Ge]&&this.addFeature(e)}),this.fetchedFeaturesForImageName=this.map.currentImage.name)}removeFeature(e){const t=this.obliqueSource.getFeatureById(e.getId());if(t){const s=t.getId(),r=this._featureListeners[s];r&&(Ce(Object.values(r)),delete this._featureListeners[s]),this.obliqueSource.removeFeature(t)}}deactivate(){super.deactivate(),this.olLayer&&this.olLayer.setVisible(!1),this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[],Ce(this._sourceListener),this._sourceListener=[],this._imageChangedListener&&(this._imageChangedListener(),this._imageChangedListener=null),this._clearCurrentImage()}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,Ce(this._sourceListener),this._sourceListener=[],this._imageChangedListener&&(this._imageChangedListener(),this._imageChangedListener=null),this.obliqueSource.clear(!0),Object.values(this._updatingOblique).forEach(e=>{e!=null&&clearTimeout(e)}),Object.values(this._updatingMercator).forEach(e=>{e!=null&&clearTimeout(e)}),this._clearCurrentImage(),super.destroy()}}class Mn{constructor(e){this.name=e.name,this.meta=e.meta,this.viewDirection=e.viewDirection,this.viewDirectionAngle=e.viewDirectionAngle,this.groundCoordinates=e.groundCoordinates,this.centerPointOnGround=e.centerPointOnGround,this.pToRealworld=e.pToRealworld||null,this.pToImage=e.pToImage||null,this.projectionCenter=e.projectionCenter||null,this._averageHeight=null}get averageHeight(){return this._averageHeight!=null?this._averageHeight:0}get hasCamera(){return!!this.meta.principalPoint}transformImage2RealWorld(e,t){let s=e;if(this.meta.principalPoint)this.meta.hasRadial&&(s=this.meta.radialDistortionCoordinate(s,!0));else return this._transformNoCamera(s,!0,t);const r=new M(s[0],this.meta.size[1]-s[1],1),n=We.multiplyByVector(this.pToRealworld,r,new M),a=t||this.averageHeight,o=new M(this.centerPointOnGround[0],this.centerPointOnGround[1],a),l=M.subtract(this.projectionCenter,o,new M),h=M.dot(M.UNIT_Z,l)*-1,c=M.dot(M.UNIT_Z,n),u=h/c,d=M.add(this.projectionCenter,M.multiplyByScalar(n,u,new M),new M);return[d.x,d.y,a]}transformRealWorld2Image(e,t){if(!this.meta.principalPoint)return this._transformNoCamera(e,!1,t);const s=t||this.averageHeight,r=new _l(e[0],e[1],s,1),n=k.multiplyByVector(this.pToImage,r,new _l),a=[n.x/n.z,n.y/n.z],o=[a[0],this.meta.size[1]-a[1]];return this.meta.radialDistortionCoordinate(o,!1)}_transformNoCamera(e,t,s){const r=[[0,0],[this.meta.size[0],0],this.meta.size,[0,this.meta.size[1]]],n=Kc(t?r:this.groundCoordinates,t?this.groundCoordinates:r,t,e,this.viewDirection),a=s||this.averageHeight;if(n===null||n.x==null||n.y==null){console.error("Real world coordinate could not be determined from footprint data, center will be returned");const l=[this.centerPointOnGround[0],this.centerPointOnGround[1]];return t&&l.push(a),l}const o=[n.x,n.y];return t&&o.push(a),o}calculateImageAverageHeight(){if(this._averageHeight===null){const e=(this.groundCoordinates[0][2]+this.groundCoordinates[1][2]+this.groundCoordinates[2][2]+this.groundCoordinates[3][2])/4;if(e===0&&this.meta.terrainProvider)return wi(this.meta.terrainProvider,[this.centerPointOnGround.slice()],this.meta.projection).then(t=>{t[0]&&t[0][2]!=null&&(this._averageHeight=t[0][2])}).catch(()=>{this._averageHeight=e});this._averageHeight=e}return Promise.resolve()}}class hr{constructor(e){this.name=e.name,this.principalPoint=e["principal-point"],this.pixelSize=e["pixel-size"],this.radialE2F=e["radial-distorsion-expected-2-found"],this.radialF2E=e["radial-distorsion-found-2-expected"],this.hasRadial=!!(this.pixelSize&&this.radialE2F&&this.radialF2E),this.size=e.size,this.tileSize=e.tileSize,this.tileResolution=e.tileResolution,this.projection=e.projection,this.url=e.url,this.terrainProvider=e.terrainProvider,this.format=e.format||"jpg"}radialDistortionCoordinate(e,t){if(this.hasRadial&&this.principalPoint){const s=t?this.radialF2E:this.radialE2F,r=mt(this.principalPoint,e)*this.pixelSize[0];if(r===0)return e.slice();const n=e[0]-this.principalPoint[0],a=e[1]-this.principalPoint[1];let o=0;for(let c=0;c<s.length;++c)o+=s[c]*r**c;const l=(r+o)/this.pixelSize[0],h=Math.atan2(a,n);return[this.principalPoint[0]+l*Math.cos(h),this.principalPoint[1]+l*Math.sin(h)]}return e.slice()}}let nu=0;function v1(){return nu+=1,nu}function yo(i){const e={version:null,buildNumber:null};if(i.version){const t=i.version.match(/\d+\.\d+/);t&&(e.version=Number(t[0]));const s=i.version.match(/-\d+-/);s&&(e.buildNumber=Number(s[0].match(/\d+/)[0]))}return e}function au(i,e,t,s){let r;i.generalImageInfo.width&&i.generalImageInfo.height&&(r=[i.generalImageInfo.width,i.generalImageInfo.height]);const n=i.generalImageInfo["tile-resolution"],a=[i.generalImageInfo["tile-width"],i.generalImageInfo["tile-height"]];let o=t;const l=[];!o&&i.generalImageInfo.crs&&(o=new D({epsg:v1(),prefix:"OBLIQUE:",proj4:i.generalImageInfo.crs}));const h={size:r,tileResolution:n,tileSize:a,projection:o,url:e,terrainProvider:s};return i.generalImageInfo.cameraParameter&&(Array.isArray(i.generalImageInfo.cameraParameter)?i.generalImageInfo.cameraParameter.forEach(c=>{l.push(new hr(S(S({},h),c)))}):typeof i.generalImageInfo.cameraParameter=="object"&&Object.entries(i.generalImageInfo.cameraParameter).forEach(([c,u])=>{l.push(new hr(S(S({name:c},h),u)))})),l.length===0&&l.push(new hr(S({name:"default"},h))),l}function _o(i,e){const t=i.images[0],s={name:t.indexOf("name"),width:t.indexOf("width"),height:t.indexOf("height"),tileResolution:t.indexOf("tile-resolution"),viewDirection:t.indexOf("view-direction"),viewDirectionAngle:t.indexOf("view-direction-angle"),groundCoordinates:t.indexOf("groundCoordinates"),centerPointOnGround:t.indexOf("centerPointOnGround"),cameraIndex:t.indexOf("camera-index"),projectionCenter:t.indexOf("projection-center"),pToRealworld:t.indexOf("p-to-realworld"),pToImage:t.indexOf("p-to-image")},r=new Array(i.images.length-1);return i.images.forEach((n,a)=>{if(a===0)return;const o=[];n[s.pToRealworld]&&n[s.pToRealworld].forEach(f=>{o.push(...f)});const l=n[s.pToRealworld]?new We(...o):null,h=[];n[s.pToImage]&&(n[s.pToImage].forEach(f=>{h.push(...f)}),h.push(0,0,0,1));const c=n[s.projectionCenter]?M.fromArray(n[s.projectionCenter]):null,u=n[s.pToImage]?new k(...h):null,d=e[n[s.cameraIndex]||0];d.size||(n[s.height]&&n[s.width]?d.size=[n[s.width],n[s.height]]:console.error("missing image meta size")),d.tileResolution||(n[s.tileResolution]?d.tileResolution=n[s.tileResolution]:console.error("missing image meta tileResolution")),r[a-1]=new Mn({name:n[s.name],viewDirection:n[s.viewDirection],viewDirectionAngle:n[s.viewDirectionAngle],groundCoordinates:n[s.groundCoordinates],centerPointOnGround:n[s.centerPointOnGround],meta:d,projectionCenter:c,pToRealworld:l,pToImage:u})}),r}function ou(i,e){const{cameraParameter:t}=i.generalImageInfo,{version:s,buildNumber:r}=yo(i);return i.images.map(n=>{const a=Sn[n["view-direction"]],o=s>=3.4&&r>=18?n["view-directionAngle"]:void 0,l=n["projection-center"],{name:h,groundCoordinates:c,centerPointOnGround:u}=n,d=n["camera-name"],f=e.find(p=>p.name===d),g=f||e[0];g.size||(n.height&&n.width?g.size=[n.width,n.height]:console.error("missing image meta size")),g.tileResolution||(n.tileResolution?g.tileResolution=n.tileResolution:console.error("missing image meta tileResolution"));const m={name:h,meta:g,viewDirection:a,viewDirectionAngle:o,groundCoordinates:c,centerPointOnGround:u};if(f&&d){const p=t[d],y=We.fromRowMajorArray([].concat(...p["camera-matrix"])),_=We.inverse(y,new We),w=We.fromRowMajorArray([].concat(...n["rotation-matrix"])),L=We.transpose(w,new We),E=p["focal-length"]*-1;We.multiplyByScalar(_,E,_);const A=We.multiply(L,_,new We),Y=k.fromRotationTranslation(y,M.ZERO,new k),V=M.fromArray(l),Ee=k.fromTranslation(M.multiplyByScalar(V,-1,new M),new k),qe=k.fromRotationTranslation(w,M.ZERO,new k),It=k.multiply(Y,k.multiply(qe,Ee,new k),new k);m.projectionCenter=V,m.pToRealworld=A,m.pToImage=It}return new Mn(m)})}async function vo(i,e){const t=await fetch(i,e);if(!t.ok)throw new Error(`Failed fetching url ${i} with status: ${t.status}`);return t}async function xt(i,e){return(await vo(i,e)).json()}async function lu(i,e){return(await vo(i,e)).arrayBuffer()}const he={PENDING:1,LOADING:2,READY:3};function cr(i){return i.some(e=>e===he.PENDING)?he.PENDING:i.some(e=>e===he.LOADING)?he.LOADING:he.READY}class So{constructor(e,t,s){this.url=e,/\.json$/.test(this.url)||(this.url=this.url.replace(/\/?$/,"/image.json")),this.baseUrl=this.url.replace(/\/?([^/]+\.json)?$/,"");let r=t;r&&!(r instanceof D)&&(r=new D(r)),this.projection=r,this._terrainProviderOptions=s?S({},s):void 0,this._terrainProvider=this._terrainProviderOptions?ls(this._terrainProviderOptions):void 0,this._imageMetas=[],this.imagesLoaded=new I,this._tiles=new Map,this._loadingPromises=new Map,this._state=he.PENDING,this._tileLevel=null,this._tileGrid=il(),this._images=[],this.copyright=void 0}get images(){return this._images.slice()}get state(){return this._state}get terrainProvider(){return this._terrainProvider}load(){return this._loadingPromise||(this._state=he.LOADING,this._loadingPromise=xt(this.url).then(e=>this._initialize(e)).catch(e=>Promise.reject(e))),this._loadingPromise}getTiles(){const e={};return this._tiles.forEach((t,s)=>{e[s]=t}),e}initialize(e){if(this._state!==he.PENDING)throw new Error("DataSet has already been loaded");this._loadingPromise=Promise.resolve(),this._initialize(e)}_initialize(e){this._parseMetaData(e),this._state=he.READY}_parseMetaData(e){this._imageMetas=au(e,this.baseUrl,this.projection,this.terrainProvider);const{version:t,buildNumber:s}=yo(e);if(e.tileLevel)this._tileLevel=e.tileLevel,e.availableTiles.forEach(r=>{this._tiles.set(r,he.PENDING)});else{let r=[];t>=3.5||t===3.4&&s>36?r=_o(e,this._imageMetas):(t>=3.1||t===null)&&(r=ou(e,this._imageMetas)),r.length>0&&(this._images=r,this.imagesLoaded.raiseEvent({images:r}))}}_getClosestTileCoordinate(e){if(!this._tileLevel)return null;const t=this._tileGrid.getTileCoordForCoordAndZ(e,this._tileLevel);if(this._tiles.has(t.join("/")))return t;let s=1/0,r=null;return[...this._tiles.keys()].forEach(n=>{const a=n.split("/").map(Number),o=mt([t[1],t[2]],[a[1],a[2]]);o<s&&(s=o,r=a)}),r||t}_getTileCoordinatesForExtent(e){const t=this._tileGrid.getTileCoordForCoordAndZ([e[0],e[3]],this._tileLevel),s=this._tileGrid.getTileCoordForCoordAndZ([e[2],e[1]],this._tileLevel),r=[];for(let n=t[1];n<=s[1];n++)for(let a=t[2];a<=s[2];a++)r.push([this._tileLevel,n,a]);return r.map(n=>n.join("/")).filter(n=>{const a=this._tiles.get(n);return a&&a!==he.READY})}getDataStateForCoordinate(e){if(this._state!==he.READY||this._tiles.size===0)return this._state;const t=this._getClosestTileCoordinate(e).join("/");return this._tiles.has(t)?this._tiles.get(t):he.READY}getDataStateForExtent(e){if(this._state!==he.READY||this._tiles.size===0)return this._state;const s=this._getTileCoordinatesForExtent(e).map(r=>this._tiles.get(r)).filter(r=>r);return cr(s)}_loadTile(e){if(this._loadingPromises.has(e))return this._loadingPromises.get(e);if(this._tiles.get(e)!==he.PENDING)return Promise.resolve();this._tiles.set(e,he.LOADING);const t=xt(`${this.baseUrl}/${e}.json`).then(s=>{const r=_o(s,this._imageMetas);r.length>0&&(this._images=this._images.concat(r),this.imagesLoaded.raiseEvent({images:r,tileCoordinate:e}))}).catch(s=>{console.error(s)}).finally(()=>{this._tiles.set(e,he.READY),this._loadingPromises.delete(e)});return this._loadingPromises.set(e,t),t}async loadDataForCoordinate(e){const t=this._getClosestTileCoordinate(e);t&&await this._loadTile(t.join("/"))}async loadDataForExtent(e){const t=this._getTileCoordinatesForExtent(e);await Promise.all(t.map(s=>this._loadTile(s)))}destroy(){this.imagesLoaded.destroy(),this._images=[],this._imageMetas=[],this._tiles.clear(),this._loadingPromises.clear(),this._tileGrid=null,this._terrainProvider=null}toJSON(){const e={url:this.url};return this.projection&&(e.projection=this.projection.toJSON()),this._terrainProviderOptions&&(e.terrainProvider=S({},this._terrainProviderOptions)),e}}let Mo="";function S1(){if(!Mo){const i=document.createElement("canvas");i.height=512,i.width=512;const e=i.getContext("2d");e.fillStyle="#409D76",e.fillRect(0,0,512,512),e.font="bold 46px Monospace, Courier New",e.fillStyle="#424242",e.textAlign="center",e.fillText("No Image",256,256),Mo=i.toDataURL("png")}return Mo}class hu{constructor(e,t){this.id=et(),this.size=e.size,this.url=e.url,this.tileSize=e.tileSize,this.format=e.format,this.minZoom=t.minZoom,this.maxZoom=t.maxZoom,this.scaleFactor=t.scaleFactor;const{tileResolution:s}=e;this.tileResolution=s.slice(0,s.length-t.hideLevels),this._createViewAndLayer()}_createViewAndLayer(){const e=[0,0,...this.size],t=new Vd({code:"ZOOMIFY",units:"pixels",extent:e}),s=this.maxZoom>0?this.maxZoom:this.tileResolution.length+4,r=Math.log(2)/Math.log(this.scaleFactor);this.view=new Gn({projection:t,center:[this.size[0]/2,this.size[1]/2],constrainOnlyCenter:!0,minZoom:this.minZoom*r,maxZoom:s*r,extent:[-2e3,-2e3,this.size[0]+2e3,this.size[1]+2e3],zoom:this.minZoom*r,zoomFactor:this.scaleFactor});const n={projection:t,tileGrid:new sl({origin:[0,0],extent:e,resolutions:this.tileResolution,tileSize:this.tileSize})};Qc(this.url)||(n.crossOrigin="anonymous"),this.tileImageSource=new Bd(n),this.layer=new Ri({source:this.tileImageSource,extent:e})}setImageName(e,t=!1){t&&this.tileImageSource.setTileLoadFunction(s=>{s.getImage().src=S1(),s.load()}),this.tileImageSource.setTileUrlFunction(s=>{const[r,n,a]=s,o=-a-1;return`${this.url}/${e}/${r}/${n}/${o}.${this.format}`}),this.tileImageSource.refresh()}destroy(){this.view=null,this.layer=null,this.tileImageSource.clear(),this.tileImageSource=null}}function M1(i,e,t,s,r){cu(i,e,t||0,s||i.length-1,r||C1)}function cu(i,e,t,s,r){for(;s>t;){if(s-t>600){var n=s-t+1,a=e-t+1,o=Math.log(n),l=.5*Math.exp(2*o/3),h=.5*Math.sqrt(o*l*(n-l)/n)*(a-n/2<0?-1:1),c=Math.max(t,Math.floor(e-a*l/n+h)),u=Math.min(s,Math.floor(e+(n-a)*l/n+h));cu(i,e,c,u,r)}var d=i[e],f=t,g=s;for(ur(i,t,e),r(i[s],d)>0&&ur(i,t,s);f<g;){for(ur(i,f,g),f++,g--;r(i[f],d)<0;)f++;for(;r(i[g],d)>0;)g--}r(i[t],d)===0?ur(i,t,g):(g++,ur(i,g,s)),g<=e&&(t=g+1),e<=g&&(s=g-1)}}function ur(i,e,t){var s=i[e];i[e]=i[t],i[t]=s}function C1(i,e){return i<e?-1:i>e?1:0}class Co{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const s=[];if(!xn(e,t))return s;const r=this.toBBox,n=[];for(;t;){for(let a=0;a<t.children.length;a++){const o=t.children[a],l=t.leaf?r(o):o;xn(e,l)&&(t.leaf?s.push(o):wo(e,l)?this._all(o,s):n.push(o))}t=n.pop()}return s}collides(e){let t=this.data;if(!xn(e,t))return!1;const s=[];for(;t;){for(let r=0;r<t.children.length;r++){const n=t.children[r],a=t.leaf?this.toBBox(n):n;if(xn(e,a)){if(t.leaf||wo(e,a))return!0;s.push(n)}}t=s.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let s=0;s<e.length;s++)this.insert(e[s]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const s=this.data;this.data=t,t=s}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=us([]),this}remove(e,t){if(!e)return this;let s=this.data;const r=this.toBBox(e),n=[],a=[];let o,l,h;for(;s||n.length;){if(s||(s=n.pop(),l=n[n.length-1],o=a.pop(),h=!0),s.leaf){const c=x1(e,s.children,t);if(c!==-1)return s.children.splice(c,1),n.push(s),this._condense(n),this}!h&&!s.leaf&&wo(s,r)?(n.push(s),a.push(o),o=0,l=s,s=s.children[0]):l?(o++,s=l.children[o],h=!1):s=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const s=[];for(;e;)e.leaf?t.push(...e.children):s.push(...e.children),e=s.pop();return t}_build(e,t,s,r){const n=s-t+1;let a=this._maxEntries,o;if(n<=a)return o=us(e.slice(t,s+1)),cs(o,this.toBBox),o;r||(r=Math.ceil(Math.log(n)/Math.log(a)),a=Math.ceil(n/Math.pow(a,r-1))),o=us([]),o.leaf=!1,o.height=r;const l=Math.ceil(n/a),h=l*Math.ceil(Math.sqrt(a));uu(e,t,s,h,this.compareMinX);for(let c=t;c<=s;c+=h){const u=Math.min(c+h-1,s);uu(e,c,u,l,this.compareMinY);for(let d=c;d<=u;d+=l){const f=Math.min(d+l-1,u);o.children.push(this._build(e,d,f,r-1))}}return cs(o,this.toBBox),o}_chooseSubtree(e,t,s,r){for(;r.push(t),!(t.leaf||r.length-1===s);){let n=1/0,a=1/0,o;for(let l=0;l<t.children.length;l++){const h=t.children[l],c=xo(h),u=O1(e,h)-c;u<a?(a=u,n=c<n?c:n,o=h):u===a&&c<n&&(n=c,o=h)}t=o||t.children[0]}return t}_insert(e,t,s){const r=s?e:this.toBBox(e),n=[],a=this._chooseSubtree(r,this.data,t,n);for(a.children.push(e),fr(a,r);t>=0&&n[t].children.length>this._maxEntries;)this._split(n,t),t--;this._adjustParentBBoxes(r,n,t)}_split(e,t){const s=e[t],r=s.children.length,n=this._minEntries;this._chooseSplitAxis(s,n,r);const a=this._chooseSplitIndex(s,n,r),o=us(s.children.splice(a,s.children.length-a));o.height=s.height,o.leaf=s.leaf,cs(s,this.toBBox),cs(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(s,o)}_splitRoot(e,t){this.data=us([e,t]),this.data.height=e.height+1,this.data.leaf=!1,cs(this.data,this.toBBox)}_chooseSplitIndex(e,t,s){let r,n=1/0,a=1/0;for(let o=t;o<=s-t;o++){const l=dr(e,0,o,this.toBBox),h=dr(e,o,s,this.toBBox),c=E1(l,h),u=xo(l)+xo(h);c<n?(n=c,r=o,a=u<a?u:a):c===n&&u<a&&(a=u,r=o)}return r||s-t}_chooseSplitAxis(e,t,s){const r=e.leaf?this.compareMinX:w1,n=e.leaf?this.compareMinY:b1,a=this._allDistMargin(e,t,s,r),o=this._allDistMargin(e,t,s,n);a<o&&e.children.sort(r)}_allDistMargin(e,t,s,r){e.children.sort(r);const n=this.toBBox,a=dr(e,0,t,n),o=dr(e,s-t,s,n);let l=Cn(a)+Cn(o);for(let h=t;h<s-t;h++){const c=e.children[h];fr(a,e.leaf?n(c):c),l+=Cn(a)}for(let h=s-t-1;h>=t;h--){const c=e.children[h];fr(o,e.leaf?n(c):c),l+=Cn(o)}return l}_adjustParentBBoxes(e,t,s){for(let r=s;r>=0;r--)fr(t[r],e)}_condense(e){for(let t=e.length-1,s;t>=0;t--)e[t].children.length===0?t>0?(s=e[t-1].children,s.splice(s.indexOf(e[t]),1)):this.clear():cs(e[t],this.toBBox)}}function x1(i,e,t){if(!t)return e.indexOf(i);for(let s=0;s<e.length;s++)if(t(i,e[s]))return s;return-1}function cs(i,e){dr(i,0,i.children.length,e,i)}function dr(i,e,t,s,r){r||(r=us(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let n=e;n<t;n++){const a=i.children[n];fr(r,i.leaf?s(a):a)}return r}function fr(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function w1(i,e){return i.minX-e.minX}function b1(i,e){return i.minY-e.minY}function xo(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Cn(i){return i.maxX-i.minX+(i.maxY-i.minY)}function O1(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function E1(i,e){const t=Math.max(i.minX,e.minX),s=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),n=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,n-s)}function wo(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function xn(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function us(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function uu(i,e,t,s,r){const n=[e,t];for(;n.length;){if(t=n.pop(),e=n.pop(),t-e<=s)continue;const a=e+Math.ceil((t-e)/s/2)*s;M1(i,a,e,t,r),n.push(e,a,a,t)}}var bo={exports:{}},du={exports:{}};(function(i,e){(function(t,s){i.exports=s()})(o_,function(){var t=function(n,a){if(n===void 0&&(n=[]),a===void 0&&(a=s),this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(var o=(this.length>>1)-1;o>=0;o--)this._down(o)};t.prototype.push=function(n){this.data.push(n),this.length++,this._up(this.length-1)},t.prototype.pop=function(){if(this.length!==0){var n=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),n}},t.prototype.peek=function(){return this.data[0]},t.prototype._up=function(n){for(var a=this,o=a.data,l=a.compare,h=o[n];n>0;){var c=n-1>>1,u=o[c];if(l(h,u)>=0)break;o[n]=u,n=c}o[n]=h},t.prototype._down=function(n){for(var a=this,o=a.data,l=a.compare,h=this.length>>1,c=o[n];n<h;){var u=(n<<1)+1,d=o[u],f=u+1;if(f<this.length&&l(o[f],d)<0&&(u=f,d=o[f]),l(d,c)>=0)break;o[n]=d,n=u}o[n]=c};function s(r,n){return r<n?-1:r>n?1:0}return t})})(du);var I1=du.exports;bo.exports=fu,bo.exports.default=fu;function fu(i,e,t,s,r,n){for(var a=i.data,o=[],l=i.toBBox,h,c,u,d,f=new I1(void 0,P1);a;){for(h=0;h<a.children.length;h++)c=a.children[h],u=L1(e,t,a.leaf?l(c):c),(!n||u<=n*n)&&f.push({node:c,isItem:a.leaf,dist:u});for(;f.length&&f.peek().isItem;)if(d=f.pop().node,(!r||r(d))&&o.push(d),s&&o.length===s)return o;a=f.pop(),a&&(a=a.node)}return o}function P1(i,e){return i.dist-e.dist}function L1(i,e,t){var s=gu(i,t.minX,t.maxX),r=gu(e,t.minY,t.maxY);return s*s+r*r}function gu(i,e,t){return i<e?e-i:i<=t?0:i-t}var mu=bo.exports;function pu(i){return i.map(e=>{const t=ye(e.meta.projection.proj,R.proj),s=new Z({geometry:new yn([e.groundCoordinates.map(r=>t(r.slice(0,2),void 0,void 0))]),viewDirection:e.viewDirection});return s.setId(e.name),s})}function yu(i){const e=il();return Object.entries(i).map(([t,s])=>{const r=t.split("/").map(o=>Number.parseInt(o,10)),n=e.getTileCoordExtent(r),a=new Z({geometry:Bv(n),state:s});return a.setId(t),a})}class $t extends ut{static get className(){return"ObliqueCollection"}static getDefaultOptions(){return{maxZoom:0,minZoom:0,scaleFactor:4,dataSets:void 0,hideLevels:0,activeOnStartup:!1}}constructor(e){super(e);const t=$t.getDefaultOptions();this._directionTrees=new Map,this._images=new Map,this._dataSets=[],this.viewOptions={maxZoom:B(e.maxZoom,t.maxZoom),minZoom:B(e.minZoom,t.minZoom),scaleFactor:N(e.scaleFactor,t.scaleFactor),hideLevels:B(e.hideLevels,t.hideLevels)},this._loaded=!1,this.imagesLoaded=new I,this._tileFeatureSource=null,this._imageFeatureSource=null,Array.isArray(e.dataSets)&&e.dataSets.forEach(s=>{this._addDataSet(s)}),this._destroyed=new I,this.activeOnStartup=ae(e.activeOnStartup,t.activeOnStartup)}get dataSets(){return this._dataSets.slice()}get loaded(){return this._loaded}get destroyed(){return this._destroyed}get tileFeatureSource(){return this._tileFeatureSource||(this._tileFeatureSource=this._createTileFeatureSource()),this._tileFeatureSource}get imageFeatureSource(){return this._imageFeatureSource||(this._imageFeatureSource=this._createImageFeatureSource()),this._imageFeatureSource}get images(){return[...this._images.values()]}_createTileFeatureSource(){const e=yu(this.getTiles()),t=new Ns;return t.addFeatures(e),t}_createImageFeatureSource(){const e=pu([...this._images.values()]),t=new Ns;return t.addFeatures(e),t}async _loadDataSet(e){if(await e.load(),this._tileFeatureSource){const t=yu(e.getTiles());this._tileFeatureSource.addFeatures(t)}}_addDataSet(e){let t;e instanceof So?t=e:t=new So(e.url,e.projection,e.terrainProvider),t.imagesLoaded.addEventListener(({images:s,tileCoordinate:r})=>{this._loadImages(s,r)}),this._loadImages(t.images),this._dataSets.push(t)}async addDataSet(e){this._loadingPromise&&(await this._loadingPromise,await this._loadDataSet(e)),this._addDataSet(e)}async load(){this._loadingPromise||(this._loadingPromise=Promise.all(this._dataSets.map(e=>this._loadDataSet(e))),await this._loadingPromise,this._loaded=!0),await this._loadingPromise}_loadImages(e,t){if(t&&this._tileFeatureSource){const r=this._tileFeatureSource.getFeatureById(t);r&&r.set("state",he.READY)}const s=new Map;if(e.forEach(r=>{this._images.set(r.name,r),s.has(r.viewDirection)||s.set(r.viewDirection,[]);const n=ye(r.meta.projection.proj,R.proj),a=r.centerPointOnGround.slice(0,2);n(a,a,void 0),s.get(r.viewDirection).push({minX:a[0],minY:a[1],maxX:a[0],maxY:a[1],name:r.name})}),s.forEach((r,n)=>{this._directionTrees.get(n)||this._directionTrees.set(n,new Co),this._directionTrees.get(n).load(r)}),this._imageFeatureSource){const r=pu(e);this._imageFeatureSource.addFeatures(r)}this.imagesLoaded.raiseEvent(e)}getTiles(){const e={};return this._dataSets.forEach(t=>{Object.entries(t.getTiles()).forEach(([s,r])=>{e[s]?e[s]=cr([r,e[s]]):e[s]=r})}),e}getImageByName(e){return this._images.get(e)}getAvailableViewDirections(){return[...this._directionTrees.keys()]}getDataStateForCoordinate(e){const t=this._dataSets.map(s=>s.getDataStateForCoordinate(e));return cr(t)}getDataStateForExtent(e){const t=this._dataSets.map(s=>s.getDataStateForExtent(e));return cr(t)}async loadDataForCoordinate(e){await Promise.all(this._dataSets.map(t=>t.loadDataForCoordinate(e)))}async loadDataForExtent(e){await Promise.all(this._dataSets.map(t=>t.loadDataForExtent(e)))}_getNextImageForCoordinate(e,t){const s=this._directionTrees.get(t);if(s){const r=mu(s,e[0],e[1],1);if(r.length===1&&r[0].name)return this.getImageByName(r[0].name)}}getImageForCoordinate(e,t){const s=[t,...Object.values(ge).filter(r=>r!==t)];for(let r=0;r<s.length;r++){const n=this._getNextImageForCoordinate(e,s[r]);if(n)return n}}async loadImageForCoordinate(e,t){return await this.loadDataForCoordinate(e),this.getImageForCoordinate(e,t)}async hasImageAtCoordinate(e,t){const s=await this.loadImageForCoordinate(e,t);if(s){const r=ye(R.proj,s.meta.projection.proj),n=e.slice(0,2);r(n,n,void 0);const a=Ls(s.groundCoordinates);return Ud(a,n)}return!1}async loadAdjacentImage(e,t,s=Math.PI/4){const r=this._directionTrees.get(e.viewDirection);if(r){const n=ye(e.meta.projection.proj,R.proj),a=e.groundCoordinates.map(u=>n(u.slice(0,2),void 0,void 0)),o=Ls(a);await this.loadDataForExtent(rl(o,200));const l=zn(o),c=mu(r,l[0],l[1],20).find(u=>{if(u.name!==e.name){let d=Math.atan2(u.minY-l[1],u.minX-l[0]);d<=0&&(d+=Math.PI*2);let f=d-t;if(f>Math.PI?f-=Math.PI*2:f<-Math.PI&&(f+=Math.PI*2),f<=s&&f>=-s)return u}return!1});if(c)return this.getImageByName(c.name)}}destroy(){this._dataSets.forEach(e=>{e.destroy()}),this._dataSets=[],[...this._directionTrees.values()].forEach(e=>{e.clear()}),this._directionTrees.clear(),this._images.clear(),this._tileFeatureSource&&(this._tileFeatureSource.clear(!0),this._tileFeatureSource=null),this._imageFeatureSource&&(this._imageFeatureSource.clear(!0),this._imageFeatureSource=null),this.imagesLoaded.destroy(),super.destroy(),this.destroyed.raiseEvent(),this._destroyed.destroy()}toJSON(){const e=super.toJSON(),t=$t.getDefaultOptions();return this.viewOptions.maxZoom!==t.maxZoom&&(e.maxZoom=this.viewOptions.maxZoom),this.viewOptions.minZoom!==t.minZoom&&(e.minZoom=this.viewOptions.minZoom),this.viewOptions.scaleFactor!==t.scaleFactor&&(e.scaleFactor=this.viewOptions.scaleFactor),this.viewOptions.hideLevels!==t.hideLevels&&(e.hideLevels=this.viewOptions.hideLevels),this.dataSets.length>0&&(e.dataSets=this.dataSets.map(s=>s.toJSON())),e}}const T1=new hr({name:"defaultObliqueMeta",size:[512,512],tileSize:[512,512],tileResolution:[1],projection:R,format:"png",url:""}),_u=Symbol("isDefaultImage");class vu extends $t{constructor(){super({})}getImageForCoordinate(e,t){const s=[[e[0]-100,e[1]-100,0],[e[0]+100,e[1]-100,0],[e[0]+100,e[1]+100,0],[e[0]-100,e[1]+100,0]],r=new Mn({meta:T1,viewDirection:ge.NORTH,viewDirectionAngle:0,name:this.name,groundCoordinates:s,centerPointOnGround:e});return r[_u]=!0,r}}function Su(i,e){return i<0?0:i>e?e:i}class Mu{constructor(e){this._active=!1,this._loadingImage=null,this._olMap=e,this._viewCache=new Map,this._currentImage=null,this._currentView=null,this._collection=null,this._mapChangeEvent="postrender",this.imageChanged=new I,this.switchEnabled=!0,this.switchThreshold=0}get mapChangeEvent(){return this._mapChangeEvent}set mapChangeEvent(e){this._mapChangeEvent=e,this._active&&(this._postRenderListener&&Ce(this._postRenderListener),this._postRenderListener=this._olMap.on(this._mapChangeEvent,this._postRenderHandler.bind(this)))}get loading(){return!!this._loadingImage}get active(){return this._active}get currentImage(){return this._currentImage}get collection(){return this._collection}setCollection(e){if(this._loadingImage=null,!e.loaded){console.error("cannot set an unloaded collection");return}this._collection=e,this._removeCurrentView(),this._currentView=null,this._currentImage=null}activate(){if(!this._collection)throw new Error("cannot activate provider without an oblique collection.");this._active||(this._active=!0,this._setCurrentView(),this._postRenderListener||(this._postRenderListener=this._olMap.on(this._mapChangeEvent,this._postRenderHandler.bind(this))))}deactivate(){this._currentView&&this._removeCurrentView(),this._postRenderListener&&(Ce(this._postRenderListener),this._postRenderListener=null),this._active=!1}_pullCoordinateToImageCenter(e){if(this.currentImage){const t=[this.currentImage.meta.size[0]/2,this.currentImage.meta.size[1]/2];e[0]<t[0]?e[0]+=50:e[0]-=50,e[1]<t[1]?e[1]+=50:e[1]-=50}return e}_postRenderHandler(){if(this._active&&!this.loading&&this.switchEnabled){const e=this._currentImage?this._currentImage.meta.size:null,t=this._olMap.getView().getCenter(),s=this.switchThreshold,r=1-s;if(!this._currentImage||t[0]/e[0]>s&&t[0]/e[0]<r&&t[1]/e[1]>s&&t[1]/e[1]<r)return;const n=this._pullCoordinateToImageCenter(t.slice()),a=this._currentImage.transformImage2RealWorld(n).slice(0,2),l=ye(this._currentImage.meta.projection.proj,R.proj)(a,void 0,void 0),h=200,c=[l[0]-h,l[1]-h,l[0]+h,l[1]+h],u=this._collection.getDataStateForExtent(c);if(u===he.READY){const d=this._collection.getImageForCoordinate(l,this._currentImage.viewDirection);d&&d.name!==this._currentImage.name&&this._changeImage(d,t)}else u===he.PENDING&&this._collection.loadDataForExtent(c)}}async _changeImage(e,t){this._loadingImage=e;const{coords:s}=await hs(this._currentImage,t);this._loadingImage===e&&await this.setImage(e,s)}async setImage(e,t){if(!this._collection)throw new Error("cannot set an image without an oblique collection.");this._loadingImage=e;const s=!this._currentImage||this._currentImage.name!==e.name;if(this._currentImage=e,s&&await e.calculateImageAverageHeight(),e!==this._loadingImage)return!1;let r;this._viewCache.has(e.meta)?r=this._viewCache.get(e.meta):(r=new hu(e.meta,this._collection.viewOptions),this._viewCache.set(e.meta,r));const n=this._currentView;this._currentView=r,s&&this._currentView.setImageName(this._currentImage.name,this._currentImage[_u]);const[a,o]=this._currentImage.meta.size;let l=[a/2,o/2];if(t){const h=ye(R.proj,this._currentImage.meta.projection.proj)(t.slice(0,2),void 0,void 0),c=this._currentImage.transformRealWorld2Image(h,t[2]);c[0]=Su(c[0],a),c[1]=Su(c[1],o),l=c}return this._currentView.view.setCenter(l),this._active&&this._setCurrentView(n),this._loadingImage=null,s&&this.imageChanged.raiseEvent(e),!0}_setCurrentView(e){this._currentView&&(e&&e===this._currentView||(e&&this._olMap.removeLayer(e.layer),this._olMap.getView()&&this._olMap.getView().getResolution()&&this._currentView.view.setResolution(this._olMap.getView().getResolution()),this._olMap.setView(this._currentView.view),this._olMap.getLayers().insertAt(0,this._currentView.layer)))}_removeCurrentView(){this._currentView&&(this._olMap.getView()===this._currentView.view&&this._olMap.setView(new Gn),this._olMap.removeLayer(this._currentView.layer))}async setView(e,t,s=2){if(!this._collection)throw new Error("cannot set the view without an oblique collection.");const r=e.slice(),n=`${e.join("")}${t}${s}`;this._loadingImage=n;const a=await this._collection.loadImageForCoordinate(e,t);if(a){if(this._loadingImage!==n)return;if(this._loadingImage=a,!r[2]&&a.meta.terrainProvider){const l=[r];await wi(a.meta.terrainProvider,l,R,l)}if(this._loadingImage!==a)return;await this.setImage(a,r)&&this._currentView.view.setZoom(s)}else throw new Error("could not find an image for this direction")}async getView(){if(this._currentView&&this._currentImage){const e=this._currentView.view.getCenter(),{coords:t}=await hs(this._currentImage,e);return{center:t,direction:this._currentImage.viewDirection,zoom:this._currentView.view.getZoom()}}return null}destroy(){this._removeCurrentView(),[...this._viewCache.values()].forEach(e=>{e.destroy()}),this._viewCache.clear(),this._loadingImage=null,this._postRenderListener&&(Ce(this._postRenderListener),this._postRenderListener=null),this.imageChanged.destroy(),this._collection=null,this._olMap=null}}const N1={[ge.NORTH]:0,[ge.EAST]:90,[ge.SOUTH]:180,[ge.WEST]:270},Cu=new vu;function Oo(i){const{heading:e}=i;let t=ge.NORTH;return e>=45&&e<135?t=ge.EAST:e>=135&&e<225?t=ge.SOUTH:e>=225&&e<315&&(t=ge.WEST),t}function xu(i){const e=i.groundPosition||i.cameraPosition;return ri(e,U.proj,R.proj)}class pe extends rr{static get className(){return"ObliqueMap"}static getDefaultOptions(){return T(S({},kt.getDefaultOptions()),{changeOnMoveEnd:!1,switchThreshold:0,switchOnEdge:!0})}constructor(e){super(e);const t=pe.getDefaultOptions();this._loadingCollection=null,this._mapChangeEvent=e.changeOnMoveEnd?"moveend":"postrender",this._switchThreshold=N(e.switchThreshold,t.switchThreshold),this._switchThreshold>1?this._switchThreshold=.2:this._switchThreshold<0&&(this._switchThreshold=0),this._switchEnabled=ae(e.switchOnEdge,t.switchOnEdge),this.collectionChanged=new I,this._activeCollectionDestroyedListener=()=>{}}get switchEnabled(){return this._switchEnabled}set switchEnabled(e){this._switchEnabled=e,this._obliqueProvider&&(this._obliqueProvider.switchEnabled=e)}get switchThreshold(){return this._switchThreshold}set switchThreshold(e){v(e,Number),this._switchThreshold=e,this._switchThreshold>1?this._switchThreshold=.2:this._switchThreshold<0&&(this._switchThreshold=0),this._obliqueProvider&&(this._obliqueProvider.switchThreshold=this._switchThreshold)}get mapChangeEvent(){return this._mapChangeEvent}async initialize(){this.initializedPromise||(this.initializedPromise=super.initialize().then(async()=>{this._obliqueProvider=new Mu(this.olMap),this.mapChangeEvent=this._mapChangeEvent,this.switchThreshold=this._switchThreshold,this.switchEnabled=this._switchEnabled;let e=this._loadingCollection;e||(e=Cu),e&&await this._setCollection(e)}).then(()=>{this.initialized=!0})),await this.initializedPromise}set mapChangeEvent(e){v(e,String),this._mapChangeEvent=e,this._obliqueProvider&&(this._obliqueProvider.mapChangeEvent=e)}get collection(){return this._obliqueProvider.collection}get imageChanged(){return this._obliqueProvider?this._obliqueProvider.imageChanged:null}get currentImage(){return this._obliqueProvider?this._obliqueProvider.currentImage:null}async canShowViewpoint(e){if(await this.initialize(),this.collection){const t=Oo(e),s=xu(e);return this.collection.hasImageAtCoordinate(s,t)}return!1}async activate(){await super.activate(),this.active&&this._obliqueProvider.activate()}getExtentOfCurrentImage(){const e=this.currentImage;if(e){const t=Ls(e.groundCoordinates);return new Me({coordinates:nl(t,e.meta.projection.proj,R.proj),projection:R.toJSON()})}return new Me({coordinates:[-189243134349e-4,-155387110963e-4,189243134349e-4,155387110963e-4],projection:R.toJSON()})}deactivate(){super.deactivate(),this._obliqueProvider.deactivate()}async setCollection(e,t){v(e,$t),!this.movementDisabled&&(this._loadingCollection=e,this.initializedPromise&&(await this.initializedPromise,this._loadingCollection===e&&await this._setCollection(e,t)))}async _setCollection(e,t){this._loadingCollection=e,this._activeCollectionDestroyedListener(),this._activeCollectionDestroyedListener=e.destroyed.addEventListener(()=>{this._setCollection(Cu)}),await e.load();const s=t||await this.getViewpoint();this._loadingCollection===e&&(this._obliqueProvider.setCollection(e),this.collectionChanged.raiseEvent(e),s&&await this.gotoViewpoint(s))}async setImageByName(e,t){if(this.movementDisabled||!this.initializedPromise)return;await this.initializedPromise;const s=this._obliqueProvider.collection.getImageByName(e);s&&await this._obliqueProvider.setImage(s,t)}async getViewpoint(){const e=this.currentImage;if(!e)return null;const t=this.olMap.getView().getCenter();if(!t)return null;const s={dataProjection:U},{coords:r}=await hs(e,t,s);return this._computeViewpointInternal(r)}getViewpointSync(){const e=this.currentImage;if(!e)return null;const t=this.olMap.getView().getCenter();if(!t)return null;const s=e.transformImage2RealWorld(t,e.averageHeight),n=ye(e.meta.projection.proj,U.proj)(s.slice(0,2),void 0,void 0);return this._computeViewpointInternal(n)}_computeViewpointInternal(e){const t=this.currentImage,{size:s,fovy:r,metersPerUnit:n}=fo(this.olMap,t),h=(this.olMap.getView().getResolution()||1)*s.height*n,c=Math.abs(h/2/Math.tan(r/2)),u=e[2]||t.averageHeight,d=c+u;return new ft({cameraPosition:[e[0],e[1],d],groundPosition:e,heading:N1[t.viewDirection],pitch:-90,roll:0,distance:c})}async gotoViewpoint(e){if(this.movementDisabled||!this._obliqueProvider||!e.isValid())return;const t=Oo(e),s=xu(e),{distance:r}=e;if(await this._obliqueProvider.setView(s,t),this._obliqueProvider.currentImage){const n=tu(this.olMap,this._obliqueProvider.currentImage,r);this.olMap.getView().setZoom(n)}}pointIsVisible(e){const t=this.currentImage;if(!t||!this.active)return!1;const r=this.olMap.getView().calculateExtent(this.olMap.getSize()),n=t.transformImage2RealWorld([r[0],r[1]]),a=t.transformImage2RealWorld([r[2],r[3]]),o=[n[0],n[1],a[0],a[1]],l=nl(o,t.meta.projection.proj,U.proj);return Zo(l,e[0],e[1])}toJSON(){const e=super.toJSON(),t=pe.getDefaultOptions();return this.mapChangeEvent==="movened"&&(e.changeOnMoveEnd=!0),this.switchThreshold!==t.switchThreshold&&(e.switchThreshold=this.switchThreshold),this.switchEnabled!==t.switchOnEdge&&(e.switchOnEdge=this.switchEnabled),e}destroy(){this._obliqueProvider&&this._obliqueProvider.destroy(),this.collectionChanged.destroy(),this._activeCollectionDestroyedListener(),super.destroy()}}di.registerClass(pe.className,pe);const wn={HEIGHT:"height",DISTANCE:"distance"};class ys{static get className(){return"CameraLimiter"}static getDefaultOptions(){return{mode:wn.HEIGHT,terrainUrl:void 0,limit:200,level:12}}constructor(e){const t=ys.getDefaultOptions();this.mode=oa(e.mode,wn,t.mode),this._terrainUrl=e.terrainUrl||t.terrainUrl,this._terrainProvider=this._terrainUrl?ls({url:this._terrainUrl}):null,this.limit=N(e.limit,t.limit),this.level=e.level===null?null:B(e.level,t.level),this.lastCheckedPosition=new se,this._terrainHeight=null,this._updatingTerrainHeight=!1}get terrainUrl(){return this._terrainUrl}set terrainUrl(e){re(e,String),this._terrainUrl!==e&&(this._terrainUrl=e,this._terrainProvider=this._terrainUrl?ls({url:this._terrainUrl}):null)}_limitWithLevel(e){return Zc(this._terrainProvider,this.level,e)?Af(this._terrainProvider,this.level,[e]):this._limitMostDetailed(e)}_limitMostDetailed(e){return Nr(this._terrainProvider,[e])}async _updateTerrainHeight(e){if(!this._updatingTerrainHeight&&!e.equalsEpsilon(this.lastCheckedPosition,P.EPSILON5)){this._updatingTerrainHeight=!0;const[t]=this.level!=null?await this._limitWithLevel(e.clone()):await this._limitMostDetailed(e.clone());this._terrainHeight=t.height,this.lastCheckedPosition=e,this._updatingTerrainHeight=!1}}limitCamera(e){let t=Promise.resolve();const s=se.fromCartesian(e.position);if(s)if(this.mode===wn.DISTANCE&&this._terrainProvider){if(t=this._updateTerrainHeight(s),this._terrainHeight&&s.height-this._terrainHeight<this.limit){const r=this._terrainHeight+this.limit;se.toCartesian(new se(s.longitude,s.latitude,r),Kn.WGS84,e.position)}}else s.height<this.limit&&se.toCartesian(new se(s.longitude,s.latitude,this.limit),Kn.WGS84,e.position);return t}toJSON(){const e={},t=ys.getDefaultOptions();return this.terrainUrl&&(e.terrainUrl=this.terrainUrl),this.limit!==t.limit&&(e.limit=this.limit),this.mode!==t.mode&&(e.mode=this.mode),this.level!==t.level&&(e.level=this.level),e}}function bn(i,e,t){const s=t.indexOfKey(e[j]);if(s>-1&&!i.contains(e)){const r=i.length;let n=r;for(let a=0;a<r;a++){const o=i.get(a);if(t.indexOfKey(o[j])>s){n=a;break}}i.add(e,n)}}async function wu(i,e,t){const s=t.indexOfKey(e[j]);if(s>-1){i.contains(e)||await i.add(e);const r=i.length;let n=r;for(let o=0;o<r;o++){const l=i.get(o);if(t.indexOfKey(l[j])>s){n=o;break}}let a=i.indexOf(e);if(n>a&&(n-=1),a<n)for(;a<n;)i.raise(e),a=i.indexOf(e);else if(a>n)for(;a>n;)i.lower(e),a=i.indexOf(e)}}function D1(i,e,t){const{destroyPrimitives:s}=i;i.destroyPrimitives=!1,i.remove(e),bn(i,e,t),i.destroyPrimitives=s}function F1(i,e,t){i.remove(e,!1),bn(i,e,t)}function A1(i,e,t){wu(i,e,t)}function bu(i,e){return e.clockRange=i.clockRange,e.clockStep=i.clockStep,e.multiplier=i.multiplier,(!e.startTime||!e.startTime.equals(i.startTime)||!e.stopTime||!e.stopTime.equals(i.stopTime))&&(e.startTime=i.startTime,e.stopTime=i.stopTime,e.currentTime=i.currentTime),i.definitionChanged.addEventListener((t,s,r)=>{e[s]=r})}function Ou(i,e){i.debugShowRenderingStatistics=e,i.debugShowBoundingVolume=e,i.debugShowContentBoundingVolume=e}function R1(i,e){i.filter(t=>t instanceof As).forEach(t=>{Ou(t,e)})}class z extends kt{static get className(){return"CesiumMap"}static getDefaultOptions(){return T(S({},kt.getDefaultOptions()),{enableLightning:!0,tileCacheSize:1,webGLaa:!1,cameraLimiter:void 0,globeColor:"#3f47cc"})}constructor(e){super(e);const t=z.getDefaultOptions();this._cesiumWidget=null,this.dataSourceDisplayClock=new Rf({shouldAnimate:!0});const s=new Gf;s.currentTime=this.dataSourceDisplayClock.currentTime,this._defaultClock=s,this._dataSourceClocks=[],this.debugMode=!1,this.enableLightning=ae(e.enableLightning,t.enableLightning),this.tileCacheSize=B(e.tileCacheSize,t.tileCacheSize),this.screenSpaceEventHandler=null,this._screenSpaceListeners=[],this.defaultJDate=vl.fromDate(new Date(2014,6,20,13,0,0,0)),this.webGLaa=ae(e.webGLaa,t.webGLaa),this.globeColor=Ne.fromCssColorString(e.globeColor||t.globeColor),this._clusterDataSourceDisplay=null,this._terrainProvider=null,this.defaultTerrainProvider=null,this._cameraLimiter=null,this._cameraLimiterOptions=e.cameraLimiter||t.cameraLimiter,this._terrainProviderChangedListener=null,this._preUpdateListener=null,this._clockTickListener=null,this._clockSyncListener=null,this._removeClusterClockTickListener=null,this._debug=!1,this._lastEventFrameNumber=null}get terrainProvider(){return this._terrainProvider}get cameraLimiter(){return this._cameraLimiter}set cameraLimiter(e){re(e,ys),this._cameraLimiter!==e&&(this._cameraLimiter=e,this._cameraLimiter&&!this._preUpdateListener&&this._cesiumWidget?this._setupPreUpdateListener():!this._cameraLimiter&&this._preUpdateListener&&(this._preUpdateListener(),this._preUpdateListener=null))}get debug(){return this._debug}set debug(e){v(e,Boolean),this._debug!==e&&(this._debug=e,this.initialized&&this._setDebug())}_setupPreUpdateListener(){this._preUpdateListener=this._cesiumWidget.scene.preUpdate.addEventListener(()=>{this._cameraLimiter&&this._cameraLimiter.limitCamera(this._cesiumWidget.scene.camera)})}_raisePointerInteraction(e,t,s,r){const n=this.screenSpaceEventHandler._positions.length>1;this.pointerInteractionEvent.raiseEvent({map:this,windowPosition:r.position||r.endPosition,key:e,pointer:t,multipleTouch:n,pointerEvent:s})}_setupInteractions(){const e=[{csModifier:Jn.ALT,vcsModifier:G.ALT},{csModifier:Jn.CTRL,vcsModifier:G.CTRL},{csModifier:Jn.SHIFT,vcsModifier:G.SHIFT},{csModifier:void 0,vcsModifier:G.NONE}],t=[{type:Wt.LEFT_DOWN,pointerEvent:Be.DOWN,pointer:le.LEFT},{type:Wt.LEFT_UP,pointerEvent:Be.UP,pointer:le.LEFT},{type:Wt.RIGHT_DOWN,pointerEvent:Be.DOWN,pointer:le.RIGHT},{type:Wt.RIGHT_UP,pointerEvent:Be.UP,pointer:le.RIGHT},{type:Wt.MIDDLE_DOWN,pointerEvent:Be.DOWN,pointer:le.MIDDLE},{type:Wt.MIDDLE_UP,pointerEvent:Be.UP,pointer:le.MIDDLE},{type:Wt.MOUSE_MOVE,pointerEvent:Be.MOVE,pointer:le.ALL}];this._screenSpaceListeners=t.map(({pointerEvent:s,pointer:r,type:n})=>e.map(({csModifier:a,vcsModifier:o})=>{const l=n===Wt.MOUSE_MOVE?h=>{this._cesiumWidget.scene.frameState.frameNumber!==this._lastEventFrameNumber&&(this._lastEventFrameNumber=this._cesiumWidget.scene.frameState.frameNumber,this._raisePointerInteraction(o,r,s,h))}:h=>{this._raisePointerInteraction(o,r,s,h)};return this.screenSpaceEventHandler.setInputAction(l,n,a),()=>{this.screenSpaceEventHandler.removeInputAction(n,a)}})).flat()}async initialize(){if(!this.initialized){this._cesiumWidget=new kf(this.mapElement,{requestRenderMode:!1,scene3DOnly:!0,imageryProvider:!1,shadows:!1,terrainShadows:Fs.ENABLED,contextOptions:{webgl:{failIfMajorPerformanceCaveat:!1,antialias:this.webGLaa}}}),this._cesiumWidget.scene.globe.tileCacheSize=this.tileCacheSize,this._cesiumWidget.scene.globe.baseColor=this.globeColor,this.dataSourceDisplay=new Sl({scene:this._cesiumWidget.scene,dataSourceCollection:new Ml}),this._cesiumWidget.scene.frameState.creditDisplay.update=()=>{},this._cesiumWidget.scene.frameState.creditDisplay.beginFrame=()=>{},this._cesiumWidget.scene.frameState.creditDisplay.endFrame=()=>{};const{clock:e}=this._cesiumWidget;e.shouldAnimate=!0,this._clockTickListener=e.onTick.addEventListener(()=>{this.dataSourceDisplayClock.tick();const s=this.dataSourceDisplayClock.currentTime;this.dataSourceDisplay.update(s)}),zf.maximumRequestsPerServer=12,this._cesiumWidget.scene.shadowMap.maximumDistance=5e3,this._cesiumWidget.scene.shadowMap.darkness=.6,this._cesiumWidget.scene.globe.depthTestAgainstTerrain=!0,this._cesiumWidget.scene.highDynamicRange=!1,this._cesiumWidget.scene.splitPosition=.5,this._cesiumWidget.scene.globe.enableLighting=this.enableLightning,this.setDay(this.defaultJDate);const t=document.getElementsByClassName("cesium-widget-credits");if(t)for(let s=0;s<t.length;s++){const r=t[s];r.style.display="none"}this._cameraLimiterOptions&&!this._cameraLimiter&&(this._cameraLimiter=new ys(this._cameraLimiterOptions)),this._cameraLimiter&&this._setupPreUpdateListener(),this.screenSpaceEventHandler=new jf(this._cesiumWidget.scene.canvas),this._setupInteractions(),this.initialized=!0,this.defaultTerrainProvider=this._cesiumWidget.scene.terrainProvider,this._terrainProvider=this.defaultTerrainProvider,this._terrainProviderChangedListener=this._cesiumWidget.scene.terrainProviderChanged.addEventListener(this._terrainProviderChanged.bind(this)),this._debug&&this._setDebug()}}async activate(){await super.activate(),this.active&&(this._cesiumWidget.useDefaultRenderLoop=!0,this._cesiumWidget.resize())}deactivate(){super.deactivate(),this._cesiumWidget&&(this._cesiumWidget.useDefaultRenderLoop=!1)}getHeightFromTerrain(e){const{terrainProvider:t}=this._cesiumWidget.scene;return t.readyPromise.then(()=>t.availability?wi(t,e,R,e):Promise.resolve(e))}async getViewpoint(){return this.getViewpointSync()}getViewpointSync(){if(!this._cesiumWidget||!this._cesiumWidget.scene||!this.target)return null;const e=this._cesiumWidget.scene.camera,t=e.position;let s=null,r=null;const n=new Hf(e.position,e.direction),a=this._cesiumWidget.scene.globe.pick(n,this._cesiumWidget.scene);if(a){r=M.distance(a,t);const h=Kn.WGS84.cartesianToCartographic(a);s=[P.toDegrees(h.longitude),P.toDegrees(h.latitude),h.height]}const o=e.positionCartographic,l=[P.toDegrees(o.longitude),P.toDegrees(o.latitude),o.height];return new ft({groundPosition:s,cameraPosition:l,distance:r,heading:P.toDegrees(e.heading),pitch:P.toDegrees(e.pitch),roll:P.toDegrees(e.roll)})}async gotoViewpoint(e,t){if(this.movementDisabled||!e.isValid())return;let s=null;const{distance:r}=e,n=P.toRadians(e.heading),a=P.toRadians(e.pitch),o=P.toRadians(e.roll);if(e.cameraPosition){const c=e.cameraPosition;s=M.fromDegrees(c[0],c[1],c[2])}else{if(!e.groundPosition)return;const c=e.groundPosition;if(!c[2]){const g=await this.getHeightFromTerrain([D.wgs84ToMercator(c)]);c[2]=g[0][2]}const u=M.fromDegrees(c[0],c[1],c[2]),d=new $f(this._cesiumWidget.scene),f={destination:u,orientation:{heading:n,pitch:a,roll:o}};d.setView(f),d.moveBackward(r),s=d.position}const l=this._cesiumWidget.scene.camera,h={heading:n,pitch:a,roll:o};s=s||null,l.cancelFlight(),e.animate?await new Promise(c=>{const u={destination:s,orientation:h,complete:()=>{c()},cancel:()=>{c()}};e.duration&&(u.duration=e.duration),e.easingFunction&&(u.easingFunction=e.easingFunction),t&&(u.maximumHeight=t),l.flyTo(u)}):l.setView({destination:s,orientation:h})}getCurrentResolution(e){const t=this._cesiumWidget.scene.camera,s=D.mercatorToWgs84(e),r=M.distance(M.fromDegrees(s[0],s[1],s[2]),t.position),n=Math.PI/3,a=this.mapElement.offsetWidth,o=this.mapElement.offsetHeight,l=a/o,h=Math.atan(Math.tan(n*.5)/l)*2,c=2*r*Math.tan(h/2),u=Math.cos(Math.abs(P.toRadians(s[1])));return c/u/o}disableMovement(e){super.disableMovement(e),this._cesiumWidget.scene.screenSpaceCameraController.enableInputs=!e}setDataSourceDisplayClock(e){const t=this._dataSourceClocks[this._dataSourceClocks.length-1];e!==t&&(this._clockSyncListener&&(this._clockSyncListener(),this._clockSyncListener=null),this._clockSyncListener=bu(e,this.dataSourceDisplayClock)),this._dataSourceClocks.push(e)}unsetDataSourceDisplayClock(e){const t=this._dataSourceClocks.lastIndexOf(e);if(t>-1&&(this._dataSourceClocks.splice(t,1),t===this._dataSourceClocks.length)){const s=this._dataSourceClocks[this._dataSourceClocks.length-1]||this._defaultClock;this._clockSyncListener&&(this._clockSyncListener(),this._clockSyncListener=null),this._clockSyncListener=bu(s,this.dataSourceDisplayClock)}}setDay(e){this._cesiumWidget.clock.currentTime=e,this._cesiumWidget.clock.multiplier=1}setLightning(e){this.enableLightning=e,this._cesiumWidget.scene.globe.enableLighting=e}getCesiumWidget(){return this._cesiumWidget}getEntities(){return this.dataSourceDisplay.defaultDataSource.entities}getDatasources(){return this.dataSourceDisplay.dataSources}getClusterDatasources(){if(this._clusterDataSourceDisplay)return this._clusterDataSourceDisplay.dataSources;const e=new Ml;function t(s,r,n){const{entities:a}=n;return[new qf(r,a),new Wf(r,a),new Xf(r,a)]}return this._clusterDataSourceDisplay=new Sl({scene:this._cesiumWidget.scene,dataSourceCollection:e,visualizersCallback:t}),this._removeClusterClockTickListener=this._cesiumWidget.clock.onTick.addEventListener(s=>{this._clusterDataSourceDisplay.update(s.currentTime)}),e}indexChanged(e){const t=this.getVisualizationsForLayer(e);t&&t.forEach(s=>{s instanceof Zn?D1(this.getScene().primitives,s,this.layerCollection):s instanceof ai?F1(this.getScene().imageryLayers,s,this.layerCollection):s instanceof Cl&&A1(this.dataSourceDisplay.dataSources,s,this.layerCollection)})}addPrimitiveCollection(e){this.validateVisualization(e)&&(this.addVisualization(e),this._debug&&e instanceof As&&Ou(e,this._debug),bn(this.getScene().primitives,e,this.layerCollection))}removePrimitiveCollection(e){var t;this.removeVisualization(e),(t=this.getScene())==null||t.primitives.remove(e)}addImageryLayer(e){this.validateVisualization(e)&&(this.addVisualization(e),bn(this.getScene().imageryLayers,e,this.layerCollection))}removeImageryLayer(e){var t;this.removeVisualization(e),(t=this.getScene())==null||t.imageryLayers.remove(e)}async addDataSource(e){this.validateVisualization(e)&&(this.addVisualization(e),await wu(this.dataSourceDisplay.dataSources,e,this.layerCollection))}removeDataSource(e){this.removeVisualization(e),!this.dataSourceDisplay.isDestroyed()&&!this.dataSourceDisplay.dataSources.isDestroyed()&&this.dataSourceDisplay.dataSources.remove(e)}setTerrainProvider(e){this.terrainProvider!==e&&(this._cesiumWidget.scene.terrainProvider=e)}unsetTerrainProvider(e){this.terrainProvider===e&&(this._terrainProvider=this.defaultTerrainProvider,this._cesiumWidget.scene.terrainProvider=this.defaultTerrainProvider)}getDataSourceDisplay(){return this.dataSourceDisplay}getScene(){var e;return(e=this._cesiumWidget)==null?void 0:e.scene}pointIsVisible(e){const{camera:t}=this._cesiumWidget.scene,s=M.fromDegrees(e[0],e[1],0);return t.frustum.computeCullingVolume(t.positionWC,t.directionWC,t.upWC).computeVisibility(new xl(s))===Vf.INSIDE}_setDebug(){this._debug&&this.initialized&&!this._cesiumInspectorContainer&&(this._cesiumInspectorContainer=document.createElement("div"),this._cesiumInspectorContainer.className="vcm-cesium-inspector",this.mapElement.appendChild(this._cesiumInspectorContainer),this._cesiumInspector=new Bf(this._cesiumInspectorContainer,this.getScene()),this._cesium3DTilesInspector=new Uf(this._cesiumInspectorContainer,this.getScene()),this._cesium3DTilesInspector.viewModel.picking=!1),this._cesiumInspectorContainer&&(this._cesiumInspectorContainer.style.display=this.active&&this._debug?"":"none"),R1(this.getVisualizations(),this._debug)}_terrainProviderChanged(e){if(this.terrainProvider!==e){const t=this.layerCollection.getByKey(this.terrainProvider[j]);this._terrainProvider=e,t&&t.deactivate()}}pickPositionSupported(){return this.initialized?this._cesiumWidget.scene.pickPositionSupported:!1}isGroundPrimitiveSupported(){return this.initialized?this._cesiumWidget.scene.context.fragmentDepth:!1}toJSON(){const e=super.toJSON(),t=z.getDefaultOptions();return this.enableLightning!==t.enableLightning&&(e.enableLightning=this.enableLightning),this.tileCacheSize!==t.tileCacheSize&&(e.tileCacheSize=this.tileCacheSize),this.webGLaa!==t.webGLaa&&(e.webGLaa=this.webGLaa),this.globeColor.toCssHexString()!==t.globeColor&&(e.globeColor=this.globeColor.toCssHexString()),this._cameraLimiter?e.cameraLimiter=this._cameraLimiter.toJSON():this._cameraLimiterOptions&&!this.initialized&&(e.cameraLimiter=this._cameraLimiterOptions),e}destroy(){this.dataSourceDisplay&&!this.dataSourceDisplay.isDestroyed()&&this.dataSourceDisplay.destroy(),this._screenSpaceListeners.forEach(e=>{e()}),this.screenSpaceEventHandler&&(this.screenSpaceEventHandler.destroy(),this.screenSpaceEventHandler=null),this._terrainProviderChangedListener&&(this._terrainProviderChangedListener(),this._terrainProviderChangedListener=null),this._terrainProvider=null,this.defaultTerrainProvider=null,this._clockTickListener&&(this._clockTickListener(),this._clockTickListener=null),this._clockSyncListener&&(this._clockSyncListener(),this._clockSyncListener=null),this._preUpdateListener&&(this._preUpdateListener(),this._preUpdateListener=null),this._cameraLimiter&&(this._cameraLimiter=null),this._removeClusterClockTickListener&&this._removeClusterClockTickListener(),[...this.layerCollection].forEach(e=>{e.removedFromMap(this)}),this._clusterDataSourceDisplay&&this._clusterDataSourceDisplay.destroy(),this._cesiumWidget&&(this._cesiumWidget.destroy(),this._cesiumWidget=null),this._cesium3DTilesInspector&&(this._cesium3DTilesInspector.destroy(),this._cesium3DTilesInspector=null),this._cesiumInspector&&(this._cesiumInspector.destroy(),this._cesiumInspector=null),this._cesiumInspectorContainer&&(this._cesiumInspectorContainer.parentElement.removeChild(this._cesiumInspectorContainer),this._cesiumInspectorContainer=null),super.destroy()}}di.registerClass(z.className,z);class ce extends bt{static get className(){return"VectorLayer"}static get alreadyTransformedToMercator(){return zh}static get alreadyTransformedToImage(){return Ge}static get obliqueGeometry(){return Rt}static get doNotTransform(){return Fa}static get originalFeatureSymbol(){return Jt}static getDefaultOptions(){return T(S({},de.getDefaultOptions()),{projection:void 0,maxResolution:void 0,minResolution:void 0,dontUseTerrainForOblique:!1,zIndex:50,highlightStyle:void 0,isDynamic:!1,vectorProperties:{}})}constructor(e){super(e),this._supportedMaps=[z.className,pe.className,ie.className];const t=ce.getDefaultOptions();this.source=new Ns({}),this.projection=new D(e.projection),this.maxResolution=e.maxResolution!=null?e.maxResolution:t.maxResolution,this.minResolution=e.minResolution!=null?e.minResolution:t.minResolution,this.dontUseTerrainForOblique=ae(e.dontUseTerrainForOblique,t.dontUseTerrainForOblique),this.highlightStyle=t.highlightStyle,e.highlightStyle&&(this.highlightStyle=e.highlightStyle instanceof W?e.highlightStyle:new W(e.highlightStyle)),this.hasFeatureUUID=!1,this._visibility=!0,this.isDynamic=ae(e.isDynamic,t.isDynamic),this._onStyleChangeRemover=null,this.vectorProperties=new nt(S({allowPicking:this.allowPicking},e.vectorProperties));let s=e.style;e.style instanceof dt&&(s=e.style.toJSON()),this._initialStyle=s}get allowPicking(){return super.allowPicking}set allowPicking(e){super.allowPicking=e,this.vectorProperties.allowPicking=e}get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this.forceRedraw())}initialize(){return super.initialize().then(()=>{this._trackStyleChanges()})}getVcsMeta(e={}){const t=this.vectorProperties.getVcsMeta();if(t.version=Da,e.embedIcons&&(t.embeddedIcons=[]),e.writeStyle){const s=this.getStyleOrDefaultStyle(this._initialStyle);(e.writeDefaultStyle||!s.equals(this.style))&&$h(this.style,t)}return t}setVcsMeta(e){this.vectorProperties.setVcsMeta(e)}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{source:this.source,maxResolution:this.maxResolution,minResolution:this.minResolution,vectorProperties:this.vectorProperties})}createImplementationsForMap(e){return this.visibility?e instanceof ie?[new Ka(e,this.getImplementationOptions())]:e instanceof z?[new Yc(e,this.getImplementationOptions())]:e instanceof pe?[new po(e,this.getImplementationOptions())]:[]:[]}getStyleOrDefaultStyle(e,t){return super.getStyleOrDefaultStyle(e,t||mi.clone())}setStyle(e,t){super.setStyle(e,t),this._trackStyleChanges();const s=this.style instanceof Oe;this.getFeatures().forEach(r=>{if(r[Ae]){let n;s?(n=!0,r.setStyle(void 0)):r.getStyle()!==r[Ae].style&&(n=!0,r.setStyle(r[Ae].style)),n&&Reflect.has(r,Ct)&&Na(r)}})}_trackStyleChanges(){this._onStyleChangeRemover&&(this._onStyleChangeRemover(),this._onStyleChangeRemover=null);const e=this.style instanceof Oe;this._onStyleChangeRemover=this.style.styleChanged.addEventListener(()=>{this.getFeatures().forEach(t=>{(e||!t[Ae])&&t.changed()})})}setHighlightStyle(e){v(e,[_e,W,Function]),e instanceof W?this.highlightStyle=e:(this.highlightStyle||(this.highlightStyle=new W({})),this.highlightStyle.style=e)}getSource(){return this.source}addFeatures(e){v(e,[Z]);const t=this.style instanceof Oe,s=e.map(r=>{const n=r.getId();if(n==null)r.setId(et());else if(this.hasFeatureUUID=!0,n&&this.getFeatureById(n))return!1;if(this.projection.epsg!==R.epsg){const a=r.getGeometry();a&&(a[ce.alreadyTransformedToMercator]||(a.transform(this.projection.proj,R.proj),a[ce.alreadyTransformedToMercator]=!0))}return r[de.vcsLayerNameSymbol]=this.name,t&&r[Ae]&&r.setStyle(),r}).filter(r=>r);return this.source.addFeatures(s),e.map(r=>r.getId())}removeFeaturesById(e){const t=this.getFeaturesById(e);for(let s=0;s<t.length;s++)this.source.removeFeature(t[s])}removeAllFeatures(){this.source.clear()}getFeaturesById(e){return v(e,[[String,Number]]),e.map(t=>this.getFeatureById(t)).filter(t=>t!=null)}getFeatureById(e){return this.source.getFeatureById(e)}getFeatures(){return this.source.getFeatures()}getZoomToExtent(){const e=super.getZoomToExtent();if(e)return e;const t=new Me({projection:R.toJSON(),coordinates:this.source.getExtent()});return t.isValid()?t:null}objectClickedHandler(e){const t=e[Jt]||e;return this.vectorProperties.getAllowPicking(t)?{id:t.getId(),feature:t}:null}getGenericFeatureFromClickedObject(e){return Za(e,this)}toJSON(){const e=super.toJSON(),t=ce.getDefaultOptions();this.projection.epsg!==Ch().epsg&&(e.projection=this.projection.toJSON()),this.maxResolution!==t.maxResolution&&(e.maxResolution=this.maxResolution),this.minResolution!==t.minResolution&&(e.minResolution=this.minResolution),this.dontUseTerrainForOblique!==t.dontUseTerrainForOblique&&(e.dontUseTerrainForOblique=this.dontUseTerrainForOblique),this.highlightStyle&&(e.highlightStyle=this.highlightStyle.toJSON()),this.isDynamic!==t.isDynamic&&(e.isDynamic=this.isDynamic);const s=this.vectorProperties.getVcsMeta();return Object.keys(s).length>0&&(e.vectorProperties=s),e}destroy(){this.source&&this.source.clear(!0),this._onStyleChangeRemover&&this._onStyleChangeRemover(),this.vectorProperties.destroy(),super.destroy()}}ue.registerClass(ce.className,ce);const rt=Symbol("vcsFeatureType"),bi={DYNAMIC:"dynamic",STATIC:"static",EDITED:"edited"},G1="EPSG:3857";let Eo;function Io(){return Eo||(Eo=new al),Eo}function Eu(i){const{crs:e}=i;if(e){if(e.type==="name")return e.properties.name;if(e.type==="EPSG")return`EPSG:${e.properties.code}`}return null}function Iu(i){if(i.get("altitudeMode")&&(i.set("olcs_altitudeMode",i.get("altitudeMode"),!0),i.unset("altitudeMode",!0)),i.get("extrudedHeight")){if(i.get("drawingType"))i.set("olcs_extrudedHeight",i.get("extrudedHeight"),!0);else{const e=Vt.fromGeometry(i.getGeometry()),t=Number.isFinite(e.minZ)?e.minZ:0;i.set("olcs_extrudedHeight",i.get("extrudedHeight")-t,!0)}i.unset("extrudedHeight",!0)}i.get("skirt")&&(i.set("olcs_skirt",i.get("skirt"),!0),i.unset("skirt",!0)),i.get("radius")&&i.unset("radius",!0)}function k1(i,e){const t=Io().readGeometry(i,e.formatOptions);return String(e.formatOptions.featureProjection)==="EPSG:3857"&&(t[ce.alreadyTransformedToMercator]=!0),Ya(t),new Z({geometry:t})}function Pu(i,e){return i.image&&i.image.src&&/^:\d+$/.test(i.image.src)&&(e.embeddedIcons?i.image.src=e.embeddedIcons[i.image.src.substring(1)]:delete i.image.src),i}function z1(i,e){const t=i.color?Te(i.color):!1,s=i.width||1.25,r=i.pointRadius||5,n=i.opacity||.8;if(delete i.color,delete i.width,delete i.pointRadius,delete i.opacity,e==="Polygon"||e==="Circle"){const a=t?t.slice():[255,255,255,.4];return a[3]=n,{fill:{color:a},stroke:{color:t||Te("#3399CC"),width:s}}}if(e==="LineString")return{stroke:{color:t||Te("#3399CC"),width:s}};if(e==="Point")return{image:{fill:{color:[255,255,255,.4]},radius:r,stroke:{color:t||Te("#3399CC"),width:1}}}}function Lu(i,e){if(!i.geometry)return null;const t=i.geometry.olcs_radius;let s=Io().readGeometry(i.geometry,e.formatOptions);if(i.radius&&s instanceof Bt){const a=s.getCoordinates();a.length===2&&a.push(0),s=new at(a,i.radius,"XYZ")}if(t&&s instanceof Bt){const a=s.getCoordinates();a.length===2&&a.push(0),s=qa(a,t)}String(e.formatOptions.featureProjection)==="EPSG:3857"&&(s[ce.alreadyTransformedToMercator]=!0),i.vcsMeta=i.vcsMeta||{},i.vcsStyle&&(i.vcsMeta.style=i.vcsMeta.style||i.vcsStyle);const{properties:r}=i;e.readLegacyStyleOptions&&!i.vcsMeta.style&&(i.vcsMeta.style=z1(r,s.getType())),Ya(s);const n=new Z(T(S({},r),{geometry:s}));if(i.id&&n.setId(i.id),i.state&&(n[rt]=i.state),i.vcsMeta.style&&!e.dontReadStyle){i.vcsMeta.style=Pu(i.vcsMeta.style,e);let a;e.defaultStyle?(a=e.defaultStyle.clone().assign(new W(i.vcsMeta.style)),a.label!=null&&s.set("_vcsGeomType","Label")):a=new W(i.vcsMeta.style),n[Ae]=a,n.setStyle(a.style)}return Iu(n),n}function zt(i,e={}){const t=typeof i=="string"?JSON.parse(i):i,s=Eu(t),r=s?{epsg:s}:e.dataProjection,n={formatOptions:{dataProjection:r?r.epsg:U.epsg,featureProjection:e.targetProjection?e.targetProjection.epsg:R.epsg},dontReadStyle:e.dontReadStyle,readLegacyStyleOptions:e.readLegacyStyleOptions,defaultStyle:e.defaultStyle};if(e.dynamicStyle&&!n.defaultStyle&&(n.defaultStyle=mi),t.type==="FeatureCollection"){t.vcsMeta=t.vcsMeta||{embeddedIcons:t.vcsEmbeddedIcons,style:t.vcsStyle};let a;return t.vcsMeta.embeddedIcons&&(n.embeddedIcons=t.vcsMeta.embeddedIcons),t.vcsMeta.style&&e.dynamicStyle&&(t.vcsMeta.style.type===Oe.className?a=new Oe(t.vcsMeta.style):(t.vcsMeta.style=Pu(t.vcsMeta.style,n),n.defaultStyle=n.defaultStyle.clone().assign(new W(t.vcsMeta.style)),a=n.defaultStyle)),{features:t.features.map(o=>Lu(o,n)).filter(o=>o),style:t.vcsMeta.style?a:void 0,vcsMeta:t.vcsMeta?t.vcsMeta:void 0}}else if(t.type==="Feature"){const a=Lu(t,n);return{features:a?[a]:[],vcsMeta:t.vcsMeta?t.vcsMeta:void 0}}else if(t.type!=null)return{features:[k1(t,n)]};return{features:[]}}function ds(i,e={},t){const s={type:"Feature",properties:i.getProperties()};e.writeId&&(s.id=i.getId()),delete s.properties[i.getGeometryName()],delete s.properties.style,delete s.properties.olcs_allowPicking;let r=i.getGeometry(),n=null;if(r instanceof at){const a=r.getCoordinates();n=qd(D.mercatorToWgs84(a[0],!0),D.mercatorToWgs84(a[1],!0)),r=new Bt(r.getCenter())}else if(r instanceof Ts){const a=r.getCoordinates();a.forEach(o=>{_n(o)}),r.setCoordinates(a)}else if(r instanceof Or){const a=r.getCoordinates();a.forEach(o=>{o.forEach(l=>{_n(l)})}),r.setCoordinates(a)}return s.geometry=Io().writeGeometryObject(r,{featureProjection:G1,rightHanded:!0}),n&&(s.geometry.olcs_radius=n),s.vcsMeta={},e.writeStyle&&i[Ae]&&(s.vcsMeta.style=Aa(i[Ae].getOptionsForFeature(i),t)),s}function j1(i,e={}){const t=i.vcsMeta||{};t.version=Da;const s=i.features.map(n=>ds(n,e,t.embeddedIcons)),r={type:"FeatureCollection",features:s,vcsMeta:t};return e.asObject?r:JSON.stringify(r,null,e.prettyPrint?2:null)}const H1=et();function $1(i,e){if(e.style&&i.setStyle(sr(e.style,i.defaultStyle)),e.highlightStyle){const t=sr(e.highlightStyle,i.highlightStyle);i.setHighlightStyle(t)}e.vectorProperties&&i.vectorProperties.setValues(e.vectorProperties),e.zIndex!=null&&(i.zIndex=e.zIndex)}function Po(i,e,t,s){if(s==null?e!==t:s!==e)throw new Error(`Cannot merge options, values of ${i} do not match`)}class Et extends ut{static get className(){return"Category"}static getDefaultConfig(){return{title:"",featureProperty:void 0,classRegistryName:void 0,layerOptions:{},keyProperty:"name"}}constructor(e){super(e);const t=Et.getDefaultConfig();this.title=e.title||this.name,this._app=null,this._featureProperty=e.featureProperty||t.featureProperty,this._classRegistryName=e.classRegistryName,this._layerOptions=e.layerOptions||t.layerOptions,this._layer=null,this._featureProperty&&(this._layer=new ce(this._layerOptions),this._layer[Le]=H1),this._keyProperty=e.keyProperty||t.keyProperty,this._collectionChanged=new I,this._collectionListeners=[],this._collection=null,this.setCollection(new Di(this._keyProperty)),this._contextRemovedListener=()=>{}}get classRegistryName(){return this._classRegistryName}get collection(){return this._collection}get collectionChanged(){return this._collectionChanged}get layer(){return this._layer}_itemAdded(e){if(this._featureProperty){const t=e[this._keyProperty];this._layer.removeFeaturesById([t]);const s=e[this._featureProperty];let r;if(s instanceof ol)r=s;else if(typeof s=="object"){const{features:n}=zt(s);n[0]&&(r=n[0])}r&&(r.setId(t),setTimeout(()=>{this._layer.addFeatures([r])},0))}}_itemRemoved(e){this._featureProperty&&this._layer.removeFeaturesById([e[this._keyProperty]])}_itemReplaced(e){}_itemMoved(e){}_getDynamicContextId(){if(!this._app)throw new Error("Cannot get dynamic context id, before setting the vcApp");return this._app.dynamicContextId}mergeOptions(e){const t=Et.getDefaultConfig();Po("classRegistryName",this._classRegistryName,t.classRegistryName,e.classRegistryName),Po("featureProperty",this._featureProperty,t.featureProperty,e.featureProperty),Po("keyProperty",this._keyProperty,t.keyProperty,e.keyProperty),this.title=e.title||this.title,e.layerOptions&&this._layer&&$1(this._layer,e.layerOptions)}setCollection(e){if(v(e,wt),this._keyProperty!==e.uniqueKey)throw new Error("The collections key property does not match the categories key property");this._collectionListeners.forEach(t=>{t()}),this._collection&&Mt(this._collection),this._layer&&this._layer.removeAllFeatures(),this._collection=e[Qr]?e:fi(e,this._getDynamicContextId.bind(this),this._serializeItem.bind(this),this._deserializeItem.bind(this)),[...this.collection].forEach(t=>{this._itemAdded(t)}),this._collectionListeners=[this._collection.added.addEventListener(this._itemAdded.bind(this)),this._collection.removed.addEventListener(this._itemRemoved.bind(this)),this._collection.replaced.addEventListener(this._itemReplaced.bind(this))],this._collection.moved&&this._collectionListeners.push(this._collection.moved.addEventListener(this._itemMoved.bind(this))),this.collectionChanged.raiseEvent()}setApp(e){if(this._app)throw new Error("Cannot switch apps");this._app=e,this._contextRemovedListener=this._app.contextRemoved.addEventListener(t=>{this._collection.removeContext(t.id)}),this._layer&&this._app.layers.add(this._layer)}async _deserializeItem(e){if(!this._app)throw new Error("Cannot deserialize item before setting the vcApp");const t=this._classRegistryName?this._app[this._classRegistryName]:null;return t&&t instanceof vt?St(t,e):e}_serializeItem(e){const t=JSON.parse(JSON.stringify(e));if(this._featureProperty){const s=this._layer.getFeatureById(e[this._keyProperty]);s&&(t[this._featureProperty]=ds(s))}return t}serializeForContext(e){return this._collection.size===0?null:{name:this.name,items:this.collection.serializeContext(e)}}toJSON(){const e=super.toJSON(),t=Et.getDefaultConfig();return this.title!==this.name&&(e.title=this.title),this._featureProperty!==t.featureProperty&&(e.featureProperty=this._featureProperty),this._classRegistryName!==t.classRegistryName&&(e.classRegistryName=this._classRegistryName),Object.keys(this._layerOptions).length>0&&(e.layerOptions=S({},this._layerOptions)),this._keyProperty!==t.keyProperty&&(e.keyProperty=this._keyProperty),e}destroy(){super.destroy(),this._app&&this._layer&&this._app.layers.remove(this._layer),this._layer&&this._layer.destroy(),this._collectionListeners.forEach(e=>{e()}),this._collectionListeners.splice(0),this._contextRemovedListener(),this._contextRemovedListener=()=>{},Mt(this._collection),this._collectionChanged.destroy(),this._app=null}}Jr.registerClass(Et.className,Et);const V1={layers:"layerClassRegistry",styles:"styleClassRegistry",maps:"mapClassRegistry",categories:"categoryClassRegistry"};class Lo extends Et{static get className(){return"AppBackedCategory"}constructor(e){e.classRegistryName=V1[e.collectionName],super(e),this._collectionName=e.collectionName}async _deserializeItem(e){if(!this._app)throw new Error("Cannot deserialize item before setting the vcApp");return this._collectionName==="viewpoints"?new ft(e):this._collectionName==="obliqueCollections"?new $t(e):this._collectionName==="layers"?ba(this._app,e):this._collectionName==="maps"?wa(this._app,e):super._deserializeItem(e)}setApp(e){super.setApp(e),this.setCollection(this._app[this._collectionName])}serializeForContext(e){return null}toJSON(){const e=super.toJSON();return delete e.classRegistryName,e.collectionName=this._collectionName,e}}Jr.registerClass(Lo.className,Lo);function Tu(){return Ie("CategoryCollection")}class Nu extends Di{constructor(e){super(),this._app=e,this._cache=new Map,this._contextRemovedListener=this._app.contextRemoved.addEventListener(t=>{this._cache.forEach((s,r)=>{s.delete(t.id),s.size===0&&this._cache.delete(r)})})}add(e){if(this.hasKey(e.name))return null;e.setApp(this._app);const t=super.add(e);return t!=null&&this._cache.has(e.name)&&(this._cache.get(e.name).forEach((s,r)=>{this.parseCategoryItems(e.name,s,r)}),this._cache.delete(e.name)),t}remove(e){super.remove(e),this._cache.delete(e.name)}async parseCategoryItems(e,t,s){const r=this.getByKey(e);r?await r.collection.parseItems(t,s):this._cache.has(e)?this._cache.get(e).set(s,t):this._cache.set(e,new Map([[s,t]]))}async requestCategory(e){if(!e.name)return Tu().error("Cannot request a category without a name"),null;e.type||(Tu().warning(`Implicitly typing category ${e.name} as ${Et.className}`),e.type=Et.className);let t;if(this.hasKey(e.name))t=this.getByKey(e.name),t.mergeOptions(e);else if(t=await St(this._app.categoryClassRegistry,e),t&&this.add(t)==null)return null;if(!t)throw new Error(`Category ${e.name} with type ${e.type} could not be created`);return t}destroy(){super.destroy(),this._contextRemovedListener(),this._cache.clear(),this._app=null}}const B1="9c27cc2d-552f-4637-9194-09329ed4c1dc",Du=et();function Fu(i){i[Le]=Du}class To{constructor(e){this._config=e,this._checkSum=xg(JSON.stringify(e),B1),this._id=e.id||this._checkSum}get id(){return this._id}get checkSum(){return this._checkSum}get config(){return JSON.parse(JSON.stringify(this._config))}}const Au=Symbol("isProvidedFeature"),Ru=Symbol("showProvidedFeature");class Ai extends ut{static get className(){return"AbstractFeatureProvider"}static getDefaultOptions(){return{vectorProperties:{allowPicking:!1},genericFeatureProperties:void 0,showGeometry:!1,mapTypes:[]}}constructor(e,t){super(t);const s=Ai.getDefaultOptions();this.layerName=e,this.style=t.style?sr(t.style,mi.clone()):void 0,this.showGeometry=ae(t.showGeometry,s.showGeometry),this.vectorProperties=t.vectorProperties instanceof nt?t.vectorProperties:new nt(S(S({},s.vectorProperties),t.vectorProperties)),this.genericFeatureProperties=t.genericFeatureProperties||s.genericFeatureProperties,this.mapTypes=Array.isArray(t.mapTypes)?t.mapTypes:s.mapTypes}isSupported(e){return e&&(this.mapTypes.length===0||this.mapTypes.includes(e.className))}getProviderFeature(e){return e.getId()||e.setId(et()),this.style&&e.setStyle(this.style.style),this.genericFeatureProperties&&e.setProperties(this.genericFeatureProperties),e[j]=this.layerName,e[Au]=!0,e[Ru]=this.showGeometry,Object.entries(this.vectorProperties.getValues()).forEach(([t,s])=>{const r=`olcs_${t}`;e.get(r)===void 0&&s!==void 0&&e.set(r,s)}),e}async getFeaturesByCoordinate(e,t){return[]}toJSON(){const e=super.toJSON(),t=Ai.getDefaultOptions();delete e.name,this.showGeometry!==t.showGeometry&&(e.showGeometry=this.showGeometry),this.genericFeatureProperties&&(e.genericFeatureProperties=S({},this.genericFeatureProperties)),this.style&&(e.style=this.style.toJSON());const s=this.vectorProperties.getVcsMeta(S(S({},nt.getDefaultOptions()),t.vectorProperties));return Object.keys(s).length>0&&(e.vectorProperties=s),e}destroy(){this.style=null,this.vectorProperties.destroy(),this.genericFeatureProperties=void 0,super.destroy()}}function U1(i,e){const t=i.getProperties();delete t[i.getGeometryName()];let{clickedPosition:s}=i;const r=i.getGeometry(),n=i.get("olcs_modelUrl");if(r&&(r.getType()==="Point"&&!n||s&&!s.exactPosition||!s&&r)){const l=zn(r.getExtent());l&&(D.mercatorToWgs84(l,!0),s={longitude:l[0],latitude:l[1]})}let a=s.height;if(!n){const l=Vt.fromGeometry(r);a=Number.isFinite(l.maxZ)?l.maxZ:0}const o=!n&&i.get("olcs_altitudeMode")==="relativeToGround";return delete t.clickedPosition,{layerName:e.name,layerClass:e.className,attributes:t,longitude:s.longitude,latitude:s.latitude,height:a,relativeToGround:o}}class On extends Ai{static get className(){return"TileProviderFeatureProvider"}constructor(e,t){super(e,t),this.mapTypes=["CesiumMap"],this.tileProvider=t.tileProvider}async getFeaturesByCoordinate(e,t){return(await this.tileProvider.getFeaturesByCoordinate(e,t)).filter(r=>this.vectorProperties.getAllowPicking(r))}destroy(){this.tileProvider=void 0,super.destroy()}}Kr.registerClass(On.className,On);function gr(i){const{location:e}=window,t=new URL(i,`${e.protocol}//${e.host}${e.pathname}`);return t.host?t.protocol===e.protocol&&t.host===e.host:!0}function No(i){const e=i.tilingSchema==="geographic"?U:R,t=e.proj.getExtent(),s=jn(t),r=i.tilingSchema==="geographic"?s/(i.tileSize[0]*2):s/i.tileSize[0],n=i.maxLevel+1,a=[];for(let h=0;h<n;++h)a.push(r/2**h);const o={origin:Pr(t),resolutions:a,tileSize:i.tileSize,minZoom:i.minLevel};i.extent&&i.extent.isValid()&&(o.extent=i.extent.getCoordinatesInProjection(e));const l={url:i.url,tileGrid:new sl(o),params:i.parameters};return gr(i.url)||(l.crossOrigin="anonymous"),i.tilingSchema==="geographic"&&(i.version==="1.3.0"?l.projection="CRS:84":l.projection="EPSG:4326"),new Wd(l)}const q1={GML:$n,GML2:Hn,GML3:$n},W1=["application/geojson","application/json","application/vnd.geo+json","application/geo+json"];function Gu(i,e={}){return i==="text/xml"?(e.gmlFormat=e.gmlFormat?new q1[e.gmlFormat]:new Hn,new ll(e)):W1.includes(i)?new al(e):i==="application/vnd.ogc.gml"?new Hn(e):i==="application/vnd.ogc.gml/3.1.1"?new $n(e):null}class si extends Ai{static get className(){return"WMSFeatureProvider"}static getDefaultOptions(){return T(S({},Ai.getDefaultOptions()),{responseType:"text/xml",style:void 0,formatOptions:void 0,projection:void 0,url:"",tilingSchema:"geographic",version:"1.1.1",maxLevel:0,minLevel:0,tileSize:[256,256],parameters:{},extent:void 0})}constructor(e,t){super(e,t);const s=si.getDefaultOptions();this.extent=null,t.extent&&(t.extent instanceof Me?this.extent=t.extent:this.extent=new Me(t.extent)),this._wmsSourceOptions={url:t.url,tilingSchema:t.tilingSchema||s.tilingSchema,maxLevel:B(t.maxLevel,s.maxLevel),minLevel:B(t.minLevel,s.minLevel),tileSize:t.tileSize||s.tileSize,parameters:t.parameters,version:t.version||s.version},this.wmsSource=No(this._wmsSourceOptions),this.featureInfoResponseType=t.responseType||s.responseType,this._formatOptions=t.formatOptions||s.formatOptions,this.featureFormat=Gu(this.featureInfoResponseType,t.formatOptions),this.projection=t.projection?new D(t.projection):void 0}featureResponseCallback(e,t){let s;try{s=this.featureFormat.readFeatures(e,{dataProjection:this.projection?this.projection.proj:void 0,featureProjection:R.proj})}catch{return this.getLogger().warning("Features could not be read, please verify the featureInfoResponseType with the capabilities from the server"),[]}return Array.isArray(s)?(s.forEach(r=>{r.getGeometry()||r.setGeometry(new Bt(t))}),s):[]}async getFeaturesByCoordinate(e,t){const s=this.wmsSource.getProjection();let r=e;s&&(r=ye(R.proj,s)(e.slice(),void 0,void 0));const n=111194.87428468118,a=this.wmsSource.getFeatureInfoUrl(r,t/n,s,{INFO_FORMAT:this.featureInfoResponseType});if(a){let o;try{o=await xt(a)}catch{return this.getLogger().error(`Failed fetching WMS FeatureInfo ${a}`),[]}return this.featureResponseCallback(o,e).map(l=>this.getProviderFeature(l))}return[]}toJSON(){const e=super.toJSON(),t=si.getDefaultOptions();return this.featureInfoResponseType!==t.responseType&&(e.responseType=this.featureInfoResponseType),this._formatOptions!==t.formatOptions&&(e.formatOptions=S({},this._formatOptions)),this.projection!==t.projection&&(e.projection=this.projection.toJSON()),e.url=this._wmsSourceOptions.url,e.parameters=S({},this._wmsSourceOptions.parameters),this._wmsSourceOptions.tilingSchema!==t.tilingSchema&&(e.tilingSchema=this._wmsSourceOptions.tilingSchema),this._wmsSourceOptions.maxLevel!==t.maxLevel&&(e.maxLevel=this._wmsSourceOptions.maxLevel),this._wmsSourceOptions.minLevel!==t.minLevel&&(e.minLevel=this._wmsSourceOptions.minLevel),this._wmsSourceOptions.version!==t.version&&(e.version=this._wmsSourceOptions.version),(this._wmsSourceOptions.tileSize[0]!==t.tileSize[0]||this._wmsSourceOptions.tileSize[1]!==t.tileSize[1])&&(e.tileSize=this._wmsSourceOptions.tileSize.slice()),this.extent&&(e.extent=this.extent.toJSON()),e}destroy(){this.wmsSource=void 0,this.featureFormat=void 0,this.projection=void 0,this._formatOptions=void 0,super.destroy()}}Kr.registerClass(si.className,si);class Se{constructor(e=b.NONE,t=G.NONE,s=le.LEFT){this.id=et(),this._defaultActive=e,this.active=this._defaultActive,this._defaultModificationKey=t,this.modificationKey=this._defaultModificationKey,this._defaultPointerKey=s,this.pointerKey=this._defaultPointerKey}async pipe(e){return e}modifierChanged(e){}setActive(e){typeof e=="undefined"?(this.active=this._defaultActive,this.modificationKey=this._defaultModificationKey,this.pointerKey=this._defaultPointerKey):typeof e=="boolean"?this.active=e?this._defaultActive:b.NONE:this.active=e}setModification(e){e?this.modificationKey=e:this.modificationKey=this._defaultModificationKey}setPointer(e){e?this.pointerKey=e:this.pointerKey=this._defaultPointerKey}destroy(){}}class Dn extends Se{constructor(){super(b.ALL,G.ALL,le.ALL),this._scratchCartographic=new se,this._scratchCartesian=new M,this.setActive()}async pipe(e){return e.map.className==="CesiumMap"?this._cesiumHandler(e):e.map.className==="ObliqueMap"?Dn.obliqueHandler(e):e}_cesiumHandler(e){const s=e.map.getScene();e.ray=s.camera.getPickRay(e.windowPosition);const r=s.globe.pick(e.ray,s,this._scratchCartesian);return r?(this._scratchCartographic=se.fromCartesian(r,s.globe.ellipsoid,this._scratchCartographic),e.position=D.wgs84ToMercator([P.toDegrees(this._scratchCartographic.longitude),P.toDegrees(this._scratchCartographic.latitude),this._scratchCartographic.height],!0)):e.position=[0,0,0],e.positionOrPixel=e.position,Promise.resolve(e)}static obliqueHandler(e){const s=e.map.currentImage;if(s){const r=e.type&(b.MOVE^b.DRAGEVENTS),n=e.position.slice(0,2);if(Number.isFinite(n[0])&&Number.isFinite(n[1]))return hs(s,n,{dontUseTerrain:!!r,dataProjection:R}).then(a=>(e.obliqueParameters={pixel:n},e.position=a.coords,e.obliqueParameters.estimate=a.estimate,e))}return e.stopPropagation=!0,Promise.resolve(e)}}class ei extends Se{constructor(e){super(b.ALL,G.ALL,le.ALL),this.chain=e||[],this.setActive()}addInteraction(e,t){t!=null?this.chain.splice(t,0,e):this.chain.push(e)}removeInteraction(e){const t=this.chain.findIndex(s=>s.id===e.id);return t>-1&&this.chain.splice(t,1),t}async pipe(e){let t=e;const s=this.chain.slice(),r=s.length;for(let n=0;n<r;n++){const a=s[n];if(a.active&e.type&&a.modificationKey&e.key&&a.pointerKey&e.pointer&&(t=await a.pipe(t),t.stopPropagation))break}return t}modifierChanged(e){this.chain.filter(t=>t.active!==b.NONE).forEach(t=>{t.modifierChanged(e)})}setModification(){super.setModification()}setPointer(){super.setPointer()}destroy(){this.chain.forEach(e=>{e.destroy()}),this.chain=[],super.destroy()}}class ku extends Se{constructor(){super(b.ALL^b.MOVE,G.ALL,le.ALL),this._pickPosition=b.CLICK,this._pickPositionMask=-1,this.pickTranslucent=!0,this.pullPickedPosition=0,this.hitTolerance=10,this._draggingFeature=null,this.setActive()}get pickPosition(){return this._pickPosition}set pickPosition(e){this._pickPosition=e&this._pickPositionMask}get excludedPickPositionEvents(){return~this._pickPositionMask}set excludedPickPositionEvents(e){this._pickPositionMask=~e}async pipe(e){return e.type&b.DRAG&&!(this._pickPosition&b.DRAG)?(this._draggingFeature&&(e.feature=this._draggingFeature),e):(e.type&b.DRAGEND&&(this._draggingFeature=null),e.map.className==="OpenlayersMap"?await this._openlayersHandler(e):e.map.className==="ObliqueMap"?await this._obliqueHandler(e):e.map.className==="CesiumMap"&&await this._cesiumHandler(e),e.type&b.DRAGSTART&&e.feature&&(this._draggingFeature=e.feature),e.type&b.DRAG&&this._draggingFeature&&(e.feature=this._draggingFeature),e)}setActive(e){typeof e=="undefined"&&(this.pickPosition=b.CLICK,this.pullPickedPosition=0),super.setActive(e)}_openlayersHandler(e){let t=null,s=null;return e.map.olMap.forEachFeatureAtPixel([e.windowPosition.x,e.windowPosition.y],(r,n)=>(r&&(r.get("olcs_allowPicking")==null||r.get("olcs_allowPicking")===!0)&&(t=r,s=n),!0),{hitTolerance:this.hitTolerance}),t&&s&&(e.feature=t,t.get("features")&&(e.feature[j]=s[j]),e.exactPosition=!0),Promise.resolve(e)}_obliqueHandler(e){let t=null,s=null;return e.map.olMap.forEachFeatureAtPixel([e.windowPosition.x,e.windowPosition.y],(r,n)=>(r&&(t=r[Jt]||r),s=n,!0),{hitTolerance:this.hitTolerance}),t&&s&&(e.feature=t,t.get("features")&&(e.feature[j]=s[j]),e.exactPosition=!0),Promise.resolve(e)}_cesiumHandler(e){const t=e.map,s=t.getScene(),r=s.pick(e.windowPosition,this.hitTolerance,this.hitTolerance);let n=new se,a=new M,o=new M;const{pickTranslucentDepth:l}=s,h=()=>a?(this.pullPickedPosition&&e.ray&&(o=M.multiplyByScalar(e.ray.direction,this.pullPickedPosition,o),a=M.subtract(a,o,a)),n=se.fromCartesian(a,s.globe.ellipsoid,n),e.position=D.wgs84ToMercator([P.toDegrees(n.longitude),P.toDegrees(n.latitude),n.height],!0),e.positionOrPixel=e.position,s.pickTranslucentDepth=l,Promise.resolve(e)):(a=new M,Promise.resolve(e));if(r){if(r.primitive&&r.primitive.olFeature)e.feature=r.primitive.olFeature;else if(r.primitive&&r.primitive[j]&&(r instanceof qt||r instanceof Ut)){e.feature=r;const c=Object.getOwnPropertySymbols(r.primitive),u=c.length;for(let d=0;d<u;d++)e.feature[c[d]]=r.primitive[c[d]]}else r.id&&r.id.olFeature?e.feature=r.id.olFeature:r.id&&r.id[j]&&r.id instanceof ni&&(e.feature=r.id);if(!(e.type&this.pickPosition))return Promise.resolve(e);if(s.pickPositionSupported)return r.primitive&&this.pickTranslucent&&!(r.primitive.pointCloudShading&&r.primitive.pointCloudShading.attenuation)&&(s.pickTranslucentDepth=!0,s.render(t.getCesiumWidget().clock.currentTime),e.exactPosition=!0),a=s.pickPosition(e.windowPosition,a),h()}return Promise.resolve(e)}}class zu extends Se{constructor(){super(b.CLICK,G.ALL,le.ALL),this.setActive()}async pipe(e){if(!e.feature){const t=[...e.map.layerCollection].filter(s=>s.featureProvider&&s.active&&s.isSupported(e.map)&&s.featureProvider.isSupported(e.map));if(t.length>0){const s=e.map.getCurrentResolution(e.position),r=(await Promise.all(t.map(n=>n.featureProvider.getFeaturesByCoordinate(e.position,s)))).flat();r.length>0&&(e.feature=r[0])}}return e}}function X1(){return Ie("EventHandler")}class ju{constructor(){this._positionInteraction=new Dn,this._featureInteraction=new ku,this._featureProviderInteraction=new zu,this._interactionChain=new ei([this._positionInteraction,this._featureInteraction,this._featureProviderInteraction]),this.clickDuration=400,this.dragDuration=100,this._lastDown=null,this._lastClick={time:null,windowPosition:new K},this._lastKeyEventModifiers=new Map,this._lastKeyEventModifiers.set(G.SHIFT,!1),this._lastKeyEventModifiers.set(G.ALT,!1),this._lastKeyEventModifiers.set(G.CTRL,!1),this._lastDispatchedModifier=G.NONE,this._dragging=null,this._running=!1,this._eventQueue=[],this._exclusiveInteraction=null,this._multiples=!1,this.exclusiveRemoved=new I,this.exclusiveAdded=new I,this._boundKeyListener=this._keyListener.bind(this),window.addEventListener("keydown",this._boundKeyListener),window.addEventListener("keyup",this._boundKeyListener)}get positionInteraction(){return this._positionInteraction}get featureInteraction(){return this._featureInteraction}get featureProviderInteraction(){return this._featureProviderInteraction}get interactions(){return this._interactionChain.chain.slice()}addExclusiveInteraction(e,t,s=3,r){return v(e,Se),v(t,Function),v(s,Number),re(r,String),this._exclusiveInteraction&&this._exclusiveInteraction.id!==r&&this.removeExclusive(),this._interactionChain.addInteraction(e,s),this._exclusiveInteraction?(this._exclusiveInteraction.interactions.push(e),this._exclusiveInteraction.cb.push(t)):this._exclusiveInteraction={id:r||et(),cb:[t],interactions:[e]},this.exclusiveAdded.raiseEvent(),this._exclusiveUnListen.bind(this,e,this._exclusiveInteraction.id)}removeExclusive(){this._exclusiveInteraction&&(this._exclusiveInteraction.interactions.filter(e=>e).forEach(e=>{this._interactionChain.removeInteraction(e)}),this._exclusiveInteraction.cb.filter(e=>e).forEach(e=>{e()}),this._exclusiveInteraction=null,this.exclusiveRemoved.raiseEvent())}_exclusiveUnListen(e,t){if(!this._exclusiveInteraction||this._exclusiveInteraction&&this._exclusiveInteraction.id!==t)return 0;const s=this._interactionChain.removeInteraction(e),r=this._exclusiveInteraction.interactions.findIndex(n=>n&&n.id===e.id);return r>-1&&(this._exclusiveInteraction.interactions.splice(r,1,void 0),this._exclusiveInteraction.cb.splice(r,1,void 0)),this._exclusiveInteraction.interactions.every(n=>n===void 0)&&(this._exclusiveInteraction=null),s>-1&&this.exclusiveRemoved.raiseEvent(),s!==-1?1:0}addPersistentInteraction(e,t=3){return v(e,Se),v(t,Number),this._interactionChain.addInteraction(e,t),()=>this._interactionChain.removeInteraction(e)!==-1?1:0}handleMapEvent(e){e.pointerEvent===Be.MOVE?this._mouseMove(e):e.pointerEvent===Be.DOWN?this._mouseDown(e):e.pointerEvent===Be.UP&&this._mouseUp(e)}_mouseDown(e){if(this._lastDown){this._multiples=!0;return}e.windowPosition.x===0&&e.windowPosition.y===0||(this._lastDown=e,this._lastDown.time=Date.now())}_mouseUp(e){if(e.multipleTouch){this._multiples=!0,this._lastDown=null;return}if(this._multiples){this._lastDown=null,this._multiples=!1;return}const t=e;this._dragging?(t.type=b.DRAGEND,t.key=this._dragging.key,t.pointer=this._dragging.pointer,this._startChain(t)):this._lastDown&&(this._lastClick.time&&Date.now()-this._lastClick.time<this.clickDuration&&K.distanceSquared(this._lastClick.windowPosition,t.windowPosition)<12?(this._lastClick.time=null,t.type=b.DBLCLICK):(this._lastClick.time=Date.now(),K.clone(t.windowPosition,this._lastClick.windowPosition),t.type=b.CLICK),this._startChain(t)),this._dragging=null,this._lastDown=null}_mouseMove(e){let t=e;this._lastDown?this._dragging?(t.type=b.DRAG,t.key=this._dragging.key,t.pointer=this._dragging.pointer,this._startChain(t,!0)):!this._dragging&&Date.now()-this._lastDown.time>this.dragDuration&&(t=S({type:b.DRAGSTART},this._lastDown),this._dragging=t,this._startChain(t,!0)):(t.type=b.MOVE,this._startChain(t,!0))}_keyListener(e){if((e.key==="Shift"||e.key==="Alt")&&(e.preventDefault(),e.stopPropagation()),this._lastKeyEventModifiers.get(G.SHIFT)!==e.shiftKey||this._lastKeyEventModifiers.get(G.ALT)!==e.altKey||this._lastKeyEventModifiers.get(G.CTRL)!==e.ctrlKey){this._lastKeyEventModifiers.set(G.SHIFT,e.shiftKey),this._lastKeyEventModifiers.set(G.ALT,e.altKey),this._lastKeyEventModifiers.set(G.CTRL,e.ctrlKey);const t=[...this._lastKeyEventModifiers.keys()].find(s=>this._lastKeyEventModifiers.get(s))||G.NONE;t!==this._lastDispatchedModifier&&(this._interactionChain.modifierChanged(t),this._lastDispatchedModifier=t)}}_startChain(e,t){this._running&&t||(this._running?this._eventQueue.push(e):(this._running=!0,this._interactionChain.pipe(e).then(this._endChain.bind(this)).catch(s=>{X1().error(s.message),this._endChain()})))}_endChain(){this._running=!1,this._eventQueue.length>0&&this._startChain(this._eventQueue.shift())}destroy(){this.removeExclusive(),this.exclusiveAdded.destroy(),this.exclusiveRemoved.destroy(),this._interactionChain.destroy(),this._interactionChain=null,this._positionInteraction.destroy(),this._positionInteraction=null,this._featureInteraction.destroy(),this._featureInteraction=null,this._eventQueue=[],window.removeEventListener("keydown",this._boundKeyListener),window.removeEventListener("keyup",this._boundKeyListener)}}const ti=Symbol("cesiumTilesetLastUpdated");function Do(i){if(!i.ready)return hl();const{rectangle:e}=i.root.boundingVolume;if(e){const o=Ye.southwest(e),l=Ye.northeast(e),h=D.wgs84ToMercator([P.toDegrees(o.longitude),P.toDegrees(o.latitude)]),c=D.wgs84ToMercator([P.toDegrees(l.longitude),P.toDegrees(l.latitude)]);return[h[0],h[1],c[0],c[1]]}const{center:t,radius:s}=i.boundingSphere,r=se.fromCartesian(t),n=D.wgs84ToMercator([P.toDegrees(r.longitude),P.toDegrees(r.latitude),r.height]);return qa(n,s).getExtent()}class ii extends Qt{static get className(){return"CesiumTilesetCesiumImpl"}constructor(e,t){super(e,t),this.cesium3DTileset=null,this.tilesetOptions=t.tilesetOptions,this.splitDirection=t.splitDirection,this.style=t.style,this.featureVisibility=t.featureVisibility,this.globalHider=t.globalHider,this.tilesetProperties=t.tilesetProperties,this.modelMatrix=t.modelMatrix,this.offset=t.offset,this._initializedPromise=null,this._originalOrigin=null,this._styleLastUpdated=Date.now()}async initialize(){this._initializedPromise||(this.cesium3DTileset=new As(this.tilesetOptions),this.tilesetProperties&&this.tilesetProperties.forEach(({key:e,value:t})=>{this.cesium3DTileset[e]=t}),this.cesium3DTileset[j]=this.name,this.cesium3DTileset.tileVisible.addEventListener(this.applyStyle.bind(this)),this.cesium3DTileset.tileUnload.addEventListener(e=>{delete e[ti]}),this._initializedPromise=this.cesium3DTileset.readyPromise,await this._initializedPromise,this._originalOrigin=M.clone(this.cesium3DTileset.boundingSphere.center),this.modelMatrix?this.cesium3DTileset.modelMatrix=this.modelMatrix:this.offset&&this._calculateOffset(),this.map.addPrimitiveCollection(this.cesium3DTileset),await super.initialize(),this.splitDirection&&this.updateSplitDirection(this.splitDirection),this.updateStyle(this.style)),await this._initializedPromise}_calculateOffset(){if(this.cesium3DTileset&&!this.modelMatrix)if(!this.offset)this.cesium3DTileset.modelMatrix=k.IDENTITY;else{const e=se.fromCartesian(this._originalOrigin);e.longitude+=P.toRadians(this.offset[0]),e.latitude+=P.toRadians(this.offset[1]),e.height+=this.offset[2];const t=se.toCartesian(e),s=M.subtract(t,this._originalOrigin,t);this.cesium3DTileset.modelMatrix=k.fromTranslation(s)}}updateModelMatrix(e){this.modelMatrix=e,this.cesium3DTileset&&(this.modelMatrix?this.cesium3DTileset.modelMatrix=e:this.offset?this._calculateOffset():this.cesium3DTileset.modelMatrix=k.IDENTITY)}updateOffset(e){this.offset=e,this._calculateOffset()}async activate(){await super.activate(),this.active&&(this.cesium3DTileset.show=!0)}deactivate(){super.deactivate(),this.cesium3DTileset&&(this.cesium3DTileset.show=!1)}updateStyle(e,t){this.style=e,this.initialized&&(this.cesium3DTileset.style=this.style.cesiumStyle,this._onStyleChangeRemover&&this._onStyleChangeRemover(),this._onStyleChangeRemover=this.style.styleChanged.addEventListener(()=>{this.cesium3DTileset.makeStyleDirty(),this._styleLastUpdated=Date.now()}),this._styleLastUpdated=Date.now(),this.cesium3DTileset.readyPromise.then(()=>{this.cesium3DTileset.colorBlendMode!==this.style.colorBlendMode&&(this.style.colorBlendMode!==Lr.HIGHLIGHT?this.cesium3DTileset.extras&&this.cesium3DTileset.extras._3DTILESDIFFUSE&&(this.cesium3DTileset.colorBlendMode=this.style.colorBlendMode):this.cesium3DTileset.colorBlendMode=this.style.colorBlendMode)}))}updateSplitDirection(e){const{splitScreen:t}=this.map;if(t){const s=t.getClippingObjectForDirection(this.splitDirection);s&&s.removeLayer(this.name),this.splitDirection=e;const r=t.getClippingObjectForDirection(this.splitDirection);r&&r.addLayer(this.name)}}applyStyle(e){if(e.content instanceof Yf)for(let t=0;t<e.content.innerContents.length;t++)this.styleContent(e.content.innerContents[t]);else this.styleContent(e.content)}styleContent(e){if(!e[ti]||e[ti]<this.featureVisibility.lastUpdated||e[ti]<this.globalHider.lastUpdated||e[ti]<this._styleLastUpdated){const t=e.featuresLength;for(let s=0;s<t;s++){const r=e.getFeature(s);if(r){let n=r.getProperty("id");n||(n=`${e.url}${s}`),this.featureVisibility.highlightedObjects[n]&&!this.featureVisibility.hasHighlightFeature(n,r)&&this.featureVisibility.addHighlightFeature(n,r),this.featureVisibility.hiddenObjects[n]&&!this.featureVisibility.hasHiddenFeature(n,r)&&this.featureVisibility.addHiddenFeature(n,r),this.globalHider.hiddenObjects[n]&&!this.globalHider.hasFeature(n,r)&&this.globalHider.addFeature(n,r),this._styleLastUpdated>e[ti]&&r[Ct]&&Na(r)}}e[ti]=Date.now()}}destroy(){if(this.cesium3DTileset){if(this.map.initialized){const e=this.cesium3DTileset;this.map.removePrimitiveCollection(e)}else this.cesium3DTileset.destroy();this.cesium3DTileset=null}if(this._onStyleChangeRemover&&this._onStyleChangeRemover(),this.splitDirection&&this.map.splitScreen){const e=this.map.splitScreen.getClippingObjectForDirection(this.splitDirection);e&&e.removeLayer(this.name)}super.destroy()}}class Y1{constructor(e){this.entities=e.entities,this.featureToBillboardMap=new Map,this.featureToLabelMap=new Map}addPrimitives(e,t,s){}addBillboards(e,t,s){as(e.map(r=>({billboard:r,position:r.position})),t,s,this.entities,this.featureToBillboardMap)}addLabels(e,t,s){as(e.map(r=>({label:r,position:r.position})),t,s,this.entities,this.featureToLabelMap)}removeFeature(e){ns(e,this.featureToBillboardMap,this.entities),ns(e,this.featureToLabelMap,this.entities)}createFeatureCache(e){const t={};return t.billboards=this.featureToBillboardMap.get(e),this.featureToBillboardMap.delete(e),t.labels=this.featureToLabelMap.get(e),this.featureToLabelMap.delete(e),t}clearFeatureCache(e){xi(this.entities,e.billboards),xi(this.entities,e.labels)}clear(){this.entities.removeAll(),this.featureToBillboardMap.clear(),this.featureToLabelMap.clear()}}function Z1(i,e){return i.values.forEach(t=>{e.add(t)}),i.collectionChanged.addEventListener((t,s,r)=>{s.forEach(n=>{e.add(n)}),r.forEach(n=>{e.remove(n)})})}class Hu extends Qt{static get className(){return"DataSourceCesiumImpl"}constructor(e,t){super(e,t),this.dataSource=new Cl(this.name),this.dataSource[j]=this.name,this.entities=t.entities,this.clock=t.clock,this._collectionListener=()=>{}}async initialize(){this.initialized||(this._collectionListener=Z1(this.entities,this.dataSource.entities),await this.map.addDataSource(this.dataSource)),await super.initialize()}async activate(){await super.activate(),this.active&&(this.dataSource.show=!0),this.clock&&this.map.setDataSourceDisplayClock(this.clock)}deactivate(){super.deactivate(),this.dataSource.show=!1,this.clock&&this.map.unsetDataSourceDisplayClock(this.clock)}flyToEntity(e){if(this.active){const t=this.dataSource.entities.getById(e);if(!t){this.getLogger().warning("could not find entity on this layer");return}const s=this.map.getDataSourceDisplay(),r=this.map.getScene(),{camera:n}=r,a=new xl,o=this.map.getViewpointSync(),{heading:l,pitch:h}=o,c=new Zf(P.toRadians(l),P.toRadians(h<-45?h:-45),void 0);let u,d=0;const f=()=>{const m=s.getBoundingSphere(t,!0,a);if(m!==wl.PENDING){if(m===wl.FAILED){d+=1,d>3&&u();return}n.flyToBoundingSphere(a,{duration:1,offset:c}),u()}},g=s.defaultDataSource;if(g.isLoading){const m=g.loadingEvent.addEventListener(()=>{u=r.postRender.addEventListener(f),m()})}else u=r.postRender.addEventListener(f)}}destroy(){this.map.initialized&&!this.isDestroyed&&this.map.removeDataSource(this.dataSource),this._collectionListener(),this.dataSource.entities.removeAll(),this.clock&&this.map.unsetDataSourceDisplayClock(this.clock),super.destroy()}}class Oi extends Qt{static get className(){return"RasterLayerCesiumImpl"}constructor(e,t){super(e,t),this.cesiumLayer=null,this.splitDirection=t.splitDirection,this.minLevel=t.minLevel,this.maxLevel=t.maxLevel,this.tilingSchema=t.tilingSchema,this.extent=t.extent,this.opacity=t.opacity}initialize(){return this.initialized||(this.cesiumLayer=this.getCesiumLayer(),this.cesiumLayer[j]=this.name,this.cesiumLayer.show=!1,this.map.addImageryLayer(this.cesiumLayer)),super.initialize()}updateSplitDirection(e){this.splitDirection=e,this.initialized&&(this.cesiumLayer.splitDirection=e)}getCesiumLayer(){throw new Error("implementation error")}async activate(){await super.activate(),this.active&&(this.cesiumLayer.show=!0)}deactivate(){super.deactivate(),this.cesiumLayer&&(this.cesiumLayer.show=!1)}updateOpacity(e){this.opacity=e,this.initialized&&this.cesiumLayer&&(this.cesiumLayer.alpha=e)}destroy(){this.cesiumLayer&&this.map.removeImageryLayer(this.cesiumLayer),this.cesiumLayer=null,super.destroy()}}class $u extends Oi{static get className(){return"OpenStreetMapCesiumImpl"}getCesiumLayer(){return new ai(new Kf({maximumLevel:this.maxLevel}),{alpha:this.opacity,splitDirection:this.splitDirection})}}class Vu extends Oi{static get className(){return"SingleImageCesiumImpl"}constructor(e,t){super(e,t),this.credit=t.credit}getCesiumLayer(){const e={url:this.url,credit:this.credit},t=this.extent.getCoordinatesInProjection(U);t&&(e.rectangle=Ye.fromDegrees(t[0],t[1],t[2],t[3]));const s=new Jf(e),r={rectangle:e.rectangle,alpha:this.opacity,defaultAlpha:1,splitDirection:this.splitDirection};return new ai(s,r)}}class Bu extends Qt{static get className(){return"TerrainCesiumImpl"}constructor(e,t){super(e,t),this.requestVertexNormals=t.requestVertexNormals,this.requestWaterMask=t.requestWaterMask}initialize(){return this.initialized||(this.terrainProvider=ls({url:this.url,requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask}),this.terrainProvider[j]=this.name),super.initialize()}async activate(){await super.activate(),this.active&&this.map.setTerrainProvider(this.terrainProvider)}deactivate(){super.deactivate(),this.terrainProvider&&this.map.unsetTerrainProvider(this.terrainProvider)}destroy(){this.terrainProvider=null,super.destroy()}}const jt={GEOGRAPHIC:"geographic",MERCATOR:"mercator"};function Fo(i){const e={};return i.numberOfLevelZeroTilesX&&i.numberOfLevelZeroTilesX>1&&(e.numberOfLevelZeroTilesX=i.numberOfLevelZeroTilesX),i.numberOfLevelZeroTilesY&&i.numberOfLevelZeroTilesY>1&&(e.numberOfLevelZeroTilesY=i.numberOfLevelZeroTilesY),i.tilingSchema===jt.MERCATOR?new Qn(e):new bl(e)}function Uu(i,e,t,s=0){if(!i.isValid())return s;const r=i.getCoordinatesInProjection(U);r[1]<-85&&(r[1]=-85),r[3]>85&&(r[3]=85);const a=[kn(r),el(r),tl(r),Pr(r)].map(l=>se.fromDegrees(l[0],l[1]));let o=s;for(;o<t;){const l=a.map(c=>e.positionToTileXY(c,o)),h=[];if(h.push(Math.abs(l[0].x-l[1].x)),h.push(Math.abs(l[0].y-l[3].y)),h[0]>1||h[1]>1){o-=1;break}o+=1}return o}class Ue extends de{static get className(){return"RasterLayer"}static getDefaultOptions(){return T(S({},de.getDefaultOptions()),{minLevel:0,maxLevel:18,tilingSchema:jt.GEOGRAPHIC,opacity:1,splitDirection:void 0})}constructor(e){e.url=e.url||"",super(e);const t=Ue.getDefaultOptions();this.extent=this.extent||new Me,this.tilingSchema=oa(e.tilingSchema,jt,t.tilingSchema),this.maxLevel=B(e.maxLevel,t.maxLevel),this._minLevel=B(e.minLevel,t.minLevel);const s=Fo(e);this.minLevel=Uu(this.extent,s,this.maxLevel,this._minLevel),this._opacity=Rr(e.opacity,t.opacity,0,1),this._splitDirection=J.NONE,e.splitDirection&&(this._splitDirection=e.splitDirection==="left"?J.LEFT:J.RIGHT),this.splitDirectionChanged=new I}get splitDirection(){return this._splitDirection}set splitDirection(e){e!==this._splitDirection&&(this._splitDirection=e,this.getImplementations().forEach(t=>{t.updateSplitDirection(e)}),this.splitDirectionChanged.raiseEvent(this._splitDirection))}get opacity(){return this._opacity}set opacity(e){const t=Rr(e,this._opacity,0,1);this._opacity!==t&&(this._opacity=t,this.getImplementations().forEach(s=>{s.updateOpacity(t)}))}getImplementationOptions(){const e=T(S({},super.getImplementationOptions()),{minLevel:this.minLevel,maxLevel:this.maxLevel,tilingSchema:this.tilingSchema,opacity:this.opacity,splitDirection:this._splitDirection});return this.extent.isValid()&&(e.extent=this.extent),e}toJSON(){const e=super.toJSON(),t=Ue.getDefaultOptions();return this.extent.equals(new Me)&&delete e.extent,this._minLevel!==t.minLevel&&(e.minLevel=this._minLevel),this.maxLevel!==t.maxLevel&&(e.maxLevel=this.maxLevel),this.tilingSchema!==t.tilingSchema&&(e.tilingSchema=this.tilingSchema),this.opacity!==t.opacity&&(e.opacity=this.opacity),this._splitDirection!==J.NONE&&(e.splitDirection=this._splitDirection===J.RIGHT?"right":"left"),e}destroy(){this.splitDirectionChanged.destroy(),super.destroy()}}ue.registerClass(Ue.className,Ue);class qu extends Oi{static get className(){return"TmsCesiumImpl"}constructor(e,t){super(e,t),this.format=t.format}getCesiumLayer(){const e={url:this.url,fileExtension:this.format,maximumLevel:this.maxLevel,minimumLevel:this.minLevel,show:!1};if(this.extent&&this.extent.isValid()){const r=this.extent.getCoordinatesInProjection(U);e.rectangle=Ye.fromDegrees(r[0],r[1],r[2],r[3])}this.tilingSchema===jt.GEOGRAPHIC&&(e.tilingScheme=new bl);const t=new Qf(e),s={alpha:this.opacity,splitDirection:this.splitDirection};return new ai(t,s)}}const mr=new Array(25);for(let i=0;i<mr.length;i++)mr[i]=200375083427892e-7*2/256/2**(i+1);function En(i){const e=Ye.southwest(i),t=Ye.northeast(i),s=[P.toDegrees(e.longitude),P.toDegrees(e.latitude)],r=[P.toDegrees(t.longitude),P.toDegrees(t.latitude)],n=Js(s),a=Js(r);return[...n,...a]}class Je extends ut{static get className(){return"TileProvider"}static getDefaultOptions(){return{tileCacheSize:50,baseLevels:[15],trackFeaturesToTiles:!0,allowTileAggregation:!0}}constructor(e){super(e);const t=Je.getDefaultOptions();this.tilingScheme=new Qn,this._tileCacheSize=B(e.tileCacheSize,t.tileCacheSize);const s=Array.isArray(e.baseLevels)?e.baseLevels.slice():t.baseLevels.slice();s.sort((r,n)=>n-r),this.baseLevels=[...new Set(s)],this.cache=new Map,this.baseLevels.forEach(r=>{this.cache.set(r,new Xd(this.tileCacheSize))}),this.rtreeCache=new Map,this.trackFeaturesToTiles=ae(e.trackFeaturesToTiles,t.trackFeaturesToTiles),this.allowTileAggregation=ae(e.allowTileAggregation,t.allowTileAggregation),this.featureIdToTileIds=new Map,this.tileLoadedEvent=new I,this._locale="en"}get tileCacheSize(){return this._tileCacheSize}get locale(){return this._locale}set locale(e){v(e,String),this._locale!==e&&(this._locale=e)}setTileCacheSize(e){const t=[];return this._tileCacheSize=e,this.cache.forEach((s,r)=>{for(s.setSize(this._tileCacheSize);s.canExpireCache();)t.push(this._removeLastTileFromCache(r))}),Promise.all(t)}_trackFeatures(e,t){this.trackFeaturesToTiles&&e.forEach(s=>{const r=s.getId();r&&(this.featureIdToTileIds.has(String(r))||this.featureIdToTileIds.set(String(r),new Set),this.featureIdToTileIds.get(String(r)).add(t))})}_unTrackFeatures(e,t){this.trackFeaturesToTiles&&e.forEach(s=>{const r=s.getId();if(r&&this.featureIdToTileIds.has(String(r))){const n=this.featureIdToTileIds.get(String(r));n.delete(t),n.size===0&&this.featureIdToTileIds.delete(String(r))}})}_addTilePromiseToCache(e,t,s){const r=e.then(n=>{n.forEach(o=>{o.getId()||o.setId(et())});const a=new Co(n.length);return a.load(n.map(o=>{const l=o.getGeometry();if(l){const h=l.getExtent();return{minX:h[0],minY:h[1],maxX:h[2],maxY:h[3],value:o}}return null}).filter(o=>o)),this.tileLoadedEvent.raiseEvent({tileId:s,rtree:a}),this._trackFeatures(n,s),this.rtreeCache.set(s,a),a}).catch(()=>{this.getLogger().warning(`Could not load Tile ${s}`);const n=new Co;return this.rtreeCache.set(s,n),n});return this.cache.get(t).set(s,r),this.cache.get(t).canExpireCache()?Promise.all([r,this._removeLastTileFromCache(t)]):r}_removeLastTileFromCache(e){const t=this.cache.get(e).peekLastKey(),s=this.cache.get(e).pop();if(s)return s.then(r=>{r&&(this.rtreeCache.delete(t),setTimeout(()=>{this._unTrackFeatures(r.all().map(n=>n.value),t),r.clear()},0))})}getBaseLevelForResolution(e,t){const s=e/Math.cos(t);let r=0;for(let a=0;a<mr.length&&(r=a,!(s>=mr[a]));a++);const n=this.getBaseLevel(r);return n===void 0?this.baseLevels[this.baseLevels.length-1]:n}getBaseLevel(e){return this.baseLevels.find(t=>e>=t)}getCacheKey(e,t,s){return`${s}/${e}/${t}`}async _getRtreeForBaseTile(e,t){const s=this.tilingScheme.positionToTileXY(t,e),r=this.getCacheKey(s.x,s.y,e);if(this.cache.has(e)){if(!this.cache.get(e).containsKey(r)){const n=this.loader(s.x,s.y,e);this._addTilePromiseToCache(n,e,r)}return this.cache.get(e).get(r)}return null}async getFeaturesByCoordinate(e,t){const s=Yd(e);rl(s,t,s);const r=va(e),n=se.fromDegrees(r[0],r[1]),a=this.getBaseLevelForResolution(t,n.latitude),o=await this._getRtreeForBaseTile(a,n);return o?o.search({minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}).map(h=>h.value):[]}async getFeaturesForTile(e,t,s){const r=this.tilingScheme.tileXYToRectangle(e,t,s),n=Ye.center(r),a=this.getBaseLevel(s);if(a!=null){const o=await this._getRtreeForBaseTile(a,n);if(o){if(s===a)return o.all().map(l=>l.value);{const l=En(r);return o.search({minX:l[0],minY:l[1],maxX:l[2],maxY:l[3]}).map(c=>c.value)}}}else if(this.allowTileAggregation&&this.baseLevels[this.baseLevels.length-1]-s<=2){const o=s+1,l=e*2,h=t*2;return[...await this.getFeaturesForTile(l,h,o),...await this.getFeaturesForTile(l+1,h,o),...await this.getFeaturesForTile(l+1,h+1,o),...await this.getFeaturesForTile(l,h+1,o)]}return[]}async getFeaturesForExtent(e,t){let s=t!=null?t:this.baseLevels[0];s=this.getBaseLevel(s);const[r,n,a,o]=e.getCoordinatesInProjection(U);this.tilingScheme.positionToTileXY(se.fromDegrees(r,o),s);const l=this.tilingScheme.positionToTileXY(se.fromDegrees(a,n),s),h=[];for(let{x:d}=topLeft;d<=l.x;d++)for(let{y:f}=topLeft;f<=l.y;f++)h.push([d,f]);const c=await Promise.all(h.map(([d,f])=>this.getFeaturesForTile(d,f,s))),u=e.getCoordinatesInProjection(R);return c.flat().filter(d=>{const f=d.getGeometry();return f&&f.intersectsExtent(u)})}forEachFeature(e){this.rtreeCache.forEach(t=>{t.all().map(s=>s.value).forEach(e)})}async loader(e,t,s){return[]}toJSON(){const e=super.toJSON(),t=Je.getDefaultOptions();return t.tileCacheSize!==this.tileCacheSize&&(e.tileCacheSize=this.tileCacheSize),this.baseLevels.length===t.baseLevels.length&&this.baseLevels.every(s=>t.baseLevels.includes(s))||(e.baseLevels=this.baseLevels.slice()),t.trackFeaturesToTiles!==this.trackFeaturesToTiles&&(e.trackFeaturesToTiles=this.trackFeaturesToTiles),t.allowTileAggregation!==this.allowTileAggregation&&(e.allowTileAggregation=this.allowTileAggregation),e}async clearCache(){const e=[];this.cache.forEach(t=>{t.forEach(s=>{e.push(s)}),t.clear()}),await Promise.all(e),this.rtreeCache.forEach(t=>{t.clear()}),this.rtreeCache.clear(),this.featureIdToTileIds.clear()}destroy(){super.destroy(),this.clearCache(),this.cache.clear(),this.isDestroyed=!0,this.tileLoadedEvent.destroy()}}ui.registerClass(Je.className,Je);class K1 extends Zd{constructor(e,t,s,r,n,a,o,l=1){super(e,t,s,r,n,a,o),this.scaleY=l,this.scaledImageScale_=[0,0],this.scaledTextScale_=[0,0]}get imageScale_(){return this.scaledImageScale_}set imageScale_(e){const t=e||[1,1];this.scaledImageScale_=[t[0],t[1]*this.scaleY]}get textScale_(){return this.scaledTextScale_}set textScale_(e){const t=e||[1,1];this.scaledTextScale_=[t[0],t[1]*this.scaleY]}moveToLineTo_(e,t,s,r,n){const a=this.context_,o=Kd(e,t,s,r,this.transform_,this.pixelCoordinates_);a.moveTo(o[0],o[1]);const{length:l}=o;for(let h=2;h<l;h+=2)a.lineTo(o[h],o[h+1]);return n&&a.closePath(),s}drawCircle(e){if(!!Jd(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=Qd(e,this.transform_,this.pixelCoordinates_),s=t[2]-t[0],r=t[3]-t[1],n=Math.sqrt(s*s+r*r),a=this.context_;a.beginPath(),a.ellipse(t[0],t[1],n,n*this.scaleY,0,0,2*Math.PI),this.fillState_&&a.fill(),this.strokeState_&&a.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}}function Wu(i,e,t,s){const{canvas:r}=t;r.width=s[0],r.height=s[1],r.style.width=`${s[0]}px`,r.style.height=`${s[1]}px`;const n=(i[2]-i[0])/(i[3]-i[1]),a=1/((i[2]-i[0])/256),o=-1/((i[3]-i[1])/256),l=ef(tf(),1,1),h=sf(l,128,128,a,o,0,-e[0],-e[1]);return new K1(t,1,i,h,0,null,null,n)}function Xu(i,e,t,s){const r=document.createElement("canvas");r.width=s[0],r.height=s[0];const n=Js([P.toDegrees(t.longitude),P.toDegrees(t.latitude)]),a=Wu(e,n,r.getContext("2d"),s);return i.forEach(o=>{o.getStyleFunction()(o,1).forEach(c=>{a.drawFeature(o,c)})}),r}class Yu{constructor(e){this.tileProvider=e.tileProvider,this._tilingScheme=this.tileProvider.tilingScheme,this._tileSize=e.tileSize,this._errorEvent=new eg,this._readyPromise=Promise.resolve(!0),this.emptyCanvas=document.createElement("canvas"),this.emptyCanvas.width=this.tileWidth,this.emptyCanvas.height=this.tileHeight,this.minLevel=0,this.maxLevel=26,this._reload=void 0,this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0}get ready(){return!0}get readyPromise(){return this._readyPromise}get rectangle(){return this._tilingScheme.rectangle}get tileWidth(){return this._tileSize[0]}get tileHeight(){return this._tileSize[1]}get maximumLevel(){return this.maxLevel}get minimumLevel(){return this.minLevel}get tilingScheme(){return this._tilingScheme}get tileDiscardPolicy(){}get errorEvent(){return this._errorEvent}get credit(){}get proxy(){}get hasAlphaChannel(){return!0}async requestImage(e,t,s){const r=await this.tileProvider.getFeaturesForTile(e,t,s);if(r.length===0)return this.emptyCanvas;const n=this.tileProvider.tilingScheme.tileXYToRectangle(e,t,s),a=En(n),o=Ye.center(n);return Xu(r,a,o,this._tileSize)}}class Zu extends Oi{static get className(){return"VectorRasterTileCesiumImpl"}constructor(e,t){const s=T(S({},t),{tilingSchema:"mercator",splitDirection:void 0,opacity:void 0});super(e,s),this.tileProvider=t.tileProvider,this.tileSize=t.tileSize,this._reloadTimeout=null,this.imageryProvider=null}getCesiumLayer(){this.imageryProvider=new Yu({tileProvider:this.tileProvider,tileSize:this.tileSize});const e={alpha:this.opacity,splitDirection:this.splitDirection,minimumTerrainLevel:this.minLevel,maximumTerrainLevel:this.maxLevel};if(this.extent&&this.extent.isValid()){const s=this.extent.getCoordinatesInProjection(U);e.rectangle=Ye.fromDegrees(s[0],s[1],s[2],s[3])}return new ai(this.imageryProvider,e)}_reloadTiles(){window.clearTimeout(this._reloadTimeout),this.imageryProvider&&this.imageryProvider._reload&&(this._reloadTimeout=window.setTimeout(()=>{this.imageryProvider._reload(),this._reloadTimeout=null}))}updateTiles(e){e.length>0&&this._reloadTiles()}updateStyle(e,t){this._reloadTiles()}}class Ku extends Oi{static get className(){return"WmsCesiumImpl"}constructor(e,t){super(e,t),this.parameters=t.parameters,this.highResolution=t.highResolution,this.tileSize=t.tileSize}getCesiumLayer(){const e=S({},this.parameters);this.highResolution&&(e.width=this.tileSize[0]*2,e.height=this.tileSize[1]*2);const t={url:this.url,layers:e.LAYERS,minimumLevel:this.minLevel,maximumLevel:this.maxLevel,show:!1,parameters:e,tileWidth:this.tileSize[0],tileHeight:this.tileSize[1]};if(this.extent&&this.extent.isValid()){const n=this.extent.getCoordinatesInProjection(U);n&&(t.rectangle=Ye.fromDegrees(n[0],n[1],n[2],n[3]))}this.tilingSchema==="mercator"&&(t.tilingScheme=new Qn);const s=new tg(t),r={alpha:this.opacity,splitDirection:this.splitDirection};return new ai(s,r)}}class Ju extends Oi{static get className(){return"WmtsCesiumImpl"}constructor(e,t){super(e,t),this.layer=t.layer,this.style=t.style,this.format=t.format,this.tileMatrixSetID=t.tileMatrixSetID,this.tileSize=t.tileSize,this.numberOfLevelZeroTilesX=t.numberOfLevelZeroTilesX,this.numberOfLevelZeroTilesY=t.numberOfLevelZeroTilesY,this.matrixIds=t.matrixIds}getCesiumLayer(){const e=this.url.indexOf("{Layer}")!==-1?this.url.replace("{Layer}",this.layer):this.url,t=this.extent.getCoordinatesInProjection(U),s={url:e,layer:this.layer,style:this.style,format:this.format,tileMatrixSetID:this.tileMatrixSetID,maximumLevel:this.maxLevel,rectangle:Ye.fromDegrees(t[0],t[1],t[2],t[3]),tileWidth:this.tileSize[0],tileHeight:this.tileSize[1]};s.tilingScheme=Fo({tilingSchema:this.tilingSchema,numberOfLevelZeroTilesX:this.numberOfLevelZeroTilesX,numberOfLevelZeroTilesY:this.numberOfLevelZeroTilesY}),s.tileMatrixLabels=this.matrixIds;const r=new ig(s),n={alpha:this.opacity,splitDirection:this.splitDirection};return new ai(r,n)}}function Qu(i){const e=i.getPropertyIds(),t={};for(let s=0;s<e.length;s++)t[e[s]]=i.getProperty(e[s]);return t.id==null&&(t.id=`${i.content.url}${i._batchId}`),t.attributes?t.attributes.gmlId=t.id:t.gmlId==null&&(t.gmlId=t.id),t.clickedPosition=i.clickedPosition?i.clickedPosition:{},t}function pr(){const i=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(i.substr(0,4))}class Ot extends bt{static get className(){return"CesiumTilesetLayer"}static getDefaultOptions(){return T(S({},bt.getDefaultOptions()),{highlightStyle:void 0,screenSpaceError:16,screenSpaceErrorMobile:32,maximumMemoryUsage:16,tilesetOptions:{},splitDirection:void 0,offset:void 0})}constructor(e){super(e),this._supportedMaps=[z.className];const t=Ot.getDefaultOptions();this.url&&!/\.json$/.test(this.url)&&(this.url=`${this.url.replace(/\/$/,"")}/tileset.json`),this.highlightStyle=null,e.highlightStyle&&(this.highlightStyle=e.highlightStyle instanceof W?e.highlightStyle:new W(e.highlightStyle)),this.screenSpaceError=B(e.screenSpaceError,t.screenSpaceError),this.screenSpaceErrorMobile=B(e.screenSpaceErrorMobile,t.screenSpaceErrorMobile),this.maximumMemoryUsage=B(e.maximumMemoryUsage,t.maximumMemoryUsage);const s=e.tilesetOptions||t.tilesetOptions;this.tilesetOptions=S({url:this.url,maximumScreenSpaceError:pr()?this.screenSpaceErrorMobile:this.screenSpaceError,maximumMemoryUsage:this.maximumMemoryUsage},s),this._splitDirection=J.NONE,e.splitDirection&&(this._splitDirection=e.splitDirection==="left"?J.LEFT:J.RIGHT),this.splitDirectionChanged=new I,this._modelMatrix=void 0,this._offset=e.offset||t.offset}get modelMatrix(){return this._modelMatrix}set modelMatrix(e){re(e,k),this._modelMatrix=e,this.getImplementations().forEach(t=>{t.updateModelMatrix(e)})}get offset(){return this._offset}set offset(e){re(e,[Number]),this._offset=e,this.getImplementations().forEach(t=>{t.updateOffset(e)})}get splitDirection(){return this._splitDirection}set splitDirection(e){e!==this._splitDirection&&(this.getImplementations().forEach(t=>{t.updateSplitDirection(e)}),this._splitDirection=e,this.splitDirectionChanged.raiseEvent(this._splitDirection))}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{tilesetOptions:this.tilesetOptions,splitDirection:this.splitDirection,modelMatrix:this.modelMatrix,offset:this.offset})}createImplementationsForMap(e){return e instanceof z?[new ii(e,this.getImplementationOptions())]:[]}objectClickedHandler(e){if(this.allowPicking){const t=Qu(e);if(t)return{id:t.id,feature:t}}return null}getZoomToExtent(){const e=super.getZoomToExtent();if(e)return e;const t=this.getImplementations()[0];if(t){const s=Do(t.cesium3DTileset),r=new Me({projection:R.toJSON(),coordinates:s});if(r.isValid())return r}return null}getGenericFeatureFromClickedObject(e){const t=S(S({},this.genericFeatureProperties),e.attributes||e);return{layerName:this.name,layerClass:this.className,attributes:t,longitude:e.clickedPosition.longitude,latitude:e.clickedPosition.latitude,height:e.clickedPosition.height+this.balloonHeightOffset,relativeToGround:!1}}setMaximumScreenSpaceError(e){this.getImplementations().forEach(t=>{t.cesium3DTileset&&(t.cesium3DTileset.maximumScreenSpaceError=e)})}toJSON(){const e=super.toJSON(),t=Ot.getDefaultOptions();this.highlightStyle&&(e.highlightStyle=this.highlightStyle.toJSON()),this.screenSpaceError!==t.screenSpaceError&&(e.screenSpaceError=this.screenSpaceError),this.screenSpaceErrorMobile!==t.screenSpaceErrorMobile&&(e.screenSpaceErrorMobile=this.screenSpaceErrorMobile),this.maximumMemoryUsage!==t.maximumMemoryUsage&&(e.maximumMemoryUsage=this.maximumMemoryUsage);const s=S({},this.tilesetOptions);s.url===this.url&&delete s.url;const r=pr()?this.screenSpaceErrorMobile:this.screenSpaceError;return s.maximumScreenSpaceError===r&&delete s.maximumScreenSpaceError,s.maximumMemoryUsage===this.maximumMemoryUsage&&delete s.maximumMemoryUsage,Object.keys(s).length>0&&(e.tilesetOptions=s),this._splitDirection!==J.NONE&&(e.splitDirection=this._splitDirection===J.RIGHT?"right":"left"),Array.isArray(this.offset)&&(e.offset=this.offset.slice()),e}destroy(){super.destroy(),this.splitDirectionChanged.destroy()}}ue.registerClass(Ot.className,Ot);class Fi extends de{static get className(){return"DataSourceLayer"}static getDefaultOptions(){return T(S({},de.getDefaultOptions()),{genericFeatureProperties:{}})}constructor(e){super(e);const t=Fi.getDefaultOptions();this.entities=new sg,this.clock=void 0,this._genericFeatureProperties=e.genericFeatureProperties||t.genericFeatureProperties,this.featureVisibility=new nn,this._featureVisibilityListeners=[],this._supportedMaps=[z.className]}setGlobalHider(e){super.setGlobalHider(e),this._setUpFeatureVisibility()}_setUpFeatureVisibility(){this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[this.featureVisibility.changed.addEventListener(({action:e,ids:t})=>{e===X.HIDE&&t.forEach(s=>{const r=this.entities.getById(s);r&&this.featureVisibility.addHiddenFeature(s,r)})}),this.entities.collectionChanged.addEventListener((e,t)=>{t.forEach(s=>{this.featureVisibility.hiddenObjects[s.id]&&this.featureVisibility.addHiddenFeature(s.id,s),this.globalHider&&this.globalHider.hiddenObjects[s.id]&&this.globalHider.addFeature(s.id,s)})})],this.globalHider&&this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({action:e,ids:t})=>{e===X.HIDE&&t.forEach(s=>{const r=this.entities.getById(s);r&&this.globalHider.addFeature(s,r)})}))}initialize(){return this.initialized||this._setUpFeatureVisibility(),super.initialize()}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{entities:this.entities,clock:this.clock})}createImplementationsForMap(e){return e instanceof z?[new Hu(e,this.getImplementationOptions())]:[]}addEntity(e,t,s){const r=this.entities.add(e);return r[j]=this.name,r.attributes=t,r.allowPicking=s,r.id}flyToEntity(e){this.getImplementations().forEach(t=>{t.flyToEntity(e)})}removeEntityById(e){this.entities.removeById(e)}objectClickedHandler(e){if(this.allowPicking&&e.id.allowPicking!==!1){const t=e.id,{id:s}=t;return t.clickedPosition=e.clickedPosition,{id:s,feature:e}}return null}getGenericFeatureFromClickedObject(e){const t=S(S({},this._genericFeatureProperties),e.attributes||{});return{layerName:this.name,layerClass:this.className,attributes:t,longitude:e.clickedPosition.longitude,latitude:e.clickedPosition.latitude,height:e.clickedPosition.height,relativeToGround:!1}}toJSON(){const e=super.toJSON();return Object.keys(this._genericFeatureProperties).length>0&&(e.genericFeatureProperties=S({},this._genericFeatureProperties)),e}destroy(){this.entities.removeAll(),this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[],this.featureVisibility.destroy(),super.destroy()}}ue.registerClass(Fi.className,Fi);class vr extends Fi{static get className(){return"CzmlLayer"}static getDefaultOptions(){return T(S({},Fi.getDefaultOptions()),{sourceUri:void 0})}constructor(e){super(e),this.dataSource=new rg,this.entities=this.dataSource.entities;const t=vr.getDefaultOptions();this.sourceUri=e.sourceUri||t.sourceUri,this._loadedResolve=()=>{},this._loadedReject=()=>{},this.loaded=new Promise((s,r)=>{this._loadedResolve=s,this._loadedReject=r})}initialize(){return this._initializedPromise||(this._initializedPromise=this._loadData().then(()=>super.initialize()).then(()=>{this._loadedResolve()}).catch(e=>{this._loadedReject(e)})),this._initializedPromise}async _loadData(){await this.dataSource.load(this.url,this.sourceUri?{sourceUri:this.sourceUri}:void 0),this.entities.values.forEach(e=>{e[j]=this.name}),this.clock=this.dataSource.clock}async reload(){this.entities.removeAll(),await this._loadData(),await this.forceRedraw()}toJSON(){const e=super.toJSON();return this.sourceUri&&(e.sourceUri=this.sourceUri),e}destroy(){super.destroy(),this.dataSource._entityCluster.destroy(),this.dataSource._entityCluster=null,this.dataSource._entityCollection=null,this.dataSource._changed=null,this.dataSource._error=null,this.dataSource._loading=null,this.dataSource=null}}ue.registerClass(vr.className,vr);function J1(i,e,t){const s=[];return i.forEach(r=>{const n=ds(r,{writeStyle:!0});s.push({action:"add",feature:n,original:r,success(a){r.setId(a),r[rt]=bi.DYNAMIC}})}),e.forEach(r=>{const n=ds(r,{writeStyle:!0});n._id=r.getId(),n.geomety="test",s.push({action:"edit",original:r,feature:n,success(){r[rt]===bi.STATIC&&(r[rt]=bi.EDITED)}})}),t.forEach(r=>{const n=r.getId();s.push({original:r,action:"remove",feature:{_id:n},success(){}})}),s}class ed extends ut{static get className(){return"FeatureStoreLayerChanges"}constructor(e){super({}),this.layer=e,this._changesListeners={addfeature:null,changefeature:null,removefeature:null},this._addedFeatures=new Set,this._editedFeatures=new Set,this._removedFeatures=new Set,this._convertedFeatures=new Set,this.values={changed:!1}}get active(){return Object.values(this._changesListeners).some(e=>e!==null)}track(){this._changesListeners.addfeature===null&&(this._changesListeners.addfeature=this.layer.source.on("addfeature",this._featureAdded.bind(this))),this._changesListeners.changefeature===null&&(this._changesListeners.changefeature=this.layer.source.on("changefeature",this._featureChanged.bind(this))),this._changesListeners.removefeature===null&&(this._changesListeners.removefeature=this.layer.source.on("removefeature",this._featureRemoved.bind(this)))}getChanges(){return{add:[...this._addedFeatures],edit:[...this._editedFeatures],remove:[...this._removedFeatures]}}async commitChanges(e,t={}){const s=J1(this._addedFeatures,this._editedFeatures,this._removedFeatures);if(s.length>0){const r=await xt(e.toString(),{method:"POST",headers:T(S({},t),{"Content-Type":"application/json"}),body:JSON.stringify(s.map(a=>({action:a.action,feature:a.feature})))}),n=r.failedActions.map(({index:a,error:o})=>{const l=s[a];return this.getLogger().log(`failed action ${l.action}: ${o}`),s[a]=null,this._resetFeature(l.original)});s.filter(a=>a).forEach(({action:a,success:o})=>{a==="add"?o(r.insertedIds.shift()._id):o()}),await Promise.all(n)}else{try{await Promise.all([...this._convertedFeatures].map(async r=>{await this._resetFeature(r)}))}catch(r){this.getLogger().error(r.message)}this._resetValues()}}async reset(){const e=[];return this._addedFeatures.forEach(t=>{e.push(this._resetFeature(t))}),this._editedFeatures.forEach(t=>{e.push(this._resetFeature(t))}),this._removedFeatures.forEach(t=>{e.push(this._resetFeature(t))}),this._convertedFeatures.forEach(t=>{e.push(this._resetFeature(t))}),Promise.all(e).then(()=>{this._resetValues()}).catch(t=>{this.getLogger().error(t),this._resetValues()})}_resetFeature(e){const t=e.getId(),s=[t];return e[rt]?e[rt]===bi.STATIC?(this.layer.resetStaticFeature(t),Promise.resolve()):this.layer.injectedFetchDynamicFeatureFunc(t).then(r=>{const{features:n}=zt(r);this.layer.removeFeaturesById(s),this.layer.addFeatures(n)}).catch(r=>{this.getLogger().error("failed to reset feature, giving up",r.message)}):(this.layer.removeFeaturesById(s),Promise.resolve())}_resetValues(){this._addedFeatures.clear(),this._editedFeatures.clear(),this._removedFeatures.clear(),this._convertedFeatures.clear(),this.values.changed=!1}unTrack(){Ce(Object.values(this._changesListeners)),this._changesListeners.addfeature=null,this._changesListeners.changefeature=null,this._changesListeners.removefeature=null,this._resetValues()}pauseTracking(e){this._changesListeners[e]&&(Ce(this._changesListeners[e]),this._changesListeners[e]=null)}_featureAdded(e){const{feature:t}=e;t[rt]?t[rt]===bi.STATIC&&(this._convertedFeatures.add(t),this.values.changed=!0):(this._addedFeatures.add(t),this.values.changed=!0)}_featureChanged(e){const{feature:t}=e;t[rt]&&(this._convertedFeatures.delete(t),this._editedFeatures.add(t),this.values.changed=!0)}_featureRemoved(e){const{feature:t}=e;t[rt]?(this._removedFeatures.add(t),this._editedFeatures.delete(t),this._convertedFeatures.delete(t),this.values.changed=!0):this._addedFeatures.delete(t)}removeFeature(e){v(e,Z),this._featureRemoved({feature:e})}addFeature(e){v(e,Z),this._featureAdded({feature:e})}editFeature(e){v(e,Z),this._featureChanged({feature:e})}destroy(){this.unTrack(),this.layer=null,super.destroy()}}const In=Symbol("isTiledFeature");class _s extends ce{static get className(){return"FeatureStoreLayer"}static getDefaultOptions(){return T(S({id:"",type:"FeatureStoreLayer",featureType:"simple",features:[]},ce.getDefaultOptions()),{projection:R.toJSON(),staticRepresentation:{},hiddenStaticFeatureIds:[],vcsMeta:{screenSpaceError:4,altitudeMode:"clampToGround"}})}constructor(e){const t=_s.getDefaultOptions(),s=S({projection:t.projection},e);super(s),this._supportedMaps=[z.className,ie.className,pe.className],this.hasFeatureUUID=!0,this.layerId=e.id,this.staticRepresentation=e.staticRepresentation||t.staticRepresentation,this.hiddenStaticFeatureIds=new Set(e.hiddenStaticFeatureIds||t.hiddenStaticFeatureIds),this.changeTracker=new ed(this);const{vcsMeta:r}=t;if(e.vcsMeta&&Object.assign(r,e.vcsMeta),this.vcsMeta=r,this.setVcsMeta(this.vcsMeta),this.screenSpaceErrorMobile=this.vcsMeta.screenSpaceError,this.screenSpaceError=this.vcsMeta.screenSpaceError,this._removeVectorPropertiesChangeHandler=this.vectorProperties.propertyChanged.addEventListener(()=>{this.changeTracker.values.changed=!0}),this.injectedFetchDynamicFeatureFunc=e.injectedFetchDynamicFeatureFunc,this._staticFeatureVisibility=new nn,this._featureVisibilitySyncListeners=[kh(this.featureVisibility,this._staticFeatureVisibility),this._staticFeatureVisibility.changed.addEventListener(({action:n})=>{n===X.SHOW&&this._staticFeatureVisibility.hideObjects([...this.hiddenStaticFeatureIds])})],this._setEditing=null,this._twoDimLoaded=null,this._twoDimStyleChanged=null,this._twoDimStaticSource=new Ns,e.features){const n={type:"FeatureCollection",features:e.features,vcsMeta:e.vcsMeta},{style:a,features:o}=zt(n,{targetProjection:R,dynamicStyle:!0});a&&(this._defaultStyle=a,this.setStyle(a)),this.addFeatures(o)}}initialize(){return this.initialized?super.initialize():super.initialize().then(()=>{this._staticFeatureVisibility.hideObjects([...this.hiddenStaticFeatureIds])})}_loadTwoDim(){return this._twoDimLoaded||(this._twoDimLoaded=(async()=>{const e=await xt(this.staticRepresentation.twoDim),{features:t}=zt(e,{targetProjection:R,dynamicStyle:!0}),s=this.style instanceof Oe;t.forEach(r=>{r[de.vcsLayerNameSymbol]=this.name,r[In]=!0,s&&r[Ae]&&r.setStyle(),this._setEditing&&this._setEditing.featureType!=null&&(r[this._setEditing.symbol]=this._setEditing.featureType)}),this._twoDimStaticSource.addFeatures(t)})()),this._twoDimLoaded}_getTwoDimStaticImplOptions(){return T(S({},super.getImplementationOptions()),{source:this._twoDimStaticSource,featureVisibility:this._staticFeatureVisibility})}createImplementationsForMap(e){const t=super.createImplementationsForMap(e);return e instanceof z&&this.staticRepresentation&&this.staticRepresentation.threeDim?t.push(new ii(e,{url:this.staticRepresentation.threeDim,tilesetOptions:{maximumScreenSpaceError:pr()?this.screenSpaceErrorMobile:this.screenSpaceError,url:this.staticRepresentation.threeDim},tilesetProperties:[{key:In,value:!0}],name:this.name,style:this.style,featureVisibility:this._staticFeatureVisibility,globalHider:this.globalHider,splitDirection:J.NONE,jumpToLocation:!1})):this.staticRepresentation&&this.staticRepresentation.twoDim&&(this._loadTwoDim(),e instanceof ie?t.push(new Ka(e,this._getTwoDimStaticImplOptions())):e instanceof pe&&t.push(new po(e,this._getTwoDimStaticImplOptions()))),t}reload(){return this._twoDimLoaded=null,this._twoDimStaticSource.clear(),super.reload()}async activate(){await super.activate(),this.active&&this._setEditing&&this.setEditing(this._setEditing.symbol,this._setEditing.featureType)}_trackStyleChanges(){if(super._trackStyleChanges(),this.staticRepresentation.twoDim){this._twoDimStyleChanged&&(this._twoDimStyleChanged(),this._twoDimStyleChanged=null);const e=this.style instanceof Oe;this._twoDimStyleChanged=this.style.styleChanged.addEventListener(()=>{this._twoDimStaticSource.getFeatures().forEach(t=>{(e||!t[Ae])&&t.changed()})})}}setStyle(e,t){const s=this.changeTracker.active;s&&this.changeTracker.pauseTracking("changefeature"),super.setStyle(e,t);const r=this.style instanceof Oe;this._twoDimStaticSource.getFeatures().forEach(n=>{if(n[Ae]){let a;r?(a=!0,n.setStyle(void 0)):n.getStyle()!==n[Ae].style&&(a=!0,n.setStyle(n[Ae].style)),a&&Reflect.has(n,Ct)&&Na(n)}}),s&&(this.changeTracker.track(),this.changeTracker.values.changed=!0)}setEditing(e,t){this.getImplementations().forEach(s=>{s instanceof ii&&(s.initialized?(t!=null?s.cesium3DTileset[e]=t:delete s.cesium3DTileset[e],this._setEditing=null):this._setEditing={symbol:e,featureType:t})}),this.staticRepresentation.twoDim&&(this._twoDimLoaded?this._twoDimLoaded.then(()=>{this._twoDimStaticSource.getFeatures().forEach(s=>{t!=null?s[e]=t:delete s[e]})}):this._setEditing={symbol:e,featureType:t})}objectClickedHandler(e){return e instanceof qt||e instanceof Ut?Ot.prototype.objectClickedHandler.call(this,e):e instanceof Z?super.objectClickedHandler(e):null}getGenericFeatureFromClickedObject(e){if(e instanceof Z)return super.getGenericFeatureFromClickedObject(e);const t=Ot.prototype.getGenericFeatureFromClickedObject.call(this,e);return t.layerName=this.name,t.layerClass=this.className,t}getZoomToExtent(){if(this.extent&&this.extent.isValid())return this.extent;const e=super.getZoomToExtent(),t=e?e.getCoordinatesInProjection(R):hl();if(this.staticRepresentation.threeDim){const r=this.getImplementations().find(n=>n instanceof ii&&n.cesium3DTileset);if(r){const n=Do(r.cesium3DTileset);cl(t,n)}}this.staticRepresentation.twoDim&&this._twoDimLoaded&&cl(t,this._twoDimStaticSource.getExtent());const s=new Me({projection:R.toJSON(),coordinates:t});return s.isValid()?s:null}setMaximumScreenSpaceError(e){pr()?this.screenSpaceErrorMobile=e:this.screenSpaceError=e,this.getImplementations().forEach(t=>{t instanceof ii&&t.cesium3DTileset&&(t.cesium3DTileset.maximumScreenSpaceError=e)})}switchStaticFeatureToDynamic(e){return this.hiddenStaticFeatureIds.has(e)?Promise.resolve(this.getFeatureById(e)):this.injectedFetchDynamicFeatureFunc?this.injectedFetchDynamicFeatureFunc(e).then(t=>{const{features:s}=zt(t,{targetProjection:R,defaultStyle:this.defaultStyle instanceof W?this.defaultStyle:mi});return this._staticFeatureVisibility.hideObjects([e]),this.hiddenStaticFeatureIds.add(e),this.addFeatures(s),s[0]}).catch(t=>{this.getLogger().error(t.message)}):Promise.reject(new Error("no injected fetching function"))}removeStaticFeature(e){this._staticFeatureVisibility.hideObjects([e]),this.hiddenStaticFeatureIds.add(e);const t=new Z;t.setId(e),t[rt]=bi.STATIC,this.changeTracker.removeFeature(t)}resetStaticFeature(e){if(this.hiddenStaticFeatureIds.has(e)){const t=[e];this.removeFeaturesById(t),this.hiddenStaticFeatureIds.delete(e),this.featureVisibility.hiddenObjects[e]||this._staticFeatureVisibility.showObjects(t)}}toJSON(){const e=super.toJSON(),t=_s.getDefaultOptions();return delete e.projection,e.vcsMeta=this.vectorProperties.getVcsMeta(S(S({},nt.getDefaultOptions()),t.vcsMeta)),Object.keys(e.vcsMeta).length===0&&delete e.vcsMeta,this.vcsMeta.screenSpaceError!==t.vcsMeta.screenSpaceError&&(e.vcsMeta=e.vcsMeta||{},e.vcsMeta.screenSpaceError=this.vcsMeta.screenSpaceError),Object.keys(this.staticRepresentation).length>0&&(e.staticRepresentation=S({},this.staticRepresentation)),this.hiddenStaticFeatureIds.size>0&&(e.hiddenStaticFeatureIds=[...this.hiddenStaticFeatureIds]),e}destroy(){this.removeAllFeatures(),this._twoDimStaticSource.clear(),this._twoDimStyleChanged&&(this._twoDimStyleChanged(),this._twoDimStyleChanged=null),this._featureVisibilitySyncListeners.forEach(e=>{e()}),this._featureVisibilitySyncListeners=[],this._staticFeatureVisibility.destroy(),this.changeTracker.destroy(),this._removeVectorPropertiesChangeHandler&&this._removeVectorPropertiesChangeHandler(),super.destroy()}}ue.registerClass(_s.className,_s);const Pn=Symbol("featureFromOptions");class vs extends ce{static get className(){return"GeoJSONLayer"}static getDefaultOptions(){return T(S({},ce.getDefaultOptions()),{projection:U.toJSON(),features:void 0})}constructor(e){const t=vs.getDefaultOptions();e.projection=e.projection||t.projection,super(e),this._dataFetchedPromise=null,this._featuresToLoad=e.features||t.features}async initialize(){return this.initialized||await this.fetchData(),super.initialize()}async reload(){if(this._dataFetchedPromise){const e=this.getFeatures().filter(t=>t[Pn]);this.removeAllFeatures(),this.source.addFeatures(e),this._dataFetchedPromise=null,await this.fetchData()}return super.reload()}fetchData(){return this._dataFetchedPromise?this._dataFetchedPromise:(Array.isArray(this._featuresToLoad)&&(this._parseGeojsonData({type:"FeatureCollection",features:this._featuresToLoad}),this.getFeatures().forEach(e=>{e[Pn]=!0}),this._featuresToLoad.splice(0),this._featuresToLoad=void 0),this.url?this._dataFetchedPromise=xt(this.url).then(e=>this._parseGeojsonData(e)).catch(e=>(this.getLogger().warning(`Could not send request for loading layer content (${e.message})`),Promise.reject(e))):this._dataFetchedPromise=Promise.resolve(),this._dataFetchedPromise)}_parseGeojsonData(e){const t=zt(e,{dataProjection:this.projection,dynamicStyle:!0});if(this.addFeatures(t.features),t.style&&this.setStyle(t.style),t.vcsMeta){const s=S(S({},t.vcsMeta),this.vectorProperties.getVcsMeta());this.setVcsMeta(s)}}toJSON(){const e=super.toJSON(),t=vs.getDefaultOptions(),s=new D(t.projection);if(this.projection.equals(s)?delete e.projection:e.projection=this.projection.toJSON(),Array.isArray(this._featuresToLoad))e.features=this._featuresToLoad.slice();else{const r=this.getFeatures().filter(n=>n[Pn]);r.length>0&&(e.features=r.map(n=>ds(n,{writeStyle:!0,writeId:!0})))}return e}destroy(){super.destroy(),this._featuresToLoad=void 0}}ue.registerClass(vs.className,vs);class fs extends nr{static get className(){return"RasterLayerOpenlayersImpl"}constructor(e,t){super(e,t),this.splitDirection=t.splitDirection,this.minLevel=t.minLevel,this.maxLevel=t.maxLevel,this.tilingSchema=t.tilingSchema,this.extent=t.extent,this.opacity=t.opacity,this._splitDirectionRenderListeners=null}initialize(){return super.initialize().then(()=>{this.updateSplitDirection(this.splitDirection)})}updateOpacity(e){this.opacity=e,this.initialized&&this.olLayer.setOpacity(this.opacity)}updateSplitDirection(e){this.splitDirection=e,this.initialized&&(this.splitDirection===J.NONE&&this._splitDirectionRenderListeners?(Ce(this._splitDirectionRenderListeners),this._splitDirectionRenderListeners=null,this.olLayer.changed()):e!==J.NONE&&!this._splitDirectionRenderListeners&&(this._splitDirectionRenderListeners=[],this._splitDirectionRenderListeners.push(this.olLayer.on("prerender",this._splitPreCompose.bind(this))),this._splitDirectionRenderListeners.push(this.olLayer.on("postrender",t=>{t.context.restore()})),this.olLayer.changed()))}_splitPreCompose(e){if(!this.map.splitScreen)return;const t=e.context,s=t.canvas.width*this.map.splitScreen.position;t.save(),t.beginPath(),this.splitDirection===J.LEFT?t.rect(0,0,s,t.canvas.height):t.rect(s,0,t.canvas.width-s,t.canvas.height),t.clip()}destroy(){this._splitDirectionRenderListeners&&(Ce(this._splitDirectionRenderListeners),this._splitDirectionRenderListeners=null),super.destroy()}}class td extends fs{static get className(){return"OpenStreetMapOpenlayersImpl"}getOLLayer(){return new Ri({opacity:this.opacity,source:new rf({maxZoom:this.maxLevel})})}}class Ss extends de{static get className(){return"OpenStreetMapLayer"}static getDefaultOptions(){return T(S({},de.getDefaultOptions),{splitDirection:void 0,opacity:1,maxLevel:19})}constructor(e){super(e);const t=Ss.getDefaultOptions();this._splitDirection=J.NONE,e.splitDirection&&(this._splitDirection=e.splitDirection==="left"?J.LEFT:J.RIGHT),this._supportedMaps=[z.className,ie.className],this._opacity=Rr(e.opacity,t.opacity,0,1),this.splitDirectionChanged=new I,this.maxLevel=B(e.maxLevel,t.maxLevel)}get splitDirection(){return this._splitDirection}set splitDirection(e){e!==this._splitDirection&&(this._splitDirection=e,this.getImplementations().forEach(t=>{t.updateSplitDirection(this._splitDirection)}),this.splitDirectionChanged.raiseEvent(this._splitDirection))}get opacity(){return this._opacity}set opacity(e){const t=Rr(e,this._opacity,0,1);this._opacity!==t&&(this._opacity=t,this.getImplementations().forEach(s=>{s.updateOpacity(t)}))}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{opacity:this.opacity,splitDirection:this.splitDirection,minLevel:0,maxLevel:this.maxLevel,tilingSchema:""})}createImplementationsForMap(e){return e instanceof ie?[new td(e,this.getImplementationOptions())]:e instanceof z?[new $u(e,this.getImplementationOptions())]:[]}toJSON(){const e=super.toJSON(),t=Ss.getDefaultOptions();return this._splitDirection!==J.NONE&&(e.splitDirection=this._splitDirection===J.RIGHT?"right":"left"),this.opacity!==t.opacity&&(e.opacity=this.opacity),this.maxLevel!==t.maxLevel&&(e.maxLevel=this.maxLevel),e}destroy(){this.splitDirectionChanged.destroy(),super.destroy()}}ue.registerClass(Ss.className,Ss);class id extends fs{static get className(){return"SingleImageOpenlayersImpl"}constructor(e,t){super(e,t),this.credit=t.credit}getOLLayer(){const e={attributions:this.credit,url:this.url,projection:"EPSG:4326",imageExtent:this.extent.getCoordinatesInProjection(U)};return gr(this.url)||(e.crossOrigin="anonymous"),new nf({source:new af(e),opacity:this.opacity})}}class Q1 extends nr{static get className(){return"TileDebugOpenlayersImpl"}getOLLayer(){return new Ri({source:new of})}updateStyle(e,t){}updateTiles(e){}}class sd extends fs{static get className(){return"TmsOpenlayersImpl"}constructor(e,t){super(e,t),this.format=t.format,this.tileSize=t.tileSize}getOLLayer(){const e={tileUrlFunction:s=>{const r=this.url.replace(/\/$/,""),n=(1<<s[0])-s[2]-1;return`${r}/${s[0]}/${s[1]}/${n}.${this.format}`},tileSize:this.tileSize,minZoom:this.minLevel,maxZoom:this.maxLevel,wrapX:!1};gr(this.url)||(e.crossOrigin="anonymous"),this.tilingSchema===jt.GEOGRAPHIC&&(e.projection="EPSG:4326");const t={source:new lf(e),opacity:this.opacity};return this.extent&&this.extent.isValid()&&(t.extent=this.extent.getCoordinatesInProjection(R)),new Ri(t)}}class rd extends nr{static get className(){return"VectorTileOpenlayersImpl"}constructor(e,t){super(e,t),this.tileProvider=t.tileProvider,this.source=null,this.tileSize=t.tileSize,this._tilesToUpdate=new Set,this._reloadTimeout=null,this.minLevel=t.minLevel,this.maxLevel=t.maxLevel,this.extent=t.extent}getOLLayer(){this.source=new hf({minZoom:0,maxZoom:26,tileSize:this.tileSize,tileLoadFunction:async n=>{const a=await this.tileProvider.getFeaturesForTile(n.tileCoord[1],n.tileCoord[2],n.tileCoord[0]);a.length>0?n.setFeatures(a):(n.setFeatures([]),n.setState(cf.EMPTY))},url:"/{z}/{x}/{y}"});const e=this.extent&&this.extent.isValid()?this.extent.getCoordinatesInProjection(R):void 0,t=this.minLevel?this.minLevel:void 0,s=this.maxLevel?this.maxLevel+1:void 0;return new uf({visible:!1,source:this.source,renderBuffer:200,renderMode:"hybrid",declutter:!0,extent:e,minZoom:t,maxZoom:s})}updateTiles(e){e.length>0&&(e.forEach(t=>{this._tilesToUpdate.add(t)}),this.source&&(this._reloadTimeout||(this._reloadTimeout=window.setTimeout(()=>{this._tilesToUpdate.forEach(t=>{const{tileCache:s}=this.source;if(s.containsKey(t)){const r=s.get(t);r.key=!1}}),this.source.changed(),this._tilesToUpdate.clear(),this._reloadTimeout=null},0))))}updateStyle(e,t){this.initialized&&(window.clearTimeout(this._reloadTimeout),this._reloadTimeout=null,this._tilesToUpdate.clear(),this.source.refresh())}setVisibility(e){this.initialized&&this.olLayer.setVisible(e)}destroy(){this.source&&(this.source.clear(),this.source=null),this.tileProvider=null,super.destroy()}}class nd extends fs{static get className(){return"WmsOpenlayersImpl"}constructor(e,t){super(e,t),this.parameters=t.parameters,this.version=t.version,this.tileSize=t.tileSize}getOLLayer(){return new Ri({visible:!1,source:No({url:this.url,parameters:this.parameters,version:this.version,extent:this.extent,tileSize:this.tileSize,minLevel:this.minLevel,maxLevel:this.maxLevel,tilingSchema:this.tilingSchema}),opacity:this.opacity})}}class ad extends fs{static get className(){return"WmtsOpenlayersImpl"}constructor(e,t){super(e,t),this.layer=t.layer,this.style=t.style,this.format=t.format,this.tileMatrixSetID=t.tileMatrixSetID,this.tileSize=t.tileSize,this.numberOfLevelZeroTilesX=t.numberOfLevelZeroTilesX,this.numberOfLevelZeroTilesY=t.numberOfLevelZeroTilesY,this.matrixIds=t.matrixIds,this.openlayersOptions=t.openlayersOptions}getOLLayer(){const e=this.tilingSchema===jt.GEOGRAPHIC?U:R,t=e.proj.getExtent();let s=jn(t)/this.tileSize[0];this.numberOfLevelZeroTilesX>1&&(s/=this.numberOfLevelZeroTilesX),this.tilingSchema===jt.GEOGRAPHIC&&(s=jn(t)/(this.tileSize[0]*2));const r=this.maxLevel+1,n=new Array(r).fill(void 0).map((u,d)=>s/2**d),a=this.extent.getCoordinatesInProjection(e),o={origin:Pr(t),extent:a,resolutions:n,matrixIds:this.matrixIds,minZoom:this.minLevel,tileSize:this.tileSize};if(this.numberOfLevelZeroTilesX>1||this.numberOfLevelZeroTilesY>1){const u=[];let d=this.numberOfLevelZeroTilesX,f=this.numberOfLevelZeroTilesY;for(let g=0;g<=r;g++)u.push([d,f]),d*=2,f*=2;o.sizes=u}const l=new df(o),h=this.url.indexOf("{")>=0?"REST":"KVP",c={tileGrid:l,requestEncoding:h,layer:this.layer,style:this.style,format:this.format,matrixSet:this.tileMatrixSetID,url:this.url};return gr(this.url)||(c.crossOrigin="anonymous"),this.tilingSchema===jt.GEOGRAPHIC&&(c.projection="EPSG:4326"),Object.assign(c,this.openlayersOptions),new Ri({opacity:this.opacity,source:new ff(c)})}}const od=new Oe({});class Ms extends Ot{static get className(){return"PointCloudLayer"}static getDefaultOptions(){return T(S({},Ot.getDefaultOptions()),{pointSize:null})}constructor(e){super(e);const t=Ms.getDefaultOptions();this.defaultPointSize=e.pointSize!=null?e.pointSize:t.pointSize,this._pointSize=this.defaultPointSize,this._supportedMaps=[z.className]}getStyleOrDefaultStyle(e,t){return super.getStyleOrDefaultStyle(e,t||od)}get pointSize(){return this._pointSize}set pointSize(e){re(e,[Number,String]),this._pointSize=e,this.style.pointSize=e==null?void 0:e.toString()}async initialize(){await super.initialize(),this.pointSize=this._pointSize}createImplementationsForMap(e){return e instanceof z?[new ii(e,this.getImplementationOptions())]:[]}clearStyle(){super.clearStyle(),this.pointSize=this.defaultPointSize}setStyle(e,t){e instanceof W?this.getLogger().warning("trying to apply vector style to point cloud layer."):super.setStyle(e,t)}toJSON(){const e=super.toJSON(),t=Ms.getDefaultOptions();return this.defaultPointSize!==t.pointSize&&(e.pointSize=this.defaultPointSize),e}}ue.registerClass(Ms.className,Ms);class Sr extends Ue{static get className(){return"SingleImageLayer"}static getDefaultOptions(){return T(S({},Ue.getDefaultOptions()),{credit:void 0})}constructor(e){super(e);const t=Sr.getDefaultOptions();this.credit=e.credit||t.credit,this.extent.isValid()||(this.getLogger().warning(`layer ${this.name} was constructed with an invalid extent, defaulting to global extent`),this.extent=new Me({projection:U.toJSON(),coordinates:[-180,-90,180,90]})),this._supportedMaps=[z.className,ie.className]}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{credit:this.credit})}createImplementationsForMap(e){return e instanceof z?[new Vu(e,this.getImplementationOptions())]:e instanceof ie?[new id(e,this.getImplementationOptions())]:[]}setExtent(e){if(v(e,Me),!e.isValid())throw new Error("Cannot set invalid extent");this.extent=e,this.forceRedraw()}toJSON(){const e=super.toJSON();return delete e.tilingSchema,this.credit&&(e.credit=this.credit),e}}ue.registerClass(Sr.className,Sr);class Cs extends de{static get className(){return"TerrainLayer"}static getDefaultOptions(){return T(S({},de.getDefaultOptions()),{requestVertexNormals:!0,requestWaterMask:!1})}constructor(e){super(e);const t=Cs.getDefaultOptions();this._supportedMaps=[z.className],this.requestVertexNormals=ae(e.requestVertexNormals,t.requestVertexNormals),this.requestWaterMask=ae(e.requestWaterMask,t.requestWaterMask)}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask})}createImplementationsForMap(e){return e instanceof z?[new Bu(e,this.getImplementationOptions())]:[]}getHeightForWGS84Coordinates(e){const t=ls({url:this.url,requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask});return wi(t,e,null,e)}toJSON(){const e=super.toJSON(),t=Cs.getDefaultOptions();return this.requestVertexNormals!==t.requestVertexNormals&&(e.requestVertexNormals=this.requestVertexNormals),this.requestWaterMask!==t.requestWaterMask&&(e.requestWaterMask=this.requestWaterMask),e}}ue.registerClass(Cs.className,Cs);function eS(i,e){return new Promise(t=>{let s;const r=i.cesium3DTileset.allTilesLoaded.addEventListener(()=>{s&&clearTimeout(s),r(),t()});e!=null&&(s=setTimeout(()=>{r(),t()},e))})}async function tS(i,e){const t=i.getImplementations().filter(s=>s instanceof ii);!i.active||t.every(s=>s.cesium3DTileset.tilesLoaded)||await Promise.all(t.map(s=>eS(s,e)))}function iS(i,e){return i.tilesLoaded?Promise.resolve():new Promise(t=>{let s;const r=i.tileLoadProgressEvent.addEventListener(n=>{n<1&&(s&&clearTimeout(s),r(),t())});e!=null&&(s=setTimeout(()=>{r(),t()},e))})}function Ao(i,e,t,s,r,n="en"){let a=i;if(r){const o=Ye.southwest(r),l=Ye.northeast(r),h=P.toDegrees(o.longitude),c=P.toDegrees(o.latitude),u=P.toDegrees(l.longitude),d=P.toDegrees(l.latitude);a=a.replace(/\{minx\}/,String(h)).replace(/\{miny\}/,String(c)).replace(/\{maxx\}/,String(u)).replace(/\{maxy\}/,String(d))}return a=a.replace(/\{x\}/,String(e)).replace(/\{y\}/,String(t)).replace(/\{z\}/,String(s)).replace(/\{locale\}/,n),a}class Mr extends Je{static get className(){return"URLTemplateTileProvider"}static getDefaultOptions(){return T(S({},Je.getDefaultOptions()),{url:void 0})}constructor(e){const t=Mr.getDefaultOptions();super(e),this.url=e.url||t.url}get locale(){return super.locale}set locale(e){this.locale!==e&&(super.locale=e,this.url.includes("{locale}")&&this.clearCache())}async loader(e,t,s){const r=this.tilingScheme.tileXYToRectangle(e,t,s),n=Ao(this.url,e,t,s,r,this.locale),a=await xt(n),{features:o}=zt(a,{dynamicStyle:!0});return o}toJSON(){const e=super.toJSON();return this.url&&(e.url=this.url),e}}ui.registerClass(Mr.className,Mr);class Cr extends Je{static get className(){return"MVTTileProvider"}static getDefaultOptions(){return T(S({},Je.getDefaultOptions()),{url:void 0,idProperty:void 0})}constructor(e){const t=Cr.getDefaultOptions();super(e),this.url=e.url||t.url,this.idProperty=e.idProperty||t.idProperty,this._MVTFormat=new gf({featureClass:Z})}get locale(){return super.locale}set locale(e){this.locale!==e&&(super.locale=e,this.url.includes("{locale}")&&this.clearCache())}async loader(e,t,s){const r=this.tilingScheme.tileXYToRectangle(e,t,s),n=Ao(this.url,e,t,s,r,this.locale),a=En(r),o=zn(a),l=await lu(n),h=this._MVTFormat.readFeatures(l),c=(a[2]-a[0])/4096,u=-((a[3]-a[1])/4096);return h.forEach(d=>{const f=d.get(this.idProperty);f!=null&&d.setId(String(f));const m=d.getGeometry().getFlatCoordinates(),p=m.length;for(let y=0;y<p;y++)y%2?(m[y]=(m[y]-2048)*u,m[y]+=o[1]):(m[y]=(m[y]-2048)*c,m[y]+=o[0])}),h}toJSON(){const e=super.toJSON();return this.url&&(e.url=this.url),this.idProperty&&(e.idProperty=this.idProperty),e}}ui.registerClass(Cr.className,Cr);class xr extends Je{static get className(){return"StaticGeoJSONTileProvider"}static getDefaultOptions(){return T(S({},Je.getDefaultOptions()),{url:void 0,baseLevels:[0]})}constructor(e){const t=xr.getDefaultOptions();e.baseLevels=t.baseLevels,super(e),this.url=e.url||t.url}async loader(e,t,s){const r=await xt(this.url),{features:n}=zt(r,{dynamicStyle:!0});return n}toJSON(){const e=super.toJSON();return delete e.baseLevels,this.url&&(e.url=this.url),e}}ui.registerClass(xr.className,xr);class xs extends Ue{static get className(){return"TMSLayer"}static getDefaultOptions(){return T(S({},Ue.getDefaultOptions()),{tilingSchema:"mercator",format:"jpeg",tileSize:[256,256]})}constructor(e){const t=xs.getDefaultOptions();e.tilingSchema=e.tilingSchema||t.tilingSchema,super(e),this._supportedMaps=[ie.className,z.className],this.format=e.format||t.format,this.tileSize=Array.isArray(e.tileSize)?e.tileSize.slice():t.tileSize}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{format:this.format,tileSize:this.tileSize})}createImplementationsForMap(e){return e instanceof ie?[new sd(e,this.getImplementationOptions())]:e instanceof z?[new qu(e,this.getImplementationOptions())]:[]}toJSON(){const e=super.toJSON(),t=xs.getDefaultOptions();return this.tilingSchema!==t.tilingSchema?e.tilingSchema=this.tilingSchema:delete e.tilingSchema,this.format!==t.format&&(e.format=this.format),(this.tileSize[0]!==t.tileSize[0]||this.tileSize[1]!==t.tileSize[1])&&(e.tileSize=this.tileSize.slice()),e}}ue.registerClass(xs.className,xs);function ld(i,e,t){const s=t.getId();i.hiddenObjects[s]?t[He]=!0:t[He]&&delete t[He],i.highlightedObjects[s]?t[Re]=i.highlightedObjects[s].style:t[Re]&&delete t[Re],e.hiddenObjects[s]?t[$e]=!0:t[$e]&&delete t[$e]}class ws extends bt{static get className(){return"VectorTileLayer"}static getDefaultOptions(){return T(S({},bt.getDefaultOptions()),{tileProvider:void 0,highlightStyle:void 0,vectorProperties:{},minLevel:void 0,maxLevel:void 0})}constructor(e){super(e),this._supportedMaps=[z.className,ie.className];const t=ws.getDefaultOptions();this.highlightStyle=t.highlightStyle,e.highlightStyle&&(this.highlightStyle=e.highlightStyle instanceof W?e.highlightStyle:new W(e.highlightStyle)),this._tileSize=[256,256],this.vectorProperties=new nt(S({allowPicking:this.allowPicking},e.vectorProperties)),this.tileProvider=e.tileProvider instanceof Je?e.tileProvider:St(ui,e.tileProvider),this.tileProvider&&(this.tileProvider.locale=this.locale),this._maxLevel=B(e.maxLevel,t.maxLevel),this._minLevel=B(e.minLevel,t.minLevel),this._featureVisibilityListeners=[],this._tileLoadEventListener=()=>{},this._vectorPropertiesChangedListener=()=>{},this._styleZIndex=0}get locale(){return super.locale}set locale(e){this.tileProvider&&(this.tileProvider.locale=super.locale),super.locale=e}async initialize(){this.initialized||(this._tileLoadEventListener=this.tileProvider.tileLoadedEvent.addEventListener(e=>this._handleTileLoaded(e)),this._vectorPropertiesChangedListener=this.vectorProperties.propertyChanged.addEventListener(()=>{this.reload()}),this.featureProvider=new On(this.name,{tileProvider:this.tileProvider,vectorProperties:this.vectorProperties})),await super.initialize()}objectClickedHandler(e){const t=e[Jt]||e;return this.vectorProperties.getAllowPicking(t)?e[He]||e[$e]?null:{id:t.getId(),feature:t}:null}getGenericFeatureFromClickedObject(e){return Za(e,this)}_getNextStyleZIndex(){return this._styleZIndex+=1,this._styleZIndex}_handleTileLoaded({rtree:e}){e.all().map(t=>t.value).forEach(t=>{const s=t.getStyle();s&&s instanceof _e&&s.setZIndex(this._getNextStyleZIndex()),t[j]=this.name,t.getStyleFunction=()=>this._featureStyle.bind(this),this.tileProvider.trackFeaturesToTiles&&ld(this.featureVisibility,this.globalHider,t)})}setGlobalHider(e){super.setGlobalHider(e),this._setupFeatureVisibilityHandlers()}_setupFeatureVisibilityHandlers(){!this.tileProvider.trackFeaturesToTiles||(this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[this.featureVisibility.changed.addEventListener(({action:e,ids:t})=>{const s=new Set;t.forEach(r=>{const n=this.tileProvider.featureIdToTileIds.get(r);n&&n.forEach(a=>{const l=this.tileProvider.rtreeCache.get(a).all().find(h=>h.value.getId()===r);if(l){const h=l.value;s.add(a),e===X.HIGHLIGHT?h[Re]=this.featureVisibility.highlightedObjects[r].style:e===X.UNHIGHLIGHT?delete h[Re]:e===X.HIDE?h[He]=!0:e===X.SHOW&&delete h[He]}})}),this.updateTiles([...s])})],this.globalHider&&this._featureVisibilityListeners.push(this.globalHider.changed.addEventListener(({action:e,ids:t})=>{const s=new Set;t.forEach(r=>{const n=this.tileProvider.featureIdToTileIds.get(r);n&&n.forEach(a=>{const l=this.tileProvider.rtreeCache.get(a).all().find(h=>h.value.getId()===r);if(l){const h=l.value;s.add(a),e===X.HIDE?h[$e]=!0:e===X.SHOW&&delete h[$e]}})}),this.updateTiles([...s])})))}updateTiles(e){this.getImplementations().forEach(t=>{t.updateTiles(e)})}_featureStyle(e,t){let s;return e[He]||e[$e]?[]:(e[Re]?{style:s}=e[Re]:this.style instanceof Oe?{style:s}=this.style:s=e.getStyle()||this.style.style,or(s,e,t))}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{tileProvider:this.tileProvider,tileSize:this._tileSize,minLevel:this._minLevel,maxLevel:this._maxLevel,extent:this.extent})}createImplementationsForMap(e){return e instanceof z?[new Zu(e,this.getImplementationOptions())]:e instanceof ie?[new rd(e,this.getImplementationOptions())]:[]}getStyleOrDefaultStyle(e,t){return super.getStyleOrDefaultStyle(e,t||mi.clone())}async activate(){await super.activate(),this._setupFeatureVisibilityHandlers(),this.tileProvider.trackFeaturesToTiles&&this.globalHider&&this.tileProvider.forEachFeature(e=>{ld(this.featureVisibility,this.globalHider,e)})}deactivate(){super.deactivate(),this._featureVisibilityListeners.forEach(e=>{e()})}destroy(){this._featureVisibilityListeners.forEach(e=>{e()}),super.destroy(),this._tileLoadEventListener(),this.featureProvider&&this.featureProvider.destroy(),this.tileProvider&&this.tileProvider.destroy(),this._vectorPropertiesChangedListener(),this.vectorProperties&&this.vectorProperties.destroy()}toJSON(){const e=super.toJSON(),t=ws.getDefaultOptions();this._maxLevel!==t.maxLevel&&(e.maxLevel=this._maxLevel),this._minLevel!==t.minLevel&&(e.minLevel=this._minLevel);const s=this.vectorProperties.getVcsMeta();return Object.keys(s).length>0&&(e.vectorProperties=s),this.tileProvider&&(e.tileProvider=this.tileProvider.toJSON()),e}}ue.registerClass(ws.className,ws);class Ro extends ce{static get className(){return"WFSLayer"}static getDefaultOptions(){return T(S({},ce.getDefaultOptions()),{featureType:[],featureNS:"",featurePrefix:"",getFeatureOptions:{}})}constructor(e){const t=new D(e.projection).toJSON();t.alias=[`http://www.opengis.net/gml/srs/epsg.xml#${t.epsg.match(/\d+/)[0]}`],e.projection=t,super(e),this.featureType=Array.isArray(e.featureType)?e.featureType:[e.featureType],this.featureNS=e.featureNS,this.featurePrefix=e.featurePrefix,this.getFeaturesOptions=e.getFeatureOptions||{},this.wfsFormat=new ll({featureNS:this.featureNS,featureType:this.featureType}),this._dataFetchedPromise=null}async initialize(){return this.initialized||await this.fetchData(),super.initialize()}async reload(){return this._dataFetchedPromise&&(this.removeAllFeatures(),this._dataFetchedPromise=null,await this.fetchData()),super.reload()}fetchData(){if(this._dataFetchedPromise)return this._dataFetchedPromise;if(this.url!=null){const e=this.wfsFormat.writeGetFeature(S({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureTypes:this.featureType,srsName:this.projection.epsg},this.getFeaturesOptions)),t=new XMLSerializer().serializeToString(e);return this._dataFetchedPromise=xt(this.url,{method:"POST",headers:{"Content-Type":"application/text+xml"},body:JSON.stringify(t)}).then(s=>this._parseWFSData(s)).catch(s=>(this.getLogger().info(`Could not send request for loading layer content (${s.message})`),Promise.reject(s))),this._dataFetchedPromise}return this.getLogger().warning("Could not load WFSLayer layer, no url is set"),Promise.reject(new Error("missing url in WFSLayer layer"))}_parseWFSData(e){const t=this.wfsFormat.readFeatures(e);this.addFeatures(t)}toJSON(){const e=super.toJSON();return e.featureType=this.featureType.slice(),e.featureNS=this.featureNS,e.featurePrefix=this.featurePrefix,Object.keys(this.getFeaturesOptions).length>0&&(e.getFeatureOptions=this.getFeaturesOptions),e}}ue.registerClass(Ro.className,Ro);class bs extends Ue{static get className(){return"WMSLayer"}static getDefaultOptions(){return T(S({},Ue.getDefaultOptions()),{version:"1.1.1",parameters:void 0,featureInfo:void 0,tileSize:[256,256],highResolution:!1,layers:""})}constructor(e){super(e);const t=bs.getDefaultOptions();if(this.version=e.version||t.version,this.parameters={},e.parameters){let s;typeof e.parameters=="string"?s=Object.fromEntries(new URLSearchParams(e.parameters)):e.parameters instanceof Object&&(s=e.parameters),Object.keys(s).forEach(r=>{this.parameters[r.toUpperCase()]=s[r]})}this.parameters.TRANSPARENT==null&&(this.parameters.TRANSPARENT=!1),this.version&&(this.parameters.VERSION=this.version),this.parameters.LAYERS=e.layers||t.layers,this.tileSize=e.tileSize||t.tileSize,this.highResolution=ae(e.highResolution,t.highResolution),this._featureInfoOptions=e.featureInfo||t.featureInfo,this._supportedMaps=[z.className,ie.className]}initialize(){return this.initialized||this._setFeatureProvider(),super.initialize()}_setFeatureProvider(){if(this._featureInfoOptions){const e=S({url:this.url,tilingSchema:this.tilingSchema,maxLevel:this.maxLevel,minLevel:this.minLevel,tileSize:this.tileSize,extent:this.extent,parameters:this.parameters,version:this.version},this._featureInfoOptions);this.featureProvider=new si(this.name,e)}}async reload(){return this.featureProvider&&this._featureInfoOptions&&(this.featureProvider.destroy(),this._setFeatureProvider()),super.reload()}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{version:this.version,parameters:this.parameters,highResolution:this.highResolution,tileSize:this.tileSize})}createImplementationsForMap(e){return e instanceof z?[new Ku(e,this.getImplementationOptions())]:e instanceof ie?[new nd(e,this.getImplementationOptions())]:[]}async setLayers(e){v(e,[String,[String]]);const t=Array.isArray(e)?e:[e];this.parameters.LAYERS=t.join(","),await this.forceRedraw()}getLayers(){return this.parameters.LAYERS?this.parameters.LAYERS.split(","):[]}toJSON(){const e=super.toJSON(),t=bs.getDefaultOptions();this.parameters.LAYERS&&(e.layers=this.parameters.LAYERS),this.version!==t.version&&(e.version=this.version);const s=S({},this.parameters);if(delete s.VERSION,delete s.LAYERS,s.TRANSPARENT===!1&&delete s.TRANSPARENT,Object.keys(s).length>0&&(e.parameters=s),this.version!==t.version&&(e.version=this.version),this.highResolution!==t.highResolution&&(e.highResolution=this.highResolution),(this.tileSize[0]!==t.tileSize[0]||this.tileSize[1]!==t.tileSize[1])&&(e.tileSize=this.tileSize.slice()),this.featureProvider&&this.featureProvider instanceof si){const r=this.featureProvider.toJSON();(this.tileSize[0]===r.tileSize[0]||this.tileSize[1]===r.tileSize[1])&&delete r.tileSize,Object.entries(this.parameters).every(([n,a])=>r.parameters[n]===a)&&delete r.parameters,r.extent&&new Me(r.extent).equals(this.extent)&&delete r.extent,this.url===r.url&&delete r.url,this.tilingSchema===r.tilingSchema&&delete r.tilingSchema,this.version===r.version&&delete r.version,this.minLevel===r.minLevel&&delete r.minLevel,this.maxLevel===r.maxLevel&&delete r.maxLevel,e.featureInfo=r}else this._featureInfoOptions&&(e.featureInfo=this._featureInfoOptions);return e}}ue.registerClass(bs.className,bs);function sS(i,e,t){if(i.length>0){if(i.length===e+1)return i;Ie("WmtsCesiumImpl").log("matrixIds must have the same length as maxLevel")}return new Array(e+1).fill(void 0).map((s,r)=>`${t}${r}`)}class Os extends Ue{static get className(){return"WMTSLayer"}static getDefaultOptions(){return T(S({},Ue.getDefaultOptions()),{tilingSchema:"mercator",numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,layer:"",wmtsStyle:"",format:"",tileMatrixPrefix:"",tileMatrixSetID:"",openlayersOptions:{},matrixIds:[],tileSize:[256,256]})}constructor(e){const t=Os.getDefaultOptions();e.tilingSchema=e.tilingSchema||t.tilingSchema,super(e),this._supportedMaps=[ie.className,z.className],this.numberOfLevelZeroTilesX=B(e.numberOfLevelZeroTilesX,t.numberOfLevelZeroTilesX),this.numberOfLevelZeroTilesY=B(e.numberOfLevelZeroTilesY,t.numberOfLevelZeroTilesY),this.layer=e.layer||t.layer,this.wmtsStyle=e.wmtsStyle||t.wmtsStyle,this.format=e.format||t.format,this.tileMatrixPrefix=e.tileMatrixPrefix||t.tileMatrixPrefix,this.tileMatrixSetID=e.tileMatrixSetID||t.tileMatrixSetID,this.openlayersOptions=e.openlayersOptions||t.openlayersOptions,this.matrixIds=Array.isArray(e.matrixIds)?e.matrixIds:t.matrixIds,this.tileSize=e.tileSize||t.tileSize}getImplementationOptions(){return T(S({},super.getImplementationOptions()),{layer:this.layer,style:this.wmtsStyle,format:this.format,tileMatrixSetID:this.tileMatrixSetID,tileSize:this.tileSize,numberOfLevelZeroTilesX:this.numberOfLevelZeroTilesX,numberOfLevelZeroTilesY:this.numberOfLevelZeroTilesY,matrixIds:sS(this.matrixIds,this.maxLevel,this.tileMatrixPrefix),openlayersOptions:this.openlayersOptions})}createImplementationsForMap(e){return e instanceof ie?[new ad(e,this.getImplementationOptions())]:e instanceof z?[new Ju(e,this.getImplementationOptions())]:[]}toJSON(){const e=super.toJSON(),t=Os.getDefaultOptions();return this.tilingSchema!==t.tilingSchema?e.tilingSchema=this.tilingSchema:delete e.tilingSchema,this.numberOfLevelZeroTilesX!==t.numberOfLevelZeroTilesX&&(e.numberOfLevelZeroTilesX=this.numberOfLevelZeroTilesX),this.numberOfLevelZeroTilesY!==t.numberOfLevelZeroTilesY&&(e.numberOfLevelZeroTilesY=this.numberOfLevelZeroTilesY),this.layer!==t.layer&&(e.layer=this.layer),this.wmtsStyle!==t.wmtsStyle&&(e.wmtsStyle=this.wmtsStyle),this.format!==t.format&&(e.format=this.format),this.tileMatrixPrefix!==t.tileMatrixPrefix&&(e.tileMatrixPrefix=this.tileMatrixPrefix),this.tileMatrixSetID!==t.tileMatrixSetID&&(e.tileMatrixSetID=this.tileMatrixSetID),Object.keys(this.openlayersOptions).length>0&&(e.openlayersOptions=S({},this.openlayersOptions)),this.matrixIds.length>0&&(e.matrixIds=this.matrixIds.slice()),(this.tileSize[0]!==t.tileSize[0]||this.tileSize[1]!==t.tileSize[1])&&(e.tileSize=this.tileSize.slice()),e}}ue.registerClass(Os.className,Os);function Go(){return Ie("ClippingObject")}const Ln=Symbol("ClippingObjectGlobe");class Ei{constructor(e={}){this.id=et(),this.layerNames=e.layerNames||[],this.entities=e.entities||[],this.targets=new Map,this._clippingPlaneCollection=e.clippingPlaneCollection||null,this._terrain=ae(e.terrain,!1),this._local=ae(e.local,!1),this.targetsUpdated=new I,this.clippingPlaneUpdated=new I,this._cachedFeatureStoreLayers=new Set,this._activeMap=null,this._layerCollection=null}get clippingPlaneCollection(){return this._clippingPlaneCollection}set clippingPlaneCollection(e){this._clippingPlaneCollection=e,this.clippingPlaneUpdated.raiseEvent()}get terrain(){return this._terrain}set terrain(e){v(e,Boolean),this._terrain!==e&&(this._terrain=e,this.handleMapChanged(this._activeMap))}get local(){return this._local}set local(e){v(e,Boolean),this._local!==e&&(this._local=e,this.clippingPlaneUpdated.raiseEvent())}setLayerCollection(e){if(v(e,Ht),this._layerCollection&&this._layerCollection!==e)throw new Error("layerCollection has already been set");this._layerCollection=e,[...this._layerCollection].forEach(t=>{this.handleLayerChanged(t)})}handleLayerChanged(e){const t=this._activeMap;if(t instanceof z){if(this.layerNames.includes(e.name))if(e.active){const s=t.getVisualizationsForLayer(e),r=s?[...s].filter(n=>n instanceof As):[];if(r.length>0)r.forEach(n=>{n.readyPromise.then(a=>{this.layerNames.includes(e.name)&&e.active&&(this.targets.set(e.name,a),this.targetsUpdated.raiseEvent())})});else{const n=this.layerNames.indexOf(e.name);Go().warning(`layer ${e.name} cannot have a ClippingObject applied`),this.layerNames.splice(n,1)}}else this.targets.has(e.name)&&(this.targets.delete(e.name),this.targetsUpdated.raiseEvent());else if(this.entities.find(s=>s.layerName===e.name)){let s=!1;const r=t.getVisualizationsForLayer(e),n=r?[...r][0]:null;if(!n){const a=this.layerNames.indexOf(e.name);Go().warning(`layer ${e.name} cannot have a ClippingObject applied`),this.layerNames.splice(a,1);return}this.entities.filter(a=>a.layerName===e.name).forEach(a=>{const o=`${a.layerName}-${a.entityId}`;if(e.active){const l=n.entities.getById(a.entityId);if(l)this.targets.set(o,l),s=!0;else{const h=this.entities.indexOf(a);Go().warning(`could not find entity with id ${a.entityId} in layer ${a.layerName}`),this.entities.splice(h,1)}}else this.targets.has(o)&&(this.targets.delete(o),s=!0)}),s&&this.targetsUpdated.raiseEvent()}}else this.layerNames.includes(e.name)&&e.className==="FeatureStoreLayer"&&(e.active?this._cachedFeatureStoreLayers.add(e):this._cachedFeatureStoreLayers.has(e)&&this._cachedFeatureStoreLayers.delete(e))}handleMapChanged(e){if(e instanceof z){const{globe:t}=e.getScene();let s=!1;this._terrain&&!this.targets.has(Ln)?(this.targets.set(Ln,t),s=!0):!this._terrain&&this.targets.has(Ln)&&(this.targets.delete(Ln),s=!0),s&&this.targetsUpdated.raiseEvent(),this._cachedFeatureStoreLayers.size>0&&(this._cachedFeatureStoreLayers.forEach(r=>{this.handleLayerChanged(r)}),this._cachedFeatureStoreLayers.clear())}this._activeMap=e}addLayer(e){if(v(e,String),!this.layerNames.includes(e)){this.layerNames.push(e);const t=this._layerCollection?this._layerCollection.getByKey(e):null;t&&t.active&&this.handleLayerChanged(t)}}removeLayer(e){v(e,String);const t=this.layerNames.indexOf(e);t>-1&&this.layerNames.splice(t,1),this.targets.has(e)&&(this.targets.delete(e),this.targetsUpdated.raiseEvent())}addEntity(e,t){if(v(e,String),v(t,String),!this.entities.find(s=>s.layerName===e&&s.entityId===t)){this.entities.push({layerName:e,entityId:t});const s=this._layerCollection?this._layerCollection.getByKey(e):null;s&&s.active&&this.handleLayerChanged(s)}}removeEntity(e,t){v(e,String),v(t,String);const s=this.entities.findIndex(n=>n.layerName===e&&n.entityId===t);s>-1&&this.entities.splice(s,1);const r=`${e}-${t}`;this.targets.has(r)&&(this.targets.delete(r),this.targetsUpdated.raiseEvent())}}function hd(i,e){const t=M.subtract(i,e,new M);M.normalize(t,t);const s=Pt.fromPointNormal(i,t);return li.fromPlane(s)}function rS(i){const e=[],t=i.map(s=>M.fromDegrees(...D.mercatorToWgs84(s)));for(let s=0;s<t.length-1;s++){const r=s+1,n=new M;M.cross(t[r],t[s],n),M.normalize(n,n);const a=new Pt(n,0);Number.isNaN(a.distance)||e.push(li.fromPlane(a))}return e}function cd(i,e,t){const s=[],r=Vt.fromGeometry(i.getGeometry());let n=Number.isFinite(r.minZ)?r.minZ:0,a=Number.isFinite(r.maxZ)?r.maxZ:0;const o=i.get("olcs_extrudedHeight");o&&(a+=o,i.get("olcs_skirt")&&(n-=i.get("olcs_skirt"))),n===a&&(a+=1);const[l,h]=D.mercatorToWgs84(e[0]),c=M.fromDegrees(l,h,n),u=M.fromDegrees(l,h,a);return t.createBottomPlane&&s.push(hd(c,u)),o&&t.createTopPlane&&s.push(hd(u,c)),s}function nS(i){const e=[],t=i.map(n=>M.fromDegrees(...D.mercatorToWgs84(n))),s=new M;M.cross(t[0],t[1],s),M.normalize(s,s);function r(n){const a=M.add(n,s,new M),o=new M;M.cross(n,a,o),M.normalize(o,o);const l=new Pt(o,0);e.push(li.fromPlane(l))}return r(t[0]),M.negate(s,s),r(t[1]),e}function aS(i,e={},t){v(i,Z),v(e,Object),re(t,k);const s=[],r=i.getGeometry(),n=r.getType();if(n==="Point")s.push(...cd(i,[r.getCoordinates()],e));else{const a=ss(r);if(a.length<2||a[0][0]===a[1][0]&&a[0][1]===a[1][1])return null;n==="Polygon"?(_n(a),Nc(a)):n==="LineString"&&a.length===2&&e.createEndingPlanes&&s.push(...nS(a)),e.createVerticalPlanes&&s.push(...rS(a)),i.get("olcs_altitudeMode")==="absolute"&&(e.createBottomPlane||e.createTopPlane)&&s.push(...cd(i,a,e))}return t&&s.forEach(a=>{const o=Pt.transform(a,t);a.normal=o.normal,a.distance=o.distance}),e.reverse&&s.forEach(a=>{M.negate(a.normal,a.normal),a.distance*=-1}),new oi({planes:s,unionClippingRegions:e.reverse})}function gs(i,e,t,s){v(i,oi),v(e,oi),e.length>0&&e.removeAll();for(let r=0;r<i.length;r++){const n=i.get(r);if(t&&s){const a=Pt.getPointDistance(n,s),o=Pt.transform(n,t);o.distance=a,e.add(li.fromPlane(o))}else e.add(li.clone(n))}return e.modelMatrix=i.modelMatrix.clone(),e.unionClippingRegions=i.unionClippingRegions,e.edgeColor=i.edgeColor.clone(),e.edgeWidth=i.edgeWidth,e}function yr(i){i instanceof ni?i.model&&(i.model.clippingPlanes?i.model.clippingPlanes.getValue().removeAll():i.model.clippingPlanes=new ng(new oi)):i.clippingPlanes?i.clippingPlanes.removeAll():i.clippingPlanes=new oi}function oS(i,e,t){if(yr(i),t)gs(e,i.clippingPlanes);else if(!e.modelMatrix.equals(k.IDENTITY))gs(e,i.clippingPlanes),i.clippingPlanes.modelMatrix=k.multiply(k.inverse(i.clippingPlanesOriginMatrix,i.clippingPlanes.modelMatrix),e.modelMatrix,i.clippingPlanes.modelMatrix);else{const s=k.getMatrix3(k.inverse(i.clippingPlanesOriginMatrix,new k),new We),r=k.fromRotationTranslation(s,new M);gs(e,i.clippingPlanes,r,i.boundingSphere.center)}}function lS(i,e){yr(i),gs(e,i.clippingPlanes)}function hS(i,e,t){if(i.model){yr(i);const s=i.model.clippingPlanes.getValue();if(gs(e,s),!t){const r=i.computeModelMatrix(vl.now());k.inverseTransformation(r,s.modelMatrix),e.modelMatrix.equals(k.IDENTITY)||k.multiply(s.modelMatrix,e.modelMatrix,s.modelMatrix)}}}function ko(i,e,t){i instanceof As?oS(i,e,t):i instanceof ag?lS(i,e):hS(i,e,t)}function cS(i,e,t=!1,s=25){v(i,[Number]),v(t,Boolean),v(s,Number);let r;if(t){const a=Er(i,-s,e.heading),o=Er(i,s,e.heading);r=new br([[a[0],a[1],i[2]],[o[0],o[1],i[2]]],"XYZ")}else{r=new Ts([[]],"XYZ");let a=2*Math.PI-Math.PI/4;const o=[...new Array(4)].map(()=>{const l=Er(i,s,a);return a-=Math.PI/2,[l[0],l[1],i[2]]});r.setCoordinates([o])}const n=new Z({geometry:r});return n.set("olcs_altitudeMode","absolute"),t&&n.set("olcs_extrudedHeight",s*2),r.transform(U.proj,R.proj),n}function uS(i,e=!1){return re(i,Z),v(e,Boolean),(i?i.getGeometry().getType()==="LineString":!1)?{createBottomPlane:!e,createTopPlane:!e,createEndingPlanes:!e,createVerticalPlanes:!0}:{createVerticalPlanes:!e,createBottomPlane:!0}}class ud{static get className(){return"ClippingObjectManager"}constructor(e){this._defaultClippingObjects=new Set,this._exclusiveClippingObjects=null,this._targetsMap=new Map,this._listenersMap=new Map,this._exclusiveRemovedCb=null,this.initialized=!1,this._updateSuspended=!1,this._dirty=!1,this._layerCollection=e,this._activeMap=null,this._layerChangedListener=this._layerCollection.stateChanged.addEventListener(t=>{this._layerChanged(t)})}get suspendUpdate(){return this._updateSuspended}set suspendUpdate(e){v(e,Boolean),this._updateSuspended=e,!this._updateSuspended&&this._dirty&&(this._dirty=!1,this._update())}_layerChanged(e){this.suspendUpdate=!0,this._defaultClippingObjects.forEach(t=>{t.handleLayerChanged(e)}),this._exclusiveClippingObjects&&this._exclusiveClippingObjects.forEach(t=>{t.handleLayerChanged(e)}),this.suspendUpdate=!1}mapActivated(e){this.suspendUpdate=!0,this._defaultClippingObjects.forEach(t=>{t.handleMapChanged(e)}),this._exclusiveClippingObjects&&this._exclusiveClippingObjects.forEach(t=>{t.handleMapChanged(e)}),this.suspendUpdate=!1,this._activeMap=e}addClippingObject(e){if(v(e,Ei),this.hasClippingObject(e))throw new Error("ClippingObject already managed, remove it first");e.setLayerCollection(this._layerCollection),this._defaultClippingObjects.add(e),this._activeMap instanceof z&&e.handleMapChanged(this._activeMap),this._listenersMap.set(e,[e.targetsUpdated.addEventListener(this._update.bind(this)),e.clippingPlaneUpdated.addEventListener(this._clippingPlaneUpdated.bind(this,e))]),this._update()}removeClippingObject(e){v(e,Ei),this._defaultClippingObjects.has(e)&&(this._defaultClippingObjects.delete(e),this._listenersMap.get(e).forEach(t=>{t()}),this._listenersMap.delete(e),this._update())}hasClippingObject(e){return v(e,Ei),this._defaultClippingObjects.has(e)||!!(this._exclusiveClippingObjects&&this._exclusiveClippingObjects.includes(e))}setExclusiveClippingObjects(e,t){if(v(e,[Ei]),v(t,Function),e.find(s=>this._defaultClippingObjects.has(s)))throw new Error("Some ClippingObjects are already managed, remove them first");this._clearExclusiveClippingObjects(),this._exclusiveRemovedCb=t,this._exclusiveClippingObjects=e,this._exclusiveClippingObjects.forEach(s=>{s.setLayerCollection(this._layerCollection),this._activeMap instanceof z&&s.handleMapChanged(this._activeMap),this._listenersMap.set(s,[s.targetsUpdated.addEventListener(this._update.bind(this)),s.clippingPlaneUpdated.addEventListener(this._clippingPlaneUpdated.bind(this,s))])}),this._update()}_clearExclusiveClippingObjects(e){this._exclusiveClippingObjects&&(this._exclusiveClippingObjects.forEach(t=>{this._listenersMap.get(t).forEach(s=>{s()}),this._listenersMap.delete(t)}),this._exclusiveClippingObjects=null),!e&&this._exclusiveRemovedCb&&this._exclusiveRemovedCb(),this._exclusiveRemovedCb=null}clearExclusiveClippingObjects(e){this._clearExclusiveClippingObjects(e),this._update()}_update(){if(this._updateSuspended){this._dirty=!0;return}const e=new Set(this._targetsMap.keys()),t=s=>{s.targets.forEach(r=>{this._targetsMap.set(r,s),e.delete(r)})};this._targetsMap.clear(),this._defaultClippingObjects.forEach(t),this._exclusiveClippingObjects&&this._exclusiveClippingObjects.forEach(t),e.forEach(s=>{yr(s)}),this._targetsMap.forEach((s,r)=>{s.clippingPlaneCollection&&ko(r,s.clippingPlaneCollection,s.local)})}_clippingPlaneUpdated(e){this._targetsMap.forEach((t,s)=>{t===e&&e.clippingPlaneCollection&&ko(s,e.clippingPlaneCollection)})}destroy(){this._listenersMap.forEach(e=>{e.forEach(t=>{t()})}),this._layerChangedListener(),this._listenersMap.clear(),this._targetsMap.clear(),this._defaultClippingObjects.clear(),this._exclusiveClippingObjects=null}}const zo={CREATE:"create",EDIT_GEOMETRY:"editGeometry",EDIT_FEATURES:"editFeatures"};function dd(i){const e=new ce({projection:R.toJSON(),vectorProperties:{altitudeMode:"clampToGround",eyeOffset:[0,0,-1]},isDynamic:!0,zIndex:Bh,style:{image:{radius:5,fill:{color:"rgba(255,255,255,0.47)"},stroke:{width:1,color:"#000000"}}}});return Fu(e),i.add(e),e.activate(),e}function fd(i){const e=new ei,t=new I,s=i.addExclusiveInteraction(e,()=>{t.raiseEvent()}),r=i.featureInteraction.active;return i.featureInteraction.setActive(b.CLICKMOVE|b.DRAGSTART),{interactionChain:e,destroy(){s(),t.destroy(),e.destroy(),i.featureInteraction.setActive(r)},removed:t}}const Ze={Point:"Point",Circle:"Circle",LineString:"LineString",Polygon:"Polygon",BBox:"BBox"};class gd extends Se{constructor(){super(b.CLICKMOVE|b.DBLCLICK),this._geometry=null,this._coordinates=[],this._lastCoordinate=null,this.finished=new I,this.created=new I,this.setActive()}_setCoordinates(){this._geometry&&this._geometry.setCoordinates(this._coordinates)}async pipe(e){return e.type&b.CLICKMOVE&&this._geometry&&(this._lastCoordinate.splice(0,e.positionOrPixel.length,...e.positionOrPixel),this._setCoordinates()),e.type&b.CLICK&&(this._geometry?(this._lastCoordinate=[...this._lastCoordinate],this._coordinates.push(this._lastCoordinate)):(this._geometry=new br([e.positionOrPixel],"XYZ"),this._geometry[Ge]=e.map instanceof pe,this.created.raiseEvent(this._geometry),this._coordinates=[e.positionOrPixel.slice()],this._lastCoordinate=this._coordinates[0].slice(),this._coordinates.push(this._lastCoordinate))),e.type&b.DBLCLICK&&this.finish(),e}finish(){this.active!==b.NONE&&(this._coordinates.pop(),this._setCoordinates(),this.setActive(!1),this.finished.raiseEvent(this._geometry))}destroy(){this._geometry=null,this._coordinates=[],this.finished.destroy(),this.created.destroy(),super.destroy()}}class md extends Se{constructor(){super(b.CLICKMOVE|b.DBLCLICK),this._geometry=null,this._lastCoordinate=null,this._coordinates=[],this.finished=new I,this.created=new I,this.setActive()}_setCoordinates(){this._geometry&&this._geometry.setCoordinates(this._coordinates)}async pipe(e){return e.type&b.CLICKMOVE&&this._geometry&&(this._lastCoordinate.splice(0,e.positionOrPixel.length,...e.positionOrPixel),this._setCoordinates()),e.type&b.CLICK&&(this._geometry?this.finish():(this._geometry=new at(e.positionOrPixel,20,"XYZ"),this._geometry[Ki]=e.map instanceof pe,this._geometry[Ge]=e.map instanceof pe,this.created.raiseEvent(this._geometry),this._coordinates=this._geometry.getCoordinates(),this._lastCoordinate=this._coordinates[1])),e.type&b.DBLCLICK&&this.finish(),e}finish(){this.active!==b.NONE&&(this._setCoordinates(),this.setActive(!1),this.finished.raiseEvent(this._geometry))}destroy(){this._geometry=null,this._coordinates=[],this.finished.destroy(),this.created.destroy(),super.destroy()}}const pd=1e-6;class yd extends Se{constructor(){super(b.CLICKMOVE|b.DBLCLICK),this._geometry=null,this._origin=null,this._lastCoordinate=null,this.finished=new I,this.created=new I,this.setActive()}_setCoordinates(){if(this._geometry){const e=this._origin[0]>=this._lastCoordinate[0],t=this._origin[1]>=this._lastCoordinate[1];this._origin[0]===this._lastCoordinate[0]&&(this._lastCoordinate[0]+=pd),this._origin[1]===this._lastCoordinate[1]&&(this._lastCoordinate[1]+=pd),this._lastCoordinate[2]=this._origin[2];let s;e&&t||!e&&!t?s=[this._origin,[this._lastCoordinate[0],this._origin[1],this._origin[2]],this._lastCoordinate,[this._origin[0],this._lastCoordinate[1],this._origin[2]]]:s=[this._origin,[this._origin[0],this._lastCoordinate[1],this._origin[2]],this._lastCoordinate,[this._lastCoordinate[0],this._origin[1],this._origin[2]]],this._geometry.setCoordinates([s])}}async pipe(e){return e.type&b.CLICKMOVE&&this._geometry&&(this._lastCoordinate.splice(0,e.positionOrPixel.length,...e.positionOrPixel),this._setCoordinates()),e.type&b.CLICK&&(this._geometry?this.finish():(this._geometry=new Ts([[e.positionOrPixel.slice()]],"XYZ"),this._geometry.set("_vcsGeomType",Ze.BBox),this._geometry[Ge]=e.map instanceof pe,this.created.raiseEvent(this._geometry),this._origin=e.positionOrPixel.slice(),this._lastCoordinate=this._origin.slice())),e.type&b.DBLCLICK&&this.finish(),e}finish(){this.active!==b.NONE&&(this._setCoordinates(),this.setActive(!1),this.finished.raiseEvent(this._geometry))}destroy(){this._geometry=null,this._coordinates=[],this.finished.destroy(),this.created.destroy(),super.destroy()}}class _d extends Se{constructor(){super(b.CLICK),this.finished=new I,this.created=new I,this._geometry=null,this.setActive()}async pipe(e){return this._geometry=new Bt(e.positionOrPixel,"XYZ"),this._geometry[Ge]=e.map instanceof pe,this.created.raiseEvent(this._geometry),this.finish(),e}finish(){this.active!==b.NONE&&(this.setActive(!1),this.finished.raiseEvent(this._geometry))}destroy(){this.finished.destroy(),this.created.destroy(),super.destroy()}}class vd extends Se{constructor(){super(b.CLICKMOVE|b.DBLCLICK),this._geometry=null,this._coordinates=[],this._lastCoordinate=null,this._validityPlaceHolder=null,this.finished=new I,this.created=new I,this.setActive()}_setCoordinates(){this._geometry&&this._geometry.setCoordinates([this._coordinates])}async pipe(e){return e.type&b.CLICKMOVE&&this._geometry&&(this._lastCoordinate.splice(0,e.positionOrPixel.length,...e.positionOrPixel),this._setCoordinates()),e.type&b.CLICK&&(this._geometry?this._validityPlaceHolder?(this._lastCoordinate=[...this._lastCoordinate],this._coordinates.splice(2,1,this._lastCoordinate),this._validityPlaceHolder=null):(this._lastCoordinate=[...this._lastCoordinate],this._coordinates.push(this._lastCoordinate)):(this._geometry=new Ts([[e.positionOrPixel.slice()]],"XYZ"),this._geometry[Ge]=e.map instanceof pe,this.created.raiseEvent(this._geometry),this._coordinates=[e.positionOrPixel.slice()],this._lastCoordinate=[...e.positionOrPixel],this._validityPlaceHolder=e.positionOrPixel.slice(),this._coordinates.push(this._lastCoordinate),this._coordinates.push(this._validityPlaceHolder))),e.type&b.DBLCLICK&&this.finish(),e}finish(){this.active!==b.NONE&&(this._coordinates.pop(),this._validityPlaceHolder&&this._coordinates.pop(),this._setCoordinates(),this.setActive(!1),this.finished.raiseEvent(this._geometry))}destroy(){this._geometry=null,this._coordinates=[],this.finished.destroy(),this.created.destroy(),super.destroy()}}class jo{constructor(e){this._position=.5,this.scene=null,this.olMap=null,this.initialized=!1,this.leftScreenClippingObject=new Ei,this.rightScreenClippingObject=new Ei,this._cameraListener=null,this.originalCameraPercentageChanged=null,this._targetsChangedListeners=[],this._targetsChangedListeners=[this.rightScreenClippingObject.targetsUpdated.addEventListener(()=>{this._targetsChanged()}),this.leftScreenClippingObject.targetsUpdated.addEventListener(()=>{this._targetsChanged()})],this._clippingObjectManager=e,this._clippingObjectManager.addClippingObject(this.rightScreenClippingObject),this._clippingObjectManager.addClippingObject(this.leftScreenClippingObject)}get position(){return this._position}set position(e){if(v(e,Number),e<0||e>1)throw new Error("Position must be between 0 and 1");Math.abs(this._position-e)>1e-4&&this._updatePosition(e)}_targetsChanged(){if(this.scene){const e=this.rightScreenClippingObject.targets.size+this.leftScreenClippingObject.targets.size,{camera:t}=this.scene;this._cameraListener&&e===0?(this._cameraListener(),this._cameraListener=null,t.percentageChanged=this.originalCameraPercentageChanged):!this._cameraListener&&e>0&&(this.originalCameraPercentageChanged=t.percentageChanged,t.percentageChanged=0,this._cameraListener=t.changed.addEventListener(this._updateClippingPlanes.bind(this)),this._updateClippingPlanes())}}_updatePosition(e){this._position=e,this.scene?(this.scene.splitPosition=e,this._updateClippingPlanes()):this.olMap&&this.olMap.render()}mapActivated(e){e instanceof z?(this.scene=e.getScene(),this.olMap=null,this._targetsChanged()):e instanceof ie&&(this.scene=null,this.olMap=e.olMap),this._updatePosition(this.position)}_calcClippingPlane(){const{camera:e}=this.scene,{fov:t,near:s}=e.frustum,r=this.scene.canvas.width||1,n=this.scene.canvas.height||1;let a;n>r?a=s*Math.tan(.5*t)*2/n:a=s*Math.tan(.5*t)*2/r;const o=r*this.position-r/2,l=n/2,h=new M(a*o,a*l,-1*s),c=new M(a*o,-1*a*l,-1*s);k.multiplyByPoint(e.inverseViewMatrix,h,h),k.multiplyByPoint(e.inverseViewMatrix,c,c);const u=e.positionWC;M.subtract(u,h,h),M.subtract(u,c,c);const d=M.cross(h,c,new M);M.normalize(d,d);const f=Pt.fromPointNormal(u,d);return li.fromPlane(f)}_updateClippingPlanes(){const e=this._calcClippingPlane();this.leftScreenClippingObject.clippingPlaneCollection=new oi({planes:[e]});const t=li.clone(e);t.normal=M.negate(t.normal,t.normal),t.distance*=-1,this.rightScreenClippingObject.clippingPlaneCollection=new oi({planes:[t]})}getClippingObjectForDirection(e){return v(e,[J.LEFT,J.RIGHT,J.NONE]),e===J.LEFT?this.leftScreenClippingObject:e===J.RIGHT?this.rightScreenClippingObject:null}destroy(){this._clippingObjectManager&&(this._clippingObjectManager.removeClippingObject(this.rightScreenClippingObject),this._clippingObjectManager.removeClippingObject(this.leftScreenClippingObject)),this._targetsChangedListeners.forEach(e=>{e()}),this._targetsChangedListeners=[],this._clippingObjectManager=null,this._cameraListener&&(this._cameraListener(),this._cameraListener=null)}}async function dS(i,e){const t=i.getViewpointSync(),s=t.clone();s.heading=0,s.pitch=-90,t&&!t.equals(s)&&(e.fixedNorthOrientation&&(t.heading=0),t.pitch=-90,t.animate=!0,t.duration=1,t.groundPosition&&(t.cameraPosition=null),await i.gotoViewpoint(t))}class Fn extends wt{static from(e){const t=new Fn;if(e)for(const s of e)t.add(s);return t}constructor(){super(),this._activeMap=null,this._target=null,this._cachedViewpoint=null,this.eventHandler=new ju,this._layerCollection=new Ht,this.initializeError=new I,this.fallbackMapActivated=new I,this.mapActivated=new I,this.clippingObjectManager=new ud(this._layerCollection),this._splitScreen=new jo(this.clippingObjectManager),this._mapPointerListeners=[]}get activeMap(){return this._activeMap}get target(){return this._target}get layerCollection(){return this._layerCollection}set layerCollection(e){v(e,Ht),this._layerCollection=e,this._array.forEach(t=>{t.layerCollection=this._layerCollection})}get splitScreen(){return this._splitScreen}set splitScreen(e){v(e,jo),this._splitScreen=e,this._array.forEach(t=>{t.splitScreen=this._splitScreen})}add(e){const t=super.add(e);return t!==null&&(this._mapPointerListeners.push(e.pointerInteractionEvent.addEventListener(this.eventHandler.handleMapEvent.bind(this.eventHandler))),e.layerCollection=this._layerCollection,e.splitScreen=this._splitScreen,e.setTarget(this._target)),t}_remove(e){if(this._activeMap===e){if(this._cachedViewpoint=e.getViewpointSync(),this._target){const t=this._activeMap.className.split(".").pop();this._target.classList.remove(t)}this._activeMap=null}return this.has(e)&&(e.setTarget(null),e.splitScreen=null,e.layerCollection=new Ht),super._remove(e)}_setActiveMapCSSClass(){if(this._target&&this._activeMap){const e=this._activeMap.className.split(".").pop();this._target.classList.add(e)}}setTarget(e){re(e,[String,HTMLElement]),this._target=typeof e=="string"?document.getElementById(e):e,this._array.forEach(t=>{t.setTarget(this._target)}),this._setActiveMapCSSClass()}_getFallbackMap(e){const{fallbackMap:t}=e;if(t){const s=this.getByKey(t);if(s&&s!==e)return s;Ie().warning(`the fallback map with the name: ${t} is missconfigured`)}return null}_getFallbackMapOrDefault(e){return this._getFallbackMap(e)||this.getByType("OpenlayersMap")[0]||this._array[0]}async setActiveMap(e){const t=this.getByKey(e);if(!t)return Ie("MapCollection").warning(`could not find map with name ${e}`),Promise.resolve();this._activeMap&&this._activeMap.className==="CesiumMap"&&t.className==="OpenlayersMap"&&await dS(this._activeMap,t);try{await t.initialize()}catch(r){Ie("MapCollection").error(r),this.remove(t);const n=this._getFallbackMapOrDefault(t);if(this.initializeError.raiseEvent({map:t,error:r}),n)return this.fallbackMapActivated.raiseEvent(t),this.setActiveMap(n.name);throw new Error("cannot activate a single map")}let s;if(this._activeMap||this._cachedViewpoint){if(this._activeMap===t)return t.activate();if(s=this._activeMap?await this._activeMap.getViewpoint():this._cachedViewpoint,!await t.canShowViewpoint(s)){const n=this._getFallbackMap(t);if(n)return this.fallbackMapActivated.raiseEvent(t),this.setActiveMap(n.name)}if(this._cachedViewpoint=null,this._activeMap&&(this._activeMap.deactivate(),this._target)){const n=this._activeMap.className.split(".").pop();this._target.classList.remove(n)}}return this._activeMap=t,await this._activeMap.activate(),this._setActiveMapCSSClass(),s&&await this._activeMap.gotoViewpoint(s),this.clippingObjectManager.mapActivated(t),this._splitScreen.mapActivated(t),this.mapActivated.raiseEvent(t),Promise.resolve()}getByType(e){return this._array.filter(t=>t.className===e)}destroy(){super.destroy(),[...this._layerCollection].forEach(e=>{e.destroy()}),this._layerCollection.destroy(),this.eventHandler.destroy(),this.mapActivated.destroy(),this.clippingObjectManager.destroy(),this.clippingObjectManager=null,this._splitScreen.destroy(),this._splitScreen=null,this.fallbackMapActivated.destroy(),this.initializeError.destroy(),this._mapPointerListeners.forEach(e=>{e()}),this._mapPointerListeners=[],this._target=null}}function Sd(){return navigator.language?navigator.language.substring(0,2):"en"}function _r(){return Ie("init")}const Tn=new Map,Md="_defaultDynamicContext";class Cd{constructor(){this._id=et(),this._defaultDynamicContext=new To({id:Md}),this._dynamicContext=this._defaultDynamicContext;const e=()=>this._dynamicContext.id;this._dynamicContextIdChanged=new I,this._locale=Sd(),this._localeChanged=new I,this._mapClassRegistry=new vt(di),this._maps=fi(new Fn,e,null,wa.bind(null,this),kt),this._layerClassRegistry=new vt(ue),this._layers=fi(this._maps.layerCollection,e,bh.bind(null,this),ba.bind(null,this),de,Oh),this._layers.locale=this.locale,this._obliqueCollections=fi(new wt,e,null,t=>new $t(t),$t),this._viewpoints=fi(new wt,e,null,wh,ft),this._styleClassRegistry=new vt(Xi),this._styles=fi(new wt,e,null,St.bind(null,this._styleClassRegistry),dt),this._contexts=new Di("id"),this._contexts.add(this._dynamicContext),this._categoryClassRegisty=new vt(Jr),this._categories=new Nu(this),this._destroyed=new I,this._contextMutationPromise=Promise.resolve(),this._categoryItemClassRegistry=new vt(new Dt),this._tileProviderClassRegsitry=new vt(ui),this._featureProviderClassRegsitry=new vt(Kr),Tn.set(this._id,this)}get id(){return this._id}get locale(){return this._locale}set locale(e){if(v(e,String),e.length!==2){_r().warning('Provide a valid locale, for example "en", "de" with max. 2 letters');return}this._locale!==e&&(this._locale=e,this.layers.locale=e,this._localeChanged.raiseEvent(e))}get localeChanged(){return this._localeChanged}get maps(){return this._maps}get layers(){return this._layers}get obliqueCollections(){return this._obliqueCollections}get viewpoints(){return this._viewpoints}get styles(){return this._styles}get categories(){return this._categories}get destroyed(){return this._destroyed}get contexts(){return[...this._contexts]}get contextAdded(){return this._contexts.added}get contextRemoved(){return this._contexts.removed}get dynamicContextId(){return this._dynamicContext.id}get dynamicContextIdChanged(){return this._dynamicContextIdChanged}get mapClassRegistry(){return this._mapClassRegistry}get layerClassRegistry(){return this._layerClassRegistry}get styleClassRegistry(){return this._styleClassRegistry}get categoryClassRegistry(){return this._categoryClassRegisty}get categoryItemClassRegistry(){return this._categoryItemClassRegistry}get tileProviderClassRegistry(){return this._tileProviderClassRegsitry}get featureProviderClassRegistry(){return this._featureProviderClassRegsitry}getContextById(e){return this._contexts.getByKey(e)}async _parseContext(e){const{config:t}=e;t.projection&&Mh(t.projection),await this._styles.parseItems(t.styles,e.id),await this._layers.parseItems(t.layers,e.id),await this._obliqueCollections.parseItems(t.obliqueCollections,e.id),await this._viewpoints.parseItems(t.viewpoints,e.id),await this._maps.parseItems(t.maps,e.id),Array.isArray(t.categories)&&await Promise.all(t.categories.map(async({name:s,items:r})=>{await this._categories.parseCategoryItems(s,r,e.id)}))}async _setContextState(e){const{config:t}=e;[...this._layers].filter(r=>r[Le]===e.id).forEach(r=>{r.activeOnStartup&&r.activate().catch(n=>{_r().error(`Failed to activate active on startup layer ${r.name}`),_r().error(n),this._layers.remove(r),r.destroy()})});const s=[...this._obliqueCollections].find(r=>r[Le]===e.id&&r.activeOnStartup);if(s&&[...this._maps].filter(r=>r instanceof pe).forEach(r=>{r.setCollection(s)}),t.startingMapName?await this._maps.setActiveMap(t.startingMapName):!this._maps.activeMap&&this._maps.size>0&&await this._maps.setActiveMap([...this._maps][0].name),t.startingViewpointName&&this._maps.activeMap){const r=this._viewpoints.getByKey(t.startingViewpointName);r&&await this._maps.activeMap.gotoViewpoint(r)}}addContext(e){return v(e,To),this._contextMutationPromise=this._contextMutationPromise.then(async()=>{if(this._contexts.has(e)){_r().info(`context with id ${e.id} already loaded`);return}await this._parseContext(e),await this._setContextState(e),this._contexts.add(e)}),this._contextMutationPromise}setDynamicContext(e){if(!this._contexts.has(e))throw new Error("Context is not managed by this app, call add(context) before");this._dynamicContext!==e&&(this._dynamicContext=e,this.dynamicContextIdChanged.raiseEvent(this.dynamicContextId))}resetDynamicContext(){this.setDynamicContext(this._defaultDynamicContext)}async _removeContext(e){await Promise.all([this._maps.removeContext(e),this._layers.removeContext(e),this._viewpoints.removeContext(e),this._styles.removeContext(e),this._obliqueCollections.removeContext(e)])}removeContext(e){return this._contextMutationPromise=this._contextMutationPromise.then(async()=>{const t=this._contexts.getByKey(e);if(!t){_r().info(`context with id ${e} has alread been removed`);return}await this._removeContext(e),this._contexts.remove(t)}),this._contextMutationPromise}destroy(){Object.defineProperty(this,"_contextMutationPromise",{get(){throw new Error("VcsApp was destroyed")}}),Tn.delete(this._id),Mt(this._maps),Mt(this._layers),Mt(this._obliqueCollections),Mt(this._viewpoints),Mt(this._styles),Mt(this._contexts),Mt(this._categories),this._mapClassRegistry.destroy(),this._layerClassRegistry.destroy(),this._styleClassRegistry.destroy(),this._categoryClassRegisty.destroy(),this._categoryItemClassRegistry.destroy(),this._tileProviderClassRegsitry.destroy(),this._featureProviderClassRegsitry.destroy(),this.destroyed.raiseEvent(),this.destroyed.destroy(),this.localeChanged.destroy(),this.dynamicContextIdChanged.destroy()}}function fS(i){return Tn.get(i)}window.vcs=window.vcs||{},window.vcs.apps=Tn;function Ho(i){const e=i.getType();return e==="LineString"?ro(i):e==="Polygon"?Qa(i):e==="Point"?ao(i):e==="Circle"?io(i):!1}function gS(i,e,t){v(i,Cd),v(e,ce),v(t,Object.values(Ze));const{interactionChain:s,removed:r,destroy:n}=fd(i.maps.eventHandler),a=new I,o=new I,l=new I;let h=!1,c=null,u=null,d=!1,f=[];const g=()=>{c&&(s.removeInteraction(c),c.destroy(),c=null),f.forEach(E=>{E()}),f=[]},m=()=>{g(),t===Ze.Polygon?c=new vd:t===Ze.Point?c=new _d:t===Ze.LineString?c=new gd:t===Ze.BBox?c=new yd:t===Ze.Circle&&(c=new md),f=[c.created.addEventListener(E=>{d&&(i.maps.activeMap.switchEnabled=!1),u=new ol({geometry:E}),u[Gt]=!0,e.addFeatures([u]),a.raiseEvent(u)}),c.finished.addEventListener(E=>{d&&(i.maps.activeMap.switchEnabled=!0),u&&(delete u[Gt],(!E||u.getGeometry()!==E||!Ho(E))&&(e.removeFeaturesById([u.getId()]),u=null)),o.raiseEvent(u),u=null,h||m()})],s.addInteraction(c)};m();const p=()=>{c&&c.finish(),m()};let y=()=>{};const _=()=>{y();const{activeMap:E}=i.maps;d=E instanceof pe,d?y=E.imageChanged.addEventListener(p):y=()=>{}},w=i.maps.mapActivated.addEventListener(()=>{_(),p()});_();const L=()=>{h=!0,w(),y(),c&&c.finish(),g(),n(),l.raiseEvent(),l.destroy(),a.destroy()};return r.addEventListener(L),{type:zo.CREATE,geometryType:t,featureCreated:a,creationFinished:o,stopped:l,finish:()=>{c&&c.finish()},stop:L}}class xd extends Se{constructor(e){super(b.CLICK,G.NONE),this._layer=e,this._selectedFeature=null,this.featureChanged=new I,this.setActive()}get selectedFeature(){return this._selectedFeature}async pipe(e){return e.feature&&e.feature[j]===this._layer.name?this._selectedFeature&&e.feature.getId()===this._selectedFeature.getId()||(e.stopPropagation=!0,await this.selectFeature(e.feature)):this.clear(),e}async selectFeature(e){let t=e;e[In]&&(t=await this._layer.switchStaticFeatureToDynamic(e.getId())),this._selectedFeature=t,this.featureChanged.raiseEvent(this._selectedFeature)}clear(){this._selectedFeature&&(this._selectedFeature=null,this.featureChanged.raiseEvent(null))}}const Ii=Symbol("Vertex"),mS=Symbol("VertexIndex");class ms extends Se{constructor(){super(b.DRAGEVENTS,G.ALT),this.vertexChanged=new I,this._vertex=null,this.setActive()}async pipe(e){return this._vertex?(this._vertex.getGeometry().setCoordinates(e.positionOrPixel),this.vertexChanged.raiseEvent(this._vertex),e.type&b.DRAGEND&&(this._vertex.setStyle(null),this._vertex=null),e.stopPropagation=!0):e.type&b.DRAGSTART&&e.feature&&e.feature[Ii]&&(this._vertex=e.feature,this._vertex.setStyle(Yi),e.stopPropagation=!0),e}destroy(){this.vertexChanged.destroy(),super.destroy()}}class $o extends Se{constructor(){super(b.CLICK,G.SHIFT),this.vertexRemoved=new I,this.setActive()}async pipe(e){return e.feature&&e.feature[Ii]&&this.vertexRemoved.raiseEvent(e.feature),e}destroy(){this.vertexRemoved.destroy(),super.destroy()}}function Pi(i){const e=new Bt(i);e[ce.alreadyTransformedToImage]=!0;const t=new Z({geometry:e});return t[Ii]=!0,t[ce.doNotTransform]=!0,t}let Li=new K,Ti=new K,Vo=new K,Ke=new M,me=new M,Bo=new M;function wd(i,e,t,s=P.EPSILON5){Ke=M.fromElements(e[0]-i[0],e[1]-i[1],e[2]-i[2],Ke),me=M.fromElements(t[0]-i[0],t[1]-i[1],t[2]-i[2],me),Bo=M.fromElements(t[0]-e[0],t[1]-e[1],t[2]-t[2],Bo);const r=M.magnitude(Ke);return r<M.magnitude(me)||r<M.magnitude(Bo)?!1:(Ke=M.normalize(Ke,Ke),me=M.normalize(me,me),Ke.equalsEpsilon(me,s))}function bd(i,e,t,s=P.EPSILON5){Li=K.fromElements(e[0]-i[0],e[1]-i[1],Li),Ti=K.fromElements(t[0]-i[0],t[1]-i[1],Ti),Vo=K.fromElements(t[0]-e[0],t[1]-e[1],Vo);const r=K.magnitude(Li);return r<K.magnitude(Ti)||r<K.magnitude(Vo)?!1:(Li=K.normalize(Li,Li),Ti=K.normalize(Ti,Ti),Li.equalsEpsilon(Ti,s))}function pS(i,e){const t=D.mercatorToWgs84(i);return Ke=M.fromDegrees(t[0],t[1],t[2]),me=e.globe.ellipsoid.geodeticSurfaceNormal(Ke,me),me=M.cross(e.camera.rightWC,me,me),me=M.normalize(me,me),Pt.fromPointNormal(Ke,me)}function yS(i,e){const t=D.mercatorToWgs84(i);return Ke=M.fromDegrees(t[0],t[1],t[2]),me=e.globe.ellipsoid.geodeticSurfaceNormal(Ke,me),Pt.fromPointNormal(Ke,me)}class Uo extends Se{constructor(e,t){super(b.CLICK,G.NONE),this.vertexInserted=new I,this._feature=e,this._geometry=t,this._isLinearRing=this._geometry instanceof mf,this.setActive()}async pipe(e){if(e.feature===this._feature){const t=this._geometry.getCoordinates(),s=e.positionOrPixel,r=this._geometry.getClosestPoint(s);if(this._isLinearRing&&t.push(t[0]),mt(r,s)<e.map.getCurrentResolution(s)*5){const a=t.length-1;let o=0;for(o;o<a&&!(this._feature.get("olcs_altitudeMode")==="clampToGround"?bd(t[o],t[o+1],r):wd(t[o],t[o+1],r));o++);let l=o+1;this._isLinearRing&&l===t.length&&(l=0),this.vertexInserted.raiseEvent({vertex:Pi(r),index:l})}}return e}destroy(){this.vertexInserted.destroy(),super.destroy()}}const Ni={auto:"auto",scaleNESW:"nesw-resize",scaleNWSE:"nwse-resize",rotate:"crosshair",translate:"move",select:"pointer",edit:"pointer",translateVertex:"move",removeVertex:"pointer",insertVertex:"cell",addToSelection:"cell",removeFromSelection:"not-allowed"};class Od extends Se{constructor(e){super(b.MOVE,G.ALL),this._lastFeature=null,this.layerName=e,this.cursorStyle=document.body.style,this.setActive()}async pipe(e){return e.feature&&(e.feature[j]===this.layerName||e.feature[Ii])?this._lastFeature=e.feature:this._lastFeature=null,this._evaluate(e.key),e}modifierChanged(e){this._evaluate(e)}setActive(e){super.setActive(e),this.reset()}reset(){this.cursorStyle&&this.cursorStyle.cursor&&(this.cursorStyle.cursor=Ni.auto)}_evaluate(e){this._lastFeature?this._lastFeature[Ii]?e===G.SHIFT?this.cursorStyle.cursor=Ni.removeVertex:e===G.ALT?this.cursorStyle.cursor=Ni.translateVertex:this.cursorStyle.cursor=Ni.auto:this.cursorStyle.cursor=Ni.select:this.cursorStyle.cursor=Ni.auto}destroy(){this.cursorStyle=null,super.destroy()}}function _S(i){const e=i.olMap.getInteractions().getArray().find(t=>t instanceof pf);return e?(e.setActive(!1),()=>{e.setActive(!0)}):()=>{}}function vS(i){function e(r){return Array.isArray(r)?r.slice():typeof r=="object"?S({},r):r}const t={},{screenSpaceCameraController:s}=i.getScene();return["lookEventTypes","tiltEventTypes","rotateEventTypes"].forEach(r=>{s!=null&&(t[r]=e(s[r]))}),s.lookEventTypes=void 0,s.tiltEventTypes=void 0,s.rotateEventTypes=void 0,()=>{s.lookEventTypes=t.lookEventTypes,s.tiltEventTypes=t.tiltEventTypes,s.rotateEventTypes=t.rotateEventTypes}}class Ed extends Se{constructor(){super(b.MOVE,G.ALL),this._clear=()=>{},this.setActive()}async pipe(e){return this.reset(),e.feature&&e.feature[Ii]&&(e.map.className==="CesiumMap"?this._clear=vS(e.map):this._clear=_S(e.map)),e}reset(){this._clear(),this._clear=()=>{}}}function SS(i,e){var h;const t=(h=i[Rt])!=null?h:i.getGeometry(),s=t.getCoordinates().map(Pi);e.addFeatures(s);const r=()=>{t.setCoordinates(s.map(c=>c.getGeometry().getCoordinates()))},n=new ms;n.vertexChanged.addEventListener(r);const a=new Uo(i,t);a.vertexInserted.addEventListener(({vertex:c,index:u})=>{e.addFeatures([c]),s.splice(u,0,c),r()});const o=new $o;o.vertexRemoved.addEventListener(c=>{e.removeFeaturesById([c.getId()]);const u=s.indexOf(c);u>-1&&(s.splice(u,1),r())});const l=new ei([n,a,o]);return{interactionChain:l,destroy:()=>{e.removeFeaturesById(s.map(c=>c.getId())),l.destroy()}}}function MS(i,e){var a;const t=(a=i[Rt])!=null?a:i.getGeometry(),s=t.getCoordinates().map(Pi);e.addFeatures(s);const r=new ms;r.vertexChanged.addEventListener(o=>{if(s.indexOf(o)===1){const l=t.getCoordinates();l[1]=o.getGeometry().getCoordinates();const h=mt(l[0],l[1]);t.setRadius(h)}else t.setCenter(o.getGeometry().getCoordinates()),s[1].getGeometry().setCoordinates(t.getCoordinates()[1])});const n=new ei([r]);return{interactionChain:n,destroy:()=>{e.removeFeaturesById(s.map(o=>o.getId())),n.destroy()}}}function CS(i,e){var a;const t=(a=i[Rt])!=null?a:i.getGeometry(),s=t.getCoordinates()[0].map(Pi);e.addFeatures(s);const r=new ms;r.vertexChanged.addEventListener(o=>{const l=s.indexOf(o),h=Fr(l+2,4),c=Fr(l+1,4),u=Fr(l-1,4),d=s[h].getGeometry().getCoordinates(),f=o.getGeometry().getCoordinates();let g=!1;d[0]===f[0]&&(f[0]+=1e-8,g=!0),d[1]===f[1]&&(f[1]+=1e-8,g=!0),g&&o.getGeometry().setCoordinates(f);const m=p=>{const y=s[p].getGeometry(),_=y.getCoordinates();_[0]===d[0]?_[1]=f[1]:_[0]=f[0],y.setCoordinates(_)};m(c),m(u),t.setCoordinates([s.map(p=>p.getGeometry().getCoordinates())])});const n=new ei([r]);return{interactionChain:n,destroy:()=>{e.removeFeaturesById(s.map(o=>o.getId())),n.destroy()}}}function xS(i,e){var c;const t=(c=i[Rt])!=null?c:i.getGeometry(),s=t.getLinearRing(0),r=s.getCoordinates().map(Pi);e.addFeatures(r);const n=()=>{const u=r.map(d=>d.getGeometry().getCoordinates());s.setCoordinates(u),t.setCoordinates([r.map(d=>d.getGeometry().getCoordinates())])},a=new ms;a.vertexChanged.addEventListener(n);const o=new Uo(i,s);o.vertexInserted.addEventListener(({vertex:u,index:d})=>{e.addFeatures([u]),r.splice(d,0,u),n()});const l=new $o;l.vertexRemoved.addEventListener(u=>{e.removeFeaturesById([u.getId()]);const d=r.indexOf(u);d>-1&&(r.splice(d,1),n())});const h=new ei([a,o,l]);return{interactionChain:h,destroy:()=>{e.removeFeaturesById(r.map(u=>u.getId())),h.destroy()}}}function wS(i,e){const t=Pi(i.getGeometry().getCoordinates()),s=i.getStyle();i.setStyle(Yi),e.addFeatures([t]);const r=new ms;r.vertexChanged.addEventListener(()=>{i.getGeometry().setCoordinates(t.getGeometry().getCoordinates())});const n=new ei([r]);return{interactionChain:n,destroy:()=>{n.destroy(),e.removeFeaturesById([t.getId()]),i.setStyle(s)}}}function bS(i,e){const{interactionChain:t,removed:s,destroy:r}=fd(i.maps.eventHandler),n=dd(i.layers),a=new xd(e);t.addInteraction(a);const o=new Ed;t.addInteraction(o);const l=new Od(e.name);t.addInteraction(l);const h=new I;let c=null,u=null,d=null;const f=()=>{c&&(t.removeInteraction(c.interactionChain),c.destroy(),c=null),u&&(delete u[Gt],Ho(u.getGeometry())||e.removeFeaturesById([u.getId()])),u=null,d&&(d.switchEnabled=!0)};a.featureChanged.addEventListener(_=>{var w;if(f(),_){d&&(d.switchEnabled=!1),u=_,u[Gt]=!0;const L=(w=_[Rt])!=null?w:_.getGeometry(),E=L.getType();E===Ze.Polygon?L.get("_vcsGeomType")===Ze.BBox?c=CS(_,n):L.getLinearRingCount()===1&&(c=xS(_,n)):E===Ze.LineString?c=SS(_,n):E===Ze.Point?c=wS(_,n):E===Ze.Circle&&(c=MS(_,n)),c?t.addInteraction(c.interactionChain):(Ie("EditGeometrySession").warning(`Geometry of type ${E} is currently not supported`),u[Gt]=!1,u=null,a.clear())}});let g=()=>{};const m=()=>{o.reset(),l.reset(),a.clear(),g();const{activeMap:_}=i.maps;_ instanceof pe?(d=_,g=_.imageChanged.addEventListener(()=>{a.clear()})):(d=null,g=()=>{})},p=i.maps.mapActivated.addEventListener(m);m();const y=()=>{i.layers.remove(n),g(),p(),o.reset(),l.reset(),f(),r(),h.raiseEvent(),h.destroy()};return s.addEventListener(y),{type:zo.EDIT_GEOMETRY,featureSelection:a,stopped:h,stop:y}}export{Ai as AbstractFeatureProvider,Se as AbstractInteraction,yi as AltitudeModeCesium,Lo as AppBackedCategory,rr as BaseOLMap,Ve as BitCounter,ys as CameraLimiter,wn as CameraLimiterMode,Et as Category,Nu as CategoryCollection,z as CesiumMap,ii as CesiumTilesetCesiumImpl,Ot as CesiumTilesetLayer,Dt as ClassRegistry,_i as ClassificationTypeCesium,Ei as ClippingObject,ud as ClippingObjectManager,Y1 as ClusterContext,wt as Collection,To as Context,Dn as CoordinateAtPixel,yd as CreateBBoxInteraction,md as CreateCircleInteraction,gd as CreateLineStringInteraction,_d as CreatePointInteraction,vd as CreatePolygonInteraction,vr as CzmlLayer,Hu as DataSourceCesiumImpl,Fi as DataSourceLayer,he as DataState,Oe as DeclarativeStyleItem,vu as DefaultObliqueCollection,Od as EditGeometryMouseOverInteraction,ju as EventHandler,b as EventType,Vh as ExclusiveManager,Me as Extent,Vt as Extent3D,ku as FeatureAtPixelInteraction,bt as FeatureLayer,zu as FeatureProviderInteraction,_s as FeatureStoreLayer,ed as FeatureStoreLayerChanges,bi as FeatureStoreLayerState,nn as FeatureVisibility,X as FeatureVisibilityAction,vs as GeoJSONLayer,Ze as GeometryType,an as GlobalHider,Di as IndexedCollection,Uo as InsertVertexInteraction,ei as InteractionChain,de as Layer,Ht as LayerCollection,Qt as LayerImplementation,ru as LayerObliqueImpl,nr as LayerOpenlayersImpl,ee as LayerState,Cr as MVTTileProvider,Fn as MapCollection,Ed as MapInteractionController,it as MapState,G as ModificationKeyType,$t as ObliqueCollection,So as ObliqueDataSet,Mn as ObliqueImage,hr as ObliqueImageMeta,pe as ObliqueMap,Mu as ObliqueProvider,hu as ObliqueView,ge as ObliqueViewDirection,La as OlcsGeometryType,$u as OpenStreetMapCesiumImpl,Ss as OpenStreetMapLayer,td as OpenStreetMapOpenlayersImpl,ie as OpenlayersMap,vt as OverrideClassRegistry,Oa as PatternType,Ms as PointCloudLayer,Be as PointerEventType,le as PointerKeyType,D as Projection,Ue as RasterLayer,Oi as RasterLayerCesiumImpl,fs as RasterLayerOpenlayersImpl,$o as RemoveVertexInteraction,xd as SelectSingleFeatureInteraction,zo as SessionType,Vu as SingleImageCesiumImpl,Sr as SingleImageLayer,id as SingleImageOpenlayersImpl,jo as SplitScreen,xr as StaticGeoJSONTileProvider,dt as StyleItem,xs as TMSLayer,Bu as TerrainCesiumImpl,Cs as TerrainLayer,Q1 as TileDebugOpenlayersImpl,Je as TileProvider,On as TileProviderFeatureProvider,jt as TilingScheme,qu as TmsCesiumImpl,sd as TmsOpenlayersImpl,ms as TranslateVertexInteraction,Mr as URLTemplateTileProvider,Cd as VcsApp,I as VcsEvent,kt as VcsMap,ut as VcsObject,Yc as VectorCesiumImpl,Xc as VectorContext,ce as VectorLayer,po as VectorObliqueImpl,Ka as VectorOpenlayersImpl,nt as VectorProperties,Zu as VectorRasterTileCesiumImpl,W as VectorStyleItem,Yu as VectorTileImageryProvider,ws as VectorTileLayer,rd as VectorTileOpenlayersImpl,ft as Viewpoint,Ro as WFSLayer,si as WMSFeatureProvider,bs as WMSLayer,Os as WMTSLayer,Ku as WmsCesiumImpl,nd as WmsOpenlayersImpl,Ju as WmtsCesiumImpl,ad as WmtsOpenlayersImpl,Ki as actuallyIsCircle,as as addPrimitiveToContext,fn as addPrimitivesToContext,Ge as alreadyTransformedToImage,zh as alreadyTransformedToMercator,Zr as angleEqualsEpsilon,tn as blackColor,Uu as calculateMinLevel,mt as cartesian2DDistance,Il as cartesian3DDistance,Jr as categoryClassRegistry,At as cesiumColorToColor,ti as cesiumTilesetLastUpdated,uo as checkLineIntersection,qa as circleFromCenterRadius,zc as circleToCesium,yr as clearClippingPlanes,u_ as colorInCanvas,Lh as combineFont,Le as contextIdSymbol,qc as convert,Wa as convertGeometryToPolygon,cg as coordinateAtDistance,xa as coordinateEqualsEpsilon,gs as copyClippingPlanesToCollection,Wh as createClassificationPrimitive,cS as createClippingFeature,aS as createClippingPlaneCollection,yS as createHorizontalPlane,Ga as createLinePrimitive,Yh as createOutlinePrimitive,Ph as createPattern,Xh as createPrimitive,Gt as createSync,Pi as createVertex,pS as createVerticalPlane,Ni as cursorMap,Hh as defaultDeclarativeStyle,Md as defaultDynamicContextId,m_ as defaultExtrudedHeightCondition,od as defaultPointCloudStyle,mi as defaultVectorStyle,ba as deserializeLayer,wa as deserializeMap,wh as deserializeViewpoint,Mt as destroyCollection,Sd as detectBrowserLocale,Fa as doNotTransform,Aa as embedIconsInStyle,f_ as emptyColor,Yi as emptyStyle,_n as enforceEndingVertex,Nc as enforceRightHand,Zi as featureExists,Pn as featureFromOptions,Kr as featureProviderClassRegistry,rt as featureStoreStateSymbol,Ah as fromCesiumColor,Ci as fvLastUpdated,Ho as geometryIsValid,ir as getAltitudeModeOptions,Hc as getBillboardOptions,Xu as getCanvasFromFeatures,Bc as getCartesian3AndWGS84FromCoordinates,un as getCartesian3Options,gi as getCesiumColor,hn as getClassificationTypeOptions,uS as getClippingOptions,d_ as getCssStyleFromTextStyle,te as getDefaultCondition,Ch as getDefaultProjection,Ia as getDefaultVectorStyleItemOptions,y1 as getDirectionName,Eu as getEPSGCodeFromGeojson,Do as getExtentFromTileset,en as getFillOptions,ss as getFlatCoordinatesFromGeometry,Ua as getFlatCoordinatesFromSimpleGeometry,Gu as getFormat,Za as getGenericFeatureFromClickedObject,U1 as getGenericFeatureFromProvidedFeature,Kh as getHeightAboveGround,wi as getHeightFromTerrainProvider,dn as getHeightInfo,Qu as getJSONObjectFromObject,$c as getLabelOptions,Oh as getLayerIndex,eu as getLongestSide,qh as getMaterialAppearance,Zh as getMinHeightOrGroundLevel,Vc as getModelOptions,cn as getNearFarValueOptions,St as getObjectFromClassRegistry,go as getPolygonizedGeometry,fo as getResolutionOptions,Pa as getShapeFromOptions,cr as getStateFromStatesArray,ka as getStoreyHeights,ja as getStoreyOptions,je as getStringColor,er as getStrokeOptions,sr as getStyleOrDefaultStyle,or as getStylesArray,ls as getTerrainProviderForUrl,Nh as getTextFromOptions,Th as getTextOptions,Fo as getTilingScheme,Ao as getURL,fS as getVcsAppById,yo as getVersionFromImageJson,Oo as getViewDirectionFromViewpoint,No as getWMSSource,tu as getZoom,$e as globalHidden,rs as globalHiderLastUpdated,iS as globeLoaded,Qc as hasSameOrigin,Ih as hexToOlColor,He as hidden,Re as highlighted,su as imageGeometryToMercatorGeometry,ug as initialBearingBetweenCoords,pr as isMobile,Qr as isOverrideCollection,Au as isProvidedFeature,gr as isSameOrigin,Zc as isTerrainTileAvailable,In as isTiledFeature,ue as layerClassRegistry,no as lineStringToCesium,fi as makeOverrideCollection,di as mapClassRegistry,Fu as markVolatile,Bh as maxZIndex,iu as mercatorGeometryToImageGeometry,R as mercatorProjection,mr as mercatorResolutionsToLevel,va as mercatorToWgs84Transformer,Fr as modulo,Rt as obliqueGeometry,Sn as obliqueViewDirectionNames,l_ as olColorToCesiumColor,Ea as olColorToHex,Jt as originalFeatureSymbol,Ct as originalStyle,ln as parseCartesian3,Te as parseColor,c_ as parseFont,zt as parseGeoJSON,_o as parseImageData,au as parseImageMeta,ou as parseLegacyImageData,on as parseNearFarScalar,vi as parseStoreyHeights,bd as pointOnLine2D,wd as pointOnLine3D,oo as pointToCesium,eo as polygonToCesium,Ca as propertyEqualsEpsilon,En as rectangleToExtent,xi as removeArrayFromCollection,Xa as removeEndingVertex,Ya as removeEndingVertexFromGeometry,ns as removeFeatureFromMap,lu as requestArrayBuffer,xt as requestJson,vo as requestUrl,bh as serializeLayer,ko as setClippingPlanes,Mh as setDefaultProjectionOptions,mo as setNewGeometry,Wc as setReferenceForPicking,dd as setupScratchLayer,Dh as shapeCategory,Ru as showProvidedFeature,co as sortRealWordEdgeCoordinates,gS as startCreateFeatureSession,bS as startEditGeometrySession,Xi as styleClassRegistry,kh as synchronizeFeatureVisibility,vn as synchronizeFeatureVisibilityWithSource,ui as tileProviderClassRegistry,tS as tiledLayerLoaded,Wu as toContext,Kc as transformCWIFC,hs as transformFromImage,_1 as transformToImage,Dc as updateFeatureVisibility,Fc as updateGlobalHider,Iu as updateLegacyFeature,io as validateCircle,h_ as validateHexColor,ro as validateLineString,ao as validatePoint,Qa as validatePolygon,za as validateStoreys,j as vcsLayerName,Da as vcsMetaVersion,Ae as vectorStyleSymbol,mS as vertexIndex,Ii as vertexSymbol,Du as volatileContextId,U as wgs84Projection,Js as wgs84ToMercatorTransformer,tr as whiteColor,j1 as writeGeoJSON,ds as writeGeoJSONFeature,$h as writeStyle};
|