@arcgis/core 4.33.0-next.20250414 → 4.33.0-next.20250416

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 (253) hide show
  1. package/arcade/featureset/support/FeatureSet.js +1 -1
  2. package/arcade/functions/geomasync.js +1 -1
  3. package/arcade/functions/geomsync.js +1 -1
  4. package/arcade/geometry/functions.js +1 -1
  5. package/arcade/geometry/operatorsWorker.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/0252d853419adc203f04.js +1 -0
  8. package/assets/esri/core/workers/chunks/030f5b9a9757eead436b.js +1 -0
  9. package/assets/esri/core/workers/chunks/{3a84ee5d0434362286a6.js → 07f206719763173faa8d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4403b3f08907e88d0d91.js → 0b34c8356b8492ce7b16.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{fb65796296b0422cf266.js → 272a309760dacb13dee3.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{fe1ad9ed0d32f557e5a3.js → 29283c19e1ccdc6cfbde.js} +33 -33
  13. package/assets/esri/core/workers/chunks/2bdbf678d4f013543dbb.js +1 -0
  14. package/assets/esri/core/workers/chunks/2fd5b48976cefe7cc0ab.js +1 -0
  15. package/assets/esri/core/workers/chunks/321f6f6d268755482c27.js +1 -0
  16. package/assets/esri/core/workers/chunks/{b7a1185ac49480fc1410.js → 35a59f0df087e3c588a9.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{626e33ece2c49d40f6cd.js → 42aab2a336ee22fd9055.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{083548c5eea5aca6404c.js → 45d64b72b7e93e9c64d7.js} +1 -1
  19. package/assets/esri/core/workers/chunks/56fdbe61ac84b036a1a2.js +1 -0
  20. package/assets/esri/core/workers/chunks/57fd5a52be41ddd6a11b.js +1 -0
  21. package/assets/esri/core/workers/chunks/5fb9bb3ac2f60dbd59c4.js +1 -0
  22. package/assets/esri/core/workers/chunks/{0a675f9f69b8b13b7443.js → 601fc99426f0213b0769.js} +1 -1
  23. package/assets/esri/core/workers/chunks/68d7babbe7e0d934e056.js +1 -0
  24. package/assets/esri/core/workers/chunks/6fc39a58f3011291c602.js +1 -0
  25. package/assets/esri/core/workers/chunks/8221f2e540abe1e0f048.js +1 -0
  26. package/assets/esri/core/workers/chunks/83e13baab4b90a88d967.js +1 -0
  27. package/assets/esri/core/workers/chunks/851baab753d9c8e967bd.js +1 -0
  28. package/assets/esri/core/workers/chunks/8ba7d44eff348004f084.js +1 -0
  29. package/assets/esri/core/workers/chunks/{9050dad7e4f093568026.js → 97267911d03c2426d319.js} +1 -1
  30. package/assets/esri/core/workers/chunks/984c5047ab1fa632ca09.js +1 -0
  31. package/assets/esri/core/workers/chunks/{5aae4e127e888f69435a.js → 9a1c058d3ecd1db0e996.js} +1 -1
  32. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ff62b813fff4a015a8a6.js → a4239e301728d594afa5.js} +1 -1
  34. package/assets/esri/core/workers/chunks/aca3ccb9599bcc444617.js +1 -0
  35. package/assets/esri/core/workers/chunks/{a3421383e48379012c9c.js → b6dd25bccb9f6e19c18e.js} +1 -1
  36. package/assets/esri/core/workers/chunks/bf4947fe446dcb477031.js +1 -0
  37. package/assets/esri/core/workers/chunks/d053c23fce77fb77cc00.js +1 -0
  38. package/assets/esri/core/workers/chunks/e31bb256921807464715.js +1 -0
  39. package/assets/esri/core/workers/chunks/{8aae03e347ab18ae6ee2.js → e3d25d027885eb1a415f.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{d88544ac332be633e3fe.js → e64e0c3240f8e577a61c.js} +1 -1
  41. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +1 -0
  42. package/assets/esri/themes/base/widgets/_Expand.scss +6 -1
  43. package/assets/esri/themes/base/widgets/_TimeSlider.scss +97 -107
  44. package/assets/esri/themes/dark/main.css +1 -1
  45. package/assets/esri/themes/light/main.css +1 -1
  46. package/assets/esri/themes/light/view.css +1 -1
  47. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider.json +1 -1
  48. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ar.json +1 -1
  49. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bg.json +1 -1
  50. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_bs.json +1 -1
  51. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ca.json +1 -1
  52. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_cs.json +1 -1
  53. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_da.json +1 -1
  54. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_de.json +1 -1
  55. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_el.json +1 -1
  56. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_en.json +1 -1
  57. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_es.json +1 -1
  58. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_et.json +1 -1
  59. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fi.json +1 -1
  60. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_fr.json +1 -1
  61. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_he.json +1 -1
  62. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hr.json +1 -1
  63. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_hu.json +1 -1
  64. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_id.json +1 -1
  65. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_it.json +1 -1
  66. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ja.json +1 -1
  67. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ko.json +1 -1
  68. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lt.json +1 -1
  69. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_lv.json +1 -1
  70. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_nl.json +1 -1
  71. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_no.json +1 -1
  72. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pl.json +1 -1
  73. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-BR.json +1 -1
  74. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_pt-PT.json +1 -1
  75. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ro.json +1 -1
  76. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_ru.json +1 -1
  77. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sk.json +1 -1
  78. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sl.json +1 -1
  79. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sr.json +1 -1
  80. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_sv.json +1 -1
  81. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_th.json +1 -1
  82. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_tr.json +1 -1
  83. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_uk.json +1 -1
  84. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_vi.json +1 -1
  85. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-CN.json +1 -1
  86. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-HK.json +1 -1
  87. package/assets/esri/widgets/TimeSlider/t9n/TimeSlider_zh-TW.json +1 -1
  88. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ar.json +1 -0
  89. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bg.json +1 -0
  90. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_bs.json +1 -0
  91. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ca.json +1 -0
  92. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_cs.json +1 -0
  93. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_da.json +1 -0
  94. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_de.json +1 -0
  95. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_el.json +1 -0
  96. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_es.json +1 -0
  97. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_et.json +1 -0
  98. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fi.json +1 -0
  99. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_fr.json +1 -0
  100. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_he.json +1 -0
  101. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hr.json +1 -0
  102. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_hu.json +1 -0
  103. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_id.json +1 -0
  104. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_it.json +1 -0
  105. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ja.json +1 -0
  106. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ko.json +1 -0
  107. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lt.json +1 -0
  108. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_lv.json +1 -0
  109. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_nl.json +1 -0
  110. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_no.json +1 -0
  111. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pl.json +1 -0
  112. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-BR.json +1 -0
  113. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_pt-PT.json +1 -0
  114. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ro.json +1 -0
  115. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_ru.json +1 -0
  116. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sk.json +1 -0
  117. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sl.json +1 -0
  118. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sr.json +1 -0
  119. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_sv.json +1 -0
  120. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_th.json +1 -0
  121. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_tr.json +1 -0
  122. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_uk.json +1 -0
  123. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_vi.json +1 -0
  124. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-CN.json +1 -0
  125. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-HK.json +1 -0
  126. package/assets/esri/widgets/support/SelectionList/t9n/SelectionList_zh-TW.json +1 -0
  127. package/chunks/BloomComposition.glsl.js +4 -13
  128. package/chunks/Theme.js +1 -1
  129. package/chunks/Tick.js +1 -1
  130. package/geometry/support/HalfFloatArray.js +1 -1
  131. package/geometry/support/MeshTexture.js +1 -1
  132. package/geometry/support/buffer/BufferView.js +1 -1
  133. package/geometry/support/float16.js +1 -1
  134. package/interfaces.d.ts +266 -139
  135. package/layers/FeatureLayer.js +1 -1
  136. package/layers/WCSLayer.js +1 -1
  137. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  138. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  139. package/layers/mixins/ArcGISImageService.js +1 -1
  140. package/layers/mixins/FeatureLayerBase.js +1 -1
  141. package/layers/support/capabilities.js +1 -1
  142. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  143. package/package.json +2 -2
  144. package/support/revision.js +1 -1
  145. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  146. package/views/3d/interactive/Manipulator3D.js +1 -1
  147. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  148. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  149. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  150. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  151. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  152. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  153. package/views/3d/layers/DrapedSubView3D.js +1 -1
  154. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  155. package/views/3d/layers/FlowSubView3D.js +5 -0
  156. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  157. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  158. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  159. package/views/3d/layers/WMSLayerView3D.js +1 -1
  160. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  165. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  167. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  170. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  171. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  172. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  173. package/views/3d/layers/graphics/Labeler.js +1 -1
  174. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  175. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  176. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  177. package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
  178. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  179. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  180. package/views/3d/support/MemoryController.js +1 -1
  181. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  182. package/views/3d/support/engineContent/line.js +1 -1
  183. package/views/3d/terrain/OverlayRenderer.js +1 -1
  184. package/views/3d/webgl-engine/Stage.js +1 -1
  185. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  186. package/views/3d/webgl-engine/effects/bloom/BloomPresets.glsl.js +1 -1
  187. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  188. package/views/3d/webgl-engine/lib/ContentObjectType.js +1 -1
  189. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  190. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  191. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  192. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  193. package/views/3d/webgl-engine/lib/IntersectableGeometry.js +5 -0
  194. package/views/3d/webgl-engine/lib/Material.js +1 -1
  195. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  196. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  197. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  198. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  199. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  200. package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
  201. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  202. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  203. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  204. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  206. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  207. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  208. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  209. package/views/layers/ImageryTileLayerView.js +1 -1
  210. package/views/support/Scheduler.js +1 -1
  211. package/webscene/Slide.js +1 -1
  212. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  213. package/widgets/Features/FeaturesViewModel.js +1 -1
  214. package/widgets/Search/types.d.ts +10 -0
  215. package/widgets/Search/types.js +5 -0
  216. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  217. package/widgets/TimeSlider/css.js +1 -1
  218. package/widgets/TimeSlider.js +1 -1
  219. package/widgets/support/SelectionList/FeatureItem.js +5 -0
  220. package/widgets/support/SelectionList/GroupLayerItem.js +5 -0
  221. package/widgets/support/SelectionList/{SelectionListItemBase.js → ItemBase.js} +1 -1
  222. package/widgets/support/SelectionList/LayerItem.js +5 -0
  223. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  224. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  225. package/widgets/support/SelectionList.js +1 -1
  226. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  227. package/assets/esri/core/workers/chunks/0db4c0071282dd94f3b2.js +0 -1
  228. package/assets/esri/core/workers/chunks/10631680abe7607616ca.js +0 -1
  229. package/assets/esri/core/workers/chunks/277b61af8982092a4c81.js +0 -1
  230. package/assets/esri/core/workers/chunks/290aed587aa647226b46.js +0 -1
  231. package/assets/esri/core/workers/chunks/345f428dfcaa594ee617.js +0 -1
  232. package/assets/esri/core/workers/chunks/358a3a9326615d5e6d3b.js +0 -1
  233. package/assets/esri/core/workers/chunks/39fbac918ebd1b0e3a18.js +0 -1
  234. package/assets/esri/core/workers/chunks/544771f64a86b541d5bb.js +0 -1
  235. package/assets/esri/core/workers/chunks/6275114e8ed9dd31465d.js +0 -1
  236. package/assets/esri/core/workers/chunks/72b5e43741ce3a0da8f7.js +0 -1
  237. package/assets/esri/core/workers/chunks/72d7e45e7eb28f2cc0b0.js +0 -1
  238. package/assets/esri/core/workers/chunks/7e63e3d759c874077b52.js +0 -1
  239. package/assets/esri/core/workers/chunks/7f8c7e3e41e51ab4d612.js +0 -1
  240. package/assets/esri/core/workers/chunks/80a5fd4fb79e90086538.js +0 -1
  241. package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +0 -1
  242. package/assets/esri/core/workers/chunks/b6361cec92003997bfe5.js +0 -1
  243. package/assets/esri/core/workers/chunks/bbbb1aa2569ebf01ad8b.js +0 -1
  244. package/assets/esri/core/workers/chunks/d59aeb46bf2fb0931a9b.js +0 -1
  245. package/assets/esri/core/workers/chunks/ee277dd58aa69281163f.js +0 -1
  246. package/assets/esri/core/workers/chunks/f718d41f665d5df25f79.js +0 -1
  247. package/assets/esri/core/workers/chunks/fa9ef9e8eae505371965.js +0 -1
  248. package/assets/esri/core/workers/chunks/fb5b852d0f72df014377.js +0 -1
  249. package/assets/esri/core/workers/chunks/fb603edd374e24f366ff.js +0 -1
  250. package/views/3d/webgl-engine/lib/MaterialCollection.js +0 -5
  251. package/widgets/support/SelectionList/SelectionListFeatureItem.js +0 -5
  252. package/widgets/support/SelectionList/SelectionListGroupLayerItem.js +0 -5
  253. package/widgets/support/SelectionList/SelectionListLayerItem.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{initializeProjection as g,project as f}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{getPointFromGeometry as y}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as w}from"../../geometry/support/webMercatorUtils.js";import{fallbackObjectIDAttribute as F}from"../../layers/LayerConstants.js";import v from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as _}from"../../symbols/support/symbolUtils.js";import{system as b}from"../../time/constants.js";import{highlightsSupported as C}from"../../views/support/layerViewUtils.js";import P from"../Feature/FeatureViewModel.js";import{ActionsCollection as M,zoomToFeature as E,zoomToClusteredFeatures as V,browseClusteredFeatures as j}from"../Popup/actions.js";import{triggerAction as L,isClusterFeature as A,removeClusteredFeaturesForBrowsing as I,displayClusterExtent as R,browseAggregateFeatures as x,getSelectedTarget as T}from"../Popup/actionUtils.js";import O from"../support/AnchorElementViewModel.js";import S from"../support/GoTo.js";const B="location-scale-handle",H=()=>[E.clone()],G=()=>[V.clone(),j.clone()];let U=null;function Z(e,t){return"building-scene"===e||"map-image"===e||"tile"===e||"imagery"===e||"2d"===t&&"imagery-tile"===e}let z=class extends(S(O)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new M,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new v({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o((async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if(i&&"mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const e=this.selectedFeature;let i=e.geometry;const r=this._getHighlightLayer(e),o=e.getObjectId();if(!r||!this.view)return;if(o){const e=this.view?.allLayerViews.find((e=>e.layer.uid===r.uid));if(!e||!("queryFeatures"in e))return;const s=e.createQuery();s.outSpatialReference=t,s.objectIds=[o],s.returnGeometry=!0;const{features:a}=await e.queryFeatures(s);i=a[0]?.geometry}if(!i||"mesh"===i.type)return;if(i=f(i,t),U||(U=await import("../../geometry/geometryEngineAsync.js")),!await U.intersects(i,s)){const t=(await U.nearestCoordinate(i,s)).coordinate??s;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=y(this.selectedFeature.geometry)??s}))}initialize(){this.addHandles([this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>L({event:e,viewModel:this,view:this.view}))),u((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),h),l((()=>[this.features,this.map,this.spatialReference,this.timeZone]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),u((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new M;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new M;return e.removeAll(),e.addMany(A(this.selectedFeature)?G():H()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=w(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach((e=>this._pendingPromises.add(e))),e.reduce(((e,t)=>e.finally((()=>t.then((e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)})).finally((()=>this._pendingPromises.delete(t))).catch((()=>{}))))),Promise.resolve())):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??b}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some((e=>e.waitingForContent))}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=T(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){I(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?A(t)?(await R(this),await x(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(E.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor((this.selectedFeatureIndex+1)/this.featuresPerPage):null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach(((t,i)=>{t&&(t.graphic??=e[o+i])}))}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),A(e))return;return e.symbol=await _(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await _(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=y(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(A(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach(((t,i)=>{if(!t)return;let h=null;if(l.some(((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h))),h)u[i]=h;else{const l=new P({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}})),l.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await g(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null})),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this.removeHandles(B),this.addHandles([l((()=>this.view?.scale),(()=>this._debouncedLocationUpdate(t).catch((e=>{a(e)||r.getLogger(this).error(e)})))),u((()=>!this.visible),(()=>{this.removeHandles(B)}),{once:!0})],B);const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(Z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||F:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&C(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter((e=>!t.includes(e)));i?.length&&(this.features=t.concat(i))}};e([c()],z.prototype,"_fetchFeaturesController",void 0),e([c({type:M})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c()],z.prototype,"activeFeature",void 0),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:M,readOnly:!0})],z.prototype,"defaultActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"featurePage",void 0),e([c({value:[]})],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureMenuOpen",void 0),e([c()],z.prototype,"featureMenuTitle",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c()],z.prototype,"initialDisplayMode",void 0),e([c({type:p})],z.prototype,"location",null),e([c()],z.prototype,"map",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({type:m})],z.prototype,"spatialReference",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"timeZone",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c({readOnly:!0})],z.prototype,"waitingForContents",null),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([d("esri.widgets.Features.FeaturesViewModel")],z);const D=z;export{D as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../geometry/Point.js";import{initializeProjection as g,project as f}from"../../geometry/projection.js";import m from"../../geometry/SpatialReference.js";import{getPointFromGeometry as y}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as w}from"../../geometry/support/webMercatorUtils.js";import{fallbackObjectIDAttribute as F}from"../../layers/LayerConstants.js";import v from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as _}from"../../symbols/support/symbolUtils.js";import{system as b}from"../../time/constants.js";import{highlightsSupported as C}from"../../views/support/layerViewUtils.js";import P from"../Feature/FeatureViewModel.js";import{ActionsCollection as M,zoomToFeature as E,zoomToClusteredFeatures as V,browseClusteredFeatures as j}from"../Popup/actions.js";import{triggerAction as L,isClusterFeature as A,removeClusteredFeaturesForBrowsing as I,displayClusterExtent as R,browseAggregateFeatures as x,getSelectedTarget as O}from"../Popup/actionUtils.js";import T from"../support/AnchorElementViewModel.js";import S from"../support/GoTo.js";const B="location-scale-handle",H=()=>[E.clone()],G=()=>[V.clone(),j.clone()];let U=null;function Z(e,t){return"building-scene"===e||"map-image"===e||"tile"===e||"imagery"===e||"2d"===t&&"imagery-tile"===e}let z=class extends(S(T)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new M,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new v({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o((async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if(i&&"mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const e=this.selectedFeature;let i=e.geometry;const r=this._getHighlightLayer(e),o=e.getObjectId();if(!r||!this.view)return;if(o){const e=this.view?.allLayerViews.find((e=>e.layer.uid===r.uid));if(!e||!("queryFeatures"in e))return;const s=e.createQuery();s.outSpatialReference=t,s.objectIds=[o],s.returnGeometry=!0;const{features:a}=await e.queryFeatures(s);i=a[0]?.geometry}if(!i||"mesh"===i.type)return;i=f(i,t),U||(U=await Promise.all([await import("../../geometry/operators/intersectsOperator.js"),await import("../../geometry/operators/proximityOperator.js")]));const[a,n]=U;if(!a.execute(i,s)){const t=n.getNearestCoordinate(i,s).coordinate??s;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=y(this.selectedFeature.geometry)??s}))}initialize(){this.addHandles([this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>L({event:e,viewModel:this,view:this.view}))),u((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),h),l((()=>[this.features,this.map,this.spatialReference,this.timeZone]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),u((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new M;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new M;return e.removeAll(),e.addMany(A(this.selectedFeature)?G():H()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=w(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach((e=>this._pendingPromises.add(e))),e.reduce(((e,t)=>e.finally((()=>t.then((e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)})).finally((()=>this._pendingPromises.delete(t))).catch((()=>{}))))),Promise.resolve())):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??b}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some((e=>e.waitingForContent))}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=O(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){I(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?A(t)?(await R(this),await x(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(E.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor((this.selectedFeatureIndex+1)/this.featuresPerPage):null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach(((t,i)=>{t&&(t.graphic??=e[o+i])}))}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),A(e))return;return e.symbol=await _(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await _(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=y(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(A(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach(((t,i)=>{if(!t)return;let h=null;if(l.some(((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h))),h)u[i]=h;else{const l=new P({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}})),l.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await g(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null})),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this.removeHandles(B),this.addHandles([l((()=>this.view?.scale),(()=>this._debouncedLocationUpdate(t).catch((e=>{a(e)||r.getLogger(this).error(e)})))),u((()=>!this.visible),(()=>{this.removeHandles(B)}),{once:!0})],B);const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(Z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||F:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&C(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter((e=>!t.includes(e)));i?.length&&(this.features=t.concat(i))}};e([c()],z.prototype,"_fetchFeaturesController",void 0),e([c({type:M})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c()],z.prototype,"activeFeature",void 0),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:M,readOnly:!0})],z.prototype,"defaultActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"featurePage",void 0),e([c({value:[]})],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureMenuOpen",void 0),e([c()],z.prototype,"featureMenuTitle",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c()],z.prototype,"initialDisplayMode",void 0),e([c({type:d})],z.prototype,"location",null),e([c()],z.prototype,"map",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({type:m})],z.prototype,"spatialReference",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"timeZone",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c({readOnly:!0})],z.prototype,"waitingForContents",null),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([p("esri.widgets.Features.FeaturesViewModel")],z);const D=z;export{D as default};
@@ -0,0 +1,10 @@
1
+ import "../../interfaces";
2
+
3
+ export type SearchResult = __esri.SearchTypes.SearchResult;
4
+ export type SuggestResult = __esri.SearchTypes.SuggestResult;
5
+ export type BaseSearchResults = __esri.SearchTypes.BaseSearchResults;
6
+ export type SearchResults = __esri.SearchTypes.SearchResults;
7
+ export type SuggestResults = __esri.SearchTypes.SuggestResults;
8
+ export type BaseSearchResponse = __esri.SearchTypes.BaseSearchResponse;
9
+ export type SuggestResponse = __esri.SearchTypes.SuggestResponse;
10
+ export type SearchResponse = __esri.SearchTypes.SearchResponse;
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ function n(){}export{n as __exported__};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import i from"../../core/Evented.js";import n from"../../core/Logger.js";import{after as l,isAbortError as s}from"../../core/promiseUtils.js";import{watch as r,whenOnce as o,initial as a,syncAndInitial as u}from"../../core/reactiveUtils.js";import{offsetDate as m}from"../../core/timeUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{ensureType as h}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../time/TimeExtent.js";import f from"../../time/TimeInterval.js";import w from"../../webdoc/Widgets.js";import g from"../../webdoc/widgets/TimeSlider.js";const v=1e4;function T(t){return null!=t&&void 0!==t.count}function x(t){return null!=t&&void 0!==t.interval}function E(t){return null!=t&&void 0!==t.dates}let _=class extends i.EventedAccessor{constructor(t){super(t),this._animationController=null,this._isViewTimeExtentInitialized=!1,this._timerId=null,this.actions=new e,this.fullTimeExtent=null,this.loop=!1,this.mode="time-window",this.stops={count:10},this.timeExtent=null,this.view=null}initialize(){this.addHandles([r((()=>this.effectiveStops),(()=>{null==this.timeExtent&&(this.timeExtent=this._getDefaultTimeExtent())}),a),r((()=>this.view),((t,e)=>{this._unregisterWidget(e),this._registerWidget(t)}),u),r((()=>this.timeExtent),(t=>{if(null==this.view)return;const e=this.view.timeExtent;(null!=t&&!t.isAllTime||null!=e&&!e.isAllTime)&&(null!=t&&null!=e&&t.equals(e)||(this.view.timeExtent=t))}),a),r((()=>this.view?.timeExtent),(t=>{this._isViewTimeExtentInitialized?(null!=t&&!t.isAllTime||null!=this.timeExtent&&!this.timeExtent.isAllTime)&&(null!=t&&null!=this.timeExtent&&t.equals(this.timeExtent)||(this.timeExtent=t)):this._isViewTimeExtentInitialized=!0}))])}destroy(){null!=this._timerId&&(clearInterval(this._timerId),this._timerId=null),this._unregisterWidget(this.view),this.view=null,null!=this._animationController&&(this._animationController.abort(),this._animationController=null)}get effectiveStops(){const{fullTimeExtent:t,stops:e}=this;if(E(e)){const{dates:i}=e;if(null==i||0===i.length)return null;const n=i.sort(((t,e)=>t.getTime()-e.getTime()));if(null==t)return n;const{start:l,end:s}=t;if(null==l||null==s)return n;return n.filter((t=>!(t.getTime()<l.getTime()||t.getTime()>s.getTime())))}if(T(e)){const i=e.timeExtent??t;return this._divideTimeExtentByCount(i,e.count)}if(x(e)){const i=e.timeExtent??t;return this._divideTimeExtentByInterval(i,e.interval)}return[]}set playRate(t){t<=0||t>36e5||("playing"===this.state&&this._startAnimation(),this._set("playRate",t))}get state(){return null==this.fullTimeExtent?"disabled":null!=this._animationController?"playing":"ready"}get timeExtentValues(){const{mode:t,timeExtent:e}=this;if(null==e||e.isAllTime||e.isEmpty)return null;const{start:i,end:n}=e;switch(t){case"cumulative-from-end":case"instant":return null!=i?[i.getTime()]:null;case"cumulative-from-start":return null!=n?[n.getTime()]:null;case"time-window":return null!=i&&null!=n?[i.getTime(),n.getTime()]:null}}next(){this._step({forward:!0,allowRestart:!1})}play(){this._startAnimation()}previous(){this._step({forward:!1,allowRestart:!1})}stop(){this._stopAnimation()}triggerAction(t){this.emit("trigger-action",{action:t})}updateWebDocument(t){const e=new g({currentTimeExtent:this.timeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:T(this.stops)?this.stops.count:null,numThumbs:"time-window"===this.mode?2:1,stopDelay:this.playRate,stopInterval:x(this.stops)?this.stops.interval:null,stops:E(this.stops)?this.stops.dates:null});t.widgets?t.widgets.timeSlider=e:t.widgets=new w({timeSlider:e})}valuesToTimeExtent(t){if(null==t)return null;const e=t.sort(((t,e)=>t-e)).map((t=>new Date(t))),i=e.length>0?e[0]:null,n=e.length>1?e[1]:null;switch(this.mode){case"time-window":return new c({start:i,end:n});case"instant":return new c({start:i,end:i});case"cumulative-from-start":return new c({start:null,end:i});case"cumulative-from-end":return new c({start:i,end:null});default:return c.allTime}}async _animate(){try{const t=this.view,e=this._animationController?.signal;await Promise.all([l(this.playRate,null,e),null!=t&&o((()=>!1===t.updating),e)])}catch(t){return s(t)||n.getLogger(this).error(t),void(this._animationController=null)}this._step({forward:!0,allowRestart:!1}),null!=this._animationController&&this._animate()}_divideTimeExtentByCount(t,e=10){if(!t||!e)return[];const{start:i,end:n}=t;if(null==i||null==n)return[];if(e>v)return this._divideTimeExtentByCount(t);const l=[],s=i.getTime(),r=n.getTime()-s;for(let o=0;o<=e;o++)l.push(new Date(s+o/e*r));return l}_divideTimeExtentByInterval(t,e,i=v){if(!t||!e)return[];const{start:n,end:l}=t;if(null==n||null==l)return[];const s=l.getTime()-n.getTime(),r=e.toMilliseconds();if(r<=0||s/r>i)return this._divideTimeExtentByCount(t);const o=[],{value:a,unit:u}=e;let p=n;for(;p.getTime()<=l.getTime();)o.push(new Date(p.getTime())),p=m(p,a,u);return o}_getDefaultTimeExtent(){const{effectiveStops:t,mode:e}=this;if(null==t||!e)return null;switch(e){case"time-window":return t.length>1?new c({start:t[0],end:t[1]}):null;case"cumulative-from-start":return t.length>0?new c({start:null,end:t[0]}):null;case"cumulative-from-end":return t.length>0?new c({start:t[0],end:null}):null;case"instant":return t.length>0?new c({start:t[0],end:t[0]}):null;default:return null}}_registerWidget(t){if(null!=t){t.persistableViewModels.includes(this)||t.persistableViewModels.add(this)}}_startAnimation(){this._stopAnimation(),this._animationController=new AbortController,this._step({forward:!0,allowRestart:!0}),this._animate()}_step(t){const{forward:e,allowRestart:i}=t,{effectiveStops:n}=this;if(null==this.timeExtentValues||null==n)return;const l=n.map((t=>t.getTime())),s=this.timeExtentValues.map((t=>{const e=l.indexOf(t);if(-1!==e)return e;const i=l.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e));return l.indexOf(i)})),r=s.map((t=>t+(e?1:-1))),o=r.some((t=>t<0||t>l.length-1)),{loop:a,state:u}=this;if(o)if(a||i){const t=Math.min(...s),i=Math.max(...s),n=(e?s.map((e=>e-t)):s.map((t=>t+(l.length-1-i)))).map((t=>l[t]));this.timeExtent=this.valuesToTimeExtent(n)}else"playing"===u&&this.stop();else{const t=r.map((t=>l[t]));this.timeExtent=this.valuesToTimeExtent(t)}}_stopAnimation(){null!=this._animationController&&(this._animationController.abort(),this._animationController=null)}_unregisterWidget(t){null!=t&&t.persistableViewModels.remove(this)}};t([p()],_.prototype,"_animationController",void 0),t([p({type:e})],_.prototype,"actions",void 0),t([p({readOnly:!0})],_.prototype,"effectiveStops",null),t([p({type:c})],_.prototype,"fullTimeExtent",void 0),t([p({nonNullable:!0})],_.prototype,"loop",void 0),t([p({nonNullable:!0})],_.prototype,"mode",void 0),t([p({nonNullable:!0,value:1e3})],_.prototype,"playRate",null),t([p({readOnly:!0})],_.prototype,"state",null),t([p({cast:t=>null==t?null:(x(t)&&(t.interval=h(f,t.interval)),(x(t)||T(t))&&(t.timeExtent=h(c,t.timeExtent)),t)})],_.prototype,"stops",void 0),t([p({type:c})],_.prototype,"timeExtent",void 0),t([p({readOnly:!0})],_.prototype,"timeExtentValues",null),t([p()],_.prototype,"view",void 0),t([p()],_.prototype,"next",null),t([p()],_.prototype,"play",null),t([p()],_.prototype,"previous",null),t([p()],_.prototype,"stop",null),t([p()],_.prototype,"updateWebDocument",null),_=t([d("esri.widgets.TimeSlider.TimeSliderViewModel")],_);const y=_;export{y as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import i from"../../core/Evented.js";import n from"../../core/Logger.js";import{after as s,isAbortError as r}from"../../core/promiseUtils.js";import{watch as o,whenOnce as l,initial as a,syncAndInitial as m}from"../../core/reactiveUtils.js";import{offsetDate as u}from"../../core/timeUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{ensureType as d}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../time/TimeExtent.js";import f from"../../time/TimeInterval.js";import w from"../../webdoc/Widgets.js";import g from"../../webdoc/widgets/TimeSlider.js";const v=1e4;function T(t){return null!=t&&void 0!==t.count}function x(t){return null!=t&&void 0!==t.interval}function E(t){return null!=t&&void 0!==t.dates}let _=class extends i.EventedAccessor{constructor(t){super(t),this._animationController=null,this._isViewTimeExtentInitialized=!1,this._timerId=null,this.actions=new e,this.fullTimeExtent=null,this.loop=!1,this.mode="time-window",this.stops={count:10},this.timeExtent=null,this.view=null}initialize(){this.addHandles([o((()=>this.effectiveStops),(()=>{this.timeExtent??=this._getDefaultTimeExtent()}),a),o((()=>this.view),((t,e)=>{this._unregisterWidget(e),this._registerWidget(t)}),m),o((()=>this.timeExtent),(t=>{if(!this.view)return;const e=this.view.timeExtent;(t&&!t.isAllTime||e&&!e.isAllTime)&&(t&&e&&t.equals(e)||(this.view.timeExtent=t))}),a),o((()=>this.view?.timeExtent),(t=>{this._isViewTimeExtentInitialized?(t&&!t.isAllTime||this.timeExtent&&!this.timeExtent.isAllTime)&&(t&&this.timeExtent&&t.equals(this.timeExtent)||(this.timeExtent=t)):this._isViewTimeExtentInitialized=!0}))])}destroy(){null!=this._timerId&&(clearInterval(this._timerId),this._timerId=null),this._unregisterWidget(this.view),this.view=null,this._animationController&&(this._animationController.abort(),this._animationController=null)}get effectiveStops(){const{fullTimeExtent:t,stops:e}=this;if(E(e)){const{dates:i}=e;if(!i?.length)return null;const n=i.sort(((t,e)=>t.getTime()-e.getTime()));if(!t)return n;const{start:s,end:r}=t;if(!s||!r)return n;return n.filter((t=>!(t.getTime()<s.getTime()||t.getTime()>r.getTime())))}if(T(e)){const i=e.timeExtent??t;return this._divideTimeExtentByCount(i,e.count)}if(x(e)){const i=e.timeExtent??t;return this._divideTimeExtentByInterval(i,e.interval)}return[]}set playRate(t){t<=0||t>36e5||("playing"===this.state&&this._startAnimation(),this._set("playRate",t))}get state(){return this.fullTimeExtent?this._animationController?"playing":"ready":"disabled"}get timeExtentValues(){const{mode:t,timeExtent:e}=this;if(!e||e.isAllTime||e.isEmpty)return null;const{start:i,end:n}=e;switch(t){case"cumulative-from-end":case"instant":return i?[i.getTime()]:null;case"cumulative-from-start":return n?[n.getTime()]:null;case"time-window":return i&&n?[i.getTime(),n.getTime()]:null}}next(){this._step({forward:!0,allowRestart:!1})}play(){this._startAnimation()}previous(){this._step({forward:!1,allowRestart:!1})}stop(){this._stopAnimation()}triggerAction(t){this.emit("trigger-action",{action:t})}updateWebDocument(t){const e=new g({currentTimeExtent:this.timeExtent,fullTimeExtent:this.fullTimeExtent,loop:this.loop,numStops:T(this.stops)?this.stops.count:null,numThumbs:"time-window"===this.mode?2:1,stopDelay:this.playRate,stopInterval:x(this.stops)?this.stops.interval:null,stops:E(this.stops)?this.stops.dates:null});t.widgets?t.widgets.timeSlider=e:t.widgets=new w({timeSlider:e})}valuesToTimeExtent(t){if(!t)return null;const e=t.sort(((t,e)=>t-e)).map((t=>new Date(t))),i=e.length>0?e[0]:null,n=e.length>1?e[1]:null;switch(this.mode){case"time-window":return new c({start:i,end:n});case"instant":return new c({start:i,end:i});case"cumulative-from-start":return new c({start:null,end:i});case"cumulative-from-end":return new c({start:i,end:null});default:return c.allTime}}async _animate(){try{const t=this.view,e=this._animationController?.signal;await Promise.all([s(this.playRate,null,e),t&&l((()=>!t.updating),e)])}catch(t){return r(t)||n.getLogger(this).error(t),void(this._animationController=null)}this._step({forward:!0,allowRestart:!1}),this._animationController&&this._animate()}_divideTimeExtentByCount(t,e=10){if(!t||!e)return[];const{start:i,end:n}=t;if(!i||!n)return[];if(e>v)return this._divideTimeExtentByCount(t);const s=[],r=i.getTime(),o=n.getTime()-r;for(let l=0;l<=e;l++)s.push(new Date(r+l/e*o));return s}_divideTimeExtentByInterval(t,e,i=v){if(!t||!e)return[];const{start:n,end:s}=t;if(!n||!s)return[];const r=s.getTime()-n.getTime(),o=e.toMilliseconds();if(o<=0||r/o>i)return this._divideTimeExtentByCount(t);const l=[],{value:a,unit:m}=e;let p=n;for(;p.getTime()<=s.getTime();)l.push(new Date(p.getTime())),p=u(p,a,m);return l}_getDefaultTimeExtent(){const{effectiveStops:t,mode:e}=this;if(!t||!e)return null;switch(e){case"time-window":return t.length>1?new c({start:t[0],end:t[1]}):null;case"cumulative-from-start":return t.length>0?new c({start:null,end:t[0]}):null;case"cumulative-from-end":return t.length>0?new c({start:t[0],end:null}):null;case"instant":return t.length>0?new c({start:t[0],end:t[0]}):null;default:return null}}_registerWidget(t){if(t){t.persistableViewModels.includes(this)||t.persistableViewModels.add(this)}}_startAnimation(){this._stopAnimation(),this._animationController=new AbortController,this._step({forward:!0,allowRestart:!0}),this._animate()}_step(t){const{forward:e,allowRestart:i}=t,{effectiveStops:n}=this;if(!this.timeExtentValues||!n)return;const s=n.map((t=>t.getTime())),r=this.timeExtentValues.map((t=>{const e=s.indexOf(t);if(-1!==e)return e;const i=s.reduce(((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e));return s.indexOf(i)})),o=r.map((t=>t+(e?1:-1))),l=o.some((t=>t<0||t>s.length-1)),{loop:a,state:m}=this;if(l)if(a||i){const t=Math.min(...r),i=Math.max(...r),n=(e?r.map((e=>e-t)):r.map((t=>t+(s.length-1-i)))).map((t=>s[t]));this.timeExtent=this.valuesToTimeExtent(n)}else"playing"===m&&this.stop();else{const t=o.map((t=>s[t]));this.timeExtent=this.valuesToTimeExtent(t)}}_stopAnimation(){null!=this._animationController&&(this._animationController.abort(),this._animationController=null)}_unregisterWidget(t){null!=t&&t.persistableViewModels.remove(this)}};t([p()],_.prototype,"_animationController",void 0),t([p({type:e})],_.prototype,"actions",void 0),t([p({readOnly:!0})],_.prototype,"effectiveStops",null),t([p({type:c})],_.prototype,"fullTimeExtent",void 0),t([p({nonNullable:!0})],_.prototype,"loop",void 0),t([p({nonNullable:!0})],_.prototype,"mode",void 0),t([p({nonNullable:!0,value:1e3})],_.prototype,"playRate",null),t([p({readOnly:!0})],_.prototype,"state",null),t([p({cast:t=>t?(x(t)&&(t.interval=d(f,t.interval)),(x(t)||T(t))&&(t.timeExtent=d(c,t.timeExtent)),t):null})],_.prototype,"stops",void 0),t([p({type:c})],_.prototype,"timeExtent",void 0),t([p({readOnly:!0})],_.prototype,"timeExtentValues",null),t([p()],_.prototype,"view",void 0),t([p()],_.prototype,"next",null),t([p()],_.prototype,"play",null),t([p()],_.prototype,"previous",null),t([p()],_.prototype,"stop",null),t([p()],_.prototype,"updateWebDocument",null),_=t([h("esri.widgets.TimeSlider.TimeSliderViewModel")],_);const y=_;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.33/esri/copyright.txt for details.
4
4
  */
5
- const t="esri-time-slider",e={timeSlider:`${t}`,timeSliderOutOfBounds:`${t}--out-of-bounds`,timeSliderMode:`${t}__mode--`,timeSliderLayout:`${t}__layout--`,timeSliderRow:`${t}__row`,animation:`${t}__animation`,animationButton:`${t}__animation-button`,timeExtent:`${t}__time-extent`,timeExtentGroup:`${t}__time-extent-group`,timeExtentDate:`${t}__time-extent-date`,timeExtentTime:`${t}__time-extent-time`,timeExtentSeparator:`${t}__time-extent-separator`,playbackControls:`${t}__playback-controls`,min:`${t}__min`,minDate:`${t}__min-date`,minTime:`${t}__min-time`,slider:`${t}__slider`,sliderMajorTick:"majorTick",sliderMinorTick:"minorTick",max:`${t}__max`,maxDate:`${t}__max-date`,maxTime:`${t}__max-time`,previous:`${t}__previous`,previousButton:`${t}__previous-button`,next:`${t}__next`,nextButton:`${t}__next-button`,warning:`${t}__warning`,warningText:`${t}__warning-text`,hasActions:`${t}--has-actions`,actions:`${t}__actions`,actionsButton:`${t}__actions-button`};export{e as css};
5
+ const t="esri-time-slider",e={timeSlider:`${t}`,actions:`${t}__actions`,hasActions:`${t}--has-actions`,max:`${t}__max`,maxDate:`${t}__max-date`,maxTime:`${t}__max-time`,min:`${t}__min`,minDate:`${t}__min-date`,minTime:`${t}__min-time`,next:`${t}__next`,play:`${t}__play`,playbackControls:`${t}__playback-controls`,previous:`${t}__previous`,slider:`${t}__slider`,sliderMajorTick:"majorTick",sliderMinorTick:"minorTick",timeExtent:`${t}__time-extent`,timeExtentEndDate:`${t}__time-extent-end-date`,timeExtentEndGroup:`${t}__time-extent-end-group`,timeExtentEndTime:`${t}__time-extent-end-time`,timeExtentSeparator:`${t}__time-extent-separator`,timeExtentStartDate:`${t}__time-extent-start-date`,timeExtentStartGroup:`${t}__time-extent-start-group`,timeExtentStartTime:`${t}__time-extent-start-time`,timeSliderDisabled:`${t}--disabled`,timeSliderLayout:`${t}__layout--`,timeSliderMode:`${t}__mode--`,timeSliderOutOfBounds:`${t}--out-of-bounds`,timeSliderRow:`${t}__row`,warning:`${t}__warning`,warningIcon:`${t}__warning-icon`,warningLabel:`${t}__warning-label`};export{e as css};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import{equals as e}from"../core/arrayUtils.js";import{neverReached as i}from"../core/compilerUtils.js";import{watch as s,initial as o}from"../core/reactiveUtils.js";import{truncateDate as a,offsetDate as n}from"../core/timeUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as u}from"../intl/date.js";import{unknown as d,system as c}from"../time/constants.js";import p from"../time/TimeInterval.js";import h from"./Slider.js";import v from"./Widget.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{accessibleHandler as b}from"./support/decorators/accessibleHandler.js";import{messageBundle as x}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as k}from"./support/jsxFactory.js";import{onResize as j}from"./support/widgetUtils.js";import{getCalciteThemeClass as _}from"../support/themeUtils.js";import{css as T}from"./TimeSlider/css.js";import E from"./TimeSlider/TimeSliderViewModel.js";const M=3,S=858,F=[{minor:{value:100,unit:"milliseconds"},major:{value:1,unit:"seconds"},format:{second:"numeric"}},{minor:{value:500,unit:"milliseconds"},major:{value:5,unit:"seconds"},format:{second:"numeric"}},{minor:{value:1,unit:"seconds"},major:{value:20,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:2,unit:"seconds"},major:{value:30,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:10,unit:"seconds"},major:{value:1,unit:"minutes"},format:{minute:"numeric"}},{minor:{value:15,unit:"seconds"},major:{value:5,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"minutes"},major:{value:20,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:5,unit:"minutes"},major:{value:2,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:15,unit:"minutes"},major:{value:6,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"hours"},major:{value:1,unit:"days"},format:{day:"numeric",month:"short"}},{minor:{value:6,unit:"hours"},major:{value:1,unit:"weeks"},format:{day:"numeric",month:"short"}},{minor:{value:1,unit:"days"},major:{value:1,unit:"months"},format:{month:"long"}},{minor:{value:2,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:3,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:4,unit:"days"},major:{value:3,unit:"months"},format:{month:"short",year:"numeric"}},{minor:{value:1,unit:"weeks"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"months"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:2,unit:"months"},major:{value:2,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"years"},major:{value:1,unit:"decades"},format:{year:"numeric"}},{minor:{value:2,unit:"years"},major:{value:5,unit:"decades"},format:{year:"numeric"}},{minor:{value:5,unit:"decades"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1,unit:"centuries"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:2,unit:"centuries"},major:{value:20,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:5,unit:"centuries"},major:{value:50,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:10,unit:"centuries"},major:{value:100,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:20,unit:"centuries"},major:{value:200,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:50,unit:"centuries"},major:{value:500,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:100,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:200,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:500,unit:"centuries"},major:{value:5e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1e3,unit:"centuries"},major:{value:1e4,unit:"centuries"},format:{era:"short",year:"numeric"}}];let C=class extends v{constructor(t,e){super(t,e),this._ignoreNextSliderUpdate=!1,this._slider=new h({precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.disabled=!1,this.labelFormatFunction=null,this.messages=null,this.messagesCommon=null,this.tickConfigs=null,this.timeVisible=!1,this.viewModel=new E}initialize(){this.addHandles([s((()=>this._slider.values),(t=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const e=this.viewModel.valuesToTimeExtent(t);null!=this.timeExtent?null!=e?this.timeExtent.equals(e)||(this.timeExtent=e):this.timeExtent=null:null!=e&&(this.timeExtent=e)})),s((()=>this.effectiveStops),(()=>this._updateSliderSteps()),o)])}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu")})}destroy(){this._slider.destroy(),this._tickFormat=null}get _dateFormat(){return this._getIntlOptions("short-date")}get _timeFormat(){return this._getIntlOptions("long-time")}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get effectiveStops(){return this.viewModel.effectiveStops}get fullTimeExtent(){return this.viewModel.fullTimeExtent}set fullTimeExtent(t){this.viewModel.fullTimeExtent=t}get icon(){return"clock"}set icon(t){this._overrideIfSome("icon",t)}get interactive(){return!(this.disabled||"disabled"===this.viewModel.state||this.timeZone===d)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}set layout(t){["auto","compact","wide"].includes(t)||(t="auto"),this._set("layout",t)}get loop(){return this.viewModel.loop}set loop(t){this.viewModel.loop=t}get mode(){return this.viewModel.mode}set mode(t){this.viewModel.mode=t}get playRate(){return this.viewModel.playRate}set playRate(t){this.viewModel.playRate=t}get stops(){return this.viewModel.stops}set stops(t){this.viewModel.stops=t}get tickFormats(){const{timeZone:t}=this;return F.map((({minor:e,major:i,format:s})=>({minor:new p(e),major:new p(i),format:{...s,timeZone:t}})))}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(t){this.viewModel.timeExtent=t}get timeZone(){return this.viewModel.view?.timeZone??c}set timeZone(t){this._overrideIfSome("timeZone",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}next(){return this.viewModel.next()}play(){return this.viewModel.play()}previous(){return this.viewModel.previous()}stop(){return this.viewModel.stop()}render(){const{_slider:t,actions:i,domNode:s,effectiveStops:o,fullTimeExtent:a,interactive:n,messages:r,messagesCommon:l,mode:u,tickConfigs:d,timeExtent:c,timeVisible:p,viewModel:{state:h,timeExtentValues:v}}=this;if(null!=a){const{start:e,end:i}=a;if(null!=e&&null!=i){const s=e.getTime(),o=i.getTime(),a=t.min!==s||t.max!==o;if(a&&(t.min=s,t.max=o),null!=d)t.tickConfigs!==d&&(t.tickConfigs=d);else{const e=(o-s)/(t.trackElement?.offsetWidth||400),i=this.tickFormats.find((t=>t.minor.toMilliseconds()>M*e))??this.tickFormats.at(-1),n=this._tickFormat!==i&&null!=i;if(n&&(this._tickFormat=i),a||n){const e={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(t,e)=>{e?.classList.add(T.sliderMinorTick)}},s={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(t,e)=>{e?.classList.add(T.sliderMajorTick)},labelFormatFunction:t=>m(t,i.format)};t.tickConfigs=[e,s]}}}}const f=null==this.fullTimeExtent?.start||null==this.fullTimeExtent.end||null==this.timeExtent||this.timeExtent.isAllTime||this.timeExtent.isEmpty||null!=this.timeExtent.start&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||null!=this.timeExtent.end&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(f)switch(this._ignoreNextSliderUpdate=!0,u){case"time-window":t.values=[t.min,t.max];break;case"instant":case"cumulative-from-end":t.values=[t.min];break;case"cumulative-from-start":t.values=[t.max]}else null!=v?e(t.values,v)||(t.values=v):t.values=null;t.disabled=!n;const b="ready"===h,x="playing"===h,w=f||!n||null==o||0===o.length,E="auto"===this.layout?s.clientWidth<S?"compact":"wide":this.layout,F=k("div",{class:T.animation},k("button",{"aria-disabled":w?"true":"false","aria-label":x?l.control.stop:l.control.play,bind:this,class:this.classes(y.widgetButton,T.animationButton,w&&y.buttonDisabled),disabled:w,onclick:this._playOrStopClick,title:x?l.control.stop:l.control.play,type:"button"},k("div",{class:this.classes((b||w)&&g.play,x&&g.pause)}))),C=null!=this.labelFormatFunction?k("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:T.timeExtentDate,"data-date":c?[c.start,c.end]:null,"data-layout":E,"data-type":"extent",key:"extent"}):null==c||null!=c&&c.isAllTime?[k("div",{class:this.classes(T.warning,g.noticeTriangle)}),k("div",{class:T.warningText,key:"warning-text"},r.noTimeExtent)]:c.isEmpty?[k("div",{class:this.classes(T.warning,g.noticeTriangle)}),k("div",{class:T.warningText,key:"warning-text"},r.emptyTimeExtent)]:[null!=c.start&&k("div",{class:T.timeExtentGroup,key:"start-date-group"},k("div",{class:T.timeExtentDate,key:"start-date"},this._formatDate(c.start)),p?k("div",{class:T.timeExtentTime,key:"start-time"},this._formatTime(c.start)):null),null!=c.start&&null!=c.end&&c.start.getTime()!==c.end.getTime()&&k("div",{class:T.timeExtentSeparator,key:"separator"},"–"),null!=c.end&&(null==c.start||c.start.getTime()!==c.end.getTime())&&k("div",{class:T.timeExtentGroup,key:"end-date-group"},k("div",{class:T.timeExtentDate,key:"end-date"},this._formatDate(c.end)),p?k("div",{class:T.timeExtentTime,key:"end-time"},this._formatTime(c.end)):null)],D=k("div",{class:this.classes(T.timeExtent,!n&&y.buttonDisabled)},[C]),L=null!=this.labelFormatFunction?k("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:T.minDate,"data-date":a?.start,"data-layout":E,"data-type":"min",key:"min-date"}):null!=a?.start&&[k("div",{class:T.minDate,key:"min-date"},this._formatDate(a.start)),p&&k("div",{class:T.minTime,key:"min-time"},this._formatTime(a.start))],U=k("div",{class:this.classes(T.min,!n&&y.buttonDisabled)},[L]),Z=k("div",{class:T.slider},t.render()),R=null!=this.labelFormatFunction?k("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:T.maxDate,"data-date":a?.end,"data-layout":E,"data-type":"max",key:"max-date"}):null!=a?.end&&[k("div",{class:T.maxDate,key:"max-date"},this._formatDate(a.end)),p&&k("div",{class:T.maxTime,key:"max-time"},this._formatTime(a.end))],B=k("div",{class:this.classes(T.max,!n&&y.buttonDisabled)},[R]),I=k("div",{class:T.previous},k("button",{"aria-disabled":w?"true":"false","aria-label":l.pagination.previous,bind:this,class:this.classes(y.widgetButton,T.previousButton,(x||w)&&y.buttonDisabled),disabled:w,onclick:this._previousClick,title:l.pagination.previous,type:"button"},k("div",{class:g.reverse}))),O=k("div",{class:T.next},k("button",{"aria-disabled":w?"true":"false","aria-label":l.pagination.next,bind:this,class:this.classes(y.widgetButton,T.nextButton,(x||w)&&y.buttonDisabled),disabled:w,onclick:this._nextClick,title:l.pagination.next,type:"button"},k("div",{class:g.forward}))),A=i?.length>0,V=A&&k("div",{class:T.actions,title:l.options},k("calcite-action-menu",{class:T.actionsButton,label:l.options},i.toArray().map((t=>k("calcite-action",{bind:this,icon:t.icon,id:t.id,onclick:()=>this.viewModel.triggerAction(t),text:t.title,textEnabled:!0,title:t.title})))));return k("div",{afterCreate:t=>{this.addHandles(j(t,(()=>this.scheduleRender())))},"aria-label":r.widgetLabel,class:this.classes(T.timeSlider,y.widget,`${T.timeSliderMode}${u}`,`${T.timeSliderLayout}${E}`,!n&&y.disabled,f&&T.timeSliderOutOfBounds,A&&T.hasActions,_())},"wide"===E&&k("div",{class:T.timeSliderRow},k("div",{class:T.playbackControls},[F,D,U,Z,B,I,O]),V),"compact"===E&&[k("div",{class:T.timeSliderRow,key:"time-slider-row-1"},[D,V]),k("div",{class:T.timeSliderRow,key:"time-slider-row-2"},[Z]),k("div",{class:T.timeSliderRow,key:"time-slider-row-3"},[U,I,F,O,B])])}updateWebDocument(t){this.viewModel?.updateWebDocument(t)}_createLabel(t){if(null==this.labelFormatFunction)return;const e=t.getAttribute("data-type"),i=t.getAttribute("data-layout"),s=t["data-date"];this.labelFormatFunction(s,e,t,i)}_formatDate(t){return m(t,this._dateFormat)}_formatTime(t){return m(t,this._timeFormat)}_getIntlOptions(t){const{timeZone:e}=this;return{...u(t),timeZone:e}}_getTickPositions(t){const{fullTimeExtent:e}=this;if(null==e?.start||null==e.end)return[];const{start:i,end:s}=e,o=[],{value:r,unit:l}=t;let m=a(i,l,this.timeZone);for(;m.getTime()<=s.getTime();)m.getTime()>=i.getTime()&&o.push(m.getTime()),m=n(m,r,l,this.timeZone);return o}_updateSliderSteps(){this._slider.steps=null!=this.effectiveStops&&this.effectiveStops.length>0?this.effectiveStops.map((t=>t.getTime())):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:i(this.viewModel.state)}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};t([r()],C.prototype,"_dateFormat",null),t([r()],C.prototype,"_timeFormat",null),t([r()],C.prototype,"actions",null),t([r()],C.prototype,"disabled",void 0),t([r()],C.prototype,"effectiveStops",null),t([r()],C.prototype,"fullTimeExtent",null),t([r()],C.prototype,"icon",null),t([r({readOnly:!0})],C.prototype,"interactive",null),t([r()],C.prototype,"label",null),t([r()],C.prototype,"labelFormatFunction",void 0),t([r({value:"auto"})],C.prototype,"layout",null),t([r()],C.prototype,"loop",null),t([r(),x("esri/widgets/TimeSlider/t9n/TimeSlider")],C.prototype,"messages",void 0),t([r(),x("esri/t9n/common")],C.prototype,"messagesCommon",void 0),t([r()],C.prototype,"mode",null),t([r()],C.prototype,"playRate",null),t([r()],C.prototype,"stops",null),t([r()],C.prototype,"tickConfigs",void 0),t([r()],C.prototype,"tickFormats",null),t([r()],C.prototype,"timeExtent",null),t([r({nonNullable:!0})],C.prototype,"timeVisible",void 0),t([r()],C.prototype,"timeZone",null),t([r()],C.prototype,"view",null),t([r({type:E}),w("trigger-action")],C.prototype,"viewModel",void 0),t([b()],C.prototype,"_playOrStopClick",null),t([b()],C.prototype,"_previousClick",null),t([b()],C.prototype,"_nextClick",null),C=t([l("esri.widgets.TimeSlider")],C);const D=C;export{D as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import{equals as e}from"../core/arrayUtils.js";import{neverReached as i}from"../core/compilerUtils.js";import{watch as a,initial as s}from"../core/reactiveUtils.js";import{truncateDate as n,offsetDate as r}from"../core/timeUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{formatDate as m,convertDateFormatToIntlOptions as u}from"../intl/date.js";import{unknown as c,system as d}from"../time/constants.js";import p from"../time/TimeInterval.js";import h from"./Slider.js";import v from"./Widget.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{onResize as g}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as x}from"./support/decorators/vmEvent.js";import{tsx as w}from"./support/jsxFactory.js";import{getCalciteThemeClass as E}from"../support/themeUtils.js";import{css as k}from"./TimeSlider/css.js";import j from"./TimeSlider/TimeSliderViewModel.js";const _=3,T=858,S=[{minor:{value:100,unit:"milliseconds"},major:{value:1,unit:"seconds"},format:{second:"numeric"}},{minor:{value:500,unit:"milliseconds"},major:{value:5,unit:"seconds"},format:{second:"numeric"}},{minor:{value:1,unit:"seconds"},major:{value:20,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:2,unit:"seconds"},major:{value:30,unit:"seconds"},format:{minute:"numeric",second:"numeric"}},{minor:{value:10,unit:"seconds"},major:{value:1,unit:"minutes"},format:{minute:"numeric"}},{minor:{value:15,unit:"seconds"},major:{value:5,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"minutes"},major:{value:20,unit:"minutes"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:5,unit:"minutes"},major:{value:2,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:15,unit:"minutes"},major:{value:6,unit:"hours"},format:{hour:"numeric",minute:"numeric"}},{minor:{value:1,unit:"hours"},major:{value:1,unit:"days"},format:{day:"numeric",month:"short"}},{minor:{value:6,unit:"hours"},major:{value:1,unit:"weeks"},format:{day:"numeric",month:"short"}},{minor:{value:1,unit:"days"},major:{value:1,unit:"months"},format:{month:"long"}},{minor:{value:2,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:3,unit:"days"},major:{value:1,unit:"months"},format:{month:"short"}},{minor:{value:4,unit:"days"},major:{value:3,unit:"months"},format:{month:"short",year:"numeric"}},{minor:{value:1,unit:"weeks"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"months"},major:{value:1,unit:"years"},format:{year:"numeric"}},{minor:{value:2,unit:"months"},major:{value:2,unit:"years"},format:{year:"numeric"}},{minor:{value:1,unit:"years"},major:{value:1,unit:"decades"},format:{year:"numeric"}},{minor:{value:2,unit:"years"},major:{value:5,unit:"decades"},format:{year:"numeric"}},{minor:{value:5,unit:"decades"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1,unit:"centuries"},major:{value:10,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:2,unit:"centuries"},major:{value:20,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:5,unit:"centuries"},major:{value:50,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:10,unit:"centuries"},major:{value:100,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:20,unit:"centuries"},major:{value:200,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:50,unit:"centuries"},major:{value:500,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:100,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:200,unit:"centuries"},major:{value:1e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:500,unit:"centuries"},major:{value:5e3,unit:"centuries"},format:{era:"short",year:"numeric"}},{minor:{value:1e3,unit:"centuries"},major:{value:1e4,unit:"centuries"},format:{era:"short",year:"numeric"}}];function M(t){return w("div",{class:k.warning},w("calcite-icon",{class:k.warningIcon,icon:"exclamation-mark-triangle"}),w("calcite-label",{alignment:"center",class:k.warningLabel,scale:"s"},t))}let F=class extends v{constructor(t,e){super(t,e),this._allLayouts=["auto","compact","wide"],this._ignoreNextSliderUpdate=!1,this._slider=new h({precision:0,visibleElements:{rangeLabels:!1},rangeLabelInputsEnabled:!1,thumbsConstrained:!1}),this._tickFormat=null,this.disabled=!1,this.labelFormatFunction=null,this.messages=null,this.tickConfigs=null,this.timeVisible=!1,this.viewModel=new j}initialize(){this.addHandles([a((()=>this._slider.values),(t=>{if(this._ignoreNextSliderUpdate)return void(this._ignoreNextSliderUpdate=!1);const e=this.viewModel.valuesToTimeExtent(t);this.timeExtent?e?this.timeExtent.equals(e)||(this.timeExtent=e):this.timeExtent=null:e&&(this.timeExtent=e)})),a((()=>this.effectiveStops),(()=>this._updateSliderSteps()),s)])}loadDependencies(){return f({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label")})}destroy(){this._slider.destroy(),this._tickFormat=null}get _dateFormat(){return this._getIntlOptions("short-date")}get _timeFormat(){return this._getIntlOptions("long-time")}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get effectiveStops(){return this.viewModel.effectiveStops}get fullTimeExtent(){return this.viewModel.fullTimeExtent}set fullTimeExtent(t){this.viewModel.fullTimeExtent=t}get icon(){return"clock"}set icon(t){this._overrideIfSome("icon",t)}get interactive(){return!(this.disabled||"disabled"===this.viewModel.state||this.timeZone===c)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}set layout(t){this._set("layout",this._allLayouts.includes(t)?t:"auto")}get loop(){return this.viewModel.loop}set loop(t){this.viewModel.loop=t}get mode(){return this.viewModel.mode}set mode(t){this.viewModel.mode=t}get playRate(){return this.viewModel.playRate}set playRate(t){this.viewModel.playRate=t}get stops(){return this.viewModel.stops}set stops(t){this.viewModel.stops=t}get tickFormats(){const{timeZone:t}=this;return S.map((({minor:e,major:i,format:a})=>({minor:new p(e),major:new p(i),format:{...a,timeZone:t}})))}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(t){this.viewModel.timeExtent=t}get timeZone(){return this.viewModel.view?.timeZone??d}set timeZone(t){this._overrideIfSome("timeZone",t)}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}next(){return this.viewModel.next()}play(){return this.viewModel.play()}previous(){return this.viewModel.previous()}stop(){return this.viewModel.stop()}render(){const{_slider:t,actions:i,domNode:a,effectiveStops:s,fullTimeExtent:n,interactive:r,messages:o,mode:l,tickConfigs:u,timeExtent:c,timeVisible:d,viewModel:{state:p,timeExtentValues:h}}=this;if(n){const{start:e,end:i}=n;if(e&&i){const a=e.getTime(),s=i.getTime(),n=t.min!==a||t.max!==s;if(n&&(t.min=a,t.max=s),u)t.tickConfigs!==u&&(t.tickConfigs=u);else{const e=(s-a)/(t.trackElement?.offsetWidth||400),i=this.tickFormats.find((({minor:t})=>t.toMilliseconds()>_*e))??this.tickFormats.at(-1),r=i&&this._tickFormat!==i;if(r&&(this._tickFormat=i),n||r){const e={mode:"position",values:this._getTickPositions(i.minor),labelsVisible:!1,tickCreatedFunction:(t,e)=>{e?.classList.add(k.sliderMinorTick)}},a={mode:"position",values:this._getTickPositions(i.major),labelsVisible:!0,tickCreatedFunction:(t,e)=>{e?.classList.add(k.sliderMajorTick)},labelFormatFunction:t=>m(t,i.format)};t.tickConfigs=[e,a]}}}}const v=!this.fullTimeExtent?.start||!this.fullTimeExtent.end||!this.timeExtent||this.timeExtent.isAllTime||this.timeExtent.isEmpty||this.timeExtent.start&&(this.timeExtent.start<this.fullTimeExtent.start||this.timeExtent.start>this.fullTimeExtent.end)||this.timeExtent.end&&(this.timeExtent.end>this.fullTimeExtent.end||this.timeExtent.end<this.fullTimeExtent.start);if(v)switch(this._ignoreNextSliderUpdate=!0,l){case"time-window":t.values=[t.min,t.max];break;case"instant":case"cumulative-from-end":t.values=[t.min];break;case"cumulative-from-start":t.values=[t.max]}else h?e(t.values,h)||(t.values=h):t.values=null;t.disabled=!r;const f=v||!r||!s?.length,b="auto"===this.layout?a.clientWidth<T?"compact":"wide":this.layout,x=w("calcite-button",{appearance:"transparent",bind:this,class:k.play,disabled:f,iconStart:"playing"===p?"pause":"play",kind:"neutral",label:"playing"===p?o.control.stop:o.control.play,onclick:this._playOrStopClick,scale:"wide"===b?"l":"m",width:"full"}),j=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.timeExtentStartDate,"data-date":c?[c.start,c.end]:null,"data-layout":b,"data-type":"extent",key:k.timeExtentStartDate}):!c||c.isAllTime?M(o.noTimeExtent):c.isEmpty?M(o.emptyTimeExtent):[c?.start&&w("div",{class:k.timeExtentStartGroup,key:k.timeExtentStartGroup},w("calcite-label",{alignment:"center",class:k.timeExtentStartDate,key:k.timeExtentStartDate,scale:"s"},this._formatDate(c.start)),d?w("calcite-label",{alignment:"center",class:k.timeExtentStartTime,key:k.timeExtentStartTime,scale:"s"},this._formatTime(c.start)):null),c.start&&c.end&&c.start.getTime()!==c.end.getTime()&&w("div",{class:k.timeExtentSeparator,key:k.timeExtentSeparator}),c?.end&&(!c.start||c.start.getTime()!==c.end.getTime())&&w("div",{class:k.timeExtentEndGroup,key:k.timeExtentEndGroup},w("calcite-label",{alignment:"center",class:k.timeExtentEndDate,key:k.timeExtentEndDate,scale:"s"},this._formatDate(c.end)),d?w("calcite-label",{alignment:"center",class:k.timeExtentEndTime,key:k.timeExtentEndTime,scale:"s"},this._formatTime(c.end)):null)],S=w("div",{class:k.timeExtent},j),F=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.minDate,"data-date":n?.start,"data-layout":b,"data-type":"min",key:k.minDate}):n?.start&&[w("calcite-label",{alignment:"center",class:k.minDate,key:k.minDate,scale:"s"},this._formatDate(n.start)),d&&w("calcite-label",{alignment:"center",class:k.minTime,key:k.minTime,scale:"s"},this._formatTime(n.start))],D=w("div",{class:k.min},F),C=w("div",{class:k.slider},t.render()),L=this.labelFormatFunction?w("div",{afterCreate:this._createLabel,afterUpdate:this._createLabel,bind:this,class:k.maxDate,"data-date":n?.end,"data-layout":b,"data-type":"max",key:k.maxDate}):n?.end&&[w("calcite-label",{alignment:"center",class:k.maxDate,key:k.maxDate,scale:"s"},this._formatDate(n.end)),d&&w("calcite-label",{alignment:"center",class:k.maxTime,key:k.maxTime,scale:"s"},this._formatTime(n.end))],U=w("div",{class:k.max},L),Z=w("calcite-button",{appearance:"transparent",bind:this,class:k.previous,disabled:f||"playing"===p,iconStart:"reverse",kind:"neutral",label:o.pagination.previous,onclick:this._previousClick,scale:"wide"===b?"l":"m",width:"full"}),R=w("calcite-button",{appearance:"transparent",bind:this,class:k.next,disabled:f||"playing"===p,iconStart:"forward",kind:"neutral",label:o.pagination.next,onclick:this._nextClick,scale:"wide"===b?"l":"m",width:"full"}),I=i?.length>0,O=I&&w("calcite-action-menu",{class:k.actions,label:o.options},i.toArray().map((t=>w("calcite-action",{bind:this,icon:t.icon,id:t.id,onclick:()=>this.viewModel.triggerAction(t),text:t.title,textEnabled:!0}))));return w("div",{afterCreate:t=>{this.addHandles(g(t,(()=>this.scheduleRender())))},"aria-label":o.widgetLabel,class:this.classes(k.timeSlider,y.widget,`${k.timeSliderMode}${l}`,`${k.timeSliderLayout}${b}`,!r&&k.timeSliderDisabled,v&&k.timeSliderOutOfBounds,I&&k.hasActions,E())},"wide"===b&&w("div",{class:k.timeSliderRow},w("div",{class:k.playbackControls},[x,S,D,C,U,Z,R]),O),"compact"===b&&[w("div",{class:k.timeSliderRow,key:"time-slider-row-1"},[S,O]),w("div",{class:k.timeSliderRow,key:"time-slider-row-2"},[C]),w("div",{class:k.timeSliderRow,key:"time-slider-row-3"},[D,Z,x,R,U])])}updateWebDocument(t){this.viewModel?.updateWebDocument(t)}_createLabel(t){if(!this.labelFormatFunction)return;const e=t.getAttribute("data-type"),i=t.getAttribute("data-layout"),a=t["data-date"];this.labelFormatFunction(a,e,t,i)}_formatDate(t){return m(t,this._dateFormat)}_formatTime(t){return m(t,this._timeFormat)}_getIntlOptions(t){const{timeZone:e}=this;return{...u(t),timeZone:e}}_getTickPositions(t){const{fullTimeExtent:e}=this;if(!e?.start||!e.end)return[];const{start:i,end:a}=e,s=[],{value:o,unit:l}=t;let m=n(i,l,this.timeZone);for(;m.getTime()<=a.getTime();)m.getTime()>=i.getTime()&&s.push(m.getTime()),m=r(m,o,l,this.timeZone);return s}_updateSliderSteps(){this._slider.steps=this.effectiveStops&&this.effectiveStops.length>0?this.effectiveStops.map((t=>t.getTime())):null}_playOrStopClick(){switch(this.viewModel.state){case"ready":this.viewModel.play();break;case"playing":this.viewModel.stop();break;case"disabled":break;default:i(this.viewModel.state)}}_previousClick(){this.viewModel.previous()}_nextClick(){this.viewModel.next()}};t([o()],F.prototype,"_dateFormat",null),t([o()],F.prototype,"_timeFormat",null),t([o()],F.prototype,"actions",null),t([o()],F.prototype,"disabled",void 0),t([o()],F.prototype,"effectiveStops",null),t([o()],F.prototype,"fullTimeExtent",null),t([o()],F.prototype,"icon",null),t([o({readOnly:!0})],F.prototype,"interactive",null),t([o()],F.prototype,"label",null),t([o()],F.prototype,"labelFormatFunction",void 0),t([o({value:"auto"})],F.prototype,"layout",null),t([o()],F.prototype,"loop",null),t([o(),b("esri/widgets/TimeSlider/t9n/TimeSlider")],F.prototype,"messages",void 0),t([o()],F.prototype,"mode",null),t([o()],F.prototype,"playRate",null),t([o()],F.prototype,"stops",null),t([o()],F.prototype,"tickConfigs",void 0),t([o()],F.prototype,"tickFormats",null),t([o()],F.prototype,"timeExtent",null),t([o({nonNullable:!0})],F.prototype,"timeVisible",void 0),t([o()],F.prototype,"timeZone",null),t([o()],F.prototype,"view",null),t([o({type:j}),x("trigger-action")],F.prototype,"viewModel",void 0),F=t([l("esri.widgets.TimeSlider")],F);const D=F;export{D as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{fetchThumbnail as i}from"../symbolPreviewUtils.js";import s from"./ItemBase.js";let o=class extends s{constructor(t){super(t),this._title=null,this._thumbnail=null,this.graphic=null,this.layer=null}get key(){return`${this.layer.id}:${this.objectId??this.graphic.uid}`}get objectId(){return this.graphic.getObjectId()}get title(){return this._title??this.objectId?.toString()}get thumbnail(){return this._thumbnail??void 0}async fetchThumbnail(){return this._thumbnail=await i(this.graphic,this.layer)}async sync(t){t.push(this._setFeatureTitle())}async _setFeatureTitle(){const{graphic:t,key:e,layer:r,viewModel:i}=this,s=i.featureTitleMap.get(e)||(r?.getFeatureTitle?await r.getFeatureTitle(t,{fetchMissingFields:!1}):null);s&&i.featureTitleMap.set(e,s),this._title=s}};t([e()],o.prototype,"_title",void 0),t([e()],o.prototype,"_thumbnail",void 0),t([e()],o.prototype,"graphic",void 0),t([e()],o.prototype,"key",null),t([e()],o.prototype,"layer",void 0),t([e()],o.prototype,"objectId",null),t([e()],o.prototype,"title",null),t([e()],o.prototype,"thumbnail",null),o=t([r("esri.widgets.support.SelectionList.FeatureItem")],o);const l=o;export{l as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/has.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./ItemBase.js";let s=class extends o{constructor(e){super(e),this.children=[],this.layer=null}get layers(){const{layer:e}=this;return"group"===e.type?e.layers.toArray().reverse():"subtype-group"===e.type?e.sublayers.toArray().reverse():[]}get maxVisibleFeatureCountExceeded(){return this.children.some((e=>e.maxVisibleFeatureCountExceeded))}get total(){return this.children.reduce(((e,r)=>e+r.total),0)}async sync({controller:e,promises:r}){const{layers:t,viewModel:o}=this;this.children=o.layersToItems({controller:e,layers:t,promises:r})}};e([r()],s.prototype,"children",void 0),e([r()],s.prototype,"layer",void 0),e([r()],s.prototype,"layers",null),e([r()],s.prototype,"maxVisibleFeatureCountExceeded",null),e([r()],s.prototype,"total",null),s=e([t("esri.widgets.support.SelectionList.GroupLayerItem")],s);const l=s;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getIconForLayer as s}from"../iconUtils.js";let i=class extends t{constructor(e){super(e),this.layer=null,this.viewModel=null}get iconName(){return s(this.layer)}get key(){return this.layer.id}get layerView(){return this.viewModel.layerViewMap.get(this.layer.id)}get title(){return this.layer.title}get view(){return this.viewModel.view}};e([r()],i.prototype,"iconName",null),e([r()],i.prototype,"key",null),e([r()],i.prototype,"layer",void 0),e([r()],i.prototype,"layerView",null),e([r()],i.prototype,"title",null),e([r()],i.prototype,"view",null),e([r()],i.prototype,"viewModel",void 0),i=e([o("esri.widgets.support.SelectionList.SelectionListItemBase")],i);const l=i;export{l as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{getIconForLayer as s}from"../iconUtils.js";let i=class extends t{constructor(e){super(e),this.layer=null,this.viewModel=null}get iconName(){return s(this.layer)}get key(){return this.layer.id}get layerView(){return this.viewModel.layerViewMap.get(this.layer.id)}get title(){return this.layer.title}get view(){return this.viewModel.view}};e([r()],i.prototype,"iconName",null),e([r()],i.prototype,"key",null),e([r()],i.prototype,"layer",void 0),e([r()],i.prototype,"layerView",null),e([r()],i.prototype,"title",null),e([r()],i.prototype,"view",null),e([r()],i.prototype,"viewModel",void 0),i=e([o("esri.widgets.support.SelectionList.ItemBase")],i);const l=i;export{l as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./FeatureItem.js";import s from"./ItemBase.js";let i=class extends s{constructor(e){super(e),this._onChangeController=null,this.layer=null,this.selection=[]}get effectiveObjectIds(){return this.objectIds.slice(0,this.maxVisibleFeatureCountPerLayer)}get maxVisibleFeatureCountExceeded(){return this.objectIds.length>this.viewModel.maxVisibleFeatureCountPerLayer}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}get objectIds(){return this.viewModel.selectionsByLayerMap.get(this.layer)??[]}get total(){return this.objectIds.length}cancel(){this._onChangeController?.abort()}async sync({controller:e,promises:t}){this.cancel();const r=this.selection.slice(),o=new Map(r.map((e=>[e.objectId,e]))),s=this.effectiveObjectIds.slice(),i=[],a=[];for(const n of s){const e=o.get(n);e?(i.push(e),t.push(e.sync(t))):a.push(n)}if(this._onChangeController=e,a.length>0){const r=await this._createFeatureItems(a,e);for(const e of r)i.push(e),t.push(e.sync(t))}e.signal.aborted||(this.selection=i)}async _createFeatureItems(e,t){const{layer:r,layerView:s,viewModel:i}=this,a=new Map;if(s){const o=s.createQuery();o.objectIds=e,o.outFields=["*"],o.returnGeometry=!0;const i=await s.queryFeatures(o,t),{objectIdField:n}=r;for(const e of i?.features??[])a.set(e.attributes[n],e)}if(t.signal.aborted)return[];const n=e.filter((e=>!a.has(e)));if(n.length){const e=r.createQuery();e.objectIds=n,e.outSpatialReference=this.view?.spatialReference,e.outFields=["*"],e.returnGeometry=!0;const o=await r.queryFeatures(e,t);for(const t of o.features??[])a.set(t.attributes[r.objectIdField],t)}return Array.from(a.values()).map((e=>new o({layer:r,graphic:e,viewModel:i})))}};e([t()],i.prototype,"_onChangeController",void 0),e([t()],i.prototype,"effectiveObjectIds",null),e([t()],i.prototype,"layer",void 0),e([t()],i.prototype,"maxVisibleFeatureCountExceeded",null),e([t()],i.prototype,"maxVisibleFeatureCountPerLayer",null),e([t()],i.prototype,"objectIds",null),e([t()],i.prototype,"selection",void 0),e([t()],i.prototype,"total",null),i=e([r("esri.widgets.support.SelectionList.LayerItem")],i);const a=i;export{a as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import r from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{ignoreAbortErrors as s,debounce as n}from"../../../core/promiseUtils.js";import{watch as a,on as l}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as g,isSubtypeSublayer as m}from"../../../layers/support/layerUtils.js";import{isSelectableLayer as u}from"../../../views/support/selectionUtils.js";import{goTo as y}from"../goToUtils.js";import f from"./SelectionListGroupLayerItem.js";import d from"./SelectionListLayerItem.js";import{computeEffectiveCount as v,getNestedFeatureItems as S,isSelectionListGroupLayerItem as C,isSelectionListLayerItem as _}from"./selectionListUtils.js";const I=100;let M=class extends t{constructor(e){super(e),this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerItemCache=new Map,this._layerItems=null,this._onChangeAbortController=null,this._updatingHandles=new p,this.featureTitleMap=new Map,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();const e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(s(this._onSelectionChange(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=n(this._onSelectionChangeController,I)}initialize(){this.addHandles([a((()=>[this.view,this.effectiveSelectionManager]),(()=>this._onSelectionChangeDebounced())),l((()=>this.effectiveSelectionManager?.sources),"change",(()=>this._onSelectionChangeDebounced())),l((()=>this.effectiveSelectionManager),"selection-change",(()=>this._onSelectionChangeDebounced()))])}destroy(){this.removeTemporaryHighlight(),this._updatingHandles.destroy()}get effectiveCount(){return v(this.layerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!(!this._onChangeAbortController&&!this._updatingHandles.updating)}get layerItems(){return this._layerItems??[]}get layerViewMap(){const e=new Map,{view:t}=this;if(!t)return e;for(const o of t.allLayerViews)if(e.set(o.layer.id,o),g(o.layer))for(const t of o.layer.sublayers)e.set(t.id,o);return e}get maxVisibleFeatureCountExceeded(){return this.layerItems.some((e=>e.maxVisibleFeatureCountExceeded))}get selectionSources(){const e=this.effectiveSelectionManager,t=new Set;if(e?.sources)for(const o of e.sources)t.add(o);return t}get selectionsByLayerMap(){const e=this.effectiveSelectionManager,t=new Map;if(!e||"ready"!==this.state)return t;for(const{layer:o,selection:r}of e.selections)t.set(o,r);return t}get state(){const{view:e}=this;return e?e.ready?this.effectiveSelectionManager?"ready":"error":"loading":"disabled"}get totalCount(){return this.effectiveSelectionManager?.count??0}get viewLayersAndTables(){const{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}addTemporaryHighlight({graphic:e,layerView:t}){this.removeTemporaryHighlight(),t&&e&&(this._hoverHighlightHandle=t.highlight(e,{name:"temporary"}))}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){const t=e.graphic.getObjectId();null!=t&&this.effectiveSelectionManager?.removeFromSelection(e.layer,[t])}deselectGroupItem(e){const t=S([e]).map((e=>e.graphic)).filter(o);t?.length&&this.effectiveSelectionManager?.updateSelection({added:[],current:[],removed:t})}deselectLayerItem(e){this.effectiveSelectionManager?.setSelection(e.layer,[])}deselectItem(e){C(e)?this.deselectGroupItem(e):_(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}goToItem(e){_(e)||C(e)?this._goTo(S([e]).map((e=>e.graphic))):this._goTo(e.graphic)}layersToItems(e){const{controller:t,layers:o,promises:r}=e,{_groupItemCache:i,_layerItemCache:s,effectiveSelectionManager:n,viewLayersAndTables:a}=this,l=o??a;if(!n)return[];const c=[];for(const h of l)switch(h.type){case"subtype-group":case"group":{const e=i.get(h),o=e??new f({layer:h,viewModel:this});e||i.set(h,o),r.push(o.sync({controller:t,promises:r})),c.push(o)}break;default:if(u(h)||m(h)){const e=h,o=n.getSelection(e);if(!o?.length)continue;const i=s.get(e),a=i??new d({layer:e,viewModel:this});i||s.set(e,a),r.push(a.sync({controller:t,promises:r})),c.push(a)}}return c}removeFromSelection(e){this.effectiveSelectionManager?.removeFromSelection(e.layer,e.objectIds)}removeTemporaryHighlight(){this._hoverHighlightHandle=i(this._hoverHighlightHandle)}selectSingleFeatureItem(e){const t=e.objectId;if(null!=t&&this.effectiveSelectionManager)for(const{layer:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:o,objectIds:o===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t.parent===e.layer?o:[]})}selectSingleItem(e){C(e)?this.selectSingleGroupItem(e):_(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t===e.layer?o:[]})}setSelection(e){this.effectiveSelectionManager?.setSelection(e.layer,e.objectIds)}async _goTo(e){const{view:t}=this;if(t)try{await y(t,e)}catch(o){"AbortError"!==o.name&&r.getLogger(this).warn("Failed to go to feature(s)",o)}}async _onSelectionChange(e){try{this.removeTemporaryHighlight();const t=[],o=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._layerItems=o)}catch(t){r.getLogger(this).warn("Failed updating selection",t)}}};e([c()],M.prototype,"_groupItemCache",void 0),e([c()],M.prototype,"_hoverHighlightHandle",void 0),e([c()],M.prototype,"_layerItemCache",void 0),e([c()],M.prototype,"_layerItems",void 0),e([c()],M.prototype,"_onChangeAbortController",void 0),e([c()],M.prototype,"effectiveCount",null),e([c()],M.prototype,"effectiveSelectionManager",null),e([c()],M.prototype,"featureTitleMap",void 0),e([c()],M.prototype,"isUpdating",null),e([c()],M.prototype,"layerItems",null),e([c()],M.prototype,"layerViewMap",null),e([c()],M.prototype,"maxVisibleFeatureCountExceeded",null),e([c()],M.prototype,"maxVisibleFeatureCountPerLayer",void 0),e([c()],M.prototype,"selectionManager",void 0),e([c()],M.prototype,"selectionSources",null),e([c()],M.prototype,"selectionsByLayerMap",null),e([c()],M.prototype,"state",null),e([c()],M.prototype,"totalCount",null),e([c()],M.prototype,"view",void 0),e([c()],M.prototype,"viewLayersAndTables",null),M=e([h("esri.widgets.support.SelectionList.SelectionListViewModel")],M);const b=M;export{b as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import r from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{ignoreAbortErrors as s,debounce as n}from"../../../core/promiseUtils.js";import{watch as a,on as l}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../../core/support/UpdatingHandles.js";import{isSubtypeGroupLayer as g,isSubtypeSublayer as m}from"../../../layers/support/layerUtils.js";import{isSelectableLayer as u}from"../../../views/support/selectionUtils.js";import{goTo as y}from"../goToUtils.js";import f from"./GroupLayerItem.js";import d from"./LayerItem.js";import{computeEffectiveCount as v,getNestedFeatureItems as S,isGroupLayerItem as C,isLayerItem as _}from"./selectionListUtils.js";const I=100;let M=class extends t{constructor(e){super(e),this._groupItemCache=new Map,this._hoverHighlightHandle=null,this._layerItemCache=new Map,this._layerItems=null,this._onChangeAbortController=null,this._updatingHandles=new p,this.featureTitleMap=new Map,this.maxVisibleFeatureCountPerLayer=500,this.selectionManager=null,this._onSelectionChangeController=async()=>{this._cancelOnSelectionChange();const e=new AbortController;this._onChangeAbortController=e,await this._updatingHandles.addPromise(s(this._onSelectionChange(e))),this._onChangeAbortController===e&&(this._onChangeAbortController=null)},this._cancelOnSelectionChange=()=>this._onChangeAbortController?.abort(),this._onSelectionChangeDebounced=n(this._onSelectionChangeController,I)}initialize(){this.addHandles([a((()=>[this.view,this.effectiveSelectionManager]),(()=>this._onSelectionChangeDebounced())),l((()=>this.effectiveSelectionManager?.sources),"change",(()=>this._onSelectionChangeDebounced())),l((()=>this.effectiveSelectionManager),"selection-change",(()=>this._onSelectionChangeDebounced()))])}destroy(){this.removeTemporaryHighlight(),this._updatingHandles.destroy()}get effectiveCount(){return v(this.layerItems)}get effectiveSelectionManager(){return this.selectionManager??this.view?.selectionManager}get isUpdating(){return!(!this._onChangeAbortController&&!this._updatingHandles.updating)}get layerItems(){return this._layerItems??[]}get layerViewMap(){const e=new Map,{view:t}=this;if(!t)return e;for(const o of t.allLayerViews)if(e.set(o.layer.id,o),g(o.layer))for(const t of o.layer.sublayers)e.set(t.id,o);return e}get maxVisibleFeatureCountExceeded(){return this.layerItems.some((e=>e.maxVisibleFeatureCountExceeded))}get selectionSources(){const e=this.effectiveSelectionManager,t=new Set;if(e?.sources)for(const o of e.sources)t.add(o);return t}get selectionsByLayerMap(){const e=this.effectiveSelectionManager,t=new Map;if(!e||"ready"!==this.state)return t;for(const{layer:o,selection:r}of e.selections)t.set(o,r);return t}get state(){const{view:e}=this;return e?e.ready?this.effectiveSelectionManager?"ready":"error":"loading":"disabled"}get totalCount(){return this.effectiveSelectionManager?.count??0}get viewLayersAndTables(){const{view:e}=this;return e?.map?[...e.map.layers.toArray().reverse(),...e.map.tables.toArray().reverse()]:[]}addTemporaryHighlight({graphic:e,layerView:t}){this.removeTemporaryHighlight(),t&&e&&(this._hoverHighlightHandle=t.highlight(e,{name:"temporary"}))}clear(){this.effectiveSelectionManager?.clear()}deselectFeatureItem(e){const t=e.graphic.getObjectId();null!=t&&this.effectiveSelectionManager?.removeFromSelection(e.layer,[t])}deselectGroupItem(e){const t=S([e]).map((e=>e.graphic)).filter(o);t?.length&&this.effectiveSelectionManager?.updateSelection({added:[],current:[],removed:t})}deselectLayerItem(e){this.effectiveSelectionManager?.setSelection(e.layer,[])}deselectItem(e){C(e)?this.deselectGroupItem(e):_(e)?this.deselectLayerItem(e):this.deselectFeatureItem(e)}goToItem(e){_(e)||C(e)?this._goTo(S([e]).map((e=>e.graphic))):this._goTo(e.graphic)}layersToItems(e){const{controller:t,layers:o,promises:r}=e,{_groupItemCache:i,_layerItemCache:s,effectiveSelectionManager:n,viewLayersAndTables:a}=this,l=o??a;if(!n)return[];const c=[];for(const h of l)switch(h.type){case"subtype-group":case"group":{const e=i.get(h),o=e??new f({layer:h,viewModel:this});e||i.set(h,o),r.push(o.sync({controller:t,promises:r})),c.push(o)}break;default:if(u(h)||m(h)){const e=h,o=n.getSelection(e);if(!o?.length)continue;const i=s.get(e),a=i??new d({layer:e,viewModel:this});i||s.set(e,a),r.push(a.sync({controller:t,promises:r})),c.push(a)}}return c}removeFromSelection(e){this.effectiveSelectionManager?.removeFromSelection(e.layer,e.objectIds)}removeTemporaryHighlight(){this._hoverHighlightHandle=i(this._hoverHighlightHandle)}selectSingleFeatureItem(e){const t=e.objectId;if(null!=t&&this.effectiveSelectionManager)for(const{layer:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:o,objectIds:o===e.layer?[t]:[]})}selectSingleGroupItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t.parent===e.layer?o:[]})}selectSingleItem(e){C(e)?this.selectSingleGroupItem(e):_(e)?this.selectSingleLayerItem(e):this.selectSingleFeatureItem(e)}selectSingleLayerItem(e){if(this.effectiveSelectionManager)for(const{layer:t,selection:o}of this.effectiveSelectionManager.selections)this.setSelection({layer:t,objectIds:t===e.layer?o:[]})}setSelection(e){this.effectiveSelectionManager?.setSelection(e.layer,e.objectIds)}async _goTo(e){const{view:t}=this;if(t)try{await y(t,e)}catch(o){"AbortError"!==o.name&&r.getLogger(this).warn("Failed to go to feature(s)",o)}}async _onSelectionChange(e){try{this.removeTemporaryHighlight();const t=[],o=this.layersToItems({controller:e,promises:t});t.length>0&&await Promise.all(t),this._onChangeAbortController===e&&(this._layerItems=o)}catch(t){r.getLogger(this).warn("Failed updating selection",t)}}};e([c()],M.prototype,"_groupItemCache",void 0),e([c()],M.prototype,"_hoverHighlightHandle",void 0),e([c()],M.prototype,"_layerItemCache",void 0),e([c()],M.prototype,"_layerItems",void 0),e([c()],M.prototype,"_onChangeAbortController",void 0),e([c()],M.prototype,"effectiveCount",null),e([c()],M.prototype,"effectiveSelectionManager",null),e([c()],M.prototype,"featureTitleMap",void 0),e([c()],M.prototype,"isUpdating",null),e([c()],M.prototype,"layerItems",null),e([c()],M.prototype,"layerViewMap",null),e([c()],M.prototype,"maxVisibleFeatureCountExceeded",null),e([c()],M.prototype,"maxVisibleFeatureCountPerLayer",void 0),e([c()],M.prototype,"selectionManager",void 0),e([c()],M.prototype,"selectionSources",null),e([c()],M.prototype,"selectionsByLayerMap",null),e([c()],M.prototype,"state",null),e([c()],M.prototype,"totalCount",null),e([c()],M.prototype,"view",void 0),e([c()],M.prototype,"viewLayersAndTables",null),M=e([h("esri.widgets.support.SelectionList.SelectionListViewModel")],M);const b=M;export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as n}from"../../../core/arrayUtils.js";function t(e){return e.flatMap((n=>i(n)?n.selection:l(n)?n.children.flatMap((n=>t([n]))):n)).filter(n)}function e(t){return t.flatMap((n=>l(n)?n.children.filter((n=>"selection"in n)):i(n)?n:null)).filter(n)}function r(n){let t=0;for(const e of n)i(e)&&(t+=e.total),l(e)&&(t+=r(e.children));return t}function l(n){return null!=n&&"object"==typeof n&&"children"in n}function i(n){return null!=n&&"object"==typeof n&&"selection"in n}function o(n){return null!=n&&"object"==typeof n&&"graphic"in n}export{r as computeEffectiveCount,t as getNestedFeatureItems,e as getNestedLayerItems,o as isSelectionListFeatureItem,l as isSelectionListGroupLayerItem,i as isSelectionListLayerItem};
5
+ import{isSome as n}from"../../../core/arrayUtils.js";function t(e){return e.flatMap((n=>i(n)?n.selection:l(n)?n.children.flatMap((n=>t([n]))):n)).filter(n)}function e(t){return t.flatMap((n=>l(n)?n.children.filter((n=>"selection"in n)):i(n)?n:null)).filter(n)}function r(n){let t=0;for(const e of n)i(e)&&(t+=e.total),l(e)&&(t+=r(e.children));return t}function l(n){return null!=n&&"object"==typeof n&&"children"in n}function i(n){return null!=n&&"object"==typeof n&&"selection"in n}function o(n){return null!=n&&"object"==typeof n&&"graphic"in n}export{r as computeEffectiveCount,t as getNestedFeatureItems,e as getNestedLayerItems,o as isFeatureItem,l as isGroupLayerItem,i as isLayerItem};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Widget.js";import{loadCalciteComponents as l}from"./componentsUtils.js";import{globalCss as n}from"./globalCss.js";import{storeNode as r}from"./widgetUtils.js";import{messageBundle as a}from"./decorators/messageBundle.js";import{tsx as c}from"./jsxFactory.js";import{isSelectionListGroupLayerItem as m,isSelectionListLayerItem as d,isSelectionListFeatureItem as p}from"./SelectionList/selectionListUtils.js";import h from"./SelectionList/SelectionListViewModel.js";import u from"./SelectionList/VisibleElements.js";import{formatNumber as g}from"../../intl/number.js";import{substitute as v}from"../../intl/substitute.js";const I="esri-selection-list",y=`${I}__list-item`,f={base:I,baseSmall:`${I}--small`,baseMedium:`${I}--medium`,baseLarge:`${I}--large`,container:`${I}__container`,notice:`${I}__notice`,listItemFeature:`${y}__feature`,listItemFeatureIcon:`${y}__feature-icon`,listItemIcon:`${y}__icon`,totalCountChip:`${I}__total-count`};let b=class extends o{constructor(e,t){super(e,t),this._list=null,this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const i=e.target;if(this._hasIcon(i))return void t.unobserve(i);const s=this._getListItem(i);if(!s)return;this._setHasIcon(i,!0);const o=await s.fetchThumbnail().catch((()=>(this._setHasIcon(i,!1),null)));if(null==o)return;i.appendChild(o)}}))})),this.displayMode="nested",this.menuScale="m",this.messages=null,this.messagesCommon=null,this.scale="s",this.viewModel=new h,this.visibleElements=new u,this._afterItemCreateOrUpdate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)},this.clear=this.clear.bind(this),this.collapseItems=this.collapseItems.bind(this),this.removeTemporaryHighlight=this.removeTemporaryHighlight.bind(this)}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return l({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")})}get effectiveCount(){return this.viewModel.effectiveCount}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get featureTitleMap(){return this.viewModel.featureTitleMap}get icon(){return"selection"}set icon(e){this._overrideIfSome("icon",e)}get isUpdating(){return this.viewModel.isUpdating}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layerItems(){return this.viewModel.layerItems}get layerViewMap(){return this.viewModel.layerViewMap}get maxVisibleFeatureCountExceeded(){return this.viewModel.maxVisibleFeatureCountExceeded}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}set maxVisibleFeatureCountPerLayer(e){this.viewModel.maxVisibleFeatureCountPerLayer=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get selectionSources(){return this.viewModel.selectionSources}get selectionsByLayerMap(){return this.viewModel.selectionsByLayerMap}get state(){return this.viewModel.state}get totalCount(){return this.viewModel.totalCount}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewLayersAndTables(){return this.viewModel.viewLayersAndTables}addTemporaryHighlight(e){this.viewModel.addTemporaryHighlight(e)}clear(){this.viewModel.clear()}deselectFeatureItem(e){this.viewModel.deselectFeatureItem(e)}deselectGroupItem(e){this.viewModel.deselectGroupItem(e)}deselectLayerItem(e){this.viewModel.deselectLayerItem(e)}deselectItem(e){this.viewModel.deselectItem(e)}collapseItems(){this._list?.filteredItems.forEach((e=>e.open=!1))}goToItem(e){this.viewModel.goToItem(e)}removeFromSelection(e){this.viewModel.removeFromSelection(e)}removeTemporaryHighlight(){this.viewModel.removeTemporaryHighlight()}selectSingleFeatureItem(e){this.viewModel.selectSingleFeatureItem(e)}selectSingleGroupItem(e){this.viewModel.selectSingleGroupItem(e)}selectSingleItem(e){this.viewModel.selectSingleItem(e)}selectSingleLayerItem(e){this.viewModel.selectSingleLayerItem(e)}setSelection(e){this.viewModel.setSelection(e)}render(){return c("div",{class:this.classes(f.base,n.widget,n.panel,this._getBaseCssClass())},c("calcite-panel",{class:f.container,heading:this.visibleElements.header?this.messages.selection:void 0,loading:"loading"===this.state,overlayPositioning:"fixed",scale:this.scale},this._renderList(),this._renderMenuActions(),this._renderTotalChip()))}_renderTotalChip(){const{visibleElements:e}=this;if(!e.totalCountChip||!e.header)return;const{effectiveCount:t}=this,i=g(t),s=v(this.messages.selectionCount,{count:i});return c("calcite-chip",{appearance:"outline",class:f.totalCountChip,closable:t>0,closed:0===t,icon:this.maxVisibleFeatureCountExceeded?"exclamation-mark-triangle":void 0,label:i,scale:this.scale,slot:"header-actions-end",title:s,onCalciteChipClose:this.clear},i)}_renderMenuActions(){const{visibleElements:e}=this;if(!e.header||!e.menu)return;const{menuScale:t}=this,i=0===this.totalCount;return[c("calcite-action",{disabled:i,icon:"reset",onclick:this.clear,scale:t,slot:"header-menu-actions",text:this.messagesCommon.clear,textEnabled:!0}),c("calcite-action",{disabled:i,icon:"folders",onclick:this.collapseItems,scale:t,slot:"header-menu-actions",text:this.messages.collapseAll,textEnabled:!0})]}_renderList(){const e=this.layerItems??[],t=!!(this.visibleElements.filter&&this.effectiveCount>0);return c("calcite-list",{afterCreate:r,bind:this,"data-node-ref":"_list",displayMode:"nested",filterEnabled:t,filterPlaceholder:this.messages.filter,filterPredicate:({value:e})=>null==this._list?.filterText||new RegExp(this._list.filterText,"iu").test(e),interactionMode:"static",label:this.messages.widgetLabel,loading:this.isUpdating,scale:this.scale,selectionMode:"none"},this._renderListContent(e))}_renderListContent(e){return e.map((e=>m(e)?this._renderGroupItem(e):d(e)?this._renderLayerItem(e):null)).filter(t)}_renderItemCountChip(e){if(!this.visibleElements.itemCountChip)return;const{messages:t}=this,{maxVisibleFeatureCountExceeded:i,total:s}=e,o=g(s),l=i?t.tooManyFeatures:v(t.selectionCount,{count:o});return c("calcite-chip",{appearance:"outline",icon:i?"exclamation-mark-triangle":void 0,label:o,scale:"s",slot:"content-end",title:l},o)}_renderItemActions(e){if(!this.visibleElements.itemMenus)return;const{messages:t,messagesCommon:i}=this,s=p(e),o=s?t.deselectFeature:d(e)?t.deselectLayer:t.deselectGroup;return[c("calcite-dropdown",{overlayPositioning:"fixed",scale:this.menuScale,slot:"actions-end",width:"m"},c("calcite-action",{icon:"ellipsis",scale:this.scale,slot:"trigger",text:i.menu,textEnabled:!1}),c("calcite-dropdown-group",{selectionMode:"none"},c("calcite-dropdown-item",{iconStart:"layer-zoom-to",onCalciteDropdownItemSelect:()=>this.goToItem(e)},t.zoomTo),c("calcite-dropdown-item",{iconStart:"selection-filter",onCalciteDropdownItemSelect:()=>this.selectSingleItem(e)},s?t.onlySelectFeature:t.onlySelectThis),c("calcite-dropdown-item",{iconStart:"selection-x",onCalciteDropdownItemSelect:()=>this.deselectItem(e)},o)))]}_renderGroupItem(e){const t=e.title||this.messages.untitledLayer;if(0===e.total)return;if("flat"===this.displayMode)return this._renderListContent(e.children);const{visibleElements:i}=this;return c("calcite-list-item",{closable:!!i.itemCloseActions,iconStart:i.itemIcons?e.iconName:void 0,key:e.key,label:t,open:!0,title:t,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)}},this._renderItemCountChip(e),this._renderItemActions(e),this._renderListContent(e.children))}_renderLayerItem(e){const{messages:t}=this,i=e.title||t.untitledLayer;if(0===e.total)return;if("flat"===this.displayMode)return this._renderItems(e.selection);const{visibleElements:s}=this;return c("calcite-list-item",{closable:!!s.itemCloseActions,iconStart:s.itemIcons?e.iconName:void 0,key:e.key,label:i,open:!0,scale:this.scale,title:i,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)}},this._renderItemCountChip(e),this._renderItemActions(e),this._renderItems(e.selection),e.maxVisibleFeatureCountExceeded?c("calcite-notice",{class:f.notice,icon:"exclamation-mark-triangle",kind:"info",open:!0,scale:this.scale},c("div",{slot:"message"},t.tooManyFeatures)):void 0)}_renderItems(e){return e.map((e=>this._renderItem(e)))}_renderItem(e){const{messages:t,visibleElements:i}=this,s=e.title||t.untitledFeature;return c("calcite-list-item",{class:i.itemIcons?f.listItemFeatureIcon:f.listItemFeature,closable:!!i.itemCloseActions,"data-item":e,key:e.key,label:s,name:s,onblur:this.removeTemporaryHighlight,onfocus:()=>this.addTemporaryHighlight(e),onpointerenter:()=>this.addTemporaryHighlight(e),onpointerleave:this.removeTemporaryHighlight,scale:this.scale,title:s,value:s,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)}},this._renderItemIcon(e),this._renderItemActions(e))}_renderItemIcon(e){if(this.visibleElements.itemIcons)return c("div",{class:f.listItemIcon,key:"content-start",slot:"content-start"},c("span",{afterCreate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,afterUpdate:this._afterItemCreateOrUpdate,"data-has-icon":!1,"data-item":e,key:"icon"}))}_getListItem(e){return e?.["data-item"]}_hasIcon(e){return!!e?.["data-has-icon"]}_setHasIcon(e,t){e&&(e["data-has-icon"]=t)}_getBaseCssClass(){switch(this.scale){case"s":return f.baseSmall;case"m":return f.baseMedium;default:return f.baseLarge}}};e([i()],b.prototype,"_list",void 0),e([i()],b.prototype,"displayMode",void 0),e([i()],b.prototype,"effectiveCount",null),e([i()],b.prototype,"effectiveSelectionManager",null),e([i()],b.prototype,"featureTitleMap",null),e([i()],b.prototype,"icon",null),e([i()],b.prototype,"isUpdating",null),e([i()],b.prototype,"label",null),e([i()],b.prototype,"layerItems",null),e([i()],b.prototype,"layerViewMap",null),e([i()],b.prototype,"maxVisibleFeatureCountExceeded",null),e([i()],b.prototype,"maxVisibleFeatureCountPerLayer",null),e([i()],b.prototype,"menuScale",void 0),e([i(),a("esri/widgets/support/SelectionList/t9n/SelectionList")],b.prototype,"messages",void 0),e([i(),a("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([i()],b.prototype,"scale",void 0),e([i()],b.prototype,"selectionManager",null),e([i()],b.prototype,"selectionSources",null),e([i()],b.prototype,"selectionsByLayerMap",null),e([i()],b.prototype,"state",null),e([i()],b.prototype,"totalCount",null),e([i()],b.prototype,"view",null),e([i()],b.prototype,"viewLayersAndTables",null),e([i()],b.prototype,"viewModel",void 0),e([i({type:u,nonNullable:!0})],b.prototype,"visibleElements",void 0),b=e([s("esri.widgets.support.SelectionList")],b);const w=b;export{w as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import o from"../Widget.js";import{loadCalciteComponents as l}from"./componentsUtils.js";import{globalCss as n}from"./globalCss.js";import{storeNode as r}from"./widgetUtils.js";import{messageBundle as a}from"./decorators/messageBundle.js";import{tsx as c}from"./jsxFactory.js";import{isGroupLayerItem as m,isLayerItem as d,isFeatureItem as p}from"./SelectionList/selectionListUtils.js";import h from"./SelectionList/SelectionListViewModel.js";import u from"./SelectionList/VisibleElements.js";import{formatNumber as g}from"../../intl/number.js";import{substitute as v}from"../../intl/substitute.js";const I="esri-selection-list",y=`${I}__list-item`,f={base:I,baseSmall:`${I}--small`,baseMedium:`${I}--medium`,baseLarge:`${I}--large`,container:`${I}__container`,notice:`${I}__notice`,listItemFeature:`${y}__feature`,listItemFeatureIcon:`${y}__feature-icon`,listItemIcon:`${y}__icon`,totalCountChip:`${I}__total-count`};let b=class extends o{constructor(e,t){super(e,t),this._list=null,this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const i=e.target;if(this._hasIcon(i))return void t.unobserve(i);const s=this._getListItem(i);if(!s)return;this._setHasIcon(i,!0);const o=await s.fetchThumbnail().catch((()=>(this._setHasIcon(i,!1),null)));if(null==o)return;i.appendChild(o)}}))})),this.displayMode="nested",this.menuScale="m",this.messages=null,this.messagesCommon=null,this.scale="s",this.viewModel=new h,this.visibleElements=new u,this._afterItemCreateOrUpdate=e=>{this._iconIntersectionObserver?.observe(e)},this._afterItemRemoved=e=>{this._iconIntersectionObserver?.unobserve(e)},this.clear=this.clear.bind(this),this.collapseItems=this.collapseItems.bind(this),this.removeTemporaryHighlight=this.removeTemporaryHighlight.bind(this)}destroy(){this._iconIntersectionObserver?.disconnect(),this._iconIntersectionObserver=null}loadDependencies(){return l({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")})}get effectiveCount(){return this.viewModel.effectiveCount}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get featureTitleMap(){return this.viewModel.featureTitleMap}get icon(){return"selection"}set icon(e){this._overrideIfSome("icon",e)}get isUpdating(){return this.viewModel.isUpdating}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layerItems(){return this.viewModel.layerItems}get layerViewMap(){return this.viewModel.layerViewMap}get maxVisibleFeatureCountExceeded(){return this.viewModel.maxVisibleFeatureCountExceeded}get maxVisibleFeatureCountPerLayer(){return this.viewModel.maxVisibleFeatureCountPerLayer}set maxVisibleFeatureCountPerLayer(e){this.viewModel.maxVisibleFeatureCountPerLayer=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get selectionSources(){return this.viewModel.selectionSources}get selectionsByLayerMap(){return this.viewModel.selectionsByLayerMap}get state(){return this.viewModel.state}get totalCount(){return this.viewModel.totalCount}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewLayersAndTables(){return this.viewModel.viewLayersAndTables}addTemporaryHighlight(e){this.viewModel.addTemporaryHighlight(e)}clear(){this.viewModel.clear()}deselectFeatureItem(e){this.viewModel.deselectFeatureItem(e)}deselectGroupItem(e){this.viewModel.deselectGroupItem(e)}deselectLayerItem(e){this.viewModel.deselectLayerItem(e)}deselectItem(e){this.viewModel.deselectItem(e)}collapseItems(){this._list?.filteredItems.forEach((e=>e.open=!1))}goToItem(e){this.viewModel.goToItem(e)}removeFromSelection(e){this.viewModel.removeFromSelection(e)}removeTemporaryHighlight(){this.viewModel.removeTemporaryHighlight()}selectSingleFeatureItem(e){this.viewModel.selectSingleFeatureItem(e)}selectSingleGroupItem(e){this.viewModel.selectSingleGroupItem(e)}selectSingleItem(e){this.viewModel.selectSingleItem(e)}selectSingleLayerItem(e){this.viewModel.selectSingleLayerItem(e)}setSelection(e){this.viewModel.setSelection(e)}render(){return c("div",{class:this.classes(f.base,n.widget,n.panel,this._getBaseCssClass())},c("calcite-panel",{class:f.container,heading:this.visibleElements.header?this.messages.selection:void 0,loading:"loading"===this.state,overlayPositioning:"fixed",scale:this.scale},this._renderList(),this._renderMenuActions(),this._renderTotalChip()))}_renderTotalChip(){const{visibleElements:e}=this;if(!e.totalCountChip||!e.header)return;const{effectiveCount:t}=this,i=g(t),s=v(this.messages.selectionCount,{count:i});return c("calcite-chip",{appearance:"outline",class:f.totalCountChip,closable:t>0,closed:0===t,icon:this.maxVisibleFeatureCountExceeded?"exclamation-mark-triangle":void 0,label:i,scale:this.scale,slot:"header-actions-end",title:s,onCalciteChipClose:this.clear},i)}_renderMenuActions(){const{visibleElements:e}=this;if(!e.header||!e.menu)return;const{menuScale:t}=this,i=0===this.totalCount;return[c("calcite-action",{disabled:i,icon:"reset",onclick:this.clear,scale:t,slot:"header-menu-actions",text:this.messagesCommon.clear,textEnabled:!0}),c("calcite-action",{disabled:i,icon:"folders",onclick:this.collapseItems,scale:t,slot:"header-menu-actions",text:this.messages.collapseAll,textEnabled:!0})]}_renderList(){const e=this.layerItems??[],t=!!(this.visibleElements.filter&&this.effectiveCount>0);return c("calcite-list",{afterCreate:r,bind:this,"data-node-ref":"_list",displayMode:"nested",filterEnabled:t,filterPlaceholder:this.messages.filter,filterPredicate:({value:e})=>null==this._list?.filterText||new RegExp(this._list.filterText,"iu").test(e),interactionMode:"static",label:this.messages.widgetLabel,loading:this.isUpdating,scale:this.scale,selectionMode:"none"},this._renderListContent(e))}_renderListContent(e){return e.map((e=>m(e)?this._renderGroupItem(e):d(e)?this._renderLayerItem(e):null)).filter(t)}_renderItemCountChip(e){if(!this.visibleElements.itemCountChip)return;const{messages:t}=this,{maxVisibleFeatureCountExceeded:i,total:s}=e,o=g(s),l=i?t.tooManyFeatures:v(t.selectionCount,{count:o});return c("calcite-chip",{appearance:"outline",icon:i?"exclamation-mark-triangle":void 0,label:o,scale:"s",slot:"content-end",title:l},o)}_renderItemActions(e){if(!this.visibleElements.itemMenus)return;const{messages:t,messagesCommon:i}=this,s=p(e),o=s?t.deselectFeature:d(e)?t.deselectLayer:t.deselectGroup;return[c("calcite-dropdown",{overlayPositioning:"fixed",scale:this.menuScale,slot:"actions-end",width:"m"},c("calcite-action",{icon:"ellipsis",scale:this.scale,slot:"trigger",text:i.menu,textEnabled:!1}),c("calcite-dropdown-group",{selectionMode:"none"},c("calcite-dropdown-item",{iconStart:"layer-zoom-to",onCalciteDropdownItemSelect:()=>this.goToItem(e)},t.zoomTo),c("calcite-dropdown-item",{iconStart:"selection-filter",onCalciteDropdownItemSelect:()=>this.selectSingleItem(e)},s?t.onlySelectFeature:t.onlySelectThis),c("calcite-dropdown-item",{iconStart:"selection-x",onCalciteDropdownItemSelect:()=>this.deselectItem(e)},o)))]}_renderGroupItem(e){const t=e.title||this.messages.untitledLayer;if(0===e.total)return;if("flat"===this.displayMode)return this._renderListContent(e.children);const{visibleElements:i}=this;return c("calcite-list-item",{closable:!!i.itemCloseActions,iconStart:i.itemIcons?e.iconName:void 0,key:e.key,label:t,open:!0,title:t,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)}},this._renderItemCountChip(e),this._renderItemActions(e),this._renderListContent(e.children))}_renderLayerItem(e){const{messages:t}=this,i=e.title||t.untitledLayer;if(0===e.total)return;if("flat"===this.displayMode)return this._renderItems(e.selection);const{visibleElements:s}=this;return c("calcite-list-item",{closable:!!s.itemCloseActions,iconStart:s.itemIcons?e.iconName:void 0,key:e.key,label:i,open:!0,scale:this.scale,title:i,value:e.title,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)}},this._renderItemCountChip(e),this._renderItemActions(e),this._renderItems(e.selection),e.maxVisibleFeatureCountExceeded?c("calcite-notice",{class:f.notice,icon:"exclamation-mark-triangle",kind:"info",open:!0,scale:this.scale},c("div",{slot:"message"},t.tooManyFeatures)):void 0)}_renderItems(e){return e.map((e=>this._renderItem(e)))}_renderItem(e){const{messages:t,visibleElements:i}=this,s=e.title||t.untitledFeature;return c("calcite-list-item",{class:i.itemIcons?f.listItemFeatureIcon:f.listItemFeature,closable:!!i.itemCloseActions,"data-item":e,key:e.key,label:s,name:s,onblur:this.removeTemporaryHighlight,onfocus:()=>this.addTemporaryHighlight(e),onpointerenter:()=>this.addTemporaryHighlight(e),onpointerleave:this.removeTemporaryHighlight,scale:this.scale,title:s,value:s,onCalciteListItemClose:t=>{t.stopPropagation(),this.deselectItem(e)}},this._renderItemIcon(e),this._renderItemActions(e))}_renderItemIcon(e){if(this.visibleElements.itemIcons)return c("div",{class:f.listItemIcon,key:"content-start",slot:"content-start"},c("span",{afterCreate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,afterUpdate:this._afterItemCreateOrUpdate,"data-has-icon":!1,"data-item":e,key:"icon"}))}_getListItem(e){return e?.["data-item"]}_hasIcon(e){return!!e?.["data-has-icon"]}_setHasIcon(e,t){e&&(e["data-has-icon"]=t)}_getBaseCssClass(){switch(this.scale){case"s":return f.baseSmall;case"m":return f.baseMedium;default:return f.baseLarge}}};e([i()],b.prototype,"_list",void 0),e([i()],b.prototype,"displayMode",void 0),e([i()],b.prototype,"effectiveCount",null),e([i()],b.prototype,"effectiveSelectionManager",null),e([i()],b.prototype,"featureTitleMap",null),e([i()],b.prototype,"icon",null),e([i()],b.prototype,"isUpdating",null),e([i()],b.prototype,"label",null),e([i()],b.prototype,"layerItems",null),e([i()],b.prototype,"layerViewMap",null),e([i()],b.prototype,"maxVisibleFeatureCountExceeded",null),e([i()],b.prototype,"maxVisibleFeatureCountPerLayer",null),e([i()],b.prototype,"menuScale",void 0),e([i(),a("esri/widgets/support/SelectionList/t9n/SelectionList")],b.prototype,"messages",void 0),e([i(),a("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([i()],b.prototype,"scale",void 0),e([i()],b.prototype,"selectionManager",null),e([i()],b.prototype,"selectionSources",null),e([i()],b.prototype,"selectionsByLayerMap",null),e([i()],b.prototype,"state",null),e([i()],b.prototype,"totalCount",null),e([i()],b.prototype,"view",null),e([i()],b.prototype,"viewLayersAndTables",null),e([i()],b.prototype,"viewModel",void 0),e([i({type:u,nonNullable:!0})],b.prototype,"visibleElements",void 0),b=e([s("esri.widgets.support.SelectionList")],b);const w=b;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Graphic.js";import o from"../../../core/Accessor.js";import s from"../../../core/Clonable.js";import r from"../../../core/Collection.js";import i from"../../../core/Identifiable.js";import{ignoreAbortErrors as a,debounce as n}from"../../../core/promiseUtils.js";import c from"../../../core/ReactiveMap.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{sqlIn as y}from"../../../core/sql.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{queryAllJSON as p}from"../../../layers/support/featureQueryAll.js";import{isSubtypeSublayer as m}from"../../../layers/support/layerUtils.js";import g from"../../../rest/networks/support/NetworkElement.js";import w from"../../../rest/support/FeatureSet.js";import b from"../../../rest/support/Query.js";import{featureUtilityNetworkFields as _}from"../../Feature/FeatureUtilityNetworkAssociations/resources.js";import{findUtilityNetwork as A}from"../../Feature/support/featureUtils.js";const C=100;let f=class extends(s.ClonableMixin(i.IdentifiableMixin(o))){constructor(t){super(t),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.networkSourceIdsInUse=new Set,this.source="popup",this.description=null,this.graphic=null,this.layer=null,this.map=null,this.featureCount=0,this.associationTypes=null,this.showAllEnabled=!1,this.title=null,this.attachmentsFeatureCount=0,this.structureFeatureCount=0,this.contentFeatureCount=0,this.containerFeatureCount=0,this.connectivityFeatureCount=0,this._queryOpenAssociationType=async()=>{this.activeAssociationType&&await this._queryDebounced(this.activeAssociationType)},this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._queryController=async t=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await a(this._query(t)),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await a(this._queryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryDebounced=n(this._queryController,C),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,C)}initialize(){this.addHandles([l((()=>[this.graphic,this.layer,this.map,this.associationTypes,this.objectId,this.globalId,this.canQuery]),(()=>this.refresh()),u),l((()=>this.activeAssociationType),(t=>this._queryDebounced(t)),u)])}destroy(){this._cancelQuery(),this._cancelQueryFeatureCount(),this._destroyAssociatedFeatureViewModels()}get supportsCacheHint(){return!!this.layer?.capabilities?.query?.supportsCacheHint}get canLoad(){return!!this.map&&!!this.associationTypes&&"string"==typeof this.globalId}get canQuery(){const t=this.layer?.capabilities?.query;return!!this.associationTypes&&"string"==typeof this.globalId&&!!t?.supportsPagination}set displayCount(t){const e=0,o=3;this._set("displayCount",Math.max(t??o,e))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:t}=this;return t?.globalIdField}get activeAssociationType(){return this._get("activeAssociationType")}set activeAssociationType(t){t&&!this.associationTypes.includes(t)||this._set("activeAssociationType",t)}get state(){const{_queryAbortController:t,_queryFeatureCountAbortController:e,_queryPageAbortController:o,canQuery:s,_loaded:r,canLoad:i,source:a}=this;return e||i&&!r?"loading":t||o?"querying":!s||"popup"===a&&0===this.featureCount?"disabled":"ready"}get utilityNetwork(){const{layer:t,map:e}=this;if(!t?.loaded||!e)return null;const o=m(t)?t.parent:t;return A(e,o)}get attachmentsAssociations(){return this._get("attachmentsAssociations")||new r}get structureAssociations(){return this._get("structureAssociations")||new r}get contentAssociations(){return this._get("contentAssociations")||new r}get containerAssociations(){return this._get("containerAssociations")||new r}get connectivityAssociations(){return this._get("connectivityAssociations")||new r}get associationFeatures(){return this._get("associationFeatures")||new c}get associationViewModels(){return this._get("associationViewModels")||new Map}async refresh(){await this._queryFeatureCountDebounced(),await this._queryOpenAssociationType()}getFeatureCountForAssociationType(t){switch(t){case"attachment":return this.attachmentsFeatureCount;case"structure":return this.structureFeatureCount;case"content":return this.contentFeatureCount;case"container":return this.containerFeatureCount;case"connectivity":return this.connectivityFeatureCount}}_destroyAssociatedFeatureViewModels(){this.associationViewModels.forEach((t=>t.destroyAll()))}async _loadUtiltyNetworks(){const t=this.map;if(!t)return;await Promise.allSettled(t.utilityNetworks?.map((async t=>{await t.load()}))??[]);const e=this.utilityNetwork;if(e){const o=t=>{if("layerId"in t&&e.isUtilityLayer(t)){const o=e.getSourceIdByLayerId(t.layerId);null!==o&&this.networkSourceIdsInUse.add(o)}};this._set("networkSourceIdsInUse",new Set),t.allLayers.forEach(o),t.allTables.forEach(o)}}async _findLayersBySourceId(t){const{utilityNetwork:e,map:o}=this,s=t=>{const o=t;if(!t.url)return!1;if(o.layerId===r){return t.url.replace(/\/\d+$/,"")===e?.featureServiceUrl}return!1};await(e?.load());const r=e.getLayerIdBySourceId(t),i=o.allLayers.filter(s),a=o.allTables.filter(s),n=i.concat(a).toArray();return await Promise.allSettled(n.map((t=>t.load()))),n}_clearAssociations(){this.attachmentsAssociations.removeAll(),this.structureAssociations.removeAll(),this.contentAssociations.removeAll(),this.containerAssociations.removeAll(),this.connectivityAssociations.removeAll()}_clearFeatures(){this.associationFeatures.forEach((t=>t.removeAll())),this.associationFeatures.clear()}_getAssociationsByType(t){switch(t){case"attachment":return this.attachmentsAssociations;case"structure":return this.structureAssociations;case"connectivity":return this.connectivityAssociations;case"container":return this.containerAssociations;case"content":return this.contentAssociations}}async _queryLayer(t,e,o,s,r){const i=this._getFeatureQueryWhereClause(t,e,o,s),a=new b({where:i,outFields:["*"],cacheHint:this.supportsCacheHint}),n=w.fromJSON(await p(t,a,r));return n.features.forEach((e=>{e.layer=t,e.sourceLayer=t})),n.features}async _createAssociationFeatureObjects(t,e,o,s,r,i){if(0===t.length)return[];const a=new Map;for(const[c,l]of e){const t=await this._findLayersBySourceId(c);for(const e of t){(await this._queryLayer(e,l,s,r,i)).forEach((t=>{if("popup"===this.source?t.layer&&t.getEffectivePopupTemplate():!!t.layer){const o=a.get(t.attributes[e.globalIdField])??[];o.push(t),a.set(t.attributes[e.globalIdField],o)}}))}}const n=[];return await Promise.all(t.toArray().map((async t=>{const{fromNetworkElement:e,toNetworkElement:s}=t,r=e.globalId===o?s:e,i=a.get(r.globalId)??[];await Promise.all(i.map((async e=>{const o=this.utilityNetwork?.getTerminalById(r?.terminalId)?.name;if(e.layer&&"getFeatureTitle"in e.layer){const s=await e.layer.getFeatureTitle(e);n.push({title:s,association:t,feature:e,terminalName:o})}else n.push({association:t,feature:e,terminalName:o})})))}))),n}_parseFeatureObjects(t,e){t.forEach((t=>{const o=t?.feature,s=o.layer,i=e.get(s)??new r;i.add(t),e.set(s,i)}))}async _queryAssociations(t){const{layer:e,globalId:o,associationTypes:s,utilityNetwork:r,canQuery:i}=this;if(await Promise.allSettled([e?.load(),r?.load()]),this._clearAssociations(),!(i&&e&&s&&r&&o))return;const a=m(e)?e.parent:e,n=new g({globalId:o,networkSourceId:r.getSourceIdByLayerId(a.layerId)}),c=new Set;s.forEach((t=>{switch(t.type){case"attachment":case"structure":c.add("attachment");break;case"container":case"content":c.add("containment");break;case"connectivity":c.add("connectivity"),c.add("junction-junction-connectivity"),c.add("junction-edge-from-connectivity"),c.add("junction-edge-midspan-connectivity"),c.add("junction-edge-to-connectivity")}}));const l=await(r?.queryAssociations({elements:[n],types:Array.from(c)},{signal:t?.signal})),u=new Map,y=new Map;s.forEach((t=>{y.set(t.type,t),u.set(t.type,[])})),l.forEach((t=>{const{toNetworkElement:e,fromNetworkElement:s}=t;switch(t.associationType){case"connectivity":case"junction-junction-connectivity":case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":if(s?.globalId===o){if(this._shouldDiscardNetworkElement(e,"connectivity",y))break;u.get("connectivity")?.push(e.globalId)}else{if(this._shouldDiscardNetworkElement(s,"connectivity",y))break;u.get("connectivity")?.push(s.globalId)}this.connectivityAssociations.add(t);break;case"containment":if(s?.globalId===o){if(this._shouldDiscardNetworkElement(e,"content",y))break;u.get("content")?.push(e.globalId),this.contentAssociations.add(t)}else{if(this._shouldDiscardNetworkElement(s,"container",y))break;u.get("container")?.push(s.globalId),this.containerAssociations.add(t)}break;case"attachment":if(s?.globalId===o){if(this._shouldDiscardNetworkElement(e,"attachment",y))break;u.get("attachment")?.push(e.globalId),this.attachmentsAssociations.add(t)}else{if(this._shouldDiscardNetworkElement(s,"structure",y))break;u.get("structure")?.push(s.globalId),this.structureAssociations.add(t)}}}));const d=s.map((async e=>{const{associatedNetworkSourceId:o,associatedAssetGroup:s,associatedAssetType:r}=e,i=u.get(e.type),a=null!=s?await this._countAssociatedFeatures(o,i,s,r,t):i.length;switch(e.type){case"attachment":this._set("attachmentsFeatureCount",a);break;case"structure":this._set("structureFeatureCount",a);break;case"content":this._set("contentFeatureCount",a);break;case"container":this._set("containerFeatureCount",a);break;case"connectivity":this._set("connectivityFeatureCount",a)}}));await Promise.allSettled(d)}async _countAssociatedFeatureCount(t,e,o,s,r){const i=this._getFeatureQueryWhereClause(t,e,o,s);return t.queryFeatureCount({where:i,outFields:["*"],returnGeometry:!1},{signal:r?.signal})}async _countAssociatedFeatures(t,e,o,s,r){if(0===e.length)return 0;const i=(await this._findLayersBySourceId(t)).map((async t=>this._countAssociatedFeatureCount(t,e,o,s,r)));return(await Promise.all(i)).reduce(((t,e)=>t+e),0)}async _queryAssociatedFeatures(t,e){const{layer:o,globalId:s,associationTypes:r,utilityNetwork:i,canQuery:a,associationFeatures:n}=this;if(await Promise.allSettled([o?.load(),i?.load()]),!(a&&o&&r&&i))return;const c=this._getAssociationsByType(t.type),{associatedAssetGroup:l,associatedAssetType:u}=t,y=new Map;c.forEach((t=>{const{fromNetworkElement:e,toNetworkElement:o}=t,{networkSourceId:r,elementGlobalId:i}=e.globalId===s?{networkSourceId:o.networkSourceId,elementGlobalId:o.globalId}:{networkSourceId:e.networkSourceId,elementGlobalId:e.globalId},a=y.get(r)||[];a.push(i),y.set(r,a)}));const d=await this._createAssociationFeatureObjects(c,y,s,l,u,e);this._parseFeatureObjects(d,n)}async _queryFeatureCount(){await this._loadUtiltyNetworks();const{_queryFeatureCountAbortController:t,canQuery:e}=this;e?(await this._queryAssociations(t),this._set("featureCount",this.attachmentsFeatureCount+this.structureFeatureCount+this.contentFeatureCount+this.containerFeatureCount+this.connectivityFeatureCount)):this._set("featureCount",0)}async _query(t){if(!t)return;await this._loadUtiltyNetworks();const{_queryAbortController:e}=this;this._destroyAssociatedFeatureViewModels(),this._clearFeatures(),0!==this.featureCount&&(this.destroyed||await this._queryAssociatedFeatures(t,{signal:e?.signal}))}_shouldDiscardNetworkElement(t,e,o){if(!t)return!1;const{networkSourceIdsInUse:s}=this,{networkSourceId:r}=t,i=o.get(e)?.associatedNetworkSourceId,a=s.has(r);return null!=i&&i!==r||!a}_getFeatureQueryWhereClause(t,e,o,s){const r=t.globalIdField,i=t.fieldsIndex.get(_.assetGroup),a=t.fieldsIndex.get(_.assetType),n=null!=o,c=null!=s;return[r?y(r,e):null,n?`(${i?.name} = ${o})`:null,n&&c?`(${a?.name} = ${s})`:null].filter(Boolean).join(" AND ")}};t([d()],f.prototype,"_loaded",void 0),t([d()],f.prototype,"_queryAbortController",void 0),t([d()],f.prototype,"_queryPageAbortController",void 0),t([d()],f.prototype,"_queryFeatureCountAbortController",void 0),t([d({readOnly:!0})],f.prototype,"supportsCacheHint",null),t([d({readOnly:!0})],f.prototype,"canLoad",null),t([d({readOnly:!0})],f.prototype,"canQuery",null),t([d()],f.prototype,"networkSourceIdsInUse",void 0),t([d({constructOnly:!0})],f.prototype,"source",void 0),t([d()],f.prototype,"description",void 0),t([d({value:3})],f.prototype,"displayCount",null),t([d({type:e})],f.prototype,"graphic",void 0),t([d()],f.prototype,"layer",void 0),t([d()],f.prototype,"map",void 0),t([d({readOnly:!0})],f.prototype,"objectId",null),t([d({readOnly:!0})],f.prototype,"objectIdField",null),t([d({readOnly:!0})],f.prototype,"globalId",null),t([d({readOnly:!0})],f.prototype,"globalIdField",null),t([d()],f.prototype,"featureCount",void 0),t([d()],f.prototype,"associationTypes",void 0),t([d()],f.prototype,"activeAssociationType",null),t([d()],f.prototype,"showAllEnabled",void 0),t([d()],f.prototype,"state",null),t([d()],f.prototype,"title",void 0),t([d({readOnly:!0})],f.prototype,"utilityNetwork",null),t([d({readOnly:!0})],f.prototype,"attachmentsFeatureCount",void 0),t([d({readOnly:!0})],f.prototype,"structureFeatureCount",void 0),t([d({readOnly:!0})],f.prototype,"attachmentsAssociations",null),t([d({readOnly:!0})],f.prototype,"structureAssociations",null),t([d({readOnly:!0})],f.prototype,"contentFeatureCount",void 0),t([d({readOnly:!0})],f.prototype,"containerFeatureCount",void 0),t([d({readOnly:!0})],f.prototype,"contentAssociations",null),t([d({readOnly:!0})],f.prototype,"containerAssociations",null),t([d({readOnly:!0})],f.prototype,"connectivityFeatureCount",void 0),t([d({readOnly:!0})],f.prototype,"connectivityAssociations",null),t([d({readOnly:!0})],f.prototype,"associationFeatures",null),t([d({readOnly:!0})],f.prototype,"associationViewModels",null),f=t([h("esri.widgets.support.UtilityNetworkAssociations.FeatureUtilityNetworkAssociationsViewModel")],f);const F=f;export{F as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Graphic.js";import o from"../../../core/Accessor.js";import s from"../../../core/Clonable.js";import r from"../../../core/Collection.js";import a from"../../../core/Identifiable.js";import{ignoreAbortErrors as i,debounce as n}from"../../../core/promiseUtils.js";import c from"../../../core/ReactiveMap.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{sqlIn as y}from"../../../core/sql.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{queryAllJSON as p}from"../../../layers/support/featureQueryAll.js";import{isSubtypeSublayer as m,isSubtypeGroupLayer as g}from"../../../layers/support/layerUtils.js";import b from"../../../rest/networks/support/NetworkElement.js";import w from"../../../rest/support/FeatureSet.js";import _ from"../../../rest/support/Query.js";import{featureUtilityNetworkFields as A}from"../../Feature/FeatureUtilityNetworkAssociations/resources.js";import{findUtilityNetwork as f}from"../../Feature/support/featureUtils.js";const C=100;let F=class extends(s.ClonableMixin(a.IdentifiableMixin(o))){constructor(t){super(t),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.networkSourceIdsInUse=new Set,this.source="popup",this.description=null,this.graphic=null,this.layer=null,this.map=null,this.featureCount=0,this.associationTypes=null,this.showAllEnabled=!1,this.title=null,this.attachmentsFeatureCount=0,this.structureFeatureCount=0,this.contentFeatureCount=0,this.containerFeatureCount=0,this.connectivityFeatureCount=0,this._queryOpenAssociationType=async()=>{this.activeAssociationType&&await this._queryDebounced(this.activeAssociationType)},this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._queryController=async t=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query(t)),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryDebounced=n(this._queryController,C),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,C)}initialize(){this.addHandles([l((()=>[this.graphic,this.layer,this.map,this.associationTypes,this.objectId,this.globalId,this.canQuery]),(()=>this.refresh()),u),l((()=>this.activeAssociationType),(t=>this._queryDebounced(t)),u)])}destroy(){this._cancelQuery(),this._cancelQueryFeatureCount(),this._destroyAssociatedFeatureViewModels()}get supportsCacheHint(){return!!this.layer?.capabilities?.query?.supportsCacheHint}get canLoad(){return!!this.map&&!!this.associationTypes&&"string"==typeof this.globalId}get canQuery(){const t=this.layer?.capabilities?.query;return!!this.associationTypes&&"string"==typeof this.globalId&&!!t?.supportsPagination}set displayCount(t){const e=0,o=3;this._set("displayCount",Math.max(t??o,e))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:t}=this;return t?.globalIdField}get activeAssociationType(){return this._get("activeAssociationType")}set activeAssociationType(t){t&&!this.associationTypes.includes(t)||this._set("activeAssociationType",t)}get state(){const{_queryAbortController:t,_queryFeatureCountAbortController:e,_queryPageAbortController:o,canQuery:s,_loaded:r,canLoad:a,source:i}=this;return e||a&&!r?"loading":t||o?"querying":!s||"popup"===i&&0===this.featureCount?"disabled":"ready"}get utilityNetwork(){const{layer:t,map:e}=this;if(!t?.loaded||!e)return null;const o=m(t)?t.parent:t;return f(e,o)}get attachmentsAssociations(){return this._get("attachmentsAssociations")||new r}get structureAssociations(){return this._get("structureAssociations")||new r}get contentAssociations(){return this._get("contentAssociations")||new r}get containerAssociations(){return this._get("containerAssociations")||new r}get connectivityAssociations(){return this._get("connectivityAssociations")||new r}get associationFeatures(){return this._get("associationFeatures")||new c}get associationViewModels(){return this._get("associationViewModels")||new Map}async refresh(){await this._queryFeatureCountDebounced(),await this._queryOpenAssociationType()}getFeatureCountForAssociationType(t){switch(t){case"attachment":return this.attachmentsFeatureCount;case"structure":return this.structureFeatureCount;case"content":return this.contentFeatureCount;case"container":return this.containerFeatureCount;case"connectivity":return this.connectivityFeatureCount}}_destroyAssociatedFeatureViewModels(){this.associationViewModels.forEach((t=>t.destroyAll()))}async _loadUtiltyNetworks(){const t=this.map;if(!t)return;await Promise.allSettled(t.utilityNetworks?.map((async t=>{await t.load()}))??[]);const e=this.utilityNetwork;if(e){const o=t=>{if("layerId"in t&&e.isUtilityLayer(t)){const o=e.getSourceIdByLayerId(t.layerId);null!==o&&this.networkSourceIdsInUse.add(o)}};this._set("networkSourceIdsInUse",new Set),t.allLayers.forEach(o),t.allTables.forEach(o)}}async _findLayersBySourceId(t){const{utilityNetwork:e,map:o}=this,s=t=>{const o=t;if(!t.url)return!1;if(o.layerId===r){return t.url.replace(/\/\d+$/,"")===e?.featureServiceUrl}return!1};await(e?.load());const r=e.getLayerIdBySourceId(t),a=o.allLayers.filter(s),i=o.allTables.filter(s),n=a.concat(i).toArray();return await Promise.allSettled(n.map((t=>t.load()))),n}_clearAssociations(){this.attachmentsAssociations.removeAll(),this.structureAssociations.removeAll(),this.contentAssociations.removeAll(),this.containerAssociations.removeAll(),this.connectivityAssociations.removeAll()}_clearFeatures(){this.associationFeatures.forEach((t=>t.removeAll())),this.associationFeatures.clear()}_getAssociationsByType(t){switch(t){case"attachment":return this.attachmentsAssociations;case"structure":return this.structureAssociations;case"connectivity":return this.connectivityAssociations;case"container":return this.containerAssociations;case"content":return this.contentAssociations}}async _queryLayer(t,e,o,s,r){const a=this._getFeatureQueryWhereClause(t,e,o,s),i=new _({where:a,outFields:["*"],cacheHint:this.supportsCacheHint}),n=w.fromJSON(await p(t,i,r));return n.features.forEach((e=>{e.layer=e.sourceLayer=g(t)?t.findSublayerForFeature(e):t})),n.features}async _createAssociationFeatureObjects(t,e,o,s,r,a){if(0===t.length)return[];const i=new Map;for(const[c,l]of e){const t=await this._findLayersBySourceId(c);for(const e of t){(await this._queryLayer(e,l,s,r,a)).forEach((t=>{if("popup"===this.source?t.layer&&t.getEffectivePopupTemplate():!!t.layer){const o=i.get(t.attributes[e.globalIdField])??[];o.push(t),i.set(t.attributes[e.globalIdField],o)}}))}}const n=[];return await Promise.all(t.toArray().map((async t=>{const{fromNetworkElement:e,toNetworkElement:s}=t,r=e.globalId===o?s:e,a=i.get(r.globalId)??[];await Promise.all(a.map((async e=>{const o=this.utilityNetwork?.getTerminalById(r?.terminalId)?.name;if(e.layer&&"getFeatureTitle"in e.layer){const s=await e.layer.getFeatureTitle(e);n.push({title:s,association:t,feature:e,terminalName:o})}else n.push({association:t,feature:e,terminalName:o})})))}))),n}_parseFeatureObjects(t,e){t.forEach((t=>{const o=t?.feature,s=o.layer,a=e.get(s)??new r;a.add(t),e.set(s,a)}))}async _queryAssociations(t){const{layer:e,globalId:o,associationTypes:s,utilityNetwork:r,canQuery:a}=this;if(await Promise.allSettled([e?.load(),r?.load()]),this._clearAssociations(),!(a&&e&&s&&r&&o))return;const i=m(e)?e.parent:e,n=new b({globalId:o,networkSourceId:r.getSourceIdByLayerId(i.layerId)}),c=new Set;s.forEach((t=>{switch(t.type){case"attachment":case"structure":c.add("attachment");break;case"container":case"content":c.add("containment");break;case"connectivity":c.add("connectivity"),c.add("junction-junction-connectivity"),c.add("junction-edge-from-connectivity"),c.add("junction-edge-midspan-connectivity"),c.add("junction-edge-to-connectivity")}}));const l=await(r?.queryAssociations({elements:[n],types:Array.from(c)},{signal:t?.signal})),u=new Map,y=new Map;s.forEach((t=>{y.set(t.type,t),u.set(t.type,[])})),l.forEach((t=>{const{toNetworkElement:e,fromNetworkElement:s}=t;switch(t.associationType){case"connectivity":case"junction-junction-connectivity":case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":if(s?.globalId===o){if(this._shouldDiscardNetworkElement(e,"connectivity",y))break;u.get("connectivity")?.push(e.globalId)}else{if(this._shouldDiscardNetworkElement(s,"connectivity",y))break;u.get("connectivity")?.push(s.globalId)}this.connectivityAssociations.add(t);break;case"containment":if(s?.globalId===o){if(this._shouldDiscardNetworkElement(e,"content",y))break;u.get("content")?.push(e.globalId),this.contentAssociations.add(t)}else{if(this._shouldDiscardNetworkElement(s,"container",y))break;u.get("container")?.push(s.globalId),this.containerAssociations.add(t)}break;case"attachment":if(s?.globalId===o){if(this._shouldDiscardNetworkElement(e,"attachment",y))break;u.get("attachment")?.push(e.globalId),this.attachmentsAssociations.add(t)}else{if(this._shouldDiscardNetworkElement(s,"structure",y))break;u.get("structure")?.push(s.globalId),this.structureAssociations.add(t)}}}));const d=s.map((async e=>{const{associatedNetworkSourceId:o,associatedAssetGroup:s,associatedAssetType:r}=e,a=u.get(e.type),i=null!=s?await this._countAssociatedFeatures(o,a,s,r,t):a.length;switch(e.type){case"attachment":this._set("attachmentsFeatureCount",i);break;case"structure":this._set("structureFeatureCount",i);break;case"content":this._set("contentFeatureCount",i);break;case"container":this._set("containerFeatureCount",i);break;case"connectivity":this._set("connectivityFeatureCount",i)}}));await Promise.allSettled(d)}async _countAssociatedFeatureCount(t,e,o,s,r){const a=this._getFeatureQueryWhereClause(t,e,o,s);return t.queryFeatureCount({where:a,outFields:["*"],returnGeometry:!1},{signal:r?.signal})}async _countAssociatedFeatures(t,e,o,s,r){if(0===e.length)return 0;const a=(await this._findLayersBySourceId(t)).map((async t=>this._countAssociatedFeatureCount(t,e,o,s,r)));return(await Promise.all(a)).reduce(((t,e)=>t+e),0)}async _queryAssociatedFeatures(t,e){const{layer:o,globalId:s,associationTypes:r,utilityNetwork:a,canQuery:i,associationFeatures:n}=this;if(await Promise.allSettled([o?.load(),a?.load()]),!(i&&o&&r&&a))return;const c=this._getAssociationsByType(t.type),{associatedAssetGroup:l,associatedAssetType:u}=t,y=new Map;c.forEach((t=>{const{fromNetworkElement:e,toNetworkElement:o}=t,{networkSourceId:r,elementGlobalId:a}=e.globalId===s?{networkSourceId:o.networkSourceId,elementGlobalId:o.globalId}:{networkSourceId:e.networkSourceId,elementGlobalId:e.globalId},i=y.get(r)||[];i.push(a),y.set(r,i)}));const d=await this._createAssociationFeatureObjects(c,y,s,l,u,e);this._parseFeatureObjects(d,n)}async _queryFeatureCount(){await this._loadUtiltyNetworks();const{_queryFeatureCountAbortController:t,canQuery:e}=this;e?(await this._queryAssociations(t),this._set("featureCount",this.attachmentsFeatureCount+this.structureFeatureCount+this.contentFeatureCount+this.containerFeatureCount+this.connectivityFeatureCount)):this._set("featureCount",0)}async _query(t){if(!t)return;await this._loadUtiltyNetworks();const{_queryAbortController:e}=this;this._destroyAssociatedFeatureViewModels(),this._clearFeatures(),0!==this.featureCount&&(this.destroyed||await this._queryAssociatedFeatures(t,{signal:e?.signal}))}_shouldDiscardNetworkElement(t,e,o){if(!t)return!1;const{networkSourceIdsInUse:s}=this,{networkSourceId:r}=t,a=o.get(e)?.associatedNetworkSourceId,i=s.has(r);return null!=a&&a!==r||!i}_getFeatureQueryWhereClause(t,e,o,s){const r=t.globalIdField,a=t.fieldsIndex.get(A.assetGroup),i=t.fieldsIndex.get(A.assetType),n=null!=o,c=null!=s;return[r?y(r,e):null,n?`(${a?.name} = ${o})`:null,n&&c?`(${i?.name} = ${s})`:null].filter(Boolean).join(" AND ")}};t([d()],F.prototype,"_loaded",void 0),t([d()],F.prototype,"_queryAbortController",void 0),t([d()],F.prototype,"_queryPageAbortController",void 0),t([d()],F.prototype,"_queryFeatureCountAbortController",void 0),t([d({readOnly:!0})],F.prototype,"supportsCacheHint",null),t([d({readOnly:!0})],F.prototype,"canLoad",null),t([d({readOnly:!0})],F.prototype,"canQuery",null),t([d()],F.prototype,"networkSourceIdsInUse",void 0),t([d({constructOnly:!0})],F.prototype,"source",void 0),t([d()],F.prototype,"description",void 0),t([d({value:3})],F.prototype,"displayCount",null),t([d({type:e})],F.prototype,"graphic",void 0),t([d()],F.prototype,"layer",void 0),t([d()],F.prototype,"map",void 0),t([d({readOnly:!0})],F.prototype,"objectId",null),t([d({readOnly:!0})],F.prototype,"objectIdField",null),t([d({readOnly:!0})],F.prototype,"globalId",null),t([d({readOnly:!0})],F.prototype,"globalIdField",null),t([d()],F.prototype,"featureCount",void 0),t([d()],F.prototype,"associationTypes",void 0),t([d()],F.prototype,"activeAssociationType",null),t([d()],F.prototype,"showAllEnabled",void 0),t([d()],F.prototype,"state",null),t([d()],F.prototype,"title",void 0),t([d({readOnly:!0})],F.prototype,"utilityNetwork",null),t([d({readOnly:!0})],F.prototype,"attachmentsFeatureCount",void 0),t([d({readOnly:!0})],F.prototype,"structureFeatureCount",void 0),t([d({readOnly:!0})],F.prototype,"attachmentsAssociations",null),t([d({readOnly:!0})],F.prototype,"structureAssociations",null),t([d({readOnly:!0})],F.prototype,"contentFeatureCount",void 0),t([d({readOnly:!0})],F.prototype,"containerFeatureCount",void 0),t([d({readOnly:!0})],F.prototype,"contentAssociations",null),t([d({readOnly:!0})],F.prototype,"containerAssociations",null),t([d({readOnly:!0})],F.prototype,"connectivityFeatureCount",void 0),t([d({readOnly:!0})],F.prototype,"connectivityAssociations",null),t([d({readOnly:!0})],F.prototype,"associationFeatures",null),t([d({readOnly:!0})],F.prototype,"associationViewModels",null),F=t([h("esri.widgets.support.UtilityNetworkAssociations.FeatureUtilityNetworkAssociationsViewModel")],F);const I=F;export{I as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4587],{4341:(t,e,n)=>{n.d(e,{I:()=>o});var i=n(26390);class o{constructor(t){this._allocator=t,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,i.d)((()=>this._reset())),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){const t=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*r);this._items.length=Math.min(t,this._items.length),this._itemsPtr=0}_grow(){for(let t=0;t<Math.max(8,Math.min(this._items.length,r));t++)this._items.push(this._allocator())}}const r=1024},11964:(t,e,n)=>{n.d(e,{Cr:()=>h,H6:()=>l,_I:()=>d,kb:()=>u,vt:()=>a});var i=n(34727),o=n(4341),r=n(38954),s=n(51850),c=n(32114);function a(t){return t?{origin:(0,s.o8)(t.origin),vector:(0,s.o8)(t.vector)}:{origin:(0,s.vt)(),vector:(0,s.vt)()}}function h(t,e,n=a()){return(0,r.c)(n.origin,t),(0,r.d)(n.vector,e,t),n}function u(t,e){const n=(0,r.d)(c.rq.get(),e,t.origin),o=(0,r.f)(t.vector,n),s=(0,r.f)(t.vector,t.vector),a=(0,i.qE)(o/s,0,1),h=(0,r.d)(c.rq.get(),(0,r.h)(c.rq.get(),t.vector,a),n);return(0,r.f)(h,h)}function d(t,e,n){return l(t,e,0,1,n)}function l(t,e,n,o,s){const{vector:a,origin:h}=t,u=(0,r.d)(c.rq.get(),e,h),d=(0,r.f)(a,u)/(0,r.k)(a);return(0,r.h)(s,a,(0,i.qE)(d,n,o)),(0,r.g)(s,s,t.origin)}(0,s.vt)(),(0,s.vt)(),new o.I((()=>a()))},24587:(t,e,n)=>{n.r(e),n.d(e,{default:()=>it});var i,o,r,s=n(90237),c=n(74887),a=(n(53966),n(44208),n(87811),n(49186),n(40608)),h=n(38954),u=n(51850),d=n(11964),l=n(97937),f=n(93687),_=n(3694),m=n(4341),g=(n(58083),n(87317),n(91829)),T=n(71351);function p(t){return t?{ray:(0,T.vt)(t.ray),c0:t.c0,c1:t.c1}:{ray:(0,T.vt)(),c0:0,c1:Number.MAX_VALUE}}function O(t,e){for(let n=0;n<b;n++){const i=t[n];if(i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]>=e[3])return!1}return!0}new m.I((()=>p())),n(240),n(32114),(r=i||(i={}))[r.LEFT=0]="LEFT",r[r.RIGHT=1]="RIGHT",r[r.BOTTOM=2]="BOTTOM",r[r.TOP=3]="TOP",r[r.NEAR=4]="NEAR",r[r.FAR=5]="FAR",function(t){t[t.NEAR_BOTTOM_LEFT=0]="NEAR_BOTTOM_LEFT",t[t.NEAR_BOTTOM_RIGHT=1]="NEAR_BOTTOM_RIGHT",t[t.NEAR_TOP_RIGHT=2]="NEAR_TOP_RIGHT",t[t.NEAR_TOP_LEFT=3]="NEAR_TOP_LEFT",t[t.FAR_BOTTOM_LEFT=4]="FAR_BOTTOM_LEFT",t[t.FAR_BOTTOM_RIGHT=5]="FAR_BOTTOM_RIGHT",t[t.FAR_TOP_RIGHT=6]="FAR_TOP_RIGHT",t[t.FAR_TOP_LEFT=7]="FAR_TOP_LEFT"}(o||(o={})),o.FAR_BOTTOM_RIGHT,o.NEAR_BOTTOM_RIGHT,o.NEAR_BOTTOM_LEFT,o.FAR_BOTTOM_LEFT,o.NEAR_BOTTOM_LEFT,o.NEAR_BOTTOM_RIGHT,o.NEAR_TOP_RIGHT,o.NEAR_TOP_LEFT,o.FAR_BOTTOM_RIGHT,o.FAR_BOTTOM_LEFT,o.FAR_TOP_LEFT,o.FAR_TOP_RIGHT,o.NEAR_BOTTOM_RIGHT,o.FAR_BOTTOM_RIGHT,o.FAR_TOP_RIGHT,o.NEAR_TOP_RIGHT,o.FAR_BOTTOM_LEFT,o.NEAR_BOTTOM_LEFT,o.NEAR_TOP_LEFT,o.FAR_TOP_LEFT,o.FAR_TOP_LEFT,o.NEAR_TOP_LEFT,o.NEAR_TOP_RIGHT,o.FAR_TOP_RIGHT;const b=6;(0,g.fA)(-1,-1,-1,1),(0,g.fA)(1,-1,-1,1),(0,g.fA)(1,1,-1,1),(0,g.fA)(-1,1,-1,1),(0,g.fA)(-1,-1,1,1),(0,g.fA)(1,-1,1,1),(0,g.fA)(1,1,1,1),(0,g.fA)(-1,1,1,1),new m.I(p),(0,u.vt)(),(0,u.vt)(),(0,u.vt)(),(0,u.vt)(),(0,u.vt)(),(0,u.vt)(),(0,u.vt)(),(0,u.vt)();var A,R,v=n(620);class M{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(t,e){this.objectToBoundingSphere=t,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new E,this._objectCount=0,e&&(void 0!==e.maximumObjectsPerNode&&(this._maximumObjectsPerNode=e.maximumObjectsPerNode),void 0!==e.maximumDepth&&(this._maximumDepth=e.maximumDepth))}destroy(){this._degenerateObjects.clear(),E.clearPool(),D[0]=null,J.prune(),$.prune()}add(t,e=t.length){this._objectCount+=e,this._grow(t,e);const n=E.acquire();for(let i=0;i<e;i++){const e=t[i];this._isDegenerate(e)?this._degenerateObjects.add(e):(n.init(this._root),this._add(e,n))}E.release(n)}remove(t,e=null){this._objectCount-=t.length;const n=E.acquire();for(const i of t){const t=e??(0,l.e)(this.objectToBoundingSphere(i),W);w(t[3])?(n.init(this._root),x(i,t,n)):this._degenerateObjects.delete(i)}E.release(n),this._shrink()}update(t,e){if(!w(e[3])&&this._isDegenerate(t))return;const n=function(t){return D[0]=t,D}(t);this.remove(n,e),this.add(n)}forEachAlongRay(t,e,n){const i=(0,T.LV)(t,e);S(this._root,(t=>{if(!function(t,e){return I((0,l.a)(e.bounds),2*-e.halfSize,V),I((0,l.a)(e.bounds),2*e.halfSize,K),(0,v.O_)(t.origin,t.direction,V,K)}(i,t))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObject(i,t)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObject(i,t)&&n(t)})),!0}))}forEachAlongRayWithVerticalOffset(t,e,n,i){const o=(0,T.LV)(t,e);S(this._root,(t=>{if(!function(t,e,n){return I((0,l.a)(e.bounds),2*-e.halfSize,V),I((0,l.a)(e.bounds),2*e.halfSize,K),n.applyToMinMax(V,K),(0,v.O_)(t.origin,t.direction,V,K)}(o,t,i))return!1;const e=t.node;return e.terminals.forAll((t=>{this._intersectsObjectWithOffset(o,t,i)&&n(t)})),null!==e.residents&&e.residents.forAll((t=>{this._intersectsObjectWithOffset(o,t,i)&&n(t)})),!0}))}forEach(t){S(this._root,(e=>{const n=e.node;return n.terminals.forAll(t),null!==n.residents&&n.residents.forAll(t),!0})),this._degenerateObjects.forEach(t)}forEachDegenerateObject(t){this._degenerateObjects.forEach(t)}findClosest(t,e,n,i=()=>!0,o=1/0){let r=1/0,s=1/0,c=null;const a=C(t,e),u=a=>{if(--o,!i(a))return;const h=this.objectToBoundingSphere(a);if(!O(n,h))return;const u=z(t,e,(0,l.a)(h)),d=u-h[3],f=u+h[3];d<r&&(r=d,s=f,c=a)};return F(this._root,(i=>{if(o<=0||!O(n,i.bounds))return!1;if((0,h.h)(k,a,i.halfSize),(0,h.g)(k,k,(0,l.a)(i.bounds)),z(t,e,k)>s)return!1;const r=i.node;return r.terminals.forAll((t=>u(t))),null!==r.residents&&r.residents.forAll((t=>u(t))),!0}),t,e),c}forEachInDepthRange(t,e,n,i,o,r,s){let c=-1/0,a=1/0;const u={setRange:t=>{n===M.DepthOrder.FRONT_TO_BACK?(c=Math.max(c,t.near),a=Math.min(a,t.far)):(c=Math.max(c,-t.far),a=Math.min(a,-t.near))}};u.setRange(i);const d=z(e,n,t),f=C(e,n),_=C(e,-n),m=t=>{if(!s(t))return;const i=this.objectToBoundingSphere(t),h=(0,l.a)(i),f=z(e,n,h)-d,_=f-i[3],m=f+i[3];_>a||m<c||!O(r,i)||o(t,u)};F(this._root,(t=>{if(!O(r,t.bounds))return!1;if((0,h.h)(k,f,t.halfSize),(0,h.g)(k,k,(0,l.a)(t.bounds)),z(e,n,k)-d>a)return!1;if((0,h.h)(k,_,t.halfSize),(0,h.g)(k,k,(0,l.a)(t.bounds)),z(e,n,k)-d<c)return!1;const i=t.node;return i.terminals.forAll((t=>m(t))),null!==i.residents&&i.residents.forAll((t=>m(t))),!0}),e,n)}forEachNode(t){S(this._root,(e=>t(e.node,e.bounds,e.halfSize,e.depth)))}forEachNeighbor(t,e){const n=(0,l.g)(e),i=(0,l.a)(e),o=e=>{const o=this.objectToBoundingSphere(e),r=(0,l.g)(o),s=n+r;return!((0,h.s)((0,l.a)(o),i)-s*s<=0)||t(e)};let r=!0;const s=t=>{r&&(r=o(t))};S(this._root,(t=>{const e=(0,l.g)(t.bounds),o=n+e;if((0,h.s)((0,l.a)(t.bounds),i)-o*o>0)return!1;const c=t.node;return c.terminals.forAll(s),r&&null!==c.residents&&c.residents.forAll(s),r})),r&&this.forEachDegenerateObject(s)}_intersectsObject(t,e){const n=this.objectToBoundingSphere(e);return!(n[3]>0)||(0,l.i)(n,t)}_intersectsObjectWithOffset(t,e,n){const i=this.objectToBoundingSphere(e);return!(i[3]>0)||(0,l.i)(n.applyToBoundingSphere(i),t)}_add(t,e){e.advanceTo(this.objectToBoundingSphere(t))?e.node.terminals.push(t):(e.node.residents.push(t),e.node.residents.length>this._maximumObjectsPerNode&&e.depth<this._maximumDepth&&this._split(e))}_split(t){const e=t.node.residents;t.node.residents=null;for(let n=0;n<e.length;n++){const i=E.acquire().init(t);this._add(e.at(n),i),E.release(i)}}_grow(t,e){if(0!==e&&(L(t,e,(t=>this.objectToBoundingSphere(t)),X),w(X[3])&&!this._fitsInsideTree(X)))if(j(this._root.node))(0,l.e)(X,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const t=this._rootBoundsForRootAsSubNode(X);this._placingRootViolatesMaxDepth(t)?this._rebuildTree(X,t):this._growRootAsSubNode(t),E.release(t)}}_rebuildTree(t,e){(0,h.c)((0,l.a)(Y),(0,l.a)(e.bounds)),Y[3]=e.halfSize,L([t,Y],2,(t=>t),Z);const n=E.acquire().init(this._root);this._root.initFrom(null,Z,Z[3]),this._root.increaseHalfSize(1.25),S(n,(t=>(this.add(t.node.terminals.data,t.node.terminals.length),null!==t.node.residents&&this.add(t.node.residents.data,t.node.residents.length),!0))),E.release(n)}_placingRootViolatesMaxDepth(t){const e=Math.log(t.halfSize/this._root.halfSize)*Math.LOG2E;let n=0;return S(this._root,(t=>(n=Math.max(n,t.depth),n+e<=this._maximumDepth))),n+e>this._maximumDepth}_rootBoundsForRootAsSubNode(t){const e=t[3],n=t;let i=-1/0;const o=this._root.bounds,r=this._root.halfSize;for(let t=0;t<3;t++){const s=o[t]-r-(n[t]-e),c=n[t]+e-(o[t]+r),a=Math.max(0,Math.ceil(s/(2*r))),h=Math.max(0,Math.ceil(c/(2*r)))+1,u=2**Math.ceil(Math.log(a+h)*Math.LOG2E);i=Math.max(i,u),U[t].min=a,U[t].max=h}for(let t=0;t<3;t++){let e=U[t].min,n=U[t].max;const s=(i-(e+n))/2;e+=Math.ceil(s),n+=Math.floor(s);const c=o[t]-r-e*r*2;G[t]=c+(n+e)*r}const s=i*r;return G[3]=s*y,E.acquire().initFrom(null,G,s,0)}_growRootAsSubNode(t){const e=this._root.node;(0,h.c)((0,l.a)(X),(0,l.a)(this._root.bounds)),X[3]=this._root.halfSize,this._root.init(t),t.advanceTo(X,null,!0),t.node.children=e.children,t.node.residents=e.residents,t.node.terminals=e.terminals}_shrink(){for(;;){const t=this._findShrinkIndex();if(-1===t)break;this._root.advance(t),this._root.depth=0}}_findShrinkIndex(){if(0!==this._root.node.terminals.length||this._root.isLeaf())return-1;let t=null;const e=this._root.node.children;let n=0,i=0;for(;i<e.length&&null==t;)n=i++,t=e[n];for(;i<e.length;)if(e[i++])return-1;return n}_isDegenerate(t){return!w(this.objectToBoundingSphere(t)[3])}_fitsInsideTree(t){const e=this._root.bounds,n=this._root.halfSize;return t[3]<=n&&t[0]>=e[0]-n&&t[0]<=e[0]+n&&t[1]>=e[1]-n&&t[1]<=e[1]+n&&t[2]>=e[2]-n&&t[2]<=e[2]+n}toJSON(){const{maximumDepth:t,maximumObjectsPerNode:e,_objectCount:n}=this,i=this._nodeToJSON(this._root.node);return{maximumDepth:t,maximumObjectsPerNode:e,objectCount:n,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:i}}}_nodeToJSON(t){const e=t.children.map((t=>t?this._nodeToJSON(t):null)),n=t.residents?.map((t=>this.objectToBoundingSphere(t))),i=t.terminals?.map((t=>this.objectToBoundingSphere(t)));return{children:e,residents:n,terminals:i}}static fromJSON(t){const e=new M((t=>t),{maximumDepth:t.maximumDepth,maximumObjectsPerNode:t.maximumObjectsPerNode});return e._objectCount=t.objectCount,e._root.initFrom(t.root.node,t.root.bounds,t.root.halfSize,t.root.depth),e}}class E{constructor(){this.bounds=(0,l.c)(),this.halfSize=0,this.initFrom(null,null,0,0)}init(t){return this.initFrom(t.node,t.bounds,t.halfSize,t.depth)}initFrom(t,e,n,i=this.depth){return this.node=null!=t?t:E.createEmptyNode(),e&&(0,l.e)(e,this.bounds),this.halfSize=n,this.depth=i,this}increaseHalfSize(t){this.halfSize*=t,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*y}advance(t){let e=this.node.children[t];e||(e=E.createEmptyNode(),this.node.children[t]=e),this.node=e,this.halfSize/=2,this.depth++;const n=q[t];return this.bounds[0]+=n[0]*this.halfSize,this.bounds[1]+=n[1]*this.halfSize,this.bounds[2]+=n[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(t,e,n=!1){for(;;){if(this.isTerminalFor(t))return e&&e(this,-1),!0;if(this.isLeaf()){if(!n)return e&&e(this,-1),!1;this.node.residents=null}const i=this._childIndex(t);e&&e(this,i),this.advance(i)}}isLeaf(){return null!=this.node.residents}isTerminalFor(t){return t[3]>this.halfSize/2}_childIndex(t){const e=this.bounds;return(e[0]<t[0]?1:0)+(e[1]<t[1]?2:0)+(e[2]<t[2]?4:0)}static createEmptyNode(){return{children:[null,null,null,null,null,null,null,null],terminals:new _.A({shrink:!0}),residents:new _.A({shrink:!0})}}static{this._pool=new f.A(E)}static acquire(){return E._pool.acquire()}static release(t){E._pool.release(t)}static clearPool(){E._pool.prune()}}function S(t,e){let n=E.acquire().init(t);const i=[n];for(;0!==i.length;){if(n=i.pop(),e(n)&&!n.isLeaf())for(let t=0;t<n.node.children.length;t++)n.node.children[t]&&i.push(E.acquire().init(n).advance(t));E.release(n)}}function F(t,e,n,i=M.DepthOrder.FRONT_TO_BACK){let o=E.acquire().init(t);const r=[o];for(function(t,e,n){if(!$.length)for(let t=0;t<8;++t)$.push({index:0,distance:0});for(let n=0;n<8;++n){const i=q[n];$.data[n].index=n,$.data[n].distance=z(t,e,i)}$.sort(((t,e)=>t.distance-e.distance));for(let t=0;t<8;++t)n[t]=$.data[t].index}(n,i,Q);0!==r.length;){if(o=r.pop(),e(o)&&!o.isLeaf())for(let t=7;t>=0;--t){const e=Q[t];o.node.children[e]&&r.push(E.acquire().init(o).advance(e))}E.release(o)}}function x(t,e,n){J.clear();const i=n.advanceTo(e,((t,e)=>{J.push(t.node),J.push(e)}))?n.node.terminals:n.node.residents;if(i.removeUnordered(t),0===i.length)for(let t=J.length-2;t>=0&&N(J.data[t],J.data[t+1]);t-=2);}function N(t,e){return e>=0&&(t.children[e]=null),!!j(t)&&(null===t.residents&&(t.residents=new _.A({shrink:!0})),!0)}function j(t){if(0!==t.terminals.length)return!1;if(null!==t.residents)return 0===t.residents.length;for(let e=0;e<t.children.length;e++)if(t.children[e])return!1;return!0}function P(t,e){t[0]=Math.min(t[0],e[0]-e[3]),t[1]=Math.min(t[1],e[1]-e[3]),t[2]=Math.min(t[2],e[2]-e[3])}function B(t,e){t[0]=Math.max(t[0],e[0]+e[3]),t[1]=Math.max(t[1],e[1]+e[3]),t[2]=Math.max(t[2],e[2]+e[3])}function I(t,e,n){n[0]=t[0]+e,n[1]=t[1]+e,n[2]=t[2]+e}function L(t,e,n,i){if(1===e){const e=n(t[0]);(0,l.e)(e,i)}else{V[0]=1/0,V[1]=1/0,V[2]=1/0,K[0]=-1/0,K[1]=-1/0,K[2]=-1/0;for(let i=0;i<e;i++){const e=n(t[i]);w(e[3])&&(P(V,e),B(K,e))}(0,h.m)((0,l.a)(i),V,K,.5),i[3]=Math.max(K[0]-V[0],K[1]-V[1],K[2]-V[2])/2}}function C(t,e){let n,i=1/0;for(let o=0;o<8;++o){const r=z(t,e,H[o]);r<i&&(i=r,n=H[o])}return n}function z(t,e,n){return e*(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])}function w(t){return!isNaN(t)&&t!==-1/0&&t!==1/0&&t>0}(R=(A=M).DepthOrder||(A.DepthOrder={}))[R.FRONT_TO_BACK=1]="FRONT_TO_BACK",R[R.BACK_TO_FRONT=-1]="BACK_TO_FRONT";const q=[(0,u.fA)(-1,-1,-1),(0,u.fA)(1,-1,-1),(0,u.fA)(-1,1,-1),(0,u.fA)(1,1,-1),(0,u.fA)(-1,-1,1),(0,u.fA)(1,-1,1),(0,u.fA)(-1,1,1),(0,u.fA)(1,1,1)],H=[(0,u.fA)(-1,-1,-1),(0,u.fA)(-1,-1,1),(0,u.fA)(-1,1,-1),(0,u.fA)(-1,1,1),(0,u.fA)(1,-1,-1),(0,u.fA)(1,-1,1),(0,u.fA)(1,1,-1),(0,u.fA)(1,1,1)],y=Math.sqrt(3),D=[null],G=(0,l.c)(),k=(0,u.vt)(),V=(0,u.vt)(),K=(0,u.vt)(),J=new _.A,W=(0,l.c)(),X=(0,l.c)(),Y=(0,l.c)(),Z=(0,l.c)(),U=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],$=new _.A,Q=[0,0,0,0,0,0,0,0];var tt=n(431);function et(t,e,n){const i=(0,l.c)(),o=(0,l.a)(i);return(0,h.b)(o,o,t,.5),(0,h.b)(o,o,e,.5),i[3]=(0,h.j)(o,t),(0,h.g)(o,o,n),i}let nt=class{constructor(){this._idToComponent=new Map,this._components=new M((t=>t.bounds)),this._edges=new M((t=>t.bounds)),this._tmpLineSegment=(0,d.vt)(),this._tmpP1=(0,u.vt)(),this._tmpP2=(0,u.vt)(),this._tmpP3=(0,u.vt)(),this.remoteClient=null}async fetchCandidates(t,e){await Promise.resolve(),(0,c.Te)(e),await this._ensureEdgeLocations(t,e);const n=[];return this._edges.forEachNeighbor((e=>(this._addCandidates(t,e,n),n.length<1e3)),t.bounds),{result:{candidates:n}}}async _ensureEdgeLocations(t,e){const n=[];if(this._components.forEachNeighbor((t=>{if(null==t.info){const{id:e,uid:i}=t;n.push({id:e,uid:i})}return!0}),t.bounds),!n.length)return;const i={components:n},o=await this.remoteClient.invoke("fetchAllEdgeLocations",i,e??{});for(const t of o.components)this._setFetchEdgeLocations(t)}async add(t){const e=new rt(t.id,t.bounds);return this._idToComponent.set(e.id,e),this._components.add([e]),{result:{}}}async remove(t){const e=this._idToComponent.get(t.id);if(e){const t=[];this._edges.forEachNeighbor((n=>(n.component===e&&t.push(n),!0)),e.bounds),this._edges.remove(t),this._components.remove([e]),this._idToComponent.delete(e.id)}return{result:{}}}_setFetchEdgeLocations(t){const e=this._idToComponent.get(t.id);if(null==e||t.uid!==e.uid)return;const n=tt.HY.createView(t.locations),i=new Array(n.count),o=(0,u.vt)(),r=(0,u.vt)();for(let s=0;s<n.count;s++){n.position0.getVec(s,o),n.position1.getVec(s,r);const c=et(o,r,t.origin),a=new st(e,s,c);i[s]=a}this._edges.add(i);const{objectIds:s,origin:c}=t;e.info={locations:n,objectIds:s,origin:c}}_addCandidates(t,e,n){const{info:i}=e.component,{origin:o,objectIds:r}=i,s=i.locations,c=s.position0.getVec(e.index,this._tmpP1),a=s.position1.getVec(e.index,this._tmpP2);(0,h.g)(c,c,o),(0,h.g)(a,a,o);const u=r[s.componentIndex.get(e.index)];this._addEdgeCandidate(t,u,c,a,n),ot(t,u,c,n),ot(t,u,a,n)}_addEdgeCandidate(t,e,n,i,o){if(!t.returnEdge)return;const r=(0,l.a)(t.bounds),s=(0,d.Cr)(n,i,this._tmpLineSegment),c=(0,d._I)(s,r,this._tmpP3);(0,l.o)(t.bounds,c)&&o.push({type:"edge",objectId:e,target:(0,u.o8)(c),distance:(0,h.j)(r,c),start:(0,u.o8)(n),end:(0,u.o8)(i)})}};nt=(0,s._)([(0,a.$)("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],nt);const it=nt;function ot(t,e,n,i){if(!t.returnVertex||!(0,l.o)(t.bounds,n))return;const o=(0,l.a)(t.bounds);i.push({type:"vertex",objectId:e,target:(0,u.o8)(n),distance:(0,h.j)(o,n)})}class rt{constructor(t,e){this.id=t,this.bounds=e,this.info=null,this.uid=++rt.uid}static{this.uid=0}}class st{constructor(t,e,n){this.component=t,this.index=e,this.bounds=n}}},71351:(t,e,n)=>{n.d(e,{Cr:()=>d,LV:()=>u,kb:()=>l,oC:()=>f,vt:()=>a}),n(4576);var i=n(4341),o=(n(77690),n(29242)),r=n(38954),s=n(51850),c=n(32114);function a(t){return t?h((0,s.o8)(t.origin),(0,s.o8)(t.direction)):h((0,s.vt)(),(0,s.vt)())}function h(t,e){return{origin:t,direction:e}}function u(t,e){const n=_.get();return n.origin=t,n.direction=e,n}function d(t,e,n=a()){return(0,r.c)(n.origin,t),(0,r.d)(n.direction,e,t),n}function l(t,e){const n=(0,r.e)(c.rq.get(),(0,r.n)(c.rq.get(),t.direction),(0,r.d)(c.rq.get(),e,t.origin));return(0,r.f)(n,n)}function f(t,e,n){const i=(0,r.f)(t.direction,(0,r.d)(n,e,t.origin));return(0,r.g)(n,t.origin,(0,r.h)(n,t.direction,i)),n}const _=new i.I((()=>a()));(0,s.vt)(),(0,s.vt)(),(0,s.vt)(),(0,o.vt)()},88582:(t,e,n)=>{var i;n.d(e,{_:()=>i}),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z"}(i||(i={}))},97937:(t,e,n)=>{n.d(e,{a:()=>A,c:()=>g,e:()=>O,f:()=>R,g:()=>b,i:()=>F,o:()=>L,s:()=>w}),n(44208),n(53966);var i=n(34727),o=n(58083),r=n(38954),s=n(51850),c=n(87317),a=n(91829),h=n(34304),u=n(88582),d=n(71351);function l(t,e){const n=(0,r.l)(t),o=(0,i.YN)(t[2]/n),s=Math.atan2(t[1]/n,t[0]/n);return(0,r.i)(e,n,o,s),e}var f=n(44280),_=n(32114);const m=g();function g(){return(0,a.vt)()}const T=c.e,p=c.e;function O(t,e){return(0,c.c)(e,t)}function b(t){return t[3]}function A(t){return t}function R(t,e,n,i){return(0,a.fA)(t,e,n,i)}function v(t,e,n){if(null==e)return!1;if(!E(t,e,M))return!1;let{t0:i,t1:o}=M;if((i<0||o<i&&o>0)&&(i=o),i<0)return!1;if(n){const{origin:t,direction:o}=e;n[0]=t[0]+o[0]*i,n[1]=t[1]+o[1]*i,n[2]=t[2]+o[2]*i}return!0}const M={t0:0,t1:0};function E(t,e,n){const{origin:i,direction:o}=e,r=S;r[0]=i[0]-t[0],r[1]=i[1]-t[1],r[2]=i[2]-t[2];const s=o[0]*o[0]+o[1]*o[1]+o[2]*o[2];if(0===s)return!1;const c=2*(o[0]*r[0]+o[1]*r[1]+o[2]*r[2]),a=c*c-4*s*(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]-t[3]*t[3]);if(a<0)return!1;const h=Math.sqrt(a);return n.t0=(-c-h)/(2*s),n.t1=(-c+h)/(2*s),!0}const S=(0,s.vt)();function F(t,e){return v(t,e,null)}function x(t,e,n){const i=_.rq.get(),s=_.Rc.get();(0,r.e)(i,e.origin,e.direction);const c=b(t);(0,r.e)(n,i,e.origin),(0,r.h)(n,n,1/(0,r.l)(n)*c);const a=j(t,e.origin),h=(0,f.g7)(e.origin,n);return(0,o.$0)(s,h+a,i),(0,r.t)(n,n,s),n}function N(t,e,n){const i=(0,r.d)(_.rq.get(),e,t),o=(0,r.h)(_.rq.get(),i,t[3]/(0,r.l)(i));return(0,r.g)(n,o,t)}function j(t,e){const n=(0,r.d)(_.rq.get(),e,t),o=(0,r.l)(n),s=b(t),c=s+Math.abs(s-o);return(0,i.XM)(s/c)}const P=(0,s.vt)();function B(t,e,n,i){const o=(0,r.d)(P,e,t);switch(n){case u._.X:{const t=l(o,P)[2];return(0,r.i)(i,-Math.sin(t),Math.cos(t),0)}case u._.Y:{const t=l(o,P),e=t[1],n=t[2],s=Math.sin(e);return(0,r.i)(i,-s*Math.cos(n),-s*Math.sin(n),Math.cos(e))}case u._.Z:return(0,r.n)(i,o);default:return}}function I(t,e){const n=(0,r.d)(C,e,t);return(0,r.l)(n)-t[3]}function L(t,e){const n=(0,r.s)(t,e),i=b(t);return n<=i*i}const C=(0,s.vt)(),z=g(),w=Object.freeze(Object.defineProperty({__proto__:null,NullSphere:m,altitudeAt:I,angleToSilhouette:j,axisAt:B,cameraFrustumCoverage:function(t,e,n,i){const o=b(t),r=o*o,s=e+.5*Math.PI,c=n*n+r-2*Math.cos(s)*n*o,a=Math.sqrt(c),h=c-r;if(h<=0)return.5;const u=Math.sqrt(h),d=Math.acos(u/a)-Math.asin(o/(a/Math.sin(s)));return Math.min(1,(d+.5*i)/i)},clear:function(t){t[0]=t[1]=t[2]=t[3]=0},closestPoint:function(t,e,n){return v(t,e,n)?n:((0,d.oC)(e,t,n),N(t,n,n))},closestPointOnSilhouette:x,containsPoint:L,copy:O,create:g,distanceToSilhouette:function(t,e){const n=(0,r.d)(_.rq.get(),e,t),i=(0,r.k)(n),o=t[3]*t[3];return Math.sqrt(Math.abs(i-o))},elevate:function(t,e,n){return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2]),n[3]=t[3]+e,n},equals:p,exactEquals:T,fromCenterAndRadius:function(t,e){return(0,a.fA)(t[0],t[1],t[2],e)},fromRadius:function(t,e){return t[0]=t[1]=t[2]=0,t[3]=e,t},fromValues:R,getCenter:A,getExtent:function(t,e){return e},getRadius:b,intersectLine:function(t,e,n){const i=(0,d.Cr)(e,n);if(!E(t,i,M))return[];const{origin:o,direction:c}=i,{t0:a,t1:u}=M,l=e=>{const n=(0,s.vt)();return(0,r.b)(n,o,c,e),N(t,n,n)};return Math.abs(a-u)<(0,h.FD)()?[l(a)]:[l(a),l(u)]},intersectRay:v,intersectRayClosestSilhouette:function(t,e,n){if(v(t,e,n))return n;const i=x(t,e,_.rq.get());return(0,r.g)(n,e.origin,(0,r.h)(_.rq.get(),e.direction,(0,r.j)(e.origin,i)/(0,r.l)(e.direction))),n},intersectsRay:F,projectPoint:N,setAltitudeAt:function(t,e,n,i){const o=I(t,e),s=B(t,e,u._.Z,C),c=(0,r.h)(C,s,n-o);return(0,r.g)(i,e,c)},setExtent:function(t,e,n){return t!==n&&O(t,n),n},tmpSphere:z,union:function(t,e,n=(0,a.vt)()){const i=(0,r.j)(t,e),o=t[3],s=e[3];return i+s<o?((0,c.c)(n,t),n):i+o<s?((0,c.c)(n,e),n):((0,r.m)(n,t,e,(i+s-o)/(2*i)),n[3]=(i+o+s)/2,n)},wrap:function(t){return t}},Symbol.toStringTag,{value:"Module"}))}}]);