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

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 (403) hide show
  1. package/Camera.js +1 -1
  2. package/applications/Components/arcadeFeatureUtils.d.ts +12 -0
  3. package/applications/Components/arcadeFeatureUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/00d43f02119167531d1b.js +1 -0
  6. package/assets/esri/core/workers/chunks/059cda6f11a91dbc9e28.js +1 -0
  7. package/assets/esri/core/workers/chunks/{1c406ab2bf99ac563316.js → 0696fa44a04b99738d7b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/073f0232135f71b6c7a5.js +1 -0
  9. package/assets/esri/core/workers/chunks/098ac10877d92fde1006.js +1 -0
  10. package/assets/esri/core/workers/chunks/0a29d87b6e58a3c6df8f.js +1 -0
  11. package/assets/esri/core/workers/chunks/0bf43d80cb40c2b43333.js +1 -0
  12. package/assets/esri/core/workers/chunks/0d04353843ccb7440342.js +1 -0
  13. package/assets/esri/core/workers/chunks/1866f832e5f52958bc97.js +1 -0
  14. package/assets/esri/core/workers/chunks/19e51cbb354954ddafbd.js +1 -0
  15. package/assets/esri/core/workers/chunks/1c7096eb48a3a7f27d4f.js +1 -0
  16. package/assets/esri/core/workers/chunks/1cc03067f8405285057c.js +1 -0
  17. package/assets/esri/core/workers/chunks/23f3692c7426173e8352.js +1 -0
  18. package/assets/esri/core/workers/chunks/24bdeafbb16ae83bb8c3.js +1 -0
  19. package/assets/esri/core/workers/chunks/2b27d3bc492e000bbe58.js +1 -0
  20. package/assets/esri/core/workers/chunks/2d64a13c2303e9cae613.js +1 -0
  21. package/assets/esri/core/workers/chunks/2dfe6af28cd1b29d5ebc.js +1 -0
  22. package/assets/esri/core/workers/chunks/2e760d04641755d1820d.js +1 -0
  23. package/assets/esri/core/workers/chunks/{0b21d0e2e5a91c34a108.js → 2f54e4feb554c1a7b9c4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/305eeaac0b4d5b79ebde.js +1 -0
  25. package/assets/esri/core/workers/chunks/353976c812ebf0c98549.js +1 -0
  26. package/assets/esri/core/workers/chunks/45aaefbdffe5e15dfb24.js +1 -0
  27. package/assets/esri/core/workers/chunks/{592b5db1459c02cf6a0c.js → 46504fc81f357bc7465a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/4caebb64a365da18453f.js +1 -0
  29. package/assets/esri/core/workers/chunks/{2fcd7db1e192858a650e.js → 503ee206e7de1f65e291.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{76e80381fa6d1e084796.js → 54de7dc0597fc80d7a52.js} +1 -1
  31. package/assets/esri/core/workers/chunks/55c0c074e4afe05f5d4d.js +1 -0
  32. package/assets/esri/core/workers/chunks/598ba405e93ebccf7b2d.js +1 -0
  33. package/assets/esri/core/workers/chunks/5bfb962ca192f90a2724.js +1 -0
  34. package/assets/esri/core/workers/chunks/6699fac01ccd842851ba.js +1 -0
  35. package/assets/esri/core/workers/chunks/672a5390182b20d632be.js +1 -0
  36. package/assets/esri/core/workers/chunks/{00311d1b18d5952a014b.js → 6738b3d6bce34a1e8be2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/67c2e5953087dadfd245.js +1 -0
  38. package/assets/esri/core/workers/chunks/67caef2ecf0dc5f2eed3.js +1 -0
  39. package/assets/esri/core/workers/chunks/68fd7b314377d27aaa54.js +1 -0
  40. package/assets/esri/core/workers/chunks/6d863761f29f31a030eb.js +1 -0
  41. package/assets/esri/core/workers/chunks/{ce8ef2eec290e1df6b2a.js → 7390af96250e89194332.js} +1 -1
  42. package/assets/esri/core/workers/chunks/7452b5ae971a9ff2e6e9.js +1 -0
  43. package/assets/esri/core/workers/chunks/7672c123cfb960f4ddad.js +1 -0
  44. package/assets/esri/core/workers/chunks/{9934e8e19f94e9169eea.js → 776b64a1e1a57878c34c.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{58716a3a6106a1b0fb9d.js → 832c887fdc5af4c08cf2.js} +1 -1
  46. package/assets/esri/core/workers/chunks/84fb27e3425515cd0e3f.js +1 -0
  47. package/assets/esri/core/workers/chunks/8b0be232723424dda320.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7023651ed6398dcf8efb.js → 8b0efcc30184593a0812.js} +21 -21
  49. package/assets/esri/core/workers/chunks/8b38fad017c4c0d9e1ec.js +1 -0
  50. package/assets/esri/core/workers/chunks/{b2d6b1ac9fbb50c7c8ab.js → 929ca32ddbb43328ef31.js} +1 -1
  51. package/assets/esri/core/workers/chunks/98958203a5ca45b24d72.js +1 -0
  52. package/assets/esri/core/workers/chunks/a03f15f2cbc3fed291c2.js +1 -0
  53. package/assets/esri/core/workers/chunks/{22e73501e1435a896826.js → a5f17e9a025ac2b6e1bf.js} +1 -1
  54. package/assets/esri/core/workers/chunks/a6e846361bf5dd3a11c7.js +1 -0
  55. package/assets/esri/core/workers/chunks/af2087b75225d7d7dbd8.js +1 -0
  56. package/assets/esri/core/workers/chunks/afe3e89737fb45189a99.js +1 -0
  57. package/assets/esri/core/workers/chunks/b18459c1bed75dbdec08.js +1 -0
  58. package/assets/esri/core/workers/chunks/{f07fb9b3fa30d7ee1681.js → b386e921c273de3ac7a5.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{d03b82e962c70a3fd377.js → b4928831a2a13b2da745.js} +1 -1
  60. package/assets/esri/core/workers/chunks/b7205620ca248f4efc88.js +1 -0
  61. package/assets/esri/core/workers/chunks/{dae2036faa28dade2119.js → beccbfff549902733c4e.js} +1 -1
  62. package/assets/esri/core/workers/chunks/c5364ff8dd1358af3603.js +1 -0
  63. package/assets/esri/core/workers/chunks/{9e2c30b67bab5795306e.js → cb2329d1ea72ce5cc057.js} +1 -1
  64. package/assets/esri/core/workers/chunks/cd46d9b4a8de644e7332.js +1 -0
  65. package/assets/esri/core/workers/chunks/d0172d31389dbfaaa848.js +1 -0
  66. package/assets/esri/core/workers/chunks/da1e6962ba0c85c37953.js +1 -0
  67. package/assets/esri/core/workers/chunks/dff845574c0037a1dca6.js +1 -0
  68. package/assets/esri/core/workers/chunks/e0864ca82ffa3c9a0776.js +1 -0
  69. package/assets/esri/core/workers/chunks/e0cf6e1e21d0ee739009.js +1 -0
  70. package/assets/esri/core/workers/chunks/e69cd62f824ce7a22fa0.js +1 -0
  71. package/assets/esri/core/workers/chunks/{396299c22994c502e41c.js → efc1a90742813b55602e.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{c9feffb9884cfed52c4b.js → f190a3124d6d03417d73.js} +1 -1
  73. package/assets/esri/core/workers/chunks/f4135779bfdaf349352a.js +1 -0
  74. package/assets/esri/core/workers/chunks/f6f5937a1308f28bb959.js +1 -0
  75. package/assets/esri/core/workers/chunks/fd17c4a9e13bf77aa86a.js +1 -0
  76. package/assets/esri/core/workers/chunks/fdd2b35388f9fe42b623.js +1 -0
  77. package/assets/esri/core/workers/chunks/fe24e039385473bf77f9.js +1 -0
  78. package/chunks/cameraUtilsPlanar.js +1 -1
  79. package/chunks/cameraUtilsSpherical.js +1 -1
  80. package/config.js +1 -1
  81. package/core/Accessor.d.ts +1 -1
  82. package/core/Accessor.js +1 -1
  83. package/core/accessorSupport/DefaultsStore.js +1 -1
  84. package/core/accessorSupport/Properties.js +1 -1
  85. package/core/accessorSupport/Property.js +1 -1
  86. package/core/accessorSupport/watch.js +1 -1
  87. package/core/has.js +1 -1
  88. package/core/libs/gl-matrix-2/math/mat4.js +1 -1
  89. package/core/workers/workers.js +1 -6
  90. package/core/workers.d.ts +1 -2
  91. package/geometry/Extent.js +1 -1
  92. package/geometry/Geometry.js +1 -1
  93. package/geometry/Multipoint.js +1 -1
  94. package/geometry/Point.js +1 -1
  95. package/geometry/Polygon.js +1 -1
  96. package/geometry/Polyline.js +1 -1
  97. package/geometry/coordinateFormatter.js +1 -1
  98. package/geometry/operators/gx/operatorRelate.js +2 -0
  99. package/geometry/operators/relateOperator.js +1 -1
  100. package/identity/IdentityModal.js +1 -1
  101. package/kernel.js +1 -1
  102. package/layers/BaseElevationLayer.js +1 -1
  103. package/layers/BaseTileLayer.js +1 -1
  104. package/layers/CatalogLayer.js +1 -1
  105. package/layers/ElevationLayer.js +1 -1
  106. package/layers/FeatureLayer.js +1 -1
  107. package/layers/GeoRSSLayer.js +1 -1
  108. package/layers/ImageryLayer.js +1 -1
  109. package/layers/ImageryTileLayer.js +1 -1
  110. package/layers/IntegratedMeshLayer.js +1 -1
  111. package/layers/KMLLayer.js +1 -1
  112. package/layers/Layer.js +1 -1
  113. package/layers/LinkChartLayer.js +1 -1
  114. package/layers/MapImageLayer.js +1 -1
  115. package/layers/OpenStreetMapLayer.js +1 -1
  116. package/layers/PointCloudLayer.js +1 -1
  117. package/layers/SceneLayer.js +1 -1
  118. package/layers/StreamLayer.js +1 -1
  119. package/layers/SubtypeGroupLayer.js +1 -1
  120. package/layers/TileLayer.js +1 -1
  121. package/layers/VectorTileLayer.js +1 -1
  122. package/layers/WCSLayer.js +1 -1
  123. package/layers/WMSLayer.js +1 -1
  124. package/layers/WMTSLayer.js +1 -1
  125. package/layers/WebTileLayer.js +1 -1
  126. package/layers/graphics/sources/CSVSource.js +1 -1
  127. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  128. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  129. package/layers/graphics/sources/MemorySource.js +1 -1
  130. package/layers/graphics/sources/WFSSource.js +1 -1
  131. package/layers/graphics/sources/support/QueryTask.js +1 -1
  132. package/layers/mixins/ArcGISImageService.js +1 -1
  133. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  134. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  135. package/layers/raster/datasets/BaseRaster.js +1 -1
  136. package/layers/raster/datasets/MRFRaster.js +1 -1
  137. package/layers/raster/formats/tiffParser.js +1 -1
  138. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  139. package/layers/support/GeometryDescriptor.js +1 -1
  140. package/layers/support/KMLSublayer.js +1 -1
  141. package/layers/support/TileInfo.js +1 -1
  142. package/layers/support/featureLayerUtils.js +1 -1
  143. package/layers/support/tiles3DUtils.js +1 -1
  144. package/layers/support/wmtsUtils.js +1 -1
  145. package/layers/video/videoUtils.js +1 -1
  146. package/package.json +3 -3
  147. package/portal/PortalItem.js +1 -1
  148. package/rest/query/executePivotQuery.js +1 -1
  149. package/rest/query/operations/queryPivot.js +1 -1
  150. package/rest/query/operations/queryUtils.js +1 -1
  151. package/rest/support/PivotQuery.js +1 -1
  152. package/rest/support/Query.js +1 -1
  153. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  154. package/symbols/PictureFillSymbol.js +1 -1
  155. package/symbols/PictureMarkerSymbol.js +1 -1
  156. package/symbols/SimpleFillSymbol.js +1 -1
  157. package/symbols/SimpleLineSymbol.js +1 -1
  158. package/symbols/SimpleMarkerSymbol.js +1 -1
  159. package/symbols/TextSymbol.js +1 -1
  160. package/symbols/cim/Rasterizer.js +1 -1
  161. package/symbols/cim/utils.js +1 -1
  162. package/views/2d/PaddedViewState.js +1 -1
  163. package/views/2d/ViewState.js +1 -1
  164. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  165. package/views/2d/engine/webgl/TextureManager.js +1 -1
  166. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  167. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  168. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  169. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  170. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  171. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  172. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  173. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  174. package/views/3d/layers/DrapedSubView3D.js +1 -1
  175. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  176. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  177. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  178. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  179. package/views/3d/layers/SceneLayerView3D.js +1 -1
  180. package/views/3d/layers/WMSLayerView3D.js +1 -1
  181. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  182. package/views/3d/layers/graphics/Graphics3DObjectStateSet.js +1 -1
  183. package/views/3d/layers/graphics/Graphics3DObjectStates.js +1 -1
  184. package/views/3d/layers/i3s/Highlights.js +1 -1
  185. package/views/3d/layers/support/SceneLayerViewRequiredFields.js +1 -1
  186. package/views/3d/layers/support/createFeatureFilterHighlight.js +2 -0
  187. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  188. package/views/3d/layers/support/highlightUtils.js +1 -1
  189. package/views/3d/layers/support/selectTiles3DSpatialReference.js +2 -0
  190. package/views/3d/support/cameraUtils.js +1 -1
  191. package/views/3d/support/earthUtils.js +1 -1
  192. package/views/3d/support/engineContent/line.js +1 -1
  193. package/views/3d/support/flow/geometryUtils.js +1 -1
  194. package/views/3d/support/hitTest.js +1 -1
  195. package/views/3d/terrain/TextureFader.js +1 -1
  196. package/views/3d/webgl-engine/Stage.js +1 -1
  197. package/views/3d/webgl-engine/createWebGLContext.js +2 -0
  198. package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
  199. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  200. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +1 -1
  202. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  203. package/views/3d/webgl.d.ts +2 -1
  204. package/views/3d/webgl.js +1 -1
  205. package/views/SceneView.d.ts +7 -1
  206. package/views/SceneView.js +1 -1
  207. package/views/VideoView.js +1 -1
  208. package/views/draw/support/Box.js +1 -1
  209. package/views/layers/FeatureLikeLayerView.d.ts +3 -1
  210. package/views/layers/FeatureLikeLayerView.js +1 -1
  211. package/views/layers/GraphicsLayerView.d.ts +3 -1
  212. package/views/layers/ImageryLayerView.js +1 -1
  213. package/views/layers/ImageryTileLayerView.js +1 -1
  214. package/views/layers/SceneLayerView.d.ts +3 -2
  215. package/views/layers/SceneLayerView.js +1 -1
  216. package/views/support/Scheduler.js +1 -1
  217. package/views/types.d.ts +1 -0
  218. package/webscene/version.js +1 -1
  219. package/widgets/AreaMeasurement2D.js +1 -1
  220. package/widgets/AreaMeasurement3D.js +1 -1
  221. package/widgets/Attachments.js +1 -1
  222. package/widgets/Attribution.js +1 -1
  223. package/widgets/BasemapGallery.js +1 -1
  224. package/widgets/BasemapLayerList.js +1 -1
  225. package/widgets/BasemapToggle.js +1 -1
  226. package/widgets/BatchAttributeForm.js +1 -1
  227. package/widgets/Bookmarks.js +1 -1
  228. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  229. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  230. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  231. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  232. package/widgets/BuildingExplorer.js +1 -1
  233. package/widgets/CatalogLayerList.js +1 -1
  234. package/widgets/Compass.js +1 -1
  235. package/widgets/CoordinateConversion.js +1 -1
  236. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  237. package/widgets/Daylight.js +1 -1
  238. package/widgets/DirectLineMeasurement3D.js +1 -1
  239. package/widgets/Directions.js +1 -1
  240. package/widgets/DistanceMeasurement2D.js +1 -1
  241. package/widgets/Editor.js +1 -1
  242. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  243. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  244. package/widgets/ElevationProfile.js +1 -1
  245. package/widgets/Expand.js +1 -1
  246. package/widgets/Feature/FeatureAttachments.js +1 -1
  247. package/widgets/Feature/FeatureContent.js +1 -1
  248. package/widgets/Feature/FeatureExpression.js +1 -1
  249. package/widgets/Feature/FeatureFields.js +1 -1
  250. package/widgets/Feature/FeatureMedia.js +1 -1
  251. package/widgets/Feature/FeatureRelationship.js +1 -1
  252. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  253. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  254. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  255. package/widgets/Feature.js +1 -1
  256. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  257. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  258. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  259. package/widgets/FeatureForm.js +1 -1
  260. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  261. package/widgets/FeatureTable.js +1 -1
  262. package/widgets/FeatureTemplates.js +1 -1
  263. package/widgets/Features/FeaturesDrillIn.js +1 -1
  264. package/widgets/Features.js +1 -1
  265. package/widgets/FloorFilter.js +1 -1
  266. package/widgets/Fullscreen.js +1 -1
  267. package/widgets/Histogram.js +1 -1
  268. package/widgets/HistogramRangeSlider.js +1 -1
  269. package/widgets/Home.js +1 -1
  270. package/widgets/LayerList/ListItemPanel.js +1 -1
  271. package/widgets/LayerList.js +1 -1
  272. package/widgets/Legend/styles/card/CardView.js +1 -1
  273. package/widgets/Legend/styles/card/ColorRamp.js +1 -1
  274. package/widgets/Legend/styles/card/LegendElement.js +1 -1
  275. package/widgets/Legend/styles/card/SizeRamp.js +1 -1
  276. package/widgets/Legend/styles/card/UnivariateAboveAndBelowRamp.js +1 -1
  277. package/widgets/Legend/styles/card/UnivariateColorSizeRamp.js +1 -1
  278. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  279. package/widgets/Legend/styles/classic/ColorRamp.js +1 -1
  280. package/widgets/Legend/styles/classic/LegendElement.js +1 -1
  281. package/widgets/Legend/styles/classic/SizeRamp.js +1 -1
  282. package/widgets/Legend/styles/classic/UnivariateAboveAndBelowRamp.js +1 -1
  283. package/widgets/Legend/styles/classic/UnivariateColorSizeRamp.js +1 -1
  284. package/widgets/Legend.js +1 -1
  285. package/widgets/LineOfSight.js +1 -1
  286. package/widgets/Locate.js +1 -1
  287. package/widgets/Measurement.js +1 -1
  288. package/widgets/NavigationToggle.js +1 -1
  289. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  290. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  291. package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
  292. package/widgets/OrientedImageryViewer.js +1 -1
  293. package/widgets/Popup.js +1 -1
  294. package/widgets/Print.js +1 -1
  295. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  296. package/widgets/ScaleBar.js +1 -1
  297. package/widgets/ScaleRangeSlider.js +1 -1
  298. package/widgets/Search/SearchResultRenderer.js +1 -1
  299. package/widgets/Search.js +1 -1
  300. package/widgets/ShadowCast/components/ShadowTooltip.js +1 -1
  301. package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
  302. package/widgets/ShadowCast.js +1 -1
  303. package/widgets/Sketch.js +1 -1
  304. package/widgets/Slice.js +1 -1
  305. package/widgets/Slider.js +1 -1
  306. package/widgets/Spinner.js +1 -1
  307. package/widgets/Swipe.js +1 -1
  308. package/widgets/TableList/ListItemPanel.js +1 -1
  309. package/widgets/TableList.js +1 -1
  310. package/widgets/TimeSlider.js +1 -1
  311. package/widgets/TimeZoneLabel.js +1 -1
  312. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
  313. package/widgets/UtilityNetworkAssociations.js +1 -1
  314. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  315. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  316. package/widgets/UtilityNetworkTrace.js +1 -1
  317. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  318. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  319. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  320. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  321. package/widgets/ValuePicker/ValuePickerLabel.js +1 -1
  322. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  323. package/widgets/ValuePicker.js +1 -1
  324. package/widgets/Widget.js +1 -1
  325. package/widgets/Zoom.js +1 -1
  326. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  327. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  328. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  329. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  330. package/widgets/smartMapping/ColorSlider.js +1 -1
  331. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  332. package/widgets/smartMapping/OpacitySlider.js +1 -1
  333. package/widgets/smartMapping/SizeSlider.js +1 -1
  334. package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
  335. package/widgets/support/ColorPicker.js +1 -1
  336. package/widgets/support/FilterBuilder.js +1 -1
  337. package/widgets/support/FilterCondition.js +1 -1
  338. package/widgets/support/GridControls.js +1 -1
  339. package/widgets/support/MeasurementWidgetContent.js +1 -1
  340. package/widgets/support/PluginSettingsControls.js +1 -1
  341. package/widgets/support/SelectionList.js +1 -1
  342. package/widgets/support/SelectionToolbar.d.ts +1 -1
  343. package/widgets/support/SelectionToolbar.js +1 -1
  344. package/widgets/support/SketchTooltipControls.js +1 -1
  345. package/widgets/support/SnappingControls.js +1 -1
  346. package/widgets/support/TimezonePicker.js +1 -1
  347. package/widgets/support/UnitSelect.js +1 -1
  348. package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
  349. package/assets/esri/core/workers/chunks/01803f76bc0d9f2cd566.js +0 -1
  350. package/assets/esri/core/workers/chunks/02940f7ddaf98e69521e.js +0 -1
  351. package/assets/esri/core/workers/chunks/07e5482e1fc69be5de09.js +0 -1
  352. package/assets/esri/core/workers/chunks/0c893837f67829757df7.js +0 -1
  353. package/assets/esri/core/workers/chunks/15950c2fb173b62ee0ec.js +0 -1
  354. package/assets/esri/core/workers/chunks/1a91443970d64a59521d.js +0 -1
  355. package/assets/esri/core/workers/chunks/20a2124cbe43e5527c40.js +0 -1
  356. package/assets/esri/core/workers/chunks/26ea39dfdf887f357fce.js +0 -1
  357. package/assets/esri/core/workers/chunks/276a0b549acf048e8673.js +0 -1
  358. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +0 -1
  359. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +0 -1
  360. package/assets/esri/core/workers/chunks/398ec098fffe6abceedd.js +0 -1
  361. package/assets/esri/core/workers/chunks/3b32a24488b3068f0cb7.js +0 -1
  362. package/assets/esri/core/workers/chunks/427d929dc7f89b0a1ea9.js +0 -1
  363. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +0 -1
  364. package/assets/esri/core/workers/chunks/4c240ca50f70bf30813f.js +0 -1
  365. package/assets/esri/core/workers/chunks/514cc15acb77dc85035c.js +0 -1
  366. package/assets/esri/core/workers/chunks/585ae43c7bcb86a26762.js +0 -1
  367. package/assets/esri/core/workers/chunks/5e48898cebb6dbaf09b5.js +0 -1
  368. package/assets/esri/core/workers/chunks/5ec5a6cef9ee9a8cc400.js +0 -1
  369. package/assets/esri/core/workers/chunks/601e1d020b8115497944.js +0 -1
  370. package/assets/esri/core/workers/chunks/687deb918eb48a963c8f.js +0 -1
  371. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +0 -1
  372. package/assets/esri/core/workers/chunks/6e910342ada398c98e30.js +0 -1
  373. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +0 -1
  374. package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +0 -1
  375. package/assets/esri/core/workers/chunks/7d497df6e13162156342.js +0 -1
  376. package/assets/esri/core/workers/chunks/7dbf4c7480bf9c72820d.js +0 -1
  377. package/assets/esri/core/workers/chunks/80c234ee5276ea1645db.js +0 -1
  378. package/assets/esri/core/workers/chunks/966204d6dedc8149c3e9.js +0 -1
  379. package/assets/esri/core/workers/chunks/9ab0735e86cf8932bf9d.js +0 -1
  380. package/assets/esri/core/workers/chunks/a0356702f2d3f787aeac.js +0 -1
  381. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +0 -1
  382. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +0 -1
  383. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +0 -1
  384. package/assets/esri/core/workers/chunks/b13d8f4e4e80ef00b1bd.js +0 -1
  385. package/assets/esri/core/workers/chunks/b15a8d4322f3b7819d2f.js +0 -1
  386. package/assets/esri/core/workers/chunks/b472c0a21ae29e653f7d.js +0 -1
  387. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +0 -1
  388. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +0 -1
  389. package/assets/esri/core/workers/chunks/bd812dd75d2a3d7d0441.js +0 -1
  390. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +0 -1
  391. package/assets/esri/core/workers/chunks/c1cf3edce15f09648eb4.js +0 -1
  392. package/assets/esri/core/workers/chunks/c31830ee897d5a7f2582.js +0 -1
  393. package/assets/esri/core/workers/chunks/c48d97c38e821be17dc5.js +0 -1
  394. package/assets/esri/core/workers/chunks/c7ad62f54d2abe1d17a0.js +0 -1
  395. package/assets/esri/core/workers/chunks/cf21b217b13770757cb8.js +0 -1
  396. package/assets/esri/core/workers/chunks/d42a4f47843e075c56a8.js +0 -1
  397. package/assets/esri/core/workers/chunks/deb408bee61ca192b2ce.js +0 -1
  398. package/assets/esri/core/workers/chunks/e121d15b883184ee83e7.js +0 -1
  399. package/assets/esri/core/workers/chunks/e4042e43f0081fe49f7b.js +0 -1
  400. package/assets/esri/core/workers/chunks/e932951598499befabf5.js +0 -1
  401. package/assets/esri/core/workers/chunks/eaab787a5f2445be5e5a.js +0 -1
  402. package/assets/esri/core/workers/chunks/f06ef153e106b26a6748.js +0 -1
  403. package/assets/esri/core/workers/chunks/faae3c43048b42341536.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as n,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{rectifyMapPointPanoramic as a,rectifyMapPoint as o}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as c,convertPixelToHeadingPitch as l,adjustHorizonAngles as u,reducerFn as d,scaleAndAddWithFactor as f,validatePixelsToTransform as p,validateRotationMatrix as m,computeFarplaneVertices as h,computeHFOVAndVFOV as g,vecToPoint as _,or as v,isUpdateElevationWithElevationSource as y,computeNewReferenceCoordinates as b,projectiveTransform as x}from"./utils.js";import{worldToImage as S}from"./worldToImage.js";import{viewingLimit as C}from"../../../widgets/OrientedImageryViewer/constants.js";async function w(e,t,n){let{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:a,farPlaneVertices:o,cameraLocation:s,pixelsToTransform:c,vecToPoint:l,pixelDepths:u}=N(e,t),d=[];return await T(c,o,i,l,t,d,s,a,r,n,u),Array.isArray(e)?d:d[0]}async function T(e,t,n,r,a,s,c,l,u,d,f){let p=a.averageElevation,m=e.length;for(let h=0;h<m;h+=1){let m=e.at(h),g=k(t,n,m,r,a),_=f?.at(h);if(typeof _==`number`){let e=E(g,c,l),t=_*l,n=[c[0]+e[0]*t,c[1]+e[1]*t,c[2]+e[2]*_];s.push(new i(n,a.cameraLocation.spatialReference))}else d&&v(`elevationSample`in d,y(d))&&(p=(await o(r(g),{x:m[0],y:m[1]},{...a,...d,farPlaneVertices:t.map(r)}))[2]),s.push(r(D(g,c,l,p,a.cameraPitch,u)))}}function E(e,t,n){let i=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],s=Math.hypot(i,a)/n,c=Math.hypot(o,s)*n,l=r();return l[0]=i/c,l[1]=a/c,l[2]=o/c,l[2]*=n,l}function D(e,t,r,i,a,o){let s=n(e),c=E(e,t,r);if(O(e[2],i,a,o)){let e=Math.abs((t[2]-i)/-c[2])*r;s=f(t,c,e,r)}else s[2]=i;return s}function O(e,t,n,r){return e<t||n+r/2<C}function k(e,t,n,r,i){let a=null,o=0,s,c=e,l=t;for(;o<=9;){let e=j(n,l,c,i);if(s=e.error,a=e.transformedPoint,v(s<=1,o===9))break;c=b(c,s,n,t),l=A(c,r,i),o++}return a}function A(e,t,n){return S(e.map(t),n).map(({x:e,y:t})=>[e,t,1])}function j(e,t,n,r){let{cameraLocation:a}=r,o=x(e,t,n),{x:s,y:c}=S(new i(o,a.spatialReference),r);return{transformedPoint:o,error:M(e,[s,c,1])}}function M(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function N(t,n){let r=e(t)||`items`in t?t:[t],{cameraLocation:a,rotationMatrix:o}=n;if(p(r,a),m(o),o?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`);let c=s(a.y,a.spatialReference),l=h({...n,scalingFactor:c}),u=S(l.map(e=>new i(e,a.spatialReference)),n),{vfov:d}=g(n.horizontalFieldOfView,n.verticalFieldOfView,n.cameraRoll);return{cameraLocation:a.toArray(),imageBoundaries:u.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:d,farPlaneVertices:l,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:_(a.spatialReference),pixelDepths:r.map(e=>P(e)?e.depth:void 0)}}function P(e){return`depth`in e&&typeof e.depth==`number`}async function F(e,n,r){let{cameraLocation:o,farDistance:f,imageHeight:p,imageWidth:m,verticalFieldOfView:h,horizonPitch:g,horizonRoll:_,horizonYaw:v}=n,y=s(o.y,o.spatialReference),b=f*y,x=[],[S,C,w]=o.toArray(),T=Array.isArray(e)?e:[e];for(let e of T){let s,T,E=P(e),O=E?e.depth*y:b;if(c(e))s=e.heading,T=e.pitch;else{let t=l({x:e.x,y:e.y},m,p),n=u(t.heading,t.pitch,[g,_,v],!0);s=n[0],T=n[1]}let k=Math.sin(t(s))*Math.sin(t(T)),A=Math.cos(t(s))*Math.sin(t(T)),j=-Math.cos(t(T)),M=[S+k*O,C+A*O,w+j*(E?e.depth:f)];if(E){x.push(new i(M,o.spatialReference));continue}let N=n.averageElevation,F;if(r&&T<90){let e=await a(new i(M,o.spatialReference),{heading:s,pitch:T},{...n,...r,farPlaneVertices:d(f,f).map(([e,t])=>new i([o.x+e,o.y+t],o.spatialReference))});F=e,N=e?.[2]??N}let I=(N-w)/(M[2]-w),L=T>=90||!!r&&!F||!Number.isFinite(I)||I<0;x.push(new i(L?[M[0],M[1],N]:D(M,o.toArray(),y,N,T,h),o.spatialReference))}return Array.isArray(e)?x:x[0]}export{w as imageToWorld,F as imageToWorldPanoramic};
2
+ import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as n,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{rectifyMapPointPanoramic as a,rectifyMapPoint as o}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as c,convertPixelToHeadingPitch as l,adjustHorizonAngles as u,reducerFn as d,scaleAndAddWithFactor as f,validatePixelsToTransform as p,validateRotationMatrix as m,computeFarplaneVertices as h,computeHFOVAndVFOV as g,vecToPoint as _,or as v,isUpdateElevationWithElevationSource as y,computeNewReferenceCoordinates as b,projectiveTransform as x}from"./utils.js";import{worldToImage as S}from"./worldToImage.js";import{viewingLimit as C}from"../../../widgets/OrientedImageryViewer/constants.js";async function w(e,t,n){let{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:a,farPlaneVertices:o,cameraLocation:s,pixelsToTransform:c,vecToPoint:l,pixelDepths:u}=N(e,t),d=[];return await T(c,o,i,l,t,d,s,a,r,n,u),Array.isArray(e)?d:d[0]}async function T(e,t,n,r,a,s,c,l,u,d,f){let p=a.averageElevation,m=e.length;for(let h=0;h<m;h+=1){let m=e.at(h),g=k(t,n,m,r,a),_=f?.at(h);if(typeof _==`number`){let e=E(g,c,l),t=_*l,n=[c[0]+e[0]*t,c[1]+e[1]*t,c[2]+e[2]*_];s.push(new i({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:a.cameraLocation.spatialReference}))}else d&&v(`elevationSample`in d,y(d))&&(p=(await o(r(g),{x:m[0],y:m[1]},{...a,...d,farPlaneVertices:t.map(r)}))[2]),s.push(r(D(g,c,l,p,a.cameraPitch,u)))}}function E(e,t,n){let i=e[0]-t[0],a=e[1]-t[1],o=e[2]-t[2],s=Math.hypot(i,a)/n,c=Math.hypot(o,s)*n,l=r();return l[0]=i/c,l[1]=a/c,l[2]=o/c,l[2]*=n,l}function D(e,t,r,i,a,o){let s=n(e),c=E(e,t,r);if(O(e[2],i,a,o)){let e=Math.abs((t[2]-i)/-c[2])*r;s=f(t,c,e,r)}else s[2]=i;return s}function O(e,t,n,r){return e<t||n+r/2<C}function k(e,t,n,r,i){let a=null,o=0,s,c=e,l=t;for(;o<=9;){let e=j(n,l,c,i);if(s=e.error,a=e.transformedPoint,v(s<=1,o===9))break;c=b(c,s,n,t),l=A(c,r,i),o++}return a}function A(e,t,n){return S(e.map(t),n).map(({x:e,y:t})=>[e,t,1])}function j(e,t,n,r){let{cameraLocation:a}=r,o=x(e,t,n),{x:s,y:c}=S(new i({x:o[0],y:o[1],z:o[2],m:o[3],spatialReference:a.spatialReference}),r);return{transformedPoint:o,error:M(e,[s,c,1])}}function M(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function N(t,n){let r=e(t)||`items`in t?t:[t],{cameraLocation:a,rotationMatrix:o}=n;if(p(r,a),m(o),o?.length!==9)throw Error(`Rotation matrix is not provided or is not a valid 3x3 matrix`);let c=s(a.y,a.spatialReference),l=h({...n,scalingFactor:c}),u=S(l.map(e=>new i({x:e[0],y:e[1],z:e[2],m:e[3],spatialReference:a.spatialReference})),n),{vfov:d}=g(n.horizontalFieldOfView,n.verticalFieldOfView,n.cameraRoll);return{cameraLocation:a.toArray(),imageBoundaries:u.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:d,farPlaneVertices:l,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:_(a.spatialReference),pixelDepths:r.map(e=>P(e)?e.depth:void 0)}}function P(e){return`depth`in e&&typeof e.depth==`number`}async function F(e,n,r){let{cameraLocation:o,farDistance:f,imageHeight:p,imageWidth:m,verticalFieldOfView:h,horizonPitch:g,horizonRoll:_,horizonYaw:v}=n,y=s(o.y,o.spatialReference),b=f*y,x=[],[S,C,w]=o.toArray(),T=Array.isArray(e)?e:[e];for(let e of T){let s,T,E=P(e),O=E?e.depth*y:b;if(c(e))s=e.heading,T=e.pitch;else{let t=l({x:e.x,y:e.y},m,p),n=u(t.heading,t.pitch,[g,_,v],!0);s=n[0],T=n[1]}let k=Math.sin(t(s))*Math.sin(t(T)),A=Math.cos(t(s))*Math.sin(t(T)),j=-Math.cos(t(T)),M=[S+k*O,C+A*O,w+j*(E?e.depth:f)];if(E){x.push(new i({x:M[0],y:M[1],z:M[2],m:M[3],spatialReference:o.spatialReference}));continue}let N=n.averageElevation,F;if(r&&T<90){let e=await a(new i({x:M[0],y:M[1],z:M[2],m:M[3],spatialReference:o.spatialReference}),{heading:s,pitch:T},{...n,...r,farPlaneVertices:d(f,f).map(([e,t])=>new i({x:o.x+e,y:o.y+t,spatialReference:o.spatialReference}))});F=e,N=e?.[2]??N}let I=(N-w)/(M[2]-w),[L,R,z]=T>=90||r&&!F||!Number.isFinite(I)||I<0?[M[0],M[1],N]:D(M,o.toArray(),y,N,T,h);x.push(new i({x:L,y:R,z,spatialReference:o.spatialReference}))}return Array.isArray(e)?x:x[0]}export{w as imageToWorld,F as imageToWorldPanoramic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import{fromArray as r,intersectRay as i,fromPoints as a,intersectLine as o}from"../../../geometry/support/plane.js";import{fromPoints as s}from"../../../geometry/support/ray.js";import c from"./updateElevation.js";import{pointToArray as l,or as u}from"./utils.js";import{worldToImagePanoramic as d,worldToImage as f}from"./worldToImage.js";import{normalizeDegrees as p}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";async function m(n,r,i,s=g){let{cameraLocation:c,farPlaneVertices:d}=i,f=l(c),p=[];await v(d,i,p);let m=a(p[0],p[1],p[2]),h=n.clone();for(let d=0;d<s;d++){let s=e();if(!o(m,f,l(n),s))break;let d=0,g=null;if({error:d,imagePoint:g,pointWithZ:h}=await y(r,new t(s,c.spatialReference),i),d<=1)break;let[v,b]=_(c.spatialReference,p);if(u(v<=1,b<=1))break;p.splice(0,p.length,...await S(v,b,new t(s,c.spatialReference),i)),m=a(p[0],p[1],p[2])}return l(h)}async function h(n,a,o,c=g){let{cameraLocation:d,farPlaneVertices:f}=o,p=l(d),m=s(p,l(n)),h=[];await v(f,o,h);let y=[0,0,0,0],x=r(y,h.flat(),!1),C=n.clone();for(let n=0;n<c;n++){let n=e();if(!i(y,m,n)||!x)return;let s=0,c;if({error:s,imagePoint:c,pointWithZ:C}=await b(a,new t(n,d.spatialReference),o),s<=1)return l(C);let[f,p]=_(d.spatialReference,h);if(u(f<=1,p<=1))break;h.splice(0,h.length,...await S(f,p,new t(n,d.spatialReference),o)),x=r(y,h.flat(),!1)}}const g=10;function _(e,t){let r=new n({spatialReference:e});return r.addRing(t),[r.extent?.width?r.extent.width/10:1,r.extent?.height?r.extent.height/10:1]}async function v(e,t,n){let r=e.map(e=>e.clone()),i=await c(r,t);n.push(...i.map(l))}async function y(e,t,n){let r=await c(t,n),i=f(r,n);return{error:x(i,e),imagePoint:i,pointWithZ:r}}async function b(e,t,n){let r=await c(t,n),i=d(r,n),a=p(i.heading+n.cameraHeading);return{error:Math.abs(a-e.heading)+Math.abs(i.pitch-e.pitch),imagePoint:i,pointWithZ:r}}const x=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y);async function S(e,n,r,i){let a=[[-e,-n],[e,-n],[e,n],[-e,n]].map(([e,n])=>new t([r.x+e,r.y+n],r.spatialReference));return c(a,i).then(e=>e.map(e=>e.toArray()))}export{m as rectifyMapPoint,h as rectifyMapPointPanoramic};
2
+ import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import t from"../../../geometry/Point.js";import n from"../../../geometry/Polygon.js";import{fromArray as r,intersectRay as i,fromPoints as a,intersectLine as o}from"../../../geometry/support/plane.js";import{fromPoints as s}from"../../../geometry/support/ray.js";import c from"./updateElevation.js";import{pointToArray as l,or as u}from"./utils.js";import{worldToImagePanoramic as d,worldToImage as f}from"./worldToImage.js";import{normalizeDegrees as p}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";async function m(n,r,i,s=g){let{cameraLocation:c,farPlaneVertices:d}=i,f=l(c),p=[];await v(d,i,p);let m=a(p[0],p[1],p[2]),h=n.clone();for(let d=0;d<s;d++){let s=e();if(!o(m,f,l(n),s))break;let d=0,g=null;if({error:d,imagePoint:g,pointWithZ:h}=await y(r,new t({x:s[0],y:s[1],z:s[2],m:s[3],spatialReference:c.spatialReference}),i),d<=1)break;let[v,b]=_(c.spatialReference,p);if(u(v<=1,b<=1))break;p.splice(0,p.length,...await S(v,b,new t({x:s[0],y:s[1],z:s[2],m:s[3],spatialReference:c.spatialReference}),i)),m=a(p[0],p[1],p[2])}return l(h)}async function h(n,a,o,c=g){let{cameraLocation:d,farPlaneVertices:f}=o,p=l(d),m=s(p,l(n)),h=[];await v(f,o,h);let y=[0,0,0,0],x=r(y,h.flat(),!1),C=n.clone();for(let n=0;n<c;n++){let n=e();if(!i(y,m,n)||!x)return;let s=0,c;if({error:s,imagePoint:c,pointWithZ:C}=await b(a,new t({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:d.spatialReference}),o),s<=1)return l(C);let[f,p]=_(d.spatialReference,h);if(u(f<=1,p<=1))break;h.splice(0,h.length,...await S(f,p,new t({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:d.spatialReference}),o)),x=r(y,h.flat(),!1)}}const g=10;function _(e,t){let r=new n({spatialReference:e});return r.addRing(t),[r.extent?.width?r.extent.width/10:1,r.extent?.height?r.extent.height/10:1]}async function v(e,t,n){let r=e.map(e=>e.clone()),i=await c(r,t);n.push(...i.map(l))}async function y(e,t,n){let r=await c(t,n),i=f(r,n);return{error:x(i,e),imagePoint:i,pointWithZ:r}}async function b(e,t,n){let r=await c(t,n),i=d(r,n),a=p(i.heading+n.cameraHeading);return{error:Math.abs(a-e.heading)+Math.abs(i.pitch-e.pitch),imagePoint:i,pointWithZ:r}}const x=(e,t)=>Math.abs(e.x-t.x)+Math.abs(e.y-t.y);async function S(e,n,r,i){let a=[[-e,-n],[e,-n],[e,n],[-e,n]].map(([e,n])=>new t({x:r.x+e,y:r.y+n,spatialReference:r.spatialReference}));return c(a,i).then(e=>e.map(e=>e.toArray()))}export{m as rectifyMapPoint,h as rectifyMapPointPanoramic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,t,n,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=S(l,r.registryId,u);if(d==null){let a=new AbortController,o=r.bandIds?.slice();if(o?.length&&i.isBsqTile){let i=new Set(o),s=[],c=Array.from(i);for(let i of c)s.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:a.signal}));d=Promise.all(s).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==o.length){let t=[];for(let n of o){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:a.signal,transferPixelsToWorker:!0}):M(e)})}else d=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:a.signal});C(l,r.registryId,u,d,a),d.catch(()=>w(l,r.registryId,u))}return r.signal&&o(r,()=>{T(l,r.registryId,u)}),d}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../request.js";import n from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import i from"../../../core/Logger.js";import{debounce as a,onAbort as o}from"../../../core/promiseUtils.js";import{QueueProcessor as s}from"../../../core/QueueProcessor.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{ensureClass as u}from"../../../core/accessorSupport/ensureType.js";import d from"../../../geometry/Extent.js";import f from"../../../geometry/Point.js";import p from"../../../geometry/SpatialReference.js";import{isFunctionRaster as m,getPixelSpaceCoverage as h}from"./datasetUtils.js";import{isMultiSliceOrRangeDefinition as g,getSliceIndex as _,createSlices as v,getSliceIds as y}from"./multidimensionalUtils.js";import{clearRegisteredIds as b,getRasterId as x,getBlock as S,putBlock as C,deleteBlock as w,decreaseRefCount as T}from"./RawBlockCache.js";import{convertNoDataToMask as E}from"../formats/pixelRangeUtils.js";import{decode as D}from"../formats/RasterCodec.js";import{convertPixelSize as O}from"../functions/clipUtils.js";import{mosaic as k,approximateTransform as A,getLocalArithmeticNorthRotations as j,compositeBands as M}from"../functions/pixelUtils.js";import{getWorldWidth as N,load as P,projectPoint as F,snapPyramid as I,shiftExtent as L,getWorldWrapCount as R,projectExtent as z,getProjectionOffsetGrid as B,getRasterDatasetAlignmentInfo as V,projectResolution as H}from"../functions/rasterProjectionHelper.js";import{convertToLocalDirections as U,uvComponentToVector as W}from"../functions/vectorFieldUtils.js";import{sanitizeUrl as G}from"../../support/arcgisLayerUrl.js";import{url as K}from"../../support/commonProperties.js";import q from"../../support/DimensionalDefinition.js";import J from"../../support/LOD.js";import Y from"../../support/RasterStorageInfo.js";import X from"../../support/TileInfo.js";let Z=0,Q=class extends r{constructor(){super(...arguments),this._tileFetchQueue=new s({concurrency:32,process:(e,t)=>this.fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:`closest`},this.rawBlockRegistryIds=[],this.refresh=a(async e=>{await this._openPromise;let t=await this._refresh(e);return t.dataChanged&&b(this.rasterId,this.rawBlockRegistryIds),t})}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:`closest`,tileInfo:X.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){let{rasterInfo:e}=this,t=N(e.spatialReference);return t!=null&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){let{transform:e}=this.rasterInfo;return e==null||e.type===`gcs-shift`}set rasterJobHandler(e){this._set(`rasterJobHandler`,e),m(this)&&this.primaryRasters?.rasters?.forEach(t=>t.rasterJobHandler=e)}get rasterId(){return this.url||`rasterId-${Z++}`}set url(e){this._set(`url`,G(e,i.getLogger(this)))}async open(e){return this._openPromise??=P().then(()=>this._open(e)),this._openPromise}async fetchTile(e,t,r,i={}){let a=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,o=this.getTileExtentFromTileInfo(e,t,r,a);if(!o)throw new n(`imagery-tile:out-of-bounds`,`Level for fetch tile out of range`);return i={noClip:!0,...i},this.fetchPixels(o,a.size[0],a.size[1],i)}async identify(e,t={}){e=u(f,e).clone().normalize();let{multidimensionalDefinition:n,timeExtent:r}=t,{rasterInfo:i}=this,{hasMultidimensionalTranspose:a,multidimensionalInfo:o}=i,{transposedVariableName:s}=t,c=o!=null&&a&&(r!=null||g(n));c&&!s&&(s=n!=null&&n.length>0?n[0].variableName??void 0:o.variables[0].name,t={...t,transposedVariableName:s}),t=this._getRequestOptionsWithSliceId(t);let{spatialReference:l,extent:p}=i,{datumTransformation:h}=t,_=F(e,l,h);if(!p.intersects(_))return{location:_,value:null};if(i.transform!=null){let e=i.transform.inverseTransform(_);if(!i.nativeExtent.intersects(e))return{location:e,value:null};_=e}let v=s!=null&&o!=null&&i.hasMultidimensionalTranspose;if(m(this)){let e=this.primaryRasters.rasters[0];if(v)return e.identify(_,t);let{pixelSize:r}=i,a=r.x*3/2,o=r.y*3/2,s=new d({xmin:_.x-a,xmax:_.x+a,ymin:_.y-o,ymax:_.y+o,spatialReference:l}),c={interpolation:`nearest`,multidimensionalDefinition:n,sliceId:t.sliceId,bandIds:t.bandIds},{pixelBlock:u}=await e.fetchPixels(s,3,3,c),{pixelBlock:f}=await this.fetchPixels(s,3,3,c);if(u==null)return{location:_,value:null};let p=!u.mask||u.mask[4]?u.pixels.map(e=>e[4]):null,m;return f!=null&&(m=!f.mask||f.mask[4]?f.pixels.map(e=>e[4]):void 0),{location:_,value:p,processedValue:m,pyramidLevel:0}}let y=0;if(!v){let{srcResolution:n}=t;if(n)n.spatialReference&&(n=O(new f(n),l)),y=I(n,i,this.ioConfig.sampling).pyramidLevel;else if(y=await this.computeBestPyramidLevelForLocation(e,t),y==null)return{location:_,value:null}}let b=this.identifyPixelLocation(_,y,null,v);if(b===null)return{location:_,value:null};let{row:x,col:S,rowOffset:C,colOffset:w,blockWidth:T}=b,E=await this._fetchRawTile(y,x,S,t);if(!E?.pixels?.length)return{location:_,value:null};let D=C*T+w;return this._processIdentifyResult(E,{srcLocation:_,position:D,pyramidLevel:y,useTransposedTile:!!v,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,n,r={}){e=L(e),r=this._getRequestOptionsWithSliceId(r);let{_hasNoneOrGCSShiftTransform:i}=this;if(r.requestRawData&&i)return this._fetchPixels(e,t,n,r);let a=N(e.spatialReference),o=R(e);if(a==null||o===0||o===1&&this._isGlobalWrappableSource&&i)return this._fetchPixels(e,t,n,r);if(o>=3)return{extent:e,pixelBlock:null};let s=[],{xmin:c,xmax:l}=e,u=Math.round(a/(l-c)*t),f=u-Math.round((a/2-c)/(l-c)*t),p=0,m=[];for(let i=0;i<=o;i++){let h=i===0?c:-a/2,g=i===o?l-a*i:a/2,_=new d({xmin:h,xmax:g,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),v=i===0?u-f:i===o?t-p:u;p+=v,m.push(v);let y=r.disableWrapAround&&i>0?null:this._fetchPixels(_,v,n,r);s.push(y)}let h=(await Promise.all(s)).map(e=>e?.pixelBlock),g=null,_={width:t,height:n};g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:_,destDimension:null,coefs:null,sampleSpacing:null,interpolation:`nearest`,alignmentInfo:null,blockWidths:m},r)).pixelBlock:k(h,_,{blockWidths:m});let v=z(e,this.rasterInfo.spatialReference,r.datumTransformation);return{extent:e,srcExtent:v,pixelBlock:g}}async fetchRawPixels(e,t,n,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};let i=await this._fetchRawTiles(e,t,n,r),{nativeExtent:a,nativePixelSize:o,storageInfo:s}=this.rasterInfo,c=2**e,l=o.x*c,u=o.y*c,f=new d({xmin:a.xmin+l*t.x,xmax:a.xmin+l*(t.x+n.width-1),ymin:a.ymax-u*(t.y+n.height-1),ymax:a.ymax-u*t.y,spatialReference:a.spatialReference});if(!i)return{extent:f,srcExtent:f,pixelBlock:null};let{pixelBlocks:p,mosaicSize:m}=i;if(p.length===1&&p[0]!=null&&p[0].width===n.width&&p[0].height===n.height)return{extent:f,srcExtent:f,pixelBlock:i.pixelBlocks[0]};let h=e>0?s.pyramidBlockWidth:s.blockWidth,g=e>0?s.pyramidBlockHeight:s.blockHeight,_={x:t.x%h,y:t.y%g},v;return v=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:m,destDimension:n,clipOffset:_,clipSize:n,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock:k(p,m,{clipOffset:_,clipSize:n}),{extent:f,srcExtent:f,pixelBlock:v}}fetchRawTile(e,t,r,i){throw new n(`BaseRaster:read-not-implemented`,`fetchRawTile() is not implemented`)}computeExtent(e){return z(this.rasterInfo.extent,e)}decodePixelBlock(e,t,n){return this.rasterJobHandler?this.rasterJobHandler.decode({data:e,options:t},n):D(e,t,n)}async request(e,n,r=0){let{customFetchParameters:i}=this.ioConfig,{range:a,query:o,headers:s}=n;r=r??n.retryCount??this.ioConfig.retryCount;let c=a?{Range:`bytes=${a.from}-${a.to}`}:null;try{return await t(e,{...n,query:{...o,...i},headers:{...s,...c}})}catch(t){if(r>0)return r--,this.request(e,n,r);throw t}}getSliceIndex(e){let{multidimensionalInfo:t}=this.rasterInfo;return t==null||e==null||e.length===0?null:_(e,t)}getTileExtentFromTileInfo(e,t,n,r){let i=r.lodAt(e);return i?this.getTileExtent({x:i.resolution,y:i.resolution},t,n,r.origin,r.spatialReference,r.size):null}updateTileInfo(){let{storageInfo:e,spatialReference:t,extent:n,pixelSize:r}=this.rasterInfo,{pyramidResolutions:i}=e;if(!e.tileInfo){let a=[],o=e.maximumPyramidLevel||0,s=(r.x+r.y)/2,c=1/.0254*96*s;for(let e=0;e<=o&&(a.unshift(new J({level:o-e,resolution:s,scale:c})),e!==o);e++)if(i){let t=(i[e].x+i[e].y)/2;c*=t/s,s=t}else s*=2,c*=2;let l=new f({x:n.xmin,y:n.ymax,spatialReference:t});e.tileInfo=new X({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:a}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,n=512,r){let{width:i,height:a,nativeExtent:o,pixelSize:s,spatialReference:c}=e,l=new f({x:o.xmin,y:o.ymax,spatialReference:c});r??=Math.max(0,Math.round(Math.log(Math.max(i,a))/Math.LN2-8));let u=this.computeBlockBoundary(o,t,n,{x:o.xmin,y:o.ymax},[s],r);e.storageInfo=new Y({blockWidth:t,blockHeight:n,pyramidBlockWidth:t,pyramidBlockHeight:n,origin:l,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,n,r,i,a=0,o=2){if(i.length===1&&a>0){i=[...i];let{x:e,y:t}=i[0];for(let n=0;n<a;n++)e*=o,t*=o,i.push({x:e,y:t})}let s=[],{x:c,y:l}=r;for(let r=0;r<i.length;r++){let{x:a,y:o}=i[r];s.push({minCol:Math.floor((e.xmin-c+.1*a)/t/a),maxCol:Math.floor((e.xmax-c-.1*a)/t/a),minRow:Math.floor((l-e.ymax+.1*o)/n/o),maxRow:Math.floor((l-e.ymin-.1*o)/n/o)})}return s}getPyramidPixelSize(e){let{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(e===0)return t;if(n!=null&&n.length)return n[e-1];let i=r**e;return{x:t.x*i,y:t.y*i}}identifyPixelLocation(e,t,n,r){let{spatialReference:i,nativeExtent:a,storageInfo:o}=this.rasterInfo,{maximumPyramidLevel:s,origin:c,transposeInfo:l}=o,u=r&&l!=null?l.tileSize[0]:o.blockWidth,d=r&&l!=null?l.tileSize[1]:o.blockHeight,f=F(e,i,n);if(!a.intersects(f)||t<0||t>s)return null;let{x:p,y:m}=this.getPyramidPixelSize(t),h=(c.y-f.y)/m/d,g=(f.x-c.x)/p/u,_=Math.min(d-1,Math.floor((h-Math.floor(h))*d)),v=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(h),col:Math.floor(g),rowOffset:_,colOffset:v,blockWidth:u,srcLocation:f}}getTileExtent(e,t,n,r,i,a){let[o,s]=a,c=r.x+n*o*e.x,l=c+o*e.x,u=r.y-t*s*e.y,f=u-s*e.y;return new d({xmin:c,xmax:l,ymin:f,ymax:u,spatialReference:i})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,n){let r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<n||r.minRow>t||r.minCol>n}updateImageSpaceRasterInfo(e){let{pixelSize:t}=e,{width:n,height:r}=e,i=p.WebMercator;e.spatialReference=i,e.extent=e.nativeExtent=new d({xmin:-.5,ymax:.5,xmax:n-.5,ymin:.5-r,spatialReference:i}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new f({x:1,y:1,spatialReference:i});let{extent:a,storageInfo:o}=e;if(o){o.origin=new f({x:a.xmin,y:a.ymax,spatialReference:i});let{pyramidResolutions:n,tileInfo:r}=o;if(n&&n.forEach(e=>{e.x/=t.x,e.y/=t.y}),r){r.origin=o.origin;let t=(e.nativePixelSize.x+e.nativePixelSize.y)/2;r.lods.forEach((e,n)=>{e.resolution=t*2**n,e.scale=96*e.resolution/.0254})}}}async _refresh(e){return{dataChanged:!0}}async _fetchPixels(e,t,n,r={}){let i=R(e);if(i>=2)return{extent:e,pixelBlock:null};let a=this._getSourceDataInfo(e,t,n,r),{pyramidLevel:o,srcResolution:s,srcWidth:c,srcHeight:l,ul:u}=a,{srcExtent:d}=a;if(c===0||l===0)return{extent:e,srcExtent:d,pixelBlock:null};let{rasterInfo:p}=this,m=p.transform,h=m?.type===`gcs-shift`,g=N(e.spatialReference)!=null;(h||!g)&&(i=R(d,h));let _=await this._fetchRawTiles(o,u,{width:c,height:l,wrapCount:i},r);if(!_)return{extent:e,srcExtent:d,pixelBlock:null};d=_.extent;let v=p.storageInfo,y=o>0?v.pyramidBlockWidth:v.blockWidth,b=o>0?v.pyramidBlockHeight:v.blockHeight,{x,y:S}=p.pixelSize;if(o>0){let{pyramidResolutions:e,pyramidScalingFactor:t}=v;if(e!=null&&e[o-1])({x,y:S}=e[o-1]);else{let e=t**o;x*=e,S*=e}}let C=p.spatialReference,w=new f({x,y:S,spatialReference:C}),T=y===c&&b===l&&u.x%y===0&&u.y%b===0,E=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),D=!e.spatialReference.equals(C),O=C.isGeographic?1e-9:1e-4,{datumTransformation:M}=r;if(!D&&T&&_.pixelBlocks.length===1&&y===t&&b===n&&$(s,E,O))return{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:_.pixelBlocks[0]};let F=g&&N(d.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,I=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith(`vector`);I&&!this.rasterJobHandler&&await P();let L=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:d,pixelSize:E.toJSON(),datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:I},r):B({projectedExtent:e,srcBufferExtent:d,pixelSize:E,datumTransformation:M,rasterTransform:m,hasWrapAround:i>0||F,isAdaptive:!1,includeGCSGrid:I}),z,V=!r.requestRawData,H={rows:L.spacing[0],cols:L.spacing[1]},W=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(o,d.xmin):void 0,{pixelBlocks:G,mosaicSize:K,isPartiallyFilled:q}=_,J=null;if(this.rasterJobHandler){let e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:G,srcMosaicSize:K,destDimension:V?{width:t,height:n}:null,coefs:V?L.coefficients:null,sampleSpacing:V?H:null,projectDirections:I,gcsGrid:I?L.gcsGrid:null,isUV:this.rasterInfo.dataType===`vector-uv`,interpolation:r.interpolation,alignmentInfo:W,blockWidths:null},r);({pixelBlock:z,localNorthDirections:J}=e)}else{let e=k(G,K,{alignmentInfo:W});z=V?A(e,{width:t,height:n},L.coefficients,H,r.interpolation):e,I&&L.gcsGrid&&(J=j({width:t,height:n},L.gcsGrid),z=U(z,this.rasterInfo.dataType,J))}return r.requestRawData||I?{extent:e,srcExtent:d,srcTilePixelSize:w,pixelBlock:z,transformGrid:L,localNorthDirections:J,isPartiallyFilled:q}:{extent:e,srcExtent:e,srcTilePixelSize:w,pixelBlock:z}}async _fetchRawTiles(e,t,n,r){let{origin:i,blockBoundary:a}=this.rasterInfo.storageInfo,{blockWidth:o,blockHeight:s}=this.getBlockWidthHeight(e),{x:c,y:l}=t,{width:u,height:f,wrapCount:p}=n,m=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(c-=r.buffer.cols,l-=r.buffer.rows,u+=r.buffer.cols*2,f+=r.buffer.rows*2);let h=0,g=0,_=0;p&&m!=null&&({worldColumnCountFromOrigin:g,originColumnOffset:_,rightPadding:h}=m,g*m.blockWidth-h>=c+u&&(h=0));let v=Math.floor(c/o),y=Math.floor(l/s),b=Math.floor((c+u+h-1)/o),x=Math.floor((l+f+h-1)/s),S=a[e];if(!S)return null;let{minRow:C,minCol:w,maxCol:T,maxRow:E}=S;if(p===0&&(x<C||b<w||y>E||v>T))return null;let D=[],O=!1,k=this.ioConfig.allowPartialFill==null?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=y;t<=x;t++)for(let n=v;n<=b;n++){let i=n;if(!r.disableWrapAround&&p&&m!=null&&g<=n&&(i=n-g-_),t>=C&&i>=w&&E>=t&&T>=i){let n=this._fetchRawTile(e,t,i,r);k?D.push(new Promise(e=>{n.then(t=>e(t)).catch(()=>{O=!0,e(null)})})):D.push(n)}else D.push(Promise.resolve(null))}if(D.length===0)return null;let A=await Promise.all(D),j={height:(x-y+1)*s,width:(b-v+1)*o},{spatialReference:M}=this.rasterInfo,{x:N,y:P}=this.getPyramidPixelSize(e);return{extent:new d({xmin:i.x+v*o*N,xmax:i.x+(b+1)*o*N,ymin:i.y-(x+1)*s*P,ymax:i.y-y*s*P,spatialReference:M}),pixelBlocks:A,mosaicSize:j,isPartiallyFilled:O}}_fetchRawTile(e,t,n,r){let{storageInfo:i}=this.rasterInfo,a=i.transposeInfo!=null&&!!r.transposedVariableName;if(!a){let r=i.blockBoundary[e];if(!r)return Promise.resolve(null);let{minRow:a,minCol:o,maxCol:s,maxRow:c}=r;if(t<a||n<o||t>c||n>s)return Promise.resolve(null)}let s=a?r.transposeVariableName:r.sliceId,c=i.isBsqTile?r.bandIds:null,l=x(this.rasterId,s,c),u=`${e}/${t}/${n}`,d=this.ioConfig.rawBlockCacheMode??`default`,f=d===`no-cache`,p=d===`minimum`?void 0:r.registryId,m=f?null:S(l,p,u);if(m==null){let a=f?null:new AbortController,o=a?.signal??r.signal,s=r.bandIds?.slice();if(s?.length&&i.isBsqTile){let i=new Set(s),a=[],c=Array.from(i);for(let i of c)a.push(this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:{...r,bandIds:[i]}},{signal:o}));m=Promise.all(a).then(e=>{if(e.some(e=>e==null))return null;if(c.length!==s.length){let t=[];for(let n of s){let r=e[c.indexOf(n)];t.includes(r)&&(r=r.clone()),t.push(r)}e=t}return this.rasterJobHandler?this.rasterJobHandler.compositeBands({pixelBlocks:e},{signal:o,transferPixelsToWorker:!0}):M(e)})}else m=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:r},{signal:o});f||(C(l,p,u,m,a),m.catch(()=>w(l,p,u)))}return!f&&r.signal&&o(r,()=>{T(l,p,u)}),m}_computeMagDirValues(e){let{bandCount:t,dataType:n}=this.rasterInfo;if(!(t===2&&n===`vector-magdir`||n===`vector-uv`)||e?.length!==2||!e[0]?.length)return null;let r=e[0].length;if(n===`vector-magdir`){let t=e[1].map(e=>(e+360)%360);return[e[0],t]}let[i,a]=e,o=[],s=[];for(let e=0;e<r;e++){let[t,n]=W([i[e],a[e]]);o.push(t),s.push(n)}return[o,s]}_getRasterTileAlignmentInfo(e,t){return this._rasterTileAlignmentInfo??=V(this.rasterInfo),this._rasterTileAlignmentInfo.pyramidsInfo==null?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,n,r={}){let i={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(i.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,i));let a=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:o,srcHeight:s,pyramidLevel:c}=i,l=o/t,u=s/n,d=c<a&&l*u>=16,p=c===a&&this._requireTooManySrcTiles(o,s,t,n);if(d||p||o===0||s===0){let o=new f({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/n,spatialReference:e.spatialReference}),s=H(o,this.rasterInfo.spatialReference,e,i.datumTransformation),p=!s||r.srcResolution&&s.x+s.y<r.srcResolution.x+r.srcResolution.y;if(d&&r.srcResolution&&p){let e=Math.round(Math.log(Math.max(l,u))/Math.LN2)-1;if(a-c+3>=e){let t=2**e;s={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}s&&(i.srcResolution=s,this._updateSourceDataInfo(e,i))}return this._requireTooManySrcTiles(i.srcWidth,i.srcHeight,t,n)&&(i.srcWidth=0,i.srcHeight=0),i}_requireTooManySrcTiles(e,t,n,r){let{tileInfo:i}=this.rasterInfo.storageInfo,a=Math.ceil(e/i.size[0])*Math.ceil(t/i.size[1]),o=e/n,s=t/r;return a>=256*Math.max(1,(n+r)/1024)||o>8||s>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;let{rasterInfo:n}=this,r=n.spatialReference,{srcResolution:i,datumTransformation:a}=t,{pyramidLevel:o,pyramidResolution:s,excessiveReading:c}=I(i,n,this.ioConfig.sampling);if(c)return;let l=t.srcExtent||z(e,r,a);if(l==null)return;let u=n.transform;u&&(l=u.inverseTransform(l)),t.srcExtent=l;let{origin:d}=n.storageInfo,{width:f,height:p,ul:m}=h(l,d,s,o);t.pyramidLevel=o,t.pyramidResolution=s,t.srcWidth=f,t.srcHeight=p,t.ul=m}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){let{srcLocation:n,position:r,pyramidLevel:i,useTransposedTile:a}=t,o=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[r])return{location:n,value:null};let{multidimensionalInfo:s}=this.rasterInfo;if(s==null||!a){let t=e.pixels.map(e=>e[r]),a={location:n,value:t,pyramidLevel:i},o=this._computeMagDirValues(t.map(e=>[e]));return o?.length&&(a.magdirValue=o.map(e=>e[0])),a}let c=e.pixels.map(e=>e.slice(r*o,r*o+o)),l=this._computeMagDirValues(c),{requestSomeSlices:u,identifyOptions:d}=t,f=v(s,d.transposedVariableName);if(u){let e=y(f,d.multidimensionalDefinition,d.timeExtent);c=c.map(t=>e.map(e=>t[e])),l=l?.map(t=>e.map(e=>t[e])),f=e.map(e=>f[e])}let p=e.noDataValues||this.rasterInfo.noDataValue,m={pixels:c,pixelType:e.pixelType},h;return p!=null&&(E(m,p),h=m.mask),{location:n,value:null,dataSeries:f.map((e,t)=>{let n={value:h?.[t]===0?null:c.map(e=>e[t]),multidimensionalDefinition:e.multidimensionalDefinition.map(e=>new q({...e,isSlice:!0}))};return l?.length&&(n.magdirValue=[l[0][t],l[1][t]]),n}),pyramidLevel:i}}};e([c()],Q.prototype,`_rasterTileAlignmentInfo`,void 0),e([c()],Q.prototype,`_tileFetchQueue`,void 0),e([c({readOnly:!0})],Q.prototype,`_isGlobalWrappableSource`,null),e([c({readOnly:!0})],Q.prototype,`_hasNoneOrGCSShiftTransform`,null),e([c()],Q.prototype,`_openPromise`,void 0),e([c()],Q.prototype,`rasterJobHandler`,null),e([c({readOnly:!0})],Q.prototype,`rasterId`,null),e([c(K)],Q.prototype,`url`,null),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetName`,void 0),e([c({type:String,json:{write:!0}})],Q.prototype,`datasetFormat`,void 0),e([c()],Q.prototype,`hasUniqueSourceStorageInfo`,void 0),e([c()],Q.prototype,`rasterInfo`,void 0),e([c()],Q.prototype,`ioConfig`,void 0),e([c()],Q.prototype,`sourceJSON`,void 0),e([c()],Q.prototype,`rawBlockRegistryIds`,void 0),Q=e([l(`esri.layers.raster.datasets.BaseRaster`)],Q);function $(e,t,n){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}export{Q as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import a from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{parseSpatialReference as c,parsePAMInfo as l}from"./pamParser.js";import{getElement as u,getElementValue as d}from"./xmlUtilities.js";import{isPlatformLittleEndian as f}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import h from"../../support/RasterInfo.js";import g from"../../support/RasterStorageInfo.js";const _=new Map([[`byte`,`u8`],[`signedbyte`,`s8`],[`int8`,`s8`],[`uint8`,`u8`],[`int16`,`s16`],[`uint16`,`u16`],[`int32`,`s32`],[`uint32`,`u32`],[`float32`,`f32`],[`float64`,`f64`],[`double64`,`f64`]]),v=new Map;v.set(`none`,{blobExtension:`.til`,isOneSegment:!0,decoderFormat:`bip`}),v.set(`lerc`,{blobExtension:`.lrc`,isOneSegment:!1,decoderFormat:`lerc`}),v.set(`deflate`,{blobExtension:`.pzp`,isOneSegment:!0,decoderFormat:`deflate`}),v.set(`jpeg`,{blobExtension:`.pjg`,isOneSegment:!0,decoderFormat:`jpg`}),v.set(`qb3`,{blobExtension:`.pq3`,isOneSegment:!0,decoderFormat:`qb3`});let y=class extends s{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat=`MRF`}async fetchRawTile(e,t,n,r={}){let{blockWidth:i,blockHeight:a,blockBoundary:o}=this.rasterInfo.storageInfo,s=o[e];if(!s||s.maxRow<t||s.maxCol<n||s.minRow>t||s.minCol>n)return null;let{bandCount:c,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:d,actualTileHeight:f}=this._getTileLocation(e,t,n);if(!u||u.length===0)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(i*a);return new m({width:i,height:a,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,h=this._getBandSegmentCount(),g=[],_=0;for(_=0;_<h;_++)(!p||p.includes(_))&&g.push(this.request(this._files.data,{range:{from:u[_].from,to:u[_].to},responseType:`array-buffer`,signal:r.signal}));let y=await Promise.all(g),b=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(b),S=[],C=0;for(_=0;_<h;_++)S.push(C),x.set(new Uint8Array(y[_].data),C),C+=y[_].data.byteLength;let w=v.get(this.rasterInfo.storageInfo.compression).decoderFormat,T=w===`jpg`&&c===4&&S.length===1,E=await this.decodePixelBlock(x.buffer,{width:i,height:a,format:w,planes:p?.length||c,offsets:S,pixelType:l,canvasUsage:T?`no-canvas`:void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(E==null)return null;let{noDataValue:D}=this.rasterInfo;if(D!=null&&w!==`lerc`&&!E.mask&&(D=D[0],D!=null)){let e=E.width*E.height,t=new Uint8Array(e);if(Math.abs(D)>1e24)for(_=0;_<e;_++)Math.abs((E.pixels[0][_]-D)/D)>1e-6&&(t[_]=1);else for(_=0;_<e;_++)E.pixels[0][_]!==D&&(t[_]=1);E.mask=t}let O=0,k=0;if(d!==i||f!==a){let e=E.mask;if(e)for(_=0;_<a;_++)if(k=_*i,_<f)for(O=d;O<i;O++)e[k+O]=0;else for(O=0;O<i;O++)e[k+O]=0;else for(e=new Uint8Array(i*a),E.mask=e,_=0;_<f;_++)for(k=_*i,O=0;O<d;O++)e[k+O]=1}return E}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1);let t=e?e.signal:null,n=await this.request(this.url,{responseType:`xml`,signal:t}),{rasterInfo:r,files:i}=this._parseHeader(n.data),{skipMapInfo:a,skipExtensions:o=[]}=this.ioConfig;if(!o.includes(`aux.xml`)&&!a){let t=await this._fetchAuxiliaryData(e);t!=null&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&r.statistics==null&&(r.statistics=p(t.histograms)))}a&&this.updateImageSpaceRasterInfo(r),this._set(`rasterInfo`,r),this._files=i;let s=await this.request(i.index,{responseType:`array-buffer`,signal:t});this._storageIndex=b(s.data);let{blockWidth:c,blockHeight:l}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:d,height:f}=this.rasterInfo,m=[],h=this._getBandSegmentCount(),g=0,_=-1;for(;g<this._storageIndex.length;){_++;let e=Math.ceil(d/c/u**_)-1,t=Math.ceil(f/l/u**_)-1;g+=(e+1)*(t+1)*h*4,m.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,_>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=_),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,n){let{blockWidth:r,blockHeight:i,pyramidScalingFactor:a}=this.rasterInfo.storageInfo,{width:o,height:s}=this.rasterInfo,c=this._getBandSegmentCount(),l,u,d,f=0,p=0;for(d=0;d<e;d++)p=a**d,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=l*u;p=a**e,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=t*l+n,f*=c*4;let m=this._storageIndex.subarray(f,f+4*c),h=0,g=0,_=[];for(let e=0;e<c;e++)h=m[e*4]*2**32+m[e*4+1],g=h+m[e*4+2]*2**32+m[e*4+3]-1,_.push({from:h,to:g});return{ranges:_,actualTileWidth:n<l-1?r:Math.ceil(o/p)-r*(l-1),actualTileHeight:t<u-1?i:Math.ceil(s/p)-i*(u-1)}}_parseHeader(e){let n=u(e,`MRF_META/Raster`);if(!n)throw new t(`mrf:open`,`not a valid MRF format`);let r=u(n,`Size`),s=parseInt(r.getAttribute(`x`),10),l=parseInt(r.getAttribute(`y`),10),f=parseInt(r.getAttribute(`c`),10),p=(d(n,`Compression`)||`none`).toLowerCase();if(!v.has(p))throw new t(`mrf:open`,`currently does not support compression `+p);let m=d(n,`DataType`)||`UInt8`,y=_.get(m.toLowerCase());if(y==null)throw new t(`mrf:open`,`currently does not support pixel type `+m);let b=u(n,`PageSize`),x=parseInt(b.getAttribute(`x`),10),S=parseInt(b.getAttribute(`y`),10),C=b.getAttribute(`c`),w=C?C===String(f):v.get(p).isOneSegment;this._isBsq=!w;let T=u(n,`DataValues`),E;if(T){let e=T.getAttribute(`NoData`);e!=null&&(E=e.trim().split(` `).map(e=>parseFloat(e)))}if(u(e,`MRF_META/CachedSource`))throw new t(`mrf:open`,`currently does not support MRF referencing other data files`);let D=u(e,`MRF_META/GeoTags`),O=u(D,`BoundingBox`),k=!1,A;if(O!=null){let e=parseFloat(O.getAttribute(`minx`)),t=parseFloat(O.getAttribute(`miny`)),n=parseFloat(O.getAttribute(`maxx`)),r=parseFloat(O.getAttribute(`maxy`)),a=d(D,`Projection`)||``,s=o.WGS84;if(a!==`LOCAL_CS[]`){if(a.toLowerCase().startsWith(`epsg:`)){let e=Number(a.slice(5));!isNaN(e)&&e!==0&&(s=new o({wkid:e}))}else s=c(a)??o.WGS84}else k=!0,s=new o({wkid:3857});A=new i(e,t,n,r),A.spatialReference=s}else k=!0,A=new i({xmin:-.5,ymin:.5-l,xmax:s-.5,ymax:.5,spatialReference:new o({wkid:3857})});let j=u(e,`MRF_META/Rsets`),M=parseInt(j?.getAttribute(`scale`)||`2`,10),N=A.spatialReference,P=new g({origin:new a({x:A.xmin,y:A.ymax,spatialReference:N}),blockWidth:x,blockHeight:S,pyramidBlockWidth:x,pyramidBlockHeight:S,compression:p,pyramidScalingFactor:M}),F=new a({x:A.width/s,y:A.height/l,spatialReference:N}),I=new h({width:s,height:l,extent:A,isPseudoSpatialReference:k,spatialReference:N,bandCount:f,pixelType:y,pixelSize:F,noDataValue:E,storageInfo:P}),L=this._getAuxFullPath(d(n,`DataFile`)),R=this._getAuxFullPath(d(n,`IndexFile`));return{rasterInfo:I,files:{mrf:this.url,index:R||this.url.replace(`.mrf`,`.idx`),data:L||this.url.replace(`.mrf`,v.get(p).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes(`\\`)?null:e.includes(`/`)?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf(`/`))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:e?.signal});return l(t)}catch{return null}}};e([n()],y.prototype,`_files`,void 0),e([n()],y.prototype,`_storageIndex`,void 0),e([n()],y.prototype,`_isBsq`,void 0),e([n({type:String,json:{write:!0}})],y.prototype,`datasetFormat`,void 0),y=e([r(`esri.layers.raster.datasets.MRFRaster`)],y);function b(e){if(e.byteLength%16>0)throw Error(`invalid array buffer must be multiples of 16`);let t;if(f){let n=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),i=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)i[t*4+e]=n[t*4+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}const x=y;export{x as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import a from"../../../geometry/Point.js";import o from"../../../geometry/SpatialReference.js";import s from"./BaseRaster.js";import{parseSpatialReference as c,parsePAMInfo as l}from"./pamParser.js";import{getElement as u,getElementValue as d}from"./xmlUtilities.js";import{isPlatformLittleEndian as f}from"../formats/utils.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import m from"../../support/PixelBlock.js";import h from"../../support/RasterInfo.js";import g from"../../support/RasterStorageInfo.js";const _=new Map([[`byte`,`u8`],[`signedbyte`,`s8`],[`int8`,`s8`],[`uint8`,`u8`],[`int16`,`s16`],[`uint16`,`u16`],[`int32`,`s32`],[`uint32`,`u32`],[`float32`,`f32`],[`float64`,`f64`],[`double64`,`f64`]]),v=new Map;v.set(`none`,{blobExtension:`.til`,isOneSegment:!0,decoderFormat:`bip`}),v.set(`lerc`,{blobExtension:`.lrc`,isOneSegment:!1,decoderFormat:`lerc`}),v.set(`deflate`,{blobExtension:`.pzp`,isOneSegment:!0,decoderFormat:`deflate`}),v.set(`jpeg`,{blobExtension:`.pjg`,isOneSegment:!0,decoderFormat:`jpg`}),v.set(`qb3`,{blobExtension:`.pq3`,isOneSegment:!0,decoderFormat:`qb3`});let y=class extends s{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat=`MRF`}async fetchRawTile(e,t,n,r={}){let{blockWidth:i,blockHeight:a,blockBoundary:o}=this.rasterInfo.storageInfo,s=o[e];if(!s||s.maxRow<t||s.maxCol<n||s.minRow>t||s.minCol>n)return null;let{bandCount:c,pixelType:l}=this.rasterInfo,{ranges:u,actualTileWidth:d,actualTileHeight:f}=this._getTileLocation(e,t,n);if(!u||u.length===0)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(i*a);return new m({width:i,height:a,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,h=this._getBandSegmentCount(),g=[],_=0;for(_=0;_<h;_++)(!p||p.includes(_))&&g.push(this.request(this._files.data,{range:{from:u[_].from,to:u[_].to},responseType:`array-buffer`,signal:r.signal}));let y=await Promise.all(g),b=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),x=new Uint8Array(b),S=[],C=0;for(_=0;_<h;_++)S.push(C),x.set(new Uint8Array(y[_].data),C),C+=y[_].data.byteLength;let w=v.get(this.rasterInfo.storageInfo.compression).decoderFormat,T=w===`jpg`&&c===4&&S.length===1,E=await this.decodePixelBlock(x.buffer,{width:i,height:a,format:w,planes:p?.length||c,offsets:S,pixelType:l,canvasUsage:T?`no-canvas`:void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(E==null)return null;let{noDataValue:D}=this.rasterInfo;if(D!=null&&w!==`lerc`&&!E.mask&&(D=D[0],D!=null)){let e=E.width*E.height,t=new Uint8Array(e);if(Math.abs(D)>1e24)for(_=0;_<e;_++)Math.abs((E.pixels[0][_]-D)/D)>1e-6&&(t[_]=1);else for(_=0;_<e;_++)E.pixels[0][_]!==D&&(t[_]=1);E.mask=t}let O=0,k=0;if(d!==i||f!==a){let e=E.mask;if(e)for(_=0;_<a;_++)if(k=_*i,_<f)for(O=d;O<i;O++)e[k+O]=0;else for(O=0;O<i;O++)e[k+O]=0;else for(e=new Uint8Array(i*a),E.mask=e,_=0;_<f;_++)for(k=_*i,O=0;O<d;O++)e[k+O]=1}return E}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf(`/`)+1);let t=e?e.signal:null,n=await this.request(this.url,{responseType:`xml`,signal:t}),{rasterInfo:r,files:i}=this._parseHeader(n.data),{skipMapInfo:a,skipExtensions:o=[]}=this.ioConfig;if(!o.includes(`aux.xml`)&&!a){let t=await this._fetchAuxiliaryData(e);t!=null&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&r.statistics==null&&(r.statistics=p(t.histograms)))}a&&this.updateImageSpaceRasterInfo(r),this._set(`rasterInfo`,r),this._files=i;let s=await this.request(i.index,{responseType:`array-buffer`,signal:t});this._storageIndex=b(s.data);let{blockWidth:c,blockHeight:l}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:d,height:f}=this.rasterInfo,m=[],h=this._getBandSegmentCount(),g=0,_=-1;for(;g<this._storageIndex.length;){_++;let e=Math.ceil(d/c/u**_)-1,t=Math.ceil(f/l/u**_)-1;g+=(e+1)*(t+1)*h*4,m.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=m,_>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=_),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,n){let{blockWidth:r,blockHeight:i,pyramidScalingFactor:a}=this.rasterInfo.storageInfo,{width:o,height:s}=this.rasterInfo,c=this._getBandSegmentCount(),l,u,d,f=0,p=0;for(d=0;d<e;d++)p=a**d,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=l*u;p=a**e,l=Math.ceil(o/r/p),u=Math.ceil(s/i/p),f+=t*l+n,f*=c*4;let m=this._storageIndex.subarray(f,f+4*c),h=0,g=0,_=[];for(let e=0;e<c;e++)h=m[e*4]*2**32+m[e*4+1],g=h+m[e*4+2]*2**32+m[e*4+3]-1,_.push({from:h,to:g});return{ranges:_,actualTileWidth:n<l-1?r:Math.ceil(o/p)-r*(l-1),actualTileHeight:t<u-1?i:Math.ceil(s/p)-i*(u-1)}}_parseHeader(e){let n=u(e,`MRF_META/Raster`);if(!n)throw new t(`mrf:open`,`not a valid MRF format`);let r=u(n,`Size`),s=parseInt(r.getAttribute(`x`),10),l=parseInt(r.getAttribute(`y`),10),f=parseInt(r.getAttribute(`c`),10),p=(d(n,`Compression`)||`none`).toLowerCase();if(!v.has(p))throw new t(`mrf:open`,`currently does not support compression `+p);let m=d(n,`DataType`)||`UInt8`,y=_.get(m.toLowerCase());if(y==null)throw new t(`mrf:open`,`currently does not support pixel type `+m);let b=u(n,`PageSize`),x=parseInt(b.getAttribute(`x`),10),S=parseInt(b.getAttribute(`y`),10),C=b.getAttribute(`c`),w=C?C===String(f):v.get(p).isOneSegment;this._isBsq=!w;let T=u(n,`DataValues`),E;if(T){let e=T.getAttribute(`NoData`);e!=null&&(E=e.trim().split(` `).map(e=>parseFloat(e)))}if(u(e,`MRF_META/CachedSource`))throw new t(`mrf:open`,`currently does not support MRF referencing other data files`);let D=u(e,`MRF_META/GeoTags`),O=u(D,`BoundingBox`),k=!1,A;if(O!=null){let e=parseFloat(O.getAttribute(`minx`)),t=parseFloat(O.getAttribute(`miny`)),n=parseFloat(O.getAttribute(`maxx`)),r=parseFloat(O.getAttribute(`maxy`)),a=d(D,`Projection`)||``,s=o.WGS84;if(a!==`LOCAL_CS[]`){if(a.toLowerCase().startsWith(`epsg:`)){let e=Number(a.slice(5));!isNaN(e)&&e!==0&&(s=new o({wkid:e}))}else s=c(a)??o.WGS84}else k=!0,s=new o({wkid:3857});A=new i({xmin:e,ymin:t,xmax:n,ymax:r}),A.spatialReference=s}else k=!0,A=new i({xmin:-.5,ymin:.5-l,xmax:s-.5,ymax:.5,spatialReference:new o({wkid:3857})});let j=u(e,`MRF_META/Rsets`),M=parseInt(j?.getAttribute(`scale`)||`2`,10),N=A.spatialReference,P=new g({origin:new a({x:A.xmin,y:A.ymax,spatialReference:N}),blockWidth:x,blockHeight:S,pyramidBlockWidth:x,pyramidBlockHeight:S,compression:p,pyramidScalingFactor:M}),F=new a({x:A.width/s,y:A.height/l,spatialReference:N}),I=new h({width:s,height:l,extent:A,isPseudoSpatialReference:k,spatialReference:N,bandCount:f,pixelType:y,pixelSize:F,noDataValue:E,storageInfo:P}),L=this._getAuxFullPath(d(n,`DataFile`)),R=this._getAuxFullPath(d(n,`IndexFile`));return{rasterInfo:I,files:{mrf:this.url,index:R||this.url.replace(`.mrf`,`.idx`),data:L||this.url.replace(`.mrf`,v.get(p).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes(`\\`)?null:e.includes(`/`)?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf(`/`))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+`.aux.xml`,{responseType:`xml`,signal:e?.signal});return l(t)}catch{return null}}};e([n()],y.prototype,`_files`,void 0),e([n()],y.prototype,`_storageIndex`,void 0),e([n()],y.prototype,`_isBsq`,void 0),e([n({type:String,json:{write:!0}})],y.prototype,`datasetFormat`,void 0),y=e([r(`esri.layers.raster.datasets.MRFRaster`)],y);function b(e){if(e.byteLength%16>0)throw Error(`invalid array buffer must be multiples of 16`);let t;if(f){let n=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),i=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)i[t*4+e]=n[t*4+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}const x=y;export{x as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../core/Error.js";import{bytesToUTF8 as t}from"../datasets/byteStreamUtils.js";import{tiffTags as n,ifdTags as r,getTagName as i,geoKeys as a}from"./tiffTag.js";const o=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],s=4294967296,c=new Map([[1,(e,t)=>e.getUint8(t)],[2,(e,t)=>e.getUint8(t)],[3,(e,t,n)=>e.getUint16(t,n)],[4,(e,t,n)=>e.getUint32(t,n)],[5,(e,t,n)=>e.getUint32(t,n)/e.getUint32(t+4,n)],[6,(e,t)=>e.getInt8(t)],[7,(e,t)=>e.getUint8(t)],[8,(e,t,n)=>e.getInt16(t,n)],[9,(e,t,n)=>e.getInt32(t,n)],[10,(e,t,n)=>e.getInt32(t,n)/e.getInt32(t+4,n)],[11,(e,t,n)=>e.getFloat32(t,n)],[12,(e,t,n)=>e.getFloat64(t,n)],[13,(e,t,n)=>e.getUint32(t,n)],[16,(e,t,n)=>l(e,t,n)],[17,(e,t,n)=>u(e,t,n)],[18,(e,t,n)=>l(e,t,n)]]);function l(e,t,n){let r=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*s+r:r*s+i}function u(e,t,n){let r=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n),a=(n?r:i)>=0?1:-1;return n?r*=a:i*=a,a*(n?i*s+r:r*s+i)}function d(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function f(e,t){return e.get(t)?.values}function p(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function h(e,t){return e.get(t)?.values?.[0]}function g(e){let n=e.get(`GEOKEYDIRECTORY`),r=n?.values;if(!r||typeof r[0]!=`number`||r.length<4)return;let o=r,s=o.slice(0,3).join(`.`),c=o[3];if(o.length<4+c*4)return;let l=new Map;l.set(`GEOTIFFVersion`,{id:0,type:2,valueCount:1,valueOffset:null,values:[s]});for(let n=0;n<c;n++){let r=4+n*4,s=o[r],c=o[r+1],u=o[r+2],d=o[r+3],f={id:s,type:c,valueCount:u,valueOffset:d,values:null};if(c===0)f.values=[d];else{let n=e.get(i(c)),r=n?.values;if(r==null&&n?.offlineOffsetSize!=null)return;if(r!=null){let e=d+u;n?.asciiBytes?e<=n.asciiBytes.length&&(f.values=[t(n.asciiBytes.subarray(d,e)).replace(/\|$/,``)]):typeof r[0]==`string`?e<=r[0].length&&(f.values=[r[0].slice(d,e).replace(/\|$/,``)]):e<=r.length&&(f.values=r.slice(d,e))}}let p=i(s,a);l.set(p,f)}n.data=l}function _(e,t,n,r){return r?l(e,t,n):e.getUint32(t,n)}function v(e,t,r,a=0,o=n,s=4){let c=s===8,u=c?8:2;if(r<0||r+u>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:u};let d=c?l(new DataView(e,r,8),0,t):new DataView(e,r,2).getUint16(0,t),f=4+s*2,p=s,m=u+d*f+p;if(r+m>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:m};let h=_(new DataView(e,r+m-p,p),0,t,c),g=r+u,v=new Map;for(let n=0;n<d;n++){let r=new DataView(e,g+f*n,f),c=r.getUint16(0,t),l=r.getUint16(2,t),u=i(c,o),d=[],p=0,m=0;s===4?(p=r.getUint32(4,t),m=r.getUint32(8,t)):s===8&&(p=_(r,4,t,!0),m=_(r,12,t,!0),d.push(r.getUint32(12,t)),d.push(r.getUint32(16,t)));let h={id:c,type:l,valueCount:p,valueOffset:m,valueOffsets:d,values:null};S(e,t,h,a,!1,s),v.set(u,h)}return{success:!0,ifd:v,nextIFD:h,requiredBufferSize:m}}function y(e){if(!e)return null;let t=e.match(/<Item(.*?)Item>/gi);if(!t||t.length===0)return null;let n=new Map;for(let e=0;e<t.length;e++){let r=t[e],i=r.indexOf(`sample=`),a=i>-1?r.slice(i+8,r.indexOf(`"`,i+8)):null;i=r.indexOf(`name=`);let o=i>-1?r.slice(i+6,r.indexOf(`"`,i+6)):r.slice(6,r.indexOf(`>`));if(o){let e=r.slice(r.indexOf(`>`)+1,r.indexOf(`</Item>`)).trim();a==null?n.set(o,e):n.has(o)?n.get(o)[a]=e:n.set(o,[e])}}let r=n.get(`STATISTICS_MINIMUM`),i=n.get(`STATISTICS_MAXIMUM`),a=n.get(`STATISTICS_MEAN`),o=n.get(`STATISTICS_STDDEV`),s=null;if(r&&i){s=[];for(let e=0;e<r.length;e++)s.push({min:parseFloat(r[e]),max:parseFloat(i[e]),avg:a&&parseFloat(a[e]),stddev:o&&parseFloat(o[e])})}let c=n.get(`BandName`),l=n.get(`WavelengthMin`),u=n.get(`WavelengthMax`),d=null;if(c){d=[];for(let e=0;e<c.length;e++)d.push({BandName:c[e],WavelengthMin:l&&parseFloat(l[e]),WavelengthMax:u&&parseFloat(u[e])})}let f=n.get(`DataType`);return{statistics:s,bandProperties:d,dataType:f,rawMetadata:n}}function b(e,t,n,r){let{type:i,valueCount:a}=t,s=o[i];if(s==null||s<=0)return[];let l=a*s,u=l/s,d=new DataView(e,n,l),f=[],p=c.get(i);if(!p)return[];for(let e=0,t=0;e<u;e++,t+=s)f.push(p(d,t,r));return f}function x(e,t,n=4){let{type:r,valueCount:i,valueOffsets:a}=e,c=o[r];if(c==null||c<=0)return[];let l=c*8,u=i*l,{valueOffset:d}=e,f=n===8?64:32;if(!t){if(f<=32)d>>>=32-u;else{let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s);u<=32?(d=e>>>32-u,a[0]=d):(d=e*2**(32-u)+(t>>>32-u),a[0]=e,a[1]=t>>>32-u)}}if(i===1&&l===f)return[d];let p=[];if(f===64){let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s),n=e,r=32;for(let e=1;e<=i;e++){let i=32-l*e%32;if(r<l){let e=n<<i>>>32-r,a=t<<32-r>>>32-r;n=t,p.push(e+a*2**(l-r)),r-=32-(l-r)}else p.push(n<<i>>>32-l),r-=l;r===0&&(r=32,n=t)}return p}for(let e=1;e<=i;e++){let t=32-l*e;p.push(d<<t>>>32-l)}return p}function S(e,n,r,i=0,a=!1,s=4){if(r.values)return!0;let{type:c,valueCount:l}=r,u=r.valueOffset,d=o[c];if(d==null||d<=0)return r.values=[],!0;let f=l*d,p=l*o[c]*8,m=s===8?64:32,h;if(p<=m)h=x(r,n,s);else{let t=a?e.byteLength:e.byteLength-u+i;if(u-=i,a&&(u=0),u<0||f>t)return r.offlineOffsetSize=[r.valueOffset,f],r.values=null,!1;h=b(e,r,u,n)}if(c===2){let e=h instanceof Uint8Array?h:new Uint8Array(h);r.id===34737&&(r.asciiBytes=e),r.values=[e.length?t(e):``]}else r.values=h;return!0}function C(e){if(!e.has(`XMP`))return;let n=e.get(`XMP`),r=n.values;r&&typeof r[0]==`number`&&n.type===7&&(n.values=[t(new Uint8Array(r))])}function w(e){let t=h(e,`PHOTOMETRICINTERPRETATION`),n=p(e,`COLORMAP`);if(t!=null&&t<=3&&n?.length&&n.length%3==0){let e=[],t=n.length/3;for(let r=0;r<t;r++)e.push([r,n[r]>>>8,n[r+t]>>>8,n[r+t*2]>>>8]);return e}}function T(e){let t=p(e,`GEOTIEPOINTS`),n=p(e,`GEOPIXELSCALE`),r=p(e,`GEOTRANSMATRIX`),i=e.get(`GEOKEYDIRECTORY`)?.data,a=i?h(i,`GTRasterTypeGeoKey`)===2:!1,{spatialReference:o,isPseudoGeographic:s}=E(e),c;n&&t&&t.length>=6?(c=[n[0],0,t[3]-t[0]*n[0],0,-Math.abs(n[1]),t[4]-t[1]*n[1]],a&&(c[2]-=c[0]*.5+c[1]*.5,c[5]-=c[3]*.5+c[4]*.5)):r?.length===16&&(c=a?[r[0],r[1],r[3]-r[0]*.5,r[4],r[5],r[7]-r[5]*.5]:[r[0],r[1],r[3],r[4],r[5],r[7]]);let l,u=h(e,`IMAGEWIDTH`),f=h(e,`IMAGELENGTH`);if(c){let e=[{x:0,y:f},{x:0,y:0},{x:u,y:f},{x:u,y:0}],t,n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=0;o<e.length;o++)t=d(e[o],c),n=t.x>n?n:t.x,i=t.x<i?i:t.x,r=t.y>r?r:t.y,a=t.y<a?a:t.y;l={xmin:n,xmax:i,ymin:r,ymax:a,spatialReference:o}}else l={xmin:-.5,ymin:.5-f,xmax:u-.5,ymax:.5,spatialReference:o};return s&&(l.xmax-l.xmin>400||Math.max(Math.abs(l.xmin),Math.abs(l.xmax))>361)&&(l.spatialReference=null),{extent:l,isPseudoGeographic:s,affine:n?void 0:c}}function E(e){let t=m(e,`GEOASCIIPARAMS`),n=null;if(t){let e=t.split(`|`).find(e=>e.includes(`ESRI PE String = `)),r=e?e.replace(`ESRI PE String = `,``):``;n=r.startsWith(`COMPD_CS`)||r.startsWith(`PROJCS`)||r.startsWith(`GEOGCS`)?{wkid:null,wkt:r}:null}let r=!1,i=e.get(`GEOKEYDIRECTORY`)?.data;if(i){let e=h(i,`GTModelTypeGeoKey`);if(e===2){let e=h(i,`GeographicTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e}),!n&&e===32767&&(r=!0,n={wkid:4326})}else if(e===1){let e=h(i,`ProjectedCSTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e})}}return{spatialReference:n,isPseudoGeographic:r}}function D(e){let{width:t,height:n,tileHeight:r,tileWidth:i}=e,a=e.planes,o=i?i*r:t*n,s=h(e.ifds[0],`BITSPERSAMPLE`),c=o*a,l=``;return c>2**30/(s>8?s/8:1)&&(l=i?`tiled tiff exceeding 1 gigabits per tile is not supported`:`scanline tiff exceeding 1 gigabits is not supported`),l}function O(e,t){let n=h(e,`PLANARCONFIGURATION`);return n==null?t?t.isBSQ:!1:n===2}function k(e){return h(e,`COMPRESSION`)??1}function A(e){let t=k(e),n,r=!1;switch(t){case 1:n=`NONE`,r=!0;break;case 2:case 3:case 4:case 32771:n=`CCITT`;break;case 5:n=`LZW`,r=!0;break;case 6:case 7:n=`JPEG`,r=!0;break;case 32773:n=`PACKBITS`;break;case 8:case 32946:n=`DEFLATE`,r=!0;break;case 34712:n=`JPEG2000`;break;case 34887:n=`LERC`,r=!0;break;default:n=String(t)}return{compression:n,supported:r}}function j(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function M(e){let t=e[0],n=h(t,`TILEWIDTH`),r=h(t,`TILELENGTH`),i=h(t,`IMAGEWIDTH`),a=h(t,`IMAGELENGTH`),o=h(t,`BITSPERSAMPLE`),s=h(t,`SAMPLESPERPIXEL`),c=h(t,`SAMPLEFORMAT`)??1,l=j(c,o),u=O(t),d=f(t,`GDAL_NODATA`),p=null;d?.length&&(p=d.map(e=>parseFloat(e)),p.some(e=>isNaN(e))&&(p=null));let g=!0,_=``,{compression:v,supported:b}=A(t);b||(g=!1,_+=`unsupported tag compression `+v),c>3&&(g=!1,_+=`unsupported tag sampleFormat `+c),o>32&&o!==64&&(g=!1,_+=`unsupported tag bitsPerSample `+o);let{extent:x,isPseudoGeographic:S,affine:C}=T(t),E=N(e),k,M,F,I;if(E.length>0){F=Math.round(Math.log(i/h(E[0],`IMAGEWIDTH`))/Math.LN2);let e=E[E.length-1];I=E.length,k=h(e,`TILEWIDTH`),M=h(e,`TILELENGTH`)}k=I!=null&&I>0?k||n:null,M=I!=null&&I>0?M||r:null;let L;n&&(L=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(a/r)-1,minRow:0,minCol:0}],E.forEach(e=>{L.push({maxCol:Math.ceil(h(e,`IMAGEWIDTH`)/h(e,`TILEWIDTH`))-1,maxRow:Math.ceil(h(e,`IMAGELENGTH`)/h(e,`TILELENGTH`))-1,minRow:0,minCol:0})}));let R=y(m(e[0],`GDAL_METADATA`));_+=` `+D({width:i,height:a,tileWidth:n,tileHeight:r,planes:s,ifds:e});let z=P(e).length===E.length+1,B=E?.length?E.map(e=>({x:i/h(e,`IMAGEWIDTH`),y:a/h(e,`IMAGELENGTH`)})):void 0,V=w(t);return{width:i,height:a,tileWidth:n,tileHeight:r,planes:s,isBSQ:u,pixelType:l,compression:v,noData:p,hasMaskBand:z,isSupported:g,pyramidResolutions:B,message:_,extent:x,isPseudoGeographic:S,affine:C,firstPyramidLevel:F,maximumPyramidLevel:I,pyramidBlockWidth:k,pyramidBlockHeight:M,tileBoundary:L,metadata:R,colormap:V}}function N(e){return e.filter(e=>h(e,`NEWSUBFILETYPE`)===1)}function P(e){return e.filter(e=>{let t=((h(e,`NEWSUBFILETYPE`)??0)&4)==4,n=h(e,`PHOTOMETRICINTERPRETATION`)===4;return t&&n})}function F(e,t,i,a=0,o=n,s=4){let c=v(e,t,i,a,o,s),l,u=c.ifd;return u&&(r.forEach((n,r)=>{u.has(r)&&(l=u.get(r),l.data=v(e,t,l.valueOffset-a,a,n).ifd)}),g(u),C(u)),c}function I(t){let n=new DataView(t,0,16),r=n.getUint16(0,!1),i=null;if(r===18761)i=!0;else if(r===19789)i=!1;else throw new e(`tiff-reader:parse-signature`,`unexpected endianness byte`);let a=n.getUint16(2,i);if(a!==42&&a!==43)throw new e(`tiff-reader:parse-signature`,`unexpected tiff identifier`);let o=4,s=a===43;if(s){let t=n.getUint16(o,i);if(o+=2,t!==8||n.getUint16(o,i)!==0)throw new e(`tiff-reader:parse-signature`,`unsupported bigtiff version`);o+=2}let c=_(n,o,i,s);return{littleEndian:i,isBigTiff:s,firstIFDPos:c}}function L(e){let{littleEndian:t,isBigTiff:r,firstIFDPos:i}=I(e),a=i,o=[];do{let i=F(e,t,a,0,n,r?8:4);if(i.success)o.push(i.ifd),a=i.nextIFD;else break}while(a>0);let s=M(o),c=N(o),l=P(o);return{...s,littleEndian:t,isBigTiff:r,ifds:o,pyramidIFDs:c,maskIFDs:l}}export{D as checkRequiredArraySize,k as getCompressionType,M as getImageInfo,P as getMaskIFDs,N as getPyramidIFDs,h as getTagFirstNumericValue,p as getTagNumericValues,O as isBSQConfig,S as parseFieldValues,g as parseGeoKeyDirectory,L as parseHeader,F as parseIFD,I as parseSignature,C as parseXMP};
2
+ import e from"../../../core/Error.js";import{bytesToUTF8 as t}from"../datasets/byteStreamUtils.js";import{tiffTags as n,ifdTags as r,getTagName as i,geoKeys as a}from"./tiffTag.js";const o=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],s=4294967296,c=new Map([[1,(e,t)=>e.getUint8(t)],[2,(e,t)=>e.getUint8(t)],[3,(e,t,n)=>e.getUint16(t,n)],[4,(e,t,n)=>e.getUint32(t,n)],[5,(e,t,n)=>e.getUint32(t,n)/e.getUint32(t+4,n)],[6,(e,t)=>e.getInt8(t)],[7,(e,t)=>e.getUint8(t)],[8,(e,t,n)=>e.getInt16(t,n)],[9,(e,t,n)=>e.getInt32(t,n)],[10,(e,t,n)=>e.getInt32(t,n)/e.getInt32(t+4,n)],[11,(e,t,n)=>e.getFloat32(t,n)],[12,(e,t,n)=>e.getFloat64(t,n)],[13,(e,t,n)=>e.getUint32(t,n)],[16,(e,t,n)=>l(e,t,n)],[17,(e,t,n)=>u(e,t,n)],[18,(e,t,n)=>l(e,t,n)]]);function l(e,t,n){let r=e.getUint32(t,n),i=e.getUint32(t+4,n);return n?i*s+r:r*s+i}function u(e,t,n){let r=n?e.getInt32(t,n):e.getUint32(t,n),i=n?e.getUint32(t+4,n):e.getInt32(t+4,n),a=(n?r:i)>=0?1:-1;return n?r*=a:i*=a,a*(n?i*s+r:r*s+i)}function d(e,t){return{x:t[0]*e.x+t[1]*e.y+t[2],y:t[3]*e.x+t[4]*e.y+t[5]}}function f(e,t){return e.get(t)?.values}function p(e,t){return e.get(t)?.values}function m(e,t){return e.get(t)?.values?.[0]}function h(e,t){return e.get(t)?.values?.[0]}function g(e){let n=e.get(`GEOKEYDIRECTORY`),r=n?.values;if(!r||typeof r[0]!=`number`||r.length<4)return;let o=r,s=o.slice(0,3).join(`.`),c=o[3];if(o.length<4+c*4)return;let l=new Map;l.set(`GEOTIFFVersion`,{id:0,type:2,valueCount:1,valueOffset:null,values:[s]});for(let n=0;n<c;n++){let r=4+n*4,s=o[r],c=o[r+1],u=o[r+2],d=o[r+3],f={id:s,type:c,valueCount:u,valueOffset:d,values:null};if(c===0)f.values=[d];else{let n=e.get(i(c)),r=n?.values;if(r==null&&n?.offlineOffsetSize!=null)return;if(r!=null){let e=d+u;n?.asciiBytes?e<=n.asciiBytes.length&&(f.values=[t(n.asciiBytes.subarray(d,e)).replace(/\|$/,``)]):typeof r[0]==`string`?e<=r[0].length&&(f.values=[r[0].slice(d,e).replace(/\|$/,``)]):e<=r.length&&(f.values=r.slice(d,e))}}let p=i(s,a);l.set(p,f)}n.data=l}function _(e,t,n,r){return r?l(e,t,n):e.getUint32(t,n)}function v(e,t,r,a=0,o=n,s=4){let c=s===8,u=c?8:2;if(r<0||r+u>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:u};let d=c?l(new DataView(e,r,8),0,t):new DataView(e,r,2).getUint16(0,t),f=4+s*2,p=s,m=u+d*f+p;if(r+m>e.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:m};let h=_(new DataView(e,r+m-p,p),0,t,c),g=r+u,v=new Map;for(let n=0;n<d;n++){let r=new DataView(e,g+f*n,f),c=r.getUint16(0,t),l=r.getUint16(2,t),u=i(c,o),d=[],p=0,m=0;s===4?(p=r.getUint32(4,t),m=r.getUint32(8,t)):s===8&&(p=_(r,4,t,!0),m=_(r,12,t,!0),d.push(r.getUint32(12,t)),d.push(r.getUint32(16,t)));let h={id:c,type:l,valueCount:p,valueOffset:m,valueOffsets:d,values:null};S(e,t,h,a,!1,s),v.set(u,h)}return{success:!0,ifd:v,nextIFD:h,requiredBufferSize:m}}function y(e){if(!e)return null;let t=e.match(/<Item(.*?)Item>/gi);if(!t||t.length===0)return null;let n=new Map;for(let e=0;e<t.length;e++){let r=t[e],i=r.indexOf(`sample=`),a=i>-1?r.slice(i+8,r.indexOf(`"`,i+8)):null;i=r.indexOf(`name=`);let o=i>-1?r.slice(i+6,r.indexOf(`"`,i+6)):r.slice(6,r.indexOf(`>`));if(o){let e=r.slice(r.indexOf(`>`)+1,r.indexOf(`</Item>`)).trim();a==null?n.set(o,e):n.has(o)?n.get(o)[a]=e:n.set(o,[e])}}let r=n.get(`STATISTICS_MINIMUM`),i=n.get(`STATISTICS_MAXIMUM`),a=n.get(`STATISTICS_MEAN`),o=n.get(`STATISTICS_STDDEV`),s=n.get(`STATISTICS_COUNT`),c=n.get(`STATISTICS_MEDIAN`),l=n.get(`STATISTICS_COVARIANCES`),u=null;if(r&&i){u=[];for(let e=0;e<r.length;e++){let t={min:parseFloat(r[e]),max:parseFloat(i[e]),avg:a&&parseFloat(a[e]),stddev:o&&parseFloat(o[e])};s&&(t.count=parseFloat(s[e])),c&&(t.median=parseFloat(c[e])),l&&(t.covariances=l[e].split(`,`).map(e=>parseFloat(e))),u.push(t)}}let d=n.get(`BandName`),f=n.get(`WavelengthMin`),p=n.get(`WavelengthMax`),m=null;if(d){m=[];for(let e=0;e<d.length;e++)m.push({BandName:d[e],WavelengthMin:f&&parseFloat(f[e]),WavelengthMax:p&&parseFloat(p[e])})}let h=n.get(`DataType`);return{statistics:u,bandProperties:m,dataType:h,rawMetadata:n}}function b(e,t,n,r){let{type:i,valueCount:a}=t,s=o[i];if(s==null||s<=0)return[];let l=a*s,u=l/s,d=new DataView(e,n,l),f=[],p=c.get(i);if(!p)return[];for(let e=0,t=0;e<u;e++,t+=s)f.push(p(d,t,r));return f}function x(e,t,n=4){let{type:r,valueCount:i,valueOffsets:a}=e,c=o[r];if(c==null||c<=0)return[];let l=c*8,u=i*l,{valueOffset:d}=e,f=n===8?64:32;if(!t){if(f<=32)d>>>=32-u;else{let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s);u<=32?(d=e>>>32-u,a[0]=d):(d=e*2**(32-u)+(t>>>32-u),a[0]=e,a[1]=t>>>32-u)}}if(i===1&&l===f)return[d];let p=[];if(f===64){let e=a?.length?a[0]:d>>>0,t=a?.length?a[1]:Math.round((d-e)/s),n=e,r=32;for(let e=1;e<=i;e++){let i=32-l*e%32;if(r<l){let e=n<<i>>>32-r,a=t<<32-r>>>32-r;n=t,p.push(e+a*2**(l-r)),r-=32-(l-r)}else p.push(n<<i>>>32-l),r-=l;r===0&&(r=32,n=t)}return p}for(let e=1;e<=i;e++){let t=32-l*e;p.push(d<<t>>>32-l)}return p}function S(e,n,r,i=0,a=!1,s=4){if(r.values)return!0;let{type:c,valueCount:l}=r,u=r.valueOffset,d=o[c];if(d==null||d<=0)return r.values=[],!0;let f=l*d,p=l*o[c]*8,m=s===8?64:32,h;if(p<=m)h=x(r,n,s);else{let t=a?e.byteLength:e.byteLength-u+i;if(u-=i,a&&(u=0),u<0||f>t)return r.offlineOffsetSize=[r.valueOffset,f],r.values=null,!1;h=b(e,r,u,n)}if(c===2){let e=h instanceof Uint8Array?h:new Uint8Array(h);r.id===34737&&(r.asciiBytes=e),r.values=[e.length?t(e):``]}else r.values=h;return!0}function C(e){if(!e.has(`XMP`))return;let n=e.get(`XMP`),r=n.values;r&&typeof r[0]==`number`&&n.type===7&&(n.values=[t(new Uint8Array(r))])}function w(e){let t=h(e,`PHOTOMETRICINTERPRETATION`),n=p(e,`COLORMAP`);if(t!=null&&t<=3&&n?.length&&n.length%3==0){let e=[],t=n.length/3;for(let r=0;r<t;r++)e.push([r,n[r]>>>8,n[r+t]>>>8,n[r+t*2]>>>8]);return e}}function T(e){let t=p(e,`GEOTIEPOINTS`),n=p(e,`GEOPIXELSCALE`),r=p(e,`GEOTRANSMATRIX`),i=e.get(`GEOKEYDIRECTORY`)?.data,a=i?h(i,`GTRasterTypeGeoKey`)===2:!1,{spatialReference:o,isPseudoGeographic:s}=E(e),c;n&&t&&t.length>=6?(c=[n[0],0,t[3]-t[0]*n[0],0,-Math.abs(n[1]),t[4]-t[1]*n[1]],a&&(c[2]-=c[0]*.5+c[1]*.5,c[5]-=c[3]*.5+c[4]*.5)):r?.length===16&&(c=a?[r[0],r[1],r[3]-r[0]*.5,r[4],r[5],r[7]-r[5]*.5]:[r[0],r[1],r[3],r[4],r[5],r[7]]);let l,u=h(e,`IMAGEWIDTH`),f=h(e,`IMAGELENGTH`);if(c){let e=[{x:0,y:f},{x:0,y:0},{x:u,y:f},{x:u,y:0}],t,n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=0;o<e.length;o++)t=d(e[o],c),n=t.x>n?n:t.x,i=t.x<i?i:t.x,r=t.y>r?r:t.y,a=t.y<a?a:t.y;l={xmin:n,xmax:i,ymin:r,ymax:a,spatialReference:o}}else l={xmin:-.5,ymin:.5-f,xmax:u-.5,ymax:.5,spatialReference:o};return s&&(l.xmax-l.xmin>400||Math.max(Math.abs(l.xmin),Math.abs(l.xmax))>361)&&(l.spatialReference=null),{extent:l,isPseudoGeographic:s,affine:n?void 0:c}}function E(e){let t=m(e,`GEOASCIIPARAMS`),n=null;if(t){let e=t.split(`|`).find(e=>e.includes(`ESRI PE String = `)),r=e?e.replace(`ESRI PE String = `,``):``;n=r.startsWith(`COMPD_CS`)||r.startsWith(`PROJCS`)||r.startsWith(`GEOGCS`)?{wkid:null,wkt:r}:null}let r=!1,i=e.get(`GEOKEYDIRECTORY`)?.data;if(i){let e=h(i,`GTModelTypeGeoKey`);if(e===2){let e=h(i,`GeographicTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e}),!n&&e===32767&&(r=!0,n={wkid:4326})}else if(e===1){let e=h(i,`ProjectedCSTypeGeoKey`);e>=1024&&e<=32766&&(n={wkid:e})}}return{spatialReference:n,isPseudoGeographic:r}}function D(e){let{width:t,height:n,tileHeight:r,tileWidth:i}=e,a=e.planes,o=i?i*r:t*n,s=h(e.ifds[0],`BITSPERSAMPLE`),c=o*a,l=``;return c>2**30/(s>8?s/8:1)&&(l=i?`tiled tiff exceeding 1 gigabits per tile is not supported`:`scanline tiff exceeding 1 gigabits is not supported`),l}function O(e,t){let n=h(e,`PLANARCONFIGURATION`);return n==null?t?t.isBSQ:!1:n===2}function k(e){return h(e,`COMPRESSION`)??1}function A(e){let t=k(e),n,r=!1;switch(t){case 1:n=`NONE`,r=!0;break;case 2:case 3:case 4:case 32771:n=`CCITT`;break;case 5:n=`LZW`,r=!0;break;case 6:case 7:n=`JPEG`,r=!0;break;case 32773:n=`PACKBITS`;break;case 8:case 32946:n=`DEFLATE`,r=!0;break;case 34712:n=`JPEG2000`;break;case 34887:n=`LERC`,r=!0;break;default:n=String(t)}return{compression:n,supported:r}}function j(e,t){let n=`unknown`;return e===3?n=t===64?`f64`:`f32`:e===1?t===1?n=`u1`:t===2?n=`u2`:t===4?n=`u4`:t<=8?n=`u8`:t<=16?n=`u16`:t<=32&&(n=`u32`):e===2&&(t<=8?n=`s8`:t<=16?n=`s16`:t<=32&&(n=`s32`)),n}function M(e){let t=e[0],n=h(t,`TILEWIDTH`),r=h(t,`TILELENGTH`),i=h(t,`IMAGEWIDTH`),a=h(t,`IMAGELENGTH`),o=h(t,`BITSPERSAMPLE`),s=h(t,`SAMPLESPERPIXEL`),c=h(t,`SAMPLEFORMAT`)??1,l=j(c,o),u=O(t),d=f(t,`GDAL_NODATA`),p=null;d?.length&&(p=d.map(e=>parseFloat(e)),p.some(e=>isNaN(e))&&(p=null));let g=!0,_=``,{compression:v,supported:b}=A(t);b||(g=!1,_+=`unsupported tag compression `+v),c>3&&(g=!1,_+=`unsupported tag sampleFormat `+c),o>32&&o!==64&&(g=!1,_+=`unsupported tag bitsPerSample `+o);let{extent:x,isPseudoGeographic:S,affine:C}=T(t),E=N(e),k,M,F,I;if(E.length>0){F=Math.round(Math.log(i/h(E[0],`IMAGEWIDTH`))/Math.LN2);let e=E[E.length-1];I=E.length,k=h(e,`TILEWIDTH`),M=h(e,`TILELENGTH`)}k=I!=null&&I>0?k||n:null,M=I!=null&&I>0?M||r:null;let L;n&&(L=[{maxCol:Math.ceil(i/n)-1,maxRow:Math.ceil(a/r)-1,minRow:0,minCol:0}],E.forEach(e=>{L.push({maxCol:Math.ceil(h(e,`IMAGEWIDTH`)/h(e,`TILEWIDTH`))-1,maxRow:Math.ceil(h(e,`IMAGELENGTH`)/h(e,`TILELENGTH`))-1,minRow:0,minCol:0})}));let R=y(m(e[0],`GDAL_METADATA`));_+=` `+D({width:i,height:a,tileWidth:n,tileHeight:r,planes:s,ifds:e});let z=P(e).length===E.length+1,B=E?.length?E.map(e=>({x:i/h(e,`IMAGEWIDTH`),y:a/h(e,`IMAGELENGTH`)})):void 0,V=w(t);return{width:i,height:a,tileWidth:n,tileHeight:r,planes:s,isBSQ:u,pixelType:l,compression:v,noData:p,hasMaskBand:z,isSupported:g,pyramidResolutions:B,message:_,extent:x,isPseudoGeographic:S,affine:C,firstPyramidLevel:F,maximumPyramidLevel:I,pyramidBlockWidth:k,pyramidBlockHeight:M,tileBoundary:L,metadata:R,colormap:V}}function N(e){return e.filter(e=>h(e,`NEWSUBFILETYPE`)===1)}function P(e){return e.filter(e=>{let t=((h(e,`NEWSUBFILETYPE`)??0)&4)==4,n=h(e,`PHOTOMETRICINTERPRETATION`)===4;return t&&n})}function F(e,t,i,a=0,o=n,s=4){let c=v(e,t,i,a,o,s),l,u=c.ifd;return u&&(r.forEach((n,r)=>{u.has(r)&&(l=u.get(r),l.data=v(e,t,l.valueOffset-a,a,n).ifd)}),g(u),C(u)),c}function I(t){let n=new DataView(t,0,16),r=n.getUint16(0,!1),i=null;if(r===18761)i=!0;else if(r===19789)i=!1;else throw new e(`tiff-reader:parse-signature`,`unexpected endianness byte`);let a=n.getUint16(2,i);if(a!==42&&a!==43)throw new e(`tiff-reader:parse-signature`,`unexpected tiff identifier`);let o=4,s=a===43;if(s){let t=n.getUint16(o,i);if(o+=2,t!==8||n.getUint16(o,i)!==0)throw new e(`tiff-reader:parse-signature`,`unsupported bigtiff version`);o+=2}let c=_(n,o,i,s);return{littleEndian:i,isBigTiff:s,firstIFDPos:c}}function L(e){let{littleEndian:t,isBigTiff:r,firstIFDPos:i}=I(e),a=i,o=[];do{let i=F(e,t,a,0,n,r?8:4);if(i.success)o.push(i.ifd),a=i.nextIFD;else break}while(a>0);let s=M(o),c=N(o),l=P(o);return{...s,littleEndian:t,isBigTiff:r,ifds:o,pyramidIFDs:c,maskIFDs:l}}export{D as checkRequiredArraySize,k as getCompressionType,M as getImageInfo,P as getMaskIFDs,N as getPyramidIFDs,h as getTagFirstNumericValue,p as getTagNumericValues,O as isBSQConfig,S as parseFieldValues,g as parseGeoKeyDirectory,L as parseHeader,F as parseIFD,y as parseMetadata,I as parseSignature,C as parseXMP};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import r from"../../../geometry/Extent.js";import{P as i,a,b as o,c as s,d as c}from"../../../chunks/pe.js";import l from"../../../geometry/Point.js";import u from"../../../geometry/Polygon.js";import{projectWithoutEngine as d}from"../../../geometry/projectionUtils.js";import f from"../../../geometry/SpatialReference.js";import{getInfo as p}from"../../../geometry/support/spatialReferenceUtils.js";function m(){if(!S)throw new t(`rasterprojectionhelper-project`,`projection operator is not loaded`)}const h=(e,t,n,r=0)=>{if(n[0]===1)return[0,0];let i=1,a=-1,o=1,s=-1;for(let t=0;t<e.length;t+=2)isNaN(e[t])||(i=i>e[t]?e[t]:i,a=a>e[t]?a:e[t],o=o>e[t+1]?e[t+1]:o,s=s>e[t+1]?s:e[t+1]);let{cols:c,rows:l}=t,u=(a-i)/c/n[0],d=(s-o)/l/n[1],f=r*2,p=0,m=!1,h=[0,0];for(let t=0;t<c-3;t++){for(let n=0;n<l-3;n++){let r=t*l*2+n*2,i=(e[r]+e[r+4]+e[r+l*4]+e[r+l*4+4])/4,a=(e[r+1]+e[r+5]+e[r+l*4+1]+e[r+l*4+5])/4,o=Math.abs((i-e[r+l*2+2])/u),s=Math.abs((a-e[r+l*2+3])/d);if(o+s>p&&(p=o+s,h=[o,s]),f&&p>f){m=!0;break}}if(m)break}return h},g={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},_=32,v=4,y=4,b=new Map,x=new Map;let S=!1,C,w,T;async function E(){return C||(C=Promise.withResolvers(),w=await import(`../../../geometry/operators/projectOperator.js`),T=await import(`../../../geometry/operators/support/geographicTransformationUtils.js`),w.projectIsLoaded()||await w.projectLoad(),T.isLoaded()||await T.load(),S=!0,C.resolve()),C.promise}function D(e,t,n){if(m(),n){let n=w.projectExecute(e,t);return T.getTransformation(t,e.spatialReference,n)}return T.getTransformation(e.spatialReference,t,e)}function O(e,t,n,i){let a=e.spatialReference;if(!a||!t||a.equals(t))return e;m();let o=n.center,s=new r({xmin:o.x-e.x/2,xmax:o.x+e.x/2,ymin:o.y-e.y/2,ymax:o.y+e.y/2,spatialReference:a}),c=w.projectExecute(s,t,{geographicTransformation:i}),l=W(t);return c==null||l!=null&&c.width>=l?k(e,a,t):{x:c.width,y:c.height}}function k(e,t,r){let i=n(t)/n(r);return{x:e.x*i,y:e.y*i}}function A(e,r,i){let{spatialReference:a}=i;if(!a||!r||a.equals(r))return e;if(a.isGeographic&&r.isGeographic)return k(e,a,r);if(m(),!S)throw new t(`raster-projection-helper:project-dataset-resolution`,`geometry engine is not loaded`);let{x:o,y:s}=e,c=n(a),l=(o+s)/2*c,d=1;l>30&&(d=30/l,o*=d,s*=d);let f=o*256/2,p=s*256/2,{x:h,y:g}=i.center,_=[];for(let e=0;e<=256;e++)_.push([h-f,g-p+e*s]);for(let e=1;e<=256;e++)_.push([h-f+e*o,g+p]);for(let e=1;e<=256;e++)_.push([h+f,g+p-e*s]);for(let e=1;e<256;e++)_.push([h+f-e*o,g-p]);_.push(_[0]);let v=new u({rings:[_],spatialReference:a}),y=w.projectExecute(v,r);if(!y)return k(e,a,r);let b=y.extent,x=W(r);if(b==null||x!=null&&b.width>=x)return k(e,a,r);let C=$(y.rings),T=o*s*256*256,E=Math.sqrt(C/T)/d,D={x:b.width/d/256,y:b.height/d/256},O={x:o*E,y:s*E},A=D.x*D.y;return Math.abs(A-O.x*O.y)/A<.1?D:O}function j(e,t){return(typeof e==`number`?e:(e.x+e.y)/2)*n(t)*96*39.37}function M(e,t){let{pixelSize:n,extent:r}=e;return j(A(n,t,r),t)}function N(e,t=.01){return n(e)?t/n(e):0}function P(e,t,n,r=!0){let i=e.spatialReference;if(i.equals(t))return e;m();let a=w.projectExecute(e,t,{geographicTransformation:n});return!r||!a||F([e],[a],i,t),a}function F(e,t,n,r){let i=G(n,!0),a=G(r,!0),o=N(n,500),s=N(r,500);if(o&&i!=null&&a!=null)for(let n=0;n<e.length;n++){let r=t[n];if(!r)continue;let{x:c}=e[n],{x:l}=r;l>=a[1]-s&&Math.abs(c-i[0])<o?r.x-=a[1]-a[0]:l<=a[0]+s&&Math.abs(c-i[1])<o&&(r.x+=a[1]-a[0])}}function I(e){let{inSR:t,outSR:n,preferPE:r}=e;if(t.equals(n)){let{points:t}=B(e,null);return t}return t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator?te(e):r&&(t.isGeographic||R(t)!=null)?ee(e):L(e)}function L(e){let{points:t}=B(e,null),{inSR:n,outSR:r,datumTransformation:i}=e,a=t.map(e=>new l(e[0],e[1],n)),o=w.projectExecuteMany(a,r,{geographicTransformation:i});return i&&F(a,o,n,r),o.map(e=>e?[e.x,e.y]:[NaN,NaN])}function ee(e){let{inSR:t,outSR:n,datumTransformation:r}=e,{points:o,mask:l}=B(e,R(t));if(!t.isGeographic){let e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,t.wkt2||t.wkt);s.projToGeog(e,o.length,o)}if(r!=null&&r.steps.length){let e,t=179.9955;if(n.isGeographic&&(e=o.map(([e])=>e>t?1:e<-179.9955?-1:0)),r.steps.forEach(e=>{let t=e.wkid?i.geogtran(e.wkid):i.fromString(a.PE_TYPE_GEOGTRAN,e.wkt);c.geogToGeog(t,o.length,o,null,e.isInverse?a.PE_TRANSFORM_2_TO_1:a.PE_TRANSFORM_1_TO_2)}),e)for(let n=0;n<o.length;n++){let r=e[n],i=o[n][0],a=i>t?1:i<-179.9955?-1:0;r&&a&&r!==a&&(o[n][0]=r>0?i+360:i-360)}}if(!n.isGeographic){let e=R(n,!0);ne(o,e!=null&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90]);let t=n.wkid?i.coordsys(n.wkid):i.fromString(n.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,n.wkt2||n.wkt);s.geogToProj(t,o.length,o)}let u=o;if(l&&o.length!==l.length){u=[];for(let e=0,t=0;e<l.length;e++)l[e]?u.push(o[t++]):u.push([NaN,NaN])}return u}function te(e){let{cols:t,rows:n,xres:r,yres:i,usePixelCenter:a,inSR:o,outSR:s}=e,{xmin:c,ymax:u}=e;a&&(c+=r/2,u-=i/2);let f=[],p=[],m=Math.max(t,n);for(let e=0;e<m;e++){let a=c+r*Math.min(t,e),m=u-i*Math.min(n,e),h=d(new l({x:a,y:m,spatialReference:o}),o,s);e<=t&&f.push(h.x),e<=n&&p.push(h.y)}let h=[];for(let e=0;e<t;e++)for(let t=0;t<n;t++)h.push([f[e],p[t]]);return h}function R(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),b.has(n)){let e=b.get(n);return t?e?.gcs:e?.pcs}let r=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,e.wkt2||e.wkt),o=z(r,N(e,1e-4)),s=z(r,0,!0);return b.set(n,{pcs:o,gcs:s}),t?s:o}function z(e,t=0,n=!1){let r=o.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!r||!i?.length)return null;let a=!1,s=i.find(e=>e.getInclusive()===1&&e.getKind()===1);if(!s){if(s=i.find(e=>e.getInclusive()===1&&e.getKind()===0),!s)return null;a=!0}let c=n?0:+(r.getNorthPoleLocation()===2)|(r.getSouthPoleLocation()===2?2:0),l=r.isPannableRectangle(),u=s.getCoord();if(a)return{isEnvelope:a,isPannable:l,vertices:u,coef:null,bbox:[u[0][0]-t,u[0][1]-t,u[1][0]+t,u[1][1]+t],poleLocation:c};let d=0,f=[],[p,m]=u[0],[h,g]=u[0];for(let e=0,t=u.length;e<t;e++){d++,d===t&&(d=0);let[n,r]=u[e],[i,a]=u[d];if(a===r)f.push([n,i,r,a,2]);else{let e=(i-n)/(a-r||1e-4),t=n-e*r;r<a?f.push([e,t,r,a,0]):f.push([e,t,a,r,1])}p=p<n?p:n,m=m<r?m:r,h=h>n?h:n,g=g>r?g:r}return{isEnvelope:!1,isPannable:l,vertices:u,coef:f,bbox:[p,m,h,g],poleLocation:c}}function B(e,t){let n=[],{cols:r,rows:i,xres:a,yres:o,usePixelCenter:s}=e,{xmin:c,ymax:l}=e;if(s&&(c+=a/2,l-=o/2),t==null){for(let e=0;e<r;e++)for(let t=0;t<i;t++)n.push([c+a*e,l-o*t]);return{points:n}}let u=new Uint8Array(r*i);if(t.isEnvelope){let{isPannable:e,bbox:[s,d,f,p]}=t;for(let t=0,m=0;t<r;t++){let r=c+a*t,h=e||r>=s&&r<=f;for(let e=0;e<i;e++,m++){let t=l-o*e;h&&t>=d&&t<=p&&(n.push([r,t]),u[m]=1)}}return{points:n,mask:u}}let d=t.coef,f=[];for(let e=0;e<i;e++){let t=l-o*e,n=[],r=[];for(let e=0;e<d.length;e++){let[i,a,o,s,c]=d[e];if(t===o&&o===s)n.push(i),n.push(a),r.push(2),r.push(2);else if(t>=o&&t<=s){let e=i*t+a;n.push(e),r.push(c)}}let i=n;if(n.length>2){let e=r[0]===2?0:r[0],t=n[0];i=[];for(let a=1;a<r.length;a++)(r[a]!==2||a===r.length-1)&&(r[a]!==e&&(i.push(e===0?Math.min(t,n[a-1]):Math.max(t,n[a-1])),e=r[a],t=n[a]),a===r.length-1&&i.push(r[a]===0?Math.min(t,n[a]):Math.max(t,n[a])));i.sort((e,t)=>e-t)}else n[0]>n[1]&&(i=[n[1],n[0]]);f.push(i)}for(let e=0,t=0;e<r;e++){let r=c+a*e;for(let e=0;e<i;e++,t++){let i=l-o*e,a=f[e];if(a.length===2)r>=a[0]&&r<=a[1]&&(n.push([r,i]),u[t]=1);else if(a.length>2){let e=!1;for(let t=0;t<a.length;t+=2)if(r>=a[t]&&r<=a[t+1]){e=!0;break}e&&(n.push([r,i]),u[t]=1)}}}return{points:n,mask:u}}function ne(e,t){let[n,r]=t;for(let t=0;t<e.length;t++){let i=e[t][1];(i<n||i>r)&&(e[t]=[NaN,NaN])}}function V(e,t){let n=W(e[0].spatialReference);if(e.length<2||n==null||(t??=N(e[0].spatialReference),e=e.filter(e=>e.width>t),e.length===1))return e[0];let{xmin:i,xmax:a,ymin:o,ymax:s}=e[0];for(let t=1;t<e.length;t++){let r=e[t];a=r.xmax+n*t,o=Math.min(o,r.ymin),s=Math.max(s,r.ymax)}return new r({xmin:i,xmax:a,ymin:o,ymax:s,spatialReference:e[0].spatialReference})}function H(t,n,i=null,a=!0){let o=t.spatialReference;if(o.equals(n)||!n)return t;let s=q(t),c=W(o,!0),l=W(n);if(s===0||c==null||l==null){let e=U(t,n,i,a);if(e&&c==null&&l!=null&&Math.abs(e.width-l)<N(n)&&w.projectIsLoaded()){let r=R(o);if(r!=null&&r.poleLocation===0&&t.width<(r.bbox[2]-r.bbox[0])/2)return ie(t,n)||e}return e}let u=t.clone().normalize();if(u.length===1&&t.xmax<c&&t.xmax-c/2>N(o)){let{xmin:e,xmax:n}=t;for(let i=0;i<=s;i++){let a=i===0?e:-c/2,l=i===s?n-c*i:c/2;u[i]=new r({xmin:a,xmax:l,ymin:t.ymin,ymax:t.ymax,spatialReference:o})}}let d=u.map(e=>U(e,n,i,a)).filter(e);return d.length===0?null:V(d)}function re(e,t,n){if(e.type===`extent`){let{xmin:t,ymin:n,xmax:r,ymax:i,spatialReference:a}=e;e=new u({rings:[[[t,i],[r,i],[r,n],[t,n],[t,i]]],spatialReference:a})}return e.spatialReference.equals(t)?e:(m(),w.projectExecute(e,t,{geographicTransformation:n}))}function ie(e,t){let n=W(t);if(n==null)return null;let{xmin:i,ymin:a,xmax:o,ymax:s}=e,c=e.spatialReference,l=new u({spatialReference:c,rings:[[[i,a],[o,a],[o,s],[i,s],[i,a]]]}),d=w.projectExecute(l,t);if(d.rings.length!==2||!d.rings[0].length||!d.rings[1].length)return null;let{rings:f}=d,p=N(c),m=new r({spatialReference:t});for(let e=0;e<2;e++){i=o=f[e][0][0],a=s=f[e][0][1];for(let t=0;t<f[e].length;t++)i=i>f[e][t][0]?f[e][t][0]:i,o=o<f[e][t][0]?f[e][t][0]:o,a=a>f[e][t][1]?f[e][t][1]:a,s=s<f[e][t][1]?f[e][t][1]:s;if(e===0)m.ymin=a,m.ymax=s,m.xmin=i,m.xmax=o;else if(m.ymin=Math.min(m.ymin,a),m.ymax=Math.max(m.ymax,s),Math.abs(o-n/2)<p)m.xmin=i,m.xmax+=n;else if(Math.abs(i+n/2)<p)m.xmax=o+n;else return null}return m}function U(e,t,n,r=!0,i=!0){let a=e.spatialReference;if(a.equals(t)||!t)return e;m();let o=w.projectExecute(e,t,{geographicTransformation:n});if(i&&t.isWebMercator&&o&&(o.ymax=Math.min(20037508.342787,o.ymax),o.ymin=Math.max(-20037508.342787,o.ymin),o.ymin>=o.ymax))return null;if(!r||!o)return o;let s=G(a,!0),c=G(t,!0);if(s==null||c==null)return o;let u=N(a,.001),d=N(a,500),f=N(t,.001);if(Math.abs(o.xmin-c[0])<f&&Math.abs(o.xmax-c[1])<f){let r=Math.abs(e.xmin-s[0]),i=Math.abs(s[1]-e.xmax);if(r<u&&i>d){o.xmin=c[0];let r=[];r.push(new l(e.xmax,e.ymin,a)),r.push(new l(e.xmax,(e.ymin+e.ymax)/2,a)),r.push(new l(e.xmax,e.ymax,a));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmax=Math.max.apply(null,i)}if(i<u&&r>d){o.xmax=c[1];let r=[];r.push(new l(e.xmin,e.ymin,a)),r.push(new l(e.xmin,(e.ymin+e.ymax)/2,a)),r.push(new l(e.xmin,e.ymax,a));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmin=Math.min.apply(null,i)}}else{let e=N(t,.001);Math.abs(o.xmin-c[0])<e&&(o.xmin=c[0]),Math.abs(o.xmax-c[1])<e&&(o.xmax=c[1])}return o}function W(e,t=!1){if(!e)return null;let n=t?20037508.342787:20037508.342788905;return e.isWebMercator?n*2:e.wkid&&e.isGeographic?360:g[e.wkid]*2||null}function G(e,t=!1){if(e.isGeographic)return[-180,180];let n=W(e,t);return n?[-n/2,n/2]:null}function K(e,t,n,r){let i=(e-t)/n;return i-Math.floor(i)===0?r&&--i:i=Math.floor(i),i}function q(e,t=!1){let n=W(e.spatialReference);if(n==null)return 0;let r=n/2,i=t?0:-r,a=N(e.spatialReference),o=!t&&Math.abs(e.xmax-n/2)<a?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<a?-n/2:e.xmin;return K(o,i,n,!0)-K(s,i,n,!1)}function ae(e){let t=e.storageInfo.origin.x,n=W(e.spatialReference,!0);if(n==null)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};let r=n/2,{nativePixelSize:i,storageInfo:a,extent:o}=e,{maximumPyramidLevel:s,blockWidth:c,pyramidScalingFactor:l}=a,u=i.x,d=[],f=e.transform!=null&&e.transform.type===`gcs-shift`,p=Math.max(0,t+(f?0:r));for(let e=0;e<=s;e++){let e=(o.xmax-t)/u/c,r=e-Math.floor(e)===0?e:Math.ceil(e),i=Math.round(p/u),a=Math.round(n/u)-i,s=Math.ceil(a/c),f=Math.floor(i/c),m=i%c,h=(c-a%c)%c;d.push({resolutionX:u,blockWidth:c,datasetColumnCount:r,worldColumnCountFromOrigin:s,leftMargin:m,rightPadding:h,originColumnOffset:f}),u*=l}return{originX:t,halfWorldWidth:r,pyramidsInfo:d,hasGCSSShiftTransform:f}}function oe(e){if(!e||e.isGeographic)return e;let t=String(e.wkid||e.wkt2||e.wkt),n;return x.has(t)?n=x.get(t):(n=(e.wkid?i.coordsys(e.wkid):i.fromString(a.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),x.set(t,n)),new f({wkid:n})}function se(e){let t=e.isAdaptive&&e.spacing==null,n=e.spacing||[32,32],r=J(e),i={cols:r.size[0]+1,rows:r.size[1]+1},a=r.outofBoundPointCount>0&&r.outofBoundPointCount<r.offsets.length/2,o=r.outofBoundPointCount===r.offsets.length/2||t&&a?[0,0]:h(r.offsets,i,n,4),s=(o[0]+o[1])/2,c=e.projectedExtent.spatialReference,l=e.srcBufferExtent.spatialReference;if(t&&(a||s>4)&&(c.isGeographic||R(c),n=[4,4],r=J({...e,spacing:n}),i={cols:r.size[0]+1,rows:r.size[1]+1},o=h(r.offsets,i,n,4)),r.error=o,n[0]>1&&(r.coefficients=Y(r.offsets,i,a)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator){if(l.isGeographic)r.gcsGrid={offsets:r.offsets,coefficients:r.coefficients,spacing:n};else{let t=R(c);if(t!=null&&!t.isEnvelope){let t=oe(c),o=H(e.projectedExtent,t),{offsets:s}=J({...e,srcBufferExtent:o,spacing:n}),l=Y(s,i,a);r.gcsGrid={offsets:s,coefficients:l,spacing:n}}}}return r}function J(e){let{projectedExtent:t,srcBufferExtent:n,pixelSize:r,datumTransformation:i,rasterTransform:a}=e,o=t.spatialReference,s=n.spatialReference;m();let{xmin:c,ymin:u,xmax:d,ymax:f}=t,p=W(s),h=p!=null&&(e.hasWrapAround||a?.type===`gcs-shift`),g=e.spacing||[32,32],_=g[0]*r.x,v=g[1]*r.y,y=g[0]===1,b=Math.ceil((d-c)/_-.1/g[0])+ +!y,x=Math.ceil((f-u)/v-.1/g[1])+ +!y,S=I({cols:b,rows:x,xmin:c,ymax:f,xres:_,yres:v,inSR:o,outSR:s,datumTransformation:i,preferPE:g[0]<=4,usePixelCenter:y}),C=[],w,T=0,E=y?-1:NaN,{xmin:D,xmax:O,ymax:k,width:A,height:j}=n,M=N(s,500),P=p!=null&&D>0&&O>p/2,F=R(o),L=F!=null&&F.poleLocation>0;for(let e=0;e<b;e++){let t=[];for(let n=0;n<x;n++){let r=S[e*x+n];if(h&&r[0]>O&&r[0]>p/2-M?r[0]-=p:h&&e===0&&r[0]<0&&P&&!a&&(r[0]+=p),!r||isNaN(r[0])||isNaN(r[1]))C.push(E),C.push(E),t.push(null),T++;else{if(a){let e=a.inverseTransform(new l({x:r[0],y:r[1],spatialReference:s}));r=[e.x,e.y]}t.push(r),e>0&&h&&w[n]&&r[0]<w[n][0]&&(r[0]+=p,L&&r[0]>O&&r[0]>p&&(r[0]-=p)),C.push((r[0]-D)/A),C.push((k-r[1])/j)}}w=t}return{offsets:C,error:null,coefficients:null,outofBoundPointCount:T,spacing:g,size:y?[b,x]:[b-1,x-1]}}function Y(e,t,n){let{cols:r,rows:i}=t,a=new Float32Array((r-1)*(i-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),s=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let t=0;t<r-1;t++){for(let n=0;n<i-1;n++){let c=t*i*2+n*2,l=e[c],u=e[c+1],d=e[c+2],f=e[c+3];c+=i*2;let p=e[c],m=e[c+1],h=e[c+2],g=e[c+3],_=0,v=(n*(r-1)+t)*12;for(let e=0;e<3;e++)a[v++]=o[_++]*l+o[_++]*d+o[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=o[_++]*u+o[_++]*f+o[_++]*g;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*l+s[_++]*p+s[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*u+s[_++]*m+s[_++]*g}if(n)for(let e=0;e<a.length;e++)isNaN(a[e])&&(a[e]=-1)}return a}function X(e,t){let n=e.clone().normalize();return n.length===1?n[0]:V(n,t)}function ce(e){let{spatialReference:t}=e,n=p(t);if(!n)return e;let[i,a]=n.valid,o=a-i,s=0;if(e.xmin<i){let t=i-e.xmin;s=Math.ceil(t/o)}else if(e.xmin>a){let t=e.xmin-a;s=-Math.ceil(t/o)}return new r({spatialReference:e.spatialReference,xmin:e.xmin+s*o,ymin:e.ymin,xmax:e.xmax+s*o,ymax:e.ymax})}function le(e,t,r){let{storageInfo:i,pixelSize:a}=t,o=0,s=!1,{pyramidResolutions:c}=i,u=i.tileInfo.format?.toLowerCase()===`mixed`?Math.max(1,Math.min(3,i.tileInfo.dpi/96)):1,d=(e.x+e.y)/2/u;if(c!=null&&c.length){let e=c[c.length-1],i=(e.x+e.y)/2,u=(a.x+a.y)/2;if(d<=u)o=0;else if(d>=i)o=c.length,s=d/i>8;else{let e=u,t;for(let n=1;n<=c.length;n++){if(t=(c[n-1].x+c[n-1].y)/2,d<=t){d===t?o=n:r===`down`?(o=n-1,s=d/e>8):o=r===`up`||d-e>t-d||d/e>2?n:n-1;break}e=t}}let f=o===0?a:c[o-1];return s&&Math.min(f.x,f.y)*n(t.spatialReference)>19567&&(s=!1),{pyramidLevel:o,pyramidResolution:new l({x:f.x,y:f.y,spatialReference:t.spatialReference}),excessiveReading:s}}let f=Math.log(e.x/a.x)/Math.LN2,p=Math.log(e.y/a.y)/Math.LN2,m=t.storageInfo.maximumPyramidLevel||0;o=r===`down`?Math.floor(Math.min(f,p)):r===`up`?Math.ceil(Math.max(f,p)):Math.round((f+p)/2),o<0?o=0:o>m&&(s=o>m+3,o=m);let h=2**o,g=new l({x:h*t.nativePixelSize.x,y:h*t.nativePixelSize.y,spatialReference:t.spatialReference});return{pyramidLevel:o,pyramidResolution:g,excessiveReading:s}}function Z(e,t,n=!1){let{pixelSize:r,extent:i}=e,a=D(i,t,!1),o=H(X(i,(r.x+r.y)/16),t,a);return!o||n||q(o)===0?o:U(i,t,a)}function ue(e,t,n){let r=n?.tileSize??512,i=n?.alignGlobalDatasetWithAGOL??!0,a=!!n?.limitToSrcResolution,{extent:o,pixelSize:s}=e,c=A(s,t,o);if(c==null)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};let l=(c.x+c.y)/2,u=j(l,t),d=256/r,f=t.isGeographic?295828763.7958547*d:591657527.591555*d,p=(t.isGeographic?.703125:156543.03392800014)*d,m=e.dataType===`vector-magdir`||e.dataType===`vector-uv`,h=Z(e,t,!0),g=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(f/2/u)/Math.LN2));if(!m&&h&&i&&(t.isGeographic||t.isWebMercator)){let n=W(t);if(m=q(h)>0||n!=null&&h.width>n/4,!m&&n!=null){let t=-1;if(g<3)t=2**g*l*r;else if(e.storageInfo){let{maximumPyramidLevel:n=0,pyramidScalingFactor:i=2}=e.storageInfo;t=i**n*l*r}let i=Math.ceil(n/t);m=i===1||i===2&&n/2-h.xmax<t}}let _=u,v,y=1.001,b=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(m){_=f;let n=Q(e,t);v={x:n.x*p,y:n.y*p}}else{v={x:s.x,y:s.y};let e=0;for(;_<y/2*f&&e<g;)e++,_*=b,v.x*=b,v.y*=b;Math.max(_,f)/Math.min(_,f)<=y&&(_=f)}let x=[_],S=[{x:v.x,y:v.y}],C=Math.min(70.5310735,u)/y;for(;_>=C;)_/=b,v.x/=b,v.y/=b,x.push(_),S.push({x:v.x,y:v.y});if(a){let e=s.x*.001,t=S.findIndex(t=>t.x>=s.x-e&&t.x<=s.x+e);t>-1?(S.length=t+1,x.length=t+1):(t=S.findIndex(t=>t.x<=s.x+e),t>0&&(S.length=t,x.length=t))}return{projectedPixelSize:c,scales:x,srcResolutions:S,isCustomTilingScheme:!m}}function Q(e,t){if(t.isWGS84||t.isWebMercator){let n=t.isGeographic?1341104507446289e-21:.29858214164761665,r=t.isGeographic?4326:3857,i=Z(e,new f({wkid:r}),!0),a=A({x:n,y:n},e.spatialReference,i);return{x:a.x/n,y:a.y/n}}let n=A(e.pixelSize,t,e.extent),r=(n.x+n.y)/2;return{x:e.pixelSize.x/r,y:e.pixelSize.y/r}}function de(e,t){let{spatialReference:n,lods:r}=t,{x:i,y:a}=Q(e,n);return r.map(({resolution:e})=>({x:e*i,y:e*a}))}function $(e){let t=0;for(let n of e){let e=n.length,r=n[0][0]*(n[1][1]-n[e-2][1]);for(let t=1;t<e-1;t++)r+=n[t][0]*(n[t+1][1]-n[t-1][1]);t+=r/2}return Math.abs(t)}export{$ as calculateArea2D,ue as computeProjectedScales,Q as computeSrcResolutionRatio,de as computeSrcResolutions,_ as defaultGridSpacing,y as defaultProjectionToleranceInPixels,D as getDefaultDatumTransformationForDataset,I as getProjectedGridPoints,se as getProjectionOffsetGrid,ae as getRasterDatasetAlignmentInfo,M as getSourceScale,W as getWorldWidth,q as getWorldWrapCount,E as load,v as minimumGridSpacing,Z as projectDatasetExtent,A as projectDatasetResolution,H as projectExtent,P as projectPoint,re as projectPolygon,O as projectResolution,ce as shiftExtent,X as snapExtent,le as snapPyramid};
2
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{getMetersPerUnitForSR as n}from"../../../core/units.js";import r from"../../../geometry/Extent.js";import{P as i,a,b as o,c as s,d as c}from"../../../chunks/pe.js";import l from"../../../geometry/Point.js";import u from"../../../geometry/Polygon.js";import{projectWithoutEngine as d}from"../../../geometry/projectionUtils.js";import f from"../../../geometry/SpatialReference.js";import{getInfo as p}from"../../../geometry/support/spatialReferenceUtils.js";function m(){if(!S)throw new t(`rasterprojectionhelper-project`,`projection operator is not loaded`)}const h=(e,t,n,r=0)=>{if(n[0]===1)return[0,0];let i=1,a=-1,o=1,s=-1;for(let t=0;t<e.length;t+=2)isNaN(e[t])||(i=i>e[t]?e[t]:i,a=a>e[t]?a:e[t],o=o>e[t+1]?e[t+1]:o,s=s>e[t+1]?s:e[t+1]);let{cols:c,rows:l}=t,u=(a-i)/c/n[0],d=(s-o)/l/n[1],f=r*2,p=0,m=!1,h=[0,0];for(let t=0;t<c-3;t++){for(let n=0;n<l-3;n++){let r=t*l*2+n*2,i=(e[r]+e[r+4]+e[r+l*4]+e[r+l*4+4])/4,a=(e[r+1]+e[r+5]+e[r+l*4+1]+e[r+l*4+5])/4,o=Math.abs((i-e[r+l*2+2])/u),s=Math.abs((a-e[r+l*2+3])/d);if(o+s>p&&(p=o+s,h=[o,s]),f&&p>f){m=!0;break}}if(m)break}return h},g={3395:20037508.342789244,3410:17334193.943686873,3857:20037508.342788905,3975:17367530.445161372,4087:20037508.342789244,4088:20015108.787169147,6933:17367530.445161372,32662:20037508.342789244,53001:20015086.79602057,53002:10007543.39801029,53003:20015086.79602057,53004:20015086.79602057,53016:14152803.599503474,53017:17333573.624304302,53034:20015086.79602057,53079:20015114.352186374,53080:20015114.352186374,54001:20037508.342789244,54002:10018754.171394624,54003:20037508.342789244,54004:20037508.342789244,54016:14168658.027268292,54017:17367530.44516137,54034:20037508.342789244,54079:20037508.342789244,54080:20037508.342789244,54100:20037508.342789244,54101:20037508.342789244},_=32,v=4,y=4,b=new Map,x=new Map;let S=!1,C,w,T;async function E(){return C||(C=Promise.withResolvers(),w=await import(`../../../geometry/operators/projectOperator.js`),T=await import(`../../../geometry/operators/support/geographicTransformationUtils.js`),w.projectIsLoaded()||await w.projectLoad(),T.isLoaded()||await T.load(),S=!0,C.resolve()),C.promise}function D(e,t,n){if(m(),n){let n=w.projectExecute(e,t);return T.getTransformation(t,e.spatialReference,n)}return T.getTransformation(e.spatialReference,t,e)}function O(e,t,n,i){let a=e.spatialReference;if(!a||!t||a.equals(t))return e;m();let o=n.center,s=new r({xmin:o.x-e.x/2,xmax:o.x+e.x/2,ymin:o.y-e.y/2,ymax:o.y+e.y/2,spatialReference:a}),c=w.projectExecute(s,t,{geographicTransformation:i}),l=W(t);return c==null||l!=null&&c.width>=l?k(e,a,t):{x:c.width,y:c.height}}function k(e,t,r){let i=n(t)/n(r);return{x:e.x*i,y:e.y*i}}function A(e,r,i){let{spatialReference:a}=i;if(!a||!r||a.equals(r))return e;if(a.isGeographic&&r.isGeographic)return k(e,a,r);if(m(),!S)throw new t(`raster-projection-helper:project-dataset-resolution`,`geometry engine is not loaded`);let{x:o,y:s}=e,c=n(a),l=(o+s)/2*c,d=1;l>30&&(d=30/l,o*=d,s*=d);let f=o*256/2,p=s*256/2,{x:h,y:g}=i.center,_=[];for(let e=0;e<=256;e++)_.push([h-f,g-p+e*s]);for(let e=1;e<=256;e++)_.push([h-f+e*o,g+p]);for(let e=1;e<=256;e++)_.push([h+f,g+p-e*s]);for(let e=1;e<256;e++)_.push([h+f-e*o,g-p]);_.push(_[0]);let v=new u({rings:[_],spatialReference:a}),y=w.projectExecute(v,r);if(!y)return k(e,a,r);let b=y.extent,x=W(r);if(b==null||x!=null&&b.width>=x)return k(e,a,r);let C=$(y.rings),T=o*s*256*256,E=Math.sqrt(C/T)/d,D={x:b.width/d/256,y:b.height/d/256},O={x:o*E,y:s*E},A=D.x*D.y;return Math.abs(A-O.x*O.y)/A<.1?D:O}function j(e,t){return(typeof e==`number`?e:(e.x+e.y)/2)*n(t)*96*39.37}function M(e,t){let{pixelSize:n,extent:r}=e;return j(A(n,t,r),t)}function N(e,t=.01){return n(e)?t/n(e):0}function P(e,t,n,r=!0){let i=e.spatialReference;if(i.equals(t))return e;m();let a=w.projectExecute(e,t,{geographicTransformation:n});return!r||!a||F([e],[a],i,t),a}function F(e,t,n,r){let i=G(n,!0),a=G(r,!0),o=N(n,500),s=N(r,500);if(o&&i!=null&&a!=null)for(let n=0;n<e.length;n++){let r=t[n];if(!r)continue;let{x:c}=e[n],{x:l}=r;l>=a[1]-s&&Math.abs(c-i[0])<o?r.x-=a[1]-a[0]:l<=a[0]+s&&Math.abs(c-i[1])<o&&(r.x+=a[1]-a[0])}}function I(e){let{inSR:t,outSR:n,preferPE:r}=e;if(t.equals(n)){let{points:t}=B(e,null);return t}return t.isWebMercator&&n.isWGS84||t.isWGS84&&n.isWebMercator?te(e):r&&(t.isGeographic||R(t)!=null)?ee(e):L(e)}function L(e){let{points:t}=B(e,null),{inSR:n,outSR:r,datumTransformation:i}=e,a=t.map(e=>new l({x:e[0],y:e[1],spatialReference:n})),o=w.projectExecuteMany(a,r,{geographicTransformation:i});return i&&F(a,o,n,r),o.map(e=>e?[e.x,e.y]:[NaN,NaN])}function ee(e){let{inSR:t,outSR:n,datumTransformation:r}=e,{points:o,mask:l}=B(e,R(t));if(!t.isGeographic){let e=t.wkid?i.coordsys(t.wkid):i.fromString(t.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,t.wkt2||t.wkt);s.projToGeog(e,o.length,o)}if(r!=null&&r.steps.length){let e,t=179.9955;if(n.isGeographic&&(e=o.map(([e])=>e>t?1:e<-179.9955?-1:0)),r.steps.forEach(e=>{let t=e.wkid?i.geogtran(e.wkid):i.fromString(a.PE_TYPE_GEOGTRAN,e.wkt);c.geogToGeog(t,o.length,o,null,e.isInverse?a.PE_TRANSFORM_2_TO_1:a.PE_TRANSFORM_1_TO_2)}),e)for(let n=0;n<o.length;n++){let r=e[n],i=o[n][0],a=i>t?1:i<-179.9955?-1:0;r&&a&&r!==a&&(o[n][0]=r>0?i+360:i-360)}}if(!n.isGeographic){let e=R(n,!0);ne(o,e!=null&&e.isEnvelope?[e.bbox[1],e.bbox[3]]:[-90,90]);let t=n.wkid?i.coordsys(n.wkid):i.fromString(n.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,n.wkt2||n.wkt);s.geogToProj(t,o.length,o)}let u=o;if(l&&o.length!==l.length){u=[];for(let e=0,t=0;e<l.length;e++)l[e]?u.push(o[t++]):u.push([NaN,NaN])}return u}function te(e){let{cols:t,rows:n,xres:r,yres:i,usePixelCenter:a,inSR:o,outSR:s}=e,{xmin:c,ymax:u}=e;a&&(c+=r/2,u-=i/2);let f=[],p=[],m=Math.max(t,n);for(let e=0;e<m;e++){let a=c+r*Math.min(t,e),m=u-i*Math.min(n,e),h=d(new l({x:a,y:m,spatialReference:o}),o,s);e<=t&&f.push(h.x),e<=n&&p.push(h.y)}let h=[];for(let e=0;e<t;e++)for(let t=0;t<n;t++)h.push([f[e],p[t]]);return h}function R(e,t=!1){let n=e.wkid||e.wkt2||e.wkt;if(!n||e.isGeographic)return null;if(n=String(n),b.has(n)){let e=b.get(n);return t?e?.gcs:e?.pcs}let r=e.wkid?i.coordsys(e.wkid):i.fromString(e.isGeographic?a.PE_TYPE_GEOGCS:a.PE_TYPE_PROJCS,e.wkt2||e.wkt),o=z(r,N(e,1e-4)),s=z(r,0,!0);return b.set(n,{pcs:o,gcs:s}),t?s:o}function z(e,t=0,n=!1){let r=o.generate(e),i=n?e.horizonGcsGenerate():e.horizonPcsGenerate();if(!r||!i?.length)return null;let a=!1,s=i.find(e=>e.getInclusive()===1&&e.getKind()===1);if(!s){if(s=i.find(e=>e.getInclusive()===1&&e.getKind()===0),!s)return null;a=!0}let c=n?0:+(r.getNorthPoleLocation()===2)|(r.getSouthPoleLocation()===2?2:0),l=r.isPannableRectangle(),u=s.getCoord();if(a)return{isEnvelope:a,isPannable:l,vertices:u,coef:null,bbox:[u[0][0]-t,u[0][1]-t,u[1][0]+t,u[1][1]+t],poleLocation:c};let d=0,f=[],[p,m]=u[0],[h,g]=u[0];for(let e=0,t=u.length;e<t;e++){d++,d===t&&(d=0);let[n,r]=u[e],[i,a]=u[d];if(a===r)f.push([n,i,r,a,2]);else{let e=(i-n)/(a-r||1e-4),t=n-e*r;r<a?f.push([e,t,r,a,0]):f.push([e,t,a,r,1])}p=p<n?p:n,m=m<r?m:r,h=h>n?h:n,g=g>r?g:r}return{isEnvelope:!1,isPannable:l,vertices:u,coef:f,bbox:[p,m,h,g],poleLocation:c}}function B(e,t){let n=[],{cols:r,rows:i,xres:a,yres:o,usePixelCenter:s}=e,{xmin:c,ymax:l}=e;if(s&&(c+=a/2,l-=o/2),t==null){for(let e=0;e<r;e++)for(let t=0;t<i;t++)n.push([c+a*e,l-o*t]);return{points:n}}let u=new Uint8Array(r*i);if(t.isEnvelope){let{isPannable:e,bbox:[s,d,f,p]}=t;for(let t=0,m=0;t<r;t++){let r=c+a*t,h=e||r>=s&&r<=f;for(let e=0;e<i;e++,m++){let t=l-o*e;h&&t>=d&&t<=p&&(n.push([r,t]),u[m]=1)}}return{points:n,mask:u}}let d=t.coef,f=[];for(let e=0;e<i;e++){let t=l-o*e,n=[],r=[];for(let e=0;e<d.length;e++){let[i,a,o,s,c]=d[e];if(t===o&&o===s)n.push(i),n.push(a),r.push(2),r.push(2);else if(t>=o&&t<=s){let e=i*t+a;n.push(e),r.push(c)}}let i=n;if(n.length>2){let e=r[0]===2?0:r[0],t=n[0];i=[];for(let a=1;a<r.length;a++)(r[a]!==2||a===r.length-1)&&(r[a]!==e&&(i.push(e===0?Math.min(t,n[a-1]):Math.max(t,n[a-1])),e=r[a],t=n[a]),a===r.length-1&&i.push(r[a]===0?Math.min(t,n[a]):Math.max(t,n[a])));i.sort((e,t)=>e-t)}else n[0]>n[1]&&(i=[n[1],n[0]]);f.push(i)}for(let e=0,t=0;e<r;e++){let r=c+a*e;for(let e=0;e<i;e++,t++){let i=l-o*e,a=f[e];if(a.length===2)r>=a[0]&&r<=a[1]&&(n.push([r,i]),u[t]=1);else if(a.length>2){let e=!1;for(let t=0;t<a.length;t+=2)if(r>=a[t]&&r<=a[t+1]){e=!0;break}e&&(n.push([r,i]),u[t]=1)}}}return{points:n,mask:u}}function ne(e,t){let[n,r]=t;for(let t=0;t<e.length;t++){let i=e[t][1];(i<n||i>r)&&(e[t]=[NaN,NaN])}}function V(e,t){let n=W(e[0].spatialReference);if(e.length<2||n==null||(t??=N(e[0].spatialReference),e=e.filter(e=>e.width>t),e.length===1))return e[0];let{xmin:i,xmax:a,ymin:o,ymax:s}=e[0];for(let t=1;t<e.length;t++){let r=e[t];a=r.xmax+n*t,o=Math.min(o,r.ymin),s=Math.max(s,r.ymax)}return new r({xmin:i,xmax:a,ymin:o,ymax:s,spatialReference:e[0].spatialReference})}function H(t,n,i=null,a=!0){let o=t.spatialReference;if(o.equals(n)||!n)return t;let s=q(t),c=W(o,!0),l=W(n);if(s===0||c==null||l==null){let e=U(t,n,i,a);if(e&&c==null&&l!=null&&Math.abs(e.width-l)<N(n)&&w.projectIsLoaded()){let r=R(o);if(r!=null&&r.poleLocation===0&&t.width<(r.bbox[2]-r.bbox[0])/2)return ie(t,n)||e}return e}let u=t.clone().normalize();if(u.length===1&&t.xmax<c&&t.xmax-c/2>N(o)){let{xmin:e,xmax:n}=t;for(let i=0;i<=s;i++){let a=i===0?e:-c/2,l=i===s?n-c*i:c/2;u[i]=new r({xmin:a,xmax:l,ymin:t.ymin,ymax:t.ymax,spatialReference:o})}}let d=u.map(e=>U(e,n,i,a)).filter(e);return d.length===0?null:V(d)}function re(e,t,n){if(e.type===`extent`){let{xmin:t,ymin:n,xmax:r,ymax:i,spatialReference:a}=e;e=new u({rings:[[[t,i],[r,i],[r,n],[t,n],[t,i]]],spatialReference:a})}return e.spatialReference.equals(t)?e:(m(),w.projectExecute(e,t,{geographicTransformation:n}))}function ie(e,t){let n=W(t);if(n==null)return null;let{xmin:i,ymin:a,xmax:o,ymax:s}=e,c=e.spatialReference,l=new u({spatialReference:c,rings:[[[i,a],[o,a],[o,s],[i,s],[i,a]]]}),d=w.projectExecute(l,t);if(d.rings.length!==2||!d.rings[0].length||!d.rings[1].length)return null;let{rings:f}=d,p=N(c),m=new r({spatialReference:t});for(let e=0;e<2;e++){i=o=f[e][0][0],a=s=f[e][0][1];for(let t=0;t<f[e].length;t++)i=i>f[e][t][0]?f[e][t][0]:i,o=o<f[e][t][0]?f[e][t][0]:o,a=a>f[e][t][1]?f[e][t][1]:a,s=s<f[e][t][1]?f[e][t][1]:s;if(e===0)m.ymin=a,m.ymax=s,m.xmin=i,m.xmax=o;else if(m.ymin=Math.min(m.ymin,a),m.ymax=Math.max(m.ymax,s),Math.abs(o-n/2)<p)m.xmin=i,m.xmax+=n;else if(Math.abs(i+n/2)<p)m.xmax=o+n;else return null}return m}function U(e,t,n,r=!0,i=!0){let a=e.spatialReference;if(a.equals(t)||!t)return e;m();let o=w.projectExecute(e,t,{geographicTransformation:n});if(i&&t.isWebMercator&&o&&(o.ymax=Math.min(20037508.342787,o.ymax),o.ymin=Math.max(-20037508.342787,o.ymin),o.ymin>=o.ymax))return null;if(!r||!o)return o;let s=G(a,!0),c=G(t,!0);if(s==null||c==null)return o;let u=N(a,.001),d=N(a,500),f=N(t,.001);if(Math.abs(o.xmin-c[0])<f&&Math.abs(o.xmax-c[1])<f){let r=Math.abs(e.xmin-s[0]),i=Math.abs(s[1]-e.xmax);if(r<u&&i>d){o.xmin=c[0];let r=[];r.push(new l({x:e.xmax,y:e.ymin,spatialReference:a})),r.push(new l({x:e.xmax,y:(e.ymin+e.ymax)/2,spatialReference:a})),r.push(new l({x:e.xmax,y:e.ymax,spatialReference:a}));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmax=Math.max.apply(null,i)}if(i<u&&r>d){o.xmax=c[1];let r=[];r.push(new l({x:e.xmin,y:e.ymin,spatialReference:a})),r.push(new l({x:e.xmin,y:(e.ymin+e.ymax)/2,spatialReference:a})),r.push(new l({x:e.xmin,y:e.ymax,spatialReference:a}));let i=r.map(e=>P(e,t,n)).filter(e=>!isNaN(e?.x)).map(e=>e.x);o.xmin=Math.min.apply(null,i)}}else{let e=N(t,.001);Math.abs(o.xmin-c[0])<e&&(o.xmin=c[0]),Math.abs(o.xmax-c[1])<e&&(o.xmax=c[1])}return o}function W(e,t=!1){if(!e)return null;let n=t?20037508.342787:20037508.342788905;return e.isWebMercator?n*2:e.wkid&&e.isGeographic?360:g[e.wkid]*2||null}function G(e,t=!1){if(e.isGeographic)return[-180,180];let n=W(e,t);return n?[-n/2,n/2]:null}function K(e,t,n,r){let i=(e-t)/n;return i-Math.floor(i)===0?r&&--i:i=Math.floor(i),i}function q(e,t=!1){let n=W(e.spatialReference);if(n==null)return 0;let r=n/2,i=t?0:-r,a=N(e.spatialReference),o=!t&&Math.abs(e.xmax-n/2)<a?n/2:e.xmax,s=!t&&Math.abs(e.xmin+n/2)<a?-n/2:e.xmin;return K(o,i,n,!0)-K(s,i,n,!1)}function ae(e){let t=e.storageInfo.origin.x,n=W(e.spatialReference,!0);if(n==null)return{originX:t,halfWorldWidth:null,pyramidsInfo:null};let r=n/2,{nativePixelSize:i,storageInfo:a,extent:o}=e,{maximumPyramidLevel:s,blockWidth:c,pyramidScalingFactor:l}=a,u=i.x,d=[],f=e.transform!=null&&e.transform.type===`gcs-shift`,p=Math.max(0,t+(f?0:r));for(let e=0;e<=s;e++){let e=(o.xmax-t)/u/c,r=e-Math.floor(e)===0?e:Math.ceil(e),i=Math.round(p/u),a=Math.round(n/u)-i,s=Math.ceil(a/c),f=Math.floor(i/c),m=i%c,h=(c-a%c)%c;d.push({resolutionX:u,blockWidth:c,datasetColumnCount:r,worldColumnCountFromOrigin:s,leftMargin:m,rightPadding:h,originColumnOffset:f}),u*=l}return{originX:t,halfWorldWidth:r,pyramidsInfo:d,hasGCSSShiftTransform:f}}function oe(e){if(!e||e.isGeographic)return e;let t=String(e.wkid||e.wkt2||e.wkt),n;return x.has(t)?n=x.get(t):(n=(e.wkid?i.coordsys(e.wkid):i.fromString(a.PE_TYPE_PROJCS,e.wkt2||e.wkt)).getGeogcs().getCode(),x.set(t,n)),new f({wkid:n})}function se(e){let t=e.isAdaptive&&e.spacing==null,n=e.spacing||[32,32],r=J(e),i={cols:r.size[0]+1,rows:r.size[1]+1},a=r.outofBoundPointCount>0&&r.outofBoundPointCount<r.offsets.length/2,o=r.outofBoundPointCount===r.offsets.length/2||t&&a?[0,0]:h(r.offsets,i,n,4),s=(o[0]+o[1])/2,c=e.projectedExtent.spatialReference,l=e.srcBufferExtent.spatialReference;if(t&&(a||s>4)&&(c.isGeographic||R(c),n=[4,4],r=J({...e,spacing:n}),i={cols:r.size[0]+1,rows:r.size[1]+1},o=h(r.offsets,i,n,4)),r.error=o,n[0]>1&&(r.coefficients=Y(r.offsets,i,a)),e.includeGCSGrid&&!c.isGeographic&&!c.isWebMercator){if(l.isGeographic)r.gcsGrid={offsets:r.offsets,coefficients:r.coefficients,spacing:n};else{let t=R(c);if(t!=null&&!t.isEnvelope){let t=oe(c),o=H(e.projectedExtent,t),{offsets:s}=J({...e,srcBufferExtent:o,spacing:n}),l=Y(s,i,a);r.gcsGrid={offsets:s,coefficients:l,spacing:n}}}}return r}function J(e){let{projectedExtent:t,srcBufferExtent:n,pixelSize:r,datumTransformation:i,rasterTransform:a}=e,o=t.spatialReference,s=n.spatialReference;m();let{xmin:c,ymin:u,xmax:d,ymax:f}=t,p=W(s),h=p!=null&&(e.hasWrapAround||a?.type===`gcs-shift`),g=e.spacing||[32,32],_=g[0]*r.x,v=g[1]*r.y,y=g[0]===1,b=Math.ceil((d-c)/_-.1/g[0])+ +!y,x=Math.ceil((f-u)/v-.1/g[1])+ +!y,S=I({cols:b,rows:x,xmin:c,ymax:f,xres:_,yres:v,inSR:o,outSR:s,datumTransformation:i,preferPE:g[0]<=4,usePixelCenter:y}),C=[],w,T=0,E=y?-1:NaN,{xmin:D,xmax:O,ymax:k,width:A,height:j}=n,M=N(s,500),P=p!=null&&D>0&&O>p/2,F=R(o),L=F!=null&&F.poleLocation>0;for(let e=0;e<b;e++){let t=[];for(let n=0;n<x;n++){let r=S[e*x+n];if(h&&r[0]>O&&r[0]>p/2-M?r[0]-=p:h&&e===0&&r[0]<0&&P&&!a&&(r[0]+=p),!r||isNaN(r[0])||isNaN(r[1]))C.push(E),C.push(E),t.push(null),T++;else{if(a){let e=a.inverseTransform(new l({x:r[0],y:r[1],spatialReference:s}));r=[e.x,e.y]}t.push(r),e>0&&h&&w[n]&&r[0]<w[n][0]&&(r[0]+=p,L&&r[0]>O&&r[0]>p&&(r[0]-=p)),C.push((r[0]-D)/A),C.push((k-r[1])/j)}}w=t}return{offsets:C,error:null,coefficients:null,outofBoundPointCount:T,spacing:g,size:y?[b,x]:[b-1,x-1]}}function Y(e,t,n){let{cols:r,rows:i}=t,a=new Float32Array((r-1)*(i-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),s=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let t=0;t<r-1;t++){for(let n=0;n<i-1;n++){let c=t*i*2+n*2,l=e[c],u=e[c+1],d=e[c+2],f=e[c+3];c+=i*2;let p=e[c],m=e[c+1],h=e[c+2],g=e[c+3],_=0,v=(n*(r-1)+t)*12;for(let e=0;e<3;e++)a[v++]=o[_++]*l+o[_++]*d+o[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=o[_++]*u+o[_++]*f+o[_++]*g;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*l+s[_++]*p+s[_++]*h;_=0;for(let e=0;e<3;e++)a[v++]=s[_++]*u+s[_++]*m+s[_++]*g}if(n)for(let e=0;e<a.length;e++)isNaN(a[e])&&(a[e]=-1)}return a}function X(e,t){let n=e.clone().normalize();return n.length===1?n[0]:V(n,t)}function ce(e){let{spatialReference:t}=e,n=p(t);if(!n)return e;let[i,a]=n.valid,o=a-i,s=0;if(e.xmin<i){let t=i-e.xmin;s=Math.ceil(t/o)}else if(e.xmin>a){let t=e.xmin-a;s=-Math.ceil(t/o)}return new r({spatialReference:e.spatialReference,xmin:e.xmin+s*o,ymin:e.ymin,xmax:e.xmax+s*o,ymax:e.ymax})}function le(e,t,r){let{storageInfo:i,pixelSize:a}=t,o=0,s=!1,{pyramidResolutions:c}=i,u=i.tileInfo.format?.toLowerCase()===`mixed`?Math.max(1,Math.min(3,i.tileInfo.dpi/96)):1,d=(e.x+e.y)/2/u;if(c!=null&&c.length){let e=c[c.length-1],i=(e.x+e.y)/2,u=(a.x+a.y)/2;if(d<=u)o=0;else if(d>=i)o=c.length,s=d/i>8;else{let e=u,t;for(let n=1;n<=c.length;n++){if(t=(c[n-1].x+c[n-1].y)/2,d<=t){d===t?o=n:r===`down`?(o=n-1,s=d/e>8):o=r===`up`||d-e>t-d||d/e>2?n:n-1;break}e=t}}let f=o===0?a:c[o-1];return s&&Math.min(f.x,f.y)*n(t.spatialReference)>19567&&(s=!1),{pyramidLevel:o,pyramidResolution:new l({x:f.x,y:f.y,spatialReference:t.spatialReference}),excessiveReading:s}}let f=Math.log(e.x/a.x)/Math.LN2,p=Math.log(e.y/a.y)/Math.LN2,m=t.storageInfo.maximumPyramidLevel||0;o=r===`down`?Math.floor(Math.min(f,p)):r===`up`?Math.ceil(Math.max(f,p)):Math.round((f+p)/2),o<0?o=0:o>m&&(s=o>m+3,o=m);let h=2**o,g=new l({x:h*t.nativePixelSize.x,y:h*t.nativePixelSize.y,spatialReference:t.spatialReference});return{pyramidLevel:o,pyramidResolution:g,excessiveReading:s}}function Z(e,t,n=!1){let{pixelSize:r,extent:i}=e,a=D(i,t,!1),o=H(X(i,(r.x+r.y)/16),t,a);return!o||n||q(o)===0?o:U(i,t,a)}function ue(e,t,n){let r=n?.tileSize??512,i=n?.alignGlobalDatasetWithAGOL??!0,a=!!n?.limitToSrcResolution,{extent:o,pixelSize:s}=e,c=A(s,t,o);if(c==null)return{projectedPixelSize:null,scales:null,srcResolutions:null,isCustomTilingScheme:!1};let l=(c.x+c.y)/2,u=j(l,t),d=256/r,f=t.isGeographic?295828763.7958547*d:591657527.591555*d,p=(t.isGeographic?.703125:156543.03392800014)*d,m=e.dataType===`vector-magdir`||e.dataType===`vector-uv`,h=Z(e,t,!0),g=Math.min(Math.ceil(Math.log(Math.min(e.width,e.height)/32)/Math.LN2),Math.ceil(Math.log(f/2/u)/Math.LN2));if(!m&&h&&i&&(t.isGeographic||t.isWebMercator)){let n=W(t);if(m=q(h)>0||n!=null&&h.width>n/4,!m&&n!=null){let t=-1;if(g<3)t=2**g*l*r;else if(e.storageInfo){let{maximumPyramidLevel:n=0,pyramidScalingFactor:i=2}=e.storageInfo;t=i**n*l*r}let i=Math.ceil(n/t);m=i===1||i===2&&n/2-h.xmax<t}}let _=u,v,y=1.001,b=Math.min(2,Math.max(1.414,e.storageInfo?.pyramidScalingFactor||2));if(m){_=f;let n=Q(e,t);v={x:n.x*p,y:n.y*p}}else{v={x:s.x,y:s.y};let e=0;for(;_<y/2*f&&e<g;)e++,_*=b,v.x*=b,v.y*=b;Math.max(_,f)/Math.min(_,f)<=y&&(_=f)}let x=[_],S=[{x:v.x,y:v.y}],C=Math.min(70.5310735,u)/y;for(;_>=C;)_/=b,v.x/=b,v.y/=b,x.push(_),S.push({x:v.x,y:v.y});if(a){let e=s.x*.001,t=S.findIndex(t=>t.x>=s.x-e&&t.x<=s.x+e);t>-1?(S.length=t+1,x.length=t+1):(t=S.findIndex(t=>t.x<=s.x+e),t>0&&(S.length=t,x.length=t))}return{projectedPixelSize:c,scales:x,srcResolutions:S,isCustomTilingScheme:!m}}function Q(e,t){if(t.isWGS84||t.isWebMercator){let n=t.isGeographic?1341104507446289e-21:.29858214164761665,r=t.isGeographic?4326:3857,i=Z(e,new f({wkid:r}),!0),a=A({x:n,y:n},e.spatialReference,i);return{x:a.x/n,y:a.y/n}}let n=A(e.pixelSize,t,e.extent),r=(n.x+n.y)/2;return{x:e.pixelSize.x/r,y:e.pixelSize.y/r}}function de(e,t){let{spatialReference:n,lods:r}=t,{x:i,y:a}=Q(e,n);return r.map(({resolution:e})=>({x:e*i,y:e*a}))}function $(e){let t=0;for(let n of e){let e=n.length,r=n[0][0]*(n[1][1]-n[e-2][1]);for(let t=1;t<e-1;t++)r+=n[t][0]*(n[t+1][1]-n[t-1][1]);t+=r/2}return Math.abs(t)}export{$ as calculateArea2D,ue as computeProjectedScales,Q as computeSrcResolutionRatio,de as computeSrcResolutions,_ as defaultGridSpacing,y as defaultProjectionToleranceInPixels,D as getDefaultDatumTransformationForDataset,I as getProjectedGridPoints,se as getProjectionOffsetGrid,ae as getRasterDatasetAlignmentInfo,M as getSourceScale,W as getWorldWidth,q as getWorldWrapCount,E as load,v as minimumGridSpacing,Z as projectDatasetExtent,A as projectDatasetResolution,H as projectExtent,P as projectPoint,re as projectPolygon,O as projectResolution,ce as shiftExtent,X as snapExtent,le as snapPyramid};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../geometry/Multipoint.js";import t from"../../geometry/Point.js";import n from"../../geometry/Polyline.js";import{initializeProjection as r,project as i}from"../../geometry/projectionUtils.js";class a{constructor(e){this.geometry=e,this.spatialReference=e.spatialReference}export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){let t=new a(this.geometry);return t.spatialReference=this.spatialReference,t.coordinates=e??this.coordinates.map(e=>e.clone()),t._exporter=this._exporter,t}async project(t,n){if(this.spatialReference.equals(t))return this.clone();await r([{source:this.spatialReference,dest:t}],{signal:n});let a=new e({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),o=i(a,t);if(!o)return null;let s=this.coordinates.map((e,t)=>{let n=e.clone(),r=o.points[t];return n.x=r[0],n.y=r[1],n}),c=this.clone(s);return c.spatialReference=t,c}projectSync(t){if(this.spatialReference.equals(t))return this.clone();let n=new e({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),r=i(n,t);if(!r)return null;let a=this.coordinates.map((e,t)=>{let n=e.clone(),i=r.points[t];return n.x=i[0],n.y=i[1],n}),o=this.clone(a);return o.spatialReference=t,o}static fromGeometry(r){let i=new a(r);if(r instanceof a)return i.coordinates=r.coordinates.map(e=>e.clone()),i._exporter=(e,t)=>{let n=r.clone(e);return n.spatialReference=t,n},i;switch(r.type){case`point`:{let e=r,{hasZ:n,hasM:a}=e;return i.coordinates=n&&a?[new o(e.x,e.y,e.z,e.m)]:n?[new o(e.x,e.y,e.z)]:a?[new o(e.x,e.y,null,e.m)]:[new o(e.x,e.y)],i._exporter=(e,n)=>r.hasM?new t(e[0].x,e[0].y,e[0].z,e[0].m,n):new t(e[0].x,e[0].y,e[0].z,n),i}case`multipoint`:{let t=r,{hasZ:n,hasM:a}=t;return i.coordinates=n&&a?t.points.map(e=>new o(e[0],e[1],e[2],e[3])):n?t.points.map(e=>new o(e[0],e[1],e[2])):a?t.points.map(e=>new o(e[0],e[1],null,e[2])):t.points.map(e=>new o(e[0],e[1])),i._exporter=(t,n)=>r.hasM?new e({points:t.map(e=>[e.x,e.y,e.z??0,e.m??0]),hasZ:!0,hasM:!0,spatialReference:n}):new e({points:t.map(e=>[e.x,e.y,e.z??0]),spatialReference:n}),i}case`polyline`:{let e=r,t=[],a=[],{hasZ:s,hasM:c}=r,l=0;for(let n of e.paths)if(a.push([l,l+n.length]),l+=n.length,s&&c)for(let e of n)t.push(new o(e[0],e[1],e[2],e[3]));else if(s)for(let e of n)t.push(new o(e[0],e[1],e[2]));else if(c)for(let e of n)t.push(new o(e[0],e[1],null,e[2]));else for(let e of n)t.push(new o(e[0],e[1]));return i.coordinates=t,i._exporter=(e,t)=>{let i=r.hasM?e.map(e=>[e.x,e.y,e.z??0,e.m??0]):e.map(e=>[e.x,e.y,e.z??0]),o=a.map(e=>i.slice(e[0],e[1]));return new n({paths:o,hasM:r.hasM,hasZ:!0,spatialReference:t})},i}}}}class o{constructor(e,t,n=null,r=null,i=null,a=null){this.x=e,this.y=t,this.z=n,this.m=r,this.tile=i,this.elevationTile=a}clone(){return new o(this.x,this.y,this.z,this.m)}}export{o as Coordinate,a as GeometryDescriptor};
2
+ import e from"../../geometry/Multipoint.js";import t from"../../geometry/Point.js";import n from"../../geometry/Polyline.js";import{initializeProjection as r,project as i}from"../../geometry/projectionUtils.js";class a{constructor(e){this.geometry=e,this.spatialReference=e.spatialReference}export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){let t=new a(this.geometry);return t.spatialReference=this.spatialReference,t.coordinates=e??this.coordinates.map(e=>e.clone()),t._exporter=this._exporter,t}async project(t,n){if(this.spatialReference.equals(t))return this.clone();await r([{source:this.spatialReference,dest:t}],{signal:n});let a=new e({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),o=i(a,t);if(!o)return null;let s=this.coordinates.map((e,t)=>{let n=e.clone(),r=o.points[t];return n.x=r[0],n.y=r[1],n}),c=this.clone(s);return c.spatialReference=t,c}projectSync(t){if(this.spatialReference.equals(t))return this.clone();let n=new e({spatialReference:this.spatialReference,points:this.coordinates.map(e=>[e.x,e.y])}),r=i(n,t);if(!r)return null;let a=this.coordinates.map((e,t)=>{let n=e.clone(),i=r.points[t];return n.x=i[0],n.y=i[1],n}),o=this.clone(a);return o.spatialReference=t,o}static fromGeometry(r){let i=new a(r);if(r instanceof a)return i.coordinates=r.coordinates.map(e=>e.clone()),i._exporter=(e,t)=>{let n=r.clone(e);return n.spatialReference=t,n},i;switch(r.type){case`point`:{let e=r,{hasZ:n,hasM:a}=e;return i.coordinates=n&&a?[new o(e.x,e.y,e.z,e.m)]:n?[new o(e.x,e.y,e.z)]:a?[new o(e.x,e.y,null,e.m)]:[new o(e.x,e.y)],i._exporter=(e,n)=>r.hasM?new t({x:e[0].x,y:e[0].y,z:e[0].z,m:e[0].m,spatialReference:n}):new t({x:e[0].x,y:e[0].y,z:e[0].z,spatialReference:n}),i}case`multipoint`:{let t=r,{hasZ:n,hasM:a}=t;return i.coordinates=n&&a?t.points.map(e=>new o(e[0],e[1],e[2],e[3])):n?t.points.map(e=>new o(e[0],e[1],e[2])):a?t.points.map(e=>new o(e[0],e[1],null,e[2])):t.points.map(e=>new o(e[0],e[1])),i._exporter=(t,n)=>r.hasM?new e({points:t.map(e=>[e.x,e.y,e.z??0,e.m??0]),hasZ:!0,hasM:!0,spatialReference:n}):new e({points:t.map(e=>[e.x,e.y,e.z??0]),spatialReference:n}),i}case`polyline`:{let e=r,t=[],a=[],{hasZ:s,hasM:c}=r,l=0;for(let n of e.paths)if(a.push([l,l+n.length]),l+=n.length,s&&c)for(let e of n)t.push(new o(e[0],e[1],e[2],e[3]));else if(s)for(let e of n)t.push(new o(e[0],e[1],e[2]));else if(c)for(let e of n)t.push(new o(e[0],e[1],null,e[2]));else for(let e of n)t.push(new o(e[0],e[1]));return i.coordinates=t,i._exporter=(e,t)=>{let i=r.hasM?e.map(e=>[e.x,e.y,e.z??0,e.m??0]):e.map(e=>[e.x,e.y,e.z??0]),o=a.map(e=>i.slice(e[0],e[1]));return new n({paths:o,hasM:r.hasM,hasZ:!0,spatialReference:t})},i}}}}class o{constructor(e,t,n=null,r=null,i=null,a=null){this.x=e,this.y=t,this.z=n,this.m=r,this.tile=i,this.elevationTile=a}clone(){return new o(this.x,this.y,this.z,this.m)}}export{o as Coordinate,a as GeometryDescriptor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{EventedMixin as n}from"../../core/Evented.js";import{JSONSupportMixin as r}from"../../core/JSONSupport.js";import{Loadable as i}from"../../core/Loadable.js";import{on as a,sync as o,watch as s,whenOnce as c}from"../../core/reactiveUtils.js";import{stripHTML as l}from"../../core/string.js";import{property as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../core/accessorSupport/ensureType.js";import p from"../../geometry/Extent.js";import m from"../../graphic/KMLGraphicOrigin.js";import{computeExtent as h,sublayersFromJSON as g,fetchService as _,parseKML as v}from"./kmlUtils.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";var b;let x=b=class extends n(r(i)){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([a(()=>this.sublayers,`after-add`,({item:e})=>{e.parent=this,e.layer=this.layer},o),a(()=>this.sublayers,`after-remove`,({item:e})=>{e.layer=e.parent=null},o),s(()=>this.sublayers,(e,t)=>{if(t)for(let e of t)e.layer=e.parent=null;if(e)for(let t of e)t.parent=this,t.layer=this.layer},o),s(()=>this.layer,e=>{if(this.sublayers)for(let t of this.sublayers)t.layer=e},o)])}initialize(){c(()=>this.networkLink).then(()=>c(()=>this.visible===!0)).then(()=>this.load())}async load(e){if(!this.networkLink||this.networkLink.viewFormat)return this;let n=e==null?null:e.signal,r=this._fetchService(this._get(`networkLink`)?.href??``,n).then(e=>{let n=h(e.sublayers);this.fullExtent=p.fromJSON(n),this.sourceJSON=e;let r=f(t.ofType(b),g(b,e));this.sublayers?this.sublayers.addMany(r):this.sublayers=r,this.layer?.emit(`sublayer-update`),this.layer&&this.layer.notifyChange(`visibleSublayers`)});return this.addResolvingPromise(r),this}get visible(){return this._get(`visible`)}set visible(e){this._get(`visible`)!==e&&(this._set(`visible`,e),this.layer&&this.layer.notifyChange(`visibleSublayers`))}readVisible(e,t){return!!t.visibility}get origin(){return this.layer?new m(this.layer,this):null}_fetchService(e,t){return _(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(e=>v(e.data))}};e([u()],x.prototype,`description`,void 0),e([u({type:p})],x.prototype,`fullExtent`,void 0),e([u()],x.prototype,`id`,void 0),e([u({readOnly:!0,value:null})],x.prototype,`networkLink`,void 0),e([u({json:{write:{allowNull:!0}}})],x.prototype,`parent`,void 0),e([u({type:t.ofType(b),json:{write:{allowNull:!0}}})],x.prototype,`sublayers`,void 0),e([u({value:null,json:{read:{source:`name`,reader(e){return l(e)}}}})],x.prototype,`title`,void 0),e([u({value:!0})],x.prototype,`visible`,null),e([y(`visible`,[`visibility`])],x.prototype,`readVisible`,null),e([u()],x.prototype,`sourceJSON`,void 0),e([u()],x.prototype,`layer`,void 0),e([u()],x.prototype,`origin`,null),x=b=e([d(`esri.layers.support.KMLSublayer`)],x);export{x as default};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{EventedMixin as n}from"../../core/Evented.js";import{JSONSupportMixin as r}from"../../core/JSONSupport.js";import{Loadable as i}from"../../core/Loadable.js";import{on as a,sync as o,watch as s,whenOnce as c}from"../../core/reactiveUtils.js";import{stripHTML as l}from"../../core/string.js";import{property as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{ensureType as f}from"../../core/accessorSupport/ensureType.js";import p from"../../geometry/Extent.js";import m from"../../graphic/KMLGraphicOrigin.js";import{computeExtent as h,sublayersFromJSON as g,fetchService as _,parseKML as v}from"./kmlUtils.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";var b;let x=b=class extends n(r(i)){constructor(e){super(e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([a(()=>this.sublayers,`after-add`,({item:e})=>{e.parent=this,e.layer=this.layer},o),a(()=>this.sublayers,`after-remove`,({item:e})=>{e.layer=e.parent=null},o),s(()=>this.sublayers,(e,t)=>{if(t)for(let e of t)e.layer=e.parent=null;if(e)for(let t of e)t.parent=this,t.layer=this.layer},o),s(()=>this.layer,e=>{if(this.sublayers)for(let t of this.sublayers)t.layer=e},o)])}initialize(){c(()=>this.networkLink).then(()=>c(()=>this.visible===!0)).then(()=>this.load())}async load(e){if(!this.networkLink||this.networkLink.viewFormat)return this;let n=e==null?null:e.signal,r=this._fetchService(this._get(`networkLink`)?.href??``,n).then(e=>{let n=h(e.sublayers);this.fullExtent=p.fromJSON(n),this.sourceJSON=e;let r=f(t.ofType(b),g(b,e));this.sublayers?this.sublayers.addMany(r):this.sublayers=r,this.layer?.emit(`sublayer-update`),this.layer&&this.layer.notifyChange(`visibleSublayers`)});return this.addResolvingPromise(r),this}get visible(){return this._get(`visible`)}set visible(e){this._get(`visible`)!==e&&(this._set(`visible`,e),this.layer&&this.layer.notifyChange(`visibleSublayers`))}readVisible(e,t){return!!t.visibility}get origin(){return this.layer?new m(this.layer,this):null}_fetchService(e,t){return _(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(e=>v(e.data))}};e([u()],x.prototype,`description`,void 0),e([u({type:p})],x.prototype,`fullExtent`,void 0),e([u()],x.prototype,`id`,void 0),e([u({readOnly:!0,value:null})],x.prototype,`networkLink`,void 0),e([u({json:{write:{allowNull:!0}}})],x.prototype,`parent`,void 0),e([u({type:t.ofType(b),json:{write:{allowNull:!0}}})],x.prototype,`sublayers`,void 0),e([u({value:null,json:{read:{source:`name`,reader(e){return l(e)}}}})],x.prototype,`title`,void 0),e([u({value:!0})],x.prototype,`visible`,null),e([y(`visible`,[`visibility`])],x.prototype,`readVisible`,null),e([u()],x.prototype,`sourceJSON`,void 0),e([u()],x.prototype,`layer`,void 0),e([u()],x.prototype,`origin`,null),x=b=e([d(`esri.layers.support.KMLSublayer`)],x);export{x as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as n}from"../../core/JSONSupport.js";import{getMetersPerUnitForSR as r}from"../../core/units.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{Integer as o}from"../../core/accessorSupport/ensureType.js";import s from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{isValid as l,getInfo as u,isGeographic as d,equals as f}from"../../geometry/support/spatialReferenceUtils.js";import{project as p}from"../../geometry/support/webMercatorUtils.js";import m from"./LOD.js";import{TileKey as h}from"./TileKey.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";import{writer as _}from"../../core/accessorSupport/decorators/writer.js";var v;const y=new t({PNG:`png`,PNG8:`png8`,PNG24:`png24`,PNG32:`png32`,JPEG:`jpg`,JPG:`jpg`,DIB:`dib`,TIFF:`tiff`,EMF:`emf`,PS:`ps`,PDF:`pdf`,GIF:`gif`,SVG:`svg`,SVGZ:`svgz`,Mixed:`mixed`,MIXED:`mixed`,LERC:`lerc`,LERC2D:`lerc2d`,RAW:`raw`,JPEGPlus:`jpgplus`,pbf:`pbf`});let b=class extends n{static{v=this}static create(e={}){let{resolutionFactor:t=1,scales:n,size:i=256,spatialReference:a=c.WebMercator,numLODs:o=24}=e;if(!l(a)){let e=[];if(n)for(let t=0;t<n.length;t++){let r=n[t];e.push(new m({level:t,scale:r,resolution:r}))}else{let t=5e-4;for(let n=o-1;n>=0;n--)e.unshift(new m({level:n,scale:t,resolution:t})),t*=2}return new v({dpi:96,lods:e,origin:new s(0,0,a),size:[i,i],spatialReference:a})}let f=u(a),p=e.origin?new s({x:e.origin.x,y:e.origin.y,spatialReference:a}):f?new s({x:f.origin[0],y:f.origin[1],spatialReference:a}):new s({x:0,y:0,spatialReference:a}),h=1/(r(a)*39.37*96),g=[];if(n)for(let e=0;e<n.length;e++){let t=n[e],r=t*h;g.push(new m({level:e,scale:t,resolution:r}))}else{let e=d(a)?512/i*591657527.5917094:256/i*591657527.591555,n=Math.ceil(o/t);g.push(new m({level:0,scale:e,resolution:e*h}));for(let r=1;r<n;r++){let n=e/2**t,i=n*h;g.push(new m({level:r,scale:n,resolution:i})),e=n}}return new v({dpi:96,lods:g,origin:p,size:[i,i],spatialReference:a})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){let{spatialReference:e,origin:t}=this;if(e&&t){let n=u(e);return e.isWrappable&&!!n&&Math.abs(n.origin[0]-t.x)<=n.dx}return!1}readOrigin(e,t){return s.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,n=0,r=[],i=this._levelToLOD={};e&&(t=-1/0,n=1/0,e.forEach(e=>{r.push(e.scale),t=e.scale>t?e.scale:t,n=e.scale<n?e.scale:n,i[e.level]=e})),this._set(`scales`,r),this._set(`lods`,e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){let t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];let n=Math.floor(e),r=n+1;return t[n]/(t[n]/t[r])**(e-n)}scaleToZoom(e){let t=this.scales,n=t.length-1,r=0;for(;r<n;r++){let n=t[r],i=t[r+1];if(n<=e)return r;if(i===e)return r+1;if(n>e&&i<e)return r+Math.log(n/e)/Math.log(n/i)}return r}tileAt(e,t,n,r){let i=this.lodAt(e);if(!i)return null;let a,o;if(typeof t==`number`)a=t,o=n;else if(f(t.spatialReference,this.spatialReference))a=t.x,o=t.y,r=n;else{let e=p(t,this.spatialReference);if(e==null)return null;a=e.x,o=e.y,r=n}let s=i.resolution*this.size[0],c=i.resolution*this.size[1];return r??=new h(0,0,0),r.level=e,r.row=Math.floor((this.origin.y-o)/c+.001),r.col=Math.floor((a-this.origin.x)/s+.001),this.updateTileInfo(r),r}updateTileInfo(e,t=0){if(!(`extent`in e))return!1;let n=this.lodAt(e.level);if(!n&&t===1){let t=this.lods[this.lods.length-1];t.level<e.level&&(n=t)}if(!n)return!1;let r=e.level-n.level,i=n.resolution*this.size[0]/2**r,a=n.resolution*this.size[1]/2**r;return e.extent[0]=this.origin.x+e.col*i,e.extent[1]=this.origin.y-(e.row+1)*a,e.extent[2]=e.extent[0]+i,e.extent[3]=e.extent[1]+a,!0}upsampleTile(e){let t=this._upsampleLevels[e.level];return!t||t.parentLevel===-1?!1:(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),!0)}getTileBounds(e,t){let n=this.lodAt(t.level);if(n==null)return null;let{resolution:r}=n,i=r*this.size[0],a=r*this.size[1];return e[0]=this.origin.x+t.col*i,e[1]=this.origin.y-(t.row+1)*a,e[2]=e[0]+i,e[3]=e[1]+a,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return v.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||this.size[0]===256&&e===512)return null;let t=(this.size[0]===512&&e===256?-1:0)+ +!!this.spatialReference.isGeographic;if(this.size[0]===e&&t===0)return this;let n=[],r=this.lods.length-t;for(let e=0;e<r;e++){let r=e+t,{scale:i,resolution:a}=r>=0?this.lods[r]:{scale:this.lods[0].scale*2,resolution:this.lods[0].resolution*2};n.push(new m({level:e,scale:i,resolution:a}))}return new v({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:n})}_initializeUpsampleLevels(){let e=this.lods;this._upsampleLevels=[];let t=null;for(let n=0;n<e.length;n++){let r=e[n];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};e([i({type:Number,json:{write:!0}})],b.prototype,`compressionQuality`,void 0),e([i({type:Number,json:{write:!0}})],b.prototype,`dpi`,void 0),e([i({type:String,json:{read:y.read,write:y.write,origins:{"web-scene":{read:!1,write:!1}}}})],b.prototype,`format`,void 0),e([i({readOnly:!0})],b.prototype,`isWrappable`,null),e([i({type:s,json:{write:!0}})],b.prototype,`origin`,void 0),e([g(`origin`)],b.prototype,`readOrigin`,null),e([i({type:[m],value:null,json:{write:!0}})],b.prototype,`lods`,null),e([i({readOnly:!0})],b.prototype,`scales`,void 0),e([i({cast:e=>Array.isArray(e)?e:typeof e==`number`?[e,e]:[256,256]})],b.prototype,`size`,void 0),e([g(`size`,[`rows`,`cols`])],b.prototype,`readSize`,null),e([_(`size`,{cols:{type:o},rows:{type:o}})],b.prototype,`writeSize`,null),e([i({type:c,json:{write:!0}})],b.prototype,`spatialReference`,void 0),b=v=e([a(`esri.layers.support.TileInfo`)],b);export{b as default};
2
+ import{__decorate as e}from"tslib";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as n}from"../../core/JSONSupport.js";import{getMetersPerUnitForSR as r}from"../../core/units.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{Integer as o}from"../../core/accessorSupport/ensureType.js";import s from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{isValid as l,getInfo as u,isGeographic as d,equals as f}from"../../geometry/support/spatialReferenceUtils.js";import{project as p}from"../../geometry/support/webMercatorUtils.js";import m from"./LOD.js";import{TileKey as h}from"./TileKey.js";import{reader as g}from"../../core/accessorSupport/decorators/reader.js";import{writer as _}from"../../core/accessorSupport/decorators/writer.js";var v;const y=new t({PNG:`png`,PNG8:`png8`,PNG24:`png24`,PNG32:`png32`,JPEG:`jpg`,JPG:`jpg`,DIB:`dib`,TIFF:`tiff`,EMF:`emf`,PS:`ps`,PDF:`pdf`,GIF:`gif`,SVG:`svg`,SVGZ:`svgz`,Mixed:`mixed`,MIXED:`mixed`,LERC:`lerc`,LERC2D:`lerc2d`,RAW:`raw`,JPEGPlus:`jpgplus`,pbf:`pbf`});let b=class extends n{static{v=this}static create(e={}){let{resolutionFactor:t=1,scales:n,size:i=256,spatialReference:a=c.WebMercator,numLODs:o=24}=e;if(!l(a)){let e=[];if(n)for(let t=0;t<n.length;t++){let r=n[t];e.push(new m({level:t,scale:r,resolution:r}))}else{let t=5e-4;for(let n=o-1;n>=0;n--)e.unshift(new m({level:n,scale:t,resolution:t})),t*=2}return new v({dpi:96,lods:e,origin:new s({x:0,y:0,spatialReference:a}),size:[i,i],spatialReference:a})}let f=u(a),p=e.origin?new s({x:e.origin.x,y:e.origin.y,spatialReference:a}):f?new s({x:f.origin[0],y:f.origin[1],spatialReference:a}):new s({x:0,y:0,spatialReference:a}),h=1/(r(a)*39.37*96),g=[];if(n)for(let e=0;e<n.length;e++){let t=n[e],r=t*h;g.push(new m({level:e,scale:t,resolution:r}))}else{let e=d(a)?512/i*591657527.5917094:256/i*591657527.591555,n=Math.ceil(o/t);g.push(new m({level:0,scale:e,resolution:e*h}));for(let r=1;r<n;r++){let n=e/2**t,i=n*h;g.push(new m({level:r,scale:n,resolution:i})),e=n}}return new v({dpi:96,lods:g,origin:p,size:[i,i],spatialReference:a})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){let{spatialReference:e,origin:t}=this;if(e&&t){let n=u(e);return e.isWrappable&&!!n&&Math.abs(n.origin[0]-t.x)<=n.dx}return!1}readOrigin(e,t){return s.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,n=0,r=[],i=this._levelToLOD={};e&&(t=-1/0,n=1/0,e.forEach(e=>{r.push(e.scale),t=e.scale>t?e.scale:t,n=e.scale<n?e.scale:n,i[e.level]=e})),this._set(`scales`,r),this._set(`lods`,e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){let t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];let n=Math.floor(e),r=n+1;return t[n]/(t[n]/t[r])**(e-n)}scaleToZoom(e){let t=this.scales,n=t.length-1,r=0;for(;r<n;r++){let n=t[r],i=t[r+1];if(n<=e)return r;if(i===e)return r+1;if(n>e&&i<e)return r+Math.log(n/e)/Math.log(n/i)}return r}tileAt(e,t,n,r){let i=this.lodAt(e);if(!i)return null;let a,o;if(typeof t==`number`)a=t,o=n;else if(f(t.spatialReference,this.spatialReference))a=t.x,o=t.y,r=n;else{let e=p(t,this.spatialReference);if(e==null)return null;a=e.x,o=e.y,r=n}let s=i.resolution*this.size[0],c=i.resolution*this.size[1];return r??=new h(0,0,0),r.level=e,r.row=Math.floor((this.origin.y-o)/c+.001),r.col=Math.floor((a-this.origin.x)/s+.001),this.updateTileInfo(r),r}updateTileInfo(e,t=0){if(!(`extent`in e))return!1;let n=this.lodAt(e.level);if(!n&&t===1){let t=this.lods[this.lods.length-1];t.level<e.level&&(n=t)}if(!n)return!1;let r=e.level-n.level,i=n.resolution*this.size[0]/2**r,a=n.resolution*this.size[1]/2**r;return e.extent[0]=this.origin.x+e.col*i,e.extent[1]=this.origin.y-(e.row+1)*a,e.extent[2]=e.extent[0]+i,e.extent[3]=e.extent[1]+a,!0}upsampleTile(e){let t=this._upsampleLevels[e.level];return!t||t.parentLevel===-1?!1:(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),!0)}getTileBounds(e,t){let n=this.lodAt(t.level);if(n==null)return null;let{resolution:r}=n,i=r*this.size[0],a=r*this.size[1];return e[0]=this.origin.x+t.col*i,e[1]=this.origin.y-(t.row+1)*a,e[2]=e[0]+i,e[3]=e[1]+a,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return v.fromJSON(this.write({}))}getCompatibleForVTL(e){if(this.size[0]!==this.size[1]||this.size[0]===256&&e===512)return null;let t=(this.size[0]===512&&e===256?-1:0)+ +!!this.spatialReference.isGeographic;if(this.size[0]===e&&t===0)return this;let n=[],r=this.lods.length-t;for(let e=0;e<r;e++){let r=e+t,{scale:i,resolution:a}=r>=0?this.lods[r]:{scale:this.lods[0].scale*2,resolution:this.lods[0].resolution*2};n.push(new m({level:e,scale:i,resolution:a}))}return new v({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:n})}_initializeUpsampleLevels(){let e=this.lods;this._upsampleLevels=[];let t=null;for(let n=0;n<e.length;n++){let r=e[n];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};e([i({type:Number,json:{write:!0}})],b.prototype,`compressionQuality`,void 0),e([i({type:Number,json:{write:!0}})],b.prototype,`dpi`,void 0),e([i({type:String,json:{read:y.read,write:y.write,origins:{"web-scene":{read:!1,write:!1}}}})],b.prototype,`format`,void 0),e([i({readOnly:!0})],b.prototype,`isWrappable`,null),e([i({type:s,json:{write:!0}})],b.prototype,`origin`,void 0),e([g(`origin`)],b.prototype,`readOrigin`,null),e([i({type:[m],value:null,json:{write:!0}})],b.prototype,`lods`,null),e([i({readOnly:!0})],b.prototype,`scales`,void 0),e([i({cast:e=>Array.isArray(e)?e:typeof e==`number`?[e,e]:[256,256]})],b.prototype,`size`,void 0),e([g(`size`,[`rows`,`cols`])],b.prototype,`readSize`,null),e([_(`size`,{cols:{type:o},rows:{type:o}})],b.prototype,`writeSize`,null),e([i({type:c,json:{write:!0}})],b.prototype,`spatialReference`,void 0),b=v=e([a(`esri.layers.support.TileInfo`)],b);export{b as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{id as e}from"../../kernel.js";import{isPopupTemplate as t}from"../../popupTemplateUtils.js";import{resultOrAbort as n}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Logger.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as s}from"../../core/uuid.js";import{createTypeReader as c}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{isHostedAgolService as l}from"./arcgisLayerUrl.js";import u from"./CodedValue.js";import d from"./CodedValueDomain.js";import{queryAllJSON as f}from"./featureQueryAll.js";import{isStringField as p,isIntegerField as m}from"./fieldUtils.js";import{isLabelClass as h}from"./labelUtils.js";import{isLayerWithFeatureCapabilities as ee,getOwningPortalUrl as g}from"./layerUtils.js";import _ from"../../renderers/SimpleRenderer.js";import te from"../../renderers/UniqueValueRenderer.js";import{isSizeVariable as v}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import y from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as ne}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import x from"../../rest/support/RelationshipQuery.js";import{loadArcade as S}from"../../support/loadArcade.js";import{symbolTypesRenderer as C}from"../../symbols/support/typeUtils.js";const w=()=>a.getLogger(`esri.layers.support.featureLayerUtils`),T=new i({esriGeometryPoint:`point`,esriGeometryMultipoint:`multipoint`,esriGeometryPolyline:`polyline`,esriGeometryPolygon:`polygon`,esriGeometryMultiPatch:`multipatch`});async function E(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.addAttachment)throw new r(i,`Layer source does not support addAttachment capability`);return o.addAttachment(t,n,a)}function D(e,t,n){let{attributes:i}=t,{objectIdField:a}=e;return e.capabilities?.data?.supportsAttachment?t?i?!a||i[a]==null?Promise.reject(new r(n,`feature is missing the identifying attribute ${a}`)):Promise.resolve():Promise.reject(new r(n,`'attributes' are required on a feature to query attachments`)):Promise.reject(new r(n,`A feature is required to add/delete/update attachments`)):Promise.reject(new r(n,`this layer doesn't support attachments`))}async function re(e,t,n,i,a,o){let s=await U(e);if(await D(e,t,a),!s.updateAttachment)throw new r(a,`Layer source does not support updateAttachment capability`);return s.updateAttachment(t,n,i,o)}async function ie(e,t,n){let{applyEdits:r}=await import(`../graphics/editingSupport.js`),i=await e.load(),a=n,{url:o,type:s,globalIdField:c}=i;return s===`feature`&&l(o)&&i.infoFor3D&&t.deleteFeatures!=null&&c!=null&&(a={...a,globalIdToObjectId:await J(i,t.deleteFeatures,c)}),r(i,i.source,t,a)}async function ae(e,t,n){let{uploadAssets:r}=await import(`../graphics/editingSupport.js`),i=await e.load();return r(i,i.source,t,n)}async function oe(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.deleteAttachments)throw new r(i,`Layer source does not support deleteAttachments capability`);return o.deleteAttachments(t,n,a)}async function se(e,t,n){let i=(await e.load({signal:t?.signal})).source;if(!i.fetchRecomputedExtents)throw new r(n,`Layer source does not support fetchUpdates capability`);return i.fetchRecomputedExtents(t)}async function ce(e,t,n,i){let a=y.from(t),o=await e.load(),s=o.source,c=o.capabilities;if(!c?.data?.supportsAttachment)throw new r(i,`this layer doesn't support attachments`);let{attachmentTypes:l,objectIds:u,globalIds:d,num:f,size:p,start:m,where:h}=a;if(!c?.operations?.supportsQueryAttachments){let e=l?.length>0,t=d?.length>0,n=p?.length>0;if(e||t||n||f||m||h)throw new r(i,`when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported`,a)}if(!(u?.length||d?.length||h))throw new r(i,`'objectIds', 'globalIds', or 'where' are required to perform attachment query`,a);if(!s.queryAttachments)throw new r(i,`Layer source does not support queryAttachments capability`,a);return!c?.attachment?.supportsOrderByFields&&a.orderByFields?.length&&(a=a.clone(),a.orderByFields=null),s.queryAttachments(a)}async function le(e,t,n,i){let a=await U(e);if(!a.queryObjectIds)throw new r(i,`Layer source does not support queryObjectIds capability`);return a.queryObjectIds(b.from(t)??e.createQuery(),n)}async function O(e,t,n,i){let a=await U(e);if(!a.queryFeatureCount)throw new r(i,`Layer source does not support queryFeatureCount capability`);return a.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function k(e,t,n,i){let a=await U(e);if(!a.queryExtent)throw new r(i,`Layer source does not support queryExtent capability`);return a.queryExtent(b.from(t)??e.createQuery(),n)}async function A(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeatures)throw new r(i,`Layer source does not support queryRelatedFeatures capability`);return a.queryRelatedFeatures(x.from(t),n)}async function j(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeaturesCount)throw new r(i,`Layer source does not support queryRelatedFeaturesCount capability`);return a.queryRelatedFeaturesCount(x.from(t),n)}async function M(e){let t=e.source;if(t?.refresh)try{let{dataChanged:n,updates:r}=await t.refresh();if(r!=null&&(e.sourceJSON={...e.sourceJSON,...r},e.read(r,{origin:`service`,url:e.parsedUrl})),n)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function N(e){let t=new b;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,t.outFields=[`*`],t.multipatchOption=e.geometryType===`multipatch`?`xyFootprint`:null;let n=e.capabilities?.query;n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference);let r=e.capabilities?.data;r?.supportsZ&&e.returnZ!=null&&(t.returnZ=e.returnZ),r?.supportsM&&e.returnM!=null&&(t.returnM=e.returnM);let{timeOffset:i,timeExtent:a}=e;return t.timeExtent=i!=null&&a!=null?a.offset(-i.value,i.unit):a||null,t}function P(e){let{globalIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeGlobalID`)return e.name}}function F(e){let{objectIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeOID`)return e.name}}function I(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty(`capabilities`)||e.hasOwnProperty(`drawingInfo`)||e.hasOwnProperty(`hasAttachments`)||e.hasOwnProperty(`htmlPopupType`)||e.hasOwnProperty(`relationships`)||e.hasOwnProperty(`timeInfo`)||e.hasOwnProperty(`typeIdField`)||e.hasOwnProperty(`types`)?10:9.3}function L(e,t,n,r){let i=n?.feature,a=!!e.subtypes?.length;if(a&&!n?.excludeImpliedDomains){let n=z(e,t);if(n)return n}let o=a&&R(e,i);if(o){let e=o?.domains?.[t];return e?.type===`inherited`?r:e}let s=Y(e.types,e.typeIdField,i);if(s){let e=s.domains&&s.domains[t];if(e&&e?.type!==`inherited`)return e}if(r)return r;if(!n?.excludeImpliedDomains){let n=B(e,t);if(n)return n}return null}function R(e,t){let{subtypes:n,subtypeField:r}=e;if(!t?.attributes||!n?.length||!r)return null;let i=t.attributes[r];return i==null?null:n.find(e=>e.code===i)}function z(e,t){let{fieldsIndex:n,subtypeField:r}=e,{name:i,type:a}=n.get(t)??{};if(!i)return null;if((r&&n.get(r)?.name)===i&&e.subtypes?.length){let t=e.subtypes.map(e=>new u({code:H(e.code,a),name:e.name}));if(t?.length)return new d({codedValues:t})}return null}function B(e,t){let{fieldsIndex:n}=e,{name:r,type:i}=n.get(t)??{};if(!r)return null;if((`typeIdField`in e?n.get(e.typeIdField)?.name:null)===r&&`types`in e&&e.types?.length&&V(e.types)){let t=e.types?.map(e=>new u({code:H(e.id,i),name:e.name}));return new d({codedValues:t})}return null}function V(e){let t=new Set,n=new Set;for(let r of e){if(t.has(r.id)||n.has(r.name))return!1;t.add(r.id),n.add(r.name)}return!0}function H(e,t){return t?p({type:t})&&typeof e==`number`?`${e}`:m({type:t})&&typeof e==`string`?Number.parseInt(e,10):e:e}async function U(e){return(await e.load()).source}async function W(t,n){if(!e)return;let r=e.findCredential(t);if(r)return r.userId;let i;try{let r=await g(t,n);r&&(i=await e.checkSignInStatus(`${r}/sharing`))}catch{}return i?i.userId:null}async function G(t,n){if(!e||e.findCredential(t))return;let r;try{let i=await g(t,n);i&&(r=await e.checkSignInStatus(`${i}/sharing`))}catch{}if(r)try{let r=n==null?null:n.signal;await e.getCredential(t,{signal:r})}catch{}}async function ue(e,t,n){let r=e.parsedUrl?.path;r&&e.authenticationTriggerEvent===t&&await G(r,n)}async function de(e){let t=e.parsedUrl?.path;t&&fe(e)&&await G(t)}function fe(e){return pe(e)&&(`serviceDefinitionExpression`in e&&K(e.serviceDefinitionExpression)||`definitionExpression`in e&&K(e.definitionExpression))}function pe(e){return!!(ee(e)&&e.capabilities?.query.supportsCurrentUser)}function K(e){return!!e?.toLowerCase().includes(`current_user`)}function me(e){return X(e)?!1:e.userHasUpdateItemPrivileges||e.editingEnabled}const q=c({types:C});function he(e,t){if(e.defaultSymbol)return e.types?.length?new te({defaultSymbol:q(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map(e=>({id:e.id,symbol:q(e.symbol,e,t)}))}):new _({symbol:q(e.defaultSymbol,e,t)})}function ge(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;let n=e.editingInfo?.lastEditDate?.getTime();return n==null||(t*=1e3,Date.now()-n<t)}async function J(e,t,r){if(t==null)return null;let i=[],{objectIdField:a}=e;if(t.forEach(e=>{let t=null;if(`attributes`in e){let{attributes:n}=e;t={globalId:n[r],objectId:n[a]!=null&&n[a]!==-1?n[a]:null}}else t={globalId:e.globalId,objectId:e.objectId!=null&&e.objectId!==-1?e.objectId:null};t.globalId!=null&&(t.objectId==null||t.objectId===-1)&&i.push(t.globalId)}),i.length===0)return null;let o=e.createQuery();o.where=i.map(e=>`${r}='${e}'`).join(` OR `),o.returnGeometry=!1,o.outFields=[a,r],o.cacheHint=!1;let c=await n(f(e,o));if(!c.ok)return null;let l=new Map,u=c.value.features;for(let e of u){let t=e.attributes[r],n=e.attributes[a];t!=null&&n!=null&&n!==-1&&l.set(s(t),n)}return l}function Y(e,t,n){if(!t||!n||!e)return null;let r=n.getAttribute(t);if(r==null)return null;let i=e.filter(e=>{let{id:t}=e;return t!=null&&t.toString()===r.toString()});return i.length>1&&w().warn(`getFeatureType`,`Cannot unambiguously determine feature type because multiple types have the id ${r}.`),i[0]??null}function X(e){let t=e.sourceJSON;return t?.isMultiServicesView||t?.isReadOnly||_e(e)}function _e(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(`,`).map(e=>e.trim()).includes(`map`)}function ve(e,t,n){let i=t?.queryAttributeBins;if(!t?.operations?.supportsQueryBins||!i)throw new r(n,`Layer source does not support binning`);switch(e.binParameters?.type){case`auto-interval`:if(!i.supportsAutoInterval)throw new r(n,`Layer source does not support auto-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`);break;case`date`:if(!i.supportsDate)throw new r(n,`Layer source does not support date binning`);if(e.binParameters.snapToData&&!i.supportsSnapToData)throw new r(n,`Layer source does not support snapToData binning`);if(e.binParameters.returnFullIntervalBin&&!i.supportsReturnFullIntervalBin)throw new r(n,`Layer source does not support returnFullIntervalBin binning`);break;case`fixed-boundaries`:if(!i.supportsFixedBoundaries)throw new r(n,`Layer source does not support fixed-boundaries binning`);break;case`fixed-interval`:if(!i.supportsFixedInterval)throw new r(n,`Layer source does not support fixed-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`)}if(e.binParameters?.stackBy&&!i.supportsStackBy)throw new r(n,`Layer source does not support stackBy binning`);if(e.binParameters?.splitBy&&!i.supportsSplitBy)throw new r(n,`Layer source does not support splitBy binning`);if(e.binParameters?.firstDayOfWeek&&!i.supportsFirstDayOfWeek)throw new r(n,`Layer source does not support firstDayOfWeek binning`);let a=i?.supportedStatistics;if(e.outStatistics&&a){let t=new Map([[`count`,`count`],[`sum`,`sum`],[`min`,`min`],[`max`,`max`],[`avg`,`avg`],[`stddev`,`stddev`],[`var`,`var`],[`percentile-continuous`,`percentileContinuous`],[`percentile-discrete`,`percentileDiscrete`],[`centroid-aggregate`,`centroid`],[`convex-hull-aggregate`,`convexHull`],[`envelope-aggregate`,`envelope`]]);for(let{statisticType:i}of e.outStatistics){let e=t.get(i);if(e&&!a[e])throw new r(n,`Layer source does not support ${i} statistic type`)}}}function Z(e,t){return e!=null&&!!t?.[ne.toJSON(e)]}function Q(e){return h(e)?!!e.labelExpressionInfo?.expression:t(e)?e.expressionInfos?.some(e=>e.expression)?!0:Array.isArray(e.content)?e.content.some(e=>e.type===`expression`&&e.expressionInfo?.expression):!1:e.type===`dot-density`&&e.attributes?.some(e=>e.valueExpression)||`valueExpression`in e&&e.valueExpression?!0:`visualVariables`in e&&e.visualVariables!=null&&e.visualVariables.some(e=>e.valueExpression?!0:e.type===`size`?v(e.minSize)&&e.minSize.valueExpression||v(e.maxSize)&&e.maxSize.valueExpression:!1)}function ye(e){if(`renderer`in e&&e.renderer&&Q(e.renderer))return!0;if(`labelingInfo`in e&&e.labelingInfo){for(let t of e.labelingInfo)if(h(t)&&Q(t))return!0}return!1}async function be(e){let t=`returnZ`in e?e.returnZ:void 0,n=`returnM`in e?e.returnM:void 0;if(ye(e)){let{arcadeUtils:r}=await S();r.layerHasGeometryFunctions(e)&&(t=!0,n=!0)}if(`renderer`in e&&e.renderer?.symbols)for(let t of e.renderer.symbols)t.type===`cim`&&($??=(await import(`../../symbols/cim/CIMSymbolHelper.js`)).forEachSymbolLayer,$(t.data.symbol,e=>{switch(e.type){case`CIMPictureMarker`:case`CIMVectorMarker`:n||=e.markerPlacement?.type===`CIMMarkerPlacementAtMeasuredUnits`}}));return{returnZ:t,returnM:n}}let $;export{E as addAttachment,ie as applyEdits,de as checkServiceCurrentUserSupport,z as computeDomainFromSubtypes,B as computeDomainFromTypes,me as computeEffectiveEditingEnabled,he as createDefaultRenderer,N as createQuery,oe as deleteAttachments,G as ensureCredentialIfSignedIn,ue as ensureLayerCredential,se as fetchRecomputedExtents,T as geometryTypeKebabDict,R as getFeatureSubtype,Y as getFeatureType,L as getFieldDomain,J as getGlobalIdToObjectIdMap,W as getSignedInUser,K as hasCurrentUser,M as hasDataChanged,ge as isLayerCacheStale,be as layerRequiresGeometryZM,ce as queryAttachments,k as queryExtent,O as queryFeatureCount,le as queryObjectIds,A as queryRelatedFeatures,j as queryRelatedFeaturesCount,P as readGlobalIdField,F as readObjectIdField,I as readVersion,X as supportsQueryOnly,V as typesHaveUniqueIdsAndNames,re as updateAttachment,ae as uploadAssets,ve as validateBinsQuery};
2
+ import{id as e}from"../../kernel.js";import{isPopupTemplate as t}from"../../popupTemplateUtils.js";import{resultOrAbort as n}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Logger.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as s}from"../../core/uuid.js";import{createTypeReader as c}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{isHostedAgolService as l}from"./arcgisLayerUrl.js";import u from"./CodedValue.js";import d from"./CodedValueDomain.js";import{queryAllJSON as f}from"./featureQueryAll.js";import{isStringField as p,isIntegerField as m}from"./fieldUtils.js";import{isLabelClass as h}from"./labelUtils.js";import{isLayerWithFeatureCapabilities as ee,getOwningPortalUrl as g}from"./layerUtils.js";import _ from"../../renderers/SimpleRenderer.js";import te from"../../renderers/UniqueValueRenderer.js";import{isSizeVariable as v}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import y from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as ne}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import x from"../../rest/support/RelationshipQuery.js";import{loadArcade as S}from"../../support/loadArcade.js";import{symbolTypesRenderer as C}from"../../symbols/support/typeUtils.js";const w=()=>a.getLogger(`esri.layers.support.featureLayerUtils`),T=new i({esriGeometryPoint:`point`,esriGeometryMultipoint:`multipoint`,esriGeometryPolyline:`polyline`,esriGeometryPolygon:`polygon`,esriGeometryMultiPatch:`multipatch`});async function E(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.addAttachment)throw new r(i,`Layer source does not support addAttachment capability`);return o.addAttachment(t,n,a)}function D(e,t,n){let{attributes:i}=t,{objectIdField:a}=e;return e.capabilities?.data?.supportsAttachment?t?i?!a||i[a]==null?Promise.reject(new r(n,`feature is missing the identifying attribute ${a}`)):Promise.resolve():Promise.reject(new r(n,`'attributes' are required on a feature to query attachments`)):Promise.reject(new r(n,`A feature is required to add/delete/update attachments`)):Promise.reject(new r(n,`this layer doesn't support attachments`))}async function re(e,t,n,i,a,o){let s=await U(e);if(await D(e,t,a),!s.updateAttachment)throw new r(a,`Layer source does not support updateAttachment capability`);return s.updateAttachment(t,n,i,o)}async function ie(e,t,n){let{applyEdits:r}=await import(`../graphics/editingSupport.js`),i=await e.load(),a=n,{url:o,type:s,globalIdField:c}=i;return s===`feature`&&l(o)&&i.infoFor3D&&t.deleteFeatures!=null&&c!=null&&(a={...a,globalIdToObjectId:await J(i,t.deleteFeatures,c)}),r(i,i.source,t,a)}async function ae(e,t,n){let{uploadAssets:r}=await import(`../graphics/editingSupport.js`),i=await e.load();return r(i,i.source,t,n)}async function oe(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.deleteAttachments)throw new r(i,`Layer source does not support deleteAttachments capability`);return o.deleteAttachments(t,n,a)}async function se(e,t,n){let i=(await e.load({signal:t?.signal})).source;if(!i.fetchRecomputedExtents)throw new r(n,`Layer source does not support fetchUpdates capability`);return i.fetchRecomputedExtents(t)}async function ce(e,t,n,i){let a=y.from(t),o=await e.load(),s=o.source,c=o.capabilities;if(!c?.data?.supportsAttachment)throw new r(i,`this layer doesn't support attachments`);let{attachmentTypes:l,objectIds:u,globalIds:d,num:f,size:p,start:m,where:h}=a;if(!c?.operations?.supportsQueryAttachments){let e=l?.length>0,t=d?.length>0,n=p?.length>0;if(e||t||n||f||m||h)throw new r(i,`when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported`,a)}if(!(u?.length||d?.length||h))throw new r(i,`'objectIds', 'globalIds', or 'where' are required to perform attachment query`,a);if(!s.queryAttachments)throw new r(i,`Layer source does not support queryAttachments capability`,a);return!c?.attachment?.supportsOrderByFields&&a.orderByFields?.length&&(a=a.clone(),a.orderByFields=null),s.queryAttachments(a)}async function le(e,t,n,i){let a=await U(e);if(!a.queryObjectIds)throw new r(i,`Layer source does not support queryObjectIds capability`);return a.queryObjectIds(b.from(t)??e.createQuery(),n)}async function O(e,t,n,i){let a=await U(e);if(!a.queryFeatureCount)throw new r(i,`Layer source does not support queryFeatureCount capability`);return a.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function k(e,t,n,i){let a=await U(e);if(!a.queryExtent)throw new r(i,`Layer source does not support queryExtent capability`);return a.queryExtent(b.from(t)??e.createQuery(),n)}async function A(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeatures)throw new r(i,`Layer source does not support queryRelatedFeatures capability`);return a.queryRelatedFeatures(x.from(t),n)}async function j(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeaturesCount)throw new r(i,`Layer source does not support queryRelatedFeaturesCount capability`);return a.queryRelatedFeaturesCount(x.from(t),n)}async function M(e){let t=e.source;if(t?.refresh)try{let{dataChanged:n,updates:r}=await t.refresh();if(r!=null&&(e.sourceJSON={...e.sourceJSON,...r},e.read(r,{origin:`service`,url:e.parsedUrl})),n)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function N(e){let t=new b;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,t.outFields=[`*`],t.multipatchOption=e.geometryType===`multipatch`?`xyFootprint`:null;let n=e.capabilities?.data;n?.supportsZ&&e.returnZ!=null&&(t.returnZ=e.returnZ),n?.supportsM&&e.returnM!=null&&(t.returnM=e.returnM);let{timeOffset:r,timeExtent:i}=e;return t.timeExtent=r!=null&&i!=null?i.offset(-r.value,r.unit):i||null,t}function P(e){let{globalIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeGlobalID`)return e.name}}function F(e){let{objectIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeOID`)return e.name}}function I(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty(`capabilities`)||e.hasOwnProperty(`drawingInfo`)||e.hasOwnProperty(`hasAttachments`)||e.hasOwnProperty(`htmlPopupType`)||e.hasOwnProperty(`relationships`)||e.hasOwnProperty(`timeInfo`)||e.hasOwnProperty(`typeIdField`)||e.hasOwnProperty(`types`)?10:9.3}function L(e,t,n,r){let i=n?.feature,a=!!e.subtypes?.length;if(a&&!n?.excludeImpliedDomains){let n=z(e,t);if(n)return n}let o=a&&R(e,i);if(o){let e=o?.domains?.[t];return e?.type===`inherited`?r:e}let s=Y(e.types,e.typeIdField,i);if(s){let e=s.domains&&s.domains[t];if(e&&e?.type!==`inherited`)return e}if(r)return r;if(!n?.excludeImpliedDomains){let n=B(e,t);if(n)return n}return null}function R(e,t){let{subtypes:n,subtypeField:r}=e;if(!t?.attributes||!n?.length||!r)return null;let i=t.attributes[r];return i==null?null:n.find(e=>e.code===i)}function z(e,t){let{fieldsIndex:n,subtypeField:r}=e,{name:i,type:a}=n.get(t)??{};if(!i)return null;if((r&&n.get(r)?.name)===i&&e.subtypes?.length){let t=e.subtypes.map(e=>new u({code:H(e.code,a),name:e.name}));if(t?.length)return new d({codedValues:t})}return null}function B(e,t){let{fieldsIndex:n}=e,{name:r,type:i}=n.get(t)??{};if(!r)return null;if((`typeIdField`in e?n.get(e.typeIdField)?.name:null)===r&&`types`in e&&e.types?.length&&V(e.types)){let t=e.types?.map(e=>new u({code:H(e.id,i),name:e.name}));return new d({codedValues:t})}return null}function V(e){let t=new Set,n=new Set;for(let r of e){if(t.has(r.id)||n.has(r.name))return!1;t.add(r.id),n.add(r.name)}return!0}function H(e,t){return t?p({type:t})&&typeof e==`number`?`${e}`:m({type:t})&&typeof e==`string`?Number.parseInt(e,10):e:e}async function U(e){return(await e.load()).source}async function W(t,n){if(!e)return;let r=e.findCredential(t);if(r)return r.userId;let i;try{let r=await g(t,n);r&&(i=await e.checkSignInStatus(`${r}/sharing`))}catch{}return i?i.userId:null}async function G(t,n){if(!e||e.findCredential(t))return;let r;try{let i=await g(t,n);i&&(r=await e.checkSignInStatus(`${i}/sharing`))}catch{}if(r)try{let r=n==null?null:n.signal;await e.getCredential(t,{signal:r})}catch{}}async function ue(e,t,n){let r=e.parsedUrl?.path;r&&e.authenticationTriggerEvent===t&&await G(r,n)}async function de(e){let t=e.parsedUrl?.path;t&&fe(e)&&await G(t)}function fe(e){return pe(e)&&(`serviceDefinitionExpression`in e&&K(e.serviceDefinitionExpression)||`definitionExpression`in e&&K(e.definitionExpression))}function pe(e){return!!(ee(e)&&e.capabilities?.query.supportsCurrentUser)}function K(e){return!!e?.toLowerCase().includes(`current_user`)}function me(e){return X(e)?!1:e.userHasUpdateItemPrivileges||e.editingEnabled}const q=c({types:C});function he(e,t){if(e.defaultSymbol)return e.types?.length?new te({defaultSymbol:q(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map(e=>({id:e.id,symbol:q(e.symbol,e,t)}))}):new _({symbol:q(e.defaultSymbol,e,t)})}function ge(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;let n=e.editingInfo?.lastEditDate?.getTime();return n==null||(t*=1e3,Date.now()-n<t)}async function J(e,t,r){if(t==null)return null;let i=[],{objectIdField:a}=e;if(t.forEach(e=>{let t=null;if(`attributes`in e){let{attributes:n}=e;t={globalId:n[r],objectId:n[a]!=null&&n[a]!==-1?n[a]:null}}else t={globalId:e.globalId,objectId:e.objectId!=null&&e.objectId!==-1?e.objectId:null};t.globalId!=null&&(t.objectId==null||t.objectId===-1)&&i.push(t.globalId)}),i.length===0)return null;let o=e.createQuery();o.where=i.map(e=>`${r}='${e}'`).join(` OR `),o.returnGeometry=!1,o.outFields=[a,r],o.cacheHint=!1;let c=await n(f(e,o));if(!c.ok)return null;let l=new Map,u=c.value.features;for(let e of u){let t=e.attributes[r],n=e.attributes[a];t!=null&&n!=null&&n!==-1&&l.set(s(t),n)}return l}function Y(e,t,n){if(!t||!n||!e)return null;let r=n.getAttribute(t);if(r==null)return null;let i=e.filter(e=>{let{id:t}=e;return t!=null&&t.toString()===r.toString()});return i.length>1&&w().warn(`getFeatureType`,`Cannot unambiguously determine feature type because multiple types have the id ${r}.`),i[0]??null}function X(e){let t=e.sourceJSON;return t?.isMultiServicesView||t?.isReadOnly||_e(e)}function _e(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(`,`).map(e=>e.trim()).includes(`map`)}function ve(e,t,n){let i=t?.queryAttributeBins;if(!t?.operations?.supportsQueryBins||!i)throw new r(n,`Layer source does not support binning`);switch(e.binParameters?.type){case`auto-interval`:if(!i.supportsAutoInterval)throw new r(n,`Layer source does not support auto-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`);break;case`date`:if(!i.supportsDate)throw new r(n,`Layer source does not support date binning`);if(e.binParameters.snapToData&&!i.supportsSnapToData)throw new r(n,`Layer source does not support snapToData binning`);if(e.binParameters.returnFullIntervalBin&&!i.supportsReturnFullIntervalBin)throw new r(n,`Layer source does not support returnFullIntervalBin binning`);break;case`fixed-boundaries`:if(!i.supportsFixedBoundaries)throw new r(n,`Layer source does not support fixed-boundaries binning`);break;case`fixed-interval`:if(!i.supportsFixedInterval)throw new r(n,`Layer source does not support fixed-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`)}if(e.binParameters?.stackBy&&!i.supportsStackBy)throw new r(n,`Layer source does not support stackBy binning`);if(e.binParameters?.splitBy&&!i.supportsSplitBy)throw new r(n,`Layer source does not support splitBy binning`);if(e.binParameters?.firstDayOfWeek&&!i.supportsFirstDayOfWeek)throw new r(n,`Layer source does not support firstDayOfWeek binning`);let a=i?.supportedStatistics;if(e.outStatistics&&a){let t=new Map([[`count`,`count`],[`sum`,`sum`],[`min`,`min`],[`max`,`max`],[`avg`,`avg`],[`stddev`,`stddev`],[`var`,`var`],[`percentile-continuous`,`percentileContinuous`],[`percentile-discrete`,`percentileDiscrete`],[`centroid-aggregate`,`centroid`],[`convex-hull-aggregate`,`convexHull`],[`envelope-aggregate`,`envelope`]]);for(let{statisticType:i}of e.outStatistics){let e=t.get(i);if(e&&!a[e])throw new r(n,`Layer source does not support ${i} statistic type`)}}}function Z(e,t){return e!=null&&!!t?.[ne.toJSON(e)]}function Q(e){return h(e)?!!e.labelExpressionInfo?.expression:t(e)?e.expressionInfos?.some(e=>e.expression)?!0:Array.isArray(e.content)?e.content.some(e=>e.type===`expression`&&e.expressionInfo?.expression):!1:e.type===`dot-density`&&e.attributes?.some(e=>e.valueExpression)||`valueExpression`in e&&e.valueExpression?!0:`visualVariables`in e&&e.visualVariables!=null&&e.visualVariables.some(e=>e.valueExpression?!0:e.type===`size`?v(e.minSize)&&e.minSize.valueExpression||v(e.maxSize)&&e.maxSize.valueExpression:!1)}function ye(e){if(`renderer`in e&&e.renderer&&Q(e.renderer))return!0;if(`labelingInfo`in e&&e.labelingInfo){for(let t of e.labelingInfo)if(h(t)&&Q(t))return!0}return!1}async function be(e){let t=`returnZ`in e?e.returnZ:void 0,n=`returnM`in e?e.returnM:void 0;if(ye(e)){let{arcadeUtils:r}=await S();r.layerHasGeometryFunctions(e)&&(t=!0,n=!0)}if(`renderer`in e&&e.renderer?.symbols)for(let t of e.renderer.symbols)t.type===`cim`&&($??=(await import(`../../symbols/cim/CIMSymbolHelper.js`)).forEachSymbolLayer,$(t.data.symbol,e=>{switch(e.type){case`CIMPictureMarker`:case`CIMVectorMarker`:n||=e.markerPlacement?.type===`CIMMarkerPlacementAtMeasuredUnits`}}));return{returnZ:t,returnM:n}}let $;export{E as addAttachment,ie as applyEdits,de as checkServiceCurrentUserSupport,z as computeDomainFromSubtypes,B as computeDomainFromTypes,me as computeEffectiveEditingEnabled,he as createDefaultRenderer,N as createQuery,oe as deleteAttachments,G as ensureCredentialIfSignedIn,ue as ensureLayerCredential,se as fetchRecomputedExtents,T as geometryTypeKebabDict,R as getFeatureSubtype,Y as getFeatureType,L as getFieldDomain,J as getGlobalIdToObjectIdMap,W as getSignedInUser,K as hasCurrentUser,M as hasDataChanged,ge as isLayerCacheStale,be as layerRequiresGeometryZM,ce as queryAttachments,k as queryExtent,O as queryFeatureCount,le as queryObjectIds,A as queryRelatedFeatures,j as queryRelatedFeaturesCount,P as readGlobalIdField,F as readObjectIdField,I as readVersion,X as supportsQueryOnly,V as typesHaveUniqueIdsAndNames,re as updateAttachment,ae as uploadAssets,ve as validateBinsQuery};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{rad2deg as e}from"../../core/mathUtils.js";import{identity as t}from"../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as r,add as i,transformMat4 as a,copy as o,min as s,max as c,sub as l}from"../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as u,create as d}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as f}from"../../geometry/ellipsoidUtils.js";import p from"../../geometry/Extent.js";import m from"../../geometry/HeightModelInfo.js";import h from"../../geometry/SpatialReference.js";import{projectBuffer as g}from"../../geometry/projection/projectBuffer.js";import{nullId as _}from"../ILyr3DWasmPerSceneView.js";const v=new h({wkid:4326,vcsWkid:115700}),y=new p(-180,-90,180,90,v);function b(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(let t of e)if(typeof t!=`number`)return!1;return!0}const x=7645211,S={xmin:-180,ymin:-90,zmin:-450,xmax:180,ymax:90,zmax:8850},C=new Map([[5773,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`EGM96_Geoid`})],[3855,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`EGM2008_Geoid`})],[115700,new m({heightModel:`ellipsoidal`,heightUnit:`meters`,vertCRS:`WGS_1984`})],[115701,new m({heightModel:`ellipsoidal`,heightUnit:`meters`,vertCRS:`ETRS_1989`})],[6360,new m({heightModel:`gravity-related-height`,heightUnit:`us-feet`,vertCRS:`NAVD88_height_(ftUS)`})],[7837,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`DHHN2016_(height)`})],[5709,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`NAP`})]]);function w(e){let t=null;return e&&C.forEach((n,r)=>{!t&&n.vertCRS===e.vertCRS&&n.heightUnit===e.heightUnit&&(t=r)}),t}function T(e){if(!e)return null;let t=e.vcsWkid||e.latestVcsWkid;return t?C.get(t):null}function E(e){return!!(e.extensions?.ESRI_crs?.wkid||e.extensions?.ESRI_crs?.latestWkid||e.extensions?.ESRI_crs?.wkt||e.extensions?.ESRI_crs?.wkt2)}const D=n(),O=t(D);function k(t,n=!1){let m=new h({wkid:4326,vcsWkid:115700}),_=t.root?.boundingVolume,v=!1,C=t?.root?.transform;if(n&&E(t)&&(v=!0,m=new h(t.extensions?.ESRI_crs),(t.root?.extensions?.ESRI_crs?.boundingVolume?.box||t.root?.extensions?.ESRI_crs?.boundingVolume?.sphere)&&(_=t.root?.extensions?.ESRI_crs?.boundingVolume),C=t.root?.extensions?.ESRI_crs?.transform?t.root?.extensions?.ESRI_crs?.transform:O),!_)return y;if(_.box){let e=_?.box;if(e[3]>x&&e[7]>x&&e[11]>x)return new p({...S,spatialReference:m})}let w=d();if(!v&&_.region&&b(_.region,6)){let t=_.region,n=e(t[0]),r=e(t[1]),i=t[4],a=e(t[2]),o=e(t[3]),s=t[5];return new p({xmin:n,ymin:r,zmin:i,xmax:a,ymax:o,zmax:s,spatialReference:m})}if(_.sphere&&b(_.sphere,4)){let e=_.sphere,t=u(e[0],e[1],e[2]),n=e[3]/Math.sqrt(3),l=d();r(l,t,u(n,n,n));let y=d();if(i(y,t,u(n,n,n)),C&&b(C,16)){let e=C;a(w,l,e),o(l,w),a(w,y,e),o(y,w)}v||(g(l,f,0,l,h.WGS84,0),g(y,f,0,y,h.WGS84,0));let x=d(),S=d();return s(x,l,y),c(S,l,y),new p({xmin:x[0],ymin:x[1],zmin:x[2],xmax:S[0],ymax:S[1],zmax:S[2],spatialReference:m})}if(_.box&&b(_.box,12)){let e=_.box,t=u(e[0],e[1],e[2]),n=u(e[3],e[4],e[5]),r=u(e[6],e[7],e[8]),o=u(e[9],e[10],e[11]),y=[];for(let e=0;e<8;++e)y.push(d());if(i(y[0],t,n),i(y[0],y[0],r),i(y[0],y[0],o),l(y[1],t,n),i(y[1],y[1],r),i(y[1],y[1],o),i(y[2],t,n),l(y[2],y[2],r),i(y[2],y[2],o),l(y[3],t,n),l(y[3],y[3],r),i(y[3],y[3],o),i(y[4],t,n),i(y[4],y[4],r),l(y[4],y[4],o),l(y[5],t,n),i(y[5],y[5],r),l(y[5],y[5],o),i(y[6],t,n),l(y[6],y[6],r),l(y[6],y[6],o),l(y[7],t,n),l(y[7],y[7],r),l(y[7],y[7],o),C&&b(C,16)){let e=C;for(let t=0;t<8;++t)a(y[t],y[t],e)}let x=u(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),S=u(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let e=0;e<8;++e)v||g(y[e],f,0,y[e],h.WGS84,0),s(S,S,y[e]),c(x,x,y[e]);return new p({xmin:S[0],ymin:S[1],zmin:S[2],xmax:x[0],ymax:x[1],zmax:x[2],spatialReference:m})}return y}function A(e){typeof e.desc==`string`&&(e.desc=JSON.parse(e.desc));let t=e.desc?.geometry?.prims.length;return e.desc!=null&&e.desc.obb!=null&&t!=null&&e.validPrimitiveIndices.length>0&&e.validPrimitiveIndices.every(e=>Number.isInteger(e)&&e>=0&&e<t)}function j(e){return`${e}`}function M(e){return e!=null&&e!==_}export{y as default3DTilesFullExtent,v as default3DTilesSpatialReference,T as getHeightModelInfoFromVCS,w as getVCSFromHeightModelInfo,E as hasEsriCrs,k as initFullExtent,M as isValidHandle,j as makeCacheKey,A as validateEntity3D,b as verifyArray};
2
+ import{rad2deg as e}from"../../core/mathUtils.js";import{identity as t}from"../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as r,add as i,transformMat4 as a,copy as o,min as s,max as c,sub as l}from"../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as u,create as d}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as f}from"../../geometry/ellipsoidUtils.js";import p from"../../geometry/Extent.js";import m from"../../geometry/HeightModelInfo.js";import h from"../../geometry/SpatialReference.js";import{projectBuffer as g}from"../../geometry/projection/projectBuffer.js";import{nullId as _}from"../ILyr3DWasmPerSceneView.js";const v=new h({wkid:4326,vcsWkid:115700}),y=new p({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:v});function b(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(let t of e)if(typeof t!=`number`)return!1;return!0}const x=7645211,S={xmin:-180,ymin:-90,zmin:-450,xmax:180,ymax:90,zmax:8850},C=new Map([[5773,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`EGM96_Geoid`})],[3855,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`EGM2008_Geoid`})],[115700,new m({heightModel:`ellipsoidal`,heightUnit:`meters`,vertCRS:`WGS_1984`})],[115701,new m({heightModel:`ellipsoidal`,heightUnit:`meters`,vertCRS:`ETRS_1989`})],[6360,new m({heightModel:`gravity-related-height`,heightUnit:`us-feet`,vertCRS:`NAVD88_height_(ftUS)`})],[7837,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`DHHN2016_(height)`})],[5709,new m({heightModel:`gravity-related-height`,heightUnit:`meters`,vertCRS:`NAP`})]]);function w(e){let t=null;return e&&C.forEach((n,r)=>{!t&&n.vertCRS===e.vertCRS&&n.heightUnit===e.heightUnit&&(t=r)}),t}function T(e){if(!e)return null;let t=e.vcsWkid||e.latestVcsWkid;return t?C.get(t):null}function E(e){return!!(e.extensions?.ESRI_crs?.wkid||e.extensions?.ESRI_crs?.latestWkid||e.extensions?.ESRI_crs?.wkt||e.extensions?.ESRI_crs?.wkt2)}const D=n(),O=t(D);function k(t,n=!1){let m=new h({wkid:4326,vcsWkid:115700}),_=t.root?.boundingVolume,v=!1,C=t?.root?.transform;if(n&&E(t)&&(v=!0,m=new h(t.extensions?.ESRI_crs),(t.root?.extensions?.ESRI_crs?.boundingVolume?.box||t.root?.extensions?.ESRI_crs?.boundingVolume?.sphere)&&(_=t.root?.extensions?.ESRI_crs?.boundingVolume),C=t.root?.extensions?.ESRI_crs?.transform?t.root?.extensions?.ESRI_crs?.transform:O),!_)return y;if(_.box){let e=_?.box;if(e[3]>x&&e[7]>x&&e[11]>x)return new p({...S,spatialReference:m})}let w=d();if(!v&&_.region&&b(_.region,6)){let t=_.region,n=e(t[0]),r=e(t[1]),i=t[4],a=e(t[2]),o=e(t[3]),s=t[5];return new p({xmin:n,ymin:r,zmin:i,xmax:a,ymax:o,zmax:s,spatialReference:m})}if(_.sphere&&b(_.sphere,4)){let e=_.sphere,t=u(e[0],e[1],e[2]),n=e[3]/Math.sqrt(3),l=d();r(l,t,u(n,n,n));let y=d();if(i(y,t,u(n,n,n)),C&&b(C,16)){let e=C;a(w,l,e),o(l,w),a(w,y,e),o(y,w)}v||(g(l,f,0,l,h.WGS84,0),g(y,f,0,y,h.WGS84,0));let x=d(),S=d();return s(x,l,y),c(S,l,y),new p({xmin:x[0],ymin:x[1],zmin:x[2],xmax:S[0],ymax:S[1],zmax:S[2],spatialReference:m})}if(_.box&&b(_.box,12)){let e=_.box,t=u(e[0],e[1],e[2]),n=u(e[3],e[4],e[5]),r=u(e[6],e[7],e[8]),o=u(e[9],e[10],e[11]),y=[];for(let e=0;e<8;++e)y.push(d());if(i(y[0],t,n),i(y[0],y[0],r),i(y[0],y[0],o),l(y[1],t,n),i(y[1],y[1],r),i(y[1],y[1],o),i(y[2],t,n),l(y[2],y[2],r),i(y[2],y[2],o),l(y[3],t,n),l(y[3],y[3],r),i(y[3],y[3],o),i(y[4],t,n),i(y[4],y[4],r),l(y[4],y[4],o),l(y[5],t,n),i(y[5],y[5],r),l(y[5],y[5],o),i(y[6],t,n),l(y[6],y[6],r),l(y[6],y[6],o),l(y[7],t,n),l(y[7],y[7],r),l(y[7],y[7],o),C&&b(C,16)){let e=C;for(let t=0;t<8;++t)a(y[t],y[t],e)}let x=u(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),S=u(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let e=0;e<8;++e)v||g(y[e],f,0,y[e],h.WGS84,0),s(S,S,y[e]),c(x,x,y[e]);return new p({xmin:S[0],ymin:S[1],zmin:S[2],xmax:x[0],ymax:x[1],zmax:x[2],spatialReference:m})}return y}function A(e){typeof e.desc==`string`&&(e.desc=JSON.parse(e.desc));let t=e.desc?.geometry?.prims.length;return e.desc!=null&&e.desc.obb!=null&&t!=null&&e.validPrimitiveIndices.length>0&&e.validPrimitiveIndices.every(e=>Number.isInteger(e)&&e>=0&&e<t)}function j(e){return`${e}`}function M(e){return e!=null&&e!==_}export{y as default3DTilesFullExtent,v as default3DTilesSpatialReference,T as getHeightModelInfoFromVCS,w as getVCSFromHeightModelInfo,E as hasEsriCrs,k as initFullExtent,M as isValidHandle,j as makeCacheKey,A as validateEntity3D,b as verifyArray};