@arcgis/core 4.28.0-next.20230720 → 4.28.0-next.20230721

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 (261) hide show
  1. package/Color.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/arcade/arcadeCompiler.js +1 -1
  4. package/arcade/featureSetUtils.js +1 -1
  5. package/arcade/featureset/actions/Top.js +1 -1
  6. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  7. package/arcade/featureset/support/FeatureSet.js +1 -1
  8. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  9. package/arcade/functions/convertdirection.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/geomasync.js +1 -1
  12. package/arcade/functions/geomsync.js +1 -1
  13. package/arcade/lib/comment-handler.js +1 -1
  14. package/arcade/lib/parser.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/assets/esri/core/workers/RemoteClient.js +1 -1
  17. package/assets/esri/core/workers/chunks/{75c28da8d0b02d612d69.js → 040b3fc9c9c0736dd893.js} +1 -1
  18. package/assets/esri/core/workers/chunks/0652f6a8d5221e978033.js +1 -0
  19. package/assets/esri/core/workers/chunks/{c13b332afdb3f6be1ec9.js → 092fda62b6f62c2e4869.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{57e0ad037188bd2997e7.js → 0af18a96cbd4e2d35436.js} +1 -1
  21. package/assets/esri/core/workers/chunks/0b5eeec0f66c87a46a0c.js +1 -0
  22. package/assets/esri/core/workers/chunks/{68e568b67b6fb34393db.js → 0cad2b991d0d0fd07846.js} +1 -1
  23. package/assets/esri/core/workers/chunks/0dccbc6c2559fdc0c2ad.js +1 -0
  24. package/assets/esri/core/workers/chunks/256a82f6f6e1405fbcc6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{bb9213899049e1db90da.js → 2c57c9bd71637c5bed8a.js} +1 -1
  26. package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +1 -0
  27. package/assets/esri/core/workers/chunks/{2b1c83453a862e01954b.js → 2d9d80b2d0042a9c09fb.js} +1 -1
  28. package/assets/esri/core/workers/chunks/2f9aec2238ff6cb99e09.js +1 -0
  29. package/assets/esri/core/workers/chunks/{7dbd3e6406fb3e3a1a8f.js → 3cf748c025f3936c1cb2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/4481d1103363434f16da.js +1 -0
  31. package/assets/esri/core/workers/chunks/5ae325e6a795c72eac6c.js +1 -0
  32. package/assets/esri/core/workers/chunks/5e4dde2886a1027b4b96.js +1 -0
  33. package/assets/esri/core/workers/chunks/730eb7e5f617fdab4f10.js +1 -0
  34. package/assets/esri/core/workers/chunks/{5a2e6bed9431cf4f42b1.js → 740dc67038f554431f1b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{09178454bda15bb7929a.js → 7fbdfd1527582c52f9b6.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{1c026947505a9ff94a53.js → 807742f38885fa90b4fe.js} +1 -1
  37. package/assets/esri/core/workers/chunks/82dfbc175b52c7a10475.js +1 -0
  38. package/assets/esri/core/workers/chunks/870a05451e074b58f19a.js +1 -0
  39. package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
  40. package/assets/esri/core/workers/chunks/99a5a434e0bad48c7a5c.js +1 -0
  41. package/assets/esri/core/workers/chunks/9a5916c66dad91d01d5b.js +1 -0
  42. package/assets/esri/core/workers/chunks/9c133fd8c1fbd0295b86.js +1 -0
  43. package/assets/esri/core/workers/chunks/9cddb504079d396779ea.js +1 -0
  44. package/assets/esri/core/workers/chunks/a3a1d4f32e518e97d071.js +1 -0
  45. package/assets/esri/core/workers/chunks/{9548aa449fe3a300c015.js → a4fa40dc77e116c954ac.js} +1 -1
  46. package/assets/esri/core/workers/chunks/a54ec9929a7db879d5db.js +1 -0
  47. package/assets/esri/core/workers/chunks/afc5b84693757fda2bc8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{591b5c277cfd3a4101a4.js → b08f2a4aa94087c6c367.js} +1 -1
  49. package/assets/esri/core/workers/chunks/c0e12f6a7bb2360e4c21.js +1 -0
  50. package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +1 -0
  51. package/assets/esri/core/workers/chunks/d0e203405f95e14b1399.js +1 -0
  52. package/assets/esri/core/workers/chunks/{ec72f492f24e67e008ae.js → d8e58dc14d3495f0830c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ddc393a012588f799f42.js +1 -0
  54. package/assets/esri/core/workers/chunks/de3baa85b1639c25458d.js +1 -0
  55. package/assets/esri/core/workers/chunks/e66cea26064ba8353af0.js +1 -0
  56. package/assets/esri/core/workers/chunks/ea478f2f4a19463e13fd.js +1 -0
  57. package/assets/esri/core/workers/chunks/eba197e45507f56f3ed0.js +1 -0
  58. package/assets/esri/core/workers/chunks/ebd006fcd568a7731115.js +1 -0
  59. package/assets/esri/core/workers/chunks/ef9a9a7d66d818720e20.js +1 -0
  60. package/assets/esri/core/workers/chunks/f3b458f55236566c940b.js +1 -0
  61. package/assets/esri/core/workers/chunks/fd0a91b9e0216cc269c3.js +1 -0
  62. package/assets/esri/core/workers/chunks/{a4fe220a912b1f428e49.js → fdd6403a8390d629392b.js} +1 -1
  63. package/assets/esri/themes/base/widgets/_Directions.scss +13 -7
  64. package/assets/esri/themes/dark/main.css +1 -1
  65. package/assets/esri/themes/light/main.css +1 -1
  66. package/assets/esri/themes/light/view.css +1 -1
  67. package/chunks/array.js +1 -1
  68. package/core/Collection.js +1 -1
  69. package/core/accessorSupport/decorators/subclass.js +1 -1
  70. package/core/accessorSupport/ensureType.js +1 -1
  71. package/core/accessorSupport/get.js +1 -1
  72. package/core/accessorSupport/tracking.js +1 -1
  73. package/core/accessorSupport/utils.js +1 -1
  74. package/core/libs/rbush/PooledRBush.js +1 -1
  75. package/core/urlUtils.js +1 -1
  76. package/geometry/GeometryCursor.js +1 -1
  77. package/geometry/support/TileClipper.js +1 -1
  78. package/geometry/support/geodesicUtils.js +1 -1
  79. package/interfaces.d.ts +7 -1
  80. package/layers/LinkChartLayer.js +1 -1
  81. package/layers/VectorTileLayer.js +1 -1
  82. package/layers/VoxelLayer.js +1 -1
  83. package/layers/WCSLayer.js +1 -1
  84. package/layers/effects/EffectView.js +1 -1
  85. package/layers/graphics/sources/geojson/geojson.js +1 -1
  86. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  87. package/layers/mixins/ArcGISCachedService.js +1 -1
  88. package/layers/support/ElevationQuery.js +1 -1
  89. package/layers/support/MultidimensionalSubset.js +1 -1
  90. package/layers/support/TileInfo.js +1 -1
  91. package/layers/support/TileInfoTilemapCache.js +1 -1
  92. package/layers/support/TilemapCache.js +1 -1
  93. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  94. package/layers/support/rasterDatasets/pamParser.js +1 -1
  95. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  96. package/layers/support/rasterFormats/Raw.js +1 -1
  97. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  98. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  99. package/layers/support/rasterFunctions/colormaps.js +1 -1
  100. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  101. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  102. package/layers/video/VideoController.js +1 -1
  103. package/layers/voxel/VoxelDimension.js +1 -1
  104. package/layers/voxel/VoxelTransferFunctionStyle.js +1 -1
  105. package/layers/voxel/VoxelVolume.js +1 -1
  106. package/package.json +1 -1
  107. package/renderers/support/RasterSymbolizer.js +1 -1
  108. package/renderers/support/colorRampUtils.js +1 -1
  109. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  110. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  111. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  112. package/rest/support/generateRendererUtils.js +1 -1
  113. package/smartMapping/raster/renderers/classBreaks.js +1 -1
  114. package/smartMapping/renderers/color.js +1 -1
  115. package/smartMapping/renderers/support/utils.js +1 -1
  116. package/smartMapping/renderers/type.js +1 -1
  117. package/smartMapping/renderers/univariateColorSize.js +1 -1
  118. package/smartMapping/support/adapters/support/utils.js +1 -1
  119. package/statistics/utils.js +1 -1
  120. package/support/revision.js +1 -1
  121. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  122. package/symbols/cim/GeometryWalker.js +1 -1
  123. package/symbols/cim/cimAnalyzer.js +1 -1
  124. package/symbols/cim/effects/EffectArrow.js +1 -1
  125. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  126. package/symbols/support/symbolUtils.js +1 -1
  127. package/views/2d/constraints/ZoomConstraint.js +1 -1
  128. package/views/2d/engine/flow/dataUtils.js +1 -1
  129. package/views/2d/engine/flow/utils.js +1 -1
  130. package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
  131. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  132. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  133. package/views/2d/engine/vectorTiles/style/VectorTileSource.js +1 -1
  134. package/views/2d/engine/vectorTiles/tileInfoUtils.js +1 -1
  135. package/views/2d/engine/webgl/TurboLine.js +1 -1
  136. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  137. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  138. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  139. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  140. package/views/2d/layers/BaseLayerView2D.js +1 -1
  141. package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
  142. package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
  143. package/views/2d/layers/MediaLayerView2D.js +1 -1
  144. package/views/2d/layers/TileLayerView2D.js +1 -1
  145. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  146. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  147. package/views/2d/layers/features/support/rendererUtils.js +1 -1
  148. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  149. package/views/2d/layers/support/vectorTileDebugUtils.js +5 -0
  150. package/views/2d/tiling/TileInfoView.js +1 -1
  151. package/views/2d/tiling/TileInfoViewPOT.js +1 -1
  152. package/views/2d/tiling/TileQueue.js +1 -1
  153. package/views/2d/tiling.js +1 -1
  154. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  155. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  156. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  157. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  158. package/views/3d/layers/TiledLayerView3D.js +1 -1
  159. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  161. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  162. package/views/3d/layers/support/featureReference.js +1 -1
  163. package/views/3d/support/LaserLineRenderer.js +1 -1
  164. package/views/3d/terrain/Overlay.js +1 -1
  165. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  166. package/views/3d/terrain/OverlayRenderTarget.js +1 -1
  167. package/views/3d/terrain/OverlayRenderer.js +1 -1
  168. package/views/3d/terrain/TerrainRenderer.js +1 -1
  169. package/views/3d/terrain/TileCompositor.js +1 -1
  170. package/views/3d/terrain/TileRenderer.js +1 -1
  171. package/views/3d/terrain/TilingScheme.js +1 -1
  172. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  173. package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
  174. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  175. package/views/3d/webgl-engine/effects/SmaaRenderPass.js +1 -1
  176. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  177. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  178. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  179. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  180. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  181. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  182. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  183. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  184. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  185. package/views/3d/webgl-engine/parts/requireUtils.js +1 -1
  186. package/views/MapView.js +1 -1
  187. package/views/animation/pointToPoint/Path.js +1 -1
  188. package/views/draw/DrawOperation.js +1 -1
  189. package/views/draw/support/Reshape.js +1 -1
  190. package/views/draw/support/createUtils.js +1 -1
  191. package/views/interactive/SegmentLabels.js +1 -1
  192. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  193. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  194. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  195. package/views/layers/GroupLayerView.js +1 -1
  196. package/views/webgl/ProgramCache.js +1 -1
  197. package/webscene/spec-certification/api.js +1 -1
  198. package/webscene/spec-certification/spec.js +1 -1
  199. package/webscene/spec-certification/utils.js +1 -1
  200. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  201. package/widgets/BuildingExplorer/BuildingPhase.js +1 -1
  202. package/widgets/BuildingExplorer/support/validation.js +1 -1
  203. package/widgets/Directions/support/resources.js +1 -1
  204. package/widgets/Directions.js +1 -1
  205. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  206. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  207. package/widgets/FeatureForm/FieldInput.js +1 -1
  208. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  209. package/widgets/FeatureForm.js +1 -1
  210. package/widgets/Features.js +1 -1
  211. package/widgets/Histogram/HistogramViewModel.js +1 -1
  212. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  213. package/widgets/Legend/styles/Card.js +1 -1
  214. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  215. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  216. package/widgets/Legend/support/colorRampUtils.js +1 -1
  217. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  218. package/widgets/Legend/support/utils.js +1 -1
  219. package/widgets/Popup.js +1 -1
  220. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  221. package/widgets/ScaleRangeSlider/ScaleRanges.js +1 -1
  222. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  223. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  224. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  225. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  226. package/widgets/smartMapping/SizeSlider.js +1 -1
  227. package/widgets/smartMapping/SmartMappingPrimaryHandleSliderViewModel.js +1 -1
  228. package/widgets/smartMapping/SmartMappingSliderViewModel.js +1 -1
  229. package/assets/esri/core/workers/chunks/0210f4c2e1f3ed13041b.js +0 -1
  230. package/assets/esri/core/workers/chunks/07bb40162d97d098bc19.js +0 -1
  231. package/assets/esri/core/workers/chunks/0a18317566c1fcb68422.js +0 -1
  232. package/assets/esri/core/workers/chunks/0de65e03db8c611af9fb.js +0 -1
  233. package/assets/esri/core/workers/chunks/1a60d23a92bcf91dbb22.js +0 -1
  234. package/assets/esri/core/workers/chunks/205a0b34b698d5329854.js +0 -1
  235. package/assets/esri/core/workers/chunks/25211d5904ee9d5f4a9d.js +0 -1
  236. package/assets/esri/core/workers/chunks/26b12d1ea713c1e07701.js +0 -1
  237. package/assets/esri/core/workers/chunks/2bfa7ee324c32a56b0d3.js +0 -1
  238. package/assets/esri/core/workers/chunks/4510a17839405146130b.js +0 -1
  239. package/assets/esri/core/workers/chunks/524156c3f5383c2dd0e3.js +0 -1
  240. package/assets/esri/core/workers/chunks/59666ecb7c2c1f5a13b2.js +0 -1
  241. package/assets/esri/core/workers/chunks/5c005c9514354c77ec27.js +0 -1
  242. package/assets/esri/core/workers/chunks/620ec5c75561183d3d73.js +0 -1
  243. package/assets/esri/core/workers/chunks/68512670816f59c0e6a5.js +0 -1
  244. package/assets/esri/core/workers/chunks/6c7374ebc18b46b3480a.js +0 -1
  245. package/assets/esri/core/workers/chunks/75ba2af92da232067adb.js +0 -1
  246. package/assets/esri/core/workers/chunks/7c1f0598a016516dcec3.js +0 -1
  247. package/assets/esri/core/workers/chunks/8dcec8d1b670d2b7ea2b.js +0 -1
  248. package/assets/esri/core/workers/chunks/8e07dfb6fc2673b640cb.js +0 -1
  249. package/assets/esri/core/workers/chunks/9050b167355588b7003d.js +0 -1
  250. package/assets/esri/core/workers/chunks/9230d68799f0b0b9ef36.js +0 -1
  251. package/assets/esri/core/workers/chunks/af4083f2aad5f5d49dde.js +0 -1
  252. package/assets/esri/core/workers/chunks/b0a57718a0765d1c8df0.js +0 -1
  253. package/assets/esri/core/workers/chunks/b431b81a7bf45dd527da.js +0 -1
  254. package/assets/esri/core/workers/chunks/bda311ad48efdb265939.js +0 -1
  255. package/assets/esri/core/workers/chunks/d5cce09fbe16cbb8fee4.js +0 -1
  256. package/assets/esri/core/workers/chunks/da547c3cabe4a89c3ce6.js +0 -1
  257. package/assets/esri/core/workers/chunks/dd295fa57b45b7ec4ec5.js +0 -1
  258. package/assets/esri/core/workers/chunks/f553b464e969d45bf451.js +0 -1
  259. package/assets/esri/core/workers/chunks/f5865294983eb160de8c.js +0 -1
  260. package/assets/esri/core/workers/chunks/fdb7b1fbdb6fe091ad83.js +0 -1
  261. package/views/2d/tiling/PagedTileQueue.js +0 -5
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7794],{28924:(e,t,i)=>{i.d(t,{Z:()=>s});class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}},67651:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>se,constructFeatureSet:()=>te,constructFeatureSetFromPortalItem:()=>he,constructFeatureSetFromRelationship:()=>re,constructFeatureSetFromUrl:()=>ee,convertToFeatureSet:()=>ue,createFeatureSetCollectionFromMap:()=>le,createFeatureSetCollectionFromService:()=>oe,initialiseMetaDataCache:()=>X});var s=i(3172),r=i(28924),n=i(61363),a=i(84328),l=i(38171),o=i(70409),u=i(85065),h=i(59987),c=i(91136),d=i(90961),f=i(3823),p=i(90658),_=i(36515),y=i(95002),g=i(41534);class m{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i){const s=new m;s.field=e;const r=g.WhereClause.create(t,i),n=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new h.eS(h.f.MissingStatisticParameters);const t=g.WhereClause.create((0,_.XF)(e.parseTree.args.value[0],p.Bj.Standardised,e.parameters),e.fieldsIndex);return{name:e.parseTree.name,expr:t}}return null}(r);if(null===n)throw new h.eS(h.f.UnsupportedSqlFunction,{function:""});const a=n.name.toUpperCase().trim();if("MIN"===a){if(s.typeofstat="MIN",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:"min"})}else if("MAX"===a){if(s.typeofstat="MAX",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===a)s.typeofstat="COUNT",s.workingexpr=n.expr;else if("STDEV"===a){if(s.typeofstat="STDDEV",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===a){if(s.typeofstat="SUM",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===a){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:a})}else if("AVG"===a){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==a)throw new h.eS(h.f.UnsupportedSqlFunction,{function:a});if(s.typeofstat="VAR",s.workingexpr=n.expr,null===r)throw new h.eS(h.f.InvalidFunctionParameters,{function:"var"})}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}var w=i(44543),b=i(82971),S=i(1231),F=i(99514);function v(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class I extends c.Z{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return p.dj.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new F.Z([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s),t.typeofstat=v(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s)};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null}else this.geometryType=p.Qk.point,this.typeIdField="",this.types=null,this.spatialReference=new b.Z({wkid:4326});this.fields=[];const r=new m;r.field=this._nextUniqueName(e),r.tofieldname=this.objectIdField,r.workingexpr=g.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex()),r.typeofstat="MIN",this._decodedStatsfield.push(r);for(const t of this._decodedGroupbyfield){const i=new S.Z;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,_.y5)(t.expression)){const e=this._parent.getField((0,_.zR)(t.expression,p.Bj.Standardised));if(!e)throw new h.EN(h.H9.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type}else{i.type=this._convertToEsriFieldType((0,_.DT)(t.expression,this._parent.fields));const e=new S.Z;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new o.yN(e,t.expression)),this._candosimplegroupby=!1}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new o.$X(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new S.Z;let s=null;const r=this._decodedStatsfield[t];r.field=this._nextUniqueName(e),r.tofieldname===this.objectIdField&&(this._internalObjectIdField=r.field),i.name=r.tofieldname,i.alias=i.name;const n=null!==r.workingexpr&&(0,_.y5)(r.workingexpr)?(0,_.zR)(r.workingexpr,p.Bj.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(s=this._parent.getField(n),!s)throw new h.EN(h.H9.AggregationFieldNotFound);i.type=s.type}else i.type="double";break;case"MIN":case"MAX":if(""!==n){if(s=this._parent.getField(n),!s)throw new h.EN(h.H9.AggregationFieldNotFound);i.type=s.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(s=this._parent.getField(n),!s))throw new h.EN(h.H9.AggregationFieldNotFound);i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const r=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,r)?(await this._expandPagedSet(e,r,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,r){if(""!==e)return new d.Z([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,_.hq)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==s){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,l.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(r),n=!0===l.nowhereclause?new d.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new d.Z(a._candidates.slice(0),a._known.slice(0),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let h=this._parent;if(this._adaptedFields.length>0&&(h=new o.Xx({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new d.Z(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.Z({parentfeatureset:h,orderbyclause:new f.Z(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=h;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a.Z({parentfeatureset:e,whereclause:t})}n=new d.Z(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.Z({parentfeatureset:e,orderbyclause:new f.Z(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,_.bB)(e,t.tofieldname,(0,_.zR)(t.workingexpr,p.Bj.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,_.bB)(e,t.tofieldname,(0,_.zR)(t.expression,p.Bj.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const e of s){const t={geometry:e.geometry,attributes:{}},i={};for(const t in e.attributes)i[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.Z(t)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((r,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?r(s.length):this._nextAggregateItem(e,t,i,s,(n=>{null===n?r(s.length):(t-=1,r(this._sequentialGetPhysicalItem(e,t,i,s)))}),n)}))}_nextAggregateItem(e,t,i,s,r,a){try{(0,n.$)(e.pagesDefinition.internal.iterator.next()).then((n=>{if(null===n)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const l=this._generateAggregateHash(n);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[n],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[n],id:l},void r(i)}e.pagesDefinition.internal.workingItem.features.push(n)}this._nextAggregateItem(e,t,i,s,r,a)}}),a)}catch(e){a(e)}}_calculateFieldStat(e,t,i){const s=[];for(let i=0;i<e.features.length;i++)if(null!==t.workingexpr){const r=t.workingexpr.calculateValue(e.features[i]);null!==r&&s.push(r)}else s.push(null);switch(t.typeofstat){case"MIN":i.attributes[t.tofieldname]=(0,y.tj)("min",s,-1);break;case"MAX":i.attributes[t.tofieldname]=(0,y.tj)("max",s,-1);break;case"SUM":i.attributes[t.tofieldname]=(0,y.tj)("sum",s,-1);break;case"COUNT":i.attributes[t.tofieldname]=s.length;break;case"VAR":i.attributes[t.tofieldname]=(0,y.tj)("var",s,-1);break;case"STDDEV":i.attributes[t.tofieldname]=(0,y.tj)("stddev",s,-1);break;case"AVG":i.attributes[t.tofieldname]=(0,y.tj)("avg",s,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.features[0].attributes[i.singlefield]:i.expression.calculateValue(e.features[0]);t.attributes[i.tofieldname]=s}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let s=0;s<this._decodedStatsfield.length;s++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[s],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.Z({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return(0,w.F)(t,w.M.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){c.Z._featuresetFunctions.groupby=function(e,t){return new I({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var C=i(53073),D=i(63991),R=i(40330),x=i(80692),T=i(33586),k=i(33955),E=i(19238),N=i(30359),A=i(20102),O=i(80442),L=i(95330),P=i(2981),Z=i(10158),j=i(4967),G=i(53261),M=i(74889),B=i(14165);function q(e,t){return null!=t&&!0===e.returnGeometry&&"xyFootprint"!==e.multipatchOption&&!e.outStatistics}i(68773),i(67676),i(17452),i(98326),i(56545);var U=i(41818),W=(i(66577),i(16306),i(45091),i(67900),i(8744),i(2109),i(5396)),V=(i(98732),i(75935)),z=(i(28141),i(58539));class Q extends c.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,this._cachedDateMetaData={},e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.tI}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,p.hd)(e.toJSON());return(0,w.F)(t,w.M.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=p.Bj.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=p.Bj.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=p.Bj.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=p.Bj.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._layer instanceof N.default?(this.typeIdField=this._layer.subtypeField??"",this.types=this._layer.subtypes):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types)}_isInFeatureSet(){return p.dj.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new B.Z;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){const t=this._layer?.capabilities?.query;return!e.outStatistics&&!0===t?.supportsFormatPBF&&!0===t?.supportsQuantizationEditMode}async queryPBF(e){return e.quantizationParameters={mode:"edit"},(await async function(e,t,s,r){return async function(e,t,s,r){const n=s?.infoFor3D;if(!(q(e,n)&&null!=n&&t.assetMaps&&t.features&&t.features.length))return M.Z.fromJSON(t);const{meshFeatureSetFromJSON:a}=await(0,L.Hl)(Promise.all([i.e(6481),i.e(6459),i.e(6399),i.e(448)]).then(i.bind(i,70558)),r);return a(e,n,t)}(t,await async function(e,t,i,s){const r={...s},n=function(e,t){let i=B.Z.from(e);i.sourceSpatialReference=i.sourceSpatialReference??t?.sourceSpatialReference??null,(t?.gdbVersion||t?.dynamicDataSource)&&(i=i===e?i.clone():i,i.gdbVersion=e.gdbVersion||t.gdbVersion,i.dynamicDataSource=e.dynamicDataSource?Z.n.from(e.dynamicDataSource):t.dynamicDataSource);const s=t?.infoFor3D;if(null!=s&&q(e,s)){i=i===e?i.clone():i,i.formatOf3DObjects=null;const{supportedFormats:t,queryFormats:r}=s,n=(0,P.S0)("model/gltf-binary",t)??(0,P.Ow)("glb",t),a=(0,P.S0)("model/gltf+json",t)??(0,P.Ow)("gtlf",t);for(const e of r){if(e===n){i.formatOf3DObjects=e;break}e!==a||i.formatOf3DObjects||(i.formatOf3DObjects=e)}if(!i.formatOf3DObjects)throw new A.Z("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(null==i.outFields||!i.outFields.includes("*")){i=i===e?i.clone():i,null==i.outFields&&(i.outFields=[]);const{originX:t,originY:r,originZ:n,translationX:a,translationY:l,translationZ:o,scaleX:u,scaleY:h,scaleZ:c,rotationX:d,rotationY:f,rotationZ:p,rotationDeg:_}=s.transformFieldRoles;i.outFields.push(t,r,n,a,l,o,u,h,c,d,f,p,_)}}return i}(t,i),a=null!=t.outStatistics?.[0],l=(0,O.Z)("featurelayer-pbf-statistics"),o=!a||l;let u;if("pbf"===i?.format&&o)try{u=await(0,G.t)(e,n,r)}catch(e){if("query:parsing-pbf"!==e.name)throw e;i.format="json"}return"json"!==i?.format&&o||(u=await(0,j.F)(e,n,r)),function(e,t){if(null!=e&&null!=t)for(const i of t){const t=e.get(i.name);t&&Object.assign(i,t.toJSON())}}(i?.fieldsIndex,u.fields),u}(e,t,s,r),s,r)}(this._layer.parsedUrl,e,{format:"pbf"},{})).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){e.returnZ=this.hasZ,e.returnM=this.hasM;const i="execute"===t?j.e:"executeForCount"===t?U.P:W.G,s="execute"===t&&this.pbfSupportedForQuery(e);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(t,r),r=r.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),r}async _getFilteredSet(e,t,i,s,r){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new d.Z([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new B.Z;this.datesInUnknownTimezone&&(o.timeReferenceUnknownClient=!0),o.where=null===i?null===t?"1=1":"":(0,_.zR)(i,n),this._requestStandardised&&(o.sqlFormat="standard"),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(r),new d.Z([],u,l,null)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=s.constructClause(),a=!0);const l=await this.databaseType();let o=null===i?null===t?"1=1":"":(0,_.zR)(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(o=""!==o?"(("+this._layer.definitionExpression+") AND ("+o+"))":this._layer.definitionExpression);let u=this._maxQueryRate();const h=this._layer.capabilities?.query.maxRecordCount;null!=h&&h<u&&(u=h);let c=null;if(!0===this._pageJustIds)c=new d.Z([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const s=this._overrideFields??this._fieldsIncludingObjectId(["*"]);c=new d.Z([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:s.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(c,u,0,1,r),c}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=new B.Z;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=e.pagesDefinition.where,a.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[r+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFeatures(e,t,i,s){const r=[];if(-1!==t&&void 0===this._featureCache[t]&&r.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,s),this._getFeatures(e,t,i,s);let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[s]]){let i=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[s]]){const r=t._featureMap[e._known[s]];null!==r&&(i=!0,this._featureCache[e._known[s]]=r)}}if(!1===i&&(e._known[s]!==t&&r.push(e._known[s]),r.length>=this._maxProcessingRate()-1))break}if(n>=i&&0===r.length)break}if(0===r.length)return"success";const a=new B.Z;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.objectIds=r,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(s),void 0!==l.error)throw new h.EN(h.H9.RequestFailed,{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,s,r,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=i.parseTree.column;const d=this._layer.fields??[];for(let e=0;e<d.length;e++)if(d[e].name.toLowerCase()===c.toLowerCase()){c=d[e].name;break}const f=new B.Z;this._requestStandardised&&(f.sqlFormat="standard"),this.datesInUnknownTimezone&&(f.timeReferenceUnknownClient=!0);let p=null===n?null===r?"1=1":"":(0,_.zR)(n,u);this._layer.definitionExpression&&this._useDefinitionExpression&&(p=""!==p?"(("+this._layer.definitionExpression+") AND ("+p+"))":this._layer.definitionExpression),f.where=p,f.spatialRelationship=this._makeRelationshipEnum(s),f.relationParameter=this._makeRelationshipParam(s),f.geometry=null===r?null:r,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[c];const y=await this.executeQuery(f,"execute");if(this._checkCancelled(o),!y.hasOwnProperty("features"))throw new h.EN(h.H9.InvalidStatResponse);let g=!1;for(let e=0;e<d.length;e++)if(d[e].name===c){"date"===d[e].type&&(g=!0);break}for(let e=0;e<y.features.length;e++){if(g){const t=y.features[e].attributes[c];null!==t?l.push(new Date(t)):l.push(t)}else l.push(y.features[e].attributes[c]);if(l.length>=a)break}return 0===y.features.length?l:y.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+y.features.length,t,i,s,r,n,a,l,o)}:l}async _distinctStat(e,t,i,s,r,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,s,r,n,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,i,s){const r=await this.databaseType(),n=new B.Z;if(this._requestStandardised&&(n.sqlFormat="standard"),this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};let a=null===s?null===i?"1=1":"":(0,_.zR)(s,r);return this._layer.definitionExpression&&this._useDefinitionExpression&&(a=""!==a?"(("+this._layer.definitionExpression+") AND ("+a+"))":this._layer.definitionExpression),n.where=a,this.datesInUnknownTimezone&&(n.timeReferenceUnknownClient=!0),n.where=a,n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===i?null:i,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,i,s,r,n,a){await this._ensureLoaded();const l=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression,o=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics,u=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsDistinct;if("count"===e)return u?this._countstat(e,i,s,r):{calculated:!1};if(!1===o||!1===(0,_.y5)(t)&&!1===l||!1===t.isStandardized)return""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===u?""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,i,s,r,n,a);const c=await this.databaseType();if(this.isTable()&&s&&null!==i&&""!==i)return{calculated:!0,result:null};const d=new B.Z;this._requestStandardised&&(d.sqlFormat="standard");let f=null===r?null===s?"1=1":"":(0,_.zR)(r,c);this._layer.definitionExpression&&this._useDefinitionExpression&&(f=""!==f?"(("+this._layer.definitionExpression+") AND ("+f+"))":this._layer.definitionExpression),d.where=f,d.spatialRelationship=this._makeRelationshipEnum(i),d.relationParameter=this._makeRelationshipParam(i),d.geometry=null===s?null:s,this.datesInUnknownTimezone&&(d.timeReferenceUnknownClient=!0);const p=new z.Z;p.statisticType=(0,y.g3)(e),p.onStatisticField=(0,_.zR)(t,c),p.outStatisticFieldName="ARCADE_STAT_RESULT",d.returnGeometry=!1;let g="ARCADE_STAT_RESULT";d.outStatistics=[p];const m=await this.executeQuery(d,"execute");if(!m.hasOwnProperty("features")||0===m.features.length)throw new h.EN(h.H9.InvalidStatResponse);let w=!1;const b=m.fields??[];for(let e=0;e<b.length;e++)if("ARCADE_STAT_RESULT"===b[e].name.toUpperCase()){g=b[e].name,"date"===b[e].type&&(w=!0);break}if(w){let e=m.features[0].attributes[g];return null!==e&&(e=new Date(m.features[0].attributes[g])),{calculated:!0,result:e}}return{calculated:!0,result:m.features[0].attributes[g]}}_stat(e,t,i,s,r,n,a){return this._stats(e,t,i,s,r,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const s=this._layer.capabilities?.query,r=!0===s?.supportsSqlExpression;if(null!=s&&!0===s.supportsStatistics&&!0===s.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,_.y5)(t[e].workingexpr)&&!1===r)&&(i=!1);return!1!==i}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,h=!1;null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=n.constructClause(),h=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(h=!1,u=!0,o=this._layer.objectIdField);const c=[];for(let e=0;e<t.length;e++){const i=new z.Z;i.onStatisticField=null!==t[e].workingexpr?(0,_.zR)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),c.push(i)}""===o&&(o=e.join(","));let f=this._maxQueryRate();const p=this._layer.capabilities?.query.maxRecordCount;null!=p&&p<f&&(f=p);let y=null===r?null===s?"1=1":"":(0,_.zR)(r,l);return this._layer.definitionExpression&&this._useDefinitionExpression&&(y=""!==y?"(("+this._layer.definitionExpression+") AND ("+y+"))":this._layer.definitionExpression),new d.Z([],["GETPAGES"],h,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:u,generatedOid:a,resultRecordCount:f,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:c,geometry:null===s?null:s,where:y,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,i){let s=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(s=""!==s?"("+s+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const r=e.pagesDefinition.internal.lastRetrieved,n=r,a=e.pagesDefinition.internal.lastPage,o=new B.Z;if(this._requestStandardised&&(o.sqlFormat="standard"),o.where=s,o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,this.datesInUnknownTimezone&&(o.timeReferenceUnknownClient=!0),o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new h.EN(h.H9.InvalidStatResponse);const c=[];if(e.pagesDefinition.internal.lastPage!==a)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[n+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)c.push(new l.Z({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,i,s,r){const n=new E.default({url:e,outFields:null===t?["*"]:t});return new Q({layer:n,spatialReference:i,lrucache:s,interceptor:r})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON&&this._layer.source.sourceJSON.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,p.US)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,s,r){const n=this._layer.capabilities;if(n?.data.supportsAttachment&&n?.operations.supportsQueryAttachments){const n={objectIds:[e],returnMetadata:r};(t&&t>0||i&&i>0)&&(n.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(n.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:n,method:"attachments"});const a=await this._layer.queryAttachments(n),l=[];return a&&a[e]&&a[e].forEach((t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let s=null;r&&t.exifInfo&&(s=T.Z.convertJsonToArcade(t.exifInfo,"system",!0)),l.push(new x.Z(t.id,t.name,t.contentType,t.size,i,s,t.keywords??null))})),l}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields?.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=JSON.stringify(e.outSpatialReference.toJSON())),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,s.Z)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t&&t.relatedRecordGroups){const i=t.spatialReference;for(const s of t.relatedRecordGroups){const r=s.objectId,n=[];for(const e of s.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.Z({geometry:e.geometry?(0,k.im)(e.geometry):null,attributes:e.attributes});n.push(t)}e[r]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new h.EN(h.H9.InvalidRequest)}async getFeatureByObjectId(e,t){const i=new B.Z;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.datesInUnknownTimezone&&(i.timeReferenceUnknownClient=!0),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await(0,j.e)(this._layer.parsedUrl.path,i);return 1===s.features.length?s.features[0]:null}async getIdentityUser(){await this.load();const e=R.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=R.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const e=await(0,s.Z)(t,{query:{f:"json"}});let i="";return e.data&&e.data.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new Q({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeReference(){return void 0===this._cachedDateMetaData.preferredTimeReference&&(this._cachedDateMetaData.preferredTimeReference=this._layer?.preferredTimeReference?.toJSON()??null),this._cachedDateMetaData.preferredTimeReference}get dateFieldsTimeReference(){return void 0===this._cachedDateMetaData.dateFieldsTimeReference&&(this._cachedDateMetaData.dateFieldsTimeReference=this._layer?.dateFieldsTimeReference?.toJSON()??null),this._cachedDateMetaData.dateFieldsTimeReference}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone}get editFieldsInfo(){return void 0===this._cachedDateMetaData.editFieldsInfo&&(this._cachedDateMetaData.editFieldsInfo=this._layer?.editFieldsInfo?.toJSON()??null),this._cachedDateMetaData.editFieldsInfo}get timeInfo(){return void 0===this._cachedDateMetaData.timeInfo&&(this._cachedDateMetaData.timeInfo=this._layer?.timeInfo?.toJSON()??null),this._cachedDateMetaData.timeInfo}}var J=i(17805);class H extends c.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.tI}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer?.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(0),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return p.dj.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new l.Z({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new d.Z([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new d.Z([],[],!0,null);if(n.capabilities?.queryRelated&&n.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&n.capabilities&&n.capabilities.queryRelated&&!0===n.capabilities.queryRelated.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new V.default;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let h=!0;!0===this._removeGeometry&&(h=!1),o.returnGeometry=h,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null;const c=await n.source.queryRelatedFeatures(o);this._checkCancelled(r);const f=c[this._findObjectId]?c[this._findObjectId].features:[],p=[];for(let e=0;e<f.length;e++)this._featureCache[f[e].attributes[this._relatedLayer.objectIdField]]=f[e],p.push(f[e].attributes[this._relatedLayer.objectIdField]);const _=t&&null!==e&&""!==e,y=null!=i;return new d.Z(_||y?p:[],_||y?[]:p,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==s&&l&&l.capabilities?.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const h=t&&null!==e&&""!==e,c=null!=i;let f=null,p=!0;!0===this._removeGeometry&&(p=!1);const _=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return f=new d.Z(h||c?["GETPAGES"]:[],h||c?[]:["GETPAGES"],a,{outFields:_.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:p,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(f,o,0,0,r),f}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new V.default;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await a.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[r+t]=u[t].attributes[this._relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this._relatedLayer.objectIdField]]=u[e];const h=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&h&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,s){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let a=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[s]&&void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>i)))&&!(a>=i&&0===r.length);s++);if(0===r.length)return"success";throw new h.EN(h.H9.MissingFeatures)}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,r,n,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,r){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,r){return this._relatedLayer.queryAttachments(e,t,i,s,r)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeReference(){return this._relatedLayer?.preferredTimeReference??null}get dateFieldsTimeReference(){return this._relatedLayer?.dateFieldsTimeReference??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}}var K=i(48039),$=i(15235);function X(){null===K.Z.applicationCache&&(K.Z.applicationCache=new K.Z)}async function Y(e,t){if(K.Z.applicationCache){const i=K.Z.applicationCache.getLayerInfo(e);if(i){const s=await i;return new E.default({url:e,outFields:t,sourceJSON:s})}const s=new E.default({url:e,outFields:t}),r=(async()=>(await s.load(),s.sourceJSON))();if(K.Z.applicationCache){K.Z.applicationCache.setLayerInfo(e,r);try{return await r,s}catch(t){throw K.Z.applicationCache.clearLayerInfo(e),t}}return await r,s}return new E.default({url:e,outFields:t})}async function ee(e,t,i,s,r,n=null){return te(await Y(e,["*"]),t,i,s,r,n)}function te(e,t=null,i=null,s=!0,r=null,a=null){if(e instanceof E.default||(0,n.Z)(e)){const n={layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:a};return 1==!(e.url||!e.source)?new J.Z(n):new Q(n)}return te(e.parent,t,i,s,r,a).filter(g.WhereClause.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),e.parent?.fieldsIndex))}async function ie(e){if(null!==K.Z.applicationCache){const t=K.Z.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,s.Z)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==K.Z.applicationCache){K.Z.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw K.Z.applicationCache.clearLayerInfo(e),t}}return t}async function se(e,t){const i={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},r=await ie(e);if(i.metadata=r,r.controllerDatasetLayers&&void 0!==r.controllerDatasetLayers.utilityNetworkLayerId&&null!==r.controllerDatasetLayers.utilityNetworkLayerId){if(r.layers)for(const e of r.layers)i.layerNameLkp[e.id]=e.name;if(r.tables)for(const e of r.tables)i.layerNameLkp[e.id]=e.name;const n=r.controllerDatasetLayers.utilityNetworkLayerId;i.networkId=n;const a=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==K.Z.applicationCache){const e=K.Z.applicationCache.getLayerInfo(i);if(null!==e)return e}const r=(async()=>{const i=await(0,s.Z)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements&&e.layerDataElements[0])return e.layerDataElements[0]}throw new h.EN(h.H9.DataElementsNotFound)})();if(null!==K.Z.applicationCache){K.Z.applicationCache.setLayerInfo(i,r);try{return await r}catch(e){throw K.Z.applicationCache.clearLayerInfo(i),e}}return r}(e,n);if(a){i.queryelem=a,i.queryelem&&i.queryelem.dataElement&&void 0!==i.queryelem.dataElement.schemaGeneration&&(i.unVersion=i.queryelem.dataElement.schemaGeneration),i.lkp={},i.queryelem.dataElement.domainNetworks||(i.queryelem.dataElement.domainNetworks=[]);for(const e of i.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}}if(i.queryelem.dataElement.terminalConfigurations)for(const e of i.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)i.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const r=await async function(e){if(null!==K.Z.applicationCache){const t=K.Z.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,s.Z)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==K.Z.applicationCache){K.Z.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw K.Z.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+n);if(r.systemLayers&&void 0!==r.systemLayers.associationsTableId&&null!==r.systemLayers.associationsTableId){const s=[];i.unVersion>=4&&(s.push("STATUS"),s.push("PERCENTALONG"));let n=await ee(e+"/"+r.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...s],!1,null,null);return await n.load(),i.unVersion>=4&&(n=n.filter(g.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62,63)",n.getFieldsIndex())),await n.load()),{lkp:i.lkp,associations:n,unVersion:i.unVersion,terminals:i.terminals}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}async function re(e,t,i,s=null,r=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await ee(o,s,r,n,a,l);return new H({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:s,outFields:r,includeGeometry:n,lrucache:a,interceptor:l})}a.Z.registerAction(),I.registerAction(),u.Z.registerAction(),C.Z.registerAction(),D.Z.registerAction();class ne extends r.Z{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=te(e,this._overridespref,null===i?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=[],a=this._map.allLayers.find((t=>{if(t instanceof E.default){if(t.title===e)return!0}else if((0,n.Z)(t)){if(t.title===e)return!0;r.push(t)}return!1}));if(a)return this._makeAndAddFeatureSet(a,t,i);if(this._map.tables){const s=this._map.tables.find((t=>!!(t.title&&t.title===e||t.title&&t.title===e)));if(s){if(s instanceof E.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e=s.outFields?s:{...s,outFields:["*"]};s._materializedTable=new E.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}for(const s of r){if("not-loaded"===s.loadStatus||"loading"===s.loadStatus)try{await s.load()}catch(e){}const r=s.sublayers.find((t=>t.title===e));if(r)return this._makeAndAddFeatureSet(r,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=[],a=this._map.allLayers.find((t=>{if(t instanceof E.default){if(t.id===e)return!0}else if((0,n.Z)(t)){if(t.id===e)return!0;r.push(t)}return!1}));if(a)return this._makeAndAddFeatureSet(a,t,i);if(this._map.tables){const s=this._map.tables.find((t=>t.id===e));if(s){if(s instanceof E.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e={...s,outFields:["*"]};s._materializedTable=new E.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}for(const s of r){if("not-loaded"===s.loadStatus||"loading"===s.loadStatus)try{await s.load()}catch(e){}const r=s.sublayers.find((t=>t.id===e));if(r)return this._makeAndAddFeatureSet(r,t,i)}return null}}class ae extends r.Z{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=te(e,this._overridespref,null===i?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await ie(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ae(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers??[])t.name===e&&(n=t);if(!n)for(const t of r.tables??[])t.name===e&&(n=t);if(n){const e=await Y(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of r.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await Y(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}}function le(e,t,i=null,s=null){return new ne(e,t,i,s)}function oe(e,t,i=null,s=null){return new ae(e,t,i,s)}function ue(e,t,i,s,r){if(null===e)return null;if(e instanceof E.default){switch(t){case"datasource":return te(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return te(e,r,e.outFields,!0,i,s)}return null}if((0,n.Z)(e)){switch(t){case"datasource":return te(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return te(e,r,e.outFields,!0,i,s)}return null}if((0,n._)(e)){switch(t){case"datasource":return te(e.parent,r,e.parent.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return te(e,r,e.parent.outFields,!0,i,s)}return null}if(e instanceof c.Z)switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}async function he(e,t,i,s,r,n,a,l=null){if(K.Z.applicationCache){const o=K.Z.applicationCache.getLayerInfo(e+":"+n.url);if(o){const e=await o;return te(new E.default({url:(0,p.US)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}}const o=new $.default({id:e,portal:n}).load();K.Z.applicationCache&&K.Z.applicationCache.setLayerInfo(e+":"+n.url,o);try{const e=await o;return te(new E.default({url:(0,p.US)(e.url??"")+"/"+t,outFields:["*"]}),i,s,r,a,l)}catch(t){throw K.Z.applicationCache&&K.Z.applicationCache.clearLayerInfo(e+":"+n.url),t}}},70409:(e,t,i)=>{i.d(t,{$X:()=>_,QP:()=>y,TO:()=>g,Xx:()=>w,yN:()=>m});var s=i(38171),r=i(48853),n=i(77286),a=i(59987),l=i(91136),o=i(90961),u=i(90658),h=i(36515),c=i(70586),d=i(41534),f=i(82971);class p{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class _ extends p{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class y extends p{constructor(e,t,i){super((0,u.JW)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,h.bB)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class g extends p{constructor(e,t,i){super(e),this.codefield=t,this.lkp=i,this.reverseLkp={};for(const e in i)this.reverseLkp[i[e]]=e;this.sqlRewritable=!0}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,u.Bj.Standardised,this.field.name,this.codefield instanceof d.WhereClause?(0,h.zR)(this.codefield,u.Bj.Standardised):this.codefield,e.parameters);return i.includes(g.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:d.WhereClause.create(i,t._parent.getFieldsIndex())}}evaluateNodeToWhereClause(e,t,i=null,s=null,n){let l,o,u,c;switch(e.type){case"interval":return(0,h.TE)(this.evaluateNodeToWhereClause(e.value,t,i,s,n),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,i,g.BADNESS,n));for(let r=0;r<e.clauses.length;r++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[r].operand,t,i,g.BADNESS,n)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[r].value,t,i,g.BADNESS,n);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,g.BADNESS,n)),s+=" END ",s}case"parameter":{const i=n[e.value.toLowerCase()];if("string"==typeof i)return"'"+i.toString().replaceAll("'","''")+"'";if(i instanceof Date)return(0,h.oX)(i,t,null);if(i instanceof r.iG)return(0,h.mA)(i,t,null);if(i instanceof Array){const e=[];for(let s=0;s<i.length;s++)"string"==typeof i[s]?e.push("'"+i[s].toString().replaceAll("'","''")+"'"):i[s]instanceof Date?e.push((0,h.oX)(i[s],t,null)):i[s]instanceof r.iG?e.push((0,h.mA)(i[s],t,null)):e.push(i[s].toString());return e}return i.toString()}case"expression-list":o=[];for(const r of e.value)o.push(this.evaluateNodeToWhereClause(r,t,i,s,n));return o;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,g.BADNESS,n)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,s,n)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,s,n)+") ";case"IS":if("null"!==e.right.type)throw new a.eS(a.f.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new a.eS(a.f.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" IS NOT NULL )";case"IN":if(l=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const r=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}r.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" IN ("+r.join(",")+")) "}return l=this.evaluateNodeToWhereClause(e.right,t,i,s,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" IN ("+l.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,s,n),c instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" IN ("+c+")) ";case"NOT IN":if(l=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const r=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}r.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" NOT IN ("+r.join(",")+")) "}return l=this.evaluateNodeToWhereClause(e.right,t,i,s,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" NOT IN ("+l.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,s,n),c instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,n)+" NOT IN ("+c+")) ";case"BETWEEN":return u=this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"NOTBETWEEN":return u=this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" NOT BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,g.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,g.BADNESS,n)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":case"date":return(0,h.oX)(e.value,t,null);case"number":return e.value.toString();case"current-time":return(0,h.vR)("date"===e.mode,t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"data-type":return e.value;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,i,g.BADNESS,n);return(0,h.fz)(e.name,s,t)}}throw new a.eS(a.f.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof d.WhereClause?this.reverseLkp[this.codefield.calculateValueCompiled(e)]:this.reverseLkp[e.attributes[this.codefield]]}}g.BADNESS="_!!!_BAD_LKP_!!!!";class m extends p{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,h.bB)(e,this.field.name,(0,h.zR)(this._sql,u.Bj.Standardised),t.getFieldsIndex())}}extractValue(e){return this._sql.calculateValueCompiled(e)}}class w extends l.Z{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new f.Z({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=u.Qk.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),(0,c.O3)(t),this._wset=new o.Z(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,r){const a=[];-1!==t&&void 0===this._featureCache[t]&&a.push(t);const l=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,l))return await this._expandPagedSet(e,l,0,0,r),this._getFeatures(e,t,i,r);let u=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&a.push(e._known[s]),a.length>=l)));s++);if(0===a.length)return"success";e=new o.Z([],a,e._ordered,null);const h=Math.min(a.length,i);await(this._parent?._getFeatures(e,-1,h,r)),this._checkCancelled(r);const c=[];for(let e=0;e<h;e++){const t=this._parent?._featureFromCache(a[e]);void 0!==t&&c.push({geometry:t.geometry,attributes:t.attributes,id:a[e]})}for(const e of c){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new s.Z({attributes:t,geometry:(0,n.r1)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new a.EN(a.H9.NeverReach)}async _getFilteredSet(e,t,i,s,r){let n=!1;const a=this._reformulateWithoutAdaptions(i);n=a.cannot,i=a.where;let l=!1;if(null!==s){l=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof _)&&!0===s.scanForField(t.field.name)){if(!(t instanceof y)){s=null,l=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,h.$e)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const u=await this._parent._getFilteredSet(e,t,i,s,r);let c;return this._checkCancelled(r),c=!0===n?new o.Z(u._candidates.slice(0).concat(u._known.slice(0)),[],!0===l&&u._ordered,this._clonePageDefinition(u.pagesDefinition)):new o.Z(u._candidates.slice(0),u._known.slice(0),!0===l&&u._ordered,this._clonePageDefinition(u.pagesDefinition)),c}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,h.hq)(e,i.field.name)){const s=i.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,i,s,r,n,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(r),l=l||o.cannot,null!==(r=o.where)?null!==this._extraFilter&&(r=(0,h.$e)(this._extraFilter,r)):r=this._extraFilter,!0===l)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};const u=await this._parent._stat(e,t,i,s,r,n,a);return!1===u.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,i,s,r){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const i of this.adaptedFields)if(e[t].toLowerCase()===i.field.name.toLowerCase()&&!(i instanceof _))return!1;const n=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)return!1;const t=i.clone();t.workingexpr=e.where,n.push(t)}else n.push(i)}const a=this._reformulateWithoutAdaptions(r);return!a.cannot&&(null!==(r=a.where)?null!==this._extraFilter&&(r=(0,h.$e)(this._extraFilter,r)):r=this._extraFilter,this._parent._canDoAggregates(e,n,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,l){if(null===this._parent)throw new a.EN(a.H9.NeverReach);const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new a.EN(a.H9.NeverReach);const t=i.clone();t.workingexpr=e.where,o.push(t)}else o.push(i)}const u=this._reformulateWithoutAdaptions(r);if(u.cannot)throw new a.EN(a.H9.NeverReach);return null!==(r=u.where)?null!==this._extraFilter&&(r=(0,h.$e)(this._extraFilter,r)):r=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,i,s,r,n,l)}}},84328:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(59987),r=i(91136),n=i(90961),a=i(90658),l=i(36515),o=i(95330),u=i(41534),h=i(82971);class c extends r.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.WhereClause?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new h.Z({wkid:4326}),this.geometryType=a.Qk.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new n.Z(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new n.Z(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return t===a.dj.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?a.dj.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.y8)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const s=new n.Z([],e,!1,null),r=Math.min(t,e.length);if(await(this._parent?._getFeatures(s,-1,r,i)),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<r;t++){const i=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=a.dj.InFeatureSet:this._idstates[e[t]]=a.dj.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<r;t++){const i=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===l[i]?this._idstates[e[i]]=a.dj.InFeatureSet:this._idstates[e[i]]=a.dj.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,i,s,r){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,l.$e)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,s,r);let o;return this._checkCancelled(r),o=null!==this._whereClauseFunction?new n.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new n.Z(a._candidates.slice(0),a._known.slice(0),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,i,s,r,n,a){if(null!==this._whereClauseFunction)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};let o=this._whereclause;null!==r&&null!==this._whereclause&&(o=(0,l.$e)(this._whereclause,r));const u=await this._parent._stat(e,t,i,s,o,n,a);return!1===u.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,i,s,r){return null===this._whereClauseFunction&&(null!==r?null!==this._whereclause&&(r=(0,l.$e)(this._whereclause,r)):r=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,o){if(null===this._parent)throw new s.EN(s.H9.NeverReach);return null!==n?null!==this._whereclause&&(n=(0,l.$e)(this._whereclause,n)):n=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,o)}static registerAction(){r.Z._featuresetFunctions.filter=function(e){if("function"==typeof e)return new c({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.WhereClause&&(t=e),new c({parentfeatureset:this,whereclause:t})}}}},85065:(e,t,i)=>{i.d(t,{Z:()=>o});var s=i(61363),r=i(59987),n=i(91136),a=i(90961),l=i(3823);class o extends n.Z{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const i=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(i);const s=new a.Z([],[],!0,null);for(let e=0;e<i.length;e++)s._known.push(i[e].id);return s}async getIdColumnDictionary(e,t,i,r){if(i<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,s.$)(this._parent._expandPagedSet(e,n,0,0,r)),this.getIdColumnDictionary(e,t,i,r);let a=i+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;i+=l.length;const o=await(0,s.$)(this._parent._getFeatureBatch(l,r));this._checkCancelled(r);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,r)}return e._candidates.length>0?(await(0,s.$)(this._refineSetBlock(e,this._maxProcessingRate(),r)),this._checkCancelled(r),this.getIdColumnDictionary(e,t,i,r)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new r.EN(r.H9.NeverReach)}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,i,null===s?this._orderbyclause:s,r);this._checkCancelled(r);const l=new a.Z(n._candidates.slice(0),n._known.slice(0),n._ordered,this._clonePageDefinition(n.pagesDefinition));let o=!0;if(n._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,r);return!1===o&&(null===t&&null===i||(e=new a.Z(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){n.Z._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.Z(e)})}}}},63991:(e,t,i)=>{i.d(t,{Z:()=>l});var s=i(59987),r=i(91136),n=i(90961),a=i(90658);class l extends r.Z{constructor(e){super(e),this._topnum=0,this.declaredClass="esri.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new n.Z(t._candidates.slice(0),t._known.slice(0),!1,this._clonePageDefinition(t.pagesDefinition)),this._setKnownLength(this._wset)>this._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===a.dj.NotInFeatureSet)return t;const i=this._idstates[e];return i===a.dj.InFeatureSet||i===a.dj.NotInFeatureSet?i:t===a.dj.InFeatureSet&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=a.dj.InFeatureSet,this._countedin++,a.dj.InFeatureSet):(this._idstates[e]=a.dj.NotInFeatureSet,a.dj.NotInFeatureSet):a.dj.Unknown}async _expandPagedSet(e,t,i,r,n){if(null===this._parent)throw new s.EN(s.H9.NotImplemented);if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const a=await this._parent._expandPagedSet(e,t,i,r,n);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),a}async _getFeatures(e,t,i,s){const r=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,s),this._getFeatures(e,t,i,s);-1!==t&&void 0===this._featureCache[t]&&r.push(t);let l=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>a)));s++);if(0===r.length)return"success";const o=new n.Z([],r,!1,null),u=Math.min(r.length,i);await this._parent._getFeatures(o,-1,u,s);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(r[e]);void 0!==t&&(this._featureCache[r[e]]=t)}return"success"}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const a=await this._getSet(r);return new n.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,s=null;const r=[];for(let n=0;n<e._candidates.length;n++){const l=this._isInFeatureSet(e._candidates[n]);if(l===a.dj.InFeatureSet){if(e._known.push(e._candidates[n]),i+=1,null===s?s={start:n,end:n}:s.end===n-1?s.end=n:(r.push(s),s={start:n,end:n}),e._known.length>=this._topnum)break}else if(l===a.dj.NotInFeatureSet)null===s?s={start:n,end:n}:s.end===n-1?s.end=n:(r.push(s),s={start:n,end:n}),i+=1;else if(l===a.dj.Unknown)break;if(i>=t)break}null!==s&&r.push(s);for(let t=r.length-1;t>=0;t--)e._candidates.splice(r[t].start,r[t].end-r[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){r.Z._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}}},17805:(e,t,i)=>{i.d(t,{Z:()=>_});var s=i(38171),r=i(59987),n=i(91136),a=i(90961),l=i(90658),o=i(36515),u=i(9361),h=i(19238),c=i(30359),d=i(16451),f=i(1231),p=i(14165);class _ extends n.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l.tI}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=l.Bj.Standardised,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this._layer instanceof c.default?(this.typeIdField=this._layer.subtypeField??"",this.types=this._layer.subtypes):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types)}isTable(){return this._forceIsTable||this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return l.dj.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new s.Z({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){let n="",u=!1;if(null!==s&&(n=s.constructClause(),u=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.Z([],[],!0,null);const h=new p.Z;h.returnZ=this.hasZ,h.returnM=this.hasM,h.where=null===i?null===t?"1=1":"":(0,o.zR)(i,l.Bj.Standardised),h.spatialRelationship=this._makeRelationshipEnum(e),h.outSpatialReference=this.spatialReference,h.orderByFields=""!==n?n.split(","):null,h.geometry=null===t?null:t,h.returnGeometry=!0,h.relationParameter=this._makeRelationshipParam(e);const c=await this._layer.queryFeatures(h);if(null===c)return new a.Z([],[],u,null);this._checkCancelled(r);const d=[];return c.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];d.push(t),this._featureCache[t]=this._changeFeature(e)})),new a.Z([],d,u,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new p.Z;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const i=t.attributes[this._layer.objectIdField];e.push(i),this._featureCache[i]=this._changeFeature(t)})),this._wset=new a.Z([],e,!1,null),this._wset}e.returnZ=this.hasZ,e.returnM=this.hasM;const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];i.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new a.Z([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);for(let r=e._lastFetchedIndex;r<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>i)));r++);if(0===s.length)return"success";throw new r.EN(r.H9.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField??"",r=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)r.push(d.Z.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!i){let t=!1;for(const s of e.layerDefinition.fields)if("oid"===s.type||"esriFieldTypeOID"===s.type){i=s.name,t=!0;break}if(!1===t){let t="FID",s=!0,r=0;for(;s;){let i=!0;for(const s of e.layerDefinition.fields)if(s.name===t){i=!1;break}!0===i?s=!1:(r++,t="FID"+r.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let i=0;i<a.length;i++)n.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),n[i].attributes[t]=i;a=n,i=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof f.Z?o.push(t):o.push(f.Z.fromJSON(t));let c=n;switch(c||(c=""),c){case"esriGeometryPoint":c="point";break;case"esriGeometryPolyline":c="polyline";break;case"esriGeometryPolygon":c="polygon";break;case"esriGeometryEnvelope":c="extent";break;case"esriGeometryMultipoint":c="multipoint";break;case"":case"esriGeometryNull":c="esriGeometryNull"}if("esriGeometryNull"!==c)for(const e of a)e.geometry&&e.geometry instanceof u.Z==0&&(e.geometry.type=c,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of a)e.geometry&&(e.geometry=null);const p={outFields:["*"],source:a,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:r,typeIdField:s,objectIdField:i,spatialReference:t},y="esriGeometryNull"===c||null===c;y||(p.geometryType=c);const g=new h.default(p);return new _({layer:g,spatialReference:t,isTable:y})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=new p.Z;t.where=this.objectIdField+"="+e.toString(),t.returnZ=this.hasZ,t.returnM=this.hasM;const i=await this._layer.queryFeatures(t);return 1===i.features.length?i.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeReference(){return this._layer?.preferredTimeReference?.toJSON()??null}get dateFieldsTimeReference(){return this._layer?.dateFieldsTimeReference?.toJSON()??null}get datesInUnknownTimezone(){return this._layer?.datesInUnknownTimezone}get editFieldsInfo(){return this._layer?.editFieldsInfo?.toJSON()??null}get timeInfo(){return this._layer?.timeInfo?.toJSON()??null}}},3823:(e,t,i)=>{function s(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{Z:()=>r});class r{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const i=t[e].match(/\S+/g);this._fields.push(i[0]),2===i.length?"asc"===i[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e.feature,this._fields[i],i),n=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?s(r,n):-1*s(r,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let i=0;i<this._fields.length;i++){0!==i&&(t+=",");let s=this._fields[i];for(const t of e)if(s.toLowerCase()===t.field.toLowerCase()){s=t.newfield;break}t+=s,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new r(t)}featureValue(e,t,i){const s=e.attributes[t];if(void 0!==s)return s;for(const s in e.attributes)if(t.toLowerCase()===s.toLowerCase())return this._fields[i]=s,e.attributes[s];return null}}},46791:(e,t,i)=>{i.d(t,{Z:()=>k});var s,r=i(43697),n=i(3894),a=i(32448),l=i(50758),o=i(22974),u=i(71143);!function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE",e[e.MOVE=4]="MOVE"}(s||(s={}));var h,c=i(1654),d=i(75215),f=i(58971),p=i(5600),_=i(52421),y=i(52011),g=i(10661);class m{constructor(e,t,i,s,r){this.target=e,this.added=t,this.removed=i,this.start=s,this.deleteCount=r}}const w=new u.Z(class{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}},void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1}));function b(e){return e?e instanceof T?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function S(e){if(e&&e.length)return e[0]}function F(e,t,i,s){const r=Math.min(e.length-i,t.length-s);let n=0;for(;n<r&&e[i+n]===t[s+n];)n++;return n}function v(e,t,i,s){t&&t.forEach(((t,r,n)=>{e.push(t),v(e,i.call(s,t,r,n),i,s)}))}const I=new Set,C=new Set,D=new Set,R=new Map;let x=0,T=h=class extends a.Z.EventedAccessor{static isCollection(e){return null!=e&&e instanceof h}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new g.s,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:x++})}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof h?{items:e}:e:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return(0,f.it)(this._observable),this._items}set items(e){this._emitBeforeChanges(s.ADD)||(this._splice(0,this.length,b(e)),this._emitAfterChanges(s.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,i={removed:!1,callback:t};return e.push(i),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),(0,l.kB)((()=>{i.removed=!0,e.splice(e.indexOf(i),1)}))}return this._emitter.on(e,t)}once(e,t){return this.on(e,t)}add(e,t){if((0,f.it)(this._observable),this._emitBeforeChanges(s.ADD))return this;const i=this.getNextIndex(t??null);return this._splice(i,0,[e]),this._emitAfterChanges(s.ADD),this}addMany(e,t=this._items.length){if((0,f.it)(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(s.ADD))return this;const i=this.getNextIndex(t);return this._splice(i,0,b(e)),this._emitAfterChanges(s.ADD),this}at(e){if((0,f.it)(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if((0,f.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return[];const e=this._removeAllRaw();return this._emitAfterChanges(s.REMOVE),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return(0,f.it)(this._observable),this._createNewInstance({items:this._items.map(o.d9)})}concat(...e){(0,f.it)(this._observable);const t=e.map(b);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if((0,f.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const i=this._splice(0,this.length),r=i.length;for(let s=0;s<r;s++)e.call(t,i[s],s,i);this._emitAfterChanges(s.REMOVE)}every(e,t){return(0,f.it)(this._observable),this._items.every(e,t)}filter(e,t){let i;return(0,f.it)(this._observable),i=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:i})}find(e,t){return(0,f.it)(this._observable),this._items.find(e,t)}findIndex(e,t){return(0,f.it)(this._observable),this._items.findIndex(e,t)}flatten(e,t){(0,f.it)(this._observable);const i=[];return v(i,this,e,t),new h(i)}forEach(e,t){return(0,f.it)(this._observable),this._items.forEach(e,t)}getItemAt(e){return(0,f.it)(this._observable),this._items[e]}getNextIndex(e){(0,f.it)(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return(0,f.it)(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return(0,f.it)(this._observable),this._items.indexOf(e,t)}join(e=","){return(0,f.it)(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return(0,f.it)(this._observable),this._items.lastIndexOf(e,t)}map(e,t){(0,f.it)(this._observable);const i=this._items.map(e,t);return new h({items:i})}reorder(e,t=this.length-1){(0,f.it)(this._observable);const i=this.indexOf(e);if(-1!==i){if(t<0?t=0:t>=this.length&&(t=this.length-1),i!==t){if(this._emitBeforeChanges(s.MOVE))return e;this._splice(i,1),this._splice(t,0,[e]),this._emitAfterChanges(s.MOVE)}return e}}pop(){if((0,f.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const e=S(this._splice(this.length-1,1));return this._emitAfterChanges(s.REMOVE),e}push(...e){return(0,f.it)(this._observable),this._emitBeforeChanges(s.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(s.ADD)),this.length}reduce(e,t){(0,f.it)(this._observable);const i=this._items;return 2===arguments.length?i.reduce(e,t):i.reduce(e)}reduceRight(e,t){(0,f.it)(this._observable);const i=this._items;return 2===arguments.length?i.reduceRight(e,t):i.reduceRight(e)}remove(e){return(0,f.it)(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if((0,f.it)(this._observable),e<0||e>=this.length||this._emitBeforeChanges(s.REMOVE))return;const t=S(this._splice(e,1));return this._emitAfterChanges(s.REMOVE),t}removeMany(e){if((0,f.it)(this._observable),!e||!e.length||this._emitBeforeChanges(s.REMOVE))return[];const t=e instanceof h?e.toArray():e,i=this._items,r=[],n=t.length;for(let e=0;e<n;e++){const s=t[e],n=i.indexOf(s);if(n>-1){const s=1+F(t,i,e+1,n+1),a=this._splice(n,s);a&&a.length>0&&r.push.apply(r,a),e+=s-1}}return this._emitAfterChanges(s.REMOVE),r}reverse(){if((0,f.it)(this._observable),this._emitBeforeChanges(s.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(s.MOVE),this}shift(){if((0,f.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const e=S(this._splice(0,1));return this._emitAfterChanges(s.REMOVE),e}slice(e=0,t=this.length){return(0,f.it)(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return(0,f.it)(this._observable),this._items.some(e,t)}sort(e){if((0,f.it)(this._observable),!this.length||this._emitBeforeChanges(s.MOVE))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(s.MOVE),this}splice(e,t,...i){(0,f.it)(this._observable);const r=(t?s.REMOVE:0)|(i.length?s.ADD:0);if(this._emitBeforeChanges(r))return[];const n=this._splice(e,t,i)||[];return this._emitAfterChanges(r),n}toArray(){return(0,f.it)(this._observable),this._items.slice()}toJSON(){return(0,f.it)(this._observable),this.toArray()}toLocaleString(){return(0,f.it)(this._observable),this._items.toLocaleString()}toString(){return(0,f.it)(this._observable),this._items.toString()}unshift(...e){return(0,f.it)(this._observable),!e.length||this._emitBeforeChanges(s.ADD)||(this._splice(0,0,e),this._emitAfterChanges(s.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,i){const s=this._items,r=this.itemType;let n,a;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=(0,c.Os)((()=>this._dispatchChange()))),e<0&&(e+=this.length),t){if(a=s.splice(e,t),this.hasEventListener("before-remove")){const t=w.acquire();t.target=this,t.cancellable=!0;for(let i=0,r=a.length;i<r;i++)n=a[i],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(a.splice(i,1),s.splice(e,0,n),e+=1,i-=1,r-=1);w.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=w.acquire();e.target=this,e.cancellable=!1;const t=a.length;for(let i=0;i<t;i++)e.reset(a[i]),this.emit("after-remove",e);w.release(e)}}if(i&&i.length){if(r){const e=[];for(const t of i){const i=r.ensureType(t);null==i&&null!=t||e.push(i)}i=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),a=e===this.length;if(t||n){const r=w.acquire();r.target=this,r.cancellable=!0;const l=w.acquire();l.target=this,l.cancellable=!1;for(const o of i)t?(r.reset(o),this.emit("before-add",r),r.defaultPrevented||(a?s.push(o):s.splice(e++,0,o),this._set("length",s.length),n&&(l.reset(o),this.emit("after-add",l)))):(a?s.push(o):s.splice(e++,0,o),this._set("length",s.length),l.reset(o),this.emit("after-add",l));w.release(l),w.release(r)}else{if(a)for(const e of i)s.push(e);else s.splice(e,0,...i);this._set("length",s.length)}}if((i&&i.length||a&&a.length)&&this._notifyChangeEvent(i,a),this.hasEventListener("after-splice")){const s=new m(this,i,a,e,t);this.emit("after-splice",s)}return a}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const i=w.acquire();i.target=this,i.cancellable=!0,i.type=e,this.emit("before-changes",i),t=i.defaultPrevented,w.release(i)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=w.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),w.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const t of e){const e=t.changes;I.clear(),C.clear(),D.clear();for(const{added:t,removed:i}of e){if(t)if(0===D.size&&0===C.size)for(const e of t)I.add(e);else for(const e of t)C.has(e)?(D.add(e),C.delete(e)):D.has(e)||I.add(e);if(i)if(0===D.size&&0===I.size)for(const e of i)C.add(e);else for(const e of i)I.has(e)?I.delete(e):(D.delete(e),C.add(e))}const i=n.Z.acquire();I.forEach((e=>{i.push(e)}));const s=n.Z.acquire();C.forEach((e=>{s.push(e)}));const r=this._items,a=t.items,l=n.Z.acquire();if(D.forEach((e=>{a.indexOf(e)!==r.indexOf(e)&&l.push(e)})),t.listeners&&(i.length||s.length||l.length)){const e={target:this,added:i,removed:s,moved:l},r=t.listeners.length;for(let i=0;i<r;i++){const s=t.listeners[i];s.removed||s.callback.call(this,e)}}n.Z.release(i),n.Z.release(s),n.Z.release(l)}I.clear(),C.clear(),D.clear()}};T.ofType=e=>{if(!e)return h;if(R.has(e))return R.get(e);let t=null;if("function"==typeof e)t=e.prototype.declaredClass;else if(e.base)t=e.base.prototype.declaredClass;else for(const i in e.typeMap){const s=e.typeMap[i].prototype.declaredClass;t?t+=` | ${s}`:t=s}let i=class extends h{};return(0,r._)([(0,_.c)({Type:e,ensureType:"function"==typeof e?(0,d.se)(e):(0,d.N7)(e)})],i.prototype,"itemType",void 0),i=(0,r._)([(0,y.j)(`esri.core.Collection<${t}>`)],i),R.set(e,i),i},(0,r._)([(0,p.Cb)()],T.prototype,"length",void 0),(0,r._)([(0,p.Cb)()],T.prototype,"items",null),T=h=(0,r._)([(0,y.j)("esri.core.Collection")],T);const k=T},32448:(e,t,i)=>{i.d(t,{Z:()=>o});var s=i(43697),r=i(92036),n=i(50758),a=i(52011);class l{constructor(){this._emitter=new l.EventEmitter(this)}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}}!function(e){class t{constructor(e=null){this._target=e,this._listenersMap=null}clear(){this._listenersMap?.clear(),this._listenersMap=null}destroy(){this.clear()}emit(e,t){const i=this._listenersMap&&this._listenersMap.get(e);if(!i)return!1;const s=this._target||this;return[...i].forEach((e=>{e.call(s,t)})),i.length>0}on(e,t){if(Array.isArray(e)){const i=e.map((e=>this.on(e,t)));return(0,n.AL)(i)}if(e.includes(","))throw new TypeError("Evented.on() with a comma delimited string of event types is not supported");this._listenersMap||(this._listenersMap=new Map);const i=this._listenersMap.get(e)||[];return i.push(t),this._listenersMap.set(e,i),(0,n.kB)((()=>{const i=this._listenersMap&&this._listenersMap.get(e)||[],s=i.indexOf(t);s>=0&&i.splice(s,1)}))}once(e,t){const i=this.on(e,(e=>{i.remove(),t.call(null,e)}));return i}hasEventListener(e){const t=this._listenersMap&&this._listenersMap.get(e);return null!=t&&t.length>0}}e.EventEmitter=t,e.EventedMixin=e=>{let i=class extends e{constructor(){super(...arguments),this._emitter=new t}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};return i=(0,s._)([(0,a.j)("esri.core.Evented")],i),i};let i=class extends r.Z{constructor(){super(...arguments),this._emitter=new l.EventEmitter(this)}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};i=(0,s._)([(0,a.j)("esri.core.Evented")],i),e.EventedAccessor=i}(l||(l={}));const o=l},10699:(e,t,i)=>{i.d(t,{IG:()=>a,iv:()=>l});var s=i(43697),r=i(52011);let n=0;const a=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+n++})}};return t=(0,s._)([(0,r.j)("esri.core.Identifiable")],t),t},l=e=>{let t=class extends e{constructor(...e){super(...e),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:n++})}};return t=(0,s._)([(0,r.j)("esri.core.NumericIdentifiable")],t),t};let o=class extends(a(class{})){};o=(0,s._)([(0,r.j)("esri.core.Identifiable")],o)},52421:(e,t,i)=>{function s(e){return(t,i)=>{t[i]=e}}i.d(t,{c:()=>s})},66643:(e,t,i)=>{i.d(t,{Ed:()=>u,UI:()=>h,mt:()=>p,q6:()=>f,vr:()=>_});var s=i(43697),r=i(92036),n=i(70586),a=i(95330),l=i(5600),o=i(52011);function u(e,t,i){return(0,a.as)(e.map(((e,s)=>t.apply(i,[e,s]))))}async function h(e,t,i){return(await(0,a.as)(e.map(((e,s)=>t.apply(i,[e,s]))))).map((e=>e.value))}function c(e){return{ok:!0,value:e}}function d(e){return{ok:!1,error:e}}async function f(e){if(null==e)return{ok:!1,error:new Error("no promise provided")};try{return c(await e)}catch(e){return d(e)}}async function p(e){try{return c(await e)}catch(e){return(0,a.r9)(e),d(e)}}function _(e,t){return new y(e,t)}let y=class extends r.Z{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,n.IM)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:i}=this._abortController;this.promise=e(i),this.promise.then((e=>{this._result=c(e),this._cleanup()}),(e=>{this._result=d(e),this._cleanup()})),this._abortHandle=(0,a.fu)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,n.hw)(this._abortHandle),this._abortController=null}};(0,s._)([(0,l.Cb)()],y.prototype,"value",null),(0,s._)([(0,l.Cb)()],y.prototype,"error",null),(0,s._)([(0,l.Cb)()],y.prototype,"finished",null),(0,s._)([(0,l.Cb)()],y.prototype,"promise",void 0),(0,s._)([(0,l.Cb)()],y.prototype,"_result",void 0),y=(0,s._)([(0,o.j)("esri.core.asyncUtils.ReactiveTask")],y)},87085:(e,t,i)=>{i.d(t,{Z:()=>w});var s=i(43697),r=(i(66577),i(3172)),n=i(20102),a=i(32448),l=i(10699),o=i(83379),u=i(92604),h=i(95330),c=i(17452),d=i(5600),f=(i(75215),i(67676),i(80442),i(52011)),p=i(68773),_=i(6570),y=i(82971);let g=0,m=class extends(a.Z.EventedMixin((0,l.IG)(o.Z))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new _.Z(-180,-90,180,90,y.Z.WGS84),this.id=Date.now().toString(16)+"-layer-"+g++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=y.Z.WGS84,this.title=null,this.type=null,this.url=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await i.e(3529).then(i.bind(i,63529))).fromUrl(t)}static fromPortalItem(e){return async function(e){const t="portalItem"in e?e:{portalItem:e},{fromItem:s}=await i.e(8008).then(i.bind(i,28008));try{return await s(t)}catch(e){const i=t&&t.portalItem,s=i&&i.id||"unset",r=i&&i.portal&&i.portal.url||p.default.portalUrl;throw u.Z.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+r+"', id: '"+s+"')",e),e}}(e)}initialize(){this.when().catch((e=>{(0,h.D_)(e)||u.Z.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){const e=this.parent;if(e){const t=this;"layers"in e&&e.layers.includes(t)?e.layers.remove(t):"tables"in e&&e.tables.includes(t)?e.tables.remove(t):"baseLayers"in e&&e.baseLayers.includes(t)?e.baseLayers.remove(t):"referenceLayers"in e&&e.referenceLayers.includes(t)&&e.referenceLayers.remove(t),this._set("parent",null)}}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,c.mN)(this.url)}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await(0,r.Z)(e,{query:{f:"json"},responseType:"json"})).data;throw new n.Z("layer:no-attribution-data","Layer does not have attribution data")}};(0,s._)([(0,d.Cb)({type:String})],m.prototype,"attributionDataUrl",void 0),(0,s._)([(0,d.Cb)({type:_.Z})],m.prototype,"fullExtent",void 0),(0,s._)([(0,d.Cb)({readOnly:!0})],m.prototype,"hasAttributionData",null),(0,s._)([(0,d.Cb)({type:String,clonable:!1})],m.prototype,"id",void 0),(0,s._)([(0,d.Cb)({type:Boolean,nonNullable:!0})],m.prototype,"legendEnabled",void 0),(0,s._)([(0,d.Cb)({type:["show","hide","hide-children"]})],m.prototype,"listMode",void 0),(0,s._)([(0,d.Cb)({type:Number,range:{min:0,max:1},nonNullable:!0})],m.prototype,"opacity",void 0),(0,s._)([(0,d.Cb)({clonable:!1})],m.prototype,"parent",void 0),(0,s._)([(0,d.Cb)({readOnly:!0})],m.prototype,"parsedUrl",null),(0,s._)([(0,d.Cb)({type:Boolean})],m.prototype,"popupEnabled",void 0),(0,s._)([(0,d.Cb)({type:Boolean})],m.prototype,"attributionVisible",void 0),(0,s._)([(0,d.Cb)({type:y.Z})],m.prototype,"spatialReference",void 0),(0,s._)([(0,d.Cb)({type:String})],m.prototype,"title",void 0),(0,s._)([(0,d.Cb)({readOnly:!0,json:{read:!1}})],m.prototype,"type",void 0),(0,s._)([(0,d.Cb)()],m.prototype,"url",void 0),(0,s._)([(0,d.Cb)({type:Boolean,nonNullable:!0})],m.prototype,"visible",void 0),m=(0,s._)([(0,f.j)("esri.layers.Layer")],m);const w=m},16451:(e,t,i)=>{i.d(t,{Z:()=>f});var s=i(43697),r=i(2368),n=i(96674),a=i(5600),l=(i(75215),i(67676),i(80442),i(71715)),o=i(52011),u=i(30556),h=i(72729),c=i(70082);let d=class extends((0,r.J)(n.wq)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const i of Object.keys(e))t[i]=(0,h.im)(e[i]);return t}writeDomains(e,t){const i={};for(const t of Object.keys(e))e[t]&&(i[t]=e[t]?.toJSON());t.domains=i}};(0,s._)([(0,a.Cb)({json:{write:!0}})],d.prototype,"id",void 0),(0,s._)([(0,a.Cb)({json:{write:!0}})],d.prototype,"name",void 0),(0,s._)([(0,a.Cb)({json:{write:!0}})],d.prototype,"domains",void 0),(0,s._)([(0,l.r)("domains")],d.prototype,"readDomains",null),(0,s._)([(0,u.c)("domains")],d.prototype,"writeDomains",null),(0,s._)([(0,a.Cb)({type:[c.Z],json:{write:!0}})],d.prototype,"templates",void 0),d=(0,s._)([(0,o.j)("esri.layers.support.FeatureType")],d);const f=d},2981:(e,t,i)=>{i.d(t,{$6:()=>h,Ow:()=>n,S0:()=>r,d1:()=>a});const s=[["binary","application/octet-stream","bin",""]];function r(e,t){return o(function(e,t){return l(t).find((t=>u(t)===e))}(e,t))}function n(e,t){return o(function(e,t){const i=e.toLowerCase();return l(t).find((e=>function(e){return e?.[2].split(",")??[]}(e).some((e=>i.endsWith(e)))))}(e,t))}function a(e,t){return u(function(e,t){return l(t).find((t=>o(t)===e))}(e,t))}function l(e){return[...s,...e]}function o(e){return e?.[0]}function u(e){return e?.[1]}function h(e){return e.tables?.find((e=>"assetMaps"===e.role))}},84230:(e,t,i)=>{i.d(t,{A2:()=>a,S1:()=>h,fb:()=>n,ln:()=>c,oP:()=>u,rQ:()=>l,y2:()=>o});var s=i(40330),r=i(3172);const n={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function a(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function l(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function o(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}async function u(e,t){const i=s.id?.findServerInfo(e);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const n=e.toLowerCase().indexOf("/rest/services");if(-1===n)return null;const a=`${e.substring(0,n)}/rest/info`,l=null!=t?t.signal:null,{data:o}=await(0,r.Z)(a,{query:{f:"json"},responseType:"json",signal:l});return o?.owningSystemUrl||null}function h(e){return function(e){if(!("capabilities"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function c(e){return!!function(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}},14661:(e,t,i)=>{i.d(t,{$o:()=>c,Ct:()=>h,Fj:()=>o,Kz:()=>d,Ss:()=>f,_$:()=>l,ck:()=>u,qj:()=>a});var s=i(44547),r=i(82971),n=i(40488);function a(e,t){if(!l(e,t)){const i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,d.HOSTED_SERVICE)}function u(e,t){const i=e.typeKeywords;if(i){const e=i.indexOf(t);e>-1&&i.splice(e,1)}}function h(e,t,i){i?a(e,t):u(e,t)}async function c(e){const t=e.clone().normalize();let i;if(t.length>1)for(const e of t)i?e.width>i.width&&(i=e):i=e;else i=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,n.Sx)(e);const i=r.Z.WGS84;return await(0,s.initializeProjection)(t,i),(0,s.iV)(e,i)}(i)}const d={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"ArcGIS API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table",HOSTED_SERVICE:"Hosted Service",LOCAL_SCENE:"ViewingMode-Local"};function f(e){const{portal:t,isOrgItem:i,itemControl:s}=e,r=t.user?.privileges;let n=!r||r.includes("features:user:edit"),a=!!i&&!!r?.includes("features:user:fullEdit");const l="update"===s||"admin"===s;return l?a=n=!0:a&&(n=!0),{features:{edit:n,fullEdit:a},content:{updateItem:l}}}},41818:(e,t,i)=>{i.d(t,{P:()=>a});var s=i(11282),r=i(34599),n=i(14165);async function a(e,t,i){const a=(0,s.en)(e);return(0,r.hH)(a,n.Z.from(t),{...i}).then((e=>e.data.count))}},5396:(e,t,i)=>{i.d(t,{G:()=>a});var s=i(11282),r=i(34599),n=i(14165);async function a(e,t,i){const a=(0,s.en)(e);return(0,r.Ev)(a,n.Z.from(t),{...i}).then((e=>e.data.objectIds))}},4967:(e,t,i)=>{i.d(t,{F:()=>o,e:()=>l});var s=i(11282),r=i(34599),n=i(74889),a=i(14165);async function l(e,t,i){const s=await o(e,t,i);return n.Z.fromJSON(s)}async function o(e,t,i){const n=(0,s.en)(e),l={...i},o=a.Z.from(t),{data:u}=await(0,r.JT)(n,o,o.sourceSpatialReference,l);return u}},53261:(e,t,i)=>{i.d(t,{t:()=>y});var s=i(11282),r=i(70586),n=i(69285),a=i(98732);function l(e,t){return t}function o(e,t,i,s){switch(i){case 0:return d(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?d(e,t+s,1):function({translate:e,scale:t},i,s){return e[s]-i*t[s]}(e,t+s,1)}}function u(e,t,i,s){return 2===i?d(e,t,2):o(e,t,i,s)}function h(e,t,i,s){return 2===i?d(e,t,3):o(e,t,i,s)}function c(e,t,i,s){return 3===i?d(e,t,3):u(e,t,i,s)}function d({translate:e,scale:t},i,s){return e[s]+i*t[s]}class f{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=l,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=(0,n.k)(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=t)for(const i of e.features)t(i.geometry)}createSpatialReference(){return{}}addField(e,t){const i=e.fields;(0,r.O3)(i),i.push(t);const s=i.map((e=>e.name));this._attributesConstructor=function(){for(const e of s)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++,e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,i)=>this.addCoordinatePoint(e,t,i),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,i)=>this._addCoordinatePolygon(e,t,i),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,i)=>this._addCoordinatePolyline(e,t,i),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,i)=>this._addCoordinateMultipoint(e,t,i),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,i){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:i,queryGeometryType:s}=t,r=(0,a.$g)(i.clone(),i,!1,!1,this._transform),n=(0,a.di)(r,s,!1,!1);e.queryGeometryType=s,e.queryGeometry={...n}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,i){const s=this._transform;switch(t=this._applyTransform(s,t,i,0),i){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let i=0;t<=1&&(i=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return this._applyTransform(s,e,t,i)}_addCoordinatePolyline(e,t,i){this._dehydratedAddPointsCoordinate(e.paths,t,i)}_addCoordinatePolygon(e,t,i){this._dehydratedAddPointsCoordinate(e.rings,t,i)}_addCoordinateMultipoint(e,t,i){0===i&&e.points.push([]);const s=this._transformPathLikeValue(t,i);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,i){0===i&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,i),r=e[e.length-1];0===i&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),r.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:i}=e;return t&&i?c:t?u:i?h:o}}var p=i(34599),_=(i(74889),i(14165));async function y(e,t,i){const r=(0,s.en)(e),n={...i},a=_.Z.from(t),l=!a.quantizationParameters,{data:o}=await(0,p.qp)(r,a,new f({sourceSpatialReference:a.sourceSpatialReference,applyTransform:l}),n);return o}},28694:(e,t,i)=>{i.d(t,{p:()=>r});var s=i(69285);function r(e,t,i){if(!i||!i.features||!i.hasZ)return;const r=(0,s.k)(i.geometryType,t,e.outSpatialReference);if(null!=r)for(const e of i.features)r(e.geometry)}},98326:(e,t,i)=>{i.d(t,{Z:()=>c});var s,r=i(43697),n=i(96674),a=i(5600),l=i(75215),o=(i(67676),i(80442),i(52011));const u={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let h=s=class extends n.wq{constructor(e){super(e),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:e}=this,t=function(e){const{exifInfo:t,exifName:i,tagName:s}=e;if(!t||!i||!s)return null;const r=t.find((e=>e.name===i));return r?function(e){const{tagName:t,tags:i}=e;if(!i||!t)return null;const s=i.find((e=>e.name===t));return s&&s.value||null}({tagName:s,tags:r.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:e});return u[t]||null}clone(){return new s({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,r._)([(0,a.Cb)({type:String})],h.prototype,"contentType",void 0),(0,r._)([(0,a.Cb)()],h.prototype,"exifInfo",void 0),(0,r._)([(0,a.Cb)({readOnly:!0})],h.prototype,"orientationInfo",null),(0,r._)([(0,a.Cb)({type:l.z8})],h.prototype,"id",void 0),(0,r._)([(0,a.Cb)({type:String})],h.prototype,"globalId",void 0),(0,r._)([(0,a.Cb)({type:String})],h.prototype,"keywords",void 0),(0,r._)([(0,a.Cb)({type:String})],h.prototype,"name",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],h.prototype,"parentGlobalId",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],h.prototype,"parentObjectId",void 0),(0,r._)([(0,a.Cb)({type:l.z8})],h.prototype,"size",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],h.prototype,"url",void 0),h=s=(0,r._)([(0,o.j)("esri.layers.support.AttachmentInfo")],h);const c=h},74889:(e,t,i)=>{i.d(t,{Z:()=>w});var s,r=i(43697),n=i(66577),a=i(38171),l=i(35454),o=i(96674),u=i(22974),h=i(5600),c=(i(75215),i(71715)),d=i(52011),f=i(30556),p=i(82971),_=i(33955),y=i(1231);const g=new l.X({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=s=class extends o.wq{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const i=p.Z.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const r=e[t],n=a.Z.fromJSON(r),l=r.geometry&&r.geometry.spatialReference;null==n.geometry||l||(n.geometry.spatialReference=i);const o=r.aggregateGeometries,u=n.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],s=o[e],r=s?.spatialReference;null==t||r||(t.spatialReference=i)}s.push(n)}return s}writeGeometryType(e,t,i,s){if(e)return void g.write(e,t,i,s);const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry)return void g.write(e.geometry.type,t,i,s)}readQueryGeometry(e,t){if(!e)return null;const i=!!e.spatialReference,s=(0,_.im)(e);return s&&!i&&t.spatialReference&&(s.spatialReference=p.Z.fromJSON(t.spatialReference)),s}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:i}=this;if(i)for(const e of i)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new s(this.cloneProperties())}cloneProperties(){return(0,u.d9)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let i=0;i<t.features.length;i++){const s=t.features[i];if(s.geometry){const t=e&&e[i];s.geometry=t&&t.toJSON()||s.geometry}}return t}quantize(e){const{scale:[t,i],translate:[s,r]}=e,n=this.features,a=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-s)/t)),(e=>Math.round((r-e)/i)));for(let e=0,t=n.length;e<t;e++)a?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:i}=this;if(!i)return this;const{translate:[s,r],scale:[n,a]}=i;let l=null,o=null;if(this.hasZ&&null!=i?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=i;l=i=>i*t+e}if(this.hasM&&null!=i?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=i;o=i=>null==i?i:i*t+e}const u=this._getHydrationFunction(e,(e=>e*n+s),(e=>r-e*a),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,i){let s,r;const n=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=i(l[1]);e===s&&a===r||(n.push([e-s,a-r]),s=e,r=a)}else s=t(l[0]),r=i(l[1]),n.push([s,r])}return n.length>0?n:null}_getQuantizationFunction(e,t,i){return"point"===e?e=>(e.x=t(e.x),e.y=i(e.y),e):"polyline"===e||"polygon"===e?e=>{const s=(0,_.oU)(e)?e.rings:e.paths,r=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],a=this._quantizePoints(n,t,i);a&&r.push(a)}return r.length>0?((0,_.oU)(e)?e.rings=r:e.paths=r,e):null}:"multipoint"===e?e=>{const s=this._quantizePoints(e.points,t,i);return s&&s.length>0?(e.points=s,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,i,s,r){return"point"===e?e=>{e.x=t(e.x),e.y=i(e.y),s&&(e.z=s(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,_.oU)(e)?e.rings:e.paths;let a,l;for(let e=0,s=n.length;e<s;e++){const s=n[e];for(let e=0,r=s.length;e<r;e++){const r=s[e];e>0?(a+=r[0],l+=r[1]):(a=r[0],l=r[1]),r[0]=t(a),r[1]=i(l)}}if(s&&r)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2]),i[3]=r(i[3])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2])}}else if(r)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=i(e.ymin),e.xmax=t(e.xmax),e.ymax=i(e.ymax),s&&null!=e.zmax&&null!=e.zmin&&(e.zmax=s(e.zmax),e.zmin=s(e.zmin)),r&&null!=e.mmax&&null!=e.mmin&&(e.mmax=r(e.mmax),e.mmin=r(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let a,l;for(let e=0,s=n.length;e<s;e++){const s=n[e];e>0?(a+=s[0],l+=s[1]):(a=s[0],l=s[1]),s[0]=t(a),s[1]=i(l)}if(s&&r)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2]),t[3]=r(t[3])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}else if(r)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=r(t[2])}}:null}};(0,r._)([(0,h.Cb)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,r._)([(0,h.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,r._)([(0,h.Cb)({type:[a.Z],json:{write:!0}})],m.prototype,"features",void 0),(0,r._)([(0,c.r)("features")],m.prototype,"readFeatures",null),(0,r._)([(0,h.Cb)({type:[y.Z],json:{write:!0}})],m.prototype,"fields",void 0),(0,r._)([(0,h.Cb)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,r._)([(0,f.c)("geometryType")],m.prototype,"writeGeometryType",null),(0,r._)([(0,h.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,r._)([(0,h.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,r._)([(0,h.Cb)({types:n.qM,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,r._)([(0,c.r)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,r._)([(0,h.Cb)({type:p.Z,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,r._)([(0,f.c)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,r._)([(0,h.Cb)({json:{write:!0}})],m.prototype,"transform",void 0),m=s=(0,r._)([(0,d.j)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0;const w=m}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9805,5732],{22303:(t,e,r)=>{r.d(e,{Z:()=>c});var i,n,s=r(35270),a=r(22021),o=r(75215);function l(t){return(0,a.uZ)((0,o.vU)(t),0,255)}function u(t,e,r){return t=Number(t),isNaN(t)?r:t<e?e:t>r?r:t}class h{static blendColors(t,e,r,i=new h){return i.r=Math.round(t.r+(e.r-t.r)*r),i.g=Math.round(t.g+(e.g-t.g)*r),i.b=Math.round(t.b+(e.b-t.b)*r),i.a=t.a+(e.a-t.a)*r,i._sanitize()}static fromRgb(t,e){const r=t.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(r){const t=r[2].split(/\s*,\s*/),i=r[1];if("rgb"===i&&3===t.length||"rgba"===i&&4===t.length){const r=t[0];if("%"===r.charAt(r.length-1)){const r=t.map((t=>2.56*parseFloat(t)));return 4===t.length&&(r[3]=parseFloat(t[3])),h.fromArray(r,e)}return h.fromArray(t.map((t=>parseFloat(t))),e)}if("hsl"===i&&3===t.length||"hsla"===i&&4===t.length)return h.fromArray((0,s.B7)(parseFloat(t[0]),parseFloat(t[1])/100,parseFloat(t[2])/100,parseFloat(t[3])),e)}return null}static fromHex(t,e=new h){if(4!==t.length&&7!==t.length||"#"!==t[0])return null;const r=4===t.length?4:8,i=(1<<r)-1;let n=Number("0x"+t.substr(1));return isNaN(n)?null:(["b","g","r"].forEach((t=>{const s=n&i;n>>=r,e[t]=4===r?17*s:s})),e.a=1,e)}static fromArray(t,e=new h){return e._set(Number(t[0]),Number(t[1]),Number(t[2]),Number(t[3])),isNaN(e.a)&&(e.a=1),e._sanitize()}static fromString(t,e){const r=(0,s.St)(t)?(0,s.h$)(t):null;return r&&h.fromArray(r,e)||h.fromRgb(t,e)||h.fromHex(t,e)}static fromJSON(t){return null!=t?new h([t[0],t[1],t[2],(t[3]??255)/255]):void 0}static toUnitRGB(t){return null!=t?[t.r/255,t.g/255,t.b/255]:null}static toUnitRGBA(t){return null!=t?[t.r/255,t.g/255,t.b/255,null!=t.a?t.a:1]:null}constructor(t){this.r=255,this.g=255,this.b=255,this.a=1,t&&this.setColor(t)}get isBright(){return.299*this.r+.587*this.g+.114*this.b>=127}setColor(t){return"string"==typeof t?h.fromString(t,this):Array.isArray(t)?h.fromArray(t,this):(this._set(t.r??0,t.g??0,t.b??0,t.a??1),t instanceof h||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(){const t=this.r.toString(16),e=this.g.toString(16),r=this.b.toString(16);return`#${t.length<2?"0"+t:t}${e.length<2?"0"+e:e}${r.length<2?"0"+r:r}`}toCss(t=!1){const e=this.r+", "+this.g+", "+this.b;return t?`rgba(${e}, ${this.a})`:`rgb(${e})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(t=h.AlphaMode.ALWAYS){const e=l(this.r),r=l(this.g),i=l(this.b);return t===h.AlphaMode.ALWAYS||1!==this.a?[e,r,i,l(255*this.a)]:[e,r,i]}clone(){return new h(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(t){return null!=t&&t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a}_sanitize(){return this.r=Math.round(u(this.r,0,255)),this.g=Math.round(u(this.g,0,255)),this.b=Math.round(u(this.b,0,255)),this.a=u(this.a,0,1),this}_set(t,e,r,i){this.r=t,this.g=e,this.b=r,this.a=i}}h.prototype.declaredClass="esri.Color",i=h||(h={}),(n=i.AlphaMode||(i.AlphaMode={}))[n.ALWAYS=0]="ALWAYS",n[n.UNLESS_OPAQUE=1]="UNLESS_OPAQUE";const c=h},5732:(t,e,r)=>{r.d(e,{c:()=>i,g:()=>n});var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}},88669:(t,e,r)=>{function i(){return[0,0,0,0]}function n(t,e,r,i){return[t,e,r,i]}function s(t,e){return new Float64Array(t,e,4)}function a(){return n(1,1,1,1)}function o(){return n(1,0,0,0)}function l(){return n(0,1,0,0)}function u(){return n(0,0,1,0)}function h(){return n(0,0,0,1)}r.d(e,{a:()=>s,c:()=>i,f:()=>n});const c=a(),p=o(),y=l(),f=u(),_=h();Object.freeze(Object.defineProperty({__proto__:null,ONES:c,UNIT_W:_,UNIT_X:p,UNIT_Y:y,UNIT_Z:f,ZEROS:[0,0,0,0],clone:function(t){return[t[0],t[1],t[2],t[3]]},create:i,createView:s,fromArray:function(t,e=[0,0,0,0]){const r=Math.min(4,t.length);for(let i=0;i<r;++i)e[i]=t[i];return e},fromValues:n,ones:a,unitW:h,unitX:o,unitY:l,unitZ:u,zeros:function(){return[0,0,0,0]}},Symbol.toStringTag,{value:"Module"}))},3892:(t,e,r)=>{function i(t){return"h"in t&&"s"in t&&"v"in t}function n(t){return"l"in t&&"a"in t&&"b"in t}function s(t){return"l"in t&&"c"in t&&"h"in t}r.d(e,{Y3:()=>_,_Y:()=>f,sJ:()=>m,xr:()=>y}),r(22303),r(88669);const a=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],o=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]];function l(t,e){const r=[];let i,n;if(t[0].length!==e.length)throw new Error("dimensions do not match");const s=t.length,a=t[0].length;let o=0;for(i=0;i<s;i++){for(o=0,n=0;n<a;n++)o+=t[i][n]*e[n];r.push(o)}return r}function u(t){const e=[t.r/255,t.g/255,t.b/255].map((t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4)),r=l(a,e);return{x:100*r[0],y:100*r[1],z:100*r[2]}}function h(t){const e=l(o,[t.x/100,t.y/100,t.z/100]).map((t=>{const e=t<=.0031308?12.92*t:1.055*t**(1/2.4)-.055;return Math.min(1,Math.max(e,0))}));return{r:Math.round(255*e[0]),g:Math.round(255*e[1]),b:Math.round(255*e[2])}}function c(t){const e=[t.x/95.047,t.y/100,t.z/108.883].map((t=>t>(6/29)**3?t**(1/3):1/3*(29/6)**2*t+4/29));return{l:116*e[1]-16,a:500*(e[0]-e[1]),b:200*(e[1]-e[2])}}function p(t){const e=t.l,r=[(e+16)/116+t.a/500,(e+16)/116,(e+16)/116-t.b/200].map((t=>t>6/29?t**3:3*(6/29)**2*(t-4/29)));return{x:95.047*r[0],y:100*r[1],z:108.883*r[2]}}function y(t){return function(t){return"r"in t&&"g"in t&&"b"in t}(t)?t:s(t)?function(t){return h(p(function(t){const e=t.l,r=t.c,i=t.h;return{l:e,a:r*Math.cos(i),b:r*Math.sin(i)}}(t)))}(t):n(t)?function(t){return h(p(t))}(t):function(t){return"x"in t&&"y"in t&&"z"in t}(t)?h(t):i(t)?function(t){const e=(t.h+360)%360/60,r=t.s/100,i=t.v/100*255,n=i*r,s=n*(1-Math.abs(e%2-1));let a;switch(Math.floor(e)){case 0:a={r:n,g:s,b:0};break;case 1:a={r:s,g:n,b:0};break;case 2:a={r:0,g:n,b:s};break;case 3:a={r:0,g:s,b:n};break;case 4:a={r:s,g:0,b:n};break;case 5:case 6:a={r:n,g:0,b:s};break;default:a={r:0,g:0,b:0}}return a.r=Math.round(a.r+i-n),a.g=Math.round(a.g+i-n),a.b=Math.round(a.b+i-n),a}(t):t}function f(t){return i(t)?t:function(t){const e=t.r,r=t.g,i=t.b,n=Math.max(e,r,i),s=n-Math.min(e,r,i);let a=n,o=0===s?0:n===e?(r-i)/s%6:n===r?(i-e)/s+2:(e-r)/s+4,l=0===s?0:s/a;return o<0&&(o+=6),o*=60,l*=100,a*=100/255,{h:o,s:l,v:a}}(y(t))}function _(t){return n(t)?t:function(t){return c(u(t))}(y(t))}function m(t){return s(t)?t:function(t){return function(t){const e=t.l,r=t.a,i=t.b,n=Math.sqrt(r*r+i*i);let s=Math.atan2(i,r);return s=s>0?s:s+2*Math.PI,{l:e,c:n,h:s}}(c(u(t)))}(y(t))}},59255:(t,e,r)=>{var i,n,s;r.d(e,{E9:()=>a,I6:()=>u,Vl:()=>i,bN:()=>l}),(s=i||(i={}))[s.Unknown=0]="Unknown",s[s.Point=1]="Point",s[s.LineString=2]="LineString",s[s.Polygon=3]="Polygon";class a{constructor(t,e){this.x=t,this.y=e}clone(){return new a(this.x,this.y)}equals(t,e){return t===this.x&&e===this.y}isEqual(t){return t.x===this.x&&t.y===this.y}setCoords(t,e){this.x=t,this.y=e}normalize(){const t=this.x,e=this.y,r=Math.sqrt(t*t+e*e);this.x/=r,this.y/=r}rightPerpendicular(){const t=this.x;this.x=this.y,this.y=-t}move(t,e){this.x+=t,this.y+=e}assign(t){this.x=t.x,this.y=t.y}assignAdd(t,e){this.x=t.x+e.x,this.y=t.y+e.y}assignSub(t,e){this.x=t.x-e.x,this.y=t.y-e.y}rotate(t,e){const r=this.x,i=this.y;this.x=r*t-i*e,this.y=r*e+i*t}scale(t){this.x*=t,this.y*=t}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}static distance(t,e){const r=e.x-t.x,i=e.y-t.y;return Math.sqrt(r*r+i*i)}static add(t,e){return new a(t.x+e.x,t.y+e.y)}static sub(t,e){return new a(t.x-e.x,t.y-e.y)}}class o{constructor(t,e,r){this.ratio=t,this.x=e,this.y=r}}class l{constructor(t,e,r,i=8,n=8){this._lines=[],this._starts=[],this.validateTessellation=!0,this._pixelRatio=i,this._pixelMargin=n,this._tileSize=512*i,this._dz=t,this._yPos=e,this._xPos=r}setPixelMargin(t){t!==this._pixelMargin&&(this._pixelMargin=t,this.setExtent(this._extent))}setExtent(t){this._extent=t,this._finalRatio=this._tileSize/t*(1<<this._dz);let e=this._pixelRatio*this._pixelMargin;e/=this._finalRatio;const r=t>>this._dz;e>r&&(e=r),this._margin=e,this._xmin=r*this._xPos-e,this._ymin=r*this._yPos-e,this._xmax=this._xmin+r+2*e,this._ymax=this._ymin+r+2*e}reset(t){this._type=t,this._lines=[],this._starts=[],this._line=null,this._start=0}moveTo(t,e){this._pushLine(),this._prevIsIn=this._isIn(t,e),this._moveTo(t,e,this._prevIsIn),this._prevPt=new a(t,e),this._firstPt=new a(t,e),this._dist=0}lineTo(t,e){const r=this._isIn(t,e),i=new a(t,e),n=a.distance(this._prevPt,i);let s,l,u,h,c,p,y,f;if(r)this._prevIsIn?this._lineTo(t,e,!0):(s=this._prevPt,l=i,u=this._intersect(l,s),this._start=this._dist+n*(1-this._r),this._lineTo(u.x,u.y,!0),this._lineTo(l.x,l.y,!0));else if(this._prevIsIn)l=this._prevPt,s=i,u=this._intersect(l,s),this._lineTo(u.x,u.y,!0),this._lineTo(s.x,s.y,!1);else{const t=this._prevPt,e=i;if(t.x<=this._xmin&&e.x<=this._xmin||t.x>=this._xmax&&e.x>=this._xmax||t.y<=this._ymin&&e.y<=this._ymin||t.y>=this._ymax&&e.y>=this._ymax)this._lineTo(e.x,e.y,!1);else{const r=[];if((t.x<this._xmin&&e.x>this._xmin||t.x>this._xmin&&e.x<this._xmin)&&(h=(this._xmin-t.x)/(e.x-t.x),f=t.y+h*(e.y-t.y),f<=this._ymin?p=!1:f>=this._ymax?p=!0:r.push(new o(h,this._xmin,f))),(t.x<this._xmax&&e.x>this._xmax||t.x>this._xmax&&e.x<this._xmax)&&(h=(this._xmax-t.x)/(e.x-t.x),f=t.y+h*(e.y-t.y),f<=this._ymin?p=!1:f>=this._ymax?p=!0:r.push(new o(h,this._xmax,f))),(t.y<this._ymin&&e.y>this._ymin||t.y>this._ymin&&e.y<this._ymin)&&(h=(this._ymin-t.y)/(e.y-t.y),y=t.x+h*(e.x-t.x),y<=this._xmin?c=!1:y>=this._xmax?c=!0:r.push(new o(h,y,this._ymin))),(t.y<this._ymax&&e.y>this._ymax||t.y>this._ymax&&e.y<this._ymax)&&(h=(this._ymax-t.y)/(e.y-t.y),y=t.x+h*(e.x-t.x),y<=this._xmin?c=!1:y>=this._xmax?c=!0:r.push(new o(h,y,this._ymax))),0===r.length)c?p?this._lineTo(this._xmax,this._ymax,!0):this._lineTo(this._xmax,this._ymin,!0):p?this._lineTo(this._xmin,this._ymax,!0):this._lineTo(this._xmin,this._ymin,!0);else if(r.length>1&&r[0].ratio>r[1].ratio)this._start=this._dist+n*r[1].ratio,this._lineTo(r[1].x,r[1].y,!0),this._lineTo(r[0].x,r[0].y,!0);else{this._start=this._dist+n*r[0].ratio;for(let t=0;t<r.length;t++)this._lineTo(r[t].x,r[t].y,!0)}this._lineTo(e.x,e.y,!1)}}this._dist+=n,this._prevIsIn=r,this._prevPt=i}close(){if(this._line.length>2){const t=this._firstPt,e=this._prevPt;t.x===e.x&&t.y===e.y||this.lineTo(t.x,t.y);const r=this._line;let i=r.length;for(;i>=4&&(r[0].x===r[1].x&&r[0].x===r[i-2].x||r[0].y===r[1].y&&r[0].y===r[i-2].y);)r.pop(),r[0].x=r[i-2].x,r[0].y=r[i-2].y,--i}}result(t=!0){return this._pushLine(),0===this._lines.length?null:(this._type===i.Polygon&&t&&h.simplify(this._tileSize,this._margin*this._finalRatio,this._lines),this._lines)}resultWithStarts(){if(this._type!==i.LineString)throw new Error("Only valid for lines");this._pushLine();const t=this._lines,e=t.length;if(0===e)return null;const r=[];for(let i=0;i<e;i++)r.push({line:t[i],start:this._starts[i]||0});return r}_isIn(t,e){return t>=this._xmin&&t<=this._xmax&&e>=this._ymin&&e<=this._ymax}_intersect(t,e){let r,i,n;if(e.x>=this._xmin&&e.x<=this._xmax)i=e.y<=this._ymin?this._ymin:this._ymax,n=(i-t.y)/(e.y-t.y),r=t.x+n*(e.x-t.x);else if(e.y>=this._ymin&&e.y<=this._ymax)r=e.x<=this._xmin?this._xmin:this._xmax,n=(r-t.x)/(e.x-t.x),i=t.y+n*(e.y-t.y);else{i=e.y<=this._ymin?this._ymin:this._ymax,r=e.x<=this._xmin?this._xmin:this._xmax;const s=(r-t.x)/(e.x-t.x),a=(i-t.y)/(e.y-t.y);s<a?(n=s,i=t.y+s*(e.y-t.y)):(n=a,r=t.x+a*(e.x-t.x))}return this._r=n,new a(r,i)}_pushLine(){this._line&&(this._type===i.Point?this._line.length>0&&(this._lines.push(this._line),this._starts.push(this._start)):this._type===i.LineString?this._line.length>1&&(this._lines.push(this._line),this._starts.push(this._start)):this._type===i.Polygon&&this._line.length>3&&(this._lines.push(this._line),this._starts.push(this._start))),this._line=[],this._start=0}_moveTo(t,e,r){this._type!==i.Polygon?r&&(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.push(new a(t,e))):(r||(t<this._xmin&&(t=this._xmin),t>this._xmax&&(t=this._xmax),e<this._ymin&&(e=this._ymin),e>this._ymax&&(e=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.push(new a(t,e)),this._isH=!1,this._isV=!1)}_lineTo(t,e,r){let n,s;if(this._type!==i.Polygon)if(r){if(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.length>0&&(n=this._line[this._line.length-1],n.equals(t,e)))return;this._line.push(new a(t,e))}else this._line&&this._line.length>0&&this._pushLine();else if(r||(t<this._xmin&&(t=this._xmin),t>this._xmax&&(t=this._xmax),e<this._ymin&&(e=this._ymin),e>this._ymax&&(e=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line&&this._line.length>0){n=this._line[this._line.length-1];const r=n.x===t,i=n.y===e;if(r&&i)return;this._isH&&r||this._isV&&i?(n.x=t,n.y=e,s=this._line[this._line.length-2],s.x===t&&s.y===e?(this._line.pop(),this._line.length<=1?(this._isH=!1,this._isV=!1):(s=this._line[this._line.length-2],this._isH=s.x===t,this._isV=s.y===e)):(this._isH=s.x===t,this._isV=s.y===e)):(this._line.push(new a(t,e)),this._isH=r,this._isV=i)}else this._line.push(new a(t,e))}}class u{setExtent(t){this._ratio=4096===t?1:4096/t}get validateTessellation(){return this._ratio<1}reset(t){this._lines=[],this._line=null}moveTo(t,e){this._line&&this._lines.push(this._line),this._line=[];const r=this._ratio;this._line.push(new a(t*r,e*r))}lineTo(t,e){const r=this._ratio;this._line.push(new a(t*r,e*r))}close(){const t=this._line;t&&!t[0].isEqual(t[t.length-1])&&t.push(t[0])}result(){return this._line&&this._lines.push(this._line),0===this._lines.length?null:this._lines}}!function(t){t[t.sideLeft=0]="sideLeft",t[t.sideRight=1]="sideRight",t[t.sideTop=2]="sideTop",t[t.sideBottom=3]="sideBottom"}(n||(n={}));class h{static simplify(t,e,r){if(!r)return;const i=-e,s=t+e,a=-e,o=t+e,l=[],u=[],c=r.length;for(let t=0;t<c;++t){const e=r[t];if(!e||e.length<2)continue;let h,c=e[0];const p=e.length;for(let r=1;r<p;++r)h=e[r],c.x===h.x&&(c.x<=i&&(c.y>h.y?(l.push(t),l.push(r),l.push(n.sideLeft),l.push(-1)):(u.push(t),u.push(r),u.push(n.sideLeft),u.push(-1))),c.x>=s&&(c.y<h.y?(l.push(t),l.push(r),l.push(n.sideRight),l.push(-1)):(u.push(t),u.push(r),u.push(n.sideRight),u.push(-1)))),c.y===h.y&&(c.y<=a&&(c.x<h.x?(l.push(t),l.push(r),l.push(n.sideTop),l.push(-1)):(u.push(t),u.push(r),u.push(n.sideTop),u.push(-1))),c.y>=o&&(c.x>h.x?(l.push(t),l.push(r),l.push(n.sideBottom),l.push(-1)):(u.push(t),u.push(r),u.push(n.sideBottom),u.push(-1)))),c=h}if(0===l.length||0===u.length)return;h.fillParent(r,u,l),h.fillParent(r,l,u);const p=[];h.calcDeltas(p,u,l),h.calcDeltas(p,l,u),h.addDeltas(p,r)}static fillParent(t,e,r){const i=r.length,s=e.length;for(let a=0;a<s;a+=4){const s=e[a],o=e[a+1],l=e[a+2],u=t[s][o-1],h=t[s][o];let p=8092,y=-1;for(let e=0;e<i;e+=4){if(r[e+2]!==l)continue;const i=r[e],s=r[e+1],a=t[i][s-1],o=t[i][s];switch(l){case n.sideLeft:case n.sideRight:if(c(u.y,a.y,o.y)&&c(h.y,a.y,o.y)){const t=Math.abs(o.y-a.y);t<p&&(p=t,y=e)}break;case n.sideTop:case n.sideBottom:if(c(u.x,a.x,o.x)&&c(h.x,a.x,o.x)){const t=Math.abs(o.x-a.x);t<p&&(p=t,y=e)}}}e[a+3]=y}}static calcDeltas(t,e,r){const i=e.length;for(let n=0;n<i;n+=4){const i=[],s=h.calcDelta(n,e,r,i);t.push(e[n]),t.push(e[n+1]),t.push(e[n+2]),t.push(s)}}static calcDelta(t,e,r,i){const n=e[t+3];if(-1===n)return 0;const s=i.length;return s>1&&i[s-2]===n?0:(i.push(n),h.calcDelta(n,r,e,i)+1)}static addDeltas(t,e){const r=t.length;let i=0;for(let e=0;e<r;e+=4){const r=t[e+3];r>i&&(i=r)}for(let s=0;s<r;s+=4){const r=e[t[s]],a=t[s+1],o=i-t[s+3];switch(t[s+2]){case n.sideLeft:r[a-1].x-=o,r[a].x-=o,1===a&&(r[r.length-1].x-=o),a===r.length-1&&(r[0].x-=o);break;case n.sideRight:r[a-1].x+=o,r[a].x+=o,1===a&&(r[r.length-1].x+=o),a===r.length-1&&(r[0].x+=o);break;case n.sideTop:r[a-1].y-=o,r[a].y-=o,1===a&&(r[r.length-1].y-=o),a===r.length-1&&(r[0].y-=o);break;case n.sideBottom:r[a-1].y+=o,r[a].y+=o,1===a&&(r[r.length-1].y+=o),a===r.length-1&&(r[0].y+=o)}}}}const c=(t,e,r)=>t>=e&&t<=r||t>=r&&t<=e},31363:(t,e,r)=>{r.d(e,{B1:()=>i,DQ:()=>u,DT:()=>o,JJ:()=>n,Or:()=>h,_U:()=>s,k3:()=>c,sX:()=>p});const i=Number.POSITIVE_INFINITY,n=Math.PI,s=2*n,a=128/n,o=n/180,l=1/Math.LN2;function u(t,e){return(t%=e)>=0?t:t+e}function h(t){return u(t*a,256)}function c(t){return Math.log(t)*l}function p(t,e,r){return t*(1-r)+e*r}},26084:(t,e,r)=>{r.d(e,{Z:()=>i});class i{constructor(t){this._array=[],t<=0&&console.error("strideInBytes must be positive!"),this._stride=t}get array(){return this._array}get index(){return 4*this._array.length/this._stride}get itemSize(){return this._stride}get sizeInBytes(){return 4*this._array.length}reset(){this.array.length=0}toBuffer(){return new Uint32Array(this._array).buffer}static i1616to32(t,e){return 65535&t|e<<16}static i8888to32(t,e,r,i){return 255&t|(255&e)<<8|(255&r)<<16|i<<24}static i8816to32(t,e,r){return 255&t|(255&e)<<8|r<<16}}},4215:(t,e,r)=>{var i,n,s;r.d(e,{Fr:()=>s,_K:()=>n,al:()=>i}),function(t){t[t.FILL=1]="FILL",t[t.LINE=2]="LINE",t[t.SYMBOL=3]="SYMBOL",t[t.CIRCLE=4]="CIRCLE"}(i||(i={})),function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.FILL=1]="FILL",t[t.OUTLINE=2]="OUTLINE",t[t.LINE=3]="LINE",t[t.ICON=4]="ICON",t[t.CIRCLE=5]="CIRCLE",t[t.TEXT=6]="TEXT",t[t.TILEINFO=7]="TILEINFO"}(n||(n={})),function(t){t[t.PAINTER_CHANGED=0]="PAINTER_CHANGED",t[t.LAYOUT_CHANGED=1]="LAYOUT_CHANGED",t[t.LAYER_CHANGED=2]="LAYER_CHANGED",t[t.LAYER_REMOVED=3]="LAYER_REMOVED",t[t.SPRITES_CHANGED=4]="SPRITES_CHANGED"}(s||(s={}))},21315:(t,e,r)=>{r.d(e,{R:()=>s,_5:()=>u,aF:()=>a,f2:()=>f,fR:()=>i,nR:()=>l,r1:()=>c,vL:()=>o});var i,n,s,a,o,l,u,h,c,p,y=r(95648);(p=i||(i={}))[p.BACKGROUND=0]="BACKGROUND",p[p.FILL=1]="FILL",p[p.LINE=2]="LINE",p[p.SYMBOL=3]="SYMBOL",p[p.CIRCLE=4]="CIRCLE",function(t){t[t.VISIBLE=0]="VISIBLE",t[t.NONE=1]="NONE"}(n||(n={})),function(t){t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.LINE_CENTER=2]="LINE_CENTER"}(s||(s={})),function(t){t[t.MAP=0]="MAP",t[t.VIEWPORT=1]="VIEWPORT",t[t.AUTO=2]="AUTO"}(a||(a={})),function(t){t[t.AUTO=0]="AUTO",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT"}(o||(o={})),function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.TOP=3]="TOP",t[t.BOTTOM=4]="BOTTOM",t[t.TOP_LEFT=5]="TOP_LEFT",t[t.TOP_RIGHT=6]="TOP_RIGHT",t[t.BOTTOM_LEFT=7]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=8]="BOTTOM_RIGHT"}(l||(l={})),function(t){t[t.NONE=0]="NONE",t[t.UPPERCASE=1]="UPPERCASE",t[t.LOWERCASE=2]="LOWERCASE"}(u||(u={})),function(t){t[t.MAP=0]="MAP",t[t.VIEWPORT=1]="VIEWPORT"}(h||(h={})),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(c||(c={}));class f{}f.backgroundLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:n.VISIBLE}},f.fillLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:n.VISIBLE}},f.lineLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:n.VISIBLE},"line-cap":{type:"enum",values:["butt","round","square"],default:y.RL.BUTT},"line-join":{type:"enum",values:["bevel","round","miter"],default:y.AH.MITER},"line-miter-limit":{type:"number",default:2},"line-round-limit":{type:"number",default:1.05}},f.symbolLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:n.VISIBLE},"symbol-avoid-edges":{type:"boolean",default:!1},"symbol-placement":{type:"enum",values:["point","line","line-center"],default:s.POINT},"symbol-sort-key":{type:"number",default:-1},"symbol-spacing":{type:"number",minimum:1,default:250},"icon-allow-overlap":{type:"boolean",default:!1},"icon-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:l.CENTER},"icon-ignore-placement":{type:"boolean",default:!1},"icon-image":{type:"string"},"icon-keep-upright":{type:"boolean",default:!1},"icon-offset":{type:"array",value:"number",length:2,default:[0,0]},"icon-optional":{type:"boolean",default:!1},"icon-padding":{type:"number",minimum:0,default:2},"icon-rotate":{type:"number",default:0},"icon-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:a.AUTO},"icon-size":{type:"number",minimum:0,default:1},"text-allow-overlap":{type:"boolean",default:!1},"text-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:l.CENTER},"text-field":{type:"string"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"]},"text-ignore-placement":{type:"boolean",default:!1},"text-justify":{type:"enum",values:["auto","left","center","right"],default:o.CENTER},"text-keep-upright":{type:"boolean",default:!0},"text-letter-spacing":{type:"number",default:0},"text-line-height":{type:"number",default:1.2},"text-max-angle":{type:"number",minimum:0,default:45},"text-max-width":{type:"number",minimum:0,default:10},"text-offset":{type:"array",value:"number",length:2,default:[0,0]},"text-optional":{type:"boolean",default:!1},"text-padding":{type:"number",minimum:0,default:2},"text-rotate":{type:"number",default:0},"text-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:a.AUTO},"text-size":{type:"number",minimum:0,default:16},"text-transform":{type:"enum",values:["none","uppercase","lowercase"],default:u.NONE},"text-writing-mode":{type:"array",value:"enum",values:["horizontal","vertical"],default:[c.HORIZONTAL]}},f.circleLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:n.VISIBLE}},f.backgroundPaintDefinition={"background-color":{type:"color",default:[0,0,0,1]},"background-opacity":{type:"number",minimum:0,maximum:1,default:1},"background-pattern":{type:"string"}},f.fillPaintDefinition={"fill-antialias":{type:"boolean",default:!0},"fill-color":{type:"color",default:[0,0,0,1]},"fill-opacity":{type:"number",minimum:0,maximum:1,default:1},"fill-outline-color":{type:"color",default:[0,0,0,0]},"fill-pattern":{type:"string"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0]},"fill-translate-anchor":{type:"enum",values:["map","viewport"],default:h.MAP}},f.linePaintDefinition={"line-blur":{type:"number",minimum:0,default:0},"line-color":{type:"color",default:[0,0,0,1]},"line-dasharray":{type:"array",value:"number",default:[]},"line-gap-width":{type:"number",minimum:0,default:0},"line-offset":{type:"number",default:0},"line-opacity":{type:"number",minimum:0,maximum:1,default:1},"line-pattern":{type:"string"},"line-translate":{type:"array",value:"number",length:2,default:[0,0]},"line-translate-anchor":{type:"enum",values:["map","viewport"],default:h.MAP},"line-width":{type:"number",minimum:0,default:1}},f.symbolPaintDefinition={"icon-color":{type:"color",default:[0,0,0,1]},"icon-halo-blur":{type:"number",minimum:0,default:0},"icon-halo-color":{type:"color",default:[0,0,0,0]},"icon-halo-width":{type:"number",minimum:0,default:0},"icon-opacity":{type:"number",minimum:0,maximum:1,default:1},"icon-translate":{type:"array",value:"number",length:2,default:[0,0]},"icon-translate-anchor":{type:"enum",values:["map","viewport"],default:h.MAP},"text-color":{type:"color",default:[0,0,0,1]},"text-halo-blur":{type:"number",minimum:0,default:0},"text-halo-color":{type:"color",default:[0,0,0,0]},"text-halo-width":{type:"number",minimum:0,default:0},"text-opacity":{type:"number",minimum:0,maximum:1,default:1},"text-translate":{type:"array",value:"number",length:2,default:[0,0]},"text-translate-anchor":{type:"enum",values:["map","viewport"],default:h.MAP}},f.rasterPaintDefinition={"raster-opacity":{type:"number",minimum:0,maximum:1,default:1},"raster-hue-rotate":{type:"number",default:0},"raster-brightness-min":{type:"number",minimum:0,maximum:1,default:0},"raster-brightness-max":{type:"number",minimum:0,maximum:1,default:1},"raster-saturation":{type:"number",minimum:-1,maximum:1,default:0},"raster-contrast":{type:"number",minimum:-1,maximum:1,default:0},"raster-fade-duration":{type:"number",minimum:0,default:300}},f.circlePaintDefinition={"circle-blur":{type:"number",minimum:0,default:0},"circle-color":{type:"color",default:[0,0,0,1]},"circle-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-radius":{type:"number",minimum:0,default:5},"circle-stroke-color":{type:"color",default:[0,0,0,1]},"circle-stroke-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-stroke-width":{type:"number",minimum:0,default:0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0]},"circle-translate-anchor":{type:"enum",values:["map","viewport"],default:h.MAP}}},7333:(t,e,r)=>{r.d(e,{Et:()=>Lt,sj:()=>Ut,Le:()=>Pt,_L:()=>Bt,gf:()=>St,jG:()=>Ot,nj:()=>Gt});var i,n,s=r(4215),a=r(26084);!function(t){t[t.R8_SIGNED=0]="R8_SIGNED",t[t.R8_UNSIGNED=1]="R8_UNSIGNED",t[t.R16_SIGNED=2]="R16_SIGNED",t[t.R16_UNSIGNED=3]="R16_UNSIGNED",t[t.R8G8_SIGNED=4]="R8G8_SIGNED",t[t.R8G8_UNSIGNED=5]="R8G8_UNSIGNED",t[t.R16G16_SIGNED=6]="R16G16_SIGNED",t[t.R16G16_UNSIGNED=7]="R16G16_UNSIGNED",t[t.R8G8B8A8_SIGNED=8]="R8G8B8A8_SIGNED",t[t.R8G8B8A8_UNSIGNED=9]="R8G8B8A8_UNSIGNED",t[t.R8G8B8A8_COLOR=10]="R8G8B8A8_COLOR",t[t.R16G16B16A16_DASHARRAY=11]="R16G16B16A16_DASHARRAY",t[t.R16G16B16A16_PATTERN=12]="R16G16B16A16_PATTERN"}(i||(i={})),function(t){t[t.UNIFORM=0]="UNIFORM",t[t.DATA_DRIVEN=1]="DATA_DRIVEN",t[t.INTERPOLATED_DATA_DRIVEN=2]="INTERPOLATED_DATA_DRIVEN",t[t.UNUSED=3]="UNUSED"}(n||(n={}));var o=r(35371),l=r(21968);class u{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this._layoutInfo||this._buildAttributesInfo(),this._stride}getAttributeLocations(){return 0===this._locations.size&&this._buildAttributesInfo(),this._locations}getLayoutInfo(){return this._layoutInfo||this._buildAttributesInfo(),this._layoutInfo}getEncodingInfos(){return this._propertyEncodingInfo||this._buildAttributesInfo(),this._propertyEncodingInfo}getUniforms(){return this._uniforms||this._buildAttributesInfo(),this._uniforms}getShaderHeader(){return this._shaderHeader||this._buildAttributesInfo(),this._shaderHeader}getShaderMain(){return this._shaderMain||this._buildAttributesInfo(),this._shaderMain}setDataUniforms(t,e,r,i,n){const s=this.getUniforms();for(const a of s){const{name:s,type:o,getValue:l}=a,u=l(r,e,i,n);if(null!==u)switch(o){case"float":t.setUniform1f(s,u);break;case"vec2":t.setUniform2fv(s,u);break;case"vec4":t.setUniform4fv(s,u)}}}encodeAttributes(t,e,r,n){const s=this.attributesInfo(),a=this.getEncodingInfos(),o=[];let l=0,u=0;for(const h of Object.keys(a)){const c=a[h],{type:p,precisionFactor:y,isLayout:f}=s[h],_=f?r.getLayoutProperty(h):r.getPaintProperty(h),m=_.interpolator?.getInterpolationRange(e);let g=0;for(const r of c){const{offset:s,bufferElementsToAdd:a}=r;if(a>0){for(let t=0;t<a;t++)o.push(0);l+=u,u=r.bufferElementsToAdd}const h=n??_.getValue(m?m[g]:e,t);switch(p){case i.R8_SIGNED:case i.R8_UNSIGNED:o[l]|=this._encodeByte(h*(y||1),8*s);break;case i.R16_SIGNED:case i.R16_UNSIGNED:o[l]|=this._encodeShort(h*(y||1),8*s);break;case i.R8G8_SIGNED:case i.R8G8_UNSIGNED:o[l]|=this._encodeByte(h*(y||1),8*s),o[l]|=this._encodeByte(h*(y||1),8*s+8);break;case i.R16G16_SIGNED:case i.R16G16_UNSIGNED:o[l]|=this._encodeShort(h*(y||1),8*s),o[l]|=this._encodeShort(h*(y||1),8*s+16);break;case i.R8G8B8A8_SIGNED:case i.R8G8B8A8_UNSIGNED:o[l]|=this._encodeByte(h*(y||1),8*s),o[l]|=this._encodeByte(h*(y||1),8*s+8),o[l]|=this._encodeByte(h*(y||1),8*s+16),o[l]|=this._encodeByte(h*(y||1),8*s+24);break;case i.R8G8B8A8_COLOR:o[l]=this._encodeColor(h);break;case i.R16G16B16A16_DASHARRAY:case i.R16G16B16A16_PATTERN:this._encodePattern(l,o,h);break;default:throw new Error("Unsupported encoding type")}g++}}return o}getAtributeState(t){let e=0;const r=3+2*t;return e|=this._bit(r),e|=this._bit(r+1)<<1,e}_buildAttributesInfo(){const t=[],e={},r={};let i=-1;const s=this.attributesInfo(),a=this.attributes();let l=-1;for(const o of a){l++;const a=this.getAtributeState(l);if(a===n.UNIFORM||a===n.UNUSED)continue;const h=s[o],c=[];e[o]=c;const p=h.type;for(let e=0;e<a;e++){const{dataType:e,bytesPerElement:n,count:s,normalized:a}=u._encodingInfo[p],o=n*s,l=`${e}-${!0===a}`;let h=r[l],y=0;if(!h||h.count+s>4)i++,h={dataIndex:i,count:0,offset:0},4!==s&&(r[l]=h),t.push({location:-1,name:"a_data_"+i,count:s,type:e,normalized:a}),y=Math.ceil(Math.max(o/4,1));else{const e=t[h.dataIndex];e.count+=s,y=Math.ceil(Math.max(e.count*n/4,1))-Math.ceil(Math.max(h.offset/4,1))}c.push({dataIndex:h.dataIndex,offset:h.offset,bufferElementsToAdd:y}),h.offset+=o,h.count+=s}}for(const e of t)switch(e.type){case o.g.BYTE:case o.g.UNSIGNED_BYTE:e.count=4;break;case o.g.SHORT:case o.g.UNSIGNED_SHORT:e.count+=e.count%2}this._buildVertexBufferLayout(t);let h=0;const c=this._layoutInfo.geometry;for(const t of c)this._locations.set(t.name,h++);const p=this._layoutInfo.opacity;if(p)for(const t of p)this._locations.set(t.name,h++);this._buildShaderInfo(t,e),this._propertyEncodingInfo=e}_buildVertexBufferLayout(t){const e={},r=this.geometryInfo();let i=r[0].stride;if(0===t.length)e.geometry=r;else{const n=[];let s=i;for(const e of t)i+=h(e.type)*e.count;for(const t of r)n.push(new l.G(t.name,t.count,t.type,t.offset,i,t.normalized));for(const e of t)n.push(new l.G(e.name,e.count,e.type,s,i,e.normalized)),s+=h(e.type)*e.count;e.geometry=n}this.opacityInfo()&&(e.opacity=this.opacityInfo()),this._layoutInfo=e,this._stride=i}_buildShaderInfo(t,e){let r="\n",s="\n";const a=[];for(const e of t)r+=`attribute ${this._getType(e.count)} ${e.name};\n`;const o=this.attributes(),l=this.attributesInfo();let h=-1;for(const t of o){h++;const{name:o,type:p,precisionFactor:y,isLayout:f}=l[t],_=y&&1!==y?" * "+1/y:"",{bytesPerElement:m,count:g}=u._encodingInfo[p],d=t=>`a_data_${t.dataIndex}${c(g,t.offset,m)}`;switch(this.getAtributeState(h)){case n.UNIFORM:{const e=this._getType(g),n=`u_${o}`;a.push({name:n,type:e,getValue:(e,r,n,s)=>{const a=f?e.getLayoutValue(t,r):e.getPaintValue(t,r);if(p===i.R16G16B16A16_DASHARRAY){const t=e.getDashKey(a,e.getLayoutValue("line-cap",r)),i=s.getMosaicItemPosition(t,!1);if(null==i)return null;const{tl:n,br:o}=i;return[n[0],o[1],o[0],n[1]]}if(p===i.R16G16B16A16_PATTERN){const e=s.getMosaicItemPosition(a,!t.includes("line-"));if(null==e)return null;const{tl:r,br:i}=e;return[r[0],i[1],i[0],r[1]]}if(p===i.R8G8B8A8_COLOR){const t=a[3];return[t*a[0],t*a[1],t*a[2],t]}return a}}),r+=`uniform ${e} ${n};\n`,s+=`${e} ${o} = ${n};\n`}break;case n.DATA_DRIVEN:{const r=d(e[t][0]);s+=`${this._getType(g)} ${o} = ${r}${_};\n`}break;case n.INTERPOLATED_DATA_DRIVEN:{const i=`u_t_${o}`;a.push({name:i,type:"float",getValue:(e,r,i,n)=>(f?e.getLayoutProperty(t):e.getPaintProperty(t)).interpolator.interpolationUniformValue(i,r)}),r+=`uniform float ${i};\n`;const n=d(e[t][0]),l=d(e[t][1]);s+=`${this._getType(g)} ${o} = mix(${n}${_}, ${l}${_}, ${i});\n`}}}this._shaderHeader=r,this._shaderMain=s,this._uniforms=a}_bit(t){return(this._key&1<<t)>>t}_getType(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4"}throw new Error("Invalid count")}_encodeColor(t){const e=255*t[3];return a.Z.i8888to32(t[0]*e,t[1]*e,t[2]*e,e)}_encodePattern(t,e,r){if(!r||!r.rect)return;const i=r.rect,n=r.width,s=r.height;e[t]=this._encodeShort(i.x+2,0),e[t]|=this._encodeShort(i.y+2+s,16),e[t+1]=this._encodeShort(i.x+2+n,0),e[t+1]|=this._encodeShort(i.y+2,16)}_encodeByte(t,e){return(255&t)<<e}_encodeShort(t,e){return(65535&t)<<e}}u._encodingInfo={[i.R8_SIGNED]:{dataType:o.g.BYTE,bytesPerElement:1,count:1,normalized:!1},[i.R8_UNSIGNED]:{dataType:o.g.UNSIGNED_BYTE,bytesPerElement:1,count:1,normalized:!1},[i.R16_SIGNED]:{dataType:o.g.SHORT,bytesPerElement:2,count:1,normalized:!1},[i.R16_UNSIGNED]:{dataType:o.g.UNSIGNED_SHORT,bytesPerElement:2,count:1,normalized:!1},[i.R8G8_SIGNED]:{dataType:o.g.BYTE,bytesPerElement:1,count:2,normalized:!1},[i.R8G8_UNSIGNED]:{dataType:o.g.UNSIGNED_BYTE,bytesPerElement:1,count:2,normalized:!1},[i.R16G16_SIGNED]:{dataType:o.g.SHORT,bytesPerElement:2,count:2,normalized:!1},[i.R16G16_UNSIGNED]:{dataType:o.g.UNSIGNED_SHORT,bytesPerElement:2,count:2,normalized:!1},[i.R8G8B8A8_SIGNED]:{dataType:o.g.BYTE,bytesPerElement:1,count:4,normalized:!1},[i.R8G8B8A8_UNSIGNED]:{dataType:o.g.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!1},[i.R8G8B8A8_COLOR]:{dataType:o.g.UNSIGNED_BYTE,bytesPerElement:1,count:4,normalized:!0},[i.R16G16B16A16_DASHARRAY]:{dataType:o.g.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1},[i.R16G16B16A16_PATTERN]:{dataType:o.g.UNSIGNED_SHORT,bytesPerElement:2,count:4,normalized:!1}};const h=t=>{switch(t){case o.g.FLOAT:case o.g.INT:case o.g.UNSIGNED_INT:return 4;case o.g.SHORT:case o.g.UNSIGNED_SHORT:return 2;case o.g.BYTE:case o.g.UNSIGNED_BYTE:return 1}},c=(t,e,r)=>{const i=e/r;if(1===t)switch(i){case 0:return".x";case 1:return".y";case 2:return".z";case 3:return".w"}else if(2===t)switch(i){case 0:return".xy";case 1:return".yz";case 2:return".zw"}else if(3===t)switch(i){case 0:return".xyz";case 1:return".yzw"}return""};class p extends u{constructor(t){super(t)}geometryInfo(){return p.GEOMETRY_LAYOUT}opacityInfo(){return null}attributes(){return p.ATTRIBUTES}attributesInfo(){return p.ATTRIBUTES_INFO}}p.ATTRIBUTES=[],p.GEOMETRY_LAYOUT=[new l.G("a_pos",2,o.g.BYTE,0,2)],p.ATTRIBUTES_INFO={};class y extends u{constructor(t){super(t)}geometryInfo(){return y.GEOMETRY_LAYOUT}opacityInfo(){return null}attributes(){return y.ATTRIBUTES}attributesInfo(){return y.ATTRIBUTES_INFO}}y.ATTRIBUTES=["circle-radius","circle-color","circle-opacity","circle-stroke-width","circle-stroke-color","circle-stroke-opacity","circle-blur"],y.GEOMETRY_LAYOUT=[new l.G("a_pos",2,o.g.SHORT,0,4)],y.ATTRIBUTES_INFO={"circle-radius":{name:"radius",type:i.R8_UNSIGNED},"circle-color":{name:"color",type:i.R8G8B8A8_COLOR},"circle-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100},"circle-stroke-width":{name:"stroke_width",type:i.R8_UNSIGNED,precisionFactor:4},"circle-stroke-color":{name:"stroke_color",type:i.R8G8B8A8_COLOR},"circle-stroke-opacity":{name:"stroke_opacity",type:i.R8_UNSIGNED,precisionFactor:100},"circle-blur":{name:"blur",type:i.R8_UNSIGNED,precisionFactor:32}};class f extends u{constructor(t){super(t)}geometryInfo(){return f.GEOMETRY_LAYOUT}opacityInfo(){return null}attributes(){return f.ATTRIBUTES}attributesInfo(){return f.ATTRIBUTES_INFO}}f.ATTRIBUTES=["fill-color","fill-opacity","fill-pattern"],f.GEOMETRY_LAYOUT=[new l.G("a_pos",2,o.g.SHORT,0,4)],f.ATTRIBUTES_INFO={"fill-color":{name:"color",type:i.R8G8B8A8_COLOR},"fill-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100},"fill-pattern":{name:"tlbr",type:i.R16G16B16A16_PATTERN,isOptional:!0}};class _ extends u{constructor(t,e){super(t),this._usefillColor=e}geometryInfo(){return _.GEOMETRY_LAYOUT}opacityInfo(){return null}attributes(){return this._usefillColor?_.ATTRIBUTES_FILL:_.ATTRIBUTES_OUTLINE}attributesInfo(){return this._usefillColor?_.ATTRIBUTES_INFO_FILL:_.ATTRIBUTES_INFO_OUTLINE}}_.ATTRIBUTES_OUTLINE=["fill-outline-color","fill-opacity"],_.ATTRIBUTES_FILL=["fill-color","fill-opacity"],_.GEOMETRY_LAYOUT=[new l.G("a_pos",2,o.g.SHORT,0,8),new l.G("a_offset",2,o.g.BYTE,4,8),new l.G("a_xnormal",2,o.g.BYTE,6,8)],_.ATTRIBUTES_INFO_OUTLINE={"fill-outline-color":{name:"color",type:i.R8G8B8A8_COLOR},"fill-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100}},_.ATTRIBUTES_INFO_FILL={"fill-color":{name:"color",type:i.R8G8B8A8_COLOR},"fill-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100}};class m extends u{constructor(t){super(t)}geometryInfo(){return m.GEOMETRY_LAYOUT}opacityInfo(){return null}attributes(){return m.ATTRIBUTES}attributesInfo(){return m.ATTRIBUTES_INFO}}m.ATTRIBUTES=["line-blur","line-color","line-gap-width","line-offset","line-opacity","line-width","line-pattern","line-dasharray"],m.GEOMETRY_LAYOUT=[new l.G("a_pos",2,o.g.SHORT,0,16),new l.G("a_extrude_offset",4,o.g.BYTE,4,16),new l.G("a_dir_normal",4,o.g.BYTE,8,16),new l.G("a_accumulatedDistance",2,o.g.UNSIGNED_SHORT,12,16)],m.ATTRIBUTES_INFO={"line-width":{name:"width",type:i.R8_UNSIGNED,precisionFactor:2},"line-gap-width":{name:"gap_width",type:i.R8_UNSIGNED,precisionFactor:2},"line-offset":{name:"offset",type:i.R8_SIGNED,precisionFactor:2},"line-color":{name:"color",type:i.R8G8B8A8_COLOR},"line-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100},"line-blur":{name:"blur",type:i.R8_UNSIGNED,precisionFactor:4},"line-pattern":{name:"tlbr",type:i.R16G16B16A16_PATTERN,isOptional:!0},"line-dasharray":{name:"tlbr",type:i.R16G16B16A16_DASHARRAY,isOptional:!0}};const g=[new l.G("a_pos",2,o.g.SHORT,0,16),new l.G("a_vertexOffset",2,o.g.SHORT,4,16),new l.G("a_texAngleRange",4,o.g.UNSIGNED_BYTE,8,16),new l.G("a_levelInfo",4,o.g.UNSIGNED_BYTE,12,16)],d=[new l.G("a_opacityInfo",1,o.g.UNSIGNED_BYTE,0,1)];class x extends u{constructor(t){super(t)}geometryInfo(){return g}opacityInfo(){return d}attributes(){return x.ATTRIBUTES}attributesInfo(){return x.ATTRIBUTES_INFO}}x.ATTRIBUTES=["icon-color","icon-opacity","icon-halo-blur","icon-halo-color","icon-halo-width","icon-size"],x.ATTRIBUTES_INFO={"icon-color":{name:"color",type:i.R8G8B8A8_COLOR},"icon-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100},"icon-halo-color":{name:"halo_color",type:i.R8G8B8A8_COLOR},"icon-halo-width":{name:"halo_width",type:i.R8_UNSIGNED,precisionFactor:4},"icon-halo-blur":{name:"halo_blur",type:i.R8_UNSIGNED,precisionFactor:4},"icon-size":{name:"size",type:i.R8_UNSIGNED,precisionFactor:32,isLayout:!0}};class b extends u{constructor(t){super(t)}geometryInfo(){return g}opacityInfo(){return d}attributes(){return b.ATTRIBUTES}attributesInfo(){return b.ATTRIBUTES_INFO}}b.ATTRIBUTES=["text-color","text-opacity","text-halo-blur","text-halo-color","text-halo-width","text-size"],b.ATTRIBUTES_INFO={"text-color":{name:"color",type:i.R8G8B8A8_COLOR},"text-opacity":{name:"opacity",type:i.R8_UNSIGNED,precisionFactor:100},"text-halo-color":{name:"halo_color",type:i.R8G8B8A8_COLOR},"text-halo-width":{name:"halo_width",type:i.R8_UNSIGNED,precisionFactor:4},"text-halo-blur":{name:"halo_blur",type:i.R8_UNSIGNED,precisionFactor:4},"text-size":{name:"size",type:i.R8_UNSIGNED,isLayout:!0}};var E=r(22303),T=r(3892),w=r(59255);function I(t,e,r,i){const n=3*t,s=3*(r-t)-n,a=1-n-s,o=3*e,l=3*(i-e)-o,u=1-o-l;function h(t){return((a*t+s)*t+n)*t}function c(t){return(3*a*t+2*s)*t+n}return function(t,e=1e-6){return function(t){return((u*t+l)*t+o)*t}(function(t,e){let r,i,n,s,a,o;for(n=t,o=0;o<8;o++){if(s=h(n)-t,Math.abs(s)<e)return n;if(a=c(n),Math.abs(a)<1e-6)break;n-=s/a}if(r=0,i=1,n=t,n<r)return r;if(n>i)return i;for(;r<i;){if(s=h(n),Math.abs(s-t)<e)return n;t>s?r=n:i=n,n=.5*(i-r)+r}return n}(t,e))}}const v={};v.ease=I(.25,.1,.25,1),v.linear=I(0,0,1,1),v.easeIn=v["ease-in"]=I(.42,0,1,1),v.easeOut=v["ease-out"]=I(0,0,.58,1),v.easeInOut=v["ease-in-out"]=I(.42,0,.58,1);var R=r(31363);const N={kind:"null"},D={kind:"number"},A={kind:"string"},L={kind:"boolean"},P={kind:"color"},S={kind:"object"},O={kind:"value"};function U(t,e){return{kind:"array",itemType:t,n:e}}const B=[N,D,A,L,P,S,U(O)];function G(t){if("array"===t.kind){const e=G(t.itemType);return"number"==typeof t.n?`array<${e}, ${t.n}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}function M(t){if(null===t)return N;if("string"==typeof t)return A;if("boolean"==typeof t)return L;if("number"==typeof t)return D;if(t instanceof E.Z)return P;if(Array.isArray(t)){let e;for(const r of t){const t=M(r);if(e){if(e!==t){e=O;break}}else e=t}return U(e||O,t.length)}return"object"==typeof t?S:O}function k(t,e){if("array"===e.kind)return"array"===t.kind&&(0===t.n&&"value"===t.itemType.kind||k(t.itemType,e.itemType))&&("number"!=typeof e.n||e.n===t.n);if("value"===e.kind)for(const e of B)if(k(t,e))return!0;return e.kind===t.kind}function F(t){if(null===t)return"";const e=typeof t;return"string"===e?t:"number"===e||"boolean"===e?String(t):t instanceof E.Z?t.toString():JSON.stringify(t)}class C{constructor(t){this._parent=t,this._vars={}}add(t,e){this._vars[t]=e}get(t){return this._vars[t]?this._vars[t]:this._parent?this._parent.get(t):null}}class z{constructor(){this.type=O}static parse(t){if(t.length>1)throw new Error('"id" does not expect arguments');return new z}evaluate(t,e){return t?.id}}class V{constructor(){this.type=A}static parse(t){if(t.length>1)throw new Error('"geometry-type" does not expect arguments');return new V}evaluate(t,e){if(!t)return null;switch(t.type){case w.Vl.Point:return"Point";case w.Vl.LineString:return"LineString";case w.Vl.Polygon:return"Polygon";default:return null}}}class ${constructor(){this.type=S}static parse(t){if(t.length>1)throw new Error('"properties" does not expect arguments');return new $}evaluate(t,e){return t?.values}}class Y{constructor(){this.type=D}static parse(t){if(t.length>1)throw new Error('"zoom" does not expect arguments');return new Y}evaluate(t,e){return e}}class H{constructor(t,e,r){this._lhs=t,this._rhs=e,this._compare=r,this.type=L}static parse(t,e,r){if(3!==t.length&&4!==t.length)throw new Error(`"${t[0]}" expects 2 or 3 arguments`);if(4===t.length)throw new Error(`"${t[0]}" collator not supported`);return new H(Tt(t[1],e),Tt(t[2],e),r)}evaluate(t,e){return this._compare(this._lhs.evaluate(t,e),this._rhs.evaluate(t,e))}}class Z{constructor(t){this._arg=t,this.type=L}static parse(t,e){if(2!==t.length)throw new Error('"!" expects 1 argument');return new Z(Tt(t[1],e))}evaluate(t,e){return!this._arg.evaluate(t,e)}}class j{constructor(t){this._args=t,this.type=L}static parse(t,e){const r=[];for(let i=1;i<t.length;i++)r.push(Tt(t[i],e));return new j(r)}evaluate(t,e){for(const r of this._args)if(!r.evaluate(t,e))return!1;return!0}}class K{constructor(t){this._args=t,this.type=L}static parse(t,e){const r=[];for(let i=1;i<t.length;i++)r.push(Tt(t[i],e));return new K(r)}evaluate(t,e){for(const r of this._args)if(r.evaluate(t,e))return!0;return!1}}class q{constructor(t){this._args=t,this.type=L}static parse(t,e){const r=[];for(let i=1;i<t.length;i++)r.push(Tt(t[i],e));return new q(r)}evaluate(t,e){for(const r of this._args)if(r.evaluate(t,e))return!1;return!0}}class W{constructor(t,e,r){this.type=t,this._args=e,this._fallback=r}static parse(t,e,r){if(t.length<4)throw new Error('"case" expects at least 3 arguments');if(t.length%2==1)throw new Error('"case" expects an odd number of arguments');let i;const n=[];for(let s=1;s<t.length-1;s+=2){const a=Tt(t[s],e),o=Tt(t[s+1],e,r);i||(i=o.type),n.push({condition:a,output:o})}const s=Tt(t[t.length-1],e,r);return i||(i=s.type),new W(i,n,s)}evaluate(t,e){for(const r of this._args)if(r.condition.evaluate(t,e))return r.output.evaluate(t,e);return this._fallback.evaluate(t,e)}}class X{constructor(t,e){this.type=t,this._args=e}static parse(t,e){if(t.length<2)throw new Error('"coalesce" expects at least 1 argument');let r;const i=[];for(let n=1;n<t.length;n++){const s=Tt(t[n],e);r||(r=s.type),i.push(s)}return new X(r,i)}evaluate(t,e){for(const r of this._args){const i=r.evaluate(t,e);if(null!==i)return i}return null}}class J{constructor(t,e,r,i,n){this.type=t,this._input=e,this._labels=r,this._outputs=i,this._fallback=n}static parse(t,e){if(t.length<3)throw new Error('"match" expects at least 3 arguments');if(t.length%2==0)throw new Error('"case" expects an even number of arguments');let r;const i=Tt(t[1],e),n=[],s={};let a;for(let i=2;i<t.length-1;i+=2){let o=t[i];Array.isArray(o)||(o=[o]);for(const t of o){const e=typeof t;if("string"!==e&&"number"!==e)throw new Error('"match" requires string or number literal as labels');if(a){if(e!==a)throw new Error('"match" requires labels to have the same type')}else a=e;s[t]=n.length}const l=Tt(t[i+1],e);r||(r=l.type),n.push(l)}return new J(r,i,s,n,Tt(t[t.length-1],e))}evaluate(t,e){const r=this._input.evaluate(t,e);return(this._outputs[this._labels[r]]||this._fallback).evaluate(t,e)}}class Q{constructor(t,e,r,i,n){this._operator=t,this.type=e,this.interpolation=r,this.input=i,this._stops=n}static parse(t,e,r){const i=t[0];if(t.length<5)throw new Error(`"${i}" expects at least 4 arguments`);const n=t[1];if(!Array.isArray(n)||0===n.length)throw new Error(`"${n}" is not a valid interpolation`);switch(n[0]){case"linear":if(1!==n.length)throw new Error("Linear interpolation cannot have parameters");break;case"exponential":if(2!==n.length||"number"!=typeof n[1])throw new Error("Exponential interpolation requires one numeric argument");break;case"cubic-bezier":if(5!==n.length)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1");for(let t=1;t<5;t++){const e=n[t];if("number"!=typeof e||e<0||e>1)throw new Error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1")}break;default:throw new Error(`"${t[0]}" unknown interpolation type "${n[0]}"`)}if(t.length%2!=1)throw new Error(`"${i}" expects an even number of arguments`);const s=Tt(t[2],e,D);let a;"interpolate-hcl"===i||"interpolate-lab"===i?a=P:r&&"value"!==r.kind&&(a=r);const o=[];for(let r=3;r<t.length;r+=2){const n=t[r];if("number"!=typeof n)throw new Error(`"${i}" requires stop inputs as literal numbers`);if(o.length&&o[o.length-1][0]>=n)throw new Error(`"${i}" requires strictly ascending stop inputs`);const s=Tt(t[r+1],e,a);a||(a=s.type),o.push([n,s])}if(a&&a!==P&&a!==D&&("array"!==a.kind||a.itemType!==D))throw new Error(`"${i}" cannot interpolate type ${G(a)}`);return new Q(i,a,n,s,o)}evaluate(t,e){const r=this._stops;if(1===r.length)return r[0][1].evaluate(t,e);const i=this.input.evaluate(t,e);if(i<=r[0][0])return r[0][1].evaluate(t,e);if(i>=r[r.length-1][0])return r[r.length-1][1].evaluate(t,e);let n=0;for(;++n<r.length&&!(i<r[n][0]););const s=r[n-1][0],a=r[n][0],o=Q.interpolationRatio(this.interpolation,i,s,a),l=r[n-1][1].evaluate(t,e),u=r[n][1].evaluate(t,e);if("interpolate"===this._operator){if("array"===this.type.kind&&Array.isArray(l)&&Array.isArray(u))return l.map(((t,e)=>(0,R.sX)(t,u[e],o)));if("color"===this.type.kind&&l instanceof E.Z&&u instanceof E.Z){const t=new E.Z(l),e=new E.Z(u);return new E.Z([(0,R.sX)(t.r,e.r,o),(0,R.sX)(t.g,e.g,o),(0,R.sX)(t.b,e.b,o),(0,R.sX)(t.a,e.a,o)])}if("number"===this.type.kind&&"number"==typeof l&&"number"==typeof u)return(0,R.sX)(l,u,o);throw new Error(`"${this._operator}" cannot interpolate type ${G(this.type)}`)}if("interpolate-hcl"===this._operator){const t=(0,T.sJ)(l),e=(0,T.sJ)(u),r=e.h-t.h,i=(0,T.xr)({h:t.h+o*(r>180||r<-180?r-360*Math.round(r/360):r),c:(0,R.sX)(t.c,e.c,o),l:(0,R.sX)(t.l,e.l,o)});return new E.Z({a:(0,R.sX)(l.a,u.a,o),...i})}if("interpolate-lab"===this._operator){const t=(0,T.Y3)(l),e=(0,T.Y3)(u),r=(0,T.xr)({l:(0,R.sX)(t.l,e.l,o),a:(0,R.sX)(t.a,e.a,o),b:(0,R.sX)(t.b,e.b,o)});return new E.Z({a:(0,R.sX)(l.a,u.a,o),...r})}throw new Error(`Unexpected operator "${this._operator}"`)}interpolationUniformValue(t,e){const r=this._stops;if(1===r.length)return 0;if(t>=r[r.length-1][0])return 0;let i=0;for(;++i<r.length&&!(t<r[i][0]););const n=r[i-1][0],s=r[i][0];return Q.interpolationRatio(this.interpolation,e,n,s)}getInterpolationRange(t){const e=this._stops;if(1===e.length){const t=e[0][0];return[t,t]}const r=e[e.length-1][0];if(t>=r)return[r,r];let i=0;for(;++i<e.length&&!(t<e[i][0]););return[e[i-1][0],e[i][0]]}static interpolationRatio(t,e,r,i){let n=0;return"linear"===t[0]?n=Q._exponentialInterpolationRatio(e,1,r,i):"exponential"===t[0]?n=Q._exponentialInterpolationRatio(e,t[1],r,i):"cubic-bezier"===t[0]&&(n=I(t[1],t[2],t[3],t[4])(Q._exponentialInterpolationRatio(e,1,r,i),1e-5)),n<0?n=0:n>1&&(n=1),n}static _exponentialInterpolationRatio(t,e,r,i){const n=i-r;if(0===n)return 0;const s=t-r;return 1===e?s/n:(e**s-1)/(e**n-1)}}class tt{constructor(t,e,r){this.type=t,this._input=e,this._stops=r}static parse(t,e){if(t.length<5)throw new Error('"step" expects at least 4 arguments');if(t.length%2!=1)throw new Error('"step" expects an even number of arguments');const r=Tt(t[1],e,D);let i;const n=[];n.push([-1/0,Tt(t[2],e)]);for(let r=3;r<t.length;r+=2){const s=t[r];if("number"!=typeof s)throw new Error('"step" requires stop inputs as literal numbers');if(n.length&&n[n.length-1][0]>=s)throw new Error('"step" requires strictly ascending stop inputs');const a=Tt(t[r+1],e);i||(i=a.type),n.push([s,a])}return new tt(i,r,n)}evaluate(t,e){const r=this._stops;if(1===r.length)return r[0][1].evaluate(t,e);const i=this._input.evaluate(t,e);let n=0;for(;++n<r.length&&!(i<r[n][0]););return this._stops[n-1][1].evaluate(t,e)}}class et{constructor(t,e){this.type=t,this._output=e}static parse(t,e,r){if(t.length<4)throw new Error('"let" expects at least 3 arguments');if(t.length%2==1)throw new Error('"let" expects an odd number of arguments');const i=new C(e);for(let r=1;r<t.length-1;r+=2){const n=t[r];if("string"!=typeof n)throw new Error(`"let" requires a string to define variable names - found ${n}`);i.add(n,Tt(t[r+1],e))}const n=Tt(t[t.length-1],i,r);return new et(n.type,n)}evaluate(t,e){return this._output.evaluate(t,e)}}class rt{constructor(t,e){this.type=t,this.output=e}static parse(t,e,r){if(2!==t.length||"string"!=typeof t[1])throw new Error('"var" requires just one literal string argument');const i=e.get(t[1]);if(!i)throw new Error(`${t[1]} must be defined before being used in a "var" expression`);return new rt(r||O,i)}evaluate(t,e){return this.output.evaluate(t,e)}}class it{constructor(t,e,r){this.type=t,this._index=e,this._array=r}static parse(t,e){if(3!==t.length)throw new Error('"at" expects 2 arguments');const r=Tt(t[1],e,D),i=Tt(t[2],e);return new it(i.type.itemType,r,i)}evaluate(t,e){const r=this._index.evaluate(t,e),i=this._array.evaluate(t,e);if(r<0||r>=i.length)throw new Error('"at" index out of bounds');if(r!==Math.floor(r))throw new Error('"at" index must be an integer');return i[r]}}class nt{constructor(t,e){this._key=t,this._obj=e,this.type=O}static parse(t,e){let r,i;switch(t.length){case 2:return r=Tt(t[1],e),new nt(r);case 3:return r=Tt(t[1],e),i=Tt(t[2],e),new nt(r,i);default:throw new Error('"get" expects 1 or 2 arguments')}}evaluate(t,e){const r=this._key.evaluate(t,e);return this._obj?this._obj.evaluate(t,e)[r]:t?.values[r]}}class st{constructor(t,e){this._key=t,this._obj=e,this.type=L}static parse(t,e){let r,i;switch(t.length){case 2:return r=Tt(t[1],e),new st(r);case 3:return r=Tt(t[1],e),i=Tt(t[2],e),new st(r,i);default:throw new Error('"has" expects 1 or 2 arguments')}}evaluate(t,e){const r=this._key.evaluate(t,e);return this._obj?r in this._obj.evaluate(t,e):!!t?.values[r]}}class at{constructor(t,e){this._key=t,this._vals=e,this.type=L}static parse(t,e){if(3!==t.length)throw new Error('"in" expects 2 arguments');return new at(Tt(t[1],e),Tt(t[2],e))}evaluate(t,e){const r=this._key.evaluate(t,e);return this._vals.evaluate(t,e).includes(r)}}class ot{constructor(t,e,r){this._item=t,this._array=e,this._from=r,this.type=D}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"index-of" expects 3 or 4 arguments');const r=Tt(t[1],e),i=Tt(t[2],e);if(4===t.length){const n=Tt(t[3],e,D);return new ot(r,i,n)}return new ot(r,i)}evaluate(t,e){const r=this._item.evaluate(t,e),i=this._array.evaluate(t,e);if(this._from){const n=this._from.evaluate(t,e);if(n!==Math.floor(n))throw new Error('"index-of" index must be an integer');return i.indexOf(r,n)}return i.indexOf(r)}}class lt{constructor(t){this._arg=t,this.type=D}static parse(t,e){if(2!==t.length)throw new Error('"length" expects 2 arguments');const r=Tt(t[1],e);return new lt(r)}evaluate(t,e){const r=this._arg.evaluate(t,e);if("string"==typeof r)return r.length;if(Array.isArray(r))return r.length;throw new Error('"length" expects string or array')}}class ut{constructor(t,e,r,i){this.type=t,this._array=e,this._from=r,this._to=i}static parse(t,e){if(t.length<3||t.length>4)throw new Error('"slice" expects 2 or 3 arguments');const r=Tt(t[1],e),i=Tt(t[2],e,D);if(i.type!==D)throw new Error('"slice" index must return a number');if(4===t.length){const n=Tt(t[3],e,D);if(n.type!==D)throw new Error('"slice" index must return a number');return new ut(r.type,r,i,n)}return new ut(r.type,r,i)}evaluate(t,e){const r=this._array.evaluate(t,e);if(!Array.isArray(r)&&"string"!=typeof r)throw new Error('"slice" input must be an array or a string');const i=this._from.evaluate(t,e);if(i<0||i>=r.length)throw new Error('"slice" index out of bounds');if(i!==Math.floor(i))throw new Error('"slice" index must be an integer');if(this._to){const n=this._to.evaluate(t,e);if(n<0||n>=r.length)throw new Error('"slice" index out of bounds');if(n!==Math.floor(n))throw new Error('"slice" index must be an integer');return r.slice(i,n)}return r.slice(i)}}class ht{constructor(){this.type=L}static parse(t){if(1!==t.length)throw new Error('"has-id" expects no arguments');return new ht}evaluate(t,e){return t&&void 0!==t.id}}class ct{constructor(t,e){this._args=t,this._calculate=e,this.type=D}static parse(t,e,r){const i=t.slice(1).map((t=>Tt(t,e)));return new ct(i,r)}evaluate(t,e){let r;return this._args&&(r=this._args.map((r=>r.evaluate(t,e)))),this._calculate(r)}}class pt{constructor(t,e){this._args=t,this._calculate=e,this.type=D}static parse(t,e){const r=t.slice(1).map((t=>Tt(t,e)));return new pt(r,pt.ops[t[0]])}evaluate(t,e){let r;return this._args&&(r=this._args.map((r=>r.evaluate(t,e)))),this._calculate(r)}}pt.ops={abs:t=>Math.abs(t[0]),acos:t=>Math.acos(t[0]),asin:t=>Math.asin(t[0]),atan:t=>Math.atan(t[0]),ceil:t=>Math.ceil(t[0]),cos:t=>Math.cos(t[0]),e:()=>Math.E,floor:t=>Math.floor(t[0]),ln:t=>Math.log(t[0]),ln2:()=>Math.LN2,log10:t=>Math.log(t[0])/Math.LN10,log2:t=>Math.log(t[0])/Math.LN2,max:t=>Math.max(...t),min:t=>Math.min(...t),pi:()=>Math.PI,round:t=>Math.round(t[0]),sin:t=>Math.sin(t[0]),sqrt:t=>Math.sqrt(t[0]),tan:t=>Math.tan(t[0])};class yt{constructor(t){this._args=t,this.type=A}static parse(t,e){return new yt(t.slice(1).map((t=>Tt(t,e))))}evaluate(t,e){return this._args.map((r=>r.evaluate(t,e))).join("")}}class ft{constructor(t,e){this._arg=t,this._calculate=e,this.type=A}static parse(t,e){if(2!==t.length)throw new Error(`${t[0]} expects 1 argument`);const r=Tt(t[1],e);return new ft(r,ft.ops[t[0]])}evaluate(t,e){return this._calculate(this._arg.evaluate(t,e))}}ft.ops={downcase:t=>t.toLowerCase(),upcase:t=>t.toUpperCase()};class _t{constructor(t){this._args=t,this.type=P}static parse(t,e){if(4!==t.length)throw new Error('"rgb" expects 3 arguments');const r=t.slice(1).map((t=>Tt(t,e)));return new _t(r)}evaluate(t,e){const r=this._validate(this._args[0].evaluate(t,e)),i=this._validate(this._args[1].evaluate(t,e)),n=this._validate(this._args[2].evaluate(t,e));return new E.Z({r,g:i,b:n})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}}class mt{constructor(t){this._args=t,this.type=P}static parse(t,e){if(5!==t.length)throw new Error('"rgba" expects 4 arguments');const r=t.slice(1).map((t=>Tt(t,e)));return new mt(r)}evaluate(t,e){const r=this._validate(this._args[0].evaluate(t,e)),i=this._validate(this._args[1].evaluate(t,e)),n=this._validate(this._args[2].evaluate(t,e)),s=this._validateAlpha(this._args[3].evaluate(t,e));return new E.Z({r,g:i,b:n,a:s})}_validate(t){if("number"!=typeof t||t<0||t>255)throw new Error(`${t}: invalid color component`);return Math.round(t)}_validateAlpha(t){if("number"!=typeof t||t<0||t>1)throw new Error(`${t}: invalid alpha color component`);return t}}class gt{constructor(t){this._color=t,this.type=U(D,4)}static parse(t,e){if(2!==t.length)throw new Error('"to-rgba" expects 1 argument');const r=Tt(t[1],e);return new gt(r)}evaluate(t,e){return new E.Z(this._color.evaluate(t,e)).toRgba()}}class dt{constructor(t,e){this.type=t,this._args=e}static parse(t,e){const r=t[0];if(t.length<2)throw new Error(`${r} expects at least one argument`);let i,n=1;if("array"===r){if(t.length>2){switch(t[1]){case"string":i=A;break;case"number":i=D;break;case"boolean":i=L;break;default:throw new Error('"array" type argument must be string, number or boolean')}n++}else i=O;let e;if(t.length>3){if(e=t[2],null!==e&&("number"!=typeof e||e<0||e!==Math.floor(e)))throw new Error('"array" length argument must be a positive integer literal');n++}i=U(i,e)}else switch(r){case"string":i=A;break;case"number":i=D;break;case"boolean":i=L;break;case"object":i=S}const s=[];for(;n<t.length;n++){const r=Tt(t[n],e);s.push(r)}return new dt(i,s)}evaluate(t,e){let r;for(const i of this._args){const n=i.evaluate(t,e);if(r=M(n),k(r,this.type))return n}throw new Error(`Expected ${G(this.type)} but got ${G(r)}`)}}class xt{constructor(t,e){this.type=t,this._args=e}static parse(t,e){const r=t[0],i=xt.types[r];if(i===L||i===A){if(2!==t.length)throw new Error(`${r} expects one argument`)}else if(t.length<2)throw new Error(`${r} expects at least one argument`);const n=[];for(let r=1;r<t.length;r++){const i=Tt(t[r],e);n.push(i)}return new xt(i,n)}evaluate(t,e){if(this.type===L)return Boolean(this._args[0].evaluate(t,e));if(this.type===A)return F(this._args[0].evaluate(t,e));if(this.type===D){for(const r of this._args){const i=Number(r.evaluate(t,e));if(!isNaN(i))return i}return null}if(this.type===P){for(const r of this._args)try{const i=xt.toColor(r.evaluate(t,e));if(i instanceof E.Z)return i}catch{}return null}}static toBoolean(t){return Boolean(t)}static toString(t){return F(t)}static toNumber(t){const e=Number(t);if(isNaN(e))throw new Error(`"${t}" is not a number`);return e}static toColor(t){if(t instanceof E.Z)return t;if("string"==typeof t){const e=E.Z.fromString(t);if(e)return e;throw new Error(`"${t}" is not a color`)}if(Array.isArray(t))return E.Z.fromArray(t);throw new Error(`"${t}" is not a color`)}}xt.types={"to-boolean":L,"to-color":P,"to-number":D,"to-string":A};class bt{constructor(t){this._val=t,this.type=M(t)}static parse(t){if(2!==t.length)throw new Error('"literal" expects 1 argument');return new bt(t[1])}evaluate(t,e){return this._val}}class Et{constructor(t){this._arg=t,this.type=A}static parse(t,e){if(2!==t.length)throw new Error('"typeof" expects 1 argument');return new Et(Tt(t[1],e))}evaluate(t,e){return G(M(this._arg.evaluate(t,e)))}}function Tt(t,e,r){const i=typeof t;if("string"===i||"boolean"===i||"number"===i||null===t){if(r)switch(r.kind){case"string":"string"!==i&&(t=xt.toString(t));break;case"number":"number"!==i&&(t=xt.toNumber(t));break;case"color":t=xt.toColor(t)}t=["literal",t]}if(!Array.isArray(t)||0===t.length)throw new Error("Expression must be a non empty array");const n=t[0];if("string"!=typeof n)throw new Error("First element of expression must be a string");const s=wt[n];if(void 0===s)throw new Error(`Invalid expression operator "${n}"`);if(!s)throw new Error(`Unimplemented expression operator "${n}"`);return s.parse(t,e,r)}const wt={array:dt,boolean:dt,collator:null,format:null,image:null,literal:bt,number:dt,"number-format":null,object:dt,string:dt,"to-boolean":xt,"to-color":xt,"to-number":xt,"to-string":xt,typeof:Et,accumulated:null,"feature-state":null,"geometry-type":V,id:z,"line-progress":null,properties:$,at:it,get:nt,has:st,in:at,"index-of":ot,length:lt,slice:ut,"!":Z,"!=":class extends H{static parse(t,e){return H.parse(t,e,((t,e)=>t!==e))}},"<":class extends H{static parse(t,e){return H.parse(t,e,((t,e)=>t<e))}},"<=":class extends H{static parse(t,e){return H.parse(t,e,((t,e)=>t<=e))}},"==":class extends H{static parse(t,e){return H.parse(t,e,((t,e)=>t===e))}},">":class extends H{static parse(t,e){return H.parse(t,e,((t,e)=>t>e))}},">=":class extends H{static parse(t,e){return H.parse(t,e,((t,e)=>t>=e))}},all:j,any:K,case:W,coalesce:X,match:J,within:null,interpolate:Q,"interpolate-hcl":Q,"interpolate-lab":Q,step:tt,let:et,var:rt,concat:yt,downcase:ft,"is-supported-script":null,"resolved-locale":null,upcase:ft,rgb:_t,rgba:mt,"to-rgba":gt,"-":class extends ct{static parse(t,e){switch(t.length){case 2:return ct.parse(t,e,(t=>-t[0]));case 3:return ct.parse(t,e,(t=>t[0]-t[1]));default:throw new Error('"-" expects 1 or 2 arguments')}}},"*":class extends ct{static parse(t,e){return ct.parse(t,e,(t=>{let e=1;for(const r of t)e*=r;return e}))}},"/":class extends ct{static parse(t,e){if(3===t.length)return ct.parse(t,e,(t=>t[0]/t[1]));throw new Error('"/" expects 2 arguments')}},"%":class extends ct{static parse(t,e){if(3===t.length)return ct.parse(t,e,(t=>t[0]%t[1]));throw new Error('"%" expects 2 arguments')}},"^":class extends ct{static parse(t,e){if(3===t.length)return ct.parse(t,e,(t=>t[0]**t[1]));throw new Error('"^" expects 1 or 2 arguments')}},"+":class extends ct{static parse(t,e){return ct.parse(t,e,(t=>{let e=0;for(const r of t)e+=r;return e}))}},abs:pt,acos:pt,asin:pt,atan:pt,ceil:pt,cos:pt,e:pt,floor:pt,ln:pt,ln2:pt,log10:pt,log2:pt,max:pt,min:pt,pi:pt,round:pt,sin:pt,sqrt:pt,tan:pt,zoom:Y,"heatmap-density":null,"has-id":ht,none:q};class It{constructor(t){this._expression=t}filter(t,e){if(!this._expression)return!0;try{return this._expression.evaluate(t,e)}catch(t){return console.log(t.message),!0}}static createFilter(t){if(!t)return null;this.isLegacyFilter(t)&&(t=this.convertLegacyFilter(t));try{const e=Tt(t,null,L);return new It(e)}catch(t){return console.log(t.message),null}}static isLegacyFilter(t){if(!Array.isArray(t))return!0;if(0===t.length)return!0;switch(t[0]){case"==":case"!=":case">":case"<":case">=":case"<=":return 3===t.length&&"string"==typeof t[1]&&!Array.isArray(t[2]);case"in":return t.length>=3&&"string"==typeof t[1]&&!Array.isArray(t[2]);case"!in":case"none":case"!has":return!0;case"any":case"all":for(let e=1;e<t.length;e++)if(this.isLegacyFilter(t[e]))return!0;return!1;case"has":return 2===t.length&&("$id"===t[1]||"$type"===t[1]);default:return!1}}static convertLegacyFilter(t){if(!Array.isArray(t)||0===t.length)return!0;const e=t[0];if(1===t.length)return"any"!==e;switch(e){case"==":return It.convertComparison("==",t[1],t[2]);case"!=":return It.negate(It.convertComparison("==",t[1],t[2]));case">":case"<":case">=":case"<=":return It.convertComparison(e,t[1],t[2]);case"in":return It.convertIn(t[1],t.slice(2));case"!in":return It.negate(It.convertIn(t[1],t.slice(2)));case"any":case"all":case"none":return It.convertCombining(e,t.slice(1));case"has":return It.convertHas(t[1]);case"!has":return It.negate(It.convertHas(t[1]));default:throw new Error("Unexpected legacy filter.")}}static convertComparison(t,e,r){switch(e){case"$type":return[t,["geometry-type"],r];case"$id":return[t,["id"],r];default:return[t,["get",e],r]}}static convertIn(t,e){switch(t){case"$type":return["in",["geometry-type"],["literal",e]];case"$id":return["in",["id"],["literal",e]];default:return["in",["get",t],["literal",e]]}}static convertHas(t){switch(t){case"$type":return!0;case"$id":return["has-id"];default:return["has",t]}}static convertCombining(t,e){return[t].concat(e.map(this.convertLegacyFilter))}static negate(t){return["!",t]}}var vt=r(21315);class Rt{constructor(t,e){let r;switch(this.isDataDriven=!1,this.interpolator=null,t.type){case"number":case"color":r=!0;break;case"array":r="number"===t.value;break;default:r=!1}if(null==e&&(e=t.default),Array.isArray(e)&&e.length>0&&wt[e[0]]){const r={number:D,color:P,string:A,boolean:L,enum:A};try{const i=Tt(e,null,"array"===t.type?U(r[t.value]||O,t.length):r[t.type]);this.getValue=this._buildExpression(i,t),this.isDataDriven=!0,i instanceof Q&&i.input instanceof Y&&(this.interpolator=i)}catch(e){console.log(e.message),this.getValue=this._buildSimple(t.default)}return}r&&"interval"===e.type&&(r=!1);const i=e&&e.stops&&e.stops.length>0;if(i)for(const r of e.stops)r[1]=this._validate(r[1],t);if(this.isDataDriven=!!e&&!!e.property,this.isDataDriven)if(void 0!==e.default&&(e.default=this._validate(e.default,t)),i)switch(e.type){case"identity":this.getValue=this._buildIdentity(e,t);break;case"categorical":this.getValue=this._buildCategorical(e,t);break;default:this.getValue=r?this._buildInterpolate(e,t):this._buildInterval(e,t)}else this.getValue=this._buildIdentity(e,t);else i?this.getValue=r?this._buildZoomInterpolate(e):this._buildZoomInterval(e):(e=this._validate(e,t),this.getValue=this._buildSimple(e))}_validate(t,e){if("number"===e.type){if(null!=e.minimum&&t<e.minimum)return e.minimum;if(null!=e.maximum&&t>e.maximum)return e.maximum}else"color"===e.type?t=Rt._parseColor(t):"enum"===e.type?"string"==typeof t&&(t=e.values.indexOf(t)):"array"===e.type&&"enum"===e.value?t=t.map((t=>"string"==typeof t?e.values.indexOf(t):t)):"string"===e.type&&(t=F(t));return t}_buildSimple(t){return()=>t}_buildExpression(t,e){return(r,i)=>{try{const n=t.evaluate(i,r);return void 0===n?e.default:this._validate(n,e)}catch(t){return console.log(t.message),e.default}}}_buildIdentity(t,e){return(r,i)=>{let n;return i&&(n=i.values[t.property]),void 0!==n&&(n=this._validate(n,e)),null!=n?n:void 0!==t.default?t.default:e.default}}_buildCategorical(t,e){return(r,i)=>{let n;return i&&(n=i.values[t.property]),n=this._categorical(n,t.stops),void 0!==n?n:void 0!==t.default?t.default:e.default}}_buildInterval(t,e){return(r,i)=>{let n;return i&&(n=i.values[t.property]),"number"==typeof n?this._interval(n,t.stops):void 0!==t.default?t.default:e.default}}_buildInterpolate(t,e){return(r,i)=>{let n;return i&&(n=i.values[t.property]),"number"==typeof n?this._interpolate(n,t.stops,t.base||1):void 0!==t.default?t.default:e.default}}_buildZoomInterpolate(t){return e=>this._interpolate(e,t.stops,t.base||1)}_buildZoomInterval(t){return e=>this._interval(e,t.stops)}_categorical(t,e){const r=e.length;for(let i=0;i<r;i++)if(e[i][0]===t)return e[i][1]}_interval(t,e){const r=e.length;let i=0;for(let n=0;n<r&&e[n][0]<=t;n++)i=n;return e[i][1]}_interpolate(t,e,r){let i,n;const s=e.length;for(let r=0;r<s;r++){const s=e[r];if(!(s[0]<=t)){n=s;break}i=s}if(i&&n){const e=n[0]-i[0],s=t-i[0],a=1===r?s/e:(r**s-1)/(r**e-1);if(Array.isArray(i[1])){const t=i[1],e=n[1],r=[];for(let i=0;i<t.length;i++)r.push((0,R.sX)(t[i],e[i],a));return r}return(0,R.sX)(i[1],n[1],a)}return i?i[1]:n?n[1]:void 0}static _isEmpty(t){for(const e in t)if(t.hasOwnProperty(e))return!1;return!0}static _parseColor(t){return Array.isArray(t)?t:("string"==typeof t&&(t=new E.Z(t)),t instanceof E.Z&&!this._isEmpty(t)?E.Z.toUnitRGBA(t):void 0)}}var Nt,Dt=r(16534);!function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE",t[t.UNKNOWN=4]="UNKNOWN"}(Nt||(Nt={}));class At{constructor(t,e,r,i){switch(this.type=t,this.typeName=e.type,this.id=e.id,this.source=e.source,this.sourceLayer=e["source-layer"],this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.filter=e.filter,this.layout=e.layout,this.paint=e.paint,this.z=r,this.uid=i,t){case vt.fR.BACKGROUND:this._layoutDefinition=vt.f2.backgroundLayoutDefinition,this._paintDefinition=vt.f2.backgroundPaintDefinition;break;case vt.fR.FILL:this._layoutDefinition=vt.f2.fillLayoutDefinition,this._paintDefinition=vt.f2.fillPaintDefinition;break;case vt.fR.LINE:this._layoutDefinition=vt.f2.lineLayoutDefinition,this._paintDefinition=vt.f2.linePaintDefinition;break;case vt.fR.SYMBOL:this._layoutDefinition=vt.f2.symbolLayoutDefinition,this._paintDefinition=vt.f2.symbolPaintDefinition;break;case vt.fR.CIRCLE:this._layoutDefinition=vt.f2.circleLayoutDefinition,this._paintDefinition=vt.f2.circlePaintDefinition}this._layoutProperties=this._parseLayout(this.layout),this._paintProperties=this._parsePaint(this.paint)}getFeatureFilter(){return void 0!==this._featureFilter?this._featureFilter:this._featureFilter=It.createFilter(this.filter)}getLayoutProperty(t){return this._layoutProperties[t]}getPaintProperty(t){return this._paintProperties[t]}getLayoutValue(t,e,r){let i;const n=this._layoutProperties[t];return n&&(i=n.getValue(e,r)),void 0===i&&(i=this._layoutDefinition[t].default),i}getPaintValue(t,e,r){let i;const n=this._paintProperties[t];return n&&(i=n.getValue(e,r)),void 0===i&&(i=this._paintDefinition[t].default),i}isPainterDataDriven(){const t=this._paintProperties;if(t)for(const e in t)if(t[e].isDataDriven)return!0;return!1}_parseLayout(t){const e={};for(const r in t){const i=this._layoutDefinition[r];i&&(e[r]=new Rt(i,t[r]))}return e}_parsePaint(t){const e={};for(const r in t){const i=this._paintDefinition[r];i&&(e[r]=new Rt(i,t[r]))}return e}computeAttributesKey(t,e,r,i){let n=0,s=0;for(const t of e){let e=3;if(!t||t!==i){const i=r[t],{isLayout:n,isOptional:s}=i,a=n?this.getLayoutProperty(t):this.getPaintProperty(t);e=a?.interpolator?2:a?.isDataDriven?1:s&&!a?3:0}s|=e<<n,n+=2}return s<<3|t}}class Lt extends At{constructor(t,e,r,i){super(t,e,r,i),this.backgroundMaterial=new p(this.computeAttributesKey(s._K.BACKGROUND,p.ATTRIBUTES,p.ATTRIBUTES_INFO))}}class Pt extends At{constructor(t,e,r,i){super(t,e,r,i);const n=this.getPaintProperty("fill-color"),a=this.getPaintProperty("fill-opacity"),o=this.getPaintProperty("fill-pattern");this.hasDataDrivenColor=n?.isDataDriven,this.hasDataDrivenOpacity=a?.isDataDriven,this.hasDataDrivenFill=this.hasDataDrivenColor||this.hasDataDrivenOpacity||o?.isDataDriven;const l=this.getPaintProperty("fill-outline-color");this.outlineUsesFillColor=!l,this.hasDataDrivenOutlineColor=l?.isDataDriven,this.hasDataDrivenOutline=l?l.isDataDriven:!!n&&n.isDataDriven,this.hasDataDrivenOutline=(l?this.hasDataDrivenOutlineColor:this.hasDataDrivenColor)||this.hasDataDrivenOpacity,this.fillMaterial=new f(this.computeAttributesKey(s._K.FILL,f.ATTRIBUTES,f.ATTRIBUTES_INFO)),this.outlineMaterial=new _(this.computeAttributesKey(s._K.OUTLINE,this.outlineUsesFillColor?_.ATTRIBUTES_FILL:_.ATTRIBUTES_OUTLINE,this.outlineUsesFillColor?_.ATTRIBUTES_INFO_FILL:_.ATTRIBUTES_INFO_OUTLINE),this.outlineUsesFillColor)}}class St extends At{constructor(t,e,r,i){super(t,e,r,i);const n=this.getPaintProperty("line-pattern");if(this.lineMaterial=new m(this.computeAttributesKey(s._K.LINE,m.ATTRIBUTES,m.ATTRIBUTES_INFO,n?"line-dasharray":"")),this.hasDataDrivenLine=this.getPaintProperty("line-blur")?.isDataDriven||this.getPaintProperty("line-color")?.isDataDriven||this.getPaintProperty("line-gap-width")?.isDataDriven||this.getPaintProperty("line-offset")?.isDataDriven||this.getPaintProperty("line-opacity")?.isDataDriven||this.getPaintProperty("line-pattern")?.isDataDriven||this.getPaintProperty("line-dasharray")?.isDataDriven||this.getLayoutProperty("line-cap")?.isDataDriven||this.getPaintProperty("line-width")?.isDataDriven,this.canUseThinTessellation=!1,!this.hasDataDrivenLine){const t=this.getPaintProperty("line-width");if(!t||"number"==typeof t&&.5*t<Dt.tQ){const t=this.getPaintProperty("line-offset");(!t||"number"==typeof t&&0===t)&&(this.canUseThinTessellation=!0)}}}getDashKey(t,e){let r;switch(e){case Nt.BUTT:r="Butt";break;case Nt.ROUND:r="Round";break;case Nt.SQUARE:r="Square";break;default:r="Butt"}return`dasharray-[${t.toString()}]-${r}`}}class Ot extends At{constructor(t,e,r,i){super(t,e,r,i),this.iconMaterial=new x(this.computeAttributesKey(s._K.ICON,x.ATTRIBUTES,x.ATTRIBUTES_INFO)),this.textMaterial=new b(this.computeAttributesKey(s._K.TEXT,b.ATTRIBUTES,b.ATTRIBUTES_INFO)),this.hasDataDrivenIcon=this.getPaintProperty("icon-color")?.isDataDriven||this.getPaintProperty("icon-halo-blur")?.isDataDriven||this.getPaintProperty("icon-halo-color")?.isDataDriven||this.getPaintProperty("icon-halo-width")?.isDataDriven||this.getPaintProperty("icon-opacity")?.isDataDriven||this.getLayoutProperty("icon-size")?.isDataDriven,this.hasDataDrivenText=this.getPaintProperty("text-color")?.isDataDriven||this.getPaintProperty("text-halo-blur")?.isDataDriven||this.getPaintProperty("text-halo-color")?.isDataDriven||this.getPaintProperty("text-halo-width")?.isDataDriven||this.getPaintProperty("text-opacity")?.isDataDriven||this.getLayoutProperty("text-size")?.isDataDriven}}class Ut extends At{constructor(t,e,r,i){super(t,e,r,i),this.circleMaterial=new y(this.computeAttributesKey(s._K.CIRCLE,y.ATTRIBUTES,y.ATTRIBUTES_INFO))}}class Bt{constructor(t,e,r){let i;this.allowOverlap=t.getLayoutValue("icon-allow-overlap",e),this.ignorePlacement=t.getLayoutValue("icon-ignore-placement",e),this.keepUpright=t.getLayoutValue("icon-keep-upright",e),this.optional=t.getLayoutValue("icon-optional",e),this.rotationAlignment=t.getLayoutValue("icon-rotation-alignment",e),this.rotationAlignment===vt.aF.AUTO&&(this.rotationAlignment=r?vt.aF.MAP:vt.aF.VIEWPORT),i=t.getLayoutProperty("icon-anchor"),i?.isDataDriven?this._anchorProp=i:this.anchor=t.getLayoutValue("icon-anchor",e),i=t.getLayoutProperty("icon-offset"),i?.isDataDriven?this._offsetProp=i:this.offset=t.getLayoutValue("icon-offset",e),i=t.getLayoutProperty("icon-padding"),i?.isDataDriven?this._paddingProp=i:this.padding=t.getLayoutValue("icon-padding",e),i=t.getLayoutProperty("icon-rotate"),i?.isDataDriven?this._rotateProp=i:this.rotate=t.getLayoutValue("icon-rotate",e),i=t.getLayoutProperty("icon-size"),i?.isDataDriven?this._sizeProp=i:this.size=t.getLayoutValue("icon-size",e)}update(t,e){this._anchorProp&&(this.anchor=this._anchorProp.getValue(t,e)),this._offsetProp&&(this.offset=this._offsetProp.getValue(t,e)),this._paddingProp&&(this.padding=this._paddingProp.getValue(t,e)),this._rotateProp&&(this.rotate=this._rotateProp.getValue(t,e)),this._sizeProp&&(this.size=this._sizeProp.getValue(t,e))}}class Gt{constructor(t,e,r){let i;this.allowOverlap=t.getLayoutValue("text-allow-overlap",e),this.ignorePlacement=t.getLayoutValue("text-ignore-placement",e),this.keepUpright=t.getLayoutValue("text-keep-upright",e),this.optional=t.getLayoutValue("text-optional",e),this.rotationAlignment=t.getLayoutValue("text-rotation-alignment",e),this.rotationAlignment===vt.aF.AUTO&&(this.rotationAlignment=r?vt.aF.MAP:vt.aF.VIEWPORT),i=t.getLayoutProperty("text-anchor"),i?.isDataDriven?this._anchorProp=i:this.anchor=t.getLayoutValue("text-anchor",e),i=t.getLayoutProperty("text-justify"),i?.isDataDriven?this._justifyProp=i:this.justify=t.getLayoutValue("text-justify",e),i=t.getLayoutProperty("text-letter-spacing"),i?.isDataDriven?this._letterSpacingProp=i:this.letterSpacing=t.getLayoutValue("text-letter-spacing",e),i=t.getLayoutProperty("text-line-height"),i?.isDataDriven?this._lineHeightProp=i:this.lineHeight=t.getLayoutValue("text-line-height",e),i=t.getLayoutProperty("text-max-angle"),i?.isDataDriven?this._maxAngleProp=i:this.maxAngle=t.getLayoutValue("text-max-angle",e),i=t.getLayoutProperty("text-max-width"),i?.isDataDriven?this._maxWidthProp=i:this.maxWidth=t.getLayoutValue("text-max-width",e),i=t.getLayoutProperty("text-offset"),i?.isDataDriven?this._offsetProp=i:this.offset=t.getLayoutValue("text-offset",e),i=t.getLayoutProperty("text-padding"),i?.isDataDriven?this._paddingProp=i:this.padding=t.getLayoutValue("text-padding",e),i=t.getLayoutProperty("text-rotate"),i?.isDataDriven?this._rotateProp=i:this.rotate=t.getLayoutValue("text-rotate",e),i=t.getLayoutProperty("text-size"),i?.isDataDriven?this._sizeProp=i:this.size=t.getLayoutValue("text-size",e),i=t.getLayoutProperty("text-writing-mode"),i?.isDataDriven?this._writingModeProp=i:this.writingMode=t.getLayoutValue("text-writing-mode",e)}update(t,e){this._anchorProp&&(this.anchor=this._anchorProp.getValue(t,e)),this._justifyProp&&(this.justify=this._justifyProp.getValue(t,e)),this._letterSpacingProp&&(this.letterSpacing=this._letterSpacingProp.getValue(t,e)),this._lineHeightProp&&(this.lineHeight=this._lineHeightProp.getValue(t,e)),this._maxAngleProp&&(this.maxAngle=this._maxAngleProp.getValue(t,e)),this._maxWidthProp&&(this.maxWidth=this._maxWidthProp.getValue(t,e)),this._offsetProp&&(this.offset=this._offsetProp.getValue(t,e)),this._paddingProp&&(this.padding=this._paddingProp.getValue(t,e)),this._rotateProp&&(this.rotate=this._rotateProp.getValue(t,e)),this._sizeProp&&(this.size=this._sizeProp.getValue(t,e)),this._writingModeProp&&(this.writingMode=this._writingModeProp.getValue(t,e))}}},51785:(t,e,r)=>{r.d(e,{Z:()=>s});var i=r(21315),n=r(7333);class s{constructor(t){if(this._style=t,this.backgroundBucketIds=[],this._uidToLayer=new Map,this._layerByName={},this._runningId=0,t.layers||(t.layers=[]),this.version=parseFloat(t.version),this.layers=t.layers.map(((t,e,r)=>this._create(t,e,r))).filter((t=>!!t)),this.layers){let t;for(let e=0;e<this.layers.length;e++)t=this.layers[e],this._layerByName[t.id]=t,this._uidToLayer.set(t.uid,t),t.type===i.fR.BACKGROUND&&this.backgroundBucketIds.push(t.id)}this._identifyRefLayers()}isPainterDataDriven(t){const e=this._layerByName[t];return!!e&&e.isPainterDataDriven()}getStyleLayerId(t){return t>=this.layers.length?null:this.layers[t].id}getStyleLayerByUID(t){return this._uidToLayer.get(t)??null}getStyleLayerIndex(t){const e=this._layerByName[t];return e?this.layers.indexOf(e):-1}setStyleLayer(t,e){if(!t||!t.id)return;const r=this._style;null!=e&&e>=this.layers.length&&(e=this.layers.length-1);let i,n=!0;const a=this._layerByName[t.id];if(a){const o=this.layers.indexOf(a);e||(e=o),e===o?(n=!1,i=s._recreateLayer(t,a),this.layers[e]=i,r.layers[e]=t):(this.layers.splice(o,1),r.layers.splice(o,1),i=this._create(t,e,this.layers),this.layers.splice(e,0,i),r.layers.splice(e,0,t))}else i=this._create(t,e,this.layers),!e||e>=this.layers.length?(this.layers.push(i),r.layers.push(t)):(this.layers.splice(e,0,i),r.layers.splice(e,0,t));this._layerByName[t.id]=i,this._uidToLayer.set(i.uid,i),n&&this._recomputeZValues(),this._identifyRefLayers()}getStyleLayer(t){const e=this._layerByName[t];return e?{type:e.typeName,id:e.id,source:e.source,"source-layer":e.sourceLayer,minzoom:e.minzoom,maxzoom:e.maxzoom,filter:e.filter,layout:e.layout,paint:e.paint}:null}deleteStyleLayer(t){const e=this._layerByName[t];if(e){delete this._layerByName[t],this._uidToLayer.delete(e.uid);const r=this.layers.indexOf(e);this.layers.splice(r,1),this._style.layers.splice(r,1),this._recomputeZValues(),this._identifyRefLayers()}}getLayerById(t){return this._layerByName[t]}getLayoutProperties(t){const e=this._layerByName[t];return e?e.layout:null}getPaintProperties(t){const e=this._layerByName[t];return e?e.paint:null}setPaintProperties(t,e){const r=this._layerByName[t];if(!r)return;const i={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:r.layout,paint:e},n=s._recreateLayer(i,r),a=this.layers.indexOf(r);this.layers[a]=n,this._style.layers[a].paint=e,this._layerByName[r.id]=n,this._uidToLayer.set(r.uid,n)}setLayoutProperties(t,e){const r=this._layerByName[t];if(!r)return;const i={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:e,paint:r.paint},n=s._recreateLayer(i,r),a=this.layers.indexOf(r);this.layers[a]=n,this._style.layers[a].layout=e,this._layerByName[r.id]=n,this._uidToLayer.set(r.uid,n)}setStyleLayerVisibility(t,e){const r=this._layerByName[t];if(!r)return;const i=r.layout||{};i.visibility=e;const n={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:i,paint:r.paint},a=s._recreateLayer(n,r),o=this.layers.indexOf(r);this.layers[o]=a,this._style.layers[o].layout=i,this._layerByName[r.id]=a,this._uidToLayer.set(r.uid,a)}getStyleLayerVisibility(t){const e=this._layerByName[t];if(!e)return"none";const r=e.layout;return r?.visibility??"visible"}_recomputeZValues(){const t=this.layers,e=1/(t.length+1);for(let r=0;r<t.length;r++)t[r].z=1-(1+r)*e}_identifyRefLayers(){const t=[],e=[];let r=0;for(const n of this.layers){const s=n.layout;if(n.type===i.fR.FILL){const e=n;let i=n.source+"|"+n.sourceLayer;i+="|"+(s?.visibility??""),i+="|"+n.minzoom,i+="|"+n.maxzoom,i+="|"+JSON.stringify(n.filter),(e.hasDataDrivenFill||e.hasDataDrivenOutline)&&(i+="|"+r),t.push({key:i,layer:n})}else if(n.type===i.fR.LINE){const t=n,i=n.paint,a=null!=i&&(null!=i["line-pattern"]||null!=i["line-dasharray"]);let o=n.source+"|"+n.sourceLayer;o+="|"+(s?.visibility??""),o+="|"+n.minzoom,o+="|"+n.maxzoom,o+="|"+JSON.stringify(n.filter),o+="|"+(void 0!==s?s["line-cap"]:""),o+="|"+(void 0!==s?s["line-join"]:""),(t.hasDataDrivenLine||a)&&(o+="|"+r),e.push({key:o,layer:n})}++r}this._assignRefLayers(t),this._assignRefLayers(e)}_assignRefLayers(t){let e,r;t.sort(((t,e)=>t.key<e.key?-1:t.key>e.key?1:0));const n=t.length;for(let s=0;s<n;s++){const a=t[s];if(a.key===e)a.layer.refLayerId=r;else if(e=a.key,r=a.layer.id,a.layer.type===i.fR.FILL){if(!a.layer.getPaintProperty("fill-outline-color"))for(let i=s+1;i<n;i++){const n=t[i];if(n.key!==e)break;if(n.layer.getPaintProperty("fill-outline-color")){t[s]=n,t[i]=a,r=n.layer.id;break}}}else if(a.layer.type===i.fR.LINE){let i=a.layer;for(let o=s+1;o<n;o++){const n=t[o];if(n.key!==e)break;const l=n.layer;(i.canUseThinTessellation&&!l.canUseThinTessellation||!i.canUseThinTessellation&&(l.getPaintProperty("line-pattern")||l.getPaintProperty("line-dasharray")))&&(i=l,t[s]=n,t[o]=a,r=n.layer.id)}}}}_create(t,e,r){const s=1-(1+e)*(1/(r.length+1)),a=this._runningId++;switch(t.type){case"background":return new n.Et(i.fR.BACKGROUND,t,s,a);case"fill":return new n.Le(i.fR.FILL,t,s,a);case"line":return new n.gf(i.fR.LINE,t,s,a);case"symbol":return new n.jG(i.fR.SYMBOL,t,s,a);case"raster":return console.warn(`Unsupported vector tile raster layer ${t.id}`),null;case"circle":return new n.sj(i.fR.CIRCLE,t,s,a)}return null}static _recreateLayer(t,e){switch(t.type){case"background":return new n.Et(i.fR.BACKGROUND,t,e.z,e.uid);case"fill":return new n.Le(i.fR.FILL,t,e.z,e.uid);case"line":return new n.gf(i.fR.LINE,t,e.z,e.uid);case"symbol":return new n.jG(i.fR.SYMBOL,t,e.z,e.uid);case"raster":return console.warn(`Unsupported vector tile raster layer ${t.id}`),null;case"circle":return new n.sj(i.fR.CIRCLE,t,e.z,e.uid)}return null}}},21968:(t,e,r)=>{r.d(e,{G:()=>i});class i{constructor(t,e,r,i,n,s=!1,a=0){this.name=t,this.count=e,this.type=r,this.offset=i,this.stride=n,this.normalized=s,this.divisor=a}}}}]);