@arcgis/core 4.34.0-next.53 → 4.34.0-next.55

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 (340) hide show
  1. package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +4 -0
  2. package/analysis/ElevationProfile/ElevationProfileGroundLine.js +5 -0
  3. package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +4 -0
  4. package/analysis/ElevationProfile/ElevationProfileInputLine.js +5 -0
  5. package/analysis/ElevationProfile/ElevationProfileLine.d.ts +4 -0
  6. package/analysis/ElevationProfile/ElevationProfileLine.js +5 -0
  7. package/analysis/ElevationProfile/ElevationProfileLineChartOptions.d.ts +4 -0
  8. package/analysis/ElevationProfile/{LineChartOptions.js → ElevationProfileLineChartOptions.js} +1 -1
  9. package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +4 -0
  10. package/analysis/ElevationProfile/{LineViewOptions.js → ElevationProfileLineViewOptions.js} +1 -1
  11. package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +4 -0
  12. package/analysis/ElevationProfile/ElevationProfileQueryLine.js +5 -0
  13. package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +4 -0
  14. package/analysis/ElevationProfile/ElevationProfileSceneLine.js +5 -0
  15. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +4 -0
  16. package/analysis/ElevationProfile/{Units.js → ElevationProfileUnits.js} +1 -1
  17. package/analysis/ElevationProfile/ElevationProfileViewOptions.d.ts +4 -0
  18. package/analysis/ElevationProfile/{ViewOptions.js → ElevationProfileViewOptions.js} +1 -1
  19. package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
  20. package/analysis/ElevationProfileAnalysis.js +1 -1
  21. package/applications/Components/formatUtils.d.ts +3 -0
  22. package/applications/Components/formatUtils.js +5 -0
  23. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/01e8b9dc77a57d1c2a52.js +1 -0
  26. package/assets/esri/core/workers/chunks/027cfcde29fe87aa2ffe.js +1 -0
  27. package/assets/esri/core/workers/chunks/{e58336aafe8c95bb6831.js → 0eb728cee6e40cb30c01.js} +1 -1
  28. package/assets/esri/core/workers/chunks/18ceea59e469a0f2721b.js +1 -0
  29. package/assets/esri/core/workers/chunks/199a17b0a0f75cbaed16.js +1 -0
  30. package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +1 -0
  31. package/assets/esri/core/workers/chunks/{ac41b882f9cbf8d56f0c.js → 222f981e876f60ae282f.js} +1 -1
  32. package/assets/esri/core/workers/chunks/22334a464f798b5279b2.js +1 -0
  33. package/assets/esri/core/workers/chunks/{99b9392946d776a62997.js → 23e600e368ac829680b5.js} +1 -1
  34. package/assets/esri/core/workers/chunks/23f54b49742098def8ae.js +1 -0
  35. package/assets/esri/core/workers/chunks/24ac204d8a045aa821be.js +1 -0
  36. package/assets/esri/core/workers/chunks/252ee00fd6c4ae0ee7fa.js +1 -0
  37. package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +1 -0
  38. package/assets/esri/core/workers/chunks/{93af38d29d066f27ed28.js → 2cb14d040e67a261b31c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{0021118bafefd1e47ff7.js → 31c088966ccfff2ea1db.js} +1 -1
  40. package/assets/esri/core/workers/chunks/3b51b61a7b8a1ef87c9b.js +1 -0
  41. package/assets/esri/core/workers/chunks/3d800fbc449bea18b1cd.js +1 -0
  42. package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +1 -0
  43. package/assets/esri/core/workers/chunks/4874aabdb5c60ca66216.js +1 -0
  44. package/assets/esri/core/workers/chunks/4d2473e680324dc17cfa.js +1 -0
  45. package/assets/esri/core/workers/chunks/{2da12a64d3baef4aaaa1.js → 4f8dab492331c9a2d67a.js} +1 -1
  46. package/assets/esri/core/workers/chunks/527557b603400189d49a.js +1 -0
  47. package/assets/esri/core/workers/chunks/{4bd92232928b832dea76.js → 5900dde7a201a7d47469.js} +1 -1
  48. package/assets/esri/core/workers/chunks/62ade6f18b375795ddfd.js +1 -0
  49. package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +1 -0
  50. package/assets/esri/core/workers/chunks/{b0ee061747bef6729bb9.js → 6801b92bce7a918fda6f.js} +1 -1
  51. package/assets/esri/core/workers/chunks/6940bb6524938894a246.js +1 -0
  52. package/assets/esri/core/workers/chunks/69e6000044bfb03776ac.js +1 -0
  53. package/assets/esri/core/workers/chunks/6b11476b2004b4db576e.js +1 -0
  54. package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +1 -0
  55. package/assets/esri/core/workers/chunks/{69dc5a7abc1fda2474ad.js → 722931d1a60be461e521.js} +1 -1
  56. package/assets/esri/core/workers/chunks/79ab06fb4c91ac8da323.js +1 -0
  57. package/assets/esri/core/workers/chunks/{0a4357af5b8c0532b439.js → 7bdfc7c7ce1d94c00745.js} +1 -1
  58. package/assets/esri/core/workers/chunks/813efde41e90e652b7db.js +1 -0
  59. package/assets/esri/core/workers/chunks/82404ff7c298493ff6f4.js +1 -0
  60. package/assets/esri/core/workers/chunks/{0ce671588de2858516d2.js → 83737d86584bf1b32368.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{98ea12c7a000a30f3dc0.js → 87f68c2b9361bd3f8cac.js} +1 -1
  62. package/assets/esri/core/workers/chunks/97ae2fdb6cb98249f5fa.js +1 -0
  63. package/assets/esri/core/workers/chunks/9a20390602126995f831.js +1 -0
  64. package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +1 -0
  65. package/assets/esri/core/workers/chunks/a778a72456fefdf40115.js +1 -0
  66. package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +1 -0
  67. package/assets/esri/core/workers/chunks/ae73ac81bd10614c2b53.js +1 -0
  68. package/assets/esri/core/workers/chunks/c7d4c296011c5393bcaa.js +1 -0
  69. package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +1 -0
  70. package/assets/esri/core/workers/chunks/{a1d3f1c221389eb6090c.js → c95e6bef8c97cf647869.js} +1 -1
  71. package/assets/esri/core/workers/chunks/cbec768cd98caff212f2.js +1 -0
  72. package/assets/esri/core/workers/chunks/d81c4afad4abe2d1d0b9.js +1 -0
  73. package/assets/esri/core/workers/chunks/dd120d562b63618e71c0.js +1 -0
  74. package/assets/esri/core/workers/chunks/dfb12f42b8d319ffa5fc.js +1 -0
  75. package/assets/esri/core/workers/chunks/e04951ee32f041faaeca.js +1 -0
  76. package/assets/esri/core/workers/chunks/e982cf44906eb26164f2.js +1 -0
  77. package/assets/esri/core/workers/chunks/{081b22fa73ef7b696409.js → ead1acf95c3385630da8.js} +2 -2
  78. package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +1 -0
  79. package/assets/esri/core/workers/chunks/fe5c37c69da3ec1e56ac.js +1 -0
  80. package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +1 -0
  81. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  82. package/chunks/Laserlines.glsl.js +1 -1
  83. package/chunks/LineSeries.js +1 -1
  84. package/chunks/Theme.js +1 -1
  85. package/chunks/boundedPlane.js +1 -1
  86. package/chunks/bundle.js +1 -1
  87. package/chunks/chartUtilsAm5.js +1 -1
  88. package/chunks/sphere.js +1 -1
  89. package/chunks/vec42.js +1 -1
  90. package/config.js +1 -1
  91. package/core/ArrayPool.js +1 -1
  92. package/core/Collection.js +1 -1
  93. package/core/ObjectPool.js +1 -1
  94. package/core/accessorSupport/Properties.js +1 -1
  95. package/core/accessorSupport/watch.js +1 -1
  96. package/core/arrayUtils.js +1 -1
  97. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  98. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  99. package/core/pbf.js +1 -1
  100. package/core/typedArrayUtil.js +1 -1
  101. package/geohash/GeohashCell.js +1 -1
  102. package/geohash/GeohashTree.js +1 -1
  103. package/geometry/operators/json/graphicBufferOperator.js +5 -0
  104. package/geometry/support/DoubleArray.js +1 -1
  105. package/geometry/support/boundedPlane.js +1 -1
  106. package/geometry/support/coordinateSystem.js +1 -1
  107. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  108. package/geometry/support/sphere.js +1 -1
  109. package/interfaces.d.ts +232 -322
  110. package/kernel.js +1 -1
  111. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  112. package/layers/graphics/sources/ParquetSource.js +1 -1
  113. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  114. package/networks/support/typeUtils.js +1 -1
  115. package/package.json +1 -1
  116. package/rest/knowledgeGraphService.js +1 -1
  117. package/rest/networks/support/Circuit.js +5 -0
  118. package/rest/networks/support/CircuitSection.js +1 -1
  119. package/rest/networks/support/Subcircuit.js +1 -1
  120. package/rest/print.js +1 -1
  121. package/support/revision.js +1 -1
  122. package/symbols/cim/CIMEffects.js +1 -1
  123. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  124. package/symbols/cim/effects/EffectOffset.js +1 -1
  125. package/views/2d/analysisViewModuleImportUtils.js +5 -0
  126. package/views/2d/engine/Container.js +1 -1
  127. package/views/2d/engine/DisplayObject.js +1 -1
  128. package/views/2d/engine/flow/dataUtils.js +1 -1
  129. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  130. package/views/2d/engine/webgl/DisplayEntity.js +1 -1
  131. package/views/2d/engine/webgl/DisplayRecord.js +1 -1
  132. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  133. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  134. package/views/2d/engine/webgl/PooledUint32Array.js +1 -1
  135. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  136. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  138. package/views/2d/input/MapViewInputManager.js +1 -1
  139. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  140. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  141. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  142. package/views/2d/layers/LayerView2D.js +1 -1
  143. package/views/2d/layers/features/FeatureContainer.js +1 -1
  144. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  145. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  146. package/views/2d/layers/features/FeatureSpatialIndex.js +1 -1
  147. package/views/2d/layers/features/Processor.js +1 -1
  148. package/views/2d/layers/features/RenderState.js +1 -1
  149. package/views/2d/layers/features/aggregation/AccumulatedStatistics.js +1 -1
  150. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  151. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  152. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  153. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  154. package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
  155. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  156. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  157. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  158. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  159. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  160. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  161. package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
  162. package/views/2d/layers/features/support/FeatureSetCache.js +1 -1
  163. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  164. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  165. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  166. package/views/2d/layers/features/support/StaticBitSet.js +1 -1
  167. package/views/2d/tiling/TileCoverage.js +1 -1
  168. package/views/2d/tiling/TileKey.js +1 -1
  169. package/views/3d/FocusAreasView.js +1 -1
  170. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  171. package/views/3d/analysis/ElevationProfile/{HoveredPointVisualization.js → ElevationProfileHoveredPointVisualization.js} +1 -1
  172. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
  173. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +5 -0
  174. package/views/3d/analysis/ElevationProfile/ElevationProfileLinesVisualization.js +5 -0
  175. package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +5 -0
  176. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +5 -0
  177. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  178. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  179. package/views/3d/analysis/Slice/SliceController.js +1 -1
  180. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  181. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  182. package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
  183. package/views/3d/analysisViewModuleImportUtils.js +5 -0
  184. package/views/3d/camera/constraintUtils/distance.js +1 -1
  185. package/views/3d/input/SceneInputManager.js +1 -1
  186. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  187. package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
  188. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  189. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  190. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  191. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  192. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  193. package/views/3d/layers/I3SMeshView3D.js +1 -1
  194. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  195. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  196. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  197. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  198. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  200. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  201. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  202. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  203. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  204. package/views/3d/layers/i3s/I3SNode.js +1 -1
  205. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  206. package/views/3d/state/ViewState.js +1 -1
  207. package/views/3d/state/ViewStateManager.js +1 -1
  208. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  209. package/views/3d/support/ViewSlice.js +1 -1
  210. package/views/3d/support/orientedBoundingBox.js +1 -1
  211. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  212. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  213. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  214. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  215. package/views/3d/terrain/ScaleRangeQueries.js +1 -1
  216. package/views/3d/terrain/SphericalPatch.js +1 -1
  217. package/views/3d/terrain/TerrainRenderer.js +1 -1
  218. package/views/3d/terrain/TerrainSurface.js +1 -1
  219. package/views/3d/terrain/Tile.js +1 -1
  220. package/views/3d/terrain/TilePerLayerInfo.js +1 -1
  221. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  222. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  223. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  224. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  225. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  226. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  227. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  228. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  229. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  230. package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
  231. package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
  232. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  233. package/views/SceneView.js +1 -1
  234. package/views/ToolViewManager.js +1 -1
  235. package/views/View.js +1 -1
  236. package/views/View2D.js +1 -1
  237. package/views/analysis/ElevationProfile/ElevationProfileController.js +5 -0
  238. package/views/analysis/ElevationProfile/{ProfileGenerationError.js → ElevationProfileGenerationError.js} +1 -1
  239. package/views/analysis/ElevationProfile/ElevationProfileGroundLineComputation.js +5 -0
  240. package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +5 -0
  241. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +5 -0
  242. package/views/analysis/ElevationProfile/ElevationProfileQueryLineComputation.js +5 -0
  243. package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +4 -0
  244. package/views/analysis/ElevationProfile/ElevationProfileResult.js +5 -0
  245. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +5 -0
  246. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +5 -0
  247. package/views/draw/DrawGraphicTool.js +1 -1
  248. package/views/draw/DrawOperation.js +1 -1
  249. package/views/draw/LegacyDrawManipulator.js +1 -1
  250. package/views/input/InputManager.js +1 -1
  251. package/views/input/handlers/LatestPointer.js +1 -1
  252. package/views/interactive/InteractiveToolBase.js +1 -1
  253. package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
  254. package/views/interactive/Tooltip.js +1 -1
  255. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  256. package/views/interactive/sketch/constraints.js +1 -1
  257. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  258. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  259. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  260. package/views/layers/FeatureLayerView.js +1 -1
  261. package/views/support/AnalysisViewManager.js +5 -0
  262. package/views/support/PropertiesPool.js +1 -1
  263. package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
  264. package/widgets/Feature/FeatureViewModel.js +1 -1
  265. package/widgets/Sketch/SketchViewModel.js +1 -1
  266. package/analysis/ElevationProfile/GroundLine.d.ts +0 -4
  267. package/analysis/ElevationProfile/GroundLine.js +0 -5
  268. package/analysis/ElevationProfile/InputLine.d.ts +0 -4
  269. package/analysis/ElevationProfile/InputLine.js +0 -5
  270. package/analysis/ElevationProfile/Line.d.ts +0 -4
  271. package/analysis/ElevationProfile/Line.js +0 -5
  272. package/analysis/ElevationProfile/LineChartOptions.d.ts +0 -4
  273. package/analysis/ElevationProfile/LineViewOptions.d.ts +0 -4
  274. package/analysis/ElevationProfile/QueryLine.d.ts +0 -4
  275. package/analysis/ElevationProfile/QueryLine.js +0 -5
  276. package/analysis/ElevationProfile/SceneLine.d.ts +0 -4
  277. package/analysis/ElevationProfile/SceneLine.js +0 -5
  278. package/analysis/ElevationProfile/Units.d.ts +0 -4
  279. package/analysis/ElevationProfile/ViewOptions.d.ts +0 -4
  280. package/assets/esri/core/workers/chunks/14c6ae4feb4859cfa7c5.js +0 -1
  281. package/assets/esri/core/workers/chunks/20a2b3d1f826e9059884.js +0 -1
  282. package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +0 -1
  283. package/assets/esri/core/workers/chunks/2b75212c31145cc07d16.js +0 -1
  284. package/assets/esri/core/workers/chunks/2efa4d8fe5454f8b2a05.js +0 -1
  285. package/assets/esri/core/workers/chunks/3149a86cd25684dcb0b3.js +0 -1
  286. package/assets/esri/core/workers/chunks/38f84294fb2fb4663ba5.js +0 -1
  287. package/assets/esri/core/workers/chunks/3eb3af0b6cf3c2f28131.js +0 -1
  288. package/assets/esri/core/workers/chunks/43bd338bb0de375b9bb7.js +0 -1
  289. package/assets/esri/core/workers/chunks/4622a3e64d3c4aafa56b.js +0 -1
  290. package/assets/esri/core/workers/chunks/47f2e905ef42e36897aa.js +0 -1
  291. package/assets/esri/core/workers/chunks/4c6862ad3af947c704f7.js +0 -1
  292. package/assets/esri/core/workers/chunks/50e9eafb118d2a221f10.js +0 -1
  293. package/assets/esri/core/workers/chunks/55588e668b6acb6aa390.js +0 -1
  294. package/assets/esri/core/workers/chunks/5b112471dca94b2e8462.js +0 -1
  295. package/assets/esri/core/workers/chunks/5dfe1aed10095385c066.js +0 -1
  296. package/assets/esri/core/workers/chunks/5fc414fc2cfc68828c5b.js +0 -1
  297. package/assets/esri/core/workers/chunks/7389841fabe0f319f1e5.js +0 -1
  298. package/assets/esri/core/workers/chunks/781b59ba0cabe78bc122.js +0 -1
  299. package/assets/esri/core/workers/chunks/8e0559cc6295008fcdf7.js +0 -1
  300. package/assets/esri/core/workers/chunks/944fa8261aad94ae0542.js +0 -1
  301. package/assets/esri/core/workers/chunks/9e479e7e2e51476c3d27.js +0 -1
  302. package/assets/esri/core/workers/chunks/a1e179dd6de9c8769b02.js +0 -1
  303. package/assets/esri/core/workers/chunks/a6493607b98783bf1ef2.js +0 -1
  304. package/assets/esri/core/workers/chunks/a829969ed44cdb814f27.js +0 -1
  305. package/assets/esri/core/workers/chunks/b2a035befeeff1a55ad8.js +0 -1
  306. package/assets/esri/core/workers/chunks/b4251e10621fb3ad03a3.js +0 -1
  307. package/assets/esri/core/workers/chunks/b877142a275188a16e17.js +0 -1
  308. package/assets/esri/core/workers/chunks/b9f5672093727c6f92c9.js +0 -1
  309. package/assets/esri/core/workers/chunks/ba45dccb4dab5a74d224.js +0 -1
  310. package/assets/esri/core/workers/chunks/cc0cb4906e4419f7c4a9.js +0 -1
  311. package/assets/esri/core/workers/chunks/cda27c0fafd687dfa72e.js +0 -1
  312. package/assets/esri/core/workers/chunks/ddd6597a66ec6b972f9c.js +0 -1
  313. package/assets/esri/core/workers/chunks/e28d3ed65c3a76a044c8.js +0 -1
  314. package/assets/esri/core/workers/chunks/e3f68f7b408a08d7cd5d.js +0 -1
  315. package/assets/esri/core/workers/chunks/e9716995ce0c3683eafc.js +0 -1
  316. package/assets/esri/core/workers/chunks/ed25bf087f52e5d3e71b.js +0 -1
  317. package/assets/esri/core/workers/chunks/f75ddd79be506423be09.js +0 -1
  318. package/assets/esri/core/workers/chunks/f8505bf69795f5293a79.js +0 -1
  319. package/assets/esri/core/workers/chunks/f92e608931b1c168cb45.js +0 -1
  320. package/assets/esri/core/workers/chunks/fb4950995f6780f6c22a.js +0 -1
  321. package/views/3d/analysis/AnalysisViewManager3D.js +0 -5
  322. package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +0 -5
  323. package/views/3d/analysis/ElevationProfile/InputVisualization.js +0 -5
  324. package/views/3d/analysis/ElevationProfile/ProfileLinesVisualization.js +0 -5
  325. package/views/3d/analysis/ElevationProfile/SceneLineComputation.js +0 -5
  326. package/views/3d/analysis/ElevationProfile/Visualization.js +0 -5
  327. package/views/analysis/ElevationProfile/Controller.js +0 -5
  328. package/views/analysis/ElevationProfile/GroundLineComputation.js +0 -5
  329. package/views/analysis/ElevationProfile/InputLineComputation.js +0 -5
  330. package/views/analysis/ElevationProfile/LineComputation.js +0 -5
  331. package/views/analysis/ElevationProfile/QueryLineComputation.js +0 -5
  332. package/views/analysis/ElevationProfile/Result.d.ts +0 -4
  333. package/views/analysis/ElevationProfile/Result.js +0 -5
  334. package/views/analysis/ElevationProfile/geometryUtils.js +0 -5
  335. package/views/analysis/ElevationProfile/profileGenerationUtils.js +0 -5
  336. /package/views/analysis/ElevationProfile/{elevationQuerySourceUtils.js → elevationProfileQuerySourceUtils.js} +0 -0
  337. /package/views/analysis/ElevationProfile/{statisticsUtils.js → elevationProfileStatisticsUtils.js} +0 -0
  338. /package/views/analysis/ElevationProfile/{traversalUtils.js → elevationProfileTraversalUtils.js} +0 -0
  339. /package/views/analysis/ElevationProfile/{unitUtils.js → elevationProfileUnitUtils.js} +0 -0
  340. /package/views/analysis/ElevationProfile/{visualizationUtils.js → elevationProfileVisualizationUtils.js} +0 -0
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import s from"../../core/Accessor.js";import{createTask as t}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import n from"../../core/Logger.js";import{removeMaybe as r,destroyMaybe as l,abortMaybe as c}from"../../core/maybe.js";import{createAbortError as h,isAborted as w,onAbort as d,createResolver as y}from"../../core/promiseUtils.js";import{schedule as _}from"../../core/scheduling.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";const u="analyses-owner-handles";let V=class extends s{constructor(e){super(e),this._allAnalysisViews=new i,this._creatingViewCount=0,this._attachedToViewResolver=A(),this._items=new Map,this._moduleMap=new Map,this._scheduledUpdateHandle=null,this._emitOnView=(e,s)=>this.view.emit(e,s)}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(h("AnalysisViewManager was destroyed")),this._set("view",null)}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(h()),this._attachedToViewResolver=A()}get updating(){return!this.view.ready||0!==this._creatingViewCount||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const s=this._items.get(e);if(null==s||1===s.state.list){throw new a("AnalysisViewManager:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e})}return s.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),u)}_disconnectOwners(){this.removeHandles(u),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const i of e)this._addAnalysis(i);const s=e.on("after-add",e=>this._addAnalysis(e.item)),t=e.on("after-remove",e=>this._removeAnalysis(e.item));return o(()=>{s.remove(),t.remove();for(const s of e)this._removeAnalysis(s)})}_addAnalysis(e){const s=this._items.get(e);if(null==s){const s={state:{view:0,list:0},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,s),s.createAnalysisViewTask=t(t=>this._createAnalysisViewPromise(s,t).then(s=>(this._emitOnView("analysis-view-create",{analysis:e,analysisView:s}),s),s=>{throw this._emitOnView("analysis-view-create-error",{analysis:e,error:s}),s}))}else s.state.list=0}_removeAnalysis(e){const s=this._items.get(e);null!=s?(s.state.list=1,this._scheduleUpdate()):n.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){null==this._scheduledUpdateHandle&&(this._scheduledUpdateHandle=_(()=>this._update()))}_update(){this._scheduledUpdateHandle=r(this._scheduledUpdateHandle),this._items.forEach(e=>{if(1!==e.state.list)return;const{analysis:s,view:t}=e;switch(this._items.delete(s),e.state.view){case 0:e.createAnalysisViewTask=c(e.createAnalysisViewTask);break;case 1:null!=t&&(this._allAnalysisViews.remove(t),e.view=l(t),e.createAnalysisViewTask=null,this._emitOnView("analysis-view-destroy",{analysis:s,analysisView:t}))}})}async _createAnalysisViewPromise(e,s){const{analysis:t}=e;if(this._creatingViewCount+=1,!this._moduleMap.has(t.type))try{this._moduleMap.set(t.type,await this.importAnalysisViewModule(t))}catch(o){throw this._creatingViewCount-=1,o}if(w(s))throw this._creatingViewCount-=1,h("AnalysisView creation aborted");const i=new(this._moduleMap.get(t.type).default)({analysis:t,view:this.view});let a=!0;d(s,()=>{a&&this._destroyAnalysisView(t,i)});try{await i.when()}catch(o){throw a=!1,this._destroyAnalysisView(t,i),o}if(w(s))throw h();return a=!1,e.view=i,e.state.view=1,this._allAnalysisViews.add(i),this._creatingViewCount-=1,i}_destroyAnalysisView(e,s){s.destroyed||(this._creatingViewCount-=1,s.destroy(),this._emitOnView("analysis-view-destroy",{analysis:e,analysisView:s}))}};e([m()],V.prototype,"updating",null),e([m({constructOnly:!0})],V.prototype,"importAnalysisViewModule",void 0),e([m({constructOnly:!0})],V.prototype,"view",void 0),e([m()],V.prototype,"_allAnalysisViews",void 0),e([m()],V.prototype,"_creatingViewCount",void 0),V=e([p("esri.views.support.AnalysisViewManager")],V);const v=V;function A(){const e=y();return e.promise.catch(()=>{}),e}export{v 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{ReentrantObjectPool as e}from"../../core/ReentrantObjectPool.js";import{afterDispatch as t,isValueInUse as r}from"../../core/accessorSupport/watch.js";class o{constructor(r,o){this._owner=o,this._properties={},this._afterDispatchHandle=null;for(const t in r){const o=r[t],s=new e(o,void 0,void 0,2,2);this._properties[t]={pool:s,acquired:[]}}this._afterDispatchHandle=t(()=>this._release())}destroy(){this._afterDispatchHandle&&(this._afterDispatchHandle.remove(),this._afterDispatchHandle=null);for(const e in this._properties){const t=this._properties[e];for(const e of t.acquired)r(e)||t.pool.release(e);t.pool.destroy(),t.pool=null,t.acquired=null}this._properties=null,this._owner=null}get(e){const t=this._owner._get(e),r=this._properties[e];let o=r.pool.acquire();for(r.acquired.push(o);o===t;)r.acquired.push(o),o=r.pool.acquire();return o}_release(){for(const e in this._properties){const t=this._properties[e];let o=0;for(const e of t.acquired)r(e)?t.acquired[o++]=e:t.pool.release(e);t.acquired.length=o}}}export{o as PropertiesPool};
5
+ import{ReentrantObjectPool as e}from"../../core/ReentrantObjectPool.js";import{afterDispatch as t,isValueInUse as r,scheduleDispatch as o}from"../../core/accessorSupport/watch.js";class s{constructor(r,o){this._owner=o,this._properties={},this._afterDispatchHandle=null;for(const t in r){const o=r[t],s=new e(o,void 0,void 0,2,2);this._properties[t]={pool:s,acquired:[]}}this._afterDispatchHandle=t(()=>this._release())}destroy(){this._afterDispatchHandle&&(this._afterDispatchHandle.remove(),this._afterDispatchHandle=null);for(const e in this._properties){const t=this._properties[e];for(const e of t.acquired)r(e)||t.pool.release(e);t.pool.destroy(),t.pool=null,t.acquired=null}this._properties=null,this._owner=null}get(e){const t=this._owner._get(e),r=this._properties[e];let s=r.pool.acquire();for(r.acquired.push(s);s===t;)s=r.pool.acquire(),r.acquired.push(s);return o(),s}_release(){for(const e in this._properties){const t=this._properties[e];let o=0;for(const e of t.acquired)r(e)?t.acquired[o++]=e:t.pool.release(e);t.acquired.length=o}}}export{s as PropertiesPool};
@@ -1,4 +1,4 @@
1
1
  import "../../interfaces";
2
2
 
3
- import ElevationProfileLine = __esri.ElevationProfileLine;
4
- export default ElevationProfileLine;
3
+ import ElevationProfileElevationProfileLine = __esri.ElevationProfileElevationProfileLine;
4
+ export default ElevationProfileElevationProfileLine;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import s from"../../core/Accessor.js";import{isSome as o}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import l from"../../core/Logger.js";import{abortMaybe as p}from"../../core/maybe.js";import{eachAlways as c,isAbortError as d,throwIfAborted as h}from"../../core/promiseUtils.js";import{watch as u,when as f,initial as m,on as _}from"../../core/reactiveUtils.js";import{throttle as y}from"../../core/throttle.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import{cast as b}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/Point.js";import A from"../../geometry/SpatialReference.js";import I from"../../popup/content/TextContent.js";import{system as x}from"../../time/constants.js";import M from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import T from"./FeatureContent/FeatureContentViewModel.js";import F from"./FeatureExpression/FeatureExpressionViewModel.js";import E from"./FeatureFields/FeatureFieldsViewModel.js";import C from"./FeatureMedia/FeatureMediaViewModel.js";import V from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{compileExpressionInfos as j,formatArcadeValue as k}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as P,preRequestCallback as R,createFieldInfoMap as L,getAllFieldInfos as O,getSourceLayer as N,querySourceLayer as U,queryUpdatedFeature as Z,isRelatableFeatureSupportedLayer as S,isAssociatedFeatureSupportedLayer as B,substituteFieldsInLinksAndAttributes as H,isExpressionField as D,isRelatedField as G,formatEditInfo as q,graphicCallback as z,formatAttributes as Q}from"./support/featureUtils.js";import{queryLayerInfos as J,queryRelatedFeatures as K,setRelatedFeatures as W,getRelatedFieldInfo as X,createRelatedInfo as Y,updateRelatedInfo as $}from"./support/relatedFeatureUtils.js";import ee from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";var te;const ie=1,se="content-view-models",oe="relationship-view-models",re="association-view-models",ae={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let ne=class extends(n(s)){static{te=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._associationVMAbortController=null,this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...ae},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title="",this.view=null,this._graphicChangedThrottled=y(this._graphicChanged,()=>this.notifyChange("waitingForContent"),ie,this),this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent||"utility-network-associations"===e.type&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=y(this._evaluateExpressionAttributes,()=>this.notifyChange("waitingForContent"),ie,this),this.addHandles([u(()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone],()=>this._graphicChangedThrottled(),m),f(()=>{if(!this._graphicChangedTask?.finished||null==this._graphicChangedTask.value)return null;const e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has("view-scale")?this.view?.scale:null,t?.has("view-time-extent")?this.view?.timeExtent?.start:null,t?.has("view-time-extent")?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=p(this._graphicChangedTask),this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}static{this.interceptor=new i(P,R)}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return L(O(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return N(this.graphic)}castAbilities(e){return{...ae,...e}}get isFeatureFromTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?.clone()??null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get timeZone(){return this.view?.timeZone??x}set timeZone(e){this._overrideIfSome("timeZone",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){const{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:i,_evaluateExpressionAttributesTask:s,_associationVMAbortController:o}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||null!=i&&!i.finished||null!=s&&!s.finished||!!o}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof C&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const s=i?.objectIdField;if(!s||!e||!i)return;const o=e?.attributes?.[s];if(null==o)return;const r=[o];if(!e.geometry){const s=await U({layer:i,graphic:e,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:t}),o=s?.geometry;o&&(e.geometry=o)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}_graphicChanged(){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._graphicChangedTask=p(this._graphicChangedTask),this._graphicChangedTask=r(async e=>{this._error=null,this._clear();const{graphic:t}=this;try{if(!t)return null;const{_sourceLayer:i,_effectivePopupTemplate:s}=this,o=this.spatialReference;await Z({graphic:t,popupTemplate:s,layer:i,spatialReference:o},{signal:e});const[{value:r},{value:a}]=await c([this._getContent(),this._getTitle()]),[,{value:n}]=await c([this._checkForRelatedFeatures({signal:e}),j(s?.expressionInfos,t)]);return{expressionInfos:n,content:r,title:a}}catch(i){throw d(i)||(this._error=i,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:t,popupTemplate:this._effectivePopupTemplate})),i}})}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):"utility-network-associations"===e.type?this._compileUtilityNetworkAssociation(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(o):"string"==typeof e?this._compileText(new I({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(oe),this.removeHandles(se),this.contentViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),s=t?.getObjectId();return null!=i&&null!=s&&i===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:s,spatialReference:o,timeZone:r}=this;t?.filter(Boolean).forEach(t=>{e.some(e=>this._matchesFeature(e,t))||e.add(new te({abilities:{relationshipContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:t}))}),e.forEach(i=>{const s=t?.find(e=>this._matchesFeature(i,e));s||e.remove(i)})}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:s,contentElementViewModel:o}=e,r=s?.type;o&&r&&("fields"===r&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createFieldsVMParams(s,t))),"media"===r&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createMediaVMParams(s,t))),"text"===r&&o.set(this._createTextVMParams(s)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:s,relationshipId:o,title:r,description:a}=e,{_sourceLayer:n,graphic:l,map:p}=this;if(!S(n))return;const c=new V({displayCount:i,graphic:l,orderByFields:s,relationshipId:o,layer:n,map:p,...this._compileTitleAndDesc({title:r,description:a})});return this.contentViewModels[t]=c,this.addHandles(_(()=>c.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(c)),oe),e}_matchesGlobalFeature(e,t){const i=e?.association.globalId,s=t?.association.globalId;return null!=i&&null!=s&&i===s}_setUpUtilityNetworkAssociationsViewModels(e,t,i){const{view:s,spatialReference:o,timeZone:r}=this;e.forEach((i,s)=>{const o=t.get(s);o?i.forEach(t=>{o.find(e=>this._matchesGlobalFeature(t,e))||(i.remove(t),0===i.length&&e.delete(s))}):(i.removeAll(),e.delete(s))}),t.forEach((t,n)=>{const l=e.get(n)||new a;t?.filter(Boolean).forEach((e,t)=>{if(!l.some(t=>this._matchesGlobalFeature(t,e))){const{association:a,feature:n,terminalName:p,title:c}=e;l.add({title:c,association:a,featureViewModel:new te({abilities:{utilityNetworkAssociationsContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:n}),terminalName:p},t)}}),e.set(n,l)})}_compileUtilityNetworkAssociation(e,t){const{displayCount:i,title:s,description:o,associationTypes:r}=e,{_sourceLayer:a,graphic:n,map:l}=this;if(!B(a))return;const p=new ee({graphic:n,displayCount:i,associationTypes:r,layer:a,map:l,...this._compileTitleAndDesc({title:s,description:o})});return this.contentViewModels[t]=p,this.addHandles([u(()=>p.associationFeatures.values(),()=>this._setUpUtilityNetworkAssociationsViewModels(p.associationViewModels,p.associationFeatures,p.map))],re),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:s,map:o,spatialReference:r,view:a,location:n}=this,l=new F({expressionInfo:i,graphic:s,interceptor:te.interceptor,map:o,spatialReference:r,view:a,location:n});return this.contentViewModels[t]=l,this.addHandles(u(()=>l.contentElementViewModel,()=>this._setExpressionContentVM(l,t),m),se),e}_compileAttachments(e,t){const{graphic:i}=this,{description:s,title:o,orderByFields:r}=e;return this.contentViewModels[t]=new M({graphic:i,orderByFields:r,...this._compileTitleAndDesc({title:o,description:s})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:s,destroyer:o}=e;return this.contentViewModels[t]=new T({graphic:i,creator:s,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:s,graphic:o,formattedAttributes:r}=this,a=o?.attributes,n=this._expressionAttributes,l=r.global;return{title:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:e}),description:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,s=this.formattedAttributes,o={...s?.global,...s?.content[t]},r=e?.fieldInfos||i?.fieldInfos,a=r?.filter(({fieldName:e})=>!!e&&(D(e)||G(e)||o.hasOwnProperty(e))),n=i?.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:n,fieldInfos:a,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),s=new E(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=s,i.fieldInfos=s.formattedFieldInfos.slice(),i}_createMediaVMParams(e,t){const{abilities:i,graphic:s,_fieldInfoMap:o,_effectivePopupTemplate:r,relatedInfos:a,_sourceLayer:n,_expressionAttributes:l}=this,p=this.formattedAttributes,c=s?.attributes??{},{description:d,mediaInfos:h,title:u}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:s?.isAggregate,layer:n,fieldInfoMap:o,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:h,popupTemplate:r,relatedInfos:a,...this._compileTitleAndDesc({title:u,description:d})}}_compileMedia(e,t){const i=e.clone(),s=new C(this._createMediaVMParams(e,t));return i.mediaInfos=s.formattedMediaInfos.slice(),this.contentViewModels[t]=s,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:s,_expressionAttributes:o}=this;if(e&&e.text){const r=t?.attributes??{},a=this.formattedAttributes?.global??{};e.text=H({attributes:r,fieldInfoMap:i,globalAttributes:a,expressionAttributes:o,layer:s,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new T(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i,timeZone:s}=this;if(!e)return;const{lastEditInfoEnabled:o}=e,r=t?.editFieldsInfo;return o&&r?q(r,i?.attributes,s,t):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:s,_expressionAttributes:o}=this,r=s?.attributes??{},a=this.formattedAttributes?.global??{};return H({attributes:r,fieldInfoMap:t,globalAttributes:a,expressionAttributes:o,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?z({type:"title",value:e?.title,event:{graphic:t}}):null}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?z({type:"content",value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({title:e,content:t,expressionInfos:i}){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=r(async s=>{const{graphic:o,map:r,view:a,spatialReference:n,location:p}=this;try{if(!o)return;let l;if(null!=i){const e=[];for(const[t,l]of i.expressions.entries())null!=l?e.push(l.evaluate({graphic:o,interceptor:te.interceptor,location:p,map:r,options:{signal:s},spatialReference:n,view:a}).then(e=>[t,"string"==typeof e?k(e):e]).catch(()=>[t,void 0])):e.push(Promise.resolve([t,void 0]));l=Object.fromEntries(await Promise.all(e)),h(s)}this._expressionAttributes=l,this._graphicExpressionAttributes={...o.attributes,...l},this._set("formattedAttributes",this._createFormattedAttributes(t)),this._set("title",this._compileTitle(e)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(t)||null)}catch(c){d(c)||(this._error=c,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:c,graphic:o,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:s,graphic:o,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:n,_graphicExpressionAttributes:l,timeZone:p}=this;i.content[t]=Q({fieldInfos:s?.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:a,fieldInfoMap:n,relatedInfos:r,timeZone:p})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:s,relatedInfos:o,_sourceLayer:r,_fieldInfoMap:a,_graphicExpressionAttributes:n,timeZone:l}=this;i.content[t]=Q({fieldInfos:e.fieldInfos,graphic:s,attributes:{...n,...e.attributes},layer:r,fieldInfoMap:a,relatedInfos:o,timeZone:l})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:r,_graphicExpressionAttributes:a,timeZone:n}=this,l=t?.fieldInfos,p={global:Q({fieldInfos:l,graphic:i,attributes:a,layer:o,fieldInfoMap:r,relatedInfos:s,timeZone:n}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p})}),p}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,O(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:s,_sourceLayer:o}=this;s.clear();const r=null!=o?.associatedLayer?await(o?.associatedLayer.load(i)):o;if(!r||!e)return;const a=t.filter(e=>!!e.fieldName&&G(e.fieldName));if(!a?.length)return;t.forEach(e=>this._configureRelatedInfo(e,r));const n=await J({relatedInfos:s,layer:r},i);Object.keys(n).forEach(e=>{const t=s.get(e.toString()),i=n[e]?.value;t&&i&&(t.layerInfo=i.data)});const l=await K({graphic:e,relatedInfos:s,layer:r},i);Object.keys(l).forEach(e=>{W(l[e]?.value,s.get(e.toString()))})}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,s=X(e.fieldName||"");if(!s)return;const{layerId:o,fieldName:r}=s;if(!o)return;const a=i.get(o.toString())||Y(o,t);a&&($({relatedInfo:a,fieldName:r,fieldInfo:e}),this.relatedInfos.set(o,a))}};e([g()],ne.prototype,"_error",void 0),e([g()],ne.prototype,"_graphicChangedTask",void 0),e([g()],ne.prototype,"_evaluateExpressionAttributesTask",void 0),e([g()],ne.prototype,"_associationVMAbortController",void 0),e([g({readOnly:!0})],ne.prototype,"_effectivePopupTemplate",null),e([g({readOnly:!0})],ne.prototype,"_fieldInfoMap",null),e([g({readOnly:!0})],ne.prototype,"_sourceLayer",null),e([g()],ne.prototype,"abilities",void 0),e([b("abilities")],ne.prototype,"castAbilities",null),e([g({readOnly:!0})],ne.prototype,"content",void 0),e([g({readOnly:!0})],ne.prototype,"contentViewModels",void 0),e([g()],ne.prototype,"description",void 0),e([g({type:Boolean})],ne.prototype,"defaultPopupTemplateEnabled",void 0),e([g({readOnly:!0})],ne.prototype,"isFeatureFromTable",null),e([g({readOnly:!0})],ne.prototype,"state",null),e([g({readOnly:!0})],ne.prototype,"formattedAttributes",void 0),e([g({type:t,value:null})],ne.prototype,"graphic",null),e([g({readOnly:!0})],ne.prototype,"lastEditInfo",void 0),e([g({type:w})],ne.prototype,"location",void 0),e([g({readOnly:!0})],ne.prototype,"relatedInfos",void 0),e([g({type:A})],ne.prototype,"spatialReference",null),e([g()],ne.prototype,"timeZone",null),e([g({readOnly:!0})],ne.prototype,"title",void 0),e([g()],ne.prototype,"map",null),e([g({readOnly:!0})],ne.prototype,"waitingForContent",null),e([g()],ne.prototype,"view",void 0),ne=te=e([v("esri.widgets.Feature.FeatureViewModel")],ne);export{ne as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import s from"../../core/Accessor.js";import{isSome as o}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import l from"../../core/Logger.js";import{abortMaybe as p}from"../../core/maybe.js";import{eachAlways as c,isAbortError as d,throwIfAborted as h}from"../../core/promiseUtils.js";import{watch as u,when as f,initial as m,on as _}from"../../core/reactiveUtils.js";import{throttle as y}from"../../core/throttle.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import{cast as b}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/Point.js";import A from"../../geometry/SpatialReference.js";import I from"../../popup/content/TextContent.js";import{system as x}from"../../time/constants.js";import M from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import T from"./FeatureContent/FeatureContentViewModel.js";import F from"./FeatureExpression/FeatureExpressionViewModel.js";import E from"./FeatureFields/FeatureFieldsViewModel.js";import C from"./FeatureMedia/FeatureMediaViewModel.js";import V from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{compileExpressionInfos as j,formatArcadeValue as k}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as P,preRequestCallback as R,createFieldInfoMap as L,getAllFieldInfos as O,getSourceLayer as N,querySourceLayer as U,queryUpdatedFeature as Z,isRelatableFeatureSupportedLayer as S,isAssociatedFeatureSupportedLayer as B,substituteFieldsInLinksAndAttributes as H,isExpressionField as D,isRelatedField as G,formatEditInfo as q,graphicCallback as z,formatAttributes as Q}from"./support/featureUtils.js";import{queryLayerInfos as J,queryRelatedFeatures as K,setRelatedFeatures as W,getRelatedFieldInfo as X,createRelatedInfo as Y,updateRelatedInfo as $}from"./support/relatedFeatureUtils.js";import ee from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";var te;const ie=1,se="content-view-models",oe="relationship-view-models",re="association-view-models",ae={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let ne=class extends(n(s)){static{te=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._associationVMAbortController=null,this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...ae},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title="",this.view=null,this._graphicChangedThrottled=y(this._graphicChanged,()=>this.notifyChange("waitingForContent"),ie,this),this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent||"utility-network-associations"===e.type&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=y(this._evaluateExpressionAttributes,()=>this.notifyChange("waitingForContent"),ie,this),this.addHandles([u(()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone],()=>this._graphicChangedThrottled(),m),f(()=>{if(!this._graphicChangedTask?.finished||null==this._graphicChangedTask.value)return null;const e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has("view-scale")?this.view?.scale:null,t?.has("view-time-extent")?this.view?.timeExtent?.start:null,t?.has("view-time-extent")?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=p(this._graphicChangedTask),this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}static{this.interceptor=new i(P,R)}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return L(O(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return N(this.graphic)}castAbilities(e){return{...ae,...e}}get isFeatureFromTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get timeZone(){return this.view?.timeZone??x}set timeZone(e){this._overrideIfSome("timeZone",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){const{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:i,_evaluateExpressionAttributesTask:s,_associationVMAbortController:o}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||null!=i&&!i.finished||null!=s&&!s.finished||!!o}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof C&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof C&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const s=i?.objectIdField;if(!s||!e||!i)return;const o=e?.attributes?.[s];if(null==o)return;const r=[o];if(!e.geometry){const s=await U({layer:i,graphic:e,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:t}),o=s?.geometry;o&&(e.geometry=o)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}_graphicChanged(){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._graphicChangedTask=p(this._graphicChangedTask),this._graphicChangedTask=r(async e=>{this._error=null,this._clear();const{graphic:t}=this;try{if(!t)return null;const{_sourceLayer:i,_effectivePopupTemplate:s}=this,o=this.spatialReference;await Z({graphic:t,popupTemplate:s,layer:i,spatialReference:o},{signal:e});const[{value:r},{value:a}]=await c([this._getContent(),this._getTitle()]),[,{value:n}]=await c([this._checkForRelatedFeatures({signal:e}),j(s?.expressionInfos,t)]);return{expressionInfos:n,content:r,title:a}}catch(i){throw d(i)||(this._error=i,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:t,popupTemplate:this._effectivePopupTemplate})),i}})}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):"utility-network-associations"===e.type?this._compileUtilityNetworkAssociation(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(o):"string"==typeof e?this._compileText(new I({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(oe),this.removeHandles(se),this.contentViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),s=t?.getObjectId();return null!=i&&null!=s&&i===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:s,spatialReference:o,timeZone:r}=this;t?.filter(Boolean).forEach(t=>{e.some(e=>this._matchesFeature(e,t))||e.add(new te({abilities:{relationshipContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:t}))}),e.forEach(i=>{const s=t?.find(e=>this._matchesFeature(i,e));s||e.remove(i)})}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:s,contentElementViewModel:o}=e,r=s?.type;o&&r&&("fields"===r&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createFieldsVMParams(s,t))),"media"===r&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:t,formattedAttributes:i}),o.set(this._createMediaVMParams(s,t))),"text"===r&&o.set(this._createTextVMParams(s)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:s,relationshipId:o,title:r,description:a}=e,{_sourceLayer:n,graphic:l,map:p}=this;if(!S(n))return;const c=new V({displayCount:i,graphic:l,orderByFields:s,relationshipId:o,layer:n,map:p,...this._compileTitleAndDesc({title:r,description:a})});return this.contentViewModels[t]=c,this.addHandles(_(()=>c.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(c)),oe),e}_matchesGlobalFeature(e,t){const i=e?.association.globalId,s=t?.association.globalId;return null!=i&&null!=s&&i===s}_setUpUtilityNetworkAssociationsViewModels(e,t,i){const{view:s,spatialReference:o,timeZone:r}=this;e.forEach((i,s)=>{const o=t.get(s);o?i.forEach(t=>{o.find(e=>this._matchesGlobalFeature(t,e))||(i.remove(t),0===i.length&&e.delete(s))}):(i.removeAll(),e.delete(s))}),t.forEach((t,n)=>{const l=e.get(n)||new a;t?.filter(Boolean).forEach((e,t)=>{if(!l.some(t=>this._matchesGlobalFeature(t,e))){const{association:a,feature:n,terminalName:p,title:c}=e;l.add({title:c,association:a,featureViewModel:new te({abilities:{utilityNetworkAssociationsContent:!1},map:i,view:s,spatialReference:o,timeZone:r,graphic:n}),terminalName:p},t)}}),e.set(n,l)})}_compileUtilityNetworkAssociation(e,t){const{displayCount:i,title:s,description:o,associationTypes:r}=e,{_sourceLayer:a,graphic:n,map:l}=this;if(!B(a))return;const p=new ee({graphic:n,displayCount:i,associationTypes:r,layer:a,map:l,...this._compileTitleAndDesc({title:s,description:o})});return this.contentViewModels[t]=p,this.addHandles([u(()=>p.associationFeatures.values(),()=>this._setUpUtilityNetworkAssociationsViewModels(p.associationViewModels,p.associationFeatures,p.map))],re),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:s,map:o,spatialReference:r,view:a,location:n}=this,l=new F({expressionInfo:i,graphic:s,interceptor:te.interceptor,map:o,spatialReference:r,view:a,location:n});return this.contentViewModels[t]=l,this.addHandles(u(()=>l.contentElementViewModel,()=>this._setExpressionContentVM(l,t),m),se),e}_compileAttachments(e,t){const{graphic:i}=this,{description:s,title:o,orderByFields:r}=e;return this.contentViewModels[t]=new M({graphic:i,orderByFields:r,...this._compileTitleAndDesc({title:o,description:s})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:s,destroyer:o}=e;return this.contentViewModels[t]=new T({graphic:i,creator:s,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:s,graphic:o,formattedAttributes:r}=this,a=o?.attributes,n=this._expressionAttributes,l=r.global;return{title:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:e}),description:H({attributes:a,fieldInfoMap:i,globalAttributes:l,expressionAttributes:n,layer:s,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,s=this.formattedAttributes,o={...s?.global,...s?.content[t]},r=e?.fieldInfos||i?.fieldInfos,a=r?.filter(({fieldName:e})=>!!e&&(D(e)||G(e)||o.hasOwnProperty(e))),n=i?.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:n,fieldInfos:a,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),s=new E(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=s,i.fieldInfos=s.formattedFieldInfos.slice(),i}_createMediaVMParams(e,t){const{abilities:i,graphic:s,_fieldInfoMap:o,_effectivePopupTemplate:r,relatedInfos:a,_sourceLayer:n,_expressionAttributes:l}=this,p=this.formattedAttributes,c=s?.attributes??{},{description:d,mediaInfos:h,title:u}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:s?.isAggregate,layer:n,fieldInfoMap:o,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:h,popupTemplate:r,relatedInfos:a,...this._compileTitleAndDesc({title:u,description:d})}}_compileMedia(e,t){const i=e.clone(),s=new C(this._createMediaVMParams(e,t));return i.mediaInfos=s.formattedMediaInfos.slice(),this.contentViewModels[t]=s,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:s,_expressionAttributes:o}=this;if(e&&e.text){const r=t?.attributes??{},a=this.formattedAttributes?.global??{};e.text=H({attributes:r,fieldInfoMap:i,globalAttributes:a,expressionAttributes:o,layer:s,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new T(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i,timeZone:s}=this;if(!e)return;const{lastEditInfoEnabled:o}=e,r=t?.editFieldsInfo;return o&&r?q(r,i?.attributes,s,t):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:s,_expressionAttributes:o}=this,r=s?.attributes??{},a=this.formattedAttributes?.global??{};return H({attributes:r,fieldInfoMap:t,globalAttributes:a,expressionAttributes:o,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?z({type:"title",value:e?.title,event:{graphic:t}}):null}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;return t?z({type:"content",value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({title:e,content:t,expressionInfos:i}){this._evaluateExpressionAttributesTask=p(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=r(async s=>{const{graphic:o,map:r,view:a,spatialReference:n,location:p}=this;try{if(!o)return;let l;if(null!=i){const e=[];for(const[t,l]of i.expressions.entries())null!=l?e.push(l.evaluate({graphic:o,interceptor:te.interceptor,location:p,map:r,options:{signal:s},spatialReference:n,view:a}).then(e=>[t,"string"==typeof e?k(e):e]).catch(()=>[t,void 0])):e.push(Promise.resolve([t,void 0]));l=Object.fromEntries(await Promise.all(e)),h(s)}this._expressionAttributes=l,this._graphicExpressionAttributes={...o.attributes,...l},this._set("formattedAttributes",this._createFormattedAttributes(t)),this._set("title",this._compileTitle(e)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(t)||null)}catch(c){d(c)||(this._error=c,l.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:c,graphic:o,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:s,graphic:o,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:n,_graphicExpressionAttributes:l,timeZone:p}=this;i.content[t]=Q({fieldInfos:s?.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:a,fieldInfoMap:n,relatedInfos:r,timeZone:p})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:s,relatedInfos:o,_sourceLayer:r,_fieldInfoMap:a,_graphicExpressionAttributes:n,timeZone:l}=this;i.content[t]=Q({fieldInfos:e.fieldInfos,graphic:s,attributes:{...n,...e.attributes},layer:r,fieldInfoMap:a,relatedInfos:o,timeZone:l})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:r,_graphicExpressionAttributes:a,timeZone:n}=this,l=t?.fieldInfos,p={global:Q({fieldInfos:l,graphic:i,attributes:a,layer:o,fieldInfoMap:r,relatedInfos:s,timeZone:n}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:p})}),p}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,O(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:s,_sourceLayer:o}=this;s.clear();const r=null!=o?.associatedLayer?await(o?.associatedLayer.load(i)):o;if(!r||!e)return;const a=t.filter(e=>!!e.fieldName&&G(e.fieldName));if(!a?.length)return;t.forEach(e=>this._configureRelatedInfo(e,r));const n=await J({relatedInfos:s,layer:r},i);Object.keys(n).forEach(e=>{const t=s.get(e.toString()),i=n[e]?.value;t&&i&&(t.layerInfo=i.data)});const l=await K({graphic:e,relatedInfos:s,layer:r},i);Object.keys(l).forEach(e=>{W(l[e]?.value,s.get(e.toString()))})}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,s=X(e.fieldName||"");if(!s)return;const{layerId:o,fieldName:r}=s;if(!o)return;const a=i.get(o.toString())||Y(o,t);a&&($({relatedInfo:a,fieldName:r,fieldInfo:e}),this.relatedInfos.set(o,a))}};e([g()],ne.prototype,"_error",void 0),e([g()],ne.prototype,"_graphicChangedTask",void 0),e([g()],ne.prototype,"_evaluateExpressionAttributesTask",void 0),e([g()],ne.prototype,"_associationVMAbortController",void 0),e([g({readOnly:!0})],ne.prototype,"_effectivePopupTemplate",null),e([g({readOnly:!0})],ne.prototype,"_fieldInfoMap",null),e([g({readOnly:!0})],ne.prototype,"_sourceLayer",null),e([g()],ne.prototype,"abilities",void 0),e([b("abilities")],ne.prototype,"castAbilities",null),e([g({readOnly:!0})],ne.prototype,"content",void 0),e([g({readOnly:!0})],ne.prototype,"contentViewModels",void 0),e([g()],ne.prototype,"description",void 0),e([g({type:Boolean})],ne.prototype,"defaultPopupTemplateEnabled",void 0),e([g({readOnly:!0})],ne.prototype,"isFeatureFromTable",null),e([g({readOnly:!0})],ne.prototype,"state",null),e([g({readOnly:!0})],ne.prototype,"formattedAttributes",void 0),e([g({type:t})],ne.prototype,"graphic",void 0),e([g({readOnly:!0})],ne.prototype,"lastEditInfo",void 0),e([g({type:w})],ne.prototype,"location",void 0),e([g({readOnly:!0})],ne.prototype,"relatedInfos",void 0),e([g({type:A})],ne.prototype,"spatialReference",null),e([g()],ne.prototype,"timeZone",null),e([g({readOnly:!0})],ne.prototype,"title",void 0),e([g()],ne.prototype,"map",null),e([g({readOnly:!0})],ne.prototype,"waitingForContent",null),e([g()],ne.prototype,"view",void 0),ne=te=e([v("esri.widgets.Feature.FeatureViewModel")],ne);export{ne 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import o from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import{drainHandles as a}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as r,abortMaybe as n}from"../../core/maybe.js";import{createAbortError as p,whenOrAbort as l,ignoreAbortErrors as h}from"../../core/promiseUtils.js";import{on as c,watch as d,syncAndInitial as u,when as m,whenOnce as y}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as _}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as b,isLoaded as w,load as G,project as O}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as T}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import S from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import k from"../../symbols/FillSymbol3DLayer.js";import A from"../../symbols/MeshSymbol3D.js";import C from"../../symbols/SimpleFillSymbol.js";import H from"../../symbols/SimpleLineSymbol.js";import j from"../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as U}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as R}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as I}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as P}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as x}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as L}from"../../views/input/InputManager.js";import{sketchKeys as F}from"../../views/interactive/keybindings.js";import V from"../../views/interactive/sketch/SketchLabelOptions.js";import K from"../../views/interactive/sketch/SketchOptions.js";import W from"../../views/interactive/sketch/SketchTooltipOptions.js";import Z from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as q}from"../../views/interactive/snapping/SnappingManager.js";import N from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as z}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as B}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as $}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Y}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as J}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as Q}from"../../views/support/screenUtils.js";import{CreateOperationHandle as X,UpdateOperationHandle as ee}from"./support/OperationHandle.js";import{getModeFromCreateOptions as te,getDrawToolGeometryTypeFromCreateTool as oe}from"./support/sketchUtils.js";const ie={defaultZ:0},ae={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Y},tool:"transform"},se=Symbol();let re=class extends i{constructor(e){super(e),this._defaultSnappingManager=null,this._updatingHandles=new f,this._internalGraphicsLayer=new S({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new C({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new H({color:[130,130,130,1],width:2}),this.meshSymbol=new A({symbolLayers:new t([new k])}),this.updateGraphics=new t,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new K,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._originalPopupEnabled=null,this.defaultCreateOptions=ie,this.defaultUpdateOptions=ae,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new N}initialize(){this.addHandles([c(()=>this.view?.map?.layers,"change",e=>{e.removed.includes(this.layer)&&this.cancel()}),c(()=>this.layer?.graphics,"change",e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())}),d(()=>this.layer?.elevationInfo??null,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},u),d(()=>this.view,e=>{this._defaultSnappingManager=r(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new q({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")))},u),d(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),z(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=r(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get updating(){return this._updatingHandles.updating||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){return"create"===this._operationHandle?.type&&this._operationHandle.activeComponent&&"mode"in this._operationHandle.activeComponent?this._operationHandle.activeComponent.mode:null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...ie,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...ae,...e,reshapeOptions:{...ae.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...ae.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=r(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new q({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(m(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=n(this._moduleLoaderAbortController),this._viewReadyAbortController=n(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){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})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),p();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");x(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const s=()=>{if(a===this._operationHandle){const o=this.createGraphic,s=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==o||i.add(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:s?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),s||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(h(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(h(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),p();null!=i.activeTool&&(i.activeTool=null);const s=Array.isArray(e)?e:[e];if(null==e||!s?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(s.some(e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0)))return;const r=await this._updatingHandles.addPromise(this._setupUpdateOperation(s,t));this.destroyed||null==r||ge(r)||(x(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(r,t),this.emit("update",{graphics:s,state:"start",aborted:!1,tool:r.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||E(o.geometry.spatialReference,t.spatialReference)||(b(o.geometry.spatialReference,t.spatialReference)||w()||await G(),o.geometry=O(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return J(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e.type)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?_(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},L.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(Q(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||i.layer===this.layer?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:s,geometryToPlace:r,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=te(p,e),c=oe(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:r,geometryType:c,mode:h,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:s,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),B(),$()]);return ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:le(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}async _makeDrawGraphicTool3D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ge(t)||this.destroyed)return null;const{elevationInfo:a}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:a,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,s=e.centered,r=[t.on("key-down",t=>{if(t.key===F.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===F.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==F.vertexAdd||t.repeat)t.key===F.undo?(t.stopPropagation(),n.undo()):t.key===F.redo?(t.stopPropagation(),n.redo()):t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===F.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},L.WIDGET),t.on("key-up",t=>{t.key===F.pan?e.enabled=!0:t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===F.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},L.WIDGET),e.on("vertex-add",t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic: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:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?n&&n.cancel():n&&n.complete()}),d(()=>this._getGraphicSymbolFromTool(e.geometryType),t=>{e.graphicSymbol=t})],n=new X({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{a(r),t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let s=a.tool??ae.tool;for(const r of e)o.remove(r),o.add(r);if("3d"===i.type){if(0===e.length)return null;switch(s){case"move":return this._setupMove3DOperation(e,a,i,s);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,i);case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(s){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,s,a,i);case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(s="reshape")}return this._setupTransformOrReshape2DOperation(e,s,a,i)}}async _setupMove3DOperation(e,t,o,i,s=!1){const[r,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ge(r))return r;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=r.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const a of e){const e=new p({view:o,graphic:a}),t=R(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${D(t)}).`),null;h.set(a,e)}const d=new l({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,autoLengthMeasurementUtils:n});o.tools.add(d),d.objects.addMany(Array.from(h.values())),s||this.updateGraphics.addMany(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),ye(o,d),c()},undo:()=>{ue(this.view,d),he(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ce(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new p({view:o,graphic:e});h.set(e,t),d.objects.push(t),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);if(m.history.undo.forEach(e=>e.updates.splice(t,1)),m.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)return void m.complete();const o=h.get(e);o&&(d.objects.remove(o),o.destroy(),h.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._setupReshape3DOperation(e,t,o,!0);a&&!ge(a)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(a,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===P(e[0])){const a=e[0],s=a.geometry;if(null!=s&&("point"===s.type||"mesh"===s.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=s&&("polygon"===s.type||"polyline"===s.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:s,enableScaling:r,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(ge(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:s,enableScaling:r,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),ye(o,d),c.destroy()},undo:()=>{ue(this.view,d),he(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ce(m,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"}),m.onEnd(),m.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||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"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const s="transform",{enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(F.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),i||this.updateGraphics.add(e);const v=[],f=new ee({activeComponent:g,tool:s,type:"update",onEnd:()=>{a(v),ye(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},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"}),f.onEnd(),f.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||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"}),f.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._setupReshape3DOperation(e,t,o,!0);i&&!ge(i)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(i,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),L.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),L.WIDGET),o.on("key-down",e=>{e.key!==F.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET)),f}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s=await this._getGraphicMover(e,t,o);if(ge(s))return s;const r=new ee({activeComponent:s,tool:i,type:"update",onEnd:()=>{this._clearCursor(),a(l),a(p),s.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();he(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ce(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),s.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?s.graphics=o:r.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==F.constraint||e.repeat||(n=!0,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&n&&(n=!1,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET)],l=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const s="reshape",[r,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ge(r))return r;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=r.module,c=new l({view:o,graphic:e}),d=I(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(d)}).`),null;const u=t.reshapeOptions,m=new h({view:o,object:c,enableZVertex:t.enableZ&&"move"===u?.vertexOperation,enableZShape:t.enableZ&&"move"===u?.shapeOperation,enableMoveObject:"move"===u?.shapeOperation||"move-xy"===u?.shapeOperation,enableMidpoints:"split"===u?.edgeOperation,enableEdgeOffset:"offset"===u?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:p});o.tools.add(m),i||this.updateGraphics.add(c.graphic);const y=[],g=new ee({activeComponent:m,tool:s,type:"update",onEnd:()=>{a(y),ye(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},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"}),g.onEnd(),g.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||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"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);ge(e)||this._setUpdateOperationHandle(e,t)}});return y.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},L.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(ge(s))return s;const r=new ee({activeComponent:s,type:"update",onEnd:()=>{a(p),a(n),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{he(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ce(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(),r.onEnd(),r.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(ge(a))return;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: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||null==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.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let s=null;"transform"===r.tool?s=await this._getReshape([e],o,i):"reshape"===r.tool&&(s=await this._getBox([e],o,i)),ge(s)||(r.activeComponent?.destroy(),r.activeComponent=s,r.activeComponent&&(a(p),p=this._getHandlesForComponent(r,o)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),L.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===F.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET),i.on("key-up",e=>{if(e.key===F.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET)];let p=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,s=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return ge(s)?s:new s.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),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._displayCursor("pointer"),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._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:s,preserveAspectRatio:r}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),$()]);if(ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(F.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:s?.name,highlightsEnabled:!!s?.enabled,preserveAspectRatio:!!r!=!!l,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:p,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){const{highlightOptions:i,reshapeOptions:a}=t,s="split"===a?.edgeOperation,r="move"===a?.shapeOperation,[n,p,l]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),B(),$()]);return ge(n)?n:new n.module.default({enableMidpoints:s,enableMovement:r,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:l,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=>T(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=>T(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;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(me(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(me(t.graphics))),o.on("rotate-start",t=>e.addToHistory(me(t.graphics))),o.on("scale-start",t=>e.addToHistory(me(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(me([t.mover]))),o.on("reshape-start",t=>e.addToHistory(me([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(me([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(me([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("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.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.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=Q(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.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===F.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===F.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===F.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&F.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=r(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(se)}_displayCursor(e){this.removeHandles(se),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),se)}_logError(e,t,i){s.getLogger(this).error(new o(e,t,i))}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"})}get test(){}wait(){return y(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(n(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await l(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",pe("view"))}_logMissingLayer(){this._logError(ne,pe("layer"))}};e([g()],re.prototype,"_defaultSnappingManager",void 0),e([g()],re.prototype,"updating",null),e([g({readOnly:!0})],re.prototype,"_updatingHandles",void 0),e([g()],re.prototype,"_operationHandle",void 0),e([g({readOnly:!0})],re.prototype,"activeTool",null),e([g({readOnly:!0})],re.prototype,"activeCreateToolDrawMode",null),e([g()],re.prototype,"activeTooltip",null),e([g({types:U})],re.prototype,"activeFillSymbol",void 0),e([g()],re.prototype,"activeLineSymbol",void 0),e([g()],re.prototype,"activeVertexSymbol",void 0),e([g()],re.prototype,"allowDeleteKey",void 0),e([g({readOnly:!0})],re.prototype,"createGraphic",null),e([g()],re.prototype,"defaultCreateOptions",null),e([g()],re.prototype,"defaultUpdateOptions",null),e([g({type:V,nonNullable:!0})],re.prototype,"labelOptions",null),e([g()],re.prototype,"layer",void 0),e([g({types:U})],re.prototype,"pointSymbol",void 0),e([g({types:U})],re.prototype,"polygonSymbol",void 0),e([g({types:U})],re.prototype,"polylineSymbol",void 0),e([g()],re.prototype,"meshSymbol",void 0),e([g({type:N,nonNullable:!0})],re.prototype,"snappingOptions",null),e([g()],re.prototype,"snappingManager",null),e([g({readOnly:!0})],re.prototype,"state",null),e([g({type:W,nonNullable:!0})],re.prototype,"tooltipOptions",null),e([g({readOnly:!0})],re.prototype,"updateGraphics",void 0),e([g()],re.prototype,"updateOnGraphicClick",void 0),e([g()],re.prototype,"creationMode",void 0),e([g({type:Z,nonNullable:!0})],re.prototype,"valueOptions",null),e([g({types:U})],re.prototype,"vertexSymbol",void 0),e([g({value:null})],re.prototype,"view",null),e([g({constructOnly:!0,type:K})],re.prototype,"sketchOptions",void 0),re=e([v("esri.widgets.Sketch.SketchViewModel")],re);const ne="sketch:missing-property",pe=e=>`Property '${e}' is missing on SketchViewModel.`;function le(e){return"polygon"===e||"rectangle"===e||"circle"===e}function he(e,t){de("undo",e.history.undo,e.history.redo,t)}function ce(e,t){de("redo",e.history.redo,e.history.undo,t)}function de(e,t,o,i){const a=t.pop();if(!a)return;const s=a.updates,r=[];i.forEach((t,o)=>{const i=s[o];null!=i&&("geometry"in i&&null!=i.geometry&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=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 ue(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function me(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function ye(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function ge(e){return"requireError"in e&&"aborted"===e.requireError}export{re as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import o from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import{drainHandles as a}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as r,abortMaybe as n}from"../../core/maybe.js";import{createAbortError as p,whenOrAbort as l,ignoreAbortErrors as h}from"../../core/promiseUtils.js";import{on as c,watch as d,syncAndInitial as u,when as m,whenOnce as y}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as _}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as b,isLoaded as w,load as G,project as O}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as T}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import S from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import k from"../../symbols/FillSymbol3DLayer.js";import A from"../../symbols/MeshSymbol3D.js";import C from"../../symbols/SimpleFillSymbol.js";import H from"../../symbols/SimpleLineSymbol.js";import j from"../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as U}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as R}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as I}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as P}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as x}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as L}from"../../views/input/InputManager.js";import{sketchKeys as F}from"../../views/interactive/keybindings.js";import V from"../../views/interactive/sketch/SketchLabelOptions.js";import K from"../../views/interactive/sketch/SketchOptions.js";import W from"../../views/interactive/sketch/SketchTooltipOptions.js";import Z from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as q}from"../../views/interactive/snapping/SnappingManager.js";import N from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as z}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as B}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as $}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Y}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as J}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as Q}from"../../views/support/screenUtils.js";import{CreateOperationHandle as X,UpdateOperationHandle as ee}from"./support/OperationHandle.js";import{getModeFromCreateOptions as te,getDrawToolGeometryTypeFromCreateTool as oe}from"./support/sketchUtils.js";const ie={defaultZ:0},ae={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Y},tool:"transform"},se=Symbol();let re=class extends i{constructor(e){super(e),this._defaultSnappingManager=null,this._updatingHandles=new f,this._internalGraphicsLayer=new S({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new C({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new H({color:[130,130,130,1],width:2}),this.meshSymbol=new A({symbolLayers:new t([new k])}),this.updateGraphics=new t,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new K,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._originalPopupEnabled=null,this.defaultCreateOptions=ie,this.defaultUpdateOptions=ae,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new N}initialize(){this.addHandles([c(()=>this.view?.map?.layers,"change",e=>{e.removed.includes(this.layer)&&this.cancel()}),c(()=>this.layer?.graphics,"change",e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())}),d(()=>this.layer?.elevationInfo??null,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},u),d(()=>this.view,e=>{this._defaultSnappingManager=r(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new q({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")))},u),d(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),z(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=r(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get updating(){return this._updatingHandles.updating||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){return"create"===this._operationHandle?.type&&this._operationHandle.activeComponent&&"mode"in this._operationHandle.activeComponent?this._operationHandle.activeComponent.mode:null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...ie,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...ae,...e,reshapeOptions:{...ae.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...ae.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=r(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new q({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(m(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=n(this._moduleLoaderAbortController),this._viewReadyAbortController=n(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){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})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),p();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");x(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const s=()=>{if(a===this._operationHandle){const o=this.createGraphic,s=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||i.add(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:s?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),s||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(h(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(h(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),p();null!=i.activeTool&&(i.activeTool=null);const s=Array.isArray(e)?e:[e];if(null==e||!s?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(s.some(e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0)))return;const r=await this._updatingHandles.addPromise(this._setupUpdateOperation(s,t));this.destroyed||null==r||ge(r)||(x(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(r,t),this.emit("update",{graphics:s,state:"start",aborted:!1,tool:r.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||E(o.geometry.spatialReference,t.spatialReference)||(b(o.geometry.spatialReference,t.spatialReference)||w()||await G(),o.geometry=O(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return J(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e.type)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?_(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},L.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(Q(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||i.layer===this.layer?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:s,geometryToPlace:r,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=te(p,e),c=oe(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:r,geometryType:c,mode:h,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:s,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),B(),$()]);return ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:le(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}async _makeDrawGraphicTool3D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ge(t)||this.destroyed)return null;const{elevationInfo:a}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:a,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,s=e.centered,r=[t.on("key-down",t=>{if(t.key===F.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===F.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==F.vertexAdd||t.repeat)t.key===F.undo?(t.stopPropagation(),n.undo()):t.key===F.redo?(t.stopPropagation(),n.redo()):t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===F.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},L.WIDGET),t.on("key-up",t=>{t.key===F.pan?e.enabled=!0:t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===F.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},L.WIDGET),e.on("vertex-add",t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic: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:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?n&&n.cancel():n&&n.complete()}),d(()=>this._getGraphicSymbolFromTool(e.geometryType),t=>{e.graphicSymbol=t})],n=new X({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{a(r),t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let s=a.tool??ae.tool;for(const r of e)o.remove(r),o.add(r);if("3d"===i.type){if(0===e.length)return null;switch(s){case"move":return this._setupMove3DOperation(e,a,i,s);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,i);case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(s){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,s,a,i);case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(s="reshape")}return this._setupTransformOrReshape2DOperation(e,s,a,i)}}async _setupMove3DOperation(e,t,o,i,s=!1){const[r,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ge(r))return r;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=r.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const a of e){const e=new p({view:o,graphic:a}),t=R(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${D(t)}).`),null;h.set(a,e)}const d=new l({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,autoLengthMeasurementUtils:n});o.tools.add(d),d.objects.addMany(Array.from(h.values())),s||this.updateGraphics.addMany(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),ye(o,d),c()},undo:()=>{ue(this.view,d),he(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ce(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new p({view:o,graphic:e});h.set(e,t),d.objects.push(t),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);if(m.history.undo.forEach(e=>e.updates.splice(t,1)),m.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)return void m.complete();const o=h.get(e);o&&(d.objects.remove(o),o.destroy(),h.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._setupReshape3DOperation(e,t,o,!0);a&&!ge(a)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(a,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===P(e[0])){const a=e[0],s=a.geometry;if(null!=s&&("point"===s.type||"mesh"===s.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=s&&("polygon"===s.type||"polyline"===s.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:s,enableScaling:r,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(ge(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:s,enableScaling:r,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),ye(o,d),c.destroy()},undo:()=>{ue(this.view,d),he(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ce(m,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"}),m.onEnd(),m.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||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"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const s="transform",{enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(F.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),i||this.updateGraphics.add(e);const v=[],f=new ee({activeComponent:g,tool:s,type:"update",onEnd:()=>{a(v),ye(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},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"}),f.onEnd(),f.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||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"}),f.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._setupReshape3DOperation(e,t,o,!0);i&&!ge(i)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(i,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),L.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),L.WIDGET),o.on("key-down",e=>{e.key!==F.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET)),f}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s=await this._getGraphicMover(e,t,o);if(ge(s))return s;const r=new ee({activeComponent:s,tool:i,type:"update",onEnd:()=>{this._clearCursor(),a(l),a(p),s.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();he(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ce(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),s.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?s.graphics=o:r.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==F.constraint||e.repeat||(n=!0,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&n&&(n=!1,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET)],l=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const s="reshape",[r,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ge(r))return r;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=r.module,c=new l({view:o,graphic:e}),d=I(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(d)}).`),null;const u=t.reshapeOptions,m=new h({view:o,object:c,enableZVertex:t.enableZ&&"move"===u?.vertexOperation,enableZShape:t.enableZ&&"move"===u?.shapeOperation,enableMoveObject:"move"===u?.shapeOperation||"move-xy"===u?.shapeOperation,enableMidpoints:"split"===u?.edgeOperation,enableEdgeOffset:"offset"===u?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:p});o.tools.add(m),i||this.updateGraphics.add(c.graphic);const y=[],g=new ee({activeComponent:m,tool:s,type:"update",onEnd:()=>{a(y),ye(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},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"}),g.onEnd(),g.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||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"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);ge(e)||this._setUpdateOperationHandle(e,t)}});return y.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},L.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(ge(s))return s;const r=new ee({activeComponent:s,type:"update",onEnd:()=>{a(p),a(n),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{he(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ce(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(),r.onEnd(),r.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(ge(a))return;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: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||null==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.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let s=null;"transform"===r.tool?s=await this._getReshape([e],o,i):"reshape"===r.tool&&(s=await this._getBox([e],o,i)),ge(s)||(r.activeComponent?.destroy(),r.activeComponent=s,r.activeComponent&&(a(p),p=this._getHandlesForComponent(r,o)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),L.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===F.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET),i.on("key-up",e=>{if(e.key===F.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET)];let p=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,s=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return ge(s)?s:new s.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),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._displayCursor("pointer"),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._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:s,preserveAspectRatio:r}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),$()]);if(ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(F.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:s?.name,highlightsEnabled:!!s?.enabled,preserveAspectRatio:!!r!=!!l,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:p,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){const{highlightOptions:i,reshapeOptions:a}=t,s="split"===a?.edgeOperation,r="move"===a?.shapeOperation,[n,p,l]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),B(),$()]);return ge(n)?n:new n.module.default({enableMidpoints:s,enableMovement:r,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:l,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=>T(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=>T(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;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(me(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(me(t.graphics))),o.on("rotate-start",t=>e.addToHistory(me(t.graphics))),o.on("scale-start",t=>e.addToHistory(me(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(me([t.mover]))),o.on("reshape-start",t=>e.addToHistory(me([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(me([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(me([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("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.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.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=Q(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.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===F.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===F.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===F.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&F.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=r(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(se)}_displayCursor(e){this.removeHandles(se),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),se)}_logError(e,t,i){s.getLogger(this).error(new o(e,t,i))}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"})}get test(){}wait(){return y(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(n(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await l(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",pe("view"))}_logMissingLayer(){this._logError(ne,pe("layer"))}};e([g()],re.prototype,"_defaultSnappingManager",void 0),e([g()],re.prototype,"updating",null),e([g({readOnly:!0})],re.prototype,"_updatingHandles",void 0),e([g()],re.prototype,"_operationHandle",void 0),e([g({readOnly:!0})],re.prototype,"activeTool",null),e([g({readOnly:!0})],re.prototype,"activeCreateToolDrawMode",null),e([g()],re.prototype,"activeTooltip",null),e([g({types:U})],re.prototype,"activeFillSymbol",void 0),e([g()],re.prototype,"activeLineSymbol",void 0),e([g()],re.prototype,"activeVertexSymbol",void 0),e([g()],re.prototype,"allowDeleteKey",void 0),e([g({readOnly:!0})],re.prototype,"createGraphic",null),e([g()],re.prototype,"defaultCreateOptions",null),e([g()],re.prototype,"defaultUpdateOptions",null),e([g({type:V,nonNullable:!0})],re.prototype,"labelOptions",null),e([g()],re.prototype,"layer",void 0),e([g({types:U})],re.prototype,"pointSymbol",void 0),e([g({types:U})],re.prototype,"polygonSymbol",void 0),e([g({types:U})],re.prototype,"polylineSymbol",void 0),e([g()],re.prototype,"meshSymbol",void 0),e([g({type:N,nonNullable:!0})],re.prototype,"snappingOptions",null),e([g()],re.prototype,"snappingManager",null),e([g({readOnly:!0})],re.prototype,"state",null),e([g({type:W,nonNullable:!0})],re.prototype,"tooltipOptions",null),e([g({readOnly:!0})],re.prototype,"updateGraphics",void 0),e([g()],re.prototype,"updateOnGraphicClick",void 0),e([g()],re.prototype,"creationMode",void 0),e([g({type:Z,nonNullable:!0})],re.prototype,"valueOptions",null),e([g({types:U})],re.prototype,"vertexSymbol",void 0),e([g({value:null})],re.prototype,"view",null),e([g({constructOnly:!0,type:K})],re.prototype,"sketchOptions",void 0),re=e([v("esri.widgets.Sketch.SketchViewModel")],re);const ne="sketch:missing-property",pe=e=>`Property '${e}' is missing on SketchViewModel.`;function le(e){return"polygon"===e||"rectangle"===e||"circle"===e}function he(e,t){de("undo",e.history.undo,e.history.redo,t)}function ce(e,t){de("redo",e.history.redo,e.history.undo,t)}function de(e,t,o,i){const a=t.pop();if(!a)return;const s=a.updates,r=[];i.forEach((t,o)=>{const i=s[o];null!=i&&("geometry"in i&&null!=i.geometry&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=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 ue(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function me(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function ye(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function ge(e){return"requireError"in e&&"aborted"===e.requireError}export{re as default};
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import GroundLine = __esri.GroundLine;
4
- export default GroundLine;
@@ -1,5 +0,0 @@
1
- /*
2
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
- See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
- */
5
- import{__decorate as o}from"tslib";import r from"../../Color.js";import t from"./Line.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends t{constructor(o){super(o),this.type="ground",this.color=new r("#ff7f00")}};o([s()],p.prototype,"type",void 0),o([s({type:r,nonNullable:!0})],p.prototype,"color",void 0),p=o([e("esri.analysis.ElevationProfile.GroundLine")],p);const i=p;export{i as default};
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import InputLine = __esri.InputLine;
4
- export default InputLine;
@@ -1,5 +0,0 @@
1
- /*
2
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
- See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
- */
5
- import{__decorate as o}from"tslib";import r from"../../Color.js";import t from"./Line.js";import e from"./LineViewOptions.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends t{constructor(o){super(o),this.type="input",this.color=new r("#00c8c8"),this.viewOptions=new e({lineVisible:!1})}};o([s()],p.prototype,"type",void 0),o([s({type:r,nonNullable:!0})],p.prototype,"color",void 0),o([s({type:e,nonNullable:!0})],p.prototype,"viewOptions",void 0),p=o([i("esri.analysis.ElevationProfile.InputLine")],p);const n=p;export{n as default};
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import Line = __esri.Line;
4
- export default Line;
@@ -1,5 +0,0 @@
1
- /*
2
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
- See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
- */
5
- import{__decorate as o}from"tslib";import t from"../../Color.js";import e from"./LineChartOptions.js";import i from"./LineViewOptions.js";import{Clonable as r}from"../../core/Clonable.js";import{generateUUID as s}from"../../core/uuid.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";let n=class extends r{constructor(o){super(o),this.type=null,this.id=s(),this.chartOptions=new e,this.color=new t("#000000"),this.enabled=!0,this.title=null,this.viewOptions=new i}equals(o){return this===o||this.type===o.type&&this.chartOptions.equals(o.chartOptions)&&this.color.equals(o.color)&&this.enabled===o.enabled&&this.title===o.title&&this.viewOptions.equals(o.viewOptions)}};o([p({nonNullable:!0})],n.prototype,"id",void 0),o([p({type:e,nonNullable:!0})],n.prototype,"chartOptions",void 0),o([p({type:t,nonNullable:!0})],n.prototype,"color",void 0),o([p()],n.prototype,"enabled",void 0),o([p()],n.prototype,"title",void 0),o([p({type:i,nonNullable:!0})],n.prototype,"viewOptions",void 0),n=o([l("esri.analysis.ElevationProfile.Line")],n);const a=n;export{a as default};
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import LineChartOptions = __esri.LineChartOptions;
4
- export default LineChartOptions;
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import LineViewOptions = __esri.LineViewOptions;
4
- export default LineViewOptions;
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import QueryLine = __esri.QueryLine;
4
- export default QueryLine;
@@ -1,5 +0,0 @@
1
- /*
2
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
- See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
- */
5
- import{__decorate as o}from"tslib";import r from"../../Color.js";import e from"./Line.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends e{constructor(o){super(o),this.type="query",this.color=new r("#db334a"),this.source=null}equals(o){return this===o||super.equals(o)&&this.source===o.source}};o([s()],p.prototype,"type",void 0),o([s({type:r,nonNullable:!0})],p.prototype,"color",void 0),o([s({clonable:"reference"})],p.prototype,"source",void 0),p=o([t("esri.analysis.ElevationProfile.QueryLine")],p);const c=p;export{c as default};
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import SceneLine = __esri.SceneLine;
4
- export default SceneLine;
@@ -1,5 +0,0 @@
1
- /*
2
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
- See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
- */
5
- import{__decorate as o}from"tslib";import r from"../../Color.js";import e from"./Line.js";import{equals as t}from"../../core/arrayUtils.js";import{equalsMaybe as s}from"../../core/maybe.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";let l=class extends e{constructor(o){super(o),this.type="scene",this.color=new r("#cf4ccf"),this.include=null,this.exclude=null}equals(o){return this===o||super.equals(o)&&p(this.include,o.include)&&p(this.exclude,o.exclude)}};function p(o,r){return s(o,r,(o,r)=>t(Array.from(o),Array.from(r)))}o([c()],l.prototype,"type",void 0),o([c({type:r,nonNullable:!0})],l.prototype,"color",void 0),o([c()],l.prototype,"include",void 0),o([c()],l.prototype,"exclude",void 0),l=o([i("esri.analysis.ElevationProfile.SceneLine")],l);const u=l;export{u as default};
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import Units = __esri.Units;
4
- export default Units;
@@ -1,4 +0,0 @@
1
- import "../../interfaces";
2
-
3
- import ViewOptions = __esri.ViewOptions;
4
- export default ViewOptions;