@arcgis/core 4.34.0-next.50 → 4.34.0-next.51

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 (256) hide show
  1. package/analysis/ElevationProfile/GroundLine.d.ts +4 -0
  2. package/analysis/ElevationProfile/GroundLine.js +5 -0
  3. package/analysis/ElevationProfile/InputLine.d.ts +4 -0
  4. package/analysis/ElevationProfile/InputLine.js +5 -0
  5. package/analysis/ElevationProfile/Line.d.ts +4 -0
  6. package/analysis/ElevationProfile/Line.js +5 -0
  7. package/analysis/ElevationProfile/LineChartOptions.d.ts +4 -0
  8. package/analysis/ElevationProfile/LineChartOptions.js +5 -0
  9. package/analysis/ElevationProfile/LineViewOptions.d.ts +4 -0
  10. package/analysis/ElevationProfile/LineViewOptions.js +5 -0
  11. package/analysis/ElevationProfile/QueryLine.d.ts +4 -0
  12. package/analysis/ElevationProfile/QueryLine.js +5 -0
  13. package/analysis/ElevationProfile/SceneLine.d.ts +4 -0
  14. package/analysis/ElevationProfile/SceneLine.js +5 -0
  15. package/analysis/ElevationProfile/Units.d.ts +4 -0
  16. package/analysis/ElevationProfile/Units.js +5 -0
  17. package/analysis/ElevationProfile/ViewOptions.d.ts +4 -0
  18. package/analysis/ElevationProfile/ViewOptions.js +5 -0
  19. package/analysis/ElevationProfile/elevationProfileLineTypes.js +5 -0
  20. package/analysis/ElevationProfileAnalysis.js +1 -1
  21. package/assets/esri/core/workers/RemoteClient.js +1 -1
  22. package/assets/esri/core/workers/chunks/{7bd672e534cde0d5787d.js → 0021118bafefd1e47ff7.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{0b52c0ca432761076076.js → 081b22fa73ef7b696409.js} +2 -2
  24. package/assets/esri/core/workers/chunks/0a6d33d013628f671aea.js +1 -0
  25. package/assets/esri/core/workers/chunks/0ce671588de2858516d2.js +1 -0
  26. package/assets/esri/core/workers/chunks/14c6ae4feb4859cfa7c5.js +1 -0
  27. package/assets/esri/core/workers/chunks/20a2b3d1f826e9059884.js +1 -0
  28. package/assets/esri/core/workers/chunks/{c4651243525026e6ddde.js → 2da12a64d3baef4aaaa1.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{3610357c8fa9bec9e0dc.js → 30169cf969d36ea8654e.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{5b0c42bb95d81085061d.js → 35fc8a64674005b1d1d7.js} +1 -1
  31. package/assets/esri/core/workers/chunks/37a97e690786814bf0b3.js +1 -0
  32. package/assets/esri/core/workers/chunks/38f84294fb2fb4663ba5.js +1 -0
  33. package/assets/esri/core/workers/chunks/3eb3af0b6cf3c2f28131.js +1 -0
  34. package/assets/esri/core/workers/chunks/48e64f99720907017778.js +1 -0
  35. package/assets/esri/core/workers/chunks/4bd92232928b832dea76.js +1 -0
  36. package/assets/esri/core/workers/chunks/50e9eafb118d2a221f10.js +1 -0
  37. package/assets/esri/core/workers/chunks/55588e668b6acb6aa390.js +1 -0
  38. package/assets/esri/core/workers/chunks/5b112471dca94b2e8462.js +1 -0
  39. package/assets/esri/core/workers/chunks/5dfe1aed10095385c066.js +1 -0
  40. package/assets/esri/core/workers/chunks/7389841fabe0f319f1e5.js +1 -0
  41. package/assets/esri/core/workers/chunks/77493aa2118d462612a0.js +1 -0
  42. package/assets/esri/core/workers/chunks/7a8d740d1226719a578a.js +1 -0
  43. package/assets/esri/core/workers/chunks/8e0559cc6295008fcdf7.js +1 -0
  44. package/assets/esri/core/workers/chunks/{69e37365c17e7cc4168f.js → 93af38d29d066f27ed28.js} +1 -1
  45. package/assets/esri/core/workers/chunks/944fa8261aad94ae0542.js +1 -0
  46. package/assets/esri/core/workers/chunks/{6775d2ab5faf1fa161db.js → 97a38d700f2cb8807d51.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{45121b7258333c8ebbdb.js → 98ea12c7a000a30f3dc0.js} +1 -1
  48. package/assets/esri/core/workers/chunks/9e479e7e2e51476c3d27.js +1 -0
  49. package/assets/esri/core/workers/chunks/a1e179dd6de9c8769b02.js +1 -0
  50. package/assets/esri/core/workers/chunks/a829969ed44cdb814f27.js +1 -0
  51. package/assets/esri/core/workers/chunks/ac41b882f9cbf8d56f0c.js +1 -0
  52. package/assets/esri/core/workers/chunks/b0ee061747bef6729bb9.js +1 -0
  53. package/assets/esri/core/workers/chunks/b2a035befeeff1a55ad8.js +1 -0
  54. package/assets/esri/core/workers/chunks/ba45dccb4dab5a74d224.js +1 -0
  55. package/assets/esri/core/workers/chunks/c5b2a261d8c216ca4a10.js +1 -0
  56. package/assets/esri/core/workers/chunks/{edc4f230a5bdf928f9fd.js → d1aeb9fe9eb573beefcc.js} +2 -2
  57. package/assets/esri/core/workers/chunks/e3f68f7b408a08d7cd5d.js +1 -0
  58. package/assets/esri/core/workers/chunks/e9716995ce0c3683eafc.js +1 -0
  59. package/assets/esri/core/workers/chunks/{4cc982c99d84e896d535.js → ed25bf087f52e5d3e71b.js} +1 -1
  60. package/assets/esri/core/workers/chunks/f92e608931b1c168cb45.js +1 -0
  61. package/assets/esri/core/workers/chunks/f9f94b5efa9a64cdb407.js +1 -0
  62. package/assets/esri/core/workers/chunks/fb4950995f6780f6c22a.js +1 -0
  63. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +16 -2
  64. package/assets/esri/themes/dark/main.css +1 -1
  65. package/assets/esri/themes/light/main.css +1 -1
  66. package/assets/esri/themes/light/view.css +1 -1
  67. package/chunks/Laserlines.glsl.js +12 -12
  68. package/chunks/sphere.js +1 -1
  69. package/chunks/vec42.js +1 -1
  70. package/config.js +1 -1
  71. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  72. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  73. package/geometry/projection/projectBoundingSphere.js +1 -1
  74. package/geometry/support/DoubleArray.js +1 -1
  75. package/geometry/support/aaBoundingRect.js +1 -1
  76. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  77. package/geometry/support/curves/circleUtils.js +1 -1
  78. package/geometry/support/curves/ellipticArc4Utils.js +1 -1
  79. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  80. package/geometry/support/curves/mathUtils.js +1 -1
  81. package/geometry/support/sphere.js +1 -1
  82. package/interfaces.d.ts +271 -279
  83. package/kernel.js +1 -1
  84. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  85. package/layers/mixins/ArcGISImageService.js +1 -1
  86. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  87. package/package.json +1 -1
  88. package/support/revision.js +1 -1
  89. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  90. package/views/2d/engine/imagery/RasterTileContainer.js +1 -1
  91. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +5 -0
  93. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/AspectTechnique.js +1 -1
  94. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BandArithmeticTechnique.js +1 -1
  95. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
  96. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ColormapToRGBTechnique.js +1 -1
  97. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CompositeBandTechnique.js +1 -1
  98. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ComputeChangeTechnique.js +1 -1
  99. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ContrastBrightnessTechnique.js +1 -1
  100. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ConvolutionTechnique.js +1 -1
  101. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CurvatureTechnique.js +1 -1
  102. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ExtractBandTechnique.js +1 -1
  103. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
  104. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/GrayscaleTechnique.js +1 -1
  105. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/HillshadeTechnique.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/LocalTechnique.js +1 -1
  107. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/MaskTechnique.js +1 -1
  108. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/NDVITechnique.js +1 -1
  109. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/RemapTechnique.js +1 -1
  110. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ShadedReliefTechnique.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SlopeTechnique.js +1 -1
  113. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
  114. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  115. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
  116. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +5 -0
  117. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  118. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  119. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  120. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  121. package/views/3d/analysis/ElevationProfile/ProfileLinesVisualization.js +1 -1
  122. package/views/3d/analysis/ElevationProfile/SceneLineComputation.js +5 -0
  123. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  124. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  125. package/views/3d/analysis/support/measurementUtils.js +1 -1
  126. package/views/3d/camera/constraintUtils/distance.js +1 -1
  127. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  128. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  129. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  130. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  131. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  132. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  133. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  134. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  135. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  136. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  137. package/views/3d/layers/I3SMeshView3D.js +1 -1
  138. package/views/3d/layers/SceneLayerWorker.js +1 -1
  139. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  140. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  141. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  142. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  143. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  144. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  145. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  146. package/views/3d/layers/i3s/I3SProjectionUtil.js +1 -1
  147. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  148. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  149. package/views/3d/state/NearFarHeuristic.js +1 -1
  150. package/views/3d/state/ViewStateManager.js +1 -1
  151. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  152. package/views/3d/state/utils/navigationUtils.js +1 -1
  153. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  154. package/views/3d/support/orientedBoundingBox.js +1 -1
  155. package/views/3d/terrain/OverlayManager.js +1 -1
  156. package/views/3d/terrain/ScaleRangeQueries.js +1 -1
  157. package/views/3d/terrain/SphericalPatch.js +1 -1
  158. package/views/3d/terrain/TerrainSurface.js +1 -1
  159. package/views/3d/terrain/Tile.js +1 -1
  160. package/views/3d/webgl/RenderCamera.js +1 -1
  161. package/views/3d/webgl-engine/Stage.js +1 -1
  162. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  163. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  164. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  165. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  166. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  167. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  168. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  169. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  170. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  171. package/views/3d/webgl-engine/lib/screenSizePerspectiveUtils.js +1 -1
  172. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  173. package/views/analysis/ElevationProfile/Controller.js +5 -0
  174. package/views/analysis/ElevationProfile/GroundLineComputation.js +5 -0
  175. package/views/analysis/ElevationProfile/InputLineComputation.js +5 -0
  176. package/views/analysis/ElevationProfile/LineComputation.js +5 -0
  177. package/views/analysis/ElevationProfile/QueryLineComputation.js +5 -0
  178. package/views/analysis/ElevationProfile/Result.d.ts +4 -0
  179. package/views/analysis/{ElevationProfileResult.js → ElevationProfile/Result.js} +1 -1
  180. package/views/interactive/coordinateHelper.js +1 -1
  181. package/views/interactive/editGeometry/operations/curveOperationUtils.js +1 -1
  182. package/views/interactive/sketch/constraints.js +1 -1
  183. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  184. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  185. package/views/support/LayerLayerViewInfo.js +1 -1
  186. package/views/support/LayerViewManager.js +1 -1
  187. package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
  188. package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
  189. package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
  190. package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
  191. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  192. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  193. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +5 -0
  194. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  195. package/widgets/VideoPlayer/css.js +1 -1
  196. package/widgets/VideoPlayer.js +1 -1
  197. package/analysis/ElevationProfileLine.d.ts +0 -4
  198. package/analysis/ElevationProfileLine.js +0 -5
  199. package/analysis/ElevationProfileLineChartOptions.d.ts +0 -4
  200. package/analysis/ElevationProfileLineChartOptions.js +0 -5
  201. package/analysis/ElevationProfileLineGround.d.ts +0 -4
  202. package/analysis/ElevationProfileLineGround.js +0 -5
  203. package/analysis/ElevationProfileLineInput.d.ts +0 -4
  204. package/analysis/ElevationProfileLineInput.js +0 -5
  205. package/analysis/ElevationProfileLineQuery.d.ts +0 -4
  206. package/analysis/ElevationProfileLineQuery.js +0 -5
  207. package/analysis/ElevationProfileLineScene.d.ts +0 -4
  208. package/analysis/ElevationProfileLineScene.js +0 -5
  209. package/analysis/ElevationProfileLineViewOptions.d.ts +0 -4
  210. package/analysis/ElevationProfileLineViewOptions.js +0 -5
  211. package/analysis/ElevationProfileUnits.d.ts +0 -4
  212. package/analysis/ElevationProfileUnits.js +0 -5
  213. package/analysis/ElevationProfileViewOptions.d.ts +0 -4
  214. package/analysis/ElevationProfileViewOptions.js +0 -5
  215. package/analysis/support/elevationProfileLineTypes.js +0 -5
  216. package/assets/esri/core/workers/chunks/21a90083f29e44ccd735.js +0 -1
  217. package/assets/esri/core/workers/chunks/224872bfd923cf4c9d78.js +0 -1
  218. package/assets/esri/core/workers/chunks/237c96d946efa5ed0386.js +0 -1
  219. package/assets/esri/core/workers/chunks/2942ab268f24cea2e722.js +0 -1
  220. package/assets/esri/core/workers/chunks/32789077e37d5c8191e7.js +0 -1
  221. package/assets/esri/core/workers/chunks/3e3886a51c0f8c86df75.js +0 -1
  222. package/assets/esri/core/workers/chunks/6d786fac4bb5efcb7acc.js +0 -1
  223. package/assets/esri/core/workers/chunks/7b95da70d39ba316b051.js +0 -1
  224. package/assets/esri/core/workers/chunks/7df8c78e36b04ad657d2.js +0 -1
  225. package/assets/esri/core/workers/chunks/838c7fd37b2e78b1d582.js +0 -1
  226. package/assets/esri/core/workers/chunks/8c6119dde0eead8d90d9.js +0 -1
  227. package/assets/esri/core/workers/chunks/8c8c8f1058a4b58a3181.js +0 -1
  228. package/assets/esri/core/workers/chunks/8f70650aba8e55eb7a96.js +0 -1
  229. package/assets/esri/core/workers/chunks/96a34b240d17147902f4.js +0 -1
  230. package/assets/esri/core/workers/chunks/9af47a4da3a0b84f1add.js +0 -1
  231. package/assets/esri/core/workers/chunks/9affcf990ea810fa426b.js +0 -1
  232. package/assets/esri/core/workers/chunks/a3dce23ca98c9b0f945f.js +0 -1
  233. package/assets/esri/core/workers/chunks/a50026e567b1edff87c6.js +0 -1
  234. package/assets/esri/core/workers/chunks/a7ff44157b8cf19de37e.js +0 -1
  235. package/assets/esri/core/workers/chunks/b884bd2f50aaccfa24c5.js +0 -1
  236. package/assets/esri/core/workers/chunks/c483d2149d9d0099bfdb.js +0 -1
  237. package/assets/esri/core/workers/chunks/cfc3f202e7313ca56823.js +0 -1
  238. package/assets/esri/core/workers/chunks/d1c97fdcba6eb443cb1c.js +0 -1
  239. package/assets/esri/core/workers/chunks/d7c679374aa2d256becf.js +0 -1
  240. package/assets/esri/core/workers/chunks/d8d17e3ecccec7e99f0b.js +0 -1
  241. package/assets/esri/core/workers/chunks/e4069352d5d1104749ae.js +0 -1
  242. package/assets/esri/core/workers/chunks/e408ccee12bfe089c913.js +0 -1
  243. package/assets/esri/core/workers/chunks/e5522c85ca4f0efab8ea.js +0 -1
  244. package/assets/esri/core/workers/chunks/e59e09766b130a05c617.js +0 -1
  245. package/assets/esri/core/workers/chunks/ef02e33ea53b46b566cb.js +0 -1
  246. package/assets/esri/core/workers/chunks/ff79a8df1b1941ae350d.js +0 -1
  247. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +0 -5
  248. package/views/analysis/ElevationProfile/ElevationProfileController.js +0 -5
  249. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +0 -5
  250. package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +0 -5
  251. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +0 -5
  252. package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +0 -5
  253. package/views/analysis/ElevationProfileResult.d.ts +0 -4
  254. package/views/support/PixelHighlightOptions.js +0 -5
  255. /package/assets/esri/core/workers/chunks/{edc4f230a5bdf928f9fd.js.LICENSE.txt → d1aeb9fe9eb573beefcc.js.LICENSE.txt} +0 -0
  256. /package/views/analysis/ElevationProfile/{profileUtils.js → profileGenerationUtils.js} +0 -0
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.50",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.51",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import{assertIsSome as o}from"../../../../core/maybe.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as i,create as u,expandWithRect as l,expandWithAABB as f,negativeInfinity as c,fromRect as d}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as h}from"../../data/QueryEngine.js";import{QueryEngineResult as y}from"../../data/QueryEngineResult.js";import p from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as _}from"../../../support/fieldUtils.js";import{createParquetFile as g,readGeoMetadata as x}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as w}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as R}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as F}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as I}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as C}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const q=new w,j=8e3;class b{constructor(){this._files=[],this._queue=new n({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(r){this.setCustomParameters(r.customParameters),this._files=await Promise.all(r.urls.map(e=>g(e,{geometryInfo:r.geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters}))),this._metadata=I.createFeature(r.metadata),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:r.geometryInfo?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.fromJSON(r.geometryInfo?.spatialReference),aggregateAdapter:null,timeInfo:null,definitionExpression:null};const s=this._files[0];if(!s)return{extent:null};const{fields:o,timeZoneByFieldName:n}=r.metadata.fieldsIndex,f=o.map(e=>({...e,column:s.columnForFieldName(e.name)})),d=p.fromJSON({fields:f,timeZoneByFieldName:n});if(this._fieldsIndex=d,r.metadata.spatialReference&&(this._fullExtent=v(this._files,r.metadata.spatialReference)),null==this._fullExtent&&"location"===r.geometryInfo?.encoding.type){const{latitudeFieldName:s,longitudeFieldName:o}=r.geometryInfo.encoding,n=this._fieldsIndex.get(s)?.column,a=this._fieldsIndex.get(o)?.column,f=i(u(),c);for(const r of this._files)for(const s of r.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(n),!1),o=e(r,s.columnDescriptorForAttribute(a),!1),i=[o.minValue(),t.minValue(),o.maxValue(),t.maxValue()];l(f,i),s.free()}catch(m){r.error=m,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:f[0],ymin:f[1],xmax:f[3],ymax:f[4],spatialReference:r.metadata.spatialReference}}return{extent:this._fullExtent}}destroy(){for(const e of this._files)e.free();this._queue.destroy()}setCustomParameters(e){this._customParameters=e}async queryFeatures(e,t){this._validateQuery(e),e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!Q(e))return this._getFeatureCount();e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.resultOffset=e.resultOffset??0,delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!Q(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!Q(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.resultOffset=e.resultOffset??0,e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.returnGeometry=!0,delete e.outFields;const o=i(u(),c),n=u(),a=await this._enqueueQuery(e,t);let l=0;for(const r of a.items)r.getBounds(n)&&(f(o,n),l+=1);return{count:l,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return this._files.reduce((e,t)=>e+t.numRows(),0)}_validateQuery(e){if(e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e})}async*_fetchChunks(e,t){const r=this._files[0].numRows(),s=Math.ceil(r/j);for(let o=0;o<s;o++){const r=o*j,s=await this._files[0].readChunk(r,j,e.fields,e.returnGeometry,t);for(const e of s){const t=new C(this._metadata,this._fieldsIndex,e,0),r=new R(t,null,0,!1),s=O(this._metadata,r,this._queryEngineParams);yield s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){let r=e.resultRecordCount,s=e.resultOffset;o(r),o(s),delete e.resultRecordCount,delete e.resultOffset;const n=await this._getReadParams(e),a=[];for await(const o of this._fetchChunks(n,t)){const n=await o.executeQueryForOpaqueFeatures(e,t);if(n.length>s){const t=n.slice(s,Math.min(r,n.length));for(const e of t)a.push(e);if(s=0,r-=t.length,0===r)return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}else s-=n.length}return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}async _getReadParams(e){const t=new Set;if(e.where&&await _(t,this._fieldsIndex,e.where),e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const r of e){const e=this._fieldsIndex.get(r);if(null==e)throw new s("unknown-field",`Field ${r} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function Q(e){return Object.keys(e).some(e=>S(e))}function S(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function O(e,t,r){const s=new F(e);return s.insert(t),new h({...r,featureStore:s})}function E(e){switch(e.length){case 4:return d(u(),e);case 6:return e;default:throw new s("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function v(e,t){const r=i(u(),c);for(const s of e){const e=x(s);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=E(t.bbox);f(r,o)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}export{b as default};
5
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import{assertIsSome as o}from"../../../../core/maybe.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as i,create as u,expandWithRect as l,expandWithAABB as f,negativeInfinity as c,fromRect as d}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as h}from"../../data/QueryEngine.js";import{QueryEngineResult as y}from"../../data/QueryEngineResult.js";import p from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as _}from"../../../support/fieldUtils.js";import{createParquetFile as g,readGeoMetadata as x}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as w}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as R}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as F}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as I}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as C}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const q=new w,j=8e3;class b{constructor(){this._files=[],this._queue=new n({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(r){this.setCustomParameters(r.customParameters),this._files=await Promise.all(r.urls.map(e=>g(e,{geometryInfo:r.geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters}))),this._metadata=I.createFeature(r.metadata),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:r.geometryInfo?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:a.fromJSON(r.geometryInfo?.spatialReference),aggregateAdapter:null,timeInfo:null,definitionExpression:null};const s=this._files[0];if(!s)return{extent:null};const{fields:o,timeZoneByFieldName:n}=r.metadata.fieldsIndex,f=o.map(e=>({...e,column:s.columnForFieldName(e.name)})),d=p.fromJSON({fields:f,timeZoneByFieldName:n});if(this._fieldsIndex=d,r.metadata.spatialReference&&(this._fullExtent=v(this._files,r.metadata.spatialReference)),null==this._fullExtent&&"location"===r.geometryInfo?.encoding.type){const{latitudeFieldName:s,longitudeFieldName:o}=r.geometryInfo.encoding,n=this._fieldsIndex.get(s)?.column,a=this._fieldsIndex.get(o)?.column,f=i(u(),c);for(const r of this._files)for(const s of r.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(n),!1),o=e(r,s.columnDescriptorForAttribute(a),!1),i=[o.minValue(),t.minValue(),o.maxValue(),t.maxValue()];l(f,i),s.free()}catch(m){r.error=m,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:f[0],ymin:f[1],xmax:f[3],ymax:f[4],spatialReference:r.metadata.spatialReference}}return{extent:this._fullExtent}}destroy(){for(const e of this._files)e.free();this._queue.destroy()}setCustomParameters(e){this._customParameters=e}async queryFeatures(e,t){this._validateQuery(e),e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!Q(e))return this._getFeatureCount();e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.resultOffset=e.resultOffset??0,delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!Q(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!Q(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.resultOffset=e.resultOffset??0,e.resultRecordCount=e.resultRecordCount??this._getFeatureCount(),e.returnGeometry=!0,delete e.outFields;const o=i(u(),c),n=u(),a=await this._enqueueQuery(e,t);let l=0;for(const r of a.items)r.getBounds(n)&&(f(o,n),l+=1);return{count:l,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return this._files.reduce((e,t)=>e+t.numRows(),0)}_validateQuery(e){if(e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e})}async*_fetchChunks(e,t){const r=this._files[0].numRows(),s=Math.ceil(r/j);for(let o=0;o<s;o++){const r=o*j,s=await this._files[0].readChunk(r,j,e.fields,e.returnGeometry,t);for(const e of s){const t=new C(this._metadata,this._fieldsIndex,e,0),r=new R(t,null,0,!1),s=O(this._metadata,r,this._queryEngineParams);yield s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){let r=e.resultRecordCount,s=e.resultOffset;o(r),o(s),delete e.resultRecordCount,delete e.resultOffset;const n=await this._getReadParams(e),a=[];for await(const o of this._fetchChunks(n,t)){const n=await o.executeQueryForOpaqueFeatures(e,t);if(n.length>s){const t=n.slice(s,Math.min(s+r,n.length));for(const e of t)a.push(e);if(s=0,r-=t.length,0===r)return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}else s-=n.length}return new y(a,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._metadata.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:q})}async _getReadParams(e){const t=new Set;if(e.where&&await _(t,this._fieldsIndex,e.where),e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);if(e.outFields)for(const r of e.outFields)t.add(r);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const r of e){const e=this._fieldsIndex.get(r);if(null==e)throw new s("unknown-field",`Field ${r} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function Q(e){return Object.keys(e).some(e=>S(e))}function S(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function O(e,t,r){const s=new F(e);return s.insert(t),new h({...r,featureStore:s})}function E(e){switch(e.length){case 4:return d(u(),e);case 6:return e;default:throw new s("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function v(e,t){const r=i(u(),c);for(const s of e){const e=x(s);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=E(t.bbox);f(r,o)}return{xmin:r[0],ymin:r[1],xmax:r[3],ymax:r[4],spatialReference:t}}export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import{clone as n}from"../../core/lang.js";import a from"../../core/Logger.js";import{watch as o}from"../../core/reactiveUtils.js";import{urlToObject as l}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import y from"../../geometry/Extent.js";import R from"../../geometry/Polygon.js";import I from"../../geometry/SpatialReference.js";import{srToRESTValue as v}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as b}from"../support/commonProperties.js";import S from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as x}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as O}from"../support/imageryRendererUtils.js";import T from"../support/MosaicRule.js";import C from"../support/MultidimensionalSubset.js";import M from"../support/PixelBlock.js";import{interpolationKebab as P,noDataInterpretationKebab as N,pixelTypeKebabDict as q}from"../support/rasterEnums.js";import{getServicePixelValueField as j,getItemPixelValueField as A,getRawServicePixelValueField as E,getProcessedServicePixelValueField as V,getMagnitudeField as Q,getDirectionField as J,getMultidimensionalFields as U,getRasterAttributeTableFields as B,commonRasterFieldNames as L,addMultidimensionalFieldValues as z,rasterFieldPrefix as H}from"../support/rasterFieldUtils.js";import G from"../support/RasterFunction.js";import k from"../support/RasterInfo.js";import{intersectMultimensionalSubset as W,getEffectiveMultidimensionalDefinition as $,getSubsetVariablesFromMdInfo as X,getDefaultMultidimensionalDefinition as K}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Y,getFormat as Z}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as ee}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as te}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as ie,getSupportedRendererTypes as re,matchPresetRenderer as se,getDefaultBandCombination as ne,normalizeRendererJSON as ae}from"../../renderers/support/rasterRendererHelper.js";import oe from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as le,rasterRendererTypes as ue,read as pe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as me,computeAngles as ce,computePixelSpaceLocations as he,computeHistograms as de,computeStatisticsHistograms as fe,measureHeight as ge,measureAreaAndPerimeter as ye,measureDistanceAndAngle as Re,measurePointOrCentroid as Ie,measureLengthFromImage as ve,measureAreaFromImage as we,getImageSpatialReferenceQueryParameter as be,getSamples as Se,identify as xe,imageToMap as _e,imageToMapMultiray as Fe,mapToImage as De,findImages as Oe,getImageUrl as Te,queryBoundary as Ce,queryGPSInfo as Me}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Pe,generateRasterInfo as Ne,patchServiceInfo as qe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as je}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Ae}from"../../rest/query/executeForCount.js";import{executeForIds as Ee}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ve}from"../../rest/query/executeQueryJSON.js";import Qe from"../../rest/support/FeatureSet.js";import Je from"../../rest/support/ImageIdentifyParameters.js";import Ue from"../../rest/support/Query.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Le=m(h,{min:0,max:255});function ze(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=m=>{const h=m;let He=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,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 x({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&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=>"number"==typeof e))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?T.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&Be.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=T.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?T.fromJSON(i):this._isMosaicRuleSupported(t)?T.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Le(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return l(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return 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,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=pe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),O(s)||a.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map(e=>e.clone())??[];e.push(j()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(A()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(E()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(V(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=Q(i),s=J();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=U(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=B(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=G.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?G.fromJSON({rasterFunctionDefinition:t.renderingRule}):G.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?I.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=q.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=ie(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new oe({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.toJSON(),{bandId:r}=i;if(null==r)i.bandId=0;else{const e=this.bandIds?.length?this.bandIds.indexOf(r):r;if(e<0||e>2)return;i.bandId=e}const s=this._rasterJobHandler;s?await s.highlightPixels({...e,highlightOptions:i},t):ee(e.pixelBlock,e.renderedPixelBlock,i)}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=n(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),me(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new s("imagery-layer:compute-angles","this operation is not supported on the input image service");return ce(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return he(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new s("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),de(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new s("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),fe(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new s("imagery-layer:measure-height","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ye(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Re(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Ie(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new s("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ve(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new s("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return we(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}fetchImage(e,t,i,n={}){if(r(a.getLogger(this),"`ImageryLayer.fetchImage` is deprecated in favor of 'ImageryLayer.fetchPixels'.",{replacement:"ImageryLayer.fetchPixels",version:"4.33",warnOnce:!0}),null==e||null==t||null==i)throw new s("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");return this.internalFetchImage(e,t,i,n)}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),await this._updateCurrentRasterInfo(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await D(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(M.createEmptyBand(l,o));return{pixelData:{pixelBlock:new M({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new x({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(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 s("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Qe.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return je(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:v(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,d=[];for(let i=0;i<p;i++)d.push({x:m,y:h+c*i});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:v(o),outSR:"0:"+e},g=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then(e=>e.data).catch(()=>({})),R=await Promise.all([a,u,g]);let w=R[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=y.fromJSON(R[1]?.geometries?.[0]);b&&(b.spatialReference=new I({wkid:0,imageCoordinateSystem:s}));const S=R[2].geometries?R[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],x=S.length;if(x<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<x;i++)_+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,O+=S[i].x*S[i].y;const T=(x*O-_*F)/(x*D-_*_);let C=0;const M=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return T===1/0?C=P?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=P?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(G,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Pe(Ge(this.parsedUrl),this.sourceJSON,i);const r=ze(e);if(!r)throw new s("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const n=Ne(Ge(this.parsedUrl),e,i);this._functionRasterInfos[r]=n;try{return await n}catch(a){throw this._functionRasterInfos[r]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=be(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(G.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new s("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=n(e);const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Se(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new s("imagery-layer:identify","identify operation is not supported on the input image service");e=n(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=R.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new s("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),r&&null==e.raster&&(e.raster=r),xe(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new s("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new s("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new s("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new s("imagery-layer:find-images","findImages operation is not supported on the input image service");return Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new s("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Te(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Ue({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new s("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Ce(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ve(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ee(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new s("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Me(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ae(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new s("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=L.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new G({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=W(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new s("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let g=e.geometry;this.version<10.91&&"extent"===g?.type&&(g=R.fromExtent(g));const y=this._getQueryParams({geometry:g,timeExtent:d,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete y.f;const I=new Je(y);try{await this._generateRasterInfo(this.rasterFunction);const i=await xe(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?$({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],g=h.map(e=>e.attributes?.[m]),y=new Ue({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p})}catch{throw new s("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return X(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Pe(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),qe(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),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([o(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new S({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new s("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?c(Ue,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&re(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){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new s("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?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=se({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ne(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??ie(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=ae(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new oe({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):Y(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:n,signal:a}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await D(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=Z(u)),!m)throw new s("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?Y(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,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=K(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new T;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&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,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&z(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=L,g=this.rasterFields.some(e=>e.name===d);for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${L.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=W(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=W(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=H+t.name;e.attributes[i]=a[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map(e=>parseFloat(e)),r=i.map(e=>[e]),s=i.map(e=>({minValue:e,maxValue:e,noDataValue:null})),n=new M({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new y(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:te([n.pixels[0][0],n.pixels[1][0]]);e.attributes[L.magnitude]=a[0],e.attributes[L.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>e.domain&&"coded-value"===e.domain.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.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 null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([u({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([u({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([d("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([u({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([u()],He.prototype,"adjustAspectRatio",void 0),e([u({type:[p],json:{write:!0}})],He.prototype,"bandIds",void 0),e([d("bandIds")],He.prototype,"readBandIds",null),e([u({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([d("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([u({type:Number})],He.prototype,"compressionQuality",void 0),e([g("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([u({type:Number})],He.prototype,"compressionTolerance",void 0),e([g("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([u({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([u({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([d("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([u({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([u({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([u()],He.prototype,"rasterInfo",void 0),e([u({readOnly:!0,type:[_]})],He.prototype,"fields",void 0),e([u({readOnly:!0})],He.prototype,"fieldsIndex",null),e([u({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([d("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([u({type:y})],He.prototype,"fullExtent",void 0),e([u({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([u({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([u({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([u({type:String,json:{type:P.jsonValues,read:P.read,write:P.write}})],He.prototype,"interpolation",void 0),e([u()],He.prototype,"minScale",void 0),e([d("service","minScale")],He.prototype,"readMinScale",null),e([u()],He.prototype,"maxScale",void 0),e([d("service","maxScale")],He.prototype,"readMaxScale",null),e([u({type:T})],He.prototype,"mosaicRule",null),e([d("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([g("mosaicRule")],He.prototype,"writeMosaicRule",null),e([u()],He.prototype,"multidimensionalInfo",void 0),e([u({type:C,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([u({json:{type:p}})],He.prototype,"noData",void 0),e([g("noData")],He.prototype,"writeNoData",null),e([u({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],He.prototype,"noDataInterpretation",void 0),e([u({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([d("objectIdField")],He.prototype,"readObjectIdField",null),e([u({readOnly:!0})],He.prototype,"geometryType",void 0),e([u({})],He.prototype,"typeIdField",void 0),e([u({})],He.prototype,"types",void 0),e([u({readOnly:!0})],He.prototype,"parsedUrl",null),e([u({type:Function})],He.prototype,"pixelFilter",void 0),e([u()],He.prototype,"raster",void 0),e([u({readOnly:!0})],He.prototype,"sourceType",void 0),e([d("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([u()],He.prototype,"viewId",void 0),e([u()],He.prototype,"renderer",null),e([u({types:ue,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([d("internalRenderer")],He.prototype,"readRenderer",null),e([g("internalRenderer")],He.prototype,"writeRenderer",null),e([u({clonable:!1})],He.prototype,"symbolizer",void 0),e([u(w)],He.prototype,"opacity",void 0),e([u({readOnly:!0})],He.prototype,"rasterFields",null),e([u({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([u({type:G,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([d("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([u({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([u({readOnly:!0,type:I})],He.prototype,"spatialReference",void 0),e([d("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([u({type:q.apiValues,json:{read:q.read,type:q.jsonValues}})],He.prototype,"pixelType",void 0),e([g("pixelType")],He.prototype,"writePixelType",null),e([u({constructOnly:!0,type:k})],He.prototype,"serviceRasterInfo",void 0),e([u()],He.prototype,"sourceJSON",void 0),e([u(b)],He.prototype,"url",void 0),e([u({readOnly:!0})],He.prototype,"version",void 0),e([d("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([f("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import{clone as n}from"../../core/lang.js";import a from"../../core/Logger.js";import{watch as o}from"../../core/reactiveUtils.js";import{urlToObject as l}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import y from"../../geometry/Extent.js";import R from"../../geometry/Polygon.js";import I from"../../geometry/SpatialReference.js";import{srToRESTValue as v}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as b}from"../support/commonProperties.js";import S from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as x}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import F from"../support/FieldsIndex.js";import{createBitmap as D}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as O}from"../support/imageryRendererUtils.js";import T from"../support/MosaicRule.js";import C from"../support/MultidimensionalSubset.js";import M from"../support/PixelBlock.js";import{interpolationKebab as P,noDataInterpretationKebab as N,pixelTypeKebabDict as q}from"../support/rasterEnums.js";import{getServicePixelValueField as j,getItemPixelValueField as A,getRawServicePixelValueField as E,getProcessedServicePixelValueField as V,getMagnitudeField as Q,getDirectionField as J,getMultidimensionalFields as U,getRasterAttributeTableFields as B,commonRasterFieldNames as L,addMultidimensionalFieldValues as z,rasterFieldPrefix as H}from"../support/rasterFieldUtils.js";import G from"../support/RasterFunction.js";import k from"../support/RasterInfo.js";import{intersectMultimensionalSubset as W,getEffectiveMultidimensionalDefinition as $,getSubsetVariablesFromMdInfo as X,getDefaultMultidimensionalDefinition as K}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Y,getFormat as Z}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as ee}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as te}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as ie,getSupportedRendererTypes as re,matchPresetRenderer as se,getDefaultBandCombination as ne,normalizeRendererJSON as ae}from"../../renderers/support/rasterRendererHelper.js";import oe from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as le,rasterRendererTypes as ue,read as pe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as me,computeAngles as ce,computePixelSpaceLocations as he,computeHistograms as de,computeStatisticsHistograms as fe,measureHeight as ge,measureAreaAndPerimeter as ye,measureDistanceAndAngle as Re,measurePointOrCentroid as Ie,measureLengthFromImage as ve,measureAreaFromImage as we,getImageSpatialReferenceQueryParameter as be,getSamples as Se,identify as xe,imageToMap as _e,imageToMapMultiray as Fe,mapToImage as De,findImages as Oe,getImageUrl as Te,queryBoundary as Ce,queryGPSInfo as Me}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Pe,generateRasterInfo as Ne,patchServiceInfo as qe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as je}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Ae}from"../../rest/query/executeForCount.js";import{executeForIds as Ee}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ve}from"../../rest/query/executeQueryJSON.js";import Qe from"../../rest/support/FeatureSet.js";import Je from"../../rest/support/ImageIdentifyParameters.js";import Ue from"../../rest/support/Query.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Le=m(h,{min:0,max:255});function ze(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=m=>{const h=m;let He=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,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 x({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&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=>"number"==typeof e))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?T.fromJSON(t):null}get fieldsIndex(){return this.fields?new F(this.fields):null}set format(e){e&&Be.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=T.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?T.fromJSON(i):this._isMosaicRuleSupported(t)?T.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Le(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return l(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return 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,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=pe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),O(s)||a.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map(e=>e.clone())??[];e.push(j()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(A()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(E()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(V(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=Q(i),s=J();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=U(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=B(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=G.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?G.fromJSON({rasterFunctionDefinition:t.renderingRule}):G.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?I.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=q.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=ie(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new oe({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},{bandId:i}=t;if(null==i)t.bandId=0;else{const e=this.bandIds?.length?this.bandIds.indexOf(i):i;if(e<0||e>2)return;t.bandId=e}return t}).filter(e=>null!=e),r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):ee(e.pixelBlock,e.renderedPixelBlock,i)}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=n(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),me(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new s("imagery-layer:compute-angles","this operation is not supported on the input image service");return ce(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return he(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new s("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),de(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new s("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),fe(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new s("imagery-layer:measure-height","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ye(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Re(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),Ie(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new s("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ve(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new s("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return we(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}fetchImage(e,t,i,n={}){if(r(a.getLogger(this),"`ImageryLayer.fetchImage` is deprecated in favor of 'ImageryLayer.fetchPixels'.",{replacement:"ImageryLayer.fetchPixels",version:"4.33",warnOnce:!0}),null==e||null==t||null==i)throw new s("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");return this.internalFetchImage(e,t,i,n)}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await D(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(M.createEmptyBand(l,o));return{pixelData:{pixelBlock:new M({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new x({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(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 s("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Qe.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return je(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:v(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,d=[];for(let i=0;i<p;i++)d.push({x:m,y:h+c*i});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:v(o),outSR:"0:"+e},g=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then(e=>e.data).catch(()=>({})),R=await Promise.all([a,u,g]);let w=R[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=y.fromJSON(R[1]?.geometries?.[0]);b&&(b.spatialReference=new I({wkid:0,imageCoordinateSystem:s}));const S=R[2].geometries?R[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],x=S.length;if(x<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<x;i++)_+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,O+=S[i].x*S[i].y;const T=(x*O-_*F)/(x*D-_*_);let C=0;const M=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return T===1/0?C=P?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=P?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(G,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Pe(Ge(this.parsedUrl),this.sourceJSON,i);const r=ze(e);if(!r)throw new s("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const n=Ne(Ge(this.parsedUrl),e,i);this._functionRasterInfos[r]=n;try{return await n}catch(a){throw this._functionRasterInfos[r]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=be(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(G.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new s("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=n(e);const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),Se(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new s("imagery-layer:identify","identify operation is not supported on the input image service");e=n(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=R.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new s("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),r&&null==e.raster&&(e.raster=r),xe(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new s("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new s("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new s("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new s("imagery-layer:find-images","findImages operation is not supported on the input image service");return Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new s("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Te(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Ue({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new s("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Ce(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ve(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ee(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new s("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Me(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ae(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new s("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=L.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new G({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=W(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new s("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let g=e.geometry;this.version<10.91&&"extent"===g?.type&&(g=R.fromExtent(g));const y=this._getQueryParams({geometry:g,timeExtent:d,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete y.f;const I=new Je(y);try{await this._generateRasterInfo(this.rasterFunction);const i=await xe(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?$({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],g=h.map(e=>e.attributes?.[m]),y=new Ue({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p})}catch{throw new s("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return X(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Pe(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),qe(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),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([o(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new S({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new s("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?c(Ue,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&re(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){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new s("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?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=se({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ne(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??ie(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=ae(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new oe({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):Y(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:n,signal:a}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await D(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=Z(u)),!m)throw new s("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?Y(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,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=K(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new T;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&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,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&z(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=L,g=this.rasterFields.some(e=>e.name===d);for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${L.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=W(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=W(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=H+t.name;e.attributes[i]=a[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map(e=>parseFloat(e)),r=i.map(e=>[e]),s=i.map(e=>({minValue:e,maxValue:e,noDataValue:null})),n=new M({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new y(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:te([n.pixels[0][0],n.pixels[1][0]]);e.attributes[L.magnitude]=a[0],e.attributes[L.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>e.domain&&"coded-value"===e.domain.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.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 null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([u({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([u({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([d("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([u({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([u()],He.prototype,"adjustAspectRatio",void 0),e([u({type:[p],json:{write:!0}})],He.prototype,"bandIds",void 0),e([d("bandIds")],He.prototype,"readBandIds",null),e([u({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([d("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([u({type:Number})],He.prototype,"compressionQuality",void 0),e([g("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([u({type:Number})],He.prototype,"compressionTolerance",void 0),e([g("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([u({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([u({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([d("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([u({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([u({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([u()],He.prototype,"rasterInfo",void 0),e([u({readOnly:!0,type:[_]})],He.prototype,"fields",void 0),e([u({readOnly:!0})],He.prototype,"fieldsIndex",null),e([u({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([d("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([u({type:y})],He.prototype,"fullExtent",void 0),e([u({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([u({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([u({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([u({type:String,json:{type:P.jsonValues,read:P.read,write:P.write}})],He.prototype,"interpolation",void 0),e([u()],He.prototype,"minScale",void 0),e([d("service","minScale")],He.prototype,"readMinScale",null),e([u()],He.prototype,"maxScale",void 0),e([d("service","maxScale")],He.prototype,"readMaxScale",null),e([u({type:T})],He.prototype,"mosaicRule",null),e([d("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([g("mosaicRule")],He.prototype,"writeMosaicRule",null),e([u()],He.prototype,"multidimensionalInfo",void 0),e([u({type:C,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([u({json:{type:p}})],He.prototype,"noData",void 0),e([g("noData")],He.prototype,"writeNoData",null),e([u({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],He.prototype,"noDataInterpretation",void 0),e([u({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([d("objectIdField")],He.prototype,"readObjectIdField",null),e([u({readOnly:!0})],He.prototype,"geometryType",void 0),e([u({})],He.prototype,"typeIdField",void 0),e([u({})],He.prototype,"types",void 0),e([u({readOnly:!0})],He.prototype,"parsedUrl",null),e([u({type:Function})],He.prototype,"pixelFilter",void 0),e([u()],He.prototype,"raster",void 0),e([u({readOnly:!0})],He.prototype,"sourceType",void 0),e([d("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([u()],He.prototype,"viewId",void 0),e([u()],He.prototype,"renderer",null),e([u({types:ue,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([d("internalRenderer")],He.prototype,"readRenderer",null),e([g("internalRenderer")],He.prototype,"writeRenderer",null),e([u({clonable:!1})],He.prototype,"symbolizer",void 0),e([u(w)],He.prototype,"opacity",void 0),e([u({readOnly:!0})],He.prototype,"rasterFields",null),e([u({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([u({type:G,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([d("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([u({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([u({readOnly:!0,type:I})],He.prototype,"spatialReference",void 0),e([d("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([u({type:q.apiValues,json:{read:q.read,type:q.jsonValues}})],He.prototype,"pixelType",void 0),e([g("pixelType")],He.prototype,"writePixelType",null),e([u({constructOnly:!0,type:k})],He.prototype,"serviceRasterInfo",void 0),e([u()],He.prototype,"sourceJSON",void 0),e([u(b)],He.prototype,"url",void 0),e([u({readOnly:!0})],He.prototype,"version",void 0),e([d("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([f("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9;function i(t){return null!=t&&t.pixels?.length>0}function o(t,e){return e?.length&&i(t)?t.extractBands(e):t}function r(t){if(!t?.length||t.some(t=>!i(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:o,pixelType:r}=n[0];if(n.some(t=>t.width!==l||t.height!==o))return null;const s=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;s.length&&(a=new Uint8Array(l*o),a.set(s[0]),s.length>1&&g(s.slice(1),a));const h=[];n.forEach(({pixels:t})=>h.push(...t));const f=n.map(({statistics:t})=>t).filter(t=>t?.length),c=[];return f.forEach(t=>c.push(...t)),new e({pixelType:r,width:l,height:o,mask:a,pixels:h,statistics:c.length?c:null})}function s(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach(t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function a(t,e){if(!i(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let o=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(s){const t=s.length-1;if(null!=o)for(let e=0;e<r;e++)o[e]&&(d=4*(c[e]-h),d<h||d>t?o[e]=0:(u[e]=s[d],p[e]=s[d+1],x[e]=s[d+2],o[e]=s[d+3]));else{o=new Uint8Array(r);for(let e=0;e<r;e++)d=4*(c[e]-h),d<h||d>t?o[e]=0:(u[e]=s[d],p[e]=s[d+1],x[e]=s[d+2],o[e]=s[d+3]);n.mask=o}}else if(a)if(null!=o)for(let i=0;i<r;i++)o[i]&&(m=a[c[i]],u[i]=m[0],p[i]=m[1],x[i]=m[2],o[i]=m[3]);else{o=new Uint8Array(r);for(let t=0;t<r;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],o[t]=m[3];n.mask=o}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function h(t,n){if(!i(t))return null;const{pixels:l,mask:o}=t,r=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map(()=>s));const h=[],c=n.outputPixelType||"u8";for(let e=0;e<r;e++){const t=f(l[e],o,s[e],a||0,c);h.push(t)}const u=new e({width:t.width,height:t.height,pixels:h,mask:o,pixelType:c});return u.updateStatistics(),u}function f(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function c(t,e,n){if(!i(t))return;const{width:l,height:o,pixels:r,mask:s}=t,a=l*o,h=new Uint8Array(a),{ranges:f,color:c}=n,u=r[n.bandId];if(!u)return;const p=1===f.length,[x,m]=f[0];for(let i=0;i<a;i++)if(!s||s[i]){const t=u[i];if(p)t>=x&&t<=m&&(h[i]=1);else for(let e=0;e<f.length;e++)if(t>=f[e][0]&&t<=f[e][1]){h[i]=1;break}}const{pixels:d}=e;if(1===d.length&&(d[1]=d[0].slice(),d[2]=d[0].slice()),e.mask){const t=e.mask;for(let e=0;e<a;e++)t[e]&&(t[e]=255,h[e]&&(d[0][e]=c[0],d[1][e]=c[1],d[2][e]=c[2],t[e]=c[3]))}else{const t=new Uint8Array(a).fill(255);for(let e=0;e<a;e++)h[e]&&(d[0][e]=c[0],d[1][e]=c[1],d[2][e]=c[2],t[e]=c[3]);e.mask=t}e.maskIsAlpha=!0}function u(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,o=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],h=l[0],f=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(o);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(o),p.fill(x?255:1),n.mask=p);for(let i=0;i<o;i++)if(p[i]){const t=h[i];let n=!1,l=s,o=a,x=0,m=r-1;for(;m-x>1;){if(t===o.value){n=!0;break}t>o.value?x=l:m=l,l=Math.floor((x+m)/2),o=e[Math.floor(l)]}n||(t===e[x].value?(o=e[x],n=!0):t===e[m].value?(o=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(o=e[x],n=!0):m===r-1?n=!1:(o=e[m],n=!0))),n?(f[i]=o.mappedColor[0],c[i]=o.mappedColor[1],u[i]=o.mappedColor[2],p[i]=o.mappedColor[3]):f[i]=c[i]=u[i]=p[i]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function p(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function x(t,l){if(!i(t))return null;const{width:o,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(o*r);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map(t=>t-y);w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(h);for(let e=0;e<r;e++)for(let t=0;t<o;t++){const n=e*o+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===s[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<o;t++){const n=e*o+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:o,height:r,pixelType:h,pixels:[m],mask:g})}function m(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function d(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function y(t,n){if(!i(t))return null;const{width:l,height:o,pixels:r}=t,s=l*o,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=r.length,{includedRanges:c,noDataValues:u,outputPixelType:p,matchAll:x,lookups:y}=n;if(y){const t=[];for(let e=0;e<h;e++){const n=y[e],l=f(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?d(t,a):g(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),m(r[e],c?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):d(t,a)}else for(let e=0;e<h;e++)m(r[e],c?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:o,pixelType:p,pixels:r,mask:a})}function w(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function k(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function M(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function A(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),s=Math.min.apply(null,r.map(t=>t.extent.xmin)),a=Math.min.apply(null,r.map(t=>t.extent.ymin)),h=Math.max.apply(null,r.map(t=>t.extent.xmax)),f=Math.max.apply(null,r.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:b(r.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function U(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=M(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p,o=m*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function b(t,n,l={}){const{clipOffset:o,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return T(t,n,{blockWidths:a});const h=t.find(t=>i(t));if(null==h)return null;const f=r?r.width:n.width,c=r?r.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:o||{x:0,y:0},mosaic:r||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const o=t[n*x+l];i(o)&&(M=o.pixels[e],U(A,M,d,l,n,s))}k.push(A)}const b=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),S=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),v=b?new Uint8Array(f*c):void 0,B=S?[]:void 0;if(v){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;U(v,null!=i?i:l?255:0,d,n,e,s)}if(B)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;U(n,null!=r?r:o?255:0,d,i,l,s)}B.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:B,mask:v});return C.updateStatistics(),C}function T(t,n,l){const o=t.find(t=>null!=t);if(null==o)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=n,h=r?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=o.getPlaneCount(),p=e.getPixelArrayConstructor(o.pixelType);if(r)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!i(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*s+i+y]=null==l?255:l[t*n.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),m=x?[]:void 0,d=s*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let o=0,r=0;o<t.length;r+=f[o],o++){const h=t[o];if(!i(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[o];e++)n[t*s+e+r]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[o];n++)l[e*s+n+r]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:s,height:a,mask:h,bandMasks:m,pixels:c,pixelType:o.pixelType});return g.updateStatistics(),g}function S(t,e,n){if(!i(t))return null;const{width:l,height:o}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>o)return t;if(0===r&&0===s&&a===l&&h===o)return t;t.mask||(t.mask=new Uint8Array(l*o));const f=t.mask;for(let i=0;i<o;i++){const t=i*l;for(let e=0;e<l;e++)f[t+e]=i<s||i>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function v(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:o}=t,r=o[0],s=e.pixels[0],a=t.mask;for(let i=2;i<l-1;i++){const t=new Map;for(let l=i-2;l<i+2;l++)for(let e=0;e<4;e++){const i=l*n+e;R(t,r[i],a?a[i]:1)}s[i*n]=B(t),s[i*n+1]=s[i*n+2]=s[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;R(t,r[l],a?a[l]:1),l=(i-1)*n+e+1,R(t,r[l],a?a[l]:1),l=i*n+e+1,R(t,r[l],a?a[l]:1),l=(i+1)*n+e+1,R(t,r[l],a?a[l]:1),l=(i-2)*n+e-3,C(t,r[l],a?a[l]:1),l=(i-1)*n+e-3,C(t,r[l],a?a[l]:1),l=i*n+e-3,C(t,r[l],a?a[l]:1),l=(i+1)*n+e-3,C(t,r[l],a?a[l]:1),s[i*n+e]=B(t)}s[i*n+e+1]=s[i*n+e]}for(let i=0;i<n;i++)s[i]=s[n+i]=s[2*n+i],s[(l-1)*n+i]=s[(l-2)*n+i];return e.updateStatistics(),e}function B(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function C(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function R(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function P(t,n,l){let{x:o,y:r}=n;const{width:s,height:a}=l;if(0===o&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,o),p=Math.min(o+s,h),x=Math.min(r+a,f);if(p<0||x<0||!i(t))return null;o=Math.max(0,-o),r=Math.max(0,-r);const{pixels:m}=t,d=s*a,g=m.length,y=[];for(let i=0;i<g;i++){const n=m[i],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let i=(t+r-c)*s+o;for(let t=u;t<p;t++)l[i++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+r-c)*s+o;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function I(t,n=!0){if(!i(t))return null;const{pixels:l,width:o,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(o/2),c=Math.round(r/2),u=r-1,p=o-1;for(let i=0;i<l.length;i++){const t=l[i],s=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<r;e+=2)for(let l=0;l<o;l+=2){const i=t[e*o+l];if(n){const n=l===p?i:t[e*o+l+1],r=e===u?i:t[e*o+l+o],a=l===p?r:e===u?n:t[e*o+l+o+1];s[x++]=(i+n+r+a)/4}else s[x++]=i}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let e=0;e<r;e+=2)for(let l=0;l<o;l+=2){const i=s[e*o+l];if(n){const n=l===p?i:s[e*o+l+1],r=e===u?i:s[e*o+l+o],a=l===p?r:e===u?n:s[e*o+l+o+1];x[t++]=i*n*r*a?1:0}else x[t++]=i}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function _(t,e,n=0,l=!0){if(!i(t))return null;const{width:o,height:r}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let i=0;i<c;i++){const t=Math.ceil(s/o),n=Math.ceil(a/r);for(let l=0;l<n;l++){f.y=l*r;for(let n=0;n<t;n++){f.x=n*o;const t=P(u,f,e);h.set(`${i}/${l}/${n}`,t)}}i<c-1&&(u=I(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function W(t){const{pixelBlock:e,tileSize:n,level:l,row:o,col:r,useBilinear:s}=t;if(!i(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=P(e,{y:o*u,x:r*c},{width:c,height:u});if(!p)return null;for(let i=l;i>0;i--)p=I(p,s);return p}function E(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let S,v,B=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+y*v+w)*r+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+y*v+w)*r+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function F(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=E(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function j(t,n,l,o,r="nearest"){if(!i(t))return null;"majority"===r&&(t=v(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=s.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=E({width:c,height:u},n,l,o,"majority"===r?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let r=0;r<m;r++){if(y[U]<0||w[U]<0)t[o*m+r]=0;else if(l)t[o*m+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+r]=(1-u)*n+u*p+i}else t[o*m+r]=e[k[U]+M[U]*c]}U++}}},T=[];let S;const B=h?.length===x,C=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}S=new p(m*d),b(S,s[e],B?h[e]:a,"nearest"===r||"majority"===r),T.push(S)}const R=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?C:void 0});if(null!=a)R.mask=new Uint8Array(m*d),b(R.mask,a,a,!0);else if(g){R.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)R.mask[t]=y[t]<0||w[t]<0?0:1}return R.updateStatistics(),R}function N(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:i,skipSpatialReference:o=!1,pixelIdOffset:r=0}=t,s=[],{width:a,height:h,pixels:f,mask:c}=e,u=t.imageRowSize??a,p=n.width/a,x=n.height/h,m=f.length,d=Math.floor(i/2),{xmin:g,ymax:y}=n,w=o?void 0:n.spatialReference.toJSON();for(let k=d;k<h;k+=i)for(let t=d;t<a;t+=i){const e=k*a+t;if(!c||c[e]){const n={x:g+(t+.5)*p,y:y-(k+.5)*x,spatialReference:w},i={objectId:r+k*u+t};for(let t=0;t<m;t++)i[l[t+1]]=f[t][e];s.push({geometry:n,attributes:i})}}return s}function D(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[r[t]]++,s++)}return s}function z(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:h-(u+.5)*s,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}export{j as approximateTransform,P as clip,W as clipTile,a as colorize,r as compositeBands,N as convertPixelBlockToFeatures,D as countCategoricalPixels,s as createColormapLUT,k as createMaskLUT,p as createRangeMaps,w as createRemapLUT,o as extractBands,M as getClipBounds,F as getLocalArithmeticNorthRotations,z as getValidPixels,c as highlightPixels,E as interpolateOffsets,i as isValidPixelBlock,f as lookupBandValues,h as lookupPixels,y as mask,l as maxMapSizeGpu,b as mosaic,A as mosaicPixelData,x as remap,u as remapColor,v as resampleByMajority,S as setValidBoundary,_ as split};
5
+ import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9;function i(t){return null!=t&&t.pixels?.length>0}function o(t,e){return e?.length&&i(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!i(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:o,pixelType:s}=n[0];if(n.some(t=>t.width!==l||t.height!==o))return null;const r=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;r.length&&(a=new Uint8Array(l*o),a.set(r[0]),r.length>1&&g(r.slice(1),a));const h=[];n.forEach(({pixels:t})=>h.push(...t));const f=n.map(({statistics:t})=>t).filter(t=>t?.length),c=[];return f.forEach(t=>c.push(...t)),new e({pixelType:s,width:l,height:o,mask:a,pixels:h,statistics:c.length?c:null})}function r(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),s=[],r=5===n[0].length;if(i>65536)return n.forEach(t=>{s[t[0]-l]=r?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:s,offset:l,alphaSpecified:r};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,s=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=r?t[4]:255,e===t[0]-l&&(t=s===n.length-1?t:n[++s])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=r?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:r}}function a(t,e){if(!i(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let o=n.mask;const s=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:r,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(r){const t=r.length-1;if(null!=o)for(let e=0;e<s;e++)o[e]&&(d=4*(c[e]-h),d<h||d>t?o[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],o[e]=r[d+3]));else{o=new Uint8Array(s);for(let e=0;e<s;e++)d=4*(c[e]-h),d<h||d>t?o[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],o[e]=r[d+3]);n.mask=o}}else if(a)if(null!=o)for(let i=0;i<s;i++)o[i]&&(m=a[c[i]],u[i]=m[0],p[i]=m[1],x[i]=m[2],o[i]=m[3]);else{o=new Uint8Array(s);for(let t=0;t<s;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],o[t]=m[3];n.mask=o}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function h(t,n){if(!i(t))return null;const{pixels:l,mask:o}=t,s=l.length;let r=n.lut;const{offset:a}=n;r&&1===r[0].length&&(r=l.map(()=>r));const h=[],c=n.outputPixelType||"u8";for(let e=0;e<s;e++){const t=f(l[e],o,r[e],a||0,c);h.push(t)}const u=new e({width:t.width,height:t.height,pixels:h,mask:o,pixelType:c});return u.updateStatistics(),u}function f(t,n,l,i,o){const s=t.length,r=e.createEmptyBand(o,s);if(n)for(let e=0;e<s;e++)n[e]&&(r[e]=l[t[e]-i]);else for(let e=0;e<s;e++)r[e]=l[t[e]-i];return r}function c(t,e,n){if(!i(t))return;const{width:l,height:o,pixels:s,mask:r}=t,a=l*o,h=new Uint8Array(a);for(let i=1;i<=n.length;i++){const{bandId:t,ranges:e}=n[i-1],l=s[t];if(!l)continue;const o=1===e.length,[f,c]=e[0];for(let n=0;n<a;n++)if(!r||r[n]){const t=l[n];if(o)t>=f&&t<=c&&(h[n]=i);else for(let l=0;l<e.length;l++){const[o,s]=e[l];if(t>=o&&t<=s){h[n]=i;break}}}}const{pixels:f}=e;1===f.length&&(f[1]=f[0].slice(),f[2]=f[0].slice());const c=n.map(t=>t.color);if(e.mask){const t=e.mask;for(let e=0;e<a;e++)if(t[e]){t[e]=255;const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(a).fill(255);for(let e=0;e<a;e++){const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}e.mask=t}e.maskIsAlpha=!0}function u(t,e){if(!i(t))return null;const n=t.clone(),{pixels:l}=n,o=n.width*n.height,s=e.length,r=Math.floor(s/2),a=e[Math.floor(r)],h=l[0],f=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(o);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(o),p.fill(x?255:1),n.mask=p);for(let i=0;i<o;i++)if(p[i]){const t=h[i];let n=!1,l=r,o=a,x=0,m=s-1;for(;m-x>1;){if(t===o.value){n=!0;break}t>o.value?x=l:m=l,l=Math.floor((x+m)/2),o=e[Math.floor(l)]}n||(t===e[x].value?(o=e[x],n=!0):t===e[m].value?(o=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(o=e[x],n=!0):m===s-1?n=!1:(o=e[m],n=!0))),n?(f[i]=o.mappedColor[0],c[i]=o.mappedColor[1],u[i]=o.mappedColor[2],p[i]=o.mappedColor[3]):f[i]=c[i]=u[i]=p[i]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function p(e,n,i=!1){const o=1e-5,s=new Float32Array(3*l),r=n.length;for(let a=0;a<l;a++)s[3*a]=e[2*a]??t-1,s[3*a+1]=e[2*a+1]??t,s[3*a+2]=n[a]??0,a<r&&(a>0&&(s[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<r-1||!i)&&(s[3*a+1]-=o));return s}function x(t,l){if(!i(t))return null;const{width:o,height:s}=t,{inputRanges:r,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(o*s);d?g.set(d):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=r.map(t=>t-y);w[0]=r[0],w[w.length-1]=r[r.length-1]+(p?1e-6:0);const k=r.length/2,[M,A]=n(h);for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=e*o+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===r[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=e*o+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:o,height:s,pixelType:h,pixels:[m],mask:g})}function m(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,s=!!e?.length;for(let r=0;r<t.length;r++)if(l[r]){const n=t[r];if(s){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[r]=0)}l[r]&&(n===o||i?.has(n))&&(l[r]=0)}}function d(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function y(t,n){if(!i(t))return null;const{width:l,height:o,pixels:s}=t,r=l*o,a=new Uint8Array(r);t.mask?a.set(t.mask):a.fill(255);const h=s.length,{includedRanges:c,noDataValues:u,outputPixelType:p,matchAll:x,lookups:y}=n;if(y){const t=[];for(let e=0;e<h;e++){const n=y[e],l=f(s[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?d(t,a):g(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(r);n.set(a),m(s[e],c?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):d(t,a)}else for(let e=0;e<h;e++)m(s[e],c?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:o,pixelType:p,pixels:s,mask:a})}function w(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:s,noDataRanges:r,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);s&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),s=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=s;e++)u[e]=t,p[e]=255}}if(r?.length)for(let e=0;e<r.length;e++){const t=Math.ceil(r[2*e]-c),n=Math.floor(r[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function k(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let s=0;s<e.length;s++){const t=Math.ceil(e[2*s]-i),n=Math.floor(e[2*s+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let s=0;s<n.length;s++)o[n[s]-i]=0;return{lut:o,offset:i}}function M(t,e,n,l,i,o,s,r){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+s<=n*t?0:i+s<n*t+t?i+s-n*t:t,ymax:o+r<=l*e?0:o+r<l*e+e?o+r-l*e:e}}function A(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),s=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),r=Math.min.apply(null,s.map(t=>t.extent.xmin)),a=Math.min.apply(null,s.map(t=>t.extent.ymin)),h=Math.max.apply(null,s.map(t=>t.extent.xmax)),f=Math.max.apply(null,s.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-r)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-r)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==s.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:b(s.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function U(t,e,n,l,i,o){const{width:s,height:r}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=M(s,r,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=s*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p,o=m*s;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function b(t,n,l={}){const{clipOffset:o,clipSize:s,alignmentInfo:r,blockWidths:a}=l;if(a)return T(t,n,{blockWidths:a});const h=t.find(t=>i(t));if(null==h)return null;const f=s?s.width:n.width,c=s?s.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:o||{x:0,y:0},mosaic:s||n,block:{width:u,height:p}},g=h.pixelType,y=e.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const o=t[n*x+l];i(o)&&(M=o.pixels[e],U(A,M,d,l,n,r))}k.push(A)}const b=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),S=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),v=b?new Uint8Array(f*c):void 0,B=S?[]:void 0;if(v){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;U(v,null!=i?i:l?255:0,d,n,e,r)}if(B)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],s=o?.bandMasks?.[e]??o?.mask;U(n,null!=s?s:o?255:0,d,i,l,r)}B.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:B,mask:v});return C.updateStatistics(),C}function T(t,n,l){const o=t.find(t=>null!=t);if(null==o)return null;const s=t.some(t=>null==t||!!t.mask),{width:r,height:a}=n,h=s?new Uint8Array(r*a):null,{blockWidths:f}=l,c=[],u=o.getPlaneCount(),p=e.getPixelArrayConstructor(o.pixelType);if(s)for(let e=0,y=0;e<t.length;y+=f[e],e++){const n=t[e];if(!i(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*r+i+y]=null==l?255:l[t*n.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),m=x?[]:void 0,d=r*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let o=0,s=0;o<t.length;s+=f[o],o++){const h=t[o];if(!i(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[o];e++)n[t*r+e+s]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[o];n++)l[e*r+n+s]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:r,height:a,mask:h,bandMasks:m,pixels:c,pixelType:o.pixelType});return g.updateStatistics(),g}function S(t,e,n){if(!i(t))return null;const{width:l,height:o}=t,s=e.x,r=e.y,a=n.width+s,h=n.height+r;if(s<0||r<0||a>l||h>o)return t;if(0===s&&0===r&&a===l&&h===o)return t;t.mask||(t.mask=new Uint8Array(l*o));const f=t.mask;for(let i=0;i<o;i++){const t=i*l;for(let e=0;e<l;e++)f[t+e]=i<r||i>=h||e<s||e>=a?0:1}return t.updateStatistics(),t}function v(t){if(!i(t))return null;const e=t.clone(),{width:n,height:l,pixels:o}=t,s=o[0],r=e.pixels[0],a=t.mask;for(let i=2;i<l-1;i++){const t=new Map;for(let l=i-2;l<i+2;l++)for(let e=0;e<4;e++){const i=l*n+e;R(t,s[i],a?a[i]:1)}r[i*n]=B(t),r[i*n+1]=r[i*n+2]=r[i*n];let e=3;for(;e<n-1;e++){let l=(i-2)*n+e+1;R(t,s[l],a?a[l]:1),l=(i-1)*n+e+1,R(t,s[l],a?a[l]:1),l=i*n+e+1,R(t,s[l],a?a[l]:1),l=(i+1)*n+e+1,R(t,s[l],a?a[l]:1),l=(i-2)*n+e-3,C(t,s[l],a?a[l]:1),l=(i-1)*n+e-3,C(t,s[l],a?a[l]:1),l=i*n+e-3,C(t,s[l],a?a[l]:1),l=(i+1)*n+e-3,C(t,s[l],a?a[l]:1),r[i*n+e]=B(t)}r[i*n+e+1]=r[i*n+e]}for(let i=0;i<n;i++)r[i]=r[n+i]=r[2*n+i],r[(l-1)*n+i]=r[(l-2)*n+i];return e.updateStatistics(),e}function B(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function C(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function R(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function P(t,n,l){let{x:o,y:s}=n;const{width:r,height:a}=l;if(0===o&&0===s&&a===t.height&&r===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,s),u=Math.max(0,o),p=Math.min(o+r,h),x=Math.min(s+a,f);if(p<0||x<0||!i(t))return null;o=Math.max(0,-o),s=Math.max(0,-s);const{pixels:m}=t,d=r*a,g=m.length,y=[];for(let i=0;i<g;i++){const n=m[i],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let i=(t+s-c)*r+o;for(let t=u;t<p;t++)l[i++]=n[e+t]}y.push(l)}const w=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+s-c)*r+o;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function I(t,n=!0){if(!i(t))return null;const{pixels:l,width:o,height:s,mask:r,pixelType:a}=t,h=[],f=Math.round(o/2),c=Math.round(s/2),u=s-1,p=o-1;for(let i=0;i<l.length;i++){const t=l[i],r=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<s;e+=2)for(let l=0;l<o;l+=2){const i=t[e*o+l];if(n){const n=l===p?i:t[e*o+l+1],s=e===u?i:t[e*o+l+o],a=l===p?s:e===u?n:t[e*o+l+o+1];r[x++]=(i+n+s+a)/4}else r[x++]=i}h.push(r)}let x=null;if(null!=r){x=new Uint8Array(f*c);let t=0;for(let e=0;e<s;e+=2)for(let l=0;l<o;l+=2){const i=r[e*o+l];if(n){const n=l===p?i:r[e*o+l+1],s=e===u?i:r[e*o+l+o],a=l===p?s:e===u?n:r[e*o+l+o+1];x[t++]=i*n*s*a?1:0}else x[t++]=i}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function _(t,e,n=0,l=!0){if(!i(t))return null;const{width:o,height:s}=e;let{width:r,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let i=0;i<c;i++){const t=Math.ceil(r/o),n=Math.ceil(a/s);for(let l=0;l<n;l++){f.y=l*s;for(let n=0;n<t;n++){f.x=n*o;const t=P(u,f,e);h.set(`${i}/${l}/${n}`,t)}}i<c-1&&(u=I(u,l)),r=Math.round(r/2),a=Math.round(a/2)}return h}function W(t){const{pixelBlock:e,tileSize:n,level:l,row:o,col:s,useBilinear:r}=t;if(!i(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=P(e,{y:o*u,x:s*c},{width:c,height:u});if(!p)return null;for(let i=l;i>0;i--)p=I(p,r);return p}function E(t,e,n,l,i=0){const{width:o,height:s}=t,{width:r,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(r/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let S,v,B=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+y*v+w)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+y*v+w)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function F(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:s}=E(t,t,n,{rows:l[0],cols:l[1]}),{width:r,height:a}=t,h=new Float32Array(r*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<r;t++){const e=c*s+t,n=0===c?e:e-s,l=c===a-1?e:e+s,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*r+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*r+t]=e}}return h}function j(t,n,l,o,s="nearest"){if(!i(t))return null;"majority"===s&&(t=v(t));const{pixels:r,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=r.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=E({width:c,height:u},n,l,o,"majority"===s?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let s=0;s<m;s++){if(y[U]<0||w[U]<0)t[o*m+s]=0;else if(l)t[o*m+s]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),r=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-r;if(!n||n[l+r*c]&&n[a+r*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+r*c]+f*e[a+r*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+s]=(1-u)*n+u*p+i}else t[o*m+s]=e[k[U]+M[U]*c]}U++}}},T=[];let S;const B=h?.length===x,C=[];for(let e=0;e<x;e++){if(B){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}S=new p(m*d),b(S,r[e],B?h[e]:a,"nearest"===s||"majority"===s),T.push(S)}const R=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:B?C:void 0});if(null!=a)R.mask=new Uint8Array(m*d),b(R.mask,a,a,!0);else if(g){R.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)R.mask[t]=y[t]<0||w[t]<0?0:1}return R.updateStatistics(),R}function N(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:i,skipSpatialReference:o=!1,pixelIdOffset:s=0}=t,r=[],{width:a,height:h,pixels:f,mask:c}=e,u=t.imageRowSize??a,p=n.width/a,x=n.height/h,m=f.length,d=Math.floor(i/2),{xmin:g,ymax:y}=n,w=o?void 0:n.spatialReference.toJSON();for(let k=d;k<h;k+=i)for(let t=d;t<a;t+=i){const e=k*a+t;if(!c||c[e]){const n={x:g+(t+.5)*p,y:y-(k+.5)*x,spatialReference:w},i={objectId:s+k*u+t};for(let t=0;t<m;t++)i[l[t+1]]=f[t][e];r.push({geometry:n,attributes:i})}}return r}function D(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=i[0];let r=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[s[t]]++,r++)}return r}function z(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=e.width/n,r=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*s,y:h-(u+.5)*r,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}export{j as approximateTransform,P as clip,W as clipTile,a as colorize,s as compositeBands,N as convertPixelBlockToFeatures,D as countCategoricalPixels,r as createColormapLUT,k as createMaskLUT,p as createRangeMaps,w as createRemapLUT,o as extractBands,M as getClipBounds,F as getLocalArithmeticNorthRotations,z as getValidPixels,c as highlightPixels,E as interpolateOffsets,i as isValidPixelBlock,f as lookupBandValues,h as lookupPixels,y as mask,l as maxMapSizeGpu,b as mosaic,A as mosaicPixelData,x as remap,u as remapColor,v as resampleByMajority,S as setValidBoundary,_ as split};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.50",
3
+ "version": "4.34.0-next.51",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const a="20250731",d="2926f45861591f7db5d28a8b7a1897173a31d215";export{a as buildDate,d as commitHash};
5
+ const e="20250801",a="0565d293ab69e864d165a4e59a95571fd9c0e796";export{e as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as t}from"../../../../core/maybe.js";import{identity as e,translate as s,rotate as r,scaleByVec2 as i,multiply as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as u}from"../DisplayObject.js";import{createTransformTexture as n,createPixelMaskTexture as d,createRasterTexture as l,createColormapTexture as _}from"../../../webgl/rasterUtils.js";const x={bandCount:3,minOutput:0,maxOutput:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"};class m extends u{constructor(t=null,e=null,s=null){super(),this._textureInvalidated=!0,this._colormapTextureInvalidated=!0,this._rasterTexture=null,this._maskTexture=null,this._rasterTextureBandIds=null,this._transformGridTexture=null,this._colormapTexture=null,this._colormap=null,this._supportsBilinearTexture=!0,this._processedTexture=null,this.functionTextures=[],this.projected=!1,this.stencilRef=0,this.coordScale=[1,1],this._processed=!1,this._symbolizerParameters=null,this.height=null,this.isRendereredSource=!1,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._mask=null,this.rawPixelData=null,this._suspended=!1,this._bandIds=null,this._interpolation=null,this._transformGrid=null,this.width=null,this.x=0,this.y=0,this.source=t,this.transformGrid=e,this.interpolation=s}destroy(){super.destroy(),this._disposeTextures()}get processedTexture(){return this._processedTexture}set processedTexture(t){this._processedTexture!==t&&(this._disposeTextures(!0),this._processedTexture=t)}get rasterTexture(){return this._rasterTexture}set rasterTexture(t){this._rasterTexture!==t&&(this._rasterTexture?.dispose(),this._rasterTexture=t),null==t&&(this.projected=!1)}get processed(){return this._processed}set processed(e){this._processed=e,e||(this.processedTexture=t(this.processedTexture),this.invalidateTexture())}get symbolizerParameters(){return this._symbolizerParameters||x}set symbolizerParameters(t){this._symbolizerParameters!==t&&(this._symbolizerParameters=t,this._colormapTextureInvalidated=!0)}get source(){return this._source}set source(e){this._source!==e&&(this._source=e,this._rasterTexture&&(this._rasterTexture=t(this._rasterTexture),this._rasterTextureBandIds=null),this.projected=!1,this.invalidateTexture())}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this._maskTexture=t(this._maskTexture))}get suspended(){return this._suspended}set suspended(t){this._suspended&&!t&&this.stage&&(this.ready(),this.requestRender()),this._suspended=t}get bandIds(){return this._bandIds}set bandIds(t){this._bandIds=t,this._isBandIdsChanged(t)&&(this.projected=!1,this.invalidateTexture())}get interpolation(){return this._interpolation||"nearest"}set interpolation(t){this._interpolation=t,this._rasterTexture&&this._rasterTexture.setSamplingMode("bilinear"===this._getTextureSamplingMethod(t||"nearest")?9729:9728)}get transformGrid(){return this._transformGrid}set transformGrid(e){this._transformGrid!==e&&(this._transformGrid=e,this._transformGridTexture=t(this._transformGridTexture))}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this.requestRender())}getRasterTextureSize(t=!1){const e=t||this.projected;return[e?this.width:this.source?.width||this.width,e?this.height:this.source?.height||this.height]}getRasterCellSize(){const t=this.rawPixelData?.srcPixelSize,{projected:e,resolution:s}=this;return t&&!e?[t.x,t.y]:[s,s]}_createTransforms(){return{displayViewScreenMat3:h()}}setTransform(t){const h=e(this.transforms.displayViewScreenMat3),[u,n]=t.toScreenNoRotation([0,0],[this.x,this.y]),d=this.resolution/this.pixelRatio/t.resolution,l=d*this.width,_=d*this.height,x=Math.PI*this.rotation/180;s(h,h,o(u,n)),s(h,h,o(l/2,_/2)),r(h,h,-x),s(h,h,o(-l/2,-_/2)),i(h,h,o(l,_)),a(this.transforms.displayViewScreenMat3,t.displayViewMat3,h)}getTextures({forProcessing:t=!1,useProcessedTexture:e=!1}={}){const s=e?this._processedTexture??this._rasterTexture:this._rasterTexture,r=[],i=[];return s?(this._transformGridTexture&&!this.projected&&(i.push(this._transformGridTexture),r.push("u_transformGrid")),i.push(s),r.push("u_image"),!this._colormapTexture||!e&&t||(i.push(this._colormapTexture),r.push("u_colormap")),this._maskTexture&&(i.push(this._maskTexture),r.push("u_mask")),{names:r,textures:i}):{names:r,textures:i}}onAttach(){this.invalidateTexture()}onDetach(){this.invalidateTexture()}updateTexture({context:t}){if(!this.stage)return void this._disposeTextures();const e=this._isValidSource(this.source);e&&this._colormapTextureInvalidated&&(this._colormapTextureInvalidated=!1,this._updateColormapTexture(t)),this._textureInvalidated&&(this._textureInvalidated=!1,this._createOrDestroyRasterTexture(t),this._rasterTexture&&(e?(this.transformGrid&&!this._transformGridTexture&&(this._transformGridTexture=n(t,this.transformGrid)),this._mask&&!this._maskTexture&&(this._maskTexture=d(t,this._mask,[this.width,this.height]))):this._rasterTexture.setData(null)),this.suspended||(this.ready(),this.requestRender()))}updateProcessedTexture(){const{functionTextures:t}=this;0!==t.length&&(this.processedTexture=t.shift(),t.forEach(t=>t?.dispose()),t.length=0,this.processed=!!this.processedTexture)}_createOrDestroyRasterTexture(e){const s=this.source?.extractBands(this.bandIds);if(!this._isValidSource(s))return void(this._rasterTexture&&(this._rasterTexture=t(this._rasterTexture),this._rasterTextureBandIds=null));const r=!this._isBandIdsChanged(this.bandIds);if(this._rasterTexture){if(r)return;this._rasterTexture=t(this._rasterTexture),this._rasterTextureBandIds=null}this._supportsBilinearTexture=!!e.capabilities.textureFloatLinear;const i=this._getTextureSamplingMethod(this.interpolation),a=this.isRendereredSource;this._rasterTexture=l(e,s,i,a),this.projected=!1,this._processed=!1,this._rasterTextureBandIds=this.bandIds?[...this.bandIds]:null}_isBandIdsChanged(t){const e=this._rasterTextureBandIds;return!(null==e&&null==t||e&&t&&e.join("")===t.join(""))}_isValidSource(t){return null!=t&&t.pixels?.length>0}_getTextureSamplingMethod(t){const{type:e}=this.symbolizerParameters,s="lut"===e&&!this.symbolizerParameters.isClassBreaks||"hillshade"===e||"stretch"===e&&1===this.symbolizerParameters.bandCount;return!this._supportsBilinearTexture||s||"bilinear"!==t&&"cubic"!==t?"nearest":"bilinear"}_updateColormapTexture(e){const s=this._colormap,r=this.symbolizerParameters.colormap;return r?s?r.length!==s.length||r.some((t,e)=>t!==s[e])?(this._colormapTexture&&(this._colormapTexture=t(this._colormapTexture)),this._colormapTexture=_(e,r),void(this._colormap=r)):void 0:(this._colormapTexture=_(e,r),void(this._colormap=r)):(this._colormapTexture&&(this._colormapTexture=t(this._colormapTexture)),void(this._colormap=null))}_disposeTextures(e=!1){e?this.projected&&(this._transformGridTexture=t(this._transformGridTexture)):(this._rasterTexture=t(this._rasterTexture),this._colormapTexture=t(this._colormapTexture),this._transformGridTexture=t(this._transformGridTexture),this._maskTexture=t(this._maskTexture),this._rasterTextureBandIds=null,this._colormap=null,this._colormapTextureInvalidated=!0),this._processedTexture=t(this._processedTexture)}}class c extends m{get source(){return this._source}}export{m as RasterBitmap,c as RasterBitmapWithSource};
5
+ import{disposeMaybe as t}from"../../../../core/maybe.js";import{identity as e,translate as s,rotate as r,scaleByVec2 as i,multiply as h}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as o}from"../DisplayObject.js";import{createTransformTexture as n,createPixelMaskTexture as l,createRasterTexture as d,createColormapTexture as _}from"../../../webgl/rasterUtils.js";const x={bandCount:3,minOutput:0,maxOutput:1,minCutOff:[0,0,0],maxCutOff:[255,255,255],factor:[1/255,1/255,1/255],useGamma:!1,gamma:[1,1,1],gammaCorrection:[1,1,1],colormap:null,colormapOffset:null,stretchType:"none",type:"stretch"};class m extends o{constructor(t=null,e=null,s=null){super(),this._textureInvalidated=!0,this._colormapTextureInvalidated=!0,this._rasterTexture=null,this._maskTexture=null,this._rasterTextureBandIds=null,this._transformGridTexture=null,this._colormapTexture=null,this._colormap=null,this._supportsBilinearTexture=!0,this._processedTexture=null,this._highlightTexture=null,this.functionTextures=[],this.projected=!1,this.stencilRef=0,this.coordScale=[1,1],this._processed=!1,this._highlighted=!1,this._symbolizerParameters=null,this.height=null,this.isRendereredSource=!1,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._mask=null,this.rawPixelData=null,this._suspended=!1,this._bandIds=null,this._interpolation=null,this._transformGrid=null,this.width=null,this.x=0,this.y=0,this.source=t,this.transformGrid=e,this.interpolation=s}destroy(){super.destroy(),this._disposeTextures()}get processedTexture(){return this._processedTexture}set processedTexture(t){this._processedTexture!==t&&(this._disposeTextures(!0),this._processedTexture=t)}get highlightTexture(){return this._highlightTexture}set highlightTexture(t){this._highlightTexture!==t&&(this._highlightTexture?.dispose(),this._highlightTexture=t),null==t&&(this._highlighted=!1)}get rasterTexture(){return this._rasterTexture}set rasterTexture(t){this._rasterTexture!==t&&(this._rasterTexture?.dispose(),this._rasterTexture=t),null==t&&(this.projected=!1)}get processed(){return this._processed}set processed(e){this._processed=e,e||(this.processedTexture=t(this.processedTexture),this.invalidateTexture())}get highlighted(){return this._highlighted}get symbolizerParameters(){return this._symbolizerParameters||x}set symbolizerParameters(t){this._symbolizerParameters!==t&&(this._symbolizerParameters=t,this._colormapTextureInvalidated=!0)}get source(){return this._source}set source(e){this._source!==e&&(this._source=e,this._rasterTexture&&(this._rasterTexture=t(this._rasterTexture),this._rasterTextureBandIds=null),this.projected=!1,this.invalidateTexture())}get mask(){return this._mask}set mask(e){this._mask!==e&&(this._mask=e,this._maskTexture=t(this._maskTexture))}get suspended(){return this._suspended}set suspended(t){this._suspended&&!t&&this.stage&&(this.ready(),this.requestRender()),this._suspended=t}get bandIds(){return this._bandIds}set bandIds(t){this._bandIds=t,this._isBandIdsChanged(t)&&(this.projected=!1,this.invalidateTexture())}get interpolation(){return this._interpolation||"nearest"}set interpolation(t){this._interpolation=t,this._rasterTexture&&this._rasterTexture.setSamplingMode("bilinear"===this._getTextureSamplingMethod(t||"nearest")?9729:9728)}get transformGrid(){return this._transformGrid}set transformGrid(e){this._transformGrid!==e&&(this._transformGrid=e,this._transformGridTexture=t(this._transformGridTexture))}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this.requestRender())}getRasterTextureSize(t=!1){const e=t||this.projected;return[e?this.width:this.source?.width||this.width,e?this.height:this.source?.height||this.height]}getRasterCellSize(){const t=this.rawPixelData?.srcPixelSize,{projected:e,resolution:s}=this;return t&&!e?[t.x,t.y]:[s,s]}_createTransforms(){return{displayViewScreenMat3:a()}}setTransform(t){const a=e(this.transforms.displayViewScreenMat3),[o,n]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,_=l*this.height,x=Math.PI*this.rotation/180;s(a,a,u(o,n)),s(a,a,u(d/2,_/2)),r(a,a,-x),s(a,a,u(-d/2,-_/2)),i(a,a,u(d,_)),h(this.transforms.displayViewScreenMat3,t.displayViewMat3,a)}getTextures({forProcessing:t=!1,useProcessedTexture:e=!1}={}){const s=e?this._processedTexture??this._rasterTexture:this._rasterTexture,r=[],i=[];return s?(this._transformGridTexture&&!this.projected&&(i.push(this._transformGridTexture),r.push("u_transformGrid")),i.push(s),r.push("u_image"),!this._colormapTexture||!e&&t||(i.push(this._colormapTexture),r.push("u_colormap")),this._maskTexture&&(i.push(this._maskTexture),r.push("u_mask")),{names:r,textures:i}):{names:r,textures:i}}onAttach(){this.invalidateTexture()}onDetach(){this.invalidateTexture()}updateTexture({context:t}){if(!this.stage)return void this._disposeTextures();const e=this._isValidSource(this.source);e&&this._colormapTextureInvalidated&&(this._colormapTextureInvalidated=!1,this._updateColormapTexture(t)),this._textureInvalidated&&(this._textureInvalidated=!1,this._createOrDestroyRasterTexture(t),this._rasterTexture&&(e?(this.transformGrid&&!this._transformGridTexture&&(this._transformGridTexture=n(t,this.transformGrid)),this._mask&&!this._maskTexture&&(this._maskTexture=l(t,this._mask,[this.width,this.height]))):this._rasterTexture.setData(null)),this.suspended||(this.ready(),this.requestRender()))}updateProcessedTexture(t=!0){t&&(this._highlighted=null!=this.highlightTexture);const{functionTextures:e}=this;0!==e.length&&(this.processedTexture=e.shift(),e.forEach(t=>t?.dispose()),e.length=0,this.processed=!!this.processedTexture)}_createOrDestroyRasterTexture(e){const s=this.source?.extractBands(this.bandIds);if(!this._isValidSource(s))return void(this._rasterTexture&&(this._rasterTexture=t(this._rasterTexture),this._rasterTextureBandIds=null));const r=!this._isBandIdsChanged(this.bandIds);if(this._rasterTexture){if(r)return;this._rasterTexture=t(this._rasterTexture),this._rasterTextureBandIds=null}this._supportsBilinearTexture=!!e.capabilities.textureFloatLinear;const i=this._getTextureSamplingMethod(this.interpolation),h=this.isRendereredSource;this._rasterTexture=d(e,s,i,h),this.projected=!1,this._processed=!1,this._rasterTextureBandIds=this.bandIds?[...this.bandIds]:null}_isBandIdsChanged(t){const e=this._rasterTextureBandIds;return!(null==e&&null==t||e&&t&&e.join("")===t.join(""))}_isValidSource(t){return null!=t&&t.pixels?.length>0}_getTextureSamplingMethod(t){const{type:e}=this.symbolizerParameters,s="lut"===e&&!this.symbolizerParameters.isClassBreaks||"hillshade"===e||"stretch"===e&&1===this.symbolizerParameters.bandCount;return!this._supportsBilinearTexture||s||"bilinear"!==t&&"cubic"!==t?"nearest":"bilinear"}_updateColormapTexture(e){const s=this._colormap,r=this.symbolizerParameters.colormap;return r?s?r.length!==s.length||r.some((t,e)=>t!==s[e])?(this._colormapTexture&&(this._colormapTexture=t(this._colormapTexture)),this._colormapTexture=_(e,r),void(this._colormap=r)):void 0:(this._colormapTexture=_(e,r),void(this._colormap=r)):(this._colormapTexture&&(this._colormapTexture=t(this._colormapTexture)),void(this._colormap=null))}_disposeTextures(e=!1){e?this.projected&&(this._transformGridTexture=t(this._transformGridTexture)):(this._rasterTexture=t(this._rasterTexture),this._colormapTexture=t(this._colormapTexture),this._transformGridTexture=t(this._transformGridTexture),this._maskTexture=t(this._maskTexture),this._rasterTextureBandIds=null,this._colormap=null,this._colormapTextureInvalidated=!0),this._processedTexture=t(this._processedTexture),this._highlightTexture=t(this._highlightTexture)}}class c extends m{get source(){return this._source}}export{m as RasterBitmap,c as RasterBitmapWithSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import{getWorldWidth as i}from"../../viewpointUtils.js";import{RasterTile as t}from"./RasterTile.js";import s from"../webgl/TileContainer.js";import{RasterColorizerTechnique as o}from"../webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js";import{RasterProcessorTechnique as n}from"../webgl/shaderGraph/techniques/raster/RasterProcessorTechnique.js";class r extends s{constructor(){super(...arguments),this.isCustomTilingScheme=!1}get pixelHighlightOptions(){return this._pixelHighlightOptions}set pixelHighlightOptions(e){this._pixelHighlightOptions=e,this.requestRender()}createTile(e){const i=this._getTileBounds(e),[s,o]=this.tileInfoView.tileInfo.size,n=this.tileInfoView.getTileResolution(e.level);return new t(e,n,i[0],i[3],s,o)}onAttach(){super.onAttach(),this._colorizerTechnique=new o,this._processorTechnique=new n}onDetach(){super.onDetach(),this._colorizerTechnique?.shutdown(),this._colorizerTechnique=void 0,this._processorTechnique?.shutdown(),this._processorTechnique=void 0}doRender(e){if(!this.visible||1!==e.drawPhase||!this._colorizerTechnique)return;const{rasterFunctionChain:i}=this;if(i?.functions?.length){if(!this._processorTechnique)return;const{functions:t,hasBranches:s}=i;for(const i of t){if("Constant"===i.name||"Identity"===i.name)continue;e.rasterFunction=i,e.hasBranches=s,super.doRender(e);const t=this.children.map(e=>e.bitmap);this._processorTechnique.render(e,{bitmaps:t})}}e.rasterFunction=null,e.pixelHighlightOptions=this.pixelHighlightOptions,super.doRender(e);const t=this.children.map(e=>e.bitmap);this._colorizerTechnique.render(e,{bitmaps:t})}_getTileBounds(t){const s=this.tileInfoView.getTileBounds(e(),t);if(this.isCustomTilingScheme&&t.world){const{tileInfo:e}=this.tileInfoView,o=i(e.spatialReference);if(o){const i=e.lodAt(t.level);if(!i)return s;const{resolution:n}=i,r=n*e.size[0];s[0]=o*t.world+e.origin.x+t.col*r,s[2]=s[0]+r}}return s}}export{r as RasterTileContainer};
5
+ import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import{getWorldWidth as i}from"../../viewpointUtils.js";import{RasterTile as t}from"./RasterTile.js";import s from"../webgl/TileContainer.js";import{RasterColorizerTechnique as h}from"../webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js";import{RasterHighlightTechnique as r}from"../webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js";import{RasterProcessorTechnique as n}from"../webgl/shaderGraph/techniques/raster/RasterProcessorTechnique.js";class o extends s{constructor(){super(...arguments),this.isCustomTilingScheme=!1}get pixelHighlights(){return this._pixelHighlights}set pixelHighlights(e){this._pixelHighlights=e,this.children.forEach(({bitmap:e})=>e.highlightTexture=null),this.requestRender()}createTile(e){const i=this._getTileBounds(e),[s,h]=this.tileInfoView.tileInfo.size,r=this.tileInfoView.getTileResolution(e.level);return new t(e,r,i[0],i[3],s,h)}onAttach(){super.onAttach(),this._colorizerTechnique=new h,this._processorTechnique=new n,this._highlightTechnique=new r}onDetach(){super.onDetach(),this._colorizerTechnique?.shutdown(),this._colorizerTechnique=void 0,this._processorTechnique?.shutdown(),this._processorTechnique=void 0,this._highlightTechnique?.shutdown(),this._highlightTechnique=void 0}doRender(e){if(!this.visible||1!==e.drawPhase||!this._colorizerTechnique)return;const{rasterFunctionChain:i}=this;if(i?.functions?.length){if(!this._processorTechnique)return;const{functions:t,hasBranches:s}=i;for(const i of t){if("Constant"===i.name||"Identity"===i.name)continue;e.rasterFunction=i,e.hasBranches=s,super.doRender(e);const t=this.children.map(e=>e.bitmap);this._processorTechnique.render(e,{bitmaps:t})}}if(this._pixelHighlights?.length&&this._highlightTechnique)for(const s of this._pixelHighlights){e.pixelHighlightOptions=s,super.doRender(e);const i=this.children.map(e=>e.bitmap);this._highlightTechnique.render(e,{bitmaps:i})}e.rasterFunction=null,e.pixelHighlightOptions=void 0,super.doRender(e);const t=this.children.map(e=>e.bitmap);this._colorizerTechnique.render(e,{bitmaps:t})}_getTileBounds(t){const s=this.tileInfoView.getTileBounds(e(),t);if(this.isCustomTilingScheme&&t.world){const{tileInfo:e}=this.tileInfoView,h=i(e.spatialReference);if(h){const i=e.lodAt(t.level);if(!i)return s;const{resolution:r}=i,n=r*e.size[0];s[0]=h*t.world+e.origin.x+t.col*n,s[2]=s[0]+n}}return s}}export{o as RasterTileContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{Technique as e}from"../Technique.js";import{RasterColorizerLUTShader as i}from"../shaders/raster/RasterColorizerLUTShader.js";import{RasterColorizerShadedReliefShader as t}from"../shaders/raster/RasterColorizerShadedReliefShader.js";import{RasterColorizerStretchShader as o}from"../shaders/raster/RasterColorizerStretchShader.js";class r extends e{constructor(){super(...arguments),this.name="BrushRasterColorizer",this.type=0,this.shaders={lut:new i,stretch:new o,shadedRelief:new t}}render(e,i){for(const t of i.bitmaps){if(!t.source||t.suspended)continue;e.timeline.begin(this.name);const{painter:i}=e;i.setPipelineState({depth:!1,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"composite"}}),t.updateTexture(e),t.processedTexture||t.updateProcessedTexture();const{type:o}=t.symbolizerParameters,r="stretch"===o?this._getStretchOptions(t):"lut"===o?this._getLutOptions(t):this._getShadedReliefOptions(t);"bilinear"!==t.interpolation||e.context.capabilities.textureFloatLinear||(r.defines.bilinear=!0);const{pixelHighlightOptions:n}=e;if(n&&!t.isRendereredSource){const e=t.bandIds?.length?t.bandIds.indexOf(n.bandId):0;if(e>=0&&e<=2){r.defines.applyPixelHighlights=!0;const i=new Float32Array(9);i[3*e]=1,r.uniforms.highlightConfig={...n,bandSwap:i}}}i.submitDrawMesh(e.context,r,i.quadMesh,t),e.timeline.end(this.name)}}_getLutOptions(e){const{config:i,projectionConfig:t,colormapConfig:o,pixelMaskConfig:r,projectionDefines:n}=this._getCommonConfig(e),s=this._getInterpolationDefines("nearest",!1);return{shader:this.shaders.lut,uniforms:{projectionConfig:t,config:i,colormapConfig:o,pixelMaskConfig:r},defines:{...n,...s,applyPixelMask:!!r,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1}}_getStretchOptions(e){const i=e.symbolizerParameters,{config:t,projectionConfig:o,colormapConfig:r,pixelMaskConfig:n,projectionDefines:s}=this._getCommonConfig(e),a=this._getInterpolationDefines(e.interpolation,1===i.bandCount);return{shader:this.shaders.stretch,uniforms:{projectionConfig:o,config:t,stretchConfig:i,colormapConfig:r,pixelMaskConfig:n},defines:{...s,...a,isMultiband:i.bandCount>1,applyColormap:!!r,useGamma:i.useGamma,noOp:e.isRendereredSource&&!e.processed,applyPixelMask:!!n,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1}}_getShadedReliefOptions(e){const i=e.symbolizerParameters,{config:t,projectionConfig:o,colormapConfig:r,pixelMaskConfig:n,projectionDefines:s}=this._getCommonConfig(e),a=this._getInterpolationDefines(e.interpolation,!0);return{shader:this.shaders.shadedRelief,uniforms:{projectionConfig:o,config:t,hillshadeConfig:i,colormapConfig:r,pixelMaskConfig:n},defines:{...s,...a,isMultidirectional:i.hillshadeType>0,applyColormap:!!r,applyPixelMask:!!n,applyPixelHighlights:!1},optionalAttributes:null,useComputeBuffer:!1}}_getCommonConfig(e){const{coordScale:i,computedOpacity:t,transforms:o}=e,{names:r,textures:n}=e.getTextures({useProcessedTexture:e.processed}),s=n[r.indexOf("u_image")],a=e.getRasterTextureSize(),l={texture:{texture:s,unit:0},dvsMat3:o.displayViewScreenMat3,coordScale:i,srcImageSize:a,opacity:t},p=n[r.indexOf("u_transformGrid")],{transformGrid:c}=e,f=!(!p||!c),d=f?{transformTexture:{texture:p,unit:2},targetImageSize:[e.width,e.height],transformSpacing:c.spacing,transformGridSize:c.size}:void 0,u=n[r.indexOf("u_colormap")],{colormap:g,colormapOffset:m}=e.symbolizerParameters,h=u&&g?{colormapTexture:{texture:u,unit:1},colormapOffset:m??0,colormapMaxIndex:g.length/4-1}:void 0,C=n[r.indexOf("u_mask")];return{config:l,projectionConfig:d,colormapConfig:h,pixelMaskConfig:C?{maskTexture:{texture:C,unit:3}}:void 0,projectionDefines:{applyProjection:f,lookupProjection:f&&1===c.spacing[0]}}}_getInterpolationDefines(e,i){const t="bilinear"===e&&i;return{bilinear:t,bicubic:"cubic"===e,nearestOnEdge:t}}}export{r as RasterColorizerTechnique};
5
+ import{Technique as e}from"../Technique.js";import{getInterpolationDefines as i}from"./processor/textureUtils.js";import{RasterColorizerLUTShader as t}from"../shaders/raster/RasterColorizerLUTShader.js";import{RasterColorizerShadedReliefShader as o}from"../shaders/raster/RasterColorizerShadedReliefShader.js";import{RasterColorizerStretchShader as r}from"../shaders/raster/RasterColorizerStretchShader.js";class s extends e{constructor(){super(...arguments),this.name="BrushRasterColorizer",this.type=0,this.shaders={lut:new t,stretch:new r,shadedRelief:new o}}render(e,i){for(const t of i.bitmaps){if(!t.source||t.suspended)continue;e.timeline.begin(this.name);const{painter:i}=e;i.setPipelineState({depth:!1,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"composite"}}),t.updateTexture(e),t.updateProcessedTexture();const{type:o}=t.symbolizerParameters,r="stretch"===o?this._getStretchOptions(t):"lut"===o?this._getLutOptions(t):this._getShadedReliefOptions(t);"bilinear"!==t.interpolation||e.context.capabilities.textureFloatLinear||(r.defines.bilinear=!0),i.submitDrawMesh(e.context,r,i.quadMesh,t),e.timeline.end(this.name)}}_getLutOptions(e){const{config:t,projectionConfig:o,colormapConfig:r,pixelMaskConfig:s,highlightConfig:n,projectionDefines:a}=this._getCommonConfig(e),l=i(e);return{shader:this.shaders.lut,uniforms:{projectionConfig:o,config:t,colormapConfig:r,pixelMaskConfig:s,highlightConfig:n},defines:{...a,...l,applyPixelMask:!!s,applyPixelHighlights:!!n},optionalAttributes:null,useComputeBuffer:!1}}_getStretchOptions(e){const t=e.symbolizerParameters,{config:o,projectionConfig:r,colormapConfig:s,pixelMaskConfig:n,highlightConfig:a,projectionDefines:l}=this._getCommonConfig(e),p=i(e);return{shader:this.shaders.stretch,uniforms:{projectionConfig:r,config:o,stretchConfig:t,colormapConfig:s,pixelMaskConfig:n,highlightConfig:a},defines:{...l,...p,isMultiband:t.bandCount>1,applyColormap:!!s,useGamma:t.useGamma,noOp:e.isRendereredSource&&!e.processed,applyPixelMask:!!n,applyPixelHighlights:!!a},optionalAttributes:null,useComputeBuffer:!1}}_getShadedReliefOptions(e){const t=e.symbolizerParameters,{config:o,projectionConfig:r,colormapConfig:s,pixelMaskConfig:n,highlightConfig:a,projectionDefines:l}=this._getCommonConfig(e),p=i(e);return{shader:this.shaders.shadedRelief,uniforms:{projectionConfig:r,config:o,hillshadeConfig:t,colormapConfig:s,pixelMaskConfig:n,highlightConfig:a},defines:{...l,...p,isMultidirectional:t.hillshadeType>0,applyColormap:!!s,applyPixelMask:!!n,applyPixelHighlights:!!a},optionalAttributes:null,useComputeBuffer:!1}}_getCommonConfig(e){const{coordScale:i,computedOpacity:t,transforms:o}=e,{names:r,textures:s}=e.getTextures({useProcessedTexture:e.processed}),n=s[r.indexOf("u_image")],a=e.getRasterTextureSize(),l={texture:{texture:n,unit:0},dvsMat3:o.displayViewScreenMat3,coordScale:i,srcImageSize:a,opacity:t},p=s[r.indexOf("u_transformGrid")],{transformGrid:g}=e,f=!(!p||!g),h=f?{transformTexture:{texture:p,unit:2},targetImageSize:[e.width,e.height],transformSpacing:g.spacing,transformGridSize:g.size}:void 0,c=s[r.indexOf("u_colormap")],{colormap:u,colormapOffset:m}=e.symbolizerParameters,d=c&&u?{colormapTexture:{texture:c,unit:1},colormapOffset:m??0,colormapMaxIndex:u.length/4-1}:void 0,C=s[r.indexOf("u_mask")],x=C?{maskTexture:{texture:C,unit:3}}:void 0,{highlightTexture:y}=e;return{config:l,projectionConfig:h,colormapConfig:d,pixelMaskConfig:x,highlightConfig:y?{highlightTexture:{texture:y,unit:4}}:void 0,projectionDefines:{applyProjection:f,lookupProjection:f&&1===g.spacing[0]}}}}export{s as RasterColorizerTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{tileSize as e}from"../../../definitions.js";import{Technique as t}from"../Technique.js";import{getInterpolationDefines as i}from"./processor/textureUtils.js";import{RasterRangeHighlightShader as r}from"../shaders/raster/RasterRangeHighlightShader.js";import{SizedPixelFormat as o,PixelType as s}from"../../../../../../webgl/enums.js";import{FramebufferObject as n}from"../../../../../../webgl/FramebufferObject.js";import{Texture as a}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../../../../webgl/TextureDescriptor.js";class g extends t{constructor(){super(...arguments),this.name="BrushRasterHighlight",this.type=2,this.shaders={range:new r}}shutdown(e){super.shutdown(e),this._fbo?.dispose(),this._fbo=void 0}render(t,r){const{context:o}=t;if(!this._fbo){const i=u(t.context,e,e);this._fbo=new n(o,i)}const s=o.getBoundFramebufferObject(),a=o.getViewport(),{pixelHighlightOptions:h}=t;for(const n of r.bitmaps){if(!h||!n.source||n.highlighted||n.suspended||n.isRendereredSource)continue;const r=n.bandIds?.length?n.bandIds.indexOf(h.bandId):0;if(r<0||r>2)continue;t.timeline.begin(this.name);const{painter:s}=t;s.setPipelineState({depth:!1,stencil:{test:!1,write:!1},color:{write:[!0,!0,!0,!0],blendMode:"custom",blendParameters:{srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0}}}),n.updateTexture(t),n.updateProcessedTexture(!1);const{config:a,projectionConfig:g,highlightConfig:c,projectionDefines:d}=this._getCommonConfig(n),f=i(n);"bilinear"!==n.interpolation||t.context.capabilities.textureFloatLinear||(f.bilinear=!0);const p=new Float32Array(9);p[3*r]=1;const l={...h,bandSwap:p},m={shader:this.shaders.range,uniforms:{projectionConfig:g,config:a,rangeHighlightConfig:l,highlightConfig:c},defines:{...d,...f,applyPixelMask:!1,applyPixelHighlights:!1,hasExistingHighlights:!!c},optionalAttributes:null,useComputeBuffer:!1};o.bindFramebuffer(this._fbo),o.setViewport(0,0,e,e),s.submitDrawMesh(t.context,m,s.quadMesh);const x=u(t.context,e,e);this._fbo.copyToTexture(0,0,e,e,0,0,x),n.highlightTexture=x,t.timeline.end(this.name)}o.bindFramebuffer(s),o.setViewport(a.x,a.y,a.width,a.height)}_getCommonConfig(e){const{names:t,textures:i}=e.getTextures({forProcessing:!0,useProcessedTexture:e.processed}),r=i[t.indexOf("u_image")],o=e.getRasterTextureSize(),s={texture:{texture:r,unit:0},dvsMat3:new Float32Array([2,0,0,0,2,0,-1,-1,0]),coordScale:[1,1],srcImageSize:o,opacity:1},n=i[t.indexOf("u_transformGrid")],{transformGrid:a}=e,h=!(!n||!a),g=h?{transformTexture:{texture:n,unit:1},targetImageSize:[e.width,e.height],transformSpacing:a.spacing,transformGridSize:a.size}:void 0,{highlightTexture:u}=e;return{config:s,projectionConfig:g,highlightConfig:u?{highlightTexture:{texture:u,unit:2}}:void 0,projectionDefines:{applyProjection:h,lookupProjection:h&&1===a.spacing[0]}}}}function u(e,t,i){const r=new h(t,i);return r.internalFormat=o.RGBA8,r.samplingMode=9728,r.dataType=s.UNSIGNED_BYTE,r.isImmutable=!0,r.wrapMode=33071,new a(e,r)}export{g as RasterHighlightTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BaseRasterProcessorTechnique as s}from"./BaseRasterProcessorTechnique.js";import{AspectShader as e}from"../../shaders/raster/processor/AspectShader.js";class t extends s{constructor(){super(...arguments),this.name="RasterAspectProcessor",this.type=2,this.shaders={aspect:new e}}_process(s,e){const t={cellSize:e.getRasterCellSize()},r=this._getCommonConfig(s,e),o={shader:this.shaders.aspect,uniforms:{config:r,aspectConfig:t},defines:{},optionalAttributes:null,useComputeBuffer:!1},{painter:a,context:i}=s;a.submitDrawMesh(i,o,a.quadMesh)}}export{t as AspectTechnique};
5
+ import{BaseRasterProcessorTechnique as s}from"./BaseRasterProcessorTechnique.js";import{AspectShader as e}from"../../shaders/raster/processor/AspectShader.js";class t extends s{constructor(){super(...arguments),this.name="RasterAspectProcessor",this.type=3,this.shaders={aspect:new e}}_process(s,e){const t={cellSize:e.getRasterCellSize()},r=this._getCommonConfig(s,e),o={shader:this.shaders.aspect,uniforms:{config:r,aspectConfig:t},defines:{},optionalAttributes:null,useComputeBuffer:!1},{painter:a,context:i}=s;a.submitDrawMesh(i,o,a.quadMesh)}}export{t as AspectTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BaseRasterProcessorTechnique as e}from"./BaseRasterProcessorTechnique.js";import{BandArithmeticShader as t}from"../../shaders/raster/processor/BandArithmeticShader.js";class s extends e{constructor(){super(...arguments),this.name="RasterBandArithmeticProcessor",this.type=3,this.shaders={bandArithmetic:new t}}_process(e,t){const s=e.rasterFunction.parameters,r={indexType:s.indexType,isOutputRounded:s.isOutputRounded},n={bandIndexMat3:s.bandIndexMat3},i=s.adjustments?{adjustments:[...s.adjustments]}:void 0,a=this._getCommonConfig(e,t),o={shader:this.shaders.bandArithmetic,uniforms:{config:a,bandArithmeticConfig:n,adjustmentConfig:i},defines:r,optionalAttributes:null,useComputeBuffer:!1},{painter:d,context:u}=e;d.submitDrawMesh(u,o,d.quadMesh)}}export{s as BandArithmeticTechnique};
5
+ import{BaseRasterProcessorTechnique as e}from"./BaseRasterProcessorTechnique.js";import{BandArithmeticShader as t}from"../../shaders/raster/processor/BandArithmeticShader.js";class s extends e{constructor(){super(...arguments),this.name="RasterBandArithmeticProcessor",this.type=4,this.shaders={bandArithmetic:new t}}_process(e,t){const s=e.rasterFunction.parameters,r={indexType:s.indexType,isOutputRounded:s.isOutputRounded},n={bandIndexMat3:s.bandIndexMat3},i=s.adjustments?{adjustments:[...s.adjustments]}:void 0,a=this._getCommonConfig(e,t),o={shader:this.shaders.bandArithmetic,uniforms:{config:a,bandArithmeticConfig:n,adjustmentConfig:i},defines:r,optionalAttributes:null,useComputeBuffer:!1},{painter:d,context:u}=e;d.submitDrawMesh(u,o,d.quadMesh)}}export{s as BandArithmeticTechnique};