@arcgis/core 4.33.0-next.20250423 → 4.33.0-next.20250425

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 (294) hide show
  1. package/Graphic.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/Analysis.d.ts +4 -0
  4. package/analysis/Analysis.js +1 -1
  5. package/analysis/SliceAnalysis.js +1 -1
  6. package/analysis/SlicePlane.js +1 -1
  7. package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
  8. package/analysis/support/AnalysisOriginWebScene.js +5 -0
  9. package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/070839cb71c8e764b8d7.js +1 -0
  13. package/assets/esri/core/workers/chunks/19084a293694c5a00cae.js +1 -0
  14. package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{fa8a3c75f9b41d31559b.js → 265f69d153b7b6f07e42.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
  20. package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
  21. package/assets/esri/core/workers/chunks/2bed8a5ed9ae3760fa2f.js +1 -0
  22. package/assets/esri/core/workers/chunks/2e3019ce49e972a815ca.js +1 -0
  23. package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
  24. package/assets/esri/core/workers/chunks/38f5e6a202ce292edd9f.js +1 -0
  25. package/assets/esri/core/workers/chunks/415903f481392c72870f.js +1 -0
  26. package/assets/esri/core/workers/chunks/4351b3e54b309935faed.js +1 -0
  27. package/assets/esri/core/workers/chunks/4da99f058cca83937e9b.js +1 -0
  28. package/assets/esri/core/workers/chunks/5acdd49c5f1a49fdc6e7.js +1 -0
  29. package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
  30. package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
  31. package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
  32. package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
  33. package/assets/esri/core/workers/chunks/968f2f841c011095a6d2.js +1 -0
  34. package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
  35. package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
  36. package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
  37. package/assets/esri/core/workers/chunks/a2676f3f135ad5fdf872.js +1 -0
  38. package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +1 -0
  39. package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
  40. package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +319 -0
  41. package/assets/esri/core/workers/chunks/bf543bdec3da0fe278fb.js +1 -0
  42. package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
  43. package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
  44. package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
  45. package/assets/esri/core/workers/chunks/{7c42281188b874ffcdad.js → db5913824d5e5a2a8365.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{9408a72968cbd985dd24.js → f2cef954b58c6604642c.js} +34 -34
  48. package/assets/esri/core/workers/chunks/f52e597dca4b32a81881.js +1 -0
  49. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  50. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  51. package/chunks/BloomBlur.glsl.js +7 -7
  52. package/chunks/BloomComposition.glsl.js +24 -25
  53. package/chunks/ShadowCastAccumulate.glsl.js +13 -9
  54. package/chunks/ShadowCastVisualize.glsl.js +24 -9
  55. package/chunks/cameraUtilsSpherical.js +1 -1
  56. package/chunks/lyr3DMain.js +1 -1
  57. package/chunks/lyr3DWorker.js +1 -1
  58. package/chunks/sphere.js +1 -1
  59. package/core/Collection.js +1 -1
  60. package/core/JSONSupport.js +1 -1
  61. package/core/SetUtils.js +1 -1
  62. package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
  63. package/core/urlUtils.js +1 -1
  64. package/geometry/Mesh.js +1 -1
  65. package/geometry/support/normalizeUtilsSync.js +1 -1
  66. package/geometry/support/sphere.js +1 -1
  67. package/interfaces.d.ts +544 -116
  68. package/layers/DimensionLayer.js +1 -1
  69. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  70. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  71. package/layers/ParquetLayer.js +1 -1
  72. package/layers/RouteLayer.js +1 -1
  73. package/layers/SubtypeGroupLayer.js +1 -1
  74. package/layers/ViewshedLayer.js +1 -1
  75. package/layers/graphics/data/QueryEngine.js +1 -1
  76. package/layers/mixins/ImageryTileMixin.js +1 -1
  77. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  78. package/layers/orientedImagery/transformations/utils.js +1 -1
  79. package/layers/support/FieldsIndex.js +1 -1
  80. package/layers/support/ParquetEncodingLocation.d.ts +4 -0
  81. package/layers/support/ParquetEncodingLocation.js +1 -1
  82. package/layers/support/ParquetEncodingWkb.d.ts +4 -0
  83. package/layers/support/ParquetEncodingWkb.js +1 -1
  84. package/layers/support/RasterStorageInfo.js +1 -1
  85. package/layers/support/VideoElement.js +1 -1
  86. package/layers/support/layerUtils.js +1 -1
  87. package/layers/support/parquetUtils.d.ts +3 -0
  88. package/layers/support/parquetUtils.js +1 -1
  89. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  90. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  91. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  92. package/layers/support/rasterDatasets/RawBlockCache.js +1 -1
  93. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  94. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  95. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  96. package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
  97. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  98. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  99. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  100. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  101. package/layers/support/rasterFunctions/RemapFunction.js +1 -1
  102. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  103. package/layers/support/videoUtils.js +5 -0
  104. package/package.json +2 -2
  105. package/portal/schemas/definitions.js +1 -1
  106. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  107. package/renderers/UniqueValueRenderer.js +1 -1
  108. package/renderers/support/colorRampUtils.js +1 -1
  109. package/support/revision.js +1 -1
  110. package/symbols/IconSymbol3DLayer.js +1 -1
  111. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  112. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  113. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  114. package/views/2d/engine/webgl/textureUtils.js +1 -1
  115. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  116. package/views/2d/layers/MediaLayerView2D.js +1 -1
  117. package/views/2d/layers/TileLayerView2D.js +1 -1
  118. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  119. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  120. package/views/2d/layers/support/DebugOverlay.js +1 -1
  121. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  122. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  123. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  124. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  125. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  126. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  127. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  128. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
  129. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  130. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  131. package/views/3d/camera/constraintUtils/distance.js +1 -1
  132. package/views/3d/camera/intersectionUtils.js +1 -1
  133. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  134. package/views/3d/environment/atmosphereUtils.js +1 -1
  135. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  136. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  137. package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
  138. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  139. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  140. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  141. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  142. package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
  143. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  144. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  145. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  146. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  147. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  148. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
  152. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  153. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  154. package/views/3d/layers/I3SMeshView3D.js +1 -1
  155. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  156. package/views/3d/layers/Lyr3DWorker.js +1 -1
  157. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  158. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  159. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  160. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  161. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  162. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  163. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  164. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  165. package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +5 -0
  166. package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +5 -0
  167. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  168. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  169. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  170. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  171. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  172. package/views/3d/state/ConstraintsManager.js +1 -1
  173. package/views/3d/state/NearFarHeuristic.js +1 -1
  174. package/views/3d/state/ViewState.js +1 -1
  175. package/views/3d/state/ViewStateManager.js +1 -1
  176. package/views/3d/state/utils/navigationUtils.js +1 -1
  177. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  178. package/views/3d/support/geometryUtils/sphere.js +1 -1
  179. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  180. package/views/3d/webgl/ManagedDepthTexture.js +1 -1
  181. package/views/3d/webgl/ManagedFBO.js +1 -1
  182. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  183. package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
  184. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -20
  185. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
  186. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js +5 -0
  187. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  188. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  189. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  190. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  191. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  192. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  193. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  194. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  195. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  196. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  197. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  198. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  199. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  200. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  201. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  202. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  203. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  204. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  205. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  206. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  207. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  208. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  209. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +5 -0
  210. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  211. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  212. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  213. package/views/PopupView.js +1 -1
  214. package/views/SceneView.js +1 -1
  215. package/views/SelectionManager.js +1 -1
  216. package/views/VideoView.js +1 -1
  217. package/views/analysis/analysisViewUtils.js +1 -1
  218. package/views/input/InputManager.js +1 -1
  219. package/views/input/ViewEvents.js +1 -1
  220. package/views/support/selectionUtils.js +1 -1
  221. package/views/webgl/FBOAttachmentType.js +5 -0
  222. package/views/webgl/FramebufferObject.js +1 -1
  223. package/views/webgl/Renderbuffer.js +1 -1
  224. package/views/webgl/RenderbufferDescriptor.js +1 -1
  225. package/views/webgl/Texture.js +1 -1
  226. package/views/webgl/TextureDescriptor.js +1 -1
  227. package/views/webgl/textureUtils.js +1 -1
  228. package/webscene/InitialViewProperties.js +1 -1
  229. package/webscene/Presentation.js +1 -1
  230. package/webscene/Slide.js +1 -1
  231. package/webscene/SlideLegendInfo.js +1 -1
  232. package/webscene/background/ColorBackground.js +1 -1
  233. package/webscene/spec-certification/api.js +1 -1
  234. package/webscene/spec-certification/compare.js +1 -1
  235. package/webscene/spec-certification/index.js +1 -1
  236. package/webscene/spec-certification/spec.js +1 -1
  237. package/webscene/spec-certification/utils.js +1 -1
  238. package/webscene/support/Description.js +1 -1
  239. package/webscene/support/SlideElements.js +1 -1
  240. package/webscene/support/SlideEnvironment.js +1 -1
  241. package/webscene/support/SlideGround.js +1 -1
  242. package/webscene/support/SlideVisibleLayer.js +1 -1
  243. package/webscene/support/Title.js +1 -1
  244. package/webscene/support/analysisUtils.js +5 -0
  245. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  246. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  247. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  248. package/widgets/Editor/EditorViewModel.js +1 -1
  249. package/widgets/Editor/UpdateWorkflow.js +1 -1
  250. package/widgets/Editor/support/SketchController.js +5 -0
  251. package/widgets/Editor/workflowUtils.js +1 -1
  252. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  253. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  254. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  255. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  256. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  257. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  258. package/widgets/FeatureTable.js +1 -1
  259. package/widgets/LayerList/LayerListItem.js +1 -1
  260. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  261. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  262. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  263. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  264. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  265. package/widgets/Sketch/SketchViewModel.js +1 -1
  266. package/widgets/VideoPlayer.js +1 -1
  267. package/widgets/Widget.js +1 -1
  268. package/widgets/support/AnalysisViewModel.js +1 -1
  269. package/widgets/support/SelectionList.js +1 -1
  270. package/widgets/support/SnappingControls.js +1 -1
  271. package/assets/esri/core/workers/chunks/184d7c8ea818bec5c462.js +0 -1
  272. package/assets/esri/core/workers/chunks/22f604726529ee6f8c25.js +0 -1
  273. package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
  274. package/assets/esri/core/workers/chunks/26fcbe053194bd78fcc3.js +0 -1
  275. package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
  276. package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
  277. package/assets/esri/core/workers/chunks/4f8782b3b6ad414409e8.js +0 -1
  278. package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
  279. package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
  280. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +0 -319
  281. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +0 -1
  282. package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
  283. package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
  284. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
  285. package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
  286. package/assets/esri/core/workers/chunks/a276980c06d5d311a37e.js +0 -1
  287. package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +0 -1
  288. package/assets/esri/core/workers/chunks/ccc50f28f217e50cc2c3.js +0 -1
  289. package/assets/esri/core/workers/chunks/d04efa51da9b4eb3a8a7.js +0 -1
  290. package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
  291. package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
  292. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
  293. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.js +0 -1
  294. package/views/webgl/formats.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as t}from"../../../chunks/vec32.js";import i from"../../../geometry/Point.js";import{fromPoints as o,fromValues as n}from"../../../geometry/support/ray.js";import{l as c,j as s}from"../../../chunks/sphere.js";import{isElevationSource as f}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPoint as m,rectifyMapPointPanoramic as l}from"./rectifyMapPoint.js";import{or as p,isUpdateElevationWithElevationSource as y,isElevationSampler as u,scaleWithFactor as h,scaleAndAddWithFactor as d,computeNewReferenceCoordinates as g,projectiveTransform as w,validatePixelsToTransform as v,validateRotationMatrix as x,getWebMercatorScalingFactor as j,computeFarplaneVertices as A,computeHFOVAndVFOV as P,vecToPoint as R,hasAngles as V,convertPixelToHeadingPitch as F,convertHeadingPitchToSphereVertex as M,reducerFn as T}from"./utils.js";import{worldToImage as b}from"./worldToImage.js";import{defaultImageSphereCenter as L}from"../../../widgets/PanoramicViewer/constants.js";async function O(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:c,pixelsToTransform:s,vecToPoint:f}=z(e,r),m=new Array;return await E(s,n,i,f,r,m,c,o,t,a),Array.isArray(e)?m:m[0]}async function E(e,r,a,t,i,o,n,c,s,f){let l=i.averageElevation;for(const h of e){const e=q(r,a,h,t,i);if(f&&p(u(f.elevationSample),y(f))){l=(await m(t(e),{x:h[0],y:h[1]},{...i,...f,farPlaneVertices:r.map(t)}))[2]}o.push(t(k(e,n,c,l,i.cameraPitch,s)))}}function k(e,i,o,n,c,s){let f=r(e);const m=Math.sqrt((e[2]-i[2])**2+(Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2)/o)**2)*o,l=h(t(a(),e,i),1/m,1/o);if(S(e[2],n,c,s)){const e=Math.abs((i[2]-n)/-l[2])*o;f=d(i,l,e,o)}else f[2]=n;return f}function S(e,r,a,t){return e<r||a+t/2<90}function q(e,r,a,t,i){let o=null;const n=9;let c,s=0,f=e,m=r;for(;s<=n;){const e=D(a,m,f,i);if(c=e.error,o=e.transformedPoint,p(c<=1,s===n))break;f=g(f,c,a,r),m=B(f,t,i),s++}return o}function B(e,r,a){return b(e.map(r),a).map((({x:e,y:r})=>[e,r,1]))}function D(e,r,a,t){const{cameraLocation:o}=t,n=w(e,r,a),{x:c,y:s}=b(new i(n,o.spatialReference),t);return{transformedPoint:n,error:H(e,[c,s,1])}}function H(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function z(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:o,rotationMatrix:n}=a;if(v(t,o),x(n),9!==n?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=j(o.y,o.spatialReference),s=A({...a,scalingFactor:c}),f=b(s.map((e=>new i(e,o.spatialReference))),a),{vfov:m}=P(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:o.toArray(),imageBoundaries:f.map((({x:e,y:r})=>[e,r,1])),verticalFieldOfView:m,farPlaneVertices:s,scalingFactor:c,pixelsToTransform:t.map((e=>[e.x,e.y,1])),vecToPoint:R(o.spatialReference)}}async function I(e,r,t){const{cameraHeading:m,cameraLocation:p,farDistance:y,imageHeight:h,imageWidth:d,verticalFieldOfView:g}=r,w=j(p.y,p.spatialReference),v=new Array,[x,A,P]=p.toArray(),R=c([x,A,P??0],y*w),b=L.toArray(),O=Array.isArray(e)?e:[e];for(const c of O){let e,j;if(V(c))e=c.heading,j=c.pitch;else{const r=F({x:c.x,y:c.y},d,h);e=r.heading,j=r.pitch}e=(e+m)%360;const L=o([b[0],b[1],b[2]],M(e,j)),O=n([x,A,P??0],L.direction),E=a();s(R,O,E);let S=r.averageElevation;if(t&&(f(t)||u(t.elevationSample))&&j+g/2<90){S=(await l(new i(E,p.spatialReference),{heading:e,pitch:j},{...r,...t,farPlaneVertices:T(y,y).map((([e,r])=>new i([p.x+e,p.y+r],p.spatialReference)))}))[2]}v.push(new i(k(E,p.toArray(),w,S,j,g),p.spatialReference))}return Array.isArray(e)?v:v[0]}export{O as imageToWorld,I as imageToWorldPanoramic};
5
+ import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as t}from"../../../chunks/vec32.js";import i from"../../../geometry/Point.js";import{fromPoints as o,fromValues as n}from"../../../geometry/support/ray.js";import{l as c,h as s}from"../../../chunks/sphere.js";import{isElevationSource as f}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPoint as m,rectifyMapPointPanoramic as l}from"./rectifyMapPoint.js";import{or as p,isUpdateElevationWithElevationSource as y,isElevationSampler as u,scaleWithFactor as h,scaleAndAddWithFactor as d,computeNewReferenceCoordinates as g,projectiveTransform as w,validatePixelsToTransform as v,validateRotationMatrix as x,getWebMercatorScalingFactor as A,computeFarplaneVertices as P,computeHFOVAndVFOV as j,vecToPoint as R,hasAngles as V,convertPixelToHeadingPitch as F,convertHeadingPitchToSphereVertex as M,reducerFn as T}from"./utils.js";import{worldToImage as b}from"./worldToImage.js";import{defaultImageSphereCenter as L}from"../../../widgets/PanoramicViewer/constants.js";async function O(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:c,pixelsToTransform:s,vecToPoint:f}=z(e,r),m=new Array;return await E(s,n,i,f,r,m,c,o,t,a),Array.isArray(e)?m:m[0]}async function E(e,r,a,t,i,o,n,c,s,f){let l=i.averageElevation;for(const h of e){const e=q(r,a,h,t,i);if(f&&p(u(f.elevationSample),y(f))){l=(await m(t(e),{x:h[0],y:h[1]},{...i,...f,farPlaneVertices:r.map(t)}))[2]}o.push(t(k(e,n,c,l,i.cameraPitch,s)))}}function k(e,i,o,n,c,s){let f=r(e);const m=Math.sqrt((e[2]-i[2])**2+(Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2)/o)**2)*o,l=h(t(a(),e,i),1/m,1/o);if(S(e[2],n,c,s)){const e=Math.abs((i[2]-n)/-l[2])*o;f=d(i,l,e,o)}else f[2]=n;return f}function S(e,r,a,t){return e<r||a+t/2<90}function q(e,r,a,t,i){let o=null;const n=9;let c,s=0,f=e,m=r;for(;s<=n;){const e=D(a,m,f,i);if(c=e.error,o=e.transformedPoint,p(c<=1,s===n))break;f=g(f,c,a,r),m=B(f,t,i),s++}return o}function B(e,r,a){return b(e.map(r),a).map((({x:e,y:r})=>[e,r,1]))}function D(e,r,a,t){const{cameraLocation:o}=t,n=w(e,r,a),{x:c,y:s}=b(new i(n,o.spatialReference),t);return{transformedPoint:n,error:H(e,[c,s,1])}}function H(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function z(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:o,rotationMatrix:n}=a;if(v(t,o),x(n),9!==n?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=A(o.y,o.spatialReference),s=P({...a,scalingFactor:c}),f=b(s.map((e=>new i(e,o.spatialReference))),a),{vfov:m}=j(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:o.toArray(),imageBoundaries:f.map((({x:e,y:r})=>[e,r,1])),verticalFieldOfView:m,farPlaneVertices:s,scalingFactor:c,pixelsToTransform:t.map((e=>[e.x,e.y,1])),vecToPoint:R(o.spatialReference)}}async function I(e,r,t){const{cameraHeading:m,cameraLocation:p,farDistance:y,imageHeight:h,imageWidth:d,verticalFieldOfView:g}=r,w=A(p.y,p.spatialReference),v=new Array,[x,P,j]=p.toArray(),R=c([x,P,j??0],y*w),b=L.toArray(),O=Array.isArray(e)?e:[e];for(const c of O){let e,A;if(V(c))e=c.heading,A=c.pitch;else{const r=F({x:c.x,y:c.y},d,h);e=r.heading,A=r.pitch}e=(e+m)%360;const L=o([b[0],b[1],b[2]],M(e,A)),O=n([x,P,j??0],L.direction),E=a();s(R,O,E);let S=r.averageElevation;if(t&&(f(t)||u(t.elevationSample))&&A+g/2<90){S=(await l(new i(E,p.spatialReference),{heading:e,pitch:A},{...r,...t,farPlaneVertices:T(y,y).map((([e,r])=>new i([p.x+e,p.y+r],p.spatialReference)))}))[2]}v.push(new i(k(E,p.toArray(),w,S,A,g),p.spatialReference))}return Array.isArray(e)?v:v[0]}export{O as imageToWorld,I as imageToWorldPanoramic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import n from"../../../core/JSONSupport.js";import{deg2rad as a,rad2deg as i}from"../../../core/mathUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as l,transpose as f}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as u}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as m,g as p}from"../../../chunks/vec32.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isElevationSource as w,isConstantElevation as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function S(t,n,a){const[i,e,r,c]=n,[s,l,f,m]=a;z(i,e,r,c);const p=z(s,l,f,m),M=V(i,e,r,c),g=V(s,l,f,m),v=h(o(),M),d=u(o(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function z(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function F(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=F(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const e=D(c([...i,1]),h(new Array(16),r(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=e[0],l=e[1],f=e[2],u=o();return u[0]=s*t[0],u[1]=l*n[0],u[2]=f*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=f*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=f*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=f,u[15]=1,u}function C(t,n,a,i,e=s()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=s();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=s();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(n,i,o,r=!0){if(!Number.isFinite(n))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?a(n):n),s=Math.cos(c),l=Math.sin(c),f=e();switch(i){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const N={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function H(n,a,i=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=e();for(let t=0;t<3;t++){const[e,r]=a[t],c=I(n[t],e,r,i);l(o,c,o)}return o}function q(t,n=!0){return H(t,N.OPK,n)}function k(t,n=!0){return H(t,N.HPR,n)}function A(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,l]=n,f=a(r),h=a(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function W(t,n){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=n,h=a(c),u=a(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=i(O);return[i(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function U(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=X(t,i);return J(e,o,n,a)}function J(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function X(t,n){const a=i(Math.acos(-t.z/n));return{heading:i(Math.atan2(t.x,t.y)),pitch:a}}function Y(t,n,i=E/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}function Z(t,n,a,i=E/2){const{heading:e,pitch:o}=U(t,n,a);return Y(e,o,i)}async function $(t,n,a){const e=await g(n,t.spatialReference,a);let o=i(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>S(x(s(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>w(t?.elevationSource)&&null!=t?.extent,Mt=t=>y(t?.elevationSource),gt=async(t,a)=>null!=a&&(mt(a)||Mt(a))?a:pt(a)?{elevationSample:await b({...n.isSerializable(a.elevationSource)?a.elevationSource.toJSON():a.elevationSource,extent:a.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:n,farDistance:i,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:l}=t,h=e();f(h,r);const u=2*Math.tan(a(l)/2)*i*c,M=2*Math.tan(a(o)/2)*i*c,g=L([0,0,-1],h),v=C([n.x,n.y,n.z],g,t.farDistance*c,c),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,u/2,c),y=R(x,M/2,c),O=m(s(),w,y),b=p(s(),w,y);return[p(s(),v,O),p(s(),v,b),m(s(),v,O),m(s(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,A as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Y as convertHeadingPitchToSphereVertex,J as convertOrientationToPixelLocation,Z as convertPixelLocationToSphereVertex,U as convertPixelToHeadingPitch,X as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,H as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,W as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,S as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
5
+ import t from"../../../core/Error.js";import{deg2rad as n,rad2deg as a}from"../../../core/mathUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as e,fromValues as o}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as r}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as s,transpose as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as f,mul as h}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{a as u,g as m}from"../../../chunks/vec32.js";import{isSerializable as p}from"../../../core/support/jsonUtils.js";import M from"../../../geometry/Point.js";import{projectWithZConversion as g}from"../../../geometry/projection.js";import{earth as v}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{a as x}from"../../../chunks/vec3.js";import{isElevationSource as w,isConstantElevation as y,ConstantElevation as O}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as b}from"./updateElevationUtils.js";import{isNumber as j}from"../../../support/guards.js";import{defaultImageSphereSize as E}from"../../../widgets/PanoramicViewer/constants.js";function z(t,n,a){const[i,o,r,c]=n,[s,l,u,m]=a;F(i,o,r,c);const p=F(s,l,u,m),M=V(i,o,r,c),g=V(s,l,u,m),v=f(e(),M),d=h(e(),v,g),[x,w,y,O]=P(t,d);return[x/O,w/O,p?0:y/O]}function F(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function S(t){return 0===t?1:t}function P(t,n){const[a,i,e]=t,o=[0,0,0,0];return o[0]=a*n[0]+i*n[1]+e*n[2]+n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+n[11],o[3]=S(a*n[12]+i*n[13]+e*n[14]+n[15]),o}function V(t,n,a,i){const c=D(r([...i,1]),f(new Array(16),o(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),s=c[0],l=c[1],h=c[2],u=e();return u[0]=s*t[0],u[1]=l*n[0],u[2]=h*a[0],u[3]=0,u[4]=s*t[1],u[5]=l*n[1],u[6]=h*a[1],u[7]=0,u[8]=s*t[2],u[9]=l*n[2],u[10]=h*a[2],u[11]=0,u[12]=s,u[13]=l,u[14]=h,u[15]=1,u}function C(t,n,a,i,e=c()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function R(t,n,a){const i=c();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,o=c();return o[0]=a*n[0]+i*n[3]+e*n[6],o[1]=a*n[1]+i*n[4]+e*n[7],o[2]=a*n[2]+i*n[5]+e*n[8],o}function D(t,n){const[a,i,e,o]=t,r=new Array(4);return r[0]=a*n[0]+i*n[1]+e*n[2]+o*n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+o*n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+o*n[11],r[3]=a*n[12]+i*n[13]+e*n[14]+o*n[15],r}function I(a,e,o,r=!0){if(!Number.isFinite(a))throw new t("InvalidRotationAngle","Please specify a valid angle for rotation");const c=o*(r?n(a):a),s=Math.cos(c),l=Math.sin(c),f=i();switch(e){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new t("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const H={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function N(n,a,e=!0){if(3!==n?.length||3!==a?.length)throw new t("InvalidRotationAngles","Please specify three angles with config for rotation");const o=i();for(let t=0;t<3;t++){const[i,r]=a[t],c=I(n[t],i,r,e);s(o,c,o)}return o}function q(t,n=!0){return N(t,H.OPK,n)}function k(t,n=!0){return N(t,H.HPR,n)}function A(t,a,i){const e=Math.sin(n(i)),o=Math.cos(n(i)),r=[[t,0],[t,a],[0,a]];r.forEach(((t,n)=>{r[n]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function K(t,a){const i=n(t[1]),e=n(t[0]),o=t[2],[r,c,s,l]=a,f=n(r),h=n(c),u=s/Math.sqrt(1-l*Math.sin(f)**2),m=e-h,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(u*Math.sin(f)-p*Math.sin(i));return[(p+o)*Math.cos(i)*Math.sin(m),(p+o)*(Math.sin(i)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(m))+M*Math.cos(f),(p+o)*(Math.sin(i)*Math.sin(f)+Math.cos(f)*Math.cos(i)*Math.cos(m))-u+M*Math.sin(f)]}function U(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,l,f]=i,h=n(c),u=n(s),m=l/Math.sqrt(1-f*Math.sin(h)**2),p=e/m,M=o/m,g=r/m,v=Math.cos(h)-Math.sin(h)*M+Math.cos(h)*g,d=Math.sin(h)+Math.cos(h)*M+Math.sin(h)*g,x=Math.sqrt(v**2+p**2),w=f*m*Math.sin(h),y=(t,n=5)=>{if(0===n)return t;const a=y(t,n-1);return Math.atan(d/x-(w-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(m*x))},O=y(h),b=Math.atan(e/(m*v))+u,j=a(O);return[a(b),j,e/(Math.cos(O)*Math.sin(b-u))-l/Math.sqrt(1-f*Math.sin(O)**2)]}function W(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function T(t,n,a,i=E/2){const{heading:e,pitch:o}=Y(t,i);return X(e,o,n,a)}function X(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function Y(t,n){const i=a(Math.acos(-t.z/n));return{heading:a(Math.atan2(t.x,t.y)),pitch:i}}function Z(t,a,i=E/2){return[i*(Math.sin(n(t))*Math.sin(n(a))),i*(Math.cos(n(t))*Math.sin(n(a))),i*Math.cos(n(180-a))]}function J(t,n,a,i=E/2){const{heading:e,pitch:o}=W(t,n,a);return Z(e,o,i)}async function $(t,n,i){const e=await g(n,t.spatialReference,i);let o=a(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function B(t,n,a){const i=Math.cos(a),e=Math.sin(a),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,l=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=l;return[t*o[0]+n*o[2]+o[4],t*o[1]+n*o[3]+o[5]]}const G=t=>t.toArray(),Q=(...t)=>t.some((t=>t));function _(t,n){if(Q(0===t.length,t.some((({x:t,y:n})=>Q(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function tt(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function nt(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function at(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/v.radius))):1}const it=t=>n=>new M(n,t),et=t=>null!=t&&"queryExtent"in t;function ot(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>z(x(c(),a,[n,e,0]),i,t)))}function rt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:o},r,c,s){const l=[t??r/2-.5,n,a??0,i??c/2-.5,e??0,o].map(ct);return null!=s&&st(l)?{affines:l,focalLength:s}:{affines:[r/2-.5,1,0,c/2-.5,0,-1]}}function ct(t,n){if(null==t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function st(t){return null!=t[1]&&null!=t[5]}function lt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:o,elevation:r,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,h=r??(l.z??0)-i;return{...ut(t,n,a),averageElevation:h,cameraPitch:e,cameraRoll:o??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function ft(t,n,a,i){return wt(i)?q([i.omega,i.phi,i.kappa]):yt(i)?k([i.heading,i.pitch,i.roll]):k([t,n,a??0])}function ht(t,n,a){const{cameraHeading:i,cameraHeight:e,elevation:o,farDistance:r,horizontalFieldOfView:c,location:s,verticalFieldOfView:l}=t;return{averageElevation:o??(s.z??0)-e,cameraLocation:s,cameraHeading:i,farDistance:r,horizontalFieldOfView:c,imageHeight:a,imageWidth:n,verticalFieldOfView:l}}function ut(t,n,a){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:h,cameraRoll:u,focalLength:m,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:d,radial:x,tangential:w,verticalFieldOfView:y}=t,{affines:O,focalLength:b}=rt({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},n,a,m),j=g??ft(l,h,u,f),E=null!=v&&null!=d?[v,d]:void 0;return{affineTransformations:f?.affineTransformations??O,cameraLocation:M.clone(),focalLength:f?.focalLength??b,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:f?.principalOffsetPoint??E,radialDistortionCoefficients:f?.radialDistortionCoefficients??x,rotationMatrix:j,tangentialDistortionCoefficients:f?.tangentialDistortionCoefficients??w,verticalFieldOfView:y}}const mt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,pt=t=>w(t?.elevationSource)&&null!=t?.extent,Mt=t=>y(t?.elevationSource),gt=async(t,n)=>null!=n&&(mt(n)||Mt(n))?n:pt(n)?{elevationSample:await b({...p(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent}),elevationSource:new O({constantElevation:t})}:{elevationSource:new O({constantElevation:t})},vt=t=>j(t?.heading)&&j(t?.pitch),dt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function xt(t){const{cameraLocation:a,farDistance:e,horizontalFieldOfView:o,rotationMatrix:r,scalingFactor:s,verticalFieldOfView:f}=t,h=i();l(h,r);const p=2*Math.tan(n(f)/2)*e*s,M=2*Math.tan(n(o)/2)*e*s,g=L([0,0,-1],h),v=C([a.x,a.y,a.z],g,t.farDistance*s,s),d=L([0,1,0],h),x=L([1,0,0],h),w=R(d,p/2,s),y=R(x,M/2,s),O=u(c(),w,y),b=m(c(),w,y);return[m(c(),v,O),m(c(),v,b),u(c(),v,O),u(c(),v,b)]}const wt=t=>2===t?.type,yt=t=>1===t?.type;function Ot(t){const n=t%360;return n<-180?n+360:n}function bt(t,n,a){if("panoramic"===t){const[t,i]=a;return T({x:n.x,y:n.y,z:n.z},t,i)}return{x:n.x+.5,y:.5-n.y}}var jt;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(jt||(jt={}));export{xt as computeFarplaneVertices,A as computeHFOVAndVFOV,ot as computeNewReferenceCoordinates,Z as convertHeadingPitchToSphereVertex,X as convertOrientationToPixelLocation,J as convertPixelLocationToSphereVertex,W as convertPixelToHeadingPitch,Y as convertSphereVertexToOrientation,T as convertSphereVertexToPixelLocation,N as createRotationMatrix,k as createRotationMatrixFromHPR,q as createRotationMatrixFromOPK,K as geographicToLTP,rt as getAffinesAndFocalLength,ht as getImageToWorldPanoramicProperties,lt as getImageToWorldProperties,$ as getInitialAngle,gt as getUpdateElevationProps,at as getWebMercatorScalingFactor,ut as getWorldToImageProperties,vt as hasAngles,yt as hasHeadingPitchRoll,wt as hasOmegaPhiKappa,et as isElevationSampler,mt as isUpdateElevationWithElevationSampler,pt as isUpdateElevationWithElevationSource,Mt as isUpdateUsingConstantElevation,st as isValidAffines,V as linearEquationSolve,U as ltpToGeographic,Ot as normalizeHeading,Q as or,G as pointToArray,z as projectiveTransform,dt as reducerFn,B as rotatePixel,C as scaleAndAddWithFactor,R as scaleWithFactor,bt as transformGraphicCoordinatesToPixel,L as transformMat3,D as transformMat4,_ as validatePixelsToTransform,tt as validatePointsToTransform,nt as validateRotationMatrix,it as vecToPoint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import i from"../../core/JSONSupport.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{UnknownTimeZone as n}from"../../core/sql/UnknownTimeZone.js";import{isDateField as r,isNumericField as l,isObjectIDField as o,isGlobalIDField as d,getFieldDefaultValue as a,isTimeOnlyField as m,normalizeFieldName as u}from"./fieldUtils.js";import{utc as f,unknown as F}from"../../time/constants.js";import{fromTimeReference as h}from"../../time/timeZoneUtils.js";import{FixedOffsetZone as c,IANAZone as p}from"luxon";function y(e){return"timeZone"in e}function _(e){return"timeZone"in e}function g(e){return"dateFieldsTimeZone"in e}const T=new Map;class Z{static fromJSON(e){return new Z(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new Z(e.fields??[],S(e))}static fromLayerJSON(e){return new Z(e.fields??[],S(e))}constructor(e=[],i){this._fieldsMap=new Map,this._normalizedFieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this._requiredFields=null,this.dateFields=[],this.numericFields=[],this.fields=e||[],this._timeZoneByFieldName=i?new Map(i):null;const t=[];for(const s of this.fields){const e=s?.name,i=M(e);if(e&&i){const n=w(e);this._fieldsMap.set(e,s),this._fieldsMap.set(n,s),this._normalizedFieldsMap.set(i,s),t.push(`${n}:${s.type}:${this._timeZoneByFieldName?.get(e)}`),r(s)?(this.dateFields.push(s),this._dateFieldsSet.add(s)):l(s)&&(this._numericFieldsSet.add(s),this.numericFields.push(s)),o(s)||d(s)||(s.editable=null==s.editable||!!s.editable,s.nullable=null==s.nullable||!!s.nullable)}}t.sort(),this.uid=t.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)o(e)||d(e)||e.nullable||void 0!==a(e)||this._requiredFields.push(e)}return this._requiredFields}equals(e){return this.uid===e?.uid}has(e){return null!=this.get(e)}get(e){if(!e)return;let i=this._fieldsMap.get(e);return i||(i=this._fieldsMap.get(w(e))??this._normalizedFieldsMap.get(M(e)),i&&this._fieldsMap.set(e,i),i)}getTimeZone(i){const s=this.get(i&&"string"!=typeof i?i.name:i);return s?this._timeZoneByFieldName?this._timeZoneByFieldName.get(s.name):"date"===s.type||"esriFieldTypeDate"===s.type?(t.getLogger("esri.layers.support.FieldsIndex").errorOnce(new e("getTimeZone:no-timezone-information",`no time zone information for field '${s.name}'`)),f):N.has(s.type)?F:null:null}getLuxonTimeZone(e){const i=this.getTimeZone(e);return i?i===F?n.instance:i===f?c.utcInstance:s(T,i,(()=>p.create(i))):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return m(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){return this.get(e)?.name??void 0}toJSON(){return{fields:this.fields.map((e=>i.isSerializable(e)?e.toJSON():e)),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}function w(e){return e.trim().toLowerCase()}function M(e){return u(e)?.toLowerCase()??""}const N=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function S(e){const i=new Map;if(!e.fields)return i;const t=!0===e.datesInUnknownTimezone,{timeInfo:s,editFieldsInfo:n}=e,r=(s?"startField"in s?s.startField:s.startTimeField:"")??"",l=(s?"endField"in s?s.endField:s.endTimeField:"")??"",o=g(e)?e.dateFieldsTimeZone??null:e.dateFieldsTimeReference?h(e.dateFieldsTimeReference):null,d=n?y(n)?n.timeZone??o:n.dateFieldsTimeReference?h(n.dateFieldsTimeReference):o??f:null,a=s?_(s)?s.timeZone??o:s.timeReference?h(s.timeReference):o:null,m=new Map([[w(n?.creationDateField??""),d],[w(n?.editDateField??""),d],[w(r),a],[w(l),a]]);for(const{name:u,type:f}of e.fields)if(N.has(f))i.set(u,F);else if("date"!==f&&"esriFieldTypeDate"!==f)i.set(u,null);else if(t)i.set(u,F);else{const e=m.get(w(u??""))??o;i.set(u,e)}return i}export{Z as default};
5
+ import e from"../../core/Error.js";import i from"../../core/Logger.js";import{getOrCreateMapValue as t}from"../../core/MapUtils.js";import{UnknownTimeZone as s}from"../../core/sql/UnknownTimeZone.js";import{isSerializable as n}from"../../core/support/jsonUtils.js";import{isDateField as r,isNumericField as l,isObjectIDField as o,isGlobalIDField as d,getFieldDefaultValue as a,isTimeOnlyField as m,normalizeFieldName as u}from"./fieldUtils.js";import{utc as f,unknown as F}from"../../time/constants.js";import{fromTimeReference as h}from"../../time/timeZoneUtils.js";import{FixedOffsetZone as c,IANAZone as p}from"luxon";function y(e){return"timeZone"in e}function _(e){return"timeZone"in e}function g(e){return"dateFieldsTimeZone"in e}const T=new Map;class Z{static fromJSON(e){return new Z(e.fields,e.timeZoneByFieldName)}static fromLayer(e){return new Z(e.fields??[],S(e))}static fromLayerJSON(e){return new Z(e.fields??[],S(e))}constructor(e=[],i){this._fieldsMap=new Map,this._normalizedFieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this._requiredFields=null,this.dateFields=[],this.numericFields=[],this.fields=e||[],this._timeZoneByFieldName=i?new Map(i):null;const t=[];for(const s of this.fields){const e=s?.name,i=M(e);if(e&&i){const n=w(e);this._fieldsMap.set(e,s),this._fieldsMap.set(n,s),this._normalizedFieldsMap.set(i,s),t.push(`${n}:${s.type}:${this._timeZoneByFieldName?.get(e)}`),r(s)?(this.dateFields.push(s),this._dateFieldsSet.add(s)):l(s)&&(this._numericFieldsSet.add(s),this.numericFields.push(s)),o(s)||d(s)||(s.editable=null==s.editable||!!s.editable,s.nullable=null==s.nullable||!!s.nullable)}}t.sort(),this.uid=t.join()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)o(e)||d(e)||e.nullable||void 0!==a(e)||this._requiredFields.push(e)}return this._requiredFields}equals(e){return this.uid===e?.uid}has(e){return null!=this.get(e)}get(e){if(!e)return;let i=this._fieldsMap.get(e);return i||(i=this._fieldsMap.get(w(e))??this._normalizedFieldsMap.get(M(e)),i&&this._fieldsMap.set(e,i),i)}getTimeZone(t){const s=this.get(t&&"string"!=typeof t?t.name:t);return s?this._timeZoneByFieldName?this._timeZoneByFieldName.get(s.name):"date"===s.type||"esriFieldTypeDate"===s.type?(i.getLogger("esri.layers.support.FieldsIndex").errorOnce(new e("getTimeZone:no-timezone-information",`no time zone information for field '${s.name}'`)),f):N.has(s.type)?F:null:null}getLuxonTimeZone(e){const i=this.getTimeZone(e);return i?i===F?s.instance:i===f?c.utcInstance:t(T,i,(()=>p.create(i))):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return m(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){return this.get(e)?.name??void 0}toJSON(){return{fields:this.fields.map((e=>n(e)?e.toJSON():e)),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}}function w(e){return e.trim().toLowerCase()}function M(e){return u(e)?.toLowerCase()??""}const N=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function S(e){const i=new Map;if(!e.fields)return i;const t=!0===e.datesInUnknownTimezone,{timeInfo:s,editFieldsInfo:n}=e,r=(s?"startField"in s?s.startField:s.startTimeField:"")??"",l=(s?"endField"in s?s.endField:s.endTimeField:"")??"",o=g(e)?e.dateFieldsTimeZone??null:e.dateFieldsTimeReference?h(e.dateFieldsTimeReference):null,d=n?y(n)?n.timeZone??o:n.dateFieldsTimeReference?h(n.dateFieldsTimeReference):o??f:null,a=s?_(s)?s.timeZone??o:s.timeReference?h(s.timeReference):o:null,m=new Map([[w(n?.creationDateField??""),d],[w(n?.editDateField??""),d],[w(r),a],[w(l),a]]);for(const{name:u,type:f}of e.fields)if(N.has(f))i.set(u,F);else if("date"!==f&&"esriFieldTypeDate"!==f)i.set(u,null);else if(t)i.set(u,F);else{const e=m.get(w(u??""))??o;i.set(u,e)}return i}export{Z as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import ParquetEncodingLocation = __esri.ParquetEncodingLocation;
4
+ export default ParquetEncodingLocation;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(o){super(o),this.type="location",this.latitudeFieldName=null,this.longitudeFieldName=null}};o([r({type:["location"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([r({json:{write:!0}})],s.prototype,"latitudeFieldName",void 0),o([r({json:{write:!0}})],s.prototype,"longitudeFieldName",void 0),s=o([e("esri.layers.support.ParquetEncodingLocation")],s);export{s as ParquetEncodingLocation};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends t{constructor(o){super(o),this.type="location",this.latitudeFieldName=null,this.longitudeFieldName=null}};o([e({type:["location"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([e({json:{write:!0}})],s.prototype,"latitudeFieldName",void 0),o([e({json:{write:!0}})],s.prototype,"longitudeFieldName",void 0),s=o([r("esri.layers.support.ParquetEncodingLocation")],s);const i=s;export{i as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import ParquetEncodingWkb = __esri.ParquetEncodingWkb;
4
+ export default ParquetEncodingWkb;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.type="wkb",this.primaryFieldName=null}};o([t({type:["wkb"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([t({json:{write:!0}})],s.prototype,"multiscale",void 0),o([t({json:{write:!0}})],s.prototype,"orientation",void 0),o([t({json:{write:!0}})],s.prototype,"primaryFieldName",void 0),s=o([e("esri.layers.support.ParquetEncodingWkb")],s);export{s as ParquetEncodingWkb};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.type="wkb",this.primaryFieldName=null}};o([t({type:["wkb"],readOnly:!0,json:{write:!0}})],s.prototype,"type",void 0),o([t({json:{write:!0}})],s.prototype,"multiscale",void 0),o([t({json:{write:!0}})],s.prototype,"orientation",void 0),o([t({json:{write:!0}})],s.prototype,"primaryFieldName",void 0),s=o([e("esri.layers.support.ParquetEncodingWkb")],s);const p=s;export{p 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import i from"../../core/JSONSupport.js";import{clone as t}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../geometry/Point.js";var p;let l=p=class extends i{constructor(){super(...arguments),this.blockWidth=void 0,this.blockHeight=void 0,this.compression=null,this.origin=null,this.firstPyramidLevel=null,this.maximumPyramidLevel=null,this.pyramidScalingFactor=2,this.pyramidBlockWidth=null,this.pyramidBlockHeight=null,this.isVirtualTileInfo=!1,this.tileInfo=null,this.transposeInfo=null,this.blockBoundary=null}clone(){return new p({blockWidth:this.blockWidth,blockHeight:this.blockHeight,compression:this.compression,origin:t(this.origin),firstPyramidLevel:this.firstPyramidLevel,maximumPyramidLevel:this.maximumPyramidLevel,pyramidResolutions:t(this.pyramidResolutions),pyramidScalingFactor:this.pyramidScalingFactor,pyramidBlockWidth:this.pyramidBlockWidth,pyramidBlockHeight:this.pyramidBlockHeight,isVirtualTileInfo:this.isVirtualTileInfo,tileInfo:t(this.tileInfo),transposeInfo:t(this.transposeInfo),blockBoundary:t(this.blockBoundary)})}};o([r({type:Number,json:{write:!0}})],l.prototype,"blockWidth",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"blockHeight",void 0),o([r({type:String,json:{write:!0}})],l.prototype,"compression",void 0),o([r({type:s,json:{write:!0}})],l.prototype,"origin",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"firstPyramidLevel",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"maximumPyramidLevel",void 0),o([r({json:{write:!0}})],l.prototype,"pyramidResolutions",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"pyramidScalingFactor",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"pyramidBlockWidth",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"pyramidBlockHeight",void 0),o([r({type:Boolean,json:{write:!0}})],l.prototype,"isVirtualTileInfo",void 0),o([r({json:{write:!0}})],l.prototype,"tileInfo",void 0),o([r()],l.prototype,"transposeInfo",void 0),o([r({json:{write:!0}})],l.prototype,"blockBoundary",void 0),l=p=o([e("esri.layers.support.RasterStorageInfo")],l);const n=l;export{n as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import i from"../../core/JSONSupport.js";import{clone as t}from"../../core/lang.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../geometry/Point.js";var p;let l=p=class extends i{constructor(){super(...arguments),this.blockWidth=void 0,this.blockHeight=void 0,this.compression=null,this.origin=null,this.firstPyramidLevel=null,this.maximumPyramidLevel=null,this.pyramidScalingFactor=2,this.pyramidBlockWidth=null,this.pyramidBlockHeight=null,this.isBsqTile=!1,this.isVirtualTileInfo=!1,this.tileInfo=null,this.transposeInfo=null,this.blockBoundary=null}clone(){return new p({blockWidth:this.blockWidth,blockHeight:this.blockHeight,compression:this.compression,origin:t(this.origin),firstPyramidLevel:this.firstPyramidLevel,maximumPyramidLevel:this.maximumPyramidLevel,pyramidResolutions:t(this.pyramidResolutions),pyramidScalingFactor:this.pyramidScalingFactor,pyramidBlockWidth:this.pyramidBlockWidth,pyramidBlockHeight:this.pyramidBlockHeight,isVirtualTileInfo:this.isVirtualTileInfo,tileInfo:t(this.tileInfo),transposeInfo:t(this.transposeInfo),blockBoundary:t(this.blockBoundary)})}};o([r({type:Number,json:{write:!0}})],l.prototype,"blockWidth",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"blockHeight",void 0),o([r({type:String,json:{write:!0}})],l.prototype,"compression",void 0),o([r({type:s,json:{write:!0}})],l.prototype,"origin",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"firstPyramidLevel",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"maximumPyramidLevel",void 0),o([r({json:{write:!0}})],l.prototype,"pyramidResolutions",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"pyramidScalingFactor",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"pyramidBlockWidth",void 0),o([r({type:Number,json:{write:!0}})],l.prototype,"pyramidBlockHeight",void 0),o([r({json:{write:!0}})],l.prototype,"isBsqTile",void 0),o([r({type:Boolean,json:{write:!0}})],l.prototype,"isVirtualTileInfo",void 0),o([r({json:{write:!0}})],l.prototype,"tileInfo",void 0),o([r()],l.prototype,"transposeInfo",void 0),o([r({json:{write:!0}})],l.prototype,"blockBoundary",void 0),l=p=o([e("esri.layers.support.RasterStorageInfo")],l);const n=l;export{n 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{isAbsolute as n,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as l}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../../core/accessorSupport/decorators/writer.js";import y from"./MediaElementBase.js";import{mediaElementUrlProperty as v,mediaTypeProperty as g}from"./mediaUtils.js";import{VideoElementSymbol as f}from"../../support/mediaLayerUtils.js";import{i as j}from"../../chunks/persistableUrlUtils.js";var b;let U=class extends y{static{b=f}constructor(e){super(e),this.autoplay=!0,this.content=null,this.type="video",this[b]=!0}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(this._preProcessVideoUrl(e).then((async e=>{const t=document.createElement("video");return t.src=encodeURI(e),t.crossOrigin="anonymous",t.autoplay=this.autoplay,t.muted=!0,t.loop=!0,t.playsInline=!0,this._loadVideo(t).then((()=>{this._set("content",t)}))}))):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then((()=>{this._set("content",e)}))):this.addResolvingPromise(Promise.reject(new o("video-element:invalid-video-type","Invalid video type",{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.content?.currentTime}set currentTime(e){if(!this.content)return;const t=i(e,0,this.content.duration);"fastSeek"in this.content?this.content.fastSeek(t):this.content.currentTime=t,this.content.play().then((()=>{this.content?.pause()})).catch((()=>{}))}get duration(){return this.content?.duration}set video(e){"not-loaded"===this.loadStatus?this._set("video",e):s.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const i=V(e)?e:null;if(!i)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!n(i)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(i);const c=a(i);!j(c)?t[r]=c:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(c(e))return d(e);try{return await t(e,{method:"head"}),e}catch{try{return d(e,!0)}catch{return e}}}_loadVideo(e){return new Promise(((t,o)=>{const s=r(e,"canplay",(()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()}));this.addHandles(s,"canplay"),"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",p(e.src)||(e.src=e.src))}))}};e([u()],U.prototype,"autoplay",void 0),e([u({readOnly:!0})],U.prototype,"content",void 0),e([u({readOnly:!0})],U.prototype,"contentWidth",null),e([u({readOnly:!0})],U.prototype,"contentHeight",null),e([u({type:Number})],U.prototype,"currentTime",null),e([u({type:Number})],U.prototype,"duration",null),e([u(v)],U.prototype,"video",null),e([h("video")],U.prototype,"writeVideo",null),e([u(g)],U.prototype,"type",void 0),U=e([m("esri.layers.support.VideoElement")],U);const w=U;function V(e){return"string"==typeof e&&!l(e)&&!p(e)}export{w as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import r from"../../core/Logger.js";import{clamp as s}from"../../core/mathUtils.js";import{isAbsolute as i,makeAbsolute as n,getProxyRule as a,addProxy as c,isBlobProtocol as d,isDataProtocol as l}from"../../core/urlUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import h from"./MediaElementBase.js";import{mediaElementUrlProperty as y,mediaTypeProperty as v}from"./mediaUtils.js";import{whenVideoPlayable as g}from"./videoUtils.js";import{VideoElementSymbol as f}from"../../support/mediaLayerUtils.js";import{i as j}from"../../chunks/persistableUrlUtils.js";var b;const U=Symbol("canplay");let w=class extends h{static{b=f}constructor(e){super(e),this.autoplay=!0,this.content=null,this.type="video",this[b]=!0}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(this._preProcessVideoUrl(e).then((async e=>{const t=document.createElement("video");return t.src=encodeURI(e),t.crossOrigin="anonymous",t.autoplay=this.autoplay,t.muted=!0,t.loop=!0,t.playsInline=!0,this._loadVideo(t).then((()=>{this._set("content",t)}))}))):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then((()=>{this._set("content",e)}))):this.addResolvingPromise(Promise.reject(new o("video-element:invalid-video-type","Invalid video type",{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.content?.currentTime}set currentTime(e){if(!this.content)return;const t=s(e,0,this.content.duration);"fastSeek"in this.content?this.content.fastSeek(t):this.content.currentTime=t,this.content.play().then((()=>{this.content?.pause()})).catch((()=>{}))}get duration(){return this.content?.duration}set video(e){"not-loaded"===this.loadStatus?this._set("video",e):r.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const a=_(e)?e:null;if(!a)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!i(a)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(a);const c=n(a);!j(c)?t[r]=c:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(a(e))return c(e);try{return await t(e,{method:"head"}),e}catch{try{return c(e,!0)}catch{return e}}}async _loadVideo(e){"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",d(e.src)||(e.src=e.src));try{await g(e,(e=>this.addHandles(e,U))),this.autoplay&&await e.play().catch((e=>{throw console.error(e),e}))}finally{this.removeHandles(U)}}};e([p()],w.prototype,"autoplay",void 0),e([p({readOnly:!0})],w.prototype,"content",void 0),e([p({readOnly:!0})],w.prototype,"contentWidth",null),e([p({readOnly:!0})],w.prototype,"contentHeight",null),e([p({type:Number})],w.prototype,"currentTime",null),e([p({type:Number})],w.prototype,"duration",null),e([p(y)],w.prototype,"video",null),e([m("video")],w.prototype,"writeVideo",null),e([p(v)],w.prototype,"type",void 0),w=e([u("esri.layers.support.VideoElement")],w);const V=w;function _(e){return"string"==typeof e&&!l(e)&&!d(e)}export{V 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";function i(e){return p(e)||l(e)}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function l(e){return"scene"===e?.type}function y(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function f(e){return"subtype-sublayer"===e?.type}function p(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function g(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function b(e){return null!=e&&"type"in e&&"group"===e.type}const d={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function m(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function h(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function j(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function v(e){return"voxel"===e?.type}function w(e){return"imagery-tile"===e?.type}function L(e,t){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent[t].includes(e)}function E(e){return L(e,"baseLayers")}function S(e){return L(e,"referenceLayers")}function C(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function M(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function x(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function I(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function T(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function k(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function O(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.slice(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:o}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return o?.owningSystemUrl||null}function B(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function P(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function U(e){return B(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function q(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function D(e){return!!q(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function J(e){if(!e)return[];return("subtypes"in e?e.subtypes:y(e.parent)?e.parent.subtypes:[])??[]}function N(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function V(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))"csv"===n.type||r(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}export{D as getEffectiveEditingEnabled,U as getEffectiveLayerCapabilities,V as getLayersWithChartSupport,O as getOwningPortalUrl,J as getSubtypesFromLayer,k as getTileMaxtrixSetFromActiveLayer,E as isBaseLayer,i as isBasemap3DSupportedLayer,p as isBasemapSupportedTiledLayer,C as isFeatureCollectionLayer,u as isFeatureLayer,x as isFeatureServiceLayer,s as isGraphicsLayer,b as isGroupLayer,w as isImageryTileLayer,j as isIntegratedMeshLayer,h as isIntegratedMeshOperationalLayer,o as isKnowledgeGraphLayer,B as isLayerWithFeatureCapabilities,M as isLayerWithFeatureLayerSource,N as isLayerWithFlowRenderer,c as isLinkChartLayer,a as isMapNotesLayer,S as isReferenceLayer,l as isSceneLayer,m as isSceneServiceLayer,y as isSubtypeGroupLayer,f as isSubtypeSublayer,P as isTable,g as isTiledLayer,v as isVoxelLayer,d as sceneServiceLayerTypeToClassName,I as serializeLayerDefinitions,T as serializeTimeOptions};
5
+ import{id as e}from"../../kernel.js";import t from"../../request.js";import n from"../../core/Collection.js";import{isLayerFromCatalog as r}from"../catalog/catalogUtils.js";function i(e){return g(e)||y(e)}function u(e){return null!=e&&"object"==typeof e&&"type"in e&&"feature"===e.type}function s(e){return null!=e&&"object"==typeof e&&"type"in e&&"graphics"===e.type}function a(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function o(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-notes"===e.type&&"sublayers"in e}function c(e){return null!=e&&"object"==typeof e&&"type"in e&&"knowledge-graph"===e.type&&"layers"in e}function l(e){return null!=e&&"object"==typeof e&&"type"in e&&"link-chart"===e.type&&"layers"in e}function y(e){return"scene"===e?.type}function f(e){return null!=e&&"object"==typeof e&&"type"in e&&"subtype-group"===e.type&&"sublayers"in e}function p(e){return"subtype-sublayer"===e?.type}function g(e){const t=e?.type;return"imagery-tile"===t||"tile"===t||"open-street-map"===t||"vector-tile"===t||"web-tile"===t||"wmts"===t}function b(e){const t=e?.type;return"base-tile"===t||"tile"===t||"elevation"===t||"imagery-tile"===t||"base-elevation"===t||"open-street-map"===t||"wcs"===t||"web-tile"===t||"wmts"===t||"vector-tile"===t}function d(e){return null!=e&&"type"in e&&"group"===e.type}const m={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function h(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function j(e){return"IntegratedMeshLayer"===e||"IntegratedMesh3DTilesLayer"===e}function v(e){return"integrated-mesh"===e||"integrated-mesh-3dtiles"===e}function w(e){return"voxel"===e?.type}function L(e){return"imagery-tile"===e?.type}function E(e,t){return null!=e?.parent&&"declaredClass"in e.parent&&"esri.Basemap"===e.parent.declaredClass&&e.parent[t].includes(e)}function S(e){return E(e,"baseLayers")}function C(e){return E(e,"referenceLayers")}function M(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function x(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}function I(e){return"feature"===e?.type&&"feature-layer"===e.source?.type}function T(e){const t=/[:;]/,n=[];let r=!1;if(e&&(e.forEach(((e,i)=>{n.push([i,e]),!r&&t.test(e)&&(r=!0)})),n.length>0)){let e;if(r){const t={};n.forEach((e=>{t[e[0]]=e[1]})),e=JSON.stringify(t)}else{const t=[];n.forEach((e=>{t.push(e[0]+":"+e[1])})),e=t.join(";")}return e}return null}function k(e){if(!e)return;const t=[];return e.forEach(((e,n)=>{t.push('"'+n+'":'+JSON.stringify(e))})),t.length?"{"+t.join(",")+"}":void 0}function O(e){if(e.activeLayer){const t=e.activeLayer.tileMatrixSet;if(t)return t;const n=e.activeLayer.tileMatrixSets;if(n)return n}return null}async function B(n,r){const i=e?.findServerInfo(n);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const u=n.toLowerCase().indexOf("/rest/services");if(-1===u)return null;const s=`${n.slice(0,u)}/rest/info`,a=null!=r?r.signal:null,{data:o}=await t(s,{query:{f:"json"},responseType:"json",signal:a});return o?.owningSystemUrl||null}function P(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function U(e){return null!=e&&"object"==typeof e&&"isTable"in e&&!!e.isTable}function q(e){return P(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function D(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function J(e){return!!D(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function N(e){if(!e)return[];return("subtypes"in e?e.subtypes:f(e.parent)?e.parent.subtypes:[])??[]}function V(e){return("imagery"===e.type||"imagery-tile"===e.type)&&"flow"===e.renderer?.type}function $(e){const t=new n;for(const n of e.allLayers.concat(e.allTables))"csv"===n.type||r(n)||("charts"in n&&t.push(n),"subtype-group"===n.type&&t.push(...n.sublayers));return t}export{J as getEffectiveEditingEnabled,q as getEffectiveLayerCapabilities,$ as getLayersWithChartSupport,B as getOwningPortalUrl,N as getSubtypesFromLayer,O as getTileMaxtrixSetFromActiveLayer,S as isBaseLayer,i as isBasemap3DSupportedLayer,g as isBasemapSupportedTiledLayer,M as isFeatureCollectionLayer,u as isFeatureLayer,I as isFeatureServiceLayer,s as isGraphicsLayer,d as isGroupLayer,L as isImageryTileLayer,v as isIntegratedMeshLayer,j as isIntegratedMeshOperationalLayer,c as isKnowledgeGraphLayer,P as isLayerWithFeatureCapabilities,x as isLayerWithFeatureLayerSource,V as isLayerWithFlowRenderer,l as isLinkChartLayer,a as isMapImageLayer,o as isMapNotesLayer,C as isReferenceLayer,y as isSceneLayer,h as isSceneServiceLayer,f as isSubtypeGroupLayer,p as isSubtypeSublayer,U as isTable,b as isTiledLayer,w as isVoxelLayer,m as sceneServiceLayerTypeToClassName,T as serializeLayerDefinitions,k as serializeTimeOptions};
@@ -0,0 +1,3 @@
1
+ import "../../interfaces";
2
+
3
+ export const getParquetLayerInfo: __esri.parquetUtils["getParquetLayerInfo"];
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as n}from"../../core/jsonMap.js";import o from"../../geometry/SpatialReference.js";import r from"./Field.js";import{inferLocationInfo as i}from"./locationUtils.js";import{ParquetEncodingLocation as a}from"./ParquetEncodingLocation.js";import{ParquetEncodingWkb as l}from"./ParquetEncodingWkb.js";import{ParquetMetadata as s}from"../../libs/parquet/parquet.js";const u=new n({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function m(e){return u.toJSON(e)}function c(t,n={}){return p({urls:new e(t)},n)}async function p(e,n={}){if(e.geometryType&&e.spatialReference&&e.encoding&&e.fields)return e;if(e.urls.length<1)throw new t("parquet:bad-input","At least one url must be specified",e);const i=e.metadata??await s.create(e.urls.getItemAt(0),(()=>n.customParameters)),a=i.tryReadGeoMetadata(),l={...e,metadata:i};if(null==l.fields&&(l.fields=i.fields.map((e=>r.fromJSON(e)))),null==l.encoding&&(l.encoding=d(i,a)),!l.encoding)return l;switch(l.encoding.type){case"location":null==l.spatialReference&&(l.spatialReference=o.WGS84),null==l.geometryType&&(l.geometryType="point");break;case"wkb":{if(!a)return l;const e=a.primary_column,t=a.columns[e];l.geometryType||(l.geometryType=y(t)),l.spatialReference||(l.spatialReference=g(t))}}return l}function d(e,t){if(null!=t){const n=t.primary_column,o=t.columns[n],r=e.tryReadEsriMetadata();return new l({primaryFieldName:n,orientation:o.orientation??null,multiscale:r?.multiscale})}const n=i(e.fields.map((e=>e.name)));return new a({latitudeFieldName:n.latitudeFieldName,longitudeFieldName:n.longitudeFieldName})}function f(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function y(e){const{geometry_types:n}=e,o=new Set;for(const t of n){const e=f(t);e&&o.add(e)}if(o.size>1)throw new t("unsupported","Parquet mixed geometry types are not support",{geometryTypes:o});return 1===o.size?o.values().next().value:void 0}function g(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new o({wkid:t}):void 0}export{p as completeParquetLayerInfo,c as getParquetLayerInfo,u as parquetGeometryTypeKebabDict,m as toParquetJSONGeometryType};
5
+ import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as n}from"../../core/jsonMap.js";import o from"../../geometry/SpatialReference.js";import r from"./Field.js";import{inferLocationInfo as i}from"./locationUtils.js";import a from"./ParquetEncodingLocation.js";import l from"./ParquetEncodingWkb.js";import{ParquetMetadata as s}from"../../libs/parquet/parquet.js";const u=new n({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"});function m(e){return u.toJSON(e)}function c(t,n={}){return p({urls:new e(t)},n)}async function p(e,n={}){if(e.geometryType&&e.spatialReference&&e.encoding&&e.fields)return e;if(e.urls.length<1)throw new t("parquet:bad-input","At least one url must be specified",e);const i=e.metadata??await s.create(e.urls.getItemAt(0),(()=>n.customParameters)),a=i.tryReadGeoMetadata(),l={...e,metadata:i};if(null==l.fields&&(l.fields=i.fields.map((e=>r.fromJSON(e)))),null==l.encoding&&(l.encoding=d(i,a)),!l.encoding)return l;switch(l.encoding.type){case"location":null==l.spatialReference&&(l.spatialReference=o.WGS84),null==l.geometryType&&(l.geometryType="point");break;case"wkb":{if(!a)return l;const e=a.primary_column,t=a.columns[e];l.geometryType||(l.geometryType=y(t)),l.spatialReference||(l.spatialReference=g(t))}}return l}function d(e,t){if(null!=t){const n=t.primary_column,o=t.columns[n],r=e.tryReadEsriMetadata();return new l({primaryFieldName:n,orientation:o.orientation??null,multiscale:r?.multiscale})}const n=i(e.fields.map((e=>e.name)));return new a({latitudeFieldName:n.latitudeFieldName,longitudeFieldName:n.longitudeFieldName})}function f(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function y(e){const{geometry_types:n}=e,o=new Set;for(const t of n){const e=f(t);e&&o.add(e)}if(o.size>1)throw new t("unsupported","Parquet mixed geometry types are not support",{geometryTypes:o});return 1===o.size?o.values().next().value:void 0}function g(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new o({wkid:t}):void 0}export{p as completeParquetLayerInfo,c as getParquetLayerInfo,u as parquetGeometryTypeKebabDict,m as toParquetJSONGeometryType};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import i from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as R,getSliceIndex as w,createSlices as S,getSliceIds as k}from"./multidimensionalUtils.js";import{getRasterId as v,getBlock as T,putBlock as b,deleteBlock as P,decreaseRefCount as _}from"./RawBlockCache.js";import{convertNoDataToMask as B}from"../rasterFormats/pixelRangeUtils.js";import{decode as M}from"../rasterFormats/RasterCodec.js";import{mosaic as C,approximateTransform as W,getLocalArithmeticNorthRotations as j}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as z,load as H,projectPoint as L,snapPyramid as E,shiftExtent as D,getWorldWrapCount as O,projectExtent as F,getProjectionOffsetGrid as A,getRasterDatasetAlignmentInfo as G,projectResolution as q}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as N,uvComponentToVector as J}from"../rasterFunctions/vectorFieldUtils.js";const V=8,U=256;let Q=0,$=class extends o{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=z(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+Q++}set url(e){this._set("url",h(e,r.getLogger(this)))}async open(e){return this._openPromise??=H().then((()=>this._open(e))),this._openPromise}async fetchTile(e,t,i,o={}){const r=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,r);return o={noClip:!0,...o},this.fetchPixels(n,r.size[0],r.size[1],o)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||R(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=r,{datumTransformation:p}=t;let d=L(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map((e=>e[p])):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map((e=>e[p])):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=E(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:w,col:S,rowOffset:k,colOffset:v,blockWidth:T}=g,b=await this._tileFetchQueue.push({pyramidLevel:x,row:w,col:S,options:t},{signal:t.signal});if(!b?.pixels?.length)return{location:d,value:null};const P=k*T+v;return this._processIdentifyResult(b,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=D(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=z(e.spatialReference),s=O(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const r=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=o.disableWrapAround&&g>0?null:this._fetchPixels(r,d,i,o);l.push(x)}const d=(await Promise.all(l)).map((e=>e?.pixelBlock));let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},o)).pixelBlock}else x=C(d,y,{blockWidths:p});return{extent:e,srcExtent:F(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!r)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=r;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:r.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else g=C(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return F(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?M(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:w(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo,{pyramidResolutions:r}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(o.x+o.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(r){const t=(r[e].x+r[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<r.length;f++){const{x:o,y:n}=r[f];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=o&&null!=c?c.tileSize[0]:s.blockWidth,m=o&&null!=c?c.tileSize[1]:s.blockHeight,u=L(e,r,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,m=o.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:o}=e,r=u.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-o,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:r});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:r});const{pyramidResolutions:i,tileInfo:o}=s;if(i&&i.forEach((e=>{e.x/=t.x,e.y/=t.y})),o){o.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;o.lods.forEach(((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,o={}){let r=O(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=z(e.spatialReference);!d&&x||(r=O(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:r},o);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,v=new m({x:w,y:S,spatialReference:k}),T=I===c&&R===f&&u.x%I==0&&u.y%R==0,b=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),_=k.isGeographic?1e-9:1e-4,{datumTransformation:B}=o;if(!P&&T&&1===y.pixelBlocks.length&&I===t&&R===i&&X(l,b,_))return{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=z(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await H();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b.toJSON(),datumTransformation:B,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},o):A({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b,datumTransformation:B,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1,includeGCSGrid:L});let D;const F=!o.requestRawData,G={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:J,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:J,srcMosaicSize:V,destDimension:F?{width:t,height:i}:null,coefs:F?E.coefficients:null,sampleSpacing:F?G:null,projectDirections:L,gcsGrid:L?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=C(J,V,{alignmentInfo:q});D=F?W(e,{width:t,height:i},E.coefficients,G,o.interpolation):e,L&&E.gcsGrid&&(Q=j({width:t,height:i},E.gcsGrid),D=N(D,this.rasterInfo.dataType,Q))}return o.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,m+=2*o.buffer.cols,u+=2*o.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:v,maxCol:T,maxRow:b}=S;if(0===h&&(w<k||R<v||I>b||g>T))return null;const P=new Array;let _=!1;const B=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!o.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=v&&b>=f&&T>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:o},{signal:o.signal});B?P.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{_=!0,e(null)}))}))):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:r.x+g*s*z,xmax:r.x+(R+1)*s*z,ymin:r.y-(w+1)*l*H,ymax:r.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:_}}_fetchRawTile(e,t,i,o){const{storageInfo:r}=this.rasterInfo,s=null!=r.transposeInfo&&!!o.transposedVariableName;if(!s){const o=r.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=o;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=v(this.rasterId,s?o.transposeVariableName:o.sliceId),a=`${e}/${t}/${i}`;let c=T(l,o.registryId,a);if(null==c){const r=new AbortController;c=this.fetchRawTile(e,t,i,{...o,signal:r.signal}),b(l,o.registryId,a,c,r),c.catch((()=>P(l,o.registryId,a)))}return o.signal&&n(o,(()=>{_(l,o.registryId,a)})),c}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=J([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=G(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=q(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(u&&o.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=E(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||F(e,o,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{x:m,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-m)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-m)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map((e=>e[o])),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map((e=>[e])));return s?.length&&(n.magdirValue=s.map((e=>e[0]))),n}let a=e.pixels.map((e=>e.slice(o*s,o*s+s))),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=S(l,m.transposedVariableName);if(f){const e=k(u,m.multidimensionalDefinition,m.timeExtent);a=a.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),u=e.map((e=>u[e]))}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(B(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map(((e,t)=>{const i={value:0===x?.[t]?null:a.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new d({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};function X(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],$.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],$.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],$.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],$.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],$.prototype,"_openPromise",void 0),e([l()],$.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],$.prototype,"rasterId",null),e([l(p)],$.prototype,"url",null),e([l({type:String,json:{write:!0}})],$.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],$.prototype,"datasetFormat",void 0),e([l()],$.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],$.prototype,"rasterInfo",void 0),e([l()],$.prototype,"ioConfig",void 0),e([l()],$.prototype,"sourceJSON",void 0),$=e([c("esri.layers.support.rasterDatasets.BaseRaster")],$);const K=$;export{K as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import i from"../../../core/Error.js";import o from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{onAbort as n}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import m from"../../../geometry/Point.js";import u from"../../../geometry/SpatialReference.js";import{sanitizeUrl as h}from"../arcgisLayerUrl.js";import{url as p}from"../commonProperties.js";import d from"../DimensionalDefinition.js";import x from"../LOD.js";import y from"../RasterStorageInfo.js";import g from"../TileInfo.js";import{isFunctionRaster as I}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as R,getSliceIndex as w,createSlices as S,getSliceIds as k}from"./multidimensionalUtils.js";import{getRasterId as v,getBlock as T,putBlock as b,deleteBlock as P,decreaseRefCount as B}from"./RawBlockCache.js";import{convertNoDataToMask as _}from"../rasterFormats/pixelRangeUtils.js";import{decode as M}from"../rasterFormats/RasterCodec.js";import{mosaic as C,approximateTransform as W,getLocalArithmeticNorthRotations as j}from"../rasterFunctions/pixelUtils.js";import{getWorldWidth as z,load as H,projectPoint as L,snapPyramid as E,shiftExtent as D,getWorldWrapCount as O,projectExtent as F,getProjectionOffsetGrid as A,getRasterDatasetAlignmentInfo as G,projectResolution as q}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as N,uvComponentToVector as J}from"../rasterFunctions/vectorFieldUtils.js";const V=8,U=256;let Q=0,$=class extends o{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:g.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=z(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),I(this)&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+Q++}set url(e){this._set("url",h(e,r.getLogger(this)))}async open(e){return this._openPromise??=H().then((()=>this._open(e))),this._openPromise}async fetchTile(e,t,i,o={}){const r=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,r);return o={noClip:!0,...o},this.fetchPixels(n,r.size[0],r.size[1],o)}async identify(e,t={}){e=a(m,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||R(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:u,extent:h}=r,{datumTransformation:p}=t;let d=L(e,u,p);if(!h.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let x=0;const y=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if(I(this)){const e=this.primaryRasters.rasters[0];if(y)return e.identify(d,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new f({xmin:d.x-s,xmax:d.x+s,ymin:d.y-l,ymax:d.y+l,spatialReference:u}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:m}=await e.fetchPixels(a,n,n,c),{pixelBlock:h}=await this.fetchPixels(a,n,n,c);if(null==m)return{location:d,value:null};const p=Math.floor(n*n*.5),x=!m.mask||m.mask[p]?m.pixels.map((e=>e[p])):null;let g;return null!=h&&(g=!h.mask||h.mask[p]?h.pixels.map((e=>e[p])):void 0),{location:d,value:x,processedValue:g,pyramidLevel:0}}if(!y)if(t.srcResolution){x=E(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(x=await this.computeBestPyramidLevelForLocation(e,t),null==x)return{location:d,value:null};const g=this.identifyPixelLocation(d,x,null,y);if(null===g)return{location:d,value:null};const{row:w,col:S,rowOffset:k,colOffset:v,blockWidth:T}=g,b=await this._tileFetchQueue.push({pyramidLevel:x,row:w,col:S,options:t},{signal:t.signal});if(!b?.pixels?.length)return{location:d,value:null};const P=k*T+v;return this._processIdentifyResult(b,{srcLocation:d,position:P,pyramidLevel:x,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=D(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=z(e.spatialReference),s=O(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),u=m-Math.round((n/2-a)/(c-a)*t);let h=0;const p=[];for(let g=0;g<=s;g++){const r=new f({xmin:0===g?a:-n/2,xmax:g===s?c-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),d=0===g?m-u:g===s?t-h:m;h+=d,p.push(d);const x=o.disableWrapAround&&g>0?null:this._fetchPixels(r,d,i,o);l.push(x)}const d=(await Promise.all(l)).map((e=>e?.pixelBlock));let x=null;const y={width:t,height:i};if(this.rasterJobHandler){x=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},o)).pixelBlock}else x=C(d,y,{blockWidths:p});return{extent:e,srcExtent:F(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:x}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,u=new f({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!r)return{extent:u,srcExtent:u,pixelBlock:null};const{pixelBlocks:h,mosaicSize:p}=r;if(1===h.length&&null!=h[0]&&h[0].width===i.width&&h[0].height===i.height)return{extent:u,srcExtent:u,pixelBlock:r.pixelBlocks[0]};const d=e>0?l.pyramidBlockWidth:l.blockWidth,x=e>0?l.pyramidBlockHeight:l.blockHeight,y={x:t.x%d,y:t.y%x};let g;if(this.rasterJobHandler){g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else g=C(h,p,{clipOffset:y,clipSize:i});return{extent:u,srcExtent:u,pixelBlock:g}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return F(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?M(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:w(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo,{pyramidResolutions:r}=e;if(!e.tileInfo){const n=[],s=e.maximumPyramidLevel||0;let l=(o.x+o.y)/2,a=1/.0254*96*l;for(let e=0;e<=s&&(n.unshift(new x({level:s-e,resolution:l,scale:a})),e!==s);e++)if(r){const t=(r[e].x+r[e].y)/2;a*=t/l,l=t}else l*=2,a*=2;const c=new m({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new g({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new m({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new y({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let f=0;f<r.length;f++){const{x:o,y:n}=r[f];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,f=o&&null!=c?c.tileSize[0]:s.blockWidth,m=o&&null!=c?c.tileSize[1]:s.blockHeight,u=L(e,r,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/m,y=(u.x-a.x)/p/f,g=Math.min(m-1,Math.floor((x-Math.floor(x))*m)),I=Math.min(f-1,Math.floor((y-Math.floor(y))*f));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:f,srcLocation:u}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,m=o.y-t*l*e.y,u=m-l*e.y;return new f({xmin:a,xmax:c,ymin:u,ymax:m,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{pixelSize:t}=e,{width:i,height:o}=e,r=u.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new f({xmin:-.5,ymax:.5,xmax:i-.5,ymin:.5-o,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new m({x:1,y:1,spatialReference:r});const{extent:n,storageInfo:s}=e;if(s){s.origin=new m({x:n.xmin,y:n.ymax,spatialReference:r});const{pyramidResolutions:i,tileInfo:o}=s;if(i&&i.forEach((e=>{e.x/=t.x,e.y/=t.y})),o){o.origin=s.origin;const t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;o.lods.forEach(((e,i)=>{e.resolution=t*2**i,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,o={}){let r=O(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:f,ul:u}=n;if(0===c||0===f)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:h}=this,p=h.transform,d="gcs-shift"===p?.type,x=null!=z(e.spatialReference);!d&&x||(r=O(n.srcExtent,d));const y=await this._fetchRawTiles(s,u,{width:c,height:f,wrapCount:r},o);if(!y)return{extent:e,srcExtent:a,pixelBlock:null};const g=h.storageInfo,I=s>0?g.pyramidBlockWidth:g.blockWidth,R=s>0?g.pyramidBlockHeight:g.blockHeight;let{x:w,y:S}=h.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[s-1])({x:w,y:S}=e[s-1]);else{const e=t**s;w*=e,S*=e}}const k=h.spatialReference,v=new m({x:w,y:S,spatialReference:k}),T=I===c&&R===f&&u.x%I==0&&u.y%R==0,b=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),P=!e.spatialReference.equals(k),B=k.isGeographic?1e-9:1e-4,{datumTransformation:_}=o;if(!P&&T&&1===y.pixelBlocks.length&&I===t&&R===i&&X(l,b,B))return{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:y.pixelBlocks[0]};const M=x&&null!=z(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await H();const E=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b.toJSON(),datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},o):A({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:b,datumTransformation:_,rasterTransform:p,hasWrapAround:r>0||M,isAdaptive:!1,includeGCSGrid:L});let D;const F=!o.requestRawData,G={rows:E.spacing[0],cols:E.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,y.extent.xmin):void 0,{pixelBlocks:J,mosaicSize:V,isPartiallyFilled:U}=y;let Q=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:J,srcMosaicSize:V,destDimension:F?{width:t,height:i}:null,coefs:F?E.coefficients:null,sampleSpacing:F?G:null,projectDirections:L,gcsGrid:L?E.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:D,localNorthDirections:Q}=e)}else{const e=C(J,V,{alignmentInfo:q});D=F?W(e,{width:t,height:i},E.coefficients,G,o.interpolation):e,L&&E.gcsGrid&&(Q=j({width:t,height:i},E.gcsGrid),D=N(D,this.rasterInfo.dataType,Q))}return o.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D,transformGrid:E,localNorthDirections:Q,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:v,pixelBlock:D}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:u,wrapCount:h}=i;const p=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,m+=2*o.buffer.cols,u+=2*o.buffer.rows);let d=0,x=0,y=0;if(h&&null!=p){({worldColumnCountFromOrigin:x,originColumnOffset:y,rightPadding:d}=p);x*p.blockWidth-d>=a+m&&(d=0)}const g=Math.floor(a/s),I=Math.floor(c/l),R=Math.floor((a+m+d-1)/s),w=Math.floor((c+u+d-1)/l),S=n[e];if(!S)return null;const{minRow:k,minCol:v,maxCol:T,maxRow:b}=S;if(0===h&&(w<k||R<v||I>b||g>T))return null;const P=new Array;let B=!1;const _=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let f=I;f<=w;f++)for(let t=g;t<=R;t++){let i=t;if(!o.disableWrapAround&&h&&null!=p&&x<=t&&(i=t-x-y),f>=k&&i>=v&&b>=f&&T>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:f,col:i,options:o},{signal:o.signal});_?P.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{B=!0,e(null)}))}))):P.push(t)}else P.push(Promise.resolve(null))}if(0===P.length)return null;const M=await Promise.all(P),C={height:(w-I+1)*l,width:(R-g+1)*s},{spatialReference:W}=this.rasterInfo,j=this.getPyramidPixelSize(e),{x:z,y:H}=j;return{extent:new f({xmin:r.x+g*s*z,xmax:r.x+(R+1)*s*z,ymin:r.y-(w+1)*l*H,ymax:r.y-I*l*H,spatialReference:W}),pixelBlocks:M,mosaicSize:C,isPartiallyFilled:B}}_fetchRawTile(e,t,i,o){const{storageInfo:r}=this.rasterInfo,s=null!=r.transposeInfo&&!!o.transposedVariableName;if(!s){const o=r.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:s,maxCol:l,maxRow:a}=o;if(t<n||i<s||t>a||i>l)return Promise.resolve(null)}const l=s?o.transposeVariableName:o.sliceId,a=this.rasterInfo.storageInfo.isBsqTile?o.bandIds:null,c=v(this.rasterId,l,a),f=`${e}/${t}/${i}`;let m=T(c,o.registryId,f);if(null==m){const r=new AbortController;m=this.fetchRawTile(e,t,i,{...o,signal:r.signal}),b(c,o.registryId,f,m,r),m.catch((()=>P(c,o.registryId,f)))}return o.signal&&n(o,(()=>{B(c,o.registryId,f)})),m}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=J([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=G(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,f=l/i,u=a<n&&c*f>=16,h=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(u||h||(0===s||0===l)){const s=new m({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=q(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const h=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(u&&o.srcResolution&&h){const e=Math.round(Math.log(Math.max(c,f))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=E(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||F(e,o,n);if(null==c)return;const f=i.transform;f&&(c=f.inverseTransform(c)),t.srcExtent=c;const{x:m,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-m)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-m)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map((e=>e[o])),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map((e=>[e])));return s?.length&&(n.magdirValue=s.map((e=>e[0]))),n}let a=e.pixels.map((e=>e.slice(o*s,o*s+s))),c=this._computeMagDirValues(a);const{requestSomeSlices:f,identifyOptions:m}=t;let u=S(l,m.transposedVariableName);if(f){const e=k(u,m.multidimensionalDefinition,m.timeExtent);a=a.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),u=e.map((e=>u[e]))}const h=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:a,pixelType:e.pixelType};let x;null!=h&&(_(p,h),x=p.mask);return{location:i,value:null,dataSeries:u.map(((e,t)=>{const i={value:0===x?.[t]?null:a.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new d({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};function X(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}e([l()],$.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],$.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],$.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],$.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],$.prototype,"_openPromise",void 0),e([l()],$.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],$.prototype,"rasterId",null),e([l(p)],$.prototype,"url",null),e([l({type:String,json:{write:!0}})],$.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],$.prototype,"datasetFormat",void 0),e([l()],$.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],$.prototype,"rasterInfo",void 0),e([l()],$.prototype,"ioConfig",void 0),e([l()],$.prototype,"sourceJSON",void 0),$=e([c("esri.layers.support.rasterDatasets.BaseRaster")],$);const K=$;export{K 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/Polygon.js";import o from"./BaseRaster.js";import{clip as a}from"../rasterFunctions/clipUtils.js";import{approximateTransform as n}from"../rasterFunctions/pixelUtils.js";import{projectPolygon as l}from"../rasterFunctions/rasterProjectionHelper.js";import c from"../../../rest/support/FeatureSet.js";const p=40;let m=class extends o{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}async fetchPixels(t,e,r,s={}){const{rasters:i,rasterIds:o}=this.primaryRasters;let l=!1;const{interpolation:c}=s,p=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!s.requestRawData&&p&&(l=1===i.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:l});const m=i.map((i=>i.fetchPixels(t,e,r,s))),u=await Promise.all(m),h=u.map((t=>t.pixelBlock)),f=l||s.requestRawData?u.map((t=>t.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((t=>null==t)))return u[0];const d=u.find((t=>null!=t.pixelBlock))?.extent??t;let y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o});const{transformGrid:g}=u[0];if(!l||null==y||null==g){const t=s.noClip?null:this.getClippingGeometry(d.spatialReference);return s.noClip||s.requestRawData||null==y||!t||(y=await a(y,d,t)),{...u[0],pixelBlock:y}}const x={rows:g.spacing[0],cols:g.spacing[1]};let R;if(this.rasterJobHandler){R=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:e,height:r},coefs:g.coefficients,sampleSpacing:x,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:c,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock}else R=n(y,{width:e,height:r},g.coefficients,x,c);const w=s.noClip?null:this.getClippingGeometry(t.spatialReference);return s.noClip||s.requestRawData||null==R||null==w||(R=await a(R,t,w)),{extent:t,srcExtent:u[0].srcExtent,pixelBlock:R}}getClippingGeometry(t){const e=this._clippingGeometry.get("0");if(!t||!e)return e;const r=f(t);let s=this._clippingGeometry.get(r);return null!=s||(s=t.equals(e.spatialReference)?e:l(e,t),this._clippingGeometry.set(r,s)),s}async _open(t){const{rasterFunction:r}=this;this.primaryRasters?.rasters?.length?r.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=r.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((t=>t.rasterJobHandler=this.rasterJobHandler)));const{rasters:s,rasterIds:i}=this.primaryRasters,o=s.map((e=>e.rasterInfo?void 0:e.open(t)));await Promise.all(o);const a=s.map((({rasterInfo:t})=>t)),n=r.bind({rasterInfos:a,rasterIds:i});if(r.rawSourceRasterInfos=a,!n.success||0===a.length)throw new e("raster-function:open",`cannot bind the function: ${n.error??""}`);const l="Table"===r.functionName?r:r.functionArguments?.raster;"Table"===l?.functionName&&(r.rasterInfo.attributeTable=c.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const p=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every((t=>h(t,p))),this.set("sourceJSON",s[0].sourceJSON),this.set("rasterInfo",r.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async _updateClipGeometry(){const t=this.rasterFunction.getClippingGeometries()[0];let e=t?.clippingGeometry;if(e&&"inside"===t.clippingType){const{extent:t}=this.rasterInfo,r=await import("../../../geometry/operators/densifyOperator.js"),s=await import("../../../geometry/operators/differenceOperator.js");let o=r.execute(i.fromExtent(t),2*(t.width+t.height)/p);o=l(o,e.spatialReference),e=s.execute(o,e)}this._clippingGeometry.clear(),e&&this._clippingGeometry.set("0",e)}};t([r({type:String,json:{write:!0}})],m.prototype,"datasetFormat",void 0),t([r()],m.prototype,"tileType",void 0),t([r()],m.prototype,"rasterFunction",void 0),t([r()],m.prototype,"primaryRasters",void 0),m=t([s("esri.layers.support.rasterDatasets.FunctionRaster")],m);const u=m;function h(t,e){const{storageInfo:r,pixelSize:s,spatialReference:i,extent:o}=t,{storageInfo:a,pixelSize:n,spatialReference:l,extent:c}=e;return s.x===n.x&&s.y===n.y&&i.equals(l)&&o.equals(c)&&r.blockHeight===a.blockHeight&&r.blockWidth===a.blockWidth&&r.maximumPyramidLevel===a.maximumPyramidLevel}function f(t){return String(t.wkid??t.wkt??t.wkt2)}export{u as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Error.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../../geometry/Polygon.js";import o from"./BaseRaster.js";import{clip as a}from"../rasterFunctions/clipUtils.js";import{approximateTransform as n}from"../rasterFunctions/pixelUtils.js";import{projectPolygon as l}from"../rasterFunctions/rasterProjectionHelper.js";import c from"../../../rest/support/FeatureSet.js";const p=40;let m=class extends o{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}async fetchPixels(t,e,r,s={}){const{rasters:i,rasterIds:o}=this.primaryRasters;let l=!1;const{interpolation:c}=s,p=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!s.requestRawData&&p&&(l=1===i.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:l});const m=i.map((i=>i.fetchPixels(t,e,r,s))),u=await Promise.all(m),h=u.map((t=>t.pixelBlock)),f=l||s.requestRawData?u.map((t=>t.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((t=>null==t)))return u[0];const d=u.find((t=>null!=t.pixelBlock))?.extent??t;let y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:o});const{transformGrid:g}=u[0];if(!l||null==y||null==g){const t=s.noClip?null:this.getClippingGeometry(d.spatialReference);return s.noClip||s.requestRawData||null==y||!t||(y=await a(y,d,t)),{...u[0],pixelBlock:y}}const x={rows:g.spacing[0],cols:g.spacing[1]};let R;if(this.rasterJobHandler){R=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:e,height:r},coefs:g.coefficients,sampleSpacing:x,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:c,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock}else R=n(y,{width:e,height:r},g.coefficients,x,c);const w=s.noClip?null:this.getClippingGeometry(t.spatialReference);return s.noClip||s.requestRawData||null==R||null==w||(R=await a(R,t,w)),{extent:t,srcExtent:u[0].srcExtent,pixelBlock:R}}getClippingGeometry(t){const e=this._clippingGeometry.get("0");if(!t||!e)return e;const r=f(t);let s=this._clippingGeometry.get(r);return null!=s||(s=t.equals(e.spatialReference)?e:l(e,t),this._clippingGeometry.set(r,s)),s}async _open(t){const{rasterFunction:r}=this;r.isRoot=!0,this.primaryRasters?.rasters?.length?r.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=r.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((t=>t.rasterJobHandler=this.rasterJobHandler)));const{rasters:s,rasterIds:i}=this.primaryRasters,o=s.map((e=>e.rasterInfo?void 0:e.open(t)));await Promise.all(o);const a=s.map((({rasterInfo:t})=>t)),n=r.bind({rasterInfos:a,rasterIds:i});if(r.rawSourceRasterInfos=a,!n.success||0===a.length)throw new e("raster-function:open",`cannot bind the function: ${n.error??""}`);const l="Table"===r.functionName?r:r.functionArguments?.raster;"Table"===l?.functionName&&(r.rasterInfo.attributeTable=c.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const p=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every((t=>h(t,p))),this.set("sourceJSON",s[0].sourceJSON),this.set("rasterInfo",r.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async _updateClipGeometry(){const t=this.rasterFunction.getClippingGeometries()[0];let e=t?.clippingGeometry;if(e&&"inside"===t.clippingType){const{extent:t}=this.rasterInfo,r=await import("../../../geometry/operators/densifyOperator.js"),s=await import("../../../geometry/operators/differenceOperator.js");let o=r.execute(i.fromExtent(t),2*(t.width+t.height)/p);o=l(o,e.spatialReference),e=s.execute(o,e)}this._clippingGeometry.clear(),e&&this._clippingGeometry.set("0",e)}};t([r({type:String,json:{write:!0}})],m.prototype,"datasetFormat",void 0),t([r()],m.prototype,"tileType",void 0),t([r()],m.prototype,"rasterFunction",void 0),t([r()],m.prototype,"primaryRasters",void 0),m=t([s("esri.layers.support.rasterDatasets.FunctionRaster")],m);const u=m;function h(t,e){const{storageInfo:r,pixelSize:s,spatialReference:i,extent:o}=t,{storageInfo:a,pixelSize:n,spatialReference:l,extent:c}=e;return s.x===n.x&&s.y===n.y&&i.equals(l)&&o.equals(c)&&r.blockHeight===a.blockHeight&&r.blockWidth===a.blockWidth&&r.maximumPyramidLevel===a.maximumPyramidLevel}function f(t){return String(t.wkid??t.wkt??t.wkt2)}export{u 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{assertIsSome as i}from"../../../core/maybe.js";import{urlToObject as s}from"../../../core/urlUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import c from"../RasterInfo.js";import m from"../RasterStorageInfo.js";import u from"../TileInfo.js";import{TilemapCache as h}from"../TilemapCache.js";import f from"./BaseRaster.js";import{setValidBoundary as p}from"../rasterFunctions/pixelUtils.js";import d from"../rasterTransforms/GCSShiftTransform.js";import{patchServiceInfo as y,fetchServiceRasterInfo as x}from"../../../rest/imageService/fetchRasterInfo.js";let g=class extends f{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,s={}){const{storageInfo:r,extent:a}=this.rasterInfo,{transposeInfo:l}=r,n=null!=l&&!!s.transposedVariableName;if(this._slices&&!n&&null==s.sliceId)return null;const o=n?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${o}/${t}/${i}`,m=this._slices?n?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null,{data:u}=await this.request(c,{query:m,responseType:"array-buffer",signal:s.signal});if(!u)return null;const h=n?l.tileSize:r.tileInfo.size,f=await this.decodePixelBlock(u,{width:h[0],height:h[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:n,noDataValue:this.rasterInfo.noDataValue});if(null==f)return null;const d=r.blockBoundary[e];if("jpg"!==r.compression||i>d.minCol&&i<d.maxCol&&t>d.minRow&&t<d.maxRow)return f;const{origin:y,blockWidth:x,blockHeight:g}=r,{x:v,y:S}=this.getPyramidPixelSize(e),I=Math.round((a.xmin-y.x)/v)%x,w=Math.round((a.xmax-y.x)/v)%x||x,j=Math.round((y.y-a.ymax)/S)%g,M=Math.round((y.y-a.ymin)/S)%g||g,b=i===d.minCol?I:0,T=t===d.minRow?j:0,_=i===d.maxCol?w:x,O=t===d.maxRow?M:g;return p(f,{x:b,y:T},{width:_-b,height:O-T}),f}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,s]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),r[1]?.[0]?.counts?.length||(r[1]=null),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let a=r-s+this._levelOffset;const l=i.srcLocation;for(;a>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(a,i.row,i.col,t))break}catch{}if(a--,s++,i=this.identifyPixelLocation(l,s,t.datumTransformation),null===i)return null}return-1===a||null==i?null:s}async _open(e){const r=e?.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:r});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=a.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const n=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(n.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name?.slice(l.name.indexOf("/")+1)??"";const o=await this._fetchRasterInfo({signal:r});if(null==o)throw new t("image-server-raster:open","cannot initialize image service");y(o,l);const c="Map"===this.tileType?v(l.tileInfo,l):u.fromJSON(l.tileInfo);i(c);const[f,p]=this._computeMinMaxLOD(o,c),{extent:d,pixelSize:x}=o,g=.5/o.width*x.x,I=Math.max(x.x,x.y),{lods:w}=c;("Map"!==this.tileType&&0!==l.maxScale||Math.abs(x.x-x.y)>g||!w.some((e=>Math.abs(e.resolution-I)<g)))&&(x.x=x.y=f.resolution,o.width=Math.ceil((d.xmax-d.xmin)/x.x-.1),o.height=Math.ceil((d.ymax-d.ymin)/x.y-.1));const j=f.level-p.level,[M,b]=c.size,T=[],_=[];w.forEach(((e,t)=>{e.level>=p.level&&e.level<=f.level&&T.push({x:e.resolution,y:e.resolution}),t<w.length-1&&_.push(Math.round(10*e.resolution/w[t+1].resolution)/10)})),T.sort(((e,t)=>e.x-t.x));const O=this.computeBlockBoundary(d,M,b,c.origin,T,j),R=T.length>1?T.slice(1):null;let z;l.transposeInfo&&(z={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:o.keyProperties?._yxs.PacketSize??0});const N=_.length<=1||_.length>=3&&_.slice(0,-1).every((e=>e===_[0]))?_[0]??2:Math.round(10/(p.resolution/f.resolution)**(-1/j))/10;if(o.storageInfo=new m({blockWidth:c.size[0],blockHeight:c.size[1],pyramidBlockWidth:c.size[0],pyramidBlockHeight:c.size[1],pyramidResolutions:R,pyramidScalingFactor:N,compression:c.format,origin:c.origin,firstPyramidLevel:1,maximumPyramidLevel:j,tileInfo:c,transposeInfo:z,blockBoundary:O}),S(o),this._set("rasterInfo",o),l.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:o.storageInfo.tileInfo,parsedUrl:s(this.url),url:this.url,tileServers:[]};this._tilemapCache=new h({layer:e})}}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=o.fromJSON(t.spatialReference||e.spatialReference),a=new n({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new c({width:i,height:s,bandCount:3,extent:l.fromJSON(e),spatialReference:r,pixelSize:a,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=x(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data?.slices)).catch((()=>null)):null,a=await Promise.all([s,r]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:r}=t,a=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),l=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:n}=this;if("Map"===n)return this._levelOffset=r[0].level,[a,l];if("Raster"===n){return[r.find((e=>e.resolution===i.x))??a,l]}const{minScale:o,maxScale:c}=this.sourceJSON;let m=a;c>0&&(m=r.find((e=>Math.abs(e.scale-c)<s)),m||(m=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??a));let u=l;return o>0&&(u=r.find((e=>Math.abs(e.scale-o)<s))??l,this._levelOffset=u.level-l.level),[m,u]}};function v(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:r,maxLOD:a}=t;if(null!=r&&null!=a)return u.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=r&&e<=a))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,r=i?t(i):1/0,a=s?t(s):-1/0;return u.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=r&&i>=a}))})}return u.fromJSON(e)}function S(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}e([r({type:String,json:{write:!0}})],g.prototype,"datasetFormat",void 0),e([r()],g.prototype,"tileType",void 0),g=e([a("esri.layers.support.rasterDatasets.ImageServerRaster")],g);const I=g;export{I as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{assertIsSome as i}from"../../../core/maybe.js";import{urlToObject as s}from"../../../core/urlUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import l from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import c from"../RasterInfo.js";import m from"../RasterStorageInfo.js";import u from"../TileInfo.js";import{TilemapCache as h}from"../TilemapCache.js";import f from"./BaseRaster.js";import{setValidBoundary as p}from"../rasterFunctions/pixelUtils.js";import d from"../rasterTransforms/GCSShiftTransform.js";import{patchServiceInfo as y,fetchServiceRasterInfo as x}from"../../../rest/imageService/fetchRasterInfo.js";let g=class extends f{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,s={}){const{storageInfo:r,extent:a}=this.rasterInfo,{transposeInfo:l}=r,n=null!=l&&!!s.transposedVariableName;if(this._slices&&!n&&null==s.sliceId)return null;const o=n?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${o}/${t}/${i}`,m=this._slices?n?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null;let u,h;if(r.isBsqTile){const e=(s.bandIds?.length?s.bandIds:[0,1,2]).map((e=>this.request(c,{query:{...m,bandId:e},responseType:"array-buffer",signal:s.signal}))),t=await Promise.all(e),i=t.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),r=new Uint8Array(i);h=[];let a=0;for(const{data:s}of t)h.push(a),r.set(new Uint8Array(s),a),a+=s.byteLength;u=r.buffer}else{u=(await this.request(c,{query:m,responseType:"array-buffer",signal:s.signal})).data}if(!u)return null;const f=n?l.tileSize:r.tileInfo.size,d=await this.decodePixelBlock(u,{width:f[0],height:f[1],planes:h?.length,offsets:h,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:n,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const y=r.blockBoundary[e];if("jpg"!==r.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return d;const{origin:x,blockWidth:g,blockHeight:v}=r,{x:S,y:I}=this.getPyramidPixelSize(e),w=Math.round((a.xmin-x.x)/S)%g,b=Math.round((a.xmax-x.x)/S)%g||g,T=Math.round((x.y-a.ymax)/I)%v,j=Math.round((x.y-a.ymin)/I)%v||v,M=i===y.minCol?w:0,_=t===y.minRow?T:0,O=i===y.maxCol?b:g,R=t===y.maxRow?j:v;return p(d,{x:M,y:_},{width:O-M,height:R-_}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,s]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),r[1]?.[0]?.counts?.length||(r[1]=null),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let a=r-s+this._levelOffset;const l=i.srcLocation;for(;a>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(a,i.row,i.col,t))break}catch{}if(a--,s++,i=this.identifyPixelLocation(l,s,t.datumTransformation),null===i)return null}return-1===a||null==i?null:s}async _open(e){const r=e?.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:r});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=a.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const n=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(n.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name?.slice(l.name.indexOf("/")+1)??"";const o=await this._fetchRasterInfo({signal:r});if(null==o)throw new t("image-server-raster:open","cannot initialize image service");y(o,l);const c="Map"===this.tileType?v(l.tileInfo,l):u.fromJSON(l.tileInfo);i(c);const[f,p]=this._computeMinMaxLOD(o,c),{extent:d,pixelSize:x}=o,g=.5/o.width*x.x,I=Math.max(x.x,x.y),{lods:w}=c;("Map"!==this.tileType&&0!==l.maxScale||Math.abs(x.x-x.y)>g||!w.some((e=>Math.abs(e.resolution-I)<g)))&&(x.x=x.y=f.resolution,o.width=Math.ceil((d.xmax-d.xmin)/x.x-.1),o.height=Math.ceil((d.ymax-d.ymin)/x.y-.1));const b=f.level-p.level,[T,j]=c.size,M=[],_=[];w.forEach(((e,t)=>{e.level>=p.level&&e.level<=f.level&&M.push({x:e.resolution,y:e.resolution}),t<w.length-1&&_.push(Math.round(10*e.resolution/w[t+1].resolution)/10)})),M.sort(((e,t)=>e.x-t.x));const O=this.computeBlockBoundary(d,T,j,c.origin,M,b),R=M.length>1?M.slice(1):null;let L;l.transposeInfo&&(L={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:o.keyProperties?._yxs.PacketSize??0});const z=_.length<=1||_.length>=3&&_.slice(0,-1).every((e=>e===_[0]))?_[0]??2:Math.round(10/(p.resolution/f.resolution)**(-1/b))/10;if(o.storageInfo=new m({blockWidth:c.size[0],blockHeight:c.size[1],pyramidBlockWidth:c.size[0],pyramidBlockHeight:c.size[1],pyramidResolutions:R,pyramidScalingFactor:z,compression:c.format,origin:c.origin,firstPyramidLevel:1,maximumPyramidLevel:b,tileInfo:c,isBsqTile:!!l.bsq,transposeInfo:L,blockBoundary:O}),S(o),this._set("rasterInfo",o),l.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:o.storageInfo.tileInfo,parsedUrl:s(this.url),url:this.url,tileServers:[]};this._tilemapCache=new h({layer:e})}}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=o.fromJSON(t.spatialReference||e.spatialReference),a=new n({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new c({width:i,height:s,bandCount:3,extent:l.fromJSON(e),spatialReference:r,pixelSize:a,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=x(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data?.slices)).catch((()=>null)):null,a=await Promise.all([s,r]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:r}=t,a=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),l=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:n}=this;if("Map"===n)return this._levelOffset=r[0].level,[a,l];if("Raster"===n){return[r.find((e=>e.resolution===i.x))??a,l]}const{minScale:o,maxScale:c}=this.sourceJSON;let m=a;c>0&&(m=r.find((e=>Math.abs(e.scale-c)<s)),m||(m=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??a));let u=l;return o>0&&(u=r.find((e=>Math.abs(e.scale-o)<s))??l,this._levelOffset=u.level-l.level),[m,u]}};function v(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:r,maxLOD:a}=t;if(null!=r&&null!=a)return u.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=r&&e<=a))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,r=i?t(i):1/0,a=s?t(s):-1/0;return u.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=r&&i>=a}))})}return u.fromJSON(e)}function S(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}e([r({type:String,json:{write:!0}})],g.prototype,"datasetFormat",void 0),e([r()],g.prototype,"tileType",void 0),g=e([a("esri.layers.support.rasterDatasets.ImageServerRaster")],g);const I=g;export{I 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.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../geometry/Point.js";import t from"./EphemeralBlockCache.js";import{projectExtent as n,projectResolution as o,snapPyramid as l}from"../rasterFunctions/rasterProjectionHelper.js";const r=new Map,c=new t;function i(e,t){return null==t?e:`${e}?sliceId=${t}`}function u(e,t){const n={extent:null,rasterInfo:t,cache:new Map},o=r.get(e);return o?(o.push(n),o.length-1):(r.set(e,[n]),0)}function a(e,t){const n=r.get(e);n&&(n[t]=null,n.some((e=>null!=e))||r.delete(e))}function f(e){r.delete(e)}function s(e,t,n){const o=r.get(e);if(!o)return null==t?c.decreaseRefCount(e,n):0;if(null==t||null==o[t])return c.decreaseRefCount(e,n);const l=o[t]?.cache,i=l?.get(n);if(l&&i){if(i.refCount--,0===i.refCount){l.delete(n);for(let e=0;e<o.length;e++)o[e]?.cache.delete(n);i.controller&&i.controller.abort()}return i.refCount}return 0}function m(e,t,n){const o=r.get(e);if(!o)return null==t?c.getBlock(e,n):null;if(null==t||null==o[t]){for(let e=0;e<o.length;e++){const t=o[e]?.cache.get(n);if(t)return t.refCount++,t.block}return c.getBlock(e,n)}const l=o[t]?.cache.get(n);if(l)return l.refCount++,l.block;for(let r=0;r<o.length;r++){if(r===t||!o[r])continue;const e=o[r]?.cache,l=e?.get(n);if(e&&l)return l.refCount++,e.set(n,l),l.block}return null}function h(e,t,n,o,l=null){const i=r.get(e);if(!i)return void(null==t&&c.putBlock(e,n,o,l));if(null==t||null==i[t])return void c.putBlock(e,n,o,l);const u={refCount:1,block:o,isResolved:!1,isRejected:!1,controller:l};o.then((()=>u.isResolved=!0)).catch((()=>u.isRejected=!0)),i[t]?.cache.set(n,u)}function x(e,t,n){const o=r.get(e);o?null!=t&&null!=o[t]?o[t]?.cache.delete(n):c.deleteBlock(e,n):null==t&&c.deleteBlock(e,n)}function d(e,t){const n=r.get(e);return n?n[t]??null:null}function g(t,r,c,i,u,a,f=null){const s=d(t,r);if(!s)return;const m=s.extent,{cache:h,rasterInfo:x}=s;if(m&&m.xmin===c.xmin&&m.xmax===c.xmax&&m.ymin===c.ymin&&m.ymax===c.ymax)return;i=i??0;const g=c.clone().normalize(),{spatialReference:y,transform:p}=x,k=new Set;for(let d=0;d<g.length;d++){const t=g[d];if(t.xmax-t.xmin<=i||t.ymax-t.ymin<=i)continue;let r=n(t,y,f);if(null==r)continue;if(null!=p&&(r=p.inverseTransform(r),null==r))continue;const c=new e({x:i,y:i,spatialReference:t.spatialReference});if(null==u&&!(u=o(c,y,t,f)))return;const{pyramidLevel:s,pyramidResolution:m,excessiveReading:h}=l(u,x,a||"closest");if(h)return;const{storageInfo:M}=x,{origin:R}=M,{x:C,y:B}=m,b=Math.max(0,Math.floor((r.xmin-R.x)/C)),v=Math.max(0,Math.floor((R.y-r.ymax)/B)),w=Math.ceil(r.width/C-.1),j=Math.ceil(r.height/B-.1),$=s>0?M.pyramidBlockWidth:M.blockWidth,I=s>0?M.pyramidBlockHeight:M.blockHeight,H=M.blockBoundary[s];if(!H)continue;const E=1,P=Math.max(H.minCol,Math.floor(b/$)-E),W=Math.max(H.minRow,Math.floor(v/I)-E),z=Math.min(H.maxCol,Math.floor((b+w-1)/$)+E),F=Math.min(H.maxRow,Math.floor((v+j-1)/I)+E);for(let e=W;e<=F;e++)for(let t=P;t<=z;t++)k.add(`${s}/${e}/${t}`)}h.forEach(((e,t)=>{if(!k.has(t)){const e=h.get(t);(null==e||e.isResolved||e.isRejected)&&h.delete(t)}})),s.extent={xmin:c.xmin,ymin:c.ymin,xmax:c.xmax,ymax:c.ymax}}export{s as decreaseRefCount,x as deleteBlock,f as deleteRaster,m as getBlock,i as getRasterId,h as putBlock,u as register,a as unregister,g as update};
5
+ import e from"../../../geometry/Point.js";import n from"./EphemeralBlockCache.js";import{projectExtent as t,projectResolution as o,snapPyramid as l}from"../rasterFunctions/rasterProjectionHelper.js";const r=new Map,c=new n;function i(e,n,t){const o=[];return null!=n&&o.push(`sliceId=${n}`),null!=t&&o.push(`bandIds=${t.join(",")}`),o.length?`${e}?${o.join("&")}`:e}function u(e,n){const t={extent:null,rasterInfo:n,cache:new Map},o=r.get(e);return o?(o.push(t),o.length-1):(r.set(e,[t]),0)}function a(e,n){const t=r.get(e);t&&(t[n]=null,t.some((e=>null!=e))||r.delete(e))}function f(e){r.delete(e)}function s(e,n,t){const o=r.get(e);if(!o)return null==n?c.decreaseRefCount(e,t):0;if(null==n||null==o[n])return c.decreaseRefCount(e,t);const l=o[n]?.cache,i=l?.get(t);if(l&&i){if(i.refCount--,0===i.refCount){l.delete(t);for(let e=0;e<o.length;e++)o[e]?.cache.delete(t);i.controller&&i.controller.abort()}return i.refCount}return 0}function m(e,n,t){const o=r.get(e);if(!o)return null==n?c.getBlock(e,t):null;if(null==n||null==o[n]){for(let e=0;e<o.length;e++){const n=o[e]?.cache.get(t);if(n)return n.refCount++,n.block}return c.getBlock(e,t)}const l=o[n]?.cache.get(t);if(l)return l.refCount++,l.block;for(let r=0;r<o.length;r++){if(r===n||!o[r])continue;const e=o[r]?.cache,l=e?.get(t);if(e&&l)return l.refCount++,e.set(t,l),l.block}return null}function h(e,n,t,o,l=null){const i=r.get(e);if(!i)return void(null==n&&c.putBlock(e,t,o,l));if(null==n||null==i[n])return void c.putBlock(e,t,o,l);const u={refCount:1,block:o,isResolved:!1,isRejected:!1,controller:l};o.then((()=>u.isResolved=!0)).catch((()=>u.isRejected=!0)),i[n]?.cache.set(t,u)}function x(e,n,t){const o=r.get(e);o?null!=n&&null!=o[n]?o[n]?.cache.delete(t):c.deleteBlock(e,t):null==n&&c.deleteBlock(e,t)}function d(e,n){const t=r.get(e);return t?t[n]??null:null}function g(n,r,c,i,u,a,f=null){const s=d(n,r);if(!s)return;const m=s.extent,{cache:h,rasterInfo:x}=s;if(m&&m.xmin===c.xmin&&m.xmax===c.xmax&&m.ymin===c.ymin&&m.ymax===c.ymax)return;i=i??0;const g=c.clone().normalize(),{spatialReference:p,transform:y}=x,k=new Set;for(let d=0;d<g.length;d++){const n=g[d];if(n.xmax-n.xmin<=i||n.ymax-n.ymin<=i)continue;let r=t(n,p,f);if(null==r)continue;if(null!=y&&(r=y.inverseTransform(r),null==r))continue;const c=new e({x:i,y:i,spatialReference:n.spatialReference});if(null==u&&!(u=o(c,p,n,f)))return;const{pyramidLevel:s,pyramidResolution:m,excessiveReading:h}=l(u,x,a||"closest");if(h)return;const{storageInfo:M}=x,{origin:R}=M,{x:C,y:B}=m,b=Math.max(0,Math.floor((r.xmin-R.x)/C)),j=Math.max(0,Math.floor((R.y-r.ymax)/B)),v=Math.ceil(r.width/C-.1),w=Math.ceil(r.height/B-.1),$=s>0?M.pyramidBlockWidth:M.blockWidth,I=s>0?M.pyramidBlockHeight:M.blockHeight,H=M.blockBoundary[s];if(!H)continue;const E=1,P=Math.max(H.minCol,Math.floor(b/$)-E),W=Math.max(H.minRow,Math.floor(j/I)-E),z=Math.min(H.maxCol,Math.floor((b+v-1)/$)+E),F=Math.min(H.maxRow,Math.floor((j+w-1)/I)+E);for(let e=W;e<=F;e++)for(let n=P;n<=z;n++)k.add(`${s}/${e}/${n}`)}h.forEach(((e,n)=>{if(!k.has(n)){const e=h.get(n);(null==e||e.isResolved||e.isRejected)&&h.delete(n)}})),s.extent={xmin:c.xmin,ymin:c.ymin,xmax:c.xmax,ymax:c.ymax}}export{s as decreaseRefCount,x as deleteBlock,f as deleteRaster,m as getBlock,i as getRasterId,h as putBlock,u as register,a as unregister,g as update};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import f from"../RasterInfo.js";import l from"../RasterStorageInfo.js";import u from"./BaseRaster.js";import c from"./DBFParser.js";import{parsePAMInfo as h,parseSpatialReference as p}from"./pamParser.js";import{parseSignature as d,getPyramidIFDs as m,getMaskIFDs as y,parseIFD as g,parseFieldValues as x,isBSQConfig as T,getImageInfo as w}from"../rasterFormats/TiffDecoder.js";import I from"../rasterFormats/TiffTags.js";import{estimateStatisticsFromHistograms as R}from"../rasterFunctions/stretchUtils.js";import _ from"../rasterTransforms/PolynomialTransform.js";import O from"../../../rest/support/FeatureSet.js";const F=(e,t)=>e.get(t)?.values,S=(e,t)=>e.get(t)?.values?.[0];let b=class extends u{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const s=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=s&&this._headerInfo.hasMaskBand){const a=await this._fetchRawTiffTile(e,t,i,!0,r);null!=a&&a.pixels[0]instanceof Uint8Array&&(s.mask=a.pixels[0])}return s}async _open(e){const r=e?e.signal:null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:r});if(!s)throw new t("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:a,firstIFDPos:n,isBigTiff:o}=d(s),f=[],l={fileChunk:s,posIFD:n,fileOffset:0};await this._readIFDs(f,l,a,o?8:4,r);const{imageInfo:u,rasterInfo:c}=k(f),h=m(f),p=y(f);if(this._headerInfo={littleEndian:a,isBigTiff:o,ifds:f,pyramidIFDs:h,maskIFDs:p,...u},this._set("rasterInfo",c),!u.isSupported)throw new t("tiffraster:open","this tiff is not supported: "+u.message);if(!u.tileWidth)throw new t("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");c.isPseudoSpatialReference&&i.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const g=f[0].get("PREDICTOR")?.values?.[0],x=f[0].get("SAMPLEFORMAT")?.values?.[0];if(3===x&&2===g)throw new t("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:T,skipExtensions:w=[]}=this.ioConfig;if(!w.includes("aux.xml")&&!T){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&E(t,c)}w.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||T||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),T&&this.updateImageSpaceRasterInfo(c),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:s}=e;if(s+8>=i.byteLength||s<0){r=s+r;i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,s=0}return{fileChunk:i,fileOffset:r,posIFD:s}}async _readIFDs(e,i,r,s=4,a){if(!i.posIFD)return null;i=await this._validateOrFetchHeaderBuffer(i,a);const n=await this._readIFD(i,r,I.tiffTags,s,a);if(!n?.ifd)throw new t("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;i.posIFD=n.nextIFD-i.fileOffset,await this._readIFDs(e,i,r,s,a)}async _readIFD(e,t,i=I.tiffTags,r=4,s){let{fileChunk:a,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;const f=g(a,t,n,o,i,r);if(f.success){const e=[];if(f.ifd?.forEach((t=>{t.values||e.push(t)})),e.length>0&&await this._fillOffsets(e,t,f.nextIFD,s),f.ifd?.has("GEOKEYDIRECTORY")){const e=f.ifd.get("GEOKEYDIRECTORY"),i=e?.values;if(i&&i.length>4){const r=i[0]+"."+i[1]+"."+i[2];n=e.valueOffset+6-o;const f=await this._validateOrFetchHeaderBuffer({fileChunk:a,posIFD:n,fileOffset:o},s),l=await this._readIFD(f,t,I.geoKeys,2,s);e.data=l?.ifd,e.data&&e.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return f}if(f.requiredBufferSize){return a=(await this.request(this.url,{range:{from:o,to:o+n+f.requiredBufferSize+8},responseType:"array-buffer",signal:s})).data,a.byteLength<n+f.requiredBufferSize?null:(e.fileChunk=a,e.fileOffset=o,this._readIFD(e,t,i,r,s))}return null}async _fillOffsets(e,t,i,r){const s=e.filter((e=>null!=e.offlineOffsetSize));if(0===s.length)return;const a=s.map((e=>e.offlineOffsetSize)),n=Math.min.apply(null,a.map((e=>e[0]))),o=Math.max.apply(null,a.map((e=>e[0]+e[1])));let f=1===a.length||o-n<=this._bufferSize;if(!f&&a.length>1){a.sort(((e,t)=>e[0]-t[0]));f=a.reduce(((e,t)=>e===t[0]?t[0]+t[1]:0),a[0][0])===o}if(f){const e=await this._fetchOffsets(n,Math.max(o,n+this._bufferSize),r);return void s.forEach((i=>x(e,t,i,n)))}const l=s.map((async e=>{const i=e.offlineOffsetSize,s=await this._fetchOffsets(i[0],i[1]+i[0],r);x(s,t,e,i[0])}));await Promise.all(l)}async _fetchOffsets(e,t,i){const r=[],s=this._chunkSize,a=Math.ceil((t-e)/s);let n=e;for(let l=0;l<a;l++)r.push(this.request(this.url,{range:{from:n,to:l===a-1?t:n+s-1},responseType:"array-buffer",signal:i})),n+=s;const o=await Promise.all(r);if(1===a)return o[0].data;const f=new Uint8Array(t-e+1);for(let l=0;l<a;l++)f.set(new Uint8Array(o[l].data),l*s);return f.buffer}async _fetchRawTiffTile(e,t,i,r,s={}){const a=this._getTileLocation(e,t,i,r);if(!a)return null;const{ranges:n,actualTileWidth:o,actualTileHeight:f,ifd:l}=a,u=n.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:s.signal}))),c=await Promise.all(u),h=c.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===c.length?c[0].data:new ArrayBuffer(h),d=[0],m=[0];if(c.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<c.length;t++){const r=c[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let T,w,I;if(o!==y||f!==g){let e=x.mask;if(e)for(T=0;T<g;T++)if(I=T*y,T<f)for(w=o;w<y;w++)e[I+w]=0;else for(w=0;w<y;w++)e[I+w]=0;else for(e=new Uint8Array(y*g),x.mask=e,T=0;T<f;T++)for(I=T*y,w=0;w<o;w++)e[I+w]=1}return x}_getTileLocation(e,t,i,r=!1){const{firstPyramidLevel:s,blockBoundary:a}=this.rasterInfo.storageInfo,n=0===e?0:e-(s-1),{_headerInfo:o}=this;if(!o)return null;const f=r?o.maskIFDs[n]:0===n?o?.ifds[0]:o?.pyramidIFDs[n-1];if(!f)return null;const l=T(f,o),u=F(f,"TILEOFFSETS");if(void 0===u)return null;const c=F(f,"TILEBYTECOUNTS"),{minRow:h,minCol:p,maxRow:d,maxCol:m}=a[n];if(t>d||i>m||t<h||i<p)return null;const y=S(f,"IMAGEWIDTH"),g=S(f,"IMAGELENGTH"),x=S(f,"TILEWIDTH"),w=S(f,"TILELENGTH"),I=[];if(l){const{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){const e=r*(d+1)*(m+1)+t*(m+1)+i;I[r]={from:u[e],to:u[e]+c[e]-1}}}else{const e=t*(m+1)+i;I.push({from:u[e],to:u[e]+c[e]-1})}for(let T=0;T<I.length;T++)if(null==I[T].from||!I[T].to||I[T].to<0)return null;return{ranges:I,ifd:f,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===d&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return h(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=c.parse(t);return i?.recordSet?O.fromJSON(i.recordSet):null}catch{return null}}};function k(e){const t=w(e),{width:i,height:r,tileWidth:s,tileHeight:u,planes:c,pixelType:h,compression:d,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidBlockWidth:g,pyramidBlockHeight:x,pyramidResolutions:T,tileBoundary:I,affine:R,metadata:O}=t,b=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid;let k=p(b),E=!!t.isPseudoGeographic;null==k&&(E=!0,k=new o({wkid:3857}));const D=new a({...t.extent,spatialReference:k}),v=new n(D?{x:D.xmin,y:D.ymax,spatialReference:k}:{x:0,y:0}),P=new l({blockWidth:s,blockHeight:u,pyramidBlockWidth:g,pyramidBlockHeight:x,compression:d,origin:v,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidResolutions:T,blockBoundary:I}),B=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),C=O?{BandProperties:O.bandProperties,DataType:O.dataType}:{};let L=null;const z=S(e[0],"PHOTOMETRICINTERPRETATION"),j=F(e[0],"COLORMAP");if(z<=3&&j?.length>3&&j.length%3==0){L=[];const e=j.length/3;for(let t=0;t<e;t++)L.push([t,j[t]>>>8,j[t+e]>>>8,j[t+2*e]>>>8])}const A=new f({width:i,height:r,bandCount:c,pixelType:h,pixelSize:B,storageInfo:P,spatialReference:k,isPseudoSpatialReference:E,keyProperties:C,extent:D,colormap:L,statistics:O?O.statistics:null});if(R?.length&&(A.nativeExtent=new a({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:k}),A.transform=new _({polynomialOrder:1,forwardCoefficients:[R[2]+R[0]/2,R[5]-R[3]/2,R[0],R[3],-R[1],-R[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),P.origin.x=-.5,P.origin.y=.5),T){const{x:e,y:t}=A.pixelSize;T.forEach((i=>{i.x*=e,i.y*=t}))}return{imageInfo:t,rasterInfo:A}}function E(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=R(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new n({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}e([r()],b.prototype,"_files",void 0),e([r()],b.prototype,"_headerInfo",void 0),e([r()],b.prototype,"_bufferSize",void 0),e([r()],b.prototype,"_chunkSize",void 0),e([r({type:String,json:{write:!0}})],b.prototype,"datasetFormat",void 0),b=e([s("esri.layers.support.rasterDatasets.TIFFRaster")],b);const D=b;export{D as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import f from"../RasterInfo.js";import l from"../RasterStorageInfo.js";import u from"./BaseRaster.js";import c from"./DBFParser.js";import{parsePAMInfo as h,parseSpatialReference as p}from"./pamParser.js";import{parseSignature as d,getPyramidIFDs as m,getMaskIFDs as y,parseIFD as g,parseFieldValues as x,isBSQConfig as w,getImageInfo as I}from"../rasterFormats/TiffDecoder.js";import{tiffTags as T,geoKeys as R}from"../rasterFormats/tiffTag.js";import{estimateStatisticsFromHistograms as _}from"../rasterFunctions/stretchUtils.js";import O from"../rasterTransforms/PolynomialTransform.js";import F from"../../../rest/support/FeatureSet.js";const S=(e,t)=>e.get(t)?.values,b=(e,t)=>e.get(t)?.values?.[0];let k=class extends u{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const s=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=s&&this._headerInfo.hasMaskBand){const a=await this._fetchRawTiffTile(e,t,i,!0,r);null!=a&&a.pixels[0]instanceof Uint8Array&&(s.mask=a.pixels[0])}return s}async _open(e){const r=e?e.signal:null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:r});if(!s)throw new t("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:a,firstIFDPos:n,isBigTiff:o}=d(s),f=[],l={fileChunk:s,posIFD:n,fileOffset:0};await this._readIFDs(f,l,a,o?8:4,r);const{imageInfo:u,rasterInfo:c}=E(f),h=m(f),p=y(f);if(this._headerInfo={littleEndian:a,isBigTiff:o,ifds:f,pyramidIFDs:h,maskIFDs:p,...u},this._set("rasterInfo",c),!u.isSupported)throw new t("tiffraster:open","this tiff is not supported: "+u.message);if(!u.tileWidth)throw new t("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");c.isPseudoSpatialReference&&i.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const g=f[0].get("PREDICTOR")?.values?.[0],x=f[0].get("SAMPLEFORMAT")?.values?.[0];if(3===x&&2===g)throw new t("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:w,skipExtensions:I=[]}=this.ioConfig;if(!I.includes("aux.xml")&&!w){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&D(t,c)}I.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||w||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),w&&this.updateImageSpaceRasterInfo(c),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:s}=e;if(s+8>=i.byteLength||s<0){r=s+r;i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,s=0}return{fileChunk:i,fileOffset:r,posIFD:s}}async _readIFDs(e,i,r,s=4,a){if(!i.posIFD)return null;i=await this._validateOrFetchHeaderBuffer(i,a);const n=await this._readIFD(i,r,T,s,a);if(!n?.ifd)throw new t("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;i.posIFD=n.nextIFD-i.fileOffset,await this._readIFDs(e,i,r,s,a)}async _readIFD(e,t,i=T,r=4,s){let{fileChunk:a,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;const f=g(a,t,n,o,i,r);if(f.success){const e=[];if(f.ifd?.forEach((t=>{t.values||e.push(t)})),e.length>0&&await this._fillOffsets(e,t,f.nextIFD,s),f.ifd?.has("GEOKEYDIRECTORY")){const e=f.ifd.get("GEOKEYDIRECTORY"),i=e?.values;if(i&&i.length>4){const r=i[0]+"."+i[1]+"."+i[2];n=e.valueOffset+6-o;const f=await this._validateOrFetchHeaderBuffer({fileChunk:a,posIFD:n,fileOffset:o},s),l=await this._readIFD(f,t,R,2,s);e.data=l?.ifd,e.data&&e.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return f}if(f.requiredBufferSize){return a=(await this.request(this.url,{range:{from:o,to:o+n+f.requiredBufferSize+8},responseType:"array-buffer",signal:s})).data,a.byteLength<n+f.requiredBufferSize?null:(e.fileChunk=a,e.fileOffset=o,this._readIFD(e,t,i,r,s))}return null}async _fillOffsets(e,t,i,r){const s=e.filter((e=>null!=e.offlineOffsetSize));if(0===s.length)return;const a=s.map((e=>e.offlineOffsetSize)),n=Math.min.apply(null,a.map((e=>e[0]))),o=Math.max.apply(null,a.map((e=>e[0]+e[1])));let f=1===a.length||o-n<=this._bufferSize;if(!f&&a.length>1){a.sort(((e,t)=>e[0]-t[0]));f=a.reduce(((e,t)=>e===t[0]?t[0]+t[1]:0),a[0][0])===o}if(f){const e=await this._fetchOffsets(n,Math.max(o,n+this._bufferSize),r);return void s.forEach((i=>x(e,t,i,n)))}const l=s.map((async e=>{const i=e.offlineOffsetSize,s=await this._fetchOffsets(i[0],i[1]+i[0],r);x(s,t,e,i[0])}));await Promise.all(l)}async _fetchOffsets(e,t,i){const r=[],s=this._chunkSize,a=Math.ceil((t-e)/s);let n=e;for(let l=0;l<a;l++)r.push(this.request(this.url,{range:{from:n,to:l===a-1?t:n+s-1},responseType:"array-buffer",signal:i})),n+=s;const o=await Promise.all(r);if(1===a)return o[0].data;const f=new Uint8Array(t-e+1);for(let l=0;l<a;l++)f.set(new Uint8Array(o[l].data),l*s);return f.buffer}async _fetchRawTiffTile(e,t,i,r,s={}){const a=this._getTileLocation(e,t,i,r);if(!a)return null;const{ranges:n,actualTileWidth:o,actualTileHeight:f,ifd:l}=a,u=n.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:s.signal}))),c=await Promise.all(u),h=c.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===c.length?c[0].data:new ArrayBuffer(h),d=[0],m=[0];if(c.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<c.length;t++){const r=c[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:l,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,I,T;if(o!==y||f!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(T=w*y,w<f)for(I=o;I<y;I++)e[T+I]=0;else for(I=0;I<y;I++)e[T+I]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<f;w++)for(T=w*y,I=0;I<o;I++)e[T+I]=1}return x}_getTileLocation(e,t,i,r=!1){const{firstPyramidLevel:s,blockBoundary:a}=this.rasterInfo.storageInfo,n=0===e?0:e-(s-1),{_headerInfo:o}=this;if(!o)return null;const f=r?o.maskIFDs[n]:0===n?o?.ifds[0]:o?.pyramidIFDs[n-1];if(!f)return null;const l=w(f,o),u=S(f,"TILEOFFSETS");if(void 0===u)return null;const c=S(f,"TILEBYTECOUNTS"),{minRow:h,minCol:p,maxRow:d,maxCol:m}=a[n];if(t>d||i>m||t<h||i<p)return null;const y=b(f,"IMAGEWIDTH"),g=b(f,"IMAGELENGTH"),x=b(f,"TILEWIDTH"),I=b(f,"TILELENGTH"),T=[];if(l){const{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){const e=r*(d+1)*(m+1)+t*(m+1)+i;T[r]={from:u[e],to:u[e]+c[e]-1}}}else{const e=t*(m+1)+i;T.push({from:u[e],to:u[e]+c[e]-1})}for(let w=0;w<T.length;w++)if(null==T[w].from||!T[w].to||T[w].to<0)return null;return{ranges:T,ifd:f,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===d&&g%I||I}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return h(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=c.parse(t);return i?.recordSet?F.fromJSON(i.recordSet):null}catch{return null}}};function E(e){const t=I(e),{width:i,height:r,tileWidth:s,tileHeight:u,planes:c,pixelType:h,compression:d,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidBlockWidth:g,pyramidBlockHeight:x,pyramidResolutions:w,tileBoundary:T,affine:R,metadata:_}=t,F=t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid;let k=p(F),E=!!t.isPseudoGeographic;null==k&&(E=!0,k=new o({wkid:3857}));const D=new a({...t.extent,spatialReference:k}),v=new n(D?{x:D.xmin,y:D.ymax,spatialReference:k}:{x:0,y:0}),P=new l({blockWidth:s,blockHeight:u,pyramidBlockWidth:g,pyramidBlockHeight:x,compression:d,origin:v,firstPyramidLevel:m,maximumPyramidLevel:y,pyramidResolutions:w,blockBoundary:T}),B=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),C=_?{BandProperties:_.bandProperties,DataType:_.dataType}:{};let L=null;const z=b(e[0],"PHOTOMETRICINTERPRETATION"),j=S(e[0],"COLORMAP");if(z<=3&&j?.length>3&&j.length%3==0){L=[];const e=j.length/3;for(let t=0;t<e;t++)L.push([t,j[t]>>>8,j[t+e]>>>8,j[t+2*e]>>>8])}const A=new f({width:i,height:r,bandCount:c,pixelType:h,pixelSize:B,storageInfo:P,spatialReference:k,isPseudoSpatialReference:E,keyProperties:C,extent:D,colormap:L,statistics:_?_.statistics:null});if(R?.length&&(A.nativeExtent=new a({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:k}),A.transform=new O({polynomialOrder:1,forwardCoefficients:[R[2]+R[0]/2,R[5]-R[3]/2,R[0],R[3],-R[1],-R[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new n({x:(D.xmax-D.xmin)/i,y:(D.ymax-D.ymin)/r,spatialReference:k}),P.origin.x=-.5,P.origin.y=.5),w){const{x:e,y:t}=A.pixelSize;w.forEach((i=>{i.x*=e,i.y*=t}))}return{imageInfo:t,rasterInfo:A}}function D(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=_(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new n({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}e([r()],k.prototype,"_files",void 0),e([r()],k.prototype,"_headerInfo",void 0),e([r()],k.prototype,"_bufferSize",void 0),e([r()],k.prototype,"_chunkSize",void 0),e([r({type:String,json:{write:!0}})],k.prototype,"datasetFormat",void 0),k=e([s("esri.layers.support.rasterDatasets.TIFFRaster")],k);const v=k;export{v as default};