@arcgis/core 5.2.0-next.75 → 5.2.0-next.77

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 (295) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/013c9cc198736a72f7f2.js +1 -0
  4. package/assets/esri/core/workers/chunks/0194244a3f437ad74045.js +1 -0
  5. package/assets/esri/core/workers/chunks/040a73b2a23577e1eabd.js +1 -0
  6. package/assets/esri/core/workers/chunks/{0d3b2d9a19383bb63f0a.js → 05663093b1d2a268b953.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js → 06c8547521ce9c97b258.js} +2 -2
  8. package/assets/esri/core/workers/chunks/{4dcd4a052b40047a9230.js → 08cac27df6c216ae1995.js} +1 -1
  9. package/assets/esri/core/workers/chunks/08ec5461af74356e7570.js +1 -0
  10. package/assets/esri/core/workers/chunks/0909816f13d25cacf250.js +1 -0
  11. package/assets/esri/core/workers/chunks/0933203eee15ea50e123.js +1 -0
  12. package/assets/esri/core/workers/chunks/{5e1d84e97de0e662aaa9.js → 1142f8e9c80207d6bdae.js} +1 -1
  13. package/assets/esri/core/workers/chunks/16929524565a677db4dc.js +1 -0
  14. package/assets/esri/core/workers/chunks/16a04fc184728d66e6e1.js +1 -0
  15. package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +1 -0
  16. package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js → 17e9324a02b69733307a.js} +2 -2
  17. package/assets/esri/core/workers/chunks/1a467da4c0b33f655199.js +1 -0
  18. package/assets/esri/core/workers/chunks/1ef28d4457c8c943ad19.js +1 -0
  19. package/assets/esri/core/workers/chunks/{2b93888e61ca638490cf.js → 20b54e7872d967f3be32.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{5f31b375971ab067121e.js → 21f763694a41968ac21a.js} +1 -1
  21. package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +1 -0
  22. package/assets/esri/core/workers/chunks/257f1e8316877f611e11.js +1 -0
  23. package/assets/esri/core/workers/chunks/270ed3070d118edb3f37.js +1 -0
  24. package/assets/esri/core/workers/chunks/29a20a37e7837142fa6b.js +2 -0
  25. package/assets/esri/core/workers/chunks/2e7c830b5b1fe406169f.js +1 -0
  26. package/assets/esri/core/workers/chunks/315031323e11a18154e3.js +1 -0
  27. package/assets/esri/core/workers/chunks/385b23d4bd5275031fb6.js +1 -0
  28. package/assets/esri/core/workers/chunks/393f79843d5a78c1cc37.js +1 -0
  29. package/assets/esri/core/workers/chunks/3958d92c737b3a2a3bc2.js +1 -0
  30. package/assets/esri/core/workers/chunks/3b5c5356353f1a2303a0.js +1 -0
  31. package/assets/esri/core/workers/chunks/{6743d726e45e7b660505.js → 4115bab15c19b4f5ae08.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{99e3aa4832ed87474ab4.js → 44857a76be2c0ac65bb9.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{4491dc227c28e2ab4f8e.js → 484b251fbcbffcb58323.js} +1 -1
  34. package/assets/esri/core/workers/chunks/48e2d0bfb62e1f4f2ad9.js +1 -0
  35. package/assets/esri/core/workers/chunks/{7f2f2a92dce3f68e579b.js → 4b54444c04fbd6f42c18.js} +1 -1
  36. package/assets/esri/core/workers/chunks/4c82f5f23004f905a18f.js +1 -0
  37. package/assets/esri/core/workers/chunks/53eed0941a39b56cc034.js +1 -0
  38. package/assets/esri/core/workers/chunks/56e6d8c4a9ed893ce951.js +1 -0
  39. package/assets/esri/core/workers/chunks/57159bcac86d660dcceb.js +1 -0
  40. package/assets/esri/core/workers/chunks/{36ec5b84e551ab08b24a.js → 57e26a86d46e02c89c4f.js} +1 -1
  41. package/assets/esri/core/workers/chunks/58026fc30d8a0ded4102.js +1 -0
  42. package/assets/esri/core/workers/chunks/59598023c0aea62a6297.js +1 -0
  43. package/assets/esri/core/workers/chunks/5bf2ce280ea35ea4c96b.js +1 -0
  44. package/assets/esri/core/workers/chunks/5fd2aa0be03dfb494efa.js +1 -0
  45. package/assets/esri/core/workers/chunks/619aa1381296172ff47b.js +1 -0
  46. package/assets/esri/core/workers/chunks/62f37d1075390a177ae9.js +1 -0
  47. package/assets/esri/core/workers/chunks/65d1e338612e59063eba.js +1 -0
  48. package/assets/esri/core/workers/chunks/680dd7b7638465eb33de.js +1 -0
  49. package/assets/esri/core/workers/chunks/{b14961a9f1f40028f141.js → 6c982779d6d47ec99899.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{a52c88e2d837b525ff6c.js → 71ee7c51d2c60a180f1e.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{6b783f440c4a5d36e879.js → 75fc0b1db8e2e3fd2458.js} +1 -1
  52. package/assets/esri/core/workers/chunks/79429c8be5da85713200.js +1 -0
  53. package/assets/esri/core/workers/chunks/7b470d6ad182548b9e95.js +1 -0
  54. package/assets/esri/core/workers/chunks/7d8eb4dbea1916320f74.js +1 -0
  55. package/assets/esri/core/workers/chunks/{67f54586156d1ab80257.js → 81cd0cb9ae1371765d32.js} +1 -1
  56. package/assets/esri/core/workers/chunks/83556c9f6f85c2a46779.js +1 -0
  57. package/assets/esri/core/workers/chunks/{d1c7c877edc6948f3801.js → 8762da315cf5086167c3.js} +1 -1
  58. package/assets/esri/core/workers/chunks/87eaed6fdabd482d142e.js +1 -0
  59. package/assets/esri/core/workers/chunks/88d5541679e77117bf03.js +1 -0
  60. package/assets/esri/core/workers/chunks/894ebc64b698e5d7604b.js +1 -0
  61. package/assets/esri/core/workers/chunks/{4046bd65d7d0677f4600.js → 8d9a7fa14489897780d3.js} +1 -1
  62. package/assets/esri/core/workers/chunks/8e225dd0319672103561.js +1 -0
  63. package/assets/esri/core/workers/chunks/9199300ffd225a1bbef1.js +1 -0
  64. package/assets/esri/core/workers/chunks/{3e2b4e734aa20a308f3e.js → 95956d62591d689f1135.js} +1 -1
  65. package/assets/esri/core/workers/chunks/98613fded899c59f34a4.js +1 -0
  66. package/assets/esri/core/workers/chunks/9e1392a0c608a13ab036.js +1 -0
  67. package/assets/esri/core/workers/chunks/{53d165b4f30fd64e5d8a.js → a4e4fa4dd1a122bbf7cd.js} +1 -1
  68. package/assets/esri/core/workers/chunks/a5240c8a47842138f31f.js +1 -0
  69. package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +1 -0
  70. package/assets/esri/core/workers/chunks/a7727a2377470d586ff9.js +1 -0
  71. package/assets/esri/core/workers/chunks/{7a24cc0f3b4eff2bdb8e.js → ac2ba5c3d613d7d5183a.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{6cd6d0cfd313f0475d98.js → ac59218847e5ef4c4160.js} +1 -1
  73. package/assets/esri/core/workers/chunks/ac87be2210f868524996.js +1 -0
  74. package/assets/esri/core/workers/chunks/aed16c3e26652960ad3f.js +1 -0
  75. package/assets/esri/core/workers/chunks/{43713bc6f7eea07259d0.js → b084829a3fd709dc47a8.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{05f6887805d92da03122.js → b24fc7eeda580ef020d2.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{5ba3a30b7cbfa9e3aa62.js → b2812279662f1a5f8d06.js} +1 -1
  78. package/assets/esri/core/workers/chunks/b37a20c5c4a4686257d4.js +1 -0
  79. package/assets/esri/core/workers/chunks/{43a65cab888d43954564.js → b4abf82b8ac974a55ae1.js} +1 -1
  80. package/assets/esri/core/workers/chunks/b82763e9401b16121f8d.js +2 -0
  81. package/assets/esri/core/workers/chunks/bab5f4b2424b487b87ac.js +1 -0
  82. package/assets/esri/core/workers/chunks/bbc6b270d2032189107c.js +1 -0
  83. package/assets/esri/core/workers/chunks/bc6e488f5fbd50f9f3d0.js +1 -0
  84. package/assets/esri/core/workers/chunks/bd7d87d175ba933ab2ce.js +1 -0
  85. package/assets/esri/core/workers/chunks/{1c49c9472167a2e0c923.js → c17dda6fadb8bfad0d51.js} +1 -1
  86. package/assets/esri/core/workers/chunks/c1e5ffe9a251be5a0744.js +1 -0
  87. package/assets/esri/core/workers/chunks/c69cf08da4e4c2c824ee.js +1717 -0
  88. package/assets/esri/core/workers/chunks/ca6652c6304ad0e37e8f.js +1 -0
  89. package/assets/esri/core/workers/chunks/cd74de12005834244a47.js +1 -0
  90. package/assets/esri/core/workers/chunks/{762be5d3e6aeaea33f74.js → cef02ed3942c010da2e8.js} +1 -1
  91. package/assets/esri/core/workers/chunks/d520d407043bc52e5410.js +1 -0
  92. package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +1 -0
  93. package/assets/esri/core/workers/chunks/dff932682d6386a861ce.js +1 -0
  94. package/assets/esri/core/workers/chunks/{2c31648a4b95275516ee.js → e227eb44cd139fe2bc1b.js} +1 -1
  95. package/assets/esri/core/workers/chunks/e4e5a171a4874c5af4a4.js +1 -0
  96. package/assets/esri/core/workers/chunks/{ddb92c815d17c67a45e6.js → e5d114f2b57d2b8e2f1c.js} +1 -1
  97. package/assets/esri/core/workers/chunks/e89e6eea380ca2c13b64.js +1 -0
  98. package/assets/esri/core/workers/chunks/e9d352d030dcad1619a6.js +1 -0
  99. package/assets/esri/core/workers/chunks/{3de6e54b6ed0feae1940.js → eae51e827f629ab37207.js} +1 -1
  100. package/assets/esri/core/workers/chunks/eee1fd629619021ea279.js +1 -0
  101. package/assets/esri/core/workers/chunks/{b6cd165d0e58598f28a5.js → ef47a5da641cb0d33fdf.js} +1 -1
  102. package/assets/esri/core/workers/chunks/{0eb35e09765fd74eb698.js → ef803fb25741e9f2a0a1.js} +1 -1
  103. package/assets/esri/core/workers/chunks/f35e749bb5be39880cbe.js +1 -0
  104. package/assets/esri/core/workers/chunks/f3bbebedad51f776bb98.js +1 -0
  105. package/assets/esri/core/workers/chunks/{3dff36f6de181d9dcdc5.js → f40e4433e7608d0962a6.js} +1 -1
  106. package/assets/esri/core/workers/chunks/f703bc002c732d1c045d.js +1 -0
  107. package/assets/esri/core/workers/chunks/fdd4f78facec6387cdb0.js +1 -0
  108. package/assets/esri/core/workers/chunks/ffd5285c7b2c83208f87.js +2 -0
  109. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  110. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  111. package/assets/esri/libs/text/pkg/bundle_bg.wasm +0 -0
  112. package/chunks/HeatmapDensity.glsl.js +5 -5
  113. package/chunks/bundle2.js +1 -1
  114. package/chunks/lyr3DMain.js +1 -1
  115. package/chunks/lyr3DWorker.js +1 -1
  116. package/config.js +1 -1
  117. package/geometry/geometryEngine.js +1 -1
  118. package/geometry/support/centroid.js +1 -1
  119. package/geometry/support/extentUtils.js +1 -1
  120. package/geometry/support/frustum.js +1 -1
  121. package/geometry/support/webMercatorUtils.d.ts +38 -14
  122. package/kernel.js +1 -1
  123. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  124. package/layers/VectorTileLayer.d.ts +40 -22
  125. package/layers/graphics/data/QueryEngineResult.js +1 -1
  126. package/layers/graphics/data/projectionSupport.js +1 -1
  127. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  128. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  129. package/layers/support/RasterJobHandler.js +1 -1
  130. package/layers/video/VideoController.js +1 -1
  131. package/package.json +4 -4
  132. package/support/revision.js +1 -1
  133. package/symbols/cim/animationUtils.js +1 -1
  134. package/symbols/cim/cimAnalyzer.js +1 -1
  135. package/symbols/cim/effects/EffectCircularSector.js +1 -1
  136. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  137. package/views/2d/engine/webgl/animations/infos.js +1 -1
  138. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
  140. package/views/3d/GroundView3D.js +1 -1
  141. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  142. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  143. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  144. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  145. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  146. package/views/3d/layers/MediaLayerView3D.js +1 -1
  147. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  148. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  149. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  150. package/views/3d/state/HUDOccludedFragmentOpacity.js +1 -1
  151. package/views/3d/state/ViewState.js +1 -1
  152. package/views/3d/state/ViewStateManager.js +1 -1
  153. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  154. package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
  155. package/views/3d/support/flow/geometryUtils.js +1 -1
  156. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  157. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  158. package/views/3d/support/renderInfoUtils/line.js +1 -1
  159. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  160. package/views/3d/terrain/DrapedZ.js +2 -0
  161. package/views/3d/terrain/OverlayManager.js +1 -1
  162. package/views/3d/terrain/OverlayRenderer.js +1 -1
  163. package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
  164. package/views/3d/terrain/TerrainRenderer.js +1 -1
  165. package/views/3d/terrain/TerrainSurface.js +1 -1
  166. package/views/3d/terrain/TerrainWaterproofnessDiagnostics.js +2 -0
  167. package/views/3d/webgl/RenderCamera.js +1 -1
  168. package/views/3d/webgl/RenderNode.js +1 -1
  169. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
  170. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
  171. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  172. package/views/3d/webgl-engine/lib/PositionReader.js +1 -1
  173. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  174. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
  175. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  176. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  177. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  178. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  179. package/views/3d/webgl-engine/parts/Model.js +1 -1
  180. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
  181. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
  182. package/views/support/waitForResources.js +1 -1
  183. package/views/webgl/RenderingContext.js +1 -1
  184. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +20 -6
  185. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  186. package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +100 -0
  187. package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.js +2 -0
  188. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  189. package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
  190. package/widgets/BatchAttributeForm.js +1 -1
  191. package/widgets/Feature/FeatureViewModel.d.ts +4 -3
  192. package/widgets/Feature/FeatureViewModel.js +1 -1
  193. package/widgets/Feature.js +1 -1
  194. package/widgets/Features/FeaturesViewModel.d.ts +4 -2
  195. package/widgets/Features/FeaturesViewModel.js +1 -1
  196. package/widgets/Features.js +1 -1
  197. package/widgets/OrientedImageryViewer.js +1 -1
  198. package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
  199. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  200. package/widgets/Popup/PopupViewModel.d.ts +1 -0
  201. package/widgets/Popup/PopupViewModel.js +1 -1
  202. package/widgets/Popup.js +1 -1
  203. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  204. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  205. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  206. package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
  207. package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +0 -1
  208. package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +0 -1
  209. package/assets/esri/core/workers/chunks/0823961e5d0bdedbf8cf.js +0 -2
  210. package/assets/esri/core/workers/chunks/0aedeb837399d3f92e4a.js +0 -1
  211. package/assets/esri/core/workers/chunks/0bf644f93c180a2bc2f8.js +0 -705
  212. package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +0 -1
  213. package/assets/esri/core/workers/chunks/1119a33245138e7b3914.js +0 -1
  214. package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +0 -1
  215. package/assets/esri/core/workers/chunks/186bedc377cc97731ca2.js +0 -2
  216. package/assets/esri/core/workers/chunks/1cf8fb704c48ac3d3b15.js +0 -1
  217. package/assets/esri/core/workers/chunks/2435ef7d11f8dbb920b7.js +0 -256
  218. package/assets/esri/core/workers/chunks/2791f3fe16ca5ee2f39a.js +0 -1
  219. package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +0 -1
  220. package/assets/esri/core/workers/chunks/2d45daacec0d5ed38782.js +0 -1
  221. package/assets/esri/core/workers/chunks/2ea3ca68cfa4d34e8f3b.js +0 -1
  222. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +0 -1
  223. package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +0 -1
  224. package/assets/esri/core/workers/chunks/32f5112c848efec6c33b.js +0 -1
  225. package/assets/esri/core/workers/chunks/3bc2943035391b44d4cf.js +0 -29
  226. package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +0 -1
  227. package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +0 -1
  228. package/assets/esri/core/workers/chunks/42d5ed44111bea77ec71.js +0 -1462
  229. package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +0 -1
  230. package/assets/esri/core/workers/chunks/4710f21b138a2c9a0345.js +0 -1
  231. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +0 -1
  232. package/assets/esri/core/workers/chunks/4c2794687aea172775a0.js +0 -1
  233. package/assets/esri/core/workers/chunks/4d9bde9f66817a92ceca.js +0 -1
  234. package/assets/esri/core/workers/chunks/4fe2cca405180af23364.js +0 -1
  235. package/assets/esri/core/workers/chunks/519af918050b47f93516.js +0 -1
  236. package/assets/esri/core/workers/chunks/5600fc334d20c4f0c83d.js +0 -1
  237. package/assets/esri/core/workers/chunks/5627f562dea8bae2f346.js +0 -1
  238. package/assets/esri/core/workers/chunks/5bf4ab72b9634b06cc5d.js +0 -1
  239. package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +0 -1
  240. package/assets/esri/core/workers/chunks/6f58cb9dffe8016397a2.js +0 -1
  241. package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +0 -1
  242. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +0 -1
  243. package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +0 -1
  244. package/assets/esri/core/workers/chunks/7f91e45156bbe88f9a62.js +0 -1
  245. package/assets/esri/core/workers/chunks/8302bffd28cc6720e0fe.js +0 -2
  246. package/assets/esri/core/workers/chunks/8a48a6760c33ed50b650.js +0 -1
  247. package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +0 -1
  248. package/assets/esri/core/workers/chunks/903e1cd8b76eff19ebdf.js +0 -1
  249. package/assets/esri/core/workers/chunks/917c11cb40a7742d7f98.js +0 -1
  250. package/assets/esri/core/workers/chunks/91d133c04ca764d74934.js +0 -1
  251. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +0 -1
  252. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +0 -1
  253. package/assets/esri/core/workers/chunks/9482a6d7baa24bbf5693.js +0 -1
  254. package/assets/esri/core/workers/chunks/96cec8a02ca96175d602.js +0 -1
  255. package/assets/esri/core/workers/chunks/9902fcd2070c8eb6d043.js +0 -1
  256. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +0 -1
  257. package/assets/esri/core/workers/chunks/9be6827e5756031a56c1.js +0 -1
  258. package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +0 -1
  259. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +0 -1
  260. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +0 -1
  261. package/assets/esri/core/workers/chunks/a3bf8aa81ee398da5b52.js +0 -1
  262. package/assets/esri/core/workers/chunks/a7a7d3289d4ca95f545f.js +0 -1
  263. package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +0 -1
  264. package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +0 -1
  265. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +0 -1
  266. package/assets/esri/core/workers/chunks/b78f509fd8e95f728178.js +0 -1
  267. package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +0 -1
  268. package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +0 -1
  269. package/assets/esri/core/workers/chunks/c02ae1d40c1fe95ae6c5.js +0 -1
  270. package/assets/esri/core/workers/chunks/c1189316d24fb4cdb2a0.js +0 -1
  271. package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +0 -1
  272. package/assets/esri/core/workers/chunks/c82ab4f0908290e70ee9.js +0 -1
  273. package/assets/esri/core/workers/chunks/cc5ec6e99aa09342c704.js +0 -1
  274. package/assets/esri/core/workers/chunks/cd892c9603710d6130a9.js +0 -1
  275. package/assets/esri/core/workers/chunks/d021775cf747556660a5.js +0 -1
  276. package/assets/esri/core/workers/chunks/d633e98b0dfa0490e4de.js +0 -1
  277. package/assets/esri/core/workers/chunks/d79ce047afbc034f6008.js +0 -1
  278. package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +0 -1
  279. package/assets/esri/core/workers/chunks/dbc9249dae41096d750d.js +0 -1
  280. package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +0 -1
  281. package/assets/esri/core/workers/chunks/ec1841e6e498d54012eb.js +0 -1
  282. package/assets/esri/core/workers/chunks/ed1de8b7406269e217b9.js +0 -29
  283. package/assets/esri/core/workers/chunks/ee9eb381e675d2d01260.js +0 -1
  284. package/assets/esri/core/workers/chunks/f2ab8e49c7f17f488aa8.js +0 -1
  285. package/assets/esri/core/workers/chunks/f43a0edf58941e2ac78e.js +0 -1
  286. package/assets/esri/core/workers/chunks/f78acff510ca615d42e4.js +0 -1
  287. package/assets/esri/core/workers/chunks/f7a5c4d22a24e1ac433c.js +0 -1
  288. package/chunks/geometryEngineBase.js +0 -2
  289. package/geometry/geometryAdapters/json.js +0 -2
  290. package/geometry/geometryEngineJSON.js +0 -2
  291. /package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js.LICENSE.txt → 06c8547521ce9c97b258.js.LICENSE.txt} +0 -0
  292. /package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js.LICENSE.txt → 17e9324a02b69733307a.js.LICENSE.txt} +0 -0
  293. /package/assets/esri/core/workers/chunks/{0823961e5d0bdedbf8cf.js.LICENSE.txt → 29a20a37e7837142fa6b.js.LICENSE.txt} +0 -0
  294. /package/assets/esri/core/workers/chunks/{8302bffd28cc6720e0fe.js.LICENSE.txt → b82763e9401b16121f8d.js.LICENSE.txt} +0 -0
  295. /package/assets/esri/core/workers/chunks/{186bedc377cc97731ca2.js.LICENSE.txt → ffd5285c7b2c83208f87.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{collectPath as t}from"../geometryCursorCollectUtils.js";import{getMidpoint as n,getLength as e}from"./coordsUtils.js";function r(t){return t?t.hasZ?[t.xmax-t.xmin/2,t.ymax-t.ymin/2,t.zmax-t.zmin/2]:[t.xmax-t.xmin/2,t.ymax-t.ymin/2]:null}function l(t){return u(t.rings,t.hasZ??!1)}function o(t){const n=l(t);if(!n)return null;const{hasZ:e,spatialReference:r}=t,[o,u,i]=n;return isNaN(o)||isNaN(u)||e&&isNaN(i)?null:{x:o,y:u,z:e?i:void 0,spatialReference:r}}function u(t,n){if(!t?.length)return null;const e=[],r=[],l=n?[1/0,-1/0,1/0,-1/0,1/0,-1/0]:[1/0,-1/0,1/0,-1/0];for(let o=0,u=t.length;o<u;o++){const e=i(t[o],n,l);e&&r.push(e)}if(r.sort((t,e)=>{let r=t[2]-e[2];return 0===r&&n&&(r=t[4]-e[4]),r}),r.length&&(e[0]=r[0][0],e[1]=r[0][1],n&&(e[2]=r[0][3]),(e[0]<l[0]||e[0]>l[1]||e[1]<l[2]||e[1]>l[3]||n&&(e[2]<l[4]||e[2]>l[5]))&&(e.length=0)),!e.length){const r=t[0]&&t[0].length?h(t[0],n):null;if(!r)return null;e[0]=r[0],e[1]=r[1],n&&r.length>2&&(e[2]=r[2])}return e}function i(t,n,e){let r=0,l=0,o=0,u=0,i=0;const s=t.length?t[0][0]:0,h=t.length?t[0][1]:0,I=t.length&&n?t[0][2]:0;for(let f=0;f<t.length;f++){const c=t[f],N=t[(f+1)%t.length],[a,x,g]=c,m=a-s,P=x-h,[T,y,E]=N,p=T-s,S=y-h,z=m*S-p*P;if(u+=z,r+=(m+p)*z,l+=(P+S)*z,n&&c.length>2&&N.length>2){const t=g-I,n=E-I,e=m*n-p*t;o+=(t+n)*e,i+=e}a<e[0]&&(e[0]=a),a>e[1]&&(e[1]=a),x<e[2]&&(e[2]=x),x>e[3]&&(e[3]=x),n&&(g<e[4]&&(e[4]=g),g>e[5]&&(e[5]=g))}if(u>0&&(u*=-1),i>0&&(i*=-1),!u)return null;u*=.5,i*=.5;const c=[r/(6*u)+s,l/(6*u)+h,u];return n&&(e[4]===e[5]||0===i?(c[3]=(e[4]+e[5])/2,c[4]=0):(c[3]=o/(6*i)+I,c[4]=i)),c}function s(t,n){let e=0,r=0,l=0;t.nextPoint();const o=t.pathSize?t.x:0,u=t.pathSize?t.y:0;for(let i=0;i<t.pathSize;i++){t.seekInPath(i);const s=[t.x,t.y];t.seekInPath((i+1)%t.pathSize);const h=[t.x,t.y],[I,c]=s,f=I-o,N=c-u,[a,x]=h,g=a-o,m=x-u,P=f*m-g*N;l+=P,e+=(f+g)*P,r+=(N+m)*P,I<n[0]&&(n[0]=I),I>n[1]&&(n[1]=I),c<n[2]&&(n[2]=c),c>n[3]&&(n[3]=c)}if(l>0&&(l*=-1),!l)return null;l*=.5;return[e/(6*l)+o,r/(6*l)+u,l]}function h(t,r){const l=r?[0,0,0]:[0,0],o=r?[0,0,0]:[0,0];let u=0,i=0,s=0,h=0;for(let I=0,c=t.length;I<c-1;I++){const c=t[I],f=t[I+1];if(c&&f){l[0]=c[0],l[1]=c[1],o[0]=f[0],o[1]=f[1],r&&c.length>2&&f.length>2&&(l[2]=c[2],o[2]=f[2]);const t=e(l,o);if(t){u+=t;const e=n(c,f);i+=t*e[0],s+=t*e[1],r&&e.length>2&&(h+=t*e[2])}}}return u>0?r?[i/u,s/u,h/u]:[i/u,s/u]:t.length?t[0]:null}function I(n){const{hasZ:e,totalSize:r}=n;if(0===r)return null;const l=[],o=[],u=e?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];for(n.reset();n.nextPath();){const e=i(t(n),n.hasZ,u);e&&o.push(e)}if(o.sort((t,n)=>{let r=t[2]-n[2];return 0===r&&e&&(r=t[4]-n[4]),r}),o.length&&(l[0]=o[0][0],l[1]=o[0][1],e&&(l[2]=o[0][3]),(l[0]<u[0]||l[0]>u[1]||l[1]<u[2]||l[1]>u[3]||e&&(l[2]<u[4]||l[2]>u[5]))&&(l.length=0)),!l.length){n.reset(),n.nextPath();const t=n.pathSize?c(n):null;if(!t)return null;l[0]=t[0],l[1]=t[1],e&&t.length>2&&(l[2]=t[2])}return l}function c(t){const{hasZ:r}=t,l=r?[0,0,0]:[0,0],o=r?[0,0,0]:[0,0];let u=0,i=0,s=0,h=0;if(t.nextPoint()){let I=t.x,c=t.y,f=t.z;for(;t.nextPoint();){const N=t.x,a=t.y,x=t.z;l[0]=I,l[1]=c,o[0]=N,o[1]=a,r&&(l[2]=f,o[2]=x);const g=e(l,o);if(g){u+=g;const t=n(l,o);i+=g*t[0],s+=g*t[1],r&&t.length>2&&(h+=g*t[2])}I=N,c=a,f=x}}return u>0?r?[i/u,s/u,h/u]:[i/u,s/u]:t.pathSize?(t.seekPathStart(),t.nextPoint(),[t.x,t.y]):null}const f=1e-6;function N(t){let n=0;for(t.reset();t.nextPath();)n+=t.getCurrentRingArea();if(n<f){const n=I(t);return n?[n[0],n[1]]:null}const e=[0,0];if(t.reset(),!t.nextPath()||!t.nextPoint())return null;const r=[t.x,t.y];for(t.reset();t.nextPath();)x(e,r,t);return e[0]*=1/n,e[1]*=1/n,e[0]+=r[0],e[1]+=r[1],e}const a=1/3;function x(t,n,e){if(!t||!e||e.pathSize<3)return null;e.nextPoint();const r=e.x,l=e.y;e.nextPoint();let o,u=e.x-r,i=e.y-l,s=0,h=0;for(;e.nextPoint();)s=e.x-r,h=e.y-l,o=.5*a*(s*i-h*u),t[0]+=o*(u+s),t[1]+=o*(i+h),u=s,i=h;const I=e.getCurrentRingArea(),c=[r,l];return c[0]-=n[0],c[1]-=n[1],c[0]*=I,c[1]*=I,t[0]+=c[0],t[1]+=c[1],t}export{r as extentCentroid,h as lineCentroid,c as lineCentroidCursor,l as polygonCentroid,o as polygonCentroidPoint,i as ringCentroid,s as ringCentroidCursorXY,u as ringsCentroid,I as ringsCentroidCursor,N as weightedAreaCentroid};
2
+ import{collectPath as t}from"../geometryCursorCollectUtils.js";import{getMidpoint as n,getLength as e}from"./coordsUtils.js";function r({xmin:t,xmax:n,ymin:e,ymax:r,zmin:l,zmax:o,hasZ:u}){const s=[(t+n)/2,(e+r)/2];return u&&s.push((l+o)/2),s}function l(t){return u(t.rings,t.hasZ??!1)}function o(t){const n=l(t);if(!n)return null;const{hasZ:e,spatialReference:r}=t,[o,u,s]=n;return isNaN(o)||isNaN(u)||e&&isNaN(s)?null:{x:o,y:u,z:e?s:void 0,spatialReference:r}}function u(t,n){if(!t?.length)return null;const e=[],r=[],l=n?[1/0,-1/0,1/0,-1/0,1/0,-1/0]:[1/0,-1/0,1/0,-1/0];for(let o=0,u=t.length;o<u;o++){const e=s(t[o],n,l);e&&r.push(e)}if(r.sort((t,e)=>{let r=t[2]-e[2];return 0===r&&n&&(r=t[4]-e[4]),r}),r.length&&(e[0]=r[0][0],e[1]=r[0][1],n&&(e[2]=r[0][3]),(e[0]<l[0]||e[0]>l[1]||e[1]<l[2]||e[1]>l[3]||n&&(e[2]<l[4]||e[2]>l[5]))&&(e.length=0)),!e.length){const r=t[0]&&t[0].length?h(t[0],n):null;if(!r)return null;e[0]=r[0],e[1]=r[1],n&&r.length>2&&(e[2]=r[2])}return e}function s(t,n,e){let r=0,l=0,o=0,u=0,s=0;const i=t.length?t[0][0]:0,h=t.length?t[0][1]:0,c=t.length&&n?t[0][2]:0;for(let f=0;f<t.length;f++){const I=t[f],N=t[(f+1)%t.length],[a,g,x]=I,m=a-i,P=g-h,[T,p,E]=N,y=T-i,S=p-h,z=m*S-y*P;if(u+=z,r+=(m+y)*z,l+=(P+S)*z,n&&I.length>2&&N.length>2){const t=x-c,n=E-c,e=m*n-y*t;o+=(t+n)*e,s+=e}a<e[0]&&(e[0]=a),a>e[1]&&(e[1]=a),g<e[2]&&(e[2]=g),g>e[3]&&(e[3]=g),n&&(x<e[4]&&(e[4]=x),x>e[5]&&(e[5]=x))}if(u>0&&(u*=-1),s>0&&(s*=-1),!u)return null;u*=.5,s*=.5;const I=[r/(6*u)+i,l/(6*u)+h,u];return n&&(e[4]===e[5]||0===s?(I[3]=(e[4]+e[5])/2,I[4]=0):(I[3]=o/(6*s)+c,I[4]=s)),I}function i(t,n){let e=0,r=0,l=0;t.nextPoint();const o=t.pathSize?t.x:0,u=t.pathSize?t.y:0;for(let s=0;s<t.pathSize;s++){t.seekInPath(s);const i=[t.x,t.y];t.seekInPath((s+1)%t.pathSize);const h=[t.x,t.y],[c,I]=i,f=c-o,N=I-u,[a,g]=h,x=a-o,m=g-u,P=f*m-x*N;l+=P,e+=(f+x)*P,r+=(N+m)*P,c<n[0]&&(n[0]=c),c>n[1]&&(n[1]=c),I<n[2]&&(n[2]=I),I>n[3]&&(n[3]=I)}if(l>0&&(l*=-1),!l)return null;l*=.5;return[e/(6*l)+o,r/(6*l)+u,l]}function h(t,r){const l=r?[0,0,0]:[0,0],o=r?[0,0,0]:[0,0];let u=0,s=0,i=0,h=0;for(let c=0,I=t.length;c<I-1;c++){const I=t[c],f=t[c+1];if(I&&f){l[0]=I[0],l[1]=I[1],o[0]=f[0],o[1]=f[1],r&&I.length>2&&f.length>2&&(l[2]=I[2],o[2]=f[2]);const t=e(l,o);if(t){u+=t;const e=n(I,f);s+=t*e[0],i+=t*e[1],r&&e.length>2&&(h+=t*e[2])}}}return u>0?r?[s/u,i/u,h/u]:[s/u,i/u]:t.length?t[0]:null}function c(n){const{hasZ:e,totalSize:r}=n;if(0===r)return null;const l=[],o=[],u=e?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];for(n.reset();n.nextPath();){const e=s(t(n),n.hasZ,u);e&&o.push(e)}if(o.sort((t,n)=>{let r=t[2]-n[2];return 0===r&&e&&(r=t[4]-n[4]),r}),o.length&&(l[0]=o[0][0],l[1]=o[0][1],e&&(l[2]=o[0][3]),(l[0]<u[0]||l[0]>u[1]||l[1]<u[2]||l[1]>u[3]||e&&(l[2]<u[4]||l[2]>u[5]))&&(l.length=0)),!l.length){n.reset(),n.nextPath();const t=n.pathSize?I(n):null;if(!t)return null;l[0]=t[0],l[1]=t[1],e&&t.length>2&&(l[2]=t[2])}return l}function I(t){const{hasZ:r}=t,l=r?[0,0,0]:[0,0],o=r?[0,0,0]:[0,0];let u=0,s=0,i=0,h=0;if(t.nextPoint()){let c=t.x,I=t.y,f=t.z;for(;t.nextPoint();){const N=t.x,a=t.y,g=t.z;l[0]=c,l[1]=I,o[0]=N,o[1]=a,r&&(l[2]=f,o[2]=g);const x=e(l,o);if(x){u+=x;const t=n(l,o);s+=x*t[0],i+=x*t[1],r&&t.length>2&&(h+=x*t[2])}c=N,I=a,f=g}}return u>0?r?[s/u,i/u,h/u]:[s/u,i/u]:t.pathSize?(t.seekPathStart(),t.nextPoint(),[t.x,t.y]):null}const f=1e-6;function N(t){let n=0;for(t.reset();t.nextPath();)n+=t.getCurrentRingArea();if(n<f){const n=c(t);return n?[n[0],n[1]]:null}const e=[0,0];if(t.reset(),!t.nextPath()||!t.nextPoint())return null;const r=[t.x,t.y];for(t.reset();t.nextPath();)g(e,r,t);return e[0]*=1/n,e[1]*=1/n,e[0]+=r[0],e[1]+=r[1],e}const a=1/3;function g(t,n,e){if(!t||!e||e.pathSize<3)return null;e.nextPoint();const r=e.x,l=e.y;e.nextPoint();let o,u=e.x-r,s=e.y-l,i=0,h=0;for(;e.nextPoint();)i=e.x-r,h=e.y-l,o=.5*a*(i*s-h*u),t[0]+=o*(u+i),t[1]+=o*(s+h),u=i,s=h;const c=e.getCurrentRingArea(),I=[r,l];return I[0]-=n[0],I[1]-=n[1],I[0]*=c,I[1]*=c,t[0]+=I[0],t[1]+=I[1],t}export{r as extentCentroid,h as lineCentroid,I as lineCentroidCursor,l as polygonCentroid,o as polygonCentroidPoint,s as ringCentroid,i as ringCentroidCursorXY,u as ringsCentroid,c as ringsCentroidCursor,N as weightedAreaCentroid};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getRingsOrPathsBounds as n,getPointsBounds as i}from"./boundsUtils.js";function t(n){return void 0!==n.xmin&&void 0!==n.ymin&&void 0!==n.xmax&&void 0!==n.ymax}function u(n){return void 0!==n.points}function r(n){return void 0!==n.x&&void 0!==n.y}function m(n){return void 0!==n.paths}function o(n){return void 0!==n.rings}const x=[];function a(n,i,t,u){return{xmin:n,ymin:i,xmax:t,ymax:u}}function c(n,i,t,u,r,m){return{xmin:n,ymin:i,zmin:t,xmax:u,ymax:r,zmax:m}}function s(n,i,t,u,r,m){return{xmin:n,ymin:i,mmin:t,xmax:u,ymax:r,mmax:m}}function e(n,i,t,u,r,m,o,x){return{xmin:n,ymin:i,zmin:t,mmin:u,xmax:r,ymax:m,zmax:o,mmax:x}}function f(n,i=!1,t=!1){return i?t?e(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]):c(n[0],n[1],n[2],n[3],n[4],n[5]):t?s(n[0],n[1],n[2],n[3],n[4],n[5]):a(n[0],n[1],n[2],n[3])}function l(n){return n?t(n)?n:r(n)?v(n):o(n)?d(n):m(n)?h(n):u(n)?y(n):null:null}function y(n){const{hasZ:t,hasM:u,points:r}=n,m=i(x,r,t??!1,u??!1,t??!1,u??!1);return m?f(m,t,u):null}function v(n){const{x:i,y:t,z:u,m:r}=n,m=null!=r;return null!=u?m?e(i,t,u,r,i,t,u,r):c(i,t,u,i,t,u):m?s(i,t,r,i,t,r):a(i,t,i,t)}function d(i){const{hasZ:t,hasM:u,rings:r,curveRings:m}=i,o=n(x,m??r,t??!1,u??!1);return o?f(o,t,u):null}function h(i){const{hasZ:t,hasM:u,paths:r,curvePaths:m}=i,o=n(x,m??r,t??!1,u??!1);return o?f(o,t,u):null}export{l as getGeometryExtent,y as getMultipointExtent,v as getPointExtent,d as getPolygonExtent,h as getPolylineExtent};
2
+ import{getRingsOrPathsBounds as n,getPointsBounds as m}from"./boundsUtils.js";function i(n){return void 0!==n.xmin&&void 0!==n.ymin&&void 0!==n.xmax&&void 0!==n.ymax}function t(n){return void 0!==n.points}function x(n){return void 0!==n.x&&void 0!==n.y}function a(n){return void 0!==n.paths}function u(n){return void 0!==n.rings}const r=[];function o(n,m,i,t){return{xmin:n,ymin:m,xmax:i,ymax:t}}function c(n,m,i,t,x,a){return{xmin:n,ymin:m,zmin:i,xmax:t,ymax:x,zmax:a}}function s(n,m,i,t,x,a){return{xmin:n,ymin:m,mmin:i,xmax:t,ymax:x,mmax:a}}function l(n,m,i,t,x,a,u,r){return{xmin:n,ymin:m,zmin:i,mmin:t,xmax:x,ymax:a,zmax:u,mmax:r}}function e(n,m=!1,i=!1){return m?i?l(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]):c(n[0],n[1],n[2],n[3],n[4],n[5]):i?s(n[0],n[1],n[2],n[3],n[4],n[5]):o(n[0],n[1],n[2],n[3])}function y(n){return n?i(n)?n:x(n)?z(n):u(n)?v(n):a(n)?M(n):t(n)?h(n):null:null}function f(n,{xmin:m,ymin:i,zmin:t,mmin:x,xmax:a,ymax:u,zmax:r,mmax:o}){n.xmin=Math.min(n.xmin,m),n.xmax=Math.max(n.xmax,a),n.ymin=Math.min(n.ymin,i),n.ymax=Math.max(n.ymax,u),null!=n.zmin&&(n.zmin=Math.min(n.zmin,t),n.zmax=Math.max(n.zmax,r)),null!=n.mmin&&(n.mmin=Math.min(n.mmin,x),n.mmax=Math.max(n.mmax,o))}function h(n){const{hasZ:i,hasM:t,points:x}=n,a=m(r,x,i??!1,t??!1,i??!1,t??!1);return a?e(a,i,t):null}function z(n){const{x:m,y:i,z:t,m:x}=n,a=null!=x;return null!=t?a?l(m,i,t,x,m,i,t,x):c(m,i,t,m,i,t):a?s(m,i,x,m,i,x):o(m,i,m,i)}function v(m){const{hasZ:i,hasM:t,rings:x,curveRings:a}=m,u=n(r,a??x,i??!1,t??!1);return u?e(u,i,t):null}function M(m){const{hasZ:i,hasM:t,paths:x,curvePaths:a}=m,u=n(r,a??x,i??!1,t??!1);return u?e(u,i,t):null}export{f as expandExtent,y as getGeometryExtent,h as getMultipointExtent,z as getPointExtent,v as getPolygonExtent,M as getPolylineExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{transformMat4 as n,set as e}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as c}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as f}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as a,width as s,depth as u,height as m}from"./aaBoundingBox.js";import{fromRay as l,fromLineSegmentAndDirection as p,create as b}from"./clipRay.js";import{create as g,fromPoints as j,signedDistance as h,clip as x,copy as M,clipInfinite as v}from"./plane.js";import{sm4d as d,sv4d as k}from"./vectorStacks.js";function y(t){return t?[g(t[0]),g(t[1]),g(t[2]),g(t[3]),g(t[4]),g(t[5])]:[g(),g(),g(),g(),g(),g()]}function B(){return[i(),i(),i(),i(),i(),i(),i(),i()]}function S(t,r){for(let o=0;o<J;o++)M(t[o],r[o]);return t}function w(t,n,i,f=P){const a=r(d.get(),n,t);o(a,a);for(let r=0;r<K;++r){const t=c(k.get(),L[r],a);e(f[r],t[0]/t[3],t[1]/t[3],t[2]/t[3])}O(i,f)}function O(t,r){j(r[4],r[0],r[3],t[0]),j(r[1],r[5],r[6],t[1]),j(r[4],r[5],r[1],t[2]),j(r[3],r[2],r[6],t[3]),j(r[0],r[1],r[2],t[4]),j(r[5],r[4],r[7],t[5])}function R(t,r){return q(t,r.center,r.radius)}function q(t,r,o){for(let n=0;n<J;n++){const e=t[n];if(e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]>=o)return!1}return!0}function z(t,r,o){const n=a(r,Q),e=s(r)/2,i=u(r)/2,c=m(r)/2;return o?C(t,n,e,i,c,o):A(t,n,e,i,c)}function A(t,r,o,n,e){for(let i=0;i<J;i++){const c=t[i];if(c[0]*r[0]+c[1]*r[1]+c[2]*r[2]+c[3]-(Math.abs(c[0])*o+Math.abs(c[1])*n+Math.abs(c[2])*e)>0)return!1}return!0}function C(t,r,o,e,i,c){const f=n(T,r,c);for(let n=0;n<J;n++){const r=t[n];if(r[0]*f[0]+r[1]*f[1]+r[2]*f[2]+r[3]-(Math.abs(r[0]*c[0]+r[1]*c[1]+r[2]*c[2])*o+Math.abs(r[0]*c[4]+r[1]*c[5]+r[2]*c[6])*e+Math.abs(r[0]*c[8]+r[1]*c[9]+r[2]*c[10])*i)>0)return!1}return!0}function D(t,r){return H(t,l(r,N.get()))}function E(t,r){for(let o=0;o<J;o++){const n=t[o];if(!v(n,r))return!1}return!0}function F(t,r,o){return H(t,p(r,o,N.get()))}function G(t,r){for(let o=0;o<J;o++){if(h(t[o],r)>0)return!1}return!0}function H(t,r){for(let o=0;o<J;o++)if(!x(t[o],r))return!1;return!0}const I={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},J=6,K=8,L=[f(-1,-1,-1,1),f(1,-1,-1,1),f(1,1,-1,1),f(-1,1,-1,1),f(-1,-1,1,1),f(1,-1,1,1),f(1,1,1,1),f(-1,1,1,1)],N=new t(b),P=B(),Q=i(),T=i();export{O as computePlanes,S as copy,y as create,B as createPoints,w as fromMatrix,E as intersectClipRay,F as intersectsLineSegment,G as intersectsPoint,D as intersectsRay,R as intersectsSphere,q as intersectsSphereCenterRadius,z as intersectsTransformedAabb,J as numPlanes,K as numPoints,I as planePointIndices};
2
+ import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{transformMat4 as n,set as e}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as c}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as f}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as a,width as s,depth as u,height as m}from"./aaBoundingBox.js";import{fromRay as l,fromLineSegmentAndDirection as p,create as b}from"./clipRay.js";import{create as g,fromPoints as j,signedDistance as h,clip as x,clipInfinite as M,copy as v}from"./plane.js";import{sm4d as d,sv4d as k}from"./vectorStacks.js";function y(t){return t?[g(t[0]),g(t[1]),g(t[2]),g(t[3]),g(t[4]),g(t[5])]:[g(),g(),g(),g(),g(),g()]}function B(){return[i(),i(),i(),i(),i(),i(),i(),i()]}function S(t,r){for(let o=0;o<J;o++)v(t[o],r[o]);return t}function w(t,n,i,f=P){const a=r(d.get(),n,t);o(a,a);for(let r=0;r<K;++r){const t=c(k.get(),L[r],a);e(f[r],t[0]/t[3],t[1]/t[3],t[2]/t[3])}O(i,f)}function O(t,r){j(r[4],r[0],r[3],t[0]),j(r[1],r[5],r[6],t[1]),j(r[4],r[5],r[1],t[2]),j(r[3],r[2],r[6],t[3]),j(r[0],r[1],r[2],t[4]),j(r[5],r[4],r[7],t[5])}function R(t,r){return q(t,r.center,r.radius)}function q(t,r,o){for(let n=0;n<J;n++){const e=t[n];if(e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]>=o)return!1}return!0}function z(t,r,o){const n=a(r,Q),e=s(r)/2,i=u(r)/2,c=m(r)/2;return o?C(t,n,e,i,c,o):A(t,n,e,i,c)}function A(t,r,o,n,e){for(let i=0;i<J;i++){const c=t[i];if(c[0]*r[0]+c[1]*r[1]+c[2]*r[2]+c[3]-(Math.abs(c[0])*o+Math.abs(c[1])*n+Math.abs(c[2])*e)>0)return!1}return!0}function C(t,r,o,e,i,c){const f=n(T,r,c);for(let n=0;n<J;n++){const r=t[n];if(r[0]*f[0]+r[1]*f[1]+r[2]*f[2]+r[3]-(Math.abs(r[0]*c[0]+r[1]*c[1]+r[2]*c[2])*o+Math.abs(r[0]*c[4]+r[1]*c[5]+r[2]*c[6])*e+Math.abs(r[0]*c[8]+r[1]*c[9]+r[2]*c[10])*i)>0)return!1}return!0}function D(t,r){return H(t,l(r,N.get()))}function E(t,r){for(let o=0;o<J;o++){const n=t[o];if(!M(n,r))return!1}return!0}function F(t,r,o){return H(t,p(r,o,N.get()))}function G(t,r){for(let o=0;o<J;o++){if(h(t[o],r)>0)return!1}return!0}function H(t,r){for(let o=0;o<J;o++)if(!x(t[o],r))return!1;return!0}const I={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},J=6,K=8,L=[f(-1,-1,-1,1),f(1,-1,-1,1),f(1,1,-1,1),f(-1,1,-1,1),f(-1,-1,1,1),f(1,-1,1,1),f(1,1,1,1),f(-1,1,1,1)],N=new t(b),P=B(),Q=i(),T=i();export{O as computePlanes,S as copy,y as create,B as createPoints,w as fromMatrix,E as intersectClipRay,F as intersectsLineSegment,G as intersectsPoint,D as intersectsRay,R as intersectsSphere,q as intersectsSphereCenterRadius,z as intersectsTransformedAabb,J as numPlanes,K as numPoints,I as planePointIndices};
@@ -1,11 +1,16 @@
1
1
  /**
2
- * Converts Web Mercator coordinates to geographic coordinates and vice versa.
2
+ * Supports client-side projection workflows between WGS84 and Web Mercator
3
+ * without requiring loading the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) and its dependencies or using a geometry service.
4
+ *
5
+ * Best suited for relatively simple geometries that do not require the full capabilities
6
+ * of the projectOperator.
3
7
  *
4
8
  * > [!WARNING]
5
9
  * >
6
- * > **Known Limitation**
10
+ * > **Known limitations**
7
11
  * >
8
- * > Geometry type [Mesh](https://developers.arcgis.com/javascript/latest/references/core/geometry/Mesh/) is not supported.
12
+ * > * Geometries with true curves are not supported.
13
+ * > * [Mesh](https://developers.arcgis.com/javascript/latest/references/core/geometry/Mesh/) geometries are not supported.
9
14
  *
10
15
  * @since 4.0
11
16
  * @see [Sample - Coordinate Conversion component - Custom Formats](https://developers.arcgis.com/javascript/latest/sample-code/coordinate-conversion-custom/)
@@ -14,8 +19,10 @@ import type SpatialReference from "../SpatialReference.js";
14
19
  import type { GeometryUnion } from "../types.js";
15
20
 
16
21
  /**
17
- * Returns `true` if the `source` spatial reference can be projected to the `target` spatial reference with the [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project) function, or
18
- * if the `source` and `target` are the same [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/).
22
+ * Returns `true` when [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project) can handle the inputs.
23
+ *
24
+ * Supported cases are limited to conversions between WGS84 and Web Mercator,
25
+ * or no-op calls where the `source` and `target` are the same [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/).
19
26
  *
20
27
  * @param source - The input [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) or an object with
21
28
  * `spatialReference` property such as [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/)
@@ -23,21 +30,29 @@ import type { GeometryUnion } from "../types.js";
23
30
  * @param target - The target [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) or an object with
24
31
  * `spatialReference` property such as [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/)
25
32
  * or [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/).
26
- * @returns Returns `true` if `source` can be projected to `target`.
33
+ * @returns Returns `true` if [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project) can handle the `source` and `target` inputs.
27
34
  * @see [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project)
28
35
  */
29
36
  export function canProject(source: object | SpatialReference | null | undefined, target: object | SpatialReference | null | undefined): boolean;
30
37
 
31
38
  /**
32
- * Projects the geometry clientside (if possible). You should test the input geometry in [canProject()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#canProject) prior to using this function.
33
- * If the result of [canProject()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#canProject) is `true`, then proceed to project. If [canProject()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#canProject) returns `false`, then
34
- * `project()` won't return useful results. Use [project()](https://developers.arcgis.com/javascript/latest/references/core/rest/geometryService/#project) instead.
39
+ * Projects the geometry client-side when the input and target spatial references are supported by this module.
40
+ *
41
+ * Use this method when the target spatial reference may vary between WGS84 and Web Mercator,
42
+ * or when needing to handle no-op projections between identical spatial references.
43
+ *
44
+ * Use [canProject()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#canProject)
45
+ * to test whether this function can handle the inputs. If the conversion
46
+ * direction is already known, use [geographicToWebMercator()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#geographicToWebMercator)
47
+ * or [webMercatorToGeographic()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#webMercatorToGeographic). If this function cannot
48
+ * handle the inputs, use [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) instead.
35
49
  *
36
50
  * @param geometry - The input geometry.
37
51
  * @param spatialReference - The target [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) or an object with
38
52
  * `spatialReference` property such as [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/)
39
53
  * or [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/).
40
- * @returns Returns the projected geometry if the projection is successful.
54
+ * @returns Returns the projected geometry if the input is supported; otherwise returns `null`.
55
+ * @see [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/)
41
56
  * @see [project()](https://developers.arcgis.com/javascript/latest/references/core/rest/geometryService/#project)
42
57
  * @see [ProjectParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/ProjectParameters/)
43
58
  */
@@ -69,7 +84,10 @@ export function xyToLngLat(x: number, y: number): [
69
84
  ];
70
85
 
71
86
  /**
72
- * Converts a geometry from geographic units (wkid: 4326) to Web Mercator units (wkid: 3857).
87
+ * Converts a geometry from the WGS 84 geographic coordinate system (WKID: 4326) to the Web Mercator coordinate system (WKID: 3857).
88
+ *
89
+ * This method provides a lightweight, high-performance client-side conversion optimized for this specific transformation.
90
+ * Geometries containing true curves are not supported. Use [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) instead.
73
91
  *
74
92
  * @param geometry - The input geometry to convert.
75
93
  * @returns Returns the converted geometry in Web Mercator units.
@@ -77,11 +95,17 @@ export function xyToLngLat(x: number, y: number): [
77
95
  export function geographicToWebMercator(geometry: GeometryUnion): GeometryUnion;
78
96
 
79
97
  /**
80
- * Converts a geometry from Web Mercator units (wkid: 3857) to geographic units (wkid: 4326).
98
+ * Converts a geometry from the Web Mercator coordinate system (WKID: 3857) to the WGS 84 geographic coordinate system (WKID: 4326).
99
+ *
100
+ * This method provides a lightweight, high-performance client-side conversion for this specific transformation.
101
+ * Geometries containing true curves are not supported. Use [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) instead.
81
102
  *
82
103
  * @param geometry - The input geometry to convert.
83
- * @param isLinear - = false - Indicates whether to work with linear values, i.e., do not normalize. By default, this conversion method normalizes xmin and xmax values.
84
- * If this is not desired, specify this value as `true`. Default value is `false`.
104
+ * @param isLinear - Indicates whether to preserve continuous coordinate values and skip
105
+ * longitude normalization.
106
+ * By default, this method normalizes output longitude values. Specify
107
+ * `true` to preserve unnormalized values, such as when working with
108
+ * wrapped world coordinates. Default value is `false`.
85
109
  * @returns Returns the converted geometry in geographic units.
86
110
  */
87
111
  export function webMercatorToGeographic(geometry: GeometryUnion, isLinear?: boolean): GeometryUnion;
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.75",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.77",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import i from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import d from"../core/ReactiveMap.js";import{watch as h}from"../core/reactiveUtils.js";import{property as _,subclass as y}from"../core/accessorSupport/decorators.js";import u from"../geometry/SpatialReference.js";import{isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import m from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as g,elevQueriesFull as p,elevQueriesGenericFail as f,invalidLayerView as w}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as v}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as D}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as L}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as C}from"../views/support/Scheduler.js";import{Yield as R}from"../views/support/Yield.js";const k=3857,S=32662,I=4326,j=5773;let W=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new d,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=s?`[js] ${i}`:`${i}`;0===t||1===t?r.getLogger(this).error(e):2===t&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([h(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),h(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()}),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(C.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),R}_hasPendingPulseWork(){return!!this._lyr3DMain&&(this._cameraDirty||this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:g})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),i.needFrame=!0,i.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){const s=this._lyr3DMain._malloc(8*t.length),r=new Float64Array(this._lyr3DMain.HEAPF64.buffer,s,t.length);for(let e=0;e<t.length;++e)r[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,s,t.length),this._lyr3DMain._free(s);const a=this._isUpdating(i);i.needFrame=!0,a||i.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&this._isUpdating(t)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=D().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=I,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=v(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j):this.view.renderSpatialReference?.wkid===S?(this._viewSR.wkid=this._viewSR.latestWkid=I,d=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,t,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0,i.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,i){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===t.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?u.WGS84:this._viewSR.wkid===k?u.WebMercator:u.PlateCarree,r=t.projectSync(s);r&&(t=r);const a=2*t.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<t.coordinates.length;++y){const e=t.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=i?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===p)return Promise.reject("max mesh elevation query limit exceeded");if(d===f)return Promise.reject("elevation query failed");const h={wasmLayerId:e.wasmLayerId,descriptor:t,signal:i?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,t)=>{h.resolveCallback=e,h.rejectCallback=t});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((t,i)=>{o(t.signal)&&(this._lyr3DMain.cancel_elevation_query(i),t.rejectCallback(n()),e.push(i))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){const t=new Array;this._elevationQueries.forEach((i,s)=>{i.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(s),i.rejectCallback(n()),t.push(s))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){const t=this._lyr3DMain;if(t){if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:i,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.screenViewport[2],e.screenViewport[3]],d={eye:i,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};t.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}this._checkForAbortedElevationQueries();let i=0,s=0;this._layers.forEach(e=>{i+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),i/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-i-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,i,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._lyr3DBusyCount>0}_incrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount+=1,i||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){e.shift()(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i)}_onJobSucceeded(e,t,i){if(e.layerView.destroyed)return void(this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i));const{data:s}=t;if(this._lyr3DMain){const r=r=>{try{const e=s.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(r.HEAPU8.buffer,a,e).set(s),r.on_job_completed(i.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,i)}};this._pendingJobCompleted.push(r)}else this._decrementJobCountIfLayerExists(e,i)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,r,a,n){const o=this._getRequestPromises(e.urls,t,i,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(t=>{let i=1;return l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t,e);const i=t.abortController.signal,s=t.layerView.layer,r="integrated-mesh-3dtiles"===s.type?s.key:null,a="integrated-mesh-3dtiles"===s.type?s.session:null,n={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:r}},o={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=r=>{if(1===r.status)this._onJobFailed(t,r,e);else if(0===r.status)this._onJobSucceeded(t,r,e);else if(2===r.status){const a=this._getRequestPromises(r.missingInputUrls,n,d,s);Promise.all(a).then(e=>{o.jobDescJson=r.jobDescJson,r.originalInputs?o.inputs=r.originalInputs:o.inputs=[],o.isMissingResourceCase=!0;for(const t of e)o.inputs.push(t);return this._workerHandle.invoke(o,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{l(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error ${i}.`),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)})}};try{const t=await this._getInitialPromise(e,n,d,s,o,i,a);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){a===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,n,d,s,o,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{assets:t}=e.entity3d;for(const[s,r]of Object.entries(t))r.data=r.data.slice();e.entity3d.validPrimitiveIndices=e.entity3d.validPrimitiveIndices.slice();const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(s=>{try{const{layerId:i,handle:r}=e,a=t();s.on_renderable_created(!0,i,r,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}).catch(t=>{l(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(t=>{try{const{layerId:i,handle:s}=e;t.on_renderable_created(!1,i,s,0,0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(!!(1&d[h]));a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_onElevQueryComplete(e){const t=this._elevationQueries.get(e),i=this._lyr3DMain.get_elevation_query_result(e);if(t)if(i.succeeded&&i.zs){const s=i.zs.slice(),r=t.descriptor.clone();for(let e=0;e<s.length;++e)r.coordinates[e].z=s[e];this._debugLog(2,3,`Success EQ ${e}, number points ${s.length}.`),t.resolveCallback(r),this._elevationQueries.delete(e)}else t.rejectCallback(new s("elevation-query:error",i?.error??"Elevation query failed")),this._elevationQueries.delete(e);else this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${e}.`)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:w};const i="integrated-mesh-3dtiles"===t.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==s.errorCode)return{wasmLayerId:w,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=L(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=c(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=m.values[m[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d),!this._haveAddedViewSRForNoOpPrj&&i.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==i.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o):this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")))}return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:w})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._markAllLayerViewsUpdating())}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([_({constructOnly:!0})],W.prototype,"view",void 0),e([_()],W.prototype,"updating",null),e([_({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([y("esri.layers.Lyr3DWasmPerSceneView")],W);const V=W;export{V as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import i from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import d from"../core/ReactiveMap.js";import{watch as h}from"../core/reactiveUtils.js";import{property as _,subclass as y}from"../core/accessorSupport/decorators.js";import u from"../geometry/SpatialReference.js";import{isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import g from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as m,elevQueriesFull as p,elevQueriesGenericFail as w,invalidLayerView as f}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as v}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as L}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as D}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as C}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as M}from"../views/support/Scheduler.js";import{Yield as R}from"../views/support/Yield.js";const k=3857,S=32662,V=4326,I=5773;let W=class extends i{get _frozen(){return this._frozenLayerViewCount>0}constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._frozenLayerViewCount=0,this._elevationQueries=new d,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=s?`[js] ${i}`:`${i}`;0===t||1===t?r.getLogger(this).error(e):2===t&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([h(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),h(()=>this.view.state?.contentCamera.relativeElevation,()=>this._updateWasmCameraElevation()),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(M.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),R}_hasPendingPulseWork(){return!!this._lyr3DMain&&(!this._frozen&&this._cameraDirty||!this._frozen&&this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:m})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._is3DTilesIMLayerView(e)&&e.freeze&&this.decrementFrozenLayerViewCount(e),this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),i.needFrame=!0,i.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,t);const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&this._isUpdating(t)}incrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&(this._frozenLayerViewCount+=1)}decrementFrozenLayerViewCount(e){this._layers.has(e.wasmLayerId)&&(this._frozenLayerViewCount-=1)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=L().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"vi"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"vi"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"vi"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"vi"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=V,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=I,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=v(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=I):this.view.renderSpatialReference?.wkid===S?(this._viewSR.wkid=this._viewSR.latestWkid=V,d=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=I):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,t,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(C(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0,i.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,i){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===t.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?u.WGS84:this._viewSR.wkid===k?u.WebMercator:u.PlateCarree,r=t.projectSync(s);r&&(t=r);const a=2*t.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<t.coordinates.length;++y){const e=t.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=i?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===p)return Promise.reject("max mesh elevation query limit exceeded");if(d===w)return Promise.reject("elevation query failed");const h={wasmLayerId:e.wasmLayerId,descriptor:t,signal:i?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,t)=>{h.resolveCallback=e,h.rejectCallback=t});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((t,i)=>{o(t.signal)&&(this._lyr3DMain.cancel_elevation_query(i),t.rejectCallback(n()),e.push(i))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){const t=new Array;this._elevationQueries.forEach((i,s)=>{i.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(s),i.rejectCallback(n()),t.push(s))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){const t=this._lyr3DMain;if(t){if(this._frozen)return this._checkForAbortedElevationQueries(),void this._flushPendingWasmCalls(e);if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:i,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.screenViewport[2],e.screenViewport[3]],d={eye:i,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};t.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}this._checkForAbortedElevationQueries();let i=0,s=0;this._layers.forEach(e=>{i+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),i/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-i-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,i,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||!this._frozen&&e.needFrame||!this._frozen&&this._cameraDirty||!this._frozen&&this._cameraElevationDirty||!this._frozen&&this._lyr3DBusyCount>0}_incrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount+=1,i||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){e.shift()(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i)}_onJobSucceeded(e,t,i){if(e.layerView.destroyed)return void(this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i));const{data:s}=t;if(this._lyr3DMain){const r=r=>{try{const e=s.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(r.HEAPU8.buffer,a,e).set(s),r.on_job_completed(i.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,i)}};this._pendingJobCompleted.push(r)}else this._decrementJobCountIfLayerExists(e,i)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,r,a,n){const o=this._getRequestPromises(e.urls,t,i,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(t=>{let i=1;return l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(e){let t;try{t=this._lyr3DMain.Emval.toValue(e);const s=this._layers.get(t.layerId);if(!s)return;this._incrementJobCount(s,t);const r=s.abortController.signal,a=s.layerView.layer,n="integrated-mesh-3dtiles"===a.type?a.key:null,o="integrated-mesh-3dtiles"===a.type?a.session:null,d={responseType:"array-buffer",signal:r,query:{...s.customParameters,token:s.apiKey,key:n}},h={id:t.jobId,inputs:[],jobDescJson:t.desc.slice(),isMissingResourceCase:!1},_=new URL(a.url),y=e=>{if(1===e.status)this._onJobFailed(s,e,t);else if(0===e.status)this._onJobSucceeded(s,e,t);else if(2===e.status){const i=this._getRequestPromises(e.missingInputUrls,d,_,a);Promise.all(i).then(t=>{h.jobDescJson=e.jobDescJson,e.originalInputs?h.inputs=e.originalInputs:h.inputs=[],h.isMissingResourceCase=!0;for(const e of t)h.inputs.push(e);return this._workerHandle.invoke(h,r)}).then(e=>{1===e.status?this._onJobFailed(s,e,t):0===e.status&&this._onJobSucceeded(s,e,t)}).catch(e=>{l(e)?this._debugLog(1,2,`job ${t.jobId} was cancelled.`):this._debugLog(1,1,`job ${t.jobId} failed with error ${e}.`),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(s,t)}}):this._decrementJobCountIfLayerExists(s,t)})}};try{const e=await this._getInitialPromise(t,d,_,a,h,r,o);if(3===e.status&&"integrated-mesh-3dtiles"===a.type){o===a.session&&null!==a.session&&await a.requestRootAndSession(r);y(await this._getInitialPromise(t,d,_,a,h,r,a.session))}else y(e)}catch(i){i&&this._debugLog(1,1,i.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(s,t)}}):this._decrementJobCountIfLayerExists(s,t)}}catch(i){i&&this._debugLog(1,1,i.toString(),!1)}}_onNewRenderable(e){try{const t=this._lyr3DMain.Emval.toValue(e),i=this._layers.get(t.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(t).then(e=>{!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(s=>{try{const{layerId:i,handle:r}=t,a=e();s.on_renderable_created(!0,i,r,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}).catch(e=>{l(e)||this._debugLog(2,1,`createRenderable failed with error ${e}.`),!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(e=>{try{const{layerId:i,handle:s}=t;e.on_renderable_created(!1,i,s,0,0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}))}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_freeRenderables(e){try{const t=this._lyr3DMain.Emval.toValue(e),i=this._layers.get(t.layerId);if(t.handles.length<1||!i)return;const s=i.layerView;for(let e=0;e<t.handles.length;++e)s.freeRenderable(t.handles[e])}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_setRenderableVisibility(e){try{const t=this._lyr3DMain.Emval.toValue(e),i=this._layers.get(t.layerId);if(t.handles.length<1||t.visibility.length!==t.handles.length||!i)return;const s=i.layerView,r=[],a=[];for(let e=0;e<t.handles.length;++e)r.push(t.handles[e]),a.push(!!(1&t.visibility[e]));s.setRenderableVisibility(r,a,t.handles.length)}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_onWasmError(e,t,i,s){if(this._lyr3DMain)try{this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}catch(r){}}_onElevQueryComplete(e){try{const t=this._lyr3DMain.Emval.toValue(e),{queryId:i}=t,r=this._elevationQueries.get(i);if(!r)return void this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${i}.`);if(t.succeeded&&t.zs){const{zs:e}=t,s=r.descriptor.clone();for(let t=0;t<e.length;++t)s.coordinates[t].z=e[t];this._debugLog(2,3,`Success EQ ${i}, number points ${e.length}.`),r.resolveCallback(s),this._elevationQueries.delete(i)}else r.rejectCallback(new s("elevation-query:error",t?.error??"Elevation query failed")),this._elevationQueries.delete(i)}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:f};const i="integrated-mesh-3dtiles"===t.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==s.errorCode)return{wasmLayerId:f,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=D(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=c(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=g.values[g[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d),!this._haveAddedViewSRForNoOpPrj&&i.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==i.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o):this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")))}return h?(this._updateWasmCamera(),this._is3DTilesIMLayerView(e)&&e.freeze&&this.incrementFrozenLayerViewCount(e),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:f})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._frozen||this._markAllLayerViewsUpdating())}_updateWasmCameraElevation(){this._cameraElevationDirty=!0,this._frozen||this._markAllLayerViewsUpdating()}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([_({constructOnly:!0})],W.prototype,"view",void 0),e([_()],W.prototype,"updating",null),e([_({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([y("esri.layers.Lyr3DWasmPerSceneView")],W);const j=W;export{j as default};
@@ -175,7 +175,7 @@ export interface VectorTileLayerEvents extends RefreshableLayerEvents, LayerEven
175
175
  *
176
176
  * A VectorTileLayer can be created in one of the following ways:
177
177
  * - By setting the [url](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#url) property to one of the supported URL types.
178
- * - By setting the [portalItem](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#portalItem) property with an ArcGIS portal item ID.
178
+ * - By setting the [portalItem](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#portalItem) property to the portal item of a vector tile service.
179
179
  * - By setting the [style](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#style) property with a JSON style object.
180
180
  *
181
181
  * Once the layer is created, add it to a map using the [Map.add()](https://developers.arcgis.com/javascript/latest/references/core/Map/#add) method to display it in a map.
@@ -183,12 +183,13 @@ export interface VectorTileLayerEvents extends RefreshableLayerEvents, LayerEven
183
183
  * <details>
184
184
  * <summary>Read More</summary>
185
185
  *
186
- * ### Using a URL (service, style, or TileJSON)
186
+ * ### Using a URL (service, style, TileJSON, or GeoJSON)
187
187
  *
188
- * To create a VectorTileLayer from a URL, set the layers [url](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#url) property to one of the following:
189
- * * The [REST endpoint of a [vector tile service](https://developers.arcgis.com/rest/services-reference/enterprise/vector-tile-service/)
190
- * * A vector tile [style](https://developers.arcgis.com/rest/services-reference/enterprise/vector-tile-style/) URL
191
- * * A [TileJSON](https://github.com/mapbox/tilejson-spec/tree/master/3.0.0) endpoint (added at version 4.34)
188
+ * To create a VectorTileLayer from a URL, set the layer's [url](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/#url) property to one of the following:
189
+ * - A vector tile style URL. The style may reference vector tile services, TileJSON sources, or GeoJSON sources.
190
+ * - The REST endpoint of a vector tile service.
191
+ * - A TileJSON endpoint (supported since version 4.34).
192
+ * - A GeoJSON endpoint (supported since version 5.2).
192
193
  *
193
194
  * ```js
194
195
  * // Example 1: Create a VectorTileLayer from vector tile service URL by setting the layer's url property
@@ -555,9 +556,10 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
555
556
  /** The spatial reference of the layer. */
556
557
  get spatialReference(): SpatialReference;
557
558
  /**
558
- * A style JSON object of vector tiles that will be used to render the layer.
559
- * If initializing the layer with a style JSON object, the tiles are fetched
560
- * from the tile servers specified in the style object.
559
+ * A style JSON object used to render the layer. The style defines the layer's styling and data sources, which may reference vector tile services,
560
+ * [TileJSON](https://github.com/mapbox/tilejson-spec) resources, or [GeoJSON](https://geojson.org/) resources. When the layer is initialized with a style object,
561
+ * data is fetched from the sources defined by the style.
562
+ * Support for TileJSON sources was added in version 4.34, and support for GeoJSON sources in style objects was added in version 5.2.
561
563
  *
562
564
  * @since 4.6
563
565
  * @example
@@ -593,19 +595,29 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
593
595
  /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
594
596
  get type(): "vector-tile";
595
597
  /**
596
- * The URL to the [vector tile service](https://developers.arcgis.com/rest/services-reference/enterprise/vector-tile-service/),
597
- * the URL to the [style resource](https://developers.arcgis.com/rest/services-reference/enterprise/vector-tile-style/) of vector tiles,
598
- * or the URL to a [TileJSON](https://github.com/mapbox/tilejson-spec) resource that will be used to render the layer.
599
- *
600
- * If specifying a URL to a style, the tiles are fetched from the `sources` specified in the style object.
601
- * If specifying a TileJSON URL, the tiles and related metadata such as bounds and attribution are read from the TileJSON configuration. This support was added in version 4.34.
602
- * Since the TileJSON source does not include style information, the layer will be rendered using a default style.
603
- * For the layer to load and render correctly, the TileJSON must meet the following requirements:
604
- * - The TileJSON must include a vector source.
605
- * - The TileJSON tiles must be in the Web Mercator spatial reference (WKID: 3857).
606
- * - The `vector_layers` array must contain at least one layer.
607
- * - Each layer in the `vector_layers` array should specify the `geometry_type` to ensure proper rendering. The `geometry_type` can be one of the following: `point`, `polygon`, or `line`.
608
- * - Vector tiles must be 512 by 512 pixels in size and overlap the data sufficiently to allow features to draw correctly.
598
+ * The URL of a [vector tile style](https://developers.arcgis.com/rest/services-reference/enterprise/vector-tile-style/) resource,
599
+ * [vector tile service](https://developers.arcgis.com/rest/services-reference/enterprise/vector-tile-service/),
600
+ * [TileJSON](https://github.com/mapbox/tilejson-spec) source, or [GeoJSON](https://geojson.org/) source.
601
+ *
602
+ * When a vector tile style resource is provided, the layer is rendered using the styling and data sources defined by the style.
603
+ * The style's sources define the data used to render the layer and may reference vector tile service, TileJSON source, or GeoJSON source.
604
+ * When a vector tile service, TileJSON source, or GeoJSON source is provided directly, the layer is rendered using a default style.
605
+ *
606
+ * **TileJSON sources**
607
+ * - Support for TileJSON sources was added in version 4.34.
608
+ * - If specifying a TileJSON URL, tiles and related metadata, such as bounds and attribution, are read from the TileJSON configuration.
609
+ * - When a TileJSON source is provided directly, the layer is rendered using a default style because TileJSON does not include styling information.
610
+ * - For the layer to load and render correctly, the TileJSON must meet the following requirements:
611
+ * - The TileJSON must include a vector source.
612
+ * - The TileJSON tiles must be in the Web Mercator spatial reference (WKID: 3857).
613
+ * - The `vector_layers` array must contain at least one layer.
614
+ * - Each layer in the `vector_layers` array should specify the `geometry_type` to ensure proper rendering. The `geometry_type` can be one of the following: `point`, `polygon`, or `line`.
615
+ * - Vector tiles must be 512 x 512 pixels in size and overlap the data sufficiently to allow features to draw correctly.
616
+ *
617
+ * **GeoJSON sources**
618
+ * - Support for GeoJSON sources was added in version 5.2.
619
+ * - When a GeoJSON source is provided directly, the layer is rendered using a default style because GeoJSON does not include styling information.
620
+ * - GeoJSON sources must satisfy the requirements described in the [GeoJSONLayer overview](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#overview).
609
621
  *
610
622
  * @example
611
623
  * // Example 1: Create a VectorTileLayer from vector tile service URL by setting the layer's url property
@@ -629,6 +641,12 @@ export default class VectorTileLayer extends VectorTileLayerSuperclass {
629
641
  * url: "https://your-tile-json-url?f=tilejson"
630
642
  * });
631
643
  * map.add(layer);
644
+ * @example
645
+ * // Example 4: Create a VectorTileLayer from a GeoJSON source
646
+ * const layer = new VectorTileLayer({
647
+ * url: "https://your-geojson-style-url.json"
648
+ * });
649
+ * map.add(layer);
632
650
  */
633
651
  accessor url: string | null | undefined;
634
652
  /**
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import i from"../../../geometry/SpatialReference.js";import{polygonCentroid as s,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as r,getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as o}from"../../../geometry/support/quantizationUtils.js";import{isValid as l,equals as u}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as c}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as m,isCoordinate as d,cloneCurve as f}from"../../../geometry/support/curves/curveUtils.js";import p from"./AttributesBuilder.js";import{cleanFromGeometryEngine as h,getGeometry as g,transformCentroid as y}from"./geometryUtils.js";import{project as x}from"./projectionSupport.js";import{getDateInNumber as I}from"./queryUtils.js";import{SnappingCandidateEdge as T,SnappingCandidateVertex as F}from"./SnappingCandidate.js";import{isDateField as _,isDateOnlyField as v,isTimestampOffsetField as V,isStringField as S,isTimeOnlyField as b}from"../../support/fieldUtils.js";import R from"../../../rest/support/AutoIntervalBinParameters.js";import z from"../../../rest/support/DateBinParameters.js";import{unitsDict as B}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import A from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as N,calculateStatistics as w,processSummaryStatisticsResult as D,calculateUniqueValuesCount as P,createUVResult as O,calculateClassBreaks as q,resolveCBResult as j,calculateHistogram as C,calculatePercentile as G,binIndex as Z,getBinParams as E,isNullCountSupported as H,getAttributeComparator as U}from"../../../statistics/utils.js";import{utc as k}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Q="bin";class Y{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasZ=!!t.returnZ&&i.hasZ,this.hasM=!!t.returnM&&i.hasM,this.fieldsIndex=i.fieldsIndex,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter,this.featureIdInfo=i.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){const e=new p(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;l(this.query.outSR)&&!u(t.spatialReference,this.query.outSR)?e.queryGeometry=h({spatialReference:this.query.outSR,...x(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=h({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,{point:a}=e,r="number"==typeof e.distance?e.distance:e.distance.x,n="number"==typeof e.distance?e.distance:e.distance.y;function o(e,t){const i=(e-a.x)/r,s=(t-a.y)/n;return i*i+s*s}const l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,p="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,h=this._getPointCreator(t,this.spatialReference,i),g=new L(null,0),y=new L(null,0),x={x:0,y:0,z:0};for(const c of this.items){const e=s.getObjectId(c),t=s.getGeometryWithCurves?.(c);if(null!=t){_(t,e);continue}const i=s.getGeometry(c);null==i||I(i,e)}return l.candidates.sort((e,t)=>e.distance-t.distance),l;function I(t,i){const{coords:s,stride:r}=t,n=t.isPoint?W:t.lengths;if(g.coords=s,y.coords=s,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const s=n[t],c=e;for(let t=0;t<s;t++,e+=r){if(!u&&t===s-1)continue;if(g.coordsIndex=e,y.coordsIndex=t===s-1?c:e+r,!X(x,a,g,y))continue;const n=o(x.x,x.y);n<=1&&l.candidates.push(new T(i,h(x),Math.sqrt(n),h(g),h(y)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const s=n[t],a=e,c=y;c.coordsIndex=a;for(let t=0;t<s;t++,e+=r){if(g.coordsIndex=e,u&&t===s-1&&g.x===c.x&&g.y===c.y)continue;const a=o(g.x,g.y);a<=1&&l.candidates.push(new F(i,h(g),Math.sqrt(a)))}}}else if(p&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*r,s>1&&t.push(e-r)}for(const s of t){g.coordsIndex=s;const e=o(g.x,g.y);e<=1&&l.candidates.push(new F(i,h(g),Math.sqrt(e)))}}}function _(t,i){const{candidates:s}=l,r={x:0,y:0,z:0};if(e.returnEdge){const e=[a.x,a.y],n=new L(e,0),l=new L(e,0);for(const{segments:a}of t.parts)for(const{start:t,curve:u}of a){const{curvePoint:a}=c(t,u,e),p=o(...a);if(p>1)continue;[r.x,r.y]=a,n.coords=t,l.coords=m(u);const g=d(u)?null:f(u);s.push(new T(i,h(r),Math.sqrt(p),h(n),h(l),!1,g))}}function n(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const a=o(r.x,r.y);a>1||(r.z=t.vertexZ?.[e]??0,s.push(new F(i,h(r),Math.sqrt(a))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)n(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":n(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const i=t.partOffsets[e],s=t.partOffsets[e+1]-1;n(i),s!==i&&n(s)}}}}_getPointCreator(e,t,i){const s=null==i||u(t,i)?e=>e:e=>x(e,t,i),{hasZ:a}=this,r=0;return a&&e?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:r})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=_(m)||v(m)||V(m),f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=H({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),h={value:.5,fieldType:m?.type},g=S(m)?N({values:f,supportsNullCount:p,percentileParams:h,outStatisticTypes:c}):w({values:f,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:h,outStatisticTypes:c});return D(g,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=P(o);return O(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=q(f,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return j(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return C(f,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:r}=K(s,this.fieldsIndex);e.sort((e,s)=>t(i(e,a,r),i(s,a,r)))}}_topNFeatures(t,i,s,a){if(t.length>1&&i?.length){const r=i.map(e=>{const{compare:t,fieldOrExpression:i,fieldInfo:s}=K(e,this.fieldsIndex);return(e,r)=>t(a(e,i,s),a(r,i,s))}).reduceRight((e,t)=>(i,s)=>{const a=t(i,s);return 0===a||Number.isNaN(a)?e(i,s):a}),n=[];for(const i of t)e(n,i,s,r);return n}return t.slice(0,s)}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,featureIdInfo:r,spatialReference:n}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:f,returnM:p}=e,g=null!=m&&t.length>(d||0)+m,y=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:g,features:this._createFeatures(e,t),fields:y,geometryType:i,hasM:s&&p,hasZ:a&&f,objectIdFieldName:"object-id"===r.type?r.fieldName:null,spatialReference:h(u||n),transform:c&&o(c)||null}}_createFeatures(e,t){const i=new p(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:n,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:h=!1}=e,x=a&&f,I=s&&h;let T;const F=m||0,_=null!=d?F+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,r,_,(e,t,s)=>i.getFieldValue(e,t,s)):(T=[...t],this._sortFeatures(T,r,(e,t,s)=>i.getFieldValue(e,t,s))),(F>0||null!=_)&&(T=T.slice(F,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=o(n)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const s of T){const a=this.featureAdapter.getGeometry(s),r=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),geometry:g(this.geometryType,a,c,e,x,I)});t&&a&&!r.geometry&&(r.centroid=y(this,this.featureAdapter.getCentroid(s,this),e)),v[V++]=r}else if(!l&&u)for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:y(this,this.featureAdapter.getCentroid(s,this),e)});else for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:y(this,this.featureAdapter.getCentroid(s,this),e),geometry:g(this.geometryType,this.featureAdapter.getGeometry(s),c,e,x,I)})}else for(const o of T){const e=i.getAttributes(o);e&&(v[V++]=this._addFeatureJSONMetadata(o,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const i=this.featureAdapter.getMetadata?.(e);return void 0!==i&&(t.metadata=i),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{e=this.items.reduce((e,t)=>{const i=this.featureAdapter.getGeometry(t);return e+(i?.size??0)},0)>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new p(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,h=c?.length,g=!!h,y=g?c[0]:null,x=g&&!this.fieldsIndex.get(y);for(const p of u??[]){const{outStatisticFieldName:u,statisticType:d}=p,f=p,I="exceedslimit"!==d?p.onStatisticField:void 0,T="percentile_disc"===d||"percentile_cont"===d,F="EnvelopeAggregate"===d||"CentroidAggregate"===d||"ConvexHullAggregate"===d,_=g&&1===h&&(I===y||x)&&"count"===d;if(g){if(!n.has(I)){const e=[];for(const i of c){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(I,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const i=n.get(I);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:d,itemPositions:p}=i[r],h=n.join(",");if(!m||l.validateItems(d,m)){const i=o.get(h)||{attributes:{}};if(e.returnAggIds&&(i.aggregateIds=d.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(f,d);i.aggregateGeometries[t]=e}else{let e=null;if(_)e=s;else{const i=this._getAttributeValues(l,I,t,a),s=p.map(e=>i[e]);e=T&&"statisticParameters"in f?this._getPercentileValue(f,s):this._getStatisticValue(f,s,null,l.returnDistinctValues)}i.attributes[u]=e}let r=0;c.forEach((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t]),o.set(h,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(f,t);i.aggregateGeometries[s]=e}else{const e=this._getAttributeValues(l,I,t,a);i.attributes[u]=T&&"statisticParameters"in f?this._getPercentileValue(f,e):this._getStatisticValue(f,e,r,l.returnDistinctValues)}const v="min"!==d&&"max"!==d||!S(this.fieldsIndex.get(I))&&!this._isAnyDateField(I)?null:this.fieldsIndex.get(I)?.type;s.push({name:u,alias:u,type:v||"esriFieldTypeDouble"})}const I=g?Array.from(o.values()):[i];return this._sortFeatures(I,d,(e,t)=>e.attributes[t]),f&&(I.length=Math.min(f,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return _(t)||v(t)||V(t)||b(t)}async _getAggregateGeometry(e,t){const{convexHull:i,union:o}=await(import("../../../geometry/geometryEngineJSON.js")),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,f=t.map(e=>g(d,c.getGeometry(e))),p=i(m,f,!0)[0],h={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=p?r(p):n(o(m,f));h.aggregateGeometries={...e,spatialReference:m},h.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=p?s(p):a(n(o(m,f)));h.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},h.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(h.aggregateGeometries=p,h.outStatisticFieldName=u||"convexHull");return h}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):S(this.fieldsIndex.get(a))||this._isAnyDateField(a)?N({values:t,returnDistinct:s}):w({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return G(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map(i=>e.getFieldValue(i,t,a));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(e,s,a=!0){const r=new p(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:o,timeZone:l}=e,u=i.fromJSON(this.query.outSR||this.spatialReference);return n?r.getExpressionValues(s,n,{viewingMode:"map",scale:o,spatialReference:u},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},l):r.getDataValues(s,t(e),a)}_calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:Q,alias:Q,type:"esriFieldTypeInteger"}],o=new p(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[i],(e,t,i)=>o.getFieldValue(e,t,i));const c=this._getAttributeValues(o,i,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[s??i]:d}}))),a.fields)for(const e of a.fields)n.some(t=>t.name===e.name)||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(R.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(z.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(M.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(A.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=E(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:I(n?e.normalizationMinValue:l,!1),maxValue:I(n?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),f=b(this.fieldsIndex.get(s)),p=B.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),g=null!=r?I(r,f):h[0],y=null!=n?I(n,f):h[h.length-1],x=[];if(null!=g&&null!=y){const e={zone:t.outTimeReference?.ianaTimeZone??k},i=u?.unit?B.toJSON(u.unit):"milliseconds",s={[i]:u?.value||0},r=J.fromMillis(g,e).minus(s),n=J.fromMillis(y,e).minus(s),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const i=(e.weekday-t+7)%7;return e.minus({days:i}).startOf("day")};if("last"===o){let e="week"===p?((e,t)=>d(e,t).plus({days:7}))(n,m):n;for(;e>r;){const t=e.minus({[p]:a.value});if(t<r){x.unshift([l?t.plus(s).toMillis():r.plus(s).toMillis(),e.plus(s).toMillis()]);break}x.unshift([t.plus(s).toMillis(),e.plus(s).toMillis()]),e=t}}else{let e="first"===o?r:"week"===p?d(r,m):r.startOf(p);for(;e<=n;){const t=e.plus({[p]:a.value});if(t>n){x.push([e.plus(s).toMillis(),l?t.plus(s).toMillis():n.plus(s).toMillis()]);break}x.push([e.plus(s).toMillis(),t.plus(s).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:x,min:g,max:y},i);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),r=b(this.fieldsIndex.get(s)),n=e.boundaries.map(e=>I(e,r)).sort((e,t)=>e-t),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,normalizationType:r,start:n,end:o}=e,l=await this._getDataValues({field:s||e.expression,normalizationField:e.normalizationField,normalizationType:r,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),u=b(this.fieldsIndex.get(s)),c=E(l,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:I(r?e.normalizationMinValue:n,u),maxValue:I(r?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,i);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:Q,alias:Q,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const f of e){const{minValue:e,maxValue:i,items:s}=f,p={attributes:{}};let h;if(p.attributes[a]=m&&d&&null!=e?J.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(p.attributes[r]=m&&d&&null!=i?J.fromMillis(i,{zone:d}).toISO():i),t.returnAggIds&&(p.aggregateIds=s.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),p.attributes[Q]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map(({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...p.attributes}:{...t,...p.attributes}}))):(p.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),n.push(p))):(t.bin?.splitBy&&(p.attributes[Q]=++c),h=await this._createStatisticsQueryResponse(t,s,p),n.push(p)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function X(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}class L{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const W=[1];function K(e,t){const i=e.split(" "),s=i[0],a=t.get(s),r=!!i[1]&&"desc"===i[1].toLowerCase();return{compare:U(a?.type,r,"case-insensitive"),fieldOrExpression:s,fieldInfo:a}}export{Y as QueryEngineResult};
2
+ import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import s from"../../../geometry/SpatialReference.js";import{importLazily as i}from"../../../geometry/operators/importUtils.js";import{polygonCentroid as a,extentCentroid as r}from"../../../geometry/support/centroid.js";import{getPolygonExtent as n,getGeometryExtent as o,expandExtent as l}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as u}from"../../../geometry/support/quantizationUtils.js";import{isValid as c,equals as m}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as d}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as f,isCoordinate as p,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as y,getGeometry as x,transformCentroid as I}from"./geometryUtils.js";import{project as T}from"./projectionSupport.js";import{getDateInNumber as F}from"./queryUtils.js";import{SnappingCandidateEdge as _,SnappingCandidateVertex as v}from"./SnappingCandidate.js";import{isDateField as V,isDateOnlyField as S,isTimestampOffsetField as b,isStringField as R,isTimeOnlyField as z}from"../../support/fieldUtils.js";import B from"../../../rest/support/AutoIntervalBinParameters.js";import M from"../../../rest/support/DateBinParameters.js";import{unitsDict as A}from"../../../rest/support/DateBinUtils.js";import w from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as P,calculateStatistics as D,processSummaryStatisticsResult as O,calculateUniqueValuesCount as j,createUVResult as q,calculateClassBreaks as C,resolveCBResult as G,calculateHistogram as Z,calculatePercentile as E,binIndex as U,getBinParams as H,isNullCountSupported as k,getAttributeComparator as J}from"../../../statistics/utils.js";import{utc as Q}from"../../../time/constants.js";import{DateTime as Y}from"luxon";const X="bin",L=i(()=>import("../../../geometry/operators/json/convexHullOperator.js"));class W{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasZ=!!t.returnZ&&s.hasZ,this.hasM=!!t.returnM&&s.hasM,this.fieldsIndex=s.fieldsIndex,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter,this.featureIdInfo=s.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){const e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!n.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,this.items,r);s.push(t)}n.set(a,this._calculateUniqueValues(s,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:i,items:a}=u[t],r=i.join(",");s&&!e.validateItems(a,s)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;c(this.query.outSR)&&!m(t.spatialReference,this.query.outSR)?e.queryGeometry=y({spatialReference:this.query.outSR,...T(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=y({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,s){const i=this.featureAdapter,{point:a}=e,r="number"==typeof e.distance?e.distance:e.distance.x,n="number"==typeof e.distance?e.distance:e.distance.y;function o(e,t){const s=(e-a.x)/r,i=(t-a.y)/n;return s*s+i*i}const l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,m=this._getPointCreator(t,this.spatialReference,s),g=new ee(null,0),y=new ee(null,0),x={x:0,y:0,z:0};for(const d of this.items){const e=i.getObjectId(d),t=i.getGeometryWithCurves?.(d);if(null!=t){T(t,e);continue}const s=i.getGeometry(d);null==s||I(s,e)}return l.candidates.sort((e,t)=>e.distance-t.distance),l;function I(t,s){const{coords:i,stride:r}=t,n=t.isPoint?te:t.lengths;if(g.coords=i,y.coords=i,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const i=n[t],c=e;for(let t=0;t<i;t++,e+=r){if(!u&&t===i-1)continue;if(g.coordsIndex=e,y.coordsIndex=t===i-1?c:e+r,!$(x,a,g,y))continue;const n=o(x.x,x.y);n<=1&&l.candidates.push(new _(s,m(x),Math.sqrt(n),m(g),m(y)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const i=n[t],a=e,c=y;c.coordsIndex=a;for(let t=0;t<i;t++,e+=r){if(g.coordsIndex=e,u&&t===i-1&&g.x===c.x&&g.y===c.y)continue;const a=o(g.x,g.y);a<=1&&l.candidates.push(new v(s,m(g),Math.sqrt(a)))}}}else if(c&&"ends"===e.vertexMode){let e=0;const t=[];for(let s=0;s<n.length;s++){t.push(e);const i=n[s];e+=i*r,i>1&&t.push(e-r)}for(const i of t){g.coordsIndex=i;const e=o(g.x,g.y);e<=1&&l.candidates.push(new v(s,m(g),Math.sqrt(e)))}}}function T(t,s){const{candidates:i}=l,r={x:0,y:0,z:0};if(e.returnEdge){const e=[a.x,a.y],n=new ee(e,0),l=new ee(e,0);for(const{segments:a}of t.parts)for(const{start:t,curve:u}of a){const{curvePoint:a}=d(t,u,e),c=o(...a);if(c>1)continue;[r.x,r.y]=a,n.coords=t,l.coords=f(u);const g=p(u)?null:h(u);i.push(new _(s,m(r),Math.sqrt(c),m(n),m(l),!1,g))}}function n(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const a=o(r.x,r.y);a>1||(r.z=t.vertexZ?.[e]??0,i.push(new v(s,m(r),Math.sqrt(a))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)n(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":n(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const s=t.partOffsets[e],i=t.partOffsets[e+1]-1;n(s),i!==s&&n(i)}}}}_getPointCreator(e,t,s){const i=null==s||m(t,s)?e=>e:e=>T(e,t,s),{hasZ:a}=this,r=0;return a&&e?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:r})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=V(m)||S(m)||b(m),f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=k({normalizationType:a,normalizationField:i,minValue:n,maxValue:o}),h={value:.5,fieldType:m?.type},g=R(m)?P({values:f,supportsNullCount:p,percentileParams:h,outStatisticTypes:c}):D({values:f,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:h,outStatisticTypes:c});return O(g,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:r,timeZone:n},this.items,!1),l=j(o);return q(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=C(f,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return G(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return Z(f,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:r}=se(i,this.fieldsIndex);e.sort((e,i)=>t(s(e,a,r),s(i,a,r)))}}_topNFeatures(t,s,i,a){if(t.length>1&&s?.length){const r=s.map(e=>{const{compare:t,fieldOrExpression:s,fieldInfo:i}=se(e,this.fieldsIndex);return(e,r)=>t(a(e,s,i),a(r,s,i))}).reduceRight((e,t)=>(s,i)=>{const a=t(s,i);return 0===a||Number.isNaN(a)?e(s,i):a}),n=[];for(const s of t)e(n,s,i,r);return n}return t.slice(0,i)}_createFeatureQueryResponse(e){const{items:t,geometryType:s,hasM:i,hasZ:a,featureIdInfo:r,spatialReference:n}=this,{outFields:o,outSR:l,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:f,returnM:p}=e,h=null!=m&&t.length>(d||0)+m,g=o&&(o.includes("*")?[...this.fieldsIndex.fields]:o.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:s,hasM:i&&p,hasZ:a&&f,objectIdFieldName:"object-id"===r.type?r.fieldName:null,spatialReference:y(l||n),transform:c&&u(c)||null}}_createFeatures(e,t){const s=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:r,quantizationParameters:n,returnGeometry:o,returnCentroid:l,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:p=!1}=e,h=a&&f,y=i&&p;let T;const F=m||0,_=null!=d?F+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,r,_,(e,t,i)=>s.getFieldValue(e,t,i)):(T=[...t],this._sortFeatures(T,r,(e,t,i)=>s.getFieldValue(e,t,i))),(F>0||null!=_)&&(T=T.slice(F,_??void 0));const v=[];let V=0;if(this.geometryType&&(o||l)){const e=u(n)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(o&&!l)for(const i of T){const a=this.featureAdapter.getGeometry(i),r=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),geometry:x(this.geometryType,a,c,e,h,y)});t&&a&&!r.geometry&&(r.centroid=I(this,this.featureAdapter.getCentroid(i,this),e)),v[V++]=r}else if(!o&&l)for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:I(this,this.featureAdapter.getCentroid(i,this),e)});else for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:I(this,this.featureAdapter.getCentroid(i,this),e),geometry:x(this.geometryType,this.featureAdapter.getGeometry(i),c,e,h,y)})}else for(const u of T){const e=s.getAttributes(u);e&&(v[V++]=this._addFeatureJSONMetadata(u,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const s=this.featureAdapter.getMetadata?.(e);return void 0!==s&&(t.metadata=s),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,s=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,i=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>s)e=!0;else{e=this.items.reduce((e,t)=>{const s=this.featureAdapter.getGeometry(t);return e+(s?.size??0)},0)>i}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,s={attributes:{}}){const i=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new g(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,p=c?.length,h=!!p,y=h?c[0]:null,x=h&&!this.fieldsIndex.get(y);for(const g of u??[]){const{outStatisticFieldName:u,statisticType:d}=g,f=g,I="exceedslimit"!==d?g.onStatisticField:void 0,T="percentile_disc"===d||"percentile_cont"===d,F="EnvelopeAggregate"===d||"CentroidAggregate"===d||"ConvexHullAggregate"===d,_=h&&1===p&&(I===y||x)&&"count"===d;if(h){if(!n.has(I)){const e=[];for(const s of c){const i=this._getAttributeValues(l,s,t,a);e.push(i)}n.set(I,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const s=n.get(I);if(!s)continue;const i=Object.keys(s);for(const r of i){const{count:i,data:n,items:d,itemPositions:p}=s[r],h=n.join(",");if(!m||l.validateItems(d,m)){const s=o.get(h)||{attributes:{}};if(e.returnAggIds&&(s.aggregateIds=d.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),F){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(f,d);s.aggregateGeometries[t]=e}else{let e=null;if(_)e=i;else{const s=this._getAttributeValues(l,I,t,a),i=p.map(e=>s[e]);e=T&&"statisticParameters"in f?this._getPercentileValue(f,i):this._getStatisticValue(f,i,null,l.returnDistinctValues)}s.attributes[u]=e}let r=0;c.forEach((e,t)=>s.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t]),o.set(h,s)}}}else if(F){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(f,t);s.aggregateGeometries[i]=e}else{const e=this._getAttributeValues(l,I,t,a);s.attributes[u]=T&&"statisticParameters"in f?this._getPercentileValue(f,e):this._getStatisticValue(f,e,r,l.returnDistinctValues)}const v="min"!==d&&"max"!==d||!R(this.fieldsIndex.get(I))&&!this._isAnyDateField(I)?null:this.fieldsIndex.get(I)?.type;i.push({name:u,alias:u,type:v||"esriFieldTypeDouble"})}const I=h?Array.from(o.values()):[s];return this._sortFeatures(I,d,(e,t)=>e.attributes[t]),f&&(I.length=Math.min(f,I.length)),{fields:i,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return V(t)||S(t)||b(t)||z(t)}async _getAggregateGeometry(e,t){const{statisticType:s,outStatisticFieldName:i}=e,{featureAdapter:o,spatialReference:l,geometryType:u}=this,c=t.map(e=>x(u,o.getGeometry(e))),m={aggregateGeometries:null,outStatisticFieldName:null},d=await L.getImportPromise();let[f]=d.executeMany(c,{merge:!0});if(f&&f.rings[0].length<=3&&(f=null),"EnvelopeAggregate"===s){const e=f?n(f):K(c);m.aggregateGeometries={...e,spatialReference:l},m.outStatisticFieldName=i||"extent"}else if("CentroidAggregate"===s){const[e,t]=f?a(f):r(K(c));m.aggregateGeometries={x:e,y:t,spatialReference:l},m.outStatisticFieldName=i||"centroid"}else"ConvexHullAggregate"===s&&(m.aggregateGeometries=f&&{...f,spatialReference:l},m.outStatisticFieldName=i||"convexHull");return m}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:r}=e;let n=null;n=s?.has(a)?s.get(a):R(this.fieldsIndex.get(a))||this._isAnyDateField(a)?P({values:t,returnDistinct:i}):D({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:r,orderBy:n}=i,o=this.fieldsIndex.get(s);return E(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s,i){if(i.has(t))return i.get(t);const a=this.fieldsIndex.get(t),r=s.map(s=>e.getFieldValue(s,t,a));return i.set(t,r),r}_calculateUniqueValues(e,t,s){const i={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==i[o]?i[o]={count:1,data:n,items:[a],itemPositions:[r]}:(s||i[o].count++,i[o].items.push(a),i[o].itemPositions.push(r))}return i}async _getDataValues(e,i,a=!0){const r=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:o,timeZone:l}=e,u=s.fromJSON(this.query.outSR||this.spatialReference);return n?r.getExpressionValues(i,n,{viewingMode:"map",scale:o,spatialReference:u},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},l):r.getDataValues(i,t(e),a)}_calculateHistogramBins(e,t,s){if(null==t.min&&null==t.max)return[];const i=t.intervals,a=t.min??0,r=t.max??0,n=i.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=s[o];if(null!=t&&t>=a&&t<=r){const e=U(i,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:s,outAlias:i,valueType:a}=t,r=[],n=[{name:i??s,alias:i??s,type:a??"esriFieldTypeString"},{name:X,alias:X,type:"esriFieldTypeInteger"}],o=new g(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[s],(e,t,s)=>o.getFieldValue(e,t,s));const c=this._getAttributeValues(o,s,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[i??s]:d}}))),a.fields)for(const e of a.fields)n.some(t=>t.name===e.name)||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const s=e.bin;switch(t=t??this.items,s.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(B.fromJSON(s),e,t);case"dateBin":return this._createDateBinsResponse(M.fromJSON(s),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(w.fromJSON(s),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(N.fromJSON(s),e,t)}}async _createAutoIntervalBinsResponse(e,t,s){const{field:i,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),m=H(c,{field:i,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:F(n?e.normalizationMinValue:l,!1),maxValue:F(n?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,s);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,s){const{field:i,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),f=z(this.fieldsIndex.get(i)),p=A.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),g=null!=r?F(r,f):h[0],y=null!=n?F(n,f):h[h.length-1],x=[];if(null!=g&&null!=y){const e={zone:t.outTimeReference?.ianaTimeZone??Q},s=u?.unit?A.toJSON(u.unit):"milliseconds",i={[s]:u?.value||0},r=Y.fromMillis(g,e).minus(i),n=Y.fromMillis(y,e).minus(i),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const s=(e.weekday-t+7)%7;return e.minus({days:s}).startOf("day")};if("last"===o){let e="week"===p?((e,t)=>d(e,t).plus({days:7}))(n,m):n;for(;e>r;){const t=e.minus({[p]:a.value});if(t<r){x.unshift([l?t.plus(i).toMillis():r.plus(i).toMillis(),e.plus(i).toMillis()]);break}x.unshift([t.plus(i).toMillis(),e.plus(i).toMillis()]),e=t}}else{let e="first"===o?r:"week"===p?d(r,m):r.startOf(p);for(;e<=n;){const t=e.plus({[p]:a.value});if(t>n){x.push([e.plus(i).toMillis(),l?t.plus(i).toMillis():n.plus(i).toMillis()]);break}x.push([e.plus(i).toMillis(),t.plus(i).toMillis()]),e=t}}}const I=this._calculateHistogramBins(d,{intervals:x,min:g,max:y},s);return this._createFeaturesFromHistogramBins(I,t)}async _createFixedBoundariesBinsResponse(e,t,s){const{field:i}=e,a=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),r=z(this.fieldsIndex.get(i)),n=e.boundaries.map(e=>F(e,r)).sort((e,t)=>e-t),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=this._calculateHistogramBins(a,l,s);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,s){const{field:i,interval:a,normalizationType:r,start:n,end:o}=e,l=await this._getDataValues({field:i||e.expression,normalizationField:e.normalizationField,normalizationType:r,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),u=z(this.fieldsIndex.get(i)),c=H(l,{field:i,classificationMethod:"defined-interval",definedInterval:a,minValue:F(r?e.normalizationMinValue:n,u),maxValue:F(r?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,s);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:s,lowerBoundaryAlias:i}=t,a=i||"lowerBoundary",r=s||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:X,alias:X,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const f of e){const{minValue:e,maxValue:s,items:i}=f,p={attributes:{}};let h;if(p.attributes[a]=m&&d&&null!=e?Y.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(p.attributes[r]=m&&d&&null!=s?Y.fromMillis(s,{zone:d}).toISO():s),t.returnAggIds&&(p.aggregateIds=i.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},i),p.attributes[X]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map(({attributes:{EXPR_1:e,...t},...s})=>({...s,attributes:u??e?{...t,[u??e]:e,...p.attributes}:{...t,...p.attributes}}))):(p.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),n.push(p))):(t.bin?.splitBy&&(p.attributes[X]=++c),h=await this._createStatisticsQueryResponse(t,i,p),n.push(p)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function K(e){const t=o(e[0]);for(const s of e.slice(1))l(t,o(s));return t}function $(e,t,s,i){const a=i.x-s.x,r=i.y-s.y,n=t.x-s.x,o=t.y-s.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=s.x+a*c,e.y=s.y+r*c,!0}class ee{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function se(e,t){const s=e.split(" "),i=s[0],a=t.get(i),r=!!s[1]&&"desc"===s[1].toLowerCase();return{compare:J(a?.type,r,"case-insensitive"),fieldOrExpression:i,fieldInfo:a}}export{W as QueryEngineResult};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as s}from"../../../core/arrayUtils.js";import{initializeProjection as t,projectMany as e}from"../../../geometry/projectionUtils.js";import{isValid as n,equals as r,isWebMercator as i}from"../../../geometry/support/spatialReferenceUtils.js";import{canProject as o,lngLatToXY as a,xyToLngLat as m}from"../../../geometry/support/webMercatorUtils.js";const l=[0,0];function u(s,t){if(!t)return null;if("x"in t){const e={x:0,y:0};return[e.x,e.y]=s(t.x,t.y,l),null!=t.z&&(e.z=t.z),null!=t.m&&(e.m=t.m),e}if("xmin"in t){const e={xmin:0,ymin:0,xmax:0,ymax:0};return[e.xmin,e.ymin]=s(t.xmin,t.ymin,l),[e.xmax,e.ymax]=s(t.xmax,t.ymax,l),t.hasZ&&(e.zmin=t.zmin,e.zmax=t.zmax,e.hasZ=!0),t.hasM&&(e.mmin=t.mmin,e.mmax=t.mmax,e.hasM=!0),e}return"rings"in t?{rings:c(t.rings,s),hasM:t.hasM,hasZ:t.hasZ}:"paths"in t?{paths:c(t.paths,s),hasM:t.hasM,hasZ:t.hasZ}:"points"in t?{points:h(t.points,s),hasM:t.hasM,hasZ:t.hasZ}:null}function c(s,t){const e=[];for(const n of s)e.push(h(n,t));return e}function h(s,t){const e=[];for(const n of s){const s=t(n[0],n[1],[0,0]);e.push(s),n.length>2&&s.push(n[2]),n.length>3&&s.push(n[3])}return e}async function p(e,n){if(!e||!n)return;const r=Array.isArray(e)?e.map(s=>null!=s.geometry?s.geometry.spatialReference:null).filter(s):[e];await t(r.map(s=>({source:s,dest:n})))}const f=u.bind(null,a),x=u.bind(null,m);function y(s,t,a,m){if(!s)return null;if(a||(a=t,t=s.spatialReference),!n(t)||!n(a)||r(t,a))return s;if(o(t,a)){const t=i(a)?f(s):x(s);return t.spatialReference=a,t}return e([s],t,a,m)[0]}class g{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(s,t,e,n){if(!s?.length||!t||!e||r(t,e))return s;const i={geometries:s,inSpatialReference:t,outSpatialReference:e,options:n,resolve:Promise.withResolvers()};return this._jobs.push(i),this._timer??=setTimeout(this._process,10),i.resolve.promise}_process(){this._timer=null;const s=this._jobs.shift();if(!s)return;const{geometries:t,inSpatialReference:n,outSpatialReference:r,resolve:a,options:m}=s,l=t.filter(s=>null!=s);let u;u=o(n,r)&&null==m?.extendedParams?i(r)?l.map(f):l.map(x):e(l,n,r,m);let c=0;const h=t.map(s=>null==s?null:u[c++]);a.resolve(h),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}}const _=new g;function j(s,t,e,n){return _.push(s,t,e,n)}export{p as checkProjectionSupport,y as project,j as projectMany};
2
+ import{isSome as t}from"../../../core/arrayUtils.js";import{initializeProjection as s,projectMany as e}from"../../../geometry/projectionUtils.js";import{isPoint as r,isExtent as n,isPolygon as o,isPolyline as i,isMultipoint as a}from"../../../geometry/support/jsonTypeUtils.js";import{isValid as m,equals as l,isWebMercator as u}from"../../../geometry/support/spatialReferenceUtils.js";import{canProject as p,lngLatToXY as c,xyToLngLat as h}from"../../../geometry/support/webMercatorUtils.js";const f=[0,0];function y(t,s){const e=u(t)?c:h;if(r(s)){const t={x:0,y:0};return[t.x,t.y]=e(s.x,s.y,f),null!=s.z&&(t.z=s.z),null!=s.m&&(t.m=s.m),t}if(n(s)){const t={xmin:0,ymin:0,xmax:0,ymax:0};return[t.xmin,t.ymin]=e(s.xmin,s.ymin,f),[t.xmax,t.ymax]=e(s.xmax,s.ymax,f),s.hasZ&&(t.zmin=s.zmin,t.zmax=s.zmax,t.hasZ=!0),s.hasM&&(t.mmin=s.mmin,t.mmax=s.mmax,t.hasM=!0),t}if(o(s))return{rings:x(s.rings,e),hasM:s.hasM,hasZ:s.hasZ};if(i(s))return{paths:x(s.paths,e),hasM:s.hasM,hasZ:s.hasZ};if(a(s))return{points:g(s.points,e),hasM:s.hasM,hasZ:s.hasZ};throw new Error}function x(t,s){const e=[];for(const r of t)e.push(g(r,s));return e}function g(t,s){const e=[];for(const r of t){const t=s(r[0],r[1],[0,0]);e.push(t),r.length>2&&t.push(r[2]),r.length>3&&t.push(r[3])}return e}async function _(e,r){if(!e||!r)return;const n=Array.isArray(e)?e.map(t=>null!=t.geometry?t.geometry.spatialReference:null).filter(t):[e];await s(n.map(t=>({source:t,dest:r})))}function j(t,s,r,n){if(!t)return null;if(r||(r=s,s=t.spatialReference),!m(s)||!m(r)||l(s,r))return t;if(p(s,r)){const s=y(r,t);return s.spatialReference=r,s}return e([t],s,r,n)[0]}class M{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(t,s,e,r){if(!t?.length||!s||!e||l(s,e))return t;const n={geometries:t,inSpatialReference:s,outSpatialReference:e,options:r,resolve:Promise.withResolvers()};return this._jobs.push(n),this._timer??=setTimeout(this._process,10),n.resolve.promise}_process(){this._timer=null;const t=this._jobs.shift();if(!t)return;const{geometries:s,inSpatialReference:r,outSpatialReference:n,resolve:o,options:i}=t,a=s.filter(t=>null!=t);let m;m=p(r,n)&&null==i?.extendedParams?a.map(t=>y(n,t)):e(a,r,n,i);let l=0;const u=s.map(t=>null==t?null:m[l++]);o.resolve(u),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}}const R=new M;function Z(t,s,e,r){return R.push(t,s,e,r)}export{_ as checkProjectionSupport,j as project,Z as projectMany};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{parseDate as t}from"../../../../core/date.js";import{isValid as e}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as n,validationErrorToString as r,isNumericField as o,sanitizedParseFloat as i,isStringField as s,isDateField as u,sanitizeNullFieldValue as l}from"../../../support/fieldUtils.js";class a{constructor(t){this.description=t,this.code=null}}class c{constructor(t){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new a(t)}}function p(t){return new c(t)}class f{constructor(t){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=t}}function g(t){return new f(t)}const d=new Set;function m(t,e,o,i=!1){d.clear();for(const s in o){const u=t.get(s);if(!u)continue;const l=y(u,o[s]);if(d.add(u.name),u&&(i||u.editable)){const t=n(u,l);if(t)return p(r(t,u,l));e[u.name]=l}}for(const n of t.requiredFields??[])if(!d.has(n.name))return p(`missing required field "${n.name}"`);return null}function y(e,n){let r=n;return o(e)&&"string"==typeof n?r=i(n):s(e)&&null!=n&&"string"!=typeof n?r=String(n):u(e)&&"string"==typeof n&&(r=t(n)),l(r)}let h;function I(t,n){if(!t||!e(n))return t;if("rings"in t||"paths"in t){if(null==h)throw new TypeError("geometry engine not loaded");return h.simplify(n,t)}return t}async function E(){return null==h&&(h=await(import("../../../../geometry/geometryEngineJSON.js"))),h}async function S(t,n){!e(t)||"esriGeometryPolygon"!==n&&"esriGeometryPolyline"!==n||await E()}const T={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:["COUNT","SUM","AVG","VAR","STDDEV","MIN","MAX","PERCENTILE_CONT","PERCENTILE_DISC","CentroidAggregate","EnvelopeAggregate","ConvexHullAggregate"],supportedNormalizationTypes:["field","log","naturalLog","percentOfTotal","squareRoot"]};export{p as createFeatureEditErrorResult,g as createFeatureEditSuccessResult,S as loadGeometryEngineForSimplify,m as mixAttributes,T as queryBinsCapabilities,I as simplify};
2
+ import{parseDate as t}from"../../../../core/date.js";import{importLazily as e}from"../../../../geometry/operators/importUtils.js";import{isPolygon as r,isPolyline as o}from"../../../../geometry/support/jsonTypeUtils.js";import{isValid as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{validateFieldValue as n,validationErrorToString as i,isNumericField as l,sanitizedParseFloat as u,isStringField as p,isDateField as a,sanitizeNullFieldValue as c}from"../../../support/fieldUtils.js";class f{constructor(t){this.description=t,this.code=null}}class m{constructor(t){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new f(t)}}function d(t){return new m(t)}class g{constructor(t){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=t}}function y(t){return new g(t)}const h=new Set;function I(t,e,r,o=!1){h.clear();for(const s in r){const l=t.get(s);if(!l)continue;const u=j(l,r[s]);if(h.add(l.name),l&&(o||l.editable)){const t=n(l,u);if(t)return d(i(t,l,u));e[l.name]=u}}for(const s of t.requiredFields??[])if(!h.has(s.name))return d(`missing required field "${s.name}"`);return null}function j(e,r){let o=r;return l(e)&&"string"==typeof r?o=u(r):p(e)&&null!=r&&"string"!=typeof r?o=String(r):a(e)&&"string"==typeof r&&(o=t(r)),c(o)}const T=e(()=>import("../../../../geometry/operators/json/simplifyOperator.js"));function E(t,e){if(!r(t)&&!o(t))return t;if(!s(e))return t;const n=T.module;if(null==n)throw new TypeError("simplify operator not loaded");return n.execute({...t,spatialReference:e})??t}async function S(t,e){!s(t)||"esriGeometryPolygon"!==e&&"esriGeometryPolyline"!==e||await T.getImportPromise()}const w={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:["COUNT","SUM","AVG","VAR","STDDEV","MIN","MAX","PERCENTILE_CONT","PERCENTILE_DISC","CentroidAggregate","EnvelopeAggregate","ConvexHullAggregate"],supportedNormalizationTypes:["field","log","naturalLog","percentOfTotal","squareRoot"]};export{d as createFeatureEditErrorResult,y as createFeatureEditSuccessResult,S as loadGeometryEngineForSimplify,I as mixAttributes,w as queryBinsCapabilities,E as simplify};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";import{highlightPixels as n}from"../raster/functions/pixelUtils.js";import{convertVectorFieldData as o,sampleVectorField as s}from"../raster/functions/vectorFieldUtils.js";import i from"../support/RasterJobHandler.js";import{getDefaultBandCombination as a,normalizeRendererJSON as l}from"../../renderers/support/rasterRendererHelper.js";import{createFlowMesh as c}from"../../views/2d/engine/flow/dataUtils.js";const d=d=>{const h=d;let b=class extends h{constructor(){super(...arguments),this._rasterJobHandlerConfig={instance:null,refCount:0,connectionPromise:null}}get _rasterJobHandler(){return this._rasterJobHandlerConfig.instance}increaseRasterJobHandlerUsage(){this._rasterJobHandlerConfig.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandlerConfig.refCount--,this._rasterJobHandlerConfig.refCount<=0&&this._shutdownJobHandler()}async convertVectorFieldData(e,t,r){if(null==e)return null;const n=this._rasterJobHandler;return n?n.convertVectorFieldData({pixelBlock:e,dataType:t},r):o(e,t)}async sampleVectorFieldData(e,t){const r=this._rasterJobHandler;return r?r.sampleVectorFieldData(e,t):s(e.pixelBlock,e.srcDataType,e.tileSize,e.offset,e.maximumVoidPercentage)}async createFlowMesh(e,t){const r=this._rasterJobHandler;return r?r.createFlowMesh(e,t):c(e.meshType,e.simulationSettings,e.flowData,e.startInfo,null!=t.signal?t.signal:(new AbortController).signal)}async highlightPixels(e,t){const r=this,{bandIds:o}=r,s="imagery"===r.type?r.rasterInfo:r.raster.rasterInfo,i=o?.length?o:a(s),l=e.highlightOptions.map(e=>{const t={...e},r="bandId"in t?[t.bandId??0]:[t.xBandId,t.yBandId];for(let n=0;n<r.length;n++){const e=r[n];if(null==e)return;const t=i?.length?i.indexOf(e):e;if(t<0||t>2)return;r[n]=t}return"bandId"in t?t.bandId=r[0]:(t.xBandId=r[0],t.yBandId=r[1]),t}).filter(e=>null!=e);if(0===l.length)return;const c=this._rasterJobHandler;c?await c.highlightPixels({...e,highlightOptions:l},t):n({...e,highlightOptions:l})}_initJobHandler(){const{_rasterJobHandlerConfig:e}=this;if(e.connectionPromise)return e.connectionPromise;const t=new i;return e.connectionPromise=t.initialize().then(()=>{e.instance=t,this.notifyChange("_rasterJobHandler")},()=>{}),e.connectionPromise}_shutdownJobHandler(){const{_rasterJobHandlerConfig:e}=this;e.instance?.destroy(),e.instance=null,e.connectionPromise=null,e.refCount=0,this.notifyChange("_rasterJobHandler"),this._cachedRendererJson=void 0}async _updateSymbolizer(e,t,r,n){const o=this._rasterJobHandlerConfig.instance;if(!o)return;const s=l({...t.toJSON(),variableName:r});JSON.stringify(this._cachedRendererJson)!==JSON.stringify(s)&&(n&&(e.rasterInfo=n),e.rendererJSON=s,e.bind(),await o.updateSymbolizer(e),this._cachedRendererJson=t.toJSON())}async _symbolize(e,t){const{pixelData:r,bandIds:n,simpleStretchParams:o}=e,s=this._rasterJobHandler;if(s){const e=await s.symbolize({...r,simpleStretchParams:o,bandIds:n},t);return{extent:r.extent,pixelBlock:e}}const i=e.symbolizer.symbolize({...r,simpleStretchParams:o,bandIds:n});return{extent:r.extent,pixelBlock:i}}};return e([t({clonable:!1})],b.prototype,"_rasterJobHandler",null),e([t({clonable:!1})],b.prototype,"_cachedRendererJson",void 0),e([t({clonable:!1})],b.prototype,"_rasterJobHandlerConfig",void 0),b=e([r("esri.layers.mixins.RasterJobHandlerMixin")],b),b};export{d as RasterJobHandlerMixin};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../core/accessorSupport/decorators.js";import{highlightPixels as n}from"../raster/functions/pixelUtils.js";import{convertVectorFieldData as o,sampleVectorField as s}from"../raster/functions/vectorFieldUtils.js";import i from"../support/RasterJobHandler.js";import{getDefaultBandCombination as a,normalizeRendererJSON as l}from"../../renderers/support/rasterRendererHelper.js";import{createFlowMesh as c}from"../../views/2d/engine/flow/dataUtils.js";const d=d=>{const h=d;let b=class extends h{constructor(){super(...arguments),this._rasterJobHandlerConfig={instance:null,refCount:0,connectionPromise:null}}get _rasterJobHandler(){return this._rasterJobHandlerConfig.instance}increaseRasterJobHandlerUsage(){this._rasterJobHandlerConfig.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandlerConfig.refCount--,this._rasterJobHandlerConfig.refCount<=0&&this._shutdownJobHandler()}async convertVectorFieldData(e,t,r){if(null==e)return null;const n=this._rasterJobHandler;return n?n.convertVectorFieldData({pixelBlock:e,dataType:t},r):o(e,t)}async sampleVectorFieldData(e,t){const r=this._rasterJobHandler;return r?r.sampleVectorFieldData(e,t):s(e.pixelBlock,e.srcDataType,e.tileSize,e.offset,e.maximumVoidPercentage)}async createFlowMesh(e,t){const r=this._rasterJobHandler;return r?r.createFlowMesh(e,t):c(e.meshType,e.simulationSettings,e.flowData,e.startInfo,null!=t.signal?t.signal:(new AbortController).signal)}async highlightPixels(e,t){const r=this,{bandIds:o}=r,s="imagery"===r.type?r.rasterInfo:r.raster.rasterInfo,i=o?.length?o:a(s),l=e.highlightOptions.map(e=>{const t={...e},r="bandId"in t?[t.bandId??0]:[t.xBandId,t.yBandId];for(let n=0;n<r.length;n++){const e=r[n];if(null==e)return;const t=i?.length?i.indexOf(e):e;if(t<0||t>2)return;r[n]=t}return"bandId"in t?t.bandId=r[0]:(t.xBandId=r[0],t.yBandId=r[1]),t}).filter(e=>null!=e);if(0===l.length)return;const c=this._rasterJobHandler;c?await c.highlightPixels({...e,highlightOptions:l},t):n({...e,highlightOptions:l})}_initJobHandler(){const{_rasterJobHandlerConfig:e}=this;if(e.connectionPromise)return e.connectionPromise;const t=new i;return e.connectionPromise=t.initialize().then(()=>{e.instance=t,this.notifyChange("_rasterJobHandler")},()=>{}),e.connectionPromise}_shutdownJobHandler(){const{_rasterJobHandlerConfig:e}=this;e.instance?.destroy(),e.instance=null,e.connectionPromise=null,e.refCount=0,this.notifyChange("_rasterJobHandler"),this._cachedRendererJson=void 0}async _updateSymbolizer(e,t,r,n){const o=this._rasterJobHandlerConfig.instance;if(!o)return;const s=l({...t.toJSON(),variableName:r});if(JSON.stringify(this._cachedRendererJson)!==JSON.stringify(s)){n&&(e.rasterInfo=n),e.rendererJSON=s,e.bind();try{await o.updateSymbolizer(e),this._cachedRendererJson=t.toJSON()}catch{}}}async _symbolize(e,t){const{pixelData:r,bandIds:n,simpleStretchParams:o}=e,s=this._rasterJobHandler;if(s){const e=await s.symbolize({...r,simpleStretchParams:o,bandIds:n},t);return{extent:r.extent,pixelBlock:e}}const i=e.symbolizer.symbolize({...r,simpleStretchParams:o,bandIds:n});return{extent:r.extent,pixelBlock:i}}};return e([t({clonable:!1})],b.prototype,"_rasterJobHandler",null),e([t({clonable:!1})],b.prototype,"_cachedRendererJson",void 0),e([t({clonable:!1})],b.prototype,"_rasterJobHandlerConfig",void 0),b=e([r("esri.layers.mixins.RasterJobHandlerMixin")],b),b};export{d as RasterJobHandlerMixin};