@arcgis/core 6.0.0-next.40 → 6.0.0-next.42

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 (529) hide show
  1. package/Camera.js +1 -1
  2. package/applications/Components/arcadeFeatureUtils.d.ts +12 -0
  3. package/applications/Components/arcadeFeatureUtils.js +1 -1
  4. package/arcgisGlobal.d.ts +0 -2
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/00d43f02119167531d1b.js +1 -0
  7. package/assets/esri/core/workers/chunks/{1c406ab2bf99ac563316.js → 0696fa44a04b99738d7b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/075fe33152fd79fe6d72.js +1 -0
  9. package/assets/esri/core/workers/chunks/098ac10877d92fde1006.js +1 -0
  10. package/assets/esri/core/workers/chunks/0a29d87b6e58a3c6df8f.js +1 -0
  11. package/assets/esri/core/workers/chunks/0d04353843ccb7440342.js +1 -0
  12. package/assets/esri/core/workers/chunks/0d87cb6417672de95d53.js +1 -0
  13. package/assets/esri/core/workers/chunks/11877d4dc97f756e4711.js +1 -0
  14. package/assets/esri/core/workers/chunks/1860104c2b33f68785dd.js +1 -0
  15. package/assets/esri/core/workers/chunks/1980fd7ae1617ef4d19d.js +1 -0
  16. package/assets/esri/core/workers/chunks/1c7096eb48a3a7f27d4f.js +1 -0
  17. package/assets/esri/core/workers/chunks/1cc03067f8405285057c.js +1 -0
  18. package/assets/esri/core/workers/chunks/{14d81280807a3d3c1b7e.js → 244ffdb91237d1cbade3.js} +1 -1
  19. package/assets/esri/core/workers/chunks/24bdeafbb16ae83bb8c3.js +1 -0
  20. package/assets/esri/core/workers/chunks/2690d5fcd9d5ca92ebf6.js +1 -0
  21. package/assets/esri/core/workers/chunks/2b27d3bc492e000bbe58.js +1 -0
  22. package/assets/esri/core/workers/chunks/2d64a13c2303e9cae613.js +1 -0
  23. package/assets/esri/core/workers/chunks/2e760d04641755d1820d.js +1 -0
  24. package/assets/esri/core/workers/chunks/{0b21d0e2e5a91c34a108.js → 2f54e4feb554c1a7b9c4.js} +1 -1
  25. package/assets/esri/core/workers/chunks/348f28d7ab46df878c6f.js +1 -0
  26. package/assets/esri/core/workers/chunks/{7023651ed6398dcf8efb.js → 36bafcc29ac133a05558.js} +7 -7
  27. package/assets/esri/core/workers/chunks/36e5f070009b29b7ac3d.js +1 -0
  28. package/assets/esri/core/workers/chunks/39c23a52d7c3e1ee121c.js +1 -0
  29. package/assets/esri/core/workers/chunks/{5504ec9bd9ee4d10af07.js → 3f74c61359b4bd6dcf00.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{00311d1b18d5952a014b.js → 446d172834f8675f1202.js} +1 -1
  31. package/assets/esri/core/workers/chunks/45aaefbdffe5e15dfb24.js +1 -0
  32. package/assets/esri/core/workers/chunks/48c6230b8a6d3a8a7906.js +1 -0
  33. package/assets/esri/core/workers/chunks/4c73c493dabe949c2512.js +1 -0
  34. package/assets/esri/core/workers/chunks/{592b5db1459c02cf6a0c.js → 4d62877f521cc9663535.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{2fcd7db1e192858a650e.js → 503ee206e7de1f65e291.js} +1 -1
  36. package/assets/esri/core/workers/chunks/55c0c074e4afe05f5d4d.js +1 -0
  37. package/assets/esri/core/workers/chunks/5bfb962ca192f90a2724.js +1 -0
  38. package/assets/esri/core/workers/chunks/{76e80381fa6d1e084796.js → 5dea74fe52583e77f3ce.js} +1 -1
  39. package/assets/esri/core/workers/chunks/6699fac01ccd842851ba.js +1 -0
  40. package/assets/esri/core/workers/chunks/672a5390182b20d632be.js +1 -0
  41. package/assets/esri/core/workers/chunks/67c2e5953087dadfd245.js +1 -0
  42. package/assets/esri/core/workers/chunks/67caef2ecf0dc5f2eed3.js +1 -0
  43. package/assets/esri/core/workers/chunks/68fd7b314377d27aaa54.js +1 -0
  44. package/assets/esri/core/workers/chunks/6d863761f29f31a030eb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{ce8ef2eec290e1df6b2a.js → 7390af96250e89194332.js} +1 -1
  46. package/assets/esri/core/workers/chunks/7452b5ae971a9ff2e6e9.js +1 -0
  47. package/assets/esri/core/workers/chunks/7672c123cfb960f4ddad.js +1 -0
  48. package/assets/esri/core/workers/chunks/{9934e8e19f94e9169eea.js → 776b64a1e1a57878c34c.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{1ec772eaa63eb6937231.js → 8140ed6e44c3d8536d3e.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{58716a3a6106a1b0fb9d.js → 832c887fdc5af4c08cf2.js} +1 -1
  51. package/assets/esri/core/workers/chunks/84fb27e3425515cd0e3f.js +1 -0
  52. package/assets/esri/core/workers/chunks/867502158997cb2d6406.js +1 -0
  53. package/assets/esri/core/workers/chunks/8ceb6697e8adbeffe019.js +1 -0
  54. package/assets/esri/core/workers/chunks/8fe22c2370219f25c15b.js +1 -0
  55. package/assets/esri/core/workers/chunks/91586bf29492735e692d.js +1 -0
  56. package/assets/esri/core/workers/chunks/{b2d6b1ac9fbb50c7c8ab.js → 929ca32ddbb43328ef31.js} +1 -1
  57. package/assets/esri/core/workers/chunks/a03f15f2cbc3fed291c2.js +1 -0
  58. package/assets/esri/core/workers/chunks/{123541f79be7adff0818.js → a422a801e55fa125546e.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{22e73501e1435a896826.js → a5f17e9a025ac2b6e1bf.js} +1 -1
  60. package/assets/esri/core/workers/chunks/a6e846361bf5dd3a11c7.js +1 -0
  61. package/assets/esri/core/workers/chunks/{fd967a9f3cf0e2890dbb.js → a91dc05a6a609d04ed04.js} +1 -1
  62. package/assets/esri/core/workers/chunks/a99c50b4e1c7568210e1.js +1 -0
  63. package/assets/esri/core/workers/chunks/ab48faea5432e2dbd45c.js +1 -0
  64. package/assets/esri/core/workers/chunks/afe3e89737fb45189a99.js +1 -0
  65. package/assets/esri/core/workers/chunks/b18459c1bed75dbdec08.js +1 -0
  66. package/assets/esri/core/workers/chunks/{d03b82e962c70a3fd377.js → b4928831a2a13b2da745.js} +1 -1
  67. package/assets/esri/core/workers/chunks/b7205620ca248f4efc88.js +1 -0
  68. package/assets/esri/core/workers/chunks/bbddeb1c893ff8bbae5d.js +1 -0
  69. package/assets/esri/core/workers/chunks/bc2e2bdf1194e6e9eb5e.js +1 -0
  70. package/assets/esri/core/workers/chunks/{dae2036faa28dade2119.js → beccbfff549902733c4e.js} +1 -1
  71. package/assets/esri/core/workers/chunks/c3ba1a3247e14f6b7b3a.js +1 -0
  72. package/assets/esri/core/workers/chunks/c5d0a034ff31d5954571.js +1 -0
  73. package/assets/esri/core/workers/chunks/{396299c22994c502e41c.js → c8057b47c7c6c02a0bda.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{9e2c30b67bab5795306e.js → cb2329d1ea72ce5cc057.js} +1 -1
  75. package/assets/esri/core/workers/chunks/cd46d9b4a8de644e7332.js +1 -0
  76. package/assets/esri/core/workers/chunks/d0172d31389dbfaaa848.js +1 -0
  77. package/assets/esri/core/workers/chunks/{f07fb9b3fa30d7ee1681.js → d4c8673ca65df874a7ce.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{947f3a1cad976bba9738.js → d5e251cddd41d643510c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/da1e6962ba0c85c37953.js +1 -0
  80. package/assets/esri/core/workers/chunks/dff845574c0037a1dca6.js +1 -0
  81. package/assets/esri/core/workers/chunks/e0864ca82ffa3c9a0776.js +1 -0
  82. package/assets/esri/core/workers/chunks/e0cf6e1e21d0ee739009.js +1 -0
  83. package/assets/esri/core/workers/chunks/e69cd62f824ce7a22fa0.js +1 -0
  84. package/assets/esri/core/workers/chunks/{c9feffb9884cfed52c4b.js → f190a3124d6d03417d73.js} +1 -1
  85. package/assets/esri/core/workers/chunks/f4135779bfdaf349352a.js +1 -0
  86. package/assets/esri/core/workers/chunks/fbe3a3b9d6c8c0b52f65.js +1 -0
  87. package/assets/esri/core/workers/chunks/fd17c4a9e13bf77aa86a.js +1 -0
  88. package/assets/esri/core/workers/chunks/fdd2b35388f9fe42b623.js +1 -0
  89. package/assets/esri/core/workers/chunks/fe7184993ef5713d13fb.js +1 -0
  90. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  91. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  92. package/assets/esri/themes/base/_core.scss +0 -2
  93. package/assets/esri/themes/dark/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/chunks/cameraUtilsPlanar.js +1 -1
  97. package/chunks/cameraUtilsSpherical.js +1 -1
  98. package/chunks/lyr3DMain.js +1 -1
  99. package/chunks/lyr3DWorker.js +1 -1
  100. package/config.js +1 -1
  101. package/core/Accessor.d.ts +1 -1
  102. package/core/Accessor.js +1 -1
  103. package/core/Logger.js +1 -1
  104. package/core/accessorSupport/DefaultsStore.js +1 -1
  105. package/core/accessorSupport/Properties.js +1 -1
  106. package/core/accessorSupport/Property.js +1 -1
  107. package/core/accessorSupport/watch.js +1 -1
  108. package/core/deprecate.js +1 -1
  109. package/core/has.js +1 -1
  110. package/core/libs/gl-matrix-2/math/mat4.js +1 -1
  111. package/core/types.d.ts +0 -5
  112. package/core/workers/workers.js +1 -6
  113. package/core/workers.d.ts +1 -2
  114. package/geometry/Extent.js +1 -1
  115. package/geometry/Geometry.js +1 -1
  116. package/geometry/Multipoint.js +1 -1
  117. package/geometry/Point.js +1 -1
  118. package/geometry/Polygon.js +1 -1
  119. package/geometry/Polyline.js +1 -1
  120. package/geometry/coordinateFormatter.js +1 -1
  121. package/geometry/operators/gx/operatorRelate.js +2 -0
  122. package/geometry/operators/relateOperator.js +1 -1
  123. package/identity/IdentityModal.js +1 -1
  124. package/interfaces.d.ts +0 -17
  125. package/kernel.js +1 -1
  126. package/layers/BaseElevationLayer.js +1 -1
  127. package/layers/BaseTileLayer.js +1 -1
  128. package/layers/BuildingSceneLayer.js +1 -1
  129. package/layers/CatalogLayer.js +1 -1
  130. package/layers/ElevationLayer.d.ts +1 -1
  131. package/layers/ElevationLayer.js +1 -1
  132. package/layers/FeatureLayer.js +1 -1
  133. package/layers/GeoRSSLayer.js +1 -1
  134. package/layers/ImageryLayer.js +1 -1
  135. package/layers/ImageryTileLayer.js +1 -1
  136. package/layers/IntegratedMesh3DTilesLayer.d.ts +4 -3
  137. package/layers/IntegratedMeshLayer.d.ts +4 -3
  138. package/layers/IntegratedMeshLayer.js +1 -1
  139. package/layers/KMLLayer.js +1 -1
  140. package/layers/Layer.js +1 -1
  141. package/layers/LinkChartLayer.js +1 -1
  142. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  143. package/layers/MapImageLayer.js +1 -1
  144. package/layers/OpenStreetMapLayer.js +1 -1
  145. package/layers/PointCloudLayer.js +1 -1
  146. package/layers/SceneLayer.js +1 -1
  147. package/layers/StreamLayer.js +1 -1
  148. package/layers/SubtypeGroupLayer.js +1 -1
  149. package/layers/TileLayer.js +1 -1
  150. package/layers/VectorTileLayer.js +1 -1
  151. package/layers/WCSLayer.js +1 -1
  152. package/layers/WMSLayer.js +1 -1
  153. package/layers/WMTSLayer.js +1 -1
  154. package/layers/WebTileLayer.js +1 -1
  155. package/layers/graphics/sources/CSVSource.js +1 -1
  156. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  157. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  158. package/layers/graphics/sources/MemorySource.js +1 -1
  159. package/layers/graphics/sources/WFSSource.js +1 -1
  160. package/layers/graphics/sources/support/QueryTask.js +1 -1
  161. package/layers/mixins/ArcGISImageService.js +1 -1
  162. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  163. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  164. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  165. package/layers/raster/datasets/BaseRaster.js +1 -1
  166. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  167. package/layers/raster/datasets/MRFRaster.js +1 -1
  168. package/layers/raster/datasets/RasterFactory.js +1 -1
  169. package/layers/raster/datasets/ZarrRaster.js +2 -0
  170. package/layers/raster/datasets/datasetUtils.js +1 -1
  171. package/layers/raster/datasets/zarrParser.js +2 -0
  172. package/layers/raster/datasets/zarrUtils.js +2 -0
  173. package/layers/raster/formats/pixelRangeUtils.js +1 -1
  174. package/layers/raster/formats/tiffParser.js +1 -1
  175. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  176. package/layers/support/GeometryDescriptor.js +1 -1
  177. package/layers/support/KMLSublayer.js +1 -1
  178. package/layers/support/SceneModifications.d.ts +1 -3
  179. package/layers/support/SceneModifications.js +1 -1
  180. package/layers/support/TileInfo.js +1 -1
  181. package/layers/support/featureLayerUtils.js +1 -1
  182. package/layers/support/tiles3DUtils.js +1 -1
  183. package/layers/support/wmtsUtils.js +1 -1
  184. package/layers/video/videoUtils.js +1 -1
  185. package/legend/ActiveLayerInfo.js +1 -1
  186. package/package.json +4 -4
  187. package/portal/Portal.js +1 -1
  188. package/portal/PortalItem.js +1 -1
  189. package/rest/query/executePivotQuery.js +1 -1
  190. package/rest/query/operations/queryPivot.js +1 -1
  191. package/rest/query/operations/queryUtils.js +1 -1
  192. package/rest/support/PivotQuery.js +1 -1
  193. package/rest/support/Query.js +1 -1
  194. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  195. package/support/LayersMixin.d.ts +2 -2
  196. package/symbols/PictureFillSymbol.js +1 -1
  197. package/symbols/PictureMarkerSymbol.js +1 -1
  198. package/symbols/SimpleFillSymbol.js +1 -1
  199. package/symbols/SimpleLineSymbol.js +1 -1
  200. package/symbols/SimpleMarkerSymbol.js +1 -1
  201. package/symbols/Symbol3D.js +1 -1
  202. package/symbols/TextSymbol.js +1 -1
  203. package/symbols/cim/Rasterizer.js +1 -1
  204. package/symbols/cim/utils.js +1 -1
  205. package/views/2d/PaddedViewState.js +1 -1
  206. package/views/2d/ViewState.js +1 -1
  207. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  208. package/views/2d/engine/webgl/TextureManager.js +1 -1
  209. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  210. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  211. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  212. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  213. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  214. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  215. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  216. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  217. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  218. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  219. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  220. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  221. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  222. package/views/3d/layers/DrapedSubView3D.js +1 -1
  223. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  224. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  225. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  226. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  227. package/views/3d/layers/SceneLayerView3D.js +1 -1
  228. package/views/3d/layers/WMSLayerView3D.js +1 -1
  229. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  230. package/views/3d/layers/graphics/Graphics3DObjectStateSet.js +1 -1
  231. package/views/3d/layers/graphics/Graphics3DObjectStates.js +1 -1
  232. package/views/3d/layers/i3s/Highlights.js +1 -1
  233. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  234. package/views/3d/layers/support/SceneLayerViewRequiredFields.js +1 -1
  235. package/views/3d/layers/support/Tiles3DLayerViewRegistration.js +2 -0
  236. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  237. package/views/3d/layers/support/createFeatureFilterHighlight.js +2 -0
  238. package/views/3d/layers/support/createTileBVHForLayer.js +2 -0
  239. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  240. package/views/3d/layers/support/highlightUtils.js +1 -1
  241. package/views/3d/layers/support/selectTiles3DSpatialReference.js +2 -0
  242. package/views/3d/layers/support/tileBoundingVolumeUtils.js +2 -0
  243. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  244. package/views/3d/support/cameraUtils.js +1 -1
  245. package/views/3d/support/earthUtils.js +1 -1
  246. package/views/3d/support/engineContent/line.js +1 -1
  247. package/views/3d/support/flow/geometryUtils.js +1 -1
  248. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  249. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  250. package/views/3d/support/gaussianSplatting/GaussianSplatSortCoordinator.js +2 -0
  251. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  252. package/views/3d/support/hitTest.js +1 -1
  253. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  254. package/views/3d/terrain/TextureFader.js +1 -1
  255. package/views/3d/webgl-engine/Stage.js +1 -1
  256. package/views/3d/webgl-engine/createWebGLContext.js +2 -0
  257. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  258. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  259. package/views/3d/webgl-engine/lib/LineMaterial.js +1 -1
  260. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  261. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  262. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  263. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  264. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  265. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  266. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  267. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +1 -1
  268. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  269. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  270. package/views/3d/webgl-engine/shaders/ShadedMaterialConfiguration.js +2 -0
  271. package/views/3d/webgl.d.ts +2 -1
  272. package/views/3d/webgl.js +1 -1
  273. package/views/SceneView.d.ts +9 -5
  274. package/views/SceneView.js +1 -1
  275. package/views/VideoView.js +1 -1
  276. package/views/View.d.ts +1 -3
  277. package/views/View2D.d.ts +2 -2
  278. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  279. package/views/draw/support/Box.js +1 -1
  280. package/views/interactive/options/ViewOptions.d.ts +0 -2
  281. package/views/layers/FeatureLikeLayerView.d.ts +3 -1
  282. package/views/layers/FeatureLikeLayerView.js +1 -1
  283. package/views/layers/GraphicsLayerView.d.ts +3 -1
  284. package/views/layers/ImageryLayerView.js +1 -1
  285. package/views/layers/ImageryTileLayerView.js +1 -1
  286. package/views/layers/SceneLayerView.d.ts +3 -2
  287. package/views/layers/SceneLayerView.js +1 -1
  288. package/views/support/Scheduler.js +1 -1
  289. package/views/types.d.ts +1 -0
  290. package/webscene/version.js +1 -1
  291. package/widgets/AreaMeasurement2D.js +1 -1
  292. package/widgets/AreaMeasurement3D.js +1 -1
  293. package/widgets/Attachments.js +1 -1
  294. package/widgets/Attribution.js +1 -1
  295. package/widgets/BasemapGallery.js +1 -1
  296. package/widgets/BasemapLayerList.js +1 -1
  297. package/widgets/BasemapToggle.js +1 -1
  298. package/widgets/BatchAttributeForm.js +1 -1
  299. package/widgets/Bookmarks.js +1 -1
  300. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  301. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  302. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  303. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  304. package/widgets/BuildingExplorer.js +1 -1
  305. package/widgets/CatalogLayerList.js +1 -1
  306. package/widgets/Compass.js +1 -1
  307. package/widgets/CoordinateConversion.js +1 -1
  308. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  309. package/widgets/Daylight.js +1 -1
  310. package/widgets/DirectLineMeasurement3D.js +1 -1
  311. package/widgets/Directions.js +1 -1
  312. package/widgets/DistanceMeasurement2D.js +1 -1
  313. package/widgets/Editor/EditorViewModel.d.ts +0 -1
  314. package/widgets/Editor.d.ts +0 -1
  315. package/widgets/Editor.js +1 -1
  316. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  317. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  318. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  319. package/widgets/ElevationProfile.js +1 -1
  320. package/widgets/Expand.js +1 -1
  321. package/widgets/Feature/FeatureAttachments.js +1 -1
  322. package/widgets/Feature/FeatureContent.js +1 -1
  323. package/widgets/Feature/FeatureExpression.js +1 -1
  324. package/widgets/Feature/FeatureFields.js +1 -1
  325. package/widgets/Feature/FeatureMedia.js +1 -1
  326. package/widgets/Feature/FeatureRelationship.js +1 -1
  327. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  328. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  329. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  330. package/widgets/Feature.js +1 -1
  331. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  332. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  333. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  334. package/widgets/FeatureForm.js +1 -1
  335. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  336. package/widgets/FeatureTable.js +1 -1
  337. package/widgets/FeatureTemplates.js +1 -1
  338. package/widgets/Features/FeaturesDrillIn.js +1 -1
  339. package/widgets/Features.js +1 -1
  340. package/widgets/FloorFilter.js +1 -1
  341. package/widgets/Fullscreen.js +1 -1
  342. package/widgets/Histogram.js +1 -1
  343. package/widgets/HistogramRangeSlider.js +1 -1
  344. package/widgets/Home.js +1 -1
  345. package/widgets/LayerList/ListItemPanel.js +1 -1
  346. package/widgets/LayerList.js +1 -1
  347. package/widgets/Legend/styles/card/CardView.js +1 -1
  348. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  349. package/widgets/Legend/styles/card/LegendElement.js +1 -1
  350. package/widgets/Legend/styles/card/SizeRamp.js +1 -1
  351. package/widgets/Legend/styles/card/UnivariateAboveAndBelowRamp.js +1 -1
  352. package/widgets/Legend/styles/card/UnivariateColorSizeRamp.js +1 -1
  353. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  354. package/widgets/Legend/styles/classic/ColorRamp.js +1 -1
  355. package/widgets/Legend/styles/classic/LegendElement.js +1 -1
  356. package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
  357. package/widgets/Legend/styles/classic/UnivariateAboveAndBelowRamp.js +1 -1
  358. package/widgets/Legend/styles/classic/UnivariateColorSizeRamp.js +1 -1
  359. package/widgets/Legend.js +1 -1
  360. package/widgets/LineOfSight.js +1 -1
  361. package/widgets/Locate.js +1 -1
  362. package/widgets/Measurement.js +1 -1
  363. package/widgets/NavigationToggle.js +1 -1
  364. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  365. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  366. package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
  367. package/widgets/OrientedImageryViewer.js +1 -1
  368. package/widgets/Popup.js +1 -1
  369. package/widgets/Print.js +1 -1
  370. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  371. package/widgets/ScaleBar.js +1 -1
  372. package/widgets/ScaleRangeSlider.js +1 -1
  373. package/widgets/Search/SearchResultRenderer.js +1 -1
  374. package/widgets/Search.js +1 -1
  375. package/widgets/ShadowCast/components/ShadowTooltip.js +1 -1
  376. package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
  377. package/widgets/ShadowCast.js +1 -1
  378. package/widgets/Sketch/SketchViewModel.d.ts +0 -1
  379. package/widgets/Sketch.d.ts +0 -1
  380. package/widgets/Sketch.js +1 -1
  381. package/widgets/Slice.js +1 -1
  382. package/widgets/Slider.js +1 -1
  383. package/widgets/Spinner.js +1 -1
  384. package/widgets/Swipe.js +1 -1
  385. package/widgets/TableList/ListItemPanel.js +1 -1
  386. package/widgets/TableList.js +1 -1
  387. package/widgets/TimeSlider.js +1 -1
  388. package/widgets/TimeZoneLabel.js +1 -1
  389. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
  390. package/widgets/UtilityNetworkAssociations.js +1 -1
  391. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  392. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  393. package/widgets/UtilityNetworkTrace.js +1 -1
  394. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  395. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  396. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  397. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  398. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  399. package/widgets/ValuePicker.js +1 -1
  400. package/widgets/Widget.js +1 -1
  401. package/widgets/Zoom.js +1 -1
  402. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  403. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  404. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  405. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  406. package/widgets/smartMapping/ColorSlider.js +1 -1
  407. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  408. package/widgets/smartMapping/OpacitySlider.js +1 -1
  409. package/widgets/smartMapping/SizeSlider.js +1 -1
  410. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  411. package/widgets/support/ColorPicker.js +1 -1
  412. package/widgets/support/FilterBuilder.js +1 -1
  413. package/widgets/support/FilterCondition.js +1 -1
  414. package/widgets/support/GridControls.js +1 -1
  415. package/widgets/support/MeasurementWidgetContent.js +1 -1
  416. package/widgets/support/PluginSettingsControls.js +1 -1
  417. package/widgets/support/SelectionList.js +1 -1
  418. package/widgets/support/SelectionToolbar.d.ts +1 -1
  419. package/widgets/support/SelectionToolbar.js +1 -1
  420. package/widgets/support/SketchTooltipControls.js +1 -1
  421. package/widgets/support/SnappingControls.js +1 -1
  422. package/widgets/support/TimezonePicker.js +1 -1
  423. package/widgets/support/UnitSelect.js +1 -1
  424. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  425. package/assets/esri/core/workers/chunks/01803f76bc0d9f2cd566.js +0 -1
  426. package/assets/esri/core/workers/chunks/02940f7ddaf98e69521e.js +0 -1
  427. package/assets/esri/core/workers/chunks/07e5482e1fc69be5de09.js +0 -1
  428. package/assets/esri/core/workers/chunks/0c893837f67829757df7.js +0 -1
  429. package/assets/esri/core/workers/chunks/15950c2fb173b62ee0ec.js +0 -1
  430. package/assets/esri/core/workers/chunks/1a91443970d64a59521d.js +0 -1
  431. package/assets/esri/core/workers/chunks/1deca3de77b1a9a07da4.js +0 -1
  432. package/assets/esri/core/workers/chunks/1fd82fcba2758741996a.js +0 -1
  433. package/assets/esri/core/workers/chunks/20a2124cbe43e5527c40.js +0 -1
  434. package/assets/esri/core/workers/chunks/26ea39dfdf887f357fce.js +0 -1
  435. package/assets/esri/core/workers/chunks/276a0b549acf048e8673.js +0 -1
  436. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +0 -1
  437. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +0 -1
  438. package/assets/esri/core/workers/chunks/398ec098fffe6abceedd.js +0 -1
  439. package/assets/esri/core/workers/chunks/3b32a24488b3068f0cb7.js +0 -1
  440. package/assets/esri/core/workers/chunks/427d929dc7f89b0a1ea9.js +0 -1
  441. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +0 -1
  442. package/assets/esri/core/workers/chunks/4c240ca50f70bf30813f.js +0 -1
  443. package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +0 -1
  444. package/assets/esri/core/workers/chunks/514cc15acb77dc85035c.js +0 -1
  445. package/assets/esri/core/workers/chunks/585ae43c7bcb86a26762.js +0 -1
  446. package/assets/esri/core/workers/chunks/5e48898cebb6dbaf09b5.js +0 -1
  447. package/assets/esri/core/workers/chunks/5ec5a6cef9ee9a8cc400.js +0 -1
  448. package/assets/esri/core/workers/chunks/601e1d020b8115497944.js +0 -1
  449. package/assets/esri/core/workers/chunks/687deb918eb48a963c8f.js +0 -1
  450. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +0 -1
  451. package/assets/esri/core/workers/chunks/6e910342ada398c98e30.js +0 -1
  452. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +0 -1
  453. package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +0 -1
  454. package/assets/esri/core/workers/chunks/7d497df6e13162156342.js +0 -1
  455. package/assets/esri/core/workers/chunks/7dbf4c7480bf9c72820d.js +0 -1
  456. package/assets/esri/core/workers/chunks/80c234ee5276ea1645db.js +0 -1
  457. package/assets/esri/core/workers/chunks/8c3779de09291170497f.js +0 -1
  458. package/assets/esri/core/workers/chunks/966204d6dedc8149c3e9.js +0 -1
  459. package/assets/esri/core/workers/chunks/9ab0735e86cf8932bf9d.js +0 -1
  460. package/assets/esri/core/workers/chunks/a0356702f2d3f787aeac.js +0 -1
  461. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +0 -1
  462. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +0 -1
  463. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +0 -1
  464. package/assets/esri/core/workers/chunks/b13d8f4e4e80ef00b1bd.js +0 -1
  465. package/assets/esri/core/workers/chunks/b15a8d4322f3b7819d2f.js +0 -1
  466. package/assets/esri/core/workers/chunks/b3aa29589dcfb5b93106.js +0 -1
  467. package/assets/esri/core/workers/chunks/b472c0a21ae29e653f7d.js +0 -1
  468. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +0 -1
  469. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +0 -1
  470. package/assets/esri/core/workers/chunks/bd812dd75d2a3d7d0441.js +0 -1
  471. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +0 -1
  472. package/assets/esri/core/workers/chunks/c1cf3edce15f09648eb4.js +0 -1
  473. package/assets/esri/core/workers/chunks/c31830ee897d5a7f2582.js +0 -1
  474. package/assets/esri/core/workers/chunks/c48d97c38e821be17dc5.js +0 -1
  475. package/assets/esri/core/workers/chunks/c7ad62f54d2abe1d17a0.js +0 -1
  476. package/assets/esri/core/workers/chunks/cf21b217b13770757cb8.js +0 -1
  477. package/assets/esri/core/workers/chunks/d42a4f47843e075c56a8.js +0 -1
  478. package/assets/esri/core/workers/chunks/deb408bee61ca192b2ce.js +0 -1
  479. package/assets/esri/core/workers/chunks/e121d15b883184ee83e7.js +0 -1
  480. package/assets/esri/core/workers/chunks/e4042e43f0081fe49f7b.js +0 -1
  481. package/assets/esri/core/workers/chunks/e932951598499befabf5.js +0 -1
  482. package/assets/esri/core/workers/chunks/eaab787a5f2445be5e5a.js +0 -1
  483. package/assets/esri/core/workers/chunks/f06ef153e106b26a6748.js +0 -1
  484. package/assets/esri/core/workers/chunks/faae3c43048b42341536.js +0 -1
  485. package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +0 -46
  486. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ar.json +0 -1
  487. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.bg.json +0 -1
  488. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.bs.json +0 -1
  489. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ca.json +0 -1
  490. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.cs.json +0 -1
  491. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.da.json +0 -1
  492. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.de.json +0 -1
  493. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.el.json +0 -1
  494. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.en.json +0 -1
  495. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.es.json +0 -1
  496. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.et.json +0 -1
  497. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.fi.json +0 -1
  498. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.fr.json +0 -1
  499. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.he.json +0 -1
  500. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.hr.json +0 -1
  501. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.hu.json +0 -1
  502. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.id.json +0 -1
  503. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.it.json +0 -1
  504. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ja.json +0 -1
  505. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ko.json +0 -1
  506. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.lt.json +0 -1
  507. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.lv.json +0 -1
  508. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.nl.json +0 -1
  509. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.no.json +0 -1
  510. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pl.json +0 -1
  511. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pt-BR.json +0 -1
  512. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.pt-PT.json +0 -1
  513. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ro.json +0 -1
  514. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.ru.json +0 -1
  515. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sk.json +0 -1
  516. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sl.json +0 -1
  517. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sr.json +0 -1
  518. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.sv.json +0 -1
  519. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.th.json +0 -1
  520. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.tr.json +0 -1
  521. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.uk.json +0 -1
  522. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.vi.json +0 -1
  523. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-CN.json +0 -1
  524. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-HK.json +0 -1
  525. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/messages.zh-TW.json +0 -1
  526. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.d.ts +0 -72
  527. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +0 -2
  528. package/widgets/UtilityNetworkValidateTopology.d.ts +0 -130
  529. package/widgets/UtilityNetworkValidateTopology.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import n from"../../request.js";import r from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import a from"../../core/Logger.js";import{QueueProcessor as o}from"../../core/QueueProcessor.js";import{watch as s}from"../../core/reactiveUtils.js";import{urlToObject as c}from"../../core/urlUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{Integer as d,ensureClass as f}from"../../core/accessorSupport/ensureType.js";import{runUntracked as p}from"../../core/accessorSupport/tracking.js";import m from"../../geometry/Extent.js";import h from"../../geometry/Point.js";import g from"../../geometry/Polygon.js";import _ from"../../geometry/SpatialReference.js";import{srToRESTValue as v}from"../../geometry/support/spatialReferenceUtils.js";import{intersectMultimensionalSubset as y,getEffectiveMultidimensionalDefinition as b,getSubsetVariablesFromMdInfo as x,getDefaultMultidimensionalDefinition as S}from"../raster/datasets/multidimensionalUtils.js";import{decode as C,getFormat as w}from"../raster/formats/RasterCodec.js";import{convertPixelSize as T}from"../raster/functions/clipUtils.js";import{mosaicPixelData as E}from"../raster/functions/pixelUtils.js";import{uvComponentToVector as D}from"../raster/functions/vectorFieldUtils.js";import{opacity as O,url as k}from"../support/commonProperties.js";import A from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as j}from"../support/ExportImageServiceParameters.js";import ee from"../support/Field.js";import te from"../support/FieldsIndex.js";import{createBitmap as M}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as ne}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import re from"../support/MultidimensionalSubset.js";import P from"../support/PixelBlock.js";import{interpolationKebab as F,noDataInterpretationKebab as I,pixelTypeKebabDict as L}from"../support/rasterEnums.js";import{getServicePixelValueField as ie,getItemPixelValueField as ae,getRawServicePixelValueField as oe,getProcessedServicePixelValueField as se,getMagnitudeField as ce,getDirectionField as le,getMultidimensionalFields as ue,getRasterAttributeTableFields as de,addMultidimensionalFieldValues as fe,commonRasterFieldNames as R,rasterFieldPrefix as pe}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import me from"../support/RasterInfo.js";import{createDefaultRenderer as B,getDefaultBandCombination as V,getSupportedRendererTypes as H,getField as U,matchPresetRenderer as he,normalizeRendererJSON as ge}from"../../renderers/support/rasterRendererHelper.js";import W from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as G,websceneRasterRendererTypes as _e,read as ve}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as ye,computeAngles as be,computePixelSpaceLocations as xe,computeHistograms as Se,computeStatisticsHistograms as Ce,measureHeight as we,measureAreaAndPerimeter as Te,measureDistanceAndAngle as Ee,measurePointOrCentroid as De,measureLengthFromImage as Oe,measureAreaFromImage as ke,getImageSpatialReferenceQueryParameter as Ae,getSamples as je,identify as K,imageToMap as Me,imageToMapMultiray as Ne,mapToImage as Pe,findImages as Fe,getImageUrl as Ie,queryBoundary as Le,queryGPSInfo as Re}from"../../rest/imageService.js";import{fetchServiceRasterInfo as q,generateRasterInfo as ze,patchServiceInfo as Be}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Ve}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as J}from"../../rest/query/executeForCount.js";import{executeForExtent as He}from"../../rest/query/executeForExtent.js";import{executeForIds as Ue}from"../../rest/query/executeForIds.js";import{executeQueryJSON as We}from"../../rest/query/executeQueryJSON.js";import Ge from"../../rest/support/FeatureSet.js";import Ke from"../../rest/support/ImageIdentifyParameters.js";import Y from"../../rest/support/Query.js";import qe from"../../rest/support/StatisticDefinition.js";import{reader as X}from"../../core/accessorSupport/decorators/reader.js";import{writer as Z}from"../../core/accessorSupport/decorators/writer.js";const Je=4096,Ye=new Set([`png`,`png8`,`png24`,`png32`,`jpg`,`bmp`,`gif`,`jpgpng`,`lerc`,`tiff`]);function Xe(e){let t=JSON.stringify(e),n=t.includes(`"rasterFunctionDefinition":{`),r=(n?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi))?.map(e=>n?e.slice(8,-18):e.slice(18,-1));return r?r.join(`/`):null}const Ze=Ze=>{let Qe=Ze,Q=class extends Qe{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this._exportTileQueue=new o({concurrency:4,process:(e,t)=>this._fetchPixels(e.extent,e.width,e.height,{...e.options,signal:t})}),this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType=`polygon`,this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set(`exportImageServiceParameters`,new j({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){let e=new Map;return!this.rasterFunctionInfos||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.length<1||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,`_`),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(e=>typeof e==`number`))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,n){e!=null&&this.format!==`lerc`&&(t[n]=e)}writeCompressionTolerance(e,t,n){this.format===`lerc`&&e!=null&&(t[n]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?p(()=>N.fromJSON(t)):null}get fieldsIndex(){return this.fields?new te(this.fields):null}set format(e){e&&Ye.has(e.toLowerCase())&&this._set(`format`,e.toLowerCase())}readFormat(e,t){return t.serviceDataType===`esriImageServiceDataTypeVector-UV`||t.serviceDataType===`esriImageServiceDataTypeVector-MagDir`||this.pixelFilter!=null||t.allowRasterFunction===!1?`lerc`:`jpgpng`}get isRenderedFormat(){return!this.format||this.format.includes(`jpg`)||this.format.includes(`png`)}readMinScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}readMaxScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set(`mosaicRule`,t)}readMosaicRule(e,t){let n=e||t.mosaicRule;return n?N.fromJSON(n):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,n){let{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[n]=r.toJSON())}readObjectIdField(e,t){return e||=t.fields.find(e=>e.type===`esriFieldTypeOID`||e.type===`oid`)?.name,e}get parsedUrl(){return c(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?`mosaic-dataset`:`raster-dataset`}get renderer(){let{activePresetRendererName:e,presetRenderers:t}=this;return e?(t?.find(({name:t})=>t===e))?.renderer.clone():this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set(`internalRenderer`,e)}readRenderer(e,t,n){let r=t?.layerDefinition?.drawingInfo?.renderer,i=ve(r,n);return i==null?null:(i.type===`vector-field`&&t.symbolTileSize&&!r.symbolTileSize&&(i.symbolTileSize=t.symbolTileSize),ne(i)||a.getLogger(this).warn(`ArcGISImageService`,`Imagery layer doesn't support given renderer type.`),i)}writeRenderer(e,t,n){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON()}get rasterFields(){let e=this.fields?.map(e=>e.clone())??[];e.push(ie()),this.sourceType===`mosaic-dataset`&&this.fields?.length&&e.push(ae()),this.version>=10.4&&this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.some(({name:e})=>e.toLowerCase()===`none`)&&e.push(oe()),this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.filter(({name:e})=>e.toLowerCase()!==`none`).forEach(({name:t})=>e.push(se(t)));let{rasterInfo:t}=this;if(this._isVectorDataSet()){let n=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=ce(n),i=le();e.push(r,i)}if(t?.multidimensionalInfo&&this.sourceType===`raster-dataset`){let n=ue(t.multidimensionalInfo);e.push(...n)}let n=t?.attributeTable;if(n!=null){let t=de(n);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set(`rasterFunction`,t)}readRasterFunction(e,t){let n=t.rasterFunctionInfos,r=t.renderingRule,i=r!=null&&Object.keys(r).length>0;return!i&&(!n?.length||n[0].name===`None`)?null:this._isRFTJson(r)?z.fromJSON({rasterFunctionDefinition:r}):z.fromJSON(i?r:{rasterFunctionInfos:n})}readSpatialReference(e,t){let n=e||t.extent.spatialReference;return n?_.fromJSON(n):null}writePixelType(e,t,n){(this.serviceRasterInfo==null||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[n]=L.toJSON(e))}readVersion(e,t){let n=t.currentVersion;return n||=t.hasOwnProperty(`fields`)||t.hasOwnProperty(`timeInfo`)?10:9.3,n}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let n=e,{renderer:r,symbolizer:i,pixelFilter:a}=this,{isRawData:o}=e;if(o&&this.format!==`lerc`&&(r??=B(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),i||=(this.symbolizer=new W({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),this.symbolizer)),(o||!this.isRenderedFormat)&&r&&i&&!a){await this._updateSymbolizer(i,r);let a=this.bandIds?.length?this.bandIds:V(this.rasterInfo);n=await this._symbolize({pixelData:e,bandIds:a,symbolizer:i},t)}return n}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r(`imagery-layer:compute-pixel-space-locations`,`this operation is not supported on the input image service`);return e=i(e),this.mosaicRule&&e.mosaicRule==null&&(e.mosaicRule=this.mosaicRule),ye(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r(`imagery-layer:compute-angles`,`this operation is not supported on the input image service`);return be(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r(`imagery-layer:compute-pixel-space-locations`,`this operation is not supported on the input image service`);return xe(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r(`imagery-layer:compute-histograms`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicAndRenderingRules(e),Se(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r(`imagery-layer:compute-statistics-histograms`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicAndRenderingRules(e),Ce(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){let n=await this._fetchCapabilities(t?.signal);if(!(e.operationType===`base-and-top`?n.mensuration.supportsHeightFromBaseAndTop:e.operationType===`base-and-top-shadow`?n.mensuration.supportsHeightFromBaseAndTopShadow:n.mensuration.supportsHeightFromTopAndTopShadow))throw new r(`imagery-layer:measure-height`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),we(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){let n=await this._fetchCapabilities(t?.signal);if(!n.mensuration.supportsAreaAndPerimeter||e.is3D&&!n.mensuration.supports3D)throw new r(`imagery-layer:measure-area-and-perimeter`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),Te(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){let n=await this._fetchCapabilities(t?.signal);if(!n.mensuration.supportsDistanceAndAngle||e.is3D&&!n.mensuration.supports3D)throw new r(`imagery-layer:measure-distance-and-angle`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),Ee(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){let n=await this._fetchCapabilities(t?.signal);if(!n.mensuration.supportsPointOrCentroid||e.is3D&&!n.mensuration.supports3D)throw new r(`imagery-layer:measure-point-or-centroid`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),De(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r(`imagery-layer:measure-length-from-image`,`this operation is not supported on the input image service`);if(e.geometry.type!==`polyline`)throw new r(`imagery-layer:measure-length-from-image`,`this input geometry must be a polyline`);return Oe(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r(`imagery-layer:measure-area-from-image`,`this operation is not supported on the input image service`);if(e.geometry.type!==`polygon`)throw new r(`imagery-layer:measure-area-from-image`,`this input geometry must be a polygon`);return ke(this.url,e,this._getRequestOptions(t))}getField(e){let{fieldsIndex:t}=this;return t?.get(e)}getFieldDomain(e,t){let n=this.getField(e);return n?n.domain:null}async internalFetchImage(e,t,n,r={}){await this._updateCurrentRasterInfo();let{exportImageServiceParameters:i}=this,a=!1;if(r.requestRawData&&(await this._initJobHandler(),!i.requestRawData&&this.format!==`lerc`)){a=!0,i.requestRawData=!0;let e=this.bandIds;if(!e?.length){let t=V(this.rasterInfo);Array.from({length:this.rasterInfo.bandCount},(e,t)=>t)?.join(`,`)!==t?.join(`,`)&&(e=t)}i.rawDataRequestBandIds=e}let o=this.getExportImageServiceParameters(e,t,n,r.timeExtent);if(a&&(i.requestRawData=!1,i.rawDataRequestBandIds=null),o==null){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){let e=document.createElement(`canvas`);if(e.width=t,e.height=n,r.returnImageBitmap){let{bitmap:t}=await M(e,`${$(this.parsedUrl)}/exportImage`,r);return{imageBitmap:t}}return{imageOrCanvasElement:e}}let{bandIds:i,rasterInfo:a}=this,o=(i?.length||a.bandCount)??0,s=t*n,c=a.pixelType,l=[];for(let e=0;e<o;e++)l.push(P.createEmptyBand(c,s));return{pixelData:{pixelBlock:new P({width:t,height:n,pixels:l,mask:new Uint8Array(s),pixelType:c}),extent:e}}}let s=!!r.requestAsImageElement&&!this.pixelFilter,c=s&&!!r.returnImageBitmap,l={imageServiceParameters:o,imageProps:{extent:e,width:t,height:n,format:this.format},requestAsImageElement:s,returnImageBitmap:c,signal:r.signal};return this._requestArrayBuffer(l)}async fetchPixels(e,t,n,i={}){await this._initJobHandler(),i.applyRendering&&await this._updateCurrentRasterInfo();let{imageMaxWidth:a,imageMaxHeight:o}=this;if(t<=a&&n<=o)return this._exportTileQueue.push({extent:e,width:t,height:n,options:i},{signal:i.signal});if(t>Je||n>Je||a<512||o<512)throw new r(`imagery-layer:fetch-pixels`,`The image service has a maximum export size of ${a}x${o}. The requested size of ${t}x${n} exceeds this limit.`);let{xmin:s,ymax:c,spatialReference:l}=this._projectedFullExtent??this.fullExtent;if(!l?.equals(e.spatialReference)){let{projectLoad:t,projectExecute:n}=await import(`../../geometry/operators/projectOperator.js`);await t();let r=n(this.fullExtent,e.spatialReference);s=r.xmin,c=r.ymax,this._projectedFullExtent=r}let u=e.width/t,d=e.height/n,f=Math.floor((e.xmin-s)/u),p=Math.floor((c-e.ymax)/d),h=f+t,g=p+n,_=Math.floor(f/512),v=Math.floor(p/512),y=Math.ceil(h/512)-1,b=Math.ceil(g/512)-1,x=512*u,S=512*d,C=[];for(let t=v;t<=b;t++){let n=c-t*S,r=n-S;for(let t=_;t<=y;t++){let a=s+t*x,o=new m({xmin:a,ymin:r,xmax:a+x,ymax:n,spatialReference:e.spatialReference});C.push(this._exportTileQueue.push({extent:o,width:512,height:512,options:i},{signal:i.signal}))}}let w=await Promise.all(C);return w.some(e=>e.pixelBlock==null)?{extent:e,pixelBlock:null}:{extent:e,pixelBlock:this._rasterJobHandler?await this._rasterJobHandler.mosaicPixelData({pixelBlocks:w,destExtent:e},{signal:i.signal,transferPixelsToWorker:!0}):E(w,e)?.pixelBlock}}async _fetchPixels(e,t,n,r={}){let i=r.applyRendering?void 0:new j({layer:this,requestRawData:!0,interpolation:r.interpolation??`nearest`,bandIds:r.bandIds??[]}),a=this.getExportImageServiceParameters(e,t,n,r.timeExtent,i);if(a==null)return{extent:e,pixelBlock:null};delete a.pixelType,r.bandIds||delete a.bandIds,delete a.compressionQuality;let o={imageServiceParameters:a,imageProps:{extent:e,width:t,height:n,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:s}=await this._requestArrayBuffer(o);return s??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return n($(this.parsedUrl)+`/keyProperties`,{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r(`#fetchRasterAttributeTable()`,`Failed to get rasterAttributeTable`)):n($(this.parsedUrl)+`/rasterAttributeTable`,{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Ge.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){let n=this._getQueryParams(),r={...t,query:n};return Ve($(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){let{data:r}=await n($(this.parsedUrl)+`/`+e+`/info/ics`,{query:this._getQueryParams(),...t}),i=r?.ics;if(!i)return;let a=null;try{a=(await n($(this.parsedUrl)+`/`+e+`/info`,{query:this._getQueryParams(),...t})).data.extent}catch{}if(!a?.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};let o=this.version>=10.7?n($(this.parsedUrl)+`/`+e+`/info/icstopixel`,{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},s=a.spatialReference,c={geometries:JSON.stringify({geometryType:`esriGeometryEnvelope`,geometries:[a]}),inSR:v(s),outSR:`0:`+e},l=n($(this.parsedUrl)+`/project`,{query:this._getQueryParams(c),...t}).then(e=>e.data).catch(()=>({})),u=(a.xmin+a.xmax)/2,d=(a.ymax-a.ymin)/6,f=a.ymin+d,p=[];for(let e=0;e<5;e++)p.push({x:u,y:f+d*e});let h={geometries:JSON.stringify({geometryType:`esriGeometryPoint`,geometries:p}),inSR:v(s),outSR:`0:`+e},g=n($(this.parsedUrl)+`/project`,{query:this._getQueryParams(h),...t}).then(e=>e.data).catch(()=>({})),y=await Promise.all([o,l,g]),b=y[0].ipxf;if(b==null){let e=i.geodataXform?.xf_0;e?.name?.toLowerCase()===`topup`&&e?.coefficients?.length===6&&(b={affine:{name:`ics [sensor: Frame] to pixel (column, row) transformation`,coefficients:e.coefficients,cellsizeRatio:0,type:`GeometricXform`}})}let x=m.fromJSON(y[1]?.geometries?.[0]);x&&(x.spatialReference=new _({wkid:0,imageCoordinateSystem:i}));let S=y[2].geometries?y[2].geometries.filter(e=>e?.x!=null&&e.y!=null&&e.x!==`NaN`&&e.y!==`NaN`):[],C=S.length;if(C<3)return{ics:i,icsToPixelTransform:b,icsExtent:x,northDirection:null};let w=0,T=0,E=0,D=0;for(let e=0;e<C;e++)w+=S[e].x,T+=S[e].y,E+=S[e].x*S[e].x,D+=S[e].x*S[e].y;let O=(C*D-w*T)/(C*E-w*w),k=0,A=S[4].x>S[0].x,j=S[4].y>S[0].y;return O===1/0?k=j?90:270:O===0?k=A?0:180:O>0?k=A?Math.atan(O)*180/Math.PI:Math.atan(O)*180/Math.PI+180:O<0&&(k=j?180+Math.atan(O)*180/Math.PI:360+Math.atan(O)*180/Math.PI),{ics:i,icsToPixelTransform:b,icsExtent:x,northDirection:k}}async generateRasterInfo(e,t){let n=f(z,e),i={...t,query:this._getQueryParams()};if(!n||n.functionName?.toLowerCase()===`none`||this._isVectorFieldResampleFunction(n))return this.serviceRasterInfo??q($(this.parsedUrl),this.sourceJSON,i);let a=Xe(n);if(!a)throw new r(`imagery-layer:generate-raster-info`,`the rendering rule is not supported`);if(this._functionRasterInfos[a])return this._functionRasterInfos[a];let o=ze($(this.parsedUrl),n,i);this._functionRasterInfos[a]=o;try{let t=await o,{rasterFunction:n}=this;return(n===e||JSON.stringify(n)===JSON.stringify(e))&&JSON.stringify(this.rasterInfo)!==JSON.stringify(t)&&(this.rasterInfo=t),t}catch(e){throw this._functionRasterInfos[a]=null,e}}getExportImageServiceParameters(e,t,n,r,i){e=e.clone().shiftCentralMeridian();let a=Ae(e.spatialReference,$(this.parsedUrl));i??=this.exportImageServiceParameters;let o=i.toJSON(),{bandIds:s,noData:c}=o,{renderingRule:l}=o,u=this.rasterFunction?.rasterFunctionDefinition,d=this.renderer?.type,f=!d||d===`raster-stretch`||d===`raster-colormap`||d===`unique-value`||d===`class-breaks`||d===`raster-shaded-relief`;if(s?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&f){let e={rasterFunction:`ExtractBand`,rasterFunctionArguments:{BandIds:s}};if(l.rasterFunction===`Stretch`)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if(l.rasterFunction===`Colormap`){let t=l.rasterFunctionArguments.Raster;t?.rasterFunction===`Stretch`?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;o.bandIds=void 0}else o.bandIds=s?.join(`,`);Array.isArray(c)&&c.length>0&&(o.noData=c.join(`,`));let p=this._processMultidimensionalIntersection(null,r,i.mosaicRule);if(p.isOutSide)return null;o.mosaicRule=p.mosaicRule==null?null:JSON.stringify(p.mosaicRule),r=p.timeExtent,o.renderingRule=this._getRenderingRuleString(z.fromJSON(l));let m={};if(r!=null){let{start:e,end:t}=r.toJSON();e&&t&&e===t?m.time=``+e:(e!=null||t!=null)&&(m.time=`${e??`null`},${t??`null`}`)}return{bbox:e.xmin+`,`+e.ymin+`,`+e.xmax+`,`+e.ymax,bboxSR:a,imageSR:a,size:t+`,`+n,...o,...m}}async getSamples(e,t){if(!(await this._fetchCapabilities(t?.signal))?.operations.supportsGetSamples)throw new r(`imagery-layer:get-samples`,`getSamples operation is not supported on the input image service`);e=i(e);let{raster:n}=this;return n&&e.raster==null&&(e.raster=n),je(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r(`imagery-layer:identify`,`identify operation is not supported on the input image service`);e=i(e),this.version<10.91&&e.geometry?.type===`extent`&&(e.geometry=g.fromExtent(e.geometry));let n=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(n.isOutSide)throw new r(`imagery-layer:identify`,`the request cannot be fulfilled when falling outside of the multidimensional subset`);e.timeExtent=n.timeExtent,e.mosaicRule=n.mosaicRule;let{raster:a,rasterFunction:o}=this;return o&&e.rasterFunction==null&&(e.rasterFunction=o),a&&e.raster==null&&(e.raster=a),K(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r(`imagery-layer:image-to-map`,`imageToMap operation is not supported on the input image service`);return Me($(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r(`imagery-layer:image-to-map-multiray`,`imageToMapMultiray operation is not supported on the input image service`);return Ne($(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r(`imagery-layer:map-to-image`,`mapToImage operation is not supported on the input image service`);return Pe($(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r(`imagery-layer:find-images`,`findImages operation is not supported on the input image service`);return Fe($(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r(`imagery-layer:get-image-url`,`getImageUrl operation is not supported on the input image service`);return Ie($(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Y({outFields:[`*`],returnGeometry:!0,where:this.definitionExpression||`1=1`})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r(`imagery-layer:query-boundary`,`queryBoundary operation is not supported on the input image service`);return e??={outSpatialReference:this.spatialReference},Le($(this.parsedUrl),e,this._getRequestOptions(t))}async queryExtent(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));let{where:n,objectIds:r,geometry:i,timeExtent:a,start:o,num:s,pixelSize:c}=e,l=n!=null&&n!==`1=1`,u=r!=null&&r.length>0,d=i!=null&&(i.type!==`extent`||!i.equals(this.fullExtent)),f=c!=null,p=o!=null||s!=null,{timeInfo:m}=this,h=a!=null&&m!=null&&!a.equals(m.fullTimeExtent);if(!(l||u||d||f||h||p)){let n=await J(this.url,e,t),{outSpatialReference:r}=e;if(!r||r.equals(this.spatialReference))return{count:n,extent:this.fullExtent.clone()};let{projectLoad:i,projectExecute:a}=await import(`../../geometry/operators/projectOperator.js`);return await i(),{count:n,extent:a(this.fullExtent,r)}}return He(this.url,e,t)}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));let n=await We(this.url,e,t),r=this.graphicOrigin;return n.features.forEach(e=>{e.layer=this,e.origin=r}),n}async fetchMaxPixelSize(e,t){let n=await this._fetchCapabilities(t?.signal),r=this.fields?.find(({name:e})=>e.toLowerCase()===`maxps`);if(!n.query.supportsStatistics||!r)return null;let i=`maxPixelSize`,a=(await this.queryRasters({where:`1=1`,outStatistics:[new qe({statisticType:`max`,onStatisticField:r.name,outStatisticFieldName:i})],returnGeometry:!1},t)).features[0]?.attributes?.[i];if(!a)return null;let o=new h({x:a,y:a,spatialReference:this.spatialReference});return T(o,e)}async queryObjectIds(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Ue(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r(`imagery-layer:query-gps-info`,`queryGPSInfo operation is not supported on the input image service`);return e??={where:`1=1`},Re($(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),J(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new r(`imagery-layer: query-visible-rasters`,`missing query parameter`);await this.load();let{pixelSize:n,returnDomainValues:i,returnTopmostRaster:a,showNoDataRecords:o}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1},s=!1,c=null,l=null,u=R.servicePixelValue.toLowerCase(),d=this._rasterFunctionNamesIndex;if(e.outFields!=null&&(s=e.outFields.some(e=>!e.toLowerCase().startsWith(u)),this.version>=10.4)){let t=e.outFields.filter(e=>e.toLowerCase().startsWith(u)&&e.length>u.length).map(e=>{let t=e.slice(u.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]});c=t.map(e=>new z({functionName:e[0]})),l=t.map(e=>e[1]);let{rasterFunction:n}=this;c.length===0?n?.functionName?(c.push(n),l.push(n.functionName)):c=null:n?.functionName&&!c.some(e=>e.functionName===n.functionName)&&(c.push(n),l.push(n.functionName))}let f=e.outSpatialReference==null||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:p}=this,m=e.timeExtent||this.timeExtent;if(p){let{isOutside:t,intersection:n}=y(p,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r(`imagery-layer:query-visible-rasters`,`the request cannot be fulfilled when falling outside of the multidimensional subset`);n?.timeExtent!=null&&(m=n.timeExtent)}let h=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,m),_=e.geometry;this.version<10.91&&_?.type===`extent`&&(_=g.fromExtent(_));let v=this._getQueryParams({geometry:_,timeExtent:m,mosaicRule:h,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:c,pixelSize:n,returnCatalogItems:s,returnGeometry:f,raster:this.raster,maxItemCount:a?1:null});delete v.f;let x=new Ke(v);try{await this._generateRasterInfo(this.rasterFunction);let n=await K(this.url,x,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,a=n.value!=null&&n.value.toLowerCase().includes(`nodata`),c=s&&!f&&n?.catalogItems?.features.length&&(o||!a),u=this.multidimensionalInfo&&this.sourceType===`raster-dataset`?b({rasterInfo:this.rasterInfo,multidimensionalDefinition:h?.multidimensionalDefinition,timeExtent:m,multidimensionalSubset:this.multidimensionalSubset}):null;if(!c)return this._processVisibleRastersResponse(n,{returnDomainValues:i,templateRRFunctionNames:l,showNoDataRecords:o,templateFields:r,effectiveMultidimensionalDefinition:u});let d=this.objectIdField||`ObjectId`,p=n.catalogItems?.features??[],g=p.map(e=>e.attributes?.[d]),_=new Y({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[d]}),v=await this.queryRasters(_);return v?.features?.length&&v.features.forEach(t=>{p.forEach(n=>{n.attributes[d]===t.attributes[d]&&t.geometry&&(n.geometry=t.geometry.clone(),e.outSpatialReference!=null&&(n.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(n,{returnDomainValues:i,templateRRFunctionNames:l,showNoDataRecords:o,templateFields:r,effectiveMultidimensionalDefinition:u})}catch{throw new r(`imagery-layer:query-visible-rasters`,`encountered error when querying visible rasters`)}}async fetchVariableStatisticsHistograms(e,t){let r=n($(this.parsedUrl)+`/statistics`,{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),i=n($(this.parsedUrl)+`/histograms`,{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),a=await Promise.all([r,i]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:a[0]||null,histograms:a[1]||null}}getMultidimensionalSubsetVariables(e){let t=e??this.serviceRasterInfo.multidimensionalInfo;return x(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e);let t=this.sourceJSON,n=this.serviceRasterInfo==null?q($(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set(`serviceRasterInfo`,e),this._set(`multidimensionalInfo`,e.multidimensionalInfo),Be(e,t),e)):Promise.resolve(this.serviceRasterInfo),r=!this.rasterInfo&&this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):Promise.resolve(this.rasterInfo),i=this.rasterFunctionInfos?.every(e=>e.functionType!=null)?null:this._getRasterFunctionInfos();return Promise.all([n,r,i]).then(e=>{e[1]?this._set(`rasterInfo`,e[1]):this._set(`rasterInfo`,e[0]),e[2]&&(t.rasterFunctionInfos=e[2],this.setAtOrigin(`rasterFunctionInfos`,e[2],`service`)),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set(`internalRenderer`,null),a.getLogger(this).warn(`ArcGISImageService`,`Switching to the default renderer. Renderer applied is not valid for this Imagery Layer`)),this._set(`internalRenderer`,this._configRenderer(this.renderer)),this.addHandles([s(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);let{serviceRasterInfo:n}=this;n.multidimensionalInfo!=null&&this._updateMultidimensionalDefinition(n)})}_combineMosaicRuleWithTimeExtent(e,t){let n=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(e==null||r==null||t==null||n?.startField==null)return e;let{startField:i}=n,a=r.variables.some(e=>e.dimensions.some(e=>e.name===i))?i:`StdTime`;if(e=e.clone(),this.sourceType===`mosaic-dataset`)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==a),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];let o=e.multidimensionalDefinition.filter(e=>e.dimensionName===a),s=t.start==null?null:t.start.getTime(),c=t.end==null?null:t.end.getTime(),l=s==null||c==null||s===c,u=l?[s||c]:[[s,c]],d=this.version>=10.8;if(o.length)o.forEach(e=>{e.dimensionName===a&&(d?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=l,e.values=u))});else if(!d){let t=e.multidimensionalDefinition.filter(e=>e.variableName!=null&&e.dimensionName==null);t.length?t.forEach(e=>{e.dimensionName=a,e.isSlice=l,e.values=u}):e.multidimensionalDefinition.push(new A({variableName:``,dimensionName:a,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return e==null?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!!(e.variableName||e.dimensionName)),e.multidimensionalDefinition.length===0&&(e.multidimensionalDefinition=null)),this.sourceType!==`mosaic-dataset`&&e.multidimensionalDefinition==null?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r(`imagery-layer:query-rasters`,`query operation is not supported on the input image service`);let n=e==null?this.createQuery():f(Y,e);return t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:n,requestOptions:t}}_isSupportedRenderer(e){let{rasterInfo:t,rasterFunction:n}=this;return e.type===`unique-value`&&this._hasRasterFunction(n)&&t?.bandCount===1&&[`u8`,`s8`].includes(t.pixelType)||t!=null&&e!=null&&H(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){let{data:r,ssl:i}=await n($(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,`https:`))}if(t.capabilities?.toLowerCase().split(`,`).map(e=>e.trim()).indexOf(`tilesonly`)>-1)throw new r(`imagery-layer:fetch-service-info`,`use ImageryTileLayer to open tiles-only image services`);this.read(t,{origin:`service`,url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?e.serviceSourceType===`esriImageServiceSourceTypeMosaicDataset`:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;let t=this._isMosaicDataset(e),n=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||n}_isVectorFieldResampleFunction(e){if(e==null)return!1;let{functionName:t,functionArguments:n}=e,r=t?.toLowerCase()===`resample`,i=n?.ResampleType||n?.resampleType;return r&&(i===7||i===10)}_configRenderer(e){let{rasterInfo:t}=this,n=t.attributeTable,r=U(n,`red`)!=null&&U(n,`green`)!=null&&U(n,`blue`)!=null,i=!e&&t.colormap==null&&!r&&H(t).includes(`unique-value`);if(!(this.isRenderedFormat||this.pixelFilter)||this._isVectorDataSet()||i){let n=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=he({variableName:n,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>=3){let e=r?.bandIds??V(t);e&&(t.bandCount!==3||e[0]!==0||e[1]!==1||e[2]!==2)&&(this.bandIds=e)}e||=r?.renderer??B(t,{bandIds:this.bandIds,variableName:this.rasterFunction?null:n});let i=ge(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=i,this.symbolizer.rasterInfo=t):this.symbolizer=new W({rendererJSON:i,rasterInfo:t}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return e==null?e:{extent:e.extent&&e.extent.clone(),pixelBlock:e.pixelBlock==null?null:e.pixelBlock.clone()}}_getQueryParams(e){e?.renderingRule!=null&&typeof e.renderingRule!=`string`&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));let{raster:t,viewId:n}=this;return{raster:t,viewId:n,f:`json`,...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,n){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):C(e,t,n)}async _getRasterFunctionInfos(e){let t=this.sourceJSON.rasterFunctionInfos;return this.loaded||!t?.length?t:t&&this.version>=10.3?t.length===1&&t[0].name.toLowerCase()===`none`?[{thumbnail:``,functionType:0,...t[0]}]:(await n($(this.parsedUrl)+`/rasterFunctionInfos`,{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos:null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes(`png`))}async _requestArrayBuffer(e){let{imageProps:t,requestAsImageElement:i,returnImageBitmap:a,signal:o}=e;if(i&&this._canRequestImageElement(t.format)){let r=`${$(this.parsedUrl)}/exportImage`,{data:i}=await n(r,{responseType:a?`blob`:`image`,query:this._getQueryParams({f:`image`,...this.refreshParameters,...e.imageServiceParameters}),signal:o});if(i instanceof Blob){let{bitmap:e}=await M(i,r,{signal:o});return{imageBitmap:e,params:t}}return{imageOrCanvasElement:i,params:t}}let s=this._initJobHandler(),c=n($(this.parsedUrl)+`/exportImage`,{responseType:`array-buffer`,query:this._getQueryParams({f:`image`,...e.imageServiceParameters}),signal:o}),l=(await Promise.all([c,s]))[0].data,u=t.format||`jpgpng`,d=u;if(d!==`bsq`&&d!==`bip`&&(d=w(l)),!d)throw new r(`imagery-layer:fetch-image`,`unsupported format signature `+String.fromCharCode.apply(null,new Uint8Array(l)));let f={signal:o};return{pixelData:{pixelBlock:await this._decodePixelBlock(l,{width:t.width,height:t.height,format:u,applyJpegMask:!0},f),extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=S(e,{multidimensionalSubset:this.multidimensionalSubset});if(t!=null&&t.length>0){this.mosaicRule=this.mosaicRule||new N;let e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&this.rasterFunction.functionName?.toLowerCase()!==`none`&&t.forEach(e=>e.variableName=``),t=t.filter(({variableName:e,dimensionName:t})=>e&&e!==`*`||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,n){n||={};let r=e.value,{templateRRFunctionNames:i,showNoDataRecords:a,returnDomainValues:o,templateFields:s}=n,c=e.processedValues,l=e.catalogItems?.features,u=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,`, `))||[],d=this.objectIdField||`ObjectId`,f=typeof r==`string`&&r.toLowerCase().includes(`nodata`),p=[];if(r&&!l&&(!f||a)){let e={};e[d]=0;let i=new t({geometry:this.fullExtent,attributes:e});u=[r],l=[i],this.multidimensionalInfo&&this.sourceType===`raster-dataset`&&fe(this.rasterFields,e,n.effectiveMultidimensionalDefinition)}if(!l)return[];this._updateResponseFieldNames(l,s),f&&!a&&(l=[]);let{itemPixelValue:m,servicePixelValue:h}=R,g=this.rasterFields.some(e=>e.name===m),_=this.graphicOrigin;for(let e=0;e<l.length;e++){let t=l[e];if(r!=null){let n=u[e],o=this.rasterFunction&&c&&c.length>0&&i&&i.length>0&&i.includes(this.rasterFunction.functionName)?c[i.indexOf(this.rasterFunction.functionName)]:r;if(n.toLowerCase()===`nodata`&&!a)continue;g&&(t.attributes[m]=n),t.attributes[h]=o,this._updateFeatureWithMagDirValues(t,n);let s=this.fields&&this.fields.length>0,l=this.rasterFunction&&this.serviceRasterInfo.attributeTable!=null?s?n:r:o;this.rasterFunction||(l=s?n:r),this._updateFeatureWithRasterAttributeTableValues(t,l)}if(t.sourceLayer=t.layer=this,t.origin=_,o&&this._updateFeatureWithDomainValues(t),i&&c&&i.length===c.length)for(let e=0;e<i.length;e++){let n=`${R.servicePixelValue}.${i[e]}`;t.attributes[n]=c[e]}p.push(l[e])}return p}_processMultidimensionalIntersection(e,t,n){let{multidimensionalSubset:r}=this;if(!r)return n=this._combineMosaicRuleWithTimeExtent(n,t),{isOutSide:!1,timeExtent:t,mosaicRule:n};if(r){let{isOutside:n,intersection:i}=y(r,{geometry:e,timeExtent:t});if(n)return{isOutSide:!0,timeExtent:null,mosaicRule:null};i?.timeExtent!=null&&(t=i.timeExtent)}if(n=this._combineMosaicRuleWithTimeExtent(n,t),n?.multidimensionalDefinition){let{isOutside:e}=y(r,{multidimensionalDefinition:n.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:n}}_updateFeatureWithRasterAttributeTableValues(e,t){let n=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(n==null)return;let{features:r,fields:i}=n,a=i.map(e=>e.name).find(e=>e.toLowerCase()===`value`);if(!a)return;let o=r.filter(e=>e.attributes[a]===(t==null?null:parseInt(t,10)));o&&o[0]&&i.forEach(t=>{let n=pe+t.name;e.attributes[n]=o[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;let n=t.split(/,\s*/).map(e=>parseFloat(e)),r=n.map(e=>[e]),i=n.map(e=>({minValue:e,maxValue:e,noDataValue:null})),a=new P({height:1,width:1,pixelType:`f32`,pixels:r,statistics:i});this.pixelFilter!=null&&this.pixelFilter({pixelBlock:a,extent:new m(0,0,0,0,this.spatialReference)});let o=this.serviceDataType===`esriImageServiceDataTypeVector-MagDir`?[a.pixels[0][0],a.pixels[1][0]]:D([a.pixels[0][0],a.pixels[1][0]]);e.attributes[R.magnitude]=o[0],e.attributes[R.direction]=o[1]}_updateFeatureWithDomainValues(e){(this.fields&&this.fields.filter(e=>e.domain?.type===`coded-value`))?.forEach(t=>{let n=e.attributes[t.name];if(n!=null){let r=t.domain.codedValues.find(e=>e.code===n);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;let n=this.fieldsIndex;n!=null&&e.forEach(e=>{if(e?.attributes)for(let r of t){let t=n.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return e?.functionName!=null&&e.functionName.toLowerCase()!==`none`}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if(e===`Raw`)return e.replace(`Raw`,`None`);let n=e.toLowerCase().replaceAll(/ /gi,`_`);return t.has(n)?t.get(n):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty(`functionType`)}_isVectorDataSet(){return this.serviceDataType===`esriImageServiceDataTypeVector-UV`||this.serviceDataType===`esriImageServiceDataTypeVector-MagDir`}_applyMosaicAndRenderingRules(e){let{raster:t,mosaicRule:n,rasterFunction:r}=this;r&&e.rasterFunction==null&&(e.rasterFunction=r),n&&e.mosaicRule==null&&(e.mosaicRule=n),t&&e.raster==null&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){let t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){let{raster:t,mosaicRule:n}=this;n&&e.mosaicRule==null&&(e.mosaicRule=n),t&&e.raster==null&&(e.raster=t)}_readCapabilities(e){let t=e.capabilities?e.capabilities.toLowerCase().split(`,`).map(e=>e.trim()):[`image`,`catalog`],{currentVersion:n,maxRecordCount:r}=e,i=t.includes(`image`),a=e.serviceDataType===`esriImageServiceDataTypeElevation`,o=!!(e.spatialReference||e.extent?.spatialReference),s=t.includes(`edit`),c=t.includes(`mensuration`)&&o,l=e.mensurationCapabilities==null?[]:e.mensurationCapabilities.toLowerCase().split(`,`).map(e=>e.trim()),u=c&&l.includes(`basic`),d=this._isMosaicDataset(e)&&t.includes(`catalog`),f=t.includes(`download`),p=n>=10.7&&a||n>=11.4&&(a||c&&l.includes(`3d`)),m=d&&e.fields&&e.fields.length>0,h=m&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:i,supportsExportImage:i,supportsIdentify:i,supportsImageToMap:n>=11.2&&d,supportsImageToMapMultiray:n>=11.2&&d,supportsMapToImage:n>=11.2&&d,supportsFindImages:n>=11.2&&d,supportsGetImageUrl:n>=11.3&&f,supportsMeasure:c,supportsMeasureFromImage:n>=11.2,supportsDownload:f,supportsQuery:m,supportsGetSamples:n>=10.2&&i,supportsProject:n>=10.3&&i,supportsComputeStatisticsHistograms:n>=10.4&&i,supportsQueryBoundary:n>=10.6&&i,supportsCalculateVolume:p,supportsComputePixelLocation:n>=10.7&&d,supportsComputeAngles:n>=10.91,supportsQueryGPSInfo:n>=11.2&&d,supportsAdd:s,supportsDelete:s,supportsEditing:s,supportsUpdate:s,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:void 0,supportsStatisticsAggregatedIds:!!h?.supportsAggregateIds,supportsStatistics:!!h?.supportsStatistics,supportsOrderBy:!!h?.supportsOrderBy,supportsDistinct:!!h?.supportsDistinct,supportsPagination:!!h?.supportsPagination,supportsPaginationOnAggregatedQueries:!!h?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!h?.useStandardizedQueries,supportsPercentileStatistics:!!h?.supportsPercentileStatistics,supportsCentroid:!!h?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!h?.supportsQueryWithDistance,supportsOutDistance:!!h?.supportsOutDistance,supportsExtent:!!h?.supportsReturningQueryExtent,supportsGeometryProperties:!!h?.supportsReturningGeometryProperties,supportsHavingClause:!!h?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:h?.supportsSqlExpression??!!h,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!h?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:u,supportsAreaAndPerimeter:u,supportsPointOrCentroid:u,supportsHeightFromBaseAndTop:c&&l.includes(`base-top height`),supportsHeightFromBaseAndTopShadow:c&&l.includes(`base-top shadow height`),supportsHeightFromTopAndTopShadow:c&&l.includes(`top-top shadow height`),supports3D:c&&l.includes(`3d`)}}}};e([l({clonable:!1})],Q.prototype,`_functionRasterInfos`,void 0),e([l({readOnly:!0})],Q.prototype,`_serviceSupportsMosaicRule`,void 0),e([X(`_serviceSupportsMosaicRule`,[`currentVersion`,`fields`])],Q.prototype,`readServiceSupportsMosaicRule`,null),e([l({readOnly:!0})],Q.prototype,`_rasterFunctionNamesIndex`,null),e([l()],Q.prototype,`_projectedFullExtent`,void 0),e([l({clonable:!1})],Q.prototype,`_exportTileQueue`,void 0),e([l()],Q.prototype,`adjustAspectRatio`,void 0),e([l({type:[d],json:{write:!0}})],Q.prototype,`bandIds`,void 0),e([X(`bandIds`)],Q.prototype,`readBandIds`,null),e([l({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,void 0),e([X(`service`,`capabilities`,[`capabilities`,`currentVersion`,`serviceDataType`])],Q.prototype,`readCapabilities`,null),e([l({type:Number})],Q.prototype,`compressionQuality`,void 0),e([Z(`compressionQuality`)],Q.prototype,`writeCompressionQuality`,null),e([l({type:Number})],Q.prototype,`compressionTolerance`,void 0),e([Z(`compressionTolerance`)],Q.prototype,`writeCompressionTolerance`,null),e([l({json:{read:{source:`copyrightText`}}})],Q.prototype,`copyright`,void 0),e([l({readOnly:!0})],Q.prototype,`defaultMosaicRule`,void 0),e([X(`defaultMosaicRule`,[`defaultMosaicMethod`])],Q.prototype,`readDefaultMosaicRule`,null),e([l({type:String,json:{name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([l({readOnly:!0,constructOnly:!0})],Q.prototype,`exportImageServiceParameters`,void 0),e([l()],Q.prototype,`rasterInfo`,void 0),e([l({readOnly:!0,type:[ee]})],Q.prototype,`fields`,void 0),e([l({readOnly:!0})],Q.prototype,`fieldsIndex`,null),e([l({type:[`png`,`png8`,`png24`,`png32`,`jpg`,`bmp`,`gif`,`jpgpng`,`lerc`,`tiff`,`bip`,`bsq`],json:{write:!0}})],Q.prototype,`format`,null),e([X(`service`,`format`,[`serviceDataType`,`allowRasterFunction`])],Q.prototype,`readFormat`,null),e([l({type:m})],Q.prototype,`fullExtent`,void 0),e([l({readOnly:!0})],Q.prototype,`hasMultidimensions`,void 0),e([l({json:{read:{source:`maxImageHeight`}}})],Q.prototype,`imageMaxHeight`,void 0),e([l({json:{read:{source:`maxImageWidth`}}})],Q.prototype,`imageMaxWidth`,void 0),e([l({type:String,json:{type:F.jsonValues,read:F.read,write:F.write}})],Q.prototype,`interpolation`,void 0),e([l()],Q.prototype,`minScale`,void 0),e([X(`service`,`minScale`)],Q.prototype,`readMinScale`,null),e([l()],Q.prototype,`maxScale`,void 0),e([X(`service`,`maxScale`)],Q.prototype,`readMaxScale`,null),e([l({type:N})],Q.prototype,`mosaicRule`,null),e([X(`mosaicRule`,[`mosaicRule`,`defaultMosaicMethod`])],Q.prototype,`readMosaicRule`,null),e([Z(`mosaicRule`)],Q.prototype,`writeMosaicRule`,null),e([l()],Q.prototype,`multidimensionalInfo`,void 0),e([l({type:re,json:{write:!0}})],Q.prototype,`multidimensionalSubset`,void 0),e([l({json:{type:[Number,[Number]],write:!0}})],Q.prototype,`noData`,void 0),e([l({type:String,json:{type:I.jsonValues,read:I.read,write:I.write}})],Q.prototype,`noDataInterpretation`,void 0),e([l({type:String,readOnly:!0,json:{read:{source:[`fields`]}}})],Q.prototype,`objectIdField`,void 0),e([X(`objectIdField`)],Q.prototype,`readObjectIdField`,null),e([l({readOnly:!0})],Q.prototype,`geometryType`,void 0),e([l({})],Q.prototype,`typeIdField`,void 0),e([l({})],Q.prototype,`types`,void 0),e([l({readOnly:!0})],Q.prototype,`parsedUrl`,null),e([l({type:Function})],Q.prototype,`pixelFilter`,void 0),e([l()],Q.prototype,`raster`,void 0),e([l({readOnly:!0})],Q.prototype,`sourceType`,void 0),e([X(`sourceType`,[`serviceSourceType`,`fields`])],Q.prototype,`readSourceType`,null),e([l()],Q.prototype,`viewId`,void 0),e([l({types:G})],Q.prototype,`renderer`,null),e([l({types:G,json:{name:`layerDefinition.drawingInfo.renderer`,origins:{"web-scene":{types:_e,name:`layerDefinition.drawingInfo.renderer`,write:{overridePolicy(e){return{enabled:e&&e.type!==`vector-field`}}}}}}})],Q.prototype,`internalRenderer`,null),e([X(`internalRenderer`)],Q.prototype,`readRenderer`,null),e([Z(`internalRenderer`)],Q.prototype,`writeRenderer`,null),e([l({clonable:!1})],Q.prototype,`symbolizer`,void 0),e([l(O)],Q.prototype,`opacity`,void 0),e([l({readOnly:!0})],Q.prototype,`rasterFields`,null),e([l({constructOnly:!0})],Q.prototype,`rasterFunctionInfos`,void 0),e([l({type:z,json:{name:`renderingRule`}})],Q.prototype,`rasterFunction`,null),e([X(`rasterFunction`,[`renderingRule`,`rasterFunctionInfos`])],Q.prototype,`readRasterFunction`,null),e([l({readOnly:!0})],Q.prototype,`serviceDataType`,void 0),e([l({readOnly:!0,type:_})],Q.prototype,`spatialReference`,void 0),e([X(`spatialReference`,[`spatialReference`,`extent`])],Q.prototype,`readSpatialReference`,null),e([l({type:L.apiValues,json:{read:L.read,type:L.jsonValues}})],Q.prototype,`pixelType`,void 0),e([Z(`pixelType`)],Q.prototype,`writePixelType`,null),e([l({constructOnly:!0,type:me})],Q.prototype,`serviceRasterInfo`,void 0),e([l()],Q.prototype,`sourceJSON`,void 0),e([l(k)],Q.prototype,`url`,void 0),e([l({readOnly:!0})],Q.prototype,`version`,void 0),e([X(`version`,[`currentVersion`,`fields`,`timeInfo`])],Q.prototype,`readVersion`,null),Q=e([u(`esri.layers.mixins.ArcGISImageService`)],Q);function $(e){return e?.path??``}return Q};export{Ze as ArcGISImageService};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import n from"../../request.js";import r from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import a from"../../core/Logger.js";import{QueueProcessor as o}from"../../core/QueueProcessor.js";import{watch as s}from"../../core/reactiveUtils.js";import{urlToObject as c}from"../../core/urlUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{Integer as d,ensureClass as f}from"../../core/accessorSupport/ensureType.js";import{runUntracked as p}from"../../core/accessorSupport/tracking.js";import m from"../../geometry/Extent.js";import h from"../../geometry/Point.js";import g from"../../geometry/Polygon.js";import _ from"../../geometry/SpatialReference.js";import{srToRESTValue as v}from"../../geometry/support/spatialReferenceUtils.js";import{intersectMultimensionalSubset as y,getEffectiveMultidimensionalDefinition as b,getSubsetVariablesFromMdInfo as x,getDefaultMultidimensionalDefinition as S}from"../raster/datasets/multidimensionalUtils.js";import{decode as C,getFormat as w}from"../raster/formats/RasterCodec.js";import{convertPixelSize as T}from"../raster/functions/clipUtils.js";import{mosaicPixelData as E}from"../raster/functions/pixelUtils.js";import{uvComponentToVector as D}from"../raster/functions/vectorFieldUtils.js";import{opacity as O,url as k}from"../support/commonProperties.js";import A from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as j}from"../support/ExportImageServiceParameters.js";import ee from"../support/Field.js";import te from"../support/FieldsIndex.js";import{createBitmap as M}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as ne}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import re from"../support/MultidimensionalSubset.js";import P from"../support/PixelBlock.js";import{interpolationKebab as F,noDataInterpretationKebab as I,pixelTypeKebabDict as L}from"../support/rasterEnums.js";import{getServicePixelValueField as ie,getItemPixelValueField as ae,getRawServicePixelValueField as oe,getProcessedServicePixelValueField as se,getMagnitudeField as ce,getDirectionField as le,getMultidimensionalFields as ue,getRasterAttributeTableFields as de,addMultidimensionalFieldValues as fe,commonRasterFieldNames as R,rasterFieldPrefix as pe}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import me from"../support/RasterInfo.js";import{createDefaultRenderer as B,getDefaultBandCombination as V,getSupportedRendererTypes as H,getField as U,matchPresetRenderer as he,normalizeRendererJSON as ge}from"../../renderers/support/rasterRendererHelper.js";import W from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as G,websceneRasterRendererTypes as _e,read as ve}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as ye,computeAngles as be,computePixelSpaceLocations as xe,computeHistograms as Se,computeStatisticsHistograms as Ce,measureHeight as we,measureAreaAndPerimeter as Te,measureDistanceAndAngle as Ee,measurePointOrCentroid as De,measureLengthFromImage as Oe,measureAreaFromImage as ke,getImageSpatialReferenceQueryParameter as Ae,getSamples as je,identify as K,imageToMap as Me,imageToMapMultiray as Ne,mapToImage as Pe,findImages as Fe,getImageUrl as Ie,queryBoundary as Le,queryGPSInfo as Re}from"../../rest/imageService.js";import{fetchServiceRasterInfo as q,generateRasterInfo as ze,patchServiceInfo as Be}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Ve}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as J}from"../../rest/query/executeForCount.js";import{executeForExtent as He}from"../../rest/query/executeForExtent.js";import{executeForIds as Ue}from"../../rest/query/executeForIds.js";import{executeQueryJSON as We}from"../../rest/query/executeQueryJSON.js";import Ge from"../../rest/support/FeatureSet.js";import Ke from"../../rest/support/ImageIdentifyParameters.js";import Y from"../../rest/support/Query.js";import qe from"../../rest/support/StatisticDefinition.js";import{reader as X}from"../../core/accessorSupport/decorators/reader.js";import{writer as Z}from"../../core/accessorSupport/decorators/writer.js";const Je=4096,Ye=new Set([`png`,`png8`,`png24`,`png32`,`jpg`,`bmp`,`gif`,`jpgpng`,`lerc`,`tiff`]);function Xe(e){let t=JSON.stringify(e),n=t.includes(`"rasterFunctionDefinition":{`),r=(n?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi))?.map(e=>n?e.slice(8,-18):e.slice(18,-1));return r?r.join(`/`):null}const Ze=Ze=>{let Qe=Ze,Q=class extends Qe{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this._exportTileQueue=new o({concurrency:4,process:(e,t)=>this._fetchPixels(e.extent,e.width,e.height,{...e.options,signal:t})}),this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType=`polygon`,this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set(`exportImageServiceParameters`,new j({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){let e=new Map;return!this.rasterFunctionInfos||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.length<1||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,`_`),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(e=>typeof e==`number`))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,n){e!=null&&this.format!==`lerc`&&(t[n]=e)}writeCompressionTolerance(e,t,n){this.format===`lerc`&&e!=null&&(t[n]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?p(()=>N.fromJSON(t)):null}get fieldsIndex(){return this.fields?new te(this.fields):null}set format(e){e&&Ye.has(e.toLowerCase())&&this._set(`format`,e.toLowerCase())}readFormat(e,t){return t.serviceDataType===`esriImageServiceDataTypeVector-UV`||t.serviceDataType===`esriImageServiceDataTypeVector-MagDir`||this.pixelFilter!=null||t.allowRasterFunction===!1?`lerc`:`jpgpng`}get isRenderedFormat(){return!this.format||this.format.includes(`jpg`)||this.format.includes(`png`)}readMinScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}readMaxScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set(`mosaicRule`,t)}readMosaicRule(e,t){let n=e||t.mosaicRule;return n?N.fromJSON(n):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,n){let{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[n]=r.toJSON())}readObjectIdField(e,t){return e||=t.fields.find(e=>e.type===`esriFieldTypeOID`||e.type===`oid`)?.name,e}get parsedUrl(){return c(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?`mosaic-dataset`:`raster-dataset`}get renderer(){let{activePresetRendererName:e,presetRenderers:t}=this;return e?(t?.find(({name:t})=>t===e))?.renderer.clone():this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set(`internalRenderer`,e)}readRenderer(e,t,n){let r=t?.layerDefinition?.drawingInfo?.renderer,i=ve(r,n);return i==null?null:(i.type===`vector-field`&&t.symbolTileSize&&!r.symbolTileSize&&(i.symbolTileSize=t.symbolTileSize),ne(i)||a.getLogger(this).warn(`ArcGISImageService`,`Imagery layer doesn't support given renderer type.`),i)}writeRenderer(e,t,n){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON()}get rasterFields(){let e=this.fields?.map(e=>e.clone())??[];e.push(ie()),this.sourceType===`mosaic-dataset`&&this.fields?.length&&e.push(ae()),this.version>=10.4&&this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.some(({name:e})=>e.toLowerCase()===`none`)&&e.push(oe()),this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.filter(({name:e})=>e.toLowerCase()!==`none`).forEach(({name:t})=>e.push(se(t)));let{rasterInfo:t}=this;if(this._isVectorDataSet()){let n=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=ce(n),i=le();e.push(r,i)}if(t?.multidimensionalInfo&&this.sourceType===`raster-dataset`){let n=ue(t.multidimensionalInfo);e.push(...n)}let n=t?.attributeTable;if(n!=null){let t=de(n);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set(`rasterFunction`,t)}readRasterFunction(e,t){let n=t.rasterFunctionInfos,r=t.renderingRule,i=r!=null&&Object.keys(r).length>0;return!i&&(!n?.length||n[0].name===`None`)?null:this._isRFTJson(r)?z.fromJSON({rasterFunctionDefinition:r}):z.fromJSON(i?r:{rasterFunctionInfos:n})}readSpatialReference(e,t){let n=e||t.extent.spatialReference;return n?_.fromJSON(n):null}writePixelType(e,t,n){(this.serviceRasterInfo==null||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[n]=L.toJSON(e))}readVersion(e,t){let n=t.currentVersion;return n||=t.hasOwnProperty(`fields`)||t.hasOwnProperty(`timeInfo`)?10:9.3,n}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let n=e,{renderer:r,symbolizer:i,pixelFilter:a}=this,{isRawData:o}=e;if(o&&this.format!==`lerc`&&(r??=B(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),i||=(this.symbolizer=new W({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),this.symbolizer)),(o||!this.isRenderedFormat)&&r&&i&&!a){await this._updateSymbolizer(i,r);let a=this.bandIds?.length?this.bandIds:V(this.rasterInfo);n=await this._symbolize({pixelData:e,bandIds:a,symbolizer:i},t)}return n}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r(`imagery-layer:compute-pixel-space-locations`,`this operation is not supported on the input image service`);return e=i(e),this.mosaicRule&&e.mosaicRule==null&&(e.mosaicRule=this.mosaicRule),ye(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r(`imagery-layer:compute-angles`,`this operation is not supported on the input image service`);return be(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r(`imagery-layer:compute-pixel-space-locations`,`this operation is not supported on the input image service`);return xe(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r(`imagery-layer:compute-histograms`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicAndRenderingRules(e),Se(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r(`imagery-layer:compute-statistics-histograms`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicAndRenderingRules(e),Ce(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){let n=await this._fetchCapabilities(t?.signal);if(!(e.operationType===`base-and-top`?n.mensuration.supportsHeightFromBaseAndTop:e.operationType===`base-and-top-shadow`?n.mensuration.supportsHeightFromBaseAndTopShadow:n.mensuration.supportsHeightFromTopAndTopShadow))throw new r(`imagery-layer:measure-height`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),we(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){let n=await this._fetchCapabilities(t?.signal);if(!n.mensuration.supportsAreaAndPerimeter||e.is3D&&!n.mensuration.supports3D)throw new r(`imagery-layer:measure-area-and-perimeter`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),Te(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){let n=await this._fetchCapabilities(t?.signal);if(!n.mensuration.supportsDistanceAndAngle||e.is3D&&!n.mensuration.supports3D)throw new r(`imagery-layer:measure-distance-and-angle`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),Ee(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){let n=await this._fetchCapabilities(t?.signal);if(!n.mensuration.supportsPointOrCentroid||e.is3D&&!n.mensuration.supports3D)throw new r(`imagery-layer:measure-point-or-centroid`,`this operation is not supported on the input image service`);return e=i(e),this._applyMosaicRule(e),De(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r(`imagery-layer:measure-length-from-image`,`this operation is not supported on the input image service`);if(e.geometry.type!==`polyline`)throw new r(`imagery-layer:measure-length-from-image`,`this input geometry must be a polyline`);return Oe(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r(`imagery-layer:measure-area-from-image`,`this operation is not supported on the input image service`);if(e.geometry.type!==`polygon`)throw new r(`imagery-layer:measure-area-from-image`,`this input geometry must be a polygon`);return ke(this.url,e,this._getRequestOptions(t))}getField(e){let{fieldsIndex:t}=this;return t?.get(e)}getFieldDomain(e,t){let n=this.getField(e);return n?n.domain:null}async internalFetchImage(e,t,n,r={}){await this._updateCurrentRasterInfo();let{exportImageServiceParameters:i}=this,a=!1;if(r.requestRawData&&(await this._initJobHandler(),!i.requestRawData&&this.format!==`lerc`)){a=!0,i.requestRawData=!0;let e=this.bandIds;if(!e?.length){let t=V(this.rasterInfo);Array.from({length:this.rasterInfo.bandCount},(e,t)=>t)?.join(`,`)!==t?.join(`,`)&&(e=t)}i.rawDataRequestBandIds=e}let o=this.getExportImageServiceParameters(e,t,n,r.timeExtent);if(a&&(i.requestRawData=!1,i.rawDataRequestBandIds=null),o==null){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){let e=document.createElement(`canvas`);if(e.width=t,e.height=n,r.returnImageBitmap){let{bitmap:t}=await M(e,`${$(this.parsedUrl)}/exportImage`,r);return{imageBitmap:t}}return{imageOrCanvasElement:e}}let{bandIds:i,rasterInfo:a}=this,o=(i?.length||a.bandCount)??0,s=t*n,c=a.pixelType,l=[];for(let e=0;e<o;e++)l.push(P.createEmptyBand(c,s));return{pixelData:{pixelBlock:new P({width:t,height:n,pixels:l,mask:new Uint8Array(s),pixelType:c}),extent:e}}}let s=!!r.requestAsImageElement&&!this.pixelFilter,c=s&&!!r.returnImageBitmap,l={imageServiceParameters:o,imageProps:{extent:e,width:t,height:n,format:this.format},requestAsImageElement:s,returnImageBitmap:c,signal:r.signal};return this._requestArrayBuffer(l)}async fetchPixels(e,t,n,i={}){await this._initJobHandler(),i.applyRendering&&await this._updateCurrentRasterInfo();let{imageMaxWidth:a,imageMaxHeight:o}=this;if(t<=a&&n<=o)return this._exportTileQueue.push({extent:e,width:t,height:n,options:i},{signal:i.signal});if(t>Je||n>Je||a<512||o<512)throw new r(`imagery-layer:fetch-pixels`,`The image service has a maximum export size of ${a}x${o}. The requested size of ${t}x${n} exceeds this limit.`);let{xmin:s,ymax:c,spatialReference:l}=this._projectedFullExtent??this.fullExtent;if(!l?.equals(e.spatialReference)){let{projectLoad:t,projectExecute:n}=await import(`../../geometry/operators/projectOperator.js`);await t();let r=n(this.fullExtent,e.spatialReference);s=r.xmin,c=r.ymax,this._projectedFullExtent=r}let u=e.width/t,d=e.height/n,f=Math.floor((e.xmin-s)/u),p=Math.floor((c-e.ymax)/d),h=f+t,g=p+n,_=Math.floor(f/512),v=Math.floor(p/512),y=Math.ceil(h/512)-1,b=Math.ceil(g/512)-1,x=512*u,S=512*d,C=[];for(let t=v;t<=b;t++){let n=c-t*S,r=n-S;for(let t=_;t<=y;t++){let a=s+t*x,o=new m({xmin:a,ymin:r,xmax:a+x,ymax:n,spatialReference:e.spatialReference});C.push(this._exportTileQueue.push({extent:o,width:512,height:512,options:i},{signal:i.signal}))}}let w=await Promise.all(C);return w.some(e=>e.pixelBlock==null)?{extent:e,pixelBlock:null}:{extent:e,pixelBlock:this._rasterJobHandler?await this._rasterJobHandler.mosaicPixelData({pixelBlocks:w,destExtent:e},{signal:i.signal,transferPixelsToWorker:!0}):E(w,e)?.pixelBlock}}async _fetchPixels(e,t,n,r={}){let i=r.applyRendering?void 0:new j({layer:this,requestRawData:!0,interpolation:r.interpolation??`nearest`,bandIds:r.bandIds??[]}),a=this.getExportImageServiceParameters(e,t,n,r.timeExtent,i);if(a==null)return{extent:e,pixelBlock:null};delete a.pixelType,r.bandIds||delete a.bandIds,delete a.compressionQuality;let o={imageServiceParameters:a,imageProps:{extent:e,width:t,height:n,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:s}=await this._requestArrayBuffer(o);return s??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return n($(this.parsedUrl)+`/keyProperties`,{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r(`#fetchRasterAttributeTable()`,`Failed to get rasterAttributeTable`)):n($(this.parsedUrl)+`/rasterAttributeTable`,{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Ge.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){let n=this._getQueryParams(),r={...t,query:n};return Ve($(this.parsedUrl),e,r)}async getCatalogItemICSInfo(e,t){let{data:r}=await n($(this.parsedUrl)+`/`+e+`/info/ics`,{query:this._getQueryParams(),...t}),i=r?.ics;if(!i)return;let a=null;try{a=(await n($(this.parsedUrl)+`/`+e+`/info`,{query:this._getQueryParams(),...t})).data.extent}catch{}if(!a?.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};let o=this.version>=10.7?n($(this.parsedUrl)+`/`+e+`/info/icstopixel`,{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},s=a.spatialReference,c={geometries:JSON.stringify({geometryType:`esriGeometryEnvelope`,geometries:[a]}),inSR:v(s),outSR:`0:`+e},l=n($(this.parsedUrl)+`/project`,{query:this._getQueryParams(c),...t}).then(e=>e.data).catch(()=>({})),u=(a.xmin+a.xmax)/2,d=(a.ymax-a.ymin)/6,f=a.ymin+d,p=[];for(let e=0;e<5;e++)p.push({x:u,y:f+d*e});let h={geometries:JSON.stringify({geometryType:`esriGeometryPoint`,geometries:p}),inSR:v(s),outSR:`0:`+e},g=n($(this.parsedUrl)+`/project`,{query:this._getQueryParams(h),...t}).then(e=>e.data).catch(()=>({})),y=await Promise.all([o,l,g]),b=y[0].ipxf;if(b==null){let e=i.geodataXform?.xf_0;e?.name?.toLowerCase()===`topup`&&e?.coefficients?.length===6&&(b={affine:{name:`ics [sensor: Frame] to pixel (column, row) transformation`,coefficients:e.coefficients,cellsizeRatio:0,type:`GeometricXform`}})}let x=m.fromJSON(y[1]?.geometries?.[0]);x&&(x.spatialReference=new _({wkid:0,imageCoordinateSystem:i}));let S=y[2].geometries?y[2].geometries.filter(e=>e?.x!=null&&e.y!=null&&e.x!==`NaN`&&e.y!==`NaN`):[],C=S.length;if(C<3)return{ics:i,icsToPixelTransform:b,icsExtent:x,northDirection:null};let w=0,T=0,E=0,D=0;for(let e=0;e<C;e++)w+=S[e].x,T+=S[e].y,E+=S[e].x*S[e].x,D+=S[e].x*S[e].y;let O=(C*D-w*T)/(C*E-w*w),k=0,A=S[4].x>S[0].x,j=S[4].y>S[0].y;return O===1/0?k=j?90:270:O===0?k=A?0:180:O>0?k=A?Math.atan(O)*180/Math.PI:Math.atan(O)*180/Math.PI+180:O<0&&(k=j?180+Math.atan(O)*180/Math.PI:360+Math.atan(O)*180/Math.PI),{ics:i,icsToPixelTransform:b,icsExtent:x,northDirection:k}}async generateRasterInfo(e,t){let n=f(z,e),i={...t,query:this._getQueryParams()};if(!n||n.functionName?.toLowerCase()===`none`||this._isVectorFieldResampleFunction(n))return this.serviceRasterInfo??q($(this.parsedUrl),this.sourceJSON,i);let a=Xe(n);if(!a)throw new r(`imagery-layer:generate-raster-info`,`the rendering rule is not supported`);if(this._functionRasterInfos[a])return this._functionRasterInfos[a];let o=ze($(this.parsedUrl),n,i);this._functionRasterInfos[a]=o;try{let t=await o,{rasterFunction:n}=this;return(n===e||JSON.stringify(n)===JSON.stringify(e))&&JSON.stringify(this.rasterInfo)!==JSON.stringify(t)&&(this.rasterInfo=t),t}catch(e){throw this._functionRasterInfos[a]=null,e}}getExportImageServiceParameters(e,t,n,r,i){e=e.clone().shiftCentralMeridian();let a=Ae(e.spatialReference,$(this.parsedUrl));i??=this.exportImageServiceParameters;let o=i.toJSON(),{bandIds:s,noData:c}=o,{renderingRule:l}=o,u=this.rasterFunction?.rasterFunctionDefinition,d=this.renderer?.type,f=!d||d===`raster-stretch`||d===`raster-colormap`||d===`unique-value`||d===`class-breaks`||d===`raster-shaded-relief`;if(s?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&f){let e={rasterFunction:`ExtractBand`,rasterFunctionArguments:{BandIds:s}};if(l.rasterFunction===`Stretch`)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if(l.rasterFunction===`Colormap`){let t=l.rasterFunctionArguments.Raster;t?.rasterFunction===`Stretch`?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;o.bandIds=void 0}else o.bandIds=s?.join(`,`);Array.isArray(c)&&c.length>0&&(o.noData=c.join(`,`));let p=this._processMultidimensionalIntersection(null,r,i.mosaicRule);if(p.isOutSide)return null;o.mosaicRule=p.mosaicRule==null?null:JSON.stringify(p.mosaicRule),r=p.timeExtent,o.renderingRule=this._getRenderingRuleString(z.fromJSON(l));let m={};if(r!=null){let{start:e,end:t}=r.toJSON();e&&t&&e===t?m.time=``+e:(e!=null||t!=null)&&(m.time=`${e??`null`},${t??`null`}`)}return{bbox:e.xmin+`,`+e.ymin+`,`+e.xmax+`,`+e.ymax,bboxSR:a,imageSR:a,size:t+`,`+n,...o,...m}}async getSamples(e,t){if(!(await this._fetchCapabilities(t?.signal))?.operations.supportsGetSamples)throw new r(`imagery-layer:get-samples`,`getSamples operation is not supported on the input image service`);e=i(e);let{raster:n}=this;return n&&e.raster==null&&(e.raster=n),je(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r(`imagery-layer:identify`,`identify operation is not supported on the input image service`);e=i(e),this.version<10.91&&e.geometry?.type===`extent`&&(e.geometry=g.fromExtent(e.geometry));let n=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(n.isOutSide)throw new r(`imagery-layer:identify`,`the request cannot be fulfilled when falling outside of the multidimensional subset`);e.timeExtent=n.timeExtent,e.mosaicRule=n.mosaicRule;let{raster:a,rasterFunction:o}=this;return o&&e.rasterFunction==null&&(e.rasterFunction=o),a&&e.raster==null&&(e.raster=a),K(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r(`imagery-layer:image-to-map`,`imageToMap operation is not supported on the input image service`);return Me($(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r(`imagery-layer:image-to-map-multiray`,`imageToMapMultiray operation is not supported on the input image service`);return Ne($(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r(`imagery-layer:map-to-image`,`mapToImage operation is not supported on the input image service`);return Pe($(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r(`imagery-layer:find-images`,`findImages operation is not supported on the input image service`);return Fe($(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r(`imagery-layer:get-image-url`,`getImageUrl operation is not supported on the input image service`);return Ie($(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Y({outFields:[`*`],returnGeometry:!0,where:this.definitionExpression||`1=1`})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r(`imagery-layer:query-boundary`,`queryBoundary operation is not supported on the input image service`);return e??={outSpatialReference:this.spatialReference},Le($(this.parsedUrl),e,this._getRequestOptions(t))}async queryExtent(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));let{where:n,objectIds:r,geometry:i,timeExtent:a,start:o,num:s,pixelSize:c}=e,l=n!=null&&n!==`1=1`,u=r!=null&&r.length>0,d=i!=null&&(i.type!==`extent`||!i.equals(this.fullExtent)),f=c!=null,p=o!=null||s!=null,{timeInfo:m}=this,h=a!=null&&m!=null&&!a.equals(m.fullTimeExtent);if(!(l||u||d||f||h||p)){let n=await J(this.url,e,t),{outSpatialReference:r}=e;if(!r||r.equals(this.spatialReference))return{count:n,extent:this.fullExtent.clone()};let{projectLoad:i,projectExecute:a}=await import(`../../geometry/operators/projectOperator.js`);return await i(),{count:n,extent:a(this.fullExtent,r)}}return He(this.url,e,t)}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));let n=await We(this.url,e,t),r=this.graphicOrigin;return n.features.forEach(e=>{e.layer=this,e.origin=r}),n}async fetchMaxPixelSize(e,t){let n=await this._fetchCapabilities(t?.signal),r=this.fields?.find(({name:e})=>e.toLowerCase()===`maxps`);if(!n.query.supportsStatistics||!r)return null;let i=`maxPixelSize`,a=(await this.queryRasters({where:`1=1`,outStatistics:[new qe({statisticType:`max`,onStatisticField:r.name,outStatisticFieldName:i})],returnGeometry:!1},t)).features[0]?.attributes?.[i];if(!a)return null;let o=new h({x:a,y:a,spatialReference:this.spatialReference});return T(o,e)}async queryObjectIds(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Ue(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r(`imagery-layer:query-gps-info`,`queryGPSInfo operation is not supported on the input image service`);return e??={where:`1=1`},Re($(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),J(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new r(`imagery-layer: query-visible-rasters`,`missing query parameter`);await this.load();let{pixelSize:n,returnDomainValues:i,returnTopmostRaster:a,showNoDataRecords:o}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1},s=!1,c=null,l=null,u=R.servicePixelValue.toLowerCase(),d=this._rasterFunctionNamesIndex;if(e.outFields!=null&&(s=e.outFields.some(e=>!e.toLowerCase().startsWith(u)),this.version>=10.4)){let t=e.outFields.filter(e=>e.toLowerCase().startsWith(u)&&e.length>u.length).map(e=>{let t=e.slice(u.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]});c=t.map(e=>new z({functionName:e[0]})),l=t.map(e=>e[1]);let{rasterFunction:n}=this;c.length===0?n?.functionName?(c.push(n),l.push(n.functionName)):c=null:n?.functionName&&!c.some(e=>e.functionName===n.functionName)&&(c.push(n),l.push(n.functionName))}let f=e.outSpatialReference==null||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:p}=this,m=e.timeExtent||this.timeExtent;if(p){let{isOutside:t,intersection:n}=y(p,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r(`imagery-layer:query-visible-rasters`,`the request cannot be fulfilled when falling outside of the multidimensional subset`);n?.timeExtent!=null&&(m=n.timeExtent)}let h=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,m),_=e.geometry;this.version<10.91&&_?.type===`extent`&&(_=g.fromExtent(_));let v=this._getQueryParams({geometry:_,timeExtent:m,mosaicRule:h,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:c,pixelSize:n,returnCatalogItems:s,returnGeometry:f,raster:this.raster,maxItemCount:a?1:null});delete v.f;let x=new Ke(v);try{await this._generateRasterInfo(this.rasterFunction);let n=await K(this.url,x,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,a=n.value!=null&&n.value.toLowerCase().includes(`nodata`),c=s&&!f&&n?.catalogItems?.features.length&&(o||!a),u=this.multidimensionalInfo&&this.sourceType===`raster-dataset`?b({rasterInfo:this.rasterInfo,multidimensionalDefinition:h?.multidimensionalDefinition,timeExtent:m,multidimensionalSubset:this.multidimensionalSubset}):null;if(!c)return this._processVisibleRastersResponse(n,{returnDomainValues:i,templateRRFunctionNames:l,showNoDataRecords:o,templateFields:r,effectiveMultidimensionalDefinition:u});let d=this.objectIdField||`ObjectId`,p=n.catalogItems?.features??[],g=p.map(e=>e.attributes?.[d]),_=new Y({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[d]}),v=await this.queryRasters(_);return v?.features?.length&&v.features.forEach(t=>{p.forEach(n=>{n.attributes[d]===t.attributes[d]&&t.geometry&&(n.geometry=t.geometry.clone(),e.outSpatialReference!=null&&(n.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(n,{returnDomainValues:i,templateRRFunctionNames:l,showNoDataRecords:o,templateFields:r,effectiveMultidimensionalDefinition:u})}catch{throw new r(`imagery-layer:query-visible-rasters`,`encountered error when querying visible rasters`)}}async fetchVariableStatisticsHistograms(e,t){let r=n($(this.parsedUrl)+`/statistics`,{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),i=n($(this.parsedUrl)+`/histograms`,{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),a=await Promise.all([r,i]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:a[0]||null,histograms:a[1]||null}}getMultidimensionalSubsetVariables(e){let t=e??this.serviceRasterInfo.multidimensionalInfo;return x(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e);let t=this.sourceJSON,n=this.serviceRasterInfo==null?q($(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set(`serviceRasterInfo`,e),this._set(`multidimensionalInfo`,e.multidimensionalInfo),Be(e,t),e)):Promise.resolve(this.serviceRasterInfo),r=!this.rasterInfo&&this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):Promise.resolve(this.rasterInfo),i=this.rasterFunctionInfos?.every(e=>e.functionType!=null)?null:this._getRasterFunctionInfos();return Promise.all([n,r,i]).then(e=>{e[1]?this._set(`rasterInfo`,e[1]):this._set(`rasterInfo`,e[0]),e[2]&&(t.rasterFunctionInfos=e[2],this.setAtOrigin(`rasterFunctionInfos`,e[2],`service`)),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set(`internalRenderer`,null),a.getLogger(this).warn(`ArcGISImageService`,`Switching to the default renderer. Renderer applied is not valid for this Imagery Layer`)),this._set(`internalRenderer`,this._configRenderer(this.renderer)),this.addHandles([s(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);let{serviceRasterInfo:n}=this;n.multidimensionalInfo!=null&&this._updateMultidimensionalDefinition(n)})}_combineMosaicRuleWithTimeExtent(e,t){let n=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(e==null||r==null||t==null||n?.startField==null)return e;let{startField:i}=n,a=r.variables.some(e=>e.dimensions.some(e=>e.name===i))?i:`StdTime`;if(e=e.clone(),this.sourceType===`mosaic-dataset`)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==a),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];let o=e.multidimensionalDefinition.filter(e=>e.dimensionName===a),s=t.start==null?null:t.start.getTime(),c=t.end==null?null:t.end.getTime(),l=s==null||c==null||s===c,u=l?[s||c]:[[s,c]],d=this.version>=10.8;if(o.length)o.forEach(e=>{e.dimensionName===a&&(d?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=l,e.values=u))});else if(!d){let t=e.multidimensionalDefinition.filter(e=>e.variableName!=null&&e.dimensionName==null);t.length?t.forEach(e=>{e.dimensionName=a,e.isSlice=l,e.values=u}):e.multidimensionalDefinition.push(new A({variableName:``,dimensionName:a,isSlice:l,values:u}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return e==null?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!!(e.variableName||e.dimensionName)),e.multidimensionalDefinition.length===0&&(e.multidimensionalDefinition=null)),this.sourceType!==`mosaic-dataset`&&e.multidimensionalDefinition==null?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r(`imagery-layer:query-rasters`,`query operation is not supported on the input image service`);let n=e==null?this.createQuery():f(Y,e);return t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:n,requestOptions:t}}_isSupportedRenderer(e){let{rasterInfo:t,rasterFunction:n}=this;return e.type===`unique-value`&&this._hasRasterFunction(n)&&t?.bandCount===1&&[`u8`,`s8`].includes(t.pixelType)||t!=null&&e!=null&&H(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){let{data:r,ssl:i}=await n($(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,`https:`))}if(t.capabilities?.toLowerCase().split(`,`).map(e=>e.trim()).indexOf(`tilesonly`)>-1)throw new r(`imagery-layer:fetch-service-info`,`use ImageryTileLayer to open tiles-only image services`);this.read(t,{origin:`service`,url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?e.serviceSourceType===`esriImageServiceSourceTypeMosaicDataset`:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;let t=this._isMosaicDataset(e),n=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||n}_isVectorFieldResampleFunction(e){if(e==null)return!1;let{functionName:t,functionArguments:n}=e,r=t?.toLowerCase()===`resample`,i=n?.ResampleType||n?.resampleType;return r&&(i===7||i===10)}_configRenderer(e){let{rasterInfo:t}=this,n=t.attributeTable,r=U(n,`red`)!=null&&U(n,`green`)!=null&&U(n,`blue`)!=null,i=!e&&t.colormap==null&&!r&&H(t).includes(`unique-value`);if(!(this.isRenderedFormat||this.pixelFilter)||this._isVectorDataSet()||i){let n=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=he({variableName:n,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>=3){let e=r?.bandIds??V(t);e&&(t.bandCount!==3||e[0]!==0||e[1]!==1||e[2]!==2)&&(this.bandIds=e)}e||=r?.renderer??B(t,{bandIds:this.bandIds,variableName:this.rasterFunction?null:n});let i=ge(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=i,this.symbolizer.rasterInfo=t):this.symbolizer=new W({rendererJSON:i,rasterInfo:t}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return e==null?e:{extent:e.extent&&e.extent.clone(),pixelBlock:e.pixelBlock==null?null:e.pixelBlock.clone()}}_getQueryParams(e){e?.renderingRule!=null&&typeof e.renderingRule!=`string`&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));let{raster:t,viewId:n}=this;return{raster:t,viewId:n,f:`json`,...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,n){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):C(e,t,n)}async _getRasterFunctionInfos(e){let t=this.sourceJSON.rasterFunctionInfos;return this.loaded||!t?.length?t:t&&this.version>=10.3?t.length===1&&t[0].name.toLowerCase()===`none`?[{thumbnail:``,functionType:0,...t[0]}]:(await n($(this.parsedUrl)+`/rasterFunctionInfos`,{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos:null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes(`png`))}async _requestArrayBuffer(e){let{imageProps:t,requestAsImageElement:i,returnImageBitmap:a,signal:o}=e;if(i&&this._canRequestImageElement(t.format)){let r=`${$(this.parsedUrl)}/exportImage`,{data:i}=await n(r,{responseType:a?`blob`:`image`,query:this._getQueryParams({f:`image`,...this.refreshParameters,...e.imageServiceParameters}),signal:o});if(i instanceof Blob){let{bitmap:e}=await M(i,r,{signal:o});return{imageBitmap:e,params:t}}return{imageOrCanvasElement:i,params:t}}let s=this._initJobHandler(),c=n($(this.parsedUrl)+`/exportImage`,{responseType:`array-buffer`,query:this._getQueryParams({f:`image`,...e.imageServiceParameters}),signal:o}),l=(await Promise.all([c,s]))[0].data,u=t.format||`jpgpng`,d=u;if(d!==`bsq`&&d!==`bip`&&(d=w(l)),!d)throw new r(`imagery-layer:fetch-image`,`unsupported format signature `+String.fromCharCode.apply(null,new Uint8Array(l)));let f={signal:o};return{pixelData:{pixelBlock:await this._decodePixelBlock(l,{width:t.width,height:t.height,format:u,applyJpegMask:!0},f),extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=S(e,{multidimensionalSubset:this.multidimensionalSubset});if(t!=null&&t.length>0){this.mosaicRule=this.mosaicRule||new N;let e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&this.rasterFunction.functionName?.toLowerCase()!==`none`&&t.forEach(e=>e.variableName=``),t=t.filter(({variableName:e,dimensionName:t})=>e&&e!==`*`||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,n){n||={};let r=e.value,{templateRRFunctionNames:i,showNoDataRecords:a,returnDomainValues:o,templateFields:s}=n,c=e.processedValues,l=e.catalogItems?.features,u=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,`, `))||[],d=this.objectIdField||`ObjectId`,f=typeof r==`string`&&r.toLowerCase().includes(`nodata`),p=[];if(r&&!l&&(!f||a)){let e={};e[d]=0;let i=new t({geometry:this.fullExtent,attributes:e});u=[r],l=[i],this.multidimensionalInfo&&this.sourceType===`raster-dataset`&&fe(this.rasterFields,e,n.effectiveMultidimensionalDefinition)}if(!l)return[];this._updateResponseFieldNames(l,s),f&&!a&&(l=[]);let{itemPixelValue:m,servicePixelValue:h}=R,g=this.rasterFields.some(e=>e.name===m),_=this.graphicOrigin;for(let e=0;e<l.length;e++){let t=l[e];if(r!=null){let n=u[e],o=this.rasterFunction&&c&&c.length>0&&i&&i.length>0&&i.includes(this.rasterFunction.functionName)?c[i.indexOf(this.rasterFunction.functionName)]:r;if(n.toLowerCase()===`nodata`&&!a)continue;g&&(t.attributes[m]=n),t.attributes[h]=o,this._updateFeatureWithMagDirValues(t,n);let s=this.fields&&this.fields.length>0,l=this.rasterFunction&&this.serviceRasterInfo.attributeTable!=null?s?n:r:o;this.rasterFunction||(l=s?n:r),this._updateFeatureWithRasterAttributeTableValues(t,l)}if(t.sourceLayer=t.layer=this,t.origin=_,o&&this._updateFeatureWithDomainValues(t),i&&c&&i.length===c.length)for(let e=0;e<i.length;e++){let n=`${R.servicePixelValue}.${i[e]}`;t.attributes[n]=c[e]}p.push(l[e])}return p}_processMultidimensionalIntersection(e,t,n){let{multidimensionalSubset:r}=this;if(!r)return n=this._combineMosaicRuleWithTimeExtent(n,t),{isOutSide:!1,timeExtent:t,mosaicRule:n};if(r){let{isOutside:n,intersection:i}=y(r,{geometry:e,timeExtent:t});if(n)return{isOutSide:!0,timeExtent:null,mosaicRule:null};i?.timeExtent!=null&&(t=i.timeExtent)}if(n=this._combineMosaicRuleWithTimeExtent(n,t),n?.multidimensionalDefinition){let{isOutside:e}=y(r,{multidimensionalDefinition:n.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:n}}_updateFeatureWithRasterAttributeTableValues(e,t){let n=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(n==null)return;let{features:r,fields:i}=n,a=i.map(e=>e.name).find(e=>e.toLowerCase()===`value`);if(!a)return;let o=r.filter(e=>e.attributes[a]===(t==null?null:parseInt(t,10)));o&&o[0]&&i.forEach(t=>{let n=pe+t.name;e.attributes[n]=o[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;let n=t.split(/,\s*/).map(e=>parseFloat(e)),r=n.map(e=>[e]),i=n.map(e=>({minValue:e,maxValue:e,noDataValue:null})),a=new P({height:1,width:1,pixelType:`f32`,pixels:r,statistics:i});this.pixelFilter!=null&&this.pixelFilter({pixelBlock:a,extent:new m({xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:this.spatialReference})});let o=this.serviceDataType===`esriImageServiceDataTypeVector-MagDir`?[a.pixels[0][0],a.pixels[1][0]]:D([a.pixels[0][0],a.pixels[1][0]]);e.attributes[R.magnitude]=o[0],e.attributes[R.direction]=o[1]}_updateFeatureWithDomainValues(e){(this.fields&&this.fields.filter(e=>e.domain?.type===`coded-value`))?.forEach(t=>{let n=e.attributes[t.name];if(n!=null){let r=t.domain.codedValues.find(e=>e.code===n);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;let n=this.fieldsIndex;n!=null&&e.forEach(e=>{if(e?.attributes)for(let r of t){let t=n.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return e?.functionName!=null&&e.functionName.toLowerCase()!==`none`}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if(e===`Raw`)return e.replace(`Raw`,`None`);let n=e.toLowerCase().replaceAll(/ /gi,`_`);return t.has(n)?t.get(n):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty(`functionType`)}_isVectorDataSet(){return this.serviceDataType===`esriImageServiceDataTypeVector-UV`||this.serviceDataType===`esriImageServiceDataTypeVector-MagDir`}_applyMosaicAndRenderingRules(e){let{raster:t,mosaicRule:n,rasterFunction:r}=this;r&&e.rasterFunction==null&&(e.rasterFunction=r),n&&e.mosaicRule==null&&(e.mosaicRule=n),t&&e.raster==null&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){let t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){let{raster:t,mosaicRule:n}=this;n&&e.mosaicRule==null&&(e.mosaicRule=n),t&&e.raster==null&&(e.raster=t)}_readCapabilities(e){let t=e.capabilities?e.capabilities.toLowerCase().split(`,`).map(e=>e.trim()):[`image`,`catalog`],{currentVersion:n,maxRecordCount:r}=e,i=t.includes(`image`),a=e.serviceDataType===`esriImageServiceDataTypeElevation`,o=!!(e.spatialReference||e.extent?.spatialReference),s=t.includes(`edit`),c=t.includes(`mensuration`)&&o,l=e.mensurationCapabilities==null?[]:e.mensurationCapabilities.toLowerCase().split(`,`).map(e=>e.trim()),u=c&&l.includes(`basic`),d=this._isMosaicDataset(e)&&t.includes(`catalog`),f=t.includes(`download`),p=n>=10.7&&a||n>=11.4&&(a||c&&l.includes(`3d`)),m=d&&e.fields&&e.fields.length>0,h=m&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:i,supportsExportImage:i,supportsIdentify:i,supportsImageToMap:n>=11.2&&d,supportsImageToMapMultiray:n>=11.2&&d,supportsMapToImage:n>=11.2&&d,supportsFindImages:n>=11.2&&d,supportsGetImageUrl:n>=11.3&&f,supportsMeasure:c,supportsMeasureFromImage:n>=11.2,supportsDownload:f,supportsQuery:m,supportsGetSamples:n>=10.2&&i,supportsProject:n>=10.3&&i,supportsComputeStatisticsHistograms:n>=10.4&&i,supportsQueryBoundary:n>=10.6&&i,supportsCalculateVolume:p,supportsComputePixelLocation:n>=10.7&&d,supportsComputeAngles:n>=10.91,supportsQueryGPSInfo:n>=11.2&&d,supportsAdd:s,supportsDelete:s,supportsEditing:s,supportsUpdate:s,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:void 0,supportsStatisticsAggregatedIds:!!h?.supportsAggregateIds,supportsStatistics:!!h?.supportsStatistics,supportsOrderBy:!!h?.supportsOrderBy,supportsDistinct:!!h?.supportsDistinct,supportsPagination:!!h?.supportsPagination,supportsPaginationOnAggregatedQueries:!!h?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!h?.useStandardizedQueries,supportsPercentileStatistics:!!h?.supportsPercentileStatistics,supportsCentroid:!!h?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!h?.supportsQueryWithDistance,supportsOutDistance:!!h?.supportsOutDistance,supportsExtent:!!h?.supportsReturningQueryExtent,supportsGeometryProperties:!!h?.supportsReturningGeometryProperties,supportsHavingClause:!!h?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsReturnExceededLimitGeometries:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:h?.supportsSqlExpression??!!h,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!h?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,standardMaxRecordCountNoGeometry:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:u,supportsAreaAndPerimeter:u,supportsPointOrCentroid:u,supportsHeightFromBaseAndTop:c&&l.includes(`base-top height`),supportsHeightFromBaseAndTopShadow:c&&l.includes(`base-top shadow height`),supportsHeightFromTopAndTopShadow:c&&l.includes(`top-top shadow height`),supports3D:c&&l.includes(`3d`)}}}};e([l({clonable:!1})],Q.prototype,`_functionRasterInfos`,void 0),e([l({readOnly:!0})],Q.prototype,`_serviceSupportsMosaicRule`,void 0),e([X(`_serviceSupportsMosaicRule`,[`currentVersion`,`fields`])],Q.prototype,`readServiceSupportsMosaicRule`,null),e([l({readOnly:!0})],Q.prototype,`_rasterFunctionNamesIndex`,null),e([l()],Q.prototype,`_projectedFullExtent`,void 0),e([l({clonable:!1})],Q.prototype,`_exportTileQueue`,void 0),e([l()],Q.prototype,`adjustAspectRatio`,void 0),e([l({type:[d],json:{write:!0}})],Q.prototype,`bandIds`,void 0),e([X(`bandIds`)],Q.prototype,`readBandIds`,null),e([l({readOnly:!0,json:{read:!1}})],Q.prototype,`capabilities`,void 0),e([X(`service`,`capabilities`,[`capabilities`,`currentVersion`,`serviceDataType`])],Q.prototype,`readCapabilities`,null),e([l({type:Number})],Q.prototype,`compressionQuality`,void 0),e([Z(`compressionQuality`)],Q.prototype,`writeCompressionQuality`,null),e([l({type:Number})],Q.prototype,`compressionTolerance`,void 0),e([Z(`compressionTolerance`)],Q.prototype,`writeCompressionTolerance`,null),e([l({json:{read:{source:`copyrightText`}}})],Q.prototype,`copyright`,void 0),e([l({readOnly:!0})],Q.prototype,`defaultMosaicRule`,void 0),e([X(`defaultMosaicRule`,[`defaultMosaicMethod`])],Q.prototype,`readDefaultMosaicRule`,null),e([l({type:String,json:{name:`layerDefinition.definitionExpression`,write:{enabled:!0,allowNull:!0}}})],Q.prototype,`definitionExpression`,void 0),e([l({readOnly:!0,constructOnly:!0})],Q.prototype,`exportImageServiceParameters`,void 0),e([l()],Q.prototype,`rasterInfo`,void 0),e([l({readOnly:!0,type:[ee]})],Q.prototype,`fields`,void 0),e([l({readOnly:!0})],Q.prototype,`fieldsIndex`,null),e([l({type:[`png`,`png8`,`png24`,`png32`,`jpg`,`bmp`,`gif`,`jpgpng`,`lerc`,`tiff`,`bip`,`bsq`],json:{write:!0}})],Q.prototype,`format`,null),e([X(`service`,`format`,[`serviceDataType`,`allowRasterFunction`])],Q.prototype,`readFormat`,null),e([l({type:m})],Q.prototype,`fullExtent`,void 0),e([l({readOnly:!0})],Q.prototype,`hasMultidimensions`,void 0),e([l({json:{read:{source:`maxImageHeight`}}})],Q.prototype,`imageMaxHeight`,void 0),e([l({json:{read:{source:`maxImageWidth`}}})],Q.prototype,`imageMaxWidth`,void 0),e([l({type:String,json:{type:F.jsonValues,read:F.read,write:F.write}})],Q.prototype,`interpolation`,void 0),e([l()],Q.prototype,`minScale`,void 0),e([X(`service`,`minScale`)],Q.prototype,`readMinScale`,null),e([l()],Q.prototype,`maxScale`,void 0),e([X(`service`,`maxScale`)],Q.prototype,`readMaxScale`,null),e([l({type:N})],Q.prototype,`mosaicRule`,null),e([X(`mosaicRule`,[`mosaicRule`,`defaultMosaicMethod`])],Q.prototype,`readMosaicRule`,null),e([Z(`mosaicRule`)],Q.prototype,`writeMosaicRule`,null),e([l()],Q.prototype,`multidimensionalInfo`,void 0),e([l({type:re,json:{write:!0}})],Q.prototype,`multidimensionalSubset`,void 0),e([l({json:{type:[Number,[Number]],write:!0}})],Q.prototype,`noData`,void 0),e([l({type:String,json:{type:I.jsonValues,read:I.read,write:I.write}})],Q.prototype,`noDataInterpretation`,void 0),e([l({type:String,readOnly:!0,json:{read:{source:[`fields`]}}})],Q.prototype,`objectIdField`,void 0),e([X(`objectIdField`)],Q.prototype,`readObjectIdField`,null),e([l({readOnly:!0})],Q.prototype,`geometryType`,void 0),e([l({})],Q.prototype,`typeIdField`,void 0),e([l({})],Q.prototype,`types`,void 0),e([l({readOnly:!0})],Q.prototype,`parsedUrl`,null),e([l({type:Function})],Q.prototype,`pixelFilter`,void 0),e([l()],Q.prototype,`raster`,void 0),e([l({readOnly:!0})],Q.prototype,`sourceType`,void 0),e([X(`sourceType`,[`serviceSourceType`,`fields`])],Q.prototype,`readSourceType`,null),e([l()],Q.prototype,`viewId`,void 0),e([l({types:G})],Q.prototype,`renderer`,null),e([l({types:G,json:{name:`layerDefinition.drawingInfo.renderer`,origins:{"web-scene":{types:_e,name:`layerDefinition.drawingInfo.renderer`,write:{overridePolicy(e){return{enabled:e&&e.type!==`vector-field`}}}}}}})],Q.prototype,`internalRenderer`,null),e([X(`internalRenderer`)],Q.prototype,`readRenderer`,null),e([Z(`internalRenderer`)],Q.prototype,`writeRenderer`,null),e([l({clonable:!1})],Q.prototype,`symbolizer`,void 0),e([l(O)],Q.prototype,`opacity`,void 0),e([l({readOnly:!0})],Q.prototype,`rasterFields`,null),e([l({constructOnly:!0})],Q.prototype,`rasterFunctionInfos`,void 0),e([l({type:z,json:{name:`renderingRule`}})],Q.prototype,`rasterFunction`,null),e([X(`rasterFunction`,[`renderingRule`,`rasterFunctionInfos`])],Q.prototype,`readRasterFunction`,null),e([l({readOnly:!0})],Q.prototype,`serviceDataType`,void 0),e([l({readOnly:!0,type:_})],Q.prototype,`spatialReference`,void 0),e([X(`spatialReference`,[`spatialReference`,`extent`])],Q.prototype,`readSpatialReference`,null),e([l({type:L.apiValues,json:{read:L.read,type:L.jsonValues}})],Q.prototype,`pixelType`,void 0),e([Z(`pixelType`)],Q.prototype,`writePixelType`,null),e([l({constructOnly:!0,type:me})],Q.prototype,`serviceRasterInfo`,void 0),e([l()],Q.prototype,`sourceJSON`,void 0),e([l(k)],Q.prototype,`url`,void 0),e([l({readOnly:!0})],Q.prototype,`version`,void 0),e([X(`version`,[`currentVersion`,`fields`,`timeInfo`])],Q.prototype,`readVersion`,null),Q=e([u(`esri.layers.mixins.ArcGISImageService`)],Q);function $(e){return e?.path??``}return Q};export{Ze as ArcGISImageService};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as n,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{rectifyMapPointPanoramic as a,rectifyMapPoint as o}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as c,convertPixelToHeadingPitch as l,adjustHorizonAngles as u,reducerFn as d,scaleAndAddWithFactor as f,validatePixelsToTransform as p,validateRotationMatrix as m,computeFarplaneVertices as h,computeHFOVAndVFOV as g,vecToPoint as _,or as v,isUpdateElevationWithElevationSource as y,computeNewReferenceCoordinates as b,projectiveTransform as x}from"./utils.js";import{worldToImage as S}from"./worldToImage.js";import{viewingLimit as C}from"../../../widgets/OrientedImageryViewer/constants.js";async function w(e,t,n){let{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:a,farPlaneVertices:o,cameraLocation:s,pixelsToTransform:c,vecToPoint:l,pixelDepths:u}=N(e,t),d=[];return await T(c,o,i,l,t,d,s,a,r,n,u),Array.isArray(e)?d:d[0]}async function T(e,t,n,r,a,s,c,l,u,d,f){let p=a.averageElevation,m=e.length;for(let h=0;h<m;h+=1){let m=e.at(h),g=k(t,n,m,r,a),_=f?.at(h);if(typeof _==`number`){let e=E(g,c,l),t=_*l,n=[c[0]+e[0]*t,c[1]+e[1]*t,c[2]+e[2]*_];s.push(new i(n,a.cameraLocation.spatialReference))}else d&&v(`elevationSample`in d,y(d))&&(p=(await o(r(g),{x:m[0],y:m[1]},{...a,...d,farPlaneVertices:t.map(r)}))[2]),s.push(r(D(g,c,l,p,a.cameraPitch,u)))}}function E(e,t,n){let i=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],s=Math.hypot(i,a)/n,c=Math.hypot(o,s)*n,l=r();return l[0]=i/c,l[1]=a/c,l[2]=o/c,l[2]*=n,l}function D(e,t,r,i,a,o){let s=n(e),c=E(e,t,r);if(O(e[2],i,a,o)){let e=Math.abs((t[2]-i)/-c[2])*r;s=f(t,c,e,r)}else s[2]=i;return s}function O(e,t,n,r){return e<t||n+r/2<C}function k(e,t,n,r,i){let a=null,o=0,s,c=e,l=t;for(;o<=9;){let e=j(n,l,c,i);if(s=e.error,a=e.transformedPoint,v(s<=1,o===9))break;c=b(c,s,n,t),l=A(c,r,i),o++}return a}function A(e,t,n){return S(e.map(t),n).map(({x:e,y:t})=>[e,t,1])}function j(e,t,n,r){let{cameraLocation:a}=r,o=x(e,t,n),{x:s,y:c}=S(new i(o,a.spatialReference),r);return{transformedPoint:o,error:M(e,[s,c,1])}}function M(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function N(t,n){let r=e(t)||`items`in t?t:[t],{cameraLocation:a,rotationMatrix:o}=n;if(p(r,a),m(o),o?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`);let c=s(a.y,a.spatialReference),l=h({...n,scalingFactor:c}),u=S(l.map(e=>new i(e,a.spatialReference)),n),{vfov:d}=g(n.horizontalFieldOfView,n.verticalFieldOfView,n.cameraRoll);return{cameraLocation:a.toArray(),imageBoundaries:u.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:d,farPlaneVertices:l,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:_(a.spatialReference),pixelDepths:r.map(e=>P(e)?e.depth:void 0)}}function P(e){return`depth`in e&&typeof e.depth==`number`}async function F(e,n,r){let{cameraLocation:o,farDistance:f,imageHeight:p,imageWidth:m,verticalFieldOfView:h,horizonPitch:g,horizonRoll:_,horizonYaw:v}=n,y=s(o.y,o.spatialReference),b=f*y,x=[],[S,C,w]=o.toArray(),T=Array.isArray(e)?e:[e];for(let e of T){let s,T,E=P(e),O=E?e.depth*y:b;if(c(e))s=e.heading,T=e.pitch;else{let t=l({x:e.x,y:e.y},m,p),n=u(t.heading,t.pitch,[g,_,v],!0);s=n[0],T=n[1]}let k=Math.sin(t(s))*Math.sin(t(T)),A=Math.cos(t(s))*Math.sin(t(T)),j=-Math.cos(t(T)),M=[S+k*O,C+A*O,w+j*(E?e.depth:f)];if(E){x.push(new i(M,o.spatialReference));continue}let N=n.averageElevation,F;if(r&&T<90){let e=await a(new i(M,o.spatialReference),{heading:s,pitch:T},{...n,...r,farPlaneVertices:d(f,f).map(([e,t])=>new i([o.x+e,o.y+t],o.spatialReference))});F=e,N=e?.[2]??N}let I=(N-w)/(M[2]-w),L=T>=90||!!r&&!F||!Number.isFinite(I)||I<0;x.push(new i(L?[M[0],M[1],N]:D(M,o.toArray(),y,N,T,h),o.spatialReference))}return Array.isArray(e)?x:x[0]}export{w as imageToWorld,F as imageToWorldPanoramic};
2
+ import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as n,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{rectifyMapPointPanoramic as a,rectifyMapPoint as o}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as c,convertPixelToHeadingPitch as l,adjustHorizonAngles as u,reducerFn as d,scaleAndAddWithFactor as f,validatePixelsToTransform as p,validateRotationMatrix as m,computeFarplaneVertices as h,computeHFOVAndVFOV as g,vecToPoint as _,or as v,isUpdateElevationWithElevationSource as y,computeNewReferenceCoordinates as b,projectiveTransform as x}from"./utils.js";import{worldToImage as S}from"./worldToImage.js";import{viewingLimit as C}from"../../../widgets/OrientedImageryViewer/constants.js";async function w(e,t,n){let{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:a,farPlaneVertices:o,cameraLocation:s,pixelsToTransform:c,vecToPoint:l,pixelDepths:u}=N(e,t),d=[];return await T(c,o,i,l,t,d,s,a,r,n,u),Array.isArray(e)?d:d[0]}async function T(e,t,n,r,a,s,c,l,u,d,f){let p=a.averageElevation,m=e.length;for(let h=0;h<m;h+=1){let m=e.at(h),g=k(t,n,m,r,a),_=f?.at(h);if(typeof _==`number`){let e=E(g,c,l),t=_*l,n=[c[0]+e[0]*t,c[1]+e[1]*t,c[2]+e[2]*_];s.push(new i({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:a.cameraLocation.spatialReference}))}else d&&v(`elevationSample`in d,y(d))&&(p=(await o(r(g),{x:m[0],y:m[1]},{...a,...d,farPlaneVertices:t.map(r)}))[2]),s.push(r(D(g,c,l,p,a.cameraPitch,u)))}}function E(e,t,n){let i=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],s=Math.hypot(i,a)/n,c=Math.hypot(o,s)*n,l=r();return l[0]=i/c,l[1]=a/c,l[2]=o/c,l[2]*=n,l}function D(e,t,r,i,a,o){let s=n(e),c=E(e,t,r);if(O(e[2],i,a,o)){let e=Math.abs((t[2]-i)/-c[2])*r;s=f(t,c,e,r)}else s[2]=i;return s}function O(e,t,n,r){return e<t||n+r/2<C}function k(e,t,n,r,i){let a=null,o=0,s,c=e,l=t;for(;o<=9;){let e=j(n,l,c,i);if(s=e.error,a=e.transformedPoint,v(s<=1,o===9))break;c=b(c,s,n,t),l=A(c,r,i),o++}return a}function A(e,t,n){return S(e.map(t),n).map(({x:e,y:t})=>[e,t,1])}function j(e,t,n,r){let{cameraLocation:a}=r,o=x(e,t,n),{x:s,y:c}=S(new i({x:o[0],y:o[1],z:o[2],m:o[3],spatialReference:a.spatialReference}),r);return{transformedPoint:o,error:M(e,[s,c,1])}}function M(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function N(t,n){let r=e(t)||`items`in t?t:[t],{cameraLocation:a,rotationMatrix:o}=n;if(p(r,a),m(o),o?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`);let c=s(a.y,a.spatialReference),l=h({...n,scalingFactor:c}),u=S(l.map(e=>new i({x:e[0],y:e[1],z:e[2],m:e[3],spatialReference:a.spatialReference})),n),{vfov:d}=g(n.horizontalFieldOfView,n.verticalFieldOfView,n.cameraRoll);return{cameraLocation:a.toArray(),imageBoundaries:u.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:d,farPlaneVertices:l,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:_(a.spatialReference),pixelDepths:r.map(e=>P(e)?e.depth:void 0)}}function P(e){return`depth`in e&&typeof e.depth==`number`}async function F(e,n,r){let{cameraLocation:o,farDistance:f,imageHeight:p,imageWidth:m,verticalFieldOfView:h,horizonPitch:g,horizonRoll:_,horizonYaw:v}=n,y=s(o.y,o.spatialReference),b=f*y,x=[],[S,C,w]=o.toArray(),T=Array.isArray(e)?e:[e];for(let e of T){let s,T,E=P(e),O=E?e.depth*y:b;if(c(e))s=e.heading,T=e.pitch;else{let t=l({x:e.x,y:e.y},m,p),n=u(t.heading,t.pitch,[g,_,v],!0);s=n[0],T=n[1]}let k=Math.sin(t(s))*Math.sin(t(T)),A=Math.cos(t(s))*Math.sin(t(T)),j=-Math.cos(t(T)),M=[S+k*O,C+A*O,w+j*(E?e.depth:f)];if(E){x.push(new i({x:M[0],y:M[1],z:M[2],m:M[3],spatialReference:o.spatialReference}));continue}let N=n.averageElevation,F;if(r&&T<90){let e=await a(new i({x:M[0],y:M[1],z:M[2],m:M[3],spatialReference:o.spatialReference}),{heading:s,pitch:T},{...n,...r,farPlaneVertices:d(f,f).map(([e,t])=>new i({x:o.x+e,y:o.y+t,spatialReference:o.spatialReference}))});F=e,N=e?.[2]??N}let I=(N-w)/(M[2]-w),[L,R,z]=T>=90||r&&!F||!Number.isFinite(I)||I<0?[M[0],M[1],N]:D(M,o.toArray(),y,N,T,h);x.push(new i({x:L,y:R,z,spatialReference:o.spatialReference}))}return Array.isArray(e)?x:x[0]}export{w as imageToWorld,F as imageToWorldPanoramic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import{fromArray as r,intersectRay as i,fromPoints as a,intersectLine as o}from"../../../geometry/support/plane.js";import{fromPoints as s}from"../../../geometry/support/ray.js";import c from"./updateElevation.js";import{pointToArray as l,or as u}from"./utils.js";import{worldToImagePanoramic as d,worldToImage as f}from"./worldToImage.js";import{normalizeDegrees as p}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";async function m(n,r,i,s=g){let{cameraLocation:c,farPlaneVertices:d}=i,f=l(c),p=[];await v(d,i,p);let m=a(p[0],p[1],p[2]),h=n.clone();for(let d=0;d<s;d++){let s=e();if(!o(m,f,l(n),s))break;let d=0,g=null;if({error:d,imagePoint:g,pointWithZ:h}=await y(r,new t(s,c.spatialReference),i),d<=1)break;let[v,b]=_(c.spatialReference,p);if(u(v<=1,b<=1))break;p.splice(0,p.length,...await S(v,b,new t(s,c.spatialReference),i)),m=a(p[0],p[1],p[2])}return l(h)}async function h(n,a,o,c=g){let{cameraLocation:d,farPlaneVertices:f}=o,p=l(d),m=s(p,l(n)),h=[];await v(f,o,h);let y=[0,0,0,0],x=r(y,h.flat(),!1),C=n.clone();for(let n=0;n<c;n++){let n=e();if(!i(y,m,n)||!x)return;let s=0,c;if({error:s,imagePoint:c,pointWithZ:C}=await b(a,new t(n,d.spatialReference),o),s<=1)return l(C);let[f,p]=_(d.spatialReference,h);if(u(f<=1,p<=1))break;h.splice(0,h.length,...await S(f,p,new t(n,d.spatialReference),o)),x=r(y,h.flat(),!1)}}const g=10;function _(e,t){let r=new n({spatialReference:e});return r.addRing(t),[r.extent?.width?r.extent.width/10:1,r.extent?.height?r.extent.height/10:1]}async function v(e,t,n){let r=e.map(e=>e.clone()),i=await c(r,t);n.push(...i.map(l))}async function y(e,t,n){let r=await c(t,n),i=f(r,n);return{error:x(i,e),imagePoint:i,pointWithZ:r}}async function b(e,t,n){let r=await c(t,n),i=d(r,n),a=p(i.heading+n.cameraHeading);return{error:Math.abs(a-e.heading)+Math.abs(i.pitch-e.pitch),imagePoint:i,pointWithZ:r}}const x=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y);async function S(e,n,r,i){let a=[[-e,-n],[e,-n],[e,n],[-e,n]].map(([e,n])=>new t([r.x+e,r.y+n],r.spatialReference));return c(a,i).then(e=>e.map(e=>e.toArray()))}export{m as rectifyMapPoint,h as rectifyMapPointPanoramic};
2
+ import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import{fromArray as r,intersectRay as i,fromPoints as a,intersectLine as o}from"../../../geometry/support/plane.js";import{fromPoints as s}from"../../../geometry/support/ray.js";import c from"./updateElevation.js";import{pointToArray as l,or as u}from"./utils.js";import{worldToImagePanoramic as d,worldToImage as f}from"./worldToImage.js";import{normalizeDegrees as p}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";async function m(n,r,i,s=g){let{cameraLocation:c,farPlaneVertices:d}=i,f=l(c),p=[];await v(d,i,p);let m=a(p[0],p[1],p[2]),h=n.clone();for(let d=0;d<s;d++){let s=e();if(!o(m,f,l(n),s))break;let d=0,g=null;if({error:d,imagePoint:g,pointWithZ:h}=await y(r,new t({x:s[0],y:s[1],z:s[2],m:s[3],spatialReference:c.spatialReference}),i),d<=1)break;let[v,b]=_(c.spatialReference,p);if(u(v<=1,b<=1))break;p.splice(0,p.length,...await S(v,b,new t({x:s[0],y:s[1],z:s[2],m:s[3],spatialReference:c.spatialReference}),i)),m=a(p[0],p[1],p[2])}return l(h)}async function h(n,a,o,c=g){let{cameraLocation:d,farPlaneVertices:f}=o,p=l(d),m=s(p,l(n)),h=[];await v(f,o,h);let y=[0,0,0,0],x=r(y,h.flat(),!1),C=n.clone();for(let n=0;n<c;n++){let n=e();if(!i(y,m,n)||!x)return;let s=0,c;if({error:s,imagePoint:c,pointWithZ:C}=await b(a,new t({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:d.spatialReference}),o),s<=1)return l(C);let[f,p]=_(d.spatialReference,h);if(u(f<=1,p<=1))break;h.splice(0,h.length,...await S(f,p,new t({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:d.spatialReference}),o)),x=r(y,h.flat(),!1)}}const g=10;function _(e,t){let r=new n({spatialReference:e});return r.addRing(t),[r.extent?.width?r.extent.width/10:1,r.extent?.height?r.extent.height/10:1]}async function v(e,t,n){let r=e.map(e=>e.clone()),i=await c(r,t);n.push(...i.map(l))}async function y(e,t,n){let r=await c(t,n),i=f(r,n);return{error:x(i,e),imagePoint:i,pointWithZ:r}}async function b(e,t,n){let r=await c(t,n),i=d(r,n),a=p(i.heading+n.cameraHeading);return{error:Math.abs(a-e.heading)+Math.abs(i.pitch-e.pitch),imagePoint:i,pointWithZ:r}}const x=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y);async function S(e,n,r,i){let a=[[-e,-n],[e,-n],[e,n],[-e,n]].map(([e,n])=>new t({x:r.x+e,y:r.y+n,spatialReference:r.spatialReference}));return c(a,i).then(e=>e.map(e=>e.toArray()))}export{m as rectifyMapPoint,h as rectifyMapPointPanoramic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as n,waitTick as r}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import{projectAsync as a}from"../../../geometry/projectionUtils.js";import{projectLoad as o,projectExecute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as c}from"../../../geometry/support/aaBoundingRect.js";import l from"../../ElevationLayer.js";import u from"../../ImageryLayer.js";import{getMetersPerUnitOfSR as d}from"../core/utils.js";import{defaultOptions as f}from"../../support/ElevationQuery.js";import{ElevationTile as p}from"../../support/ElevationTile.js";import m from"../../support/ElevationTileData.js";import h from"../../support/RasterFunction.js";import{TileElevationSampler as g}from"../../support/TileElevationSampler.js";import _ from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{requestServiceJSON as y}from"../../../request/serviceJSON.js";import{logAndThrow as b}from"../../../widgets/OrientedImageryViewer/utils.js";async function x(t,n,r){if(!n.extent||!n.url)throw b(`esri.layer.orientedImagery.transformations`,new e(`update-elevation:missing-property`,`both extent and url are required to create a sampler`,n));let i=await C(n);if(!i)throw b(`esri.layers.orientedImagery.transformations`,new e(`update-elevation:elevation-source`,`could not create a sampler using provided elevation source`,n));return S(t,i,r)}async function S(e,t,n){await r(n);let i=D(t,n),a=Array.isArray(e)?e:[e];return await Promise.all(a.map(i))}async function C(e,r){let i,{extent:a,rasterFunction:o,url:s,lod:c}=e;try{i=await E(s)}catch(e){if(n(e))return;t.getLogger(`esri.layers.orientedImagery.transformations`).error(`updateElevationUsingElevationSource`,e)}switch(i){case 0:return await T(s,a,o,r);case 1:return await w(s,a,c,r);default:return}}async function w(e,r,i,a){let o=new l(e),s;try{let{tileInfo:e}=await o.load(),t=(i&&e.lodAt(Math.min(e.lods.length-1,i))?.resolution)??`finest-contiguous`;s=await o.createElevationSampler(r,{...a,demResolution:t})}catch(e){if(n(e))return;t.getLogger(o).error(e)}finally{o.destroy()}return s}async function T(e,t,n,r){let a=n?new h({functionName:n}):void 0,l=new u({url:e,rasterFunction:a,format:`lerc`});await l.load(r);let d=t.center,y=Math.max(t.width,t.height),b=new i({xmin:d.x-y/2,ymin:d.y-y/2,xmax:d.x+y/2,ymax:d.y+y/2,spatialReference:t.spatialReference});l.spatialReference.equals(b.spatialReference)||(await o(),b=s(b,l.spatialReference));let x=await l.fetchPixels(b,512,512,r),S=_.create({scales:[y/512],size:512,spatialReference:b.spatialReference}),C=new v(0,0,0,c(b)),w=new m({values:x.pixelBlock.pixels[0],width:512,height:512,noDataValue:0}),T=[new p(C,w)],E=f.noDataValue;return new g({tiles:T,tileInfo:S,noDataValue:E})}async function E(t,n){await r(n);let i=await y(t),{tileInfo:a,cacheType:o}=i;if(!i.hasOwnProperty(`bandCount`)||!i.hasOwnProperty(`pixelSizeX`))throw new e(`elevation-source:invalid-service-url`,`ElevationSource URL expects an elevation 3D image service but given ${t}`);return a?a?.format?.toUpperCase()===`LERC`&&(!o||o.toLowerCase()===`elevation`)?1:2:0}function D(e,t){return async n=>{let r=n.clone(),i=n.spatialReference.equals(e.spatialReference)?r:await a(n,e.spatialReference,t),o=e.queryElevation(i);return o&&(r=n.spatialReference.equals(e.spatialReference)?o.clone():await a(o,n.spatialReference,t)),r.z=r.z??1,r}}async function O(e,t,n){return await r(n),e.map(e=>(e.z=t,e))}function k(e,t){let{averageGroundElevation:n,spatialReference:r}=t,i=d(r);return e.map(e=>{let t=e.clone();return t.z=n*i/e.spatialReference.metersPerUnit,t})}export{C as getElevationSampler,T as getElevationSamplerFromDynamicImageService,k as updateUsingAverageGroundElevation,O as updateUsingConstant,S as updateUsingElevationSampler,x as updateUsingElevationSource,E as validateElevationSourceURL};
2
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as n,waitTick as r}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import{projectAsync as a}from"../../../geometry/projectionUtils.js";import{projectLoad as o,projectExecute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as c}from"../../../geometry/support/aaBoundingRect.js";import l from"../../ElevationLayer.js";import u from"../../ImageryLayer.js";import{getMetersPerUnitOfSR as d}from"../core/utils.js";import{defaultOptions as f}from"../../support/ElevationQuery.js";import{ElevationTile as p}from"../../support/ElevationTile.js";import m from"../../support/ElevationTileData.js";import h from"../../support/RasterFunction.js";import{TileElevationSampler as g}from"../../support/TileElevationSampler.js";import _ from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{requestServiceJSON as y}from"../../../request/serviceJSON.js";import{logAndThrow as b}from"../../../widgets/OrientedImageryViewer/utils.js";async function x(t,n,r){if(!n.extent||!n.url)throw b(`esri.layer.orientedImagery.transformations`,new e(`update-elevation:missing-property`,`both extent and url are required to create a sampler`,n));let i=await C(n);if(!i)throw b(`esri.layers.orientedImagery.transformations`,new e(`update-elevation:elevation-source`,`could not create a sampler using provided elevation source`,n));return S(t,i,r)}async function S(e,t,n){await r(n);let i=D(t,n),a=Array.isArray(e)?e:[e];return await Promise.all(a.map(i))}async function C(e,r){let i,{extent:a,rasterFunction:o,url:s,lod:c}=e;try{i=await E(s)}catch(e){if(n(e))return;t.getLogger(`esri.layers.orientedImagery.transformations`).error(`updateElevationUsingElevationSource`,e)}switch(i){case 0:return await T(s,a,o,r);case 1:return await w(s,a,c,r);default:return}}async function w(e,r,i,a){let o=new l({url:e}),s;try{let{tileInfo:e}=await o.load(),t=(i&&e.lodAt(Math.min(e.lods.length-1,i))?.resolution)??`finest-contiguous`;s=await o.createElevationSampler(r,{...a,demResolution:t})}catch(e){if(n(e))return;t.getLogger(o).error(e)}finally{o.destroy()}return s}async function T(e,t,n,r){let a=n?new h({functionName:n}):void 0,l=new u({url:e,rasterFunction:a,format:`lerc`});await l.load(r);let d=t.center,y=Math.max(t.width,t.height),b=new i({xmin:d.x-y/2,ymin:d.y-y/2,xmax:d.x+y/2,ymax:d.y+y/2,spatialReference:t.spatialReference});l.spatialReference.equals(b.spatialReference)||(await o(),b=s(b,l.spatialReference));let x=await l.fetchPixels(b,512,512,r),S=_.create({scales:[y/512],size:512,spatialReference:b.spatialReference}),C=new v(0,0,0,c(b)),w=new m({values:x.pixelBlock.pixels[0],width:512,height:512,noDataValue:0}),T=[new p(C,w)],E=f.noDataValue;return new g({tiles:T,tileInfo:S,noDataValue:E})}async function E(t,n){await r(n);let i=await y(t),{tileInfo:a,cacheType:o}=i;if(!i.hasOwnProperty(`bandCount`)||!i.hasOwnProperty(`pixelSizeX`))throw new e(`elevation-source:invalid-service-url`,`ElevationSource URL expects an elevation 3D image service but given ${t}`);return a?a?.format?.toUpperCase()===`LERC`&&(!o||o.toLowerCase()===`elevation`)?1:2:0}function D(e,t){return async n=>{let r=n.clone(),i=n.spatialReference.equals(e.spatialReference)?r:await a(n,e.spatialReference,t),o=e.queryElevation(i);return o&&(r=n.spatialReference.equals(e.spatialReference)?o.clone():await a(o,n.spatialReference,t)),r.z=r.z??1,r}}async function O(e,t,n){return await r(n),e.map(e=>(e.z=t,e))}function k(e,t){let{averageGroundElevation:n,spatialReference:r}=t,i=d(r);return e.map(e=>{let t=e.clone();return t.z=n*i/e.spatialReference.metersPerUnit,t})}export{C as getElevationSampler,T as getElevationSamplerFromDynamicImageService,k as updateUsingAverageGroundElevation,O as updateUsingConstant,S as updateUsingElevationSampler,x as updateUsingElevationSource,E as validateElevationSourceURL};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,t,n,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,t,n,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=this.ioConfig.rawBlockCacheMode??`default`,f=d===`no-cache`,p=d===`minimum`?void 0:r.registryId,m=f?null:S(l,p,u);if(m==null){let a=f?null:new AbortController,o=a?.signal??r.signal,s=r.bandIds?.slice();if(s?.length&&i.isBsqTile){let i=new Set(s),a=[],c=Array.from(i);for(let i of c)a.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:o}));m=Promise.all(a).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==s.length){let t=[];for(let n of s){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:o,transferPixelsToWorker:!0}):M(e)})}else m=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:o});f||(C(l,p,u,m,a),m.catch(()=>w(l,p,u)))}return!f&&r.signal&&o(r,()=>{T(l,p,u)}),m}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{assertIsSome as n}from"../../../core/maybe.js";import{urlToObject as r}from"../../../core/urlUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import{setValidBoundary as u}from"../functions/pixelUtils.js";import d from"../transforms/GCSShiftTransform.js";import f from"../../support/RasterInfo.js";import p from"../../support/RasterStorageInfo.js";import m from"../../support/TileInfo.js";import{TilemapCache as h}from"../../support/TilemapCache.js";import{patchServiceInfo as g,fetchServiceRasterInfo as _}from"../../../rest/imageService/fetchRasterInfo.js";let v=class extends l{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat=`RasterTileServer`,this.tileType=null}async fetchRawTile(e,t,n,r={}){let{storageInfo:i,extent:a}=this.rasterInfo,{transposeInfo:o}=i,s=o!=null&&!!r.transposedVariableName;if(this._slices&&!s&&r.sliceId==null)return null;let c=s?0:i.maximumPyramidLevel-e+this._levelOffset,l=`${this.url}/tile/${c}/${t}/${n}`,d={...this._slices?s?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters},f,p;if(i.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(l,{query:{...d,bandId:e},responseType:`array-buffer`,signal:r.signal})),t=await Promise.all(e),n=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),i=new Uint8Array(n);p=[];let a=0;for(let{data:e}of t)p.push(a),i.set(new Uint8Array(e),a),a+=e.byteLength;f=i.buffer}else f=(await this.request(l,{query:d,responseType:`array-buffer`,signal:r.signal})).data;if(!f)return null;let{tileInfo:m}=i,h=s?o.tileSize:m.size,g=/^(mixed|jp)/i.test(m.format),_=m.format===`raw`,v=await this.decodePixelBlock(f,{format:_?`bsq`:void 0,width:h[0],height:h[1],planes:p?.length,offsets:p,pixelType:_?this.rasterInfo.pixelType:void 0,isPoint:this.tileType===`Elevation`,returnInterleaved:s,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:g},{signal:r.signal});if(v==null)return null;let y=i.blockBoundary[e];if(i.compression!==`jpg`||n>y.minCol&&n<y.maxCol&&t>y.minRow&&t<y.maxRow)return v;let{origin:b,blockWidth:x,blockHeight:S}=i,{x:C,y:w}=this.getPyramidPixelSize(e),T=Math.round((a.xmin-b.x)/C)%x,E=Math.round((a.xmax-b.x)/C)%x||x,D=Math.round((b.y-a.ymax)/w)%S,O=Math.round((b.y-a.ymin)/w)%S||S,k=n===y.minCol?T:0,A=t===y.minRow?D:0,j=n===y.maxCol?E:x,M=t===y.maxRow?O:S;return u(v,{x:k,y:A},{width:j-k,height:M-A}),v}getSliceIndex(e){if(!this._slices||e==null||e.length===0)return null;let t=e;for(let e=0;e<this._slices.length;e++){let n=this._slices[e].multidimensionalDefinition;if(n.length===t.length&&!n.some(e=>{let n=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!n||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(n.values[0])?`${n.values[0][0]}-${n.values[0][1]}`:n.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let n=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),i=await Promise.all([n,r]);return i[0]&&i[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),i[1]?.[0]?.counts?.length||(i[1]=null),{statistics:i[0]||null,histograms:i[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let n=this.identifyPixelLocation(e,0,t.datumTransformation);if(n===null)return null;let r=0,{maximumPyramidLevel:i}=this.rasterInfo.storageInfo,a=i-r+this._levelOffset,o=n.srcLocation;for(;a>=0;){try{if(await this._tilemapCache.fetchAvailability(a,n.row,n.col,t)===`available`)break}catch{}if(a--,r++,n=this.identifyPixelLocation(o,r,t.datumTransformation),n===null)return null}return a===-1||n==null?null:r}async _open(e){let i=e?.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:`json`},signal:i});a.ssl&&(this.url=this.url.replace(/^http:/i,`https:`));let o=a.data;if(this.sourceJSON=o,!o)throw new t(`imageserverraster:open`,`cannot initialize tiled image service, missing service info`);if(!o.tileInfo)throw new t(`imageserverraster:open`,`use ImageryLayer to open non-tiled image services`);this._fixScaleInServiceInfo();let s=[`jpg`,`jpeg`,`png`,`png8`,`png24`,`png32`,`mixed`];this.tileType=o.cacheType,this.tileType??=s.includes(o.tileInfo.format.toLowerCase())?`Map`:o.tileInfo.format.toLowerCase()===`lerc`?`Elevation`:`Raster`,this.datasetName=o.name?.slice(o.name.indexOf(`/`)+1)??``;let c=this.rasterInfo??await this._fetchRasterInfo({signal:i});if(c==null)throw new t(`image-server-raster:open`,`cannot initialize image service`);g(c,o);let l=this.tileType===`Map`?y(o.tileInfo,o):m.fromJSON(o.tileInfo);n(l);let[u,d]=this._computeMinMaxLOD(c,l),{extent:f,pixelSize:_}=c,v=Math.min(_.x,_.y)*.001;(_.x!==_.y||Math.abs(u.resolution-_.x)>v)&&(_.x=_.y=u.resolution,c.width=Math.ceil((f.xmax-f.xmin)/_.x-.1),c.height=Math.ceil((f.ymax-f.ymin)/_.y-.1));let x=u.level-d.level,[S,C]=l.size,w=[],T=[],{lods:E}=l;E.forEach((e,t)=>{e.level>=d.level&&e.level<=u.level&&w.push({x:e.resolution,y:e.resolution}),t<E.length-1&&T.push(Math.round(10*e.resolution/E[t+1].resolution)/10)}),w.sort((e,t)=>e.x-t.x);let D=this.computeBlockBoundary(f,S,C,l.origin,w,x),O=w.length>1?w.slice(1):null,k;o.transposeInfo&&(k={tileSize:[o.transposeInfo.rows,o.transposeInfo.cols],packetSize:c.keyProperties?._yxs.PacketSize??0});let A=T.length<=1||T.length>=3&&T.slice(0,-1).every(e=>e===T[0])?T[0]??2:Math.round(10/(d.resolution/u.resolution)**(-1/x))/10,j=!!o.bsq&&this.tileType===`Raster`;if(c.storageInfo=new p({blockWidth:l.size[0],blockHeight:l.size[1],pyramidBlockWidth:l.size[0],pyramidBlockHeight:l.size[1],pyramidResolutions:O,pyramidScalingFactor:A,compression:l.format,origin:l.origin,firstPyramidLevel:1,maximumPyramidLevel:x,tileInfo:l,isBsqTile:j,transposeInfo:k,blockBoundary:D}),b(c),this._set(`rasterInfo`,c),o.capabilities.toLowerCase().includes(`tilemap`)){let e={tileInfo:c.storageInfo.tileInfo,parsedUrl:r(this.url),url:this.url,tileServers:[]};this._tilemapCache=new h({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if(this.tileType===`Map`){let e=t.fullExtent||t.extent,n=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),i=c.fromJSON(t.spatialReference||e.spatialReference),a=new s({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:i});return new f({width:n,height:r,bandCount:3,extent:o.fromJSON(e),spatialReference:i,pixelSize:a,pixelType:`u8`,statistics:null,keyProperties:{DataType:`processed`}})}let n={...e,query:{...this.ioConfig.customFetchParameters,f:`json`}},r=_(this.url,this.sourceJSON,n),i=t.hasMultidimensions?this.request(`${this.url}/slices`,n).then(e=>e.data?.slices).catch(()=>null):null,a=await Promise.all([r,i]);return this._slices=a[1],a[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:n}=e,r=.5/e.width*n.x,{lods:i}=t,a=t.lodAt(Math.max.apply(null,i.map(e=>e.level))),o=t.lodAt(Math.min.apply(null,i.map(e=>e.level))),{tileType:s}=this;if(s===`Map`)return this._levelOffset=i[0].level,[a,o];if(s===`Raster`)return[i.find(e=>e.resolution===n.x)??a,o];let{minScale:c,maxScale:l}=this.sourceJSON,u=a;l>0&&(u=i.find(e=>Math.abs(e.scale-l)<r),u||=i.filter(e=>e.scale>l).sort((e,t)=>e.scale>t.scale?1:-1)[0]??a);let d=o;return c>0&&(d=i.find(e=>Math.abs(e.scale-c)<r)??o,this._levelOffset=d.level-o.level),[u,d]}};e([i({type:String,json:{write:!0}})],v.prototype,`datasetFormat`,void 0),e([i()],v.prototype,`tileType`,void 0),v=e([a(`esri.layers.raster.datasets.ImageServerRaster`)],v);function y(e,t){if(!e)return null;let{minScale:n,maxScale:r,minLOD:i,maxLOD:a}=t;if(i!=null&&a!=null)return m.fromJSON({...e,lods:e.lods.filter(({level:e})=>e!=null&&e>=i&&e<=a)});if(n!==0&&r!==0){let t=e=>Math.round(e*1e4)/1e4,i=n?t(n):1/0,a=r?t(r):-1/0;return m.fromJSON({...e,lods:e.lods.filter(e=>{let n=t(e.scale);return n<=i&&n>=a})})}return m.fromJSON(e)}function b(e){let{extent:t,spatialReference:n}=e;t.xmin>-1&&t.xmax>181&&n?.wkid&&n.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}const x=v;export{x as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{assertIsSome as n}from"../../../core/maybe.js";import{urlToObject as r}from"../../../core/urlUtils.js";import{property as i,subclass as a}from"../../../core/accessorSupport/decorators.js";import o from"../../../geometry/Extent.js";import s from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import{fixGCSShift as u}from"./datasetUtils.js";import{setValidBoundary as d}from"../functions/pixelUtils.js";import f from"../../support/RasterInfo.js";import p from"../../support/RasterStorageInfo.js";import m from"../../support/TileInfo.js";import{TilemapCache as h}from"../../support/TilemapCache.js";import{patchServiceInfo as g,fetchServiceRasterInfo as _}from"../../../rest/imageService/fetchRasterInfo.js";let v=class extends l{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat=`RasterTileServer`,this.tileType=null}async fetchRawTile(e,t,n,r={}){let{storageInfo:i,extent:a}=this.rasterInfo,{transposeInfo:o}=i,s=o!=null&&!!r.transposedVariableName;if(this._slices&&!s&&r.sliceId==null)return null;let c=s?0:i.maximumPyramidLevel-e+this._levelOffset,l=`${this.url}/tile/${c}/${t}/${n}`,u={...this._slices?s?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters},f,p;if(i.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(l,{query:{...u,bandId:e},responseType:`array-buffer`,signal:r.signal})),t=await Promise.all(e),n=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),i=new Uint8Array(n);p=[];let a=0;for(let{data:e}of t)p.push(a),i.set(new Uint8Array(e),a),a+=e.byteLength;f=i.buffer}else f=(await this.request(l,{query:u,responseType:`array-buffer`,signal:r.signal})).data;if(!f)return null;let{tileInfo:m}=i,h=s?o.tileSize:m.size,g=/^(mixed|jp)/i.test(m.format),_=m.format===`raw`,v=await this.decodePixelBlock(f,{format:_?`bsq`:void 0,width:h[0],height:h[1],planes:p?.length,offsets:p,pixelType:_?this.rasterInfo.pixelType:void 0,isPoint:this.tileType===`Elevation`,returnInterleaved:s,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:g},{signal:r.signal});if(v==null)return null;let y=i.blockBoundary[e];if(i.compression!==`jpg`||n>y.minCol&&n<y.maxCol&&t>y.minRow&&t<y.maxRow)return v;let{origin:b,blockWidth:x,blockHeight:S}=i,{x:C,y:w}=this.getPyramidPixelSize(e),T=Math.round((a.xmin-b.x)/C)%x,E=Math.round((a.xmax-b.x)/C)%x||x,D=Math.round((b.y-a.ymax)/w)%S,O=Math.round((b.y-a.ymin)/w)%S||S,k=n===y.minCol?T:0,A=t===y.minRow?D:0,j=n===y.maxCol?E:x,M=t===y.maxRow?O:S;return d(v,{x:k,y:A},{width:j-k,height:M-A}),v}getSliceIndex(e){if(!this._slices||e==null||e.length===0)return null;let t=e;for(let e=0;e<this._slices.length;e++){let n=this._slices[e].multidimensionalDefinition;if(n.length===t.length&&!n.some(e=>{let n=t.find(t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName);return!n||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(n.values[0])?`${n.values[0][0]}-${n.values[0][1]}`:n.values[0])}))return e}return null}async fetchVariableStatisticsHistograms(e,t){let n=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),i=await Promise.all([n,r]);return i[0]&&i[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),i[1]?.[0]?.counts?.length||(i[1]=null),{statistics:i[0]||null,histograms:i[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let n=this.identifyPixelLocation(e,0,t.datumTransformation);if(n===null)return null;let r=0,{maximumPyramidLevel:i}=this.rasterInfo.storageInfo,a=i-r+this._levelOffset,o=n.srcLocation;for(;a>=0;){try{if(await this._tilemapCache.fetchAvailability(a,n.row,n.col,t)===`available`)break}catch{}if(a--,r++,n=this.identifyPixelLocation(o,r,t.datumTransformation),n===null)return null}return a===-1||n==null?null:r}async _open(e){let i=e?.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:`json`},signal:i});a.ssl&&(this.url=this.url.replace(/^http:/i,`https:`));let o=a.data;if(this.sourceJSON=o,!o)throw new t(`imageserverraster:open`,`cannot initialize tiled image service, missing service info`);if(!o.tileInfo)throw new t(`imageserverraster:open`,`use ImageryLayer to open non-tiled image services`);this._fixScaleInServiceInfo();let s=[`jpg`,`jpeg`,`png`,`png8`,`png24`,`png32`,`mixed`];this.tileType=o.cacheType,this.tileType??=s.includes(o.tileInfo.format.toLowerCase())?`Map`:o.tileInfo.format.toLowerCase()===`lerc`?`Elevation`:`Raster`,this.datasetName=o.name?.slice(o.name.indexOf(`/`)+1)??``;let c=this.rasterInfo??await this._fetchRasterInfo({signal:i});if(c==null)throw new t(`image-server-raster:open`,`cannot initialize image service`);g(c,o);let l=this.tileType===`Map`?y(o.tileInfo,o):m.fromJSON(o.tileInfo);n(l);let[d,f]=this._computeMinMaxLOD(c,l),{extent:_,pixelSize:v}=c,b=Math.min(v.x,v.y)*.001;(v.x!==v.y||Math.abs(d.resolution-v.x)>b)&&(v.x=v.y=d.resolution,c.width=Math.ceil((_.xmax-_.xmin)/v.x-.1),c.height=Math.ceil((_.ymax-_.ymin)/v.y-.1));let x=d.level-f.level,[S,C]=l.size,w=[],T=[],{lods:E}=l;E.forEach((e,t)=>{e.level>=f.level&&e.level<=d.level&&w.push({x:e.resolution,y:e.resolution}),t<E.length-1&&T.push(Math.round(10*e.resolution/E[t+1].resolution)/10)}),w.sort((e,t)=>e.x-t.x);let D=this.computeBlockBoundary(_,S,C,l.origin,w,x),O=w.length>1?w.slice(1):null,k;o.transposeInfo&&(k={tileSize:[o.transposeInfo.rows,o.transposeInfo.cols],packetSize:c.keyProperties?._yxs.PacketSize??0});let A=T.length<=1||T.length>=3&&T.slice(0,-1).every(e=>e===T[0])?T[0]??2:Math.round(10/(f.resolution/d.resolution)**(-1/x))/10,j=!!o.bsq&&this.tileType===`Raster`;if(c.storageInfo=new p({blockWidth:l.size[0],blockHeight:l.size[1],pyramidBlockWidth:l.size[0],pyramidBlockHeight:l.size[1],pyramidResolutions:O,pyramidScalingFactor:A,compression:l.format,origin:l.origin,firstPyramidLevel:1,maximumPyramidLevel:x,tileInfo:l,isBsqTile:j,transposeInfo:k,blockBoundary:D}),u(c),this._set(`rasterInfo`,c),o.capabilities.toLowerCase().includes(`tilemap`)){let e={tileInfo:c.storageInfo.tileInfo,parsedUrl:r(this.url),url:this.url,tileServers:[]};this._tilemapCache=new h({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if(this.tileType===`Map`){let e=t.fullExtent||t.extent,n=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),i=c.fromJSON(t.spatialReference||e.spatialReference),a=new s({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:i});return new f({width:n,height:r,bandCount:3,extent:o.fromJSON(e),spatialReference:i,pixelSize:a,pixelType:`u8`,statistics:null,keyProperties:{DataType:`processed`}})}let n={...e,query:{...this.ioConfig.customFetchParameters,f:`json`}},r=_(this.url,this.sourceJSON,n),i=t.hasMultidimensions?this.request(`${this.url}/slices`,n).then(e=>e.data?.slices).catch(()=>null):null,a=await Promise.all([r,i]);return this._slices=a[1],a[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:n}=e,r=.5/e.width*n.x,{lods:i}=t,a=t.lodAt(Math.max.apply(null,i.map(e=>e.level))),o=t.lodAt(Math.min.apply(null,i.map(e=>e.level))),{tileType:s}=this;if(s===`Map`)return this._levelOffset=i[0].level,[a,o];if(s===`Raster`)return[i.find(e=>e.resolution===n.x)??a,o];let{minScale:c,maxScale:l}=this.sourceJSON,u=a;l>0&&(u=i.find(e=>Math.abs(e.scale-l)<r),u||=i.filter(e=>e.scale>l).sort((e,t)=>e.scale>t.scale?1:-1)[0]??a);let d=o;return c>0&&(d=i.find(e=>Math.abs(e.scale-c)<r)??o,this._levelOffset=d.level-o.level),[u,d]}};e([i({type:String,json:{write:!0}})],v.prototype,`datasetFormat`,void 0),e([i()],v.prototype,`tileType`,void 0),v=e([a(`esri.layers.raster.datasets.ImageServerRaster`)],v);function y(e,t){if(!e)return null;let{minScale:n,maxScale:r,minLOD:i,maxLOD:a}=t;if(i!=null&&a!=null)return m.fromJSON({...e,lods:e.lods.filter(({level:e})=>e!=null&&e>=i&&e<=a)});if(n!==0&&r!==0){let t=e=>Math.round(e*1e4)/1e4,i=n?t(n):1/0,a=r?t(r):-1/0;return m.fromJSON({...e,lods:e.lods.filter(e=>{let n=t(e.scale);return n<=i&&n>=a})})}return m.fromJSON(e)}const b=v;export{b as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import a from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{parseSpatialReference as c,parsePAMInfo as l}from"./pamParser.js";import{getElement as u,getElementValue as d}from"./xmlUtilities.js";import{isPlatformLittleEndian as f}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import h from"../../support/RasterInfo.js";import g from"../../support/RasterStorageInfo.js";const _=new Map([[`byte`,`u8`],[`signedbyte`,`s8`],[`int8`,`s8`],[`uint8`,`u8`],[`int16`,`s16`],[`uint16`,`u16`],[`int32`,`s32`],[`uint32`,`u32`],[`float32`,`f32`],[`float64`,`f64`],[`double64`,`f64`]]),v=new Map;v.set(`none`,{blobExtension:`.til`,isOneSegment:!0,decoderFormat:`bip`}),v.set(`lerc`,{blobExtension:`.lrc`,isOneSegment:!1,decoderFormat:`lerc`}),v.set(`deflate`,{blobExtension:`.pzp`,isOneSegment:!0,decoderFormat:`deflate`}),v.set(`jpeg`,{blobExtension:`.pjg`,isOneSegment:!0,decoderFormat:`jpg`}),v.set(`qb3`,{blobExtension:`.pq3`,isOneSegment:!0,decoderFormat:`qb3`});let y=class extends s{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat=`MRF`}async fetchRawTile(e,t,n,r={}){let{blockWidth:i,blockHeight:a,blockBoundary:o}=this.rasterInfo.storageInfo,s=o[e];if(!s||s.maxRow<t||s.maxCol<n||s.minRow>t||s.minCol>n)return null;let{bandCount:c,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:d,actualTileHeight:f}=this._getTileLocation(e,t,n);if(!u||u.length===0)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(i*a);return new m({width:i,height:a,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,h=this._getBandSegmentCount(),g=[],_=0;for(_=0;_<h;_++)(!p||p.includes(_))&&g.push(this.request(this._files.data,{range:{from:u[_].from,to:u[_].to},responseType:`array-buffer`,signal:r.signal}));let y=await Promise.all(g),b=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(b),S=[],C=0;for(_=0;_<h;_++)S.push(C),x.set(new Uint8Array(y[_].data),C),C+=y[_].data.byteLength;let w=v.get(this.rasterInfo.storageInfo.compression).decoderFormat,T=w===`jpg`&&c===4&&S.length===1,E=await this.decodePixelBlock(x.buffer,{width:i,height:a,format:w,planes:p?.length||c,offsets:S,pixelType:l,canvasUsage:T?`no-canvas`:void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(E==null)return null;let{noDataValue:D}=this.rasterInfo;if(D!=null&&w!==`lerc`&&!E.mask&&(D=D[0],D!=null)){let e=E.width*E.height,t=new Uint8Array(e);if(Math.abs(D)>1e24)for(_=0;_<e;_++)Math.abs((E.pixels[0][_]-D)/D)>1e-6&&(t[_]=1);else for(_=0;_<e;_++)E.pixels[0][_]!==D&&(t[_]=1);E.mask=t}let O=0,k=0;if(d!==i||f!==a){let e=E.mask;if(e)for(_=0;_<a;_++)if(k=_*i,_<f)for(O=d;O<i;O++)e[k+O]=0;else for(O=0;O<i;O++)e[k+O]=0;else for(e=new Uint8Array(i*a),E.mask=e,_=0;_<f;_++)for(k=_*i,O=0;O<d;O++)e[k+O]=1}return E}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1);let t=e?e.signal:null,n=await this.request(this.url,{responseType:`xml`,signal:t}),{rasterInfo:r,files:i}=this._parseHeader(n.data),{skipMapInfo:a,skipExtensions:o=[]}=this.ioConfig;if(!o.includes(`aux.xml`)&&!a){let t=await this._fetchAuxiliaryData(e);t!=null&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&r.statistics==null&&(r.statistics=p(t.histograms)))}a&&this.updateImageSpaceRasterInfo(r),this._set(`rasterInfo`,r),this._files=i;let s=await this.request(i.index,{responseType:`array-buffer`,signal:t});this._storageIndex=b(s.data);let{blockWidth:c,blockHeight:l}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:d,height:f}=this.rasterInfo,m=[],h=this._getBandSegmentCount(),g=0,_=-1;for(;g<this._storageIndex.length;){_++;let e=Math.ceil(d/c/u**_)-1,t=Math.ceil(f/l/u**_)-1;g+=(e+1)*(t+1)*h*4,m.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,_>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=_),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,n){let{blockWidth:r,blockHeight:i,pyramidScalingFactor:a}=this.rasterInfo.storageInfo,{width:o,height:s}=this.rasterInfo,c=this._getBandSegmentCount(),l,u,d,f=0,p=0;for(d=0;d<e;d++)p=a**d,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=l*u;p=a**e,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=t*l+n,f*=c*4;let m=this._storageIndex.subarray(f,f+4*c),h=0,g=0,_=[];for(let e=0;e<c;e++)h=m[e*4]*2**32+m[e*4+1],g=h+m[e*4+2]*2**32+m[e*4+3]-1,_.push({from:h,to:g});return{ranges:_,actualTileWidth:n<l-1?r:Math.ceil(o/p)-r*(l-1),actualTileHeight:t<u-1?i:Math.ceil(s/p)-i*(u-1)}}_parseHeader(e){let n=u(e,`MRF_META/Raster`);if(!n)throw new t(`mrf:open`,`not a valid MRF format`);let r=u(n,`Size`),s=parseInt(r.getAttribute(`x`),10),l=parseInt(r.getAttribute(`y`),10),f=parseInt(r.getAttribute(`c`),10),p=(d(n,`Compression`)||`none`).toLowerCase();if(!v.has(p))throw new t(`mrf:open`,`currently does not support compression `+p);let m=d(n,`DataType`)||`UInt8`,y=_.get(m.toLowerCase());if(y==null)throw new t(`mrf:open`,`currently does not support pixel type `+m);let b=u(n,`PageSize`),x=parseInt(b.getAttribute(`x`),10),S=parseInt(b.getAttribute(`y`),10),C=b.getAttribute(`c`),w=C?C===String(f):v.get(p).isOneSegment;this._isBsq=!w;let T=u(n,`DataValues`),E;if(T){let e=T.getAttribute(`NoData`);e!=null&&(E=e.trim().split(` `).map(e=>parseFloat(e)))}if(u(e,`MRF_META/CachedSource`))throw new t(`mrf:open`,`currently does not support MRF referencing other data files`);let D=u(e,`MRF_META/GeoTags`),O=u(D,`BoundingBox`),k=!1,A;if(O!=null){let e=parseFloat(O.getAttribute(`minx`)),t=parseFloat(O.getAttribute(`miny`)),n=parseFloat(O.getAttribute(`maxx`)),r=parseFloat(O.getAttribute(`maxy`)),a=d(D,`Projection`)||``,s=o.WGS84;if(a!==`LOCAL_CS[]`){if(a.toLowerCase().startsWith(`epsg:`)){let e=Number(a.slice(5));!isNaN(e)&&e!==0&&(s=new o({wkid:e}))}else s=c(a)??o.WGS84}else k=!0,s=new o({wkid:3857});A=new i(e,t,n,r),A.spatialReference=s}else k=!0,A=new i({xmin:-.5,ymin:.5-l,xmax:s-.5,ymax:.5,spatialReference:new o({wkid:3857})});let j=u(e,`MRF_META/Rsets`),M=parseInt(j?.getAttribute(`scale`)||`2`,10),N=A.spatialReference,P=new g({origin:new a({x:A.xmin,y:A.ymax,spatialReference:N}),blockWidth:x,blockHeight:S,pyramidBlockWidth:x,pyramidBlockHeight:S,compression:p,pyramidScalingFactor:M}),F=new a({x:A.width/s,y:A.height/l,spatialReference:N}),I=new h({width:s,height:l,extent:A,isPseudoSpatialReference:k,spatialReference:N,bandCount:f,pixelType:y,pixelSize:F,noDataValue:E,storageInfo:P}),L=this._getAuxFullPath(d(n,`DataFile`)),R=this._getAuxFullPath(d(n,`IndexFile`));return{rasterInfo:I,files:{mrf:this.url,index:R||this.url.replace(`.mrf`,`.idx`),data:L||this.url.replace(`.mrf`,v.get(p).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 l(t)}catch{return null}}};e([n()],y.prototype,`_files`,void 0),e([n()],y.prototype,`_storageIndex`,void 0),e([n()],y.prototype,`_isBsq`,void 0),e([n({type:String,json:{write:!0}})],y.prototype,`datasetFormat`,void 0),y=e([r(`esri.layers.raster.datasets.MRFRaster`)],y);function b(e){if(e.byteLength%16>0)throw Error(`invalid array buffer must be multiples of 16`);let t;if(f){let n=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),i=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)i[t*4+e]=n[t*4+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}const x=y;export{x as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import a from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{parseSpatialReference as c,parsePAMInfo as l}from"./pamParser.js";import{getElement as u,getElementValue as d}from"./xmlUtilities.js";import{isPlatformLittleEndian as f}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import h from"../../support/RasterInfo.js";import g from"../../support/RasterStorageInfo.js";const _=new Map([[`byte`,`u8`],[`signedbyte`,`s8`],[`int8`,`s8`],[`uint8`,`u8`],[`int16`,`s16`],[`uint16`,`u16`],[`int32`,`s32`],[`uint32`,`u32`],[`float32`,`f32`],[`float64`,`f64`],[`double64`,`f64`]]),v=new Map;v.set(`none`,{blobExtension:`.til`,isOneSegment:!0,decoderFormat:`bip`}),v.set(`lerc`,{blobExtension:`.lrc`,isOneSegment:!1,decoderFormat:`lerc`}),v.set(`deflate`,{blobExtension:`.pzp`,isOneSegment:!0,decoderFormat:`deflate`}),v.set(`jpeg`,{blobExtension:`.pjg`,isOneSegment:!0,decoderFormat:`jpg`}),v.set(`qb3`,{blobExtension:`.pq3`,isOneSegment:!0,decoderFormat:`qb3`});let y=class extends s{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat=`MRF`}async fetchRawTile(e,t,n,r={}){let{blockWidth:i,blockHeight:a,blockBoundary:o}=this.rasterInfo.storageInfo,s=o[e];if(!s||s.maxRow<t||s.maxCol<n||s.minRow>t||s.minCol>n)return null;let{bandCount:c,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:d,actualTileHeight:f}=this._getTileLocation(e,t,n);if(!u||u.length===0)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(i*a);return new m({width:i,height:a,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,h=this._getBandSegmentCount(),g=[],_=0;for(_=0;_<h;_++)(!p||p.includes(_))&&g.push(this.request(this._files.data,{range:{from:u[_].from,to:u[_].to},responseType:`array-buffer`,signal:r.signal}));let y=await Promise.all(g),b=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(b),S=[],C=0;for(_=0;_<h;_++)S.push(C),x.set(new Uint8Array(y[_].data),C),C+=y[_].data.byteLength;let w=v.get(this.rasterInfo.storageInfo.compression).decoderFormat,T=w===`jpg`&&c===4&&S.length===1,E=await this.decodePixelBlock(x.buffer,{width:i,height:a,format:w,planes:p?.length||c,offsets:S,pixelType:l,canvasUsage:T?`no-canvas`:void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(E==null)return null;let{noDataValue:D}=this.rasterInfo;if(D!=null&&w!==`lerc`&&!E.mask&&(D=D[0],D!=null)){let e=E.width*E.height,t=new Uint8Array(e);if(Math.abs(D)>1e24)for(_=0;_<e;_++)Math.abs((E.pixels[0][_]-D)/D)>1e-6&&(t[_]=1);else for(_=0;_<e;_++)E.pixels[0][_]!==D&&(t[_]=1);E.mask=t}let O=0,k=0;if(d!==i||f!==a){let e=E.mask;if(e)for(_=0;_<a;_++)if(k=_*i,_<f)for(O=d;O<i;O++)e[k+O]=0;else for(O=0;O<i;O++)e[k+O]=0;else for(e=new Uint8Array(i*a),E.mask=e,_=0;_<f;_++)for(k=_*i,O=0;O<d;O++)e[k+O]=1}return E}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1);let t=e?e.signal:null,n=await this.request(this.url,{responseType:`xml`,signal:t}),{rasterInfo:r,files:i}=this._parseHeader(n.data),{skipMapInfo:a,skipExtensions:o=[]}=this.ioConfig;if(!o.includes(`aux.xml`)&&!a){let t=await this._fetchAuxiliaryData(e);t!=null&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&r.statistics==null&&(r.statistics=p(t.histograms)))}a&&this.updateImageSpaceRasterInfo(r),this._set(`rasterInfo`,r),this._files=i;let s=await this.request(i.index,{responseType:`array-buffer`,signal:t});this._storageIndex=b(s.data);let{blockWidth:c,blockHeight:l}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:d,height:f}=this.rasterInfo,m=[],h=this._getBandSegmentCount(),g=0,_=-1;for(;g<this._storageIndex.length;){_++;let e=Math.ceil(d/c/u**_)-1,t=Math.ceil(f/l/u**_)-1;g+=(e+1)*(t+1)*h*4,m.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,_>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=_),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,n){let{blockWidth:r,blockHeight:i,pyramidScalingFactor:a}=this.rasterInfo.storageInfo,{width:o,height:s}=this.rasterInfo,c=this._getBandSegmentCount(),l,u,d,f=0,p=0;for(d=0;d<e;d++)p=a**d,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=l*u;p=a**e,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=t*l+n,f*=c*4;let m=this._storageIndex.subarray(f,f+4*c),h=0,g=0,_=[];for(let e=0;e<c;e++)h=m[e*4]*2**32+m[e*4+1],g=h+m[e*4+2]*2**32+m[e*4+3]-1,_.push({from:h,to:g});return{ranges:_,actualTileWidth:n<l-1?r:Math.ceil(o/p)-r*(l-1),actualTileHeight:t<u-1?i:Math.ceil(s/p)-i*(u-1)}}_parseHeader(e){let n=u(e,`MRF_META/Raster`);if(!n)throw new t(`mrf:open`,`not a valid MRF format`);let r=u(n,`Size`),s=parseInt(r.getAttribute(`x`),10),l=parseInt(r.getAttribute(`y`),10),f=parseInt(r.getAttribute(`c`),10),p=(d(n,`Compression`)||`none`).toLowerCase();if(!v.has(p))throw new t(`mrf:open`,`currently does not support compression `+p);let m=d(n,`DataType`)||`UInt8`,y=_.get(m.toLowerCase());if(y==null)throw new t(`mrf:open`,`currently does not support pixel type `+m);let b=u(n,`PageSize`),x=parseInt(b.getAttribute(`x`),10),S=parseInt(b.getAttribute(`y`),10),C=b.getAttribute(`c`),w=C?C===String(f):v.get(p).isOneSegment;this._isBsq=!w;let T=u(n,`DataValues`),E;if(T){let e=T.getAttribute(`NoData`);e!=null&&(E=e.trim().split(` `).map(e=>parseFloat(e)))}if(u(e,`MRF_META/CachedSource`))throw new t(`mrf:open`,`currently does not support MRF referencing other data files`);let D=u(e,`MRF_META/GeoTags`),O=u(D,`BoundingBox`),k=!1,A;if(O!=null){let e=parseFloat(O.getAttribute(`minx`)),t=parseFloat(O.getAttribute(`miny`)),n=parseFloat(O.getAttribute(`maxx`)),r=parseFloat(O.getAttribute(`maxy`)),a=d(D,`Projection`)||``,s=o.WGS84;if(a!==`LOCAL_CS[]`){if(a.toLowerCase().startsWith(`epsg:`)){let e=Number(a.slice(5));!isNaN(e)&&e!==0&&(s=new o({wkid:e}))}else s=c(a)??o.WGS84}else k=!0,s=new o({wkid:3857});A=new i({xmin:e,ymin:t,xmax:n,ymax:r}),A.spatialReference=s}else k=!0,A=new i({xmin:-.5,ymin:.5-l,xmax:s-.5,ymax:.5,spatialReference:new o({wkid:3857})});let j=u(e,`MRF_META/Rsets`),M=parseInt(j?.getAttribute(`scale`)||`2`,10),N=A.spatialReference,P=new g({origin:new a({x:A.xmin,y:A.ymax,spatialReference:N}),blockWidth:x,blockHeight:S,pyramidBlockWidth:x,pyramidBlockHeight:S,compression:p,pyramidScalingFactor:M}),F=new a({x:A.width/s,y:A.height/l,spatialReference:N}),I=new h({width:s,height:l,extent:A,isPseudoSpatialReference:k,spatialReference:N,bandCount:f,pixelType:y,pixelSize:F,noDataValue:E,storageInfo:P}),L=this._getAuxFullPath(d(n,`DataFile`)),R=this._getAuxFullPath(d(n,`IndexFile`));return{rasterInfo:I,files:{mrf:this.url,index:R||this.url.replace(`.mrf`,`.idx`),data:L||this.url.replace(`.mrf`,v.get(p).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 l(t)}catch{return null}}};e([n()],y.prototype,`_files`,void 0),e([n()],y.prototype,`_storageIndex`,void 0),e([n()],y.prototype,`_isBsq`,void 0),e([n({type:String,json:{write:!0}})],y.prototype,`datasetFormat`,void 0),y=e([r(`esri.layers.raster.datasets.MRFRaster`)],y);function b(e){if(e.byteLength%16>0)throw Error(`invalid array buffer must be multiples of 16`);let t;if(f){let n=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),i=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)i[t*4+e]=n[t*4+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}const x=y;export{x as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/Error.js";import t from"./CovJSONRaster.js";import n from"./ImageAuxRaster.js";import r from"./ImageServerRaster.js";import i from"./InMemoryRaster.js";import a from"./MRFRaster.js";import o from"./TIFFRaster.js";const s=new Map;s.set(`MRF`,{desc:`Meta Raster Format`,constructor:a}),s.set(`TIFF`,{desc:`GeoTIFF`,constructor:o}),s.set(`RasterTileServer`,{desc:`Raster Tile Server`,constructor:r}),s.set(`JPG`,{desc:`JPG Raster Format`,constructor:n}),s.set(`PNG`,{desc:`PNG Raster Format`,constructor:n}),s.set(`GIF`,{desc:`GIF Raster Format`,constructor:n}),s.set(`BMP`,{desc:`BMP Raster Format`,constructor:n}),s.set(`CovJSON`,{desc:`COVJSON Raster Format`,constructor:t}),s.set(`MEMORY`,{desc:`In Memory Raster Format`,constructor:i});class c{static get supportedFormats(){let e=new Set;return s.forEach((t,n)=>e.add(n)),e}static async open(t){let{url:n,ioConfig:r,source:i,sourceJSON:a}=t,o=t.datasetFormat??r?.datasetFormat;o??(n.includes(`.`)?o=n.slice(n.lastIndexOf(`.`)+1).toUpperCase():i?.type?.toLowerCase()===`coverage`?o=`CovJSON`:i?.extent&&i.pixelblocks&&(o=`MEMORY`)),o===`OVR`||o===`TIF`||o===`DM`?o=`TIFF`:o===`JPG`||o===`JPEG`||o===`JFIF`?o=`JPG`:o===`COVJSON`&&(o=`CovJSON`),n.toLowerCase().includes(`/imageserver`)&&!n.toLowerCase().includes(`/wcsserver`)&&(o=`RasterTileServer`);let c={url:n,source:i,sourceJSON:a,datasetFormat:o,ioConfig:r??{bandIds:null,sampling:null}};if(Object.keys(c).forEach(e=>{c[e]??delete c[e]}),o){if(!this.supportedFormats.has(o))throw new e(`rasterfactory:open`,`not a supported format `+o);if(o===`CRF`)throw new e(`rasterfactory:open`,`cannot open raster: ${n}`);let r=s.get(o).constructor,i=new r(c);return i.rasterJobHandler=t.rasterJobHandler,i.rasterInfo=t.rasterInfo,await i.open({signal:t.signal}),i}let l=Array.from(s.keys()).filter(e=>e!==`CovJSON`&&e!==`Memory`),u=0,d=()=>{if(o=l[u++],!o||o===`CRF`)return null;let e=s.get(o).constructor,n=new e(c);return n.rasterJobHandler=t.rasterJobHandler,n.open({signal:t.signal}).then(()=>n).catch(()=>d())};return d()}static register(e,t,n){s.has(e.toUpperCase())||s.set(e.toUpperCase(),{desc:t,constructor:n})}}export{c as default};
2
+ import e from"../../../core/Error.js";import t from"./CovJSONRaster.js";import n from"./ImageAuxRaster.js";import r from"./ImageServerRaster.js";import i from"./InMemoryRaster.js";import a from"./MRFRaster.js";import o from"./TIFFRaster.js";import s from"./ZarrRaster.js";const c=new Map;c.set(`RasterTileServer`,{desc:`Raster Tile Server`,constructor:r}),c.set(`TIFF`,{desc:`Cloud Optimized GeoTIFF`,constructor:o}),c.set(`MRF`,{desc:`Meta Raster Format`,constructor:a}),c.set(`ZARR`,{desc:`Zarr Raster Format`,constructor:s}),c.set(`JPG`,{desc:`JPG Raster Format`,constructor:n}),c.set(`PNG`,{desc:`PNG Raster Format`,constructor:n}),c.set(`GIF`,{desc:`GIF Raster Format`,constructor:n}),c.set(`BMP`,{desc:`BMP Raster Format`,constructor:n}),c.set(`CovJSON`,{desc:`COVJSON Raster Format`,constructor:t}),c.set(`MEMORY`,{desc:`In Memory Raster Format`,constructor:i});class l{static get supportedFormats(){let e=new Set;return c.forEach((t,n)=>e.add(n)),e}static async open(t){let{url:n,ioConfig:r,source:i,sourceJSON:a}=t,o=t.datasetFormat??r?.datasetFormat;o??(/(?:\.zarr|\/\.(?:zmetadata|zarray|zgroup))$/.test(n)?o=`ZARR`:n.includes(`.`)?o=n.slice(n.lastIndexOf(`.`)+1).toUpperCase():i?.type?.toLowerCase()===`coverage`?o=`CovJSON`:i?.extent&&i.pixelblocks&&(o=`MEMORY`)),o===`OVR`||o===`TIF`||o===`DM`?o=`TIFF`:o===`JPG`||o===`JPEG`||o===`JFIF`?o=`JPG`:o===`COVJSON`&&(o=`CovJSON`),n.toLowerCase().includes(`/imageserver`)&&!n.toLowerCase().includes(`/wcsserver`)&&(o=`RasterTileServer`);let s={url:n,source:i,sourceJSON:a,datasetFormat:o,ioConfig:r??{bandIds:null,sampling:null}};if(Object.keys(s).forEach(e=>{s[e]??delete s[e]}),o){if(!this.supportedFormats.has(o))throw new e(`rasterfactory:open`,`not a supported format `+o);if(o===`CRF`)throw new e(`rasterfactory:open`,`cannot open raster: ${n}`);let r=c.get(o).constructor,i=new r(s);return i.rasterJobHandler=t.rasterJobHandler,i.rasterInfo=t.rasterInfo,await i.open({signal:t.signal}),i}let l=Array.from(c.keys()).filter(e=>e!==`CovJSON`&&e!==`Memory`),u=0,d=()=>{if(o=l[u++],!o||o===`CRF`)return null;let e=c.get(o).constructor,n=new e(s);return n.rasterJobHandler=t.rasterJobHandler,n.open({signal:t.signal}).then(()=>n).catch(()=>d())};return d()}static register(e,t,n){c.has(e.toUpperCase())||c.set(e.toUpperCase(),{desc:t,constructor:n})}}export{l as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import a from"./BaseRaster.js";import{convertOleDateTimeToEpoch as o}from"./multidimensionalUtils.js";import{parseConsolidatedMetadata as s,parseRasterInfo as c}from"./zarrParser.js";import{getChunkInfo as l,getZarrObjectUrl as u,extractPixelBlock as d,unpackUncompressedChunk as f}from"./zarrUtils.js";const p=`zarr-raster:open`,m=new Set([`none`]);let h=class extends 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,n,r,i={}){let{multidimensionalDefinition:a}=i;if(!a?.length)return null;let o=a[0].variableName,s=this._metadata.dataVariables.find(e=>e.name===o);if(!s)return null;let{storageInfo:c}=s,f=Object.fromEntries(a.map(e=>[e.dimensionName,e.values[0]])),p=this._getDimensionIndices(s,n,r,f);if(!p)return null;let m=s.attributes._ARRAY_DIMENSIONS,{xDimension:h,yDimension:g}=this._metadata,_=l(c,p,m.indexOf(h),m.indexOf(g));if(!_)return null;let v=u(this._baseUrl,`${o}/${_.chunkPath}`),{data:y}=await this.request(v,{responseType:`array-buffer`,signal:i.signal}),{actualSize:b,elementCount:x}=_,S=this._decodeChunk(y,c),C=b.reduce((e,t)=>e*t,1),w=S.length;if(w!==x&&w!==C)throw new t(`zarr-raster:decode`,`Invalid chunk length ${w} for "${v}"; expected ${x} or ${C} values`);return d(S,_)}async _open(e){let n=this.url.slice(this.url.lastIndexOf(`/`)+1);if(n.endsWith(`.zattrs`)||n.endsWith(`.zarray`))throw new t(p,`Unsupported Zarr URL: "${this.url}". Expect a v2 root url or consolidated metadata url`);let r=this._baseUrl;this.datasetName=r.slice(r.lastIndexOf(`/`)+1).replace(`.zarr`,``);let i=e?.signal??void 0,{data:a}=await this.request(`${r}/.zmetadata`,{signal:i}),o=s(a);this._metadata=o;let l=[...o.dataDimensions,...o.dataVariables].find(({storageInfo:{compression:e}})=>!m.has(e));if(l)throw new t(p,`Unsupported Zarr compression "${l.storageInfo.compression}" for array "${l.name}"`);let u={};await Promise.all(o.dataDimensions.map(e=>this._readDimensionValues(e,u,i)));let d=c(o,u);this._dimensionValues=u,this._set(`rasterInfo`,d)}_getDimensionIndices(e,t,n,r){let i=e.attributes._ARRAY_DIMENSIONS,{xDimension:a,yDimension:o}=this._metadata,{chunkSize:s}=e.storageInfo;if(!this.rasterInfo.multidimensionalInfo?.variables.find(t=>t.name===e.name)?.dimensions?.length)return null;let c=[];for(let e=0;e<i.length;e++){let l=i[e];if(l===a)c[e]=n*s[e];else if(l===o)c[e]=t*s[e];else{let t=this._dimensionValues[l],n=r[l],i=t?.indexOf(n)??-1;if(i<0)return null;c[e]=i}}return c}async _readDimensionValues(e,r,i){let{name:a,storageInfo:s}=e,c=s.chunkSize[0],l=s.shape[0];if(c<=0||l<=0)throw new t(p,`Invalid dimension array "${a}" with chunkSize ${c} and totalElements ${l}`);let d=Math.ceil(l/c),f=this._baseUrl,m=[];for(let e=0;e<d;e++){let r=u(f,`${a}/${e}`),o=e===d-1?l-e*c:c;m.push(this.request(r,{responseType:`array-buffer`,signal:i}).then(e=>{let n=this._decodeChunk(e.data,s);if(n.length!==c&&n.length!==o)throw new t(p,`Invalid dimension chunk length for "${a}"`);return n.slice(0,o)}).catch(e=>{throw n(e)?e:new t(p,`Unable to fetch dimension data for "${a}"`)}))}let h=(await Promise.all(m)).flatMap(e=>Array.from(e)),{scaleFactor:g,addOffset:_}=s;if(g!==1||_!==0)for(let e=0;e<h.length;e++)h[e]=h[e]*g+_;r[a]=e.attributes.units===`days since 1899-12-30 00:00:00 UTC`?h.map(o):h}_decodeChunk(e,n){let{compression:r}=n;if(!m.has(r))throw new t(`zarr-raster:decode`,`Unsupported Zarr compression "${r}"`);return f(e,n)}};e([r()],h.prototype,`_baseUrl`,null),e([r({json:{write:!0}})],h.prototype,`_dimensionValues`,void 0),e([r({json:{write:!0}})],h.prototype,`_metadata`,void 0),e([r({type:String,json:{write:!0}})],h.prototype,`datasetFormat`,void 0),h=e([i(`esri.layers.raster.datasets.ZarrRaster`)],h);const g=h;export{g as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- function e(e){return e?.datasetFormat===`Function`}function t(t){return e(t)?t.primaryRasters.rasters:[t]}function n(e,t,n,r){let{x:i,y:a}=t,{x:o,y:s}=n,{xmin:c,xmax:l,ymin:u,ymax:d}=e,{width:f,height:p}=e,m=f/o,h=p/s,g=Math.min(m,h),_=g<=1?0:Math.min(.1,g/100),v=Math.floor((c-i)/o+_),y=Math.floor((a-d)/s+_),b=Math.floor((l-i)/o-_),x=Math.floor((a-u)/s-_),S=r>0&&m<.1?0:b-v+1,C=r>0&&h<.1?0:x-y+1;return{ul:{x:v,y},width:S,height:C}}export{n as getPixelSpaceCoverage,t as getPrimaryRasters,e as isFunctionRaster};
2
+ import e from"../transforms/GCSShiftTransform.js";function t(e){return e?.datasetFormat===`Function`}function n(e){return t(e)?e.primaryRasters.rasters:[e]}function r(e,t,n,r){let{x:i,y:a}=t,{x:o,y:s}=n,{xmin:c,xmax:l,ymin:u,ymax:d}=e,{width:f,height:p}=e,m=f/o,h=p/s,g=Math.min(m,h),_=g<=1?0:Math.min(.1,g/100),v=Math.floor((c-i)/o+_),y=Math.floor((a-d)/s+_),b=Math.floor((l-i)/o-_),x=Math.floor((a-u)/s-_),S=r>0&&m<.1?0:b-v+1,C=r>0&&h<.1?0:x-y+1;return{ul:{x:v,y},width:S,height:C}}function i(t){let{extent:n,spatialReference:r}=t;n.xmin>-1&&n.xmax>181&&r?.wkid&&r.isGeographic&&(t.nativeExtent=t.extent,t.transform=new e,t.extent=t.transform.forwardTransform(n))}export{i as fixGCSShift,r as getPixelSpaceCoverage,n as getPrimaryRasters,t as isFunctionRaster};