@arcgis/core 4.24.0-next.20220427 → 4.24.0-next.20220430

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 (276) hide show
  1. package/WebMap.js +1 -1
  2. package/analysis/LineOfSightAnalysis.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{3a43a2918b44781aaf85.js → 055a0ebf22a82f859474.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{3273b6be43eeb49ee842.js → 0b12ff7b2ed2838afbb8.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0e25548573baf855e394.js +1 -0
  7. package/assets/esri/core/workers/chunks/0edd4c3ca6e7d749d0e5.js +1 -0
  8. package/assets/esri/core/workers/chunks/133f971e72a1a6277ac4.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c388ac33496f004d56f3.js → 135a90ae61f3b3cae91b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{54f9b1ab9d472bf4baca.js → 1facbda248863cf72cbd.js} +1 -1
  11. package/assets/esri/core/workers/chunks/1fb2d7abe6c8efa84695.js +1 -0
  12. package/assets/esri/core/workers/chunks/2133499e642193f6738f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{dee63bfc108b4e5893a3.js → 2cf3934b3ecabdf207c8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{3c572629f46e5093223c.js → 30333a95dc0a44e23fb5.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{7afe89eafab00afb31f2.js → 30837d93116f0337972f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/31df729c17470245288c.js +2 -0
  17. package/assets/esri/core/workers/chunks/{c0bf663240df7be68131.js.LICENSE.txt → 31df729c17470245288c.js.LICENSE.txt} +1 -1
  18. package/assets/esri/core/workers/chunks/4130ea1f5a9f197168d7.js +1 -0
  19. package/assets/esri/core/workers/chunks/{417ee7a88575cb8f9aaf.js → 492b65fe99641f5740f0.js} +1 -1
  20. package/assets/esri/core/workers/chunks/4cdd29e1f3a1c7a39af7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{9a0073d43b7dbaeba736.js → 541e644fc77dbe527124.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{5a61a12b2492c6eae592.js → 59e341b2db44351bf557.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{73630d52768e3d932f30.js → 5a10b58533b4116115ac.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5fd787f63362defc984f.js +1 -0
  25. package/assets/esri/core/workers/chunks/682a8f15f352de76df69.js +1 -0
  26. package/assets/esri/core/workers/chunks/6a06635089761ee3e6d4.js +972 -0
  27. package/assets/esri/core/workers/chunks/{ab0c0c29d54f2ed954d6.js → 86b31ae136f931d7884a.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{dc193247a1980360ec4f.js → 8e98ff9404a802352037.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{863cfe35ee640bac103f.js → 94e51fe1c539df6257c2.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{cbe7e6283a427a618d4b.js → 9519a02b9b8db88a3150.js} +1 -1
  31. package/assets/esri/core/workers/chunks/9f3a094aa4b47e4eb046.js +1 -0
  32. package/assets/esri/core/workers/chunks/{50d256bc3b213c8a1b09.js → a0ebf25c9c9a7f839b93.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{d8a992dee594a6a64fde.js → a25f0a195f9217665530.js} +1 -1
  34. package/assets/esri/core/workers/chunks/a59ee7d2b98c85f27dd2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{92ef9b0c61640e0ecbb4.js → a5dbab94697757c87c49.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{147d3ee9aa81d7b2b7fa.js → a6406a248b7b2ed65f35.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{ebdf61eb364ac0856f40.js → acbd0f4d72d1f5d8e4e8.js} +1 -1
  38. package/assets/esri/core/workers/chunks/acc97a210f36bff2d1b0.js +1 -0
  39. package/assets/esri/core/workers/chunks/ad68fe924456d6d7d4f0.js +1 -0
  40. package/assets/esri/core/workers/chunks/b06c949fc7d08e376a5f.js +1 -0
  41. package/assets/esri/core/workers/chunks/b4405e9fe6c0cf7250d3.js +1 -0
  42. package/assets/esri/core/workers/chunks/b97a34d2e7cceef1ac41.js +1 -0
  43. package/assets/esri/core/workers/chunks/bc08fe3b03767bd694c5.js +1 -0
  44. package/assets/esri/core/workers/chunks/c9b09099488d0e719dfb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4a05d0dfa73ff570e1fa.js → d15e6662d90718411d62.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{b74b9dceabbf7b1aec39.js → d16aac3461af9cee0c29.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{bb678bc2e2fc48112e07.js → d60dd3e1028f714f2258.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{31c1ae0532dd991da63d.js → d6c150c243ca1f6108f9.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{cab6decfcb3f596a3837.js → d8c59b1d73650c060dfb.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{d24339b37cc9316e6d99.js → dcb6e1b33402d7fa455b.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{a8da24116180d708cf81.js → df653bca2b14dffc82d1.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{a3db91d04fe1fca0fe4f.js → e06461703e6f1acfcfdc.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{423e199c2f695e913c0e.js → e3e1d87b8532bf84a18d.js} +1 -1
  54. package/assets/esri/core/workers/chunks/e7744b7e0c16bba93151.js +1 -0
  55. package/assets/esri/core/workers/chunks/ea50effc5c39870dc871.js +1 -0
  56. package/assets/esri/core/workers/chunks/fc4fd9db056579e09bfe.js +1 -0
  57. package/assets/esri/core/workers/chunks/fc9b5f40c5179a8c90de.js +1 -0
  58. package/assets/esri/core/workers/chunks/fd35b69872ac9393924f.js +1 -0
  59. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ar.json +1 -1
  60. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bg.json +1 -1
  61. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bs.json +1 -1
  62. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ca.json +1 -1
  63. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_cs.json +1 -1
  64. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_da.json +1 -1
  65. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_de.json +1 -1
  66. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_el.json +1 -1
  67. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_es.json +1 -1
  68. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_et.json +1 -1
  69. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fi.json +1 -1
  70. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fr.json +1 -1
  71. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_he.json +1 -1
  72. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hr.json +1 -1
  73. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hu.json +1 -1
  74. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_id.json +1 -1
  75. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_it.json +1 -1
  76. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ja.json +1 -1
  77. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ko.json +1 -1
  78. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lt.json +1 -1
  79. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lv.json +1 -1
  80. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nb.json +1 -1
  81. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nl.json +1 -1
  82. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pl.json +1 -1
  83. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-BR.json +1 -1
  84. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-PT.json +1 -1
  85. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ro.json +1 -1
  86. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ru.json +1 -1
  87. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sk.json +1 -1
  88. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sl.json +1 -1
  89. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sr.json +1 -1
  90. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sv.json +1 -1
  91. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_th.json +1 -1
  92. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_tr.json +1 -1
  93. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_uk.json +1 -1
  94. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_vi.json +1 -1
  95. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-CN.json +1 -1
  96. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-HK.json +1 -1
  97. package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-TW.json +1 -1
  98. package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
  99. package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
  100. package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
  101. package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
  102. package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
  103. package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
  104. package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
  105. package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
  106. package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
  109. package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
  110. package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
  111. package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
  112. package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
  113. package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
  114. package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
  115. package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
  116. package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
  117. package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
  118. package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
  119. package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
  120. package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
  121. package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
  122. package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
  123. package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
  124. package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
  125. package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
  126. package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
  127. package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
  128. package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
  129. package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
  130. package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
  131. package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
  132. package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
  133. package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
  134. package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
  135. package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
  136. package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
  137. package/chunks/ColorMaterial.glsl.js +4 -4
  138. package/chunks/LineMarker.glsl.js +12 -12
  139. package/chunks/Pattern.glsl.js +17 -17
  140. package/chunks/RibbonLine.glsl.js +34 -34
  141. package/chunks/ShadedColorMaterial.glsl.js +11 -11
  142. package/chunks/index.js +1 -1
  143. package/chunks/sphere.js +1 -1
  144. package/config.js +1 -1
  145. package/core/workers/RemoteClient.js +1 -1
  146. package/core/workers/WorkerHandle.js +1 -1
  147. package/geometry/support/sphere.js +1 -1
  148. package/interfaces.d.ts +74 -20
  149. package/layers/mixins/PortalLayer.js +1 -1
  150. package/layers/support/LercDecoder.js +1 -1
  151. package/package.json +2 -2
  152. package/request.js +1 -1
  153. package/support/elevationInfoUtils.js +1 -1
  154. package/support/revision.js +1 -1
  155. package/symbols/support/previewSymbol2D.js +1 -1
  156. package/views/2d/engine/brushes.js +1 -1
  157. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  158. package/views/2d/engine/webgl/GraphicDisplayList.js +1 -1
  159. package/views/2d/engine/webgl/Painter.js +1 -1
  160. package/views/2d/engine/webgl/WGLRendererInfo.js +1 -1
  161. package/views/2d/engine/webgl/brushes/WGLBrushDotDensity.js +5 -0
  162. package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +5 -0
  163. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  164. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  165. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
  166. package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
  167. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  168. package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
  169. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  170. package/views/2d/engine/webgl/techniques/Technique.js +5 -0
  171. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +5 -0
  172. package/views/2d/engine/webgl/techniques/heatmap/TechniqueHeatmap.js +5 -0
  173. package/views/2d/engine/webgl/techniques/utils.js +5 -0
  174. package/views/2d/layers/features/schemaUtils.js +1 -1
  175. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  176. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  177. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  178. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  179. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  180. package/views/3d/camera/constraintUtils/distance.js +1 -1
  181. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  182. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  183. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  184. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  185. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  186. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  187. package/views/3d/layers/I3SMeshView3D.js +1 -1
  188. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  189. package/views/3d/layers/I3SPointsWorkerHandle.js +1 -1
  190. package/views/3d/layers/PointCloudWorkerHandle.js +1 -1
  191. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  192. package/views/3d/layers/i3s/I3SElevationProvider.js +1 -1
  193. package/views/3d/layers/i3s/I3SNode.js +1 -1
  194. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  195. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  196. package/views/3d/state/utils/navigationUtils.js +1 -1
  197. package/views/3d/support/PBFDecoder.js +1 -1
  198. package/views/3d/support/geometryUtils/sphere.js +1 -1
  199. package/views/3d/terrain/OverlayManager.js +1 -1
  200. package/views/3d/terrain/OverlayRenderer.js +1 -1
  201. package/views/3d/terrain/PatchRenderData.js +1 -1
  202. package/views/3d/terrain/TerrainSurface.js +1 -1
  203. package/views/3d/terrain/Tile.js +1 -1
  204. package/views/3d/terrain/tileUtils.js +1 -1
  205. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  206. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +1 -1
  207. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  208. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  209. package/views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker.js +1 -1
  210. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  211. package/views/3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js +1 -1
  212. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  213. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  214. package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
  215. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  216. package/views/interactive/snapping/LineSnapper.js +1 -1
  217. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  218. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  219. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  220. package/views/interactive/snapping/SnappingManager.js +1 -1
  221. package/views/interactive/snapping/candidates/EdgeSnappingCandidate.js +1 -1
  222. package/views/interactive/snapping/candidates/FeatureSnappingCandidate.js +1 -1
  223. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  224. package/views/interactive/snapping/candidates/LineSnappingCandidate.js +1 -1
  225. package/views/interactive/snapping/candidates/ParallelLineSnappingCandidate.js +1 -1
  226. package/views/interactive/snapping/candidates/RightAngleSnappingCandidate.js +1 -1
  227. package/views/interactive/snapping/candidates/RightAngleTriangleSnappingCandidate.js +1 -1
  228. package/views/interactive/snapping/candidates/SnappingCandidate.js +1 -1
  229. package/views/interactive/snapping/candidates/VertexSnappingCandidate.js +1 -1
  230. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  231. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  232. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  233. package/views/interactive/snapping/featureSources/SceneLayerSnappingSource.js +5 -0
  234. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  235. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  236. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +5 -0
  237. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +5 -0
  238. package/views/interactive/snapping/hints/IntersectionSnappingHint.js +1 -1
  239. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  240. package/views/interactive/snapping/hints/ParallelSnappingHint.js +1 -1
  241. package/views/interactive/snapping/hints/PointSnappingHint.js +1 -1
  242. package/views/interactive/snapping/hints/RightAngleSnappingHint.js +1 -1
  243. package/views/interactive/snapping/hints/SnappingHint.js +1 -1
  244. package/views/interactive/snapping/snappingUtils.js +1 -1
  245. package/views/support/colorUtils.js +1 -1
  246. package/webmap/Bookmark.js +1 -1
  247. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  248. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  249. package/widgets/FeatureTable/Grid/Grid.js +2 -2
  250. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  251. package/widgets/Sketch/SketchViewModel.js +1 -1
  252. package/widgets/Slice/SliceViewModel.js +1 -1
  253. package/widgets/support/AnalysisViewModel.js +1 -1
  254. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  255. package/assets/esri/core/workers/chunks/2266d6388444ac5d50b3.js +0 -1
  256. package/assets/esri/core/workers/chunks/3f6b17c9d2629ed396da.js +0 -1
  257. package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +0 -1
  258. package/assets/esri/core/workers/chunks/4e4994665549435f51ee.js +0 -1
  259. package/assets/esri/core/workers/chunks/503226c5c612feab4115.js +0 -1
  260. package/assets/esri/core/workers/chunks/528033aa0d663b4d41bf.js +0 -1
  261. package/assets/esri/core/workers/chunks/54af957c5330933805a3.js +0 -1
  262. package/assets/esri/core/workers/chunks/6ef8de3aa9a8d9c22161.js +0 -1
  263. package/assets/esri/core/workers/chunks/72d8b2ad36f0d0a40a0d.js +0 -1
  264. package/assets/esri/core/workers/chunks/756befc4aa3354e1db1d.js +0 -972
  265. package/assets/esri/core/workers/chunks/8a4e2831e8fdde530b21.js +0 -1
  266. package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +0 -1
  267. package/assets/esri/core/workers/chunks/9c4d41f20c1a94147344.js +0 -1
  268. package/assets/esri/core/workers/chunks/9cfd66ee9e6328b3693a.js +0 -1
  269. package/assets/esri/core/workers/chunks/b548bf032c8af34fe155.js +0 -1
  270. package/assets/esri/core/workers/chunks/bbcae04235830debd814.js +0 -1
  271. package/assets/esri/core/workers/chunks/bc6f5927f07c5993b998.js +0 -1
  272. package/assets/esri/core/workers/chunks/c0bf663240df7be68131.js +0 -2
  273. package/assets/esri/core/workers/chunks/cd9668acbe3babd2b188.js +0 -1
  274. package/assets/esri/core/workers/chunks/d53c7a9ede56be749f2b.js +0 -1
  275. package/assets/esri/core/workers/chunks/e07930ab66f89d215666.js +0 -1
  276. package/assets/esri/core/workers/chunks/f72de828ede4d0c5e9d7.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import i from"../../analysis/LineOfSightAnalysisTarget.js";import o from"../../core/Collection.js";import{castForReferenceSetter as n,referenceSetter as r}from"../../core/collectionUtils.js";import a from"../../core/Handles.js";import{handlesGroup as l}from"../../core/handleUtils.js";import{destroyMaybe as h,isNone as c,isSome as d,applySome as g,unwrap as y}from"../../core/maybe.js";import{watch as m,syncAndInitial as p,sync as T}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{LineOfSightTool as w}from"../../views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js";import _ from"./LineOfSightTarget.js";import{InteractiveAnalysisViewModel as f}from"../support/InteractiveAnalysisViewModel.js";const A=o.ofType(_);let M=class extends f{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._handles=new a,this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this._handles.add([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),m((()=>this.analysis),(e=>this._onAnalysisChange(e)),p)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove())),this._handles=h(this._handles)}get state(){return this.disabled||!this.ready?"disabled":c(this.tool)?"ready":this.tool.state}get observer(){return d(this.analysis.observer)?this.analysis.observer.position:null}set observer(e){this.analysis.observer=new s({position:e})}get targets(){return this._get("targets")||new A}set targets(e){this._set("targets",r(e,this.targets,A))}clear(){this.removeTool(),this.observer=null,this.targets.removeAll()}continue(){d(this.tool)&&this.tool.continue()}stop(){d(this.tool)&&this.tool.stop()}get testInfo(){return{getAnalysisTargetFromViewModelTarget:e=>g(this._vmTargetsToConnection.get(e),(e=>e.analysisTarget))}}constructAnalysis(){return new t}constructTool(){return new w({view:y(this.view),analysis:this.analysis,analysisView:y(this.analysisView),visible:this.visible})}async onConnectToAnalysisView(e){this._handles.add([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);d(e.result)?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=y(e.result.intersectedLocation),t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0)}))],"view")}onDisconnectFromAnalysisView(){null!=this._handles&&this._handles.remove("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new i({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const t=new _({location:g(e.position,(e=>e.clone()))});this._connectViewModelWithAnalysisTarget(t,e),this.targets.add(t)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const i=l([m((()=>t.position),(t=>{s||(s=!0,e.location=g(t,(e=>e.clone())),s=!1)}),T),m((()=>e.location),(e=>{s||(s=!0,t.position=g(e,(e=>e.clone())),s=!1)}),T)]),o={analysisTarget:t,viewModelTarget:e,remove:()=>{i.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,o),this._analysisTargetsToConnection.set(t,o)}_onAnalysisChange(e){const t="analysis";this._handles.remove(t),this._handles.add([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}};e([v({type:t})],M.prototype,"analysis",void 0),e([v({readOnly:!0})],M.prototype,"state",null),e([v()],M.prototype,"observer",null),e([v({type:A,cast:n,nonNullable:!0})],M.prototype,"targets",null),M=e([u("esri.widgets.lineOfSight.LineOfSightViewModel")],M);const b=M;export{b as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import i from"../../analysis/LineOfSightAnalysisTarget.js";import o from"../../core/Collection.js";import{castForReferenceSetter as n,referenceSetter as r}from"../../core/collectionUtils.js";import a from"../../core/Handles.js";import{handlesGroup as l}from"../../core/handleUtils.js";import{destroyMaybe as h,isNone as c,isSome as d,applySome as g,unwrap as y}from"../../core/maybe.js";import{watch as m,syncAndInitial as p,sync as T}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{LineOfSightTool as w}from"../../views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js";import _ from"./LineOfSightTarget.js";import{InteractiveAnalysisViewModel as f}from"../support/InteractiveAnalysisViewModel.js";const A=o.ofType(_);let M=class extends f{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._handles=new a,this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this._handles.add([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),m((()=>this.analysis),(e=>this._onAnalysisChange(e)),p)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove())),this._handles=h(this._handles)}get state(){return this.disabled||!this.ready?"disabled":c(this.tool)?"ready":this.tool.state}get observer(){return d(this.analysis.observer)?this.analysis.observer.position:null}set observer(e){this.analysis.observer=new s({position:e})}get targets(){return this._get("targets")||new A}set targets(e){this._set("targets",r(e,this.targets,A))}clearAnalysis(){this.observer=null,this.targets.removeAll()}continue(){d(this.tool)&&this.tool.continue()}stop(){d(this.tool)&&this.tool.stop()}get testInfo(){return{getAnalysisTargetFromViewModelTarget:e=>g(this._vmTargetsToConnection.get(e),(e=>e.analysisTarget))}}constructAnalysis(){return new t}constructTool(){return new w({view:y(this.view),analysis:this.analysis,analysisView:y(this.analysisView),visible:this.visible})}async onConnectToAnalysisView(e){this._handles.add([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);d(e.result)?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=y(e.result.intersectedLocation),t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0)}))],"view")}onDisconnectFromAnalysisView(){null!=this._handles&&this._handles.remove("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new i({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const t=new _({location:g(e.position,(e=>e.clone()))});this._connectViewModelWithAnalysisTarget(t,e),this.targets.add(t)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const i=l([m((()=>t.position),(t=>{s||(s=!0,e.location=g(t,(e=>e.clone())),s=!1)}),T),m((()=>e.location),(e=>{s||(s=!0,t.position=g(e,(e=>e.clone())),s=!1)}),T)]),o={analysisTarget:t,viewModelTarget:e,remove:()=>{i.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,o),this._analysisTargetsToConnection.set(t,o)}_onAnalysisChange(e){const t="analysis";this._handles.remove(t),this._handles.add([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}};e([v({type:t})],M.prototype,"analysis",void 0),e([v({readOnly:!0})],M.prototype,"state",null),e([v()],M.prototype,"observer",null),e([v({type:A,cast:n,nonNullable:!0})],M.prototype,"targets",null),M=e([u("esri.widgets.lineOfSight.LineOfSightViewModel")],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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{symbolTypes as t}from"../../symbols.js";import o from"../../core/Collection.js";import"../../core/has.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import r from"../../core/Handles.js";import s from"../../core/Logger.js";import{destroyMaybe as n,isSome as p,unwrap as l,abortMaybe as h,isNone as c,unwrapOr as d,get as u}from"../../core/maybe.js";import{createAbortError as y,whenOrAbort as v}from"../../core/promiseUtils.js";import{on as m,watch as g,when as f,whenOnce as _,syncAndInitial as w}from"../../core/reactiveUtils.js";import{property as G}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as T,isLoaded as E,load as O,project as S}from"../../geometry/projection.js";import{getReferenceEllipsoid as A}from"../../geometry/projectionEllipsoid.js";import{geometryToCoordinates as k}from"../../geometry/support/coordsUtils.js";import{equals as C}from"../../geometry/support/spatialReferenceUtils.js";import H from"../../layers/GraphicsLayer.js";import{isDOMContainer as I}from"../../views/DOMContainer.js";import{SupportedGraphicResult as R,isSupportedGraphicResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedGraphicUtils.js";import{isSupportedGraphic as M}from"../../views/3d/interactive/editingTools/moveGraphic/isSupportedGraphic.js";import{isSupportedGraphic as U}from"../../views/3d/interactive/editingTools/reshapeGraphic/isSupportedGraphic.js";import{isSupportedGraphic as P}from"../../views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js";import{addUniqueLayer as x}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as j}from"../../views/input/InputManager.js";import{SKETCH_KEYS as L}from"../../views/interactive/keybindings.js";import{SnappingManager as F}from"../../views/interactive/snapping/SnappingManager.js";import V from"../../views/interactive/snapping/SnappingOptions.js";import{TooltipOptions as W}from"../../views/interactive/tooltip/TooltipOptions.js";import{createScreenPointFromEvent as K}from"../../views/support/screenUtils.js";import{OperationHandle as q,UpdateOperationHandle as Z}from"./support/OperationHandle.js";import z from"../../symbols/SimpleMarkerSymbol.js";import N from"../../symbols/SimpleFillSymbol.js";import B from"../../symbols/SimpleLineSymbol.js";const $="esri.widgets.Sketch.SketchViewModel",Y=s.getLogger($),J={defaultZ:0},Q={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,tool:"transform"};let X=class extends a.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._handles=new r,this._internalGraphicsLayer=new H({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandles=new r,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new N({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new B({color:[130,130,130,1],width:2}),this._snappingManager=null,this.tooltipOptions=new W,this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.updatePointSymbol=new z({size:10,color:[0,200,255,.5],outline:{color:"black",width:1}}),this.updatePolygonSymbol=new N({color:[12,207,255,.2],outline:{join:"round",color:[12,207,255],width:2}}),this.updatePolylineSymbol=new B({color:[12,207,255],width:2}),this.vertexSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalAutoOpenEnabled=null,this.defaultCreateOptions=J,this.defaultUpdateOptions=Q,this.snappingOptions=new V}initialize(){this._handles.add([m((()=>{var e,t;return null==(e=this.view)||null==(t=e.map)?void 0:t.layers}),"change",(e=>{e.removed.includes(this.layer)&&this.cancel()})),m((()=>{var e;return null==(e=this.layer)?void 0:e.graphics}),"change",(e=>{if(p(this._operationHandle))for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())})),g((()=>{var e,t;return null!=(e=null==(t=this.layer)?void 0:t.elevationInfo)?e:null}),(e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)}),w),g((()=>this.view),(e=>{n(this._snappingManager),e&&(this._snappingManager=new F({view:e,options:this.snappingOptions}),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))}),w),g((()=>{var e;return null==(e=this.view)?void 0:e.spatialReference}),((e,t)=>{e&&t&&!e.equals(t)&&this.cancel()}))])}destroy(){this.cancel(),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeDefaultLayer(),this._snappingManager=n(this._snappingManager),this._set("view",null),this.emit("destroy")}get _defaultUpdateTool(){return"3d"===this.view.type?"move":"transform"}get updating(){return this._numUpdating>0}get activeTool(){return this._operationHandle&&this._operationHandle.tool?this._operationHandle.tool:null}get activeComponent(){return this._operationHandle?this._operationHandle.activeComponent:null}get createGraphic(){return!p(this.activeComponent)||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):l(this.activeComponent.graphic)}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...J,...e})}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Q,...e,reshapeOptions:{...Q.reshapeOptions,...null==e?void 0:e.reshapeOptions}})}set snappingOptions(e){p(this._snappingManager)&&(this._snappingManager.options=e),this._set("snappingOptions",e)}get state(){var e;const t=!(null==(e=this.view)||!e.ready||!this.layer),o=this._operationHandle;return t&&o?"active":t?"ready":"disabled"}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o&&o.remove(this._internalGraphicsLayer),this._viewHandles.removeAll(),this.cancel()}const o="view-ready";this._handles.remove(o),e&&this._handles.add(f((()=>e.ready),(t=>{this._viewHandles.removeAll(),t&&this._viewHandles.add(this._generateViewHandles(e))}),w),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}async create(e,t){if(this.cancel(),await this._waitViewReady(),"disabled"===this.state)throw this.layer||this._logError("sketch:missing-property","Property 'layer' is missing on SketchViewModel."),this.view||this._logError("sketch:missing-property","Property 'view' is missing on SketchViewModel."),y();if(p(this.view.activeTool)&&(this.view.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");x(this.view,this._internalGraphicsLayer);const o=await this._setupCreateOperation(e,t);if(c(o)||this.destroyed)return void this.view.map.remove(this._internalGraphicsLayer);const i=()=>{if(o===this._operationHandle){const t=this.createGraphic,i=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view&&this.view.map&&this.view.map.remove(this._internalGraphicsLayer),o.cancelled||null==t||this.layer.add(t),this.emit("create",{graphic:t,state:i?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};o.on("complete",i),this._operationHandle=o,this.view.ready&&I(this.view)&&this.view.focus()}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if("disabled"===a)throw i||this._logError("sketch:missing-property","Property 'view' is missing on SketchViewModel."),o||this._logError("sketch:missing-property","Property 'layer' is missing on SketchViewModel."),y();p(this.view.activeTool)&&(this.view.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r||!r.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some((e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):!!c(e.geometry)&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0))))return;const s=await this._setupUpdateOperation(r,t);this.destroyed||c(s)||re(s)||(x(this.view,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const t of e)p(t.geometry)&&"mesh"!==t.geometry.type&&!C(t.geometry.spatialReference,this.view.spatialReference)&&(T(t.geometry.spatialReference,this.view.spatialReference)||E()||await O(),t.geometry=S(t.geometry,this.view.spatialReference));this._endAsyncOperation()}undo(){this.canUndo()&&this._operationHandle.undo()}redo(){this.canRedo()&&this._operationHandle.redo()}canUndo(){return!(!this._operationHandle||!this._operationHandle.canUndo())}canRedo(){return!(!this._operationHandle||!this._operationHandle.canRedo())}toggleUpdateTool(){this._operationHandle&&this._operationHandle.toggleTool&&this._operationHandle.toggleTool()}async _getFirstHit(e){const t=[];switch(this.view.type){case"2d":{const o=[];this.view.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const i=await this.view.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];e.graphic&&t.push(e)}}break;case"3d":{const o=[this.view.map.ground];this.view.map.allLayers.forEach((e=>{"integrated-mesh"===e.type&&o.push(e)}));const i=await this.view.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];(!i.ground.mapPoint||this.view.map.ground.opacity<1||i.ground.distance-d(e.distance,0)>-Math.min(3*i.ground.distance,"global"===this.view.viewingMode?A(this.view.renderCoordsHelper.spatialReference).radius/this.view.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY))&&t.push(e)}}}return{screenPoint:e,results:t}}_generateViewHandles(e){return[e.on("immediate-click",(async t=>{const o="active"===this.state&&"create"===this._operationHandle.type;if("disabled"===this.state||o||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const i=(await t.async((()=>this._getFirstHit(K(t))))).results;let a=null;if(i.length){for(const r of i)if(r.graphic){const o=r.graphic;if(this.updateGraphics.includes(o)||o.layer===this.layer){t.stopPropagation(),a=o;break}"2d"!==e.type||this._isComponentGraphic(o)||"active"!==this.state||this.cancel()}}else"active"===this.state&&this.cancel();p(a)&&!this.updateGraphics.includes(a)&&await this.update([a],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()}),j.WIDGET)]}async _setupCreateOperation(e,t){const o={hasZ:"3d"===this.view.type,...this.defaultCreateOptions,...t},i=await this._setupDrawGraphicTool(e,this.view,o);return c(i)?null:(this.view.tools.add(i),this.view.activeTool=i,this._setupCreateOperationHandle(i))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView"),null;const i="rectangle"!==e,a="rectangle"!==e;this.snappingOptions.enabledToggled=!1;const r={view:t,mode:"rectangle"===e||"circle"===e?"hybrid":"click",...o,snapToScene:!1,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),snappingManager:this._snappingManager,forceUniformSize:a,centered:i};return"2d"===this.view.type?this._makeDrawGraphicTool2D(r):this._makeDrawGraphicTool3D(r)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return re(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ee(e.geometryType)?this.activeFillSymbol:null})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return re(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this.layer.elevationInfo,snapToScene:!p(this.layer.elevationInfo)||"absolute-height"===this.layer.elevationInfo.mode})}_setupCreateOperationHandle(e){let t=null;const o=e.forceUniformSize,i=e.centered,a=[this.view.on("key-down",(t=>{if(t.key===L.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===L.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==L.vertexAdd||t.repeat)t.key===L.undo?(t.stopPropagation(),r.undo()):t.key===L.redo?(t.stopPropagation(),r.redo()):t.key!==L.snappingToggle||"rectangle"===e.geometryType||"circle"===e.geometryType||t.repeat?t.key!==L.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===L.center&&(t.repeat||(e.centered=!i,t.stopPropagation())):(e.forceUniformSize=!o,t.stopPropagation()):(this.snappingOptions.enabledToggled=!0,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}}),j.WIDGET),this.view.on("key-up",(t=>{t.key===L.pan?e.enabled=!0:t.key===L.snappingToggle&&"rectangle"!==e.geometryType&&"circle"!==e.geometryType?(this.snappingOptions.enabledToggled=!1,t.stopPropagation()):t.key!==L.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===L.center&&(e.centered=i,t.stopPropagation()):(e.forceUniformSize=o,t.stopPropagation())}),j.WIDGET),e.on("vertex-add",(o=>{switch(t=c(t)?"start":"active",o.operation){case"apply":this.emit("create",{graphic:l(e.graphic),state:t,tool:this.activeTool,toolEventInfo:o,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[l(e.graphic)],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[l(e.graphic)],tool:e.geometryType})}})),e.on("cursor-update",(t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:l(e.graphic),state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})})),e.on("vertex-remove",(t=>{switch(t.operation){case"apply":this.emit("create",{graphic:l(e.graphic),state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[l(e.graphic)],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[l(e.graphic)],tool:e.geometryType})}})),e.on("complete",(e=>{this._set("createGraphic",l(e.graphic)),t="complete",e.aborted?r&&r.cancel():r&&r.complete()})),g((()=>this._getGraphicSymbolFromTool(e.geometryType)),(t=>{e.graphicSymbol=t}))],r=new q({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{var t;a.forEach((e=>e.remove())),a.length=0,null==(t=this.view.tools)||t.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return r}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;default:return null}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this,a={tool:this._defaultUpdateTool,...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...null==t?void 0:t.reshapeOptions}};let r=a.tool;for(const s of e)o.remove(s),o.add(s);if("3d"===i.type){if(0===e.length)return null;switch(r){case"move":return this._setupMove3DOperation(e,a,i,r);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=U(e[0]);return t===R.SUPPORTED?this._setupReshape3DOperation(e[0],a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(t)}).`),null)}case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(r){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=U(e[0]);return t===R.SUPPORTED?this._setupTransformOrReshape2DOperation(e,r,a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(t)}).`),null)}case"transform":if(1===e.length){const t=u(e[0].geometry,"type");"point"!==t&&"multipoint"!==t||(r="reshape")}return this._setupTransformOrReshape2DOperation(e,r,a,i)}}async _setupMove3DOperation(e,t,o,i,a=!1){for(const l of e){const e=M(l);if(e!==R.SUPPORTED)return this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${D(e)}).`),null}const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(r))return r;const s=new r.module.GraphicMoveTool({view:o,enableZ:t.enableZ,snappingManager:this._snappingManager});this.view.tools.add(s),s.graphics.addMany(e),a||this.updateGraphics.addMany(e);const n=[],p=new Z({activeComponent:s,tool:i,type:"update",onEnd:()=>{var e;n.forEach((e=>e.remove())),n.length=0,null==(e=this.view.tools)||e.remove(s),s.destroyed||s.destroy()},undo:()=>{te(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{oe(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e),s.graphics.push(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);p.history.undo.forEach((e=>e.updates.splice(t,1))),p.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?s.graphics.remove(e):p.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.getItemAt(0);if(U(e)!==R.SUPPORTED)return;const a=await this._setupReshape3DOperation(e,t,o,!0);re(a)||(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(a,t))}});return n.push(...this._getHandlesForComponent(p,t),this.view.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(p,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e),e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!0,e.stopPropagation())}),j.WIDGET),o.on("key-up",(e=>{e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation())}),j.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&P(e[0])===R.SUPPORTED){const a=e[0],r=a.geometry;if(p(r)&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(p(r)&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(n))return n;const p=new n.module.GraphicTransformTool({graphic:e,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this._snappingManager});this.view.tools.add(p),this.updateGraphics.add(e);const l=[],h=new Z({activeComponent:p,tool:i,type:"update",onEnd:()=>{var e;l.forEach((e=>e.remove())),l.length=0,null==(e=this.view.tools)||e.remove(p),p.destroyed||p.destroy()},undo:()=>{te(h,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{oe(h,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"});const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);re(i)||(h.onEnd(),h.destroy(),this._setUpdateOperationHandle(i,t))},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),h.complete()},toggleTool:()=>{}});return l.push(...this._getHandlesForComponent(h,t),this.view.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(h,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(h,e),e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!0,e.stopPropagation())}),j.WIDGET),o.on("key-up",(e=>{e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation())}),j.WIDGET)),h}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(l))return l;const h=new l.module.ExtentTransformTool({graphic:e,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p});this.view.tools.add(h),i||this.updateGraphics.add(e);const c=[],d=new Z({activeComponent:h,tool:a,type:"update",onEnd:()=>{var e;c.forEach((e=>e.remove())),c.length=0,null==(e=this.view.tools)||e.remove(h),h.destroyed||h.destroy()},canUndo:()=>h.canUndo,undo:()=>{h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>h.canRedo,redo:()=>{h.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"});const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);re(i)||(d.onEnd(),d.destroy(),this._setUpdateOperationHandle(i,t))},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),d.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const e=this.updateGraphics.getItemAt(0);if(U(e)!==R.SUPPORTED)return;const i=await this._setupReshape3DOperation(e,t,o,!0);re(i)||(d.onEnd(),d.destroy(),this._setUpdateOperationHandle(i,t))}});return c.push(...this._getHandlesForComponent(d,t),this.view.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(d,e,t)),j.WIDGET),this.view.on("key-down",(e=>this._getCommonUpdateOperationKeyDownHandlers(d,e)),j.WIDGET),this.view.on("key-down",(e=>{e.key!==L.constraint||e.repeat||(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())}),j.WIDGET),this.view.on("key-up",(e=>{e.key===L.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())}),j.WIDGET)),d}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a=await this._getGraphicMover(e,t,o);if(re(a))return a;const r=new Z({activeComponent:a,tool:i,type:"update",onEnd:()=>{var e;this._displayDefaultCursor(),p.forEach((e=>e.remove())),n.forEach((e=>e.remove())),p=[],n=[],a.destroy(),null==(e=this._internalGraphicsLayer)||e.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();te(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();oe(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updateSpatialReference(e),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1,n=[o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==L.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),j.WIDGET),o.on("key-up",(e=>{e.key===L.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),j.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(r))return r;this.snappingOptions.enabledToggled=!1;const s=new r.module.GraphicReshapeTool({view:o,graphic:e,enableZVertex:t.enableZ&&"move"===t.reshapeOptions.vertexOperation,enableZShape:t.enableZ&&"move"===t.reshapeOptions.shapeOperation,enableMoveGraphic:"move"===t.reshapeOptions.shapeOperation||"move-xy"===t.reshapeOptions.shapeOperation,enableMidpoints:"split"===t.reshapeOptions.edgeOperation,enableEdgeOffset:"offset"===t.reshapeOptions.edgeOperation,snappingManager:this._snappingManager});o.tools.add(s),i||this.updateGraphics.add(e);const n=[],p=new Z({activeComponent:s,tool:a,type:"update",onEnd:()=>{var e;n.forEach((e=>e.remove())),n.length=0,null==(e=this.view.tools)||e.remove(s),s.destroyed||s.destroy()},canUndo:()=>s.canUndo,undo:()=>{s.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>s.canRedo,redo:()=>{s.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"});const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);re(i)||(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),p.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);re(e)||(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(e,t))}});return n.push(...this._getHandlesForComponent(p,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(p,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e),e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!0,e.stopPropagation())}),j.WIDGET),o.on("key-up",(e=>{e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation())}),j.WIDGET)),p}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(re(a))return a;const r=new Z({activeComponent:a,type:"update",onEnd:()=>{n.forEach((e=>e.remove())),s.forEach((e=>e.remove())),n=[],s=[],r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{te(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{oe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll();const a=await this._setupMove2DOperation(t,o,i);if(re(a))return;r.onEnd(),r.destroy(),this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)r.complete();else{const e=o[0].geometry;1!==o.length||!p(e)||"point"!==e.type&&"multipoint"!==e.type?r.activeComponent.graphics=o:r.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.getItemAt(0),t=e.geometry;if(p(t)&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let a=null;"transform"===r.tool?a=await this._getReshape([e],o,i):"reshape"===r.tool&&(a=await this._getBox([e],o,i)),re(a)||(r.activeComponent.destroy(),r.activeComponent=a,r.activeComponent&&(n.forEach((e=>e.remove())),n=this._getHandlesForComponent(r,o)))}});let s=[i.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,o)),j.WIDGET),i.on("key-down",(e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==L.snappingToggle||e.repeat||(this.snappingOptions.enabledToggled=!0,e.stopPropagation()),e.key===L.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),j.WIDGET),i.on("key-up",(e=>{var t;if(e.key===L.snappingToggle&&"reshape"===(null==r||null==(t=r.activeComponent)?void 0:t.type)&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation()),e.key===L.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),j.WIDGET)],n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i}=t,a=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return re(a)?a:new a.module.default({enableMoveAllGraphics:i,highlightsEnabled:!0,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,preserveAspectRatio:r}=t,s=await this._requireModule(import("../../views/draw/support/Box.js"));return re(s)?s:new s.module.default({graphics:e,enableRotation:i,enableScaling:a,preserveAspectRatio:r,layer:this._internalGraphicsLayer,view:o,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){var i,a;const r="split"===(null==(i=t.reshapeOptions)?void 0:i.edgeOperation),s="move"===(null==(a=t.reshapeOptions)?void 0:a.shapeOperation),n=await this._requireModule(import("../../views/draw/support/Reshape.js"));return re(n)?n:new n.module.default({enableMidpoints:r,enableMovement:s,graphic:e[0],layer:this._internalGraphicsLayer,snappingManager:this._snappingManager,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map((e=>k(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map((e=>k(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;switch(o.type){case"graphic-mover":return[o.on("graphic-click",(({graphic:t,viewEvent:o})=>{var i;null!=(i=o.native)&&i.shiftKey&&(o.stopPropagation(),e.removeFromSelection(t))})),o.on("graphic-move-start",(t=>e.addToHistory(ae(t.allGraphics))))];case"box":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ae(t.graphics)))),o.on("rotate-start",(t=>e.addToHistory(ae(t.graphics)))),o.on("scale-start",(t=>e.addToHistory(ae(t.graphics))))];case"reshape":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ae([t.mover])))),o.on("reshape-start",(t=>e.addToHistory(ae([t.graphic])))),o.on("vertex-add",(t=>e.addToHistory(ae([t.oldGraphic])))),o.on("vertex-remove",(t=>e.addToHistory(ae([t.oldGraphic]))))];case"move-3d":return[o.on("graphic-move-start",(t=>{e.addToHistory(ae(t.allGraphics)),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:t.allGraphics.length>0?t.allGraphics[0]:null,type:"move-start"},type:"update"})})),o.on("graphic-move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move"},type:"update"})})),o.on("graphic-move-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move-stop"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"transform-3d":return[o.on("record-undo",(({record:t})=>{e.addToHistory({updates:[t]})})),o.on("graphic-translate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})})),o.on("graphic-translate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})})),o.on("graphic-rotate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-start"},type:"update"})})),o.on("graphic-rotate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})})),o.on("graphic-scale-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})})),o.on("graphic-scale-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})})),o.on("graphic-translate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})})),o.on("graphic-rotate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate"},type:"update"})})),o.on("graphic-scale",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"reshape-3d":return[o.on("reshape",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-add",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-remove",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];default:return}}_onTransformOrReshape2DGraphicClick(e,t,o){var i;const{graphic:a,viewEvent:r}=o;return null!=(i=r.native)&&i.shiftKey&&a.layer===this.layer?(r.stopPropagation(),e.removeFromSelection(a)):t.toggleToolOnClick?(r.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=K(t),a=(await t.async((()=>this._getFirstHit(i)))).results;if(!a.length)return void e.complete();if(t.native.shiftKey&&this._toggleSelection(a.map((e=>e.graphic)),e,o))return void t.stopPropagation();a.some((e=>e.graphic&&this.updateGraphics.includes(e.graphic)))?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some((e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0))))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===L.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===L.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===L.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&L.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();c(t)||"reshape-3d"===t.type||("reshape"!==t.type||1===o.length&&"point"===u(o[0].geometry,"type"))&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view&&this.view.map&&this.view.map.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||c(t))&&(e.attributes&&e.attributes.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view&&this.view.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view&&this.view.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayDefaultCursor(){this.view&&this.view.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,o){Y.error(new i(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}test(){return{operationHandle:this._operationHandle,defaultUpdateOptions:Q}}wait(){return _((()=>!this.updating))}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){var t;return"3d"!==(null==(t=this.view)?void 0:t.type)||this.updateOnGraphicClick||p(e)&&e.toggleToolOnClick}_disablePopup(e){if(!this._disablePopupEnabled(e))return;const t=this.view.popup;t&&c(this._originalAutoOpenEnabled)&&(this._originalAutoOpenEnabled=t.autoOpenEnabled,t.autoOpenEnabled=!1)}_restorePopup(e){if(!this._disablePopupEnabled(e))return;const t=this.view.popup;t&&p(this._originalAutoOpenEnabled)&&(t.autoOpenEnabled=this._originalAutoOpenEnabled,this._originalAutoOpenEnabled=null)}async _waitViewReady(){const e=this.view;e&&(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await v(_((()=>null==e?void 0:e.ready)),this._viewReadyAbortController.signal))}};function ee(e){return"polygon"===e||"rectangle"===e||"circle"===e}function te(e,t){ie("undo",e.history.undo,e.history.redo,t)}function oe(e,t){ie("redo",e.history.redo,e.history.undo,t)}function ie(e,t,o,i){const a=t.pop().updates,r=[];i.forEach(((t,o)=>{const i=a[o];null!=i&&("geometry"in i&&p(i.geometry)&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&p(i.symbol)&&(r.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(r.push(i),i[e](t)))})),o.push({updates:r})}function ae(e){return{updates:e.map((e=>({geometry:e.geometry})))}}function re(e){return"requireError"in e&&"aborted"===e.requireError}e([G()],X.prototype,"updating",null),e([G()],X.prototype,"_operationHandle",void 0),e([G({readOnly:!0})],X.prototype,"activeTool",null),e([G()],X.prototype,"activeFillSymbol",void 0),e([G()],X.prototype,"activeLineSymbol",void 0),e([G()],X.prototype,"activeVertexSymbol",void 0),e([G()],X.prototype,"allowDeleteKey",void 0),e([G({readOnly:!0})],X.prototype,"createGraphic",null),e([G()],X.prototype,"defaultCreateOptions",null),e([G()],X.prototype,"defaultUpdateOptions",null),e([G()],X.prototype,"layer",void 0),e([G({types:t})],X.prototype,"pointSymbol",void 0),e([G({types:t})],X.prototype,"polygonSymbol",void 0),e([G({types:t})],X.prototype,"polylineSymbol",void 0),e([G({type:V,nonNullable:!0})],X.prototype,"snappingOptions",null),e([G()],X.prototype,"_snappingManager",void 0),e([G({readOnly:!0})],X.prototype,"state",null),e([G({nonNullable:!0})],X.prototype,"tooltipOptions",void 0),e([G({readOnly:!0})],X.prototype,"updateGraphics",void 0),e([G()],X.prototype,"updateOnGraphicClick",void 0),e([G({types:t})],X.prototype,"updatePointSymbol",void 0),e([G({types:t})],X.prototype,"updatePolygonSymbol",void 0),e([G({types:t})],X.prototype,"updatePolylineSymbol",void 0),e([G({types:t})],X.prototype,"vertexSymbol",void 0),e([G({value:null})],X.prototype,"view",null),X=e([b($)],X);const se=X;export{se as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{symbolTypes as t}from"../../symbols.js";import o from"../../core/Collection.js";import"../../core/has.js";import i from"../../core/Error.js";import a from"../../core/Evented.js";import r from"../../core/Handles.js";import s from"../../core/Logger.js";import{destroyMaybe as n,isSome as p,unwrap as l,abortMaybe as h,isNone as c,unwrapOr as d,get as u}from"../../core/maybe.js";import{createAbortError as y,whenOrAbort as v}from"../../core/promiseUtils.js";import{on as m,watch as g,when as f,whenOnce as _,syncAndInitial as w}from"../../core/reactiveUtils.js";import{property as G}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as T,isLoaded as E,load as O,project as S}from"../../geometry/projection.js";import{getReferenceEllipsoid as A}from"../../geometry/projectionEllipsoid.js";import{geometryToCoordinates as k}from"../../geometry/support/coordsUtils.js";import{equals as C}from"../../geometry/support/spatialReferenceUtils.js";import H from"../../layers/GraphicsLayer.js";import{isDOMContainer as I}from"../../views/DOMContainer.js";import{SupportedGraphicResult as R,isSupportedGraphicResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedGraphicUtils.js";import{isSupportedGraphic as M}from"../../views/3d/interactive/editingTools/moveGraphic/isSupportedGraphic.js";import{isSupportedGraphic as U}from"../../views/3d/interactive/editingTools/reshapeGraphic/isSupportedGraphic.js";import{isSupportedGraphic as P}from"../../views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js";import{addUniqueLayer as x}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as j}from"../../views/input/InputManager.js";import{SKETCH_KEYS as L}from"../../views/interactive/keybindings.js";import{SnappingManager as F}from"../../views/interactive/snapping/SnappingManager.js";import V from"../../views/interactive/snapping/SnappingOptions.js";import{TooltipOptions as W}from"../../views/interactive/tooltip/TooltipOptions.js";import{createScreenPointFromEvent as K}from"../../views/support/screenUtils.js";import{OperationHandle as q,UpdateOperationHandle as Z}from"./support/OperationHandle.js";import z from"../../symbols/SimpleMarkerSymbol.js";import N from"../../symbols/SimpleFillSymbol.js";import B from"../../symbols/SimpleLineSymbol.js";const $="esri.widgets.Sketch.SketchViewModel",Y=s.getLogger($),J={defaultZ:0},Q={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,tool:"transform"};let X=class extends a.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._handles=new r,this._internalGraphicsLayer=new H({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandles=new r,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new N({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new B({color:[130,130,130,1],width:2}),this._snappingManager=null,this.tooltipOptions=new W,this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.updatePointSymbol=new z({size:10,color:[0,200,255,.5],outline:{color:"black",width:1}}),this.updatePolygonSymbol=new N({color:[12,207,255,.2],outline:{join:"round",color:[12,207,255],width:2}}),this.updatePolylineSymbol=new B({color:[12,207,255],width:2}),this.vertexSymbol=new z({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalAutoOpenEnabled=null,this.defaultCreateOptions=J,this.defaultUpdateOptions=Q,this.snappingOptions=new V}initialize(){this._handles.add([m((()=>{var e,t;return null==(e=this.view)||null==(t=e.map)?void 0:t.layers}),"change",(e=>{e.removed.includes(this.layer)&&this.cancel()})),m((()=>{var e;return null==(e=this.layer)?void 0:e.graphics}),"change",(e=>{if(p(this._operationHandle))for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())})),g((()=>{var e,t;return null!=(e=null==(t=this.layer)?void 0:t.elevationInfo)?e:null}),(e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)}),w),g((()=>this.view),(e=>{n(this._snappingManager),e&&(this._snappingManager=new F({view:e,options:this.snappingOptions}),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))}),w),g((()=>{var e;return null==(e=this.view)?void 0:e.spatialReference}),((e,t)=>{e&&t&&!e.equals(t)&&this.cancel()}))])}destroy(){this.cancel(),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeDefaultLayer(),this._snappingManager=n(this._snappingManager),this._set("view",null),this.emit("destroy")}get _defaultUpdateTool(){return"3d"===this.view.type?"move":"transform"}get updating(){return this._numUpdating>0}get activeTool(){return this._operationHandle&&this._operationHandle.tool?this._operationHandle.tool:null}get activeComponent(){return this._operationHandle?this._operationHandle.activeComponent:null}get createGraphic(){return!p(this.activeComponent)||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):l(this.activeComponent.graphic)}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...J,...e})}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...Q,...e,reshapeOptions:{...Q.reshapeOptions,...null==e?void 0:e.reshapeOptions}})}set snappingOptions(e){p(this._snappingManager)&&(this._snappingManager.options=e),this._set("snappingOptions",e)}get state(){var e;const t=!(null==(e=this.view)||!e.ready||!this.layer),o=this._operationHandle;return t&&o?"active":t?"ready":"disabled"}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o&&o.remove(this._internalGraphicsLayer),this._viewHandles.removeAll(),this.cancel()}const o="view-ready";this._handles.remove(o),e&&this._handles.add(f((()=>e.ready),(t=>{this._viewHandles.removeAll(),t&&this._viewHandles.add(this._generateViewHandles(e))}),w),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}async create(e,t){if(this.cancel(),await this._waitViewReady(),"disabled"===this.state)throw this.layer||this._logError("sketch:missing-property","Property 'layer' is missing on SketchViewModel."),this.view||this._logError("sketch:missing-property","Property 'view' is missing on SketchViewModel."),y();if(p(this.view.activeTool)&&(this.view.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");x(this.view,this._internalGraphicsLayer);const o=await this._setupCreateOperation(e,t);if(c(o)||this.destroyed)return void this.view.map.remove(this._internalGraphicsLayer);const i=()=>{if(o===this._operationHandle){const t=this.createGraphic,i=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view&&this.view.map&&this.view.map.remove(this._internalGraphicsLayer),o.cancelled||null==t||this.layer.add(t),this.emit("create",{graphic:t,state:i?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};o.on("complete",i),this._operationHandle=o,this.view.ready&&I(this.view)&&this.view.focus()}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if("disabled"===a)throw i||this._logError("sketch:missing-property","Property 'view' is missing on SketchViewModel."),o||this._logError("sketch:missing-property","Property 'layer' is missing on SketchViewModel."),y();p(this.view.activeTool)&&(this.view.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r||!r.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some((e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):!!c(e.geometry)&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0))))return;const s=await this._setupUpdateOperation(r,t);this.destroyed||c(s)||re(s)||(x(this.view,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const t of e)p(t.geometry)&&"mesh"!==t.geometry.type&&!C(t.geometry.spatialReference,this.view.spatialReference)&&(T(t.geometry.spatialReference,this.view.spatialReference)||E()||await O(),t.geometry=S(t.geometry,this.view.spatialReference));this._endAsyncOperation()}undo(){this.canUndo()&&this._operationHandle.undo()}redo(){this.canRedo()&&this._operationHandle.redo()}canUndo(){return!(!this._operationHandle||!this._operationHandle.canUndo())}canRedo(){return!(!this._operationHandle||!this._operationHandle.canRedo())}toggleUpdateTool(){this._operationHandle&&this._operationHandle.toggleTool&&this._operationHandle.toggleTool()}async _getFirstHit(e){const t=[];switch(this.view.type){case"2d":{const o=[];this.view.map.allLayers.forEach((e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)}));const i=await this.view.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];e.graphic&&t.push(e)}}break;case"3d":{const o=[this.view.map.ground];this.view.map.allLayers.forEach((e=>{"integrated-mesh"===e.type&&o.push(e)}));const i=await this.view.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];(!i.ground.mapPoint||this.view.map.ground.opacity<1||i.ground.distance-d(e.distance,0)>-Math.min(3*i.ground.distance,"global"===this.view.viewingMode?A(this.view.renderCoordsHelper.spatialReference).radius/this.view.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY))&&t.push(e)}}}return{screenPoint:e,results:t}}_generateViewHandles(e){return[e.on("immediate-click",(async t=>{const o="active"===this.state&&"create"===this._operationHandle.type;if("disabled"===this.state||o||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const i=(await t.async((()=>this._getFirstHit(K(t))))).results;let a=null;if(i.length){for(const r of i)if(r.graphic){const o=r.graphic;if(this.updateGraphics.includes(o)||o.layer===this.layer){t.stopPropagation(),a=o;break}"2d"!==e.type||this._isComponentGraphic(o)||"active"!==this.state||this.cancel()}}else"active"===this.state&&this.cancel();p(a)&&!this.updateGraphics.includes(a)&&await this.update([a],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()}),j.WIDGET)]}async _setupCreateOperation(e,t){const o={hasZ:"3d"===this.view.type,...this.defaultCreateOptions,...t},i=await this._setupDrawGraphicTool(e,this.view,o);return c(i)?null:(this.view.tools.add(i),this.view.activeTool=i,this._setupCreateOperationHandle(i))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView"),null;const i="rectangle"!==e,a="rectangle"!==e;this.snappingOptions.enabledToggled=!1;const r={view:t,mode:"rectangle"===e||"circle"===e?"hybrid":"click",...o,snapToScene:!1,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),snappingManager:this._snappingManager,forceUniformSize:a,centered:i};return"2d"===this.view.type?this._makeDrawGraphicTool2D(r):this._makeDrawGraphicTool3D(r)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return re(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ee(e.geometryType)?this.activeFillSymbol:null})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return re(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this.layer.elevationInfo,snapToScene:!p(this.layer.elevationInfo)||"absolute-height"===this.layer.elevationInfo.mode})}_setupCreateOperationHandle(e){let t=null;const o=e.forceUniformSize,i=e.centered,a=[this.view.on("key-down",(t=>{if(t.key===L.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===L.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==L.vertexAdd||t.repeat)t.key===L.undo?(t.stopPropagation(),r.undo()):t.key===L.redo?(t.stopPropagation(),r.redo()):t.key!==L.snappingToggle||"rectangle"===e.geometryType||"circle"===e.geometryType||t.repeat?t.key!==L.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===L.center&&(t.repeat||(e.centered=!i,t.stopPropagation())):(e.forceUniformSize=!o,t.stopPropagation()):(this.snappingOptions.enabledToggled=!0,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}}),j.WIDGET),this.view.on("key-up",(t=>{t.key===L.pan?e.enabled=!0:t.key===L.snappingToggle&&"rectangle"!==e.geometryType&&"circle"!==e.geometryType?(this.snappingOptions.enabledToggled=!1,t.stopPropagation()):t.key!==L.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===L.center&&(e.centered=i,t.stopPropagation()):(e.forceUniformSize=o,t.stopPropagation())}),j.WIDGET),e.on("vertex-add",(o=>{switch(t=c(t)?"start":"active",o.operation){case"apply":this.emit("create",{graphic:l(e.graphic),state:t,tool:this.activeTool,toolEventInfo:o,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[l(e.graphic)],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[l(e.graphic)],tool:e.geometryType})}})),e.on("cursor-update",(t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:l(e.graphic),state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})})),e.on("vertex-remove",(t=>{switch(t.operation){case"apply":this.emit("create",{graphic:l(e.graphic),state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[l(e.graphic)],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[l(e.graphic)],tool:e.geometryType})}})),e.on("complete",(e=>{this._set("createGraphic",l(e.graphic)),t="complete",e.aborted?r&&r.cancel():r&&r.complete()})),g((()=>this._getGraphicSymbolFromTool(e.geometryType)),(t=>{e.graphicSymbol=t}))],r=new q({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{var t;a.forEach((e=>e.remove())),a.length=0,null==(t=this.view.tools)||t.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return r}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;default:return null}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this,a={tool:this._defaultUpdateTool,...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...null==t?void 0:t.reshapeOptions}};let r=a.tool;for(const s of e)o.remove(s),o.add(s);if("3d"===i.type){if(0===e.length)return null;switch(r){case"move":return this._setupMove3DOperation(e,a,i,r);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=U(e[0]);return t===R.SUPPORTED?this._setupReshape3DOperation(e[0],a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(t)}).`),null)}case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(r){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const t=U(e[0]);return t===R.SUPPORTED?this._setupTransformOrReshape2DOperation(e,r,a,i):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(t)}).`),null)}case"transform":if(1===e.length){const t=u(e[0].geometry,"type");"point"!==t&&"multipoint"!==t||(r="reshape")}return this._setupTransformOrReshape2DOperation(e,r,a,i)}}async _setupMove3DOperation(e,t,o,i,a=!1){for(const l of e){const e=M(l);if(e!==R.SUPPORTED)return this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${D(e)}).`),null}const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(r))return r;const s=new r.module.GraphicMoveTool({view:o,enableZ:t.enableZ,snappingManager:this._snappingManager});this.view.tools.add(s),s.graphics.addMany(e),a||this.updateGraphics.addMany(e);const n=[],p=new Z({activeComponent:s,tool:i,type:"update",onEnd:()=>{var e;n.forEach((e=>e.remove())),n.length=0,null==(e=this.view.tools)||e.remove(s),s.destroyed||s.destroy()},undo:()=>{te(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{oe(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e),s.graphics.push(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);p.history.undo.forEach((e=>e.updates.splice(t,1))),p.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?s.graphics.remove(e):p.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.getItemAt(0);if(U(e)!==R.SUPPORTED)return;const a=await this._setupReshape3DOperation(e,t,o,!0);re(a)||(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(a,t))}});return n.push(...this._getHandlesForComponent(p,t),this.view.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(p,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e),e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!0,e.stopPropagation())}),j.WIDGET),o.on("key-up",(e=>{e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation())}),j.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&P(e[0])===R.SUPPORTED){const a=e[0],r=a.geometry;if(p(r)&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(p(r)&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(n))return n;const p=new n.module.GraphicTransformTool({graphic:e,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this._snappingManager});this.view.tools.add(p),this.updateGraphics.add(e);const l=[],h=new Z({activeComponent:p,tool:i,type:"update",onEnd:()=>{var e;l.forEach((e=>e.remove())),l.length=0,null==(e=this.view.tools)||e.remove(p),p.destroyed||p.destroy()},undo:()=>{te(h,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{oe(h,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"});const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);re(i)||(h.onEnd(),h.destroy(),this._setUpdateOperationHandle(i,t))},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),h.complete()},toggleTool:()=>{}});return l.push(...this._getHandlesForComponent(h,t),this.view.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(h,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(h,e),e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!0,e.stopPropagation())}),j.WIDGET),o.on("key-up",(e=>{e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation())}),j.WIDGET)),h}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,l=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(l))return l;const h=new l.module.ExtentTransformTool({graphic:e,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p});this.view.tools.add(h),i||this.updateGraphics.add(e);const c=[],d=new Z({activeComponent:h,tool:a,type:"update",onEnd:()=>{var e;c.forEach((e=>e.remove())),c.length=0,null==(e=this.view.tools)||e.remove(h),h.destroyed||h.destroy()},canUndo:()=>h.canUndo,undo:()=>{h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>h.canRedo,redo:()=>{h.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"});const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);re(i)||(d.onEnd(),d.destroy(),this._setUpdateOperationHandle(i,t))},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),d.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const e=this.updateGraphics.getItemAt(0);if(U(e)!==R.SUPPORTED)return;const i=await this._setupReshape3DOperation(e,t,o,!0);re(i)||(d.onEnd(),d.destroy(),this._setUpdateOperationHandle(i,t))}});return c.push(...this._getHandlesForComponent(d,t),this.view.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(d,e,t)),j.WIDGET),this.view.on("key-down",(e=>this._getCommonUpdateOperationKeyDownHandlers(d,e)),j.WIDGET),this.view.on("key-down",(e=>{e.key!==L.constraint||e.repeat||(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())}),j.WIDGET),this.view.on("key-up",(e=>{e.key===L.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())}),j.WIDGET)),d}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a=await this._getGraphicMover(e,t,o);if(re(a))return a;const r=new Z({activeComponent:a,tool:i,type:"update",onEnd:()=>{var e;this._displayDefaultCursor(),p.forEach((e=>e.remove())),n.forEach((e=>e.remove())),p=[],n=[],a.destroy(),null==(e=this._internalGraphicsLayer)||e.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();te(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();oe(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updateSpatialReference(e),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1,n=[o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==L.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),j.WIDGET),o.on("key-up",(e=>{e.key===L.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)}),j.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(re(r))return r;this.snappingOptions.enabledToggled=!1;const s=new r.module.GraphicReshapeTool({view:o,graphic:e,enableZVertex:t.enableZ&&"move"===t.reshapeOptions.vertexOperation,enableZShape:t.enableZ&&"move"===t.reshapeOptions.shapeOperation,enableMoveGraphic:"move"===t.reshapeOptions.shapeOperation||"move-xy"===t.reshapeOptions.shapeOperation,enableMidpoints:"split"===t.reshapeOptions.edgeOperation,enableEdgeOffset:"offset"===t.reshapeOptions.edgeOperation,snappingManager:this._snappingManager});o.tools.add(s),i||this.updateGraphics.add(e);const n=[],p=new Z({activeComponent:s,tool:a,type:"update",onEnd:()=>{var e;n.forEach((e=>e.remove())),n.length=0,null==(e=this.view.tools)||e.remove(s),s.destroyed||s.destroy()},canUndo:()=>s.canUndo,undo:()=>{s.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},canRedo:()=>s.canRedo,redo:()=>{s.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"});const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);re(i)||(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),p.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);re(e)||(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(e,t))}});return n.push(...this._getHandlesForComponent(p,t),o.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(p,e,t)),j.WIDGET),o.on("key-down",(e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e),e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!0,e.stopPropagation())}),j.WIDGET),o.on("key-up",(e=>{e.key===L.snappingToggle&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation())}),j.WIDGET)),p}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const a="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(re(a))return a;const r=new Z({activeComponent:a,type:"update",onEnd:()=>{n.forEach((e=>e.remove())),s.forEach((e=>e.remove())),n=[],s=[],r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{te(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{oe(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll();const a=await this._setupMove2DOperation(t,o,i);if(re(a))return;r.onEnd(),r.destroy(),this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach((e=>e.updates.splice(t,1))),r.history.redo.forEach((e=>e.updates.splice(t,1))),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)r.complete();else{const e=o[0].geometry;1!==o.length||!p(e)||"point"!==e.type&&"multipoint"!==e.type?r.activeComponent.graphics=o:r.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.getItemAt(0),t=e.geometry;if(p(t)&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let a=null;"transform"===r.tool?a=await this._getReshape([e],o,i):"reshape"===r.tool&&(a=await this._getBox([e],o,i)),re(a)||(r.activeComponent.destroy(),r.activeComponent=a,r.activeComponent&&(n.forEach((e=>e.remove())),n=this._getHandlesForComponent(r,o)))}});let s=[i.on("immediate-click",(e=>this._getCommonUpdateOperationClickHandlers(r,e,o)),j.WIDGET),i.on("key-down",(e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==L.snappingToggle||e.repeat||(this.snappingOptions.enabledToggled=!0,e.stopPropagation()),e.key===L.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),j.WIDGET),i.on("key-up",(e=>{var t;if(e.key===L.snappingToggle&&"reshape"===(null==r||null==(t=r.activeComponent)?void 0:t.type)&&(this.snappingOptions.enabledToggled=!1,e.stopPropagation()),e.key===L.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}}),j.WIDGET)],n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i}=t,a=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return re(a)?a:new a.module.default({enableMoveAllGraphics:i,highlightsEnabled:!0,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,preserveAspectRatio:r}=t,s=await this._requireModule(import("../../views/draw/support/Box.js"));return re(s)?s:new s.module.default({graphics:e,enableRotation:i,enableScaling:a,preserveAspectRatio:r,layer:this._internalGraphicsLayer,view:o,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){var i,a;const r="split"===(null==(i=t.reshapeOptions)?void 0:i.edgeOperation),s="move"===(null==(a=t.reshapeOptions)?void 0:a.shapeOperation),n=await this._requireModule(import("../../views/draw/support/Reshape.js"));return re(n)?n:new n.module.default({enableMidpoints:r,enableMovement:s,graphic:e[0],layer:this._internalGraphicsLayer,snappingManager:this._snappingManager,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map((e=>k(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map((e=>k(e.geometry)));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;switch(o.type){case"graphic-mover":return[o.on("graphic-click",(({graphic:t,viewEvent:o})=>{var i;null!=(i=o.native)&&i.shiftKey&&(o.stopPropagation(),e.removeFromSelection(t))})),o.on("graphic-move-start",(t=>e.addToHistory(ae(t.allGraphics))))];case"box":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ae(t.graphics)))),o.on("rotate-start",(t=>e.addToHistory(ae(t.graphics)))),o.on("scale-start",(t=>e.addToHistory(ae(t.graphics))))];case"reshape":return[o.on("graphic-click",(o=>this._onTransformOrReshape2DGraphicClick(e,t,o))),o.on("move-start",(t=>e.addToHistory(ae([t.mover])))),o.on("reshape-start",(t=>e.addToHistory(ae([t.graphic])))),o.on("vertex-add",(t=>e.addToHistory(ae([t.oldGraphic])))),o.on("vertex-remove",(t=>e.addToHistory(ae([t.oldGraphic]))))];case"move-3d":return[o.on("graphic-move-start",(t=>{e.addToHistory(ae(t.allGraphics)),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:t.allGraphics.length>0?t.allGraphics[0]:null,type:"move-start"},type:"update"})})),o.on("graphic-move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move"},type:"update"})})),o.on("graphic-move-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.allGraphics.length>0?e.allGraphics[0]:null,type:"move-stop"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"transform-3d":return[o.on("record-undo",(({record:t})=>{e.addToHistory({updates:[t]})})),o.on("graphic-translate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})})),o.on("graphic-translate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})})),o.on("graphic-rotate-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-start"},type:"update"})})),o.on("graphic-rotate-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})})),o.on("graphic-scale-start",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})})),o.on("graphic-scale-stop",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})})),o.on("graphic-translate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})})),o.on("graphic-rotate",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,angle:e.angle,type:"rotate"},type:"update"})})),o.on("graphic-scale",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];case"reshape-3d":return[o.on("reshape",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("move",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-add",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("vertex-remove",(e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})})),o.on("immediate-click",(o=>{o.shiftKey?this._toggleSelection([o.graphic],e,t):e.toggleTool()}))];default:return}}_onTransformOrReshape2DGraphicClick(e,t,o){var i;const{graphic:a,viewEvent:r}=o;return null!=(i=r.native)&&i.shiftKey&&a.layer===this.layer?(r.stopPropagation(),e.removeFromSelection(a)):t.toggleToolOnClick?(r.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=K(t),a=(await t.async((()=>this._getFirstHit(i)))).results;if(!a.length)return void e.complete();if(t.native.shiftKey&&this._toggleSelection(a.map((e=>e.graphic)),e,o))return void t.stopPropagation();a.some((e=>e.graphic&&this.updateGraphics.includes(e.graphic)))?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some((e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0))))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===L.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===L.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===L.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&L.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();c(t)||"reshape-3d"===t.type||("reshape"!==t.type||1===o.length&&"point"===u(o[0].geometry,"type"))&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view&&this.view.map&&this.view.map.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||c(t))&&(e.attributes&&e.attributes.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view&&this.view.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view&&this.view.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayDefaultCursor(){this.view&&this.view.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,o){Y.error(new i(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}test(){return{operationHandle:this._operationHandle,defaultUpdateOptions:Q}}wait(){return _((()=>!this.updating))}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){var t;return"3d"!==(null==(t=this.view)?void 0:t.type)||this.updateOnGraphicClick||p(e)&&e.toggleToolOnClick}_disablePopup(e){if(!this._disablePopupEnabled(e))return;const t=this.view.popup;t&&c(this._originalAutoOpenEnabled)&&(this._originalAutoOpenEnabled=t.autoOpenEnabled,t.autoOpenEnabled=!1)}_restorePopup(e){if(!this._disablePopupEnabled(e))return;const t=this.view.popup;t&&p(this._originalAutoOpenEnabled)&&(t.autoOpenEnabled=this._originalAutoOpenEnabled,this._originalAutoOpenEnabled=null)}async _waitViewReady(){const e=this.view;e&&(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await v(_((()=>null==e?void 0:e.ready)),this._viewReadyAbortController.signal))}};function ee(e){return"polygon"===e||"rectangle"===e||"circle"===e}function te(e,t){ie("undo",e.history.undo,e.history.redo,t)}function oe(e,t){ie("redo",e.history.redo,e.history.undo,t)}function ie(e,t,o,i){const a=t.pop().updates,r=[];i.forEach(((t,o)=>{const i=a[o];null!=i&&("geometry"in i&&p(i.geometry)&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&p(i.symbol)&&(r.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(r.push(i),i[e](t)))})),o.push({updates:r})}function ae(e){return{updates:e.map((e=>({geometry:e.geometry})))}}function re(e){return"requireError"in e&&"aborted"===e.requireError}e([G()],X.prototype,"updating",null),e([G()],X.prototype,"_operationHandle",void 0),e([G({readOnly:!0})],X.prototype,"activeTool",null),e([G()],X.prototype,"activeFillSymbol",void 0),e([G()],X.prototype,"activeLineSymbol",void 0),e([G()],X.prototype,"activeVertexSymbol",void 0),e([G()],X.prototype,"allowDeleteKey",void 0),e([G({readOnly:!0})],X.prototype,"createGraphic",null),e([G()],X.prototype,"defaultCreateOptions",null),e([G()],X.prototype,"defaultUpdateOptions",null),e([G()],X.prototype,"layer",void 0),e([G({types:t})],X.prototype,"pointSymbol",void 0),e([G({types:t})],X.prototype,"polygonSymbol",void 0),e([G({types:t})],X.prototype,"polylineSymbol",void 0),e([G({type:V,nonNullable:!0})],X.prototype,"snappingOptions",null),e([G()],X.prototype,"_snappingManager",void 0),e([G({readOnly:!0})],X.prototype,"state",null),e([G({nonNullable:!0})],X.prototype,"tooltipOptions",void 0),e([G({readOnly:!0})],X.prototype,"updateGraphics",void 0),e([G()],X.prototype,"updateOnGraphicClick",void 0),e([G({types:t})],X.prototype,"updatePointSymbol",void 0),e([G({types:t})],X.prototype,"updatePolygonSymbol",void 0),e([G({types:t})],X.prototype,"updatePolylineSymbol",void 0),e([G({types:t})],X.prototype,"vertexSymbol",void 0),e([G({value:null})],X.prototype,"view",null),X=e([b($)],X);const se=X;export{se 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../analysis/SliceAnalysis.js";import{isNone as t,applySome as r,unwrapOr as o,isSome as a}from"../../core/maybe.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{AnalysisViewModel as n}from"../support/AnalysisViewModel.js";const d=new Set;let u=class extends n{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",d.add(this)}destroy(){d.delete(this)}get state(){return this.disabled||!this.ready?"disabled":t(this.tool)?"ready":this.tool.state}get shape(){return this.analysis.shape}set shape(e){this.analysis.shape=e}get tiltEnabled(){return this.analysis.tiltEnabled}set tiltEnabled(e){this.analysis.tiltEnabled=e}get layersMode(){const e=r(this.tool,(e=>e.layersMode));return o(e,"none")}get excludedLayers(){return this.analysis.excludedLayers}set excludedLayers(e){this.analysis.excludedLayers=e}get excludeGroundSurface(){return this.analysis.excludeGroundSurface}set excludeGroundSurface(e){this.analysis.excludeGroundSurface=e}async start(){await super.start(),d.forEach((e=>{e.view===this.view&&e!==this&&e.clear()})),a(this.analysisView)&&(this.analysisView.active=!0)}clear(){this.removeTool(),this.shape=null}enterExcludeLayerMode(){a(this.tool)&&this.tool.enterExcludeLayerMode()}exitExcludeLayerMode(){a(this.tool)&&this.tool.exitExcludeLayerMode()}onConnectToAnalysisView(e){e.active=!0}constructAnalysis(){return new s}};e([l({type:s})],u.prototype,"analysis",void 0),e([l({readOnly:!0})],u.prototype,"state",null),e([l()],u.prototype,"shape",null),e([l()],u.prototype,"tiltEnabled",null),e([l()],u.prototype,"layersMode",null),e([l()],u.prototype,"excludedLayers",null),e([l({nonNullable:!0})],u.prototype,"excludeGroundSurface",null),u=e([i("esri.widgets.Slice.SliceViewModel")],u);const c=u;export{c as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../analysis/SliceAnalysis.js";import{isNone as t,applySome as r,unwrapOr as o,isSome as a}from"../../core/maybe.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{AnalysisViewModel as n}from"../support/AnalysisViewModel.js";const d=new Set;let u=class extends n{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",d.add(this)}destroy(){d.delete(this)}get state(){return this.disabled||!this.ready?"disabled":t(this.tool)?"ready":this.tool.state}get shape(){return this.analysis.shape}set shape(e){this.analysis.shape=e}get tiltEnabled(){return this.analysis.tiltEnabled}set tiltEnabled(e){this.analysis.tiltEnabled=e}get layersMode(){const e=r(this.tool,(e=>e.layersMode));return o(e,"none")}get excludedLayers(){return this.analysis.excludedLayers}set excludedLayers(e){this.analysis.excludedLayers=e}get excludeGroundSurface(){return this.analysis.excludeGroundSurface}set excludeGroundSurface(e){this.analysis.excludeGroundSurface=e}async start(){await super.start(),d.forEach((e=>{e.view===this.view&&e!==this&&e.clear()})),a(this.analysisView)&&(this.analysisView.active=!0)}clearAnalysis(){this.shape=null}enterExcludeLayerMode(){a(this.tool)&&this.tool.enterExcludeLayerMode()}exitExcludeLayerMode(){a(this.tool)&&this.tool.exitExcludeLayerMode()}onConnectToAnalysisView(e){e.active=!0}constructAnalysis(){return new s}};e([l({type:s})],u.prototype,"analysis",void 0),e([l({readOnly:!0})],u.prototype,"state",null),e([l()],u.prototype,"shape",null),e([l()],u.prototype,"tiltEnabled",null),e([l()],u.prototype,"layersMode",null),e([l()],u.prototype,"excludedLayers",null),e([l({nonNullable:!0})],u.prototype,"excludeGroundSurface",null),u=e([i("esri.widgets.Slice.SliceViewModel")],u);const c=u;export{c 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{equalsShallow as i}from"../../core/lang.js";import t from"../../core/Logger.js";import{isSome as n,abortMaybe as o,isNone as a,applySome as r}from"../../core/maybe.js";import{createTask as l,throwIfAborted as h,isAbortError as c,isAborted as y}from"../../core/promiseUtils.js";import{watch as w,whenOnce as p,when as v}from"../../core/reactiveUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";let m=class extends e{constructor(s={}){super(s),this.analysisView=null,this._reconnectViewTask=null,this._parentChangeFromReconnect=!1,this.logger=t.getLogger(this.declaredClass);const e=null==s?void 0:s.analysis;n(e)?this.analysis=e:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0)),s&&null!=s.visible&&(this.visible=s.visible)}normalizeCtorArgs(s){const{analysis:e,...i}=s;return i}initialize(){this.own([w((()=>({readyAndNotSupported:n(this.view)&&this.view.ready&&!this.supported})),(({readyAndNotSupported:s})=>{s&&this.logger.errorOnce(this.unsupportedErrorMessage)}),{sync:!0,initial:!0,equals:i}),w((()=>({analysis:this.analysis,parent:r(this.analysis,(({parent:s})=>s))})),(({parent:s})=>{this._parentChangeFromReconnect||s===this.view||this._set("isAnalysisOwner",!1);const e=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,e&&this._scheduleViewReconnect()})),w((()=>({view:this.view,ready:n(this.view)&&this.view.ready,supported:this.supported})),(({view:s},{view:e})=>{s!==e&&this._disconnectFromView(e),this._scheduleViewReconnect()}),{sync:!0,initial:!0,equals:i}),w((()=>this.analysis.isEditable),(s=>{a(this.analysisView)||(s&&a(this.tool)?this.createTool():s||!n(this.tool)||this.tool.active||this.removeTool())}))]),this.analysis.visible=this.visible}destroy(){this.removeTool(),this._reconnectViewTask=o(this._reconnectViewTask),this._disconnectFromView(this.view),this._set("view",null),n(this.analysis)&&(this.isAnalysisOwner?(this.analysis.destroy(),this._set("analysis",null)):this.analysis.visible=!0)}get supported(){return a(this.view)||this.view.type===this.supportedViewType}get view(){return this._get("view")}set view(s){s!==this._get("view")&&(this.removeTool(),this._set("view",s))}set visible(s){this._set("visible",s),n(this.tool)&&(this.tool.visible=s)}get active(){return n(this.tool)&&this.tool.active}get disabled(){return a(this.view)||!this.view.ready||!this.supported}set analysis(s){s!==this._get("analysis")&&(this._disconnectFromView(this.view),this._setExternalAnalysis(s),this._scheduleViewReconnect())}get ready(){return n(this.analysisView)&&!this.connectingToView}get connectingToView(){return n(this._reconnectViewTask)}get isAnalysisOwner(){return this._get("isAnalysisOwner")}get tool(){return n(this.analysisView)?this.analysisView.tool:null}async start(){if(this.clear(),this.ready||await p((()=>this.ready)),a(this.analysisView)||a(this.view))return;this.createTool();const s=this.analysisView.tool;a(s)||(this.view.activeTool=s,v((()=>s.created),(()=>{s.active&&n(this.view)&&(this.view.activeTool=null)}),{initial:!0,once:!0}))}onConnectToAnalysisView(s){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=o(this._reconnectViewTask);const s=l((async e=>{try{await this._reconnectView(e)}catch(i){if(h(e),!c(i))return void this.logger.warn("Failed to use analysis in view model",i);throw i}finally{s===this._reconnectViewTask&&(this._reconnectViewTask=null)}}));this._reconnectViewTask=s}async _reconnectView(s){const{view:e}=this,i=n(e)&&e.ready&&this.supported,t=this.analysis;if(this._disconnectFromView(e),i&&!a(e)&&!a(t)){if(this.isAnalysisOwner){if(n(t.parent))return void this.logger.errorOnce("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,e.analyses.add(t)}this.analysisView=await e.whenAnalysisView(t),y(s)?this._disconnectFromView(e):(this.onConnectToAnalysisView(this.analysisView),!this.analysis.visible&&this.isAnalysisOwner||(this.createTool(),this._removeToolIfAnalysisIsIncomplete()))}}_disconnectFromView(s){n(s)&&this.isAnalysisOwner&&(this._parentChangeFromReconnect=!0,s.analyses.remove(this.analysis)),this.onDisconnectFromAnalysisView(),this.removeTool(),this.analysisView=null}_setExternalAnalysis(s){if(n(this.analysis)&&!this.isAnalysisOwner&&(this.analysis.visible=!0),this._set("analysis",s),this._set("isAnalysisOwner",!1),this._parentChangeFromReconnect=!1,!s.isEditable){const e=s.nonEditableMessage;this.logger.warn(`The assigned ${s.type} analysis object will not be editable in the view. ${e}`)}}createTool(){if(this.removeTool(),a(this.analysisView)||!this.supported)return;this.analysisView.interactive=!0;const s=this.analysisView.tool;n(s)&&(s.visible=this.visible)}removeTool(){a(this.analysisView)||(this.analysisView.interactive=!1)}_removeToolIfAnalysisIsIncomplete(){if(a(this.analysisView))return;const s=this.analysisView.tool;a(s)||s.created||this.removeTool()}};s([u()],m.prototype,"supported",null),s([u({value:null})],m.prototype,"view",null),s([u({type:Boolean,value:!0})],m.prototype,"visible",null),s([u()],m.prototype,"active",null),s([u()],m.prototype,"disabled",null),s([u({nonNullable:!0})],m.prototype,"analysis",null),s([u()],m.prototype,"analysisView",void 0),s([u()],m.prototype,"ready",null),s([u()],m.prototype,"connectingToView",null),s([u({readOnly:!0})],m.prototype,"isAnalysisOwner",null),s([u()],m.prototype,"_reconnectViewTask",void 0),s([u()],m.prototype,"tool",null),m=s([d("esri.widgets.support.AnalysisViewModel")],m);export{m as AnalysisViewModel};
5
+ import{_ as s}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{equalsShallow as i}from"../../core/lang.js";import t from"../../core/Logger.js";import{isSome as n,abortMaybe as o,isNone as a,applySome as r}from"../../core/maybe.js";import{createTask as l,throwIfAborted as h,isAbortError as c,isAborted as y}from"../../core/promiseUtils.js";import{watch as w,whenOnce as p,when as v}from"../../core/reactiveUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";let m=class extends e{constructor(s={}){super(s),this.analysisView=null,this._reconnectViewTask=null,this._parentChangeFromReconnect=!1,this.logger=t.getLogger(this.declaredClass);const e=null==s?void 0:s.analysis;n(e)?this.analysis=e:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0)),s&&null!=s.visible&&(this.visible=s.visible)}normalizeCtorArgs(s){const{analysis:e,...i}=s;return i}initialize(){this.own([w((()=>({readyAndNotSupported:n(this.view)&&this.view.ready&&!this.supported})),(({readyAndNotSupported:s})=>{s&&this.logger.errorOnce(this.unsupportedErrorMessage)}),{sync:!0,initial:!0,equals:i}),w((()=>({analysis:this.analysis,parent:r(this.analysis,(({parent:s})=>s))})),(({parent:s})=>{this._parentChangeFromReconnect||s===this.view||this._set("isAnalysisOwner",!1);const e=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,e&&this._scheduleViewReconnect()})),w((()=>({view:this.view,ready:n(this.view)&&this.view.ready,supported:this.supported})),(({view:s},{view:e})=>{s!==e&&this._disconnectFromView(e),this._scheduleViewReconnect()}),{sync:!0,initial:!0,equals:i}),w((()=>this.analysis.isEditable),(s=>{a(this.analysisView)||(s&&a(this.tool)?this.createTool():s||!n(this.tool)||this.tool.active||this.removeTool())}))]),this.analysis.visible=this.visible}destroy(){this.removeTool(),this._reconnectViewTask=o(this._reconnectViewTask),this._disconnectFromView(this.view),this._set("view",null),n(this.analysis)&&(this.isAnalysisOwner?(this.analysis.destroy(),this._set("analysis",null)):this.analysis.visible=!0)}get supported(){return a(this.view)||this.view.type===this.supportedViewType}get view(){return this._get("view")}set view(s){s!==this._get("view")&&(this.removeTool(),this._set("view",s))}set visible(s){this._set("visible",s),n(this.tool)&&(this.tool.visible=s)}get active(){return n(this.tool)&&this.tool.active}get disabled(){return a(this.view)||!this.view.ready||!this.supported}set analysis(s){s!==this._get("analysis")&&(this._disconnectFromView(this.view),this._setExternalAnalysis(s),this._scheduleViewReconnect())}get ready(){return n(this.analysisView)&&!this.connectingToView}get connectingToView(){return n(this._reconnectViewTask)}get isAnalysisOwner(){return this._get("isAnalysisOwner")}get tool(){return n(this.analysisView)?this.analysisView.tool:null}clear(){this.removeTool(),this.clearAnalysis()}async start(){if(this.clear(),this.ready||await p((()=>this.ready)),a(this.analysisView)||a(this.view))return;this.createTool();const s=this.analysisView.tool;a(s)||(this.view.activeTool=s,v((()=>s.created),(()=>{s.active&&n(this.view)&&(this.view.activeTool=null)}),{initial:!0,once:!0}))}onConnectToAnalysisView(s){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=o(this._reconnectViewTask);const s=l((async e=>{try{await this._reconnectView(e)}catch(i){if(h(e),!c(i))return void this.logger.warn("Failed to use analysis in view model",i);throw i}finally{s===this._reconnectViewTask&&(this._reconnectViewTask=null)}}));this._reconnectViewTask=s}async _reconnectView(s){const{view:e}=this,i=n(e)&&e.ready&&this.supported,t=this.analysis;if(this._disconnectFromView(e),i&&!a(e)&&!a(t)){if(this.isAnalysisOwner){if(n(t.parent))return void this.logger.errorOnce("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,e.analyses.add(t)}this.analysisView=await e.whenAnalysisView(t),y(s)?this._disconnectFromView(e):(this.onConnectToAnalysisView(this.analysisView),!this.analysis.visible&&this.isAnalysisOwner||(this.createTool(),this._removeToolIfAnalysisIsIncomplete()))}}_disconnectFromView(s){n(s)&&this.isAnalysisOwner&&(this._parentChangeFromReconnect=!0,s.analyses.remove(this.analysis),this.clearAnalysis()),this.onDisconnectFromAnalysisView(),this.removeTool(),this.analysisView=null}_setExternalAnalysis(s){if(n(this.analysis)&&!this.isAnalysisOwner&&(this.analysis.visible=!0),this._set("analysis",s),this._set("isAnalysisOwner",!1),this._parentChangeFromReconnect=!1,!s.isEditable){const e=s.nonEditableMessage;this.logger.warn(`The assigned ${s.type} analysis object will not be editable in the view. ${e}`)}}createTool(){if(this.removeTool(),a(this.analysisView)||!this.supported)return;this.analysisView.interactive=!0;const s=this.analysisView.tool;n(s)&&(s.visible=this.visible)}removeTool(){a(this.analysisView)||(this.analysisView.interactive=!1)}_removeToolIfAnalysisIsIncomplete(){if(a(this.analysisView))return;const s=this.analysisView.tool;a(s)||s.created||this.removeTool()}};s([u()],m.prototype,"supported",null),s([u({value:null})],m.prototype,"view",null),s([u({type:Boolean,value:!0})],m.prototype,"visible",null),s([u()],m.prototype,"active",null),s([u()],m.prototype,"disabled",null),s([u({nonNullable:!0})],m.prototype,"analysis",null),s([u()],m.prototype,"analysisView",void 0),s([u()],m.prototype,"ready",null),s([u()],m.prototype,"connectingToView",null),s([u({readOnly:!0})],m.prototype,"isAnalysisOwner",null),s([u()],m.prototype,"_reconnectViewTask",void 0),s([u()],m.prototype,"tool",null),m=s([d("esri.widgets.support.AnalysisViewModel")],m);export{m as AnalysisViewModel};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../chunks/tslib.es6.js";import e from"../../core/Handles.js";import{isSome as i,destroyMaybe as t,abortMaybe as n,isNone as a,applySome as o}from"../../core/maybe.js";import{createTask as r,throwIfAborted as l,isAbortError as c,isAborted as h}from"../../core/promiseUtils.js";import{watch as y,syncAndInitial as w,whenOnce as p}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{InteractiveToolViewModel as m}from"./InteractiveToolViewModel.js";let V=class extends m{constructor(s={}){super(s),this.analysisView=null,this._reconnectViewTask=null,this._analysisBaseHandles=new e,this._parentChangeFromReconnect=!1;const t=null==s?void 0:s.analysis;i(t)?this.analysis=t:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0))}normalizeCtorArgs(s){const{analysis:e,...i}=s;return i}initialize(){this._analysisBaseHandles.add([y((()=>({analysis:this.analysis,parent:o(this.analysis,(({parent:s})=>s))})),(({parent:s})=>{this._parentChangeFromReconnect||s===this.view||this._set("isAnalysisOwner",!1);const e=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,e&&this._scheduleViewReconnect()})),y((()=>({view:this.view,ready:i(this.view)&&this.view.ready,supported:this.supported})),(({view:s},{view:e})=>{s!==e&&this._disconnectFromView(e),this._scheduleViewReconnect()}),w),y((()=>this.analysis.isEditable),((s,e)=>{a(this.analysisView)||(s&&!e&&a(this.tool)?this.createTool():!s&&e&&i(this.tool)&&!this.tool.active&&this.removeTool())}))]),this.analysis.visible=this.visible}destroy(){this._analysisBaseHandles=t(this._analysisBaseHandles),this._reconnectViewTask=n(this._reconnectViewTask),this._disconnectFromView(this.view),i(this.analysis)&&(this.isAnalysisOwner?(this.analysis.destroy(),this._set("analysis",null)):this.analysis.visible=!0)}set analysis(s){s!==this._get("analysis")&&(this._disconnectFromView(this.view),this._setExternalAnalysis(s),this._scheduleViewReconnect())}get ready(){return i(this.analysisView)&&!this.connectingToView}get connectingToView(){return i(this._reconnectViewTask)}get isAnalysisOwner(){return this._get("isAnalysisOwner")}async start(){this.clear(),this.ready||await p((()=>this.ready)),this.createTool({interactive:!0})}onConnectToAnalysisView(s){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=n(this._reconnectViewTask);const s=r((async e=>{try{await this._reconnectView(e)}catch(i){if(l(e),!c(i))return void this.logger.warn("Failed to use analysis in view model",i);throw i}finally{s===this._reconnectViewTask&&(this._reconnectViewTask=null)}}));this._reconnectViewTask=s}async _reconnectView(s){const{view:e}=this,t=i(e)&&e.ready&&this.supported,n=this.analysis;if(this._disconnectFromView(e),t&&!a(e)&&!a(n)){if(this.isAnalysisOwner){if(i(n.parent))return void this.logError("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,e.analyses.add(n)}this.analysisView=await e.whenAnalysisView(n),h(s)?this._disconnectFromView(e):(this.onConnectToAnalysisView(this.analysisView),!this.analysis.visible&&this.isAnalysisOwner||this.createTool())}}_disconnectFromView(s){i(s)&&this.isAnalysisOwner&&(this._parentChangeFromReconnect=!0,s.analyses.remove(this.analysis)),this.analysisView=null,this.onDisconnectFromAnalysisView(),this.removeTool()}_setExternalAnalysis(s){if(i(this.analysis)&&!this.isAnalysisOwner&&(this.analysis.visible=!0),this._set("analysis",s),this._set("isAnalysisOwner",!1),this._parentChangeFromReconnect=!1,!s.isEditable){const e=s.nonEditableMessage;this.logger.warn(`The assigned ${s.type} analysis object will not be editable in the view. ${e}`)}}};s([d({nonNullable:!0})],V.prototype,"analysis",null),s([d()],V.prototype,"analysisView",void 0),s([d()],V.prototype,"ready",null),s([d()],V.prototype,"connectingToView",null),s([d({readOnly:!0})],V.prototype,"isAnalysisOwner",null),s([d()],V.prototype,"_reconnectViewTask",void 0),V=s([_("esri.widgets.support.InteractiveAnalysisViewModel")],V);export{V as InteractiveAnalysisViewModel};
5
+ import{_ as s}from"../../chunks/tslib.es6.js";import e from"../../core/Handles.js";import{isSome as i,destroyMaybe as t,abortMaybe as n,isNone as a,applySome as o}from"../../core/maybe.js";import{createTask as r,throwIfAborted as l,isAbortError as c,isAborted as h}from"../../core/promiseUtils.js";import{watch as y,syncAndInitial as w,whenOnce as p}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{InteractiveToolViewModel as m}from"./InteractiveToolViewModel.js";let V=class extends m{constructor(s={}){super(s),this.analysisView=null,this._reconnectViewTask=null,this._analysisBaseHandles=new e,this._parentChangeFromReconnect=!1;const t=null==s?void 0:s.analysis;i(t)?this.analysis=t:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0))}normalizeCtorArgs(s){const{analysis:e,...i}=s;return i}initialize(){this._analysisBaseHandles.add([y((()=>({analysis:this.analysis,parent:o(this.analysis,(({parent:s})=>s))})),(({parent:s})=>{this._parentChangeFromReconnect||s===this.view||this._set("isAnalysisOwner",!1);const e=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,e&&this._scheduleViewReconnect()})),y((()=>({view:this.view,ready:i(this.view)&&this.view.ready,supported:this.supported})),(({view:s},{view:e})=>{s!==e&&this._disconnectFromView(e),this._scheduleViewReconnect()}),w),y((()=>this.analysis.isEditable),((s,e)=>{a(this.analysisView)||(s&&!e&&a(this.tool)?this.createTool():!s&&e&&i(this.tool)&&!this.tool.active&&this.removeTool())}))]),this.analysis.visible=this.visible}destroy(){this._analysisBaseHandles=t(this._analysisBaseHandles),this._reconnectViewTask=n(this._reconnectViewTask),this._disconnectFromView(this.view),i(this.analysis)&&(this.isAnalysisOwner?(this.analysis.destroy(),this._set("analysis",null)):this.analysis.visible=!0)}set analysis(s){s!==this._get("analysis")&&(this._disconnectFromView(this.view),this._setExternalAnalysis(s),this._scheduleViewReconnect())}get ready(){return i(this.analysisView)&&!this.connectingToView}get connectingToView(){return i(this._reconnectViewTask)}get isAnalysisOwner(){return this._get("isAnalysisOwner")}async start(){this.clear(),this.ready||await p((()=>this.ready)),this.createTool({interactive:!0})}clear(){this.removeTool(),this.clearAnalysis()}onConnectToAnalysisView(s){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=n(this._reconnectViewTask);const s=r((async e=>{try{await this._reconnectView(e)}catch(i){if(l(e),!c(i))return void this.logger.warn("Failed to use analysis in view model",i);throw i}finally{s===this._reconnectViewTask&&(this._reconnectViewTask=null)}}));this._reconnectViewTask=s}async _reconnectView(s){const{view:e}=this,t=i(e)&&e.ready&&this.supported,n=this.analysis;if(this._disconnectFromView(e),t&&!a(e)&&!a(n)){if(this.isAnalysisOwner){if(i(n.parent))return void this.logError("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,e.analyses.add(n)}this.analysisView=await e.whenAnalysisView(n),h(s)?this._disconnectFromView(e):(this.onConnectToAnalysisView(this.analysisView),!this.analysis.visible&&this.isAnalysisOwner||this.createTool())}}_disconnectFromView(s){i(s)&&this.isAnalysisOwner&&(this._parentChangeFromReconnect=!0,s.analyses.remove(this.analysis),this.clearAnalysis()),this.analysisView=null,this.onDisconnectFromAnalysisView(),this.removeTool()}_setExternalAnalysis(s){if(i(this.analysis)&&!this.isAnalysisOwner&&(this.analysis.visible=!0),this._set("analysis",s),this._set("isAnalysisOwner",!1),this._parentChangeFromReconnect=!1,!s.isEditable){const e=s.nonEditableMessage;this.logger.warn(`The assigned ${s.type} analysis object will not be editable in the view. ${e}`)}}};s([d({nonNullable:!0})],V.prototype,"analysis",null),s([d()],V.prototype,"analysisView",void 0),s([d()],V.prototype,"ready",null),s([d()],V.prototype,"connectingToView",null),s([d({readOnly:!0})],V.prototype,"isAnalysisOwner",null),s([d()],V.prototype,"_reconnectViewTask",void 0),V=s([_("esri.widgets.support.InteractiveAnalysisViewModel")],V);export{V as InteractiveAnalysisViewModel};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7845],{24133:(e,t,i)=>{i.d(t,{Q:()=>a});var n=i(67676),s=i(70586),r=i(44553),o=i(88764);class a{constructor(e=9,t){this.compareMinX=h,this.compareMinY=c,this._toBBox=e=>e,this._maxEntries=Math.max(4,e||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),t&&("function"==typeof t?this._toBBox=t:this._initFormat(t)),this.clear()}destroy(){this.clear(),x.prune(),b.prune(),S.prune(),w.prune()}all(e){this._all(this.data,e)}search(e,t){let i=this.data;const n=this._toBBox;if(_(e,i))for(x.clear();i;){for(let s=0,r=i.children.length;s<r;s++){const r=i.children[s],o=i.leaf?n(r):r;_(e,o)&&(i.leaf?t(r):g(e,o)?this._all(r,t):x.push(r))}i=x.pop()}}collides(e){let t=this.data;const i=this._toBBox;if(!_(e,t))return!1;for(x.clear();t;){for(let n=0,s=t.children.length;n<s;n++){const s=t.children[n],r=t.leaf?i(s):s;if(_(e,r)){if(t.leaf||g(e,r))return!0;x.push(s)}}t=x.pop()}return!1}load(e){if(!e.length)return this;if(e.length<this._minEntries){for(let t=0,i=e.length;t<i;t++)this.insert(e[t]);return this}let t=this._build(e.slice(0,e.length),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=new B([]),this}remove(e){if(!e)return this;let t,i=this.data,r=null,o=0,a=!1;const l=this._toBBox(e);for(S.clear(),w.clear();i||S.length>0;){var u;if(i||(i=(0,s.j0)(S.pop()),r=S.data[S.length-1],o=null!=(u=w.pop())?u:0,a=!0),i.leaf&&(t=(0,n.cq)(i.children,e,i.children.length,i.indexHint),-1!==t))return i.children.splice(t,1),S.push(i),this._condense(S),this;a||i.leaf||!g(i,l)?r?(o++,i=r.children[o],a=!1):i=null:(S.push(i),w.push(o),o=0,r=i,i=i.children[0])}return this}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let i=e;for(b.clear();i;){var n;if(!0===i.leaf)for(const e of i.children)t(e);else b.pushArray(i.children);i=null!=(n=b.pop())?n:null}}_build(e,t,i,n){const s=i-t+1;let r=this._maxEntries;if(s<=r){const n=new B(e.slice(t,i+1));return l(n,this._toBBox),n}n||(n=Math.ceil(Math.log(s)/Math.log(r)),r=Math.ceil(s/r**(n-1)));const o=new E([]);o.height=n;const a=Math.ceil(s/r),u=a*Math.ceil(Math.sqrt(r));I(e,t,i,u,this.compareMinX);for(let s=t;s<=i;s+=u){const t=Math.min(s+u-1,i);I(e,s,t,a,this.compareMinY);for(let i=s;i<=t;i+=a){const s=Math.min(i+a-1,t);o.children.push(this._build(e,i,s,n-1))}}return l(o,this._toBBox),o}_chooseSubtree(e,t,i,n){for(;n.push(t),!0!==t.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let r=0,o=t.children.length;r<o;r++){const o=t.children[r],a=p(o),l=y(e,o)-a;l<s?(s=l,n=a<n?a:n,i=o):l===s&&a<n&&(n=a,i=o)}t=i||t.children[0]}return t}_insert(e,t,i){const n=this._toBBox,s=i?e:n(e);S.clear();const r=this._chooseSubtree(s,this.data,t,S);for(r.children.push(e),d(r,s);t>=0&&S.data[t].children.length>this._maxEntries;)this._split(S,t),t--;this._adjustParentBBoxes(s,S,t)}_split(e,t){const i=e.data[t],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);const r=this._chooseSplitIndex(i,s,n);if(!r)return void console.log(" Error: assertion failed at PooledRBush._split: no valid split index");const o=i.children.splice(r,i.children.length-r),a=i.leaf?new B(o):new E(o);a.height=i.height,l(i,this._toBBox),l(a,this._toBBox),t?e.data[t-1].children.push(a):this._splitRoot(i,a)}_splitRoot(e,t){this.data=new E([e,t]),this.data.height=e.height+1,l(this.data,this._toBBox)}_chooseSplitIndex(e,t,i){let n,s,r;n=s=1/0;for(let o=t;o<=i-t;o++){const t=u(e,0,o,this._toBBox),a=u(e,o,i,this._toBBox),l=m(t,a),d=p(t)+p(a);l<n?(n=l,r=o,s=d<s?d:s):l===n&&d<s&&(s=d,r=o)}return r}_chooseSplitAxis(e,t,i){const n=e.leaf?this.compareMinX:h,s=e.leaf?this.compareMinY:c;this._allDistMargin(e,t,i,n)<this._allDistMargin(e,t,i,s)&&e.children.sort(n)}_allDistMargin(e,t,i,n){e.children.sort(n);const s=this._toBBox,r=u(e,0,t,s),o=u(e,i-t,i,s);let a=f(r)+f(o);for(let n=t;n<i-t;n++){const t=e.children[n];d(r,e.leaf?s(t):t),a+=f(r)}for(let n=i-t-1;n>=t;n--){const t=e.children[n];d(o,e.leaf?s(t):t),a+=f(o)}return a}_adjustParentBBoxes(e,t,i){for(let n=i;n>=0;n--)d(t.data[n],e)}_condense(e){for(let t=e.length-1;t>=0;t--){const i=e.data[t];if(0===i.children.length)if(t>0){const s=e.data[t-1],r=s.children;r.splice((0,n.cq)(r,i,r.length,s.indexHint),1)}else this.clear();else l(i,this._toBBox)}}_initFormat(e){const t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(e[0])),this.compareMinY=new Function("a","b",t.join(e[1])),this._toBBox=new Function("a","return {minX: a"+e[0]+", minY: a"+e[1]+", maxX: a"+e[2]+", maxY: a"+e[3]+"};")}}function l(e,t){u(e,0,e.children.length,t,e)}function u(e,t,i,n,s){s||(s=new B([])),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let r,o=t;o<i;o++)r=e.children[o],d(s,e.leaf?n(r):r);return s}function d(e,t){e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY)}function h(e,t){return e.minX-t.minX}function c(e,t){return e.minY-t.minY}function p(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function f(e){return e.maxX-e.minX+(e.maxY-e.minY)}function y(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function m(e,t){const i=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),r=Math.min(e.maxY,t.maxY);return Math.max(0,s-i)*Math.max(0,r-n)}function g(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function _(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function I(e,t,i,n,r){const a=[t,i];for(;a.length;){const t=(0,s.j0)(a.pop()),i=(0,s.j0)(a.pop());if(t-i<=n)continue;const l=i+Math.ceil((t-i)/n/2)*n;(0,o.q)(e,l,i,t,r),a.push(i,l,l,t)}}const x=new r.Z,b=new r.Z,S=new r.Z,w=new r.Z({deallocator:void 0});class F extends class{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}}{constructor(){super(...arguments),this.height=1,this.indexHint=new n.SO}}class B extends F{constructor(e){super(),this.children=e,this.leaf=!0}}class E extends F{constructor(e){super(),this.children=e,this.leaf=!1}}},37549:(e,t,i)=>{i.d(t,{H:()=>o});var n=i(80442),s=i(24133);const r={minX:0,minY:0,maxX:0,maxY:0};class o{constructor(){this._indexInvalid=!1,this._boundsToLoad=[],this._boundsById=new Map,this._idByBounds=new Map,this._index=new s.Q(9,(0,n.Z)("esri-csp-restrictions")?e=>({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){const e=new Array(this._idByBounds.size);let t=0;this._idByBounds.forEach(((i,n)=>{e[t++]=n})),this._indexInvalid=!1,this._index.clear(),this._index.load(e)}else this._boundsToLoad.length&&(this._index.load(this._boundsToLoad.filter((e=>this._idByBounds.has(e)))),this._boundsToLoad.length=0)}}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(e){const t=this._boundsById.get(e);this._boundsById.delete(e),t&&(this._idByBounds.delete(t),this._indexInvalid||this._index.remove(t))}forEachInBounds(e,t){this._loadIndex(),function(e,t,i){r.minX=t[0],r.minY=t[1],r.maxX=t[2],r.maxY=t[3],e.search(r,i)}(this._index,e,(e=>t(this._idByBounds.get(e))))}get(e){return this._boundsById.get(e)}has(e){return this._boundsById.has(e)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(e,t){if(!this._indexInvalid){const t=this._boundsById.get(e);t&&(this._index.remove(t),this._idByBounds.delete(t))}this._boundsById.set(e,t),t&&(this._idByBounds.set(t,e),this._indexInvalid||(this._boundsToLoad.push(t),this._boundsToLoad.length>5e4&&this._loadIndex()))}}},57191:(e,t,i)=>{i.d(t,{Z:()=>y});var n=i(20102),s=i(32448),r=i(92604),o=i(70586),a=i(60437),l=i(24470),u=i(98732),d=i(37549),h=i(29730),c=i(70272),p=i(5428);const f={getObjectId:e=>e.objectId,getAttributes:e=>e.attributes,getAttribute:(e,t)=>e.attributes[t],cloneWithGeometry:(e,t)=>new c.u_(t,e.attributes,null,e.objectId),getGeometry:e=>e.geometry,getCentroid:(e,t)=>((0,o.Wi)(e.centroid)&&(e.centroid=(0,h.Y)(new p.Z,e.geometry,t.hasZ,t.hasM)),e.centroid)};class y{constructor(e){this.geometryInfo=e,this._boundsStore=new d.H,this._featuresById=new Map,this._markedIds=new Set,this.events=new s.Z,this.featureAdapter=f}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){if(!this.numFeatures)return null;const e=(0,l.Ue)(l.Gv);return this._featuresById.forEach((t=>{const i=this._boundsStore.get(t.objectId);i&&(e[0]=Math.min(i[0],e[0]),e[1]=Math.min(i[1],e[1]),e[2]=Math.max(i[2],e[2]),e[3]=Math.max(i[3],e[3]))})),e}get storeStatistics(){let e=0;return this._featuresById.forEach((t=>{(0,o.pC)(t.geometry)&&t.geometry.coords&&(e+=t.geometry.coords.length)})),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t,i){for(const n of e){const e=this._boundsStore.get(n.objectId);e&&t((0,a.JR)(i,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach((t=>e(t)))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,(e=>{t(this._featuresById.get(e))}))}startMarkingUsedFeatures(){this._boundsStore.invalidateIndex(),this._markedIds.clear()}sweep(){let e=!1;this._featuresById.forEach(((t,i)=>{this._markedIds.has(i)||(e=!0,this._remove(t))})),this._markedIds.clear(),e&&this._emitChanged()}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const t=e.objectId;if(null==t)return void r.Z.getLogger("esri.layers.graphics.data.FeatureStore").error(new n.Z("featurestore:invalid-feature","feature id is missing",{feature:e}));const i=this._featuresById.get(t);let s;if(this._markedIds.add(t),i?(e.displayId=i.displayId,s=this._boundsStore.get(t),this._boundsStore.delete(t)):(0,o.pC)(this.onFeatureAdd)&&this.onFeatureAdd(e),(0,o.Wi)(e.geometry)||!e.geometry.coords||!e.geometry.coords.length)return this._boundsStore.set(t,null),void this._featuresById.set(t,e);s=(0,u.$)((0,o.pC)(s)?s:(0,l.Ue)(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),(0,o.pC)(s)&&this._boundsStore.set(t,s),this._featuresById.set(t,e)}_remove(e){return(0,o.pC)(this.onFeatureRemove)&&this.onFeatureRemove(e),this._markedIds.delete(e.objectId),this._boundsStore.delete(e.objectId),this._featuresById.delete(e.objectId),e}}},97845:(e,t,i)=>{i.r(t),i.d(t,{default:()=>b});var n=i(3172),s=i(20102),r=i(92604),o=i(70586),a=i(95330),l=i(33955),u=i(8744),d=i(98732),h=i(57191),c=i(37427),p=i(7673),f=i(92722),y=i(25278),m=i(23095),g=i(99514),_=i(86719),I=i(35671);const x={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class b{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){var e;null==(e=this._queryEngine)||e.destroy(),this._queryEngine=this._fieldsIndex=this._createDefaultAttributes=null}async load(e,t={}){this.loadOptions={url:e.url,customParameters:e.customParameters};const i=[];await this._checkProjection(e.spatialReference);let n=null;e.url&&(n=await this._fetch(null==t?void 0:t.signal));const r=(0,f.my)(n,{geometryType:e.geometryType}),o=e.fields||r.fields||[],a=null!=e.hasZ?e.hasZ:r.hasZ,l=r.geometryType,d=e.objectIdField||r.objectIdFieldName||"__OBJECTID",c=e.spatialReference||u.Zn;let m=e.timeInfo;o===r.fields&&r.unknownFields.length>0&&i.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:r.unknownFields}});let b=o.find((e=>e.name===d));b?("esriFieldTypeString"!==b.type&&(b.type="esriFieldTypeOID"),b.editable=!1,b.nullable=!1):(b={alias:d,name:d,type:"string"===r.objectIdFieldType?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},o.unshift(b));const S={};for(const e of o){if(null==e.name&&(e.name=e.alias),null==e.alias&&(e.alias=e.name),!e.name)throw new s.Z("geojson-layer:invalid-field-name","field name is missing",{field:e});if(!_.v.jsonValues.includes(e.type))throw new s.Z("geojson-layer:invalid-field-type",`invalid type for field "${e.name}"`,{field:e});if(e.name!==b.name){const t=(0,I.os)(e);void 0!==t&&(S[e.name]=t)}}this._fieldsIndex=new g.Z(o);const w=this._fieldsIndex.requiredFields.indexOf(b);if(w>-1&&this._fieldsIndex.requiredFields.splice(w,1),m){if(m.startTimeField){const e=this._fieldsIndex.get(m.startTimeField);e?(m.startTimeField=e.name,e.type="esriFieldTypeDate"):m.startTimeField=null}if(m.endTimeField){const e=this._fieldsIndex.get(m.endTimeField);e?(m.endTimeField=e.name,e.type="esriFieldTypeDate"):m.endTimeField=null}if(m.trackIdField){const e=this._fieldsIndex.get(m.trackIdField);e?m.trackIdField=e.name:(m.trackIdField=null,i.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:m}}))}m.startTimeField||m.endTimeField||(i.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:m}}),m=null)}const F=l?(0,y.bU)(l):null,B={warnings:i,featureErrors:[],layerDefinition:{...x,drawingInfo:F,templates:(0,y.Hq)(S),extent:null,geometryType:l,objectIdField:d,fields:o,hasZ:!!a,timeInfo:m}};this._queryEngine=new p.q({fields:o,geometryType:l,hasM:!1,hasZ:a,objectIdField:d,spatialReference:c,timeInfo:m,featureStore:new h.Z({geometryType:l,hasM:!1,hasZ:a}),cacheSpatialQueries:!0}),this._createDefaultAttributes=(0,y.Dm)(S,d);const E=await this._createFeatures(n);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,E);const M=this._normalizeFeatures(E,B.warnings,B.featureErrors);if(this._queryEngine.featureStore.addMany(M),B.layerDefinition.extent=this._queryEngine.fullExtent,B.layerDefinition.timeInfo){const{start:e,end:t}=this._queryEngine.timeExtent;B.layerDefinition.timeInfo.timeExtent=[e,t]}return B}async applyEdits(e){const{spatialReference:t,geometryType:i}=this._queryEngine;return await Promise.all([(0,m.b)(t,i),(0,c._W)(e.adds,t),(0,c._W)(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){var t;return this.loadOptions.customParameters=e,null==(t=this._snapshotTask)||t.abort(),this._snapshotTask=(0,a.vr)(this._snapshotFeatures),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,e);const t=this._normalizeFeatures(e);t&&this._queryEngine.featureStore.addMany(t)}),(e=>{this._queryEngine.featureStore.clear(),(0,a.D_)(e)||r.Z.getLogger("esri.layers.GeoJSONLayer").error(new s.Z("geojson-layer:refresh","An error occurred during refresh",{error:e}))})),await this._waitSnapshotComplete(),{extent:this._queryEngine.fullExtent,timeExtent:this._queryEngine.timeExtent}}async _createFeatures(e){const{geometryType:t,hasZ:i,objectIdField:n}=this._queryEngine,s=(0,f.lG)(e,{geometryType:t,hasZ:i,objectIdField:n});if(!(0,u.fS)(this._queryEngine.spatialReference,u.Zn))for(const e of s)(0,o.pC)(e.geometry)&&(e.geometry=(0,d.GH)((0,c.iV)((0,d.di)(e.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),u.Zn,this._queryEngine.spatialReference)));return s}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(e){const{url:t,customParameters:i}=this.loadOptions,s=(await(0,n.default)(t,{responseType:"json",query:{...i},signal:e})).data;return await(0,f.O3)(s),s}_normalizeFeatures(e,t,i){const{objectIdField:n}=this._queryEngine,s=[];for(const r of e){const e=this._createDefaultAttributes(),o=(0,m.O0)(this._fieldsIndex,e,r.attributes,!0,t);o?null==i||i.push(o):(this._assignObjectId(e,r.attributes,!0),r.attributes=e,r.objectId=e[n],s.push(r))}return s}_applyEdits(e){const{adds:t,updates:i,deletes:n}=e,s={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t&&t.length&&this._applyAddEdits(s,t),i&&i.length&&this._applyUpdateEdits(s,i),n&&n.length){for(const e of n)s.deleteResults.push((0,m.d1)(e));this._queryEngine.featureStore.removeManyById(n)}return{extent:this._queryEngine.fullExtent,timeExtent:this._queryEngine.timeExtent,featureEditResults:s}}_applyAddEdits(e,t){const{addResults:i}=e,{geometryType:n,hasM:s,hasZ:r,objectIdField:a,spatialReference:u,featureStore:h}=this._queryEngine,p=[];for(const s of t){if(s.geometry&&n!==(0,l.Ji)(s.geometry)){i.push((0,m.av)("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=(0,m.O0)(this._fieldsIndex,t,s.attributes);if(r)i.push(r);else{if(this._assignObjectId(t,s.attributes),s.attributes=t,null!=s.uid){const t=s.attributes[a];e.uidToObjectId[s.uid]=t}(0,o.pC)(s.geometry)&&(s.geometry=(0,c.iV)((0,m.og)(s.geometry,u),s.geometry.spatialReference,u)),p.push(s),i.push((0,m.d1)(s.attributes[a]))}}h.addMany((0,d.Yn)([],p,n,r,s,a))}_applyUpdateEdits({updateResults:e},t){const{geometryType:i,hasM:n,hasZ:s,objectIdField:r,spatialReference:a,featureStore:u}=this._queryEngine;for(const h of t){const{attributes:t,geometry:p}=h,f=t&&t[r];if(null==f){e.push((0,m.av)(`Identifier field ${r} missing`));continue}if(!u.has(f)){e.push((0,m.av)(`Feature with object id ${f} missing`));continue}const y=(0,d.EI)(u.getFeature(f),i,s,n);if((0,o.pC)(p)){if(i!==(0,l.Ji)(p)){e.push((0,m.av)("Incorrect geometry type."));continue}y.geometry=(0,c.iV)((0,m.og)(p,a),p.spatialReference,a)}if(t){const i=(0,m.O0)(this._fieldsIndex,y.attributes,t);if(i){e.push(i);continue}}u.add((0,d.XA)(y,i,s,n,r)),e.push((0,m.d1)(f))}}_createObjectIdGenerator(e,t){const i=e.fieldsIndex.get(e.objectIdField);if("esriFieldTypeString"===i.type)return()=>i.name+"-"+Date.now().toString(16);let n=Number.NEGATIVE_INFINITY;for(const e of t)e.objectId&&(n=Math.max(n,e.objectId));return n=Math.max(0,n)+1,()=>n++}_assignObjectId(e,t,i=!1){const n=this._queryEngine.objectIdField;e[n]=i&&n in t?t[n]:this._objectIdGenerator()}async _checkProjection(e){try{await(0,c._W)(u.Zn,e)}catch{throw new s.Z("geojson-layer","Projection not supported")}}}},92722:(e,t,i)=>{i.d(t,{O3:()=>b,lG:()=>w,my:()=>S,q9:()=>l});var n=i(20102),s=i(70272),r=i(5428),o=i(35671);const a={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function l(e){return a[e]}function*u(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*d(e){if(!e)return null;switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function h(e){for(const t of e)if(t.length>2)return!0;return!1}function c(e){let t=0;for(let i=0;i<e.length;i++){const n=e[i],s=e[(i+1)%e.length];t+=n[0]*s[1]-s[0]*n[1]}return t<=0}function p(e){const t=e[0],i=e[e.length-1];return t[0]===i[0]&&t[1]===i[1]&&t[2]===i[2]||e.push(t),e}function f(e,t,i){switch(t.type){case"LineString":case"MultiPoint":return function(e,t,i){return g(e,t.coordinates,i),e}(e,t,i);case"MultiLineString":return function(e,t,i){for(const n of t.coordinates)g(e,n,i);return e}(e,t,i);case"MultiPolygon":return function(e,t,i){for(const n of t.coordinates){y(e,n[0],i);for(let t=1;t<n.length;t++)m(e,n[t],i)}return e}(e,t,i);case"Point":return function(e,t,i){return I(e,t.coordinates,i),e}(e,t,i);case"Polygon":return function(e,t,i){const n=t.coordinates;y(e,n[0],i);for(let t=1;t<n.length;t++)m(e,n[t],i);return e}(e,t,i)}}function y(e,t,i){const n=p(t);!function(e){return!c(e)}(n)?g(e,n,i):_(e,n,i)}function m(e,t,i){const n=p(t);!function(e){return c(e)}(n)?g(e,n,i):_(e,n,i)}function g(e,t,i){for(const n of t)I(e,n,i);e.lengths.push(t.length)}function _(e,t,i){for(let n=t.length-1;n>=0;n--)I(e,t[n],i);e.lengths.push(t.length)}function I(e,t,i){const[n,s,r]=t;e.coords.push(n,s),i.hasZ&&e.coords.push(r||0)}function x(e){switch(typeof e){case"string":return"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function b(e){if(!e)throw new n.Z("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new n.Z("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:t}=e;if(!t)return;const i="string"==typeof t?t:"name"===t.type?t.properties.name:"EPSG"===t.type?t.properties.code:null,s=new RegExp(".*(CRS84H?|4326)$","i");if(!i||!s.test(i))throw new n.Z("geojson-layer:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:t})}function S(e,t={}){const i=[],n=new Set,s=new Set;let r,a=!1,c=null,p=!1,{geometryType:f=null}=t,y=!1;for(const t of u(e)){const{geometry:e,properties:o,id:u}=t;if((!e||(f||(f=l(e.type)),l(e.type)===f))&&(a||(a=h(d(e))),p||(p=null!=u,p&&(r=typeof u,c=Object.keys(o).filter((e=>o[e]===u)))),p&&null!=u&&(c.length>1?c=c.filter((e=>o[e]===u)):1===c.length&&(c=o[c[0]]===u?c:[])),!y&&o)){let e=!0;for(const t in o){if(n.has(t))continue;const r=o[t];if(null==r){e=!1,s.add(t);continue}const a=x(r);"unknown"!==a?(s.delete(t),n.add(t),i.push({name:t,alias:t,type:a})):s.add(t)}y=e}}const m=c&&1===c.length&&c[0]||null;if(m)for(const e of i)if(e.name===m&&(0,o.H7)(e)){e.type="esriFieldTypeOID";break}return{fields:i,geometryType:f,hasZ:a,objectIdFieldName:m,objectIdFieldType:r,unknownFields:Array.from(s)}}function w(e,t){return Array.from(function*(e,t={}){const{geometryType:i,objectIdField:n}=t;for(const a of e){var o;const{geometry:e,properties:u,id:d}=a;if(e&&l(e.type)!==i)continue;const h=u||{};let c=null!=(o=h[n])?o:null;n&&null!=d&&!h[n]&&(h[n]=c=d);const p=new s.u_(e?f(new r.Z,e,t):null,h,null,c);yield p}}(u(e),t))}},25278:(e,t,i)=>{i.d(t,{Dm:()=>d,Hq:()=>h,MS:()=>c,bU:()=>a});var n=i(80442),s=i(22974),r=i(61159),o=i(58333);function a(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?o.I4:"esriGeometryPolyline"===e?o.ET:o.lF}}}const l=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let u=1;function d(e,t){if((0,n.Z)("esri-csp-restrictions"))return()=>({[t]:null,...e});try{let i=`this.${t} = null;`;for(const t in e)i+=`this${l.test(t)?`.${t}`:`["${t}"]`} = ${JSON.stringify(e[t])};`;const n=new Function(`\n return class AttributesClass$${u++} {\n constructor() {\n ${i};\n }\n }\n `)();return()=>new n}catch(i){return()=>({[t]:null,...e})}}function h(e={}){return[{name:"New Feature",description:"",prototype:{attributes:(0,s.d9)(e)}}]}function c(e,t){return{attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0},query:r.g,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0},editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1}}}},23095:(e,t,i)=>{i.d(t,{O0:()=>h,av:()=>a,b:()=>y,d1:()=>u,og:()=>f});var n=i(8744),s=i(35671);class r{constructor(){this.code=null,this.description=null}}class o{constructor(e){this.error=new r,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function a(e){return new o(e)}class l{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function u(e){return new l(e)}const d=new Set;function h(e,t,i,n=!1,r){d.clear();for(const o in i){const l=e.get(o);if(!l)continue;const u=i[o],h=c(l,u);if(h!==u&&r&&r.push({name:"invalid-value-type",message:"attribute value was converted to match the field type",details:{field:l,originalValue:u,sanitizedValue:h}}),d.add(l.name),l&&(n||l.editable)){const e=(0,s.Qc)(l,h);if(e)return a((0,s.vP)(e,l,h));t[l.name]=h}}for(const t of e.requiredFields)if(!d.has(t.name))return a(`missing required field "${t.name}"`);return null}function c(e,t){let i=t;return"string"==typeof t&&(0,s.H7)(e)?i=parseFloat(t):null!=t&&(0,s.qN)(e)&&"string"!=typeof t&&(i=String(t)),(0,s.Pz)(i)}let p;function f(e,t){if(!e||!(0,n.JY)(t))return e;if("rings"in e||"paths"in e){if(!p)throw new TypeError("geometry engine not loaded");return p.simplify(t,e)}return e}async function y(e,t){!(0,n.JY)(e)||"esriGeometryPolygon"!==t&&"esriGeometryPolyline"!==t||await async function(){return p||(p=await Promise.all([i.e(5837),i.e(247)]).then(i.bind(i,30247)),p)}()}},86719:(e,t,i)=>{i.d(t,{v:()=>n});const n=new(i(35454).X)({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml"})},58333:(e,t,i)=>{i.d(t,{ET:()=>r,I4:()=>s,eG:()=>l,lF:()=>o,lj:()=>d,qP:()=>a,wW:()=>u});const n=[252,146,31,255],s={type:"esriSMS",style:"esriSMSCircle",size:6,color:n,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},r={type:"esriSLS",style:"esriSLSSolid",width:.75,color:n},o={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},a={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},l={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},u={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},d={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1938],{43090:(e,t,i)=>{function l(e){return 32+e.length}function r(e){if(!e)return 0;let t=32;for(const i in e)if(e.hasOwnProperty(i)){const r=e[i];switch(typeof r){case"string":t+=l(r);break;case"number":t+=16;break;case"boolean":t+=4}}return t}function s(e,t){return 32+e.length*t}var o;i.d(t,{Y8:()=>o,do:()=>s,f2:()=>r}),function(e){e[e.KILOBYTES=1024]="KILOBYTES",e[e.MEGABYTES=1048576]="MEGABYTES",e[e.GIGABYTES=1073741824]="GIGABYTES"}(o||(o={}))},16859:(e,t,i)=>{i.d(t,{I:()=>b});var l=i(43697),r=i(40330),s=i(3172),o=i(66643),a=i(20102),n=i(92604),h=i(70586),c=i(95330),p=i(17452),u=i(5600),d=(i(67676),i(80442),i(75215),i(71715)),f=i(52011),m=i(30556),v=i(65587),y=i(15235),g=i(86082);const w=n.Z.getLogger("esri.layers.mixins.PortalLayer"),b=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0}destroy(){var e;null==(e=this.portalItem)||e.destroy(),this.portalItem=null}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,i){if(t.itemId)return new y.default({id:t.itemId,portal:i&&i.portal})}writePortalItem(e,t){e&&e.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem&&this.portalItem.id)try{const l=await i.e(8062).then(i.bind(i,18062));return(0,c.k_)(t),await l.load({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData},t)}catch(e){throw(0,c.D_)(e)||w.warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,c.r9)(e),!0))))}async _fetchUserHasEditingPrivileges(e){const t=this.url?null==r.id?void 0:r.id.findCredential(this.url):null;if(!t)return!0;const i=_.credential===t?_.user:await this._fetchEditingUser(e);return _.credential=t,_.user=i,(0,h.Wi)(i)||null==i.privileges||i.privileges.includes("features:user:edit")}async _fetchEditingUser(e){var t,i;const l=null==(t=this.portalItem)||null==(i=t.portal)?void 0:i.user;if(l)return l;const a=r.id.findServerInfo(this.url);if(null==a||!a.owningSystemUrl)return null;const n=`${a.owningSystemUrl}/sharing/rest`,c=v.Z.getDefault();if(c&&c.loaded&&(0,p.Fv)(c.restUrl)===(0,p.Fv)(n))return c.user;const u=`${n}/community/self`,d=(0,h.pC)(e)?e.signal:null,f=await(0,o.q6)((0,s.default)(u,{authMode:"no-prompt",query:{f:"json"},signal:d}));return f.ok?g.default.fromJSON(f.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const i=t&&t.portal,l=this.portalItem&&this.portalItem.id&&(this.portalItem.portal||v.Z.getDefault());return i&&l&&!(0,p.tm)(l.restUrl,i.restUrl)?(t.messages&&t.messages.push(new a.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save the scene, set the layer.portalItem to null or save the scene to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,l._)([(0,u.Cb)({type:y.default})],t.prototype,"portalItem",null),(0,l._)([(0,d.r)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,l._)([(0,m.c)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,l._)([(0,u.Cb)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,l._)([(0,u.Cb)({readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),t=(0,l._)([(0,f.j)("esri.layers.mixins.PortalLayer")],t),t},_={credential:null,user:null}},39450:(e,t,i)=>{i.d(t,{Z:()=>c});var l,r=i(43697),s=i(96674),o=i(5600),a=(i(67676),i(80442),i(75215)),n=i(52011);let h=l=class extends s.wq{constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new l({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,r._)([(0,o.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],h.prototype,"cols",void 0),(0,r._)([(0,o.Cb)({type:a.z8,json:{write:!0}})],h.prototype,"level",void 0),(0,r._)([(0,o.Cb)({type:String,json:{write:!0}})],h.prototype,"levelValue",void 0),(0,r._)([(0,o.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],h.prototype,"origin",void 0),(0,r._)([(0,o.Cb)({type:Number,json:{write:!0}})],h.prototype,"resolution",void 0),(0,r._)([(0,o.Cb)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],h.prototype,"rows",void 0),(0,r._)([(0,o.Cb)({type:Number,json:{write:!0}})],h.prototype,"scale",void 0),h=l=(0,r._)([(0,n.j)("esri.layers.support.LOD")],h);const c=h},11145:(e,t,i)=>{i.d(t,{Z:()=>T});var l,r=i(43697),s=i(35454),o=i(96674),a=i(70586),n=i(67900),h=i(5600),c=(i(67676),i(80442),i(75215)),p=i(71715),u=i(52011),d=i(30556),f=i(13473),m=i(82971),v=i(24470),y=i(8744),g=i(40488),w=i(39450);const b=new s.X({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let _=l=class extends o.wq{constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.minScale=0,this.maxScale=0,this.size=null,this.spatialReference=null}static create(e={}){const{resolutionFactor:t=1,scales:i,size:r=256,spatialReference:s=m.Z.WebMercator,numLODs:o=24}=e;if(!(0,y.JY)(s)){const e=[];if(i)for(let t=0;t<i.length;t++){const l=i[t];e.push({level:t,scale:l,resolution:l})}else{let t=5e-4;for(let i=o-1;i>=0;i--)e.unshift({level:i,scale:t,resolution:t}),t*=2}return new l({dpi:96,lods:e,origin:new f.Z(0,0,s),size:[r,r],spatialReference:s})}const a=(0,y.C5)(s),h=e.origin?new f.Z({x:e.origin.x,y:e.origin.y,spatialReference:s}):new f.Z(a?{x:a.origin[0],y:a.origin[1],spatialReference:s}:{x:0,y:0,spatialReference:s}),c=1/(39.37*(0,n.c9)(s)*96),p=[];if(i)for(let e=0;e<i.length;e++){const t=i[e],l=t*c;p.push({level:e,scale:t,resolution:l})}else{let e=(0,y.sT)(s)?512/r*591657527.5917094:256/r*591657527.591555;const i=Math.ceil(o/t);p.push({level:0,scale:e,resolution:e*c});for(let l=1;l<i;l++){const i=e/2**t,r=i*c;p.push({level:l,scale:i,resolution:r}),e=i}}return new l({dpi:96,lods:p,origin:h,size:[r,r],spatialReference:s})}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const i=(0,y.C5)(e);return e.isWrappable&&Math.abs(i.origin[0]-t.x)<=i.dx}return!1}readOrigin(e,t){return f.Z.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,i=0;const l=[];this._levelToLOD={},e&&(t=-1/0,i=1/0,e.forEach((e=>{l.push(e.scale),t=e.scale>t?e.scale:t,i=e.scale<i?e.scale:i,this._levelToLOD[e.level]=e}))),this._set("scales",l),this._set("minScale",t),this._set("maxScale",i),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];{const i=Math.floor(e),l=i+1;return t[i]/(t[i]/t[l])**(e-i)}}scaleToZoom(e){const t=this.scales,i=t.length-1;let l=0;for(;l<i;l++){const i=t[l],r=t[l+1];if(i<=e)return l;if(r===e)return l+1;if(i>e&&r<e)return l+Math.log(i/e)/Math.log(i/r)}return l}snapScale(e,t=.95){const i=this.scaleToZoom(e);return i%Math.floor(i)>=t?this.zoomToScale(Math.ceil(i)):this.zoomToScale(Math.floor(i))}tileAt(e,t,i,l){const r=this.lodAt(e);if(!r)return null;let s,o;if("number"==typeof t)s=t,o=i;else if((0,y.fS)(t.spatialReference,this.spatialReference))s=t.x,o=t.y,l=i;else{const e=(0,g.iV)(t,this.spatialReference);if((0,a.Wi)(e))return null;s=e.x,o=e.y,l=i}const n=r.resolution*this.size[0],h=r.resolution*this.size[1];return l||(l={id:null,level:0,row:0,col:0,extent:(0,v.Ue)()}),l.level=e,l.row=Math.floor((this.origin.y-o)/h+.001),l.col=Math.floor((s-this.origin.x)/n+.001),this.updateTileInfo(l),l}updateTileInfo(e,t=l.ExtrapolateOptions.NONE){let i=this.lodAt(e.level);if(!i&&t===l.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(i=t)}if(!i)return;const r=e.level-i.level,s=i.resolution*this.size[0]/2**r,o=i.resolution*this.size[1]/2**r;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,v.Ue)()),e.extent[0]=this.origin.x+e.col*s,e.extent[1]=this.origin.y-(e.row+1)*o,e.extent[2]=e.extent[0]+s,e.extent[3]=e.extent[1]+o}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const{resolution:i}=this.lodAt(t.level),l=i*this.size[0],r=i*this.size[1];return e[0]=this.origin.x+t.col*l,e[1]=this.origin.y-(t.row+1)*r,e[2]=e[0]+l,e[3]=e[1]+r,e}lodAt(e){return this._levelToLOD&&this._levelToLOD[e]||null}clone(){return l.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const i=[],r=this.lods.length;for(let e=0;e<r;e++){const l=this.lods[e],r=l.resolution*t;i.push(new w.Z({level:l.level,scale:l.scale,resolution:r}))}return new l({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:i})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let i=0;i<e.length;i++){const l=e[i];this._upsampleLevels[l.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/l.resolution:0},t=l}}};var S,O;(0,r._)([(0,h.Cb)({type:Number,json:{write:!0}})],_.prototype,"compressionQuality",void 0),(0,r._)([(0,h.Cb)({type:Number,json:{write:!0}})],_.prototype,"dpi",void 0),(0,r._)([(0,h.Cb)({type:String,json:{read:b.read,write:b.write,origins:{"web-scene":{read:!1,write:!1}}}})],_.prototype,"format",void 0),(0,r._)([(0,h.Cb)({readOnly:!0})],_.prototype,"isWrappable",null),(0,r._)([(0,h.Cb)({type:f.Z,json:{write:!0}})],_.prototype,"origin",void 0),(0,r._)([(0,p.r)("origin")],_.prototype,"readOrigin",null),(0,r._)([(0,h.Cb)({type:[w.Z],value:null,json:{write:!0}})],_.prototype,"lods",null),(0,r._)([(0,h.Cb)({readOnly:!0})],_.prototype,"minScale",void 0),(0,r._)([(0,h.Cb)({readOnly:!0})],_.prototype,"maxScale",void 0),(0,r._)([(0,h.Cb)({readOnly:!0})],_.prototype,"scales",void 0),(0,r._)([(0,h.Cb)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],_.prototype,"size",void 0),(0,r._)([(0,p.r)("size",["rows","cols"])],_.prototype,"readSize",null),(0,r._)([(0,d.c)("size",{cols:{type:c.z8},rows:{type:c.z8}})],_.prototype,"writeSize",null),(0,r._)([(0,h.Cb)({type:m.Z,json:{write:!0}})],_.prototype,"spatialReference",void 0),_=l=(0,r._)([(0,u.j)("esri.layers.support.TileInfo")],_),(O=(S=_||(_={})).ExtrapolateOptions||(S.ExtrapolateOptions={}))[O.NONE=0]="NONE",O[O.POWER_OF_TWO=1]="POWER_OF_TWO";const T=_},56608:(e,t,i)=>{i.d(t,{y:()=>z});var l,r=i(43697),s=i(3172),o=i(15923),a=i(43090),n=i(20102),h=i(3920),c=i(92604),p=i(13867),u=i(44553),d=i(95330),f=i(17445),m=i(1654),v=i(17452),y=i(5600),g=i(67676),w=(i(80442),i(90578)),b=i(52011),_=i(22974);class S{constructor(){this.location={left:0,top:0,width:0,height:0},this._allAvailability="unknown",this.byteSize=40}getAvailability(e,t){if("unknown"!==this._allAvailability)return this._allAvailability;const i=(e-this.location.top)*this.location.width+(t-this.location.left),l=i%8,r=i>>3,s=this._tileAvailabilityBitSet;return r<0||r>s.length?"unknown":s[r]&1<<l?"available":"unavailable"}_updateFromData(e){const t=this.location.width,i=this.location.height;let l=!0,r=!0;const s=Math.ceil(t*i/8),o=new Uint8Array(s);let a=0;for(let t=0;t<e.length;t++){const i=t%8;e[t]?(r=!1,o[a]|=1<<i):l=!1,7===i&&++a}r?this._allAvailability="unavailable":l?this._allAvailability="available":(this._allAvailability="unknown",this._tileAvailabilityBitSet=o,this.byteSize+=o.length)}static fromDefinition(e,t){const i=e.service.request||s.default,{row:l,col:r,width:o,height:a}=e,h={query:{f:"json"}};return t=t?{...h,...t}:h,i(function(e){let t;if("vector-tile"===e.service.type)t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;else{const i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}const i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then((e=>e.data)).catch((e=>{if(e&&e.details&&422===e.details.httpStatus)return{location:{top:l,left:r,width:o,height:a},valid:!0,data:(0,g.a9)(o*a,0)};throw e})).then((e=>{if(e.location&&(e.location.top!==l||e.location.left!==r||e.location.width!==o||e.location.height!==a))throw new n.Z("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:l,left:r,width:o,height:a}});return S.fromJSON(e)}))}static fromJSON(e){S._validateJSON(e);const t=new S;return t.location=Object.freeze((0,_.d9)(e.location)),t._updateFromData(e.data),Object.freeze(t)}static _validateJSON(e){if(!e||!e.location)throw new n.Z("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new n.Z("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new n.Z("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new n.Z("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new n.Z("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}}function O(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}const T=c.Z.getLogger("esri.layers.support.TilemapCache");let z=l=class extends((0,h.p)(o.Z)){constructor(e){super(e),this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2*a.Y8.MEGABYTES,this.request=s.default,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new p.Z(this.cacheByteSize),this.handles.add([this.watch(["layer.parsedUrl","layer.tileServers?","layer.apiKey?","layer.customParameters?"],(()=>this._initializeTilemapDefinition())),(0,f.YP)((()=>{var e,t;return null==(e=this.layer)||null==(t=e.tileInfo)?void 0:t.lods}),(e=>this._initializeAvailableLevels(e)),f.tX)]),this._initializeTilemapDefinition()}castLevels(e){return e<=2?(T.error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<<this.levels}fetchTilemap(e,t,i,l){if(!this._availableLevels[e])return Promise.reject(new n.Z("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const r=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,r);if(s)return Promise.resolve(s);const o=l&&l.signal;return l={...l,signal:null},new Promise(((e,t)=>{(0,d.fu)(o,(()=>t((0,d.zE)())));const i=O(r);let s=this._pendingTilemapRequests[i];if(!s){s=S.fromDefinition(r,l).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)}))}getAvailability(e,t,i){if(!this._availableLevels[e])return"unavailable";const l=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return l?l.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,l){return this._availableLevels[e]?this.fetchTilemap(e,t,i,l).catch((e=>e)).then((l=>{if(l instanceof S){const r=l.getAvailability(t,i);if("unavailable"===r)throw new n.Z("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return r}if((0,d.D_)(l))throw l;return"unknown"})):Promise.reject(new n.Z("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`))}fetchAvailabilityUpsample(e,t,i,l,r){l.level=e,l.row=t,l.col=i;const s=this.layer.tileInfo;s.updateTileInfo(l);const o=this.fetchAvailability(e,t,i,r).catch((e=>{if((0,d.D_)(e))throw e;if(s.upsampleTile(l))return this.fetchAvailabilityUpsample(l.level,l.row,l.col,l);throw e}));return this._fetchAvailabilityUpsamplePrefetch(l.id,e,t,i,r,o),o}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,s,o){if(!this._prefetchingEnabled)return;const a=`prefetch-${e}`;if(this.handles.has(a))return;const n=new AbortController;o.then((()=>n.abort()),(()=>n.abort()));let h=!1;const c={remove(){h||(h=!0,n.abort())}};if(this.handles.add(c,a),await(0,m.MU)(10,n.signal).catch((()=>{})),h||(h=!0,this.handles.remove(a)),(0,d.Hc)(n))return;const p={id:e,level:t,row:i,col:r},u={...s,signal:n.signal},f=this.layer.tileInfo;for(let e=0;l._prefetches.length<l._maxPrefetch&&f.upsampleTile(p);++e){const e=this.fetchAvailability(p.level,p.row,p.col,u);l._prefetches.push(e);const t=()=>{l._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){var e;if(!this.layer.parsedUrl)return;const{parsedUrl:t,apiKey:i,customParameters:l}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:t.path,query:(0,v.B7)({...t.query,...l,token:null!=i?i:null==(e=t.query)?void 0:e.token}),tileServers:this.layer.tileServers,request:this.request,type:this.layer.type},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,l){l.level=e,l.row=t-t%this.size,l.col=i-i%this.size;const r=O(l);return this._tilemapCache.get(r)}_initializeAvailableLevels(e){this._availableLevels={},e&&e.forEach((e=>this._availableLevels[e.level]=!0))}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,l)=>!!e._tilemapFromCache(t,i,l,e._tmpTilemapDefinition)}}};z._maxPrefetch=4,z._prefetches=new u.Z({initialSize:l._maxPrefetch}),(0,r._)([(0,y.Cb)({constructOnly:!0,type:Number})],z.prototype,"levels",void 0),(0,r._)([(0,w.p)("levels")],z.prototype,"castLevels",null),(0,r._)([(0,y.Cb)({readOnly:!0,type:Number})],z.prototype,"size",null),(0,r._)([(0,y.Cb)({constructOnly:!0,type:Number})],z.prototype,"cacheByteSize",void 0),(0,r._)([(0,y.Cb)({constructOnly:!0})],z.prototype,"layer",void 0),(0,r._)([(0,y.Cb)({constructOnly:!0})],z.prototype,"request",void 0),z=l=(0,r._)([(0,b.j)("esri.layers.support.TilemapCache")],z)},45322:(e,t,i)=>{i.d(t,{d:()=>s,h:()=>r});var l=i(11145);const r={type:l.Z,json:{origins:{service:{read:{source:["tileInfo","minScale","maxScale","minLOD","maxLOD"],reader:s}}}}};function s(e,t,i,r){if(!e)return null;const{minScale:s,maxScale:o,minLOD:a,maxLOD:n}=t;if(null!=a&&null!=n)return r&&r.ignoreMinMaxLOD?l.Z.fromJSON(e):l.Z.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=a&&e<=n))});if(0!==s&&0!==o){const t=e=>Math.round(1e4*e)/1e4,i=s?t(s):1/0,r=o?t(o):-1/0;return l.Z.fromJSON({...e,lods:e.lods.filter((e=>{const l=t(e.scale);return l<=i&&l>=r}))})}return l.Z.fromJSON(e)}}}]);