@arcgis/core 6.0.0-next.54 → 6.0.0-next.55

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 (300) hide show
  1. package/WebScene.js +2 -2
  2. package/applications/Components/OrientedImageryViewer/shared/constants.js +1 -1
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/featureset/support/sqlUtils.js +1 -1
  8. package/arcade/validation/arcadeValidator.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/0329fa3aa3403f1c243b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{6602310c3fcd91fb6a2f.js → 07c8ac092e4b9e8d5b3c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0a97b1974367382cfdf5.js +1 -0
  13. package/assets/esri/core/workers/chunks/{db0a7671ab5cbe8afd72.js → 123661019bb69c53f2d3.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d14732a57c8e63948c60.js → 14259910f44c08fd5bbd.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{1b41ba050cde068d2860.js → 193a73a2c7f4f8482c21.js} +1 -1
  16. package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +1 -0
  17. package/assets/esri/core/workers/chunks/{e507dfc4788295d9c244.js → 249a687ce1b6d0815242.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{afb4dfb89fbc8a342cc5.js → 3354f1fa90f8ce4c8fde.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{9b458b0d1627f22fdd93.js → 3b11e4d2e69b7aea1d65.js} +1 -1
  20. package/assets/esri/core/workers/chunks/41694ee8990e799da225.js +1 -0
  21. package/assets/esri/core/workers/chunks/{e592f2483db71230e8e5.js → 4401b3f8ebb658abe789.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{12add2003631fa314f25.js → 5060be52a380fc4920f8.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2aa6be0b047a1b25a520.js → 53bbb9aa6e4e4a0a8121.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4707aedcc1b3bdf5e987.js → 5c34d49a6c9cc34b7626.js} +1 -1
  25. package/assets/esri/core/workers/chunks/69a09c6acb5ae03c67f6.js +1 -0
  26. package/assets/esri/core/workers/chunks/7b156905d168bf973518.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e83806797979138fd22a.js → 844c593754b2692257f4.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{2d3e977f3b75474d7ebc.js → 846248697c398468d8e6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{f7e33d37dd11fb08f3f8.js → 97107e64407fa6825620.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{032733b863426c5bde00.js → 9e508f930086d2ef5f22.js} +3 -3
  31. package/assets/esri/core/workers/chunks/{5118c7269b706089c88e.js → a05a2c2aaf0c288f9681.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{817bf487df056da1e6ec.js → a116dd204921e7464944.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{944f17e9c9f681b971fb.js → a12e2a345005189c64be.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{15b3386ad92a0b4149b8.js → a24dc5350af001db417a.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{10967a36c77c5188690d.js → a66d6298236d59a615db.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{255f5b45c4d32f97f86c.js → ac0861014b3d2f1a1de2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/ace210d313ce53f3ae10.js +1 -0
  38. package/assets/esri/core/workers/chunks/ae48ee283cfa5b3c14b0.js +1 -0
  39. package/assets/esri/core/workers/chunks/bbd8fcb0bbba7bde3d9b.js +1 -0
  40. package/assets/esri/core/workers/chunks/{ac8d38016e4bee37a77c.js → be0b8bb4f09aae6ff5de.js} +1 -1
  41. package/assets/esri/core/workers/chunks/d0659f1b0495734be4b3.js +1 -0
  42. package/assets/esri/core/workers/chunks/{b9a2b05ede02c305e865.js → d8ffb1502def5c85740b.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{7dfe1e78d2e66de6be22.js → d9ef244019954d5a8a27.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{95403bb27a4ea0a4b7b1.js → ddbfa664e69612295785.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{c6d82397044e403a1f61.js → e61082f56c08abe54b3a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{55d28d3f5b8ced061e39.js → eaf73ce60f39a48ddd2a.js} +1 -1
  47. package/assets/esri/core/workers/chunks/ed2f2a5da830d058e339.js +1 -0
  48. package/assets/esri/core/workers/chunks/{944cb751c85d3a127f49.js → f52d081bbde5c95265cf.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1de9be7b65109c207bd5.js → fbd5f3b81cd9f061824d.js} +1 -1
  50. package/assets/esri/layers/raster/formats/blosc-wasm.wasm +0 -0
  51. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  52. package/basemapGallery/support/basemapCompatibilityUtils.js +1 -1
  53. package/chunks/CypherParser.js +1 -1
  54. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  55. package/chunks/MultiPathImpl.js +1 -1
  56. package/chunks/OperatorGeodesicBuffer.js +1 -1
  57. package/chunks/UnitFactory.js +1 -1
  58. package/chunks/blosc-wasm.js +2 -0
  59. package/chunks/cameraUtilsSpherical.js +1 -1
  60. package/chunks/parquet.js +1 -1
  61. package/chunks/text.js +1 -1
  62. package/config.js +1 -1
  63. package/core/sql/SqlInterval.js +1 -1
  64. package/core/urlUtils.js +1 -1
  65. package/geometry/geometryEngine.js +1 -1
  66. package/geometry/operators/gx/operatorOffset.js +1 -1
  67. package/geometry/support/Ellipsoid.js +1 -1
  68. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  69. package/geometry/support/geodesicConstants.js +1 -1
  70. package/geometry/support/meshUtils/primitives.js +1 -1
  71. package/kernel.js +1 -1
  72. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  73. package/layers/VoxelWasmPerSceneView.js +1 -1
  74. package/layers/effects/parser.js +1 -1
  75. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  76. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  77. package/layers/graphics/data/QueryEngineResult.js +1 -1
  78. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  79. package/layers/parquet.js +1 -1
  80. package/layers/raster/datasets/ZarrRaster.js +1 -1
  81. package/layers/raster/datasets/wcsCoverageParser.js +1 -1
  82. package/layers/raster/formats/RasterCodec.js +1 -1
  83. package/layers/raster/formats/blosc.js +2 -0
  84. package/layers/support/BuildingFilter.js +1 -1
  85. package/layers/support/IntegratedMeshSemantics.js +1 -1
  86. package/layers/support/fieldUtils.d.ts +23 -87
  87. package/layers/support/fieldUtils.js +1 -1
  88. package/layers/support/layersMapping.js +1 -1
  89. package/layers/video/VideoController.js +1 -1
  90. package/legend/ActiveLayerInfo.js +1 -1
  91. package/libs/ajv/ajv.bundle-wrapper.js +1 -1
  92. package/package.json +4 -4
  93. package/renderers/types.d.ts +1 -1
  94. package/rest/knowledgeGraphService.js +1 -1
  95. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  96. package/smartMapping/statistics/support/attributeDensity.js +1 -1
  97. package/smartMapping/support/adapters/support/utils.js +1 -1
  98. package/support/tests/serviceMockDependencies.js +1 -1
  99. package/symbols/cim/CIMEffects.js +1 -1
  100. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  101. package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
  102. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  103. package/symbols/cim/rasterizingUtils.js +1 -1
  104. package/views/2d/PaddedViewState.js +1 -1
  105. package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
  106. package/views/2d/engine/vectorTiles/constants.js +1 -1
  107. package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
  108. package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
  109. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  110. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  113. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  114. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  115. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  116. package/views/2d/layers/ParquetLayerView2D.js +1 -1
  117. package/views/2d/layers/features/Processor.js +1 -1
  118. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  119. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  120. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  121. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  122. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  123. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  124. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  125. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  126. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  127. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  128. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  129. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  130. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  131. package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
  132. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
  133. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  134. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  135. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  136. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementVisualization.js +1 -1
  137. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  138. package/views/3d/camera/constraintUtils.js +1 -1
  139. package/views/3d/camera/intersectionUtils.js +1 -1
  140. package/views/3d/environment/EnvironmentView.js +1 -1
  141. package/views/3d/focusAreaUtils.js +1 -1
  142. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  143. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  144. package/views/3d/interactive/editingTools/manipulations/config.js +1 -1
  145. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  146. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  147. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  148. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  149. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  150. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  151. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  152. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  153. package/views/3d/layers/I3SMeshView3D.js +1 -1
  154. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  155. package/views/3d/layers/TiledLayerView3D.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  159. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DSymbolFactory.js +1 -1
  164. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  165. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  166. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  167. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  168. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  169. package/views/3d/layers/i3s/I3SNode.js +1 -1
  170. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  171. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  172. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  173. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  174. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  175. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  176. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  177. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  178. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +1 -1
  179. package/views/3d/layers/support/selectTiles3DSpatialReference.js +1 -1
  180. package/views/3d/layers/support/uvUtils.js +1 -1
  181. package/views/3d/state/Constraints.js +1 -1
  182. package/views/3d/state/ConstraintsManager.js +1 -1
  183. package/views/3d/state/NearFarHeuristic.js +1 -1
  184. package/views/3d/state/ViewState.js +1 -1
  185. package/views/3d/state/ViewStateManager.js +1 -1
  186. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  187. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  188. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  189. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  190. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  191. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  192. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  193. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  194. package/views/3d/state/utils/navigationUtils.js +1 -1
  195. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  196. package/views/3d/support/RenderCoordsHelper.js +1 -1
  197. package/views/3d/support/SweptSphereVolume.js +1 -1
  198. package/views/3d/support/cameraUtils.js +1 -1
  199. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  200. package/views/3d/support/engineContent/line.js +1 -1
  201. package/views/3d/support/engineContent/marker.js +1 -1
  202. package/views/3d/support/hitTest.js +1 -1
  203. package/views/3d/support/orientedBoundingBox.js +1 -1
  204. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  205. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  206. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  207. package/views/3d/support/sunUtils.js +1 -1
  208. package/views/3d/terrain/ExtentHelper.js +1 -1
  209. package/views/3d/terrain/OverlayManager.js +1 -1
  210. package/views/3d/terrain/OverlayRenderer.js +1 -1
  211. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  212. package/views/3d/terrain/TerrainRenderer.js +1 -1
  213. package/views/3d/terrain/TerrainSurface.js +1 -1
  214. package/views/3d/terrain/Tile.js +1 -1
  215. package/views/3d/terrain/TilingSchemeLogic.js +1 -1
  216. package/views/3d/terrain/terrainUtils.js +1 -1
  217. package/views/3d/webgl/RenderCamera.js +1 -1
  218. package/views/3d/webgl-engine/Stage.js +1 -1
  219. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  220. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  221. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  222. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
  223. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  225. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  227. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  228. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  229. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  230. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  231. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  232. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  233. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +1 -1
  234. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  235. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  236. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  237. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  238. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  239. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  240. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  241. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  242. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  243. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  244. package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
  245. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  246. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  247. package/views/MapView.d.ts +1 -0
  248. package/views/SceneView.js +1 -1
  249. package/views/View2D.js +1 -1
  250. package/views/ViewingMode.js +1 -1
  251. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
  252. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  253. package/views/draw/DrawAction.js +1 -1
  254. package/views/draw/DrawOperation.js +1 -1
  255. package/views/draw/DrawTool.js +1 -1
  256. package/views/draw/SegmentDrawAction.js +1 -1
  257. package/views/draw/support/Reshape.js +1 -1
  258. package/views/draw/support/helpMessageUtils.js +1 -1
  259. package/views/draw/support/managers/EditSessionManager.js +1 -1
  260. package/views/interactive/dragEventPipeline.js +1 -1
  261. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  262. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  263. package/views/interactive/editGeometry/operations/AddOrUpdatePart.js +1 -1
  264. package/views/layers/support/editableLayerViews.js +1 -1
  265. package/views/overlay/TextOverlayItem.js +1 -1
  266. package/views/support/DefaultsFromMap.js +1 -1
  267. package/views/support/Scheduler.js +1 -1
  268. package/views/support/spatialReferenceSupport.js +1 -1
  269. package/views/webgl/ShaderTranspiler.js +2 -2
  270. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  271. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  272. package/widgets/BatchAttributeForm.js +1 -1
  273. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  274. package/widgets/Editor/workflowUtils.js +1 -1
  275. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  276. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  277. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  278. package/widgets/FeatureForm.js +1 -1
  279. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  280. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  281. package/widgets/Measurement.js +1 -1
  282. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  283. package/widgets/OrientedImageryViewer/components/ImageMeasurementWidget.js +1 -1
  284. package/widgets/Search/support/layerSearchUtils.js +1 -1
  285. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  286. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  287. package/widgets/UtilityNetworkAssociations.js +1 -1
  288. package/widgets/Weather/WeatherViewModel.js +1 -1
  289. package/widgets/Weather/css.js +1 -1
  290. package/widgets/Weather.js +1 -1
  291. package/assets/esri/core/workers/chunks/021bd07b9a3e70598840.js +0 -1
  292. package/assets/esri/core/workers/chunks/170e68624b71ac96de4a.js +0 -1
  293. package/assets/esri/core/workers/chunks/8a820e303941b351de81.js +0 -1
  294. package/assets/esri/core/workers/chunks/90d567e920b6982b402d.js +0 -1
  295. package/assets/esri/core/workers/chunks/97cdcedfe853280f6258.js +0 -1
  296. package/assets/esri/core/workers/chunks/9ebc6026934400fc1e1f.js +0 -1
  297. package/assets/esri/core/workers/chunks/b4a325dcf50e276751d7.js +0 -1
  298. package/assets/esri/core/workers/chunks/be5857b0d1b00faf430b.js +0 -1
  299. package/assets/esri/core/workers/chunks/cd9100a7c8309dfa7569.js +0 -1
  300. package/assets/esri/core/workers/chunks/e58f51618251f74aaafd.js +0 -1
@@ -1 +1 @@
1
- "use strict";(Array.isArray(self.webpackChunkRemoteClient)?self.webpackChunkRemoteClient:self.webpackChunkRemoteClient=[]).push([[6051],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...n){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(n,r)||(i=e.apply(this,n),t=this,r=n,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{JY:()=>d,Qf:()=>o,Qh:()=>s,lM:()=>n,ro:()=>u,rq:()=>f});var r=i(44208),a=i(34275);function n(e){if(!e)return 0;let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return o(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return f(e,8);let i=c;for(let r=0;r<t;r++)i+=l(e[r]);return i}(e);let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?s(e):h;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...e){return e.reduce((e,t)=>e+u(t),0)}function u(e,t=16){return e?(0,a.iu)(e)?e.byteLength+p:Array.isArray(e)?f(e,t):0:0}function f(e,t){return c+e.length*t}const h=32,c=16,d=(0,r.A)("ios")||!(0,r.A)("chrome")&&!(0,r.A)("opr")?8:4,p=145},5359(e,t,i){i.d(t,{H:()=>r,Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}},16051(e,t,i){i.r(t),i.d(t,{default:()=>It});var r,a=i(32198),n=i(91429),s=i(56507),l=i(69540),o=i(49186),u=i(53966),f=i(97768),h=i(25728),c=i(17676),d=i(36708),p=i(41910),m=i(60950),g=i(89808),y=i(99959),w=i(5359);class v extends y.A{get[(r=w.H,m.ym)](){return this.layer}get[g.Q](){return this.layer}get[p.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var x=i(40124),b=i(24212),I=i(30291),A=i(88625),S=i(59923),C=i(4146),_=i(18768),R=i(63074),M=i(69208),T=i(34287),O=i(8303),k=i(72545),F=i(56551),D=i(54310),N=i(25036),P=i(82935),z=i(82806),L=i(7548),E=i(23636),B=i(22671),$=i(51927),J=i(49859),U=i(68197),H=i(5443),j=i(16930),Z=i(73444),V=i(14140),q=i(94778);function W(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function G(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function X(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],n=-1,s=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];W(o)?n=e:G(o)&&(s=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,n=(t-e)/(i-1);r.push([e-.5*n,t+.5*n]),a.push(n);for(let t=0;t<i;t++)f.push(e+n*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}n>-1&&-1===s?s=+(0===n):s>-1&&-1===n?n=+(0===s):-1===s&&-1===n&&(n=0,s=1),l=l.filter((e,t)=>t!==n&&t!==s);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[n])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new j.A({wkid:h}),[d,p]=r[n],[m,g]=r[s],y=new H.A({xmin:d,xmax:p,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[n]),height:Math.round(y.height/a[s]),extent:y,dimensions:l}}function Y(e){let t=(0,Z.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function K(){return Math.round(255*Math.random())}function Q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:n,categoryEncoding:s,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Y(a)),n&&(t[e].unit=n.label?Y(n.label):null,t[e].symbol=n.symbol?.value),s)){let i=Object.entries(s).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Y(e.label):null,e.preferredColor)){let t=U.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=K(),e.Green=K(),e.Blue=K())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function ee(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,q.X1)(t,i)}function te(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),n=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),s=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);s+=n[l]*(i%t[a]),i=Math.floor(i/t[a])}return s}var ie=i(45617),re=i(87186),ae=i(47520),ne=i(4366);let se=class extends J.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,n=this._pixelBlockTiles.get(a);if(n)return n;if(!this.source)return null;let{rasterInfo:s}=this,[l,o]=s.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let n=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return n&&this._pixelBlockTiles.set(a,n),n}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let d={pixelBlock:c,useBilinear:"thematic"!==s.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(d,r):(0,ae.J$)(d)}async _open(e){if(!this.source)throw new o.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:n,nativeExtent:s,transform:l,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:d}=f??t.imageInfo,p=t.extent??new H.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new j.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:p.width/h,y:p.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new re.A({width:h,height:c,pixelType:d,extent:p,nativeExtent:s,attributeTable:r,colormap:u,transform:l,pixelSize:g,spatialReference:p.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:n});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,n="thematic"!==r.dataType,s=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:n},i):Promise.resolve((0,ae.lD)(e,t,a,n)),l=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,$.f4)(e)),h=await(0,c.Lx)([s,f]);if(!h[0].value)throw new o.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=h[0].value,l||(r.statistics=h[1].value?.statistics),u||(r.histograms=h[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let n=a.dimensions.map(e=>new ie.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),s=(0,ne.NG)(n,t),l=null==s?null:e[s];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,$.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],se.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)({constructOnly:!0})],se.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,n.MZ)()],se.prototype,"source",void 0),(0,a.Cg)([(0,n.MZ)()],se.prototype,"url",null),se=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.InMemoryRaster")],se);const le=se;let oe=class extends J.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:n}=await this._fetchData(e),{statistics:s,histograms:l}=(0,$.eH)(i[0]),o=n?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new le({source:{extent:t,pixelBlocks:i,attributeTable:a?B.A.fromJSON(a):null,multidimensionalInfo:r,statistics:s,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new o.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new o.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new o.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:n,values:s}=r[e];if(!("ndarray"===n.toLowerCase()&&s?.length&&t?.length&&a?.length))throw new o.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!W(t[t.length-1])||!G(t[t.length-2]))throw new o.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=X(e),{ranges:n}=e,s=Object.keys(n).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<s.length;e++){let t=s[e];a?.length&&l.push({name:t,dimensions:a})}let o=Q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<s.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=n[s[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),d=u.slice(0,-2),p="float"===l?"f32":ee(r),m=t*i,g=r.length/m;for(let n=0;n<g;n++){let s=V.A.createEmptyBand(p,m),l=new Uint8Array(m).fill(255),o=!1,u=n*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):s[e]=t}if(0===e||a?.length){let e=new V.A({width:t,height:i,mask:o?l:null,pixels:[s],pixelType:p});e.updateStatistics(),a?.length?f[te(c,d,n)+h]=e:f.push(e)}else{let e=f[n];e.pixels.push(s),o?e.mask&&=V.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:s}}(t)}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],oe.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)({constructOnly:!0})],oe.prototype,"source",void 0),oe=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.CovJSONRaster")],oe);const ue=oe;var fe=i(85951),he=i(40951),ce=i(43163),de=i(4576),pe=i(21325),me=i(330);function ge(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function ye(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new j.A({wkid:t});if(e=String(e).trim(),(0,pe.jp)(e))return new j.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),n=a>-1?a:i.indexOf("GEOGCS");if(-1===n)return null;let s=e.slice(n,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=we(s);let o=t?new j.A({wkid:t}):new j.A({wkt:s}),u=we(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=we(e),0===t?new j.A({wkt:e}):new j.A({wkid:t})):null}function we(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ve(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,me.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,me.mX)(e);t.spatialReference=ye(i)}}else if((0,me.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,me.V6)(e,"GeodataXform"),i=ye((0,me.v7)(t,"SpatialReference/WKID")||(0,me.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,me.v7)(t,"PolynomialOrder")??1,a=(0,me.Ui)(t,"CoeffX/Double"),n=(0,me.Ui)(t,"CoeffY/Double"),s=(0,me.Ui)(t,"InverseCoeffX/Double"),l=(0,me.Ui)(t,"InverseCoeffY/Double"),o=ge(a,n),u=ge(s,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new ce.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,me.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,me.mX)(e));else if((0,me.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,n=(0,me.v7)(e,"NoDataValue"),s=(0,me.V6)(e,"Histograms/HistItem"),l=(0,me.v7)(s,"HistMin"),o=(0,me.v7)(s,"HistMax"),u=(0,me.v7)(s,"BucketCount"),f=(0,me.mX)(s,"HistCounts")?.split("|").map(e=>Number(e));(0,me.IC)(e,"Metadata/MDI").forEach(e=>{let n=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=n;break;case"STATISTICS_MAXIMUM":i=n;break;case"STATISTICS_MEAN":r=n;break;case"STATISTICS_STDDEV":a=n}});let h=(0,me.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:n,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(de.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(de.Ru):null),t}const xe="image-aux-raster:open",be="The data is not a supported format.";let Ie=class extends J.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,n="immediate"===a||"jpg"!==r;if(n){let a=await this._decodeFullImage(i,r,e);if(!a)throw new o.A(xe,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,fe.R)(i);if(!r)throw new o.A(xe,be);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:s,ioConfig:l}=this,u=new le({preGenerateTiles:n,rasterJobHandler:s,source:t,ioConfig:{...l,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:n}=await this._fetchAuxiliaryData(t),s=!i;s&&(i=new j.A({wkid:3857})),a?.length&&null==r&&(r=(0,$.Pg)(a));let{width:l,height:o}=e,u=new H.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=n?n.forwardTransform(u):u,h=!0;if(n){let e=n.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(n=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:n,statistics:r,histograms:a,isPseudoSpatialReference:s,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,he.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new o.A(xe,be);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,c.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),n=this.datasetFormat,s="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,l=r||null==s||i.includes(s)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+s,{responseType:"text",signal:t}),o=await(0,c.Lx)([a,l]);if(t?.aborted)throw(0,c.NK)();let u=ve(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new ce.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],Ie.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)()],Ie.prototype,"rasterJobHandler",null),Ie=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.ImageAuxRaster")],Ie);const Ae=Ie;var Se=i(84952),Ce=i(86738),_e=i(82371),Re=i(20223),Me=i(87045),Te=i(25943);let Oe=class extends J.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:n}=this.rasterInfo,{transposeInfo:s}=a,l=null!=s&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let n=0;for(let{data:e}of t)u.push(n),a.set(new Uint8Array(e),n),n+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:d}=a,p=l?s.tileSize:d.size,m=/^(mixed|jp)/i.test(d.format),g="raw"===d.format,y=await this.decodePixelBlock(o,{format:g?"bsq":void 0,width:p[0],height:p[1],planes:u?.length,offsets:u,pixelType:g?this.rasterInfo.pixelType:void 0,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==y)return null;let w=a.blockBoundary[e];if("jpg"!==a.compression||i>w.minCol&&i<w.maxCol&&t>w.minRow&&t<w.maxRow)return y;let{origin:v,blockWidth:x,blockHeight:b}=a,{x:I,y:A}=this.getPyramidPixelSize(e),S=Math.round((n.xmin-v.x)/I)%x,C=Math.round((n.xmax-v.x)/I)%x||x,_=Math.round((v.y-n.ymax)/A)%b,R=Math.round((v.y-n.ymin)/A)%b||b,M=i===w.minCol?S:0,T=t===w.minRow?_:0,O=i===w.maxCol?C:x,k=t===w.maxRow?R:b;return(0,ae.z$)(y,{x:M,y:T},{width:O-M,height:k-T}),y}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let i=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,n=a-r+this._levelOffset,s=i.srcLocation;for(;n>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(n,i.row,i.col,t))break}catch{}if(n--,r++,i=this.identifyPixelLocation(s,r,t.datumTransformation),null===i)return null}return-1===n||null==i?null:r}async _open(e){let t=e?.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let r=i.data;if(this.sourceJSON=r,!r)throw new o.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new o.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new o.A("image-server-raster:open","cannot initialize image service");(0,_e.E9)(a,r);let n="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:n}=t;if(null!=a&&null!=n)return Me.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=n)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,n=r?t(r):-1/0;return Me.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=n})})}return Me.A.fromJSON(e)}(r.tileInfo,r):Me.A.fromJSON(r.tileInfo);(0,f.Lw)(n);let[s,l]=this._computeMinMaxLOD(a,n),{extent:u,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(s.resolution-h.x)>c)&&(h.x=h.y=s.resolution,a.width=Math.ceil((u.xmax-u.xmin)/h.x-.1),a.height=Math.ceil((u.ymax-u.ymin)/h.y-.1));let d=s.level-l.level,[p,m]=n.size,g=[],y=[],{lods:w}=n;w.forEach((e,t)=>{e.level>=l.level&&e.level<=s.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(u,p,m,n.origin,g,d),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(l.resolution/s.resolution)**(-1/d))/10,A=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Re.A({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:n,isBsqTile:A,transposeInfo:v,blockBoundary:x}),(0,L.vj)(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,Se.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Te.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=j.A.fromJSON(t.spatialReference||e.spatialReference),n=new Ce.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new re.A({width:i,height:r,bandCount:3,extent:H.A.fromJSON(e),spatialReference:a,pixelSize:n,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,_e.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,n=await Promise.all([r,a]);return this._slices=n[1],n[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,n=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),s=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[n,s];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??n,s];let{minScale:o,maxScale:u}=this.sourceJSON,f=n;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??n);let h=s;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??s,this._levelOffset=h.level-s.level),[f,h]}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],Oe.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)()],Oe.prototype,"tileType",void 0),Oe=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.ImageServerRaster")],Oe);const ke=Oe;var Fe=i(10713);const De=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Ne=new Map;Ne.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Ne.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Ne.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Ne.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Ne.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Pe=class extends J.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:n,blockBoundary:s}=this.rasterInfo.storageInfo,l=s[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*n);return new V.A({width:a,height:n,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<p;g++)(!d||d.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<p;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Ne.get(this.rasterInfo.storageInfo.compression).decoderFormat,A="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:n,format:I,planes:d?.length||o,offsets:x,pixelType:u,canvasUsage:A?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:C}=this.rasterInfo;if(null!=C&&"lerc"!==I&&!S.mask&&(C=C[0],null!=C)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(C)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-C)/C)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==C&&(t[g]=1);S.mask=t}let _=0,R=0;if(h!==a||c!==n){let e=S.mask;if(e)for(g=0;g<n;g++)if(R=g*a,g<c)for(_=h;_<a;_++)e[R+_]=0;else for(_=0;_<a;_++)e[R+_]=0;else for(e=new Uint8Array(a*n),S.mask=e,g=0;g<c;g++)for(R=g*a,_=0;_<h;_++)e[R+_]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:n,skipExtensions:s=[]}=this.ioConfig;if(!s.includes("aux.xml")&&!n){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,$.Pg)(t.histograms)))}n&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(Fe.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,d=[],p=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*p*4,d.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=d,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,n,{blockWidth:s,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,d=0;for(n=0;n<e;n++)d=o**n,r=Math.ceil(u/s/d),a=Math.ceil(f/l/d),c+=r*a;d=o**e,r=Math.ceil(u/s/d),a=Math.ceil(f/l/d),c+=t*r+i,c*=4*h;let p=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=p[4*e]*2**32+p[4*e+1],g=m+p[4*e+2]*2**32+p[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?s:Math.ceil(u/d)-s*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/d)-l*(a-1)}}_parseHeader(e){let t=(0,me.V6)(e,"MRF_META/Raster");if(!t)throw new o.A("mrf:open","not a valid MRF format");let i=(0,me.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),n=parseInt(i.getAttribute("c"),10),s=((0,me.mX)(t,"Compression")||"none").toLowerCase();if(!Ne.has(s))throw new o.A("mrf:open","currently does not support compression "+s);let l=(0,me.mX)(t,"DataType")||"UInt8",u=De.get(l.toLowerCase());if(null==u)throw new o.A("mrf:open","currently does not support pixel type "+l);let f=(0,me.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),d=f.getAttribute("c"),p=d?d===String(n):Ne.get(s).isOneSegment;this._isBsq=!p;let m,g=(0,me.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,me.V6)(e,"MRF_META/CachedSource"))throw new o.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,me.V6)(e,"MRF_META/GeoTags"),v=(0,me.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,me.mX)(w,"Projection")||"",n=j.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(n=new j.A({wkid:e}))}else n=ye(a)??j.A.WGS84;else x=!0,n=new j.A({wkid:3857});y=new H.A({xmin:e,ymin:t,xmax:i,ymax:r}),y.spatialReference=n}else x=!0,y=new H.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new j.A({wkid:3857})});let b=(0,me.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),A=y.spatialReference,S=new Re.A({origin:new Ce.A({x:y.xmin,y:y.ymax,spatialReference:A}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:s,pyramidScalingFactor:I}),C=new Ce.A({x:y.width/r,y:y.height/a,spatialReference:A}),_=new re.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:A,bandCount:n,pixelType:u,pixelSize:C,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,me.mX)(t,"DataFile")),M=this._getAuxFullPath((0,me.mX)(t,"IndexFile"));return{rasterInfo:_,files:{mrf:this.url,index:M||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Ne.get(s).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ve(t)}catch{return null}}};(0,a.Cg)([(0,n.MZ)()],Pe.prototype,"_files",void 0),(0,a.Cg)([(0,n.MZ)()],Pe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,n.MZ)()],Pe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],Pe.prototype,"datasetFormat",void 0),Pe=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.MRFRaster")],Pe);const ze=Pe;i(44208);var Le=i(44094),Ee=i(94213),Be=i(9334);function $e(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),n=a.map(e=>e.name),s=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<n.length;o++)t[n[o]]=e[o-1];s.push({attributes:t})}),{displayFieldName:"",fields:a,features:s}}function Je(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),n=t.getUint16(10,!0),s={version:i,recordCount:r,headerByteCount:a,recordByteCount:n},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,Be.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>n;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,Be.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=n}return{header:s,fields:o,records:u,recordSet:$e({fields:o,records:u})}}const Ue="none-tiled tiff is not optimized for access, convert to COG and retry.";let He=class extends J.A{constructor(){super(...arguments),this._bufferSize=1048576,this._chunkSize=10485760,this._fileSize=-1,this._headerChunks=[],this.datasetFormat="TIFF",this.headerInfo=null}async fetchRawTile(e,t,i,r={}){if(!this.headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this.headerInfo.hasMaskBand){let n=await this._fetchRawTiffTile(e,t,i,!0,r);null!=n&&n.pixels[0]instanceof Uint8Array&&(a.mask=n.pixels[0])}return a}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf(".")),await this._readHeader(e?.signal),await this._fetchAllAuxData(),this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(this.rasterInfo),this.updateTileInfo()}async _readHeader(e){try{let t=await this._fetchHeaderData(0,this._bufferSize,e);if(!t)throw new o.A("tiffraster:open","failed to open url "+this.url);let{littleEndian:i,firstIFDPos:r,isBigTiff:a}=(0,Le.uT)(t),n=[],s={fileChunk:t,posIFD:r,fileOffset:0};await this._readIFDs(n,s,i,a?8:4,e);let{imageInfo:l,rasterInfo:u}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:n,planes:s,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:d,tileBoundary:p,affine:m,metadata:g,colormap:y}=t,w=ye(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new j.A({wkid:3857}));let x=new H.A({...t.extent,spatialReference:w}),b=x?new Ce.A({x:x.xmin,y:x.ymax,spatialReference:w}):new Ce.A({x:0,y:0}),I=new Re.A({blockWidth:a,blockHeight:n,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:d,blockBoundary:p}),A=new Ce.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},C=new re.A({width:i,height:r,bandCount:s,pixelType:l,pixelSize:A,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(C.nativeExtent=new H.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),C.transform=new ce.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),C.extent=C.transform.forwardTransform(C.nativeExtent),C.pixelSize=new Ce.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),d){let{x:e,y:t}=C.pixelSize;d.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:C}}(n),f=(0,Le.zS)(n),h=(0,Le.r9)(n);this.headerInfo={littleEndian:i,isBigTiff:a,ifds:n,pyramidIFDs:f,maskIFDs:h,...l},this._set("rasterInfo",u),this._validateHeader()}finally{this._headerChunks.length=0}}_validateHeader(){let e=this.headerInfo;if(!e.isSupported)throw new o.A("tiffraster:open","this tiff is not supported: "+e.message);if(!e.tileWidth||!e.tileHeight)throw new o.A("tiffraster:open",Ue);this.rasterInfo.isPseudoSpatialReference&&u.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let t=e.ifds[0],i=t.get("PREDICTOR")?.values?.[0];if(3===t.get("SAMPLEFORMAT")?.values?.[0]&&2===i)throw new o.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data")}async _fetchHeaderData(e,t,i){let r=this._getCachedHeaderData(e,t);if(r)return r;let a=Math.floor(e/this._bufferSize)*this._bufferSize,n=a+Math.max(1,Math.ceil((t-a)/this._bufferSize))*this._bufferSize,s=this._getMissingHeaderRanges(a,n).map(async e=>{let{from:t,to:r}=e,a=await this._fetchOffsets(t,r,i),n=this._fileSize;return{chunk:a,fileOffset:t,isEOF:n>0?t+a.byteLength>=n:a.byteLength<r-t+1}}),l=await Promise.all(s);this._headerChunks.push(...l),this._headerChunks.sort((e,t)=>e.fileOffset-t.fileOffset);let u=this._getCachedHeaderData(e,t);if(!u)throw new o.A("tiffraster:open",`failed to fetch byte range ${e}-${t} from ${this.url}`);return u}_getCachedHeaderData(e,t){let i=[],r=e;for(let{chunk:a,fileOffset:n,isEOF:s}of this._headerChunks){if(n+a.byteLength-1<r)continue;if(n>r)return null;let l=r-n,o=Math.min(t-n+1,a.byteLength);if(i.push({chunk:a,start:l,end:o}),r=n+o,r>t||s&&o===a.byteLength){let t=new Uint8Array(r-e),a=0;for(let e of i){let i=new Uint8Array(e.chunk,e.start,e.end-e.start);t.set(i,a),a+=i.byteLength}return t.buffer}}return null}_getMissingHeaderRanges(e,t){let i=[],r=(e,t)=>{let r=Math.floor(e/this._bufferSize)*this._bufferSize,a=Math.ceil(t/this._bufferSize)*this._bufferSize;i.push({from:r,to:a})},a=e;for(let{chunk:e,fileOffset:n,isEOF:s}of this._headerChunks){let l=n+e.byteLength-1;if(!(l<a)&&(n>a&&r(a,Math.min(n-1,t)),a=Math.max(a,l+1),a>t||s))return i}return a<=t&&r(a,t),i}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;if(a+8>=i.byteLength||a<0){if(r=a+r,r<0)throw new o.A("tiffraster:open",`invalid IFD position ${r}. failed to open url ${this.url}`);i=await this._fetchHeaderData(r,r+this._bufferSize/2,t),a=0}return{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let n=await this._readIFD(t,i,Ee.NB,r,a);if(!n?.ifd)throw new o.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;t.posIFD=n.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Ee.NB,r=4,a){let{fileChunk:n,posIFD:s,fileOffset:l}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(n,t,s,l,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new o.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Ee.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new o.A("tiffraster:open",Ue);let r=[];e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),(0,Le.fM)(e),(0,Le.h_)(e);for(let[i,r]of Ee.RR){let o=e.get(i),u=null!=o?.data&&Array.from(o.data.values()).some(e=>null==e.values&&null!=e.offlineOffsetSize);if(o&&(!o.data||u)){s=o.valueOffset-l;let e=await this._validateOrFetchHeaderBuffer({fileChunk:n,posIFD:s,fileOffset:l},a);o.data=(await this._readIFD(e,t,r,4,a))?.ifd}}return u}return u.requiredBufferSize?(n=await this._fetchHeaderData(l,l+s+u.requiredBufferSize+8,a),n.byteLength<s+u.requiredBufferSize?null:(e.fileChunk=n,e.fileOffset=l,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let n=a.map(e=>e.offlineOffsetSize),s=Math.min.apply(null,n.map(e=>e[0])),l=Math.max.apply(null,n.map(e=>e[0]+e[1])),o=1===n.length||l-s<=this._bufferSize;if(!o&&n.length>1&&(n.sort((e,t)=>e[0]-t[0]),o=n.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,n[0][0])===l),o){let e=Math.max(l,s+this._bufferSize/4),i=await this._fetchHeaderData(s,e,r);return void a.forEach(e=>(0,Le.Cr)(i,t,e,s))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchHeaderData(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize;this._fileSize>0&&(t=Math.min(t,this._fileSize-1));let n=Math.ceil((t-e+1)/a),s=e;for(let e=0;e<n;e++)r.push(this.request(this.url,{range:{from:s,to:e===n-1?t:s+a-1},responseType:"array-buffer",signal:i})),s+=a;let l=await Promise.all(r);if(-1===this._fileSize&&206===l[0].httpStatus){let e=l[0].getHeader?.("Content-Range"),t=Number(e?.split("/",2)[1]);Number.isFinite(t)&&(this._fileSize=t)}if(1===l.length)return l[0].data;let o=l.reduce((e,t)=>e+t.data.byteLength,0),u=new Uint8Array(o),f=0;for(let e of l)u.set(new Uint8Array(e.data),f),f+=e.data.byteLength;return u.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let n=this._getTileLocation(e,t,i,r);if(!n)return null;let{ranges:s,actualTileWidth:l,actualTileHeight:o,ifd:u}=n,f=s.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),d=1===h.length?h[0].data:new ArrayBuffer(c),p=[0],m=[d.byteLength];if(h.length>1){let e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),p[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this.headerInfo,ifd:u,offsets:p,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:n}=this.rasterInfo.storageInfo,s=0===e?0:e-(a-1),{headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[s]:0===s?l.ifds[0]:l.pyramidIFDs[s-1];if(!o)return null;let u=(0,Le.XO)(o),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:d,maxRow:p,maxCol:m}=n[s];if(t>p||i>m||t<c||i<d)return null;let g=(0,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(p+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===p&&y%v||v}}async _fetchAllAuxData(e){if(this.ioConfig.skipMapInfo)return;let{rasterInfo:t}=this,{skipExtensions:i=[]}=this.ioConfig,r=i.includes("aux.xml")?Promise.resolve(null):this._fetchAuxiliaryMetaData(e),a=i.includes("vat.dbf")||1!==t.bandCount||"u8"!==t.pixelType?Promise.resolve(null):this._fetchAuxiliaryTable(e),[n,s]=await Promise.all([r,a]);null!=n&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,$.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new Ce.A({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}(n,t),null!=s&&(t.attributeTable=s,t.keyProperties.DataType="thematic")}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ve(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Je(t);return i?.recordSet?B.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,n.MZ)()],He.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"_fileSize",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"_headerChunks",void 0),(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"headerInfo",void 0),He=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.TIFFRaster")],He);const je=He;var Ze=i(91806);const Ve=new Set(["x","lon","long","longitude","e","east","easting"]),qe=new Set(["y","lat","latitude","n","north","northing"]),We=new Map([["b1","u8"],["u1","u8"],["u2","u16"],["u4","u32"],["i1","s8"],["i2","s16"],["i4","s32"],["f2","f32"],["f4","f32"],["f8","f64"],["c8","c64"],["c16","c128"],["m","unknown"],["M","unknown"],["S","unknown"],["U","unknown"],["V","unknown"]]),Ge="zarr-raster:parse";function Xe(e,t){return e.slice(0,-t.length)}function Ye(e,t){!function(e){if(2!==e?.zarr_format)throw new o.A(Ge,"only zarr_format 2 is supported");let{shape:t,compressor:i,order:r,chunks:a,dimension_separator:n}=e;if(!Array.isArray(t)||!Array.isArray(a)||t.length!==a.length||t.some(e=>!Number.isSafeInteger(e)||e<0)||a.some(e=>!Number.isSafeInteger(e)||e<=0))throw new o.A(Ge,"invalid Zarr shape or chunks");if(null!=r&&"C"!==r&&"F"!==r)throw new o.A(Ge,"invalid Zarr array order");if(null!=n&&"."!==n&&"/"!==n)throw new o.A(Ge,"invalid Zarr dimension separator");if(null!==i&&("string"!=typeof i?.id||!i.id))throw new o.A(Ge,"Zarr compressor must be null or have a codec id")}(e);let{isBigEndian:i,pixelType:r,originalPixelType:a}=function(e){if("string"!=typeof e)throw new o.A(Ge,`Unsupported Zarr dtype: ${JSON.stringify(e)}`);let t=e.startsWith(">"),i=e.replace(/^[<>|=]/,""),r=We.get(i);if(!r||"unknown"===r||r.startsWith("c"))throw new o.A(Ge,`Unsupported Zarr dtype: ${JSON.stringify(e)}`);return{isBigEndian:t,pixelType:r,originalPixelType:i}}(e.dtype),{shape:n,compressor:s,order:l,chunks:u}=e,f=s?.id||"none",h="C"===l||null==l,c=function(e){if(null!==e){if("number"==typeof e)return e;switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new o.A(Ge,`Unsupported numeric Zarr fill value: ${e}`)}}}(e.fill_value);if(null!=c)if(Number.isFinite(c)){"f32"===r&&(c="f2"===a?new Float16Array([c])[0]:Math.fround(c));let[e,t]=(0,q.hP)("f2"===a?"f16":r);(c>t||c<e)&&(c=void 0)}else c=r.startsWith("f")?c:void 0;let d=e.dimension_separator??".";return{isBigEndian:i,pixelType:r,originalPixelType:a,compression:f,isRowMajor:h,shape:n,chunkSize:u,fillValue:c,scaleFactor:t?.scale_factor??1,addOffset:t?.add_offset??0,separator:d}}function Ke(e){return e.Description??e.description??e.long_name??e.standard_name??null}function Qe(e,t,i){let r=i?.[e];return!r?.length||t<=0?null:r.length<=t?r.toSorted((e,t)=>e-t):r.slice(0,t).toSorted((e,t)=>e-t)}function et(e){if(1===e.length)return[e[0]-.5,e[0]+.5];let t=e[0],i=e.at(-1),r=Math.abs(i-t)/(e.length-1)*.5;return[Math.min(t,i)-r,Math.max(t,i)+r]}function tt(e){let t;for(let i=0;i<e.length;i++){let r=e[i],a=it(r);if(a)return new j.A({wkid:a});t||=r?._CRS?.wkt?.trim()}return t?new j.A({wkt:t}):void 0}function it(e){let t=e?._CRS?.projjson?.id?.code,i="CRS84"===t?4326:"CRS83"===t?4269:"CRS27"===t?4267:Number(t);if(Number.isSafeInteger(i)&&i>0)return i;let r=e?._CRS?.url;return"string"==typeof r&&Number(r.slice(r.lastIndexOf("/")+1))||void 0}function rt(e){let t=e.attributes._ARRAY_DIMENSIONS,i=e.array.shape??[];return!t?.length||t.length!==i.length}function at(e,t){let i="x"===t?Ve:qe;return(e.find(e=>i.has(e.attributes.standard_name?.toLowerCase()??""))??e.find(e=>i.has(e.name.toLowerCase()??"")))?.name}function nt(e,t){return`${e}/${t=t.split("/").map(encodeURIComponent).join("/")}`}const st="zarr-raster:open",lt=new Set(["none"]);let ot=class extends J.A{constructor(){super(...arguments),this.datasetFormat="ZARR"}get _baseUrl(){let{url:e}=this;return e.endsWith("/.zmetadata")||e.endsWith("/.zgroup")?e.slice(0,e.lastIndexOf("/")):e}async fetchRawTile(e,t,i,r={}){let{multidimensionalDefinition:a}=r;if(!a?.length)return null;let n=a[0].variableName,s=this._metadata.dataVariables.find(e=>e.name===n);if(!s)return null;let{storageInfo:l}=s,u=Object.fromEntries(a.map(e=>[e.dimensionName,e.values[0]])),f=this._getDimensionIndices(s,t,i,u);if(!f)return null;let h=s.attributes._ARRAY_DIMENSIONS,{xDimension:c,yDimension:d}=this._metadata,p=function(e,t,i,r){let{chunkSize:a,shape:n,pixelType:s,separator:l,isRowMajor:o,fillValue:u,scaleFactor:f,addOffset:h}=e,c=Array(n.length),d=Array(n.length),p=Array(n.length),m=1;for(let e=0;e<n.length;e++){let i=t[e];if(i<0||i>=n[e])return null;let r=a[e],s=Math.floor(i/r);c[e]=s,d[e]=i-s*r,p[e]=Math.min(r,n[e]-s*r),m*=r}return{chunkPath:c.join(l),chunkSize:a,actualSize:p,offsets:d,xIndex:i,yIndex:r,pixelType:s,isRowMajor:o,elementCount:m,fillValue:u,scaleFactor:f,addOffset:h}}(l,f,h.indexOf(c),h.indexOf(d));if(!p)return null;let m=nt(this._baseUrl,`${n}/${p.chunkPath}`),{data:g}=await this.request(m,{responseType:"array-buffer",signal:r.signal}),{actualSize:y,elementCount:w}=p,v=this._decodeChunk(g,l),x=y.reduce((e,t)=>e*t,1),b=v.length;if(b!==w&&b!==x)throw new o.A("zarr-raster:decode",`Invalid chunk length ${b} for "${m}"; expected ${w} or ${x} values`);return function(e,t){let i,{chunkSize:r,actualSize:a,xIndex:n,yIndex:s}=t,l=r[n],o=r[s],u=a[n],f=a[s],h=function(e,t){let{chunkSize:i,actualSize:r,xIndex:a,yIndex:n,pixelType:s,elementCount:l,isRowMajor:o}=t,u=i[a],f=i[n],h=e.length===l?i:r;return e.length===u*f&&h[a]===u&&h[n]===f?(o?n<a:a<n)?e:function(e,t,i,r){let a=new(V.A.getPixelArrayConstructor(r))(e.length);for(let r=0;r<i;r++)for(let n=0;n<t;n++)a[r*t+n]=e[n*i+r];return a}(e,u,f,s):function(e,t,i){let{chunkSize:r,actualSize:a,offsets:n,xIndex:s,yIndex:l,pixelType:o,isRowMajor:u}=t,f=r[s],h=r[l],c=a[s],d=a[l],p=Array(i.length),m=1;for(let e=0;e<i.length;e++){let t=u?i.length-1-e:e;p[t]=m,m*=i[t]}let g=new(V.A.getPixelArrayConstructor(o))(f*h);for(let t=0;t<d;t++)for(let r=0;r<c;r++){let a=0;for(let e=0;e<i.length;e++){let i=n[e];e===s?i=r:e===l&&(i=t),a+=i*p[e]}g[t*f+r]=e[a]}return g}(e,t,h)}(e,t);if(u<l||f<o){i=new Uint8Array(l*o);for(let e=0;e<f;e++)i.fill(1,e*l,e*l+u)}let{fillValue:c}=t;if(null!=c){let e=Number.isNaN(c);for(let t=0;t<f;t++)for(let r=0;r<u;r++){let a=t*l+r,n=h[a];(n===c||e&&Number.isNaN(n))&&(i??=new Uint8Array(l*o).fill(1),i[a]=0)}}let{pixelType:d,scaleFactor:p,addOffset:m}=t,g=d,y=h;if(1!==p||0!==m){g="f64"===d?"f64":"f32",y=new(V.A.getPixelArrayConstructor(g))(h.length);for(let e=0;e<h.length;e++)y[e]=0===i?.[e]?h[e]:h[e]*p+m}return new V.A({width:l,height:o,pixelType:g,pixels:[y],mask:i})}(v,p)}async _open(e){let t=this.url.slice(this.url.lastIndexOf("/")+1);if(t.endsWith(".zattrs")||t.endsWith(".zarray"))throw new o.A(st,`Unsupported Zarr URL: "${this.url}". Expect a v2 root url or consolidated metadata url`);let i=this._baseUrl;this.datasetName=i.slice(i.lastIndexOf("/")+1).replace(".zarr","");let r=e?.signal??void 0,{data:a}=await this.request(`${i}/.zmetadata`,{signal:r}),n=function(e){let t=e?.metadata;if("object"!=typeof t||!t||Array.isArray(t))throw new o.A(Ge,"missing consolidated metadata root");let i=new Map;for(let[e,r]of Object.entries(t))if(e.endsWith("/.zarray")){let a=r,n=Xe(e,"/.zarray"),s=t[`${n}/.zattrs`],l=Ye(a,s);if(s){let e=s._ARRAY_DIMENSIONS;if(!e?.length)throw new o.A(Ge,`missing required _ARRAY_DIMENSIONS attribute for array "${n}"`);if(null!=s.scale_factor&&!Number.isFinite(s.scale_factor)||null!=s.add_offset&&!Number.isFinite(s.add_offset))throw new o.A(Ge,`Invalid scale_factor or add_offset for array "${n}"`);let t=1===e.length&&e[0]===n,r=tt([s]),{shape:u,chunkSize:f}=l;if(e.length!==u.length||e.length!==f.length)throw new o.A(Ge,`variable dimensions do not match shape for array "${n}"`);i.set(n,{name:n,isDimension:t,storageInfo:l,spatialReference:r,array:a,attributes:s})}}if(0===i.size)throw new o.A(Ge,"no arrays found");let r=Array.from(i.values()),{xDimension:a,yDimension:n}=function(e){let t=e.filter(e=>e.isDimension),i=t.map(e=>e.name),r=at(t,"x"),a=at(t,"y");if(!r||!a){let t=(e.find(e=>!e.isDimension&&(e.attributes._ARRAY_DIMENSIONS?.length??0)>=2)?.attributes._ARRAY_DIMENSIONS)?.filter(e=>i.includes(e))??i;r??=t.findLast(e=>e!==a),a??=t.findLast(e=>e!==r)}if(!r||!a||r===a)throw new o.A(Ge,`Unable to determine x and y dimensions from variable dimensions "${i.join(", ")}"`);return{xDimension:r,yDimension:a}}(r),s=function(e,t,i){let r=e.filter(e=>{let r=!e.isDimension,a=e.attributes._ARRAY_DIMENSIONS,n=a?.includes(t)&&a.includes(i);return r&&n});if(0===r.length)throw new o.A(Ge,"no valid data variables found");if(r.some(rt))throw new o.A(Ge,"some variable dimensions do not match shape");let a=e.filter(e=>e.isDimension),n=r[0],s=n.attributes._ARRAY_DIMENSIONS,l=n.storageInfo.chunkSize[s.indexOf(t)],u=n.storageInfo.chunkSize[s.indexOf(i)];for(let e of r){let r=e.attributes._ARRAY_DIMENSIONS;if(r.some((t,i)=>{let r=a.find(e=>e.name===t);return r&&r.storageInfo.shape[0]!==e.storageInfo.shape[i]}))throw new o.A(Ge,`Coordinate dimensions do not match shape for "${e.name}"`);let{chunkSize:s}=e.storageInfo;if(s[r.indexOf(t)]!==l||s[r.indexOf(i)]!==u)throw new o.A(Ge,`X/Y chunk sizes must match across variables: compare ${e.name} ${n.name}`)}return r}(r,a,n),l=r.filter(e=>e.isDimension);return{dataDimensions:l,dataVariables:s,spatialReference:s.find(e=>e.spatialReference)?.spatialReference??l.find(e=>e.spatialReference)?.spatialReference,xDimension:a,yDimension:n,version:2}}(a);this._metadata=n;let s=[...n.dataDimensions,...n.dataVariables].find(({storageInfo:{compression:e}})=>!lt.has(e));if(s)throw new o.A(st,`Unsupported Zarr compression "${s.storageInfo.compression}" for array "${s.name}"`);let l={};await Promise.all(n.dataDimensions.map(e=>this._readDimensionValues(e,l,r)));let u=function(e,t){let{dataDimensions:i,dataVariables:r,spatialReference:a}=e,n=r[0],s=n.attributes._ARRAY_DIMENSIONS??[],{xDimension:l,yDimension:u}=e,f=i.find(e=>e.name===l)?.storageInfo.shape[0],h=i.find(e=>e.name===u)?.storageInfo.shape[0];if(!f||!h)throw new o.A(Ge,`Unable to determine width and height from dimensions "${l}" and "${u}"`);let c=t[l],d=t[u];if(c.some((e,t)=>t>0&&e<c[t-1])||d.some((e,t)=>t>0&&e>d[t-1]))throw new o.A(Ge,"Unsupported spatial coordinates order, must be ascending X and descending Y");let[p,m]=et(c),[g,y]=et(d),w=new H.A({xmin:p,ymin:g,xmax:m,ymax:y,spatialReference:a}),v=Math.abs((m-p)/f),x=Math.abs((y-g)/h),b={x:v,y:x},I=new Map;for(let e of i){let i=e.name;if(i===l||i===u)continue;let r=e.storageInfo.shape[0],a=Qe(i,r,t),{attributes:n}=e;I.set(i,{name:i,description:Ke(n),unit:n.units,values:a,extent:a?[a[0],a.at(-1)]:r>0?[0,r-1]:void 0})}let A=[];for(let e of r){let t=e.attributes._ARRAY_DIMENSIONS.map(e=>I.get(e)).filter(e=>!!e),{attributes:i}=e;A.push({name:e.name,description:Ke(i),unit:i.units??null,dimensions:t})}let S=A.length?{variables:A}:null,{pixelType:C}=n.storageInfo;for(let{storageInfo:e}of r){if("f64"===e.pixelType){C="f64";break}("f32"===e.pixelType||1!==e.scaleFactor||0!==e.addOffset)&&(C="f32")}let _={DataType:S?"Scientific":"Generic"},{chunkSize:R}=n.storageInfo,M=R[s.indexOf(l)],T=R[s.indexOf(u)],O=[{minCol:0,maxCol:Math.ceil(f/M)-1,minRow:0,maxRow:Math.ceil(h/T)-1}],k=new Ce.A({x:p,y,spatialReference:a}),F=(v+x)/2,D=new Me.A({origin:k,size:[M,T],spatialReference:a,lods:[new Ze.A({level:0,resolution:F,scale:1/.0254*96*F})]}),N=new Re.A({blockWidth:M,blockHeight:T,pyramidBlockWidth:M,pyramidBlockHeight:T,compression:n.storageInfo.compression,origin:k,firstPyramidLevel:0,maximumPyramidLevel:0,blockBoundary:O,tileInfo:D,isVirtualTileInfo:!1}),P=n.storageInfo.fillValue,z=new re.A({width:f,height:h,pixelSize:b,pixelType:C,bandCount:1,noDataValue:P,extent:w,spatialReference:a,keyProperties:_,multidimensionalInfo:S,isPseudoSpatialReference:!1,format:"zarr",storageInfo:N});return(0,L.vj)(z),z}(n,l);this._dimensionValues=l,this._set("rasterInfo",u)}_getDimensionIndices(e,t,i,r){let a=e.attributes._ARRAY_DIMENSIONS,{xDimension:n,yDimension:s}=this._metadata,{chunkSize:l}=e.storageInfo;if(!this.rasterInfo.multidimensionalInfo?.variables.find(t=>t.name===e.name)?.dimensions?.length)return null;let o=[];for(let e=0;e<a.length;e++){let u=a[e];if(u===n)o[e]=i*l[e];else if(u===s)o[e]=t*l[e];else{let t=this._dimensionValues[u],i=r[u],a=t?.indexOf(i)??-1;if(a<0)return null;o[e]=a}}return o}async _readDimensionValues(e,t,i){let{name:r,storageInfo:a}=e,n=a.chunkSize[0],s=a.shape[0];if(n<=0||s<=0)throw new o.A(st,`Invalid dimension array "${r}" with chunkSize ${n} and totalElements ${s}`);let l=Math.ceil(s/n),u=this._baseUrl,f=[];for(let e=0;e<l;e++){let t=nt(u,`${r}/${e}`),h=e===l-1?s-e*n:n;f.push(this.request(t,{responseType:"array-buffer",signal:i}).then(e=>{let t=this._decodeChunk(e.data,a);if(t.length!==n&&t.length!==h)throw new o.A(st,`Invalid dimension chunk length for "${r}"`);return t.slice(0,h)}).catch(e=>{throw(0,c.zf)(e)?e:new o.A(st,`Unable to fetch dimension data for "${r}"`)}))}let h=(await Promise.all(f)).flatMap(e=>Array.from(e)),{scaleFactor:d,addOffset:p}=a;if(1!==d||0!==p)for(let e=0;e<h.length;e++)h[e]=h[e]*d+p;t[r]="days since 1899-12-30 00:00:00 UTC"===e.attributes.units?h.map(ne.$E):h}_decodeChunk(e,t){let{compression:i}=t;if(!lt.has(i))throw new o.A("zarr-raster:decode",`Unsupported Zarr compression "${i}"`);return function(e,t){let{pixelType:i,originalPixelType:r}=t,a=!t.isBigEndian,n=V.A.getPixelArrayConstructor(i);if(a&&"f2"!==r)return new n(e);let s="f2"===r?2:(0,q.Qd)(i),l=e.byteLength/s,u=new DataView(e),f=new n(l);for(let e=0,t=0;e<l;t+=s,e++)switch(i){case"s8":f[e]=u.getInt8(t);break;case"u8":f[e]=u.getUint8(t);break;case"s16":f[e]=u.getInt16(t,a);break;case"u16":f[e]=u.getUint16(t,a);break;case"s32":f[e]=u.getInt32(t,a);break;case"u32":f[e]=u.getUint32(t,a);break;case"f32":f[e]="f2"===r?u.getFloat16(t,a):u.getFloat32(t,a);break;case"f64":f[e]=u.getFloat64(t,a);break;default:throw new o.A("zarr-raster:decode",`Unsupported coordinate pixel type: ${i}`)}return f}(e,t)}};(0,a.Cg)([(0,n.MZ)()],ot.prototype,"_baseUrl",null),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],ot.prototype,"_dimensionValues",void 0),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],ot.prototype,"_metadata",void 0),(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],ot.prototype,"datasetFormat",void 0),ot=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.ZarrRaster")],ot);const ut=ot,ft=new Map;ft.set("RasterTileServer",{desc:"Raster Tile Server",constructor:ke}),ft.set("TIFF",{desc:"Cloud Optimized GeoTIFF",constructor:je}),ft.set("MRF",{desc:"Meta Raster Format",constructor:ze}),ft.set("ZARR",{desc:"Zarr Raster Format",constructor:ut}),ft.set("JPG",{desc:"JPG Raster Format",constructor:Ae}),ft.set("PNG",{desc:"PNG Raster Format",constructor:Ae}),ft.set("GIF",{desc:"GIF Raster Format",constructor:Ae}),ft.set("BMP",{desc:"BMP Raster Format",constructor:Ae}),ft.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ue}),ft.set("MEMORY",{desc:"In Memory Raster Format",constructor:le});class ht{static get supportedFormats(){let e=new Set;return ft.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,n=e.datasetFormat??i?.datasetFormat;n??(/(?:\.zarr|\/\.(?:zmetadata|zarray|zgroup))$/.test(t)?n="ZARR":t.includes(".")?n=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?n="CovJSON":r?.extent&&r.pixelblocks&&(n="MEMORY")),"OVR"===n||"TIF"===n||"DM"===n?n="TIFF":"JPG"===n||"JPEG"===n||"JFIF"===n?n="JPG":"COVJSON"===n&&(n="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");let s={url:t,source:r,sourceJSON:a,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(s).forEach(e=>{s[e]??delete s[e]}),n){if(!this.supportedFormats.has(n))throw new o.A("rasterfactory:open","not a supported format "+n);if("CRF"===n)throw new o.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(ft.get(n).constructor)(s);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let l=Array.from(ft.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(n=l[u++],!n||"CRF"===n)return null;let t=new(ft.get(n).constructor)(s);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){ft.has(e.toUpperCase())||ft.set(e.toUpperCase(),{desc:t,constructor:i})}}var ct=i(99235),dt=i(10873),pt=i(20437),mt=i(74797),gt=i(22796),yt=i(69409);const wt={instance:null,refCount:0,connectionPromise:null};async function vt(){if(wt.refCount++,wt.instance)return wt.instance;if(!wt.connectionPromise){let e=new yt.A;wt.connectionPromise=e.initialize().then(()=>{wt.instance=e})}return await wt.connectionPromise,wt.instance}function xt(){wt.refCount--,wt.refCount>0||(wt.instance?.destroy(),wt.instance=null,wt.connectionPromise=null,wt.refCount=0)}let bt=class extends((0,R.dM)((0,N.j)((0,T.q)((0,O.A)((0,F.H)((0,M.d)((0,z.b)((0,k.G)((0,P.e)((0,_.b)((0,D.J)((0,h.M)((0,l.OU)(C.A)))))))))))))){constructor(e){super(e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new v(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,c.sg)(async(e,t,r)=>{let{save:a,saveAs:n}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return n(this,r,t)}})}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,f.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,mt.rZ)("Pixel Value"),(0,mt.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,mt.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,mt.DV)(t),r=(0,mt.y6)();e.push(i,r)}if(a){let t=(0,mt.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==mt.F_.rawServicePixelValue)),r=(0,I.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,mt.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,s.PZ)(gt.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof o.A?e:new o.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,S.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,L.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new o.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new o.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,d.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,L.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,ct.UD)(t.toJSON(),a),a.some(e=>At(e,this.ioConfig))&&(r=await vt(),this._releaseWorkerHandle={remove:()=>xt()});let n=await Promise.all(a.map(e=>ht.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),s=n.findIndex(e=>null==e);if(s>-1)throw new o.A("imagery-tile-layer:open",`cannot open raster: ${a[s]}`);return this._primaryRasters=n,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;At(e,this.ioConfig)&&(i=await vt(),this._releaseWorkerHandle={remove:()=>xt()});let r=await ht.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new o.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new o.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await ht.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new o.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,ct.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new E.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof o.A&&u.A.getLogger(this).error("imagery-tile-layer:open",e.message),u.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,b.XF)(u.A.getLogger(this),(0,b.$7)("ImageryTile layers","relative-to-scene",e)),(0,b.XF)(u.A.getLogger(this),(0,b.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,n.MZ)({clonable:!1})],bt.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,n.MZ)({clonable:!1})],bt.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,n.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],bt.prototype,"charts",void 0),(0,a.Cg)([(0,n.MZ)({type:A.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],bt.prototype,"elevationInfo",null),(0,a.Cg)([(0,n.MZ)({type:Me.A})],bt.prototype,"tileInfo",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,clonable:!1})],bt.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,n.MZ)(dt.fV)],bt.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],bt.prototype,"isReference",void 0),(0,a.Cg)([(0,n.MZ)({type:["show","hide"]})],bt.prototype,"listMode",void 0),(0,a.Cg)([(0,n.MZ)({json:{read:!0,write:!0}})],bt.prototype,"blendMode",void 0),(0,a.Cg)([(0,n.MZ)({type:gt.A,json:{name:"renderingRule",write:!0}})],bt.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,n.MZ)()],bt.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],bt.prototype,"version",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,json:{read:!1}})],bt.prototype,"type",void 0),(0,a.Cg)([(0,n.MZ)({type:["ArcGISTiledImageServiceLayer"]})],bt.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],bt.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,n.MZ)({type:x.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],bt.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0})],bt.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,n.MZ)(dt.PY)],bt.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,type:[pt.A]})],bt.prototype,"fields",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,type:[pt.A]})],bt.prototype,"rasterFields",null),(0,a.Cg)([(0,n.MZ)({constructOnly:!0})],bt.prototype,"source",void 0),bt=(0,a.Cg)([(0,n.$K)("esri.layers.ImageryTileLayer")],bt);const It=bt;function At(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(91429),n=i(53966),s=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,s.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,s.Jf)(e,n.A.getLogger(this)))}};return(0,r.Cg)([(0,a.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,a.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),n=i(56507),s=i(69540),l=i(25482),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(l.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[n.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},43163(e,t,i){i.d(t,{A:()=>p});var r,a=i(32198),n=i(91429),s=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,n=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+n*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+n*e[9]+i*e[11]}}let n=r*r,s=a*a,l=r*a,o=n*r,u=n*a,f=r*s,h=a*s;return{x:e[0]+r*e[2]+a*e[4]+n*e[6]+l*e[8]+s*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+n*e[7]+l*e[9]+s*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function d(e,t,i){let{xmin:r,ymin:a,xmax:n,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:n,y:l}),u.push({x:r,y:a}),u.push({x:n,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:n,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(n-r)*t/e,y:a}),u.push({x:r+(n-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new s.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let p=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,n,s]=e,l=r*s-n*a,o=n*a-r*s;return[(n*i-t*s)/l,(r*i-t*a)/o,s/l,a/o,-n/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],p.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],p.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],p.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],p.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],p.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],p.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,n.MZ)()],p.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],p.prototype,"type",void 0),p=r=(0,a.Cg)([(0,n.$K)("esri.layers.raster.transforms.PolynomialTransform")],p)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),n=i(56372),s=i(91429),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),d=i(76030),p=i(84952),m=i(78888),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,n=!0,s=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(s=!1,o[u]|=1<<t):n=!1,31===t&&++u}s?(this._availability="unavailable",this.byteSize=40):n?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,n=this._availability;return a<0||a>n.length?"unknown":n[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||m.A,{row:r,col:a,width:n,height:s}=e,o={query:{f:"json"}};return t=t?{...o,...t}:o,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:s},valid:!0,data:Array(n*s).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==s))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:s}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=m.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let n=this.layer.tileInfo;n.updateTileInfo(r);let s=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(n.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,s),s}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,n){if(!this._prefetchingEnabled)return;let s=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(s))return;let l=new AbortController;n.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,s),await(0,d.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(s)),(0,h.G4)(l))return;let c=new g.U(e,t,i),p={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,p);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,n=this._tilemapFromCache(e,t,i,a);if(n)return Promise.resolve(n);let s=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(s,()=>t((0,h.NK)()));let i=x(a),n=this._pendingTilemapRequests[i];if(!n){n=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=n,n.then(e,e)}n.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,p.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,s.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>p,Tw:()=>c,X6:()=>d});var r=i(5443),a=i(86738),n=i(16930),s=i(87186),l=i(20223),o=i(78888),u=i(22671),f=i(2272);async function h(e,t,i){let h=(0,f.Dl)(e),{rasterFunction:c,sourceJSON:d}=t||{},p=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,f.lF)({...h.query,renderingRule:p,f:"json"}),g=(0,f.jV)(m,i);e=h.path;let y=d||await(0,o.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,o.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,o.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,o.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,o.A)(`${e}/keyProperties`,g):null,A=y.hasMultidimensions?(0,o.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,o.A)(`${e}/statistics`,g):null,C=await Promise.allSettled([v,x,b,I,A,S]),_=r.A.fromJSON(y.extent),R=Math.ceil(_.width/y.pixelSizeX-.1),M=Math.ceil(_.height/y.pixelSizeY-.1),T=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),O="fulfilled"===C[0].status?C[0].value?.data:null,k=O?.features?.length?u.A.fromJSON(O):null,F="fulfilled"===C[1].status?C[1].value?.data.colormap:null,D=F?.length?F:null,N="fulfilled"===C[2].status?C[2].value?.data.histograms:null,P=N?.[0]?.counts?.length?N:null,z="fulfilled"===C[3].status?C[3].value?.data??{}:{},L="fulfilled"===C[4].status?C[4].value?.data.multidimensionalInfo:null,E=L?.variables?.length?L:null;var B;(B=E)&&B.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let $=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===C[5].status?C[5].value?.data.statistics:null),{defaultVariable:J,serviceDataType:U}=y;J&&J!==z.DefaultVariable&&(z.DefaultVariable=J),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(z.DataType)&&(z.DataType=U.replace("esriImageServiceDataType",""));let H=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==H)&&(H=y.noDataValues);let j=y.transposeInfo?new l.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:T}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,M))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new s.A({width:R,height:M,bandCount:y.bandCount,extent:r.A.fromJSON(y.extent),spatialReference:T,pixelSize:new a.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:T}),pixelType:y.pixelType.toLowerCase(),statistics:$,attributeTable:k,colormap:D,histograms:P,keyProperties:z,noDataValue:H,multidimensionalInfo:E,storageInfo:j})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function d(e,t,i){return h(e,{rasterFunction:t},i)}function p(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(4718),n=i(84952),s=i(70333),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,a.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let n=e[a];if(null!=n&&"function"!=typeof n)if(Array.isArray(n))r[a]=n.map(e=>f(e));else if("object"==typeof n)if(n.toJSON){let e=n.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?n:JSON.stringify(n);else r[a]=n}return r}async function h(e,t,a){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??s.id?.findCredential(e)?.token:null}(e,t)||(!s.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(7956),i.e(4189)]).then(()=>i(98232)),(await s.id.getCredential(e,a))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>s});var r=i(56512),a=i(86211),n=i(16271);function s(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:d}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,n.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",n=(0,a.mq)(i);return n?(0,a.oU)(e,r,n):0});const c={mode:"absolute-height",offset:0},d={mode:"on-the-ground",offset:null}}}]);
1
+ "use strict";(Array.isArray(self.webpackChunkRemoteClient)?self.webpackChunkRemoteClient:self.webpackChunkRemoteClient=[]).push([[6051],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...n){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(n,r)||(i=e.apply(this,n),t=this,r=n,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{JY:()=>d,Qf:()=>o,Qh:()=>s,lM:()=>n,ro:()=>u,rq:()=>f});var r=i(44208),a=i(34275);function n(e){if(!e)return 0;let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return o(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return f(e,8);let i=c;for(let r=0;r<t;r++)i+=l(e[r]);return i}(e);let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?s(e):h;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...e){return e.reduce((e,t)=>e+u(t),0)}function u(e,t=16){return e?(0,a.iu)(e)?e.byteLength+p:Array.isArray(e)?f(e,t):0:0}function f(e,t){return c+e.length*t}const h=32,c=16,d=(0,r.A)("ios")||!(0,r.A)("chrome")&&!(0,r.A)("opr")?8:4,p=145},5359(e,t,i){i.d(t,{H:()=>r,Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}},16051(e,t,i){i.r(t),i.d(t,{default:()=>It});var r,a=i(32198),n=i(91429),s=i(56507),l=i(69540),o=i(49186),u=i(53966),f=i(97768),h=i(25728),c=i(17676),d=i(36708),p=i(41910),m=i(60950),g=i(89808),y=i(99959),w=i(5359);class x extends y.A{get[(r=w.H,m.ym)](){return this.layer}get[g.Q](){return this.layer}get[p.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var v=i(40124),b=i(24212),I=i(30291),A=i(88625),S=i(59923),C=i(4146),_=i(18768),R=i(63074),T=i(69208),M=i(34287),O=i(8303),k=i(72545),F=i(56551),D=i(54310),N=i(25036),P=i(82935),z=i(82806),L=i(7548),E=i(23636),B=i(22671),$=i(51927),J=i(49859),U=i(68197),H=i(5443),j=i(16930),Z=i(73444),V=i(14140),q=i(94778);function W(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function G(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function X(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],n=-1,s=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];W(o)?n=e:G(o)&&(s=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,n=(t-e)/(i-1);r.push([e-.5*n,t+.5*n]),a.push(n);for(let t=0;t<i;t++)f.push(e+n*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}n>-1&&-1===s?s=+(0===n):s>-1&&-1===n?n=+(0===s):-1===s&&-1===n&&(n=0,s=1),l=l.filter((e,t)=>t!==n&&t!==s);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[n])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new j.A({wkid:h}),[d,p]=r[n],[m,g]=r[s],y=new H.A({xmin:d,xmax:p,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[n]),height:Math.round(y.height/a[s]),extent:y,dimensions:l}}function Y(e){let t=(0,Z.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function K(){return Math.round(255*Math.random())}function Q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:n,categoryEncoding:s,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Y(a)),n&&(t[e].unit=n.label?Y(n.label):null,t[e].symbol=n.symbol?.value),s)){let i=Object.entries(s).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Y(e.label):null,e.preferredColor)){let t=U.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=K(),e.Green=K(),e.Blue=K())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function ee(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,q.X1)(t,i)}function te(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),n=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),s=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);s+=n[l]*(i%t[a]),i=Math.floor(i/t[a])}return s}var ie=i(45617),re=i(87186),ae=i(47520),ne=i(4366);let se=class extends J.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,n=this._pixelBlockTiles.get(a);if(n)return n;if(!this.source)return null;let{rasterInfo:s}=this,[l,o]=s.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let n=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return n&&this._pixelBlockTiles.set(a,n),n}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let d={pixelBlock:c,useBilinear:"thematic"!==s.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(d,r):(0,ae.J$)(d)}async _open(e){if(!this.source)throw new o.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:n,nativeExtent:s,transform:l,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:d}=f??t.imageInfo,p=t.extent??new H.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new j.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:p.width/h,y:p.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new re.A({width:h,height:c,pixelType:d,extent:p,nativeExtent:s,attributeTable:r,colormap:u,transform:l,pixelSize:g,spatialReference:p.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:n});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,n="thematic"!==r.dataType,s=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:n},i):Promise.resolve((0,ae.lD)(e,t,a,n)),l=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,$.f4)(e)),h=await(0,c.Lx)([s,f]);if(!h[0].value)throw new o.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=h[0].value,l||(r.statistics=h[1].value?.statistics),u||(r.histograms=h[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let n=a.dimensions.map(e=>new ie.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),s=(0,ne.NG)(n,t),l=null==s?null:e[s];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,$.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],se.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)({constructOnly:!0})],se.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,n.MZ)()],se.prototype,"source",void 0),(0,a.Cg)([(0,n.MZ)()],se.prototype,"url",null),se=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.InMemoryRaster")],se);const le=se;let oe=class extends J.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:n}=await this._fetchData(e),{statistics:s,histograms:l}=(0,$.eH)(i[0]),o=n?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new le({source:{extent:t,pixelBlocks:i,attributeTable:a?B.A.fromJSON(a):null,multidimensionalInfo:r,statistics:s,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new o.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new o.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new o.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:n,values:s}=r[e];if(!("ndarray"===n.toLowerCase()&&s?.length&&t?.length&&a?.length))throw new o.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!W(t[t.length-1])||!G(t[t.length-2]))throw new o.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=X(e),{ranges:n}=e,s=Object.keys(n).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<s.length;e++){let t=s[e];a?.length&&l.push({name:t,dimensions:a})}let o=Q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<s.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=n[s[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),d=u.slice(0,-2),p="float"===l?"f32":ee(r),m=t*i,g=r.length/m;for(let n=0;n<g;n++){let s=V.A.createEmptyBand(p,m),l=new Uint8Array(m).fill(255),o=!1,u=n*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):s[e]=t}if(0===e||a?.length){let e=new V.A({width:t,height:i,mask:o?l:null,pixels:[s],pixelType:p});e.updateStatistics(),a?.length?f[te(c,d,n)+h]=e:f.push(e)}else{let e=f[n];e.pixels.push(s),o?e.mask&&=V.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:s}}(t)}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],oe.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)({constructOnly:!0})],oe.prototype,"source",void 0),oe=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.CovJSONRaster")],oe);const ue=oe;var fe=i(85951),he=i(33196),ce=i(43163),de=i(4576),pe=i(21325),me=i(330);function ge(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function ye(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new j.A({wkid:t});if(e=String(e).trim(),(0,pe.jp)(e))return new j.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),n=a>-1?a:i.indexOf("GEOGCS");if(-1===n)return null;let s=e.slice(n,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=we(s);let o=t?new j.A({wkid:t}):new j.A({wkt:s}),u=we(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=we(e),0===t?new j.A({wkt:e}):new j.A({wkid:t})):null}function we(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function xe(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,me.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,me.mX)(e);t.spatialReference=ye(i)}}else if((0,me.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,me.V6)(e,"GeodataXform"),i=ye((0,me.v7)(t,"SpatialReference/WKID")||(0,me.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,me.v7)(t,"PolynomialOrder")??1,a=(0,me.Ui)(t,"CoeffX/Double"),n=(0,me.Ui)(t,"CoeffY/Double"),s=(0,me.Ui)(t,"InverseCoeffX/Double"),l=(0,me.Ui)(t,"InverseCoeffY/Double"),o=ge(a,n),u=ge(s,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new ce.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,me.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,me.mX)(e));else if((0,me.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,n=(0,me.v7)(e,"NoDataValue"),s=(0,me.V6)(e,"Histograms/HistItem"),l=(0,me.v7)(s,"HistMin"),o=(0,me.v7)(s,"HistMax"),u=(0,me.v7)(s,"BucketCount"),f=(0,me.mX)(s,"HistCounts")?.split("|").map(e=>Number(e));(0,me.IC)(e,"Metadata/MDI").forEach(e=>{let n=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=n;break;case"STATISTICS_MAXIMUM":i=n;break;case"STATISTICS_MEAN":r=n;break;case"STATISTICS_STDDEV":a=n}});let h=(0,me.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:n,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(de.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(de.Ru):null),t}const ve="image-aux-raster:open",be="The data is not a supported format.";let Ie=class extends J.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,n="immediate"===a||"jpg"!==r;if(n){let a=await this._decodeFullImage(i,r,e);if(!a)throw new o.A(ve,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,fe.R)(i);if(!r)throw new o.A(ve,be);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:s,ioConfig:l}=this,u=new le({preGenerateTiles:n,rasterJobHandler:s,source:t,ioConfig:{...l,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:n}=await this._fetchAuxiliaryData(t),s=!i;s&&(i=new j.A({wkid:3857})),a?.length&&null==r&&(r=(0,$.Pg)(a));let{width:l,height:o}=e,u=new H.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=n?n.forwardTransform(u):u,h=!0;if(n){let e=n.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(n=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:n,statistics:r,histograms:a,isPseudoSpatialReference:s,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,he.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new o.A(ve,be);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,c.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),n=this.datasetFormat,s="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,l=r||null==s||i.includes(s)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+s,{responseType:"text",signal:t}),o=await(0,c.Lx)([a,l]);if(t?.aborted)throw(0,c.NK)();let u=xe(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new ce.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],Ie.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)()],Ie.prototype,"rasterJobHandler",null),Ie=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.ImageAuxRaster")],Ie);const Ae=Ie;var Se=i(84952),Ce=i(86738),_e=i(82371),Re=i(20223),Te=i(87045),Me=i(25943);let Oe=class extends J.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:n}=this.rasterInfo,{transposeInfo:s}=a,l=null!=s&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let n=0;for(let{data:e}of t)u.push(n),a.set(new Uint8Array(e),n),n+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:d}=a,p=l?s.tileSize:d.size,m=/^(mixed|jp)/i.test(d.format),g="raw"===d.format,y=await this.decodePixelBlock(o,{format:g?"bsq":void 0,width:p[0],height:p[1],planes:u?.length,offsets:u,pixelType:g?this.rasterInfo.pixelType:void 0,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==y)return null;let w=a.blockBoundary[e];if("jpg"!==a.compression||i>w.minCol&&i<w.maxCol&&t>w.minRow&&t<w.maxRow)return y;let{origin:x,blockWidth:v,blockHeight:b}=a,{x:I,y:A}=this.getPyramidPixelSize(e),S=Math.round((n.xmin-x.x)/I)%v,C=Math.round((n.xmax-x.x)/I)%v||v,_=Math.round((x.y-n.ymax)/A)%b,R=Math.round((x.y-n.ymin)/A)%b||b,T=i===w.minCol?S:0,M=t===w.minRow?_:0,O=i===w.maxCol?C:v,k=t===w.maxRow?R:b;return(0,ae.z$)(y,{x:T,y:M},{width:O-T,height:k-M}),y}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let i=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,n=a-r+this._levelOffset,s=i.srcLocation;for(;n>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(n,i.row,i.col,t))break}catch{}if(n--,r++,i=this.identifyPixelLocation(s,r,t.datumTransformation),null===i)return null}return-1===n||null==i?null:r}async _open(e){let t=e?.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let r=i.data;if(this.sourceJSON=r,!r)throw new o.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new o.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new o.A("image-server-raster:open","cannot initialize image service");(0,_e.E9)(a,r);let n="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:n}=t;if(null!=a&&null!=n)return Te.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=n)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,n=r?t(r):-1/0;return Te.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=n})})}return Te.A.fromJSON(e)}(r.tileInfo,r):Te.A.fromJSON(r.tileInfo);(0,f.Lw)(n);let[s,l]=this._computeMinMaxLOD(a,n),{extent:u,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(s.resolution-h.x)>c)&&(h.x=h.y=s.resolution,a.width=Math.ceil((u.xmax-u.xmin)/h.x-.1),a.height=Math.ceil((u.ymax-u.ymin)/h.y-.1));let d=s.level-l.level,[p,m]=n.size,g=[],y=[],{lods:w}=n;w.forEach((e,t)=>{e.level>=l.level&&e.level<=s.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let x,v=this.computeBlockBoundary(u,p,m,n.origin,g,d),b=g.length>1?g.slice(1):null;r.transposeInfo&&(x={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(l.resolution/s.resolution)**(-1/d))/10,A=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Re.A({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:n,isBsqTile:A,transposeInfo:x,blockBoundary:v}),(0,L.vj)(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,Se.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Me.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=j.A.fromJSON(t.spatialReference||e.spatialReference),n=new Ce.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new re.A({width:i,height:r,bandCount:3,extent:H.A.fromJSON(e),spatialReference:a,pixelSize:n,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,_e.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,n=await Promise.all([r,a]);return this._slices=n[1],n[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,n=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),s=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[n,s];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??n,s];let{minScale:o,maxScale:u}=this.sourceJSON,f=n;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??n);let h=s;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??s,this._levelOffset=h.level-s.level),[f,h]}};(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],Oe.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)()],Oe.prototype,"tileType",void 0),Oe=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.ImageServerRaster")],Oe);const ke=Oe;var Fe=i(10713);const De=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Ne=new Map;Ne.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Ne.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Ne.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Ne.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Ne.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Pe=class extends J.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:n,blockBoundary:s}=this.rasterInfo.storageInfo,l=s[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*n);return new V.A({width:a,height:n,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<p;g++)(!d||d.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(w),v=[],b=0;for(g=0;g<p;g++)v.push(b),x.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Ne.get(this.rasterInfo.storageInfo.compression).decoderFormat,A="jpg"===I&&4===o&&1===v.length,S=await this.decodePixelBlock(x.buffer,{width:a,height:n,format:I,planes:d?.length||o,offsets:v,pixelType:u,canvasUsage:A?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:C}=this.rasterInfo;if(null!=C&&"lerc"!==I&&!S.mask&&(C=C[0],null!=C)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(C)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-C)/C)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==C&&(t[g]=1);S.mask=t}let _=0,R=0;if(h!==a||c!==n){let e=S.mask;if(e)for(g=0;g<n;g++)if(R=g*a,g<c)for(_=h;_<a;_++)e[R+_]=0;else for(_=0;_<a;_++)e[R+_]=0;else for(e=new Uint8Array(a*n),S.mask=e,g=0;g<c;g++)for(R=g*a,_=0;_<h;_++)e[R+_]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:n,skipExtensions:s=[]}=this.ioConfig;if(!s.includes("aux.xml")&&!n){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,$.Pg)(t.histograms)))}n&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(Fe.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,d=[],p=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*p*4,d.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=d,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,n,{blockWidth:s,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,d=0;for(n=0;n<e;n++)d=o**n,r=Math.ceil(u/s/d),a=Math.ceil(f/l/d),c+=r*a;d=o**e,r=Math.ceil(u/s/d),a=Math.ceil(f/l/d),c+=t*r+i,c*=4*h;let p=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=p[4*e]*2**32+p[4*e+1],g=m+p[4*e+2]*2**32+p[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?s:Math.ceil(u/d)-s*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/d)-l*(a-1)}}_parseHeader(e){let t=(0,me.V6)(e,"MRF_META/Raster");if(!t)throw new o.A("mrf:open","not a valid MRF format");let i=(0,me.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),n=parseInt(i.getAttribute("c"),10),s=((0,me.mX)(t,"Compression")||"none").toLowerCase();if(!Ne.has(s))throw new o.A("mrf:open","currently does not support compression "+s);let l=(0,me.mX)(t,"DataType")||"UInt8",u=De.get(l.toLowerCase());if(null==u)throw new o.A("mrf:open","currently does not support pixel type "+l);let f=(0,me.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),d=f.getAttribute("c"),p=d?d===String(n):Ne.get(s).isOneSegment;this._isBsq=!p;let m,g=(0,me.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,me.V6)(e,"MRF_META/CachedSource"))throw new o.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,me.V6)(e,"MRF_META/GeoTags"),x=(0,me.V6)(w,"BoundingBox"),v=!1;if(null!=x){let e=parseFloat(x.getAttribute("minx")),t=parseFloat(x.getAttribute("miny")),i=parseFloat(x.getAttribute("maxx")),r=parseFloat(x.getAttribute("maxy")),a=(0,me.mX)(w,"Projection")||"",n=j.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(n=new j.A({wkid:e}))}else n=ye(a)??j.A.WGS84;else v=!0,n=new j.A({wkid:3857});y=new H.A({xmin:e,ymin:t,xmax:i,ymax:r}),y.spatialReference=n}else v=!0,y=new H.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new j.A({wkid:3857})});let b=(0,me.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),A=y.spatialReference,S=new Re.A({origin:new Ce.A({x:y.xmin,y:y.ymax,spatialReference:A}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:s,pyramidScalingFactor:I}),C=new Ce.A({x:y.width/r,y:y.height/a,spatialReference:A}),_=new re.A({width:r,height:a,extent:y,isPseudoSpatialReference:v,spatialReference:A,bandCount:n,pixelType:u,pixelSize:C,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,me.mX)(t,"DataFile")),T=this._getAuxFullPath((0,me.mX)(t,"IndexFile"));return{rasterInfo:_,files:{mrf:this.url,index:T||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Ne.get(s).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return xe(t)}catch{return null}}};(0,a.Cg)([(0,n.MZ)()],Pe.prototype,"_files",void 0),(0,a.Cg)([(0,n.MZ)()],Pe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,n.MZ)()],Pe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],Pe.prototype,"datasetFormat",void 0),Pe=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.MRFRaster")],Pe);const ze=Pe;i(44208);var Le=i(44094),Ee=i(94213),Be=i(9334);function $e(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),n=a.map(e=>e.name),s=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<n.length;o++)t[n[o]]=e[o-1];s.push({attributes:t})}),{displayFieldName:"",fields:a,features:s}}function Je(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),n=t.getUint16(10,!0),s={version:i,recordCount:r,headerByteCount:a,recordByteCount:n},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,Be.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>n;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,Be.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=n}return{header:s,fields:o,records:u,recordSet:$e({fields:o,records:u})}}const Ue="none-tiled tiff is not optimized for access, convert to COG and retry.";let He=class extends J.A{constructor(){super(...arguments),this._bufferSize=1048576,this._chunkSize=10485760,this._fileSize=-1,this._headerChunks=[],this.datasetFormat="TIFF",this.headerInfo=null}async fetchRawTile(e,t,i,r={}){if(!this.headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this.headerInfo.hasMaskBand){let n=await this._fetchRawTiffTile(e,t,i,!0,r);null!=n&&n.pixels[0]instanceof Uint8Array&&(a.mask=n.pixels[0])}return a}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf(".")),await this._readHeader(e?.signal),await this._fetchAllAuxData(),this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(this.rasterInfo),this.updateTileInfo()}async _readHeader(e){try{let t=await this._fetchHeaderData(0,this._bufferSize,e);if(!t)throw new o.A("tiffraster:open","failed to open url "+this.url);let{littleEndian:i,firstIFDPos:r,isBigTiff:a}=(0,Le.uT)(t),n=[],s={fileChunk:t,posIFD:r,fileOffset:0};await this._readIFDs(n,s,i,a?8:4,e);let{imageInfo:l,rasterInfo:u}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:n,planes:s,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:d,tileBoundary:p,affine:m,metadata:g,colormap:y}=t,w=ye(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),x=!!t.isPseudoGeographic;w??=(x=!0,new j.A({wkid:3857}));let v=new H.A({...t.extent,spatialReference:w}),b=v?new Ce.A({x:v.xmin,y:v.ymax,spatialReference:w}):new Ce.A({x:0,y:0}),I=new Re.A({blockWidth:a,blockHeight:n,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:d,blockBoundary:p}),A=new Ce.A({x:(v.xmax-v.xmin)/i,y:(v.ymax-v.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},C=new re.A({width:i,height:r,bandCount:s,pixelType:l,pixelSize:A,storageInfo:I,spatialReference:w,isPseudoSpatialReference:x,keyProperties:S,extent:v,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(C.nativeExtent=new H.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),C.transform=new ce.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),C.extent=C.transform.forwardTransform(C.nativeExtent),C.pixelSize=new Ce.A({x:(v.xmax-v.xmin)/i,y:(v.ymax-v.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),d){let{x:e,y:t}=C.pixelSize;d.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:C}}(n),f=(0,Le.zS)(n),h=(0,Le.r9)(n);this.headerInfo={littleEndian:i,isBigTiff:a,ifds:n,pyramidIFDs:f,maskIFDs:h,...l},this._set("rasterInfo",u),this._validateHeader()}finally{this._headerChunks.length=0}}_validateHeader(){let e=this.headerInfo;if(!e.isSupported)throw new o.A("tiffraster:open","this tiff is not supported: "+e.message);if(!e.tileWidth||!e.tileHeight)throw new o.A("tiffraster:open",Ue);this.rasterInfo.isPseudoSpatialReference&&u.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let t=e.ifds[0],i=t.get("PREDICTOR")?.values?.[0];if(3===t.get("SAMPLEFORMAT")?.values?.[0]&&2===i)throw new o.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data")}async _fetchHeaderData(e,t,i){let r=this._getCachedHeaderData(e,t);if(r)return r;let a=Math.floor(e/this._bufferSize)*this._bufferSize,n=a+Math.max(1,Math.ceil((t-a)/this._bufferSize))*this._bufferSize,s=this._getMissingHeaderRanges(a,n).map(async e=>{let{from:t,to:r}=e,a=await this._fetchOffsets(t,r,i),n=this._fileSize;return{chunk:a,fileOffset:t,isEOF:n>0?t+a.byteLength>=n:a.byteLength<r-t+1}}),l=await Promise.all(s);this._headerChunks.push(...l),this._headerChunks.sort((e,t)=>e.fileOffset-t.fileOffset);let u=this._getCachedHeaderData(e,t);if(!u)throw new o.A("tiffraster:open",`failed to fetch byte range ${e}-${t} from ${this.url}`);return u}_getCachedHeaderData(e,t){let i=[],r=e;for(let{chunk:a,fileOffset:n,isEOF:s}of this._headerChunks){if(n+a.byteLength-1<r)continue;if(n>r)return null;let l=r-n,o=Math.min(t-n+1,a.byteLength);if(i.push({chunk:a,start:l,end:o}),r=n+o,r>t||s&&o===a.byteLength){let t=new Uint8Array(r-e),a=0;for(let e of i){let i=new Uint8Array(e.chunk,e.start,e.end-e.start);t.set(i,a),a+=i.byteLength}return t.buffer}}return null}_getMissingHeaderRanges(e,t){let i=[],r=(e,t)=>{let r=Math.floor(e/this._bufferSize)*this._bufferSize,a=Math.ceil(t/this._bufferSize)*this._bufferSize;i.push({from:r,to:a})},a=e;for(let{chunk:e,fileOffset:n,isEOF:s}of this._headerChunks){let l=n+e.byteLength-1;if(!(l<a)&&(n>a&&r(a,Math.min(n-1,t)),a=Math.max(a,l+1),a>t||s))return i}return a<=t&&r(a,t),i}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;if(a+8>=i.byteLength||a<0){if(r=a+r,r<0)throw new o.A("tiffraster:open",`invalid IFD position ${r}. failed to open url ${this.url}`);i=await this._fetchHeaderData(r,r+this._bufferSize/2,t),a=0}return{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let n=await this._readIFD(t,i,Ee.NB,r,a);if(!n?.ifd)throw new o.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;t.posIFD=n.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Ee.NB,r=4,a){let{fileChunk:n,posIFD:s,fileOffset:l}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(n,t,s,l,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new o.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Ee.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new o.A("tiffraster:open",Ue);let r=[];e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),(0,Le.fM)(e),(0,Le.h_)(e);for(let[i,r]of Ee.RR){let o=e.get(i),u=null!=o?.data&&Array.from(o.data.values()).some(e=>null==e.values&&null!=e.offlineOffsetSize);if(o&&(!o.data||u)){s=o.valueOffset-l;let e=await this._validateOrFetchHeaderBuffer({fileChunk:n,posIFD:s,fileOffset:l},a);o.data=(await this._readIFD(e,t,r,4,a))?.ifd}}return u}return u.requiredBufferSize?(n=await this._fetchHeaderData(l,l+s+u.requiredBufferSize+8,a),n.byteLength<s+u.requiredBufferSize?null:(e.fileChunk=n,e.fileOffset=l,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let n=a.map(e=>e.offlineOffsetSize),s=Math.min.apply(null,n.map(e=>e[0])),l=Math.max.apply(null,n.map(e=>e[0]+e[1])),o=1===n.length||l-s<=this._bufferSize;if(!o&&n.length>1&&(n.sort((e,t)=>e[0]-t[0]),o=n.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,n[0][0])===l),o){let e=Math.max(l,s+this._bufferSize/4),i=await this._fetchHeaderData(s,e,r);return void a.forEach(e=>(0,Le.Cr)(i,t,e,s))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchHeaderData(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize;this._fileSize>0&&(t=Math.min(t,this._fileSize-1));let n=Math.ceil((t-e+1)/a),s=e;for(let e=0;e<n;e++)r.push(this.request(this.url,{range:{from:s,to:e===n-1?t:s+a-1},responseType:"array-buffer",signal:i})),s+=a;let l=await Promise.all(r);if(-1===this._fileSize&&206===l[0].httpStatus){let e=l[0].getHeader?.("Content-Range"),t=Number(e?.split("/",2)[1]);Number.isFinite(t)&&(this._fileSize=t)}if(1===l.length)return l[0].data;let o=l.reduce((e,t)=>e+t.data.byteLength,0),u=new Uint8Array(o),f=0;for(let e of l)u.set(new Uint8Array(e.data),f),f+=e.data.byteLength;return u.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let n=this._getTileLocation(e,t,i,r);if(!n)return null;let{ranges:s,actualTileWidth:l,actualTileHeight:o,ifd:u}=n,f=s.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),d=1===h.length?h[0].data:new ArrayBuffer(c),p=[0],m=[d.byteLength];if(h.length>1){let e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),p[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this.headerInfo,ifd:u,offsets:p,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:n}=this.rasterInfo.storageInfo,s=0===e?0:e-(a-1),{headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[s]:0===s?l.ifds[0]:l.pyramidIFDs[s-1];if(!o)return null;let u=(0,Le.XO)(o),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:d,maxRow:p,maxCol:m}=n[s];if(t>p||i>m||t<c||i<d)return null;let g=(0,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),x=(0,Le.LZ)(o,"TILELENGTH"),v=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(p+1)*(m+1)+t*(m+1)+i;v[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;v.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<v.length;e++)if(null==v[e].from||!v[e].to||v[e].to<0)return null;return{ranges:v,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===p&&y%x||x}}async _fetchAllAuxData(e){if(this.ioConfig.skipMapInfo)return;let{rasterInfo:t}=this,{skipExtensions:i=[]}=this.ioConfig,r=i.includes("aux.xml")?Promise.resolve(null):this._fetchAuxiliaryMetaData(e),a=i.includes("vat.dbf")||1!==t.bandCount||"u8"!==t.pixelType?Promise.resolve(null):this._fetchAuxiliaryTable(e),[n,s]=await Promise.all([r,a]);null!=n&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,$.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new Ce.A({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}(n,t),null!=s&&(t.attributeTable=s,t.keyProperties.DataType="thematic")}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return xe(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Je(t);return i?.recordSet?B.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,n.MZ)()],He.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"_fileSize",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"_headerChunks",void 0),(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,n.MZ)()],He.prototype,"headerInfo",void 0),He=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.TIFFRaster")],He);const je=He;var Ze=i(91806);const Ve=new Set(["x","lon","long","longitude","e","east","easting"]),qe=new Set(["y","lat","latitude","n","north","northing"]),We=new Map([["b1","u8"],["u1","u8"],["u2","u16"],["u4","u32"],["i1","s8"],["i2","s16"],["i4","s32"],["f2","f32"],["f4","f32"],["f8","f64"],["c8","c64"],["c16","c128"],["m","unknown"],["M","unknown"],["S","unknown"],["U","unknown"],["V","unknown"]]),Ge="zarr-raster:parse";function Xe(e,t){return e.slice(0,-t.length)}function Ye(e,t){!function(e){if(2!==e?.zarr_format)throw new o.A(Ge,"only zarr_format 2 is supported");let{shape:t,compressor:i,order:r,chunks:a,dimension_separator:n}=e;if(!Array.isArray(t)||!Array.isArray(a)||t.length!==a.length||t.some(e=>!Number.isSafeInteger(e)||e<0)||a.some(e=>!Number.isSafeInteger(e)||e<=0))throw new o.A(Ge,"invalid Zarr shape or chunks");if(null!=r&&"C"!==r&&"F"!==r)throw new o.A(Ge,"invalid Zarr array order");if(null!=n&&"."!==n&&"/"!==n)throw new o.A(Ge,"invalid Zarr dimension separator");if(null!==i&&("string"!=typeof i?.id||!i.id))throw new o.A(Ge,"Zarr compressor must be null or have a codec id")}(e);let{isBigEndian:i,pixelType:r,originalPixelType:a}=function(e){if("string"!=typeof e)throw new o.A(Ge,`Unsupported Zarr dtype: ${JSON.stringify(e)}`);let t=e.startsWith(">"),i=e.replace(/^[<>|=]/,""),r=We.get(i);if(!r||"unknown"===r||r.startsWith("c"))throw new o.A(Ge,`Unsupported Zarr dtype: ${JSON.stringify(e)}`);return{isBigEndian:t,pixelType:r,originalPixelType:i}}(e.dtype),{shape:n,compressor:s,order:l,chunks:u}=e,f=s?.id||"none",h="C"===l||null==l,c=function(e){if(null!==e){if("number"==typeof e)return e;switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new o.A(Ge,`Unsupported numeric Zarr fill value: ${e}`)}}}(e.fill_value);if(null!=c)if(Number.isFinite(c)){"f32"===r&&(c="f2"===a?new Float16Array([c])[0]:Math.fround(c));let[e,t]=(0,q.hP)("f2"===a?"f16":r);(c>t||c<e)&&(c=void 0)}else c=r.startsWith("f")?c:void 0;let d=e.dimension_separator??".";return{isBigEndian:i,pixelType:r,originalPixelType:a,compression:f,isRowMajor:h,shape:n,chunkSize:u,fillValue:c,scaleFactor:t?.scale_factor??1,addOffset:t?.add_offset??0,separator:d}}function Ke(e){return e.Description??e.description??e.long_name??e.standard_name??null}function Qe(e,t,i){let r=i?.[e];return!r?.length||t<=0?null:r.length<=t?r.toSorted((e,t)=>e-t):r.slice(0,t).toSorted((e,t)=>e-t)}function et(e){if(1===e.length)return[e[0]-.5,e[0]+.5];let t=e[0],i=e.at(-1),r=Math.abs(i-t)/(e.length-1)*.5;return[Math.min(t,i)-r,Math.max(t,i)+r]}function tt(e){let t;for(let i=0;i<e.length;i++){let r=e[i],a=it(r);if(a)return new j.A({wkid:a});t||=r?._CRS?.wkt?.trim()}return t?new j.A({wkt:t}):void 0}function it(e){let t=e?._CRS?.projjson?.id?.code,i="CRS84"===t?4326:"CRS83"===t?4269:"CRS27"===t?4267:Number(t);if(Number.isSafeInteger(i)&&i>0)return i;let r=e?._CRS?.url;return"string"==typeof r&&Number(r.slice(r.lastIndexOf("/")+1))||void 0}function rt(e){let t=e.attributes._ARRAY_DIMENSIONS,i=e.array.shape??[];return!t?.length||t.length!==i.length}function at(e,t){let i="x"===t?Ve:qe;return(e.find(e=>i.has(e.attributes.standard_name?.toLowerCase()??""))??e.find(e=>i.has(e.name.toLowerCase()??"")))?.name}function nt(e,t){return`${e}/${t=t.split("/").map(encodeURIComponent).join("/")}`}const st="zarr-raster:open",lt=new Set(["none","blosc"]);let ot=class extends J.A{constructor(){super(...arguments),this.datasetFormat="ZARR"}get _baseUrl(){let{url:e}=this;return e.endsWith("/.zmetadata")||e.endsWith("/.zgroup")?e.slice(0,e.lastIndexOf("/")):e}async fetchRawTile(e,t,i,r={}){let{multidimensionalDefinition:a}=r;if(!a?.length)return null;let n=a[0].variableName,s=this._metadata.dataVariables.find(e=>e.name===n);if(!s)return null;let{storageInfo:l}=s,u=Object.fromEntries(a.map(e=>[e.dimensionName,e.values[0]])),f=this._getDimensionIndices(s,t,i,u);if(!f)return null;let h=s.attributes._ARRAY_DIMENSIONS,{xDimension:c,yDimension:d}=this._metadata,p=function(e,t,i,r){let{chunkSize:a,shape:n,pixelType:s,separator:l,isRowMajor:o,fillValue:u,scaleFactor:f,addOffset:h}=e,c=Array(n.length),d=Array(n.length),p=Array(n.length),m=1;for(let e=0;e<n.length;e++){let i=t[e];if(i<0||i>=n[e])return null;let r=a[e],s=Math.floor(i/r);c[e]=s,d[e]=i-s*r,p[e]=Math.min(r,n[e]-s*r),m*=r}return{chunkPath:c.join(l),chunkSize:a,actualSize:p,offsets:d,xIndex:i,yIndex:r,pixelType:s,isRowMajor:o,elementCount:m,fillValue:u,scaleFactor:f,addOffset:h}}(l,f,h.indexOf(c),h.indexOf(d));if(!p)return null;let m=nt(this._baseUrl,`${n}/${p.chunkPath}`),{data:g}=await this.request(m,{responseType:"array-buffer",signal:r.signal}),{actualSize:y,elementCount:w}=p,x=await this._decodeChunk(g,l,r),v=y.reduce((e,t)=>e*t,1),b=x.length;if(b!==w&&b!==v)throw new o.A("zarr-raster:decode",`Invalid chunk length ${b} for "${m}"; expected ${w} or ${v} values`);return function(e,t){let i,{chunkSize:r,actualSize:a,xIndex:n,yIndex:s}=t,l=r[n],o=r[s],u=a[n],f=a[s],h=function(e,t){let{chunkSize:i,actualSize:r,xIndex:a,yIndex:n,pixelType:s,elementCount:l,isRowMajor:o}=t,u=i[a],f=i[n],h=e.length===l?i:r;return e.length===u*f&&h[a]===u&&h[n]===f?(o?n<a:a<n)?e:function(e,t,i,r){let a=new(V.A.getPixelArrayConstructor(r))(e.length);for(let r=0;r<i;r++)for(let n=0;n<t;n++)a[r*t+n]=e[n*i+r];return a}(e,u,f,s):function(e,t,i){let{chunkSize:r,actualSize:a,offsets:n,xIndex:s,yIndex:l,pixelType:o,isRowMajor:u}=t,f=r[s],h=r[l],c=a[s],d=a[l],p=Array(i.length),m=1;for(let e=0;e<i.length;e++){let t=u?i.length-1-e:e;p[t]=m,m*=i[t]}let g=new(V.A.getPixelArrayConstructor(o))(f*h);for(let t=0;t<d;t++)for(let r=0;r<c;r++){let a=0;for(let e=0;e<i.length;e++){let i=n[e];e===s?i=r:e===l&&(i=t),a+=i*p[e]}g[t*f+r]=e[a]}return g}(e,t,h)}(e,t);if(u<l||f<o){i=new Uint8Array(l*o);for(let e=0;e<f;e++)i.fill(1,e*l,e*l+u)}let{fillValue:c}=t;if(null!=c){let e=Number.isNaN(c);for(let t=0;t<f;t++)for(let r=0;r<u;r++){let a=t*l+r,n=h[a];(n===c||e&&Number.isNaN(n))&&(i??=new Uint8Array(l*o).fill(1),i[a]=0)}}let{pixelType:d,scaleFactor:p,addOffset:m}=t,g=d,y=h;if(1!==p||0!==m){g="f64"===d?"f64":"f32",y=new(V.A.getPixelArrayConstructor(g))(h.length);for(let e=0;e<h.length;e++)y[e]=0===i?.[e]?h[e]:h[e]*p+m}return new V.A({width:l,height:o,pixelType:g,pixels:[y],mask:i})}(x,p)}async _open(e){let t=this.url.slice(this.url.lastIndexOf("/")+1);if(t.endsWith(".zattrs")||t.endsWith(".zarray"))throw new o.A(st,`Unsupported Zarr URL: "${this.url}". Expect a v2 root url or consolidated metadata url`);let i=this._baseUrl;this.datasetName=i.slice(i.lastIndexOf("/")+1).replace(".zarr","");let r=e?.signal??void 0,{data:a}=await this.request(`${i}/.zmetadata`,{signal:r}),n=function(e){let t=e?.metadata;if("object"!=typeof t||!t||Array.isArray(t))throw new o.A(Ge,"missing consolidated metadata root");let i=new Map;for(let[e,r]of Object.entries(t))if(e.endsWith("/.zarray")){let a=r,n=Xe(e,"/.zarray"),s=t[`${n}/.zattrs`],l=Ye(a,s);if(s){let e=s._ARRAY_DIMENSIONS;if(!e?.length)throw new o.A(Ge,`missing required _ARRAY_DIMENSIONS attribute for array "${n}"`);if(null!=s.scale_factor&&!Number.isFinite(s.scale_factor)||null!=s.add_offset&&!Number.isFinite(s.add_offset))throw new o.A(Ge,`Invalid scale_factor or add_offset for array "${n}"`);let t=1===e.length&&e[0]===n,r=tt([s]),{shape:u,chunkSize:f}=l;if(e.length!==u.length||e.length!==f.length)throw new o.A(Ge,`variable dimensions do not match shape for array "${n}"`);i.set(n,{name:n,isDimension:t,storageInfo:l,spatialReference:r,array:a,attributes:s})}}if(0===i.size)throw new o.A(Ge,"no arrays found");let r=Array.from(i.values()),{xDimension:a,yDimension:n}=function(e){let t=e.filter(e=>e.isDimension),i=t.map(e=>e.name),r=at(t,"x"),a=at(t,"y");if(!r||!a){let t=(e.find(e=>!e.isDimension&&(e.attributes._ARRAY_DIMENSIONS?.length??0)>=2)?.attributes._ARRAY_DIMENSIONS)?.filter(e=>i.includes(e))??i;r??=t.findLast(e=>e!==a),a??=t.findLast(e=>e!==r)}if(!r||!a||r===a)throw new o.A(Ge,`Unable to determine x and y dimensions from variable dimensions "${i.join(", ")}"`);return{xDimension:r,yDimension:a}}(r),s=function(e,t,i){let r=e.filter(e=>{let r=!e.isDimension,a=e.attributes._ARRAY_DIMENSIONS,n=a?.includes(t)&&a.includes(i);return r&&n});if(0===r.length)throw new o.A(Ge,"no valid data variables found");if(r.some(rt))throw new o.A(Ge,"some variable dimensions do not match shape");let a=e.filter(e=>e.isDimension),n=r[0],s=n.attributes._ARRAY_DIMENSIONS,l=n.storageInfo.chunkSize[s.indexOf(t)],u=n.storageInfo.chunkSize[s.indexOf(i)];for(let e of r){let r=e.attributes._ARRAY_DIMENSIONS;if(r.some((t,i)=>{let r=a.find(e=>e.name===t);return r&&r.storageInfo.shape[0]!==e.storageInfo.shape[i]}))throw new o.A(Ge,`Coordinate dimensions do not match shape for "${e.name}"`);let{chunkSize:s}=e.storageInfo;if(s[r.indexOf(t)]!==l||s[r.indexOf(i)]!==u)throw new o.A(Ge,`X/Y chunk sizes must match across variables: compare ${e.name} ${n.name}`)}return r}(r,a,n),l=r.filter(e=>e.isDimension);return{dataDimensions:l,dataVariables:s,spatialReference:s.find(e=>e.spatialReference)?.spatialReference??l.find(e=>e.spatialReference)?.spatialReference,xDimension:a,yDimension:n,version:2}}(a);this._metadata=n;let s=[...n.dataDimensions,...n.dataVariables].find(({storageInfo:{compression:e}})=>!lt.has(e));if(s)throw new o.A(st,`Unsupported Zarr compression "${s.storageInfo.compression}" for array "${s.name}"`);let l={};await Promise.all(n.dataDimensions.map(e=>this._readDimensionValues(e,l,r)));let u=function(e,t){let{dataDimensions:i,dataVariables:r,spatialReference:a}=e,n=r[0],s=n.attributes._ARRAY_DIMENSIONS??[],{xDimension:l,yDimension:u}=e,f=i.find(e=>e.name===l)?.storageInfo.shape[0],h=i.find(e=>e.name===u)?.storageInfo.shape[0];if(!f||!h)throw new o.A(Ge,`Unable to determine width and height from dimensions "${l}" and "${u}"`);let c=t[l],d=t[u];if(c.some((e,t)=>t>0&&e<c[t-1])||d.some((e,t)=>t>0&&e>d[t-1]))throw new o.A(Ge,"Unsupported spatial coordinates order, must be ascending X and descending Y");let[p,m]=et(c),[g,y]=et(d),w=new H.A({xmin:p,ymin:g,xmax:m,ymax:y,spatialReference:a}),x=Math.abs((m-p)/f),v=Math.abs((y-g)/h),b={x,y:v},I=new Map;for(let e of i){let i=e.name;if(i===l||i===u)continue;let r=e.storageInfo.shape[0],a=Qe(i,r,t),{attributes:n}=e;I.set(i,{name:i,description:Ke(n),unit:n.units,values:a,extent:a?[a[0],a.at(-1)]:r>0?[0,r-1]:void 0})}let A=[];for(let e of r){let t=e.attributes._ARRAY_DIMENSIONS.map(e=>I.get(e)).filter(e=>!!e),{attributes:i}=e;A.push({name:e.name,description:Ke(i),unit:i.units??null,dimensions:t})}let S=A.length?{variables:A}:null,{pixelType:C}=n.storageInfo;for(let{storageInfo:e}of r){if("f64"===e.pixelType){C="f64";break}("f32"===e.pixelType||1!==e.scaleFactor||0!==e.addOffset)&&(C="f32")}let _={DataType:S?"Scientific":"Generic"},{chunkSize:R}=n.storageInfo,T=R[s.indexOf(l)],M=R[s.indexOf(u)],O=[{minCol:0,maxCol:Math.ceil(f/T)-1,minRow:0,maxRow:Math.ceil(h/M)-1}],k=new Ce.A({x:p,y,spatialReference:a}),F=(x+v)/2,D=new Te.A({origin:k,size:[T,M],spatialReference:a,lods:[new Ze.A({level:0,resolution:F,scale:1/.0254*96*F})]}),N=new Re.A({blockWidth:T,blockHeight:M,pyramidBlockWidth:T,pyramidBlockHeight:M,compression:n.storageInfo.compression,origin:k,firstPyramidLevel:0,maximumPyramidLevel:0,blockBoundary:O,tileInfo:D,isVirtualTileInfo:!1}),P=n.storageInfo.fillValue,z=new re.A({width:f,height:h,pixelSize:b,pixelType:C,bandCount:1,noDataValue:P,extent:w,spatialReference:a,keyProperties:_,multidimensionalInfo:S,isPseudoSpatialReference:!1,format:"zarr",storageInfo:N});return(0,L.vj)(z),z}(n,l);this._dimensionValues=l,this._set("rasterInfo",u)}_getDimensionIndices(e,t,i,r){let a=e.attributes._ARRAY_DIMENSIONS,{xDimension:n,yDimension:s}=this._metadata,{chunkSize:l}=e.storageInfo;if(!this.rasterInfo.multidimensionalInfo?.variables.find(t=>t.name===e.name)?.dimensions?.length)return null;let o=[];for(let e=0;e<a.length;e++){let u=a[e];if(u===n)o[e]=i*l[e];else if(u===s)o[e]=t*l[e];else{let t=this._dimensionValues[u],i=r[u],a=t?.indexOf(i)??-1;if(a<0)return null;o[e]=a}}return o}async _readDimensionValues(e,t,i){let{name:r,storageInfo:a}=e,n=a.chunkSize[0],s=a.shape[0];if(n<=0||s<=0)throw new o.A(st,`Invalid dimension array "${r}" with chunkSize ${n} and totalElements ${s}`);let l=Math.ceil(s/n),u=this._baseUrl,f=[];for(let e=0;e<l;e++){let t=nt(u,`${r}/${e}`),h=e===l-1?s-e*n:n;f.push(this.request(t,{responseType:"array-buffer",signal:i}).then(async e=>{let t=await this._decodeChunk(e.data,a,{signal:i});if(t.length!==n&&t.length!==h)throw new o.A(st,`Invalid dimension chunk length for "${r}"`);return t.slice(0,h)}).catch(e=>{throw(0,c.zf)(e)?e:new o.A(st,`Unable to fetch dimension data for "${r}"`)}))}let h=(await Promise.all(f)).flatMap(e=>Array.from(e)),{scaleFactor:d,addOffset:p}=a;if(1!==d||0!==p)for(let e=0;e<h.length;e++)h[e]=h[e]*d+p;t[r]="days since 1899-12-30 00:00:00 UTC"===e.attributes.units?h.map(ne.$E):h}async _decodeChunk(e,t,i){let{compression:r}=t;if(!lt.has(r))throw new o.A("zarr-raster:decode",`Unsupported Zarr compression "${r}"`);if("blosc"===r){let r="f2"===t.originalPixelType?2:(0,q.Qd)(t.pixelType),a=t.chunkSize.reduce((e,t)=>e*t,r),n=await this.decodePixelBlock(e,{format:"blosc",pixelType:"u8",skipStatistics:!0,maxUncompressedSize:a},i);if(!n)throw new o.A("zarr-raster:decode","Unable to decode Blosc chunk");e=n.pixels[0].buffer}return function(e,t){let{pixelType:i,originalPixelType:r}=t,a=!t.isBigEndian,n=V.A.getPixelArrayConstructor(i);if(a&&"f2"!==r)return new n(e);let s="f2"===r?2:(0,q.Qd)(i),l=e.byteLength/s,u=new DataView(e),f=new n(l);for(let e=0,t=0;e<l;t+=s,e++)switch(i){case"s8":f[e]=u.getInt8(t);break;case"u8":f[e]=u.getUint8(t);break;case"s16":f[e]=u.getInt16(t,a);break;case"u16":f[e]=u.getUint16(t,a);break;case"s32":f[e]=u.getInt32(t,a);break;case"u32":f[e]=u.getUint32(t,a);break;case"f32":f[e]="f2"===r?u.getFloat16(t,a):u.getFloat32(t,a);break;case"f64":f[e]=u.getFloat64(t,a);break;default:throw new o.A("zarr-raster:decode",`Unsupported coordinate pixel type: ${i}`)}return f}(e,t)}};(0,a.Cg)([(0,n.MZ)()],ot.prototype,"_baseUrl",null),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],ot.prototype,"_dimensionValues",void 0),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],ot.prototype,"_metadata",void 0),(0,a.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],ot.prototype,"datasetFormat",void 0),ot=(0,a.Cg)([(0,n.$K)("esri.layers.raster.datasets.ZarrRaster")],ot);const ut=ot,ft=new Map;ft.set("RasterTileServer",{desc:"Raster Tile Server",constructor:ke}),ft.set("TIFF",{desc:"Cloud Optimized GeoTIFF",constructor:je}),ft.set("MRF",{desc:"Meta Raster Format",constructor:ze}),ft.set("ZARR",{desc:"Zarr Raster Format",constructor:ut}),ft.set("JPG",{desc:"JPG Raster Format",constructor:Ae}),ft.set("PNG",{desc:"PNG Raster Format",constructor:Ae}),ft.set("GIF",{desc:"GIF Raster Format",constructor:Ae}),ft.set("BMP",{desc:"BMP Raster Format",constructor:Ae}),ft.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ue}),ft.set("MEMORY",{desc:"In Memory Raster Format",constructor:le});class ht{static get supportedFormats(){let e=new Set;return ft.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,n=e.datasetFormat??i?.datasetFormat;n??(/(?:\.zarr|\/\.(?:zmetadata|zarray|zgroup))$/.test(t)?n="ZARR":t.includes(".")?n=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?n="CovJSON":r?.extent&&r.pixelblocks&&(n="MEMORY")),"OVR"===n||"TIF"===n||"DM"===n?n="TIFF":"JPG"===n||"JPEG"===n||"JFIF"===n?n="JPG":"COVJSON"===n&&(n="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");let s={url:t,source:r,sourceJSON:a,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(s).forEach(e=>{s[e]??delete s[e]}),n){if(!this.supportedFormats.has(n))throw new o.A("rasterfactory:open","not a supported format "+n);if("CRF"===n)throw new o.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(ft.get(n).constructor)(s);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let l=Array.from(ft.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(n=l[u++],!n||"CRF"===n)return null;let t=new(ft.get(n).constructor)(s);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){ft.has(e.toUpperCase())||ft.set(e.toUpperCase(),{desc:t,constructor:i})}}var ct=i(99235),dt=i(10873),pt=i(20437),mt=i(74797),gt=i(22796),yt=i(69409);const wt={instance:null,refCount:0,connectionPromise:null};async function xt(){if(wt.refCount++,wt.instance)return wt.instance;if(!wt.connectionPromise){let e=new yt.A;wt.connectionPromise=e.initialize().then(()=>{wt.instance=e})}return await wt.connectionPromise,wt.instance}function vt(){wt.refCount--,wt.refCount>0||(wt.instance?.destroy(),wt.instance=null,wt.connectionPromise=null,wt.refCount=0)}let bt=class extends((0,R.dM)((0,N.j)((0,M.q)((0,O.A)((0,F.H)((0,T.d)((0,z.b)((0,k.G)((0,P.e)((0,_.b)((0,D.J)((0,h.M)((0,l.OU)(C.A)))))))))))))){constructor(e){super(e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,c.sg)(async(e,t,r)=>{let{save:a,saveAs:n}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return n(this,r,t)}})}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,f.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,mt.rZ)("Pixel Value"),(0,mt.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,mt.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,mt.DV)(t),r=(0,mt.y6)();e.push(i,r)}if(a){let t=(0,mt.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==mt.F_.rawServicePixelValue)),r=(0,I.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,mt.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,s.PZ)(gt.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof o.A?e:new o.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,S.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,L.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new o.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new o.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,d.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,L.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,ct.UD)(t.toJSON(),a),a.some(e=>At(e,this.ioConfig))&&(r=await xt(),this._releaseWorkerHandle={remove:()=>vt()});let n=await Promise.all(a.map(e=>ht.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),s=n.findIndex(e=>null==e);if(s>-1)throw new o.A("imagery-tile-layer:open",`cannot open raster: ${a[s]}`);return this._primaryRasters=n,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;At(e,this.ioConfig)&&(i=await xt(),this._releaseWorkerHandle={remove:()=>vt()});let r=await ht.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new o.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new o.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await ht.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new o.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,ct.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new E.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof o.A&&u.A.getLogger(this).error("imagery-tile-layer:open",e.message),u.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,b.XF)(u.A.getLogger(this),(0,b.$7)("ImageryTile layers","relative-to-scene",e)),(0,b.XF)(u.A.getLogger(this),(0,b.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,n.MZ)({clonable:!1})],bt.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,n.MZ)({clonable:!1})],bt.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,n.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],bt.prototype,"charts",void 0),(0,a.Cg)([(0,n.MZ)({type:A.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],bt.prototype,"elevationInfo",null),(0,a.Cg)([(0,n.MZ)({type:Te.A})],bt.prototype,"tileInfo",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,clonable:!1})],bt.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,n.MZ)(dt.fV)],bt.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],bt.prototype,"isReference",void 0),(0,a.Cg)([(0,n.MZ)({type:["show","hide"]})],bt.prototype,"listMode",void 0),(0,a.Cg)([(0,n.MZ)({json:{read:!0,write:!0}})],bt.prototype,"blendMode",void 0),(0,a.Cg)([(0,n.MZ)({type:gt.A,json:{name:"renderingRule",write:!0}})],bt.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,n.MZ)()],bt.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],bt.prototype,"version",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,json:{read:!1}})],bt.prototype,"type",void 0),(0,a.Cg)([(0,n.MZ)({type:["ArcGISTiledImageServiceLayer"]})],bt.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],bt.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,n.MZ)({type:v.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],bt.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0})],bt.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,n.MZ)(dt.PY)],bt.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,type:[pt.A]})],bt.prototype,"fields",void 0),(0,a.Cg)([(0,n.MZ)({readOnly:!0,type:[pt.A]})],bt.prototype,"rasterFields",null),(0,a.Cg)([(0,n.MZ)({constructOnly:!0})],bt.prototype,"source",void 0),bt=(0,a.Cg)([(0,n.$K)("esri.layers.ImageryTileLayer")],bt);const It=bt;function At(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(91429),n=i(53966),s=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,s.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,s.Jf)(e,n.A.getLogger(this)))}};return(0,r.Cg)([(0,a.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,a.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),n=i(56507),s=i(69540),l=i(25482),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(l.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[n.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},43163(e,t,i){i.d(t,{A:()=>p});var r,a=i(32198),n=i(91429),s=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,n=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+n*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+n*e[9]+i*e[11]}}let n=r*r,s=a*a,l=r*a,o=n*r,u=n*a,f=r*s,h=a*s;return{x:e[0]+r*e[2]+a*e[4]+n*e[6]+l*e[8]+s*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+n*e[7]+l*e[9]+s*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function d(e,t,i){let{xmin:r,ymin:a,xmax:n,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:n,y:l}),u.push({x:r,y:a}),u.push({x:n,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:n,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(n-r)*t/e,y:a}),u.push({x:r+(n-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new s.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let p=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,n,s]=e,l=r*s-n*a,o=n*a-r*s;return[(n*i-t*s)/l,(r*i-t*a)/o,s/l,a/o,-n/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],p.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],p.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],p.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,n.MZ)({json:{write:!0}})],p.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],p.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],p.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,n.MZ)()],p.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],p.prototype,"type",void 0),p=r=(0,a.Cg)([(0,n.$K)("esri.layers.raster.transforms.PolynomialTransform")],p)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),n=i(56372),s=i(91429),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),d=i(76030),p=i(84952),m=i(78888),g=i(72802),y=i(4718),w=i(69397);class x{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,n=!0,s=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(s=!1,o[u]|=1<<t):n=!1,31===t&&++u}s?(this._availability="unavailable",this.byteSize=40):n?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,n=this._availability;return a<0||a>n.length?"unknown":n[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||m.A,{row:r,col:a,width:n,height:s}=e,o={query:{f:"json"}};return t=t?{...o,...t}:o,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:s},valid:!0,data:Array(n*s).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==s))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:s}});return x.fromJSON(e)})}static fromJSON(e){return Object.freeze(new x(e))}}function v(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=m.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof x){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let n=this.layer.tileInfo;n.updateTileInfo(r);let s=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(n.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,s),s}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,n){if(!this._prefetchingEnabled)return;let s=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(s))return;let l=new AbortController;n.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,s),await(0,d.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(s)),(0,h.G4)(l))return;let c=new g.U(e,t,i),p={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,p);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,n=this._tilemapFromCache(e,t,i,a);if(n)return Promise.resolve(n);let s=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(s,()=>t((0,h.NK)()));let i=v(a),n=this._pendingTilemapRequests[i];if(!n){n=x.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=n,n.then(e,e)}n.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,p.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=v(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,s.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,s.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>p,Tw:()=>c,X6:()=>d});var r=i(5443),a=i(86738),n=i(16930),s=i(87186),l=i(20223),o=i(78888),u=i(22671),f=i(2272);async function h(e,t,i){let h=(0,f.Dl)(e),{rasterFunction:c,sourceJSON:d}=t||{},p=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,f.lF)({...h.query,renderingRule:p,f:"json"}),g=(0,f.jV)(m,i);e=h.path;let y=d||await(0,o.A)(e,g).then(e=>e.data),{currentVersion:w}=y,x=y.hasRasterAttributeTable?(0,o.A)(`${e}/rasterAttributeTable`,g):null,v=y.hasColormap?(0,o.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,o.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,o.A)(`${e}/keyProperties`,g):null,A=y.hasMultidimensions?(0,o.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,o.A)(`${e}/statistics`,g):null,C=await Promise.allSettled([x,v,b,I,A,S]),_=r.A.fromJSON(y.extent),R=Math.ceil(_.width/y.pixelSizeX-.1),T=Math.ceil(_.height/y.pixelSizeY-.1),M=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),O="fulfilled"===C[0].status?C[0].value?.data:null,k=O?.features?.length?u.A.fromJSON(O):null,F="fulfilled"===C[1].status?C[1].value?.data.colormap:null,D=F?.length?F:null,N="fulfilled"===C[2].status?C[2].value?.data.histograms:null,P=N?.[0]?.counts?.length?N:null,z="fulfilled"===C[3].status?C[3].value?.data??{}:{},L="fulfilled"===C[4].status?C[4].value?.data.multidimensionalInfo:null,E=L?.variables?.length?L:null;var B;(B=E)&&B.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let $=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===C[5].status?C[5].value?.data.statistics:null),{defaultVariable:J,serviceDataType:U}=y;J&&J!==z.DefaultVariable&&(z.DefaultVariable=J),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(z.DataType)&&(z.DataType=U.replace("esriImageServiceDataType",""));let H=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==H)&&(H=y.noDataValues);let j=y.transposeInfo?new l.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:M}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,T))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new s.A({width:R,height:T,bandCount:y.bandCount,extent:r.A.fromJSON(y.extent),spatialReference:M,pixelSize:new a.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:M}),pixelType:y.pixelType.toLowerCase(),statistics:$,attributeTable:k,colormap:D,histograms:P,keyProperties:z,noDataValue:H,multidimensionalInfo:E,storageInfo:j})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function d(e,t,i){return h(e,{rasterFunction:t},i)}function p(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(4718),n=i(84952),s=i(70333),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,a.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let n=e[a];if(null!=n&&"function"!=typeof n)if(Array.isArray(n))r[a]=n.map(e=>f(e));else if("object"==typeof n)if(n.toJSON){let e=n.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?n:JSON.stringify(n);else r[a]=n}return r}async function h(e,t,a){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??s.id?.findCredential(e)?.token:null}(e,t)||(!s.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(7956),i.e(4189)]).then(()=>i(98232)),(await s.id.getCredential(e,a))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>s});var r=i(56512),a=i(86211),n=i(16271);function s(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:d}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,n.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",n=(0,a.mq)(i);return n?(0,a.oU)(e,r,n):0});const c={mode:"absolute-height",offset:0},d={mode:"on-the-ground",offset:null}}}]);