@arcgis/core 4.23.0-next.20220128 → 4.23.0-next.20220202

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 (288) hide show
  1. package/Graphic.js +1 -1
  2. package/TimeExtent.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/01a10fe5ad6941b0ee8c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{7a5f5acfbd4ca1a5c1f3.js → 06116433eb6e669f146b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/09a05d778b6fac710828.js +1 -0
  7. package/assets/esri/core/workers/chunks/{83d00afae4406ec78bc9.js → 0c6be307709523eb8a05.js} +1 -1
  8. package/assets/esri/core/workers/chunks/0e215fa28a0448169132.js +1 -0
  9. package/assets/esri/core/workers/chunks/{391e96192d1ec4e55ce2.js → 101b4f02f0572afb666f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/11750e96065b4d7b926b.js +1 -0
  11. package/assets/esri/core/workers/chunks/{929c9b7cdab7c4ca3d87.js → 17c51f5a13f471e6656a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{ed0bcc66fb1e0ee75a4b.js → 1f34957ef42e5b5977d0.js} +1 -1
  13. package/assets/esri/core/workers/chunks/2f4e425be3a3bdfd8d29.js +1 -0
  14. package/assets/esri/core/workers/chunks/34bed896b68993cabaa1.js +1 -0
  15. package/assets/esri/core/workers/chunks/3e1679b01429fd73cffe.js +1 -0
  16. package/assets/esri/core/workers/chunks/{99619fcb772807c74f3b.js → 444829a840b8ded16fd7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/467b5faa1c90d9821609.js +1 -0
  18. package/assets/esri/core/workers/chunks/49353182a16218a84251.js +1 -0
  19. package/assets/esri/core/workers/chunks/4bfc2eeb0738c393d8ec.js +1 -0
  20. package/assets/esri/core/workers/chunks/4de996ebc432f5e149bc.js +1 -0
  21. package/assets/esri/core/workers/chunks/{422537fc3df707bb62c9.js → 5038935db9b1ebe61d02.js} +1 -1
  22. package/assets/esri/core/workers/chunks/50976921acf7bd636123.js +1 -0
  23. package/assets/esri/core/workers/chunks/50ef2622fd0d9a241979.js +1 -0
  24. package/assets/esri/core/workers/chunks/{5790d171072b3c7d108f.js → 53aa2ab4e569c994a32d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{7903a3e2e0faff0f86c0.js → 56657f890e0f79f5d2ad.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{db3c729ce0c0b2690dc9.js → 574e33f28c106d607fe3.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{952980635afc7ec81804.js → 5b02ba8ed152dba53155.js} +1 -1
  28. package/assets/esri/core/workers/chunks/60c06d1bb3f8a26cb5ac.js +1 -0
  29. package/assets/esri/core/workers/chunks/{c2253a9f29c1aabb2b75.js → 66c47983e93071de28b1.js} +1 -1
  30. package/assets/esri/core/workers/chunks/6be326edd9829781d926.js +1 -0
  31. package/assets/esri/core/workers/chunks/70d6bb3c7112cb702389.js +1 -0
  32. package/assets/esri/core/workers/chunks/{5bcb3240b3c005e5fe72.js → 7215af7810d15e89aa5a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/7509c1693ffedc0fa018.js +1 -0
  34. package/assets/esri/core/workers/chunks/76c1d663f6d3f935c87f.js +1 -0
  35. package/assets/esri/core/workers/chunks/7ccbb923f113b3e21545.js +1 -0
  36. package/assets/esri/core/workers/chunks/810a763373d7f78ae398.js +1 -0
  37. package/assets/esri/core/workers/chunks/82194fec53054c37061f.js +1 -0
  38. package/assets/esri/core/workers/chunks/82c59a71b7f087148089.js +1 -0
  39. package/assets/esri/core/workers/chunks/84eee02122b56a22d49e.js +1 -0
  40. package/assets/esri/core/workers/chunks/{dd13772a5e2eccc6a2bc.js → 8598f762f15ca68d52b7.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{3c673495e5f507c4a9e5.js → 88458dcaff8edc50620c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{5ec98f4ddac707d0fbd1.js → 88815d533808aabb1fa9.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{0463ba46df855a92b9c0.js → 8941f09329d9d39fb2fe.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{655b55ac0cd533d7e9d7.js → 8ad5dc818dc73f4b9a76.js} +1 -1
  45. package/assets/esri/core/workers/chunks/8e96cddb069b643d864a.js +1 -0
  46. package/assets/esri/core/workers/chunks/{f2124f4d0f2b8a91f0ea.js → 90c5edcd8a609224ce55.js} +1 -1
  47. package/assets/esri/core/workers/chunks/9230b20eba4304d421b4.js +1 -0
  48. package/assets/esri/core/workers/chunks/{bac9fc90e6756e211160.js → 94d9951509c0db09547a.js} +1 -1
  49. package/assets/esri/core/workers/chunks/996d6ae7f2e2273f9bce.js +1 -0
  50. package/assets/esri/core/workers/chunks/{37c03cfc19086ce631c6.js → 9bd603ec98d24cd918e9.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{c1135cb02ec46c491459.js → 9ce961bc390202c87941.js} +1 -1
  52. package/assets/esri/core/workers/chunks/9d4a35d4a85db80c4071.js +1 -0
  53. package/assets/esri/core/workers/chunks/9f0ad28e66862ba971a3.js +1 -0
  54. package/assets/esri/core/workers/chunks/{b3f5e91116112b0b612a.js → 9fd47b8fe25657ac0237.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{b9e9cb354822c6d995a4.js → a276e60209f3d877a8d0.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{aeaa1667c2d9f1b3366b.js → a85ed251d3d3668e474f.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{44f0c3663b293afbd172.js → acf10f747215e9ff54dc.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{69fd99b7c76e9992ccf3.js → b32bf9808cb4be3a6bd0.js} +1 -1
  59. package/assets/esri/core/workers/chunks/b3dc80ddbfa81026e937.js +1 -0
  60. package/assets/esri/core/workers/chunks/b548e6b3add4154ac4e6.js +1 -0
  61. package/assets/esri/core/workers/chunks/b6c55bdd8c957b062bc1.js +1 -0
  62. package/assets/esri/core/workers/chunks/{9d77467aa71d345fc1b6.js → bcc01bbffaa3bb5f60a8.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{1f8c6a179e39fd4c5e6f.js → bd152e8b43cc4a6844dd.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{0d02c6ad1f4688bfa374.js → bf7c44644fe7b0aa60cf.js} +1 -1
  65. package/assets/esri/core/workers/chunks/c0dc5882362479794224.js +1 -0
  66. package/assets/esri/core/workers/chunks/c8b574a76807f4ea7a70.js +1 -0
  67. package/assets/esri/core/workers/chunks/d09a0b2dc3a6fc10fa41.js +1 -0
  68. package/assets/esri/core/workers/chunks/{ec10151a2a95e95a0bb5.js → d304fe0ac836afd46e3d.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{37a7bd30352b1309b8f8.js → d3f05b8e4bd53eb1eb9d.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{be588873c16770ceb9ef.js → d46b511bbb83e68f1ece.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{17de7a324dfa7f57ad5d.js → d780e946149b1c3d1246.js} +1 -1
  72. package/assets/esri/core/workers/chunks/d80bcf5ed1f54e0c4f5a.js +1 -0
  73. package/assets/esri/core/workers/chunks/{8cbb04a9065aa3756638.js → dc04a8ba6c770bdc2bd4.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{89820b200ee44e678af5.js → dd891a98105904f8a06b.js} +1 -1
  75. package/assets/esri/core/workers/chunks/e5ab037c2a90411c453b.js +1 -0
  76. package/assets/esri/core/workers/chunks/ef2df21e1af3aa7ced29.js +1 -0
  77. package/assets/esri/core/workers/chunks/f5a7281ae24e837efc61.js +1 -0
  78. package/assets/esri/core/workers/chunks/{ff6abdc72076f3994659.js → f7150547d7e3259a0f29.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{2c607d30ff8ca1b61286.js → fe0c3b7c9b428d9c3f25.js} +1 -1
  80. package/assets/esri/images/portal/mediaservice16.png +0 -0
  81. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  82. package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
  83. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  84. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  85. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  86. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  87. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  88. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  89. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  90. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  91. package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
  92. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  93. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  94. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  95. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  96. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  97. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  98. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  99. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  100. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  101. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  102. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  103. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  104. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  105. package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
  106. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  107. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  108. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  109. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  110. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  111. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  112. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  113. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  114. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  115. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  116. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  117. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  118. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  119. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  120. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  121. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  122. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  123. package/chunks/Heatmap.glsl.js +10 -0
  124. package/chunks/HeatmapDensity.glsl.js +21 -0
  125. package/core/maybe.js +1 -1
  126. package/core/promiseUtils.js +1 -1
  127. package/interfaces.d.ts +455 -45
  128. package/layers/RouteLayer.d.ts +4 -0
  129. package/layers/RouteLayer.js +1 -1
  130. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  131. package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
  132. package/layers/graphics/featureConversionUtils.js +1 -1
  133. package/layers/mixins/ArcGISImageService.js +1 -1
  134. package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
  135. package/package.json +1 -1
  136. package/portal/PortalItem.js +1 -1
  137. package/renderers/support/rendererConversion.js +1 -1
  138. package/rest/support/DirectionLine.d.ts +4 -0
  139. package/rest/support/DirectionPoint.d.ts +4 -0
  140. package/rest/support/FeatureSet.js +1 -1
  141. package/rest/support/RouteInfo.d.ts +4 -0
  142. package/rest/support/RouteInfo.js +1 -1
  143. package/rest/support/RouteSolveResult.d.ts +4 -0
  144. package/support/featureFlags.js +1 -1
  145. package/support/revision.js +1 -1
  146. package/symbols/TextSymbol3DLayer.js +1 -1
  147. package/symbols/support/Symbol3DHalo.js +1 -1
  148. package/symbols/support/Symbol3DTextBackground.js +5 -0
  149. package/views/2d/engine/RasterVFContainer.js +5 -0
  150. package/views/2d/engine/RasterVFDisplayObject.js +1 -1
  151. package/views/2d/engine/flow/AnimatedFlowView2D.js +1 -1
  152. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  153. package/views/2d/engine/webgl/brushes/raster/BrushVectorField.js +1 -1
  154. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  155. package/views/2d/engine/webgl/mesh/templates/WGLBaseTextTemplate.js +1 -1
  156. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  157. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  158. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  159. package/views/2d/layers/RouteLayerView2D.js +1 -1
  160. package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
  161. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  162. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  163. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  164. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  165. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  166. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  167. package/views/2d/layers/imagery/ImageryVFStrategy.js +5 -0
  168. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  169. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  170. package/views/2d/layers/imagery/VectorFieldView2D.js +5 -0
  171. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  172. package/views/3d/environment/CloudsComposition.js +1 -1
  173. package/views/3d/environment/CloudsGenerator.js +1 -1
  174. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  175. package/views/3d/environment/Fog.js +1 -1
  176. package/views/3d/environment/NoiseTextureAtlas.js +1 -1
  177. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  178. package/views/3d/environment/Precipitation.js +1 -1
  179. package/views/3d/environment/SimpleAtmosphere.js +1 -1
  180. package/views/3d/environment/Stars.js +1 -1
  181. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  182. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  183. package/views/3d/layers/I3SMeshView3D.js +1 -1
  184. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  185. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  186. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  187. package/views/3d/layers/graphics/labelPlacement.js +1 -1
  188. package/views/3d/layers/i3s/I3SCrossfadeHelper.js +1 -1
  189. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  190. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  191. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  192. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  193. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  194. package/views/3d/support/LaserLineRenderer.js +1 -1
  195. package/views/3d/terrain/OverlayRenderer.js +1 -1
  196. package/views/3d/terrain/TerrainRenderer.js +1 -1
  197. package/views/3d/terrain/TileRenderer.js +1 -1
  198. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  199. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  200. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +5 -0
  201. package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
  202. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  203. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  204. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  205. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  206. package/views/3d/webgl-engine/lib/ShadowHighlightHelper.js +1 -1
  207. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  208. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  209. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  210. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  212. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  213. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +5 -0
  214. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  215. package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +5 -0
  216. package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +5 -0
  217. package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +5 -0
  218. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +5 -0
  219. package/views/draw/support/Box.js +1 -1
  220. package/views/draw/support/GraphicMover.js +1 -1
  221. package/views/draw/support/HighlightHelper.js +5 -0
  222. package/views/draw/support/Reshape.js +1 -1
  223. package/views/draw/support/layerUtils.js +1 -1
  224. package/webdoc/support/{Thumbnail.js → SlideThumbnail.js} +1 -1
  225. package/webmap/Bookmark.js +1 -1
  226. package/webmap/Version.js +1 -1
  227. package/webscene/Slide.js +1 -1
  228. package/webscene/Version.js +1 -1
  229. package/webscene/support/SlideVisibleLayer.js +1 -1
  230. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  231. package/widgets/Bookmarks.js +1 -1
  232. package/widgets/Directions/DirectionsViewModel.js +1 -1
  233. package/widgets/Directions/support/directionsUtils.js +1 -1
  234. package/widgets/Directions/support/resources.js +1 -1
  235. package/widgets/Directions.js +1 -1
  236. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  237. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  238. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  239. package/widgets/FeatureTable.js +1 -1
  240. package/widgets/Sketch/SketchViewModel.js +1 -1
  241. package/widgets/Sketch.js +1 -1
  242. package/widgets/TimeSlider.js +1 -1
  243. package/widgets/Widget.js +1 -1
  244. package/widgets/support/vnodeCache.js +5 -0
  245. package/widgets/support/widgetUtils.js +1 -1
  246. package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +0 -1
  247. package/assets/esri/core/workers/chunks/0cd0a6eef51fc5b9ea61.js +0 -1
  248. package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +0 -1
  249. package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +0 -1
  250. package/assets/esri/core/workers/chunks/1877ab1b6a115dbba1c5.js +0 -1
  251. package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +0 -1
  252. package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +0 -1
  253. package/assets/esri/core/workers/chunks/1c733b7db092a2a88ef3.js +0 -1
  254. package/assets/esri/core/workers/chunks/27474b007988855bea9d.js +0 -1
  255. package/assets/esri/core/workers/chunks/357033117dfe61eb81ea.js +0 -1
  256. package/assets/esri/core/workers/chunks/483d5d8593d96d0f0b15.js +0 -1
  257. package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +0 -1
  258. package/assets/esri/core/workers/chunks/4be35af7d6babbfe9d84.js +0 -1
  259. package/assets/esri/core/workers/chunks/5457962a70bd3c557a75.js +0 -1
  260. package/assets/esri/core/workers/chunks/57856b4a9b8784a69844.js +0 -1
  261. package/assets/esri/core/workers/chunks/57b349d1dbc0bed75b79.js +0 -1
  262. package/assets/esri/core/workers/chunks/5d11b97b667921d67ae7.js +0 -1
  263. package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +0 -1
  264. package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +0 -1
  265. package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +0 -1
  266. package/assets/esri/core/workers/chunks/96f148a556a2418038de.js +0 -1
  267. package/assets/esri/core/workers/chunks/9876a1bae350795fab36.js +0 -1
  268. package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +0 -1
  269. package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +0 -1
  270. package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +0 -1
  271. package/assets/esri/core/workers/chunks/c984b3040e120e502b11.js +0 -1
  272. package/assets/esri/core/workers/chunks/cdbc005eebec1503b99d.js +0 -1
  273. package/assets/esri/core/workers/chunks/d1fe53b597351dc58305.js +0 -1
  274. package/assets/esri/core/workers/chunks/e218bde41ffbcc5194f5.js +0 -1
  275. package/assets/esri/core/workers/chunks/e287f49184d076af17e2.js +0 -1
  276. package/assets/esri/core/workers/chunks/e93dfdede0532a89ffa5.js +0 -1
  277. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +0 -1
  278. package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +0 -1
  279. package/assets/esri/core/workers/chunks/eb82ff10cef2bde6e57f.js +0 -1
  280. package/assets/esri/core/workers/chunks/ee6e0db58dc64410e687.js +0 -1
  281. package/assets/esri/core/workers/chunks/f0a9f161805fc7a30fc5.js +0 -1
  282. package/assets/esri/core/workers/chunks/fc7e31d87555beb63291.js +0 -1
  283. package/assets/esri/core/workers/chunks/fff6b0338f06dad0c45d.js +0 -1
  284. package/views/2d/layers/imagery/ImageryGraphicsView2D.js +0 -5
  285. package/widgets/Directions/support/CostSummary.js +0 -5
  286. package/widgets/Directions/support/RouteSection.js +0 -5
  287. package/widgets/Directions/support/RouteSections.js +0 -5
  288. package/widgets/Directions/support/maneuverUtils.js +0 -5
@@ -0,0 +1,4 @@
1
+ import "../interfaces";
2
+
3
+ import RouteLayer = __esri.RouteLayer;
4
+ export default RouteLayer;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import"../geometry.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import{read as i}from"../renderers/support/jsonUtils.js";import s from"../core/Collection.js";import n from"../core/Error.js";import{isSome as l,isNone as a}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{convertUnit as y}from"../core/unitUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";import S from"../geometry/Extent.js";import{WGS84 as h}from"../geometry/support/spatialReferenceUtils.js";import g from"./Layer.js";import{BlendLayer as b}from"./mixins/BlendLayer.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import P from"./support/DefaultSymbols.js";import{fetchServiceDescription as N}from"../rest/networkService.js";import{solve as I}from"../rest/route.js";import D from"../rest/support/DirectionLine.js";import O from"../rest/support/DirectionPoint.js";import{directionsTimeUnitJsonMap as j,directionsLengthUnitJsonMap as L}from"../rest/support/networkEnums.js";import C from"../rest/support/PointBarrier.js";import _ from"../rest/support/PolygonBarrier.js";import T from"../rest/support/PolylineBarrier.js";import J from"../rest/support/RouteInfo.js";import R from"../rest/support/RouteParameters.js";import x from"../rest/support/RouteSettings.js";import F from"../rest/support/Stop.js";import k from"../geometry/SpatialReference.js";import A from"../geometry/Multipoint.js";function G(e){return e.length?e:null}function U(e){return"layers"in e}function M(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function W(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function E(e,t,r){var o,i,s,a,p,u,y,m,f,c,d;const S=t.networkDataset.networkAttributes.filter((e=>"esriNAUTCost"===e.usageType)),h=t.supportedTravelModes.find((e=>e.id===t.defaultTravelMode)),g=null!=(o=r.travelMode)?o:h,{timeAttributeName:b,distanceAttributeName:w}=g,v=S.find((e=>e.name===b)),B=S.find((e=>e.name===w)),P=null!=(i=null!=(s=null==(a=r.travelMode)?void 0:a.impedanceAttributeName)?s:r.impedanceAttribute)?i:t.impedance,N=j.fromJSON(null==v?void 0:v.units),I=L.fromJSON(null==B?void 0:B.units);if(!N||!I)throw new n("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const D=null!=(p=r.directionsLanguage)?p:t.directionsLanguage,O=null!=(u=null!=(y=r.accumulateAttributes)?y:t.accumulateAttributeNames)?u:[],C=new Set(S.filter((({name:e})=>e===b||e===w||e===P||O.includes(e))).map((({name:e})=>e))),_=e=>{for(const t in e)C.has(t)||delete e[t]};for(const n of e.pointBarriers){var T;if(l(n.costs))n.addedCost=null!=(T=n.costs[P])?T:0,_(n.costs)}for(const n of e.polygonBarriers){var J;if(l(n.costs))n.scaleFactor=null!=(J=n.costs[P])?J:1,_(n.costs)}for(const n of e.polylineBarriers){var R;if(l(n.costs))n.scaleFactor=null!=(R=n.costs[P])?R:1,_(n.costs)}const{routeInfo:F}=e,{findBestSequence:k,preserveFirstStop:A,preserveLastStop:G,startTimeIsUTC:U,timeWindowsAreUTC:M}=r;F.analysisSettings=new x({accumulateAttributes:O,directionsLanguage:D,findBestSequence:k,preserveFirstStop:A,preserveLastStop:G,startTimeIsUTC:U,timeWindowsAreUTC:M,travelMode:g}),F.totalDuration=q(null!=(m=F.totalCosts[b])?m:0,N),F.totalDistance=V(null!=(f=F.totalCosts[w])?f:0,I),F.totalLateDuration=q(null!=(c=F.totalViolations[b])?c:0,N),F.totalWaitDuration=q(null!=(d=F.totalWait[b])?d:0,N),l(F.totalCosts)&&_(F.totalCosts),l(F.totalViolations)&&_(F.totalViolations),l(F.totalWait)&&_(F.totalWait);for(const n of e.stops){var W,E,H,K,Q,Z;if(l(n.serviceCosts))n.serviceDuration=q(null!=(W=n.serviceCosts[b])?W:0,N),n.serviceDistance=V(null!=(E=n.serviceCosts[w])?E:0,I),_(n.serviceCosts);if(l(n.cumulativeCosts))n.cumulativeDuration=q(null!=(H=n.cumulativeCosts[b])?H:0,N),n.cumulativeDistance=V(null!=(K=n.cumulativeCosts[w])?K:0,I),_(n.cumulativeCosts);if(l(n.violations))n.lateDuration=q(null!=(Q=n.violations[b])?Q:0,N),_(n.violations);if(l(n.wait))n.waitDuration=q(null!=(Z=n.wait[b])?Z:0,N),_(n.wait)}}function q(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function V(e,t){return"decimal-degrees"===t||"points"===t?e:y(e,t,"meters")}const H=s.ofType(D),K=s.ofType(O),Q=s.ofType(C),Z=s.ofType(_),$=s.ofType(T),z=s.ofType(F);let X=class extends(b(B(w(v(p(g)))))){constructor(...e){super(...e),this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new P,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new Q,this.polygonBarriers=new Z,this.polylineBarriers=new $,this.routeInfo=null,this.spatialReference=k.WGS84,this.stops=new z,this.title="Route",this.type="route"}writeFeatureCollectionWebmap(e,t){const r=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),o=r.map(((e,t)=>t));u("featureCollection.layers",r,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=o}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>D.fromPortalJSON(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>O.fromPortalJSON(e)))}get fullExtent(){if(l(this.routeInfo)&&l(this.routeInfo.geometry))return this.routeInfo.geometry.extent;if(this.stops.length>1){const{spatialReference:e}=this.stops[0],t=new A({spatialReference:e}),r=this.stops.toArray().map((e=>e.geometry));for(const o of r)l(o)&&t.addPoint(o);return t.extent}return new S({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:k.WGS84})}readMaxScale(e,t){var r;const o=(U(t)?t.layers:t.featureCollection.layers).find((e=>l(e.layerDefinition.maxScale)));return null!=(r=null==o?void 0:o.layerDefinition.maxScale)?r:0}readMinScale(e,t){var r;const o=(U(t)?t.layers:t.featureCollection.layers).find((e=>l(e.layerDefinition.minScale)));return null!=(r=null==o?void 0:o.layerDefinition.minScale)?r:0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>C.fromPortalJSON(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>_.fromPortalJSON(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>T.fromPortalJSON(e)))}readRouteInfo(e,t){const r=this._getNetworkFeatures(t,"RouteInfo",(e=>J.fromPortalJSON(e)));return r.length>0?r.getItemAt(0):null}get routeServiceUrl(){var e,r,o,i;return null!=(e=this.portalItem)&&e.id&&null!=(r=null==(o=this.portalItem.portal.helperServices)||null==(i=o.route)?void 0:i.url)?r:t.routeServiceUrl}readSpatialReference(e,t){var r,o;const i=U(t)?t.layers:t.featureCollection.layers;if(!i.length)return k.WGS84;const{layerDefinition:s}=i[0],n=null!=(r=null!=(o=s.spatialReference)?o:s.extent.spatialReference)?r:h;return k.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>F.fromPortalJSON(e)),(e=>this._setStopSymbol(e)))}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}async solve(e,t){var r,o,i,l;const p=null!=(r=null==e?void 0:e.stops)?r:this.stops,u=null!=(o=null==e?void 0:e.pointBarriers)?o:G(this.pointBarriers),y=null!=(i=null==e?void 0:e.polylineBarriers)?i:G(this.polylineBarriers),m=null!=(l=null==e?void 0:e.polygonBarriers)?l:G(this.polygonBarriers);if(a(p))throw new n("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((M(p)||W(p))&&p.features.length<2||s.isCollection(p)&&p.length<2)throw new n("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");const f=await N(this.routeServiceUrl,null==e?void 0:e.apiKey,t),c={startTime:new Date},d={directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:u,polylineBarriers:y,polygonBarriers:m,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!u,returnDirections:!0,returnPolygonBarriers:!!m,returnPolylineBarriers:!!y,returnRoutes:!0,returnStops:!0,stops:p},S=e?R.from(e):new R;for(const s in c)null==S[s]&&(S[s]=c[s]);S.set(d);const h=await I(this.routeServiceUrl,S,t),g=this._toRouteLayerSolution(h);return E(g,f,S),g}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l)}_getLayerDefinition(){return{capabilities:"Query,Update,Editing",extent:this.fullExtent.toJSON(),hasM:!1,hasZ:!1,maxScale:this.maxScale,minScale:this.minScale,objectIdField:"__OBJECTID",spatialReference:this.spatialReference.toJSON(),type:"Feature Layer",typeIdField:""}}_getNetworkFeatures(e,t,n,l){const p=(U(e)?e.layers:e.featureCollection.layers).find((e=>e.layerDefinition.name===t));if(a(p))return new s;const{layerDefinition:u,popupInfo:y,featureSet:m}=p,f=u.drawingInfo.renderer,{features:c}=m,d=f&&i(f),S=c.map((e=>{var i;const s=n(e),{attributes:l}=e,a=new r({attributes:l});return null!=s.symbol||(s.symbol=null!=(i=null==d?void 0:d.getSymbol(a))?i:this._getNetworkSymbol(t)),null!=s.popupTemplate||(s.popupTemplate=y&&o.fromJSON(y)),s}));return l&&S.some((e=>!e.symbol))&&l(S),new s(S)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}_setStopSymbol(e){if(!e)return;if(e.length<2){for(const t of e)t.symbol=this.defaultSymbols.invalidStop;return}const t=e.map((e=>e.sequence)).filter((e=>l(e))),r=Math.min(...t),o=Math.max(...t);for(const i of e)i.sequence!==r?i.sequence!==o?"ok"===i.status||"not-located-on-closest"===i.status?"waypoint"!==i.locationType?"break"!==i.locationType?i.symbol=this.defaultSymbols.middleStop:i.symbol=this.defaultSymbols.breakStop:i.symbol=this.defaultSymbols.waypointStop:i.symbol=this.defaultSymbols.invalidStop:i.symbol=this.defaultSymbols.lastStop:i.symbol=this.defaultSymbols.firstStop}_toRouteLayerSolution(e){var t,r,o;const i=e.routeResults[0].stops.map((e=>F.fromJSON(e.toJSON())));this._setStopSymbol(i);const s=new z(i),n=new Z(null==(t=e.polygonBarriers)?void 0:t.map((e=>{const t=_.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),l=new $(null==(r=e.polylineBarriers)?void 0:r.map((e=>{const t=T.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),a=new Q(null==(o=e.pointBarriers)?void 0:o.map((e=>{const t=C.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),p=J.fromJSON(e.routeResults[0].route.toJSON());p.symbol=this.defaultSymbols.routeInfo;const u=new K(e.routeResults[0].directionPoints.features.map((e=>{const t=O.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new H(e.routeResults[0].directionLines.features.map((e=>{const t=D.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:u,pointBarriers:a,polygonBarriers:n,polylineBarriers:l,routeInfo:p,stops:s}}_writeDirectionLines(){return a(this.directionLines)||!this.directionLines.length?null:{featureSet:{features:this.directionLines.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionLines.toJSON()}},fields:D.fields,geometryType:"esriGeometryPolyline",name:"DirectionLines",title:"Direction Lines"},popupInfo:D.popupInfo}}_writeDirectionPoints(){return a(this.directionPoints)||!this.directionPoints.length?null:{featureSet:{features:this.directionPoints.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionPoints.toJSON()}},fields:O.fields,geometryType:"esriGeometryPoint",name:"DirectionPoints",title:"Direction Points"},popupInfo:O.popupInfo}}_writePointBarriers(){return a(this.pointBarriers)||!this.pointBarriers.length?null:{featureSet:{features:this.pointBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.pointBarriers.toJSON()}},fields:C.fields,geometryType:"esriGeometryPoint",name:"Barrier",title:"Point Barrier"},popupInfo:C.popupInfo}}_writePolygonBarriers(){return a(this.polygonBarriers)||!this.polygonBarriers.length?null:{featureSet:{features:this.polygonBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolygon"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polygonBarriers.toJSON()}},fields:_.fields,geometryType:"esriGeometryPolygon",name:"PolygonBarriers",title:"Polygon Barriers"},popupInfo:_.popupInfo}}_writePolylineBarriers(){return a(this.polylineBarriers)||!this.polylineBarriers.length?null:{featureSet:{features:this.polylineBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polylineBarriers.toJSON()}},fields:T.fields,geometryType:"esriGeometryPolyline",name:"PolylineBarriers",title:"Line Barriers"},popupInfo:T.popupInfo}}_writeRouteInfo(){return a(this.routeInfo)?null:{featureSet:{features:[this.routeInfo.toPortalJSON()],geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.routeInfo.toJSON()}},fields:J.fields,geometryType:"esriGeometryPolyline",name:"RouteInfo",title:"Route Details"},popupInfo:J.popupInfo}}_writeStops(){return a(this.stops)||!this.stops.length?null:{featureSet:{features:this.stops.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"uniqueValue",field1:"Sequence",defaultSymbol:this.defaultSymbols.middleStop.toJSON(),uniqueValueInfos:[{value:"1",symbol:this.defaultSymbols.firstStop.toJSON(),label:"First Stop"},{value:`${this.stops.length}`,symbol:this.defaultSymbols.lastStop.toJSON(),label:"Last Stop"}]}},fields:F.fields,geometryType:"esriGeometryPoint",name:"Stops",title:"Stops"},popupInfo:F.popupInfo}}};e([m({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],X.prototype,"_featureCollection",void 0),e([d("web-map","_featureCollection")],X.prototype,"writeFeatureCollectionWebmap",null),e([m({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],X.prototype,"_type",void 0),e([m({nonNullable:!0,type:P})],X.prototype,"defaultSymbols",void 0),e([m({readOnly:!0})],X.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],X.prototype,"readDirectionLines",null),e([m({readOnly:!0})],X.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],X.prototype,"readDirectionPoints",null),e([m({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],X.prototype,"featureCollectionType",void 0),e([m({readOnly:!0})],X.prototype,"fullExtent",null),e([m({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],X.prototype,"legendEnabled",void 0),e([m({type:["show","hide"]})],X.prototype,"listMode",void 0),e([m({type:Number,nonNullable:!0,json:{write:!1}})],X.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],X.prototype,"readMaxScale",null),e([m({type:Number,nonNullable:!0,json:{write:!1}})],X.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],X.prototype,"readMinScale",null),e([m({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],X.prototype,"operationalLayerType",void 0),e([m({nonNullable:!0,type:s.ofType(C)})],X.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],X.prototype,"readPointBarriers",null),e([m({nonNullable:!0,type:s.ofType(_)})],X.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],X.prototype,"readPolygonBarriers",null),e([m({nonNullable:!0,type:s.ofType(T)})],X.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],X.prototype,"readPolylineBarriers",null),e([m({readOnly:!0})],X.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],X.prototype,"readRouteInfo",null),e([m({nonNullable:!0})],X.prototype,"routeServiceUrl",null),e([m({type:k})],X.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],X.prototype,"readSpatialReference",null),e([m({nonNullable:!0,type:s.ofType(F)})],X.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],X.prototype,"readStops",null),e([m()],X.prototype,"title",void 0),e([m({readOnly:!0,json:{read:!1}})],X.prototype,"type",void 0),X=e([c("esri.layers.RouteLayer")],X);const Y=X;export{Y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import"../geometry.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import{read as i}from"../renderers/support/jsonUtils.js";import s from"../core/Collection.js";import n from"../core/Error.js";import{isSome as l,isNone as a}from"../core/maybe.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{convertUnit as y}from"../core/unitUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{reader as f}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";import h from"../geometry/Extent.js";import{WGS84 as S}from"../geometry/support/spatialReferenceUtils.js";import g from"./Layer.js";import{BlendLayer as b}from"./mixins/BlendLayer.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as B}from"./mixins/ScaleRangeLayer.js";import P from"./support/DefaultSymbols.js";import{fetchServiceDescription as N}from"../rest/networkService.js";import{solve as I}from"../rest/route.js";import D from"../rest/support/DirectionLine.js";import O from"../rest/support/DirectionPoint.js";import{directionsTimeUnitJsonMap as j,directionsLengthUnitJsonMap as L}from"../rest/support/networkEnums.js";import _ from"../rest/support/PointBarrier.js";import C from"../rest/support/PolygonBarrier.js";import T from"../rest/support/PolylineBarrier.js";import J from"../rest/support/RouteInfo.js";import R from"../rest/support/RouteParameters.js";import x from"../rest/support/RouteSettings.js";import A from"../rest/support/Stop.js";import F from"../geometry/SpatialReference.js";import k from"../geometry/Multipoint.js";function G(e){return e.length?e:null}function U(e){return"layers"in e}function M(e){return"esri.rest.support.FeatureSet"===e.declaredClass}function W(e){return"esri.rest.support.NetworkFeatureSet"===e.declaredClass}function E(e,t,r){var o,i,s,a,p,u,y,m,f,c,d;const h=t.networkDataset.networkAttributes.filter((e=>"esriNAUTCost"===e.usageType)),S=t.supportedTravelModes.find((e=>e.id===t.defaultTravelMode)),g=null!=(o=r.travelMode)?o:S,{timeAttributeName:b,distanceAttributeName:w}=g,v=h.find((e=>e.name===b)),B=h.find((e=>e.name===w)),P=null!=(i=null!=(s=null==(a=r.travelMode)?void 0:a.impedanceAttributeName)?s:r.impedanceAttribute)?i:t.impedance,N=j.fromJSON(null==v?void 0:v.units),I=L.fromJSON(null==B?void 0:B.units);if(!N||!I)throw new n("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const D=null!=(p=r.directionsLanguage)?p:t.directionsLanguage,O=null!=(u=null!=(y=r.accumulateAttributes)?y:t.accumulateAttributeNames)?u:[],_=new Set(h.filter((({name:e})=>e===b||e===w||e===P||O.includes(e))).map((({name:e})=>e))),C=e=>{for(const t in e)_.has(t)||delete e[t]};for(const n of e.pointBarriers){var T;if(l(n.costs))n.addedCost=null!=(T=n.costs[P])?T:0,C(n.costs)}for(const n of e.polygonBarriers){var J;if(l(n.costs))n.scaleFactor=null!=(J=n.costs[P])?J:1,C(n.costs)}for(const n of e.polylineBarriers){var R;if(l(n.costs))n.scaleFactor=null!=(R=n.costs[P])?R:1,C(n.costs)}const{routeInfo:A}=e,{findBestSequence:F,preserveFirstStop:k,preserveLastStop:G,startTimeIsUTC:U,timeWindowsAreUTC:M}=r;A.analysisSettings=new x({accumulateAttributes:O,directionsLanguage:D,findBestSequence:F,preserveFirstStop:k,preserveLastStop:G,startTimeIsUTC:U,timeWindowsAreUTC:M,travelMode:g}),A.totalDuration=q(null!=(m=A.totalCosts[b])?m:0,N),A.totalDistance=V(null!=(f=A.totalCosts[w])?f:0,I),A.totalLateDuration=q(null!=(c=A.totalViolations[b])?c:0,N),A.totalWaitDuration=q(null!=(d=A.totalWait[b])?d:0,N),l(A.totalCosts)&&C(A.totalCosts),l(A.totalViolations)&&C(A.totalViolations),l(A.totalWait)&&C(A.totalWait);for(const n of e.stops){var W,E,H,K,Q,Z;if(l(n.serviceCosts))n.serviceDuration=q(null!=(W=n.serviceCosts[b])?W:0,N),n.serviceDistance=V(null!=(E=n.serviceCosts[w])?E:0,I),C(n.serviceCosts);if(l(n.cumulativeCosts))n.cumulativeDuration=q(null!=(H=n.cumulativeCosts[b])?H:0,N),n.cumulativeDistance=V(null!=(K=n.cumulativeCosts[w])?K:0,I),C(n.cumulativeCosts);if(l(n.violations))n.lateDuration=q(null!=(Q=n.violations[b])?Q:0,N),C(n.violations);if(l(n.wait))n.waitDuration=q(null!=(Z=n.wait[b])?Z:0,N),C(n.wait)}}function q(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function V(e,t){return"decimal-degrees"===t||"points"===t?e:y(e,t,"meters")}const H=s.ofType(D),K=s.ofType(O),Q=s.ofType(_),Z=s.ofType(C),$=s.ofType(T),z=s.ofType(A);let X=class extends(b(B(w(v(p(g)))))){constructor(...e){super(...e),this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new P,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new Q,this.polygonBarriers=new Z,this.polylineBarriers=new $,this.routeInfo=null,this.spatialReference=F.WGS84,this.stops=new z,this.title="Route",this.type="route"}writeFeatureCollectionWebmap(e,t){const r=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter((e=>!!e)),o=r.map(((e,t)=>t));u("featureCollection.layers",r,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=o}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",(e=>D.fromPortalJSON(e)))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",(e=>O.fromPortalJSON(e)))}get fullExtent(){if(l(this.routeInfo)&&l(this.routeInfo.geometry))return this.routeInfo.geometry.extent;if(this.stops.length>1){const{spatialReference:e}=this.stops[0],t=new k({spatialReference:e}),r=this.stops.toArray().map((e=>e.geometry));for(const o of r)l(o)&&t.addPoint(o);return t.extent}return new h({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:F.WGS84})}readMaxScale(e,t){var r;const o=(U(t)?t.layers:t.featureCollection.layers).find((e=>l(e.layerDefinition.maxScale)));return null!=(r=null==o?void 0:o.layerDefinition.maxScale)?r:0}readMinScale(e,t){var r;const o=(U(t)?t.layers:t.featureCollection.layers).find((e=>l(e.layerDefinition.minScale)));return null!=(r=null==o?void 0:o.layerDefinition.minScale)?r:0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",(e=>_.fromPortalJSON(e)))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",(e=>C.fromPortalJSON(e)))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",(e=>T.fromPortalJSON(e)))}readRouteInfo(e,t){const r=this._getNetworkFeatures(t,"RouteInfo",(e=>J.fromPortalJSON(e)));return r.length>0?r.getItemAt(0):null}get routeServiceUrl(){var e,r,o,i;return null!=(e=this.portalItem)&&e.id&&null!=(r=null==(o=this.portalItem.portal.helperServices)||null==(i=o.route)?void 0:i.url)?r:t.routeServiceUrl}readSpatialReference(e,t){var r,o;const i=U(t)?t.layers:t.featureCollection.layers;if(!i.length)return F.WGS84;const{layerDefinition:s}=i[0],n=null!=(r=null!=(o=s.spatialReference)?o:s.extent.spatialReference)?r:S;return F.fromJSON(n)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",(e=>A.fromPortalJSON(e)),(e=>this._setStopSymbol(e)))}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){l(this.directionLines)&&(this.directionLines.removeAll(),this._set("directionLines",null)),l(this.directionPoints)&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),l(this.routeInfo)&&this._set("routeInfo",null),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}async solve(e,t){var r,o,i,l;const p=null!=(r=null==e?void 0:e.stops)?r:this.stops,u=null!=(o=null==e?void 0:e.pointBarriers)?o:G(this.pointBarriers),y=null!=(i=null==e?void 0:e.polylineBarriers)?i:G(this.polylineBarriers),m=null!=(l=null==e?void 0:e.polygonBarriers)?l:G(this.polygonBarriers);if(a(p))throw new n("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((M(p)||W(p))&&p.features.length<2||s.isCollection(p)&&p.length<2)throw new n("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");const f=await N(this.routeServiceUrl,null==e?void 0:e.apiKey,t),c={startTime:new Date},d={directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:u,polylineBarriers:y,polygonBarriers:m,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!u,returnDirections:!0,returnPolygonBarriers:!!m,returnPolylineBarriers:!!y,returnRoutes:!0,returnStops:!0,stops:p},h=e?R.from(e):new R;for(const s in c)null==h[s]&&(h[s]=c[s]);h.set(d);const S=await I(this.routeServiceUrl,h,t),g=this._toRouteLayerSolution(S);return E(g,f,h),g}update(e){const{stops:t,directionLines:r,directionPoints:o,pointBarriers:i,polylineBarriers:s,polygonBarriers:n,routeInfo:l}=e;this.set({stops:t,pointBarriers:i,polylineBarriers:s,polygonBarriers:n}),this._set("directionLines",r),this._set("directionPoints",o),this._set("routeInfo",l)}_getLayerDefinition(){return{capabilities:"Query,Update,Editing",extent:this.fullExtent.toJSON(),hasM:!1,hasZ:!1,maxScale:this.maxScale,minScale:this.minScale,objectIdField:"__OBJECTID",spatialReference:this.spatialReference.toJSON(),type:"Feature Layer",typeIdField:""}}_getNetworkFeatures(e,t,n,l){const p=(U(e)?e.layers:e.featureCollection.layers).find((e=>e.layerDefinition.name===t));if(a(p))return new s;const{layerDefinition:u,popupInfo:y,featureSet:m}=p,f=u.drawingInfo.renderer,{features:c}=m,d=f&&i(f),h=c.map((e=>{var i;const s=n(e),{attributes:l}=e,a=new r({attributes:l});return null!=s.symbol||(s.symbol=null!=(i=null==d?void 0:d.getSymbol(a))?i:this._getNetworkSymbol(t)),null!=s.popupTemplate||(s.popupTemplate=y&&o.fromJSON(y)),s}));return l&&h.some((e=>!e.symbol))&&l(h),new s(h)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}_setStopSymbol(e){if(!e)return;if(e.length<2){for(const t of e)t.symbol=this.defaultSymbols.invalidStop;return}const t=e.map((e=>e.sequence)).filter((e=>l(e))),r=Math.min(...t),o=Math.max(...t);for(const i of e)i.sequence!==r?i.sequence!==o?"ok"===i.status||"not-located-on-closest"===i.status?"waypoint"!==i.locationType?"break"!==i.locationType?i.symbol=this.defaultSymbols.middleStop:i.symbol=this.defaultSymbols.breakStop:i.symbol=this.defaultSymbols.waypointStop:i.symbol=this.defaultSymbols.invalidStop:i.symbol=this.defaultSymbols.lastStop:i.symbol=this.defaultSymbols.firstStop}_toRouteLayerSolution(e){var t,r,o;const i=e.routeResults[0].stops.map((e=>A.fromJSON(e.toJSON())));this._setStopSymbol(i);const s=new z(i),n=new Z(null==(t=e.polygonBarriers)?void 0:t.map((e=>{const t=C.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polygonBarriers,t}))),l=new $(null==(r=e.polylineBarriers)?void 0:r.map((e=>{const t=T.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.polylineBarriers,t}))),a=new Q(null==(o=e.pointBarriers)?void 0:o.map((e=>{const t=_.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.pointBarriers,t}))),p=J.fromJSON(e.routeResults[0].route.toJSON());p.symbol=this.defaultSymbols.routeInfo;const u=new K(e.routeResults[0].directionPoints.features.map((e=>{const t=O.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionPoints,t})));return{directionLines:new H(e.routeResults[0].directionLines.features.map((e=>{const t=D.fromJSON(e.toJSON());return t.symbol=this.defaultSymbols.directionLines,t}))),directionPoints:u,pointBarriers:a,polygonBarriers:n,polylineBarriers:l,routeInfo:p,stops:s}}_writeDirectionLines(){return a(this.directionLines)||!this.directionLines.length?null:{featureSet:{features:this.directionLines.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionLines.toJSON()}},fields:D.fields,geometryType:"esriGeometryPolyline",name:"DirectionLines",title:"Direction Lines"},popupInfo:D.popupInfo}}_writeDirectionPoints(){return a(this.directionPoints)||!this.directionPoints.length?null:{featureSet:{features:this.directionPoints.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.directionPoints.toJSON()}},fields:O.fields,geometryType:"esriGeometryPoint",name:"DirectionPoints",title:"Direction Points"},popupInfo:O.popupInfo}}_writePointBarriers(){return a(this.pointBarriers)||!this.pointBarriers.length?null:{featureSet:{features:this.pointBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.pointBarriers.toJSON()}},fields:_.fields,geometryType:"esriGeometryPoint",name:"Barrier",title:"Point Barrier"},popupInfo:_.popupInfo}}_writePolygonBarriers(){return a(this.polygonBarriers)||!this.polygonBarriers.length?null:{featureSet:{features:this.polygonBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolygon"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polygonBarriers.toJSON()}},fields:C.fields,geometryType:"esriGeometryPolygon",name:"PolygonBarriers",title:"Polygon Barriers"},popupInfo:C.popupInfo}}_writePolylineBarriers(){return a(this.polylineBarriers)||!this.polylineBarriers.length?null:{featureSet:{features:this.polylineBarriers.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.polylineBarriers.toJSON()}},fields:T.fields,geometryType:"esriGeometryPolyline",name:"PolylineBarriers",title:"Line Barriers"},popupInfo:T.popupInfo}}_writeRouteInfo(){return a(this.routeInfo)?null:{featureSet:{features:[this.routeInfo.toPortalJSON()],geometryType:"esriGeometryPolyline"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"simple",symbol:this.defaultSymbols.routeInfo.toJSON()}},fields:J.fields,geometryType:"esriGeometryPolyline",name:"RouteInfo",title:"Route Details"},popupInfo:J.popupInfo}}_writeStops(){return a(this.stops)||!this.stops.length?null:{featureSet:{features:this.stops.toArray().map((e=>e.toPortalJSON())),geometryType:"esriGeometryPoint"},layerDefinition:{...this._getLayerDefinition(),drawingInfo:{renderer:{type:"uniqueValue",field1:"Sequence",defaultSymbol:this.defaultSymbols.middleStop.toJSON(),uniqueValueInfos:[{value:"1",symbol:this.defaultSymbols.firstStop.toJSON(),label:"First Stop"},{value:`${this.stops.length}`,symbol:this.defaultSymbols.lastStop.toJSON(),label:"Last Stop"}]}},fields:A.fields,geometryType:"esriGeometryPoint",name:"Stops",title:"Stops"},popupInfo:A.popupInfo}}};e([m({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:null==this.portalItem}}}}}}})],X.prototype,"_featureCollection",void 0),e([d("web-map","_featureCollection")],X.prototype,"writeFeatureCollectionWebmap",null),e([m({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:null!=this.portalItem}}}}}}})],X.prototype,"_type",void 0),e([m({nonNullable:!0,type:P})],X.prototype,"defaultSymbols",void 0),e([m({readOnly:!0})],X.prototype,"directionLines",void 0),e([f(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],X.prototype,"readDirectionLines",null),e([m({readOnly:!0})],X.prototype,"directionPoints",void 0),e([f(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],X.prototype,"readDirectionPoints",null),e([m({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],X.prototype,"featureCollectionType",void 0),e([m({readOnly:!0})],X.prototype,"fullExtent",null),e([m({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],X.prototype,"legendEnabled",void 0),e([m({type:["show","hide"]})],X.prototype,"listMode",void 0),e([m({type:Number,nonNullable:!0,json:{write:!1}})],X.prototype,"maxScale",void 0),e([f(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],X.prototype,"readMaxScale",null),e([m({type:Number,nonNullable:!0,json:{write:!1}})],X.prototype,"minScale",void 0),e([f(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],X.prototype,"readMinScale",null),e([m({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],X.prototype,"operationalLayerType",void 0),e([m({nonNullable:!0,type:s.ofType(_)})],X.prototype,"pointBarriers",void 0),e([f(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],X.prototype,"readPointBarriers",null),e([m({nonNullable:!0,type:s.ofType(C)})],X.prototype,"polygonBarriers",void 0),e([f(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],X.prototype,"readPolygonBarriers",null),e([m({nonNullable:!0,type:s.ofType(T)})],X.prototype,"polylineBarriers",void 0),e([f(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],X.prototype,"readPolylineBarriers",null),e([m({readOnly:!0})],X.prototype,"routeInfo",void 0),e([f(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],X.prototype,"readRouteInfo",null),e([m({nonNullable:!0})],X.prototype,"routeServiceUrl",null),e([m({type:F})],X.prototype,"spatialReference",void 0),e([f(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],X.prototype,"readSpatialReference",null),e([m({nonNullable:!0,type:s.ofType(A)})],X.prototype,"stops",void 0),e([f(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],X.prototype,"readStops",null),e([m()],X.prototype,"title",void 0),e([m({readOnly:!0,json:{read:!1}})],X.prototype,"type",void 0),X=e([c("esri.layers.RouteLayer")],X);const Y=X;export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import s from"../../../core/has.js";import a from"../../../core/Logger.js";import{isSome as r,isNone as d}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{EsriPromiseMixin as n}from"../../../core/Promise.js";import{isAbortError as h}from"../../../core/promiseUtils.js";import{init as l}from"../../../core/watchUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection.js";import{create as p,intersectsSphere as g}from"../../../geometry/support/aaBoundingRect.js";import{makeDehydratedPoint as m}from"../dehydratedFeatures.js";import{PromiseQueue as y}from"../../support/PromiseQueue.js";import{addTask as x}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as f}from"../../../views/3d/layers/i3s/I3SIndex.js";import b from"../../../views/3d/layers/i3s/I3SLodHandling.js";import{NodeState as w,CacheState as N}from"../../../views/3d/layers/i3s/I3SNode.js";import v from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as C}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as D,getIndexCrs as L,findIntersectingNodes as S}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{FadeDirection as I}from"../../../views/3d/layers/support/I3SLayerView.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{ClientType as U,maxDownloadSlots as F}from"../../../views/3d/support/index.js";import{extractSafeScaleBounds as P,scaleBoundsPredicate as O}from"../../../views/support/layerViewUtils.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const q=a.getLogger("esri.layers.graphics.controllers.I3SOnDemandController"),G=100,j=2,Q=1e4,T=1e-4,E=1.2,B=500,H=1.5;let k=class extends(n(t)){constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new o({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new o,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new i,this._idleQueue=new y,this._elevationUpdateNodes=new o({deallocator:null}),this._errorCount=0}get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store.lodType}get isGraphics3D(){return"points"===this.layer.profile}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(U.I3S_INDEX);return new C(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(U.I3S_DATA);return new C(e,this.layer.apiKey)}get crsVertex(){return D(this.layer)}get crsIndex(){return L(this.layer)}get rootNodeVisible(){if(r(this._index)){const e=this._index.rootNode;if(r(e))return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}initialize(){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData,this._lodHandling=new b(this.layerView);const e=this.layerView.i3slayer;this.layer=e,this._defaultGeometrySchema=e.store.defaultGeometrySchema,this.disableIDBCache=s("disable-feature:idb-cache"),"fields"in e&&(this._fields=e.fields,this._attributeStorageInfo=e.attributeStorageInfo),this.addResolvingPromise(Promise.all([this.layer.indexInfo,this.layer.when(),this.layerView.when()]).then((([t])=>{var i;if(this.destroyed||!this.layerView||this.layerView.destroyed)return;const s=this.layerView.view;this._setClippingArea(s.clippingArea);const a=this.layerView.view.resourceController;this._handles.add([l(s,"pointsOfInterest.focus.renderLocation",(e=>this._pointOfInterestChanged(e))),a.memoryController.events.on("quality-changed",(()=>this._setCameraDirty())),l(this.layerView,"suspended",(e=>{const t=e?()=>this._updateViewData():()=>this._updateIdleState(!0),i=e?()=>{}:()=>this._updateIdleState(!1);this._idleStateCallbacks?(e&&this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=a.scheduler.registerIdleStateCallbacks(t,i)})),x(this.layerView.view.resourceController.scheduler,{update:(e,t)=>this._frame(e,t),needsUpdate:()=>this.updating}),this.watch("uncompressedTextureDownsamplingEnabled",(()=>this.restartNodeLoading())),this.watch(["featureTarget","fixedFeatureTarget"],(()=>{this._setCameraDirty(),this._stableFeatureLOD=!1})),s.state.watch("contentCamera",(()=>this._setCameraDirty())),this.layer.watch("elevationInfo",(()=>this._elevationInfoChanged())),this.layer.watch("effectiveScaleRange",(()=>this._scaleBoundsChanged())),this.layerView.watch("lodFactor",(()=>this._setCameraDirty())),this.layerView.watch("availableFields?",(()=>this._requiredFieldsChange())),this.layerView.watch("holeFilling",(e=>r(this._index)&&(this._index.holeFilling=e)))]),this._updateScaleHandles(),this._viewportQueries=new V(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,s.elevationProvider,this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this.lod,angleDependentLoD:this.lod<.5}),this._index=new f(e,t,this.indexStreamController,this._viewportQueries,q,this.layerView.holeFilling,(e=>this.layerView.isNodeLoaded(e)),(e=>this.layerView.isNodeReloading(e)),(e=>this._shouldLoadNode(e)),(e=>this._enableFromGPUCache(e,w.Leaf)),(e=>this._needsUpdate(e)),(()=>!this.indexStreamController.busy),(e=>this.layerView.computeVisibilityObb?this.layerView.computeVisibilityObb(e):null),null!=(i=this.layerView)&&i.computeNodeFiltering?e=>this.layerView.computeNodeFiltering(e):void 0),this._index.imModificationsChanged(!!this.layerView.hasModifications),this._startNodeLoading()}))),this._tmpPoint=m(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;r(t)&&i&&i.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll((e=>{const i=t.getNode(e);r(i)&&this._modificationsNodeFilteringArray.push(i)})),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,R.prune(),r(z)&&(z.hide(),z=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map((i=>{const s=X(e,i),a=X(t,i);return s>=0&&a>=0?{index:s,name:t[a].name,field:t[a],attributeStorageInfo:e[s]}:null})).filter((e=>null!=e&&e.name!==i))}_requiredFieldsChange(){const e=this._getRequiredAttributes();K(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=p();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){r(this._viewportQueries)&&(this._viewportQueries.setPointOfInterest(e),r(this._index)&&(this._index.progressiveLoadPenalty=$.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),r(this._viewportQueries)&&r(this._index)&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this.notifyChange("rootNodeVisible"),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateElevationChanged(e,t){const i=this._index;if(d(i))return;const s=i.rootNode;if(d(s))return;const a=this._elevationUpdateNodes;a.clear(),S(e,t,s,this.crsIndex,i,(e=>a.push(e.index))),a.forAll((e=>{i.invalidateBoundingVolumeCache(e),e===s.index&&this.notifyChange("rootNodeVisible")})),a.length&&this.restartNodeLoading()}getParentIndex(e){return r(this._index)&&this._index.getParentIndex(e)}_elevationInfoChanged(){r(this._index)&&this._index.updateElevationInfo(this.layer.elevationInfo),this._setCameraDirty()}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this.areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),e)}_scaleBoundsChanged(){this.areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(d(i))return;const s=i.rootNode;!d(s)&&_(e,t,J,this.crsIndex)&&this._loadedNodeScales.forEach(((e,t)=>{const s=i.getNode(t);r(s)&&g(J,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))}))}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get areScaleBoundsActive(){const{minScale:e,maxScale:t}=P(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return d(this._index)||this.layerView.suspended?0:this._index.getUnloadedMemoryEstimate()*this.lodDropFactor}get indexDepth(){return r(this._index)?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}_frame(e,t){return this.layerView.suspended?(this._updateViewData(),this._evaluateUpdating(),-1/0):!this.layerView.visible||d(this._index)?-1/0:(this._processLogError(e,t),this._index.getPriority())}_processLogError(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?q.error("Error during processing: "+i):50===this._errorCount&&q.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null==this._nodeLoader||d(this._index)||(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this.isIntegratedMesh&&(e.enabled=!1),e.run((()=>this._processIndex(e))),this._updateFeatureLOD(),e.run((()=>this._processCache(e))),this.isIntegratedMesh&&(e.enabled=!0),e.run((()=>this._processNodes(e,t))),this._idleQueue.runTask(e),e.run((()=>this._prefetchIndex())),t.numIndexLoading+=this._index.getIndexLoading(),t.numNodesLoading+=this._downloadingCount,e.run((()=>this._lodHandling.lodGlobalHandling(e))),this._evaluateUpdating())}_processIndex(e){if(d(this._index))return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update([...this._loadingNodes.keys()],e,(e=>this.updateNodeModificationStatus(e))),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading()||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(d(this._index)||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.isGraphics3D||d(this._index)||d(this._viewportQueries))return;const e=!this._index.isLoading(),t=this.featureTarget*this.baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.getIndexMissing()>B){if(this._featureLOD<=T)return;this._featureLOD/=H,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=Q||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this.lod,a=this._index.checkFeatureTarget(t,s);a!==s&&(this._featureLOD=a/this.baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*E||e&&i.estimate>t))return;if(this._featureLOD<=T)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(Q,Math.max(T,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(d(t))return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);r(s)&&(!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s));s=t.getParent(s.index))if(this._enableFromGPUCache(s,w.Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(d(this._index))return!1;let i=(this._isIdle?G:j)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());r(t)&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const a=this._index.getNode(s.add.back());if(d(a)||a.cacheState!==N.Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(a),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach((e=>e.abort())),this._loadingNodes.clear(),this._updatingNodes.forEach((e=>e.abort())),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=j)&&(this._downloadingCount<F&&!this.dataStreamController.busy)}_evaluateUpdating(){let e=!1,t=0;if(this.layerView.suspended)e=this._cameraDirty,t=e?0:1;else{const i=(r(this._index)?this._index.getIndexMissing():0)+3*(r(this._index)?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}this.updating=e,this.updatingProgress=t}_updateViewData(){if(!this._cameraDirty||d(this._index)||d(this._viewportQueries))return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=$.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get lod(){return this._featureLOD*this.baseLOD}get baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return r(this._index)&&this._index.isGeometryVisible(e.index)}updateVisibility(e){r(this._index)&&this._index.invalidateNodeVisibilityCache(e)}updateBoundingVolume(e){r(this._index)&&this._index.invalidateBoundingVolumeCache(e)}invalidateGeometryVisibility(e){r(this._index)&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){r(this._index)&&this._index.invalidateVisibilityObbs()}modificationsChanged(){r(this._index)&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&(!(!r(this._index)||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e))}_shouldDropNode(e){if(d(this._viewportQueries))return!1;const t=this.lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||d(e)||d(this._viewportQueries))return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:!this.isMeshPyramid};this._nodeLoader=new v(this.layer,this.dataStreamController,q,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e=>this._isNodeInScaleBounds(e)),((e,t)=>this._removeNodes(e,t,W.fadeout)),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(d(t)||d(this._viewportQueries))return!1;R.clear(),this.layerView.getLoadedNodeIndices(R);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return R.filterInPlace((e=>{const i=t.getNode(e);return d(i)||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)})),R.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(R,e,W.pop),!(i&&this.lodDropFactor<1)&&(0===R.length||(R.clear(),!1))}markNodeToRemove(e){R.push(e)}removeMarkedNodes(){this._removeNodes(R,M,W.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(r(this._index)&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),a=this._index;i===W.fadeout&&this.layerView.nodeFadeoutEnabled&&r(a)&&a.isGeometryVisible(s)?this.layerView.fadeNode(s,I.FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<s;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(!e.resources.hasFeatureData||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}_updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t);(K(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?Promise.resolve(this.layerView.getAttributeData(e.index)):this._nodeLoader.loadAttributes(e,this._requiredAttributes,t.signal)).then((i=>this.schedule((()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:i},t.signal)),t.signal))).catch((i=>{if(!h(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)})).catch((()=>{})).then((()=>{this._updatingNodes.delete(e.index),this._evaluateUpdating()})),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void q.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then((i=>{i&&r(this._index)&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())})).catch((e=>{if(!h(e))throw e})).finally((()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()}))}_loadAndAddNode(e,t){return e.cacheState===N.Uncached?this._loadUncached(e,t).then((()=>!1)):this._loadCached(e,t).then((t=>!t&&(e.cacheState=N.Uncached,!0))).catch((t=>!h(t)&&(e.cacheState=N.Uncached,!0)))}_enableFromGPUCache(e,t){if(this._disableMemCache||d(this._index))return!1;if(t===w.Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e);return r(t)&&r(t.attributeInfo)&&K(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){r(this._index)&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_loadCached(e,t){if(this._enableFromGPUCache(e,w.Leaf))return Promise.resolve(!0);const i=this.layerView;return!this.disableIDBCache&&i.loadCachedNodeData&&i.addCachedNodeData?this.schedule((()=>i.loadCachedNodeData(e,t,((t,i)=>this._nodeLoader.loadTextures(e,t,i)))),t).then((s=>{if(d(s))return!1;const a=this._requiredAttributes;return this.reschedule((()=>this._nodeLoader.loadAttributes(e,a,t)),t).then((r=>this.reschedule((()=>i.addCachedNodeData(e,s,{loadedAttributes:a,attributeData:r},t)),t))).then((()=>(this._nodeAdded(),!0)))})):Promise.resolve(!1)}_loadUncached(e,t){return this._downloadingCount++,this._nodeLoader.loadNodeData(e,t).catch((e=>{throw this._downloadingCount--,e})).then((i=>(this._downloadingCount--,this.schedule((()=>this.layerView.addNode(e,i,t)),t)))).then((()=>{this._nodeAdded(),e.cacheState=N.Cached})).catch((t=>{if(!h(t))throw q.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,r(this._index)&&this._index.requestUpdate(),t}))}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&r(this._index)&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this.areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=P(this.layer);return O(t,i,s)}updateStats(e){e.index=r(this._index)?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this.baseLOD),r(this._index)&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){r(e._index)&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),r(this._index)&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;r(t)&&t.layerFilterChanged(e),this.requestUpdate()}};e([u({readOnly:!0})],k.prototype,"isMeshPyramid",null),e([u({readOnly:!0})],k.prototype,"isGraphics3D",null),e([u({readOnly:!0})],k.prototype,"indexStreamController",null),e([u({readOnly:!0})],k.prototype,"dataStreamController",null),e([u({readOnly:!0})],k.prototype,"crsVertex",null),e([u({readOnly:!0})],k.prototype,"crsIndex",null),e([u()],k.prototype,"screenSizeFactor",void 0),e([u()],k.prototype,"featureTarget",void 0),e([u()],k.prototype,"fixedFeatureTarget",void 0),e([u()],k.prototype,"layerView",void 0),e([u()],k.prototype,"layer",void 0),e([u({})],k.prototype,"updating",void 0),e([u({})],k.prototype,"updatingProgress",void 0),e([u({readOnly:!0})],k.prototype,"leavesReached",void 0),e([u({constructOnly:!0})],k.prototype,"scaleVisibilityEnabled",void 0),e([u({readOnly:!0,dependsOn:[]})],k.prototype,"rootNodeVisible",null),k=e([c("esri.layers.graphics.controllers.I3SOnDemandController")],k);const R=new o({deallocator:null});let z;function K(e,t){return r(e)&&e.length===t.length&&e.every((e=>X(t,e.name)>=0))}function X(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const $={factorIM:.2,factor3dObject:.05,distancePenalty:10},J=p();var W;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(W||(W={}));const Y=k;export{Y as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import i from"../../../core/Handles.js";import s from"../../../core/has.js";import a from"../../../core/Logger.js";import{isSome as r,isNone as d}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{EsriPromiseMixin as n}from"../../../core/Promise.js";import{isAbortError as h}from"../../../core/promiseUtils.js";import{init as l}from"../../../core/watchUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as _}from"../../../geometry/projection.js";import{create as p,intersectsSphere as g}from"../../../geometry/support/aaBoundingRect.js";import{makeDehydratedPoint as m}from"../dehydratedFeatures.js";import{PromiseQueue as y}from"../../support/PromiseQueue.js";import{addTask as x}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as f}from"../../../views/3d/layers/i3s/I3SIndex.js";import b from"../../../views/3d/layers/i3s/I3SLodHandling.js";import{NodeState as w,CacheState as N}from"../../../views/3d/layers/i3s/I3SNode.js";import v from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as C}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as D,getIndexCrs as L,findIntersectingNodes as S}from"../../../views/3d/layers/i3s/I3SUtil.js";import V from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{FadeDirection as I}from"../../../views/3d/layers/support/I3SLayerView.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{ClientType as U,maxDownloadSlots as F}from"../../../views/3d/support/index.js";import{extractSafeScaleBounds as P,scaleBoundsPredicate as O}from"../../../views/support/layerViewUtils.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const q=a.getLogger("esri.layers.graphics.controllers.I3SOnDemandController"),G=100,j=2,Q=1e4,T=1e-4,E=1.2,B=500,H=1.5;let k=class extends(n(t)){constructor(e){super(e),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new o({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new o,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._handles=new i,this._idleQueue=new y,this._elevationUpdateNodes=new o({deallocator:null}),this._errorCount=0}get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store.lodType}get isGraphics3D(){return"points"===this.layer.profile}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(U.I3S_INDEX);return new C(e,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(U.I3S_DATA);return new C(e,this.layer.apiKey)}get crsVertex(){return D(this.layer)}get crsIndex(){return L(this.layer)}get rootNodeVisible(){if(r(this._index)){const e=this._index.rootNode;if(r(e))return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}initialize(){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData,this._lodHandling=new b(this.layerView);const e=this.layerView.i3slayer;this.layer=e,this._defaultGeometrySchema=e.store.defaultGeometrySchema,this.disableIDBCache=s("disable-feature:idb-cache"),"fields"in e&&(this._fields=e.fields,this._attributeStorageInfo=e.attributeStorageInfo),this.addResolvingPromise(Promise.all([this.layer.indexInfo,this.layer.when(),this.layerView.when()]).then((([t])=>{var i;if(this.destroyed||!this.layerView||this.layerView.destroyed)return;const s=this.layerView.view;this._setClippingArea(s.clippingArea);const a=this.layerView.view.resourceController;this._handles.add([l(s,"pointsOfInterest.focus.renderLocation",(e=>this._pointOfInterestChanged(e))),a.memoryController.events.on("quality-changed",(()=>this._setCameraDirty())),l(this.layerView,"suspended",(e=>{const t=e?()=>this._updateViewData():()=>this._updateIdleState(!0),i=e?()=>{}:()=>this._updateIdleState(!1);this._idleStateCallbacks?(e&&this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=t,this._idleStateCallbacks.idleEnd=i):this._idleStateCallbacks=a.scheduler.registerIdleStateCallbacks(t,i)})),x(this.layerView.view.resourceController.scheduler,{update:(e,t)=>this._frame(e,t),needsUpdate:()=>this.updating}),this.watch("uncompressedTextureDownsamplingEnabled",(()=>this.restartNodeLoading())),this.watch(["featureTarget","fixedFeatureTarget"],(()=>{this._setCameraDirty(),this._stableFeatureLOD=!1})),s.state.watch("contentCamera",(()=>this._setCameraDirty())),this.layer.watch("elevationInfo",(()=>this._elevationInfoChanged())),this.layer.watch("effectiveScaleRange",(()=>this._scaleBoundsChanged())),this.layerView.watch("lodFactor",(()=>this._setCameraDirty())),this.layerView.watch("availableFields?",(()=>this._requiredFieldsChange())),this.layerView.watch("holeFilling",(e=>r(this._index)&&(this._index.holeFilling=e)))]),this._updateScaleHandles(),this._viewportQueries=new V(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,s.elevationProvider,this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this.lod,angleDependentLoD:this.lod<.5}),this._index=new f(e,t,this.indexStreamController,this._viewportQueries,q,this.layerView.holeFilling,(e=>this.layerView.isNodeLoaded(e)),(e=>this.layerView.isNodeReloading(e)),(e=>this._shouldLoadNode(e)),(e=>this._enableFromGPUCache(e,w.Leaf)),(e=>this._needsUpdate(e)),(()=>!this.indexStreamController.busy),(e=>this.layerView.computeVisibilityObb?this.layerView.computeVisibilityObb(e):null),null!=(i=this.layerView)&&i.computeNodeFiltering?e=>this.layerView.computeNodeFiltering(e):void 0),this._index.imModificationsChanged(!!this.layerView.hasModifications),this._startNodeLoading()}))),this._tmpPoint=m(0,0,0,this.crsIndex)}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;r(t)&&i&&i.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll((e=>{const i=t.getNode(e);r(i)&&this._modificationsNodeFilteringArray.push(i)})),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._handles.destroy(),this._nodeLoader=null,R.prune(),r(z)&&(z.hide(),z=null)}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map((i=>{const s=X(e,i),a=X(t,i);return s>=0&&a>=0?{index:s,name:t[a].name,field:t[a],attributeStorageInfo:e[s]}:null})).filter((e=>null!=e&&e.name!==i))}_requiredFieldsChange(){const e=this._getRequiredAttributes();K(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=p();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){r(this._viewportQueries)&&(this._viewportQueries.setPointOfInterest(e),r(this._index)&&(this._index.progressiveLoadPenalty=$.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),r(this._viewportQueries)&&r(this._index)&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this.notifyChange("rootNodeVisible"),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateElevationChanged(e,t){const i=this._index;if(d(i))return;const s=i.rootNode;if(d(s))return;const a=this._elevationUpdateNodes;a.clear(),S(e,t,s,this.crsIndex,i,(e=>a.push(e.index))),a.forAll((e=>{i.invalidateBoundingVolumeCache(e),e===s.index&&this.notifyChange("rootNodeVisible")})),a.length&&this.restartNodeLoading()}getParentIndex(e){return r(this._index)&&this._index.getParentIndex(e)}_elevationInfoChanged(){r(this._index)&&this._index.updateElevationInfo(this.layer.elevationInfo),this._setCameraDirty()}_updateScaleHandles(){const e="scale-bounds";this._handles.remove(e),this.areScaleBoundsActive&&this._handles.add(this.layerView.view.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),e)}_scaleBoundsChanged(){this.areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(e){this._updateScaleInBoundingRect(e.extent,e.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(e,t){const i=this._index;if(d(i))return;const s=i.rootNode;!d(s)&&_(e,t,J,this.crsIndex)&&this._loadedNodeScales.forEach(((e,t)=>{const s=i.getNode(t);r(s)&&g(J,s.mbs)&&this._loadedNodeScales.set(t,this._computeScale(s))}))}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(e,t){return this._idleQueue.push(e,t)}reschedule(e,t){return this._idleQueue.unshift(e,t)}get isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get areScaleBoundsActive(){const{minScale:e,maxScale:t}=P(this.layer);return this.scaleVisibilityEnabled&&(e>0||t>0)}get unloadedMemoryEstimate(){return d(this._index)||this.layerView.suspended?0:this._index.getUnloadedMemoryEstimate()*this.lodDropFactor}get indexDepth(){return r(this._index)?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=e}_frame(e,t){return this.layerView.suspended?(this._updateViewData(),this._evaluateUpdating(),-1/0):!this.layerView.visible||d(this._index)?-1/0:(this._processLogError(e,t),this._index.getPriority())}_processLogError(e,t){try{this._process(e,t)}catch(i){this._errorCount<50?q.error("Error during processing: "+i):50===this._errorCount&&q.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null==this._nodeLoader||d(this._index)||(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this.isIntegratedMesh&&(e.enabled=!1),e.run((()=>this._processIndex(e))),this._updateFeatureLOD(),e.run((()=>this._processCache(e))),this.isIntegratedMesh&&(e.enabled=!0),e.run((()=>this._processNodes(e,t))),this._idleQueue.runTask(e),e.run((()=>this._prefetchIndex())),t.numIndexLoading+=this._index.getIndexLoading(),t.numNodesLoading+=this._downloadingCount,e.run((()=>this._lodHandling.lodGlobalHandling(e))),this._evaluateUpdating())}_processIndex(e){if(d(this._index))return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update([...this._loadingNodes.keys()],e,(e=>this.updateNodeModificationStatus(e))),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading()||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(d(this._index)||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.isGraphics3D||d(this._index)||d(this._viewportQueries)||s("enable-feature:psl-server-lod"))return;const e=!this._index.isLoading(),t=this.featureTarget*this.baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.getIndexMissing()>B){if(this._featureLOD<=T)return;this._featureLOD/=H,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=Q||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this.lod,a=this._index.checkFeatureTarget(t,s);a!==s&&(this._featureLOD=a/this.baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*E||e&&i.estimate>t))return;if(this._featureLOD<=T)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(Q,Math.max(T,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(d(t))return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);r(s)&&(!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s));s=t.getParent(s.index))if(this._enableFromGPUCache(s,w.Hole)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(d(this._index))return!1;let i=(this._isIdle?G:j)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());r(t)&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const a=this._index.getNode(s.add.back());if(d(a)||a.cacheState!==N.Cached&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(a),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach((e=>e.abort())),this._loadingNodes.clear(),this._updatingNodes.forEach((e=>e.abort())),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=j)&&(this._downloadingCount<F&&!this.dataStreamController.busy)}_evaluateUpdating(){let e=!1,t=0;if(this.layerView.suspended)e=this._cameraDirty,t=e?0:1;else{const i=(r(this._index)?this._index.getIndexMissing():0)+3*(r(this._index)?this._index.updates.add.length:0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}this.updating=e,this.updatingProgress=t}_updateViewData(){if(!this._cameraDirty||d(this._index)||d(this._viewportQueries))return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this.screenSizeFactor=1/(t.perScreenPixelRatio/2),this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this.lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=$.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.resourceController.memoryController.memoryFactor<1?1:this.layerView.progressiveLoadFactor}get lod(){return this._featureLOD*this.baseLOD}get baseLOD(){const e=this.layerView.lodFactor,t=this.layerView.view.resourceController.memoryController.memoryFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*t}get lodDropFactor(){if(this.fixedFeatureTarget)return 1;const e=this.layerView.view.resourceController.memoryController;return(Math.min(e.memoryFactor,.5)-e.minQuality)/(.5-e.minQuality)}isGeometryVisible(e){return r(this._index)&&this._index.isGeometryVisible(e.index)}updateVisibility(e){r(this._index)&&this._index.invalidateNodeVisibilityCache(e)}updateBoundingVolume(e){r(this._index)&&this._index.invalidateBoundingVolumeCache(e)}invalidateGeometryVisibility(e){r(this._index)&&this._index.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){r(this._index)&&this._index.invalidateVisibilityObbs()}modificationsChanged(){r(this._index)&&this._index.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&(!(!r(this._index)||!this._index.isGeometryVisible(e.index))&&this._isNodeInScaleBounds(e))}_shouldDropNode(e){if(d(this._viewportQueries))return!1;const t=this.lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||d(e)||d(this._viewportQueries))return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:!this.isMeshPyramid};this._nodeLoader=new v(this.layer,this.dataStreamController,q,this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e=>this._isNodeInScaleBounds(e)),((e,t)=>this._removeNodes(e,t,W.fadeout)),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(e){const t=this._index;if(d(t)||d(this._viewportQueries))return!1;R.clear(),this.layerView.getLoadedNodeIndices(R);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return R.filterInPlace((e=>{const i=t.getNode(e);return d(i)||!t.isGeometryVisible(e)||s(i)||!this._isNodeInScaleBounds(i)})),R.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(R,e,W.pop),!(i&&this.lodDropFactor<1)&&(0===R.length||(R.clear(),!1))}markNodeToRemove(e){R.push(e)}removeMarkedNodes(){this._removeNodes(R,M,W.pop)}_removeNodes(e,t,i){const s=e.length;if(0!==s&&!t.done){for(r(this._index)&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),a=this._index;i===W.fadeout&&this.layerView.nodeFadeoutEnabled&&r(a)&&a.isGeometryVisible(s)?this.layerView.fadeNode(s,I.FadeOut,!0):this.layerView.removeNode(s),t.madeProgress()}if(this._loadedNodeScales.size>0)for(let t=e.length;t<s;t++){const i=e.data[t];this._loadedNodeScales.delete(i)}}}_needsUpdate(e){if(!e.resources.hasFeatureData||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}_updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t);(K(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?Promise.resolve(this.layerView.getAttributeData(e.index)):this._nodeLoader.loadAttributes(e,this._requiredAttributes,t.signal)).then((i=>this.schedule((()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:i},t.signal)),t.signal))).catch((i=>{if(!h(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)})).catch((()=>{})).then((()=>{this._updatingNodes.delete(e.index),this._evaluateUpdating()})),this._evaluateUpdating()}_loadNode(e){if(this._loadingNodes.has(e.index))return void q.error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateUpdating(),this._loadAndAddNode(e,t.signal).then((i=>{i&&r(this._index)&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())})).catch((e=>{if(!h(e))throw e})).finally((()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateUpdating()}))}_loadAndAddNode(e,t){return e.cacheState===N.Uncached?this._loadUncached(e,t).then((()=>!1)):this._loadCached(e,t).then((t=>!t&&(e.cacheState=N.Uncached,!0))).catch((t=>!h(t)&&(e.cacheState=N.Uncached,!0)))}_enableFromGPUCache(e,t){if(this._disableMemCache||d(this._index))return!1;if(t===w.Hole&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e);return r(t)&&r(t.attributeInfo)&&K(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){r(this._index)&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_loadCached(e,t){if(this._enableFromGPUCache(e,w.Leaf))return Promise.resolve(!0);const i=this.layerView;return!this.disableIDBCache&&i.loadCachedNodeData&&i.addCachedNodeData?this.schedule((()=>i.loadCachedNodeData(e,t,((t,i)=>this._nodeLoader.loadTextures(e,t,i)))),t).then((s=>{if(d(s))return!1;const a=this._requiredAttributes;return this.reschedule((()=>this._nodeLoader.loadAttributes(e,a,t)),t).then((r=>this.reschedule((()=>i.addCachedNodeData(e,s,{loadedAttributes:a,attributeData:r},t)),t))).then((()=>(this._nodeAdded(),!0)))})):Promise.resolve(!1)}_loadUncached(e,t){return this._downloadingCount++,this._nodeLoader.loadNodeData(e,t).catch((e=>{throw this._downloadingCount--,e})).then((i=>(this._downloadingCount--,this.schedule((()=>this.layerView.addNode(e,i,t)),t)))).then((()=>{this._nodeAdded(),e.cacheState=N.Cached})).catch((t=>{if(!h(t))throw q.error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,r(this._index)&&this._index.requestUpdate(),t}))}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateUpdating(),e&&this._index&&r(this._index)&&this._index.resetFailedNodes())}_getScale(e){if(this._loadedNodeScales.has(e.index))return this._loadedNodeScales.get(e.index);const t=this._computeScale(e);return this.layerView.isNodeLoaded(e.index)&&this._loadedNodeScales.set(e.index,t),t}_computeScale(e){this._tmpPoint.x=e.mbs[0],this._tmpPoint.y=e.mbs[1],this._tmpPoint.z=e.mbs[2];const t=e.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,t)}_isNodeInScaleBounds(e){if(!this.areScaleBoundsActive)return!0;const t=this._getScale(e),{minScale:i,maxScale:s}=P(this.layer);return O(t,i,s)}updateStats(e){e.index=r(this._index)?this._index.size:0,this.isGraphics3D&&(e.detail=this._featureLOD,e.target=this.featureTarget*this.baseLOD),r(this._index)&&this._index.updateStats(e)}get test(){const e=this;return{index:this._index,set disableUpdates(t){e._updatesDisabled=t,t?e.cancelNodeLoading():e.requestUpdate()},set disableIDBCache(t){e.disableIDBCache=t},set ignoreServiceObb(t){r(e._index)&&(e._index.ignoreServiceObb=t)},shouldLoadNode:t=>e._shouldLoadNode(t)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),r(this._index)&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;r(t)&&t.layerFilterChanged(e),this.requestUpdate()}};e([u({readOnly:!0})],k.prototype,"isMeshPyramid",null),e([u({readOnly:!0})],k.prototype,"isGraphics3D",null),e([u({readOnly:!0})],k.prototype,"indexStreamController",null),e([u({readOnly:!0})],k.prototype,"dataStreamController",null),e([u({readOnly:!0})],k.prototype,"crsVertex",null),e([u({readOnly:!0})],k.prototype,"crsIndex",null),e([u()],k.prototype,"screenSizeFactor",void 0),e([u()],k.prototype,"featureTarget",void 0),e([u()],k.prototype,"fixedFeatureTarget",void 0),e([u()],k.prototype,"layerView",void 0),e([u()],k.prototype,"layer",void 0),e([u({})],k.prototype,"updating",void 0),e([u({})],k.prototype,"updatingProgress",void 0),e([u({readOnly:!0})],k.prototype,"leavesReached",void 0),e([u({constructOnly:!0})],k.prototype,"scaleVisibilityEnabled",void 0),e([u({readOnly:!0,dependsOn:[]})],k.prototype,"rootNodeVisible",null),k=e([c("esri.layers.graphics.controllers.I3SOnDemandController")],k);const R=new o({deallocator:null});let z;function K(e,t){return r(e)&&e.length===t.length&&e.every((e=>X(t,e.name)>=0))}function X(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const $={factorIM:.2,factor3dObject:.05,distancePenalty:10},J=p();var W;!function(e){e[e.pop=0]="pop",e[e.fadeout=1]="fadeout"}(W||(W={}));const Y=k;export{Y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{getCentroidOptimizedGeometry as t}from"../centroid.js";import e from"../OptimizedFeature.js";import r from"../OptimizedGeometry.js";const o={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,r)=>new e(r,t.attributes,null,t.objectId),getGeometry:t=>t.geometry,getCentroid:(e,o)=>(e.centroid||(e.centroid=t(new r,e.geometry,o.hasZ,o.hasM)),e.centroid)};export{o as default,o as optimizedFeatureQueryEngineAdapter};
5
+ import{isNone as t}from"../../../core/maybe.js";import{getCentroidOptimizedGeometry as e}from"../centroid.js";import r from"../OptimizedFeature.js";import o from"../OptimizedGeometry.js";const i={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,e)=>new r(e,t.attributes,null,t.objectId),getGeometry:t=>t.geometry,getCentroid:(r,i)=>(t(r.centroid)&&(r.centroid=e(new o,r.geometry,i.hasZ,i.hasM)),r.centroid)};export{i as default,i as optimizedFeatureQueryEngineAdapter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import t from"../../core/Logger.js";import{isNone as n,isSome as o}from"../../core/maybe.js";import{isPoint as r,isPolygon as s,isPolyline as c,isMultipoint as l}from"../../geometry/support/jsonUtils.js";import u from"./OptimizedFeature.js";import i from"./OptimizedFeatureSet.js";import f from"./OptimizedGeometry.js";function h(e,t){return e?t?4:3:t?3:2}const a=t.getLogger("esri.layers.graphics.featureConversionUtils"),g={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:3,esriGeometryMultipoint:0},d=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s},m=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s,e[n+2]=t[o+2]},y=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s,e[n+2]=t[o+3]},p=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s,e[n+2]=t[o+2],e[n+3]=t[o+3]};function I(e,t,n,o){if(e){if(n)return t&&o?p:m;if(t&&o)return y}else if(t&&o)return m;return d}function b({scale:e,translate:t},n){return Math.round((n-t[0])/e[0])}function M({scale:e,translate:t},n){return Math.round((t[1]-n)/e[1])}function w({scale:e,translate:t},n){return n*e[0]+t[0]}function N({scale:e,translate:t},n){return t[1]-n*e[1]}function G(e,t,n){return e?t?n?k(e):P(e):n?Z(e):T(e):null}function T(e){const t=e.coords;return{x:t[0],y:t[1]}}function F(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e}function P(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2]}}function x(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e}function Z(e){const t=e.coords;return{x:t[0],y:t[1],m:t[2]}}function j(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.m,e}function k(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2],m:t[3]}}function E(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e.coords[3]=t.m,e}function z(e,t,n,r){let s=T;n&&r?s=k:n?s=P:r&&(s=Z);for(const c of t){const{geometry:t,attributes:n}=c,r=o(t)?s(t):null;e.push({attributes:n,geometry:r})}return e}function v(e,t){return e&&t?E:e?x:t?j:F}function S(e,t,n,o,r){const s=v(n,o);for(const c of t){const{geometry:t,attributes:n}=c;let o;t&&(o=s(new f,t)),e.push(new u(o,n,null,n[r]))}return e}function V(e,t,n=v(null!=t.z,null!=t.m)){return n(e,t)}function Y(e,t,n,o){for(const r of t){const{geometry:t,attributes:s}=r;let c;t&&(c=_(t,n,o)),e.push({attributes:s,geometry:c})}return e}function _(e,t,o){if(n(e))return null;const r=h(t,o),s=[];for(let n=0;n<e.coords.length;n+=r){const t=[];for(let o=0;o<r;o++)t.push(e.coords[n+o]);s.push(t)}return t?o?{points:s,hasZ:t,hasM:o}:{points:s,hasZ:t}:o?{points:s,hasM:o}:{points:s}}function O(e,t,n,o,r){const s=h(n,o);for(const c of t){const t=c.geometry,n=c.attributes;let o;t&&(o=U(new f,t,s)),e.push(new u(o,n,null,n[r]))}return e}function U(e,t,n=h(t.hasZ,t.hasM)){e.lengths[0]=t.points.length;const o=e.coords;let r=0;for(const s of t.points)for(let e=0;e<n;e++)o[r++]=s[e];return e}function A(e,t,n,r){for(const s of t){const{geometry:t,attributes:c}=s;let l;o(t)&&(l=L(t,n,r)),e.push({attributes:c,geometry:l})}return e}function L(e,t,n){if(!e)return null;const o=h(t,n),{coords:r,lengths:s}=e,c=[];let l=0;for(const u of s){const e=[];for(let t=0;t<u;t++){const t=[];for(let e=0;e<o;e++)t.push(r[l++]);e.push(t)}c.push(e)}return t?n?{paths:c,hasZ:t,hasM:n}:{paths:c,hasZ:t}:n?{paths:c,hasM:n}:{paths:c}}function q(e,t,n,o,r){const s=h(n,o);for(const c of t){const t=c.geometry,n=c.attributes;let o;t&&(o=$(new f,t,s)),e.push(new u(o,n,null,n[r]))}return e}function $(e,t,n=h(t.hasZ,t.hasM)){const{lengths:o,coords:r}=e;let s=0;for(const c of t.paths){for(const e of c)for(let t=0;t<n;t++)r[s++]=e[t];o.push(c.length)}return e}function R(e,t,n,r){for(const s of t){const{geometry:t,attributes:c,centroid:l}=s;let u;if(o(t)&&(u=C(t,n,r)),l){const t=T(l);e.push({attributes:c,centroid:t,geometry:u})}else e.push({attributes:c,geometry:u})}return e}function C(e,t,n){if(!e)return null;const o=h(t,n),{coords:r,lengths:s}=e,c=[];let l=0;for(const u of s){const e=[];for(let t=0;t<u;t++){const t=[];for(let e=0;e<o;e++)t.push(r[l++]);e.push(t)}c.push(e)}return t?n?{rings:c,hasZ:t,hasM:n}:{rings:c,hasZ:t}:n?{rings:c,hasM:n}:{rings:c}}function B(e,t,n,r,s){for(const c of t){const t=c.geometry,l=c.centroid,i=c.attributes;let h;t&&(h=D(new f,t,n,r)),o(l)?e.push(new u(h,i,F(new f,l),i[s])):e.push(new u(h,i,null,i[s]))}return e}function D(e,t,n=t.hasZ,o=t.hasM){return H(e,t.rings,n,o),e}function H(e,t,n,o){const r=h(n,o),{lengths:s,coords:c}=e;let l=0;s.length=c.length=0;for(const u of t){for(const e of u)for(let t=0;t<r;t++)c[l++]=e[t];s.push(u.length)}return e}const J=[],K=[];function Q(e,t,n,o,r){J[0]=e;const[s]=W(K,J,t,n,o,r);return J.length=K.length=0,s}function W(t,n,o,r,s,c){if(t.length=0,!o){for(const e of n){const n=e.attributes[c];t.push(new u(null,e.attributes,null,n))}return t}switch(o){case"esriGeometryPoint":return S(t,n,r,s,c);case"esriGeometryMultipoint":return O(t,n,r,s,c);case"esriGeometryPolyline":return q(t,n,r,s,c);case"esriGeometryPolygon":return B(t,n,r,s,c);default:a.error("convertToFeatureSet:unknown-geometry",new e(`Unable to parse unknown geometry type '${o}'`)),t.length=0}return t}function X(t,n,o,r,s,c){const l=t.length;switch(o){case"esriGeometryPoint":S(t,n,r,s,c);break;case"esriGeometryMultipoint":O(t,n,r,s,c);break;case"esriGeometryPolyline":q(t,n,r,s,c);break;case"esriGeometryPolygon":B(t,n,r,s,c);break;default:a.error("convertToFeatureSet:unknown-geometry",new e(`Unable to parse unknown geometry type '${o}'`))}for(let e=0;e<n.length;e++)t[e+l].geometryType=o,t[e+l].insertAfter=n[e].insertAfter,t[e+l].groupId=n[e].groupId;return t}function ee(e,t,n,o){K[0]=e,re(J,K,t,n,o);const r=J[0];return J.length=K.length=0,r}function te(t,o,u){if(n(t))return null;const i=new f;if("hasZ"in t&&null==o&&(o=t.hasZ),"hasM"in t&&null==u&&(u=t.hasM),r(t)){return v(null!=o?o:null!=t.z,null!=u?u:null!=t.m)(i,t)}return s(t)?D(i,t,o,u):c(t)?$(i,t,h(o,u)):l(t)?U(i,t,h(o,u)):void a.error("convertFromGeometry:unknown-geometry",new e(`Unable to parse unknown geometry type '${t}'`))}function ne(t,o,r,s){const c=t&&("coords"in t?t:t.geometry);if(n(c))return null;switch(o){case"esriGeometryPoint":{let e=T;return r&&s?e=k:r?e=P:s&&(e=Z),e(c)}case"esriGeometryMultipoint":return _(c,r,s);case"esriGeometryPolyline":return L(c,r,s);case"esriGeometryPolygon":return C(c,r,s);default:return void a.error("convertToGeometry:unknown-geometry",new e(`Unable to parse unknown geometry type '${o}'`))}}function oe(e,t){for(const n of t)e.push({attributes:n.attributes});return e}function re(t,o,r,s,c){if(t.length=0,n(r))return oe(t,o);switch(r){case"esriGeometryPoint":return z(t,o,s,c);case"esriGeometryMultipoint":return Y(t,o,s,c);case"esriGeometryPolyline":return A(t,o,s,c);case"esriGeometryPolygon":return R(t,o,s,c);default:a.error("convertToFeatureSet:unknown-geometry",new e(`Unable to parse unknown geometry type '${r}'`))}return t}function se(e){const{objectIdFieldName:t,spatialReference:n,transform:o,fields:r,hasM:s,hasZ:c,features:l,geometryType:u,exceededTransferLimit:i,uniqueIdField:f,queryGeometry:h,queryGeometryType:a}=e,g={features:re([],l,u,c,s),fields:r,geometryType:u,objectIdFieldName:t,spatialReference:n,uniqueIdField:f,queryGeometry:ne(h,a,!1,!1)};return o&&(g.transform=o),i&&(g.exceededTransferLimit=i),s&&(g.hasM=s),c&&(g.hasZ=c),g}function ce(t,n){const o=new i,{hasM:r,hasZ:s,features:c,objectIdFieldName:l,spatialReference:u,geometryType:f,exceededTransferLimit:h,transform:g,fields:d}=t;return d&&(o.fields=d),o.geometryType=f,o.objectIdFieldName=l||n,o.spatialReference=u,o.objectIdFieldName?(c&&W(o.features,c,f,s,r,o.objectIdFieldName),h&&(o.exceededTransferLimit=h),r&&(o.hasM=r),s&&(o.hasZ=s),g&&(o.transform=g),o):(a.error(new e("optimized-features:invalid-objectIdFieldName","objectIdFieldName is missing")),o)}function le(e){const{transform:t,features:n,hasM:r,hasZ:s}=e;if(!t)return e;for(const c of n)o(c.geometry)&&me(c.geometry,c.geometry,r,s,t),c.centroid&&me(c.centroid,c.centroid,r,s,t);return e.transform=null,e}function ue(e,t){const{geometryType:n,features:o,hasM:r,hasZ:s}=t;if(!e)return t;for(let c=0;c<o.length;c++){const t=o[c],l=t.weakClone();l.geometry=new f,ie(l.geometry,t.geometry,r,s,n,e),t.centroid&&(l.centroid=new f,ie(l.centroid,t.centroid,r,s,"esriGeometryPoint",e)),o[c]=l}return t.transform=e,t}function ie(e,t,o,r,s,c,l=o,u=r){if(e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0),n(t)||!t.coords.length)return null;const i=g[s],{coords:f,lengths:a}=t,d=h(o,r),m=h(o&&l,r&&u),y=I(o,r,l,u);if(!a.length)return y(e.coords,f,0,0,b(c,f[0]),M(c,f[1])),e.lengths.length&&(e.lengths.length=0),e.coords.length=d,e;let p,w,N,G,T=0,F=0,P=F;for(const n of a){if(n<i)continue;let t=0;F=P,N=p=b(c,f[T]),G=w=M(c,f[T+1]),y(e.coords,f,F,T,N,G),t++,T+=d,F+=m;for(let o=1;o<n;o++,T+=d)N=b(c,f[T]),G=M(c,f[T+1]),N===p&&G===w||(y(e.coords,f,F,T,N-p,G-w),F+=m,t++,p=N,w=G);t>=i&&(e.lengths.push(t),P=F)}return e.coords.length=P,e.coords.length?e:null}function fe(e,t,n,o,r,s,c=n,l=o){if(e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0),!t||!t.coords.length)return null;const u=g[r],{coords:i,lengths:f}=t,a=h(n,o),d=h(n&&c,o&&l),m=I(n,o,c,l);if(!f.length)return m(e.coords,i,0,0,i[0],i[1]),e.lengths.length&&(e.lengths.length=0),e.coords.length=a,e;let y=0;const p=s*s;for(const h of f){if(h<u){y+=h*a;continue}const t=e.coords.length/d,n=y,o=y+(h-1)*a;m(e.coords,i,e.coords.length,n,i[n],i[n+1]),ae(e.coords,i,a,p,m,n,o),m(e.coords,i,e.coords.length,o,i[o],i[o+1]);const r=e.coords.length/d-t;r>=u?e.lengths.push(r):e.coords.length=t*d,y+=h*a}return e.coords.length?e:null}function he(e,t,n,o){const r=e[t],s=e[t+1],c=e[n],l=e[n+1],u=e[o],i=e[o+1];let f=c,h=l,a=u-f,g=i-h;if(0!==a||0!==g){const e=((r-f)*a+(s-h)*g)/(a*a+g*g);e>1?(f=u,h=i):e>0&&(f+=a*e,h+=g*e)}return a=r-f,g=s-h,a*a+g*g}function ae(e,t,n,o,r,s,c){let l,u=o,i=0;for(let f=s+n;f<c;f+=n)l=he(t,f,s,c),l>u&&(i=f,u=l);u>o&&(i-s>n&&ae(e,t,n,o,r,s,i),r(e,t,e.length,i,t[i],t[i+1]),c-i>n&&ae(e,t,n,o,r,i,c))}function ge(e,t,o,r){if(n(t)||!t.coords||!t.coords.length)return null;const s=h(o,r);let c=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;if(t&&t.coords){const e=t.coords;for(let t=0;t<e.length;t+=s){const n=e[t],o=e[t+1];c=Math.min(c,n),u=Math.max(u,n),l=Math.min(l,o),i=Math.max(i,o)}}return e[0]=c,e[1]=l,e[2]=u,e[3]=i,e}function de(e,t,n,o){const r=h(n,o),{lengths:s,coords:c}=t;let l=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,f=Number.NEGATIVE_INFINITY,a=0;for(const h of s){let e=c[a],t=c[a+1];l=Math.min(e,l),u=Math.min(t,u),i=Math.max(e,i),f=Math.max(t,f),a+=r;for(let n=1;n<h;n++,a+=r){const n=c[a],o=c[a+1];e+=n,t+=o,n<0&&(l=Math.min(l,e)),n>0&&(i=Math.max(i,e)),o<0?u=Math.min(u,t):o>0&&(f=Math.max(f,t))}}return e[0]=l,e[1]=u,e[2]=i,e[3]=f,e}function me(e,t,n,o,r){const{coords:s,lengths:c}=t,l=n?o?p:m:o?m:d,u=h(n,o);if(!s.length)return e!==t&&(e.lengths.length=0,e.coords.length=0),e;if(!c.length)return l(e.coords,s,0,0,w(r,s[0]),N(r,s[1])),e!==t&&(e.lengths.length=0,e.coords.length=u),e;const[i,f]=r.scale;let a=0;for(let h=0;h<c.length;h++){const t=c[h];e.lengths[h]=t;let n=w(r,s[a]),o=N(r,s[a+1]);l(e.coords,s,a,a,n,o),a+=u;for(let r=1;r<t;r++,a+=u)n+=s[a]*i,o-=s[a+1]*f,l(e.coords,s,a,a,n,o)}return e!==t&&(e.lengths.length=c.length,e.coords.length=s.length),e}function ye(e,t,n,o,r,s){const c=h(n,o),l=I(n,o,r,s),u=t.coords;e.coords.length=0,e.lengths.length=0,e.lengths.push(...t.lengths);for(let i=0;i<u.length;i+=c)l(e.coords,u,e.coords.length,i,u[i],u[i+1]);return e}function pe(e,t,n,o,r){if(!t||!t.coords||!t.coords.length)return null;const s=g[n],{coords:c,lengths:l}=t,u=I(o,r,o,r),i=h(o,r);let f=0,a=0,d=0,m=0;for(const h of l){a=m,u(e.coords,c,a,f,c[f],c[f+1]),f+=i;let t=c[f],n=c[f+1],o=t,r=n,l=n/t;a+=i,u(e.coords,c,a,f,o,r),f+=i;for(let s=2;s<h;s++){t=c[f],n=c[f+1];const s=n/t,h=l===s||!isFinite(l)&&!isFinite(s),g=h&&isFinite(s)?l>=0&&s>=0||l<=0&&s<=0:r>=0&&n>=0||r<=0&&n<=0;h&&g?(o+=t,r+=n):(o=t,r=n,a+=i),u(e.coords,c,a,f,o,r),f+=i,l=s}a+=i;const g=(a-m)/i;g>=s&&(e.lengths[d]=g,m=a,d++)}return e.coords.length>m&&(e.coords.length=m),e.lengths.length>d&&(e.lengths.length=d),e.coords.length&&e.lengths.length?e:null}function Ie(e,t,n,o){let r=0,s=e[o*t],c=e[o*(t+1)];for(let l=1;l<n;l++){const n=s+e[o*(t+l)],u=c+e[o*(t+l)+1],i=(n-s)*(u+c);s=n,c=u,r+=i}return.5*r}function be(e,t){const{coords:n,lengths:o}=e;let r=0,s=0;for(let c=0;c<o.length;c++){s+=Ie(n,r,o[c],t),r+=c}return Math.abs(s)}function Me(e,t){const n=e.clone(),o=e.coords,r=e.lengths;let s=0;for(let c=0;c<r.length;c++){const e=r[c];let l=o[t*s],u=o[t*s+1];for(let r=1;r<e;r++){const e=o[t*(s+r)],c=o[t*(s+r)+1],i=e-l,f=c-u;n.coords[t*(s+r)]=i,n.coords[t*(s+r)+1]=f,l=e,u=c}s+=e}return n}function we(e,t){if(n(e))return null;const o=e.clone(),r=e.coords,s=e.lengths;let c=0;for(let n=0;n<s.length;n++){const e=s[n];let l=r[t*c],u=r[t*c+1];for(let n=1;n<e;n++){const e=l+r[t*(c+n)],s=u+r[t*(c+n)+1];o.coords[t*(c+n)]=e,o.coords[t*(c+n)+1]=s,l=e,u=s}c+=e}return o}export{Q as convertFromFeature,ce as convertFromFeatureSet,W as convertFromFeatures,te as convertFromGeometry,X as convertFromGraphics,U as convertFromMultipoint,O as convertFromMultipointFeatures,H as convertFromNestedArray,V as convertFromPoint,S as convertFromPointFeatures,D as convertFromPolygon,$ as convertFromPolyline,q as convertFromPolylineFeatures,ee as convertToFeature,se as convertToFeatureSet,re as convertToFeatures,ne as convertToGeometry,_ as convertToMultipoint,Y as convertToMultipointFeatures,G as convertToPoint,C as convertToPolygon,L as convertToPolyline,we as deltaDecodeGeometry,Me as deltaEncodeGeometry,fe as generalizeOptimizedGeometry,ge as getBoundsOptimizedGeometry,be as getQuantizedArea,de as getQuantizedBoundsOptimizedGeometry,Ie as getSignedQuantizedRingArea,ue as quantizeOptimizedFeatureSet,ie as quantizeOptimizedGeometry,b as quantizeX,M as quantizeY,pe as removeCollinearVectices,ye as removeZMValues,le as unquantizeOptimizedFeatureSet,me as unquantizeOptimizedGeometry,w as unquantizeX,N as unquantizeY};
5
+ import e from"../../core/Error.js";import t from"../../core/Logger.js";import{isNone as n,isSome as o}from"../../core/maybe.js";import{isPoint as r,isPolygon as s,isPolyline as c,isMultipoint as l}from"../../geometry/support/jsonUtils.js";import u from"./OptimizedFeature.js";import i from"./OptimizedFeatureSet.js";import f from"./OptimizedGeometry.js";function h(e,t){return e?t?4:3:t?3:2}const a=t.getLogger("esri.layers.graphics.featureConversionUtils"),g={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:3,esriGeometryMultipoint:0},d=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s},m=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s,e[n+2]=t[o+2]},y=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s,e[n+2]=t[o+3]},p=(e,t,n,o,r,s)=>{e[n]=r,e[n+1]=s,e[n+2]=t[o+2],e[n+3]=t[o+3]};function I(e,t,n,o){if(e){if(n)return t&&o?p:m;if(t&&o)return y}else if(t&&o)return m;return d}function b({scale:e,translate:t},n){return Math.round((n-t[0])/e[0])}function M({scale:e,translate:t},n){return Math.round((t[1]-n)/e[1])}function w({scale:e,translate:t},n){return n*e[0]+t[0]}function N({scale:e,translate:t},n){return t[1]-n*e[1]}function G(e,t,n){return e?t?n?k(e):P(e):n?Z(e):T(e):null}function T(e){const t=e.coords;return{x:t[0],y:t[1]}}function F(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e}function P(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2]}}function x(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e}function Z(e){const t=e.coords;return{x:t[0],y:t[1],m:t[2]}}function j(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.m,e}function k(e){const t=e.coords;return{x:t[0],y:t[1],z:t[2],m:t[3]}}function E(e,t){return e.coords[0]=t.x,e.coords[1]=t.y,e.coords[2]=t.z,e.coords[3]=t.m,e}function z(e,t,n,r){let s=T;n&&r?s=k:n?s=P:r&&(s=Z);for(const c of t){const{geometry:t,attributes:n}=c,r=o(t)?s(t):null;e.push({attributes:n,geometry:r})}return e}function v(e,t){return e&&t?E:e?x:t?j:F}function S(e,t,n,o,r){const s=v(n,o);for(const c of t){const{geometry:t,attributes:n}=c;let o;t&&(o=s(new f,t)),e.push(new u(o,n,null,n[r]))}return e}function V(e,t,n=v(null!=t.z,null!=t.m)){return n(e,t)}function Y(e,t,n,o){for(const r of t){const{geometry:t,attributes:s}=r;let c;t&&(c=_(t,n,o)),e.push({attributes:s,geometry:c})}return e}function _(e,t,o){if(n(e))return null;const r=h(t,o),s=[];for(let n=0;n<e.coords.length;n+=r){const t=[];for(let o=0;o<r;o++)t.push(e.coords[n+o]);s.push(t)}return t?o?{points:s,hasZ:t,hasM:o}:{points:s,hasZ:t}:o?{points:s,hasM:o}:{points:s}}function O(e,t,n,o,r){const s=h(n,o);for(const c of t){const t=c.geometry,n=c.attributes;let o;t&&(o=U(new f,t,s)),e.push(new u(o,n,null,n[r]))}return e}function U(e,t,n=h(t.hasZ,t.hasM)){e.lengths[0]=t.points.length;const o=e.coords;let r=0;for(const s of t.points)for(let e=0;e<n;e++)o[r++]=s[e];return e}function A(e,t,n,r){for(const s of t){const{geometry:t,attributes:c}=s;let l;o(t)&&(l=L(t,n,r)),e.push({attributes:c,geometry:l})}return e}function L(e,t,n){if(!e)return null;const o=h(t,n),{coords:r,lengths:s}=e,c=[];let l=0;for(const u of s){const e=[];for(let t=0;t<u;t++){const t=[];for(let e=0;e<o;e++)t.push(r[l++]);e.push(t)}c.push(e)}return t?n?{paths:c,hasZ:t,hasM:n}:{paths:c,hasZ:t}:n?{paths:c,hasM:n}:{paths:c}}function q(e,t,n,o,r){const s=h(n,o);for(const c of t){const t=c.geometry,n=c.attributes;let o;t&&(o=$(new f,t,s)),e.push(new u(o,n,null,n[r]))}return e}function $(e,t,n=h(t.hasZ,t.hasM)){const{lengths:o,coords:r}=e;let s=0;for(const c of t.paths){for(const e of c)for(let t=0;t<n;t++)r[s++]=e[t];o.push(c.length)}return e}function R(e,t,n,r){for(const s of t){const{geometry:t,attributes:c,centroid:l}=s;let u;if(o(t)&&(u=C(t,n,r)),o(l)){const t=T(l);e.push({attributes:c,centroid:t,geometry:u})}else e.push({attributes:c,geometry:u})}return e}function C(e,t,n){if(!e)return null;const o=h(t,n),{coords:r,lengths:s}=e,c=[];let l=0;for(const u of s){const e=[];for(let t=0;t<u;t++){const t=[];for(let e=0;e<o;e++)t.push(r[l++]);e.push(t)}c.push(e)}return t?n?{rings:c,hasZ:t,hasM:n}:{rings:c,hasZ:t}:n?{rings:c,hasM:n}:{rings:c}}function B(e,t,n,r,s){for(const c of t){const t=c.geometry,l=c.centroid,i=c.attributes;let h;t&&(h=D(new f,t,n,r)),o(l)?e.push(new u(h,i,F(new f,l),i[s])):e.push(new u(h,i,null,i[s]))}return e}function D(e,t,n=t.hasZ,o=t.hasM){return H(e,t.rings,n,o),e}function H(e,t,n,o){const r=h(n,o),{lengths:s,coords:c}=e;let l=0;s.length=c.length=0;for(const u of t){for(const e of u)for(let t=0;t<r;t++)c[l++]=e[t];s.push(u.length)}return e}const J=[],K=[];function Q(e,t,n,o,r){J[0]=e;const[s]=W(K,J,t,n,o,r);return J.length=K.length=0,s}function W(t,n,o,r,s,c){if(t.length=0,!o){for(const e of n){const n=e.attributes[c];t.push(new u(null,e.attributes,null,n))}return t}switch(o){case"esriGeometryPoint":return S(t,n,r,s,c);case"esriGeometryMultipoint":return O(t,n,r,s,c);case"esriGeometryPolyline":return q(t,n,r,s,c);case"esriGeometryPolygon":return B(t,n,r,s,c);default:a.error("convertToFeatureSet:unknown-geometry",new e(`Unable to parse unknown geometry type '${o}'`)),t.length=0}return t}function X(t,n,o,r,s,c){const l=t.length;switch(o){case"esriGeometryPoint":S(t,n,r,s,c);break;case"esriGeometryMultipoint":O(t,n,r,s,c);break;case"esriGeometryPolyline":q(t,n,r,s,c);break;case"esriGeometryPolygon":B(t,n,r,s,c);break;default:a.error("convertToFeatureSet:unknown-geometry",new e(`Unable to parse unknown geometry type '${o}'`))}for(let e=0;e<n.length;e++)t[e+l].geometryType=o,t[e+l].insertAfter=n[e].insertAfter,t[e+l].groupId=n[e].groupId;return t}function ee(e,t,n,o){K[0]=e,re(J,K,t,n,o);const r=J[0];return J.length=K.length=0,r}function te(t,o,u){if(n(t))return null;const i=new f;if("hasZ"in t&&null==o&&(o=t.hasZ),"hasM"in t&&null==u&&(u=t.hasM),r(t)){return v(null!=o?o:null!=t.z,null!=u?u:null!=t.m)(i,t)}return s(t)?D(i,t,o,u):c(t)?$(i,t,h(o,u)):l(t)?U(i,t,h(o,u)):void a.error("convertFromGeometry:unknown-geometry",new e(`Unable to parse unknown geometry type '${t}'`))}function ne(t,o,r,s){const c=t&&("coords"in t?t:t.geometry);if(n(c))return null;switch(o){case"esriGeometryPoint":{let e=T;return r&&s?e=k:r?e=P:s&&(e=Z),e(c)}case"esriGeometryMultipoint":return _(c,r,s);case"esriGeometryPolyline":return L(c,r,s);case"esriGeometryPolygon":return C(c,r,s);default:return void a.error("convertToGeometry:unknown-geometry",new e(`Unable to parse unknown geometry type '${o}'`))}}function oe(e,t){for(const n of t)e.push({attributes:n.attributes});return e}function re(t,o,r,s,c){if(t.length=0,n(r))return oe(t,o);switch(r){case"esriGeometryPoint":return z(t,o,s,c);case"esriGeometryMultipoint":return Y(t,o,s,c);case"esriGeometryPolyline":return A(t,o,s,c);case"esriGeometryPolygon":return R(t,o,s,c);default:a.error("convertToFeatureSet:unknown-geometry",new e(`Unable to parse unknown geometry type '${r}'`))}return t}function se(e){const{objectIdFieldName:t,spatialReference:n,transform:o,fields:r,hasM:s,hasZ:c,features:l,geometryType:u,exceededTransferLimit:i,uniqueIdField:f,queryGeometry:h,queryGeometryType:a}=e,g={features:re([],l,u,c,s),fields:r,geometryType:u,objectIdFieldName:t,spatialReference:n,uniqueIdField:f,queryGeometry:ne(h,a,!1,!1)};return o&&(g.transform=o),i&&(g.exceededTransferLimit=i),s&&(g.hasM=s),c&&(g.hasZ=c),g}function ce(t,n){const o=new i,{hasM:r,hasZ:s,features:c,objectIdFieldName:l,spatialReference:u,geometryType:f,exceededTransferLimit:h,transform:g,fields:d}=t;return d&&(o.fields=d),o.geometryType=f,o.objectIdFieldName=l||n,o.spatialReference=u,o.objectIdFieldName?(c&&W(o.features,c,f,s,r,o.objectIdFieldName),h&&(o.exceededTransferLimit=h),r&&(o.hasM=r),s&&(o.hasZ=s),g&&(o.transform=g),o):(a.error(new e("optimized-features:invalid-objectIdFieldName","objectIdFieldName is missing")),o)}function le(e){const{transform:t,features:n,hasM:r,hasZ:s}=e;if(!t)return e;for(const c of n)o(c.geometry)&&me(c.geometry,c.geometry,r,s,t),o(c.centroid)&&me(c.centroid,c.centroid,r,s,t);return e.transform=null,e}function ue(e,t){const{geometryType:n,features:o,hasM:r,hasZ:s}=t;if(!e)return t;for(let c=0;c<o.length;c++){const t=o[c],l=t.weakClone();l.geometry=new f,ie(l.geometry,t.geometry,r,s,n,e),t.centroid&&(l.centroid=new f,ie(l.centroid,t.centroid,r,s,"esriGeometryPoint",e)),o[c]=l}return t.transform=e,t}function ie(e,t,o,r,s,c,l=o,u=r){if(e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0),n(t)||!t.coords.length)return null;const i=g[s],{coords:f,lengths:a}=t,d=h(o,r),m=h(o&&l,r&&u),y=I(o,r,l,u);if(!a.length)return y(e.coords,f,0,0,b(c,f[0]),M(c,f[1])),e.lengths.length&&(e.lengths.length=0),e.coords.length=d,e;let p,w,N,G,T=0,F=0,P=F;for(const n of a){if(n<i)continue;let t=0;F=P,N=p=b(c,f[T]),G=w=M(c,f[T+1]),y(e.coords,f,F,T,N,G),t++,T+=d,F+=m;for(let o=1;o<n;o++,T+=d)N=b(c,f[T]),G=M(c,f[T+1]),N===p&&G===w||(y(e.coords,f,F,T,N-p,G-w),F+=m,t++,p=N,w=G);t>=i&&(e.lengths.push(t),P=F)}return e.coords.length=P,e.coords.length?e:null}function fe(e,t,n,o,r,s,c=n,l=o){if(e.lengths.length&&(e.lengths.length=0),e.coords.length&&(e.coords.length=0),!t||!t.coords.length)return null;const u=g[r],{coords:i,lengths:f}=t,a=h(n,o),d=h(n&&c,o&&l),m=I(n,o,c,l);if(!f.length)return m(e.coords,i,0,0,i[0],i[1]),e.lengths.length&&(e.lengths.length=0),e.coords.length=a,e;let y=0;const p=s*s;for(const h of f){if(h<u){y+=h*a;continue}const t=e.coords.length/d,n=y,o=y+(h-1)*a;m(e.coords,i,e.coords.length,n,i[n],i[n+1]),ae(e.coords,i,a,p,m,n,o),m(e.coords,i,e.coords.length,o,i[o],i[o+1]);const r=e.coords.length/d-t;r>=u?e.lengths.push(r):e.coords.length=t*d,y+=h*a}return e.coords.length?e:null}function he(e,t,n,o){const r=e[t],s=e[t+1],c=e[n],l=e[n+1],u=e[o],i=e[o+1];let f=c,h=l,a=u-f,g=i-h;if(0!==a||0!==g){const e=((r-f)*a+(s-h)*g)/(a*a+g*g);e>1?(f=u,h=i):e>0&&(f+=a*e,h+=g*e)}return a=r-f,g=s-h,a*a+g*g}function ae(e,t,n,o,r,s,c){let l,u=o,i=0;for(let f=s+n;f<c;f+=n)l=he(t,f,s,c),l>u&&(i=f,u=l);u>o&&(i-s>n&&ae(e,t,n,o,r,s,i),r(e,t,e.length,i,t[i],t[i+1]),c-i>n&&ae(e,t,n,o,r,i,c))}function ge(e,t,o,r){if(n(t)||!t.coords||!t.coords.length)return null;const s=h(o,r);let c=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;if(t&&t.coords){const e=t.coords;for(let t=0;t<e.length;t+=s){const n=e[t],o=e[t+1];c=Math.min(c,n),u=Math.max(u,n),l=Math.min(l,o),i=Math.max(i,o)}}return e[0]=c,e[1]=l,e[2]=u,e[3]=i,e}function de(e,t,n,o){const r=h(n,o),{lengths:s,coords:c}=t;let l=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,f=Number.NEGATIVE_INFINITY,a=0;for(const h of s){let e=c[a],t=c[a+1];l=Math.min(e,l),u=Math.min(t,u),i=Math.max(e,i),f=Math.max(t,f),a+=r;for(let n=1;n<h;n++,a+=r){const n=c[a],o=c[a+1];e+=n,t+=o,n<0&&(l=Math.min(l,e)),n>0&&(i=Math.max(i,e)),o<0?u=Math.min(u,t):o>0&&(f=Math.max(f,t))}}return e[0]=l,e[1]=u,e[2]=i,e[3]=f,e}function me(e,t,n,o,r){const{coords:s,lengths:c}=t,l=n?o?p:m:o?m:d,u=h(n,o);if(!s.length)return e!==t&&(e.lengths.length=0,e.coords.length=0),e;if(!c.length)return l(e.coords,s,0,0,w(r,s[0]),N(r,s[1])),e!==t&&(e.lengths.length=0,e.coords.length=u),e;const[i,f]=r.scale;let a=0;for(let h=0;h<c.length;h++){const t=c[h];e.lengths[h]=t;let n=w(r,s[a]),o=N(r,s[a+1]);l(e.coords,s,a,a,n,o),a+=u;for(let r=1;r<t;r++,a+=u)n+=s[a]*i,o-=s[a+1]*f,l(e.coords,s,a,a,n,o)}return e!==t&&(e.lengths.length=c.length,e.coords.length=s.length),e}function ye(e,t,n,o,r,s){const c=h(n,o),l=I(n,o,r,s),u=t.coords;e.coords.length=0,e.lengths.length=0,e.lengths.push(...t.lengths);for(let i=0;i<u.length;i+=c)l(e.coords,u,e.coords.length,i,u[i],u[i+1]);return e}function pe(e,t,n,o,r){if(!t||!t.coords||!t.coords.length)return null;const s=g[n],{coords:c,lengths:l}=t,u=I(o,r,o,r),i=h(o,r);let f=0,a=0,d=0,m=0;for(const h of l){a=m,u(e.coords,c,a,f,c[f],c[f+1]),f+=i;let t=c[f],n=c[f+1],o=t,r=n,l=n/t;a+=i,u(e.coords,c,a,f,o,r),f+=i;for(let s=2;s<h;s++){t=c[f],n=c[f+1];const s=n/t,h=l===s||!isFinite(l)&&!isFinite(s),g=h&&isFinite(s)?l>=0&&s>=0||l<=0&&s<=0:r>=0&&n>=0||r<=0&&n<=0;h&&g?(o+=t,r+=n):(o=t,r=n,a+=i),u(e.coords,c,a,f,o,r),f+=i,l=s}a+=i;const g=(a-m)/i;g>=s&&(e.lengths[d]=g,m=a,d++)}return e.coords.length>m&&(e.coords.length=m),e.lengths.length>d&&(e.lengths.length=d),e.coords.length&&e.lengths.length?e:null}function Ie(e,t,n,o){let r=0,s=e[o*t],c=e[o*(t+1)];for(let l=1;l<n;l++){const n=s+e[o*(t+l)],u=c+e[o*(t+l)+1],i=(n-s)*(u+c);s=n,c=u,r+=i}return.5*r}function be(e,t){const{coords:n,lengths:o}=e;let r=0,s=0;for(let c=0;c<o.length;c++){s+=Ie(n,r,o[c],t),r+=c}return Math.abs(s)}function Me(e,t){const n=e.clone(),o=e.coords,r=e.lengths;let s=0;for(let c=0;c<r.length;c++){const e=r[c];let l=o[t*s],u=o[t*s+1];for(let r=1;r<e;r++){const e=o[t*(s+r)],c=o[t*(s+r)+1],i=e-l,f=c-u;n.coords[t*(s+r)]=i,n.coords[t*(s+r)+1]=f,l=e,u=c}s+=e}return n}function we(e,t){if(n(e))return null;const o=e.clone(),r=e.coords,s=e.lengths;let c=0;for(let n=0;n<s.length;n++){const e=s[n];let l=r[t*c],u=r[t*c+1];for(let n=1;n<e;n++){const e=l+r[t*(c+n)],s=u+r[t*(c+n)+1];o.coords[t*(c+n)]=e,o.coords[t*(c+n)+1]=s,l=e,u=s}c+=e}return o}export{Q as convertFromFeature,ce as convertFromFeatureSet,W as convertFromFeatures,te as convertFromGeometry,X as convertFromGraphics,U as convertFromMultipoint,O as convertFromMultipointFeatures,H as convertFromNestedArray,V as convertFromPoint,S as convertFromPointFeatures,D as convertFromPolygon,$ as convertFromPolyline,q as convertFromPolylineFeatures,ee as convertToFeature,se as convertToFeatureSet,re as convertToFeatures,ne as convertToGeometry,_ as convertToMultipoint,Y as convertToMultipointFeatures,G as convertToPoint,C as convertToPolygon,L as convertToPolyline,we as deltaDecodeGeometry,Me as deltaEncodeGeometry,fe as generalizeOptimizedGeometry,ge as getBoundsOptimizedGeometry,be as getQuantizedArea,de as getQuantizedBoundsOptimizedGeometry,Ie as getSignedQuantizedRingArea,ue as quantizeOptimizedFeatureSet,ie as quantizeOptimizedGeometry,b as quantizeX,M as quantizeY,pe as removeCollinearVectices,ye as removeZMValues,le as unquantizeOptimizedFeatureSet,me as unquantizeOptimizedGeometry,w as unquantizeX,N as unquantizeY};