@vcmap/ui 5.0.0-rc.10 → 5.0.0-rc.13

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.
Files changed (165) hide show
  1. package/README.md +12 -5
  2. package/build/build.js +6 -3
  3. package/build/buildHelpers.js +12 -4
  4. package/build/buildPreview.js +7 -0
  5. package/build/getPluginProxies.js +4 -0
  6. package/config/aerowest.config.json +13 -3
  7. package/config/base.config.json +398 -219
  8. package/config/codes.config.json +397 -0
  9. package/config/dev.config.json +375 -1
  10. package/config/graphFeatureInfo.config.json +100 -0
  11. package/config/www.config.json +1232 -0
  12. package/dist/assets/{cesium.eb5667.js → cesium.21663e.js} +0 -0
  13. package/dist/assets/cesium.js +1 -1
  14. package/dist/assets/core.63242d.js +4 -0
  15. package/dist/assets/core.js +1 -1
  16. package/dist/assets/font/OFL.txt +93 -0
  17. package/dist/assets/font/TitilliumWeb-Regular.woff2 +0 -0
  18. package/dist/assets/{index.4ccd4433.js → index.44b91cfe.js} +1 -1
  19. package/dist/assets/{ol.ef03b1.js → ol.88ba9d.js} +0 -0
  20. package/dist/assets/ol.js +1 -1
  21. package/dist/assets/ui.3c2933.css +1 -0
  22. package/dist/assets/ui.3c2933.js +71 -0
  23. package/dist/assets/ui.js +1 -1
  24. package/dist/assets/vue.c897fc.js +9 -0
  25. package/dist/assets/vue.js +2 -1
  26. package/dist/assets/{vuetify.401a29.css → vuetify.147c3a.css} +1 -1
  27. package/dist/assets/{vuetify.401a29.js → vuetify.147c3a.js} +72 -72
  28. package/dist/assets/vuetify.js +2 -2
  29. package/dist/index.html +1 -5
  30. package/index.js +39 -5
  31. package/lib/vue.js +1 -0
  32. package/map.config.json +15 -6
  33. package/package.json +17 -8
  34. package/plugins/@vcmap/create-link/fallbackCreateLink.vue +71 -0
  35. package/plugins/@vcmap/create-link/index.js +83 -0
  36. package/plugins/@vcmap/create-link/package.json +6 -0
  37. package/plugins/@vcmap/pluginExample/index.js +2 -2
  38. package/plugins/@vcmap/pluginExample/pluginExampleComponent.vue +20 -3
  39. package/plugins/@vcmap/project-selector/ProjectSelectorComponent.vue +1 -1
  40. package/plugins/@vcmap/project-selector/index.js +1 -1
  41. package/plugins/@vcmap/project-selector/package.json +1 -2
  42. package/plugins/@vcmap/theme-changer/ThemeChangerComponent.vue +1 -1
  43. package/plugins/@vcmap/theme-changer/index.js +1 -1
  44. package/plugins/@vcmap/theme-changer/package.json +1 -2
  45. package/plugins/categoryTest/Categories.vue +89 -1
  46. package/plugins/categoryTest/Category.vue +1 -1
  47. package/plugins/example/index.js +10 -23
  48. package/plugins/simple-graph/README.md +51 -0
  49. package/plugins/simple-graph/SimpleGraphComponent.vue +70 -0
  50. package/plugins/simple-graph/index.js +17 -0
  51. package/plugins/simple-graph/package.json +11 -0
  52. package/plugins/simple-graph/simpleGraphView.js +76 -0
  53. package/plugins/test/editor.vue +1 -1
  54. package/plugins/test/index.js +76 -9
  55. package/plugins/test/toolbox-data.js +82 -57
  56. package/plugins/test/windowManagerExample.vue +1 -1
  57. package/src/actions/stateRefAction.js +2 -2
  58. package/src/actions/styleSelector.vue +1 -1
  59. package/src/application/Navbar.vue +13 -2
  60. package/src/application/VcsApp.vue +301 -116
  61. package/src/application/VcsMap.vue +1 -1
  62. package/src/application/VcsSettings.vue +1 -1
  63. package/src/application/vcsAppWrapper.vue +1 -0
  64. package/src/assets/font/OFL.txt +93 -0
  65. package/src/assets/font/TitilliumWeb-Regular.woff2 +0 -0
  66. package/src/components/form-inputs-controls/VcsCheckbox.vue +13 -0
  67. package/src/components/form-inputs-controls/VcsColorPicker.vue +1 -1
  68. package/src/components/form-inputs-controls/VcsRadio.vue +123 -0
  69. package/src/components/form-output/VcsFormattedNumber.vue +1 -1
  70. package/src/components/lists/VcsActionList.vue +22 -7
  71. package/src/components/lists/VcsTreeview.vue +4 -4
  72. package/src/components/lists/VcsTreeviewLeaf.vue +10 -3
  73. package/src/components/lists/VcsTreeviewSearchbar.vue +1 -2
  74. package/src/components/tables/VcsTable.vue +245 -0
  75. package/src/contentTree/LayerTree.vue +1 -1
  76. package/src/contentTree/contentTreeCollection.js +4 -4
  77. package/src/contentTree/contentTreeItem.js +9 -9
  78. package/src/contentTree/groupContentTreeItem.js +1 -1
  79. package/src/contentTree/layerContentTreeItem.js +15 -1
  80. package/src/contentTree/layerGroupContentTreeItem.js +21 -1
  81. package/src/contentTree/nodeContentTreeItem.js +1 -1
  82. package/src/featureInfo/AddressBalloonComponent.vue +47 -0
  83. package/src/featureInfo/BalloonComponent.vue +140 -0
  84. package/src/featureInfo/abstractFeatureInfoView.js +313 -0
  85. package/src/featureInfo/addressBalloonFeatureInfoView.js +118 -0
  86. package/src/featureInfo/balloonFeatureInfoView.js +151 -0
  87. package/src/featureInfo/balloonHelper.js +132 -0
  88. package/src/featureInfo/featureInfo.js +457 -0
  89. package/src/featureInfo/featureInfoInteraction.js +42 -0
  90. package/src/featureInfo/iframeFeatureInfoView.js +95 -0
  91. package/src/featureInfo/tableFeatureInfoView.js +106 -0
  92. package/src/i18n/de.js +26 -0
  93. package/src/i18n/en.js +26 -0
  94. package/src/i18n/i18nCollection.js +17 -0
  95. package/src/icons/+all.js +80 -0
  96. package/src/icons/ClippingHorizontalIcon.vue +7 -0
  97. package/src/icons/ClippingIcon.vue +7 -0
  98. package/src/icons/ClippingVerticalIcon.vue +7 -0
  99. package/src/icons/ColorPickerIcon.vue +7 -0
  100. package/src/icons/ComponentsIcon.vue +2 -2
  101. package/src/icons/DimensionsHouseIcon.vue +11 -9
  102. package/src/icons/EditIcon.vue +7 -0
  103. package/src/icons/GlobalTerrainIcon.vue +9 -0
  104. package/src/icons/GroundIcon.vue +18 -0
  105. package/src/icons/HideIcon.vue +12 -0
  106. package/src/icons/LogoutIcon.vue +7 -0
  107. package/src/icons/ObjectAttributeIcon.vue +2 -13
  108. package/src/icons/PedestrianIcon.vue +2 -3
  109. package/src/icons/PenIcon.vue +2 -9
  110. package/src/icons/PoiIcon.vue +5 -2
  111. package/src/icons/PointSelectIcon.vue +4 -2
  112. package/src/icons/QueryIcon.vue +6 -7
  113. package/src/icons/ScreenshotIcon.vue +16 -0
  114. package/src/icons/ShareIcon.vue +4 -16
  115. package/src/icons/SkipNextIcon.vue +3 -1
  116. package/src/icons/TerrainBoxIcon.vue +9 -0
  117. package/src/icons/ToolsIcon.vue +4 -30
  118. package/src/icons/UploadIcon.vue +2 -9
  119. package/src/icons/UserProfileIcon.vue +7 -0
  120. package/src/icons/UserShareIcon.vue +7 -0
  121. package/src/icons/VideoRecorderIcon.vue +5 -9
  122. package/src/icons/ViewpointFlightIcon.vue +11 -0
  123. package/src/icons/ViewpointIcon.vue +11 -0
  124. package/src/icons/Viewshed360Icon.vue +7 -0
  125. package/src/icons/ViewshedConeIcon.vue +7 -0
  126. package/src/icons/ViewshedIcon.vue +7 -0
  127. package/src/icons/WallIcon.vue +4 -9
  128. package/src/legend/legendHelper.js +193 -0
  129. package/src/legend/styleLegendItem.vue +129 -0
  130. package/src/legend/vcsLegend.vue +92 -0
  131. package/src/manager/buttonManager.js +7 -12
  132. package/src/manager/categoryManager/ComponentsManager.vue +30 -0
  133. package/src/manager/categoryManager/categoryManager.js +500 -0
  134. package/src/manager/contextMenu/contextMenuComponent.vue +43 -0
  135. package/src/manager/contextMenu/contextMenuInteraction.js +42 -0
  136. package/src/manager/contextMenu/contextMenuManager.js +197 -0
  137. package/src/manager/navbarManager.js +9 -9
  138. package/src/manager/toolbox/GroupToolboxComponent.vue +118 -0
  139. package/src/manager/toolbox/SelectToolboxComponent.vue +128 -0
  140. package/src/manager/toolbox/ToolboxManager.vue +116 -98
  141. package/src/manager/toolbox/toolboxManager.js +235 -86
  142. package/src/manager/window/WindowComponent.vue +1 -1
  143. package/src/manager/window/WindowManager.vue +5 -3
  144. package/src/manager/window/windowManager.js +118 -14
  145. package/src/navigation/mapNavigation.vue +3 -5
  146. package/src/navigation/overviewMap.js +28 -5
  147. package/src/navigation/vcsCompass.vue +1 -1
  148. package/src/pluginHelper.js +42 -10
  149. package/src/setup.js +0 -2
  150. package/src/state.js +256 -0
  151. package/src/styles/_theming.scss +0 -5
  152. package/src/styles/variables.scss +7 -0
  153. package/src/styles/vcsFont.scss +17 -0
  154. package/src/uiConfig.js +79 -0
  155. package/src/vcsUiApp.js +213 -22
  156. package/src/vuePlugins/vuetify.js +14 -4
  157. package/config/berlin.config.json +0 -510
  158. package/dist/assets/core.216494.js +0 -4
  159. package/dist/assets/ui.99a1a7.css +0 -1
  160. package/dist/assets/ui.99a1a7.js +0 -70
  161. package/dist/assets/vue-composition-api.c5aca1.js +0 -14
  162. package/dist/assets/vue-composition-api.js +0 -2
  163. package/dist/assets/vue.762edd.js +0 -9
  164. package/lib/vue-composition-api.js +0 -2
  165. package/src/manager/toolbox/ToolboxGroupComponent.vue +0 -128
@@ -1,4 +0,0 @@
1
- var td=Object.defineProperty,id=Object.defineProperties;var sd=Object.getOwnPropertyDescriptors;var No=Object.getOwnPropertySymbols;var rd=Object.prototype.hasOwnProperty,nd=Object.prototype.propertyIsEnumerable;var Do=(i,e,t)=>e in i?td(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,v=(i,e)=>{for(var t in e||(e={}))rd.call(e,t)&&Do(i,t,e[t]);if(No)for(var t of No(e))nd.call(e,t)&&Do(i,t,e[t]);return i},O=(i,e)=>id(i,sd(e));import{ol$geom$Circle as lt,ol$geom$GeometryCollection as ms,ol$geom$GeometryLayout as xn,ol$Feature as Z,ol$proj$getTransform as de,ol$proj$get as ad,ol$proj$equivalent as od,ol$proj$proj4$register as Fo,ol$style$Style as fe,ol$style$Fill as ht,ol$style$Stroke as tt,ol$style$Text as wn,ol$has$DEVICE_PIXEL_RATIO as ld,ol$style$RegularShape as bn,ol$style$Circle as ps,ol$style$Icon as ys,ol$style$Image as hd,ol$Map as cd,ol$interaction$defaults as ud,ol$Observable$unByKey as ye,ol$View as On,ol$easing$inAndOut as dd,ol$extent$containsXY as Ro,ol$extent$boundingExtent as _s,ol$extent$getBottomLeft as Pn,ol$geom$Point as wi,ol$geom$LineString as En,ol$geom$MultiPoint as Ao,ol$geom$MultiLineString as Go,ol$geom$MultiPolygon as fr,ol$sphere$offset as gr,ol$geom$GeometryType as Rt,ol$layer$Vector as ko,ol$geom$Polygon$circular as fd,ol$ImageState as mr,ol$geom$Polygon as In,ol$extent$getBottomRight as zo,ol$extent$getTopRight as jo,ol$extent$getTopLeft as pr,ol$proj$transform as Yt,ol$geom$Polygon$fromCircle as gd,ol$source$Vector as vs,ol$tilegrid$createXYZ as Ho,ol$proj$Projection as md,ol$tilegrid$TileGrid as $o,ol$source$TileImage as pd,ol$layer$Tile as bi,ol$extent$containsCoordinate as yd,ol$extent$buffer as Vo,ol$extent$getCenter as Ln,ol$proj$transformExtent as Bo,ol$sphere$getDistance as _d,ol$format$GeoJSON as Uo,Feature as vd,ol$extent$getWidth as Tn,ol$source$TileWMS as Sd,ol$format$GML2 as Nn,ol$format$WFS as qo,ol$format$GML3 as Dn,ol$extent$createEmpty as Wo,ol$structs$LRUCache as Md,ol$extent$createOrUpdateFromCoordinate as Cd,ol$render$canvas$Immediate as xd,ol$geom$flat$transform$transform2D as wd,ol$extent$intersects as bd,ol$geom$SimpleGeometry$transformGeom2D as Od,ol$transform$scale as Pd,ol$transform$create as Ed,ol$transform$compose as Id,ol$extent$extend as Xo,ol$source$OSM as Ld,ol$layer$Image as Td,ol$source$ImageStatic as Nd,ol$source$TileDebug as Dd,ol$source$XYZ as Fd,ol$source$VectorTile as Rd,ol$TileState as Ad,ol$layer$VectorTile as Gd,ol$tilegrid$WMTS as kd,ol$source$WMTS as zd,ol$format$MVT as jd}from"./ol.ef03b1.js";import{Cartesian3 as C,Math as P,Material as Oi,Cartesian2 as $e,Cesium3DTilePointFeature as At,Cesium3DTileFeature as Gt,Matrix3 as Ve,Quaternion as Hd,Color as Oe,EasingFunction as $d,Cesium3DTileStyle as Fn,Cesium3DTileColorBlendMode as yr,VerticalOrigin as Be,Entity as Rn,ConditionsExpression as Vd,Expression as Bd,HeightReference as Xe,ClassificationType as Pi,NearFarScalar as Ss,SceneTransforms as Ud,MaterialAppearance as qd,GeometryInstance as _r,ColorGeometryInstanceAttribute as Yo,PerInstanceColorAppearance as An,ShadowMode as Ms,ClassificationPrimitive as Zo,GroundPrimitive as Jo,Primitive as Gn,PolylineMaterialAppearance as Wd,GroundPolylinePrimitive as Ko,PolygonGeometry as Xd,PolygonOutlineGeometry as Yd,GroundPolylineGeometry as kn,PolylineGeometry as zn,PolygonHierarchy as Qo,CircleGeometry as Zd,CircleOutlineGeometry as Jd,Cartographic as te,WallGeometry as Kd,WallOutlineGeometry as Qd,LabelStyle as jn,HorizontalOrigin as Hn,HeadingPitchRoll as ef,Matrix4 as A,Transforms as el,Model as tf,sampleTerrainMostDetailed as vr,ModelAnimationLoop as sf,PrimitiveCollection as $n,BillboardCollection as rf,LabelCollection as nf,CesiumTerrainProvider as tl,Cartesian4 as il,sampleTerrain as af,Ellipsoid as Vn,ExperimentalFeatures as of,Clock as lf,DataSourceClock as hf,JulianDate as sl,KeyboardEventModifier as Bn,ScreenSpaceEventType as Zt,CesiumWidget as cf,DataSourceDisplay as rl,DataSourceCollection as nl,RequestScheduler as uf,ScreenSpaceEventHandler as df,Ray as ff,Camera as gf,ImageryLayer as Jt,CustomDataSource as al,Cesium3DTileset as Cs,BoundingSphere as ol,Intersect as mf,CesiumInspector as pf,Cesium3DTilesInspector as yf,BillboardVisualizer as _f,LabelVisualizer as vf,PointVisualizer as Sf,Rectangle as Ue,Composite3DTileContent as Mf,HeadingPitchRange as Cf,BoundingSphereState as ll,OpenStreetMapImageryProvider as xf,SingleTileImageryProvider as wf,WebMercatorTilingScheme as Un,GeographicTilingScheme as hl,SplitDirection as Y,TileMapServiceImageryProvider as bf,Event as Of,WebMapServiceImageryProvider as Pf,WebMapTileServiceImageryProvider as Ef,EntityCollection as If,CzmlDataSource as Lf,Plane as Kt,ClippingPlaneCollection as Qt,ClippingPlane as ei,ConstantProperty as Tf,Globe as Nf}from"./cesium.eb5667.js";const xs=[[String,"string"],[Number,"number"],[Boolean,"boolean"],[Function,"function"],[void 0,"undefined"],[Symbol,"symbol"]];function Sr(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 it(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=>it(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 Df(i,e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"?i===e?!1:`Expected ${it(i)} to equal ${e.toString()}`:null}function Ff(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{_(n,e[0],t)}catch(a){s=a.message.replace(/Match failed:\s/,"")}return s})>-1?`${s} in ${it(i)}`:!1}return`Expected ${it(i)} to be an Array`}return null}function qn(i,e,t){const s=t?`${t}.`:"";if(!Sr(i))return`Expected ${it(i)} to be a plain Object`;let n=!1;const a=Object.keys(e).find(o=>{const l=i[o];if(Sr(e[o]))n=qn(l,e[o],s+o);else try{_(l,e[o])}catch(h){n=h.message.replace(/Match failed:\s/,"")}return n});return a?`${n} in object.${s}${a}`:!1}function Rf(i,e){if(e===Number)return Number.isFinite(i)?!1:`expected ${it(i)} to be a number, excluding NaN`;for(let t=xs.length;t--;)if(e===xs[t][0])return typeof i===xs[t][1]?!1:`expected ${it(i)} to be a ${xs[t][1]}`;return null}function Wn(i){if(i===null)return"null";const e=xs.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(Sr(i)){const r={};Object.keys(i).forEach(n=>{r[n]=Wn(i[n])});try{t=`Object of ${JSON.stringify(r)}`}catch{t="Object"}}return t}function cl(i,e,t){const s=t?`${t}.`:"";let r=!1;return Object.keys(i).find(a=>{if(Sr(e[a])){const o=i[a];r=cl(o,e[a],s+a)}else e[a]||(r=`Found additional key ${s}${a}`);return r=r?r.replace(/\sin.*/,""):!1,r})?`${r} in ${it(i)}`:!1}function ul(i,e,t){const s=function(a,o){if(o==null)return a===o?!1:`Expected ${it(a)} to be ${o}`;const l=Rf(a,o);if(l!==null)return l;const h=Df(a,o);if(h!==null)return h;if(Array.isArray(o))return Ff(a,o,t);if(o instanceof Function)return a instanceof o?!1:`Expected ${it(a,!0)} to be of Type ${Wn(o)}`;if(o===Object)return qn(a,{});if(typeof o!="object")throw new Error(`Cannot handler pattern ${o}`);const c=qn(a,o);return c||(t?cl(a,o):!1)};let r;return Array.isArray(e)&&e.length>1?e.every(a=>s(i,a))&&(r=`Expected ${it(i)} to be a ${e.map(a=>Wn(a)).join(" or ")}`):r=s(i,e),r}function Xn(i,e,t){return!ul(i,e,t)}function _(i,e,t){const s=ul(i,e,t);if(s)throw new Error(`Match failed: ${s}`);return!1}function ie(i,e,t){const s=[null,void 0];return Array.isArray(e)&&e.length>1?e.forEach(r=>{s.push(r)}):s.push(e),_(i,s.reverse(),t)}function Af(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 Gf(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 kt(i,e){const t=i[0]-e[0],s=i[1]-e[1];return Math.sqrt(t**2+s**2)}function dl(i,e){const t=C.fromElements(i[0],i[1],i[2]),s=C.fromElements(e[0],e[1],e[2]);return C.distance(t,s)}lt.prototype.getCoordinates=function(){return[this.getCenter(),this.getLastCoordinate()]},lt.prototype.setCoordinates=function(e,t){_(e,[[Number]]),_(e.length,2);const s=t||this.getLayout(),r=/XYM?/.test(s)?kt:dl;this.setCenterAndRadius(e[0],r(e[0],e[1]),t)},ms.prototype.getCoordinates=function(){return this.getGeometries().map(e=>e.getCoordinates())},ms.prototype.setCoordinates=function(e,t){_(e,Array),_(e.length,this.getGeometries().length),this.setGeometries(this.getGeometries().map((s,r)=>(s.setCoordinates(e[r],t),s)))},ms.prototype.getLayout=function(){const e=this.getGeometries()[0];return e?e.getLayout():xn.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)},Oi._materialCache.addMaterial("Wallpaper",{fabric:{type:"Wallpaper",uniforms:{image:Oi.DefaultImageId,anchor:new $e(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}),At.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},Gt.prototype.getId=function(){return this.getProperty("id")||`${this.content.url}${this._batchId}`},new C,new Ve,new Hd,new Oe;var Mr,kf=new Uint8Array(16);function zf(){if(!Mr&&(Mr=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Mr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mr(kf)}var jf=/^(?:[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 fl(i){return typeof i=="string"&&jf.test(i)}for(var _e=[],Yn=0;Yn<256;++Yn)_e.push((Yn+256).toString(16).substr(1));function gl(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(_e[i[e+0]]+_e[i[e+1]]+_e[i[e+2]]+_e[i[e+3]]+"-"+_e[i[e+4]]+_e[i[e+5]]+"-"+_e[i[e+6]]+_e[i[e+7]]+"-"+_e[i[e+8]]+_e[i[e+9]]+"-"+_e[i[e+10]]+_e[i[e+11]]+_e[i[e+12]]+_e[i[e+13]]+_e[i[e+14]]+_e[i[e+15]]).toLowerCase();if(!fl(t))throw TypeError("Stringified UUID is invalid");return t}function Hf(i){if(!fl(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 $f(i){i=unescape(encodeURIComponent(i));for(var e=[],t=0;t<i.length;++t)e.push(i.charCodeAt(t));return e}var Vf="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Bf="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Uf(i,e,t){function s(r,n,a,o){if(typeof r=="string"&&(r=$f(r)),typeof n=="string"&&(n=Hf(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 gl(l)}try{s.name=i}catch{}return s.DNS=Vf,s.URL=Bf,s}function Ye(i,e,t){i=i||{};var s=i.random||(i.rng||zf)();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 gl(s)}function qf(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 Zn(i,e){return i<<e|i>>>32-e}function Wf(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]=Zn(d[g-3]^d[g-8]^d[g-14]^d[g-16],1);for(var m=t[0],p=t[1],y=t[2],M=t[3],b=t[4],I=0;I<80;++I){var L=Math.floor(I/20),D=Zn(m,5)+qf(L,p,y,M)+b+e[L]+d[I]>>>0;b=M,M=y,y=Zn(p,30)>>>0,p=m,m=D}t[0]=t[0]+m>>>0,t[1]=t[1]+p>>>0,t[2]=t[2]+y>>>0,t[3]=t[3]+M>>>0,t[4]=t[4]+b>>>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 Xf=Uf("v5",80,Wf),Yf=Xf;const se={OFF:1,ERROR:2,WARN:4,INFO:8,DEBUG:16},Ct={ERROR:0,WARN:0,INFO:0,DEBUG:0};Ct.ERROR=se.ERROR|se.WARN|se.INFO|se.DEBUG,Ct.WARN=se.WARN|se.INFO|se.DEBUG,Ct.INFO=se.INFO|se.DEBUG,Ct.DEBUG=se.DEBUG;const ws={useTimestamp:!1,logLevel:se.INFO},bs=new Map;bs.set(se.ERROR,"error"),bs.set(se.WARN,"warn"),bs.set(se.INFO,"info"),bs.set(se.DEBUG,"log");class ml{constructor(e){this.className=e,this.deprecations=new Map}error(e,...t){ws.logLevel&Ct.ERROR&&this._log(String(e),se.ERROR,t)}warning(e,...t){ws.logLevel&Ct.WARN&&this._log(String(e),se.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){ws.logLevel&Ct.INFO&&this._log(String(e),se.INFO,t)}debug(e,...t){ws.logLevel&Ct.DEBUG&&this._log(String(e),se.DEBUG,t)}log(e,...t){ws.logLevel&Ct.DEBUG&&this._log(String(e),se.DEBUG,t)}_log(e,t,s){let r=e;this.className&&(r=`[${this.className}] ${r}`),console[bs.get(t)](r,...s),t&se.ERROR&&(console.group(),console.trace(),console.groupEnd())}}const Jn=new Map;let Kn;function Zf(){return Kn||(Kn=new ml),Kn}function Jf(i){const e=new ml(i);return Jn.set(i,e),e}function Pe(i){return i?Jn.has(i)?Jn.get(i):Jf(i):Zf()}function V(i,e){if(i!=null){const t=Number.parseInt(String(i),10);if(t!=null&&!Number.isNaN(t))return t}return e}function E(i,e){if(i!=null){const t=Number.parseFloat(String(i));if(t!=null&&!Number.isNaN(t))return t}return e}function Cr(i,e,t,s){const r=E(i,e);return r<t?t:r>s?s:r}function re(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 Qn(i,e,t){if(i!=null){const s=Object.values(e).find(r=>r==i);if(s!=null)return s}return t}function zt(i,e,t){if(i!=null){const s=Object.keys(e).find(r=>r==i);if(s!=null)return e[s]}return t}function Kf(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 ti=1,ii=2,xr=3,Qf=4,ea=5,pl=6378137,eg=6356752314e-3,yl=.0066943799901413165,Os=484813681109536e-20,S=Math.PI/2,tg=.16666666666666666,ig=.04722222222222222,sg=.022156084656084655,x=1e-10,ve=.017453292519943295,ct=57.29577951308232,j=Math.PI/4,Ps=Math.PI*2,ne=3.14159265359,De={};De.greenwich=0,De.lisbon=-9.131906111111,De.paris=2.337229166667,De.bogota=-74.080916666667,De.madrid=-3.687938888889,De.rome=12.452333333333,De.bern=7.439583333333,De.jakarta=106.807719444444,De.ferro=-17.666666666667,De.brussels=4.367975,De.stockholm=18.058277777778,De.athens=23.7163375,De.oslo=10.722916666667;var rg={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},_l=/[\s_\-\/\(\)]/g;function jt(i,e){if(i[e])return i[e];for(var t=Object.keys(i),s=e.toLowerCase().replace(_l,""),r=-1,n,a;++r<t.length;)if(n=t[r],a=n.toLowerCase().replace(_l,""),a===s)return i[n]}function ta(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*ve},lat_1:function(o){e.lat1=o*ve},lat_2:function(o){e.lat2=o*ve},lat_ts:function(o){e.lat_ts=o*ve},lon_0:function(o){e.long0=o*ve},lon_1:function(o){e.long1=o*ve},lon_2:function(o){e.long2=o*ve},alpha:function(o){e.alpha=parseFloat(o)*ve},gamma:function(o){e.rectified_grid_angle=parseFloat(o)},lonc:function(o){e.longc=o*ve},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=jt(rg,o);l&&(e.to_meter=l.to_meter)},from_greenwich:function(o){e.from_greenwich=o*ve},pm:function(o){var l=jt(De,o);e.from_greenwich=(l||parseFloat(o))*ve},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 Es=1,vl=2,Sl=3,wr=4,Ml=5,ia=-1,ng=/\s/,ag=/[A-Za-z]/,og=/[A-Za-z84]/,br=/[,\]]/,Cl=/[\d\.E\-\+]/;function xt(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=Es}xt.prototype.readCharicter=function(){var i=this.text[this.place++];if(this.state!==wr)for(;ng.test(i);){if(this.place>=this.text.length)return;i=this.text[this.place++]}switch(this.state){case Es:return this.neutral(i);case vl:return this.keyword(i);case wr:return this.quoted(i);case Ml:return this.afterquote(i);case Sl:return this.number(i);case ia:return}},xt.prototype.afterquote=function(i){if(i==='"'){this.word+='"',this.state=wr;return}if(br.test(i)){this.word=this.word.trim(),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in afterquote yet, index '+this.place)},xt.prototype.afterItem=function(i){if(i===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Es;return}if(i==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Es,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ia);return}},xt.prototype.number=function(i){if(Cl.test(i)){this.word+=i;return}if(br.test(i)){this.word=parseFloat(this.word),this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in number yet, index '+this.place)},xt.prototype.quoted=function(i){if(i==='"'){this.state=Ml;return}this.word+=i},xt.prototype.keyword=function(i){if(og.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=Es;return}if(br.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in keyword yet, index '+this.place)},xt.prototype.neutral=function(i){if(ag.test(i)){this.word=i,this.state=vl;return}if(i==='"'){this.word="",this.state=wr;return}if(Cl.test(i)){this.word=i,this.state=Sl;return}if(br.test(i)){this.afterItem(i);return}throw new Error(`havn't handled "`+i+'" in neutral yet, index '+this.place)},xt.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ia)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function lg(i){var e=new xt(i);return e.output()}function xl(i,e,t){Array.isArray(e)&&(t.unshift(e),e=null);var s=e?{}:i,r=t.reduce(function(n,a){return Ei(a,n),n},s);e&&(i[e]=r)}function Ei(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]={},Ei(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&&Ei(i[2],e[t]);return;case"SPHEROID":case"ELLIPSOID":e[t]={name:i[0],a:i[1],rf:i[2]},i.length===4&&Ei(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]],xl(e,t,i);return;default:for(s=-1;++s<i.length;)if(!Array.isArray(i[s]))return Ei(i,e[t]);return xl(e,t,i)}}var hg=.017453292519943295;function cg(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 wt(i){return i*hg}function ug(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 cg(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",wt],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",wt],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",wt],["lat0","latitude_of_origin",wt],["lat0","standard_parallel_1",wt],["lat1","standard_parallel_1",wt],["lat2","standard_parallel_2",wt],["azimuth","Azimuth"],["alpha","azimuth",wt],["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=wt(i.lat1>0?90:-90),i.lat_ts=i.lat1)}function wl(i){var e=lg(i),t=e.shift(),s=e.shift();e.unshift(["name",s]),e.unshift(["type",t]);var r={};return Ei(e,r),ug(r),r}function Ee(i){var e=this;if(arguments.length===2){var t=arguments[1];typeof t=="string"?t.charAt(0)==="+"?Ee[i]=ta(arguments[1]):Ee[i]=wl(arguments[1]):Ee[i]=t}else if(arguments.length===1){if(Array.isArray(i))return i.map(function(s){Array.isArray(s)?Ee.apply(e,s):Ee(s)});if(typeof i=="string"){if(i in Ee)return Ee[i]}else"EPSG"in i?Ee["EPSG:"+i.EPSG]=i:"ESRI"in i?Ee["ESRI:"+i.ESRI]=i:"IAU2000"in i?Ee["IAU2000:"+i.IAU2000]=i:console.log(i);return}}Kf(Ee);function dg(i){return typeof i=="string"}function fg(i){return i in Ee}var gg=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function mg(i){return gg.some(function(e){return i.indexOf(e)>-1})}var pg=["3857","900913","3785","102113"];function yg(i){var e=jt(i,"authority");if(!!e){var t=jt(e,"epsg");return t&&pg.indexOf(t)>-1}}function _g(i){var e=jt(i,"extension");if(!!e)return jt(e,"proj4")}function vg(i){return i[0]==="+"}function Sg(i){if(dg(i)){if(fg(i))return Ee[i];if(mg(i)){var e=wl(i);if(yg(e))return Ee["EPSG:3857"];var t=_g(e);return t?ta(t):e}if(vg(i))return ta(i)}else return i}function bl(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 ut(i,e,t){var s=i*e;return t/Math.sqrt(1-s*s)}function Is(i){return i<0?-1:1}function w(i){return Math.abs(i)<=ne?i:i-Is(i)*Ps}function st(i,e,t){var s=i*t,r=.5*i;return s=Math.pow((1-s)/(1+s),r),Math.tan(.5*(S-e))/s}function Ls(i,e){for(var t=.5*i,s,r,n=S-2*Math.atan(e),a=0;a<=15;a++)if(s=i*Math.sin(n),r=S-2*Math.atan(e*Math.pow((1-s)/(1+s),t))-n,n+=r,Math.abs(r)<=1e-10)return n;return-9999}function Mg(){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=ut(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Cg(i){var e=i.x,t=i.y;if(t*ct>90&&t*ct<-90&&e*ct>180&&e*ct<-180)return null;var s,r;if(Math.abs(Math.abs(t)-S)<=x)return null;if(this.sphere)s=this.x0+this.a*this.k0*w(e-this.long0),r=this.y0+this.a*this.k0*Math.log(Math.tan(j+.5*t));else{var n=Math.sin(t),a=st(this.e,t,n);s=this.x0+this.a*this.k0*w(e-this.long0),r=this.y0-this.a*this.k0*Math.log(a)}return i.x=s,i.y=r,i}function xg(i){var e=i.x-this.x0,t=i.y-this.y0,s,r;if(this.sphere)r=S-2*Math.atan(Math.exp(-t/(this.a*this.k0)));else{var n=Math.exp(-t/(this.a*this.k0));if(r=Ls(this.e,n),r===-9999)return null}return s=w(this.long0+e/(this.a*this.k0)),i.x=s,i.y=r,i}var wg=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],bg={init:Mg,forward:Cg,inverse:xg,names:wg};function Og(){}function Ol(i){return i}var Pg=["longlat","identity"],Eg={init:Og,forward:Ol,inverse:Ol,names:Pg},Ig=[bg,Eg],Or={},Pr=[];function Pl(i,e){var t=Pr.length;return i.names?(Pr[t]=i,i.names.forEach(function(s){Or[s.toLowerCase()]=t}),this):(console.log(e),!0)}function Lg(i){if(!i)return!1;var e=i.toLowerCase();if(typeof Or[e]!="undefined"&&Pr[Or[e]])return Pr[Or[e]]}function Tg(){Ig.forEach(Pl)}var Ng={start:Tg,add:Pl,get:Lg},N={};N.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},N.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},N.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},N.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},N.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},N.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},N.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},N.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},N.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},N.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},N.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},N.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},N.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},N.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},N.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},N.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},N.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},N.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},N.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},N.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},N.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},N.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},N.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},N.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},N.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},N.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},N.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},N.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},N.hough={a:6378270,rf:297,ellipseName:"Hough"},N.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},N.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},N.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},N.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},N.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},N.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},N.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},N.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},N.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},N.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},N.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},N.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Dg=N.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};N.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Fg(i,e,t,s){var r=i*i,n=e*e,a=(r-n)/r,o=0;s?(i*=1-a*(tg+a*(ig+a*sg)),r=i*i,a=0):o=Math.sqrt(a);var l=(r-n)/n;return{es:a,e:o,ep2:l}}function Rg(i,e,t,s,r){if(!i){var n=jt(N,s);n||(n=Dg),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 ge={};ge.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ge.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ge.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},ge.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},ge.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},ge.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},ge.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},ge.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},ge.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ge.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},ge.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},ge.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},ge.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},ge.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},ge.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},ge.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},ge.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function Ag(i,e,t,s,r,n,a){var o={};return i===void 0||i==="none"?o.datum_type=ea:o.datum_type=Qf,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=ti),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=ii,o.datum_params[3]*=Os,o.datum_params[4]*=Os,o.datum_params[5]*=Os,o.datum_params[6]=o.datum_params[6]/1e6+1)),a&&(o.datum_type=xr,o.grids=a),o.a=t,o.b=s,o.es=r,o.ep2=n,o}var El={};function Gg(i,e){var t=new DataView(e),s=jg(t),r=Hg(t,s);r.nSubgrids>1&&console.log("Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored");var n=$g(t,r,s),a={header:r,subgrids:n};return El[i]=a,a}function kg(i){if(i===void 0)return null;var e=i.split(",");return e.map(zg)}function zg(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:El[i]||null,isNull:!1}}function Ii(i){return i/3600*Math.PI/180}function jg(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 Hg(i,e){return{nFields:i.getInt32(8,e),nSubgridFields:i.getInt32(24,e),nSubgrids:i.getInt32(40,e),shiftType:sa(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 sa(i,e,t){return String.fromCharCode.apply(null,new Uint8Array(i.buffer.slice(e,t)))}function $g(i,e,t){for(var s=176,r=[],n=0;n<e.nSubgrids;n++){var a=Bg(i,s,t),o=Ug(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:[Ii(a.lowerLongitude),Ii(a.lowerLatitude)],del:[Ii(a.longitudeInterval),Ii(a.latitudeInterval)],lim:[l,h],count:a.gridNodeCount,cvs:Vg(o)})}return r}function Vg(i){return i.map(function(e){return[Ii(e.longitudeShift),Ii(e.latitudeShift)]})}function Bg(i,e,t){return{name:sa(i,e+8,e+16).trim(),parent:sa(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 Ug(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 dt(i,e){if(!(this instanceof dt))return new dt(i);e=e||function(h){if(h)throw h};var t=Sg(i);if(typeof t!="object"){e(i);return}var s=dt.projections.get(t.projName);if(!s){e(i);return}if(t.datumCode&&t.datumCode!=="none"){var r=jt(ge,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=Rg(t.a,t.b,t.rf,t.ellps,t.sphere),a=Fg(n.a,n.b,n.rf,t.R_A),o=kg(t.nadgrids),l=t.datum||Ag(t.datumCode,t.datum_params,n.a,n.b,a.es,a.ep2,o);bl(this,t),bl(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)}dt.projections=Ng,dt.projections.start();function qg(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===ti?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===ii?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 Il(i,e,t){var s=i.x,r=i.y,n=i.z?i.z:0,a,o,l,h;if(r<-S&&r>-1.001*S)r=-S;else if(r>S&&r<1.001*S)r=S;else{if(r<-S)return{x:-1/0,y:-1/0,z:i.z};if(r>S)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 Ll(i,e,t,s){var r=1e-12,n=r*r,a=30,o,l,h,c,u,d,f,g,m,p,y,M,b,I=i.x,L=i.y,D=i.z?i.z:0,X,$,xe;if(o=Math.sqrt(I*I+L*L),l=Math.sqrt(I*I+L*L+D*D),o/t<r){if(X=0,l/t<r)return $=S,xe=-s,{x:i.x,y:i.y,z:i.z}}else X=Math.atan2(L,I);h=D/l,c=o/l,u=1/Math.sqrt(1-e*(2-e)*c*c),g=c*(1-e)*u,m=h*u,b=0;do b++,f=t/Math.sqrt(1-e*m*m),xe=o*g+D*m-f*(1-e*m*m),d=e*f/(f+xe),u=1/Math.sqrt(1-d*(2-d)*c*c),p=c*(1-d)*u,y=h*u,M=y*g-p*m,g=p,m=y;while(M*M>n&&b<a);return $=Math.atan(y/Math.abs(p)),{x:X,y:$,z:xe}}function Wg(i,e,t){if(e===ti)return{x:i.x+t[0],y:i.y+t[1],z:i.z+t[2]};if(e===ii){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 Xg(i,e,t){if(e===ti)return{x:i.x-t[0],y:i.y-t[1],z:i.z-t[2]};if(e===ii){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 Er(i){return i===ti||i===ii}function Yg(i,e,t){if(qg(i,e)||i.datum_type===ea||e.datum_type===ea)return t;var s=i.a,r=i.es;if(i.datum_type===xr){var n=Tl(i,!1,t);if(n!==0)return;s=pl,r=yl}var a=e.a,o=e.b,l=e.es;if(e.datum_type===xr&&(a=pl,o=eg,l=yl),r===l&&s===a&&!Er(i.datum_type)&&!Er(e.datum_type))return t;if(t=Il(t,r,s),Er(i.datum_type)&&(t=Wg(t,i.datum_type,i.datum_params)),Er(e.datum_type)&&(t=Xg(t,e.datum_type,e.datum_params)),t=Ll(t,l,a,o),e.datum_type===xr){var h=Tl(e,!0,t);if(h!==0)return}return t}function Tl(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=Zg(s,e,l),!isNaN(r.x)))break}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*ct+" "+s.y*ct+" tried: '"+n+"'"),-1):(t.x=-r.x,t.y=r.y,0)}function Zg(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=w(r.x-Math.PI)+Math.PI;var n=Nl(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=Nl(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=w(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 Nl(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 Dl(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 Fl(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 Jg(i){Rl(i.x),Rl(i.y)}function Rl(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 Kg(i,e){return(i.datum.datum_type===ti||i.datum.datum_type===ii)&&e.datumCode!=="WGS84"||(e.datum.datum_type===ti||e.datum.datum_type===ii)&&i.datumCode!=="WGS84"}function Ir(i,e,t,s){var r;if(Array.isArray(t)&&(t=Fl(t)),Jg(t),i.datum&&e.datum&&Kg(i,e)&&(r=new dt("WGS84"),t=Ir(i,r,t,s),i=r),s&&i.axis!=="enu"&&(t=Dl(i,!1,t)),i.projName==="longlat")t={x:t.x*ve,y:t.y*ve,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=Yg(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*ct,y:t.y*ct,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"?Dl(e,!0,t):t}var Al=dt("WGS84");function ra(i,e,t,s){var r,n,a;return Array.isArray(t)?(r=Ir(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=Ir(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 Gl(i){return i instanceof dt?i:i.oProj?i.oProj:dt(i)}function ce(i,e,t){i=Gl(i);var s=!1,r;return typeof e=="undefined"?(e=i,i=Al,s=!0):(typeof e.x!="undefined"||Array.isArray(e))&&(t=e,e=i,i=Al,s=!0),e=Gl(e),t?ra(i,e,t):(r={forward:function(n,a){return ra(i,e,n,a)},inverse:function(n,a){return ra(e,i,n,a)}},s&&(r.oProj=e),r)}var kl=6,zl="AJSAJS",jl="AFAFAF",Li=65,Fe=73,Ze=79,Ts=86,Ns=90,Qg={forward:Hl,inverse:em,toPoint:$l};function Hl(i,e){return e=e||5,sm(tm({lat:i[1],lon:i[0]}),e)}function em(i){var e=aa(Ul(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function $l(i){var e=aa(Ul(i.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function na(i){return i*(Math.PI/180)}function Vl(i){return 180*(i/Math.PI)}function tm(i){var e=i.lat,t=i.lon,s=6378137,r=.00669438,n=.9996,a,o,l,h,c,u,d,f=na(e),g=na(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=na(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,M=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&&(M+=1e7),{northing:Math.round(M),easting:Math.round(y),zoneNumber:p,zoneLetter:im(e)}}function aa(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,M,b=t-5e5,I=e;s<"N"&&(I-=1e7),p=(r-1)*6-180+3,l=o/(1-o),m=I/n,y=m/(a*(1-o/4-3*o*o/64-5*o*o*o/256)),M=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(M)*Math.sin(M)),u=Math.tan(M)*Math.tan(M),d=l*Math.cos(M)*Math.cos(M),f=a*(1-o)/Math.pow(1-o*Math.sin(M)*Math.sin(M),1.5),g=b/(c*n);var L=M-c*Math.tan(M)/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);L=Vl(L);var D=(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(M);D=p+Vl(D);var X;if(i.accuracy){var $=aa({northing:i.northing+i.accuracy,easting:i.easting+i.accuracy,zoneLetter:i.zoneLetter,zoneNumber:i.zoneNumber});X={top:$.lat,right:$.lon,bottom:L,left:D}}else X={lat:L,lon:D};return X}function im(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 sm(i,e){var t="00000"+i.easting,s="00000"+i.northing;return i.zoneNumber+i.zoneLetter+rm(i.easting,i.northing,i.zoneNumber)+t.substr(t.length-5,e)+s.substr(s.length-5,e)}function rm(i,e,t){var s=Bl(t),r=Math.floor(i/1e5),n=Math.floor(e/1e5)%20;return nm(r,n,s)}function Bl(i){var e=i%kl;return e===0&&(e=kl),e}function nm(i,e,t){var s=t-1,r=zl.charCodeAt(s),n=jl.charCodeAt(s),a=r+i-1,o=n+e,l=!1;a>Ns&&(a=a-Ns+Li-1,l=!0),(a===Fe||r<Fe&&a>Fe||(a>Fe||r<Fe)&&l)&&a++,(a===Ze||r<Ze&&a>Ze||(a>Ze||r<Ze)&&l)&&(a++,a===Fe&&a++),a>Ns&&(a=a-Ns+Li-1),o>Ts?(o=o-Ts+Li-1,l=!0):l=!1,(o===Fe||n<Fe&&o>Fe||(o>Fe||n<Fe)&&l)&&o++,(o===Ze||n<Ze&&o>Ze||(o>Ze||n<Ze)&&l)&&(o++,o===Fe&&o++),o>Ts&&(o=o-Ts+Li-1);var h=String.fromCharCode(a)+String.fromCharCode(o);return h}function Ul(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=Bl(a),h=am(t.charAt(0),l),c=om(t.charAt(1),l);c<lm(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,M,b;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),M=f+h,b=g+c,{easting:M,northing:b,zoneLetter:o,zoneNumber:a,accuracy:m}}function am(i,e){for(var t=zl.charCodeAt(e-1),s=1e5,r=!1;t!==i.charCodeAt(0);){if(t++,t===Fe&&t++,t===Ze&&t++,t>Ns){if(r)throw"Bad character: "+i;t=Li,r=!0}s+=1e5}return s}function om(i,e){if(i>"V")throw"MGRSPoint given invalid Northing "+i;for(var t=jl.charCodeAt(e-1),s=0,r=!1;t!==i.charCodeAt(0);){if(t++,t===Fe&&t++,t===Ze&&t++,t>Ts){if(r)throw"Bad character: "+i;t=Li,r=!0}s+=1e5}return s}function lm(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 Ti(i,e,t){if(!(this instanceof Ti))return new Ti(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")}Ti.fromMGRS=function(i){return new Ti($l(i))},Ti.prototype.toMGRS=function(i){return Hl([this.x,this.y],i)};var hm=1,cm=.25,ql=.046875,Wl=.01953125,Xl=.01068115234375,um=.75,dm=.46875,fm=.013020833333333334,gm=.007120768229166667,mm=.3645833333333333,pm=.005696614583333333,ym=.3076171875;function Yl(i){var e=[];e[0]=hm-i*(cm+i*(ql+i*(Wl+i*Xl))),e[1]=i*(um-i*(ql+i*(Wl+i*Xl)));var t=i*i;return e[2]=t*(dm-i*(fm+i*gm)),t*=i,e[3]=t*(mm-i*pm),e[4]=t*i*ym,e}function Lr(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 _m=20;function Zl(i,e,t){for(var s=1/(1-e),r=i,n=_m;n;--n){var a=Math.sin(r),o=1-e*a*a;if(o=(Lr(r,a,Math.cos(r),t)-i)*(o*Math.sqrt(o))*s,r-=o,Math.abs(o)<x)return r}return r}function vm(){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=Yl(this.es),this.ml0=Lr(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Sm(i){var e=i.x,t=i.y,s=w(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=Lr(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 Mm(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=Zl(e,this.es,this.en),Math.abs(t)<S){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 M=n*Math.sqrt(e)/this.k0,b=Math.pow(M,2);e=e*f,s=t-e*b/(1-this.es)*.5*(1-b/12*(5+3*p-9*g*p+g-4*m-b/30*(61+90*p-252*g*p+45*y+46*g-b/56*(1385+3633*p+4095*y+1574*y*p)))),r=w(this.long0+M*(1-b/6*(1+2*p+g-b/20*(5+28*p+24*y+8*g*p+6*g-b/42*(61+662*p+1320*y+720*y*p))))/d)}else s=S*Is(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=w(Math.atan2(l,c)+this.long0)}return i.x=r,i.y=s,i}var Cm=["Fast_Transverse_Mercator","Fast Transverse Mercator"],Tr={init:vm,forward:Sm,inverse:Mm,names:Cm};function Jl(i){var e=Math.exp(i);return e=(e-1/e)/2,e}function Nr(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 xm(i){var e=1+i,t=e-1;return t===0?i:i*Math.log(e)/t}function wm(i){var e=Math.abs(i);return e=xm(e*(1+e/(Nr(1,e)+1))),i<0?-e:e}function oa(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 bm(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 Om(i){var e=Math.exp(i);return e=(e+1/e)/2,e}function Kl(i,e,t){for(var s=Math.sin(e),r=Math.cos(e),n=Jl(t),a=Om(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 Pm(){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&&(Tr.init.apply(this),this.forward=Tr.forward,this.inverse=Tr.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=oa(this.cbg,this.lat0);this.Zb=-this.Qn*(s+bm(this.gtu,2*s))}function Em(i){var e=w(i.x-this.long0),t=i.y;t=oa(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,Nr(s,r*a)),e=wm(Math.tan(e));var o=Kl(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 Im(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=Kl(this.utg,2*t,2*e);t=t+n[0],e=e+n[1],e=Math.atan(Jl(e));var a=Math.sin(t),o=Math.cos(t),l=Math.sin(e),h=Math.cos(e);t=Math.atan2(a*h,Nr(l,h*o)),e=Math.atan2(l,h*o),s=w(e+this.long0),r=oa(this.cgb,t)}else s=1/0,r=1/0;return i.x=s,i.y=r,i}var Lm=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"],Dr={init:Pm,forward:Em,inverse:Im,names:Lm};function Tm(i,e){if(i===void 0){if(i=Math.floor((w(e)+Math.PI)*30/Math.PI)+1,i<0)return 0;if(i>60)return 60}return i}var Nm="etmerc";function Dm(){var i=Tm(this.zone,this.long0);if(i===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(i)-183)*ve,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Dr.init.apply(this),this.forward=Dr.forward,this.inverse=Dr.inverse}var Fm=["Universal Transverse Mercator System","utm"],Rm={init:Dm,names:Fm,dependsOn:Nm};function la(i,e){return Math.pow((1-i)/(1+i),e)}var Am=20;function Gm(){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+j)/(Math.pow(Math.tan(.5*this.lat0+j),this.C)*la(this.e*i,this.ratexp))}function km(i){var e=i.x,t=i.y;return i.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*t+j),this.C)*la(this.e*Math.sin(t),this.ratexp))-S,i.x=this.C*e,i}function zm(i){for(var e=1e-14,t=i.x/this.C,s=i.y,r=Math.pow(Math.tan(.5*s+j)/this.K,1/this.C),n=Am;n>0&&(s=2*Math.atan(r*la(this.e*Math.sin(i.y),-.5*this.e))-S,!(Math.abs(s-i.y)<e));--n)i.y=s;return n?(i.x=t,i.y=s,i):null}var jm=["gauss"],ha={init:Gm,forward:km,inverse:zm,names:jm};function Hm(){ha.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 $m(i){var e,t,s,r;return i.x=w(i.x-this.long0),ha.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 Vm(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,ha.inverse.apply(this,[i]),i.x=w(i.x+this.long0),i}var Bm=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],Um={init:Hm,forward:$m,inverse:Vm,names:Bm};function qm(i,e,t){return e*=t,Math.tan(.5*(S+i))*Math.pow((1-e)/(1+e),.5*t)}function Wm(){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+Is(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*ut(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/st(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=ut(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-S,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Xm(i){var e=i.x,t=i.y,s=Math.sin(t),r=Math.cos(t),n,a,o,l,h,c,u=w(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))-S,l=Math.cos(a),o=Math.sin(a),Math.abs(this.coslat0)<=x?(h=st(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 Ym(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=w(this.long0+Math.atan2(i.x,-1*i.y)):e=w(this.long0+Math.atan2(i.x,i.y)):e=w(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*Ls(this.e,s),e=this.con*w(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=w(this.long0+Math.atan2(i.x*Math.sin(r),a*this.cosX0*Math.cos(r)-i.y*this.sinX0*Math.sin(r)))),t=-1*Ls(this.e,Math.tan(.5*(S+n)));return i.x=e,i.y=t,i}var Zm=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Jm={init:Wm,forward:Xm,inverse:Ym,names:Zm,ssfn_:qm};function Km(){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 Qm(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 ep(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 tp=["somerc"],ip={init:Km,forward:Qm,inverse:ep,names:tp},Ni=1e-7;function sp(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 rp(){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=sp(this),this.no_rot="no_rot"in this;var M=!1;"alpha"in this&&(M=!0);var b=!1;if("rectified_grid_angle"in this&&(b=!0),M&&(y=this.alpha),b&&(c=this.rectified_grid_angle*ve),M||b)d=this.longc;else if(f=this.long1,m=this.lat1,g=this.long2,p=this.lat2,Math.abs(m-p)<=Ni||(i=Math.abs(m))<=Ni||Math.abs(i-S)<=Ni||Math.abs(Math.abs(this.lat0)-S)<=Ni||Math.abs(Math.abs(p)-S)<=Ni)throw new Error;var I=1-this.es;e=Math.sqrt(I),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/I),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(st(this.e,this.lat0,o),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=r=1),M||b?(M?(u=Math.asin(Math.sin(y)/s),b||(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(st(this.e,m,Math.sin(m)),this.B),a=Math.pow(st(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-=Ps:i>Math.pi&&(g+=Ps),this.lam0=w(.5*(f+g)-Math.atan(h*Math.tan(.5*this.B*(f-g))/l)/this.B),u=Math.atan(2*Math.sin(this.B*w(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(j-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(j+r))}function np(i){var e={},t,s,r,n,a,o,l,h;if(i.x=i.x-this.lam0,Math.abs(Math.abs(i.y)-S)>x){if(a=this.E/Math.pow(st(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)<Ni?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 ap(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?-S:S;else{if(l.y=this.E/Math.sqrt((1+o)/(1-o)),l.y=Ls(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 op=["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"],lp={init:rp,forward:np,inverse:ap,names:op};function hp(){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=ut(this.e,e,t),r=st(this.e,this.lat1,e),n=Math.sin(this.lat2),a=Math.cos(this.lat2),o=ut(this.e,n,a),l=st(this.e,this.lat2,n),h=st(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 cp(i){var e=i.x,t=i.y;Math.abs(2*Math.abs(t)-Math.PI)<=x&&(t=Is(t)*(S-2*x));var s=Math.abs(Math.abs(t)-S),r,n;if(s>x)r=st(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*w(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 up(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=Ls(this.e,s),r===-9999)return null}else r=-S;return n=w(l/this.ns+this.long0),i.x=n,i.y=r,i}var dp=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc"],fp={init:hp,forward:cp,inverse:up,names:dp};function gp(){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 mp(i){var e,t,s,r,n,a,o,l=i.x,h=i.y,c=w(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 pp(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 yp=["Krovak","krovak"],_p={init:gp,forward:mp,inverse:pp,names:yp};function Ie(i,e,t,s,r){return i*r-e*Math.sin(2*r)+t*Math.sin(4*r)-s*Math.sin(6*r)}function Ds(i){return 1-.25*i*(1+i/16*(3+1.25*i))}function Fs(i){return .375*i*(1+.25*i*(1+.46875*i))}function Rs(i){return .05859375*i*i*(1+.75*i)}function As(i){return i*i*i*(35/3072)}function Di(i,e,t){var s=e*t;return i/Math.sqrt(1-s*s)}function Fi(i){return Math.abs(i)<S?i:i-Is(i)*Math.PI}function Fr(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 vp(){this.sphere||(this.e0=Ds(this.es),this.e1=Fs(this.es),this.e2=Rs(this.es),this.e3=As(this.es),this.ml0=this.a*Ie(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Sp(i){var e,t,s=i.x,r=i.y;if(s=w(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=Di(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*Ie(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 Mp(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=Fr(a,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-S)<=x)return i.x=this.long0,i.y=S,t<0&&(i.y*=-1),i;var l=Di(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=w(r+this.long0),i.y=Fi(s),i}var Cp=["Cassini","Cassini_Soldner","cass"],xp={init:vp,forward:Sp,inverse:Mp,names:Cp};function Ht(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 wp=1,bp=2,Op=3,Pp=4;function Ep(){var i=Math.abs(this.lat0);if(Math.abs(i-S)<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=Ht(this.e,1),this.mmf=.5/(1-this.es),this.apa=Gp(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=Ht(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 Ip(i){var e,t,s,r,n,a,o,l,h,c,u=i.x,d=i.y;if(u=w(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=j-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=Ht(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=S+d,a=this.qp-a;break;case this.S_POLE:h=d-S,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 Lp(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=S-r;break;case this.S_POLE:r-=S;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=kp(Math.asin(h),this.apa)}return i.x=w(this.long0+s),i.y=r,i}var Tp=.3333333333333333,Np=.17222222222222222,Dp=.10257936507936508,Fp=.06388888888888888,Rp=.0664021164021164,Ap=.016415012942191543;function Gp(i){var e,t=[];return t[0]=i*Tp,e=i*i,t[0]+=e*Np,t[1]=e*Fp,e*=i,t[0]+=e*Dp,t[1]+=e*Rp,t[2]=e*Ap,t}function kp(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 zp=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],jp={init:Ep,forward:Ip,inverse:Lp,names:zp,S_POLE:wp,N_POLE:bp,EQUIT:Op,OBLIQ:Pp};function $t(i){return Math.abs(i)>1&&(i=i>1?1:-1),Math.asin(i)}function Hp(){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=ut(this.e3,this.sin_po,this.cos_po),this.qs1=Ht(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=ut(this.e3,this.sin_po,this.cos_po),this.qs2=Ht(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=Ht(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 $p(i){var e=i.x,t=i.y;this.sin_phi=Math.sin(t),this.cos_phi=Math.cos(t);var s=Ht(this.e3,this.sin_phi,this.cos_phi),r=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,n=this.ns0*w(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 Vp(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=w(r/this.ns0+this.long0),i.x=n,i.y=a,i}function Bp(i,e){var t,s,r,n,a,o=$t(.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 Up=["Albers_Conic_Equal_Area","Albers","aea"],qp={init:Hp,forward:$p,inverse:Vp,names:Up,phi1z:Bp};function Wp(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Xp(i){var e,t,s,r,n,a,o,l,h=i.x,c=i.y;return s=w(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 Yp(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=$t(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=w(this.long0+n)):(a=this.phic0,n=0),i.x=n,i.y=a,i}var Zp=["gnom"],Jp={init:Wp,forward:Xp,inverse:Yp,names:Zp};function Kp(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*S:S;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 Qp(){this.sphere||(this.k0=ut(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function ey(i){var e=i.x,t=i.y,s,r,n=w(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=Ht(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 ty(i){i.x-=this.x0,i.y-=this.y0;var e,t;return this.sphere?(e=w(this.long0+i.x/this.a/Math.cos(this.lat_ts)),t=Math.asin(i.y/this.a*Math.cos(this.lat_ts))):(t=Kp(this.e,2*i.y*this.k0/this.a),e=w(this.long0+i.x/(this.a*this.k0))),i.x=e,i.y=t,i}var iy=["cea"],sy={init:Qp,forward:ey,inverse:ty,names:iy};function ry(){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 ny(i){var e=i.x,t=i.y,s=w(e-this.long0),r=Fi(t-this.lat0);return i.x=this.x0+this.a*s*this.rc,i.y=this.y0+this.a*r,i}function ay(i){var e=i.x,t=i.y;return i.x=w(this.long0+(e-this.x0)/(this.a*this.rc)),i.y=Fi(this.lat0+(t-this.y0)/this.a),i}var oy=["Equirectangular","Equidistant_Cylindrical","eqc"],ly={init:ry,forward:ny,inverse:ay,names:oy},Ql=20;function hy(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Ds(this.es),this.e1=Fs(this.es),this.e2=Rs(this.es),this.e3=As(this.es),this.ml0=this.a*Ie(this.e0,this.e1,this.e2,this.e3,this.lat0)}function cy(i){var e=i.x,t=i.y,s,r,n,a=w(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*(Fi(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=Di(this.a,this.e,Math.sin(t))/Math.tan(t);s=o*Math.sin(n),r=this.a*Ie(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 uy(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=w(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=Ql;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=w(this.long0+Math.asin(s*Math.tan(l)/this.a)/Math.sin(t))}else if(Math.abs(r+this.ml0)<=x)t=0,e=w(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=Ql;n;--n)if(m=this.e*Math.sin(l),u=Math.sqrt(1-m*m)*Math.tan(l),d=this.a*Ie(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=w(this.long0+Math.asin(s*u/this.a)/Math.sin(t))}return i.x=e,i.y=t,i}var dy=["Polyconic","poly"],fy={init:hy,forward:cy,inverse:uy,names:dy};function gy(){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 my(i){var e,t=i.x,s=i.y,r=s-this.lat0,n=t-this.long0,a=r/Os*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 py(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,M,b=a,I=o;for(e=2;e<=6;e++)y=m*d-p*f,M=p*d+m*f,m=y,p=M,b=b+(e-1)*(this.B_re[e]*m-this.B_im[e]*p),I=I+(e-1)*(this.B_im[e]*m+this.B_re[e]*p);m=1,p=0;var L=this.B_re[1],D=this.B_im[1];for(e=2;e<=6;e++)y=m*d-p*f,M=p*d+m*f,m=y,p=M,L=L+e*(this.B_re[e]*m-this.B_im[e]*p),D=D+e*(this.B_im[e]*m+this.B_re[e]*p);var X=L*L+D*D;d=(b*L+I*D)/X,f=(I*L-b*D)/X}var $=d,xe=f,He=1,Mt=0;for(e=1;e<=9;e++)He=He*$,Mt=Mt+this.D[e]*He;var dr=this.lat0+Mt*Os*1e5,ed=this.long0+xe;return i.x=ed,i.y=dr,i}var yy=["New_Zealand_Map_Grid","nzmg"],_y={init:gy,forward:my,inverse:py,names:yy};function vy(){}function Sy(i){var e=i.x,t=i.y,s=w(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 My(i){i.x-=this.x0,i.y-=this.y0;var e=w(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 Cy=["Miller_Cylindrical","mill"],xy={init:vy,forward:Sy,inverse:My,names:Cy},wy=20;function by(){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=Yl(this.es)}function Oy(i){var e,t,s=i.x,r=i.y;if(s=w(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=wy;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*Lr(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 Py(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=$t((this.m*e+Math.sin(e))/this.n):this.n!==1&&(e=$t(Math.sin(e)/this.n)),s=w(s+this.long0),e=Fi(e)):(e=Zl(i.y/this.a,this.es,this.en),r=Math.abs(e),r<S?(r=Math.sin(e),t=this.long0+i.x*Math.sqrt(1-this.es*r*r)/(this.a*Math.cos(e)),s=w(t)):r-x<S&&(s=this.long0)),i.x=s,i.y=e,i}var Ey=["Sinusoidal","sinu"],Iy={init:by,forward:Oy,inverse:Py,names:Ey};function Ly(){}function Ty(i){for(var e=i.x,t=i.y,s=w(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 Ny(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=w(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 Dy=["Mollweide","moll"],Fy={init:Ly,forward:Ty,inverse:Ny,names:Dy};function Ry(){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=Ds(this.es),this.e1=Fs(this.es),this.e2=Rs(this.es),this.e3=As(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=ut(this.e,this.sinphi,this.cosphi),this.ml1=Ie(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=ut(this.e,this.sinphi,this.cosphi),this.ml2=Ie(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=Ie(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Ay(i){var e=i.x,t=i.y,s;if(this.sphere)s=this.a*(this.g-t);else{var r=Ie(this.e0,this.e1,this.e2,this.e3,t);s=this.a*(this.g-r)}var n=this.ns*w(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 Gy(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=w(this.long0+n/this.ns),s=Fi(this.g-t/this.a),i.x=r,i.y=s,i;var a=this.g-t/this.a;return s=Fr(a,this.e0,this.e1,this.e2,this.e3),r=w(this.long0+n/this.ns),i.x=r,i.y=s,i}var ky=["Equidistant_Conic","eqdc"],zy={init:Ry,forward:Ay,inverse:Gy,names:ky};function jy(){this.R=this.a}function Hy(i){var e=i.x,t=i.y,s=w(e-this.long0),r,n;Math.abs(t)<=x&&(r=this.x0+this.R*s,n=this.y0);var a=$t(2*Math.abs(t/Math.PI));(Math.abs(s)<=x||Math.abs(Math.abs(t)-S)<=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 $y(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=w(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 Vy=["Van_der_Grinten_I","VanDerGrinten","vandg"],By={init:jy,forward:Hy,inverse:$y,names:Vy};function Uy(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function qy(i){var e=i.x,t=i.y,s=Math.sin(i.y),r=Math.cos(i.y),n=w(e-this.long0),a,o,l,h,c,u,d,f,g,m,p,y,M,b,I,L,D,X,$,xe,He,Mt,dr;return this.sphere?Math.abs(this.sin_p12-1)<=x?(i.x=this.x0+this.a*(S-t)*Math.sin(n),i.y=this.y0-this.a*(S-t)*Math.cos(n),i):Math.abs(this.sin_p12+1)<=x?(i.x=this.x0+this.a*(S+t)*Math.sin(n),i.y=this.y0+this.a*(S+t)*Math.cos(n),i):(X=this.sin_p12*s+this.cos_p12*r*Math.cos(n),L=Math.acos(X),D=L?L/Math.sin(L):1,i.x=this.x0+this.a*D*r*Math.sin(n),i.y=this.y0+this.a*D*(this.cos_p12*s-this.sin_p12*r*Math.cos(n)),i):(a=Ds(this.es),o=Fs(this.es),l=Rs(this.es),h=As(this.es),Math.abs(this.sin_p12-1)<=x?(c=this.a*Ie(a,o,l,h,S),u=this.a*Ie(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*Ie(a,o,l,h,S),u=this.a*Ie(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=Di(this.a,this.e,this.sin_p12),g=Di(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?$=Math.asin(this.cos_p12*Math.sin(m)-this.sin_p12*Math.cos(m)):Math.abs(Math.abs(p)-Math.PI)<=x?$=-Math.asin(this.cos_p12*Math.sin(m)-this.sin_p12*Math.cos(m)):$=Math.asin(Math.sin(n)*Math.cos(m)/Math.sin(p)),y=this.e*this.sin_p12/Math.sqrt(1-this.es),M=this.e*this.cos_p12*Math.cos(p)/Math.sqrt(1-this.es),b=y*M,I=M*M,xe=$*$,He=xe*$,Mt=He*$,dr=Mt*$,L=f*$*(1-xe*I*(1-I)/6+He/8*b*(1-2*I)+Mt/120*(I*(4-7*I)-3*y*y*(1-7*I))-dr/48*b),i.x=this.x0+L*Math.sin(p),i.y=this.y0+L*Math.cos(p),i))}function Wy(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,M,b,I,L,D,X,$;return this.sphere?(e=Math.sqrt(i.x*i.x+i.y*i.y),e>2*S*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=$t(r*this.sin_p12+i.y*s*this.cos_p12/e),o=Math.abs(this.lat0)-S,Math.abs(o)<=x?this.lat0>=0?n=w(this.long0+Math.atan2(i.x,-i.y)):n=w(this.long0-Math.atan2(-i.x,i.y)):n=w(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=Ds(this.es),h=Fs(this.es),c=Rs(this.es),u=As(this.es),Math.abs(this.sin_p12-1)<=x?(d=this.a*Ie(l,h,c,u,S),e=Math.sqrt(i.x*i.x+i.y*i.y),f=d-e,a=Fr(f/this.a,l,h,c,u),n=w(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*Ie(l,h,c,u,S),e=Math.sqrt(i.x*i.x+i.y*i.y),f=e-d,a=Fr(f/this.a,l,h,c,u),n=w(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=Di(this.a,this.e,this.sin_p12),y=Math.cos(p),M=this.e*this.cos_p12*y,b=-M*M/(1-this.es),I=3*this.es*(1-b)*this.sin_p12*this.cos_p12*y/(1-this.es),L=e/g,D=L-b*(1+b)*Math.pow(L,3)/6-I*(1+3*b)*Math.pow(L,4)/24,X=1-b*D*D/2-L*D*D*D/6,m=Math.asin(this.sin_p12*Math.cos(D)+this.cos_p12*Math.sin(D)*y),n=w(this.long0+Math.asin(Math.sin(p)*Math.sin(D)/Math.cos(m))),$=Math.sin(m),a=Math.atan2(($-this.es*X*this.sin_p12)*Math.tan(m),$*(1-this.es)),i.x=n,i.y=a,i))}var Xy=["Azimuthal_Equidistant","aeqd"],Yy={init:Uy,forward:qy,inverse:Wy,names:Xy};function Zy(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Jy(i){var e,t,s,r,n,a,o,l,h=i.x,c=i.y;return s=w(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 Ky(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=$t(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=$t(r*this.sin_p14+i.y*s*this.cos_p14/e),n=Math.abs(this.lat0)-S,Math.abs(n)<=x?(this.lat0>=0?a=w(this.long0+Math.atan2(i.x,-i.y)):a=w(this.long0-Math.atan2(-i.x,i.y)),i.x=a,i.y=o,i):(a=w(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 Qy=["ortho"],e0={init:Zy,forward:Jy,inverse:Ky,names:Qy},J={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},H={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function t0(){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>=S-j/2?this.face=J.TOP:this.lat0<=-(S-j/2)?this.face=J.BOTTOM:Math.abs(this.long0)<=j?this.face=J.FRONT:Math.abs(this.long0)<=S+j?this.face=this.long0>0?J.RIGHT:J.LEFT:this.face=J.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 i0(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===J.TOP)n=S-t,s>=j&&s<=S+j?(l.value=H.AREA_0,r=s-S):s>S+j||s<=-(S+j)?(l.value=H.AREA_1,r=s>0?s-ne:s+ne):s>-(S+j)&&s<=-j?(l.value=H.AREA_2,r=s+S):(l.value=H.AREA_3,r=s);else if(this.face===J.BOTTOM)n=S+t,s>=j&&s<=S+j?(l.value=H.AREA_0,r=-s+S):s<j&&s>=-j?(l.value=H.AREA_1,r=-s):s<-j&&s>=-(S+j)?(l.value=H.AREA_2,r=-s-S):(l.value=H.AREA_3,r=s>0?-s+ne:-s-ne);else{var h,c,u,d,f,g,m;this.face===J.RIGHT?s=Ri(s,+S):this.face===J.BACK?s=Ri(s,+ne):this.face===J.LEFT&&(s=Ri(s,-S)),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===J.FRONT?(n=Math.acos(h),r=Rr(n,u,c,l)):this.face===J.RIGHT?(n=Math.acos(c),r=Rr(n,u,-h,l)):this.face===J.BACK?(n=Math.acos(-h),r=Rr(n,u,-c,l)):this.face===J.LEFT?(n=Math.acos(-c),r=Rr(n,u,h,l)):(n=r=0,l.value=H.AREA_0)}return o=Math.atan(12/ne*(r+Math.acos(Math.sin(r)*Math.cos(j))-S)),a=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(r))))),l.value===H.AREA_1?o+=S:l.value===H.AREA_2?o+=ne:l.value===H.AREA_3&&(o+=1.5*ne),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 s0(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=H.AREA_0:i.y>=0&&i.y>=Math.abs(i.x)?(u.value=H.AREA_1,t-=S):i.x<0&&-i.x>=Math.abs(i.y)?(u.value=H.AREA_2,t=t<0?t+ne:t-ne):(u.value=H.AREA_3,t+=S),c=ne/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===J.TOP)h=Math.acos(l),e.phi=S-h,u.value===H.AREA_0?e.lam=o+S:u.value===H.AREA_1?e.lam=o<0?o+ne:o-ne:u.value===H.AREA_2?e.lam=o-S:e.lam=o;else if(this.face===J.BOTTOM)h=Math.acos(l),e.phi=h-S,u.value===H.AREA_0?e.lam=-o+S:u.value===H.AREA_1?e.lam=-o:u.value===H.AREA_2?e.lam=-o-S:e.lam=o<0?-o-ne:-o+ne;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===H.AREA_1?(c=f,f=-g,g=c):u.value===H.AREA_2?(f=-f,g=-g):u.value===H.AREA_3&&(c=f,f=g,g=-c),this.face===J.RIGHT?(c=d,d=-f,f=c):this.face===J.BACK?(d=-d,f=-f):this.face===J.LEFT&&(c=d,d=f,f=-c),e.phi=Math.acos(-g)-S,e.lam=Math.atan2(f,d),this.face===J.RIGHT?e.lam=Ri(e.lam,-S):this.face===J.BACK?e.lam=Ri(e.lam,-ne):this.face===J.LEFT&&(e.lam=Ri(e.lam,+S))}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 Rr(i,e,t,s){var r;return i<x?(s.value=H.AREA_0,r=0):(r=Math.atan2(e,t),Math.abs(r)<=j?s.value=H.AREA_0:r>j&&r<=S+j?(s.value=H.AREA_1,r-=S):r>S+j||r<=-(S+j)?(s.value=H.AREA_2,r=r>=0?r-ne:r+ne):(s.value=H.AREA_3,r+=S)),r}function Ri(i,e){var t=i+e;return t<-ne?t+=Ps:t>+ne&&(t-=Ps),t}var r0=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],n0={init:t0,forward:i0,inverse:s0,names:r0},ca=[[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]],Gs=[[-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]],eh=.8487,th=1.3523,ih=ct/5,a0=1/ih,Ai=18,Ar=function(i,e){return i[0]+e*(i[1]+e*(i[2]+e*i[3]))},o0=function(i,e){return i[1]+e*(2*i[2]+e*3*i[3])};function l0(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 h0(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function c0(i){var e=w(i.x-this.long0),t=Math.abs(i.y),s=Math.floor(t*ih);s<0?s=0:s>=Ai&&(s=Ai-1),t=ct*(t-a0*s);var r={x:Ar(ca[s],t)*e,y:Ar(Gs[s],t)};return i.y<0&&(r.y=-r.y),r.x=r.x*this.a*eh+this.x0,r.y=r.y*this.a*th+this.y0,r}function u0(i){var e={x:(i.x-this.x0)/(this.a*eh),y:Math.abs(i.y-this.y0)/(this.a*th)};if(e.y>=1)e.x/=ca[Ai][0],e.y=i.y<0?-S:S;else{var t=Math.floor(e.y*Ai);for(t<0?t=0:t>=Ai&&(t=Ai-1);;)if(Gs[t][0]>e.y)--t;else if(Gs[t+1][0]<=e.y)++t;else break;var s=Gs[t],r=5*(e.y-s[0])/(Gs[t+1][0]-s[0]);r=l0(function(n){return(Ar(s,n)-e.y)/o0(s,n)},r,x,100),e.x/=Ar(ca[t],r),e.y=(5*t+r)*ve,i.y<0&&(e.y=-e.y)}return e.x=w(e.x+this.long0),e}var d0=["Robinson","robin"],f0={init:h0,forward:c0,inverse:u0,names:d0};function g0(){this.name="geocent"}function m0(i){var e=Il(i,this.es,this.a);return e}function p0(i){var e=Ll(i,this.es,this.a,this.b);return e}var y0=["Geocentric","geocentric","geocent","Geocent"],_0={init:g0,forward:m0,inverse:p0,names:y0},we={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 v0(){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]*ve)}.bind(this)),Math.abs(Math.abs(this.lat0)-S)<x?this.mode=this.lat0<0?we.S_POLE:we.N_POLE:Math.abs(this.lat0)<x?this.mode=we.EQUIT:(this.mode=we.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 S0(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 we.OBLIQ:n=this.sinph0*e+this.cosph0*t*s;break;case we.EQUIT:n=t*s;break;case we.S_POLE:n=-e;break;case we.N_POLE:n=e;break}switch(n=this.pn1/(this.p-n),r=n*t*Math.sin(i.x),this.mode){case we.OBLIQ:n*=this.cosph0*e-this.sinph0*t*s;break;case we.EQUIT:n*=e;break;case we.N_POLE:n*=-(t*s);break;case we.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 M0(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=Nr(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 we.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 we.EQUIT:e.y=Math.asin(i.y*o/n),i.y=a*n,i.x*=o;break;case we.N_POLE:e.y=Math.asin(a),i.y=-i.y;break;case we.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 C0=["Tilted_Perspective","tpers"],x0={init:v0,forward:S0,inverse:M0,names:C0};function w0(i){i.Proj.projections.add(Tr),i.Proj.projections.add(Dr),i.Proj.projections.add(Rm),i.Proj.projections.add(Um),i.Proj.projections.add(Jm),i.Proj.projections.add(ip),i.Proj.projections.add(lp),i.Proj.projections.add(fp),i.Proj.projections.add(_p),i.Proj.projections.add(xp),i.Proj.projections.add(jp),i.Proj.projections.add(qp),i.Proj.projections.add(Jp),i.Proj.projections.add(sy),i.Proj.projections.add(ly),i.Proj.projections.add(fy),i.Proj.projections.add(_y),i.Proj.projections.add(xy),i.Proj.projections.add(Iy),i.Proj.projections.add(Fy),i.Proj.projections.add(zy),i.Proj.projections.add(By),i.Proj.projections.add(Yy),i.Proj.projections.add(e0),i.Proj.projections.add(n0),i.Proj.projections.add(f0),i.Proj.projections.add(_0),i.Proj.projections.add(x0)}ce.defaultDatum="WGS84",ce.Proj=dt,ce.WGS84=new ce.Proj("WGS84"),ce.Point=Ti,ce.toPoint=Fl,ce.defs=Ee,ce.nadgrid=Gg,ce.transform=Ir,ce.mgrs=Qg,ce.version="__VERSION__",w0(ce);const zs=de("EPSG:4326","EPSG:3857"),ua=de("EPSG:3857","EPSG:4326");let da={epsg:"EPSG:4326"};function fa(i,e="EPSG:"){const t=new RegExp(`^(?:${e})?(\\d+)`,"i"),s=`${i}`.match(t);return s&&s[1]?`${e}${s[1]}`:""}function sh(i){let e=null;if(i.epsg)try{e=ce(fa(i.epsg))}catch{e=null}if(i.proj4)try{e=ce(i.proj4)}catch{e=null}return e!=null}function rh(i){const e={prefix:i.prefix};return i.epsg&&(e.epsg=fa(i.epsg,i.prefix),e.epsg&&(i.proj4&&(e.proj4=i.proj4,ce.defs(e.epsg,i.proj4),Fo(ce)),i.alias&&Array.isArray(i.alias)&&(e.alias=i.alias,e.alias.forEach(t=>{ce.defs(t,ce.defs(e.epsg)),Fo(ce)})))),e}function nh(i){if(_(i,{epsg:[String,Number],proj4:[String,void 0,null]}),!sh(i))throw new Error("Cannot set invalid projection options as default options");da=rh(i)}class T{static get className(){return"Projection"}constructor(e={epsg:""}){const t=rh(e);this._proj4=t.proj4,this._epsg=t.epsg,this.proj||(this._epsg=T.parseEPSGCode(da.epsg)),this._alias=t.alias,this._prefix=t.prefix}get epsg(){return this._epsg}get proj4(){return this._proj4}get proj(){return ad(this.epsg)}equals(e){return od(this.proj,e.proj)}static transform(e,t,s){const r=de(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 T.transform(e,this,t)}static transformCoordinates(e,t,s){const r=[];for(let n=0;n<s.length;n++)r.push(T.transform(e,t,s[n]));return r}static getTransformer(e,t){return de(t.proj,e.proj)}transformFrom(e,t){return T.transform(this,e,t)}toJSON(){const e={type:T.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 ua(e,t?e:void 0,e.length)}static wgs84ToMercator(e,t){return zs(e,t?e:void 0,e.length)}static validateOptions(e){return sh(e)}static parseEPSGCode(e,t="EPSG:"){return fa(e,t)}}function ah(){return new T(da)}const B=new T({epsg:4326}),F=new T({epsg:3857});class rt{static get className(){return"VcsObject"}constructor(e){this.name=e.name||Ye(),this.properties=e.properties||{}}get className(){return this.constructor.className}getLogger(){return Pe(this.className)}toJSON(){const e={type:this.className,name:this.name};return Object.keys(this.properties).length>0&&(e.properties=v({},this.properties)),e}destroy(){this.isDestroyed=!0,this.properties={}}}function oh(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 pe{static get className(){return"Extent"}constructor(e={}){this.projection=new T(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=T.getTransformer(e,this.projection),r=t||[];return s(this.extent,r,2),r}isValid(){return oh(this.extent)}toJSON(){return{coordinates:this.extent.slice(),projection:this.projection.toJSON(),type:pe.className}}clone(){return new pe(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 T.validateOptions(e.projection||{})&&oh(e.coordinates)}static get WGS_84_EXTENT(){return[-180,-90,180,90]}}function ga(i,e,t){return Math.abs(i-e)<=t}function Gr(i,e,t){const s=i-e-Math.trunc((i-e)/360)*360;return Math.abs(s)<=t}function ma(i,e,t){return i!==null&&e!==null&&i.every((s,r)=>ga(s,e[r],t))}class ot extends rt{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=E(e.distance,this.cameraPosition?this.cameraPosition[2]:1e3),this.heading=E(e.heading,0),this.pitch=E(e.pitch,-90),this.roll=E(e.roll,0),this.animate=re(e.animate,!1),this.duration=e.duration||null,this.easingFunctionName=e.easingFunctionName||null}get easingFunction(){return this.easingFunctionName?$d[this.easingFunctionName]:null}toJSON(){return O(v({},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 ot(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 pe?e.getCoordinatesInProjection(B):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 ot({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 T({epsg:n,proj4:a}),l=B;s&&(s=T.transform(l,o,s)),t&&(t=T.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 ot(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&&ga(e.distance,this.distance,t)&&Gr(e.heading,this.heading,t)&&Gr(e.pitch,this.pitch,t)&&Gr(e.roll,this.roll,t)&&(ma(e.cameraPosition,this.cameraPosition,t)||ma(e.groundPosition,this.groundPosition,t))}}class R{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 b0(){return Pe("OverrideClassRegistry")}class ft{constructor(e){this._coreClassRegistry=e,this._classMap=new Map,this._classShadows=new Map,this.replaced=new R,this.removed=new R}getClassNames(){return[...new Set([...this._classMap.keys(),...this._coreClassRegistry.getClassNames()])]}registerClass(e,t,s){_(e,String),_(t,String),_(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(_(e,String),_(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 _(e,String),this._classMap.has(e)?this._classMap.get(e).ctor:this._coreClassRegistry.getClass(e)}hasClass(e){return _(e,String),this._classMap.has(e)||this._coreClassRegistry.hasClass(e)}create(e,...t){_(e,String);const s=this.getClass(e);if(!s){b0().error(`could not find constructor ${e}`);return}return new s(...t)}createFromTypeOptions(e,...t){return _(e,{type:String}),this.create(e.type,e,...t)}removeContext(e){_(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 js(){return Pe("ClassRegistry")}class bt{constructor(){this._classMap=new Map}getClassNames(){return[...this._classMap.keys()]}registerClass(e,t){if(_(e,String),_(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(_(e,String),this._classMap.has(e))return this._classMap.get(e)}hasClass(e){return _(e,String),this._classMap.has(e)}create(e,...t){_(e,String);const s=this.getClass(e);if(!s){js().error(`could not find constructor ${e}`);return}return new s(...t)}createFromTypeOptions(e,...t){return _(e,{type:String}),this.create(e.type,e,...t)}}const oe=new bt,si=new bt,kr=new bt,ri=new bt,Gi=new bt,zr=new bt;function gt(i,e,...t){if(!Xn(i,[bt,ft]))return js().error(`ObjectCreation failed: no class registry provided for ${e}`),null;if(!(e!=null&&e.type))return js().warning(`ObjectCreation failed: could not find type in options ${e}`),null;let s;try{s=i.createFromTypeOptions(e,...t)}catch(r){js().warning(`Error: ${r}`)}return s||(js().warning("ObjectCreation failed: could not create new Object"),null)}function O0(){return Pe("init")}const Le=Symbol("contextId");function pa(i,e){const t=gt(i.mapClassRegistry,e);return t&&(t.layerCollection=i.layers),t}function lh(i){const e=new ot(i);return e&&e.isValid()?e:(O0().warning(`Viewpoint ${i.name} is not valid`),null)}function ya(i,e){let t;e.style&&(typeof e.style=="string"?t=i.styles.getByKey(e.style):t=gt(i.styleClassRegistry,e.style));let s;e.tileProvider&&(s=gt(i.tileProviderClassRegistry,e.tileProvider));let r;return e.featureProvider&&(r=gt(i.featureProviderClassRegistry,e.featureProvider)),gt(i.layerClassRegistry,O(v({},e),{style:t,tileProvider:s,featureProvider:r}))}function hh(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 ch(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 _t{static from(e,t){const s=new _t(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 R,this.removed=new R}*[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 P0(){return Pe("OverrideCollection")}const jr=Symbol("OverrideCollection");function ni(i,e,t,s,r,n){_(i,_t);const a=i;if(a[jr])throw new Error("Cannot transform collection, collection already is an OverrideCollection");a[jr]=!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),M=l(f);f.destroy&&f.destroy(),M[Le]=f[Le],y.push(M)}const p=f?h(f,d,g):null;return f&&a.replaced.raiseEvent(d),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)?(P0().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 R,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 z=Symbol("vcsLayerName"),K={INACTIVE:1,ACTIVE:2,LOADING:4};var E0=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Ot=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 nt extends rt{static get className(){return"StyleItem"}constructor(e){super(e),this.supportedLayers=[],this.cesiumStyle=new Fn({show:!0}),this.styleChanged=new R,this.colorBlendMode=Qn(e.colorBlendMode,yr,yr.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!==yr.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,Ot(t,s)}return!0}_styleChanged(){this.styleChanged.raiseEvent()}destroy(){this.cesiumStyle=null,this.styleChanged.destroy(),super.destroy()}}Gi.registerClass(nt.className,nt);function uh(){return Pe("StyleHelpers")}const _a={NWSE:1,SWNE:2,DIAGONALCROSS:3,NS:4,WE:5,CROSS:6};function dh(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 Pt(i){const e=i.toBytes();return e[3]/=255,e}function I0(i){return Oe.fromBytes(i[0],i[1],i[2],i[3]*255)}function be(i,e){if(Array.isArray(i))return i.length===3&&i.push(1),i;if(typeof i=="string"){if(/^#/.test(i))return dh(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 ai(i,e){const t=be(i,e);return Oe.fromBytes(t[0],t[1],t[2],t[3]*255)}function Re(i){return`rgba(${be(i).join(",")})`}function fh(i,e){const t=ld,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=Re(i.color),r.fillRect(0,0,n,n);function a(o,l){r.strokeStyle=Re(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 va(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 L0(i){return/^#[0-9a-f]{6}$/.test(i)}function T0(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 gh(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 N0(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 Hr(i){if(i.getFill()){let e=i.getFill().getColor();try{e=be(e).slice()}catch(t){uh().warning(t.message)}return{color:e}}}function Hs(i){let e=i.getColor();if(e)try{e=be(e).slice()}catch(t){uh().warning(t.message)}return{color:e,width:i.getWidth(),lineDash:i.getLineDash()}}function mh(i){return{font:i.getFont(),fill:Hr(i),stroke:i.getStroke()?Hs(i.getStroke()):void 0,textBaseline:i.getTextBaseline(),offsetY:i.getOffsetY(),offsetX:i.getOffsetX()}}function ph(i){const e=v({},i);return e.fill&&!(e.fill instanceof ht)&&(e.fill=new ht(e.fill)),e.stroke&&!(e.stroke instanceof tt)&&(e.stroke=new tt(e.stroke)),e.font&&typeof e.font!="string"&&(e.font=gh(e.font)),new wn(e)}function D0(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=va(be(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=va(be(i.getFill().getColor()))),e}const $r=new fe({}),F0=[0,0,0,0],$s=[255,255,255,1],Vr=[0,0,0,1];function Sa(){return{image:{fill:{color:[255,255,255,.4]},stroke:{color:Vr,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 R0={olcs_color:Re($s),olcs_scale:"1.0",olcs_outlineWidth:"0.0",olcs_outlineColor:Re(Vr),olcs_pointSize:"8.0",olcs_image:null,olcs_font:`'${Sa().text.font}'`,olcs_fontColor:Re(Vr),olcs_fontOutlineWidth:"1.0",olcs_fontOutlineColor:Re($s),olcs_labelText:null,olcs_anchorLineColor:Re($s)};function Q(i,e){const t=`Boolean(\${${i}})===true`,s=e?`color(\${${i}})`:`\${${i}}`;return[[t,s],["true",R0[i]]]}const A0="${attributes} !== undefined && ${attributes} !== null && ${attributes.olcs_extrudedHeight} !== undefined && ${attributes.olcs_extrudedHeight}!==null";function Ma(i){return i.fill&&!(i.fill instanceof ht)&&(i.fill=new ht(i.fill)),i.stroke&&!(i.stroke instanceof tt)&&(i.stroke=new tt(i.stroke)),i.points?new bn(i):new ps(i)}class G0{constructor(){this.shapes=[]}addImage(e){const s=Ma(v({},e)).getImage(1);e.src=s.toDataURL(),this.shapes.push(e)}}const yh=new G0,_h={fill:new ht({color:[255,255,255,1]}),stroke:new tt({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,_h):_h;yh.addImage(e)});const Ca={POLYGON:1,POLYLINE:2,POINT:3},Te=Symbol("VcsVectorStyleItem");class q extends nt{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 tt(e.stroke):void 0,this._text=void 0,e.text&&(this._text=ph(e.text)),this._label=e.label,this.label=this._label,this._cesiumColor=new Oe,this._image=void 0,e.image&&(this._image=e.image.radius?Ma(v({},e.image)):new ys(e.image)),this._style=new fe({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=be(r.color),_(r.color,[Number]),_(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(_a).includes(e.fill.pattern.type)||(this.getLogger().error(`Cannot find pattern ${e.fill.pattern.type}`),e.fill.pattern.type=_a.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,Oe.fromBytes(...e,this._cesiumColor)):Oe.RED.clone(this._cesiumColor)}set fillColor(e){this.exclude.fill=!1,this._style instanceof fe?e?(this._fillOptions?this._fillOptions.color=be(e):this._fillOptions={color:be(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?(ie(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 fe?(ie(e,tt),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){ie(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 fe?(ie(e,wn),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 fe?(ie(e,hd),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){ie(e,[fe,Function]),e instanceof fe?(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:be(this._fill.getColor())}),this._text&&this._text.setText(this._label),this.updateCesiumStyle()}_setFill(){if(this._style instanceof fe){const e=this._fillOptions.pattern?fh(this._fillOptions):this._fillOptions.color;this._fill?this._fill.setColor(e):(this._fill=new ht({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=Q("olcs_color",!0);this.stroke&&this.stroke.getColor()&&t.splice(1,0,[`\${olcs_geometryType}===${Ca.POLYLINE}`,Re(this.stroke.getColor())]),this._image instanceof ps&&this._image.getFill()&&t.splice(1,0,[`\${olcs_geometryType}===${Ca.POINT}`,Re(this._image.getFill().getColor())]),this.fillColor&&t.splice(-1,1,["true",Re(this.fillColor)]),this.cesiumStyle.color={conditions:t},e||this._styleChanged()}updateCesiumStyleImage(e){const t=Q("olcs_scale"),s=Q("olcs_outlineWidth"),r=Q("olcs_outlineColor",!0),n=Q("olcs_pointSize"),a=Q("olcs_image");if(this._image)if(this._image.getScale()!=null&&t.splice(1,1,["true",`${this._image.getScale()}`]),this._image instanceof ps){const o=this._image.getStroke();let l=this._image.getRadius()*2;if(o){this._image.getStroke().getColor()&&r.splice(1,1,["true",Re(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 bn){const o=this._image.getImage(1).toDataURL();a.splice(1,1,["true",`"${o}"`])}else this._image instanceof ys&&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=Q("olcs_font"),s=Q("olcs_labelText"),r=Q("olcs_fontColor",!0),n=Q("olcs_fontOutlineWidth"),a=Q("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",Re(this._text.getFill().getColor())]),this._text.getStroke()&&this._text.getStroke().getColor()&&(a.splice(1,1,["true",Re(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=Be.CENTER;if(this._text)switch(this._text.getTextBaseline()){case"top":o=Be.TOP;break;case"middle":o=Be.CENTER;break;case"bottom":o=Be.BOTTOM;break;case"alphabetic":o=Be.TOP;break;case"hanging":o=Be.BOTTOM;break}this.cesiumStyle.labelVerticalOrigin=o,e||this._styleChanged()}clone(e){if(e)return e.style=this._style instanceof fe?this._style.clone():this._style,this._fillOptions&&this._fillOptions.color&&(e.fillColor=this._fillOptions.color.slice(),this._fillOptions.pattern&&(e.pattern=v({},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 q(t)}assign(e){return super.assign(e),e.fillColor&&(this.fillColor=e.fillColor.slice()),e.pattern?this.pattern=v({},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:be(this._fillOptions.color).slice()},this._fillOptions.pattern&&(e.fill.pattern=v({},this._fillOptions.pattern))):this.exclude.fill&&(e.fill=!1),this._stroke?e.stroke=Hs(this._stroke):this.exclude.stroke&&(e.stroke=!1),this._text&&(e.text=mh(this._text)),this._label&&(e.label=this._label),this._image instanceof ys?e.image={src:this._image.getSrc(),scale:this._image.getScale(),opacity:this._image.getOpacity()}:this._image instanceof ps?e.image={scale:this._image.getScale(),fill:Hr(this._image),radius:this._image.getRadius(),stroke:this._image.getStroke()?Hs(this._image.getStroke()):void 0}:this._image instanceof bn?e.image={scale:this._image.getScale(),fill:Hr(this._image),points:this._image.getPoints(),angle:this._image.getAngle(),radius:this._image.getRadius(),stroke:this._image.getStroke()?Hs(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[Te].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){_(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 oi=new q(Sa());Gi.registerClass(q.className,q);function vh(i){const e=i.toBytes();return e[3]/=255,new q({fill:{color:e},stroke:{color:e,width:oi.stroke.getWidth()}})}const pt=Symbol("originalStyle"),Ne=Symbol("highlighted"),Ae=Symbol("hidden"),Ge=Symbol("globalHidden");function ki(i){return i&&i.content&&!i.content.isDestroyed()&&!i.content.batchTable.isDestroyed()}function xa(i){(i instanceof Gt||i instanceof At)&&ki(i)||i instanceof Rn?i.show=!1:i instanceof Z&&i.setStyle($r.clone())}function Br(i){Reflect.has(i,pt)||((i instanceof Gt||i instanceof At)&&ki(i)?i[pt]=i.color.clone():i instanceof Z&&(i[pt]=i.getStyle()))}function Sh(i){if(!(i[Ge]||i[Ae]||i[Ne])){const e=i[pt];(i instanceof Gt||i instanceof At)&&ki(i)?i.color=e:i instanceof Z&&i.setStyle(e),delete i[pt]}}function Ur(i){if(!(i[Ge]||i[Ae])){const e=i[Ne];(i instanceof Gt||i instanceof At)&&ki(i)?i.color=e.cesiumFillColor:i instanceof Z&&i.setStyle(e.style)}}function wa(i){delete i[pt],Br(i),i[Ae]||i[Ge]?xa(i):i[Ne]&&Ur(i)}function k0(i){delete i[Ne],Sh(i)}function Mh(i,e){delete i[e],i[Ae]||i[Ge]||(((i instanceof Gt||i instanceof At)&&ki(i)||i instanceof Rn)&&(i.show=!0),i[Ne]?Ur(i):Sh(i))}const W={HIGHLIGHT:1,UNHIGHLIGHT:2,HIDE:3,SHOW:4};function Ch(i,e){function t({action:n,ids:a}){if(n===W.HIGHLIGHT){const o={};a.forEach(l=>{o[l]=i.highlightedObjects[l].style}),e.highlight(o)}else n===W.UNHIGHLIGHT?e.unHighlight(a):n===W.HIDE?e.hideObjects(a):n===W.SHOW&&e.showObjects(a)}const s=Object.keys(i.highlightedObjects);s.length>0&&t({action:W.HIGHLIGHT,ids:s});const r=Object.keys(i.hiddenObjects);return r.length>0&&t({action:W.HIDE,ids:r}),i.changed.addEventListener(t)}class qr{constructor(){this.hiddenObjects={},this.highlightedObjects={},this.lastUpdated=Date.now(),this.changed=new R}highlight(e){const t=[];Object.entries(e).forEach(([s,r])=>{let n=r;r instanceof Oe?n=vh(r):r instanceof fe&&(n=new q({}),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[Ne]=n,Ur(o)})):(this.highlightedObjects[s]={style:n,features:new Set},t.push(s))}),t.length>0&&(this.lastUpdated=Date.now(),this.changed.raiseEvent({action:W.HIGHLIGHT,ids:t}))}unHighlight(e){const t=[];e.forEach(s=>{this.highlightedObjects[s]&&(this.highlightedObjects[s].features.forEach(r=>{k0(r)}),delete this.highlightedObjects[s],t.push(s))}),t.length>0&&this.changed.raiseEvent({action:W.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]&&(Br(t),this.highlightedObjects[e].features.add(t),t[Ne]=this.highlightedObjects[e].style,Ur(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:W.HIDE,ids:t}))}showObjects(e){const t=[];e.forEach(s=>{this.hiddenObjects[s]&&(this.hiddenObjects[s].forEach(r=>{Mh(r,Ae)}),delete this.hiddenObjects[s],t.push(s))}),t.length>0&&this.changed.raiseEvent({action:W.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]&&(Br(t),this.hiddenObjects[e].add(t),t[Ae]=!0,xa(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 Wr{constructor(){this.hiddenObjects={},this._hiddenObjectFeatures={},this.lastUpdated=Date.now(),this.changed=new R}hideObjects(e){_(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:W.HIDE,ids:t}))}showObjects(e){_(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=>{Mh(r,Ge)}),this._hiddenObjectFeatures[s].clear()),delete this.hiddenObjects[s],t.push(s)))}),t.length>0&&this.changed.raiseEvent({action:W.SHOW,ids:t})}addFeature(e,t){this._hiddenObjectFeatures[e]||(this._hiddenObjectFeatures[e]=new Set),Br(t),this._hiddenObjectFeatures[e].add(t),t[Ge]=!0,xa(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 ba="2.0";class he extends rt{static get className(){return"Layer"}static get vcsLayerNameSymbol(){return z}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=he.getDefaultOptions();this.extent=e.extent?new pe(e.extent):null,this.activeOnStartup=re(e.activeOnStartup,t.activeOnStartup),this._allowPicking=re(e.allowPicking,t.allowPicking),this._state=K.INACTIVE,this._loadingPromise=null,this._initialized=!1,this.mapNames=e.mapNames||t.mapNames,this._supportedMaps=[],this._url=e.url,this._zIndex=V(e.zIndex,0),this.zIndexChanged=new R,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 R,this.copyright=e.copyright||t.copyright,this._implementations=new Map,this._activeMaps=new Set,this.stateChanged=new R,this.featureProvider=void 0,this._locale="en"}get initialized(){return this._initialized}get active(){return this._state===K.ACTIVE}get loading(){return!!(this._state&K.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){_(e,[String,Object]),this._url!==e&&(this._url=e,this.reload())}get hiddenObjectIds(){return this._hiddenObjectIds}set hiddenObjectIds(e){_(e,[String]),this._globalHider&&this.active&&this._globalHider.hideObjects(e),this._hiddenObjectIds=e}get globalHider(){return this._globalHider}setGlobalHider(e){ie(e,Wr),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){_(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){_(e,Number),this._zIndex!==e&&(this._zIndex=e,this.zIndexChanged.raiseEvent(e))}get locale(){return this._locale}set locale(e){_(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=K.LOADING;try{this.stateChanged.raiseEvent(K.LOADING)}catch(e){this.getLogger().debug(`Error on raising LayerState.LOADING event for layer ${this.name} : ${e.message}`)}if(await this.initialize(),this._state===K.LOADING&&(await Promise.all([...this._activeMaps].map(e=>this._activateImplsForMap(e))),this._state===K.LOADING)){this._globalHider&&this._globalHider.hideObjects(this.hiddenObjectIds),this._state=K.ACTIVE;try{this.stateChanged.raiseEvent(K.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===K.INACTIVE?(this._loadingPromise=this._activate().catch(e=>(this._state=K.INACTIVE,Promise.reject(e))),this._loadingPromise):Promise.resolve()}deactivate(){if(this._loadingPromise&&(this._loadingPromise=null),this._state!==K.INACTIVE){this.getImplementations().forEach(e=>{(e.loading||e.active)&&e.deactivate()}),this._globalHider&&this._globalHider.showObjects(this.hiddenObjectIds),this._state=K.INACTIVE;try{this.stateChanged.raiseEvent(K.INACTIVE)}catch(e){this.getLogger().debug(`Error on raising LayerState.INACTIVE event for layer ${this.name} : ${e.message}`)}}}toJSON(){const e=super.toJSON(),t=he.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=v({},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()}}oe.registerClass(he.className,he);const xh=Symbol("alreadyTransformedToMercator"),Vt=Symbol("alreadyTransformedToImage"),Xr=Symbol("obliqueGeometry"),Oa=Symbol("doNotTransform"),Bt=Symbol("OriginalFeature"),Vs=Symbol("ActuallyIsCircle"),li=new Oe,z0=new wn({font:"30px sans-serif",fill:new ht({color:$s}),textAlign:"left",offsetY:-15});function wh(i,e,t){t[e].conditions?i[e]=new Vd(t[e],t.defines):i[e]=new Bd(t[e],t.defines)}class Me extends nt{static get className(){return"DeclarativeStyleItem"}constructor(e){super(e);const t=e.declarativeStyle||{};t.show=t.show!=null?t.show:!0,this.cesiumStyle=new Fn(t),this._style=this._styleFunction.bind(this),t.strokeColor&&wh(this.cesiumStyle,"strokeColor",t),t.strokeWidth&&wh(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(),t=this.cesiumStyle.ready?this.cesiumStyle.style:this.styleOptions;return e.declarativeStyle=Object.fromEntries(Object.entries(t).filter(([,s])=>s!=null).map(([s,r])=>Xn(r,Boolean)?[s,r.toString()]:[s,r])),e}clone(e){if(e)return e.assign(this);const t=this.toJSON();return delete t.name,new Me(t)}assign(e){return super.assign(e),this._styleOptions=e.cesiumStyle.ready?e.cesiumStyle.style:e.styleOptions,this.cesiumStyle=new Fn(this._styleOptions),this}_styleFunction(e){const t=e[Bt]||e;if(!this.cesiumStyle.show.evaluate(t))return $r;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}`),$r)}_stylePolygon(e){const t=new fe({}),s=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(e,li):Oe.WHITE;return s&&t.setFill(new ht({color:Pt(s)})),this._evaluateStroke(e,t),t}_styleLineString(e){const t=new fe({}),s=e.get("olcs_extrudedHeight")||e.get("olcs_storeyHeight")&&e.get("olcs_storeyNumber"),r=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(e,li):Oe.WHITE;if(r)if(s)t.setFill(new ht({color:Pt(r)}));else{const n=this.cesiumStyle.strokeWidth?this.cesiumStyle.strokeWidth.evaluate(e):1;t.setStroke(new tt({width:Number.isFinite(n)?n:1,color:Pt(r)}))}return s&&this._evaluateStroke(e,t),t}_stylePoint(e){const t=new fe({});if(this.cesiumStyle.labelText){const s=this.cesiumStyle.labelText.evaluate(e);if(s){const r=z0.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,li);n&&r.getFill().setColor(Pt(n))}if(this.cesiumStyle.labelOutlineColor){const n=this.cesiumStyle.labelOutlineColor.evaluate(e,li);if(n){const a=this.cesiumStyle.labelOutlineWidth?this.cesiumStyle.labelOutlineWidth.evaluate(e):1;r.setStroke(new tt({color:Pt(n),width:a}))}}t.setText(r)}}if(this.cesiumStyle.image){const s=this.cesiumStyle.image.evaluate(e);s&&t.setImage(new ys({src:s}))}else{const s=this.cesiumStyle.color?this.cesiumStyle.color.evaluate(e,li):Oe.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=Oe.BLACK;n&&(this.cesiumStyle.pointOutlineColor&&(a=this.cesiumStyle.pointOutlineColor.evaluateColor(e,li)),r+=n/2);const o=`${r}${s}${n}${a}`;if(!this._circleCache.has(o)){const l={radius:r,fill:new ht({color:Pt(s)})};n&&(l.stroke=new tt({color:Pt(a),width:n})),this._circleCache.set(o,new ps(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,li);if(s){const r=this.cesiumStyle.strokeWidth?this.cesiumStyle.strokeWidth.evaluate(e):1;t.setStroke(new tt({width:Number.isFinite(r)?r:1,color:Pt(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()}}Gi.registerClass(Me.className,Me);const bh=new Me({declarativeStyle:{show:!0,color:{conditions:Q("olcs_color",!0)},scale:{conditions:Q("olcs_scale")},pointOutlineWidth:{conditions:Q("olcs_outlineWidth")},pointOutlineColor:{conditions:Q("olcs_outlineColor",!0)},pointSize:{conditions:Q("olcs_pointSize")},image:{conditions:Q("olcs_image")},font:{conditions:Q("olcs_font")},labelStyle:"2",labelText:{conditions:Q("olcs_labelText")},labelColor:{conditions:Q("olcs_fontColor",!0)},labelOutlineWidth:{conditions:Q("olcs_fontOutlineWidth")},labelOutlineColor:{conditions:Q("olcs_fontOutlineColor",!0)},verticalOrigin:"1",horizontalOrigin:"0",labelHorizontalOrigin:"0",labelVerticalOrigin:"1"}});function Pa(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 Oh(i,e={}){return i instanceof q?e.style=Pa(i.toJSON(),e.embeddedIcons):i instanceof Me&&(e.style=i.toJSON()),e}function Ea(){return Pe("VectorProperties")}const hi={clampToGround:Xe.CLAMP_TO_GROUND,absolute:Xe.NONE,relativeToGround:Xe.RELATIVE_TO_GROUND},ci={both:Pi.BOTH,cesium3DTile:Pi.CESIUM_3D_TILE,terrain:Pi.TERRAIN};function Yr(i,e){if(Array.isArray(i)){const t=i.map(s=>E(s,null)).filter(s=>s!=null);if(t.length===4)return new Ss(t[0],t[1],t[2],t[3])}return e}function Zr(i,e){if(Array.isArray(i)){const t=i.map(s=>E(s,null)).filter(s=>s!=null);if(t.length===3)return new C(t[0],t[1],t[2])}return e}function ui(i,e){if(Array.isArray(i))return i.map(t=>E(t,null)).filter(t=>t!==null&&t>0);{const t=E(i,null);if(t&&t>0)return[t]}return Array.isArray(e)?e:[e]}function Bs(i){return Object.keys(hi).find(e=>hi[e]===i)}function Jr(i){return Object.keys(ci).find(e=>ci[e]===i)}function Kr(i){return i?Ss.pack(i,[]):void 0}function Qr(i){return i?C.pack(i,[]):void 0}class et{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=et.getDefaultOptions();this._altitudeMode=zt(e.altitudeMode,hi,Xe.CLAMP_TO_GROUND),this._allowPicking=re(e.allowPicking,t.allowPicking),this._classificationType=zt(e.classificationType,ci,void 0),this._scaleByDistance=Yr(e.scaleByDistance,void 0),this._eyeOffset=Zr(e.eyeOffset,void 0),this._heightAboveGround=E(e.heightAboveGround,t.heightAboveGround),this._skirt=E(e.skirt,t.skirt),this._groundLevel=E(e.groundLevel,t.groundLevel),this._extrudedHeight=E(e.extrudedHeight,t.extrudedHeight),this._storeysAboveGround=V(e.storeysAboveGround,t.storeysAboveGround),this._storeysBelowGround=V(e.storeysBelowGround,t.storeysBelowGround),this._storeyHeightsAboveGround=ui(e.storeyHeightsAboveGround,t.storeyHeightsAboveGround),this._storeyHeightsBelowGround=ui(e.storeyHeightsBelowGround,t.storeyHeightsBelowGround),this._storeyHeight=E(e.storeyHeight,t.storeyHeight),this._modelUrl=e.modelUrl||t.modelUrl,this._modelScaleX=E(e.modelScaleX,t.modelScaleX),this._modelScaleY=E(e.modelScaleY,t.modelScaleY),this._modelScaleZ=E(e.modelScaleZ,t.modelScaleZ),this._modelHeading=E(e.modelHeading,t.modelHeading),this._modelPitch=E(e.modelPitch,t.modelPitch),this._modelRoll=E(e.modelRoll,t.modelRoll),this._baseUrl=e.baseUrl||t.baseUrl,this._modelOptions=e.modelOptions||t.modelOptions,this.propertyChanged=new R}get altitudeMode(){return this._altitudeMode}set altitudeMode(e){e!==this._altitudeMode&&(_(e,Object.values(Xe)),this._altitudeMode=e,this.propertyChanged.raiseEvent(["altitudeMode"]))}getAltitudeMode(e){const t=e.get("olcs_altitudeMode");return zt(t,hi,this._altitudeMode)}get allowPicking(){return this._allowPicking}set allowPicking(e){e!==this._allowPicking&&(_(e,Boolean),this._allowPicking=e,this.propertyChanged.raiseEvent(["allowPicking"]))}getAllowPicking(e){const t=e.get("olcs_allowPicking");return re(t,this._allowPicking)}get classificationType(){return this._classificationType}set classificationType(e){e!==this._classificationType&&(ie(e,Object.values(Pi)),this._classificationType=e,this.propertyChanged.raiseEvent(["classificationType"]))}getClassificationType(e){const t=e.get("olcs_classificationType");return zt(t,ci,this.classificationType)}get scaleByDistance(){return this._scaleByDistance}set scaleByDistance(e){Ss.equals(e,this._scaleByDistance)||(ie(e,Ss),this._scaleByDistance=e,this.propertyChanged.raiseEvent(["scaleByDistance"]))}getScaleByDistance(e){const t=e.get("olcs_scaleByDistance");return Yr(t,this.scaleByDistance)}get eyeOffset(){return this._eyeOffset}set eyeOffset(e){C.equals(this.eyeOffset,e)||(ie(e,C),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 Ea().deprecate("zCoordinateEyeOffset","use eyeOffset and provide [0,0,value]"),new C(0,0,E(s,0))}return Zr(t,this.eyeOffset)}get heightAboveGround(){return this._heightAboveGround}set heightAboveGround(e){e!==this._heightAboveGround&&(_(e,Number),this._heightAboveGround=e,this.propertyChanged.raiseEvent(["heightAboveGround"]))}getHeightAboveGround(e){const t=e.get("olcs_heightAboveGround");return E(t,this.heightAboveGround)}get skirt(){return this._skirt}set skirt(e){e!==this._skirt&&(_(e,Number),this._skirt=e,this.propertyChanged.raiseEvent(["skirt"]))}getSkirt(e){const t=e.get("olcs_skirt");return E(t,this.skirt)}get groundLevel(){return this._groundLevel}set groundLevel(e){e!==this._groundLevel&&(ie(e,Number),this._groundLevel=e,this.propertyChanged.raiseEvent(["groundLevel"]))}getGroundLevel(e){const t=e.get("olcs_groundLevel");return E(t,this.groundLevel)}get extrudedHeight(){return this._extrudedHeight}set extrudedHeight(e){e!==this._extrudedHeight&&(_(e,Number),this._extrudedHeight=e,this.propertyChanged.raiseEvent(["extrudedHeight"]))}getExtrudedHeight(e){const t=e.get("olcs_extrudedHeight");return E(t,this.extrudedHeight)}get storeysAboveGround(){return this._storeysAboveGround}set storeysAboveGround(e){e!==this._storeysAboveGround&&(_(e,Number),this._storeysAboveGround=Math.trunc(e),this.propertyChanged.raiseEvent(["storeysAboveGround"]))}getStoreysAboveGround(e){const t=e.get("olcs_storeysAboveGround");return V(t,this.storeysAboveGround)}get storeysBelowGround(){return this._storeysBelowGround}set storeysBelowGround(e){e!==this._storeysBelowGround&&(_(e,Number),this._storeysBelowGround=Math.trunc(e),this.propertyChanged.raiseEvent(["storeysBelowGround"]))}getStoreysBelowGround(e){const t=e.get("olcs_storeysBelowGround");return V(t,this.storeysBelowGround)}get storeyHeightsAboveGround(){return this._storeyHeightsAboveGround.slice()}set storeyHeightsAboveGround(e){Ot(e,this._storeyHeightsAboveGround)||(_(e,[Number]),this._storeyHeightsAboveGround=e,this.propertyChanged.raiseEvent(["storeyHeightsAboveGround"]))}getStoreyHeightsAboveGround(e){const t=e.get("olcs_storeyHeightsAboveGround");return ui(t,this.storeyHeightsAboveGround)}get storeyHeightsBelowGround(){return this._storeyHeightsBelowGround.slice()}set storeyHeightsBelowGround(e){Ot(e,this._storeyHeightsBelowGround)||(_(e,[Number]),this._storeyHeightsBelowGround=e,this.propertyChanged.raiseEvent(["storeyHeightsBelowGround"]))}getStoreyHeightsBelowGround(e){const t=e.get("olcs_storeyHeightsBelowGround");return ui(t,this.storeyHeightsBelowGround)}get storeyHeight(){return this._storeyHeight}set storeyHeight(e){e!==this._storeyHeight&&(Ea().deprecate("storeyHeight","use storeyHeightAboveGround"),_(e,Number),this._storeyHeight=e,this.propertyChanged.raiseEvent(["storeyHeight"]))}get modelUrl(){return this._modelUrl}set modelUrl(e){_(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){_(e,Number),this._modelScaleX!==e&&(this._modelScaleX=e,this.propertyChanged.raiseEvent(["modelScaleX"]))}getModelScaleX(e){const t=e.get("olcs_modelScaleX");return E(t,this.modelScaleX)}get modelScaleY(){return this._modelScaleY}set modelScaleY(e){_(e,Number),this._modelScaleY!==e&&(this._modelScaleY=e,this.propertyChanged.raiseEvent(["modelScaleY"]))}getModelScaleY(e){const t=e.get("olcs_modelScaleY");return E(t,this.modelScaleY)}get modelScaleZ(){return this._modelScaleZ}set modelScaleZ(e){_(e,Number),this._modelScaleZ!==e&&(this._modelScaleZ=e,this.propertyChanged.raiseEvent(["modelScaleZ"]))}getModelScaleZ(e){const t=e.get("olcs_modelScaleZ");return E(t,this.modelScaleZ)}get modelHeading(){return this._modelHeading}set modelHeading(e){_(e,Number),this._modelHeading!==e&&(this._modelHeading=e,this.propertyChanged.raiseEvent(["modelHeading"]))}getModelHeading(e){const t=e.get("olcs_modelHeading");return E(t,this.modelHeading)}get modelPitch(){return this._modelPitch}set modelPitch(e){_(e,Number),this._modelPitch!==e&&(this._modelPitch=e,this.propertyChanged.raiseEvent(["modelPitch"]))}getModelPitch(e){const t=e.get("olcs_modelPitch");return E(t,this.modelPitch)}get modelRoll(){return this._modelRoll}set modelRoll(e){_(e,Number),this._modelRoll!==e&&(this._modelRoll=e,this.propertyChanged.raiseEvent(["modelRoll"]))}getModelRoll(e){const t=e.get("olcs_modelRoll");return E(t,this.modelRoll)}get modelOptions(){return this._modelOptions}set modelOptions(e){ie(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){_(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=et.getDefaultOptions();e.altitudeMode||(e.altitudeMode=Bs(this.altitudeMode)),Object.assign(t,e),this.setValues(t)}setValues(e){const t=et.getDefaultOptions(),s=[];if("altitudeMode"in e){const r=zt(t.altitudeMode,hi,void 0),n=zt(e.altitudeMode,hi,r);this._altitudeMode!==n&&(this._altitudeMode=n,s.push("altitudeMode"))}if("allowPicking"in e){const r=re(e.allowPicking,t.allowPicking);this._allowPicking!==r&&(this._allowPicking=r,s.push("allowPicking"))}if("classificationType"in e){const r=zt(t.classificationType,ci,void 0),n=zt(e.classificationType,ci,r);this._classificationType!==n&&(this._classificationType=n,s.push("classificationType"))}if("scaleByDistance"in e){const r=Yr(e.scaleByDistance,void 0);Ss.equals(r,this._scaleByDistance)||(this._scaleByDistance=r,s.push("scaleByDistance"))}if("eyeOffset"in e){const r=Zr(e.eyeOffset,void 0);C.equals(r,this._eyeOffset)||(this._eyeOffset=r,s.push("eyeOffset"))}if("heightAboveGround"in e){const r=E(e.heightAboveGround,t.heightAboveGround);r!==this._heightAboveGround&&(this._heightAboveGround=r,s.push("heightAboveGround"))}if("skirt"in e){const r=E(e.skirt,t.skirt);r!==this._skirt&&(this._skirt=r,s.push("skirt"))}if("groundLevel"in e){const r=E(e.groundLevel,t.groundLevel);r!==this._groundLevel&&(this._groundLevel=r,s.push("groundLevel"))}if("extrudedHeight"in e){const r=E(e.extrudedHeight,t.extrudedHeight);r!==this._extrudedHeight&&(this._extrudedHeight=r,s.push("extrudedHeight"))}if("storeysAboveGround"in e){const r=V(e.storeysAboveGround,t.storeysAboveGround);r!==this._storeysAboveGround&&(this._storeysAboveGround=r,s.push("storeysAboveGround"))}if("storeysBelowGround"in e){const r=V(e.storeysBelowGround,t.storeysBelowGround);r!==this._storeysBelowGround&&(this._storeysBelowGround=r,s.push("storeysBelowGround"))}if("storeyHeightsAboveGround"in e){const r=ui(e.storeyHeightsAboveGround,t.storeyHeightsAboveGround);Ot(r,this._storeyHeightsAboveGround)||(this._storeyHeightsAboveGround=r,s.push("storeyHeightsAboveGround"))}if("storeyHeightsBelowGround"in e){const r=ui(e.storeyHeightsBelowGround,t.storeyHeightsBelowGround);Ot(r,this._storeyHeightsBelowGround)||(this._storeyHeightsBelowGround=r,s.push("storeyHeightsBelowGround"))}if("storeyHeight"in e){const r=E(e.storeyHeight,t.storeyHeight);r!==this._storeyHeight&&(Ea().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=E(e.modelScaleX,t.modelScaleX);r!==this._modelScaleX&&(this._modelScaleX=r,s.push("modelScaleX"))}if("modelScaleY"in e){const r=E(e.modelScaleY,t.modelScaleY);r!==this._modelScaleY&&(this._modelScaleY=r,s.push("modelScaleY"))}if("modelScaleZ"in e){const r=E(e.modelScaleZ,t.modelScaleZ);r!==this._modelScaleZ&&(this._modelScaleZ=r,s.push("modelScaleZ"))}if("modelHeading"in e){const r=E(e.modelHeading,t.modelHeading);r!==this._modelHeading&&(this._modelHeading=r,s.push("modelHeading"))}if("modelPitch"in e){const r=E(e.modelPitch,t.modelPitch);r!==this._modelPitch&&(this._modelPitch=r,s.push("modelPitch"))}if("modelRoll"in e){const r=E(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:Bs(this.altitudeMode),allowPicking:this.allowPicking,classificationType:Jr(this.classificationType),scaleByDistance:Kr(this.scaleByDistance),eyeOffset:Qr(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||et.getDefaultOptions(),s={};return Bs(this.altitudeMode)!==t.altitudeMode&&(s.altitudeMode=Bs(this.altitudeMode)),this.allowPicking!==t.allowPicking&&(s.allowPicking=this.allowPicking),Jr(this.classificationType)!==t.classificationType&&(s.classificationType=Jr(this.classificationType)),Ot(Kr(this.scaleByDistance),t.scaleByDistance)||(s.scaleByDistance=Kr(this.scaleByDistance)),Ot(Qr(this.eyeOffset),t.eyeOffset)||(s.eyeOffset=Qr(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),Ot(this.storeyHeightsAboveGround,t.storeyHeightsAboveGround)||(s.storeyHeightsAboveGround=this.storeyHeightsAboveGround),Ot(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 Us(i,e){if(Xn(i,[nt,{type:String}])){if(i instanceof nt)return i;{const t=Gi.createFromTypeOptions(i);if(t)return t instanceof q&&e instanceof q?e.assign(t):t}}return e||bh.clone()}class vt extends he{static get className(){return"FeatureLayer"}static getDefaultOptions(){return O(v({},he.getDefaultOptions()),{style:void 0,balloonHeightOffset:10,genericFeatureProperties:{}})}constructor(e){super(e);const t=vt.getDefaultOptions();this._style=this.getStyleOrDefaultStyle(e.style),this._defaultStyle=this._style,this.styleChanged=new R,this._genericFeatureProperties=e.genericFeatureProperties||t.genericFeatureProperties,this.balloonHeightOffset=V(e.balloonHeightOffset,t.balloonHeightOffset),this.featureVisibility=e.featureVisibility||new qr}get defaultStyle(){return this._defaultStyle}get style(){return this._style}get genericFeatureProperties(){return this._genericFeatureProperties}getImplementationOptions(){return O(v({},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){_(e,Object),Object.assign(this._genericFeatureProperties,e)}getStyleOrDefaultStyle(e,t){return Us(e,t)}setStyle(e,t){_(e,[fe,nt,Function]),e instanceof nt?this._style=e:(this._style=new q({}),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=v({},this._genericFeatureProperties)),e}destroy(){this.featureVisibility&&this.featureVisibility.destroy(),this.styleChanged.destroy(),super.destroy()}}oe.registerClass(vt.className,vt);class Mi extends _t{static from(e,t){const s=new Mi(t);if(e)for(const r of e)s.add(r);return s}constructor(e){super(e),this.moved=new R,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 Ph{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()}}class Tt extends Mi{static from(e){const t=new Tt;if(e)for(const s of e)t.add(s);return t}constructor(){super(),this._layerEventListeners={},this._zIndexSymbol=Symbol("zIndex"),this.stateChanged=new R,this.exclusiveManager=new Ph,this._globalHider=new Wr,this._locale="en"}get zIndexSymbol(){return this._zIndexSymbol}get globalHider(){return this._globalHider}set globalHider(e){_(e,Wr),this._globalHider=e,this._array.forEach(t=>{t.setGlobalHider(this._globalHider)})}get locale(){return this._locale}set locale(e){_(e,String),this._locale!==e&&(this._locale=e,[...this].forEach(t=>{t.locale=this._locale}))}_listenToLayerEvents(e){const t=e.stateChanged.addEventListener(a=>{a===K.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 Je={INACTIVE:1,ACTIVE:2,LOADING:4},j0={};class Et extends rt{static get className(){return"VcsMap"}static get specificLayerImpl(){return j0}static getDefaultOptions(){return{fallbackMap:void 0}}constructor(e){super(e),this.mapElement=document.createElement("div"),this.mapElement.setAttribute("id",Ye()),this.mapElement.classList.add("mapElement"),this.mapElement.style.display="none",this._target=null,e.target&&this.setTarget(e.target),this._layerCollection=e.layerCollection||new Tt,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=Je.INACTIVE,this.stateChanged=new R,this.pointerInteractionEvent=new R,this.splitScreen=null}get active(){return this._state===Je.ACTIVE}get loading(){return this._state===Je.LOADING}get target(){return this._target}get layerCollection(){return this._layerCollection}set layerCollection(e){_(e,Tt),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){ie(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[z];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[z];this._visualizations.has(t)||this._visualizations.set(t,new Set),this._visualizations.get(t).add(e)}removeVisualization(e){const t=e[z],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===Je.INACTIVE){if(this._state=Je.LOADING,this.stateChanged.raiseEvent(Je.LOADING),this.mapElement.style.display="",await this.initialize(),this._state!==Je.LOADING||(this._state=Je.ACTIVE,await Promise.all([...this.layerCollection].map(e=>e.mapActivated(this))),this._state!==Je.ACTIVE))return;this.stateChanged.raiseEvent(this._state)}}deactivate(){this._state!==Je.INACTIVE&&(this.mapElement.style.display="none",this._state=Je.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}}ri.registerClass(Et.className,Et);let U=1;class ke{static get interactionTypeCounter(){return U}static getNextBit(e){return e<<1}}const le={NONE:U=ke.getNextBit(U),ALT:U=ke.getNextBit(U),CTRL:U=ke.getNextBit(U),SHIFT:U=ke.getNextBit(U),ALL:0};le.ALL=le.NONE|le.ALT|le.CTRL|le.SHIFT;const k={NONE:0,CLICK:U=ke.getNextBit(U),DBLCLICK:U=ke.getNextBit(U),DRAG:U=ke.getNextBit(U),DRAGSTART:U=ke.getNextBit(U),DRAGEND:U=ke.getNextBit(U),MOVE:U=ke.getNextBit(U),DRAGEVENTS:0,CLICKMOVE:0,ALL:0};k.DRAGEVENTS=k.DRAG|k.DRAGEND|k.DRAGSTART,k.CLICKMOVE=k.CLICK|k.MOVE,k.ALL=Object.values(k).reduce((i,e)=>i|e,0);const me={LEFT:U=ke.getNextBit(U),RIGHT:U=ke.getNextBit(U),MIDDLE:U=ke.getNextBit(U),ALL:0};me.ALL=me.LEFT|me.RIGHT|me.MIDDLE;const ze={DOWN:1,UP:2,MOVE:3};function Eh(i,e,t){const s=t.indexOfKey(e[z]);if(s>-1){const r=i.getArray();if(!r.includes(e)){let n=r.findIndex(a=>t.indexOfKey(a[z])>s);n===-1&&(n=r.length),i.insertAt(n,e)}}}class qs extends Et{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":me.ALL,0:me.LEFT,1:me.MIDDLE,2:me.RIGHT};let r=e.originalEvent.shiftKey?le.SHIFT:le.NONE;r=e.originalEvent.ctrlKey?le.CTRL:r,r=e.originalEvent.altKey?le.ALT:r,r!==le.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:$e.fromArray(e.pixel,0,new $e),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 cd({layers:[],controls:[],interactions:ud({altShiftDragRotate:!1,pinchRotate:!1,shiftDragZoom:!1,doubleClickZoom:!1}),target:this.mapElement});const e=this.olMap.on("pointerdown",r=>{this._raisePointerInteraction(r,ze.DOWN)}),t=this.olMap.on("pointerup",r=>{this._raisePointerInteraction(r,ze.UP)}),s=this.olMap.on("pointermove",r=>{this._raisePointerInteraction(r,ze.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),Eh(r,s,this.layerCollection)})}addOLLayer(e){this.validateVisualization(e)&&(this.addVisualization(e),Eh(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),ye(this._olListeners),super.destroy()}}ri.registerClass(qs.className,qs);class ee extends qs{static get className(){return"OpenlayersMap"}static getDefaultOptions(){return O(v({},Et.getDefaultOptions()),{fixedNorthOrientation:!0})}constructor(e){super(e);const t=ee.getDefaultOptions();this.fixedNorthOrientation=re(e.fixedNorthOrientation,t.fixedNorthOrientation)}async initialize(){this.initialized||(await super.initialize(),this.olMap.setView(new On({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=de(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,M=-90;return new ot({groundPosition:y,pitch:M,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=de("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(M=>{t.animate({duration:e.duration?e.duration*1e3:100,center:a,easing:dd,resolution:p,rotation:y},()=>{M()})})}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=de(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 Ro(_s(o),e[0],e[1])}toJSON(){const e=super.toJSON(),t=ee.getDefaultOptions();return this.fixedNorthOrientation!==t.fixedNorthOrientation&&(e.fixedNorthOrientation=this.fixedNorthOrientation),e}}ri.registerClass(ee.className,ee);class Ut extends rt{static get className(){return"LayerImplementation"}constructor(e,t){super(t),this.map=e,this.url=t.url,this._state=K.INACTIVE,this._initialized=!1}get initialized(){return this._initialized}get active(){return this._state===K.ACTIVE}get loading(){return this._state===K.LOADING}async initialize(){this._initialized=!0}async activate(){this.map.active&&!this.active&&(this._state=K.LOADING,await this.initialize(),this.loading&&(this._state=K.ACTIVE))}deactivate(){this._state=K.INACTIVE}destroy(){this._initialized=!1,this._state=K.INACTIVE,this.map=null,super.destroy()}}class Ws extends Ut{static get className(){return"LayerOpenlayersImpl"}constructor(e,t){super(e,t),this.olLayer=null}initialize(){return this.initialized||(this.olLayer=this.getOLLayer(),this.olLayer[z]=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 Ih(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=Oi.fromType("Wallpaper",{image:n,anchor:Ud.wgs84ToDrawingBufferCoordinates(i,C.fromDegreesArray(Pn(t.getGeometry().getExtent()))[0])})}else{const n=ai(r,[0,0,0,1]);s.material=Oi.fromType("Color",{color:n}),s.translucent=n.alpha!==1}return new qd(s)}function Lh(i,e,t,s){const r=e.map(o=>new _r({geometry:o,attributes:{color:Yo.fromColor(t)}})),n=new An({flat:!1,renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:t.alpha!==1}),a=O(v({},i),{geometryInstances:r,appearance:n,shadows:Ms.ENABLED,classificationType:s});return new Zo(a)}function Th(i,e,t,s,r,n,a){const o=e.getClassificationType(s),l={shadows:Ms.ENABLED,allowPicking:t};let h;if(o!==void 0&&!a){if(!Zo.isSupported(i))return null;const c=ai(n.getFill().getColor(),[0,0,0,1]);h=Lh(l,r,c,o)}else{const c=r.map(d=>new _r({geometry:d}));l.geometryInstances=c;const u=Ih(i,n.getFill(),s);if(l.appearance=u,a){if(!Jo.isSupported(i))return null;l.classificationType=o||Pi.TERRAIN,h=new Jo(l)}else h=new Gn(l)}return h}function Nh(i,e,t,s,r,n){const a=ai(n.getStroke().getColor(),[0,0,0,1]),o=r.map(u=>new _r({geometry:u,attributes:{color:Yo.fromColor(a)}})),l=new An({flat:!0,renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:a.alpha!==1}),h={geometryInstances:o,appearance:l,shadows:Ms.ENABLED,allowPicking:t};return new Gn(h)}function Ia(i,e,t,s,r,n,a){const o=e.getClassificationType(s),l=r.map(g=>new _r({geometry:g})),h=ai(n.getStroke().getColor(),[0,0,0,1]);let c;n.getStroke().getLineDash()?c=Oi.fromType("Stripe",{horizontal:!1,repeat:500,evenColor:h,oddColor:new Oe(0,0,0,0)}):c=Oi.fromType("Color",{color:h});const u=new Wd({renderState:{depthTest:{enabled:!0},lineWidth:1},translucent:h.alpha!==1,material:c}),d={geometryInstances:l,appearance:u,shadows:Ms.ENABLED,allowPicking:t};let f;if(a){if(!Ko.isSupported(i))return null;d.classificationType=o||Pi.TERRAIN,f=new Ko(d)}else f=new Gn(d);return f}function Dh(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 La(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 Ta(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 Fh(i,e,t){return e===Xe.RELATIVE_TO_GROUND?t.getHeightAboveGround(i):0}function en(i,e,t){const s=e.getExtrudedHeight(i),r=Math.abs(V(i.get("olcs_storeyNumber"),0)),n=Math.abs(E(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 M=Math.abs(s/r);l=new Array(r).fill(M)}else if(s&&s<0&&r){o=r;const M=Math.abs(s/r);h=new Array(r).fill(M)}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=La(s,l,a),a=l.length,h=[],o=0):s<0&&(h=La(s,h,o),o=h.length,l=[],a=0))),Ta(a,l),Ta(o,h);const c=e.getSkirt(i),u=e.getGroundLevel(i),d=e.getAltitudeMode(i),f=Fh(i,d,e),g=Dh(u,t)+f,m=!!t.find(M=>M[2]),p=!!(l.length||h.length||c),y=m&&(!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 Na(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 tn(i,e,t,s,r,n,a){if(!t.length)return;const o=[],l=[],h=[],c=en(i,s,n.getCoordinates(t)),u=!!e.getFill(),d=!!e.getStroke();let f=!1;t.forEach(p=>{const y=n.getGeometryOptions(p,c.heightAboveGroundAdjustment),M=Na(c.storeyHeightsAboveGround,c.groundLevel);if(Na(c.storeyHeightsBelowGround,c.groundLevel,!0,M),u&&M.forEach(b=>{o.push(...n.createSolidGeometries(y,b.currentHeight,c.perPositionHeight,b.extrudedHeight))}),d&&M.forEach(b=>{l.push(...n.createOutlineGeometries(y,b.currentHeight,c.perPositionHeight,b.extrudedHeight))}),c.skirt){const b=c.groundLevel-c.storeyHeightsBelowGround.reduce((D,X)=>D+X,0),I=b-c.skirt,L=c.storeyHeightsBelowGround.length?!1:c.perPositionHeight;u&&o.push(...n.createSolidGeometries(y,b,L,I)),d&&l.push(...n.createOutlineGeometries(y,b,L,I))}c.extruded||(c.heightReference===Xe.CLAMP_TO_GROUND&&(f=!0),u&&o.push(...n.createFillGeometries(y,c.groundLevel,c.perPositionHeight)),d&&(c.heightReference===Xe.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=Ia(r,s,g,i,h,e,f);p&&m.push(p)}if(o.length){const p=Th(r,s,g,i,o,e,f);p&&m.push(p)}if(l.length){const p=Nh(r,s,g,i,l,e);p&&m.push(p)}a.addPrimitives(m,i,g)}var qe={XY:"XY",XYZ:"XYZ",XYM:"XYM",XYZM:"XYZM"},Da={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};class H0{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var Rh=H0,$0={PROPERTYCHANGE:"propertychange"};class V0{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var B0=V0;function U0(i,e){return i>e?1:i<e?-1:0}function q0(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 W0(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 Ah(){}function X0(i){let e=!1,t,s,r;return function(){const n=Array.prototype.slice.call(arguments);return(!e||this!==r||!W0(n,s))&&(e=!0,r=this,s=n,t=i.apply(this,arguments)),t}}const Gh=typeof Object.assign=="function"?Object.assign:function(i,e){if(i==null)throw new TypeError("Cannot convert undefined or null to object");const t=Object(i);for(let s=1,r=arguments.length;s<r;++s){const n=arguments[s];if(n!=null)for(const a in n)n.hasOwnProperty(a)&&(t[a]=n[a])}return t};function kh(i){for(const e in i)delete i[e]}function Y0(i){let e;for(e in i)return!1;return!e}class Z0 extends B0{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.indexOf(t)===-1&&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 Rh(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,Ah);delete a[s]}return l}disposeInternal(){this.listeners_&&kh(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]=Ah,++this.pendingRemovals_[e]):(s.splice(r,1),s.length===0&&delete this.listeners_[e]))}}}var J0=Z0,K0={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 Fa(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 zh(i,e,t,s){return Fa(i,e,t,s,!0)}function jh(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),kh(i))}class sn extends J0{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(K0.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]=Fa(this,e[n],t);return r}else return Fa(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]=zh(this,e[n],t)}else s=zh(this,e,t);return t.ol_key=s,s}unInternal(e,t){const s=t.ol_key;if(s)Q0(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)}}sn.prototype.on,sn.prototype.once,sn.prototype.un;function Q0(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)jh(i[e]);else jh(i)}var e_=sn;function Ke(){return function(){throw new Error("Unimplemented abstract method.")}()}let t_=0;function i_(i){return i.ol_uid||(i.ol_uid=String(++t_))}class Hh extends Rh{constructor(e,t,s){super(e),this.key=t,this.oldValue=s}}class s_ extends e_{constructor(e){super(),this.on,this.once,this.un,i_(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_&&Gh({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let s;s=`change:${e}`,this.hasListener(s)&&this.dispatchEvent(new Hh(s,e,t)),s=$0.PROPERTYCHANGE,this.hasListener(s)&&this.dispatchEvent(new Hh(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_||Gh(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],Y0(this.values_)&&(this.values_=null),t||this.notify(e,s)}}}var r_=s_;const zi={RADIANS:"radians",DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},ji={};ji[zi.RADIANS]=6370997/(2*Math.PI),ji[zi.DEGREES]=2*Math.PI*6370997/360,ji[zi.FEET]=.3048,ji[zi.METERS]=1,ji[zi.USFEET]=1200/3937;var Ra=zi;new Array(6);function n_(){return[1,0,0,1,0,0]}function a_(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 Se={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function $h(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 o_(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function l_(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Vh(i,e){const t=i[0],s=i[1],r=i[2],n=i[3],a=e[0],o=e[1];let l=Se.UNKNOWN;return a<t?l=l|Se.LEFT:a>r&&(l=l|Se.RIGHT),o<s?l=l|Se.BELOW:o>n&&(l=l|Se.ABOVE),l===Se.UNKNOWN&&(l=Se.INTERSECTING),l}function Bh(){return[1/0,1/0,-1/0,-1/0]}function Uh(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 qh(i){return Uh(1/0,1/0,-1/0,-1/0,i)}function h_(i,e){const t=i[0],s=i[1];return Uh(t,s,t,s,e)}function c_(i,e,t,s,r){const n=qh(r);return Wh(n,i,e,t,s)}function Wh(i,e,t,s,r){for(;t<s;t+=r)u_(i,e[t],e[t+1]);return i}function u_(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 d_(i,e){let t;return t=e(f_(i)),t||(t=e(g_(i)),t)||(t=e(p_(i)),t)||(t=e(m_(i)),t)?t:!1}function f_(i){return[i[0],i[1]]}function g_(i){return[i[2],i[1]]}function Xh(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function Yh(i){return i[3]-i[1]}function m_(i){return[i[0],i[3]]}function p_(i){return[i[2],i[3]]}function y_(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function __(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function v_(i,e,t){let s=!1;const r=Vh(i,e),n=Vh(i,t);if(r===Se.INTERSECTING||n===Se.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&Se.ABOVE)&&!(r&Se.ABOVE)&&(m=d-(f-h)/g,s=m>=a&&m<=l),!s&&!!(n&Se.RIGHT)&&!(r&Se.RIGHT)&&(p=f-(d-l)*g,s=p>=o&&p<=h),!s&&!!(n&Se.BELOW)&&!(r&Se.BELOW)&&(m=d-(f-o)/g,s=m>=a&&m<=l),!s&&!!(n&Se.LEFT)&&!(r&Se.LEFT)&&(p=f-(d-a)*g,s=p>=o&&p<=h)}return s}class S_{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_||ji[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 Zh=S_;const M_=function(){let i;return"cosh"in Math?i=Math.cosh:i=function(e){const t=Math.exp(e);return(t+1/t)/2},i}();function C_(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 Hi(i,e,t,s)}function Hi(i,e,t,s){const r=t-i,n=s-e;return r*r+n*n}function x_(i,e){const t=i%e;return t*e<0?t+e:t}function w_(i,e,t){return i+t*(e-i)}const Xs=6378137,$i=Math.PI*Xs,b_=[-$i,-$i,$i,$i],O_=[-180,-85,180,85],rn=Xs*Math.log(Math.tan(Math.PI/2));class Vi extends Zh{constructor(e){super({code:e,units:Ra.METERS,extent:b_,global:!0,worldExtent:O_,getPointResolution:function(t,s){return t/M_(s[1]/Xs)}})}}const Jh=[new Vi("EPSG:3857"),new Vi("EPSG:102100"),new Vi("EPSG:102113"),new Vi("EPSG:900913"),new Vi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Vi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function P_(i,e,t){const s=i.length,r=t>1?t:2;let n=e;n===void 0&&(r>2?n=i.slice():n=new Array(s));for(let a=0;a<s;a+=r){n[a]=$i*i[a]/180;let o=Xs*Math.log(Math.tan(Math.PI*(+i[a+1]+90)/360));o>rn?o=rn:o<-rn&&(o=-rn),n[a+1]=o}return n}function E_(i,e,t){const s=i.length,r=t>1?t:2;let n=e;n===void 0&&(r>2?n=i.slice():n=new Array(s));for(let a=0;a<s;a+=r)n[a]=180*i[a]/$i,n[a+1]=360*Math.atan(Math.exp(i[a+1]/Xs))/Math.PI-90;return n}const I_=6378137,Kh=[-180,-90,180,90],L_=Math.PI*I_/180;class di extends Zh{constructor(e,t){super({code:e,units:Ra.DEGREES,extent:Kh,axisOrientation:t,global:!0,metersPerUnit:L_,worldExtent:Kh})}}const Qh=[new di("CRS:84"),new di("EPSG:4326","neu"),new di("urn:ogc:def:crs:OGC:1.3:CRS84"),new di("urn:ogc:def:crs:OGC:2:84"),new di("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new di("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new di("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Aa={};function T_(i){return Aa[i]||Aa[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function N_(i,e){Aa[i]=e}let Bi={};function nn(i,e,t){const s=i.getCode(),r=e.getCode();s in Bi||(Bi[s]={}),Bi[s][r]=t}function D_(i,e){let t;return i in Bi&&e in Bi[i]&&(t=Bi[i][e]),t}function ec(i,e,t){let s;if(e!==void 0){for(let r=0,n=i.length;r<n;++r)e[r]=i[r];s=e}else s=i.slice();return s}function F_(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 R_(i){N_(i.getCode(),i),nn(i,i,ec)}function A_(i){i.forEach(R_)}function Ga(i){return typeof i=="string"?T_(i):i||null}function tc(i){A_(i),i.forEach(function(e){i.forEach(function(t){e!==t&&nn(e,t,ec)})})}function G_(i,e,t,s){i.forEach(function(r){e.forEach(function(n){nn(r,n,t),nn(n,r,s)})})}function k_(i,e){const t=i.getCode(),s=e.getCode();let r=D_(t,s);return r||(r=F_),r}function ic(i,e){const t=Ga(i),s=Ga(e);return k_(t,s)}function z_(){tc(Jh),tc(Qh),G_(Qh,Jh,P_,E_)}z_();function j_(i,e,t,s,r,n){const a=n||[];let o=0;for(let l=e;l<t;l+=s){const h=i[l],c=i[l+1];a[o++]=r[0]*h+r[2]*c+r[4],a[o++]=r[1]*h+r[3]*c+r[5]}return n&&a.length!=o&&(a.length=o),a}function H_(i,e,t,s,r,n,a){const o=a||[],l=Math.cos(r),h=Math.sin(r),c=n[0],u=n[1];let d=0;for(let f=e;f<t;f+=s){const g=i[f]-c,m=i[f+1]-u;o[d++]=c+g*l-m*h,o[d++]=u+g*h+m*l;for(let p=f+2;p<f+s;++p)o[d++]=i[p]}return a&&o.length!=d&&(o.length=d),o}function $_(i,e,t,s,r,n,a,o){const l=o||[],h=a[0],c=a[1];let u=0;for(let d=e;d<t;d+=s){const f=i[d]-h,g=i[d+1]-c;l[u++]=h+r*f,l[u++]=c+n*g;for(let m=d+2;m<d+s;++m)l[u++]=i[m]}return o&&l.length!=u&&(l.length=u),l}function V_(i,e,t,s,r,n,a){const o=a||[];let l=0;for(let h=e;h<t;h+=s){o[l++]=i[h]+r,o[l++]=i[h+1]+n;for(let c=h+2;c<h+s;++c)o[l++]=i[c]}return a&&o.length!=l&&(o.length=l),o}const sc=n_();class B_ extends r_{constructor(){super(),this.extent_=Bh(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=X0(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 Ke()}closestPointXY(e,t,s,r){return Ke()}containsXY(e,t){const s=this.getClosestPoint([e,t]);return s[0]===e&&s[1]===t}getClosestPoint(e,t){const s=t||[NaN,NaN];return this.closestPointXY(e[0],e[1],s,1/0),s}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return Ke()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&qh(t),this.extentRevision_=this.getRevision()}return __(this.extent_,e)}rotate(e,t){Ke()}scale(e,t,s){Ke()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Ke()}getType(){return Ke()}applyTransform(e){Ke()}intersectsExtent(e){return Ke()}translate(e,t){Ke()}transform(e,t){const s=Ga(e),r=s.getUnits()==Ra.TILE_PIXELS?function(n,a,o){const l=s.getExtent(),h=s.getWorldExtent(),c=Yh(h)/Yh(l);return a_(sc,h[0],h[3],c,-c,0,0,0),j_(n,0,n.length,o,sc,a),ic(s,t)(n,a,o)}:ic(s,t);return this.applyTransform(r),this}}var U_=B_;class q_ extends U_{constructor(){super(),this.layout=qe.XY,this.stride=2,this.flatCoordinates=null}computeExtent(e){return c_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Ke()}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=rc(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Ke()}setLayout(e,t,s){let r;if(e)r=rc(e);else{for(let n=0;n<s;++n)if(t.length===0){this.layout=qe.XY,this.stride=2;return}else t=t[0];r=t.length,e=W_(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();H_(s,0,s.length,r,e,t,s),this.changed()}}scale(e,t,s){let r=t;r===void 0&&(r=e);let n=s;n||(n=Xh(this.getExtent()));const a=this.getFlatCoordinates();if(a){const o=this.getStride();$_(a,0,a.length,o,e,r,n,a),this.changed()}}translate(e,t){const s=this.getFlatCoordinates();if(s){const r=this.getStride();V_(s,0,s.length,r,e,t,s),this.changed()}}}function W_(i){let e;return i==2?e=qe.XY:i==3?e=qe.XYZ:i==4&&(e=qe.XYZM),e}function rc(i){let e;return i==qe.XY?e=2:i==qe.XYZ||i==qe.XYM?e=3:i==qe.XYZM&&(e=4),e}var ka=q_;function nc(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]=w_(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 ac(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=Hi(n,a,o,l);h>r&&(r=h),n=o,a=l}return r}function X_(i,e,t,s,r){for(let n=0,a=t.length;n<a;++n){const o=t[n];r=ac(i,e,o,s,r),e=o}return r}function oc(i,e,t,s,r,n,a,o,l,h,c){if(e==t)return h;let u,d;if(r===0)if(d=Hi(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;const f=c||[NaN,NaN];let g=e+s;for(;g<t;)if(nc(i,g-s,g,s,a,o,f),d=Hi(a,o,f[0],f[1]),d<h){for(h=d,u=0;u<s;++u)l[u]=f[u];l.length=s,g+=s}else g+=s*Math.max((Math.sqrt(d)-Math.sqrt(h))/r|0,1);if(n&&(nc(i,t-s,e,s,a,o,f),d=Hi(a,o,f[0],f[1]),d<h)){for(h=d,u=0;u<s;++u)l[u]=f[u];l.length=s}return h}function Y_(i,e,t,s,r,n,a,o,l,h,c){const u=c||[NaN,NaN];for(let d=0,f=t.length;d<f;++d){const g=t[d];h=oc(i,e,g,s,r,n,a,o,l,h,u),e=g}return h}function Z_(i,e,t,s){for(let r=0,n=t.length;r<n;++r)i[e++]=t[r];return e}function lc(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 J_(i,e,t,s,r){const n=r||[];let a=0;for(let o=0,l=t.length;o<l;++o){const h=lc(i,e,t[o],s);n[a++]=h,e=h}return n.length=a,n}function K_(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 M=d+s;M<u;M+=s){const b=i[M],I=i[M+1],L=C_(b,I,g,m,p,y);L>f&&(c=M,f=L)}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 Ui(i,e){return e*Math.round(i/e)}function Q_(i,e,t,s,r,n,a){if(e==t)return a;let o=Ui(i[e],r),l=Ui(i[e+1],r);e+=s,n[a++]=o,n[a++]=l;let h,c;do if(h=Ui(i[e],r),c=Ui(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=Ui(i[e],r),d=Ui(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 ev(i,e,t,s,r,n,a,o){for(let l=0,h=t.length;l<h;++l){const c=t[l];a=Q_(i,e,c,s,r,n,a),o.push(a),e=c}return a}function hc(i,e,t,s,r){const n=r!==void 0?r:[];let a=0;for(let o=e;o<t;o+=s)n[a++]=i.slice(o,o+s);return n.length=a,n}function tv(i,e,t,s,r){const n=r!==void 0?r:[];let a=0;for(let o=0,l=t.length;o<l;++o){const h=t[o];n[a++]=hc(i,e,h,s,n[a]),e=h}return n.length=a,n}function cc(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 iv(i,e,t,s){let r=0;for(let n=0,a=t.length;n<a;++n){const o=t[n];r+=cc(i,e,o,s),e=o}return r}class Sn extends ka{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 Sn(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,s,r){return r<$h(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ac(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,s,r))}getArea(){return cc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return hc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=K_(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Sn(t,qe.XY)}getType(){return Da.LINEAR_RING}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=lc(this.flatCoordinates,0,e,this.stride),this.changed()}}var uc=Sn;class To extends ka{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new To(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,s,r){const n=this.flatCoordinates,a=Hi(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 h_(this.flatCoordinates,e)}getType(){return Da.POINT}intersectsExtent(e){return l_(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Z_(this.flatCoordinates,0,e,this.stride),this.changed()}}var sv=To;function rv(i,e,t,s,r){return!d_(r,function(a){return!fi(i,e,t,s,a[0],a[1])})}function fi(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 dc(i,e,t,s,r,n){if(t.length===0||!fi(i,e,t[0],s,r,n))return!1;for(let a=1,o=t.length;a<o;++a)if(fi(i,t[a-1],t[a],s,r,n))return!1;return!0}function nv(i,e,t,s,r,n,a){let o,l,h,c,u,d,f;const g=r[n+1],m=[];for(let M=0,b=t.length;M<b;++M){const I=t[M];for(c=i[I-s],d=i[I-s+1],o=e;o<I;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(U0),c=m[0],o=1,l=m.length;o<l;++o){u=m[o];const M=Math.abs(u-c);M>y&&(h=(c+u)/2,dc(i,e,t,s,h,g)&&(p=h,y=M)),c=u}return isNaN(p)&&(p=r[n]),a?(a.push(p,g,y),a):[p,g,y]}function av(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 fc(i,e,t,s,r){const n=Wh(Bh(),i,e,t,s);return y_(r,n)?o_(r,n)||n[0]>=r[0]&&n[2]<=r[2]||n[1]>=r[1]&&n[3]<=r[3]?!0:av(i,e,t,s,function(a,o){return v_(r,a,o)}):!1}function ov(i,e,t,s,r){return!!(fc(i,e,t,s,r)||fi(i,e,t,s,r[0],r[1])||fi(i,e,t,s,r[0],r[3])||fi(i,e,t,s,r[2],r[1])||fi(i,e,t,s,r[2],r[3]))}function lv(i,e,t,s,r){if(!ov(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(rv(i,t[n-1],t[n],s,r)&&!fc(i,t[n-1],t[n],s,r))return!1;return!0}function hv(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 gc(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 cv(i,e,t,s,r){const n=r!==void 0?r:!1;for(let a=0,o=t.length;a<o;++a){const l=t[a],h=gc(i,e,l,s);if(a===0){if(n&&h||!n&&!h)return!1}else if(n&&!h||!n&&h)return!1;e=l}return!0}function mc(i,e,t,s,r){const n=r!==void 0?r:!1;for(let a=0,o=t.length;a<o;++a){const l=t[a],h=gc(i,e,l,s);(a===0?n&&h||!n&&!h:n&&!h||!n&&h)&&hv(i,e,l,s),e=l}return e}class rs extends ka{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?q0(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new rs(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,s,r){return r<$h(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(X_(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Y_(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,s,r))}containsXY(e,t){return dc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return iv(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),mc(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,tv(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=Xh(this.getExtent());this.flatInteriorPoint_=nv(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new sv(this.getFlatInteriorPoint(),qe.XYM)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new uc(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 uc(t.slice(n,l),e);r.push(h),n=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;cv(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=mc(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],s=[];return t.length=ev(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,s),new rs(t,qe.XY,s)}getType(){return Da.POLYGON}intersectsExtent(e){return lv(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const s=J_(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=s.length===0?0:s[s.length-1],this.changed()}}var an=rs;function uv(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 rs(n,qe.XY,[n.length])}function dv(i,e,t){const s=e||32,r=i.getStride(),n=i.getLayout(),a=i.getCenter(),o=r*(s+1),l=new Array(o);for(let u=0;u<o;u+=r){l[u]=0,l[u+1]=0;for(let d=2;d<r;d++)l[u+d]=a[d]}const h=[l.length],c=new rs(l,n,h);return fv(c,a,i.getRadius(),t),c}function fv(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+x_(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 za(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 qi(i,e){const t=e||i.getCoordinates();let s=null;return i instanceof wi?s=[t]:i instanceof En?s=t:i instanceof an?s=t.reduce((r,n)=>r.concat(n)):i instanceof Ao?s=t:i instanceof Go?s=t.reduce((r,n)=>r.concat(n)):i instanceof fr?s=t.reduce((r,n)=>r.concat(n)).reduce((r,n)=>r.concat(n)):i instanceof lt?s=t:i instanceof ms&&(s=i.getGeometries().map((r,n)=>qi(r,t[n])).reduce((r,n)=>r.concat(n))),s}function ja(i,e){const t=gr(T.mercatorToWgs84(i),e,Math.PI/2),s=T.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 lt(i,l,"XYZ")}function Ha(i){return i instanceof lt?dv(i):(i instanceof an&&i.unset("_vcsGeomType"),i)}function on(i){const[e,t]=i[i.length-1];i[0][0]===e&&i[0][1]===t||i.push(i[0].slice())}function $a(i){const[e,t]=i[i.length-1];i[0][0]===e&&i[0][1]===t&&i.pop()}function Va(i){if(i instanceof an){const e=i.getCoordinates();e.forEach(t=>{$a(t)}),i.setCoordinates(e)}else if(i instanceof fr){const e=i.getCoordinates();e.forEach(t=>{t.forEach(s=>{$a(s)})}),i.setCoordinates(e)}}function gv(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 pc(i){return gv(i)<0&&i.reverse(),i}class Ft{static fromArray(e){return _(e,[Number]),_(e.length,6),new Ft(e[0],e[1],e[2],e[3],e[4],e[5])}static fromGeometry(e){const t=new Ft;return t.extendWithGeometry(e),t}static fromHeightInfo(e){const t=new Ft;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()===Rt.GEOMETRY_COLLECTION)e.getGeometriesArray().forEach(t=>{this.extendWithGeometry(t)});else if(e.getType()===Rt.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 gi=Symbol("FVlastUpdated"),Wi=Symbol("GlobalHiderLastUpdated");function yc(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[gi]=Date.now()}function _c(i,e){Object.keys(i.hiddenObjects).forEach(t=>{const s=e.getFeatureById(t);s&&!i.hasFeature(t,s)&&i.addFeature(t,s)}),e[Wi]=Date.now()}function ln(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[gi]=a,e[Wi]=a});return(!e[gi]||e[gi]<i.lastUpdated)&&yc(i,e),(!e[Wi]||e[Wi]<i.lastUpdated)&&_c(t,e),[i.changed.addEventListener(({action:r,ids:n})=>{r===W.HIGHLIGHT?(n.forEach(a=>{const o=e.getFeatureById(a);o&&i.addHighlightFeature(a,o)}),e[gi]=Date.now()):r===W.HIDE&&(n.forEach(a=>{const o=e.getFeatureById(a);o&&i.addHiddenFeature(a,o)}),e[gi]=Date.now())}),t.changed.addEventListener(({action:r,ids:n})=>{r===W.HIDE&&(n.forEach(a=>{const o=e.getFeatureById(a);o&&t.addFeature(a,o)}),e[Wi]=Date.now())}),()=>{ye(s)}]}function Ba(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=T.wgs84ToMercator([s.longitude,s.latitude,s.height]);if(a&&!a.intersectsCoordinate(c)){const u=a.getClosestPoint(c);[n,r]=T.mercatorToWgs84(u),l=!0}if(l){const u=qi(a),d=en(i,e.vectorProperties,u);if(d.perPositionHeight||d.extruded){const f=Ft.fromGeometry(a);f.extendWithHeightInfo(d),o=f.maxZ}!d.extruded&&(a.getType()===Rt.POINT||a.getType()===Rt.MULTI_POINT)&&(d.heightReference===Xe.RELATIVE_TO_GROUND||d.heightReference===Xe.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:v(v({},e.genericFeatureProperties),t),longitude:n,latitude:r,height:o+e.balloonHeightOffset,relativeToGround:h}}class Ua extends Ws{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 ko({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=ln(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 vc(i,e,t,s){const r=O(v({},i),{perPositionHeight:t,extrudedHeight:s});return t||(r.height=e),[new Xd(r)]}function mv(i,e,t,s){return[new Yd(O(v({},i),{height:t?void 0:e,extrudedHeight:s,perPositionHeight:t,vertexFormat:An.FLAT_VERTEX_FORMAT}))]}function pv(i,e,t){return vc(i,e,t,void 0)}function Sc(i,e){const t=E(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 yv(i,e){return Sc(i,e).map(t=>new kn(t))}function _v(i,e){return Sc(i,e).map(t=>new zn(t))}function vv(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=T.mercatorToWgs84(l);return h[2]!=null&&(h[2]+=e),C.fromDegrees(h[0],h[1],h[2])});C.equals(o[0],o[o.length-1])||o.push(o[0]),n===0?t=o:s.push(new Qo(o))}return{polygonHierarchy:new Qo(t,s)}}function Sv(i){const e=[];return i.forEach(t=>{e.push(...za(t))}),e}let qa=null;function Mv(){return qa||(qa={getCoordinates:Sv,getGeometryOptions:vv,createSolidGeometries:vc,createOutlineGeometries:mv,createFillGeometries:pv,createGroundLineGeometries:yv,createLineGeometries:_v}),qa}function Mc(i){if(i.getType()!==Rt.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 Wa(i,e,t,s,r,n){if(!e.getFill()&&!e.getStroke())return;const a=Mv(),o=t.filter(l=>Mc(l));tn(i,e,o,s,r,a,n)}function Cc(i,e,t,s){return[new Zd(O(v({},i),{height:e,granularity:.02,extrudedHeight:s}))]}function Cv(i,e,t,s){return[new Jd(O(v({},i),{height:e,extrudedHeight:s,granularity:.02}))]}function xv(i,e,t){return Cc(i,e,t,void 0)}function xc(i,e){const t=E(e.getStroke().getWidth(),1),{center:s,radius:r}=i,n=te.fromCartesian(s),a=[P.toDegrees(n.longitude),P.toDegrees(n.latitude)];return{positions:fd(a,r,40).getLinearRing(0).getCoordinates().map(c=>C.fromDegrees(c[0],c[1],n.height)),width:t}}function wv(i,e){const t=xc(i,e);return[new kn(t)]}function bv(i,e){const t=xc(i,e);return[new zn(t)]}function Ov(i,e){const t=i.getCenter(),s=t.slice();s[0]+=i.getRadius();const r=T.mercatorToWgs84(t,!0);r[2]!=null&&(r[2]+=e);const n=T.mercatorToWgs84(s,!0),a=C.fromDegrees(r[0],r[1],r[2]),o=C.fromDegrees(n[0],n[1],r[2]);return{radius:C.distance(a,o),center:a}}function Pv(i){return i.map(e=>e.getCenter())}let Xa=null;function Ev(){return Xa||(Xa={getCoordinates:Pv,getGeometryOptions:Ov,createSolidGeometries:Cc,createOutlineGeometries:Cv,createFillGeometries:xv,createGroundLineGeometries:wv,createLineGeometries:bv}),Xa}function wc(i){if(i.getType()!==Rt.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 bc(i,e,t,s,r,n){if(!e.getFill()&&!e.getStroke())return;const a=Ev(),o=t.filter(l=>wc(l));tn(i,e,o,s,r,a,n)}function Iv(i,e,t,s){return[Kd.fromConstantHeights(O(v({},i),{maximumHeight:t?void 0:e,minimumHeight:s}))]}function Lv(i,e,t,s){return[Qd.fromConstantHeights(O(v({},i),{maximumHeight:t?void 0:e,minimumHeight:s}))]}function Tv(i,e,t){return[]}function Nv(i,e){const t=E(e.getStroke().getWidth(),1);return[new kn(O(v({},i),{width:t}))]}function Oc(i,e){const t=E(e.getStroke().getWidth(),1);return[new zn(O(v({},i),{width:t}))]}function Dv(i,e){return{positions:i.getCoordinates().map(r=>{const n=T.mercatorToWgs84(r);return n[2]!=null&&(n[2]+=e),C.fromDegrees(n[0],n[1],n[2])})}}function Fv(i){const e=[];return i.forEach(t=>{e.push(...za(t))}),e}let Ya=null;function Rv(){return Ya||(Ya={getCoordinates:Fv,getGeometryOptions:Dv,createSolidGeometries:Iv,createOutlineGeometries:Lv,createFillGeometries:Tv,createGroundLineGeometries:Nv,createLineGeometries:Oc}),Ya}function Pc(i){if(i.getType()!==Rt.LINE_STRING)return!1;const e=i.getFlatCoordinates(),t=i.getStride()*2;return e&&e.length>=t?e.every(s=>Number.isFinite(s)):!1}function Za(i,e,t,s,r,n){if(!e.getFill()&&!e.getStroke())return;const a=Rv(),o=t.filter(l=>Pc(l));tn(i,e,o,s,r,a,n)}function Av(i){return i.map(e=>e.getCoordinates())}function Ec(i,e,t,s){const r=e.getImage();if(r){const n=new Oe(1,1,1,r.getOpacity());let a=null;r instanceof ys&&(r.load(),r.getImageState()===mr.LOADING&&(a=new Promise((l,h)=>{const c=()=>{r.getImageState()===mr.LOADED||r.getImageState()===mr.EMPTY?(l(r.getImage(1)),r.unlistenImageChange(c)):r.getImageState()===mr.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:Be.BOTTOM,id:i.getId()};return o.eyeOffset=s.getEyeOffset(i),o.scaleByDistance=s.getScaleByDistance(i),o}return null}function Ic(i,e,t,s){const r=e.getText(),n=r?r.getText():null;if(n){const a={};a.text=n,a.heightReference=t;const o=r.getOffsetX()||0,l=r.getOffsetY()||0;a.pixelOffset=new $e(o,l);const h=r.getFont();h&&(a.font=h);const c=r.getFill(),u=r.getStroke();let d;c&&(a.fillColor=ai(c.getColor(),[0,0,0,1]),d=jn.FILL),u&&(a.outlineWidth=E(u.getWidth(),1),a.outlineColor=ai(u.getColor(),[0,0,0,1]),d=jn.OUTLINE),c&&u&&(d=jn.FILL_AND_OUTLINE),a.style=d;let f;switch(r.getTextAlign()){case"left":f=Hn.LEFT;break;case"right":f=Hn.RIGHT;break;case"center":default:f=Hn.CENTER}a.horizontalOrigin=f;let g;switch(r.getTextBaseline()){case"top":g=Be.TOP;break;case"middle":g=Be.CENTER;break;case"bottom":g=Be.BOTTOM;break;case"alphabetic":g=Be.TOP;break;case"hanging":g=Be.BOTTOM;break;default:g=Be.BASELINE}return a.verticalOrigin=g,a.eyeOffset=s.getEyeOffset(i),a.scaleByDistance=s.getScaleByDistance(i),a}return null}function Lc(i,e,t,s,r){const n=s.getModel(i);if(n){const a=C.fromArray(n.scale),o=ef.fromDegrees(n.heading,n.pitch,n.roll);return t.map((l,h)=>{const c=A.multiply(el.headingPitchRollToFixedFrame(l,o),A.fromScale(a),new A),u=s.getModelOptions(i),d=tf.fromGltf(v({url:n.url,modelMatrix:c},u));return e[h][2]||vr(r.globe.terrainProvider,[te.fromCartesian(l)]).then(([f])=>{d.isDestroyed()||(d.modelMatrix=A.multiply(el.headingPitchRollToFixedFrame(te.toCartesian(f),o),A.fromScale(a),new A))}).catch(()=>{}),d.readyPromise.then(()=>{d.activeAnimations.addAll({loop:sf.REPEAT})}),d})}return null}function Tc(i){if(i.getType()!==Rt.POINT)return!1;const e=i.getFlatCoordinates();return e&&e.length>=2?e.every(t=>Number.isFinite(t)):!1}function Nc(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]=T.mercatorToWgs84(n,!0);let o=null;e.heightReference===Xe.RELATIVE_TO_GROUND?o=e.heightAboveGroundAdjustment:o=r,s[a]=C.fromDegrees(n[0],n[1],o)}),{positions:s,wgs84Positions:t}}function Gv(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=C.fromDegrees(o[0],o[1],l),c=[t[a],h];r.push(...Oc({positions:c},s))}return r}function Ja(i,e,t,s,r,n){if(!e.getImage()&&!(e.getText()&&e.getText().getText()))return;const a=t.filter(g=>Tc(g));if(!a.length)return;const o=Av(a),l=en(i,s,o);let{heightReference:h}=l;const c=s.getAllowPicking(i),{positions:u,wgs84Positions:d}=Nc(o,l),f=Lc(i,d,u,s,r);if(f)n.addPrimitives(f,i,c);else{if(l.extruded&&e.getStroke()){const p=Gv(d,l,u,e);if(p.length){h=Xe.NONE;const y=Ia(r,s,c,i,p,e,!1);y&&n.addPrimitives([y],i,c)}}const g=Ec(i,e,h,s);if(g){const p=u.map(y=>O(v({},g),{position:y}));n.addBillboards(p,i,c)}const m=Ic(i,e,h,s);if(m){const p=u.map(y=>O(v({},m),{position:y}));n.addLabels(p,i,c)}}}function Dc(i,e,t,s,r,n){e instanceof wi?Ja(i,t,[e],s,r,n):e instanceof In?Wa(i,t,[e],s,r,n):e instanceof En?Za(i,t,[e],s,r,n):e instanceof lt?bc(i,t,[e],s,r,n):e instanceof Ao?Ja(i,t,e.getPoints(),s,r,n):e instanceof fr?Wa(i,t,e.getPolygons(),s,r,n):e instanceof Go?Za(i,t,e.getLineStrings(),s,r,n):e instanceof ms&&e.getGeometries().forEach(a=>{Dc(i,a,t,s,r,n)})}function Ys(i,e,t=1){const s=[];return typeof i=="function"?s.push(...Ys(i(e,t),e,t)):Array.isArray(i)?i.forEach(r=>{s.push(...Ys(r,e,t))}):i instanceof fe&&s.push(i),s}function Fc(i,e,t,s,r){Ys(i.getStyle()||e,i,0).forEach(a=>{const o=a.getGeometryFunction()(i);o&&Dc(i,o,a,t,r,s)})}function Rc(i,e){e.olFeature=i}function mi(i,e){e&&e.forEach(t=>{i.remove(t)})}function Xi(i,e,t){mi(t,e.get(i)),e.delete(i)}function Yi(i,e,t,s,r){if(i.length){const n=i.map(a=>{const o=s.add(a);return t&&Rc(e,o),o});r.has(e)?r.get(e).push(...n):r.set(e,n)}}class Ac{constructor(e,t){this.primitives=new $n,this.billboards=new rf({scene:e}),this.labels=new nf({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){Yi(e,t,s,this.primitives,this.featureToPrimitiveMap)}addBillboards(e,t,s){Yi(e,t,s,this.billboards,this.featureToBillboardMap)}addLabels(e,t,s){Yi(e,t,s,this.labels,this.featureToLabelMap)}removeFeature(e){Xi(e,this.featureToPrimitiveMap,this.primitives),Xi(e,this.featureToBillboardMap,this.billboards),Xi(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){mi(this.primitives,e.primitives),mi(this.billboards,e.billboards),mi(this.labels,e.labels)}clear(){this.primitives.removeAll(),this.billboards.removeAll(),this.labels.removeAll(),this.featureToBillboardMap.clear(),this.featureToLabelMap.clear(),this.featureToPrimitiveMap.clear()}}class Gc extends Ut{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 $n,this._rootCollection[z]=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 Ac(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?Fc(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=ln(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=>{ye(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 ue={NORTH:1,EAST:2,SOUTH:3,WEST:4,NADIR:5},hn={north:ue.NORTH,east:ue.EAST,south:ue.SOUTH,west:ue.WEST,nadir:ue.NADIR};function kv(i){return Object.keys(hn).find(e=>hn[e]===i)}const Zi={};function Ji(i){if(!Zi[i.url])return Zi[i.url]=new tl(i),Zi[i.url];let e=Zi[i.url];return(i.requestVertexNormals!==void 0&&e.requestVertexNormals!==i.requestVertexNormals||i.requestWaterMask!==void 0&&e.requestWaterMask!==i.requestWaterMask)&&(Zi[i.url]=new tl(i),e=Zi[i.url]),e}function pi(i,e,t,s){const r=t?de(t.proj,B.proj):null,n=e.map(o=>{const l=r?r(o,o.slice(),o.length):o;return te.fromDegrees(l[0],l[1])}),a=s||e.map(o=>o.slice());return vr(i,n).then(o=>(o.forEach((l,h)=>{a[h][2]=l.height||0}),a))}function kc(i,e,t){if(!i.ready)return!1;const s=i.tilingScheme.positionToTileXY(t,e,new $e);return i.getTileDataAvailable(s.x,s.y,e)}let Ka=new $e,Qa=new $e;function eo(i,e=!1){const t=i.slice(),s=_s(t);let n=[Pn(s),zo(s),jo(s),pr(s)].map(a=>{let o=0,l=1/0;return t.forEach((h,c)=>{const u=kt(a,h);u<l&&(l=u,o=c)}),t.splice(o,1)[0]});return e===ue.EAST?n=[n[3],n[0],n[1],n[2]]:e===ue.SOUTH?n=[n[2],n[3],n[0],n[1]]:e===ue.WEST&&(n=[n[1],n[2],n[3],n[0]]),n}function Zs(i,e){return Ka=$e.fromElements(i[0],i[1],Ka),Qa=$e.fromElements(e[0],e[1],Qa),$e.angleBetween(Ka,Qa)}function to(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 zc(i,e,t,s,r){const n=eo(i,t?!1:r),a=eo(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=to([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]],M=[p.x-n[c][0],p.y-n[c][1]],b=Zs(y,M);if(b==null||b/(Math.PI*180)>5)continue;const I=[n[g][0]-n[m][0],n[g][1]-n[m][1]],L=[n[m][0]-n[g][0],n[m][1]-n[g][1]],D=Zs(y,I);if(D==null)continue;const X=Zs(y,L);if(X==null)continue;const $=kt(n[g],n[m]);if($===0)continue;const xe=kt(n[g],[p.x,p.y])/$;let He=0;xe!==0&&(He=Zs(L,[p.x-n[g][0],p.y-n[g][1]]),He==null)||u.push({cornerPoint:c,intrX:p.x,intrY:p.y,angle:D<=X?D:X,edgeStart:g,edgeEnd:m,ratioStart2End:He/Math.PI*180>5?xe*-1:xe})}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],M=[p[0]-y[0],p[1]-y[1]],b=[y[0]+M[0]*u[1].ratioStart2End,y[1]+M[1]*u[1].ratioStart2End],I=[m[0]-a[u[0].cornerPoint][0],m[1]-a[u[0].cornerPoint][1]],L=[b[0]-a[u[1].cornerPoint][0],b[1]-a[u[1].cornerPoint][1]];return!(Zs(I,L)==null||(h=to([a[u[0].cornerPoint],m],[a[u[1].cornerPoint],b]),h.x==null||h.y==null))}),h}function zv(i,e,t={}){let s;t.dataProjection&&t.dataProjection===i.meta.projection?s=e:s=t.dataProjection?Yt(e,t.dataProjection.proj,i.meta.projection.proj):Yt(e,F.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?pi(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 pi(e.meta.terrainProvider,[t]).then(([l])=>{if(l[2]!=null){const h=Yt(e.transformImage2RealWorld(s,l[2]),e.meta.projection.proj,B.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 Ki(i,e,t={}){const s=Yt(i.transformImage2RealWorld(e,i.averageHeight),i.meta.projection.proj,B.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?Yt(a.coords,B.proj,t.dataProjection.proj):Yt(a.coords,B.proj,F.proj),a}function Hc(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 $c(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=kt(r,n);a>e&&(e=a)}return e}function io(i,e){const t=$c(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 Vc(i,e,t){const{size:s,fovy:r,metersPerUnit:n}=io(i,e),l=2*t*Math.tan(r/2)/n/s.height;return i.getView().getZoomForResolution(l)}async function Bc(i,e,t){const s=i instanceof lt?gd(i):i,r=s.getCoordinates(),n=qi(s,r);let a=de(F.proj,t.meta.projection.proj),o=[];if(t.meta.terrainProvider){const l=n.map(h=>(T.mercatorToWgs84(h,!0),te.fromDegrees(h[0],h[1])));a=de(B.proj,t.meta.projection.proj),o=await vr(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 Uc(i,e,t){const s=i.getCoordinates(),n=qi(i,s).map(a=>Ki(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 so(i,e=!1){const t=i.getGeometry();if((t.get("_vcsGeomType")==="bbox"||t.get("_vcsGeomType")==="rectangle")&&e)return t;const r=t instanceof lt,n=Ha(t);return n[Vs]=r,n}function ro(i,e){const t=i.getGeometry(),s=i.getGeometry().clone();e.setGeometry(t[Vt]?s:Ha(s)),t[Vt]&&e.getGeometry().setProperties(i.getGeometry().getProperties(),!1),i[Xr]=e.getGeometry()}class qc extends Ut{constructor(e,t){super(e,t),this.olLayer=null}initialize(){return this.initialized||(this.olLayer=this.getOLLayer(),this.olLayer[z]=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 no extends qc{static get className(){return"VectorObliqueImpl"}constructor(e,t){super(e,t),this.obliqueSource=new vs({}),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 ko({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[Vt]||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=ln(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[Oa])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[Bt]=e,ro(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){ye(e.originalGeometryChanged),ye(e.obliqueGeometryChanged),ro(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[Vs]){ye(r.originalGeometryChanged),r.originalGeometryChanged=e.getGeometry().on("change",()=>{this._updatingMercator[s]||(delete n[Vs],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[Vt]?t.getGeometry().setCoordinates(r.getCoordinates()):await Bc(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]),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=so(e,!1);n[Vs]&&e.setGeometry(n);const a=so(t,!0);this._updatingMercator[s]=!0,await Uc(a,n,this.map.collection.getImageByName(r)),this._updatingMercator[s]=null},200)}_clearCurrentImage(){Object.values(this._featureListeners).forEach(e=>{ye(Object.values(e))}),this._featureListeners={},this._updatingOblique={},this._updatingMercator={},this.obliqueSource.getFeatures().forEach(e=>{const t=e[Bt];t&&(delete t[Xr],delete t.getGeometry()[Vt])}),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(F),this.source.forEachFeatureInExtent(this.currentExtent,e=>{this.addFeature(e)}),this.source.forEachFeature(e=>{e.getGeometry()[Vt]&&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&&(ye(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=[],ye(this._sourceListener),this._sourceListener=[],this._imageChangedListener&&(this._imageChangedListener(),this._imageChangedListener=null),this._clearCurrentImage()}destroy(){this.olLayer&&this.map.removeOLLayer(this.olLayer),this.olLayer=null,ye(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 cn{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 C(s[0],this.meta.size[1]-s[1],1),n=Ve.multiplyByVector(this.pToRealworld,r,new C),a=t||this.averageHeight,o=new C(this.centerPointOnGround[0],this.centerPointOnGround[1],a),l=C.subtract(this.projectionCenter,o,new C),h=C.dot(C.UNIT_Z,l)*-1,c=C.dot(C.UNIT_Z,n),u=h/c,d=C.add(this.projectionCenter,C.multiplyByScalar(n,u,new C),new C);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 il(e[0],e[1],s,1),n=A.multiplyByVector(this.pToImage,r,new il),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=zc(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 pi(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 Js{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=kt(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 Wc=0;function jv(){return Wc+=1,Wc}function ao(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 Xc(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 T({epsg:jv(),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 Js(v(v({},h),c)))}):typeof i.generalImageInfo.cameraParameter=="object"&&Object.entries(i.generalImageInfo.cameraParameter).forEach(([c,u])=>{l.push(new Js(v(v({name:c},h),u)))})),l.length===0&&l.push(new Js(v({name:"default"},h))),l}function oo(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 Ve(...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]?C.fromArray(n[s.projectionCenter]):null,u=n[s.pToImage]?new A(...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 cn({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 Yc(i,e){const{cameraParameter:t}=i.generalImageInfo,{version:s,buildNumber:r}=ao(i);return i.images.map(n=>{const a=hn[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=Ve.fromRowMajorArray([].concat(...p["camera-matrix"])),M=Ve.inverse(y,new Ve),b=Ve.fromRowMajorArray([].concat(...n["rotation-matrix"])),I=Ve.transpose(b,new Ve),L=p["focal-length"]*-1;Ve.multiplyByScalar(M,L,M);const D=Ve.multiply(I,M,new Ve),X=A.fromRotationTranslation(y,C.ZERO,new A),$=C.fromArray(l),xe=A.fromTranslation(C.multiplyByScalar($,-1,new C),new A),He=A.fromRotationTranslation(b,C.ZERO,new A),Mt=A.multiply(X,A.multiply(He,xe,new A),new A);m.projectionCenter=$,m.pToRealworld=D,m.pToImage=Mt}return new cn(m)})}async function lo(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 yt(i,e){return(await lo(i,e)).json()}async function Zc(i,e){return(await lo(i,e)).arrayBuffer()}const ae={PENDING:1,LOADING:2,READY:3};function Ks(i){return i.some(e=>e===ae.PENDING)?ae.PENDING:i.some(e=>e===ae.LOADING)?ae.LOADING:ae.READY}class ho{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 T)&&(r=new T(r)),this.projection=r,this._terrainProviderOptions=s?v({},s):void 0,this._terrainProvider=this._terrainProviderOptions?Ji(this._terrainProviderOptions):void 0,this._imageMetas=[],this.imagesLoaded=new R,this._tiles=new Map,this._loadingPromises=new Map,this._state=ae.PENDING,this._tileLevel=null,this._tileGrid=Ho(),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=ae.LOADING,this._loadingPromise=yt(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!==ae.PENDING)throw new Error("DataSet has already been loaded");this._loadingPromise=Promise.resolve(),this._initialize(e)}_initialize(e){this._parseMetaData(e),this._state=ae.READY}_parseMetaData(e){this._imageMetas=Xc(e,this.baseUrl,this.projection,this.terrainProvider);const{version:t,buildNumber:s}=ao(e);if(e.tileLevel)this._tileLevel=e.tileLevel,e.availableTiles.forEach(r=>{this._tiles.set(r,ae.PENDING)});else{let r=[];t>=3.5||t===3.4&&s>36?r=oo(e,this._imageMetas):(t>=3.1||t===null)&&(r=Yc(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=kt([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!==ae.READY})}getDataStateForCoordinate(e){if(this._state!==ae.READY||this._tiles.size===0)return this._state;const t=this._getClosestTileCoordinate(e).join("/");return this._tiles.has(t)?this._tiles.get(t):ae.READY}getDataStateForExtent(e){if(this._state!==ae.READY||this._tiles.size===0)return this._state;const s=this._getTileCoordinatesForExtent(e).map(r=>this._tiles.get(r)).filter(r=>r);return Ks(s)}_loadTile(e){if(this._loadingPromises.has(e))return this._loadingPromises.get(e);if(this._tiles.get(e)!==ae.PENDING)return Promise.resolve();this._tiles.set(e,ae.LOADING);const t=yt(`${this.baseUrl}/${e}.json`).then(s=>{const r=oo(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,ae.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=v({},this._terrainProviderOptions)),e}}let co="";function Hv(){if(!co){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),co=i.toDataURL("png")}return co}class Jc{constructor(e,t){this.id=Ye(),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 md({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 On({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 $o({origin:[0,0],extent:e,resolutions:this.tileResolution,tileSize:this.tileSize})};Hc(this.url)||(n.crossOrigin="anonymous"),this.tileImageSource=new pd(n),this.layer=new bi({source:this.tileImageSource,extent:e})}setImageName(e,t=!1){t&&this.tileImageSource.setTileLoadFunction(s=>{s.getImage().src=Hv(),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 $v(i,e,t,s,r){Kc(i,e,t||0,s||i.length-1,r||Vv)}function Kc(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));Kc(i,e,c,u,r)}var d=i[e],f=t,g=s;for(Qs(i,t,e),r(i[s],d)>0&&Qs(i,t,s);f<g;){for(Qs(i,f,g),f++,g--;r(i[f],d)<0;)f++;for(;r(i[g],d)>0;)g--}r(i[t],d)===0?Qs(i,t,g):(g++,Qs(i,g,s)),g<=e&&(t=g+1),e<=g&&(s=g-1)}}function Qs(i,e,t){var s=i[e];i[e]=i[t],i[t]=s}function Vv(i,e){return i<e?-1:i>e?1:0}class uo{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(!dn(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;dn(e,l)&&(t.leaf?s.push(o):go(e,l)?this._all(o,s):n.push(o))}t=n.pop()}return s}collides(e){let t=this.data;if(!dn(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(dn(e,a)){if(t.leaf||go(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=es([]),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=Bv(e,s.children,t);if(c!==-1)return s.children.splice(c,1),n.push(s),this._condense(n),this}!h&&!s.leaf&&go(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=es(e.slice(t,s+1)),Qi(o,this.toBBox),o;r||(r=Math.ceil(Math.log(n)/Math.log(a)),a=Math.ceil(n/Math.pow(a,r-1))),o=es([]),o.leaf=!1,o.height=r;const l=Math.ceil(n/a),h=l*Math.ceil(Math.sqrt(a));Qc(e,t,s,h,this.compareMinX);for(let c=t;c<=s;c+=h){const u=Math.min(c+h-1,s);Qc(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 Qi(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=fo(h),u=Wv(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),tr(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=es(s.children.splice(a,s.children.length-a));o.height=s.height,o.leaf=s.leaf,Qi(s,this.toBBox),Qi(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(s,o)}_splitRoot(e,t){this.data=es([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Qi(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=er(e,0,o,this.toBBox),h=er(e,o,s,this.toBBox),c=Xv(l,h),u=fo(l)+fo(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:Uv,n=e.leaf?this.compareMinY:qv,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=er(e,0,t,n),o=er(e,s-t,s,n);let l=un(a)+un(o);for(let h=t;h<s-t;h++){const c=e.children[h];tr(a,e.leaf?n(c):c),l+=un(a)}for(let h=s-t-1;h>=t;h--){const c=e.children[h];tr(o,e.leaf?n(c):c),l+=un(o)}return l}_adjustParentBBoxes(e,t,s){for(let r=s;r>=0;r--)tr(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():Qi(e[t],this.toBBox)}}function Bv(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 Qi(i,e){er(i,0,i.children.length,e,i)}function er(i,e,t,s,r){r||(r=es(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];tr(r,i.leaf?s(a):a)}return r}function tr(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 Uv(i,e){return i.minX-e.minX}function qv(i,e){return i.minY-e.minY}function fo(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function un(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Wv(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 Xv(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 go(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function dn(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function es(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Qc(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;$v(i,a,e,t,r),n.push(e,a,a,t)}}var mo={exports:{}},eu={exports:{}};(function(i,e){(function(t,s){i.exports=s()})(E0,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})})(eu);var Yv=eu.exports;mo.exports=tu,mo.exports.default=tu;function tu(i,e,t,s,r,n){for(var a=i.data,o=[],l=i.toBBox,h,c,u,d,f=new Yv(void 0,Zv);a;){for(h=0;h<a.children.length;h++)c=a.children[h],u=Jv(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 Zv(i,e){return i.dist-e.dist}function Jv(i,e,t){var s=iu(i,t.minX,t.maxX),r=iu(e,t.minY,t.maxY);return s*s+r*r}function iu(i,e,t){return i<e?e-i:i<=t?0:i-t}var su=mo.exports;function ru(i){return i.map(e=>{const t=de(e.meta.projection.proj,F.proj),s=new Z({geometry:new an([e.groundCoordinates.map(r=>t(r.slice(0,2),void 0,void 0))]),viewDirection:e.viewDirection});return s.setId(e.name),s})}function nu(i){const e=Ho();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:uv(n),state:s});return a.setId(t),a})}class Nt extends rt{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=Nt.getDefaultOptions();this._directionTrees=new Map,this._images=new Map,this._dataSets=[],this.viewOptions={maxZoom:V(e.maxZoom,t.maxZoom),minZoom:V(e.minZoom,t.minZoom),scaleFactor:E(e.scaleFactor,t.scaleFactor),hideLevels:V(e.hideLevels,t.hideLevels)},this._loaded=!1,this.imagesLoaded=new R,this._tileFeatureSource=null,this._imageFeatureSource=null,Array.isArray(e.dataSets)&&e.dataSets.forEach(s=>{this._addDataSet(s)}),this._destroyed=new R,this.activeOnStartup=re(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=nu(this.getTiles()),t=new vs;return t.addFeatures(e),t}_createImageFeatureSource(){const e=ru([...this._images.values()]),t=new vs;return t.addFeatures(e),t}async _loadDataSet(e){if(await e.load(),this._tileFeatureSource){const t=nu(e.getTiles());this._tileFeatureSource.addFeatures(t)}}_addDataSet(e){let t;e instanceof ho?t=e:t=new ho(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",ae.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=de(r.meta.projection.proj,F.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 uo),this._directionTrees.get(n).load(r)}),this._imageFeatureSource){const r=ru(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]=Ks([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 Ks(t)}getDataStateForExtent(e){const t=this._dataSets.map(s=>s.getDataStateForExtent(e));return Ks(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=su(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(ue).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=de(F.proj,s.meta.projection.proj),n=e.slice(0,2);r(n,n,void 0);const a=_s(s.groundCoordinates);return yd(a,n)}return!1}async loadAdjacentImage(e,t,s=Math.PI/4){const r=this._directionTrees.get(e.viewDirection);if(r){const n=de(e.meta.projection.proj,F.proj),a=e.groundCoordinates.map(u=>n(u.slice(0,2),void 0,void 0)),o=_s(a);await this.loadDataForExtent(Vo(o,200));const l=Ln(o),c=su(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=Nt.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 Kv=new Js({name:"defaultObliqueMeta",size:[512,512],tileSize:[512,512],tileResolution:[1],projection:F,format:"png",url:""}),au=Symbol("isDefaultImage");class ou extends Nt{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 cn({meta:Kv,viewDirection:ue.NORTH,viewDirectionAngle:0,name:this.name,groundCoordinates:s,centerPointOnGround:e});return r[au]=!0,r}}function lu(i,e){return i<0?0:i>e?e:i}class hu{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 R,this.switchEnabled=!0,this.switchThreshold=0}get mapChangeEvent(){return this._mapChangeEvent}set mapChangeEvent(e){this._mapChangeEvent=e,this._active&&(this._postRenderListener&&ye(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&&(ye(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=de(this._currentImage.meta.projection.proj,F.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===ae.READY){const d=this._collection.getImageForCoordinate(l,this._currentImage.viewDirection);d&&d.name!==this._currentImage.name&&this._changeImage(d,t)}else u===ae.PENDING&&this._collection.loadDataForExtent(c)}}async _changeImage(e,t){this._loadingImage=e;const{coords:s}=await Ki(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 Jc(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[au]);const[a,o]=this._currentImage.meta.size;let l=[a/2,o/2];if(t){const h=de(F.proj,this._currentImage.meta.projection.proj)(t.slice(0,2),void 0,void 0),c=this._currentImage.transformRealWorld2Image(h,t[2]);c[0]=lu(c[0],a),c[1]=lu(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 On),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 pi(a.meta.terrainProvider,l,F,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 Ki(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&&(ye(this._postRenderListener),this._postRenderListener=null),this.imageChanged.destroy(),this._collection=null,this._olMap=null}}const Qv={[ue.NORTH]:0,[ue.EAST]:90,[ue.SOUTH]:180,[ue.WEST]:270},cu=new ou;function po(i){const{heading:e}=i;let t=ue.NORTH;return e>=45&&e<135?t=ue.EAST:e>=135&&e<225?t=ue.SOUTH:e>=225&&e<315&&(t=ue.WEST),t}function uu(i){const e=i.groundPosition||i.cameraPosition;return Yt(e,B.proj,F.proj)}class at extends qs{static get className(){return"ObliqueMap"}static getDefaultOptions(){return O(v({},Et.getDefaultOptions()),{changeOnMoveEnd:!1,switchThreshold:0,switchOnEdge:!0})}constructor(e){super(e);const t=at.getDefaultOptions();this._loadingCollection=null,this._mapChangeEvent=e.changeOnMoveEnd?"moveend":"postrender",this._switchThreshold=E(e.switchThreshold,t.switchThreshold),this._switchThreshold>1?this._switchThreshold=.2:this._switchThreshold<0&&(this._switchThreshold=0),this._switchEnabled=re(e.switchOnEdge,t.switchOnEdge),this.collectionChanged=new R,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){_(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 hu(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){_(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=po(e),s=uu(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=_s(e.groundCoordinates);return new pe({coordinates:Bo(t,e.meta.projection.proj,F.proj),projection:F.toJSON()})}return new pe({coordinates:[-189243134349e-4,-155387110963e-4,189243134349e-4,155387110963e-4],projection:F.toJSON()})}deactivate(){super.deactivate(),this._obliqueProvider.deactivate()}async setCollection(e,t){_(e,Nt),!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:B},{coords:r}=await Ki(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=de(e.meta.projection.proj,B.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}=io(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 ot({cameraPosition:[e[0],e[1],d],groundPosition:e,heading:Qv[t.viewDirection],pitch:-90,roll:0,distance:c})}async gotoViewPoint(e){if(this.movementDisabled||!this._obliqueProvider||!e.isValid())return;const t=po(e),s=uu(e),{distance:r}=e;if(await this._obliqueProvider.setView(s,t),this._obliqueProvider.currentImage){const n=Vc(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=Bo(o,t.meta.projection.proj,B.proj);return Ro(l,e[0],e[1])}toJSON(){const e=super.toJSON(),t=at.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()}}ri.registerClass(at.className,at);const fn={HEIGHT:"height",DISTANCE:"distance"};class ns{static get className(){return"CameraLimiter"}static getDefaultOptions(){return{mode:fn.HEIGHT,terrainUrl:void 0,limit:200,level:12}}constructor(e){const t=ns.getDefaultOptions();this.mode=Qn(e.mode,fn,t.mode),this._terrainUrl=e.terrainUrl||t.terrainUrl,this._terrainProvider=this._terrainUrl?Ji({url:this._terrainUrl}):null,this.limit=E(e.limit,t.limit),this.level=e.level===null?null:V(e.level,t.level),this.lastCheckedPosition=new te,this._terrainHeight=null,this._updatingTerrainHeight=!1}get terrainUrl(){return this._terrainUrl}set terrainUrl(e){ie(e,String),this._terrainUrl!==e&&(this._terrainUrl=e,this._terrainProvider=this._terrainUrl?Ji({url:this._terrainUrl}):null)}_limitWithLevel(e){return kc(this._terrainProvider,this.level,e)?af(this._terrainProvider,this.level,[e]):this._limitMostDetailed(e)}_limitMostDetailed(e){return vr(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=te.fromCartesian(e.position);if(s)if(this.mode===fn.DISTANCE&&this._terrainProvider){if(t=this._updateTerrainHeight(s),this._terrainHeight&&s.height-this._terrainHeight<this.limit){const r=this._terrainHeight+this.limit;te.toCartesian(new te(s.longitude,s.latitude,r),Vn.WGS84,e.position)}}else s.height<this.limit&&te.toCartesian(new te(s.longitude,s.latitude,this.limit),Vn.WGS84,e.position);return t}toJSON(){const e={},t=ns.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 gn(i,e,t){const s=t.indexOfKey(e[z]);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[z])>s){n=a;break}}i.add(e,n)}}async function du(i,e,t){const s=t.indexOfKey(e[z]);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[z])>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 e1(i,e,t){const{destroyPrimitives:s}=i;i.destroyPrimitives=!1,i.remove(e),gn(i,e,t),i.destroyPrimitives=s}function t1(i,e,t){i.remove(e,!1),gn(i,e,t)}function i1(i,e,t){du(i,e,t)}function fu(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 gu(i,e){i.debugShowRenderingStatistics=e,i.debugShowBoundingVolume=e,i.debugShowContentBoundingVolume=e}function s1(i,e){i.filter(t=>t instanceof Cs).forEach(t=>{gu(t,e)})}of.enableModelExperimental=!1;class G extends Et{static get className(){return"CesiumMap"}static getDefaultOptions(){return O(v({},Et.getDefaultOptions()),{enableLightning:!0,tileCacheSize:1,webGLaa:!1,cameraLimiter:void 0,globeColor:"#3f47cc"})}constructor(e){super(e);const t=G.getDefaultOptions();this._cesiumWidget=null,this.dataSourceDisplayClock=new lf({shouldAnimate:!0});const s=new hf;s.currentTime=this.dataSourceDisplayClock.currentTime,this._defaultClock=s,this._dataSourceClocks=[],this.debugMode=!1,this.enableLightning=re(e.enableLightning,t.enableLightning),this.tileCacheSize=V(e.tileCacheSize,t.tileCacheSize),this.screenSpaceEventHandler=null,this._screenSpaceListeners=[],this.defaultJDate=sl.fromDate(new Date(2014,6,20,13,0,0,0)),this.webGLaa=re(e.webGLaa,t.webGLaa),this.globeColor=Oe.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}get terrainProvider(){return this._terrainProvider}get cameraLimiter(){return this._cameraLimiter}set cameraLimiter(e){ie(e,ns),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){_(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:Bn.ALT,vcsModifier:le.ALT},{csModifier:Bn.CTRL,vcsModifier:le.CTRL},{csModifier:Bn.SHIFT,vcsModifier:le.SHIFT},{csModifier:void 0,vcsModifier:le.NONE}],t=[{type:Zt.LEFT_DOWN,pointerEvent:ze.DOWN,pointer:me.LEFT},{type:Zt.LEFT_UP,pointerEvent:ze.UP,pointer:me.LEFT},{type:Zt.RIGHT_DOWN,pointerEvent:ze.DOWN,pointer:me.RIGHT},{type:Zt.RIGHT_UP,pointerEvent:ze.UP,pointer:me.RIGHT},{type:Zt.MIDDLE_DOWN,pointerEvent:ze.DOWN,pointer:me.MIDDLE},{type:Zt.MIDDLE_UP,pointerEvent:ze.UP,pointer:me.MIDDLE},{type:Zt.MOUSE_MOVE,pointerEvent:ze.MOVE,pointer:me.ALL}];this._screenSpaceListeners=t.map(({pointerEvent:s,pointer:r,type:n})=>e.map(({csModifier:a,vcsModifier:o})=>(this.screenSpaceEventHandler.setInputAction(l=>{this._raisePointerInteraction(o,r,s,l)},n,a),()=>{this.screenSpaceEventHandler.removeInputAction(n,a)}))).flat()}async initialize(){if(!this.initialized){this._cesiumWidget=new cf(this.mapElement,{requestRenderMode:!1,scene3DOnly:!0,imageryProvider:!1,shadows:!1,terrainShadows:Ms.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 rl({scene:this._cesiumWidget.scene,dataSourceCollection:new nl}),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)}),uf.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.imagerySplitPosition=.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 ns(this._cameraLimiterOptions)),this._cameraLimiter&&this._setupPreUpdateListener(),this.screenSpaceEventHandler=new df(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?pi(t,e,F,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 ff(e.position,e.direction),a=this._cesiumWidget.scene.globe.pick(n,this._cesiumWidget.scene);if(a){r=C.distance(a,t);const h=Vn.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 ot({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=C.fromDegrees(c[0],c[1],c[2])}else{if(!e.groundPosition)return;const c=e.groundPosition;if(!c[2]){const g=await this.getHeightFromTerrain([T.wgs84ToMercator(c)]);c[2]=g[0][2]}const u=C.fromDegrees(c[0],c[1],c[2]),d=new gf(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=T.mercatorToWgs84(e),r=C.distance(C.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=fu(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=fu(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 nl;function t(s,r,n){const{entities:a}=n;return[new _f(r,a),new vf(r,a),new Sf(r,a)]}return this._clusterDataSourceDisplay=new rl({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 $n?e1(this.getScene().primitives,s,this.layerCollection):s instanceof Jt?t1(this.getScene().imageryLayers,s,this.layerCollection):s instanceof al&&i1(this.dataSourceDisplay.dataSources,s,this.layerCollection)})}addPrimitiveCollection(e){this.validateVisualization(e)&&(this.addVisualization(e),this._debug&&e instanceof Cs&&gu(e,this._debug),gn(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),gn(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 du(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=C.fromDegrees(e[0],e[1],0);return t.frustum.computeCullingVolume(t.positionWC,t.directionWC,t.upWC).computeVisibility(new ol(s))===mf.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 pf(this._cesiumInspectorContainer,this.getScene()),this._cesium3DTilesInspector=new yf(this._cesiumInspectorContainer,this.getScene()),this._cesium3DTilesInspector.viewModel.picking=!1),this._cesiumInspectorContainer&&(this._cesiumInspectorContainer.style.display=this.active&&this._debug?"":"none"),s1(this.getVisualizations(),this._debug)}_terrainProviderChanged(e){if(this.terrainProvider!==e){const t=this.layerCollection.getByKey(this.terrainProvider[z]);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=G.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()}}ri.registerClass(G.className,G);class Ce extends vt{static get className(){return"VectorLayer"}static get alreadyTransformedToMercator(){return xh}static get alreadyTransformedToImage(){return Vt}static get obliqueGeometry(){return Xr}static get doNotTransform(){return Oa}static get originalFeatureSymbol(){return Bt}static getDefaultOptions(){return O(v({},he.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=[G.className,at.className,ee.className];const t=Ce.getDefaultOptions();this.source=new vs({}),this.projection=new T(e.projection),this.maxResolution=e.maxResolution!=null?e.maxResolution:t.maxResolution,this.minResolution=e.minResolution!=null?e.minResolution:t.minResolution,this.dontUseTerrainForOblique=re(e.dontUseTerrainForOblique,t.dontUseTerrainForOblique),this.highlightStyle=t.highlightStyle,e.highlightStyle&&(this.highlightStyle=e.highlightStyle instanceof q?e.highlightStyle:new q(e.highlightStyle)),this.hasFeatureUUID=!1,this._visibility=!0,this.isDynamic=re(e.isDynamic,t.isDynamic),this._onStyleChangeRemover=null,this.vectorProperties=new et(v({allowPicking:this.allowPicking},e.vectorProperties));let s=e.style;e.style instanceof nt&&(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=ba,e.embedIcons&&(t.embeddedIcons=[]),e.writeStyle){const s=this.getStyleOrDefaultStyle(this._initialStyle);(e.writeDefaultStyle||!s.equals(this.style))&&Oh(this.style,t)}return t}setVcsMeta(e){this.vectorProperties.setVcsMeta(e)}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{source:this.source,maxResolution:this.maxResolution,minResolution:this.minResolution,vectorProperties:this.vectorProperties})}createImplementationsForMap(e){return this.visibility?e instanceof ee?[new Ua(e,this.getImplementationOptions())]:e instanceof G?[new Gc(e,this.getImplementationOptions())]:e instanceof at?[new no(e,this.getImplementationOptions())]:[]:[]}getStyleOrDefaultStyle(e,t){return super.getStyleOrDefaultStyle(e,t||oi.clone())}setStyle(e,t){super.setStyle(e,t),this._trackStyleChanges();const s=this.style instanceof Me;this.getFeatures().forEach(r=>{if(r[Te]){let n;s?(n=!0,r.setStyle(void 0)):r.getStyle()!==r[Te].style&&(n=!0,r.setStyle(r[Te].style)),n&&Reflect.has(r,pt)&&wa(r)}})}_trackStyleChanges(){this._onStyleChangeRemover&&(this._onStyleChangeRemover(),this._onStyleChangeRemover=null);const e=this.style instanceof Me;this._onStyleChangeRemover=this.style.styleChanged.addEventListener(()=>{this.getFeatures().forEach(t=>{(e||!t[Te])&&t.changed()})})}setHighlightStyle(e){_(e,[fe,q,Function]),e instanceof q?this.highlightStyle=e:(this.highlightStyle||(this.highlightStyle=new q({})),this.highlightStyle.style=e)}getSource(){return this.source}addFeatures(e){_(e,[Z]);const t=this.style instanceof Me,s=e.map(r=>{const n=r.getId();if(n==null)r.setId(Ye());else if(this.hasFeatureUUID=!0,n&&this.getFeatureById(n))return!1;if(this.projection.epsg!==F.epsg){const a=r.getGeometry();a&&(a[Ce.alreadyTransformedToMercator]||(a.transform(this.projection.proj,F.proj),a[Ce.alreadyTransformedToMercator]=!0))}return r[he.vcsLayerNameSymbol]=this.name,t&&r[Te]&&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 _(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 pe({projection:F.toJSON(),coordinates:this.source.getExtent()});return t.isValid()?t:null}objectClickedHandler(e){const t=e[Bt]||e;return this.vectorProperties.getAllowPicking(t)?{id:t.getId(),feature:t}:null}getGenericFeatureFromClickedObject(e){return Ba(e,this)}toJSON(){const e=super.toJSON(),t=Ce.getDefaultOptions();this.projection.epsg!==ah().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()}}oe.registerClass(Ce.className,Ce);const Qe=Symbol("vcsFeatureType"),yi={DYNAMIC:"dynamic",STATIC:"static",EDITED:"edited"},r1="EPSG:3857";let yo;function _o(){return yo||(yo=new Uo),yo}function mu(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 pu(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=Ft.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 n1(i,e){const t=_o().readGeometry(i,e.formatOptions);return String(e.formatOptions.featureProjection)==="EPSG:3857"&&(t[Ce.alreadyTransformedToMercator]=!0),Va(t),new Z({geometry:t})}function yu(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 a1(i,e){const t=i.color?be(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||be("#3399CC"),width:s}}}if(e==="LineString")return{stroke:{color:t||be("#3399CC"),width:s}};if(e==="Point")return{image:{fill:{color:[255,255,255,.4]},radius:r,stroke:{color:t||be("#3399CC"),width:1}}}}function _u(i,e){if(!i.geometry)return null;const t=i.geometry.olcs_radius;let s=_o().readGeometry(i.geometry,e.formatOptions);if(i.radius&&s instanceof wi){const a=s.getCoordinates();a.length===2&&a.push(0),s=new lt(a,i.radius,"XYZ")}if(t&&s instanceof wi){const a=s.getCoordinates();a.length===2&&a.push(0),s=ja(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=a1(r,s.getType())),Va(s);const n=new Z(O(v({},r),{geometry:s}));if(i.id&&n.setId(i.id),i.state&&(n[Qe]=i.state),i.vcsMeta.style&&!e.dontReadStyle){i.vcsMeta.style=yu(i.vcsMeta.style,e);let a;e.defaultStyle?(a=e.defaultStyle.clone().assign(new q(i.vcsMeta.style)),a.label!=null&&s.set("_vcsGeomType","Label")):a=new q(i.vcsMeta.style),n[Te]=a,n.setStyle(a.style)}return pu(n),n}function It(i,e={}){const t=typeof i=="string"?JSON.parse(i):i,s=mu(t),r=s?{epsg:s}:e.dataProjection,n={formatOptions:{dataProjection:r?r.epsg:B.epsg,featureProjection:e.targetProjection?e.targetProjection.epsg:F.epsg},dontReadStyle:e.dontReadStyle,readLegacyStyleOptions:e.readLegacyStyleOptions,defaultStyle:e.defaultStyle};if(e.dynamicStyle&&!n.defaultStyle&&(n.defaultStyle=oi),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===Me.className?a=new Me(t.vcsMeta.style):(t.vcsMeta.style=yu(t.vcsMeta.style,n),n.defaultStyle=n.defaultStyle.clone().assign(new q(t.vcsMeta.style)),a=n.defaultStyle)),{features:t.features.map(o=>_u(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=_u(t,n);return{features:a?[a]:[],vcsMeta:t.vcsMeta?t.vcsMeta:void 0}}else if(t.type!=null)return{features:[n1(t,n)]};return{features:[]}}function ts(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 lt){const a=r.getCoordinates();n=_d(T.mercatorToWgs84(a[0],!0),T.mercatorToWgs84(a[1],!0)),r=new wi(r.getCenter())}else if(r instanceof In){const a=r.getCoordinates();a.forEach(o=>{on(o)}),r.setCoordinates(a)}else if(r instanceof fr){const a=r.getCoordinates();a.forEach(o=>{o.forEach(l=>{on(l)})}),r.setCoordinates(a)}return s.geometry=_o().writeGeometryObject(r,{featureProjection:r1,rightHanded:!0}),n&&(s.geometry.olcs_radius=n),s.vcsMeta={},e.writeStyle&&i[Te]&&(s.vcsMeta.style=Pa(i[Te].getOptionsForFeature(i),t)),s}function o1(i,e={}){const t=i.vcsMeta||{};t.version=ba;const s=i.features.map(n=>ts(n,e,t.embeddedIcons)),r={type:"FeatureCollection",features:s,vcsMeta:t};return e.asObject?r:JSON.stringify(r,null,e.prettyPrint?2:null)}const l1=Ye();function h1(i,e){if(e.style&&i.setStyle(Us(e.style,i.defaultStyle)),e.highlightStyle){const t=Us(e.highlightStyle,i.highlightStyle);i.setHighlightStyle(t)}e.vectorProperties&&i.vectorProperties.setValues(e.vectorProperties),e.zIndex!=null&&(i.zIndex=e.zIndex)}function vo(i,e,t,s){if(s==null?e!==t:s!==e)throw new Error(`Cannot merge options, values of ${i} do not match`)}class Dt extends rt{static get className(){return"Category"}static getDefaultConfig(){return{title:"",featureProperty:void 0,classRegistryName:void 0,layerOptions:{},keyProperty:"name",items:[]}}constructor(e){super(e);const t=Dt.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]=l1),this._keyProperty=e.keyProperty||t.keyProperty,this._collectionChanged=new R,this._collectionListeners=[],this._collection=null,this.setCollection(new Mi(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 vd)r=s;else if(typeof s=="object"){const{features:n}=It(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=Dt.getDefaultConfig();vo("classRegistryName",this._classRegistryName,t.classRegistryName,e.classRegistryName),vo("featureProperty",this._featureProperty,t.featureProperty,e.featureProperty),vo("keyProperty",this._keyProperty,t.keyProperty,e.keyProperty),this.title=e.title||this.title,e.layerOptions&&this._layer&&h1(this._layer,e.layerOptions)}setCollection(e){if(_(e,_t),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[jr]?e:ni(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 ft?gt(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]=ts(s))}return t}serializeForContext(e){return this._collection.size===0?null:{name:this.name,items:this.collection.serializeContext(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}}zr.registerClass(Dt.className,Dt);const c1={layers:"layerClassRegistry",styles:"styleClassRegistry",maps:"mapClassRegistry",categories:"categoryClassRegistry"};class So extends Dt{static get className(){return"AppBackedCategory"}constructor(e){e.classRegistryName=c1[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 ot(e):this._collectionName==="obliqueCollections"?new Nt(e):this._collectionName==="layers"?ya(this._app,e):this._collectionName==="maps"?pa(this._app,e):super._deserializeItem(e)}setApp(e){super.setApp(e),this.setCollection(this._app[this._collectionName])}serializeForContext(e){return null}}zr.registerClass(So.className,So);function vu(){return Pe("CategoryCollection")}class Su extends Mi{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 vu().error("Cannot request a category without a name"),null;e.type||(vu().warning(`Implicitly typing category ${e.name} as ${Dt.className}`),e.type=Dt.className);let t;if(this.hasKey(e.name))t=this.getByKey(e.name),t.mergeOptions(e);else if(t=await gt(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 u1=Ye();class Mo{constructor(e){this._config=e,this._checkSum=Yf(JSON.stringify(e),u1),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 Mu=Symbol("isProvidedFeature"),Cu=Symbol("showProvidedFeature");class xi extends rt{static get className(){return"AbstractFeatureProvider"}static getDefaultOptions(){return{vectorProperties:{allowPicking:!1},genericFeatureProperties:void 0,showGeometry:!1,mapTypes:[]}}constructor(e,t){super(t);const s=xi.getDefaultOptions();this.layerName=e,this.style=t.style?Us(t.style,oi.clone()):void 0,this.showGeometry=re(t.showGeometry,s.showGeometry),this.vectorProperties=t.vectorProperties instanceof et?t.vectorProperties:new et(v(v({},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(Ye()),this.style&&e.setStyle(this.style.style),this.genericFeatureProperties&&e.setProperties(this.genericFeatureProperties),e[z]=this.layerName,e[Mu]=!0,e[Cu]=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=xi.getDefaultOptions();delete e.name,this.showGeometry!==t.showGeometry&&(e.showGeometry=this.showGeometry),this.genericFeatureProperties&&(e.genericFeatureProperties=v({},this.genericFeatureProperties)),this.style&&(e.style=this.style.toJSON());const s=this.vectorProperties.getVcsMeta(v(v({},et.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 d1(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=Ln(r.getExtent());l&&(T.mercatorToWgs84(l,!0),s={longitude:l[0],latitude:l[1]})}let a=s.height;if(!n){const l=Ft.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 mn extends xi{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(mn.className,mn);function ir(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 Co(i){const e=i.tilingSchema==="geographic"?B:F,t=e.proj.getExtent(),s=Tn(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 $o(o),params:i.parameters};return ir(i.url)||(l.crossOrigin="anonymous"),i.tilingSchema==="geographic"&&(i.version==="1.3.0"?l.projection="CRS:84":l.projection="EPSG:4326"),new Sd(l)}const f1={GML:Dn,GML2:Nn,GML3:Dn},g1=["application/geojson","application/json","application/vnd.geo+json"];function xu(i,e={}){return i==="text/xml"?(e.gmlFormat=e.gmlFormat?new f1[e.gmlFormat]:new Nn,new qo(e)):g1.includes(i)?new Uo(e):i==="application/vnd.ogc.gml"?new Nn(e):i==="application/vnd.ogc.gml/3.1.1"?new Dn(e):null}class Xt extends xi{static get className(){return"WMSFeatureProvider"}static getDefaultOptions(){return O(v({},xi.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=Xt.getDefaultOptions();this.extent=null,t.extent&&(t.extent instanceof pe?this.extent=t.extent:this.extent=new pe(t.extent)),this._wmsSourceOptions={url:t.url,tilingSchema:t.tilingSchema||s.tilingSchema,maxLevel:V(t.maxLevel,s.maxLevel),minLevel:V(t.minLevel,s.minLevel),tileSize:t.tileSize||s.tileSize,parameters:t.parameters,version:t.version||s.version},this.wmsSource=Co(this._wmsSourceOptions),this.featureInfoResponseType=t.responseType||s.responseType,this._formatOptions=t.formatOptions||s.formatOptions,this.featureFormat=xu(this.featureInfoResponseType,t.formatOptions),this.projection=t.projection?new T(t.projection):void 0}featureResponseCallback(e,t){let s;try{s=this.featureFormat.readFeatures(e,{dataProjection:this.projection?this.projection.proj:void 0,featureProjection:F.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 wi(t))}),s):[]}async getFeaturesByCoordinate(e,t){const s=this.wmsSource.getProjection();let r=e;s&&(r=de(F.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 yt(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=Xt.getDefaultOptions();return this.featureInfoResponseType!==t.responseType&&(e.responseType=this.featureInfoResponseType),this._formatOptions!==t.formatOptions&&(e.formatOptions=v({},this._formatOptions)),this.projection!==t.projection&&(e.projection=this.projection.toJSON()),e.url=this._wmsSourceOptions.url,e.parameters=v({},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(Xt.className,Xt);class _i{constructor(e=k.NONE,t=le.NONE,s=me.LEFT){this.id=Ye(),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}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:k.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 Mn extends _i{constructor(){super(k.ALL,le.ALL),this._scratchCartographic=new te,this._scratchCartesian=new C,this.setActive()}async pipe(e){return e.map.className==="CesiumMap"?this._cesiumHandler(e):e.map.className==="ObliqueMap"?Mn.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=te.fromCartesian(r,s.globe.ellipsoid,this._scratchCartographic),e.position=T.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&(k.MOVE^k.DRAGEVENTS),n=e.position.slice(0,2);if(Number.isFinite(n[0])&&Number.isFinite(n[1]))return Ki(s,n,{dontUseTerrain:!!r,dataProjection:F}).then(a=>(e.obliqueParameters={pixel:n},e.position=a.coords,e.obliqueParameters.estimate=a.estimate,e))}return e.stopPropagation=!0,Promise.resolve(e)}}class wu extends _i{constructor(e){super(k.ALL,le.ALL,me.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.length;for(let r=0;r<s;r++){const n=this.chain[r];if(n.active&e.type&&n.modificationKey&e.key&&n.pointerKey&e.pointer&&(t=await n.pipe(t),t.stopPropagation))break}return t}setModification(){super.setModification()}setPointer(){super.setPointer()}destroy(){this.chain.forEach(e=>{e.destroy()}),this.chain=[],super.destroy()}}class bu extends _i{constructor(){super(k.ALL^k.MOVE,le.ALL),this._pickPosition=k.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&k.DRAG&&!(this._pickPosition&k.DRAG)?(this._draggingFeature&&(e.feature=this._draggingFeature),e):(e.type&k.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&k.DRAGSTART&&e.feature&&(this._draggingFeature=e.feature),e.type&k.DRAG&&this._draggingFeature&&(e.feature=this._draggingFeature),e)}setActive(e){typeof e=="undefined"&&(this.pickPosition=k.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[z]=s[z]),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[Bt]||r),s=n,!0),{hitTolerance:this.hitTolerance}),t&&s&&(e.feature=t,t.get("features")&&(e.feature[z]=s[z]),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 te,a=new C,o=new C;const{pickTranslucentDepth:l}=s,h=()=>a?(this.pullPickedPosition&&e.ray&&(o=C.multiplyByScalar(e.ray.direction,this.pullPickedPosition,o),a=C.subtract(a,o,a)),n=te.fromCartesian(a,s.globe.ellipsoid,n),e.position=T.wgs84ToMercator([P.toDegrees(n.longitude),P.toDegrees(n.latitude),n.height],!0),e.positionOrPixel=e.position,s.pickTranslucentDepth=l,Promise.resolve(e)):(a=new C,Promise.resolve(e));if(r){if(r.primitive&&r.primitive.olFeature)e.feature=r.primitive.olFeature;else if(r.primitive&&r.primitive[z]&&(r instanceof Gt||r instanceof At)){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[z]?(e.feature=r,e.feature[z]=r.id[z]):e.feature=r;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 Ou extends _i{constructor(){super(k.CLICK,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 m1(){return Pe("EventHandler")}class Pu{constructor(){this._positionInteraction=new Mn,this._featureInteraction=new bu,this._featureProviderInteraction=new Ou,this._interactionChain=new wu([this._positionInteraction,this._featureInteraction,this._featureProviderInteraction]),this.clickDuration=400,this.dragDuration=100,this._lastDown=null,this._lastClick={time:null,windowPosition:new $e},this._dragging=null,this._running=!1,this._eventQueue=[],this._exclusiveInteraction=null,this._multiples=!1,this.exclusiveRemoved=new R,this.exclusiveAdded=new R}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 _(e,_i),_(t,Function),_(s,Number),ie(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||Ye(),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 _(e,_i),_(t,Number),this._interactionChain.addInteraction(e,t),()=>this._interactionChain.removeInteraction(e)!==-1?1:0}handleMapEvent(e){e.pointerEvent===ze.MOVE?this._mouseMove(e):e.pointerEvent===ze.DOWN?this._mouseDown(e):e.pointerEvent===ze.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=k.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&&$e.distanceSquared(this._lastClick.windowPosition,t.windowPosition)<12?(this._lastClick.time=null,t.type=k.DBLCLICK):(this._lastClick.time=Date.now(),$e.clone(t.windowPosition,this._lastClick.windowPosition),t.type=k.CLICK),this._startChain(t)),this._dragging=null,this._lastDown=null}_mouseMove(e){let t=e;this._lastDown?this._dragging?(t.type=k.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=v({type:k.DRAGSTART},this._lastDown),this._dragging=t,this._startChain(t,!0)):(t.type=k.MOVE,this._startChain(t,!0))}_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=>{m1().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=[]}}const qt=Symbol("cesiumTilesetLastUpdated");function xo(i){if(!i.ready)return Wo();const{rectangle:e}=i.root.boundingVolume;if(e){const o=Ue.southwest(e),l=Ue.northeast(e),h=T.wgs84ToMercator([P.toDegrees(o.longitude),P.toDegrees(o.latitude)]),c=T.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=te.fromCartesian(t),n=T.wgs84ToMercator([P.toDegrees(r.longitude),P.toDegrees(r.latitude),r.height]);return ja(n,s).getExtent()}class Wt extends Ut{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 Cs(this.tilesetOptions),this.tilesetProperties&&this.tilesetProperties.forEach(({key:e,value:t})=>{this.cesium3DTileset[e]=t}),this.cesium3DTileset[z]=this.name,this.cesium3DTileset.tileVisible.addEventListener(this.applyStyle.bind(this)),this.cesium3DTileset.tileUnload.addEventListener(e=>{delete e[qt]}),this._initializedPromise=this.cesium3DTileset.readyPromise,await this._initializedPromise,this._originalOrigin=C.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=A.IDENTITY;else{const e=te.fromCartesian(this._originalOrigin);e.longitude+=P.toRadians(this.offset[0]),e.latitude+=P.toRadians(this.offset[1]),e.height+=this.offset[2];const t=te.toCartesian(e),s=C.subtract(t,this._originalOrigin,t);this.cesium3DTileset.modelMatrix=A.fromTranslation(s)}}updateModelMatrix(e){this.modelMatrix=e,this.cesium3DTileset&&(this.modelMatrix?this.cesium3DTileset.modelMatrix=e:this.offset?this._calculateOffset():this.cesium3DTileset.modelMatrix=A.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!==yr.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 Mf)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[qt]||e[qt]<this.featureVisibility.lastUpdated||e[qt]<this.globalHider.lastUpdated||e[qt]<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[qt]&&r[pt]&&wa(r)}}e[qt]=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 p1{constructor(e){this.entities=e.entities,this.featureToBillboardMap=new Map,this.featureToLabelMap=new Map}addPrimitives(e,t,s){}addBillboards(e,t,s){Yi(e.map(r=>({billboard:r,position:r.position})),t,s,this.entities,this.featureToBillboardMap)}addLabels(e,t,s){Yi(e.map(r=>({label:r,position:r.position})),t,s,this.entities,this.featureToLabelMap)}removeFeature(e){Xi(e,this.featureToBillboardMap,this.entities),Xi(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){mi(this.entities,e.billboards),mi(this.entities,e.labels)}clear(){this.entities.removeAll(),this.featureToBillboardMap.clear(),this.featureToLabelMap.clear()}}function y1(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 Eu extends Ut{static get className(){return"DataSourceCesiumImpl"}constructor(e,t){super(e,t),this.dataSource=new al(this.name),this.dataSource[z]=this.name,this.entities=t.entities,this.clock=t.clock,this._collectionListener=()=>{}}async initialize(){this.initialized||(this._collectionListener=y1(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 ol,o=this.map.getViewPointSync(),{heading:l,pitch:h}=o,c=new Cf(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!==ll.PENDING){if(m===ll.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 vi extends Ut{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[z]=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 Iu extends vi{static get className(){return"OpenStreetMapCesiumImpl"}getCesiumLayer(){return new Jt(new xf({maximumLevel:this.maxLevel}),{alpha:this.opacity,splitDirection:this.splitDirection})}}class Lu extends vi{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(B);t&&(e.rectangle=Ue.fromDegrees(t[0],t[1],t[2],t[3]));const s=new wf(e),r={rectangle:e.rectangle,alpha:this.opacity,defaultAlpha:1,splitDirection:this.splitDirection};return new Jt(s,r)}}class Tu extends Ut{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=Ji({url:this.url,requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask}),this.terrainProvider[z]=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 Lt={GEOGRAPHIC:"geographic",MERCATOR:"mercator"};function wo(i){const e={};return i.numberOfLevelZeroTilesX&&i.numberOfLevelZeroTilesX>1&&(e.numberOfLevelZeroTilesX=i.numberOfLevelZeroTilesX),i.numberOfLevelZeroTilesY&&i.numberOfLevelZeroTilesY>1&&(e.numberOfLevelZeroTilesY=i.numberOfLevelZeroTilesY),i.tilingSchema===Lt.MERCATOR?new Un(e):new hl(e)}function Nu(i,e,t,s=0){if(!i.isValid())return s;const r=i.getCoordinatesInProjection(B);r[1]<-85&&(r[1]=-85),r[3]>85&&(r[3]=85);const a=[Pn(r),zo(r),jo(r),pr(r)].map(l=>te.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 je extends he{static get className(){return"RasterLayer"}static getDefaultOptions(){return O(v({},he.getDefaultOptions()),{minLevel:0,maxLevel:18,tilingSchema:Lt.GEOGRAPHIC,opacity:1,splitDirection:void 0})}constructor(e){e.url=e.url||"",super(e);const t=je.getDefaultOptions();this.extent=this.extent||new pe,this.tilingSchema=Qn(e.tilingSchema,Lt,t.tilingSchema),this.maxLevel=V(e.maxLevel,t.maxLevel),this._minLevel=V(e.minLevel,t.minLevel);const s=wo(e);this.minLevel=Nu(this.extent,s,this.maxLevel,this._minLevel),this._opacity=Cr(e.opacity,t.opacity,0,1),this._splitDirection=Y.NONE,e.splitDirection&&(this._splitDirection=e.splitDirection==="left"?Y.LEFT:Y.RIGHT),this.splitDirectionChanged=new R}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=Cr(e,this._opacity,0,1);this._opacity!==t&&(this._opacity=t,this.getImplementations().forEach(s=>{s.updateOpacity(t)}))}getImplementationOptions(){const e=O(v({},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=je.getDefaultOptions();return this.extent.equals(new pe)&&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!==Y.NONE&&(e.splitDirection=this._splitDirection===Y.RIGHT?"right":"left"),e}destroy(){this.splitDirectionChanged.destroy(),super.destroy()}}oe.registerClass(je.className,je);class Du extends vi{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(B);e.rectangle=Ue.fromDegrees(r[0],r[1],r[2],r[3])}this.tilingSchema===Lt.GEOGRAPHIC&&(e.tilingScheme=new hl);const t=new bf(e),s={alpha:this.opacity,splitDirection:this.splitDirection};return new Jt(t,s)}}const sr=new Array(25);for(let i=0;i<sr.length;i++)sr[i]=200375083427892e-7*2/256/2**(i+1);function pn(i){const e=Ue.southwest(i),t=Ue.northeast(i),s=[P.toDegrees(e.longitude),P.toDegrees(e.latitude)],r=[P.toDegrees(t.longitude),P.toDegrees(t.latitude)],n=zs(s),a=zs(r);return[...n,...a]}class We extends rt{static get className(){return"TileProvider"}static getDefaultOptions(){return{tileCacheSize:50,baseLevels:[15],trackFeaturesToTiles:!0,allowTileAggregation:!0}}constructor(e){super(e);const t=We.getDefaultOptions();this.tilingScheme=new Un,this._tileCacheSize=V(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 Md(this.tileCacheSize))}),this.rtreeCache=new Map,this.trackFeaturesToTiles=re(e.trackFeaturesToTiles,t.trackFeaturesToTiles),this.allowTileAggregation=re(e.allowTileAggregation,t.allowTileAggregation),this.featureIdToTileIds=new Map,this.tileLoadedEvent=new R,this._locale="en"}get tileCacheSize(){return this._tileCacheSize}get locale(){return this._locale}set locale(e){_(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(Ye())});const a=new uo(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 uo;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<sr.length&&(r=a,!(s>=sr[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=Cd(e);Vo(s,t,s);const r=ua(e),n=te.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=Ue.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=pn(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(B);this.tilingScheme.positionToTileXY(te.fromDegrees(r,o),s);const l=this.tilingScheme.positionToTileXY(te.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(F);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=We.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()}}si.registerClass(We.className,We);class _1 extends xd{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=wd(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(!!bd(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=Od(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 Fu(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=Pd(Ed(),1,1),h=Id(l,128,128,a,o,0,-e[0],-e[1]);return new _1(t,1,i,h,0,null,null,n)}function Ru(i,e,t,s){const r=document.createElement("canvas");r.width=s[0],r.height=s[0];const n=zs([P.toDegrees(t.longitude),P.toDegrees(t.latitude)]),a=Fu(e,n,r.getContext("2d"),s);return i.forEach(o=>{o.getStyleFunction()(o,1).forEach(c=>{a.drawFeature(o,c)})}),r}class Au{constructor(e){this.tileProvider=e.tileProvider,this._tilingScheme=this.tileProvider.tilingScheme,this._tileSize=e.tileSize,this._errorEvent=new Of,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=pn(n),o=Ue.center(n);return Ru(r,a,o,this._tileSize)}}class Gu extends vi{static get className(){return"VectorRasterTileCesiumImpl"}constructor(e,t){const s=O(v({},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 Au({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(B);e.rectangle=Ue.fromDegrees(s[0],s[1],s[2],s[3])}return new Jt(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 vi{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=v({},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(B);n&&(t.rectangle=Ue.fromDegrees(n[0],n[1],n[2],n[3]))}this.tilingSchema==="mercator"&&(t.tilingScheme=new Un);const s=new Pf(t),r={alpha:this.opacity,splitDirection:this.splitDirection};return new Jt(s,r)}}class zu extends vi{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(B),s={url:e,layer:this.layer,style:this.style,format:this.format,tileMatrixSetID:this.tileMatrixSetID,maximumLevel:this.maxLevel,rectangle:Ue.fromDegrees(t[0],t[1],t[2],t[3]),tileWidth:this.tileSize[0],tileHeight:this.tileSize[1]};s.tilingScheme=wo({tilingSchema:this.tilingSchema,numberOfLevelZeroTilesX:this.numberOfLevelZeroTilesX,numberOfLevelZeroTilesY:this.numberOfLevelZeroTilesY}),s.tileMatrixLabels=this.matrixIds;const r=new Ef(s),n={alpha:this.opacity,splitDirection:this.splitDirection};return new Jt(r,n)}}function ju(i){const e=i.getPropertyNames(),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 rr(){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 St extends vt{static get className(){return"CesiumTilesetLayer"}static getDefaultOptions(){return O(v({},vt.getDefaultOptions()),{highlightStyle:void 0,screenSpaceError:16,screenSpaceErrorMobile:32,maximumMemoryUsage:16,tilesetOptions:{},splitDirection:void 0,offset:void 0})}constructor(e){super(e),this._supportedMaps=[G.className];const t=St.getDefaultOptions();this.url&&!/\.json$/.test(this.url)&&(this.url=`${this.url.replace(/\/$/,"")}/tileset.json`),this.highlightStyle=null,e.highlightStyle&&(this.highlightStyle=e.highlightStyle instanceof q?e.highlightStyle:new q(e.highlightStyle)),this.screenSpaceError=V(e.screenSpaceError,t.screenSpaceError),this.screenSpaceErrorMobile=V(e.screenSpaceErrorMobile,t.screenSpaceErrorMobile),this.maximumMemoryUsage=V(e.maximumMemoryUsage,t.maximumMemoryUsage);const s=e.tilesetOptions||t.tilesetOptions;this.tilesetOptions=v({url:this.url,maximumScreenSpaceError:rr()?this.screenSpaceErrorMobile:this.screenSpaceError,maximumMemoryUsage:this.maximumMemoryUsage},s),this._splitDirection=Y.NONE,e.splitDirection&&(this._splitDirection=e.splitDirection==="left"?Y.LEFT:Y.RIGHT),this.splitDirectionChanged=new R,this._modelMatrix=void 0,this._offset=e.offset||t.offset}get modelMatrix(){return this._modelMatrix}set modelMatrix(e){ie(e,A),this._modelMatrix=e,this.getImplementations().forEach(t=>{t.updateModelMatrix(e)})}get offset(){return this._offset}set offset(e){ie(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))}async initialize(){return await this.style.cesiumStyle.readyPromise,super.initialize()}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{tilesetOptions:this.tilesetOptions,splitDirection:this.splitDirection,modelMatrix:this.modelMatrix,offset:this.offset})}createImplementationsForMap(e){return e instanceof G?[new Wt(e,this.getImplementationOptions())]:[]}objectClickedHandler(e){if(this.allowPicking){const t=ju(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=xo(t.cesium3DTileset),r=new pe({projection:F.toJSON(),coordinates:s});if(r.isValid())return r}return null}getGenericFeatureFromClickedObject(e){const t=v(v({},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=St.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=v({},this.tilesetOptions);s.url===this.url&&delete s.url;const r=rr()?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!==Y.NONE&&(e.splitDirection=this._splitDirection===Y.RIGHT?"right":"left"),Array.isArray(this.offset)&&(e.offset=this.offset.slice()),e}destroy(){super.destroy(),this.splitDirectionChanged.destroy()}}oe.registerClass(St.className,St);class Ci extends he{static get className(){return"DataSourceLayer"}static getDefaultOptions(){return O(v({},he.getDefaultOptions()),{genericFeatureProperties:{}})}constructor(e){super(e);const t=Ci.getDefaultOptions();this.entities=new If,this.clock=void 0,this._genericFeatureProperties=e.genericFeatureProperties||t.genericFeatureProperties,this.featureVisibility=new qr,this._featureVisibilityListeners=[],this._supportedMaps=[G.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===W.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===W.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 O(v({},super.getImplementationOptions()),{entities:this.entities,clock:this.clock})}createImplementationsForMap(e){return e instanceof G?[new Eu(e,this.getImplementationOptions())]:[]}addEntity(e,t,s){const r=this.entities.add(e);return r[z]=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=v(v({},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=v({},this._genericFeatureProperties)),e}destroy(){this.entities.removeAll(),this._featureVisibilityListeners.forEach(e=>{e()}),this._featureVisibilityListeners=[],this.featureVisibility.destroy(),super.destroy()}}oe.registerClass(Ci.className,Ci);class or extends Ci{static get className(){return"CzmlLayer"}static getDefaultOptions(){return O(v({},Ci.getDefaultOptions()),{sourceUri:void 0})}constructor(e){super(e),this.dataSource=new Lf,this.entities=this.dataSource.entities;const t=or.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[z]=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}}oe.registerClass(or.className,or);function v1(i,e,t){const s=[];return i.forEach(r=>{const n=ts(r,{writeStyle:!0});s.push({action:"add",feature:n,original:r,success(a){r.setId(a),r[Qe]=yi.DYNAMIC}})}),e.forEach(r=>{const n=ts(r,{writeStyle:!0});n._id=r.getId(),n.geomety="test",s.push({action:"edit",original:r,feature:n,success(){r[Qe]===yi.STATIC&&(r[Qe]=yi.EDITED)}})}),t.forEach(r=>{const n=r.getId();s.push({original:r,action:"remove",feature:{_id:n},success(){}})}),s}class Hu extends rt{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){const t=v1(this._addedFeatures,this._editedFeatures,this._removedFeatures);if(t.length>0){const s=await yt(e.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.map(n=>({action:n.action,feature:n.feature})))}),r=s.failedActions.map(({index:n,error:a})=>{const o=t[n];return this.getLogger().log(`failed action ${o.action}: ${a}`),t[n]=null,this._resetFeature(o.original)});t.filter(n=>n).forEach(({action:n,success:a})=>{n==="add"?a(s.insertedIds.shift()._id):a()}),await Promise.all(r)}else{try{await Promise.all([...this._convertedFeatures].map(async s=>{await this._resetFeature(s)}))}catch(s){this.getLogger().error(s.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[Qe]?e[Qe]===yi.STATIC?(this.layer.resetStaticFeature(t),Promise.resolve()):this.layer.injectedFetchDynamicFeatureFunc(t).then(r=>{const{features:n}=It(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(){ye(Object.values(this._changesListeners)),this._changesListeners.addfeature=null,this._changesListeners.changefeature=null,this._changesListeners.removefeature=null,this._resetValues()}pauseTracking(e){this._changesListeners[e]&&(ye(this._changesListeners[e]),this._changesListeners[e]=null)}_featureAdded(e){const{feature:t}=e;t[Qe]?t[Qe]===yi.STATIC&&(this._convertedFeatures.add(t),this.values.changed=!0):(this._addedFeatures.add(t),this.values.changed=!0)}_featureChanged(e){const{feature:t}=e;t[Qe]&&(this._convertedFeatures.delete(t),this._editedFeatures.add(t),this.values.changed=!0)}_featureRemoved(e){const{feature:t}=e;t[Qe]?(this._removedFeatures.add(t),this._editedFeatures.delete(t),this._convertedFeatures.delete(t),this.values.changed=!0):this._addedFeatures.delete(t)}removeFeature(e){_(e,Z),this._featureRemoved({feature:e})}addFeature(e){_(e,Z),this._featureAdded({feature:e})}editFeature(e){_(e,Z),this._featureChanged({feature:e})}destroy(){this.unTrack(),this.layer=null,super.destroy()}}const bo=Symbol("isTiledFeature");class as extends Ce{static get className(){return"FeatureStoreLayer"}static getDefaultOptions(){return O(v({id:"",type:"FeatureStoreLayer",featureType:"simple",features:[]},Ce.getDefaultOptions()),{projection:F.toJSON(),staticRepresentation:{},hiddenStaticFeatureIds:[],vcsMeta:{screenSpaceError:4,altitudeMode:"clampToGround"}})}constructor(e){const t=as.getDefaultOptions(),s=v({projection:t.projection},e);super(s),this._supportedMaps=[G.className,ee.className,at.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 Hu(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 qr,this._featureVisibilitySyncListeners=[Ch(this.featureVisibility,this._staticFeatureVisibility),this._staticFeatureVisibility.changed.addEventListener(({action:n})=>{n===W.SHOW&&this._staticFeatureVisibility.hideObjects([...this.hiddenStaticFeatureIds])})],this._setEditing=null,this._twoDimLoaded=null,this._twoDimStyleChanged=null,this._twoDimStaticSource=new vs,e.features){const n={type:"FeatureCollection",features:e.features,vcsMeta:e.vcsMeta},{style:a,features:o}=It(n,{targetProjection:F,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 yt(this.staticRepresentation.twoDim),{features:t}=It(e,{targetProjection:F,dynamicStyle:!0}),s=this.style instanceof Me;t.forEach(r=>{r[he.vcsLayerNameSymbol]=this.name,r[bo]=!0,s&&r[Te]&&r.setStyle(),this._setEditing&&this._setEditing.featureType!=null&&(r[this._setEditing.symbol]=this._setEditing.featureType)}),this._twoDimStaticSource.addFeatures(t)})()),this._twoDimLoaded}_getTwoDimStaticImplOptions(){return O(v({},super.getImplementationOptions()),{source:this._twoDimStaticSource,featureVisibility:this._staticFeatureVisibility})}createImplementationsForMap(e){const t=super.createImplementationsForMap(e);return e instanceof G&&this.staticRepresentation&&this.staticRepresentation.threeDim?t.push(new Wt(e,{url:this.staticRepresentation.threeDim,tilesetOptions:{maximumScreenSpaceError:rr()?this.screenSpaceErrorMobile:this.screenSpaceError,url:this.staticRepresentation.threeDim},tilesetProperties:[{key:bo,value:!0}],name:this.name,style:this.style,featureVisibility:this._staticFeatureVisibility,globalHider:this.globalHider,splitDirection:Y.NONE,jumpToLocation:!1})):this.staticRepresentation&&this.staticRepresentation.twoDim&&(this._loadTwoDim(),e instanceof ee?t.push(new Ua(e,this._getTwoDimStaticImplOptions())):e instanceof at&&t.push(new no(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 Me;this._twoDimStyleChanged=this.style.styleChanged.addEventListener(()=>{this._twoDimStaticSource.getFeatures().forEach(t=>{(e||!t[Te])&&t.changed()})})}}setStyle(e,t){const s=this.changeTracker.active;s&&this.changeTracker.pauseTracking("changefeature"),super.setStyle(e,t);const r=this.style instanceof Me;this._twoDimStaticSource.getFeatures().forEach(n=>{if(n[Te]){let a;r?(a=!0,n.setStyle(void 0)):n.getStyle()!==n[Te].style&&(a=!0,n.setStyle(n[Te].style)),a&&Reflect.has(n,pt)&&wa(n)}}),s&&(this.changeTracker.track(),this.changeTracker.values.changed=!0)}setEditing(e,t){this.getImplementations().forEach(s=>{s instanceof Wt&&(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 Gt||e instanceof At?St.prototype.objectClickedHandler.call(this,e):e instanceof Z?super.objectClickedHandler(e):null}getGenericFeatureFromClickedObject(e){if(e instanceof Z)return super.getGenericFeatureFromClickedObject(e);const t=St.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(F):Wo();if(this.staticRepresentation.threeDim){const r=this.getImplementations().find(n=>n instanceof Wt&&n.cesium3DTileset);if(r){const n=xo(r.cesium3DTileset);Xo(t,n)}}this.staticRepresentation.twoDim&&this._twoDimLoaded&&Xo(t,this._twoDimStaticSource.getExtent());const s=new pe({projection:F.toJSON(),coordinates:t});return s.isValid()?s:null}setMaximumScreenSpaceError(e){rr()?this.screenSpaceErrorMobile=e:this.screenSpaceError=e,this.getImplementations().forEach(t=>{t instanceof Wt&&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}=It(t,{targetProjection:F,defaultStyle:this.defaultStyle instanceof q?this.defaultStyle:oi});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[Qe]=yi.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=as.getDefaultOptions();return delete e.projection,e.vcsMeta=this.vectorProperties.getVcsMeta(v(v({},et.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=v({},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()}}oe.registerClass(as.className,as);const yn=Symbol("featureFromOptions");class os extends Ce{static get className(){return"GeoJSONLayer"}static getDefaultOptions(){return O(v({},Ce.getDefaultOptions()),{projection:B.toJSON(),features:void 0})}constructor(e){const t=os.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[yn]);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[yn]=!0}),this._featuresToLoad.splice(0),this._featuresToLoad=void 0),this.url?this._dataFetchedPromise=yt(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=It(e,{dataProjection:this.projection,dynamicStyle:!0});if(this.addFeatures(t.features),t.style&&this.setStyle(t.style),t.vcsMeta){const s=v(v({},t.vcsMeta),this.vectorProperties.getVcsMeta());this.setVcsMeta(s)}}toJSON(){const e=super.toJSON(),t=os.getDefaultOptions(),s=new T(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[yn]);r.length>0&&(e.features=r.map(n=>ts(n,{writeStyle:!0,writeId:!0})))}return e}destroy(){super.destroy(),this._featuresToLoad=void 0}}oe.registerClass(os.className,os);class is extends Ws{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===Y.NONE&&this._splitDirectionRenderListeners?(ye(this._splitDirectionRenderListeners),this._splitDirectionRenderListeners=null,this.olLayer.changed()):e!==Y.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===Y.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&&(ye(this._splitDirectionRenderListeners),this._splitDirectionRenderListeners=null),super.destroy()}}class $u extends is{static get className(){return"OpenStreetMapOpenlayersImpl"}getOLLayer(){return new bi({opacity:this.opacity,source:new Ld({maxZoom:this.maxLevel})})}}class ls extends he{static get className(){return"OpenStreetMapLayer"}static getDefaultOptions(){return O(v({},he.getDefaultOptions),{splitDirection:void 0,opacity:1,maxLevel:19})}constructor(e){super(e);const t=ls.getDefaultOptions();this._splitDirection=Y.NONE,e.splitDirection&&(this._splitDirection=e.splitDirection==="left"?Y.LEFT:Y.RIGHT),this._supportedMaps=[G.className,ee.className],this._opacity=Cr(e.opacity,t.opacity,0,1),this.splitDirectionChanged=new R,this.maxLevel=V(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=Cr(e,this._opacity,0,1);this._opacity!==t&&(this._opacity=t,this.getImplementations().forEach(s=>{s.updateOpacity(t)}))}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{opacity:this.opacity,splitDirection:this.splitDirection,minLevel:0,maxLevel:this.maxLevel,tilingSchema:""})}createImplementationsForMap(e){return e instanceof ee?[new $u(e,this.getImplementationOptions())]:e instanceof G?[new Iu(e,this.getImplementationOptions())]:[]}toJSON(){const e=super.toJSON(),t=ls.getDefaultOptions();return this._splitDirection!==Y.NONE&&(e.splitDirection=this._splitDirection===Y.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()}}oe.registerClass(ls.className,ls);class Vu extends is{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(B)};return ir(this.url)||(e.crossOrigin="anonymous"),new Td({source:new Nd(e),opacity:this.opacity})}}class S1 extends Ws{static get className(){return"TileDebugOpenlayersImpl"}getOLLayer(){return new bi({source:new Dd})}updateStyle(e,t){}updateTiles(e){}}class Bu extends is{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};ir(this.url)||(e.crossOrigin="anonymous"),this.tilingSchema===Lt.GEOGRAPHIC&&(e.projection="EPSG:4326");const t={source:new Fd(e),opacity:this.opacity};return this.extent&&this.extent.isValid()&&(t.extent=this.extent.getCoordinatesInProjection(F)),new bi(t)}}class Uu extends Ws{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 Rd({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(Ad.EMPTY))},url:"/{z}/{x}/{y}"});const e=this.extent&&this.extent.isValid()?this.extent.getCoordinatesInProjection(F):void 0,t=this.minLevel?this.minLevel:void 0,s=this.maxLevel?this.maxLevel+1:void 0;return new Gd({visible:!1,source:this.source,renderBuffer:200,renderMode:"image",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 qu extends is{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 bi({visible:!1,source:Co({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 Wu extends is{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===Lt.GEOGRAPHIC?B:F,t=e.proj.getExtent();let s=Tn(t)/this.tileSize[0];this.numberOfLevelZeroTilesX>1&&(s/=this.numberOfLevelZeroTilesX),this.tilingSchema===Lt.GEOGRAPHIC&&(s=Tn(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 kd(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 ir(this.url)||(c.crossOrigin="anonymous"),this.tilingSchema===Lt.GEOGRAPHIC&&(c.projection="EPSG:4326"),Object.assign(c,this.openlayersOptions),new bi({opacity:this.opacity,source:new zd(c)})}}const Xu=new Me({});class hs extends St{static get className(){return"PointCloudLayer"}static getDefaultOptions(){return O(v({},St.getDefaultOptions()),{pointSize:null})}constructor(e){super(e);const t=hs.getDefaultOptions();this.defaultPointSize=e.pointSize!=null?e.pointSize:t.pointSize,this._pointSize=this.defaultPointSize,this._supportedMaps=[G.className]}getStyleOrDefaultStyle(e,t){return super.getStyleOrDefaultStyle(e,t||Xu)}get pointSize(){return this._pointSize}set pointSize(e){ie(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 G?[new Wt(e,this.getImplementationOptions())]:[]}clearStyle(){super.clearStyle(),this.pointSize=this.defaultPointSize}setStyle(e,t){e instanceof q?this.getLogger().warning("trying to apply vector style to point cloud layer."):super.setStyle(e,t)}toJSON(){const e=super.toJSON(),t=hs.getDefaultOptions();return this.defaultPointSize!==t.pointSize&&(e.pointSize=this.defaultPointSize),e}}oe.registerClass(hs.className,hs);class lr extends je{static get className(){return"SingleImageLayer"}static getDefaultOptions(){return O(v({},je.getDefaultOptions()),{credit:void 0})}constructor(e){super(e);const t=lr.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 pe({projection:B.toJSON(),coordinates:[-180,-90,180,90]})),this._supportedMaps=[G.className,ee.className]}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{credit:this.credit})}createImplementationsForMap(e){return e instanceof G?[new Lu(e,this.getImplementationOptions())]:e instanceof ee?[new Vu(e,this.getImplementationOptions())]:[]}setExtent(e){if(_(e,pe),!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}}oe.registerClass(lr.className,lr);class cs extends he{static get className(){return"TerrainLayer"}static getDefaultOptions(){return O(v({},he.getDefaultOptions()),{requestVertexNormals:!0,requestWaterMask:!1})}constructor(e){super(e);const t=cs.getDefaultOptions();this._supportedMaps=[G.className],this.requestVertexNormals=re(e.requestVertexNormals,t.requestVertexNormals),this.requestWaterMask=re(e.requestWaterMask,t.requestWaterMask)}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask})}createImplementationsForMap(e){return e instanceof G?[new Tu(e,this.getImplementationOptions())]:[]}getHeightForWGS84Coordinates(e){const t=Ji({url:this.url,requestVertexNormals:this.requestVertexNormals,requestWaterMask:this.requestWaterMask});return pi(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}}oe.registerClass(cs.className,cs);function M1(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 C1(i,e){const t=i.getImplementations().filter(s=>s instanceof Wt);!i.active||t.every(s=>s.cesium3DTileset.tilesLoaded)||await Promise.all(t.map(s=>M1(s,e)))}function x1(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 Oo(i,e,t,s,r,n="en"){let a=i;if(r){const o=Ue.southwest(r),l=Ue.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 hr extends We{static get className(){return"URLTemplateTileProvider"}static getDefaultOptions(){return O(v({},We.getDefaultOptions()),{url:void 0})}constructor(e){const t=hr.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=Oo(this.url,e,t,s,r,this.locale),a=await yt(n),{features:o}=It(a,{dynamicStyle:!0});return o}toJSON(){const e=super.toJSON();return this.url&&(e.url=this.url),e}}si.registerClass(hr.className,hr);class cr extends We{static get className(){return"MVTTileProvider"}static getDefaultOptions(){return O(v({},We.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 jd({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=Oo(this.url,e,t,s,r,this.locale),a=pn(r),o=Ln(a),l=await Zc(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}}si.registerClass(cr.className,cr);class ur extends We{static get className(){return"StaticGeoJSONTileProvider"}static getDefaultOptions(){return O(v({},We.getDefaultOptions()),{url:void 0,baseLevels:[0]})}constructor(e){const t=ur.getDefaultOptions();e.baseLevels=t.baseLevels,super(e),this.url=e.url||t.url}async loader(e,t,s){const r=await yt(this.url),{features:n}=It(r,{dynamicStyle:!0});return n}toJSON(){const e=super.toJSON();return delete e.baseLevels,this.url&&(e.url=this.url),e}}si.registerClass(ur.className,ur);class us extends je{static get className(){return"TMSLayer"}static getDefaultOptions(){return O(v({},je.getDefaultOptions()),{tilingSchema:"mercator",format:"jpeg",tileSize:[256,256]})}constructor(e){const t=us.getDefaultOptions();e.tilingSchema=e.tilingSchema||t.tilingSchema,super(e),this._supportedMaps=[ee.className,G.className],this.format=e.format||t.format,this.tileSize=Array.isArray(e.tileSize)?e.tileSize.slice():t.tileSize}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{format:this.format,tileSize:this.tileSize})}createImplementationsForMap(e){return e instanceof ee?[new Bu(e,this.getImplementationOptions())]:e instanceof G?[new Du(e,this.getImplementationOptions())]:[]}toJSON(){const e=super.toJSON(),t=us.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}}oe.registerClass(us.className,us);function Yu(i,e,t){const s=t.getId();i.hiddenObjects[s]?t[Ae]=!0:t[Ae]&&delete t[Ae],i.highlightedObjects[s]?t[Ne]=i.highlightedObjects[s].style:t[Ne]&&delete t[Ne],e.hiddenObjects[s]?t[Ge]=!0:t[Ge]&&delete t[Ge]}class ds extends vt{static get className(){return"VectorTileLayer"}static getDefaultOptions(){return O(v({},vt.getDefaultOptions()),{tileProvider:void 0,highlightStyle:void 0,vectorProperties:{},minLevel:void 0,maxLevel:void 0})}constructor(e){super(e),this._supportedMaps=[G.className,ee.className];const t=ds.getDefaultOptions();this.highlightStyle=t.highlightStyle,e.highlightStyle&&(this.highlightStyle=e.highlightStyle instanceof q?e.highlightStyle:new q(e.highlightStyle)),this._tileSize=[256,256],this.vectorProperties=new et(v({allowPicking:this.allowPicking},e.vectorProperties)),this.tileProvider=e.tileProvider instanceof We?e.tileProvider:gt(si,e.tileProvider),this.tileProvider&&(this.tileProvider.locale=this.locale),this._maxLevel=V(e.maxLevel,t.maxLevel),this._minLevel=V(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 mn(this.name,{tileProvider:this.tileProvider,vectorProperties:this.vectorProperties})),await super.initialize()}objectClickedHandler(e){const t=e[Bt]||e;return this.vectorProperties.getAllowPicking(t)?e[Ae]||e[Ge]?null:{id:t.getId(),feature:t}:null}getGenericFeatureFromClickedObject(e){return Ba(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 fe&&s.setZIndex(this._getNextStyleZIndex()),t[z]=this.name,t.getStyleFunction=()=>this._featureStyle.bind(this),this.tileProvider.trackFeaturesToTiles&&Yu(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===W.HIGHLIGHT?h[Ne]=this.featureVisibility.highlightedObjects[r].style:e===W.UNHIGHLIGHT?delete h[Ne]:e===W.HIDE?h[Ae]=!0:e===W.SHOW&&delete h[Ae]}})}),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===W.HIDE?h[Ge]=!0:e===W.SHOW&&delete h[Ge]}})}),this.updateTiles([...s])})))}updateTiles(e){this.getImplementations().forEach(t=>{t.updateTiles(e)})}_featureStyle(e,t){let s;return e[Ae]||e[Ge]?[]:(e[Ne]?{style:s}=e[Ne]:this.style instanceof Me?{style:s}=this.style:s=e.getStyle()||this.style.style,Ys(s,e,t))}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{tileProvider:this.tileProvider,tileSize:this._tileSize,minLevel:this._minLevel,maxLevel:this._maxLevel,extent:this.extent})}createImplementationsForMap(e){return e instanceof G?[new Gu(e,this.getImplementationOptions())]:e instanceof ee?[new Uu(e,this.getImplementationOptions())]:[]}getStyleOrDefaultStyle(e,t){return super.getStyleOrDefaultStyle(e,t||oi.clone())}async activate(){await super.activate(),this._setupFeatureVisibilityHandlers(),this.tileProvider.trackFeaturesToTiles&&this.globalHider&&this.tileProvider.forEachFeature(e=>{Yu(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=ds.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}}oe.registerClass(ds.className,ds);class Po extends Ce{static get className(){return"WFSLayer"}static getDefaultOptions(){return O(v({},Ce.getDefaultOptions()),{featureType:[],featureNS:"",featurePrefix:"",getFeatureOptions:{}})}constructor(e){const t=new T(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 qo({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(v({featureNS:this.featureNS,featurePrefix:this.featurePrefix,featureTypes:this.featureType,srsName:this.projection.epsg},this.getFeaturesOptions)),t=new XMLSerializer().serializeToString(e);return this._dataFetchedPromise=yt(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}}oe.registerClass(Po.className,Po);class fs extends je{static get className(){return"WMSLayer"}static getDefaultOptions(){return O(v({},je.getDefaultOptions()),{version:"1.1.1",parameters:void 0,featureInfo:void 0,tileSize:[256,256],highResolution:!1,layers:""})}constructor(e){super(e);const t=fs.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=re(e.highResolution,t.highResolution),this._featureInfoOptions=e.featureInfo||t.featureInfo,this._supportedMaps=[G.className,ee.className]}initialize(){return this.initialized||this._setFeatureProvider(),super.initialize()}_setFeatureProvider(){if(this._featureInfoOptions){const e=v({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 Xt(this.name,e)}}async reload(){return this.featureProvider&&this._featureInfoOptions&&(this.featureProvider.destroy(),this._setFeatureProvider()),super.reload()}getImplementationOptions(){return O(v({},super.getImplementationOptions()),{version:this.version,parameters:this.parameters,highResolution:this.highResolution,tileSize:this.tileSize})}createImplementationsForMap(e){return e instanceof G?[new ku(e,this.getImplementationOptions())]:e instanceof ee?[new qu(e,this.getImplementationOptions())]:[]}async setLayers(e){_(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=fs.getDefaultOptions();this.parameters.LAYERS&&(e.layers=this.parameters.LAYERS),this.version!==t.version&&(e.version=this.version);const s=v({},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 Xt){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 pe(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}}oe.registerClass(fs.className,fs);function w1(i,e,t){if(i.length>0){if(i.length===e+1)return i;Pe("WmtsCesiumImpl").log("matrixIds must have the same length as maxLevel")}return new Array(e+1).fill(void 0).map((s,r)=>`${t}${r}`)}class gs extends je{static get className(){return"WMTSLayer"}static getDefaultOptions(){return O(v({},je.getDefaultOptions()),{tilingSchema:"mercator",numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,layer:"",style:"",format:"",tileMatrixPrefix:"",tileMatrixSetID:"",openlayersOptions:{},matrixIds:[],tileSize:[256,256]})}constructor(e){const t=gs.getDefaultOptions();e.tilingSchema=e.tilingSchema||t.tilingSchema,super(e),this._supportedMaps=[ee.className,G.className],this.numberOfLevelZeroTilesX=V(e.numberOfLevelZeroTilesX,t.numberOfLevelZeroTilesX),this.numberOfLevelZeroTilesY=V(e.numberOfLevelZeroTilesY,t.numberOfLevelZeroTilesY),this.layer=e.layer||t.layer,this.style=e.style||t.style,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 O(v({},super.getImplementationOptions()),{layer:this.layer,style:this.style,format:this.format,tileMatrixSetID:this.tileMatrixSetID,tileSize:this.tileSize,numberOfLevelZeroTilesX:this.numberOfLevelZeroTilesX,numberOfLevelZeroTilesY:this.numberOfLevelZeroTilesY,matrixIds:w1(this.matrixIds,this.maxLevel,this.tileMatrixPrefix),openlayersOptions:this.openlayersOptions})}createImplementationsForMap(e){return e instanceof ee?[new Wu(e,this.getImplementationOptions())]:e instanceof G?[new zu(e,this.getImplementationOptions())]:[]}toJSON(){const e=super.toJSON(),t=gs.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.style!==t.style&&(e.style=this.style),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=v({},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}}oe.registerClass(gs.className,gs);function Eo(){return Pe("ClippingObject")}const _n=Symbol("ClippingObjectGlobe");class Si{constructor(e={}){this.id=Ye(),this.layerNames=e.layerNames||[],this.entities=e.entities||[],this.targets=new Map,this._clippingPlaneCollection=e.clippingPlaneCollection||null,this._terrain=re(e.terrain,!1),this._local=re(e.local,!1),this.targetsUpdated=new R,this.clippingPlaneUpdated=new R,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){_(e,Boolean),this._terrain!==e&&(this._terrain=e,this.handleMapChanged(this._activeMap))}get local(){return this._local}set local(e){_(e,Boolean),this._local!==e&&(this._local=e,this.clippingPlaneUpdated.raiseEvent())}setLayerCollection(e){if(_(e,Tt),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 G){if(this.layerNames.includes(e.name))if(e.active){const s=t.getVisualizationsForLayer(e),r=s?[...s].filter(n=>n instanceof Cs):[];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);Eo().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);Eo().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);Eo().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 G){const{globe:t}=e.getScene();let s=!1;this._terrain&&!this.targets.has(_n)?(this.targets.set(_n,t),s=!0):!this._terrain&&this.targets.has(_n)&&(this.targets.delete(_n),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(_(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){_(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(_(e,String),_(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){_(e,String),_(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 Zu(i,e){const t=C.subtract(i,e,new C);C.normalize(t,t);const s=Kt.fromPointNormal(i,t);return ei.fromPlane(s)}function b1(i){const e=[],t=i.map(s=>C.fromDegrees(...T.mercatorToWgs84(s)));for(let s=0;s<t.length-1;s++){const r=s+1,n=new C;C.cross(t[r],t[s],n),C.normalize(n,n);const a=new Kt(n,0);Number.isNaN(a.distance)||e.push(ei.fromPlane(a))}return e}function Ju(i,e,t){const s=[],r=Ft.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]=T.mercatorToWgs84(e[0]),c=C.fromDegrees(l,h,n),u=C.fromDegrees(l,h,a);return t.createBottomPlane&&s.push(Zu(c,u)),o&&t.createTopPlane&&s.push(Zu(u,c)),s}function O1(i){const e=[],t=i.map(n=>C.fromDegrees(...T.mercatorToWgs84(n))),s=new C;C.cross(t[0],t[1],s),C.normalize(s,s);function r(n){const a=C.add(n,s,new C),o=new C;C.cross(n,a,o),C.normalize(o,o);const l=new Kt(o,0);e.push(ei.fromPlane(l))}return r(t[0]),C.negate(s,s),r(t[1]),e}function P1(i,e={},t){_(i,Z),_(e,Object),ie(t,A);const s=[],r=i.getGeometry(),n=r.getType();if(n==="Point")s.push(...Ju(i,[r.getCoordinates()],e));else{const a=qi(r);if(a.length<2||a[0][0]===a[1][0]&&a[0][1]===a[1][1])return null;n==="Polygon"?(on(a),pc(a)):n==="LineString"&&a.length===2&&e.createEndingPlanes&&s.push(...O1(a)),e.createVerticalPlanes&&s.push(...b1(a)),i.get("olcs_altitudeMode")==="absolute"&&(e.createBottomPlane||e.createTopPlane)&&s.push(...Ju(i,a,e))}return t&&s.forEach(a=>{const o=Kt.transform(a,t);a.normal=o.normal,a.distance=o.distance}),e.reverse&&s.forEach(a=>{C.negate(a.normal,a.normal),a.distance*=-1}),new Qt({planes:s,unionClippingRegions:e.reverse})}function ss(i,e,t,s){_(i,Qt),_(e,Qt),e.length>0&&e.removeAll();for(let r=0;r<i.length;r++){const n=i.get(r);if(t&&s){const a=Kt.getPointDistance(n,s),o=Kt.transform(n,t);o.distance=a,e.add(ei.fromPlane(o))}else e.add(ei.clone(n))}return e.modelMatrix=i.modelMatrix.clone(),e.unionClippingRegions=i.unionClippingRegions,e.edgeColor=i.edgeColor.clone(),e.edgeWidth=i.edgeWidth,e}function nr(i){i instanceof Rn?i.model&&(i.model.clippingPlanes?i.model.clippingPlanes.getValue().removeAll():i.model.clippingPlanes=new Tf(new Qt)):i.clippingPlanes?i.clippingPlanes.removeAll():i.clippingPlanes=new Qt}function E1(i,e,t){if(nr(i),t)ss(e,i.clippingPlanes);else if(!e.modelMatrix.equals(A.IDENTITY))ss(e,i.clippingPlanes),i.clippingPlanes.modelMatrix=A.multiply(A.inverse(i.clippingPlanesOriginMatrix,i.clippingPlanes.modelMatrix),e.modelMatrix,i.clippingPlanes.modelMatrix);else{const s=A.getMatrix3(A.inverse(i.clippingPlanesOriginMatrix,new A),new Ve),r=A.fromRotationTranslation(s,new C);ss(e,i.clippingPlanes,r,i.boundingSphere.center)}}function I1(i,e){nr(i),ss(e,i.clippingPlanes)}function L1(i,e,t){if(i.model){nr(i);const s=i.model.clippingPlanes.getValue();if(ss(e,s),!t){const r=i.computeModelMatrix(sl.now());A.inverseTransformation(r,s.modelMatrix),e.modelMatrix.equals(A.IDENTITY)||A.multiply(s.modelMatrix,e.modelMatrix,s.modelMatrix)}}}function Io(i,e,t){i instanceof Cs?E1(i,e,t):i instanceof Nf?I1(i,e):L1(i,e,t)}function T1(i,e,t=!1,s=25){_(i,[Number]),_(t,Boolean),_(s,Number);let r;if(t){const a=gr(i,-s,e.heading),o=gr(i,s,e.heading);r=new En([[a[0],a[1],i[2]],[o[0],o[1],i[2]]],xn.XYZ)}else{r=new In([[]],xn.XYZ);let a=2*Math.PI-Math.PI/4;const o=[...new Array(4)].map(()=>{const l=gr(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(B.proj,F.proj),n}function N1(i,e=!1){return ie(i,Z),_(e,Boolean),(i?i.getGeometry().getType()==="LineString":!1)?{createBottomPlane:!e,createTopPlane:!e,createEndingPlanes:!e,createVerticalPlanes:!0}:{createVerticalPlanes:!e,createBottomPlane:!0}}class Ku{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){_(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(_(e,Si),this.hasClippingObject(e))throw new Error("ClippingObject already managed, remove it first");e.setLayerCollection(this._layerCollection),this._defaultClippingObjects.add(e),this._activeMap instanceof G&&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){_(e,Si),this._defaultClippingObjects.has(e)&&(this._defaultClippingObjects.delete(e),this._listenersMap.get(e).forEach(t=>{t()}),this._listenersMap.delete(e),this._update())}hasClippingObject(e){return _(e,Si),this._defaultClippingObjects.has(e)||!!(this._exclusiveClippingObjects&&this._exclusiveClippingObjects.includes(e))}setExclusiveClippingObjects(e,t){if(_(e,[Si]),_(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 G&&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=>{nr(s)}),this._targetsMap.forEach((s,r)=>{s.clippingPlaneCollection&&Io(r,s.clippingPlaneCollection,s.local)})}_clippingPlaneUpdated(e){this._targetsMap.forEach((t,s)=>{t===e&&e.clippingPlaneCollection&&Io(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}}function Qu(){return navigator.language?navigator.language.substring(0,2):"en"}class Lo{constructor(e){this._position=.5,this.scene=null,this.olMap=null,this.initialized=!1,this.leftScreenClippingObject=new Si,this.rightScreenClippingObject=new Si,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(_(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.imagerySplitPosition=e,this._updateClippingPlanes()):this.olMap&&this.olMap.render()}mapActivated(e){e instanceof G?(this.scene=e.getScene(),this.olMap=null,this._targetsChanged()):e instanceof ee&&(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 C(a*o,a*l,-1*s),c=new C(a*o,-1*a*l,-1*s);A.multiplyByPoint(e.inverseViewMatrix,h,h),A.multiplyByPoint(e.inverseViewMatrix,c,c);const u=e.positionWC;C.subtract(u,h,h),C.subtract(u,c,c);const d=C.cross(h,c,new C);C.normalize(d,d);const f=Kt.fromPointNormal(u,d);return ei.fromPlane(f)}_updateClippingPlanes(){const e=this._calcClippingPlane();this.leftScreenClippingObject.clippingPlaneCollection=new Qt({planes:[e]});const t=ei.clone(e);t.normal=C.negate(t.normal,t.normal),t.distance*=-1,this.rightScreenClippingObject.clippingPlaneCollection=new Qt({planes:[t]})}getClippingObjectForDirection(e){return _(e,[Y.LEFT,Y.RIGHT,Y.NONE]),e===Y.LEFT?this.leftScreenClippingObject:e===Y.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 D1(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 Cn extends _t{static from(e){const t=new Cn;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 Pu,this._layerCollection=new Tt,this.initializeError=new R,this.fallbackMapActivated=new R,this.mapActivated=new R,this.clippingObjectManager=new Ku(this._layerCollection),this._splitScreen=new Lo(this.clippingObjectManager),this._mapPointerListeners=[]}get activeMap(){return this._activeMap}get target(){return this._target}get layerCollection(){return this._layerCollection}set layerCollection(e){_(e,Tt),this._layerCollection=e,this._array.forEach(t=>{t.layerCollection=this._layerCollection})}get splitScreen(){return this._splitScreen}set splitScreen(e){_(e,Lo),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 Tt),super._remove(e)}_setActiveMapCSSClass(){if(this._target&&this._activeMap){const e=this._activeMap.className.split(".").pop();this._target.classList.add(e)}}setTarget(e){ie(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;Pe().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 Pe("MapCollection").warning(`could not find map with name ${e}`),Promise.resolve();this._activeMap&&this._activeMap.className==="CesiumMap"&&t.className==="OpenlayersMap"&&await D1(this._activeMap,t);try{await t.initialize()}catch(r){Pe("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 ar(){return Pe("init")}const vn=new Map;class F1{constructor(){this._id=Ye(),this._defaultDynamicContext=new Mo({id:"_defaultDynamicContext"}),this._dynamicContext=this._defaultDynamicContext;const e=()=>this._dynamicContext.id;this._locale=Qu(),this._localeChanged=new R,this._mapClassRegistry=new ft(ri),this._maps=ni(new Cn,e,null,pa.bind(null,this),Et),this._layerClassRegistry=new ft(oe),this._layers=ni(this._maps.layerCollection,e,hh.bind(null,this),ya.bind(null,this),he,ch),this._layers.locale=this.locale,this._obliqueCollections=ni(new _t,e,null,t=>new Nt(t),Nt),this._viewPoints=ni(new _t,e,null,lh,ot),this._styleClassRegistry=new ft(Gi),this._styles=ni(new _t,e,null,gt.bind(null,this._styleClassRegistry),nt),this._contexts=new Mi("id"),this._contexts.add(this._dynamicContext),this._categoryClassRegisty=new ft(zr),this._categories=new Su(this),this._destroyed=new R,this._contextMutationPromise=Promise.resolve(),this._categoryItemClassRegistry=new ft(new bt),this._tileProviderClassRegsitry=new ft(si),this._featureProviderClassRegsitry=new ft(kr),vn.set(this._id,this)}get id(){return this._id}get locale(){return this._locale}set locale(e){if(_(e,String),e.length!==2){ar().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 contextAdded(){return this._contexts.added}get contextRemoved(){return this._contexts.removed}get dynamicContextId(){return this._dynamicContext.id}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&&nh(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=>{ar().error(`Failed to activate active on startup layer ${r.name}`),ar().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 at).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 _(e,Mo),this._contextMutationPromise=this._contextMutationPromise.then(async()=>{if(this._contexts.has(e)){ar().info(`context with id ${e.id} already loaded`);return}await this._parseContext(e),await this._setContextState(e),this._contexts.add(e)}),this._contextMutationPromise}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){ar().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")}}),vn.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()}}function R1(i){return vn.get(i)}window.vcs=window.vcs||{},window.vcs.apps=vn;export{xi as AbstractFeatureProvider,_i as AbstractInteraction,hi as AltitudeModeCesium,So as AppBackedCategory,qs as BaseOLMap,ke as BitCounter,ns as CameraLimiter,fn as CameraLimiterMode,Dt as Category,Su as CategoryCollection,G as CesiumMap,Wt as CesiumTilesetCesiumImpl,St as CesiumTilesetLayer,bt as ClassRegistry,ci as ClassificationTypeCesium,Si as ClippingObject,Ku as ClippingObjectManager,p1 as ClusterContext,_t as Collection,Mo as Context,Mn as CoordinateAtPixel,or as CzmlLayer,Eu as DataSourceCesiumImpl,Ci as DataSourceLayer,ae as DataState,Me as DeclarativeStyleItem,ou as DefaultObliqueCollection,Pu as EventHandler,k as EventType,Ph as ExclusiveManager,pe as Extent,Ft as Extent3D,bu as FeatureAtPixelInteraction,vt as FeatureLayer,Ou as FeatureProviderInteraction,as as FeatureStoreLayer,Hu as FeatureStoreLayerChanges,yi as FeatureStoreLayerState,qr as FeatureVisibility,W as FeatureVisibilityAction,os as GeoJSONLayer,Wr as GlobalHider,Mi as IndexedCollection,wu as InteractionChain,he as Layer,Tt as LayerCollection,Ut as LayerImplementation,qc as LayerObliqueImpl,Ws as LayerOpenlayersImpl,K as LayerState,cr as MVTTileProvider,Cn as MapCollection,Je as MapState,le as ModificationKeyType,Nt as ObliqueCollection,ho as ObliqueDataSet,cn as ObliqueImage,Js as ObliqueImageMeta,at as ObliqueMap,hu as ObliqueProvider,Jc as ObliqueView,ue as ObliqueViewDirection,Ca as OlcsGeometryType,Iu as OpenStreetMapCesiumImpl,ls as OpenStreetMapLayer,$u as OpenStreetMapOpenlayersImpl,ee as OpenlayersMap,ft as OverrideClassRegistry,_a as PatternType,hs as PointCloudLayer,ze as PointerEventType,me as PointerKeyType,T as Projection,je as RasterLayer,vi as RasterLayerCesiumImpl,is as RasterLayerOpenlayersImpl,Lu as SingleImageCesiumImpl,lr as SingleImageLayer,Vu as SingleImageOpenlayersImpl,Lo as SplitScreen,ur as StaticGeoJSONTileProvider,nt as StyleItem,us as TMSLayer,Tu as TerrainCesiumImpl,cs as TerrainLayer,S1 as TileDebugOpenlayersImpl,We as TileProvider,mn as TileProviderFeatureProvider,Lt as TilingScheme,Du as TmsCesiumImpl,Bu as TmsOpenlayersImpl,hr as URLTemplateTileProvider,F1 as VcsApp,R as VcsEvent,Et as VcsMap,rt as VcsObject,Gc as VectorCesiumImpl,Ac as VectorContext,Ce as VectorLayer,no as VectorObliqueImpl,Ua as VectorOpenlayersImpl,et as VectorProperties,Gu as VectorRasterTileCesiumImpl,q as VectorStyleItem,Au as VectorTileImageryProvider,ds as VectorTileLayer,Uu as VectorTileOpenlayersImpl,ot as ViewPoint,Po as WFSLayer,Xt as WMSFeatureProvider,fs as WMSLayer,gs as WMTSLayer,ku as WmsCesiumImpl,qu as WmsOpenlayersImpl,zu as WmtsCesiumImpl,Wu as WmtsOpenlayersImpl,Vs as actuallyIsCircle,Yi as addPrimitiveToContext,tn as addPrimitivesToContext,Vt as alreadyTransformedToImage,xh as alreadyTransformedToMercator,Gr as angleEqualsEpsilon,Vr as blackColor,Nu as calculateMinLevel,kt as cartesian2DDistance,dl as cartesian3DDistance,zr as categoryClassRegistry,Pt as cesiumColorToColor,qt as cesiumTilesetLastUpdated,to as checkLineIntersection,ja as circleFromCenterRadius,bc as circleToCesium,nr as clearClippingPlanes,N0 as colorInCanvas,gh as combineFont,Le as contextIdSymbol,Fc as convert,Ha as convertGeometryToPolygon,Af as coordinateAtDistance,ma as coordinateEqualsEpsilon,ss as copyClippingPlanesToCollection,Lh as createClassificationPrimitive,T1 as createClippingFeature,P1 as createClippingPlaneCollection,Ia as createLinePrimitive,Nh as createOutlinePrimitive,fh as createPattern,Th as createPrimitive,bh as defaultDeclarativeStyle,A0 as defaultExtrudedHeightCondition,Xu as defaultPointCloudStyle,oi as defaultVectorStyle,ya as deserializeLayer,pa as deserializeMap,lh as deserializeViewPoint,mt as destroyCollection,Qu as detectBrowserLocale,Oa as doNotTransform,Pa as embedIconsInStyle,F0 as emptyColor,$r as emptyStyle,on as enforceEndingVertex,pc as enforceRightHand,ki as featureExists,yn as featureFromOptions,kr as featureProviderClassRegistry,Qe as featureStoreStateSymbol,vh as fromCesiumColor,gi as fvLastUpdated,Bs as getAltitudeModeOptions,Ec as getBillboardOptions,Ru as getCanvasFromFeatures,Nc as getCartesian3AndWGS84FromCoordinates,Qr as getCartesian3Options,ai as getCesiumColor,Jr as getClassificationTypeOptions,N1 as getClippingOptions,D0 as getCssStyleFromTextStyle,Q as getDefaultCondition,ah as getDefaultProjection,Sa as getDefaultVectorStyleItemOptions,kv as getDirectionName,mu as getEPSGCodeFromGeojson,xo as getExtentFromTileset,Hr as getFillOptions,qi as getFlatCoordinatesFromGeometry,za as getFlatCoordinatesFromSimpleGeometry,xu as getFormat,Ba as getGenericFeatureFromClickedObject,d1 as getGenericFeatureFromProvidedFeature,Fh as getHeightAboveGround,pi as getHeightFromTerrainProvider,en as getHeightInfo,ju as getJSONObjectFromObject,Ic as getLabelOptions,ch as getLayerIndex,$c as getLongestSide,Ih as getMaterialAppearance,Dh as getMinHeightOrGroundLevel,Lc as getModelOptions,Kr as getNearFarValueOptions,gt as getObjectFromClassRegistry,so as getPolygonizedGeometry,io as getResolutionOptions,Ma as getShapeFromOptions,Ks as getStateFromStatesArray,La as getStoreyHeights,Na as getStoreyOptions,Re as getStringColor,Hs as getStrokeOptions,Us as getStyleOrDefaultStyle,Ys as getStylesArray,Ji as getTerrainProviderForUrl,ph as getTextFromOptions,mh as getTextOptions,wo as getTilingScheme,Oo as getURL,R1 as getVcsAppById,ao as getVersionFromImageJson,po as getViewDirectionFromViewPoint,Co as getWMSSource,Vc as getZoom,Ge as globalHidden,Wi as globalHiderLastUpdated,x1 as globeLoaded,Hc as hasSameOrigin,dh as hexToOlColor,Ae as hidden,Ne as highlighted,Uc as imageGeometryToMercatorGeometry,Gf as initialBearingBetweenCoords,rr as isMobile,jr as isOverrideCollection,Mu as isProvidedFeature,ir as isSameOrigin,kc as isTerrainTileAvailable,bo as isTiledFeature,oe as layerClassRegistry,Za as lineStringToCesium,ni as makeOverrideCollection,ri as mapClassRegistry,Bc as mercatorGeometryToImageGeometry,F as mercatorProjection,sr as mercatorResolutionsToLevel,ua as mercatorToWgs84Transformer,Xr as obliqueGeometry,hn as obliqueViewDirectionNames,I0 as olColorToCesiumColor,va as olColorToHex,Bt as originalFeatureSymbol,pt as originalStyle,Zr as parseCartesian3,be as parseColor,T0 as parseFont,It as parseGeoJSON,oo as parseImageData,Xc as parseImageMeta,Yc as parseLegacyImageData,Yr as parseNearFarScalar,ui as parseStoreyHeights,Ja as pointToCesium,Wa as polygonToCesium,ga as propertyEqualsEpsilon,pn as rectangleToExtent,mi as removeArrayFromCollection,$a as removeEndingVertex,Va as removeEndingVertexFromGeometry,Xi as removeFeatureFromMap,Zc as requestArrayBuffer,yt as requestJson,lo as requestUrl,hh as serializeLayer,Io as setClippingPlanes,nh as setDefaultProjectionOptions,ro as setNewGeometry,Rc as setReferenceForPicking,yh as shapeCategory,Cu as showProvidedFeature,eo as sortRealWordEdgeCoordinates,Gi as styleClassRegistry,Ch as synchronizeFeatureVisibility,ln as synchronizeFeatureVisibilityWithSource,si as tileProviderClassRegistry,C1 as tiledLayerLoaded,Fu as toContext,zc as transformCWIFC,Ki as transformFromImage,zv as transformToImage,yc as updateFeatureVisibility,_c as updateGlobalHider,pu as updateLegacyFeature,wc as validateCircle,L0 as validateHexColor,Pc as validateLineString,Tc as validatePoint,Mc as validatePolygon,Ta as validateStoreys,z as vcsLayerName,ba as vcsMetaVersion,Te as vectorStyleSymbol,B as wgs84Projection,zs as wgs84ToMercatorTransformer,$s as whiteColor,o1 as writeGeoJSON,ts as writeGeoJSONFeature,Oh as writeStyle};