@arcgis/core 6.0.0-next.22 → 6.0.0-next.24

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 (433) hide show
  1. package/Graphic.d.ts +47 -14
  2. package/PopupTemplate.js +1 -1
  3. package/WebScene.d.ts +3 -0
  4. package/analysis/LineOfSightAnalysis.d.ts +1 -1
  5. package/analysis/LineOfSightAnalysisObserver.d.ts +5 -4
  6. package/analysis/LineOfSightAnalysisTarget.d.ts +4 -4
  7. package/analysis/Viewshed.d.ts +4 -4
  8. package/arcade/functions/string.js +1 -1
  9. package/arcgisGlobal.d.ts +0 -5
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{3c277a0f099d67090d07.js → 02335385b1476fe322eb.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{db9921fbda556f142c4a.js → 04d55ed51e8b2683c4b4.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{435b90168f79c5587a07.js → 04ecf15524ff3838c01c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{e2f42aec02bff33b25dd.js → 09300e74e5b014ce6269.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{fcb86d24fc7e0666b564.js → 096b2bf1c0d69d27f20c.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{612345f17f5eeb99ea8f.js → 0d9c4c6c571ce26d356b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{0f725cf79ce00e790a7d.js → 1168bc5c9f0a7e1f63a2.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4911ce62421a6c3320b0.js → 13c64087be3b2985a21b.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{8e19629899a5becf8e19.js → 150e7a7bd5df25693da7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{12a7997a40c77f5c9160.js → 151e5799ede763a03ee2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{a64446a3328a7323e307.js → 173f89c55a5c79ff065b.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{8715661a838361d4211a.js → 1b24a40c0fa197014873.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{ca0d4ce453d8eb35467d.js → 277263466837e1673f56.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{b1d989b72203113a06fe.js → 2a36fe3f3f257a779a1b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/2c0cb214fedb29487eef.js +1 -0
  26. package/assets/esri/core/workers/chunks/{ffcb99693182a621a93e.js → 2cf8172be83b10b11bdc.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{fcaf9450642fcef83286.js → 3048e74e6246324ce6fc.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{95b82cbbe355266c65d7.js → 30af63b3b750142faadb.js} +1 -1
  29. package/assets/esri/core/workers/chunks/30dcf2cfb31cb70de7df.js +1 -0
  30. package/assets/esri/core/workers/chunks/{9f0a973a0dd28953ce25.js → 371e2ddb88cc6b9a41e8.js} +1 -1
  31. package/assets/esri/core/workers/chunks/3fd5c3cd8457ddc68798.js +1 -0
  32. package/assets/esri/core/workers/chunks/{62fec1816907f070f079.js → 3fe04f13215474accb09.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{f47fe4433b05fca5c3ad.js → 42f6194633c2d879c8da.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{cddc3e285f763ccf33c2.js → 4869e097261ded90b8bb.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{d8a7eba588d374b2f961.js → 4bb9a5f4ca944d3fc206.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{2e096537a3a5555a4a93.js → 4cb751dc8d00bdaeb04c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{8052da8be251c3ff2176.js → 4d93bed14945e3d34d5c.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{65cb5e39c467a35621ca.js → 56e903ccef66cbe18f92.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{44d5508042cacdfcac47.js → 58da3f8cf0f7f6a7e4fa.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{bc915fb182d463d804e6.js → 5c04835b0b52461183cd.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{7e8611cb709f105946f5.js → 6061232c96e11eb7b25d.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{1e514e1c9aabefa04201.js → 64382363d6dc04ff1eac.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{c82daefb193aae895bc0.js → 67e06d606c7fd2064adf.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{434a8ba841a59e0deab9.js → 67e533748435253aaba6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{feb41abc03d677df6f73.js → 6b9961261241fdce0e94.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{949bee7b304e625a7891.js → 6db0f8fe1402643fbe1a.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{baed828b7846c0863289.js → 6f1d6453184e0a1530ad.js} +22 -18
  48. package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +1 -0
  49. package/assets/esri/core/workers/chunks/{0049b66ccbfb168caa76.js → 7124ad8dc5ad40dc66f3.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{6e107ce73633de8ac257.js → 72f4dad65e16a7d7c58f.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{0df9a906f7823c23d426.js → 7566321c6a2913f2852b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{c4ddac23bd649d24f3f2.js → 75d551a449bba61ce238.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{af349c7bc8ef41a0e1bd.js → 7748c2886d0122b40eeb.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{b4c3ec081874b49ff89b.js → 78fbe330f16bdbdb886e.js} +1 -1
  55. package/assets/esri/core/workers/chunks/79483c05867ba1386f5a.js +1 -0
  56. package/assets/esri/core/workers/chunks/7b482afb9fd1229f5707.js +1 -0
  57. package/assets/esri/core/workers/chunks/7c631e2947243e2c9bde.js +1 -0
  58. package/assets/esri/core/workers/chunks/{814751e705c05099f864.js → 7c75a8ee266c36baa902.js} +1 -1
  59. package/assets/esri/core/workers/chunks/7db9e615e60d824eac1b.js +1 -0
  60. package/assets/esri/core/workers/chunks/{8a7b02037151767542f1.js → 7dbf4c7480bf9c72820d.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{1b1d3f6916d2cb751435.js → 87177e0f82e8a6ae3189.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{5cb26bbaa08114aec5ce.js → 89cc1a5539b82fb46216.js} +1 -1
  63. package/assets/esri/core/workers/chunks/8b5dcc4282772bf6b675.js +1 -0
  64. package/assets/esri/core/workers/chunks/{8c12269d26f5a4c753cb.js → 8ebaf5754e86a45b0497.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{542e5640ea1b80ef801a.js → 9189dfe19a2a2ccd5173.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{67a35155b8b4d36f171e.js → 926e0a3827eaf16ca8b4.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{dc1761cba0454fda3cf9.js → 9630234267098115de4d.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{10d80e793019dfb45ca2.js → 987424121cf30b0f3c50.js} +1 -1
  69. package/assets/esri/core/workers/chunks/9afc87474cef1fc4fe4a.js +1 -0
  70. package/assets/esri/core/workers/chunks/{facd1ff23203fed67686.js → 9b048f80c2d28d527373.js} +1 -1
  71. package/assets/esri/core/workers/chunks/9dd48e75b4e8d9811d81.js +1 -0
  72. package/assets/esri/core/workers/chunks/{ee08ae5b73439a1ff666.js → a163c6005aba3378edaa.js} +1 -1
  73. package/assets/esri/core/workers/chunks/a4b822ee45810c4c292a.js +1 -0
  74. package/assets/esri/core/workers/chunks/{092e311cb7aea92a6a26.js → acb265a22be5e12f38e5.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{1a411ddae7a47015370c.js → acf4737ba509cbd73cce.js} +1 -1
  76. package/assets/esri/core/workers/chunks/ad96132bc89671e595f3.js +1 -0
  77. package/assets/esri/core/workers/chunks/{d247dd53788d512b9c9f.js → af3c6794334626b94f00.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{532e9cda8ac3601d8892.js → b12acf1f694f82e00df9.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{d08ff41e2a9bcd58b64a.js → ba3d5abff65aefcb8dee.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{504184828048310a052c.js → bdc221d94300c225665a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/c0eb27263f608dc3684b.js +1 -0
  82. package/assets/esri/core/workers/chunks/c2318c014e97ba519be8.js +1 -0
  83. package/assets/esri/core/workers/chunks/{7f8e327acad48c9e75ea.js → c62237c344e341619341.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{a2ad3e620c98e2b2eb06.js → cd355baab983033c3ef0.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{7be6d621a0d1e33dfff4.js → d070fcb73ce274ab80e4.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{6d41444b46677aa762a7.js → db41490bd39d863305bf.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{fc5a36e54929e03efa86.js → dba5f44c4e4a3f075df2.js} +1 -1
  88. package/assets/esri/core/workers/chunks/{3e30b96a8c75bd5b9ae2.js → ddc95cdac6c06fc4794c.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{a5c8f9f5be4ef5063b42.js → df26ec0b508cf4716e0a.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{f426da2210888cc264b4.js → e83f9abee611c5b80009.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{8487727f1197cf7dbf50.js → ef12fa3574d4cbf8b084.js} +1 -1
  92. package/assets/esri/core/workers/chunks/f10c883eb26330e3421c.js +1 -0
  93. package/assets/esri/core/workers/chunks/f46e92c67986c8c09bdd.js +1 -0
  94. package/assets/esri/core/workers/chunks/{709e019885822b1f6f3e.js → f905f1a1aa4c123cbe83.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{5b91e2dffdc84c006539.js → fb37f0848196c28b7fd7.js} +1 -1
  96. package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
  97. package/assets/esri/libs/librust-text/pkg/text_bg.wasm +0 -0
  98. package/assets/esri/themes/base/_core.scss +0 -2
  99. package/assets/esri/themes/dark/main.css +1 -1
  100. package/assets/esri/themes/light/main.css +1 -1
  101. package/assets/esri/themes/light/view.css +1 -1
  102. package/chunks/Component.glsl.js +9 -12
  103. package/chunks/DefaultMaterial.glsl.js +4 -5
  104. package/chunks/MultiPathImpl.js +1 -1
  105. package/chunks/OperatorProximityGeodesic.js +1 -1
  106. package/chunks/Path.glsl.js +2 -4
  107. package/chunks/RealisticTree.glsl.js +3 -3
  108. package/chunks/SSAO.glsl.js +1 -2
  109. package/chunks/basis_encoder.js +1 -1
  110. package/chunks/basis_transcoder.js +1 -1
  111. package/chunks/draco_mesh_decoder.js +1 -1
  112. package/chunks/dxt_encoder.js +1 -1
  113. package/chunks/i3s.js +1 -1
  114. package/chunks/lclayout.js +1 -1
  115. package/chunks/lerc-wasm.js +1 -1
  116. package/chunks/libtess-f32.js +1 -1
  117. package/chunks/libtess-f64.js +1 -1
  118. package/chunks/lyr3DMain.js +1 -1
  119. package/chunks/lyr3DWorker.js +1 -1
  120. package/chunks/parquet.js +1 -1
  121. package/chunks/qb3-wasm.js +1 -1
  122. package/chunks/rbush.js +1 -1
  123. package/chunks/text.js +1 -1
  124. package/chunks/vxlLayer.js +1 -1
  125. package/config.js +1 -1
  126. package/core/workers/WorkerFallback.js +4 -2
  127. package/core/workers/workerFactory.js +1 -1
  128. package/core/workers/workers.js +4 -2
  129. package/geometry/support/clipRay.js +1 -1
  130. package/geometry/support/labelPoint.js +1 -1
  131. package/geometry/support/plane.js +1 -1
  132. package/graphic/AnnotationFeatureGraphicOrigin.d.ts +49 -9
  133. package/graphic/BuildingGraphicOrigin.d.ts +49 -0
  134. package/graphic/CSVGraphicOrigin.d.ts +42 -9
  135. package/graphic/CatalogGraphicOrigin.d.ts +42 -9
  136. package/graphic/DimensionFeatureGraphicOrigin.d.ts +42 -9
  137. package/graphic/FeatureGraphicOrigin.d.ts +42 -9
  138. package/graphic/GeoJSONGraphicOrigin.d.ts +42 -9
  139. package/graphic/GeoRSSGraphicOrigin.d.ts +42 -9
  140. package/graphic/GraphicOrigin.d.ts +52 -12
  141. package/graphic/ImageryGraphicOrigin.d.ts +42 -9
  142. package/graphic/ImageryTileGraphicOrigin.d.ts +42 -9
  143. package/graphic/KMLGraphicOrigin.d.ts +47 -10
  144. package/graphic/KnowledgeGraphGraphicOrigin.d.ts +49 -1
  145. package/graphic/LinkChartGraphicOrigin.d.ts +49 -1
  146. package/graphic/MapImageGraphicOrigin.d.ts +49 -1
  147. package/graphic/MapNotesGraphicOrigin.d.ts +48 -1
  148. package/graphic/OGCFeatureGraphicOrigin.d.ts +42 -9
  149. package/graphic/OrientedImageryGraphicOrigin.d.ts +42 -9
  150. package/graphic/ParquetGraphicOrigin.d.ts +42 -9
  151. package/graphic/PointCloudGraphicOrigin.d.ts +43 -0
  152. package/graphic/SceneGraphicOrigin.d.ts +43 -0
  153. package/graphic/SketchGraphicOrigin.d.ts +43 -0
  154. package/graphic/StreamGraphicOrigin.d.ts +43 -0
  155. package/graphic/SubtypeGroupGraphicOrigin.d.ts +49 -1
  156. package/graphic/TileGraphicOrigin.d.ts +49 -1
  157. package/graphic/VectorTileGraphicOrigin.d.ts +43 -14
  158. package/graphic/VoxelGraphicOrigin.d.ts +43 -0
  159. package/graphic/WCSGraphicOrigin.d.ts +43 -0
  160. package/graphic/WFSGraphicOrigin.d.ts +42 -9
  161. package/graphic/getGraphicOriginTitle.d.ts +21 -3
  162. package/interfaces.d.ts +0 -55
  163. package/kernel.js +1 -1
  164. package/layers/ElevationLayer.d.ts +6 -2
  165. package/layers/GaussianSplatLayer.d.ts +2 -1
  166. package/layers/GeoJSONLayer.d.ts +2 -107
  167. package/layers/IntegratedMeshLayer.js +1 -1
  168. package/layers/ParquetLayer.d.ts +24 -1
  169. package/layers/ParquetLayer.js +1 -1
  170. package/layers/SceneLayer.d.ts +40 -16
  171. package/layers/ViewshedLayer.d.ts +10 -4
  172. package/layers/WMSLayer.d.ts +2 -69
  173. package/layers/mixins/ReloadableLayer.js +1 -1
  174. package/layers/mixins/TemporalLayer.d.ts +70 -48
  175. package/layers/mixins/TiledImagery.d.ts +0 -11
  176. package/layers/orientedImagery/transformations/utils.js +1 -1
  177. package/layers/save/featureLayerUtils.js +1 -1
  178. package/layers/save/imageryUtils.js +1 -1
  179. package/layers/save/mapImageLayerUtils.js +1 -1
  180. package/layers/save/mediaLayerUtils.js +1 -1
  181. package/layers/save/parquetLayerUtils.js +2 -0
  182. package/layers/save/streamLayerUtils.js +1 -1
  183. package/layers/support/LabelClass.d.ts +8 -2
  184. package/layers/support/layersMapping.js +1 -1
  185. package/layers/support/rasterJobHelper.js +1 -1
  186. package/layers/video/VideoController.js +5 -5
  187. package/package.json +2 -2
  188. package/popup/content.d.ts +38 -1
  189. package/popup/content.js +1 -1
  190. package/portal/schemas/definitions.js +1 -1
  191. package/portal/schemas/webScene.js +1 -1
  192. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  193. package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
  194. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  195. package/smartMapping/popup/support/clusterUtils.js +1 -1
  196. package/smartMapping/popup/support/utils.js +2 -2
  197. package/smartMapping/renderers/size.js +1 -1
  198. package/smartMapping/renderers/support/regenerateUtils.js +1 -1
  199. package/support/timeUtils.d.ts +11 -0
  200. package/undoredo/support/ApplySet.js +1 -1
  201. package/views/2d/engine/flow/ProcessingTimeEstimate.js +1 -1
  202. package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
  203. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  204. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  205. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  206. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  207. package/views/2d/layers/features/Processor.js +1 -1
  208. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  209. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  210. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  211. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  212. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  213. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  214. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  215. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  216. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  217. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  218. package/views/2d/layers/features/processor/AggregateStrategy.js +1 -1
  219. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  220. package/views/2d/layers/features/processor/bins/BinAdapter.js +1 -1
  221. package/views/2d/layers/features/processor/bins/BinLevelState.js +1 -1
  222. package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +1 -1
  223. package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +1 -1
  224. package/views/2d/layers/features/processor/tracks/TrackAdapter.js +1 -1
  225. package/views/2d/layers/features/processor/tracks/TrackLevelState.js +1 -1
  226. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  227. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  228. package/views/2d/layers/features/sources/strategies/chunks/ByReferenceTileSourceChunk.js +1 -1
  229. package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
  230. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  231. package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
  232. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  233. package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
  234. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  235. package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
  236. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  237. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  238. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  239. package/views/3d/environment/SunLighting.d.ts +0 -1
  240. package/views/3d/environment/SunLighting.js +1 -1
  241. package/views/3d/environment/VirtualLighting.d.ts +0 -1
  242. package/views/3d/environment/VirtualLighting.js +1 -1
  243. package/views/3d/input/handlers/ground/GroundDoubleClickMove.js +1 -1
  244. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  245. package/views/3d/interactive/placementTools/GroundNavigationPlacementTool3D.js +1 -1
  246. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  247. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  248. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  249. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  250. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  251. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  252. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  253. package/views/3d/layers/graphics/LabelParameters.js +1 -1
  254. package/views/3d/layers/graphics/Labeler.js +1 -1
  255. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  256. package/views/3d/layers/graphics/pointUtils.js +1 -1
  257. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  258. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  259. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  260. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  261. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  262. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  263. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  264. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  265. package/views/3d/state/utils/navigationUtils.js +1 -1
  266. package/views/3d/terrain/TerrainRenderer.js +1 -1
  267. package/views/3d/terrain/TerrainSurface.js +1 -1
  268. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  269. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -2
  270. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -2
  271. package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +9 -4
  272. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  273. package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +1 -1
  274. package/views/3d/webgl-engine/effects/snowcover/applySnow.glsl.js +18 -0
  275. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  276. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  277. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  278. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  279. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  280. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  281. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  282. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  283. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  284. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  285. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  286. package/views/3d/webgl-engine/materials/internal/worldSizedRibbonLineIntersectionUtils.js +2 -0
  287. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  288. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  289. package/views/DOMContainer.js +1 -1
  290. package/views/draw/SegmentDrawAction.js +1 -1
  291. package/views/interactive/snapping/SnappingManagerPool.js +1 -1
  292. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  293. package/views/interactive/tooltip/fields/TooltipField.js +1 -1
  294. package/views/layers/LineOfSightLayerView.d.ts +2 -2
  295. package/views/layers/ViewshedLayerView.d.ts +2 -1
  296. package/views/support/LayerViewManager.js +1 -1
  297. package/views/support/ScheduledQueueProcessor.js +1 -1
  298. package/views/support/screenshotUtils.js +1 -1
  299. package/views/ui/UI.js +1 -1
  300. package/webdoc/support/webdocSaveUtils.js +1 -1
  301. package/webscene/Slide.d.ts +1 -2
  302. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  303. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  304. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  305. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  306. package/widgets/FeatureTable/RelationshipColumn.js +1 -1
  307. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  308. package/widgets/Locate.d.ts +1 -1
  309. package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
  310. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  311. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  312. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  313. package/widgets/Search/SearchViewModel.js +1 -1
  314. package/widgets/Search/support/layerSearchUtils.js +1 -1
  315. package/widgets/Sketch/SketchViewModel.js +1 -1
  316. package/widgets/Sketch/support/PluginManager.js +1 -1
  317. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  318. package/widgets/support/GeolocationPositioning.d.ts +1 -2
  319. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +0 -1
  320. package/assets/esri/core/workers/chunks/42045cf46497828cd3c0.js +0 -1
  321. package/assets/esri/core/workers/chunks/42753cf4965a94bc91ca.js +0 -1
  322. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +0 -1
  323. package/assets/esri/core/workers/chunks/5046214dd32029cb733d.js +0 -1
  324. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +0 -1
  325. package/assets/esri/core/workers/chunks/58865772bed48141a56a.js +0 -1
  326. package/assets/esri/core/workers/chunks/6059853ef3b6cddbe869.js +0 -1
  327. package/assets/esri/core/workers/chunks/72e6d594b7262430ae55.js +0 -1
  328. package/assets/esri/core/workers/chunks/7d11710e1586a3d75887.js +0 -1
  329. package/assets/esri/core/workers/chunks/8f74d92ac69714b9fd4e.js +0 -1
  330. package/assets/esri/core/workers/chunks/a09d2e1e2540921e4717.js +0 -1
  331. package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +0 -1
  332. package/assets/esri/core/workers/chunks/a679207c3458cc0b1fec.js +0 -1
  333. package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +0 -1
  334. package/assets/esri/core/workers/chunks/fc76aff0f7d95e517d8f.js +0 -1
  335. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +0 -85
  336. package/assets/esri/widgets/DirectionalPad/t9n/messages.ar.json +0 -1
  337. package/assets/esri/widgets/DirectionalPad/t9n/messages.bg.json +0 -1
  338. package/assets/esri/widgets/DirectionalPad/t9n/messages.bs.json +0 -1
  339. package/assets/esri/widgets/DirectionalPad/t9n/messages.ca.json +0 -1
  340. package/assets/esri/widgets/DirectionalPad/t9n/messages.cs.json +0 -1
  341. package/assets/esri/widgets/DirectionalPad/t9n/messages.da.json +0 -1
  342. package/assets/esri/widgets/DirectionalPad/t9n/messages.de.json +0 -1
  343. package/assets/esri/widgets/DirectionalPad/t9n/messages.el.json +0 -1
  344. package/assets/esri/widgets/DirectionalPad/t9n/messages.en.json +0 -1
  345. package/assets/esri/widgets/DirectionalPad/t9n/messages.es.json +0 -1
  346. package/assets/esri/widgets/DirectionalPad/t9n/messages.et.json +0 -1
  347. package/assets/esri/widgets/DirectionalPad/t9n/messages.fi.json +0 -1
  348. package/assets/esri/widgets/DirectionalPad/t9n/messages.fr.json +0 -1
  349. package/assets/esri/widgets/DirectionalPad/t9n/messages.he.json +0 -1
  350. package/assets/esri/widgets/DirectionalPad/t9n/messages.hr.json +0 -1
  351. package/assets/esri/widgets/DirectionalPad/t9n/messages.hu.json +0 -1
  352. package/assets/esri/widgets/DirectionalPad/t9n/messages.id.json +0 -1
  353. package/assets/esri/widgets/DirectionalPad/t9n/messages.it.json +0 -1
  354. package/assets/esri/widgets/DirectionalPad/t9n/messages.ja.json +0 -1
  355. package/assets/esri/widgets/DirectionalPad/t9n/messages.ko.json +0 -1
  356. package/assets/esri/widgets/DirectionalPad/t9n/messages.lt.json +0 -1
  357. package/assets/esri/widgets/DirectionalPad/t9n/messages.lv.json +0 -1
  358. package/assets/esri/widgets/DirectionalPad/t9n/messages.nl.json +0 -1
  359. package/assets/esri/widgets/DirectionalPad/t9n/messages.no.json +0 -1
  360. package/assets/esri/widgets/DirectionalPad/t9n/messages.pl.json +0 -1
  361. package/assets/esri/widgets/DirectionalPad/t9n/messages.pt-BR.json +0 -1
  362. package/assets/esri/widgets/DirectionalPad/t9n/messages.pt-PT.json +0 -1
  363. package/assets/esri/widgets/DirectionalPad/t9n/messages.ro.json +0 -1
  364. package/assets/esri/widgets/DirectionalPad/t9n/messages.ru.json +0 -1
  365. package/assets/esri/widgets/DirectionalPad/t9n/messages.sk.json +0 -1
  366. package/assets/esri/widgets/DirectionalPad/t9n/messages.sl.json +0 -1
  367. package/assets/esri/widgets/DirectionalPad/t9n/messages.sr.json +0 -1
  368. package/assets/esri/widgets/DirectionalPad/t9n/messages.sv.json +0 -1
  369. package/assets/esri/widgets/DirectionalPad/t9n/messages.th.json +0 -1
  370. package/assets/esri/widgets/DirectionalPad/t9n/messages.tr.json +0 -1
  371. package/assets/esri/widgets/DirectionalPad/t9n/messages.uk.json +0 -1
  372. package/assets/esri/widgets/DirectionalPad/t9n/messages.vi.json +0 -1
  373. package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-CN.json +0 -1
  374. package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-HK.json +0 -1
  375. package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-TW.json +0 -1
  376. package/assets/esri/widgets/Track/t9n/messages.ar.json +0 -1
  377. package/assets/esri/widgets/Track/t9n/messages.bg.json +0 -1
  378. package/assets/esri/widgets/Track/t9n/messages.bs.json +0 -1
  379. package/assets/esri/widgets/Track/t9n/messages.ca.json +0 -1
  380. package/assets/esri/widgets/Track/t9n/messages.cs.json +0 -1
  381. package/assets/esri/widgets/Track/t9n/messages.da.json +0 -1
  382. package/assets/esri/widgets/Track/t9n/messages.de.json +0 -1
  383. package/assets/esri/widgets/Track/t9n/messages.el.json +0 -1
  384. package/assets/esri/widgets/Track/t9n/messages.en.json +0 -1
  385. package/assets/esri/widgets/Track/t9n/messages.es.json +0 -1
  386. package/assets/esri/widgets/Track/t9n/messages.et.json +0 -1
  387. package/assets/esri/widgets/Track/t9n/messages.fi.json +0 -1
  388. package/assets/esri/widgets/Track/t9n/messages.fr.json +0 -1
  389. package/assets/esri/widgets/Track/t9n/messages.he.json +0 -1
  390. package/assets/esri/widgets/Track/t9n/messages.hr.json +0 -1
  391. package/assets/esri/widgets/Track/t9n/messages.hu.json +0 -1
  392. package/assets/esri/widgets/Track/t9n/messages.id.json +0 -1
  393. package/assets/esri/widgets/Track/t9n/messages.it.json +0 -1
  394. package/assets/esri/widgets/Track/t9n/messages.ja.json +0 -1
  395. package/assets/esri/widgets/Track/t9n/messages.ko.json +0 -1
  396. package/assets/esri/widgets/Track/t9n/messages.lt.json +0 -1
  397. package/assets/esri/widgets/Track/t9n/messages.lv.json +0 -1
  398. package/assets/esri/widgets/Track/t9n/messages.nl.json +0 -1
  399. package/assets/esri/widgets/Track/t9n/messages.no.json +0 -1
  400. package/assets/esri/widgets/Track/t9n/messages.pl.json +0 -1
  401. package/assets/esri/widgets/Track/t9n/messages.pt-BR.json +0 -1
  402. package/assets/esri/widgets/Track/t9n/messages.pt-PT.json +0 -1
  403. package/assets/esri/widgets/Track/t9n/messages.ro.json +0 -1
  404. package/assets/esri/widgets/Track/t9n/messages.ru.json +0 -1
  405. package/assets/esri/widgets/Track/t9n/messages.sk.json +0 -1
  406. package/assets/esri/widgets/Track/t9n/messages.sl.json +0 -1
  407. package/assets/esri/widgets/Track/t9n/messages.sr.json +0 -1
  408. package/assets/esri/widgets/Track/t9n/messages.sv.json +0 -1
  409. package/assets/esri/widgets/Track/t9n/messages.th.json +0 -1
  410. package/assets/esri/widgets/Track/t9n/messages.tr.json +0 -1
  411. package/assets/esri/widgets/Track/t9n/messages.uk.json +0 -1
  412. package/assets/esri/widgets/Track/t9n/messages.vi.json +0 -1
  413. package/assets/esri/widgets/Track/t9n/messages.zh-CN.json +0 -1
  414. package/assets/esri/widgets/Track/t9n/messages.zh-HK.json +0 -1
  415. package/assets/esri/widgets/Track/t9n/messages.zh-TW.json +0 -1
  416. package/views/2d/layers/features/FeatureSpatialIndex.js +0 -2
  417. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +0 -2
  418. package/views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js +0 -12
  419. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +0 -85
  420. package/widgets/DirectionalPad/DirectionalPadViewModel.js +0 -2
  421. package/widgets/DirectionalPad/VisibleElements.d.ts +0 -40
  422. package/widgets/DirectionalPad/VisibleElements.js +0 -2
  423. package/widgets/DirectionalPad/constants.js +0 -2
  424. package/widgets/DirectionalPad/css.js +0 -2
  425. package/widgets/DirectionalPad/types.d.ts +0 -27
  426. package/widgets/DirectionalPad/utils.js +0 -2
  427. package/widgets/DirectionalPad.d.ts +0 -156
  428. package/widgets/DirectionalPad.js +0 -2
  429. package/widgets/Track/TrackViewModel.d.ts +0 -131
  430. package/widgets/Track/TrackViewModel.js +0 -2
  431. package/widgets/Track/types.d.ts +0 -6
  432. package/widgets/Track.d.ts +0 -278
  433. package/widgets/Track.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import n from"../../Graphic.js";import r from"../../PopupTemplate.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import s from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as l,after as u}from"../../core/promiseUtils.js";import{watch as d,initial as f,whenOnce as p}from"../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../core/accessorSupport/decorators.js";import g from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointWithElevation as v}from"../../geometry/support/geometryUtils.js";import{getPopupLayer as y}from"../../popup/support/featureUtils.js";import b from"../../portal/Portal.js";import{isApiKeyApplicable as x}from"../../support/apiKeyUtils.js";import S from"../../symbols/PictureMarkerSymbol.js";import C from"../../symbols/SimpleFillSymbol.js";import w from"../../symbols/SimpleLineSymbol.js";import T from"../../symbols/TextSymbol.js";import{highlightsSupported as E}from"../../views/support/layerViewUtils.js";import D from"./LayerSearchSource.js";import O from"./LocatorSearchSource.js";import{SourceCollection as k}from"./types.js";import{isSearchableLayer as A}from"./support/layerSearchUtils.js";import{isArcGISWorldGeocoder as j,meteredArcGISLocatorUrl as M,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as P}from"./support/locatorUtils.js";import{supported as F,getCurrentPosition as I,positionToPoint as L}from"../support/geolocationUtils.js";import{GoTo as R}from"../support/GoTo.js";function z(e,t){return e.hasOwnProperty(t)&&e[t]!=null&&e[t]!==``}const B=`highlight`,V=_.WGS84,H=/<[\s\S]*?>/g;let U=class extends R(o){constructor(e){super(e),this._defaultPopupTemplate=new r({content:`{Match_addr}`}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new k,this.defaultSymbols={point:new S({url:t(`esri/images/search/search-symbol-32.png`),size:24,width:24,height:24}),polyline:new w({color:[130,130,130,1],width:2}),polygon:new C({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=b.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.resultLocation=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new k,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([d(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),f),d(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??``,this._update()},f)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=-1}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return this.allSources.length===1||!this.searchAllEnabled?0:-1}set activeSourceIndex(e){this._overrideIfSome(`activeSourceIndex`,e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome(`allPlaceholder`,e)}get allSources(){let{sources:e,defaultSources:t,includeDefaultSources:n}=this,r=typeof n==`function`?n.call(null,{sources:e,defaultSources:t}):n?t.concat(e):e,i=this._get(`allSources`)||new k;return i.removeAll(),i.addMany(r.filter(Boolean)),i}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome(`defaultPopupTemplate`,e)}get locationEnabled(){return this._get(`locationEnabled`)||F()}set locationEnabled(e){if(e===void 0){this._clearOverride(`locationEnabled`);return}let t=F();if(e&&!t){let e=new a(`locationEnabled:geolocation-unsupported`,`Geolocation API is unsupported.`,{geolocation:navigator.geolocation});s.getLogger(this).error(e)}this._override(`locationEnabled`,!!e&&t)}get placeholder(){let{allSources:e,activeSourceIndex:t,allPlaceholder:n}=this;return t===-1?n??``:e.at(t)?.placeholder??``}set searchTerm(e){this._set(`searchTerm`,e||``),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set(`selectedSuggestion`,null),e===``&&this._clear()}get searchTerm(){return this._get(`searchTerm`)||``}get state(){return this._searching?`searching`:this.updating?`loading`:this.allSources.length===0?`disabled`:`ready`}get updating(){return this._updatingPromise!=null}clear(){this.searchTerm=``}clearGraphics(){this._removeHighlight();let{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set(`resultLocation`,null),this._set(`resultGraphic`,null)}search(e,t){this.emit(`search-start`),this.clearGraphics();let n=(async()=>{try{let n=await this._createSuggestionForSearch(e);await this.when();let r=await this._getResultsFromSources(n,t);if(t?.signal?.aborted)return null;let i={activeSourceIndex:this.activeSourceIndex,searchTerm:n.text??``,numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(i,r,n);let a=this._getFirstResult(i.results),o=(n.location&&a?a.name:n.text)?.replaceAll(H,``);return this._set(`searchTerm`,o),(n.key&&typeof n.sourceIndex==`number`||n.location)&&this._set(`selectedSuggestion`,n),this._set(`results`,i.results),this._set(`resultCount`,i.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit(`search-complete`,i),await this._selectFirstResult(a),i}finally{this._clearSearching()}})();return this._searching=n,n}async searchNearby(e){if(!this.locationEnabled){let e=new a(`searchNearby:geolocation-unsupported`,`Geolocation API is unsupported.`,{geolocation:navigator.geolocation});throw s.getLogger(this).error(e),e}let t=(async()=>{try{let t=await I(),n=await L({position:t,view:this.view},e);return await this.search(n,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){let t=new a(`select:missing-parameter`,`Cannot select without a searchResult.`,{value:e});throw s.getLogger(this).error(t),t}let{view:t}=this,r=z(e,`sourceIndex`)?e.sourceIndex:this._getSourceIndexOfResult(e),i=r==null?null:this.allSources.at(r);if(!i){let e=new a(`select:missing-source`,`Cannot select without a source.`,{source:i});throw s.getLogger(this).error(e),e}let o=i instanceof D?this._getLayerSourcePopupTemplate(i):i.popupTemplate,c=i.resultSymbol||this._getDefaultSymbol(e),u=z(i,`resultGraphicEnabled`)?!!i.resultGraphicEnabled:this.resultGraphicEnabled,d=z(i,`autoNavigate`)?!!i.autoNavigate:this.autoNavigate,f=z(i,`popupEnabled`)?!!i.popupEnabled:this.popupEnabled,p=f?o||this.popupTemplate||this.defaultPopupTemplate:null,{feature:m}=e;if(!m){let e=new a(`select:missing-feature`,`Cannot select without a feature.`,{feature:m});throw s.getLogger(this).error(e),e}let{attributes:h,geometry:g}=m,_=y(m),b=null;if(g){let{labelPointExecute:e}=await import(`../../geometry/operators/labelPointOperator.js`);b=e(g)}let x={layerViewQuery:this._getLayerView(m),elevationQuery:t&&b!=null?v(b,t):Promise.resolve(b)},S=await l(x),C=S.layerViewQuery.value,w=S.elevationQuery.value;c instanceof T&&(c.text=e.name);let O=t&&d?e.target||e.extent:null;await(O==null?Promise.resolve():this._goToSearchResult(O));let k=C?m:new n({geometry:g,symbol:c,attributes:h,layer:_,origin:m.origin,popupTemplate:p});return C&&E(C)&&!f&&this._highlightFeature({graphic:k,layerView:C}),!C&&u&&t&&t.graphics.push(k),this._setResultFloor(e),this._set(`selectedResult`,e),this._set(`resultGraphic`,k),this._set(`resultLocation`,w),this.emit(`select-result`,{popupEnabled:f,result:e,source:i,sourceIndex:r}),e}async suggest(e,t,n){let r=e||this.searchTerm;this.emit(`suggest-start`,{searchTerm:r}),await this._suggestTimer(t,n);let i=await this._suggestImmediate(r,n);return this._set(`suggestions`,i?.results),this._set(`suggestionCount`,i?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit(`suggest-complete`,i),i}async when(){await p(()=>!this.updating)}async _update(){let{portal:e,view:t}=this;if(this.includeDefaultSources){let n=this._updatingPromise=l([e?.load(),t?.when()]);if(this.destroyed||(await n,n!==this._updatingPromise))return}this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){let e=this.portal?.helperServices?.geocode;return e?e.map(e=>{if(e.placefinding===!1)return;let t=j(e.url)&&x(e.url)?{url:M}:null,n=O.fromJSON({...e,...t}),r=n.url;if(j(r)||N(r)||P(r)){let e=n.outFields??[`Addr_type`,`Match_addr`,`StAddr`,`City`],t=(n.placeholder||this.messages?.placeholder)??``,r=typeof n.defaultZoomScale==`number`?n.defaultZoomScale:2500;n.singleLineFieldName=`SingleLine`,n.outFields=e,n.placeholder=t,n.defaultZoomScale=r}if(n.singleLineFieldName)return n}).filter(i):[]}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,t){let n=this.view?.map;return e.map(e=>{let r=n.findLayerById(e.id);if(!r)return;let i=this._getLayerJSON(e),a=D.fromJSON(i);return a.placeholder=t,this._getLayer(r,i).then(e=>{a.layer=e}),a}).filter(i).toArray()}_getTableSources(e,t){let n=this.view?.map;return e.map(e=>{if(!e.id)return;let r=n.findTableById(e.id);if(!r)return;let i=this._getLayerJSON(e),a=D.fromJSON(i);return a.placeholder=t,this._getLayer(r,i).then(e=>{a.layer=e}),a}).filter(i).toArray()}_convertApplicationProperties(){let e=(this.view?.map)?.applicationProperties?.viewing?.search;if(!e)return[];let{enabled:t,hintText:n,layers:r,tables:i}=e;if(!t)return[];let a=this._getLayerSources(r,n),o=this._getTableSources(i,n);return[...a,...o]}async _getSubLayer(e,t){if(await e.load(),!e.allSublayers)throw Error();let n=e.allSublayers.find(e=>e.id===t.subLayer);if(!n)throw Error();let r=await n.createFeatureLayer?.();if(!r)throw Error();return this._createdFeatureLayers.push(r),r}async _getBuildingSubLayer(e,t){await e.load();let n=e.allSublayers.find(e=>e.id===t.subLayer);if(n?.type!==`building-component`||(await n.load(),n.associatedLayer==null))throw Error();return await n.associatedLayer.load(),n}async _getLayer(e,t){if(e.type===`map-image`)try{return await this._getSubLayer(e,t)}catch{let t=new a(`search:create-featurelayer`,`Could not create a FeatureLayer from the MapImageLayer`,{layer:e});return s.getLogger(this).error(t),null}return e.type===`building-scene`?this._getBuildingSubLayer(e,t):(await e.load(),e.capabilities?.operations?.supportsQuery?e:null)}_getLayerJSON(e){return typeof e.toJSON==`function`?e.toJSON():e}_updateDefaultSources(){let{defaultSources:e,includeDefaultSources:t}=this;this._destroyFeatureLayers(),e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set(`resultCount`,null),this._set(`results`,null),this._set(`suggestions`,null),this._set(`suggestionCount`,null),this._set(`selectedResult`,null),this._set(`selectedSuggestion`,null),this.emit(`search-clear`)}_suggestTimer(e,t){let n=e??this.suggestionDelay;return u(n,null,t?.signal)}async _createLocationForSearch(e){if(e instanceof n&&e.geometry){let{labelPointExecute:t}=await import(`../../geometry/operators/labelPointOperator.js`);return t(e.geometry)}return e instanceof g?e:Array.isArray(e)&&e.length===2?new g({longitude:e[0],latitude:e[1]}):null}async _createSuggestionForSearch(e){if(e&&z(e,`key`)&&z(e,`text`)&&z(e,`sourceIndex`))return e;let t=await this._createLocationForSearch(e),n=typeof e==`string`?e:this.searchTerm,{selectedSuggestion:r,selectedResult:i}=this,a=!e&&r&&i,o=a&&r.key===i.key&&r.sourceIndex===i.sourceIndex,s=a&&r.location;return o||s?r:{location:t,text:t?``:n,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return!this.autoSelect||!e?null:this.select(e)}async _suggestImmediate(e,t){await this.when();let n=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;let r={activeSourceIndex:this.activeSourceIndex,searchTerm:e??``,numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(r,n),r}_formatSourceResponse(e,t,n){let r=t?.value||[],i=t?.error,a=this.allSources.at(n);if(i){let t={sourceIndex:n,source:a,error:i};e.errors.push(t),s.getLogger(this).error(i),e.numErrors++}else{let t={sourceIndex:n,source:a,results:r};e.results.push(t),e.numResults+=r.length}}_formatResponse(e,t,n){if(t){if(e.activeSourceIndex===-1){let r=n&&z(n,`sourceIndex`)&&n.sourceIndex!==-1?n.sourceIndex:void 0;t.forEach((t,n)=>{let i=r===void 0?n:r;this._formatSourceResponse(e,t,i)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}}async _getResultsFromSources(e,t){let{allSources:n}=this,r=!e.location&&z(e,`sourceIndex`)?e.sourceIndex:this.activeSourceIndex,i=[];if(!n.length){let e=new a(`search:no-sources-defined`,`At least one source is required.`,{allSources:n});throw s.getLogger(this).error(e),e}return r===-1?n.forEach((n,r)=>{i.push(this._getResultsFromSource(e,r,t))}):i.push(this._getResultsFromSource(e,r,t)),l(i)}async _getSuggestionsFromSources(e,t){let{allSources:n,activeSourceIndex:r}=this,i=[];if(!n.length){let e=new a(`suggest:no-sources-defined`,`At least one source is required.`,{allSources:n});throw s.getLogger(this).error(e),e}return r===-1?n.forEach((n,r)=>{i.push(this._getSuggestionsFromSource(e,r,t))}):i.push(this._getSuggestionsFromSource(e,r,t)),l(i)}async _getResultsFromSource(e,t,n){let r=t==null?null:this.allSources.at(t);if(!r)return null;let{location:i=null}=e,a=this.view?.spatialReference??V,o=z(r,`maxResults`)?r.maxResults:this.maxResults,s=r instanceof D&&z(r,`exactMatch`)?r.exactMatch:!1,{view:c}=this;return r.getResults?.({exactMatch:s,location:i,maxResults:o,sourceIndex:t,spatialReference:a,suggestResult:e,view:c},n)}async _getSuggestionsFromSource(e,t,n){let r=this.allSources.at(t);if(!r)return null;e??=``;let i=z(r,`suggestionsEnabled`)?r.suggestionsEnabled:this.suggestionsEnabled,a=e?.length,o=z(r,`minSuggestCharacters`)?r.minSuggestCharacters:this.minSuggestCharacters;if(i&&e.trim()&&a>=o){let i=this.view?.spatialReference||V,a=z(r,`maxSuggestions`)?r.maxSuggestions:this.maxSuggestions,{view:o}=this,s=r instanceof D&&z(r,`exactMatch`)?r.exactMatch:!1;return r.getSuggestions?.({view:o,sourceIndex:t,suggestTerm:e,spatialReference:i,maxSuggestions:a,exactMatch:s},n)}return null}_getLayerSourcePopupTemplate(e){let{layer:t}=e;if(t)return z(e,`popupTemplate`)?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],({results:t,sourceIndex:n})=>t?.includes(e)?n:null)??null}async _goToSearchResult(e){this._abortGoTo();let t=new AbortController;this._gotoController=t;let n={target:{target:e},options:{signal:t.signal}};e||(n.options.animate=!1),await this.callGoTo(n),this._gotoController=null}_getDefaultSymbol(e){let{defaultSymbols:t}=this,n=e.feature?.geometry;if(n==null)return null;switch(n.type){case`point`:case`multipoint`:return t.point;case`polyline`:return t.polyline;case`extent`:case`polygon`:return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){let{view:t}=this;if(!e||!t)return null;let n=y(e);return!n||n.type===`building-component`||n.type===`subtype-sublayer`?null:(await t.when(),t.whenLayerView(n))}_highlightFeature(e){let{graphic:t,layerView:n}=e,{attributes:r}=t,i=y(t);if(!A(i))return;let{objectIdField:a}=i,o=(a&&r?.[a])??null,s=n.highlight(o??t);this.addHandles(s,B)}_setResultFloor(e){let{view:t}=this,n=e.feature?.attributes,r=y(e.feature);if(A(r)&&r.floorInfo?.floorField&&n){let e=n[r.floorInfo.floorField];t?.emit(`select-result-floor`,e)}}};e([m()],U.prototype,`_searching`,void 0),e([m()],U.prototype,`_updatingPromise`,void 0),e([m({readOnly:!0,value:null})],U.prototype,`activeSource`,null),e([m()],U.prototype,`activeSourceIndex`,null),e([m()],U.prototype,`allPlaceholder`,null),e([m({readOnly:!0})],U.prototype,`allSources`,null),e([m()],U.prototype,`autoNavigate`,void 0),e([m()],U.prototype,`autoSelect`,void 0),e([m({type:r})],U.prototype,`defaultPopupTemplate`,null),e([m({readOnly:!0})],U.prototype,`defaultSources`,void 0),e([m()],U.prototype,`defaultSymbols`,void 0),e([m()],U.prototype,`includeDefaultSources`,void 0),e([m()],U.prototype,`locationEnabled`,null),e([m()],U.prototype,`maxInputLength`,void 0),e([m()],U.prototype,`maxResults`,void 0),e([m()],U.prototype,`maxSuggestions`,void 0),e([m()],U.prototype,`messages`,void 0),e([m()],U.prototype,`minSuggestCharacters`,void 0),e([m({readOnly:!0})],U.prototype,`placeholder`,null),e([m()],U.prototype,`popupEnabled`,void 0),e([m({type:r})],U.prototype,`popupTemplate`,void 0),e([m({type:b})],U.prototype,`portal`,void 0),e([m()],U.prototype,`resultCount`,void 0),e([m()],U.prototype,`resultGraphicEnabled`,void 0),e([m({readOnly:!0})],U.prototype,`resultGraphic`,void 0),e([m({readOnly:!0})],U.prototype,`resultLocation`,void 0),e([m({readOnly:!0})],U.prototype,`results`,void 0),e([m({readOnly:!0})],U.prototype,`selectedSuggestion`,void 0),e([m()],U.prototype,`searchAllEnabled`,void 0),e([m({readOnly:!0})],U.prototype,`selectedResult`,void 0),e([m()],U.prototype,`searchTerm`,null),e([m({type:k})],U.prototype,`sources`,void 0),e([m({readOnly:!0})],U.prototype,`state`,null),e([m()],U.prototype,`suggestionDelay`,void 0),e([m()],U.prototype,`suggestionCount`,void 0),e([m({readOnly:!0})],U.prototype,`suggestions`,void 0),e([m()],U.prototype,`suggestionsEnabled`,void 0),e([m({readOnly:!0})],U.prototype,`updating`,null),e([m()],U.prototype,`view`,void 0),e([m()],U.prototype,`clear`,null),U=e([h(`esri.widgets.Search.SearchViewModel`)],U);const W=U;export{W as default};
2
+ import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import n from"../../Graphic.js";import r from"../../PopupTemplate.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import s from"../../core/Logger.js";import{mappedFind as c}from"../../core/maybe.js";import{eachAlways as l,after as u}from"../../core/promiseUtils.js";import{watch as d,initial as f,whenOnce as p}from"../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../core/accessorSupport/decorators.js";import g from"../../geometry/Point.js";import _ from"../../geometry/SpatialReference.js";import{getPointWithElevation as v}from"../../geometry/support/geometryUtils.js";import{getPopupLayer as y}from"../../popup/support/featureUtils.js";import b from"../../portal/Portal.js";import{isApiKeyApplicable as x}from"../../support/apiKeyUtils.js";import S from"../../symbols/PictureMarkerSymbol.js";import C from"../../symbols/SimpleFillSymbol.js";import w from"../../symbols/SimpleLineSymbol.js";import T from"../../symbols/TextSymbol.js";import{highlightsSupported as E}from"../../views/support/layerViewUtils.js";import D from"./LayerSearchSource.js";import O from"./LocatorSearchSource.js";import{SourceCollection as k}from"./types.js";import{isSearchableLayer as A}from"./support/layerSearchUtils.js";import{isArcGISWorldGeocoder as j,meteredArcGISLocatorUrl as M,isProxiedArcGISWorldGeocoder as N,isMeteredArcGISWorldGeocoder as P}from"./support/locatorUtils.js";import{supported as F,getCurrentPosition as I,positionToPoint as L}from"../support/geolocationUtils.js";import{GoTo as R}from"../support/GoTo.js";function z(e,t){return e.hasOwnProperty(t)&&e[t]!=null&&e[t]!==``}const B=`highlight`,V=_.WGS84,H=/<[\s\S]*?>/g;let U=class extends R(o){constructor(e){super(e),this._defaultPopupTemplate=new r({content:`{Match_addr}`}),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultSources=new k,this.defaultSymbols={point:new S({url:t(`esri/images/search/search-symbol-32.png`),size:24,width:24,height:24}),polyline:new w({color:[130,130,130,1],width:2}),polygon:new C({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=b.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.resultLocation=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new k,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){this.addHandles([d(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),f),d(()=>this.messages,()=>{this._defaultPopupTemplate.title=this.messages?.searchResult??``,this._update()},f)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}static{this.ALL_INDEX=-1}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return this.allSources.length===1||!this.searchAllEnabled?0:-1}set activeSourceIndex(e){this._overrideIfSome(`activeSourceIndex`,e)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(e){this._overrideIfSome(`allPlaceholder`,e)}get allSources(){let{sources:e,defaultSources:t,includeDefaultSources:n}=this,r=typeof n==`function`?n.call(null,{sources:e,defaultSources:t}):n?t.concat(e):e,i=this._get(`allSources`)||new k;return i.removeAll(),i.addMany(r.filter(Boolean)),i}get defaultPopupTemplate(){return this._defaultPopupTemplate}set defaultPopupTemplate(e){this._overrideIfSome(`defaultPopupTemplate`,e)}get locationEnabled(){return this._get(`locationEnabled`)||F()}set locationEnabled(e){if(e===void 0){this._clearOverride(`locationEnabled`);return}let t=F();if(e&&!t){let e=new a(`locationEnabled:geolocation-unsupported`,`Geolocation API is unsupported.`,{geolocation:navigator.geolocation});s.getLogger(this).error(e)}this._override(`locationEnabled`,!!e&&t)}get placeholder(){let{allSources:e,activeSourceIndex:t,allPlaceholder:n}=this;return t===-1?n??``:e.at(t)?.placeholder??``}set searchTerm(e){this._set(`searchTerm`,e||``),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set(`selectedSuggestion`,null),e===``&&this._clear()}get searchTerm(){return this._get(`searchTerm`)||``}get state(){return this._searching?`searching`:this.updating?`loading`:this.allSources.length===0?`disabled`:`ready`}get updating(){return this._updatingPromise!=null}clear(){this.searchTerm=``}clearGraphics(){this._removeHighlight();let{view:e,resultGraphic:t}=this;e&&t&&e.graphics.remove(t),this._set(`resultLocation`,null),this._set(`resultGraphic`,null)}search(e,t){this.emit(`search-start`),this.clearGraphics();let n=(async()=>{try{let n=await this._createSuggestionForSearch(e);await this.when();let r=await this._getResultsFromSources(n,t);if(t?.signal?.aborted)return null;let i={activeSourceIndex:this.activeSourceIndex,searchTerm:n.text??``,numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(i,r,n);let a=this._getFirstResult(i.results),o=(n.location&&a?a.name:n.text)?.replaceAll(H,``);return this._set(`searchTerm`,o),(n.key&&typeof n.sourceIndex==`number`||n.location)&&this._set(`selectedSuggestion`,n),this._set(`results`,i.results),this._set(`resultCount`,i.results.reduce((e,t)=>e+(t.results?.length??0),0)),this.emit(`search-complete`,i),await this._selectFirstResult(a),i}finally{this._clearSearching()}})();return this._searching=n,n}async searchNearby(e){if(!this.locationEnabled){let e=new a(`searchNearby:geolocation-unsupported`,`Geolocation API is unsupported.`,{geolocation:navigator.geolocation});throw s.getLogger(this).error(e),e}let t=(async()=>{try{let t=await I(),n=await L({position:t,view:this.view},e);return await this.search(n,e)}finally{this._clearSearching()}})();return this._searching=t,t}async select(e){if(this.clearGraphics(),!e){let t=new a(`select:missing-parameter`,`Cannot select without a searchResult.`,{value:e});throw s.getLogger(this).error(t),t}let{view:t}=this,r=z(e,`sourceIndex`)?e.sourceIndex:this._getSourceIndexOfResult(e),i=r==null?null:this.allSources.at(r);if(!i){let e=new a(`select:missing-source`,`Cannot select without a source.`,{source:i});throw s.getLogger(this).error(e),e}let o=i instanceof D?this._getLayerSourcePopupTemplate(i):i.popupTemplate,c=i.resultSymbol||this._getDefaultSymbol(e),u=z(i,`resultGraphicEnabled`)?!!i.resultGraphicEnabled:this.resultGraphicEnabled,d=z(i,`autoNavigate`)?!!i.autoNavigate:this.autoNavigate,f=z(i,`popupEnabled`)?!!i.popupEnabled:this.popupEnabled,p=f?o||this.popupTemplate||this.defaultPopupTemplate:null,{feature:m}=e;if(!m){let e=new a(`select:missing-feature`,`Cannot select without a feature.`,{feature:m});throw s.getLogger(this).error(e),e}let{attributes:h,geometry:g}=m,_=y(m),b=null;if(g){let{labelPointExecute:e}=await import(`../../geometry/operators/labelPointOperator.js`);b=e(g)}let x={layerViewQuery:this._getLayerView(m),elevationQuery:t&&b!=null?v(b,t):Promise.resolve(b)},S=await l(x),C=S.layerViewQuery.value,w=S.elevationQuery.value;c instanceof T&&(c.text=e.name);let O=t&&d?e.target||e.extent:null;await(O==null?Promise.resolve():this._goToSearchResult(O));let k=C?m:new n({geometry:g,symbol:c,attributes:h,layer:_,origin:m.origin,popupTemplate:p});return C&&E(C)&&!f&&this._highlightFeature({graphic:k,layerView:C}),!C&&u&&t&&t.graphics.push(k),this._setResultFloor(e),this._set(`selectedResult`,e),this._set(`resultGraphic`,k),this._set(`resultLocation`,w),this.emit(`select-result`,{popupEnabled:f,result:e,source:i,sourceIndex:r}),e}async suggest(e,t,n){let r=e||this.searchTerm;this.emit(`suggest-start`,{searchTerm:r}),await this._suggestTimer(t,n);let i=await this._suggestImmediate(r,n);return this._set(`suggestions`,i?.results),this._set(`suggestionCount`,i?.results.reduce((e,t)=>e+(t.results?.length??0),0)??null),this.emit(`suggest-complete`,i),i}async when(){await p(()=>!this.updating)}async _update(){let{portal:e,view:t}=this;if(!this.includeDefaultSources){this._updateDefaultSources(),this._updatingPromise=null;return}let n=l([e?.load(),t?.when()]).then(async()=>{this.destroyed||n!==this._updatingPromise||await this._updateDefaultSources()});this._updatingPromise=n,await n,n===this._updatingPromise&&(this._updatingPromise=null)}_clearSearching(){this._searching=null}_convertHelperServices(){let e=this.portal?.helperServices?.geocode;return e?e.map(e=>{if(e.placefinding===!1)return;let t=j(e.url)&&x(e.url)?{url:M}:null,n=O.fromJSON({...e,...t}),r=n.url;if(j(r)||N(r)||P(r)){let e=n.outFields??[`Addr_type`,`Match_addr`,`StAddr`,`City`],t=(n.placeholder||this.messages?.placeholder)??``,r=typeof n.defaultZoomScale==`number`?n.defaultZoomScale:2500;n.singleLineFieldName=`SingleLine`,n.outFields=e,n.placeholder=t,n.defaultZoomScale=r}if(n.singleLineFieldName)return n}).filter(i):[]}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e?.destroy()),this._createdFeatureLayers=[]}async _getLayerSources(e,t){let n=this.view?.map;return(await l(e.map(async e=>{let r=n.findLayerById(e.id);if(!r)return;let i=this._getLayerJSON(e),a=await this._getLayer(r,i);if(!a)return;let o=D.fromJSON(i);return o.placeholder=t,o.layer=a,o}).toArray())).map(({value:e})=>e).filter(i)}async _getTableSources(e,t){let n=this.view?.map;return(await l(e.map(async e=>{if(!e.id)return;let r=n.findTableById(e.id);if(!r)return;let i=this._getLayerJSON(e),a=await this._getLayer(r,i);if(!a)return;let o=D.fromJSON(i);return o.placeholder=t,o.layer=a,o}).toArray())).map(({value:e})=>e).filter(i)}async _convertApplicationProperties(){let e=(this.view?.map)?.applicationProperties?.viewing?.search;if(!e)return[];let{enabled:t,hintText:n,layers:r,tables:i}=e;if(!t)return[];let[a,o]=await Promise.all([this._getLayerSources(r,n),this._getTableSources(i,n)]);return[...a,...o]}async _getSubLayer(e,t){let n=this._updatingPromise;if(await e.load(),!e.allSublayers)throw Error();let r=e.allSublayers.find(e=>e.id===t.subLayer);if(!r)throw Error();let i=await r.createFeatureLayer?.();if(!i)throw Error();if(this.destroyed||n!==this._updatingPromise)return i.destroy(),null;this._createdFeatureLayers.push(i);try{await i.load()}catch(e){throw this._createdFeatureLayers=this._createdFeatureLayers.filter(e=>e!==i),i.destroy(),e}return this.destroyed||n!==this._updatingPromise?(this._createdFeatureLayers=this._createdFeatureLayers.filter(e=>e!==i),i.destroy(),null):i}async _getBuildingSubLayer(e,t){await e.load();let n=e.allSublayers.find(e=>e.id===t.subLayer);if(n?.type!==`building-component`||(await n.load(),n.associatedLayer==null))throw Error();return await n.associatedLayer.load(),n}async _getLayer(e,t){if(e.type===`map-image`)try{return await this._getSubLayer(e,t)}catch{let t=new a(`search:create-featurelayer`,`Could not create a FeatureLayer from the MapImageLayer`,{layer:e});return s.getLogger(this).error(t),null}return e.type===`building-scene`?this._getBuildingSubLayer(e,t):(await e.load(),e.capabilities?.operations?.supportsQuery?e:null)}_getLayerJSON(e){return typeof e.toJSON==`function`?e.toJSON():e}async _updateDefaultSources(){let{defaultSources:e,includeDefaultSources:t}=this,n=this._updatingPromise;if(this._destroyFeatureLayers(),e.removeAll(),t){let t=await this._convertApplicationProperties();if(this.destroyed||n!==this._updatingPromise)return;e.addMany([...t,...this._convertHelperServices()])}}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set(`resultCount`,null),this._set(`results`,null),this._set(`suggestions`,null),this._set(`suggestionCount`,null),this._set(`selectedResult`,null),this._set(`selectedSuggestion`,null),this.emit(`search-clear`)}_suggestTimer(e,t){let n=e??this.suggestionDelay;return u(n,null,t?.signal)}async _createLocationForSearch(e){if(e instanceof n&&e.geometry){let{labelPointExecute:t}=await import(`../../geometry/operators/labelPointOperator.js`);return t(e.geometry)}return e instanceof g?e:Array.isArray(e)&&e.length===2?new g({longitude:e[0],latitude:e[1]}):null}async _createSuggestionForSearch(e){if(e&&z(e,`key`)&&z(e,`text`)&&z(e,`sourceIndex`))return e;let t=await this._createLocationForSearch(e),n=typeof e==`string`?e:this.searchTerm,{selectedSuggestion:r,selectedResult:i}=this,a=!e&&r&&i,o=a&&r.key===i.key&&r.sourceIndex===i.sourceIndex,s=a&&r.location;return o||s?r:{location:t,text:t?``:n,sourceIndex:null,key:null}}_getFirstResult(e){return c(e,({results:e})=>e?.[0])??null}async _selectFirstResult(e){return!this.autoSelect||!e?null:this.select(e)}async _suggestImmediate(e,t){await this.when();let n=await this._getSuggestionsFromSources(e,t);if(t?.signal?.aborted)return null;let r={activeSourceIndex:this.activeSourceIndex,searchTerm:e??``,numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(r,n),r}_formatSourceResponse(e,t,n){let r=t?.value||[],i=t?.error,a=this.allSources.at(n);if(i){let t={sourceIndex:n,source:a,error:i};e.errors.push(t),s.getLogger(this).error(i),e.numErrors++}else{let t={sourceIndex:n,source:a,results:r};e.results.push(t),e.numResults+=r.length}}_formatResponse(e,t,n){if(t){if(e.activeSourceIndex===-1){let r=n&&z(n,`sourceIndex`)&&n.sourceIndex!==-1?n.sourceIndex:void 0;t.forEach((t,n)=>{let i=r===void 0?n:r;this._formatSourceResponse(e,t,i)})}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}}async _getResultsFromSources(e,t){let{allSources:n}=this,r=!e.location&&z(e,`sourceIndex`)?e.sourceIndex:this.activeSourceIndex,i=[];if(!n.length){let e=new a(`search:no-sources-defined`,`At least one source is required.`,{allSources:n});throw s.getLogger(this).error(e),e}return r===-1?n.forEach((n,r)=>{i.push(this._getResultsFromSource(e,r,t))}):i.push(this._getResultsFromSource(e,r,t)),l(i)}async _getSuggestionsFromSources(e,t){let{allSources:n,activeSourceIndex:r}=this,i=[];if(!n.length){let e=new a(`suggest:no-sources-defined`,`At least one source is required.`,{allSources:n});throw s.getLogger(this).error(e),e}return r===-1?n.forEach((n,r)=>{i.push(this._getSuggestionsFromSource(e,r,t))}):i.push(this._getSuggestionsFromSource(e,r,t)),l(i)}async _getResultsFromSource(e,t,n){let r=t==null?null:this.allSources.at(t);if(!r)return null;let{location:i=null}=e,a=this.view?.spatialReference??V,o=z(r,`maxResults`)?r.maxResults:this.maxResults,s=r instanceof D&&z(r,`exactMatch`)?r.exactMatch:!1,{view:c}=this;return r.getResults?.({exactMatch:s,location:i,maxResults:o,sourceIndex:t,spatialReference:a,suggestResult:e,view:c},n)}async _getSuggestionsFromSource(e,t,n){let r=this.allSources.at(t);if(!r)return null;e??=``;let i=z(r,`suggestionsEnabled`)?r.suggestionsEnabled:this.suggestionsEnabled,a=e?.length,o=z(r,`minSuggestCharacters`)?r.minSuggestCharacters:this.minSuggestCharacters;if(i&&e.trim()&&a>=o){let i=this.view?.spatialReference||V,a=z(r,`maxSuggestions`)?r.maxSuggestions:this.maxSuggestions,{view:o}=this,s=r instanceof D&&z(r,`exactMatch`)?r.exactMatch:!1;return r.getSuggestions?.({view:o,sourceIndex:t,suggestTerm:e,spatialReference:i,maxSuggestions:a,exactMatch:s},n)}return null}_getLayerSourcePopupTemplate(e){let{layer:t}=e;if(t)return z(e,`popupTemplate`)?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){return c(this.results??[],({results:t,sourceIndex:n})=>t?.includes(e)?n:null)??null}async _goToSearchResult(e){this._abortGoTo();let t=new AbortController;this._gotoController=t;let n={target:{target:e},options:{signal:t.signal}};e||(n.options.animate=!1),await this.callGoTo(n),this._gotoController=null}_getDefaultSymbol(e){let{defaultSymbols:t}=this,n=e.feature?.geometry;if(n==null)return null;switch(n.type){case`point`:case`multipoint`:return t.point;case`polyline`:return t.polyline;case`extent`:case`polygon`:return t.polygon;default:return null}}_removeHighlight(){this.removeHandles(B)}async _getLayerView(e){let{view:t}=this;if(!e||!t)return null;let n=y(e);return!n||n.type===`building-component`||n.type===`subtype-sublayer`?null:(await t.when(),t.whenLayerView(n))}_highlightFeature(e){let{graphic:t,layerView:n}=e,{attributes:r}=t,i=y(t);if(!A(i))return;let{objectIdField:a}=i,o=(a&&r?.[a])??null,s=n.highlight(o??t);this.addHandles(s,B)}_setResultFloor(e){let{view:t}=this,n=e.feature?.attributes,r=y(e.feature);if(A(r)&&r.floorInfo?.floorField&&n){let e=n[r.floorInfo.floorField];t?.emit(`select-result-floor`,e)}}};e([m()],U.prototype,`_searching`,void 0),e([m()],U.prototype,`_updatingPromise`,void 0),e([m({readOnly:!0,value:null})],U.prototype,`activeSource`,null),e([m()],U.prototype,`activeSourceIndex`,null),e([m()],U.prototype,`allPlaceholder`,null),e([m({readOnly:!0})],U.prototype,`allSources`,null),e([m()],U.prototype,`autoNavigate`,void 0),e([m()],U.prototype,`autoSelect`,void 0),e([m({type:r})],U.prototype,`defaultPopupTemplate`,null),e([m({readOnly:!0})],U.prototype,`defaultSources`,void 0),e([m()],U.prototype,`defaultSymbols`,void 0),e([m()],U.prototype,`includeDefaultSources`,void 0),e([m()],U.prototype,`locationEnabled`,null),e([m()],U.prototype,`maxInputLength`,void 0),e([m()],U.prototype,`maxResults`,void 0),e([m()],U.prototype,`maxSuggestions`,void 0),e([m()],U.prototype,`messages`,void 0),e([m()],U.prototype,`minSuggestCharacters`,void 0),e([m({readOnly:!0})],U.prototype,`placeholder`,null),e([m()],U.prototype,`popupEnabled`,void 0),e([m({type:r})],U.prototype,`popupTemplate`,void 0),e([m({type:b})],U.prototype,`portal`,void 0),e([m()],U.prototype,`resultCount`,void 0),e([m()],U.prototype,`resultGraphicEnabled`,void 0),e([m({readOnly:!0})],U.prototype,`resultGraphic`,void 0),e([m({readOnly:!0})],U.prototype,`resultLocation`,void 0),e([m({readOnly:!0})],U.prototype,`results`,void 0),e([m({readOnly:!0})],U.prototype,`selectedSuggestion`,void 0),e([m()],U.prototype,`searchAllEnabled`,void 0),e([m({readOnly:!0})],U.prototype,`selectedResult`,void 0),e([m()],U.prototype,`searchTerm`,null),e([m({type:k})],U.prototype,`sources`,void 0),e([m({readOnly:!0})],U.prototype,`state`,null),e([m()],U.prototype,`suggestionDelay`,void 0),e([m()],U.prototype,`suggestionCount`,void 0),e([m({readOnly:!0})],U.prototype,`suggestions`,void 0),e([m()],U.prototype,`suggestionsEnabled`,void 0),e([m({readOnly:!0})],U.prototype,`updating`,null),e([m()],U.prototype,`view`,void 0),e([m()],U.prototype,`clear`,null),U=e([h(`esri.widgets.Search.SearchViewModel`)],U);const W=U;export{W as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{substitute as e,formatDate as t}from"../../../intl.js";import n from"../../../core/Error.js";import{clone as r}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{mappedFind as a}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/units.js";import s from"../../../geometry/Polygon.js";import{getExtentFromGeometry as c,scaleExtent as l}from"../../../geometry/support/geometryUtils.js";import{getPopupLayer as u}from"../../../popup/support/featureUtils.js";import d from"../../../rest/support/FullTextSearch.js";const f=/https?:\/\/services.*\.arcgis\.com/i,p=/(?:\{([^}]+)\})/g,m=()=>i.getLogger(`esri.widgets.Search.support.layerSearchUtils`);function h(e,t){let{exactMatch:r=!1,location:i,maxResults:a,spatialReference:s,source:c,sourceIndex:l,suggestResult:u,view:d}=e,{layer:f,zoomScale:p}=c,h=d?.scale,g=_(c,d),x=t?.signal;return y(f).then(()=>{let e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null}).then(e=>{let{objectIdField:t,returnZ:_}=f,y=O(c);if(!A(f,y))throw m().error(`invalid-field: displayField is invalid.`),new n(`getResults():invalid-field`,`displayField is invalid.`);let S=e?.length?e:[y],w=c.outFields||S,T=v(w);if(!w.includes(t)&&!T&&w.push(t),f.floorInfo?.floorField&&w.push(f.floorInfo.floorField),!(T||k(f,w)))throw m().error(`invalid-field: outField is invalid.`),new n(`getResults():invalid-field`,`outField is invalid.`);let D=f.createQuery(),{orderByFields:j}=c;if(j&&(D.orderByFields=j),s){D.outSpatialReference=s;let e=1/o(s);e&&(D.maxAllowableOffset=e)}let M=f.geometryType===`mesh`||f.geometryType===`multipatch`;if(D.returnZ=f.capabilities?.data?.supportsZ&&!M&&_!==!1,D.returnGeometry=!0,D.multipatchOption=M?`xyFootprint`:null,w&&(D.outFields=w),i)D.geometry=i;else if(u.key)D.objectIds=[u.key];else{let e=c.searchFields||[y];if(!k(f,e))throw m().error(`invalid-field: search field is invalid.`),new n(`getResults():invalid-field`,`search field is invalid.`);E(f)&&(D.num=a),g&&(D.geometry=g);let t=u.text;if(!t?.trim()||(C({source:c,searchTerm:t,searchFields:e,exactMatch:r,query:D,type:`search`}),!b(D)))return[]}return f.queryFeatures(D,{signal:x}).then(async e=>{let{labelPointExecute:t}=await import(`../../../geometry/operators/labelPointOperator.js`);return K(e,d,c,l,y,h,p,t)})})}function g(e,t){let{source:r,spatialReference:i,view:a,suggestTerm:o,maxSuggestions:s,sourceIndex:c,exactMatch:l}=e,{layer:u}=r,d=t?.signal,f=_(r,a);return y(u).then(()=>{if(!E(u))return[];let e=O(r),t=r.searchFields||[e],a=[];r.suggestionTemplate?r.suggestionTemplate.replaceAll(p,(e,t)=>(a.push(t),e)):a.push(e);let h=v(a);!a.includes(u.objectIdField)&&!h&&a.push(u.objectIdField);let g=A(u,e),_=h||k(u,a),y=k(u,t);if(!g)throw m().error(`invalid-field: displayField is invalid.`),new n(`getSuggestions():invalid-field`,`displayField is invalid.`);if(!_)throw m().error(`invalid-field: outField is invalid.`),new n(`getSuggestions():invalid-field`,`outField is invalid.`);if(!y)throw m().error(`invalid-field: search field is invalid.`),new n(`getSuggestions():invalid-field`,`search field is invalid.`);let x=u.createQuery(),{orderByFields:S}=r;return S&&(x.orderByFields=S),x.outSpatialReference=i,x.returnGeometry=!1,x.num=s,x.outFields=a,f&&(x.geometry=f),!o.trim()||(C({source:r,searchTerm:o,searchFields:t,exactMatch:l,query:x,type:`suggest`}),!b(x))?[]:u.queryFeatures(x,{signal:d}).then(t=>U(t,r,c,e))})}function _(e,t){let{filter:n,withinViewEnabled:r}=e,i=t?.extent;return n?.geometry??(r&&i?i:void 0)}function v(e){return e&&e.includes(`*`)}async function y(e){e&&await e.load()}function b(e){return!!(e.fullText||e.where)}function x(e,t){let n=e?.indexes;return!n||!t?.length?!1:n.filter(e=>e.indexType===`FullText`).some(e=>{let n=e.fields?.split(`,`).map(e=>e.trim().toLowerCase())||[];return t.every(e=>n.includes(e.toLowerCase()))})}function S({text:e,searchFields:t,searchType:n=`prefix`}){return(n===`simple`?[e.trim()]:e.trim().split(` `)).filter(e=>!!e.trim()).map(e=>new d({onFields:t,searchTerm:e,searchType:n}))}function C({source:e,searchTerm:t,searchFields:n,exactMatch:r,query:i,type:a}){let{layer:o,filter:s,prefix:c=``,suffix:l=``,searchMode:u}=e,d=w(u,r,o,n);d.fullTextSearchType&&t&&(i.fullText=S({text:t,searchFields:n,searchType:d.fullTextSearchType})),i.where=L({searchTerm:N(`${c}${t}${l}`),layer:o,searchFields:n,filter:s,exactMatch:d.exactMatch,query:i,type:a})}function w(e,t,n,r){let i=T(n)&&x(n,r),a=e??(t?`simple`:`starts-with`);return a===`simple`?{exactMatch:!0,fullTextSearchType:null}:e===`starts-with`?{exactMatch:!1,fullTextSearchType:null}:a===`full-text-simple`?i?{exactMatch:!1,fullTextSearchType:`simple`}:{exactMatch:!0,fullTextSearchType:null}:i?{exactMatch:!1,fullTextSearchType:`prefix`}:{exactMatch:!1,fullTextSearchType:null}}function T(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function E(e){return e?.capabilities?.query?.supportsPagination??!1}function D(e){return e?.fieldsIndex?.fields?.find(e=>e.type===`string`)?.name??``}function O(e){return e.displayField||e.layer.displayField||D(e.layer)}function k(e,t){return!e||!t?.length?!1:t.every(t=>A(e,t))}function A(e,t){return!!e.getField(t)}function j(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function M({codedValues:e},t,n){return a(e??[],e=>{let r=e.name,i=n?r:r.toLowerCase();return(n?t:t.toLowerCase())===i?e.code.toString():null})??null}function N(e){return e.replaceAll(`'`,`''`)}function P(e,t){let n=t?.where;return n?`(${e}) AND (${n})`:e}function F({currentTerm:e,field:t,filter:n,exactMatch:r,url:i,type:a}){let o=t?.type,s=t?.name;if(o===`string`||o===`date`||o===`global-id`){let t=f.test(i??``),o=t&&j(e)?`N`:``;return P(r&&a===`search`?`${s} = ${o}'${e}'`:t?`${s} LIKE ${o}${`'${e}%'`}`:`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,n)}if(o===`oid`||o===`small-integer`||o===`integer`||o===`single`||o===`double`){let t=Number(e);return isNaN(t)?null:P(`${s} = ${t}`,n)}return P(`${s} = ${e}`,n)}function I(e,t){return e?` OR (${t})`:`(${t})`}function L({searchTerm:e,layer:t,searchFields:n,filter:r,exactMatch:i,query:a,type:o}){let{definitionExpression:s,url:c}=t,l=``;if(!a.fullText&&e&&n&&n.forEach(n=>{let a=t.getField(n),s=t.getFieldDomain?.(n),u=(s?.type===`coded-value`?M(s,e,i):null)||e||null;if(u!==null){let e=F({currentTerm:u,field:a,filter:r,exactMatch:i,url:c,type:o});e&&(l+=I(l,e))}}),a.fullText){let e=r?.where;return s&&e?`(${s}) AND (${e})`:s||e||``}return s&&l?`(${s}) AND (${l})`:l}function R(e,t){let n=null,{codedValues:r}=e;return r&&r.length&&r.some(e=>e.code===t&&(n=e.name,!0)),n}function z(e,t){return e[t]??e[Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase())]}function B(e){return!!e&&`getField`in e&&`queryFeatures`in e}function V(n,r,i){let a=u(n);if(!B(a))return``;let{attributes:o}=n,s=a.getFieldDomain?.(i,{feature:n});if(r)return e(r,o);if(i&&o){let e=a.getField(i),n=z(o,i);return n==null?``:s?.type===`coded-value`?R(s,n)??``:e?.type===`date`?t(new Date(n)):typeof n==`number`?n.toString():typeof n==`string`?n.trim():``}return``}function H(e,t,n,r){let i=u(e),{attributes:a}=e,o=B(i)&&i.objectIdField?a[i.objectIdField]:null;return{text:V(e,t.suggestionTemplate,r),key:o,sourceIndex:n}}function U(e,t,n,r){return e.features.map(e=>H(e,t,n,r))}function W(e){return e!=null&&e.minScale!=null&&e.maxScale!=null}function G(e,t,n,i,a,o,d,f){let p=e.clone(),m=u(e);p.layer=m,p.origin=e.origin;let h=B(m)?m.objectIdField:void 0,g=h?e.attributes[h]:null,_=V(e,n.searchTemplate,a);o!=null&&W(m)&&(m.minScale&&m.minScale<o?o=m.minScale:m.maxScale&&m.maxScale>o&&(o=m.maxScale));let v=c(p.geometry,t,o,f),y=typeof d==`number`&&v?l(r(v),t??void 0,d):v,b=e.clone();return b.layer=m,b.origin=e.origin,y!=null&&(b.geometry=s.fromExtent(y)),{extent:y,target:b,feature:p,key:g,name:_,sourceIndex:i}}function K(e,t,n,r,i,a,o,s){return e.features.map(e=>G(e,t,n,r,i,a,o,s))}export{S as createFullTextSearchInfos,h as getResults,g as getSuggestions,B as isSearchableLayer};
2
+ import{substitute as e,formatDate as t}from"../../../intl.js";import n from"../../../core/Error.js";import{clone as r}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{mappedFind as a}from"../../../core/maybe.js";import{getMetersPerUnitForSR as o}from"../../../core/units.js";import s from"../../../geometry/Polygon.js";import{getExtentFromGeometry as c,scaleExtent as l}from"../../../geometry/support/geometryUtils.js";import{getPopupLayer as u}from"../../../popup/support/featureUtils.js";import d from"../../../rest/support/FullTextSearch.js";const f=/https?:\/\/services.*\.arcgis\.com/i,p=/(?:\{([^}]+)\})/g,m=()=>i.getLogger(`esri.widgets.Search.support.layerSearchUtils`);function h(e,t){let{exactMatch:r=!1,location:i,maxResults:a,spatialReference:s,source:c,sourceIndex:l,suggestResult:u,view:d}=e,{layer:f,zoomScale:p}=c,h=d?.scale,g=_(c,d),x=t?.signal;return y(f).then(()=>{let e=f.popupTemplate;return e?e.getRequiredFields(f.fieldsIndex):null}).then(e=>{let{objectIdField:t,returnZ:_}=f,y=O(c);if(!A(f,y))throw m().error(`invalid-field: displayField is invalid.`),new n(`getResults():invalid-field`,`displayField is invalid.`);let S=e?.length?e:[y],w=c.outFields||S,T=v(w);if(!w.includes(t)&&!T&&w.push(t),f.floorInfo?.floorField&&w.push(f.floorInfo.floorField),!(T||k(f,w)))throw m().error(`invalid-field: outField is invalid.`),new n(`getResults():invalid-field`,`outField is invalid.`);let D=f.createQuery(),{orderByFields:j}=c;if(j&&(D.orderByFields=j),s){D.outSpatialReference=s;let e=1/o(s);e&&(D.maxAllowableOffset=e)}let M=f.geometryType===`mesh`||f.geometryType===`multipatch`;if(D.returnZ=f.capabilities?.data?.supportsZ&&!M&&_!==!1,D.returnGeometry=!0,D.multipatchOption=M?`xyFootprint`:null,w&&(D.outFields=w),i)D.geometry=i;else if(u.key)D.objectIds=[u.key];else{let e=c.searchFields||[y];if(!k(f,e))throw m().error(`invalid-field: search field is invalid.`),new n(`getResults():invalid-field`,`search field is invalid.`);E(f)&&(D.num=a),g&&(D.geometry=g);let t=u.text;if(!t?.trim()||(C({source:c,searchTerm:t,searchFields:e,exactMatch:r,query:D,type:`search`}),!b(D)))return[]}return f.queryFeatures(D,{signal:x}).then(async e=>{let{labelPointExecute:t}=await import(`../../../geometry/operators/labelPointOperator.js`);return K(e,d,c,l,y,h,p,t)})})}function g(e,t){let{source:r,spatialReference:i,view:a,suggestTerm:o,maxSuggestions:s,sourceIndex:c,exactMatch:l}=e,{layer:u}=r,d=t?.signal,f=_(r,a);return y(u).then(()=>{if(!E(u))return[];let e=O(r),t=r.searchFields||[e],a=[];r.suggestionTemplate?r.suggestionTemplate.replaceAll(p,(e,t)=>(a.push(t),e)):a.push(e);let h=v(a);!a.includes(u.objectIdField)&&!h&&a.push(u.objectIdField);let g=A(u,e),_=h||k(u,a),y=k(u,t);if(!g)throw m().error(`invalid-field: displayField is invalid.`),new n(`getSuggestions():invalid-field`,`displayField is invalid.`);if(!_)throw m().error(`invalid-field: outField is invalid.`),new n(`getSuggestions():invalid-field`,`outField is invalid.`);if(!y)throw m().error(`invalid-field: search field is invalid.`),new n(`getSuggestions():invalid-field`,`search field is invalid.`);let x=u.createQuery(),{orderByFields:S}=r;return S&&(x.orderByFields=S),x.outSpatialReference=i,x.returnGeometry=!1,x.num=s,x.outFields=a,f&&(x.geometry=f),!o.trim()||(C({source:r,searchTerm:o,searchFields:t,exactMatch:l,query:x,type:`suggest`}),!b(x))?[]:u.queryFeatures(x,{signal:d}).then(t=>U(t,r,c,e))})}function _(e,t){let{filter:n,withinViewEnabled:r}=e,i=t?.extent;return n?.geometry??(r&&i?i:void 0)}function v(e){return e&&e.includes(`*`)}async function y(e){if(!e)throw new n(`search:missing-layer`,`A layer is required for a layer search source.`);await e.load()}function b(e){return!!(e.fullText||e.where)}function x(e,t){let n=e?.indexes;return!n||!t?.length?!1:n.filter(e=>e.indexType===`FullText`).some(e=>{let n=e.fields?.split(`,`).map(e=>e.trim().toLowerCase())||[];return t.every(e=>n.includes(e.toLowerCase()))})}function S({text:e,searchFields:t,searchType:n=`prefix`}){return(n===`simple`?[e.trim()]:e.trim().split(` `)).filter(e=>!!e.trim()).map(e=>new d({onFields:t,searchTerm:e,searchType:n}))}function C({source:e,searchTerm:t,searchFields:n,exactMatch:r,query:i,type:a}){let{layer:o,filter:s,prefix:c=``,suffix:l=``,searchMode:u}=e,d=w(u,r,o,n);d.fullTextSearchType&&t&&(i.fullText=S({text:t,searchFields:n,searchType:d.fullTextSearchType})),i.where=L({searchTerm:N(`${c}${t}${l}`),layer:o,searchFields:n,filter:s,exactMatch:d.exactMatch,query:i,type:a})}function w(e,t,n,r){let i=T(n)&&x(n,r),a=e??(t?`simple`:`starts-with`);return a===`simple`?{exactMatch:!0,fullTextSearchType:null}:e===`starts-with`?{exactMatch:!1,fullTextSearchType:null}:a===`full-text-simple`?i?{exactMatch:!1,fullTextSearchType:`simple`}:{exactMatch:!0,fullTextSearchType:null}:i?{exactMatch:!1,fullTextSearchType:`prefix`}:{exactMatch:!1,fullTextSearchType:null}}function T(e){return e?.capabilities?.query?.supportsFullTextSearch??!1}function E(e){return e?.capabilities?.query?.supportsPagination??!1}function D(e){return e?.fieldsIndex?.fields?.find(e=>e.type===`string`)?.name??``}function O(e){return e.displayField||e.layer.displayField||D(e.layer)}function k(e,t){return!e||!t?.length?!1:t.every(t=>A(e,t))}function A(e,t){return!!e.getField(t)}function j(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function M({codedValues:e},t,n){return a(e??[],e=>{let r=e.name,i=n?r:r.toLowerCase();return(n?t:t.toLowerCase())===i?e.code.toString():null})??null}function N(e){return e.replaceAll(`'`,`''`)}function P(e,t){let n=t?.where;return n?`(${e}) AND (${n})`:e}function F({currentTerm:e,field:t,filter:n,exactMatch:r,url:i,type:a}){let o=t?.type,s=t?.name;if(o===`string`||o===`date`||o===`global-id`){let t=f.test(i??``),o=t&&j(e)?`N`:``;return P(r&&a===`search`?`${s} = ${o}'${e}'`:t?`${s} LIKE ${o}${`'${e}%'`}`:`${`LOWER(${s})`} LIKE ${o}${`'${e.toLowerCase()}%'`}`,n)}if(o===`oid`||o===`small-integer`||o===`integer`||o===`single`||o===`double`){let t=Number(e);return isNaN(t)?null:P(`${s} = ${t}`,n)}return P(`${s} = ${e}`,n)}function I(e,t){return e?` OR (${t})`:`(${t})`}function L({searchTerm:e,layer:t,searchFields:n,filter:r,exactMatch:i,query:a,type:o}){let{definitionExpression:s,url:c}=t,l=``;if(!a.fullText&&e&&n&&n.forEach(n=>{let a=t.getField(n),s=t.getFieldDomain?.(n),u=(s?.type===`coded-value`?M(s,e,i):null)||e||null;if(u!==null){let e=F({currentTerm:u,field:a,filter:r,exactMatch:i,url:c,type:o});e&&(l+=I(l,e))}}),a.fullText){let e=r?.where;return s&&e?`(${s}) AND (${e})`:s||e||``}return s&&l?`(${s}) AND (${l})`:l}function R(e,t){let n=null,{codedValues:r}=e;return r&&r.length&&r.some(e=>e.code===t&&(n=e.name,!0)),n}function z(e,t){return e[t]??e[Object.keys(e).find(e=>e.toLowerCase()===t.toLowerCase())]}function B(e){return!!e&&`getField`in e&&`queryFeatures`in e}function V(n,r,i){let a=u(n);if(!B(a))return``;let{attributes:o}=n,s=a.getFieldDomain?.(i,{feature:n});if(r)return e(r,o);if(i&&o){let e=a.getField(i),n=z(o,i);return n==null?``:s?.type===`coded-value`?R(s,n)??``:e?.type===`date`?t(new Date(n)):typeof n==`number`?n.toString():typeof n==`string`?n.trim():``}return``}function H(e,t,n,r){let i=u(e),{attributes:a}=e,o=B(i)&&i.objectIdField?a[i.objectIdField]:null;return{text:V(e,t.suggestionTemplate,r),key:o,sourceIndex:n}}function U(e,t,n,r){return e.features.map(e=>H(e,t,n,r))}function W(e){return e!=null&&e.minScale!=null&&e.maxScale!=null}function G(e,t,n,i,a,o,d,f){let p=e.clone(),m=u(e);p.layer=m,p.origin=e.origin;let h=B(m)?m.objectIdField:void 0,g=h?e.attributes[h]:null,_=V(e,n.searchTemplate,a);o!=null&&W(m)&&(m.minScale&&m.minScale<o?o=m.minScale:m.maxScale&&m.maxScale>o&&(o=m.maxScale));let v=c(p.geometry,t,o,f),y=typeof d==`number`&&v?l(r(v),t??void 0,d):v,b=e.clone();return b.layer=m,b.origin=e.origin,y!=null&&(b.geometry=s.fromExtent(y)),{extent:y,target:b,feature:p,key:g,name:_,sourceIndex:i}}function K(e,t,n,r,i,a,o,s){return e.features.map(e=>G(e,t,n,r,i,a,o,s))}export{S as createFullTextSearchInfos,h as getResults,g as getSuggestions,B as isSearchableLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as n}from"../../core/arrayUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import{handlesGroup as o,makeHandle as s,drainHandles as c,destroyHandle as l}from"../../core/handleUtils.js";import has from"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as f,removeMaybe as p}from"../../core/maybe.js";import{createAbortError as m,ignoreAbortErrors as h,whenOrAbort as g}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as v,on as ee,when as te,sync as ne,whenOnce as y}from"../../core/reactiveUtils.js";import{property as b,subclass as re}from"../../core/accessorSupport/decorators.js";import{trackAccess as x}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as ie}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ae}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as oe,isLoaded as se,load as ce,project as le}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as ue}from"../../geometry/support/spatialReferenceUtils.js";import de from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as fe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as pe}from"../../support/elevationInfoUtils.js";import me from"../../symbols/FillSymbol3DLayer.js";import he from"../../symbols/MeshSymbol3D.js";import ge from"../../symbols/SimpleFillSymbol.js";import _e from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import T from"../../symbols/TextSymbol.js";import{symbolTypes as E}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ve}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as be}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as O}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as k}from"../../views/input/InputManager.js";import{sketchKeys as A}from"../../views/interactive/keybindings.js";import{bindViewToolOptions as xe}from"../../views/interactive/options/bindViewToolOptions.js";import j from"../../views/interactive/options/InteractiveToolOptions.js";import M from"../../views/interactive/sketch/SketchLabelOptions.js";import N from"../../views/interactive/sketch/SketchOptions.js";import Se from"../../views/interactive/sketch/SketchTooltipOptions.js";import Ce from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as P}from"../../views/interactive/snapping/SnappingManager.js";import{acquireForViewOptions as we}from"../../views/interactive/snapping/SnappingManagerPool.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as I}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as Te}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Ee}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as De}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as L}from"../../views/support/screenUtils.js";import Oe from"./adapters/layer/GraphicsLayerAdapter.js";import ke from"./adapters/layer/MapNotesLayerAdapter.js";import Ae from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as je,DrawToolOperationHandle as Me,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Ne}from"./support/PluginManager.js";import{SettingsManager as Pe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Fe,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Ie,getDrawToolGeometryTypeFromCreateTool as Le}from"./support/sketchUtils.js";const V={defaultZ:0},H={reshapeOptions:{edgeOperation:`split`,shapeOperation:`move`,vertexOperation:`move`,enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Ee},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends a{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Ne({sketchViewModel:this}),this.settingsManager=new Pe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new Te,this._viewHandlesKey=`viewHandles`,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new ge({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new _e({color:[130,130,130,1],width:2}),this.meshSymbol=new he({symbolLayers:new r([new me])}),this.updateGraphics=new r,this.updateOnGraphicClick=!0,this.useViewOptions=!1,this.cancelUpdateOnClickAway=!0,this.creationMode=`single`,this.vertexSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new N,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{let{_layerAdapter:e}=this;if(this.removeHandles(W),!e)return;let t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},v)].filter(n);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F,this.textSymbol=new T({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([ee(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),v),_(()=>this.view,e=>{this._defaultSnappingManager=d(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new P({view:e,options:this.snappingOptions})),e.type===`2d`?(import(`../../views/2d/interactive/editingTools.js`),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):e.type===`3d`&&(import(`../../views/3d/interactive/editingTools.js`),import(`../../views/3d/layers/GraphicsLayerView3D.js`)))},v),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),I(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=d(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit(`destroy`)}get _operationSnappingManager(){return this._operationContext?.snappingManager??this.snappingManager}get _operationToolOptions(){return this._operationContext?.toolOptions??this.sketchOptions}get _layerAdapter(){let{layer:e}=this;switch(e?.type){case`graphics`:return new Oe(e);case`map-notes`:return new ke(e);case`sketch`:return new Ae(e);case void 0:default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){let e=this._operationHandle;if(e?.type===`create`&&e.activeComponent&&`mode`in e.activeComponent)return e.activeComponent.mode;if(e?.activeComponent?.type===`draw-2.0`){let t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(n).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){let{activeComponent:e,destroyed:t}=this,n=!t&&e&&`tooltip`in e?e.tooltip:null;return n?.visible?n:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return this.activeComponent!=null&&(this.activeComponent.type===`draw-3d`||this.activeComponent.type===`draw-2d`)?this.activeComponent.graphic:this._get(`createGraphic`)}get defaultCreateOptions(){return this._get(`defaultCreateOptions`)}set defaultCreateOptions(e){this._set(`defaultCreateOptions`,{...V,...e})}get defaultUpdateOptions(){return this._get(`defaultUpdateOptions`)}set defaultUpdateOptions(e){this._set(`defaultUpdateOptions`,{...H,...e,reshapeOptions:{...H.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...H.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get(`textSymbol`)}set textSymbol(e){this._set(`textSymbol`,e)}get snappingOptions(){return this.snappingManager?.options??this._get(`snappingOptions`)}set snappingOptions(e){this._defaultSnappingManager!=null&&(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=d(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new P({options:this.snappingOptions,view:e})),this._clearOverride(`snappingManager`)}}get state(){let e=!!(this.view?.ready&&this.layer),t=this._operationHandle;return e&&t?`active`:e?`ready`:`disabled`}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.toolTransitionInProgress||this.activeComponent&&`updating`in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get(`view`)}set view(e){let t=this._get(`view`);if(t){let{container:e,map:n}=t;e&&this._clearCursor(),n?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}let n=`view-ready`;this.removeHandles(n),e&&this.addHandles(te(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},v),n),this._set(`view`,e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get pluginManager(){return this._pluginManager}get drawTool(){return this.activeComponent?.type===`draw-2.0`?this.activeComponent:null}get activePluginConfigurations(){return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).filter(n)??[]}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome(`rootPlugins`,e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;let e=this.view?.type??`2d`,{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(n)??[]}get firstPluginWithSwappableLeaf(){let e=this.view?.type??`2d`;return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>t!=null&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1)}get multiplePluginsActive(){return this.drawTool?this.drawTool.pluginStack.length>1:!1}replaceLeaf(e){this.drawTool?.replaceLeaf(e)}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=f(this._moduleLoaderAbortController),this._viewReadyAbortController=f(this._viewReadyAbortController),this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){let{state:e,updateGraphics:t}=this;if(e===`active`&&t.length){let{activeTool:e}=this,n=t.toArray();this.removeGraphics(n),this.cancel(),this._emitDeleteEvent({graphics:n,tool:e})}}duplicate(){if(this.state===`active`&&this.updateGraphics.length){let e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit(`duplicate`,{graphics:e,type:`duplicate`}),e}return[]}async create(e,t){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{view:n,layer:r}=this;if(!n||this.state===`disabled`)throw r||this._logMissingLayer(),m();if(n.activeTool!=null&&(n.activeTool=null),!e){this._logError(`sketch:missing-parameter`,`Missing parameter 'tool'.`);return}O(n,this._internalGraphicsLayer);let i=this._createOperationContext(n),a;try{a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t))}catch(e){throw this._destroyOperationContext(i),e}if(a==null||this.destroyed||i!==this._operationContext){let e=i===this._operationContext;a?.onEnd(),d(a),this._destroyOperationContext(i),e&&n.map?.remove(this._internalGraphicsLayer);return}let o=z(e);a.on(`complete`,()=>{if(a===this._operationHandle){let n=this.createGraphic,r=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._set(`createGraphic`,null),this.view?.map?.remove(this._internalGraphicsLayer),!a.cancelled&&n!=null&&this.addGraphic(n),this._sketchContinuationFlag=!1,this.emit(`create`,{graphic:n,state:r?`cancel`:`complete`,tool:o??`point`,toolEventInfo:null,type:`create`}),r||this._sketchContinuationFlag)return;let{creationMode:i}=this;if(i===`continuous`){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(h(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(h(this.update([n])))}}),this._operationHandle=a,n.ready&&n.focus()}async place(e,t){return await e.load(),this.create(`mesh`,{mode:`click`,hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{layer:n,view:r,state:i}=this;if(!r||i===`disabled`)throw n||this._logMissingLayer(),m();r.activeTool!=null&&(r.activeTool=null);let a=Array.isArray(e)?e:[e];if(e==null||!a?.length){this._logError(`sketch:missing-parameter`,`Missing parameter 'graphics'.`);return}if(a.some(e=>this.hasGraphic(e)?e.geometry==null&&(this._logError(`sketch:invalid-parameter`,`Parameter 'graphics' contains one or more graphics with an unsupported geometry.`),!0):(this._logError(`sketch:invalid-parameter`,`Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer.`),!0)))return;let o=this._createOperationContext(r),s;try{s=await this._updatingHandles.addPromise(this._setupUpdateOperation(a,t))}catch(e){throw this._destroyOperationContext(o),e}this.destroyed||s==null||$(s)||o!==this._operationContext?(s&&!$(s)&&(s.onEnd(),s.destroy()),this._destroyOperationContext(o)):(O(r,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit(`update`,{graphics:a,state:`start`,aborted:!1,tool:s.tool,toolEventInfo:null,type:`update`}))}async _updateSpatialReference(e){let t=this.view;if(!t)this._logMissingView();else{e=Array.isArray(e)?e:[e];for(let n of e)n.geometry!=null&&n.geometry.type!==`mesh`&&!ue(n.geometry.spatialReference,t.spatialReference)&&(!oe(n.geometry.spatialReference,t.spatialReference)&&!se()&&await ce(),n.geometry=le(n.geometry,t.spatialReference))}}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}_createOperationContext(e){this._destroyOperationContext();let t=this.useViewOptions?e.options:null,n=t?we(e):null,r=t?new j:this.sketchOptions,i;if(t){let{values:t}=r;i=o([xe(r,()=>e.options,()=>this.sketchOptions),_(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},ne)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...o([n,i])}}_destroyOperationContext(e=this._operationContext){e===this._operationContext?this._operationContext=p(this._operationContext):p(e)}async _getFirstHit(e){let t=this.view;if(!t)return this._logMissingView(),null;if(t.type===`2d`){let n=[];t.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});return De(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{fe(e)&&(!has(`enable-feature:im-as-ground`)||e.isUsedAsGroundLayer)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});if(r.results.length>0){let e=r.results[0];if(e!=null&&e.type===`graphic`&&e.graphic&&(!r.ground.mapPoint||t.map.ground.opacity<1||r.ground.distance-(e.distance??0)>-Math.min(3*r.ground.distance,t.viewingMode===`global`?ae(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:1/0)))return e}return null}_generateViewHandles(e){return[e.on(`immediate-click`,async e=>{let t=this.state===`active`&&this._operationHandle?.type===`create`;this.state!==`disabled`&&!t&&this.updateOnGraphicClick&&await this._toolTransitionHandles.addPromise(this._handleImmediateClick(e))},k.WIDGET)]}async _handleImmediateClick(e){let t=await e.defer(()=>this._getFirstHit(L(e))),n=null;if(t!=null){let r=t.graphic;this.updateGraphics.includes(r)||this.hasGraphic(r)?(e.stopPropagation(),n=r):this.view?.type===`2d`&&!this._isComponentGraphic(r)&&this.state===`active`&&this.cancel()}else this.state===`active`&&this.cancelUpdateOnClickAway&&this.cancel();n!=null&&!this.updateGraphics.includes(n)&&await this.update([n],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r={hasZ:n.type===`3d`,...this.defaultCreateOptions,...t},i=typeof e==`string`?this.pluginManager?.getPluginsEquivalentToCreateTool(e,r.mode):e,a=z(e);if(i&&!this.isUsingLegacyCreateTools){let e=await this._setupDrawTool(i,r,a??`polyline`);if(e)return this._setupDrawToolOperationHandle(e,a??`point`)}if(!a)return null;let o=await this._setupDrawGraphicTool(a,n,r);return o==null?null:(n.tools.add(o),n.activeTool=o,this._setupCreateOperationHandle(o,a))}async _setupDrawGraphicTool(e,t,n){if(e===`multipoint`&&t.type===`3d`)return this._logError(`sketch:create`,`Multipoint geometries are not supported in SceneView.`),null;if(!t)return this._logMissingView(),null;let{cursor:r,defaultZ:i,hasZ:a,geometryToPlace:o,graphicProperties:s,mode:c,preserveAspectRatio:l}=n,u=Ie(c,e),d=Le(e),f=n?.optionsPerTool?.has(e)?n.optionsPerTool.get(e):{},p=f?.preserveAspectRatio??l??e!==`rectangle`,m={centered:e!==`rectangle`&&!(e===`circle`&&!p),cursor:r,defaultZ:i,forceUniformSize:p,graphicProperties:{...s,attributes:{...s?.attributes}},geometryToPlace:o,geometryType:d,mode:u,graphicSymbol:n.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:a,snappingManager:this._operationSnappingManager,snapToScene:!1,view:t,...f};return t.type===`2d`?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){let t=await this._requireModule(import(`../../views/2d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ze(e.geometryType)?this.activeFillSymbol:null,toolOptions:this._operationToolOptions})}async _makeDrawGraphicTool3D(e){let t=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,toolOptions:this._operationToolOptions})}_setupCreateOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r=null,i=e.forceUniformSize,a=e.centered,o=new ie,l=[s(()=>o.destroy()),n.on(`key-down`,t=>{if(t.key===A.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===A.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key===A.vertexAdd&&!t.repeat){let n=e.drawOperation.geometryType;(n===`polyline`||n===`polygon`||n===`multipoint`)&&(t.stopPropagation(),e.drawOperation.commitStagedVertex())}else t.key===A.undo?(t.stopPropagation(),u.undo()):t.key===A.redo?(t.stopPropagation(),u.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!i,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!a,t.stopPropagation()))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan?e.enabled=!0:t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)?(e.forceUniformSize=i,t.stopPropagation()):t.key===A.center&&(e.centered=a,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{o.notify()}),e.on(`vertex-add`,t=>{switch(o.notify(),r=r==null?`start`:`active`,t.operation){case`apply`:this.emit(`create`,{graphic:e.graphic,state:r,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(o.notify(),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),r=`complete`,e.aborted?u&&u.cancel():u&&u.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],u=new je({activeComponent:e,type:`create`,onEnd:()=>{c(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(x(o),e.canUndo),canRedo:()=>(x(o),e.canRedo)});return u}_setupDrawToolOperationHandle(e,t){let r=this.view;if(!r)return this._logMissingView(),null;let i=null,a=[r.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),r.on(`key-up`,t=>{t.key===A.pan&&(e.editable=!0)},k.WIDGET),e.on(`before-vertex-add`,t=>{let n=e.mostUpstreamPlugin?.configuration;if(n&&`legacyCreateTool`in n&&(n?.legacyCreateTool===`point`||n.legacyCreateTool===`text`)){let e=t.detail.originalEvent;e&&`key`in e&&e.key===A.vertexAdd&&t.preventDefault()}}),e.on(`before-complete`,t=>{let n=e.getGeometryIfCompleted();(!n||Fe(n))&&t.preventDefault()}),e.on([`vertex-add`,`vertex-remove`],r=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),i=i==null&&r.type!==`vertex-remove`?`start`:`active`,r.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:i,tool:this.activeTool,toolEventInfo:r,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(n),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(n),tool:t})}}),e.on(`cursor-update`,t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit(`create`,{graphic:this.createGraphic,state:`active`,tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:`cursor-update`},type:`create`})}),e.on(`complete`,async({geometry:t,isSimple:n})=>{let r=this.createGraphic,i=!!t&&t.type!==`mesh`&&t.type!==`extent`&&!n;if(r&&(r.geometry=n?t:e.unprocessedGeometry??t),!i||!r)o.complete();else{this._internalGraphicsLayer.add(this.createGraphic);let e=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=e,await this._updatingHandles.addPromise(h(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new Me({activeComponent:e,type:`create`,onEnd:()=>{c(a),r.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),o.cancel()})),o}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:n,handle:r}){let i=this.view?.acquireCursor(`progress`,`high`);i&&this.addHandles(i);let a=()=>e.signal.aborted?(n&&(this._layerAdapter?.remove(n),this._internalGraphicsLayer?.remove(n)),this._set(`createGraphic`,null),!0):!1;try{let i=await this._geometryWorkerHandle.simplify(t,e.signal);if(a())return;n.geometry=i??t,this._internalGraphicsLayer?.remove(n),r.complete()}finally{i?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_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;case`text`:return this.textSymbol}}async _setupUpdateOperation(e,t){let{view:n}=this;if(!n)return this._logMissingView(),null;let r={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=r;let i=r.tool??H.tool;if(this.removeGraphics(e),this.addGraphics(e),n.type===`3d`){if(e.length===0)return null;switch(i){case`move`:return this._setupMove3DOperation(e,r,n,i);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupReshape3DOperation(e[0],r,n);case`transform`:return this._setupGraphicTransform3DOperation(e,r,n)}}switch(i){case`move`:return this._setupMove2DOperation(e,r,n);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupTransformOrReshape2DOperation(e,i,r,n);case`transform`:return B(e)&&(i=`reshape`),this._setupTransformOrReshape2DOperation(e,i,r,n)}}async _setupMove3DOperation(e,t,n,r,i=!1){let a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,MoveTool3D:s}=a.module,l=new Map,u=()=>{l.forEach(e=>e.destroy()),l.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ve(e);if(r!==0)return u(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;l.set(t,e)}let d=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(d),d.objects.addMany(Array.from(l.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:d,tool:r,type:`update`,onEnd:()=>{c(f),Q(n,d),u()},undo:()=>{X(this.view,d),q(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},addToSelection:async e=>{this.updateGraphics.push(e);let t=new o({view:n,graphic:e});l.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:async e=>{let t=this.updateGraphics.indexOf(e);if(p.history.undo.forEach(e=>e.updates.splice(t,1)),p.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0){p.complete();return}let n=l.get(e);n&&(d.objects.remove(n),n.destroy(),l.delete(e))},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1||r!==`transform`)return;let e=this.updateGraphics.at(0),i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));i&&!$(i)&&(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))}});return f.push(...this._getHandlesForComponent(p,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(p,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)},k.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,n,r=!1){if(e.length===1&&be(e[0])===0){let i=e[0],a=i.geometry;if(a!=null&&(a.type===`point`||a.type===`mesh`))return this._setupPointTransform3DOperation(i,t,n);if(a!=null&&(a.type===`polygon`||a.type===`polyline`))return this._setupPolyTransform3DOperation(i,t,n,r)}return this._setupMove3DOperation(e,t,n,`transform`,r)}async _setupPointTransform3DOperation(e,t,n){let r=`transform`,{enableRotation:i,enableScaling:a,enableZ:o}=t,s=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(s))return s;let{TransformTool3D:l,ManipulatedObject3DGraphic:u}=s.module,d=new u({graphic:e,view:n}),f=new l({object:d,view:n,enableRotation:i,enableScaling:a,enableZ:o,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),this.updateGraphics.add(e);let p=[],m=new R({activeComponent:f,tool:r,type:`update`,onEnd:()=>{c(p),Q(n,f),d.destroy()},undo:()=>{X(this.view,f),q(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,n,r=!1){let i=`transform`,{enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:l}=t,u=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(u))return u;let{ManipulatedObject3DGraphic:d,ExtentTransformTool:f}=u.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new d({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!l!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{c(g),Q(n,h),m.destroy()},canUndo:()=>!h.destroyed&&h.canUndo,undo:()=>{h.destroyed||(h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!h.destroyed&&h.canRedo,redo:()=>{h.destroyed||(h.redo(),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`}),await this._replaceUpdateOperationHandle(_,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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`}),_.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1)return;let r=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));r&&!$(r)&&(_.onEnd(),_.destroy(),this._setUpdateOperationHandle(r,t))}});return g.push(...this._getHandlesForComponent(_,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(_,e,t),k.WIDGET),n.on(`key-down`,e=>this._getCommonUpdateOperationKeyDownHandlers(_,e),k.WIDGET),n.on(`key-down`,e=>{e.key===A.constraint&&!e.repeat&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET)),_}async _setupMove2DOperation(e,t,n){let r=`move`;this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,n));if($(i))return i;let a=new R({activeComponent:i,tool:r,type:`update`,onEnd:()=>{this._clearCursor(),c(l),c(s),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{let e=this.updateGraphics.toArray();q(a,e),a.refreshComponent(),this._emitUndoEvent({graphics:e,tool:r})},redo:()=>{let e=this.updateGraphics.toArray();J(a,e),a.refreshComponent(),this._emitRedoEvent({graphics:e,tool:r})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0?a.complete():i.graphics=n}}),o=!1,s=[n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&(o=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&o&&(o=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET)],l=this._getHandlesForComponent(a,t);return a}async _setupReshape3DOperation(e,t,n,r=!1){let i=`reshape`,a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,ReshapeTool3D:s}=a.module,l=new o({view:n,graphic:e}),u=ye(l);if(u!==0)return l.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(u)}).`),null;let d=t.reshapeOptions,f=new s({view:n,object:l,enableZVertex:t.enableZ&&d?.vertexOperation===`move`,enableZShape:t.enableZ&&d?.shapeOperation===`move`,enableMoveObject:d?.shapeOperation===`move`||d?.shapeOperation===`move-xy`,enableMidpoints:d?.edgeOperation===`split`,enableEdgeOffset:d?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(l.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{c(p),Q(n,f),l.destroy()},canUndo:()=>!f.destroyed&&f.canUndo,undo:()=>{f.destroyed||(f.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!f.destroyed&&f.canRedo,redo:()=>{f.destroyed||(f.redo(),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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{t.toggleToolOnClick!==!1&&await this._replaceUpdateOperationHandle(m,t,()=>this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,n,!0))}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,n,r){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(t===`transform`?this._getBox(e,n,r):this._getReshape(e,n,r));if($(i))return i;let a=new R({activeComponent:i,type:`update`,onEnd:()=>{c(s),c(o),a.activeComponent&&!a.activeComponent.destroyed&&a.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{q(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},redo:()=>{J(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},addToSelection:async e=>{let t=a.activeComponent;if(t?.type===`reshape`){let t=[...this.updateGraphics,e];if(this.updateGraphics.removeAll(),!await this._replaceUpdateOperationHandle(a,n,()=>this._setupTransformOrReshape2DOperation(t,`transform`,n,r)))return}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),a.resetHistory();this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:`selection-change`},type:`update`})},removeFromSelection:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();n.length===0?a.complete():B(n)?await a.toggleTool():a.activeComponent.graphics=n,this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;let e=this.updateGraphics.at(0),t=e.geometry;if(t!=null&&(a.tool===`reshape`&&t.type===`point`||a.tool===`transform`&&t.type===`extent`))return;let i=null,o={...this.defaultUpdateOptions,...n,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...n?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...n?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};a.tool===`transform`?i=await this._updatingHandles.addPromise(this._getReshape([e],o,r)):a.tool===`reshape`&&(i=await this._updatingHandles.addPromise(this._getBox([e],o,r))),!$(i)&&(a.activeComponent?.destroy(),a.activeComponent=i,a.activeComponent&&(c(s),s=this._getHandlesForComponent(a,o)))}}),o=[r.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,n),k.WIDGET),r.on(`key-down`,e=>{if(this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET),r.on(`key-up`,e=>{if(e.key===A.constraint&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET)],s=this._getHandlesForComponent(a,n);return a}async _getGraphicMover(e,t,n){let{enableMoveAllGraphics:r,highlightOptions:i}=t,a=await this._requireModule(import(`../../views/draw/support/GraphicMover.js`));return $(a)?a:new a.module.default({enableMoveAllGraphics:r,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:n,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`grabbing`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-start`},type:`update`})},onGraphicMove:({dx:e,dy:t,graphic:n})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move`},type:`update`}),onGraphicMoveStop:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`pointer`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-stop`},type:`update`})},onGraphicPointerOver:()=>this._displayCursor(`move`),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,n){let{enableRotation:r,enableScaling:i,highlightOptions:a,preserveAspectRatio:o}=t,s=await this._requireModule(import(`../../views/draw/support/Box.js`));if($(s))return s;let c=this.view?.inputManager?.isModifierKeyDown(A.constraint),l=new s.module.default({graphics:e,enableRotation:r,enableScaling:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,preserveAspectRatio:!!o!=!!c,layer:this._internalGraphicsLayer,view:n,toolOptions:this._operationToolOptions,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`})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},v)),l}async _getReshape(e,t,n){let{highlightOptions:r,reshapeOptions:i}=t,a=i?.edgeOperation===`split`,o=i?.shapeOperation===`move`,s=!!i?.enableCreateCurveFromStraightEdge,c=await this._requireModule(import(`../../views/draw/support/Reshape.js`));return $(c)?c:new c.module.default({enableMidpoints:a,enableMovement:o,enableCurveOnMidpoint:s,graphic:e[0],highlightName:r?.name,highlightsEnabled:!!r?.enabled,layer:this._internalGraphicsLayer,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions,view:n,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:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMove:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMoveStop:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onVertexAdd:({added:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:r,vertices:n,type:t},type:`update`})},onVertexRemove:({removed:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{removed:r,vertices:n,type:t},type:`update`})}}})}_getHandlesForComponent(e,t){let n=e.activeComponent;if(!n)return[];switch(n.type){case`graphic-mover`:return[n.on(`graphic-click`,({graphic:n,viewEvent:r})=>{r.native?.shiftKey&&t.multipleSelectionEnabled&&(r.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(n)))}),n.on(`graphic-move-start`,t=>e.addToHistory(Z(t.allGraphics)))];case`box`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`rotate-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`scale-start`,t=>e.addToHistory(Z(t.graphics)))];case`reshape`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z([t.mover]))),n.on(`reshape-start`,t=>e.addToHistory(Z([t.graphic]))),n.on(`vertex-add`,t=>e.addToHistory(Z([t.oldGraphic]))),n.on(`vertex-remove`,t=>e.addToHistory(Z([t.oldGraphic])))];case`move-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`transform-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`reshape-3d`:return[n.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`})}),n.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`})}),n.events.on(`vertex-add`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`vertex-remove`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,n){let{graphic:r,viewEvent:i}=n;i.native?.shiftKey&&this.hasGraphic(r)?(i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(r))):t.toggleToolOnClick&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}async _replaceUpdateOperationHandle(e,t,n){let r=this._operationContext;e.onEnd(),e.destroy();let i=await this._updatingHandles.addPromise(n());return!i||$(i)||r!==this._operationContext?(i&&!$(i)&&(i.onEnd(),i.destroy()),this._destroyOperationContext(r),!1):(this._setUpdateOperationHandle(i,t),!0)}_setUpdateOperationHandle(e,t){this._operationHandle=e;let n=this.view?.map;this._disablePopup(t),e.on(`complete`,()=>{if(e===this._operationHandle){let r=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),n&&n.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit(`update`,{graphics:r,state:`complete`,aborted:e.cancelled,tool:i,toolEventInfo:null,type:`update`})}})}_getCommonUpdateOperationClickHandlers(e,t,n){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,n))}async _handleCommonUpdateOperationClick(e,t,n){let r=L(t),i=await t.defer(()=>this._getFirstHit(r));if(i==null){this.cancelUpdateOnClickAway&&e.complete();return}let a=t.native.shiftKey?this._toggleSelection([i.graphic],e,n):null;a?(t.stopPropagation(),await a):this.updateGraphics.includes(i.graphic)?this._shouldTemporarilyDisablePopup(n)&&t.stopPropagation():e.complete()}async _toggleSelection(e,t,n){let r=!!n.multipleSelectionEnabled;for(let n of e)if(n!=null&&r&&this.hasGraphic(n))return this.updateGraphics.includes(n)?await t.removeFromSelection(n):await t.addToSelection(n)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;let n=t.key;n===A.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):n===A.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):n===A.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&A.delete.includes(n)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&this._operationHandle.type===`update`&&this.activeComponent!=null&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&=(this.view?.map?.remove(this._internalGraphicsLayer),d(this._internalGraphicsLayer))}_isComponentGraphic(e){let{activeComponent:t}=this;return!e||t==null?!1:e.attributes?.esriSketchTool||t.type===`draw-2d`&&t.graphic===e||(t.type===`box`||t.type===`reshape`)&&t.isUIGraphic(e)}_clearCursor(){this.removeHandles(U)}_displayCursor(e){this.removeHandles(U),this.view?.container&&e!=null&&this.addHandles(this.view.acquireCursor(e,`high`),U)}_logError(e,t,n){u.getLogger(this).error(new i(e,t,n))}async _requireModule(e){let t=new AbortController;this._moduleLoaderAbortController=t;let n=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:`aborted`}:{module:n}}_emitUndoEvent(e){this.emit(`undo`,{...e,type:`undo`})}_emitRedoEvent(e){this.emit(`redo`,{...e,type:`redo`})}_emitDeleteEvent(e){this.emit(`delete`,{...e,type:`delete`})}_onLayerGraphicsChangeCallback(e){if(this._operationHandle!=null){let{updateGraphics:t}=this;for(let n of e.removed)if(t.includes(n)){if(t.length>1)this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(n));else{this._operationHandle.cancel();break}}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,n,r){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let i=this.view,a=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let o=await this.pluginManager.makeRenderer({customSymbol:n.graphicSymbol,useTextSymbol:r===`text`}),s=new a.DrawTool({view:i,elevationInfo:this._layerAdapter?.elevationInfo??pe(i.type===`3d`),hasZ:!!n.hasZ,toolOptions:this._operationToolOptions,renderer:o,defaultZ:n.defaultZ??0,directionOptions:n.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:r!==`rectangle`&&r!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});s.addHandles(l(o));let c=new t({...n.graphicProperties,attributes:{...n.graphicProperties?.attributes},symbol:n.graphicSymbol??this._getGraphicSymbolFromTool(r)});return n.graphicSymbol||s.addHandles(_(()=>this._getGraphicSymbolFromTool(r),e=>c.symbol=e)),this._set(`createGraphic`,c),i.addAndActivateTool(s),s.begin(e),s}get test(){}wait(){return y(()=>!this.updating)}_shouldTemporarilyDisablePopup(e){return this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){let e=this.view;e?(f(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await g(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(Re,K(`layer`))}};e([b()],G.prototype,`_defaultSnappingManager`,void 0),e([b()],G.prototype,`_operationContext`,void 0),e([b()],G.prototype,`_layerAdapter`,null),e([b()],G.prototype,`_pluginManager`,void 0),e([b({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([b()],G.prototype,`_operationHandle`,void 0),e([b({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([b({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([b()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([b({readOnly:!0})],G.prototype,`activeTool`,null),e([b()],G.prototype,`geometrySimplificationInProgress`,null),e([b({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([b()],G.prototype,`activeTooltip`,null),e([b({types:E})],G.prototype,`activeFillSymbol`,void 0),e([b()],G.prototype,`activeLineSymbol`,void 0),e([b()],G.prototype,`activeVertexSymbol`,void 0),e([b()],G.prototype,`allowDeleteKey`,void 0),e([b({readOnly:!0})],G.prototype,`createGraphic`,null),e([b()],G.prototype,`defaultCreateOptions`,null),e([b()],G.prototype,`defaultUpdateOptions`,null),e([b()],G.prototype,`activeUpdateOptions`,void 0),e([b({type:M,nonNullable:!0})],G.prototype,`labelOptions`,null),e([b()],G.prototype,`layer`,void 0),e([b({types:E})],G.prototype,`pointSymbol`,void 0),e([b({types:E})],G.prototype,`polygonSymbol`,void 0),e([b({types:E})],G.prototype,`polylineSymbol`,void 0),e([b()],G.prototype,`meshSymbol`,void 0),e([b({type:T})],G.prototype,`textSymbol`,null),e([b({type:F,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([b()],G.prototype,`snappingManager`,null),e([b({readOnly:!0})],G.prototype,`state`,null),e([b()],G.prototype,`toolTransitionInProgress`,null),e([b({type:Se,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([b({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([b()],G.prototype,`updateOnGraphicClick`,void 0),e([b()],G.prototype,`useViewOptions`,void 0),e([b()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([b()],G.prototype,`updating`,null),e([b()],G.prototype,`creationMode`,void 0),e([b({type:Ce,nonNullable:!0})],G.prototype,`valueOptions`,null),e([b({types:E})],G.prototype,`vertexSymbol`,void 0),e([b({value:null})],G.prototype,`view`,null),e([b({constructOnly:!0,type:N})],G.prototype,`sketchOptions`,void 0),e([b()],G.prototype,`useLegacyCreateTools`,void 0),e([b()],G.prototype,`isUsingLegacyCreateTools`,null),e([b()],G.prototype,`pluginManager`,null),e([b()],G.prototype,`drawTool`,null),e([b()],G.prototype,`activePluginConfigurations`,null),e([b()],G.prototype,`rootPlugins`,null),e([b()],G.prototype,`effectiveAvailablePlugins`,null),e([b()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([b()],G.prototype,`multiplePluginsActive`,null),G=e([re(`esri.widgets.Sketch.SketchViewModel`)],G);const Re=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function ze(e){return e===`polygon`||e===`rectangle`||e===`circle`}function q(e,t){Y(`undo`,e.history.undo,e.history.redo,t)}function J(e,t){Y(`redo`,e.history.redo,e.history.undo,t)}function Y(e,t,n,r){let i=t.pop();if(!i)return;let a=i.updates,o=[];r.forEach((t,n)=>{let r=a[n];r!=null&&(`geometry`in r&&r.geometry!=null&&(o.push({geometry:t.geometry}),t.geometry=r.geometry),`symbol`in r&&r.symbol!=null&&(o.push({symbol:t.symbol}),t.symbol=r.symbol),`undo`in r&&(o.push(r),r[e](t)))}),n.push({updates:o})}function X(e,t){e!=null&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Z(e){return{updates:e.map(({geometry:e})=>e?.type===`mesh`?{geometry:e.cloneShallow()}:{geometry:e})}}function Q(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function $(e){return`requireError`in e&&e.requireError===`aborted`}export{G as default};
2
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as n}from"../../core/arrayUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as a}from"../../core/Evented.js";import{handlesGroup as o,makeHandle as s,drainHandles as c,destroyHandle as l}from"../../core/handleUtils.js";import has from"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as d,abortMaybe as f,removeMaybe as p}from"../../core/maybe.js";import{createAbortError as m,ignoreAbortErrors as h,whenOrAbort as g}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as v,on as ee,when as te,sync as ne,whenOnce as y}from"../../core/reactiveUtils.js";import{property as b,subclass as re}from"../../core/accessorSupport/decorators.js";import{trackAccess as x}from"../../core/accessorSupport/tracking.js";import{SimpleObservable as ie}from"../../core/accessorSupport/tracking/SimpleObservable.js";import{UpdatingHandles as S}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as ae}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as oe,isLoaded as se,load as ce,project as le}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as ue}from"../../geometry/support/spatialReferenceUtils.js";import de from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as fe}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as pe}from"../../support/elevationInfoUtils.js";import me from"../../symbols/FillSymbol3DLayer.js";import he from"../../symbols/MeshSymbol3D.js";import ge from"../../symbols/SimpleFillSymbol.js";import _e from"../../symbols/SimpleLineSymbol.js";import w from"../../symbols/SimpleMarkerSymbol.js";import T from"../../symbols/TextSymbol.js";import{symbolTypes as E}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as ve}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as ye}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as be}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as O}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as k}from"../../views/input/InputManager.js";import{sketchKeys as A}from"../../views/interactive/keybindings.js";import{bindViewToolOptions as xe}from"../../views/interactive/options/bindViewToolOptions.js";import j from"../../views/interactive/options/InteractiveToolOptions.js";import M from"../../views/interactive/sketch/SketchLabelOptions.js";import N from"../../views/interactive/sketch/SketchOptions.js";import Se from"../../views/interactive/sketch/SketchTooltipOptions.js";import Ce from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as P}from"../../views/interactive/snapping/SnappingManager.js";import{acquireForViewOptions as we}from"../../views/interactive/snapping/SnappingManagerPool.js";import F from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as I}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as Te}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as Ee}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as De}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as L}from"../../views/support/screenUtils.js";import Oe from"./adapters/layer/GraphicsLayerAdapter.js";import ke from"./adapters/layer/MapNotesLayerAdapter.js";import Ae from"./adapters/layer/SketchLayerAdapter.js";import{CreateOperationHandle as je,DrawToolOperationHandle as Me,UpdateOperationHandle as R}from"./support/OperationHandle.js";import{PluginManager as Ne}from"./support/PluginManager.js";import{SettingsManager as Pe}from"./support/SettingsManager.js";import{getLegacyTool as z,isCompletelyDegenerate as Fe,graphicsHaveTooFewVerticesForBox as B,getModeFromCreateOptions as Ie,getDrawToolGeometryTypeFromCreateTool as Le}from"./support/sketchUtils.js";const V={defaultZ:0},H={reshapeOptions:{edgeOperation:`split`,shapeOperation:`move`,vertexOperation:`move`,enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Ee},tool:`transform`},U=Symbol(),W=Symbol();let G=class extends a{constructor(e){super(e),this._defaultSnappingManager=null,this._operationContext=null,this._internalGraphicsLayer=new de({listMode:`hide`,internal:!0,title:`SVM Internal`}),this._pluginManager=new Ne({sketchViewModel:this}),this.settingsManager=new Pe({availablePlugins:()=>this.pluginManager.visiblePluginsFlat}),this._operationHandle=null,this._updatingHandles=new S,this._toolTransitionHandles=new S,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new Te,this._viewHandlesKey=`viewHandles`,this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new ge({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new _e({color:[130,130,130,1],width:2}),this.meshSymbol=new he({symbolLayers:new r([new me])}),this.updateGraphics=new r,this.updateOnGraphicClick=!0,this.useViewOptions=!1,this.cancelUpdateOnClickAway=!0,this.creationMode=`single`,this.vertexSymbol=new w({style:`circle`,size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new N,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{let{_layerAdapter:e}=this;if(this.removeHandles(W),!e)return;let t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},v)].filter(n);this.addHandles(t,W)},this._originalPopupEnabled=null,this.defaultCreateOptions=V,this.defaultUpdateOptions=H,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new F,this.textSymbol=new T({text:`text`})}initialize(){this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([ee(()=>this.view?.map?.layers,`change`,e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),v),_(()=>this.view,e=>{this._defaultSnappingManager=d(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new P({view:e,options:this.snappingOptions})),e.type===`2d`?(import(`../../views/2d/interactive/editingTools.js`),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())):e.type===`3d`&&(import(`../../views/3d/interactive/editingTools.js`),import(`../../views/3d/layers/GraphicsLayerView3D.js`)))},v),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),I(this,void 0,()=>this._operationSnappingManager?.options??this.snappingOptions)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=d(this._defaultSnappingManager),this._destroyOperationContext(),this._set(`snappingManager`,null),this._set(`view`,null),this._updatingHandles.destroy(),this._toolTransitionHandles.destroy(),this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit(`destroy`)}get _operationSnappingManager(){return this._operationContext?.snappingManager??this.snappingManager}get _operationToolOptions(){return this._operationContext?.toolOptions??this.sketchOptions}get _layerAdapter(){let{layer:e}=this;switch(e?.type){case`graphics`:return new Oe(e);case`map-notes`:return new ke(e);case`sketch`:return new Ae(e);case void 0:default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){let e=this._operationHandle;if(e?.type===`create`&&e.activeComponent&&`mode`in e.activeComponent)return e.activeComponent.mode;if(e?.activeComponent?.type===`draw-2.0`){let t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(n).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){let{activeComponent:e,destroyed:t}=this,n=!t&&e&&`tooltip`in e?e.tooltip:null;return n?.visible?n:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return this.activeComponent!=null&&(this.activeComponent.type===`draw-3d`||this.activeComponent.type===`draw-2d`)?this.activeComponent.graphic:this._get(`createGraphic`)}get defaultCreateOptions(){return this._get(`defaultCreateOptions`)}set defaultCreateOptions(e){this._set(`defaultCreateOptions`,{...V,...e})}get defaultUpdateOptions(){return this._get(`defaultUpdateOptions`)}set defaultUpdateOptions(e){this._set(`defaultUpdateOptions`,{...H,...e,reshapeOptions:{...H.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...H.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get(`textSymbol`)}set textSymbol(e){this._set(`textSymbol`,e)}get snappingOptions(){return this.snappingManager?.options??this._get(`snappingOptions`)}set snappingOptions(e){this._defaultSnappingManager!=null&&(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=d(this._defaultSnappingManager)),this._override(`snappingManager`,e);else{let{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new P({options:this.snappingOptions,view:e})),this._clearOverride(`snappingManager`)}}get state(){let e=!!(this.view?.ready&&this.layer),t=this._operationHandle;return e&&t?`active`:e?`ready`:`disabled`}get toolTransitionInProgress(){return this._toolTransitionHandles.updating||!!this.drawTool?.lifecycleManager.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.toolTransitionInProgress||this.activeComponent&&`updating`in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this._operationSnappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get(`view`)}set view(e){let t=this._get(`view`);if(t===e)return;if(t){let{container:e,map:n}=t;e&&this._clearCursor(),n?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}let n=`view-ready`;this.removeHandles(n),e&&this.addHandles(te(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},v),n),this._set(`view`,e),this._updatingHandles.consumePromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get pluginManager(){return this._pluginManager}get drawTool(){return this.activeComponent?.type===`draw-2.0`?this.activeComponent:null}get activePluginConfigurations(){return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).filter(n)??[]}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome(`rootPlugins`,e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;let e=this.view?.type??`2d`,{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(n)??[]}get firstPluginWithSwappableLeaf(){let e=this.view?.type??`2d`;return this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>t!=null&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1)}get multiplePluginsActive(){return this.drawTool?this.drawTool.pluginStack.length>1:!1}replaceLeaf(e){this.drawTool?.replaceLeaf(e)}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=f(this._moduleLoaderAbortController),this._viewReadyAbortController=f(this._viewReadyAbortController),this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){let{state:e,updateGraphics:t}=this;if(e===`active`&&t.length){let{activeTool:e}=this,n=t.toArray();this.removeGraphics(n),this.cancel(),this._emitDeleteEvent({graphics:n,tool:e})}}duplicate(){if(this.state===`active`&&this.updateGraphics.length){let e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit(`duplicate`,{graphics:e,type:`duplicate`}),e}return[]}async create(e,t){return this._toolTransitionHandles.addPromise(this._create(e,t))}async _create(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{view:n,layer:r}=this;if(!n||this.state===`disabled`)throw r||this._logMissingLayer(),m();if(n.activeTool!=null&&(n.activeTool=null),!e){this._logError(`sketch:missing-parameter`,`Missing parameter 'tool'.`);return}O(n,this._internalGraphicsLayer);let i=this._createOperationContext(n),a;try{a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t))}catch(e){throw this._destroyOperationContext(i),e}if(a==null||this.destroyed||i!==this._operationContext){let e=i===this._operationContext;a?.onEnd(),d(a),this._destroyOperationContext(i),e&&n.map?.remove(this._internalGraphicsLayer);return}let o=z(e);a.on(`complete`,()=>{if(a===this._operationHandle){let n=this.createGraphic,r=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._set(`createGraphic`,null),this.view?.map?.remove(this._internalGraphicsLayer),!a.cancelled&&n!=null&&this.addGraphic(n),this._sketchContinuationFlag=!1,this.emit(`create`,{graphic:n,state:r?`cancel`:`complete`,tool:o??`point`,toolEventInfo:null,type:`create`}),r||this._sketchContinuationFlag)return;let{creationMode:i}=this;if(i===`continuous`){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(h(this.create(e,t)))}else i===`update`&&n&&this._updatingHandles.consumePromise(h(this.update([n])))}}),this._operationHandle=a,n.ready&&n.focus()}async place(e,t){return await e.load(),this.create(`mesh`,{mode:`click`,hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){return this._toolTransitionHandles.addPromise(this._update(e,t))}async _update(e,t){this.cancel(),await this._updatingHandles.addPromise(this._waitViewReady());let{layer:n,view:r,state:i}=this;if(!r||i===`disabled`)throw n||this._logMissingLayer(),m();r.activeTool!=null&&(r.activeTool=null);let a=Array.isArray(e)?e:[e];if(e==null||!a?.length){this._logError(`sketch:missing-parameter`,`Missing parameter 'graphics'.`);return}if(a.some(e=>this.hasGraphic(e)?e.geometry==null&&(this._logError(`sketch:invalid-parameter`,`Parameter 'graphics' contains one or more graphics with an unsupported geometry.`),!0):(this._logError(`sketch:invalid-parameter`,`Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer.`),!0)))return;let o=this._createOperationContext(r),s;try{s=await this._updatingHandles.addPromise(this._setupUpdateOperation(a,t))}catch(e){throw this._destroyOperationContext(o),e}this.destroyed||s==null||$(s)||o!==this._operationContext?(s&&!$(s)&&(s.onEnd(),s.destroy()),this._destroyOperationContext(o)):(O(r,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit(`update`,{graphics:a,state:`start`,aborted:!1,tool:s.tool,toolEventInfo:null,type:`update`}))}async _updateSpatialReference(e){let t=this.view;if(!t)this._logMissingView();else{e=Array.isArray(e)?e:[e];for(let n of e)n.geometry!=null&&n.geometry.type!==`mesh`&&!ue(n.geometry.spatialReference,t.spatialReference)&&(!oe(n.geometry.spatialReference,t.spatialReference)&&!se()&&await ce(),n.geometry=le(n.geometry,t.spatialReference))}}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._updatingHandles.consumePromise(this._operationHandle?.toggleTool())}_createOperationContext(e){this._destroyOperationContext();let t=this.useViewOptions?e.options:null,n=t?we(e):null,r=t?new j:this.sketchOptions,i;if(t){let{values:t}=r;i=o([xe(r,()=>e.options,()=>this.sketchOptions),_(()=>t.directionMode,e=>{this.sketchOptions.values.directionMode=e},ne)])}return this._operationContext={snappingManager:n?.snappingManager??this.snappingManager,toolOptions:r,...o([n,i])}}_destroyOperationContext(e=this._operationContext){e===this._operationContext?this._operationContext=p(this._operationContext):p(e)}async _getFirstHit(e){let t=this.view;if(!t)return this._logMissingView(),null;if(t.type===`2d`){let n=[];t.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});return De(r.results)}let n=[t.map.ground];t.map.allLayers.forEach(e=>{fe(e)&&(!has(`enable-feature:im-as-ground`)||e.isUsedAsGroundLayer)&&n.push(e)});let r=await t.hitTest(e,{exclude:n});if(r.results.length>0){let e=r.results[0];if(e!=null&&e.type===`graphic`&&e.graphic&&(!r.ground.mapPoint||t.map.ground.opacity<1||r.ground.distance-(e.distance??0)>-Math.min(3*r.ground.distance,t.viewingMode===`global`?ae(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:1/0)))return e}return null}_generateViewHandles(e){return[e.on(`immediate-click`,async e=>{let t=this.state===`active`&&this._operationHandle?.type===`create`;this.state!==`disabled`&&!t&&this.updateOnGraphicClick&&await this._toolTransitionHandles.addPromise(this._handleImmediateClick(e))},k.WIDGET)]}async _handleImmediateClick(e){let t=await e.defer(()=>this._getFirstHit(L(e))),n=null;if(t!=null){let r=t.graphic;this.updateGraphics.includes(r)||this.hasGraphic(r)?(e.stopPropagation(),n=r):this.view?.type===`2d`&&!this._isComponentGraphic(r)&&this.state===`active`&&this.cancel()}else this.state===`active`&&this.cancelUpdateOnClickAway&&this.cancel();n!=null&&!this.updateGraphics.includes(n)&&await this.update([n],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r={hasZ:n.type===`3d`,...this.defaultCreateOptions,...t},i=typeof e==`string`?this.pluginManager?.getPluginsEquivalentToCreateTool(e,r):e,a=z(e);if(i&&!this.isUsingLegacyCreateTools){let e=await this._setupDrawTool(i,r,a??`polyline`);if(e)return this._setupDrawToolOperationHandle(e,a??`point`)}if(!a)return null;let o=await this._setupDrawGraphicTool(a,n,r);return o==null?null:(n.tools.add(o),n.activeTool=o,this._setupCreateOperationHandle(o,a))}async _setupDrawGraphicTool(e,t,n){if(e===`multipoint`&&t.type===`3d`)return this._logError(`sketch:create`,`Multipoint geometries are not supported in SceneView.`),null;if(!t)return this._logMissingView(),null;let{cursor:r,defaultZ:i,hasZ:a,geometryToPlace:o,graphicProperties:s,mode:c,preserveAspectRatio:l}=n,u=Ie(c,e),d=Le(e),f=n?.optionsPerTool?.has(e)?n.optionsPerTool.get(e):{},p=f?.preserveAspectRatio??l??e!==`rectangle`,m={centered:e!==`rectangle`&&!(e===`circle`&&!p),cursor:r,defaultZ:i,forceUniformSize:p,graphicProperties:{...s,attributes:{...s?.attributes}},geometryToPlace:o,geometryType:d,mode:u,graphicSymbol:n.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:a,snappingManager:this._operationSnappingManager,snapToScene:!1,view:t,...f};return t.type===`2d`?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){let t=await this._requireModule(import(`../../views/2d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ze(e.geometryType)?this.activeFillSymbol:null,toolOptions:this._operationToolOptions})}async _makeDrawGraphicTool3D(e){let t=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));return $(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,toolOptions:this._operationToolOptions})}_setupCreateOperationHandle(e,t){let n=this.view;if(!n)return this._logMissingView(),null;let r=null,i=e.forceUniformSize,a=e.centered,o=new ie,l=[s(()=>o.destroy()),n.on(`key-down`,t=>{if(t.key===A.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===A.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key===A.vertexAdd&&!t.repeat){let n=e.drawOperation.geometryType;(n===`polyline`||n===`polygon`||n===`multipoint`)&&(t.stopPropagation(),e.drawOperation.commitStagedVertex())}else t.key===A.undo?(t.stopPropagation(),u.undo()):t.key===A.redo?(t.stopPropagation(),u.redo()):t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)&&!t.repeat?(e.forceUniformSize=!i,t.stopPropagation()):t.key===A.center&&(t.repeat||(e.centered=!a,t.stopPropagation()))},k.WIDGET),n.on(`key-up`,t=>{t.key===A.pan?e.enabled=!0:t.key===A.constraint&&(e.geometryType===`rectangle`||e.geometryType===`circle`)?(e.forceUniformSize=i,t.stopPropagation()):t.key===A.center&&(e.centered=a,t.stopPropagation())},k.WIDGET),e.on(`vertex-update`,()=>{o.notify()}),e.on(`vertex-add`,t=>{switch(o.notify(),r=r==null?`start`:`active`,t.operation){case`apply`:this.emit(`create`,{graphic:e.graphic,state:r,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(o.notify(),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),r=`complete`,e.aborted?u&&u.cancel():u&&u.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],u=new je({activeComponent:e,type:`create`,onEnd:()=>{c(l),n.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>(x(o),e.canUndo),canRedo:()=>(x(o),e.canRedo)});return u}_setupDrawToolOperationHandle(e,t){let r=this.view;if(!r)return this._logMissingView(),null;let i=null,a=[r.on(`key-down`,t=>{t.key===A.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},k.WIDGET),r.on(`key-up`,t=>{t.key===A.pan&&(e.editable=!0)},k.WIDGET),e.on(`before-vertex-add`,t=>{let n=e.mostUpstreamPlugin?.configuration;if(n&&`legacyCreateTool`in n&&(n?.legacyCreateTool===`point`||n.legacyCreateTool===`text`)){let e=t.detail.originalEvent;e&&`key`in e&&e.key===A.vertexAdd&&t.preventDefault()}}),e.on(`before-complete`,t=>{let n=e.getGeometryIfCompleted();(!n||Fe(n))&&t.preventDefault()}),e.on([`vertex-add`,`vertex-remove`],r=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),i=i==null&&r.type!==`vertex-remove`?`start`:`active`,r.operation){case`apply`:this.emit(`create`,{graphic:this.createGraphic,state:i,tool:this.activeTool,toolEventInfo:r,type:`create`});break;case`undo`:this._emitUndoEvent({graphics:[this.createGraphic].filter(n),tool:t});break;case`redo`:this._emitRedoEvent({graphics:[this.createGraphic].filter(n),tool:t})}}),e.on(`cursor-update`,t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit(`create`,{graphic:this.createGraphic,state:`active`,tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:`cursor-update`},type:`create`})}),e.on(`complete`,async({geometry:t,isSimple:n})=>{let r=this.createGraphic,i=!!t&&t.type!==`mesh`&&t.type!==`extent`&&!n;if(r&&(r.geometry=n?t:e.unprocessedGeometry??t),!i||!r)o.complete();else{this._internalGraphicsLayer.add(this.createGraphic);let e=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=e,await this._updatingHandles.addPromise(h(this._finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:r,handle:o})))}})],o=new Me({activeComponent:e,type:`create`,onEnd:()=>{c(a),r.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a.push(e.on(`cancel`,()=>{this._drawToolSimplifyAbortController=f(this._drawToolSimplifyAbortController),o.cancel()})),o}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:n,handle:r}){let i=this.view?.acquireCursor(`progress`,`high`);i&&this.addHandles(i);let a=()=>e.signal.aborted?(n&&(this._layerAdapter?.remove(n),this._internalGraphicsLayer?.remove(n)),this._set(`createGraphic`,null),!0):!1;try{let i=await this._geometryWorkerHandle.simplify(t,e.signal);if(a())return;n.geometry=i??t,this._internalGraphicsLayer?.remove(n),r.complete()}finally{i?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_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;case`text`:return this.textSymbol}}async _setupUpdateOperation(e,t){let{view:n}=this;if(!n)return this._logMissingView(),null;let r={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=r;let i=r.tool??H.tool;if(this.removeGraphics(e),this.addGraphics(e),n.type===`3d`){if(e.length===0)return null;switch(i){case`move`:return this._setupMove3DOperation(e,r,n,i);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupReshape3DOperation(e[0],r,n);case`transform`:return this._setupGraphicTransform3DOperation(e,r,n)}}switch(i){case`move`:return this._setupMove2DOperation(e,r,n);case`reshape`:return e.length>1?(this._logError(`sketch:reshape-multiple`,`Reshape operation does not support multiple graphics.`),null):this._setupTransformOrReshape2DOperation(e,i,r,n);case`transform`:return B(e)&&(i=`reshape`),this._setupTransformOrReshape2DOperation(e,i,r,n)}}async _setupMove3DOperation(e,t,n,r,i=!1){let a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,MoveTool3D:s}=a.module,l=new Map,u=()=>{l.forEach(e=>e.destroy()),l.clear()};for(let t of e){let e=new o({view:n,graphic:t}),r=ve(e);if(r!==0)return u(),this._logError(`sketch:move`,`Move operation not supported for provided graphic(s) (${D(r)}).`),null;l.set(t,e)}let d=new s({view:n,enableZ:t.enableZ,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(d),d.objects.addMany(Array.from(l.values())),i||this.updateGraphics.addMany(e);let f=[],p=new R({activeComponent:d,tool:r,type:`update`,onEnd:()=>{c(f),Q(n,d),u()},undo:()=>{X(this.view,d),q(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},addToSelection:async e=>{this.updateGraphics.push(e);let t=new o({view:n,graphic:e});l.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:async e=>{let t=this.updateGraphics.indexOf(e);if(p.history.undo.forEach(e=>e.updates.splice(t,1)),p.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0){p.complete();return}let n=l.get(e);n&&(d.objects.remove(n),n.destroy(),l.delete(e))},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1||r!==`transform`)return;let e=this.updateGraphics.at(0),i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));i&&!$(i)&&(p.onEnd(),p.destroy(),this._setUpdateOperationHandle(i,t))}});return f.push(...this._getHandlesForComponent(p,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(p,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(p,e)},k.WIDGET)),p}_setupGraphicTransform3DOperation(e,t,n,r=!1){if(e.length===1&&be(e[0])===0){let i=e[0],a=i.geometry;if(a!=null&&(a.type===`point`||a.type===`mesh`))return this._setupPointTransform3DOperation(i,t,n);if(a!=null&&(a.type===`polygon`||a.type===`polyline`))return this._setupPolyTransform3DOperation(i,t,n,r)}return this._setupMove3DOperation(e,t,n,`transform`,r)}async _setupPointTransform3DOperation(e,t,n){let r=`transform`,{enableRotation:i,enableScaling:a,enableZ:o}=t,s=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(s))return s;let{TransformTool3D:l,ManipulatedObject3DGraphic:u}=s.module,d=new u({graphic:e,view:n}),f=new l({object:d,view:n,enableRotation:i,enableScaling:a,enableZ:o,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),this.updateGraphics.add(e);let p=[],m=new R({activeComponent:f,tool:r,type:`update`,onEnd:()=>{c(p),Q(n,f),d.destroy()},undo:()=>{X(this.view,f),q(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r})},redo:()=>{J(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r})},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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,n,r=!1){let i=`transform`,{enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:l}=t,u=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(u))return u;let{ManipulatedObject3DGraphic:d,ExtentTransformTool:f}=u.module,p=this.view?.inputManager?.isModifierKeyDown(A.constraint),m=new d({view:n,graphic:e}),h=new f({object:m,view:n,enableRotation:a,enableScaling:o,enableZ:s,preserveAspectRatio:!!l!=!!p,toolOptions:this._operationToolOptions});n.tools.add(h),r||this.updateGraphics.add(e);let g=[],_=new R({activeComponent:h,tool:i,type:`update`,onEnd:()=>{c(g),Q(n,h),m.destroy()},canUndo:()=>!h.destroyed&&h.canUndo,undo:()=>{h.destroyed||(h.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!h.destroyed&&h.canRedo,redo:()=>{h.destroyed||(h.redo(),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`}),await this._replaceUpdateOperationHandle(_,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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`}),_.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||t.toggleToolOnClick===!1)return;let r=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,n,!0));r&&!$(r)&&(_.onEnd(),_.destroy(),this._setUpdateOperationHandle(r,t))}});return g.push(...this._getHandlesForComponent(_,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(_,e,t),k.WIDGET),n.on(`key-down`,e=>this._getCommonUpdateOperationKeyDownHandlers(_,e),k.WIDGET),n.on(`key-down`,e=>{e.key===A.constraint&&!e.repeat&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&(h.preserveAspectRatio=!h.preserveAspectRatio,e.stopPropagation())},k.WIDGET)),_}async _setupMove2DOperation(e,t,n){let r=`move`;this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,n));if($(i))return i;let a=new R({activeComponent:i,tool:r,type:`update`,onEnd:()=>{this._clearCursor(),c(l),c(s),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{let e=this.updateGraphics.toArray();q(a,e),a.refreshComponent(),this._emitUndoEvent({graphics:e,tool:r})},redo:()=>{let e=this.updateGraphics.toArray();J(a,e),a.refreshComponent(),this._emitRedoEvent({graphics:e,tool:r})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.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:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`}),this.updateGraphics.length===0?a.complete():i.graphics=n}}),o=!1,s=[n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&(o=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET),n.on(`key-up`,e=>{e.key===A.constraint&&o&&(o=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},k.WIDGET)],l=this._getHandlesForComponent(a,t);return a}async _setupReshape3DOperation(e,t,n,r=!1){let i=`reshape`,a=await this._requireModule(import(`../../views/3d/interactive/editingTools.js`));if($(a))return a;let{ManipulatedObject3DGraphic:o,ReshapeTool3D:s}=a.module,l=new o({view:n,graphic:e}),u=ye(l);if(u!==0)return l.destroy(),this._logError(`sketch:reshape`,`Reshape operation not supported for provided graphic(s) (${D(u)}).`),null;let d=t.reshapeOptions,f=new s({view:n,object:l,enableZVertex:t.enableZ&&d?.vertexOperation===`move`,enableZShape:t.enableZ&&d?.shapeOperation===`move`,enableMoveObject:d?.shapeOperation===`move`||d?.shapeOperation===`move-xy`,enableMidpoints:d?.edgeOperation===`split`,enableEdgeOffset:d?.edgeOperation===`offset`,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions});n.tools.add(f),r||this.updateGraphics.add(l.graphic);let p=[],m=new R({activeComponent:f,tool:i,type:`update`,onEnd:()=>{c(p),Q(n,f),l.destroy()},canUndo:()=>!f.destroyed&&f.canUndo,undo:()=>{f.destroyed||(f.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!f.destroyed&&f.canRedo,redo:()=>{f.destroyed||(f.redo(),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`}),await this._replaceUpdateOperationHandle(m,t,()=>this._setupMove3DOperation(this.updateGraphics.toArray(),t,n,`transform`,!0))},removeFromSelection:async 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:async()=>{t.toggleToolOnClick!==!1&&await this._replaceUpdateOperationHandle(m,t,()=>this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,n,!0))}});return p.push(...this._getHandlesForComponent(m,t),n.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(m,e,t),k.WIDGET),n.on(`key-down`,e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},k.WIDGET)),m}async _setupTransformOrReshape2DOperation(e,t,n,r){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));let i=await this._updatingHandles.addPromise(t===`transform`?this._getBox(e,n,r):this._getReshape(e,n,r));if($(i))return i;let a=new R({activeComponent:i,type:`update`,onEnd:()=>{c(s),c(o),a.activeComponent&&!a.activeComponent.destroyed&&a.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{q(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},redo:()=>{J(a,this.updateGraphics.toArray()),a.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a.tool})},addToSelection:async e=>{let t=a.activeComponent;if(t?.type===`reshape`){let t=[...this.updateGraphics,e];if(this.updateGraphics.removeAll(),!await this._replaceUpdateOperationHandle(a,n,()=>this._setupTransformOrReshape2DOperation(t,`transform`,n,r)))return}else this.updateGraphics.add(e),t=t,t.graphics=this.updateGraphics.toArray(),t.refresh(),a.resetHistory();this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:`selection-change`},type:`update`})},removeFromSelection:async e=>{let t=this.updateGraphics.indexOf(e);a.history.undo.forEach(e=>e.updates.splice(t,1)),a.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);let n=this.updateGraphics.toArray();n.length===0?a.complete():B(n)?await a.toggleTool():a.activeComponent.graphics=n,this.emit(`update`,{graphics:n,state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:`selection-change`},type:`update`})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;let e=this.updateGraphics.at(0),t=e.geometry;if(t!=null&&(a.tool===`reshape`&&t.type===`point`||a.tool===`transform`&&t.type===`extent`))return;let i=null,o={...this.defaultUpdateOptions,...n,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...n?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...n?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};a.tool===`transform`?i=await this._updatingHandles.addPromise(this._getReshape([e],o,r)):a.tool===`reshape`&&(i=await this._updatingHandles.addPromise(this._getBox([e],o,r))),$(i)||(a.activeComponent?.destroy(),a.activeComponent=i,a.activeComponent&&(c(s),s=this._getHandlesForComponent(a,o)))}}),o=[r.on(`immediate-click`,e=>this._getCommonUpdateOperationClickHandlers(a,e,n),k.WIDGET),r.on(`key-down`,e=>{if(this._getCommonUpdateOperationKeyDownHandlers(a,e),e.key===A.constraint&&!e.repeat&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET),r.on(`key-up`,e=>{if(e.key===A.constraint&&a){let e=a.activeComponent;e?.type===`box`&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},k.WIDGET)],s=this._getHandlesForComponent(a,n);return a}async _getGraphicMover(e,t,n){let{enableMoveAllGraphics:r,highlightOptions:i}=t,a=await this._requireModule(import(`../../views/draw/support/GraphicMover.js`));return $(a)?a:new a.module.default({enableMoveAllGraphics:r,highlightName:i?.name,highlightsEnabled:!!i?.enabled,indicatorsEnabled:!1,graphics:e,view:n,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`grabbing`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-start`},type:`update`})},onGraphicMove:({dx:e,dy:t,graphic:n})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move`},type:`update`}),onGraphicMoveStop:({dx:e,dy:t,graphic:n})=>{this._displayCursor(`pointer`),this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:`move-stop`},type:`update`})},onGraphicPointerOver:()=>this._displayCursor(`move`),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,n){let{enableRotation:r,enableScaling:i,highlightOptions:a,preserveAspectRatio:o}=t,s=await this._requireModule(import(`../../views/draw/support/Box.js`));if($(s))return s;let c=this.view?.inputManager?.isModifierKeyDown(A.constraint),l=new s.module.default({graphics:e,enableRotation:r,enableScaling:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,preserveAspectRatio:!!o!=!!c,layer:this._internalGraphicsLayer,view:n,toolOptions:this._operationToolOptions,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`})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,n])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=n??t.enableScaling??!0,l.refresh()},v)),l}async _getReshape(e,t,n){let{highlightOptions:r,reshapeOptions:i}=t,a=i?.edgeOperation===`split`,o=i?.shapeOperation===`move`,s=!!i?.enableCreateCurveFromStraightEdge,c=await this._requireModule(import(`../../views/draw/support/Reshape.js`));return $(c)?c:new c.module.default({enableMidpoints:a,enableMovement:o,enableCurveOnMidpoint:s,graphic:e[0],highlightName:r?.name,highlightsEnabled:!!r?.enabled,layer:this._internalGraphicsLayer,snappingManager:this._operationSnappingManager,toolOptions:this._operationToolOptions,view:n,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:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMove:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onMoveStop:({dx:e,dy:t,mover:n,type:r})=>this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:n,type:r},type:`update`}),onVertexAdd:({added:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{added:r,vertices:n,type:t},type:`update`})},onVertexRemove:({removed:e,type:t,vertices:n})=>{let r=e.map(e=>C(e.geometry));this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:{removed:r,vertices:n,type:t},type:`update`})}}})}_getHandlesForComponent(e,t){let n=e.activeComponent;if(!n)return[];switch(n.type){case`graphic-mover`:return[n.on(`graphic-click`,({graphic:n,viewEvent:r})=>{r.native?.shiftKey&&t.multipleSelectionEnabled&&(r.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(n)))}),n.on(`graphic-move-start`,t=>e.addToHistory(Z(t.allGraphics)))];case`box`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`rotate-start`,t=>e.addToHistory(Z(t.graphics))),n.on(`scale-start`,t=>e.addToHistory(Z(t.graphics)))];case`reshape`:return[n.on(`graphic-click`,n=>this._onTransformOrReshape2DGraphicClick(e,t,n)),n.on(`move-start`,t=>e.addToHistory(Z([t.mover]))),n.on(`reshape-start`,t=>e.addToHistory(Z([t.graphic]))),n.on(`vertex-add`,t=>e.addToHistory(Z([t.oldGraphic]))),n.on(`vertex-remove`,t=>e.addToHistory(Z([t.oldGraphic])))];case`move-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`transform-3d`:return[n.events.on(`record-undo`,({updates:t})=>{e.addToHistory({updates:t})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.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`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})];case`reshape-3d`:return[n.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`})}),n.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`})}),n.events.on(`vertex-add`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`vertex-remove`,e=>{this.emit(`update`,{graphics:this.updateGraphics.toArray(),state:`active`,aborted:!1,tool:this.activeTool,toolEventInfo:e,type:`update`})}),n.events.on(`immediate-click`,n=>{this._updatingHandles.consumePromise(n.shiftKey?this._toggleSelection([n.object.graphic],e,t):e.toggleTool())})]}}_onTransformOrReshape2DGraphicClick(e,t,n){let{graphic:r,viewEvent:i}=n;i.native?.shiftKey&&this.hasGraphic(r)?(i.stopPropagation(),this._updatingHandles.consumePromise(e.removeFromSelection(r))):t.toggleToolOnClick&&(i.stopPropagation(),this._updatingHandles.consumePromise(e.toggleTool()))}async _replaceUpdateOperationHandle(e,t,n){let r=this._operationContext;e.onEnd(),e.destroy();let i=await this._updatingHandles.addPromise(n());return!i||$(i)||r!==this._operationContext?(i&&!$(i)&&(i.onEnd(),i.destroy()),this._destroyOperationContext(r),!1):(this._setUpdateOperationHandle(i,t),!0)}_setUpdateOperationHandle(e,t){this._operationHandle=e;let n=this.view?.map;this._disablePopup(t),e.on(`complete`,()=>{if(e===this._operationHandle){let r=this.updateGraphics.toArray(),i=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._destroyOperationContext(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),n&&n.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit(`update`,{graphics:r,state:`complete`,aborted:e.cancelled,tool:i,toolEventInfo:null,type:`update`})}})}_getCommonUpdateOperationClickHandlers(e,t,n){return this._updatingHandles.addPromise(this._handleCommonUpdateOperationClick(e,t,n))}async _handleCommonUpdateOperationClick(e,t,n){let r=L(t),i=await t.defer(()=>this._getFirstHit(r));if(i==null){this.cancelUpdateOnClickAway&&e.complete();return}let a=t.native.shiftKey?this._toggleSelection([i.graphic],e,n):null;a?(t.stopPropagation(),await a):this.updateGraphics.includes(i.graphic)?this._shouldTemporarilyDisablePopup(n)&&t.stopPropagation():e.complete()}async _toggleSelection(e,t,n){let r=!!n.multipleSelectionEnabled;for(let n of e)if(n!=null&&r&&this.hasGraphic(n))return this.updateGraphics.includes(n)?await t.removeFromSelection(n):await t.addToSelection(n)}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;let n=t.key;n===A.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):n===A.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):n===A.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&A.delete.includes(n)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&this._operationHandle.type===`update`&&this.activeComponent!=null&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&=(this.view?.map?.remove(this._internalGraphicsLayer),d(this._internalGraphicsLayer))}_isComponentGraphic(e){let{activeComponent:t}=this;return!e||t==null?!1:e.attributes?.esriSketchTool||t.type===`draw-2d`&&t.graphic===e||(t.type===`box`||t.type===`reshape`)&&t.isUIGraphic(e)}_clearCursor(){this.removeHandles(U)}_displayCursor(e){this.removeHandles(U),this.view?.container&&e!=null&&this.addHandles(this.view.acquireCursor(e,`high`),U)}_logError(e,t,n){u.getLogger(this).error(new i(e,t,n))}async _requireModule(e){let t=new AbortController;this._moduleLoaderAbortController=t;let n=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:`aborted`}:{module:n}}_emitUndoEvent(e){this.emit(`undo`,{...e,type:`undo`})}_emitRedoEvent(e){this.emit(`redo`,{...e,type:`redo`})}_emitDeleteEvent(e){this.emit(`delete`,{...e,type:`delete`})}_onLayerGraphicsChangeCallback(e){if(this._operationHandle!=null){let{updateGraphics:t}=this;for(let n of e.removed)if(t.includes(n)){if(t.length>1)this._updatingHandles.consumePromise(this._operationHandle.removeFromSelection(n));else{this._operationHandle.cancel();break}}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,n,r){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;let i=this.view,a=await import(`../../views/draw/DrawTool.js`);await this.pluginManager.loadPlugins();let o=await this.pluginManager.makeRenderer({customSymbol:n.graphicSymbol,useTextSymbol:r===`text`}),s=new a.DrawTool({view:i,elevationInfo:this._layerAdapter?.elevationInfo??pe(i.type===`3d`),hasZ:!!n.hasZ,toolOptions:this._operationToolOptions,renderer:o,defaultZ:n.defaultZ??0,directionOptions:n.directionOptions,snappingManager:this._operationSnappingManager,enableVertexVisuals:r!==`rectangle`&&r!==`circle`,readPluginSetting:(e,t)=>this.settingsManager.getValue(t)});s.addHandles(l(o));let c=new t({...n.graphicProperties,attributes:{...n.graphicProperties?.attributes},symbol:n.graphicSymbol??this._getGraphicSymbolFromTool(r)});return n.graphicSymbol||s.addHandles(_(()=>this._getGraphicSymbolFromTool(r),e=>c.symbol=e)),this._set(`createGraphic`,c),i.addAndActivateTool(s),s.begin(e),s}get test(){}wait(){return y(()=>!this.updating)}_shouldTemporarilyDisablePopup(e){return this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._shouldTemporarilyDisablePopup(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){let e=this.view;e?(f(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await g(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError(`sketch:missing-property`,K(`view`))}_logMissingLayer(){this._logError(Re,K(`layer`))}};e([b()],G.prototype,`_defaultSnappingManager`,void 0),e([b()],G.prototype,`_operationContext`,void 0),e([b()],G.prototype,`_layerAdapter`,null),e([b()],G.prototype,`_pluginManager`,void 0),e([b({readOnly:!0})],G.prototype,`settingsManager`,void 0),e([b()],G.prototype,`_operationHandle`,void 0),e([b({readOnly:!0})],G.prototype,`_updatingHandles`,void 0),e([b({readOnly:!0})],G.prototype,`_toolTransitionHandles`,void 0),e([b()],G.prototype,`_drawToolSimplifyAbortController`,void 0),e([b({readOnly:!0})],G.prototype,`activeTool`,null),e([b()],G.prototype,`geometrySimplificationInProgress`,null),e([b({readOnly:!0})],G.prototype,`activeCreateToolDrawMode`,null),e([b()],G.prototype,`activeTooltip`,null),e([b({types:E})],G.prototype,`activeFillSymbol`,void 0),e([b()],G.prototype,`activeLineSymbol`,void 0),e([b()],G.prototype,`activeVertexSymbol`,void 0),e([b()],G.prototype,`allowDeleteKey`,void 0),e([b({readOnly:!0})],G.prototype,`createGraphic`,null),e([b()],G.prototype,`defaultCreateOptions`,null),e([b()],G.prototype,`defaultUpdateOptions`,null),e([b()],G.prototype,`activeUpdateOptions`,void 0),e([b({type:M,nonNullable:!0})],G.prototype,`labelOptions`,null),e([b()],G.prototype,`layer`,void 0),e([b({types:E})],G.prototype,`pointSymbol`,void 0),e([b({types:E})],G.prototype,`polygonSymbol`,void 0),e([b({types:E})],G.prototype,`polylineSymbol`,void 0),e([b()],G.prototype,`meshSymbol`,void 0),e([b({type:T})],G.prototype,`textSymbol`,null),e([b({type:F,nonNullable:!0})],G.prototype,`snappingOptions`,null),e([b()],G.prototype,`snappingManager`,null),e([b({readOnly:!0})],G.prototype,`state`,null),e([b()],G.prototype,`toolTransitionInProgress`,null),e([b({type:Se,nonNullable:!0})],G.prototype,`tooltipOptions`,null),e([b({readOnly:!0})],G.prototype,`updateGraphics`,void 0),e([b()],G.prototype,`updateOnGraphicClick`,void 0),e([b()],G.prototype,`useViewOptions`,void 0),e([b()],G.prototype,`cancelUpdateOnClickAway`,void 0),e([b()],G.prototype,`updating`,null),e([b()],G.prototype,`creationMode`,void 0),e([b({type:Ce,nonNullable:!0})],G.prototype,`valueOptions`,null),e([b({types:E})],G.prototype,`vertexSymbol`,void 0),e([b({value:null})],G.prototype,`view`,null),e([b({constructOnly:!0,type:N})],G.prototype,`sketchOptions`,void 0),e([b()],G.prototype,`useLegacyCreateTools`,void 0),e([b()],G.prototype,`isUsingLegacyCreateTools`,null),e([b()],G.prototype,`pluginManager`,null),e([b()],G.prototype,`drawTool`,null),e([b()],G.prototype,`activePluginConfigurations`,null),e([b()],G.prototype,`rootPlugins`,null),e([b()],G.prototype,`effectiveAvailablePlugins`,null),e([b()],G.prototype,`firstPluginWithSwappableLeaf`,null),e([b()],G.prototype,`multiplePluginsActive`,null),G=e([re(`esri.widgets.Sketch.SketchViewModel`)],G);const Re=`sketch:missing-property`,K=e=>`Property '${e}' is missing on SketchViewModel.`;function ze(e){return e===`polygon`||e===`rectangle`||e===`circle`}function q(e,t){Y(`undo`,e.history.undo,e.history.redo,t)}function J(e,t){Y(`redo`,e.history.redo,e.history.undo,t)}function Y(e,t,n,r){let i=t.pop();if(!i)return;let a=i.updates,o=[];r.forEach((t,n)=>{let r=a[n];r!=null&&(`geometry`in r&&r.geometry!=null&&(o.push({geometry:t.geometry}),t.geometry=r.geometry),`symbol`in r&&r.symbol!=null&&(o.push({symbol:t.symbol}),t.symbol=r.symbol),`undo`in r&&(o.push(r),r[e](t)))}),n.push({updates:o})}function X(e,t){e!=null&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Z(e){return{updates:e.map(({geometry:e})=>e?.type===`mesh`?{geometry:e.cloneShallow()}:{geometry:e})}}function Q(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function $(e){return`requireError`in e&&e.requireError===`aborted`}export{G as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{handlesGroup as i}from"../../../core/handleUtils.js";import a from"../../../core/Logger.js";import{throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{freehandSnappingEnabledSettingKey as u,bezierEnableSplineBehaviorSettingKey as d}from"../../../views/draw/support/types.js";let f=class extends t{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _freehandPluginSettings(){return{[u]:{titleLocalizationKey:`settings.freehandSnappingEnabledTitle`,descriptionLocalizationKey:`settings.freehandSnappingEnabledDescription`,type:`toggle`,default:!0}}}get _simplePointPlugin(){let e=Symbol.for(`esri-builtin-plugin-leaf-point`);return{uniqueId:e,localizationKey:`leaf-point-segment`,kind:[`vertex`],geometryType:`point`,icon:`line-straight`,legacyCreateTool:`point`,create:()=>this._createPlugin(e),[Symbol.toStringTag]:`Point`}}get _hybridSegmentPlugin(){let e=Symbol.for(`esri-builtin-plugin-freehand`);return{...this._simplePointPlugin,create:()=>{let t=this._createPlugin(e);return t.completeOnDragEnd=!0,t.snappingBehavior=`when-not-capturing`,t},settings:this._freehandPluginSettings,[Symbol.toStringTag]:`Hybrid Segment`}}get _pointLikeFreehandSegmentPlugin(){let e=Symbol.for(`esri-builtin-plugin-freehand`);return{...this._simplePointPlugin,create:()=>{let t=this._createPlugin(e);return t.completeOnDragEnd=!0,t.snappingBehavior=`when-not-capturing`,t},settings:this._freehandPluginSettings,[Symbol.toStringTag]:`Freehand Segment`}}get _effectiveConfiguredDrawingMode(){return this.sketchViewModel?.defaultCreateOptions?.mode??`click`}get _effectivePointLikePlugin(){switch(this._effectiveConfiguredDrawingMode){case`hybrid`:return this._hybridSegmentPlugin;case`freehand`:return this._pointLikeFreehandSegmentPlugin;default:return this._simplePointPlugin}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:`pin`,localizationKey:`root-point`,create:()=>{let e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){let e=Symbol.for(`esri-builtin-plugin-text-point`);return{uniqueId:e,localizationKey:`root-text`,kind:[`vertex`],geometryType:`point`,icon:`text`,legacyCreateTool:`text`,create:()=>this._createPlugin(e),[Symbol.toStringTag]:`Text`}}get _multipointPlugin(){let e={...this._simplePointPlugin,localizationKey:`leaf-point`,icon:`point`,hidden:!0},t=Symbol.for(`esri-builtin-plugin-multipoint`);return{uniqueId:t,localizationKey:`root-multipoint`,kind:[`part`],geometryType:`multipoint`,icon:`pins`,legacyCreateTool:`multipoint`,excludedViews:[`3d`],create:()=>this._createPlugin(t),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:`Multipoint`}}get _freehandPlugin(){let e=Symbol.for(`esri-builtin-plugin-freehand`);return{uniqueId:e,localizationKey:`leaf-stream`,kind:[`vertex`,`section`,`part`],geometryType:`polyline`,icon:`freehand`,legacyCreateTool:`freehandPolyline`,create:()=>{let t=this._createPlugin(e);return t.completeOnDragEnd=!0,t.snappingBehavior=`when-not-capturing`,t},settings:this._freehandPluginSettings,[Symbol.toStringTag]:`Freehand`}}get _bezierPlugin(){let e=Symbol.for(`esri-builtin-plugin-bezier-segment`);return{uniqueId:e,localizationKey:`leaf-bezier`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`cubic-bezier`],icon:`bezier-curve`,excludedViews:[`3d`],create:()=>this._createPlugin(e),settings:{[d]:{titleLocalizationKey:`settings.bezierEnableSplineBehaviorTitle`,descriptionLocalizationKey:`settings.bezierEnableSplineBehaviorDescription`,type:`toggle`,default:!0}},[Symbol.toStringTag]:`Bezier`}}get _tangentArcPlugin(){let e=Symbol.for(`esri-builtin-plugin-tangent-arc-segment`);return{uniqueId:e,localizationKey:`leaf-tangent-arc`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`circular-arc`],icon:`tangent-curve`,excludedViews:[`3d`],create:()=>this._createPlugin(e),availableDownstreamPlugins:[],[Symbol.toStringTag]:`Tangent Arc`}}get _endpointArcPlugin(){let e=Symbol.for(`esri-builtin-plugin-circular-arc-segment-end-first`);return{uniqueId:e,localizationKey:`leaf-endpoint-arc`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`circular-arc`],icon:`end-point-arc-segment`,excludedViews:[`3d`],create:()=>{let t=this._createPlugin(e);return t.arcDrawingMode=`end-first`,t},availableDownstreamPlugins:[],[Symbol.toStringTag]:`Endpoint Arc`}}get _interiorArcPlugin(){let e=Symbol.for(`esri-builtin-plugin-circular-arc-segment-interior-first`);return{uniqueId:e,localizationKey:`leaf-circular-arc`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`circular-arc`],icon:`arc-segment`,excludedViews:[`3d`],create:()=>{let t=this._createPlugin(e);return t.arcDrawingMode=`interior-first`,t},availableDownstreamPlugins:[],[Symbol.toStringTag]:`Interior Arc`}}get _singlePartPolylinePlugin(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`freehandPolyline`)&&e?.freehandPolyline!==!1,r=!this._isExcludedByAvailableCreateTools(`polyline`)&&e?.polyline!==!1,i=this._effectiveConfiguredDrawingMode===`freehand`&&t?this._simplePointPlugin:this._effectivePointLikePlugin,a=Symbol.for(`esri-builtin-plugin-simple-polyline`);return{uniqueId:a,localizationKey:`root-polyline`,kind:[`section`,`part`],geometryType:`polyline`,legacyCreateTool:`polyline`,icon:r?`line`:`freehand`,create:()=>this._createPlugin(a),availableDownstreamPlugins:r?[i,t?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(n):[t?this._freehandPlugin:null].filter(n),defaultDownstreamPlugin:r?i:this._freehandPlugin,[Symbol.toStringTag]:`Polyline`}}get _singlePartPolygonPlugin(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`freehandPolygon`)&&e?.freehandPolygon!==!1,r=!this._isExcludedByAvailableCreateTools(`polygon`)&&e?.polygon!==!1,i=this._effectiveConfiguredDrawingMode===`freehand`&&t?this._simplePointPlugin:this._effectivePointLikePlugin,a=Symbol.for(`esri-builtin-plugin-simple-polygon`);return{uniqueId:a,localizationKey:`root-polygon`,kind:[`section`,`part`],geometryType:`polygon`,legacyCreateTool:`polygon`,icon:r?`polygon`:`freehand-area`,create:()=>this._createPlugin(a),availableDownstreamPlugins:r?[i,t?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(n):[t?this._freehandPlugin:null].filter(n),defaultDownstreamPlugin:r?i:this._freehandPlugin,[Symbol.toStringTag]:`Polygon`}}get _rectanglePlugin(){let e=Symbol.for(`esri-builtin-plugin-simple-rectangle`);return{uniqueId:e,localizationKey:`root-rectangle`,kind:[`part`],geometryType:`polygon`,icon:`rectangle`,legacyCreateTool:`rectangle`,create:()=>this._createPlugin(e),[Symbol.toStringTag]:`Rectangle`}}get _circlePlugin(){let e=Symbol.for(`esri-builtin-plugin-simple-ellipse`);return{uniqueId:e,localizationKey:`root-circle`,kind:[`part`],geometryType:`polygon`,icon:`circle`,legacyCreateTool:`circle`,create:()=>{let t=this._createPlugin(e);return t.shapeType=`circle`,t.defaultUniform=!0,t.defaultCentered=!0,t},[Symbol.toStringTag]:`Circle`}}set sketch(e){this._set(`sketch`,e)}set sketchViewModel(e){this._overrideIfSome(`sketchViewModel`,e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){return this.sketch?.visibleElements.createTools?.point!==!1&&!this._isExcludedByAvailableCreateTools(`point`)?this._simplePointPluginRoot:null}get effectiveRootText(){return this.sketch?.visibleElements.createTools?.text!==!1&&!this._isExcludedByAvailableCreateTools(`text`)?this._textPointPlugin:null}get effectiveRootMultipoint(){return this.sketch?.visibleElements.createTools?.multipoint!==!1&&!this._isExcludedByAvailableCreateTools(`multipoint`)&&this.sketchViewModel?.view?.type!==`3d`?this._multipointPlugin:null}get effectiveRootPolyline(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`polyline`)&&e?.polyline!==!1,n=!this._isExcludedByAvailableCreateTools(`freehandPolyline`)&&e?.freehandPolyline!==!1;return t||n?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`polygon`)&&e?.polygon!==!1,n=!this._isExcludedByAvailableCreateTools(`freehandPolygon`)&&e?.freehandPolygon!==!1;return t||n?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){return this.sketch?.visibleElements.createTools?.rectangle!==!1&&!this._isExcludedByAvailableCreateTools(`rectangle`)?this._rectanglePlugin:null}get effectiveRootCircle(){return this.sketch?.visibleElements.createTools?.circle!==!1&&!this._isExcludedByAvailableCreateTools(`circle`)?this._circlePlugin:null}get availablePlugins(){let e=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,this.effectiveRootCircle].filter(n),t=this.sketch?.availableCreateTools;if(!t)return e;let r=e=>{if(!e.legacyCreateTool)return 2**53-1;let n=t.indexOf(e.legacyCreateTool);return n===-1?2**53-1:n};return e.map((e,t)=>({plugin:e,index:t,order:r(e)})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({plugin:e})=>e)}get visiblePluginsFlat(){if(this.sketchViewModel?.isUsingLegacyCreateTools)return[];let e=this.sketchViewModel?.view?.type??`2d`,t=new Set,n=[],r=i=>{i&&!i.excludedViews?.includes(e)&&(t.has(i.uniqueId)||(t.add(i.uniqueId),i.hidden||n.push(i)),i.availableDownstreamPlugins?.forEach(e=>r(e)))};return this.availablePlugins.forEach(e=>r(e)),n}get loaded(){return this._pluginConstructors!=null}getPluginsEquivalentToCreateTool(e,t){switch(e){case`text`:return[this._textPointPlugin];case`point`:return[this._simplePointPluginRoot];case`rectangle`:return[this._rectanglePlugin];case`circle`:return[this._circlePlugin];case`freehandPolyline`:return[this._singlePartPolylinePlugin,this._freehandPlugin];case`freehandPolygon`:return[this._singlePartPolygonPlugin,this._freehandPlugin];case`polyline`:return t===`freehand`?this.sketch?.viewModel?.defaultCreateOptions?.mode===`freehand`?[this._singlePartPolylinePlugin,this._effectivePointLikePlugin]:[this._singlePartPolylinePlugin,this._freehandPlugin]:t===`hybrid`?[this._singlePartPolylinePlugin,this._hybridSegmentPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case`polygon`:return t===`freehand`?this.sketch?.viewModel?.defaultCreateOptions?.mode===`freehand`?[this._singlePartPolygonPlugin,this._effectivePointLikePlugin]:[this._singlePartPolygonPlugin,this._freehandPlugin]:t===`hybrid`?[this._singlePartPolygonPlugin,this._hybridSegmentPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case`multipoint`:return[this._multipointPlugin];case`mesh`:return null;default:return null}}getDrawingModeEquivalentToPluginStack(e){let t=e.at(-1);return t===this._freehandPlugin?`freehand`:t===this._hybridSegmentPlugin||t===this._rectanglePlugin||t===this._circlePlugin?`hybrid`:`click`}async makeRenderer(e={}){let t=this.sketchViewModel;if(!t?.view)return null;let{abortOptions:n,useTextSymbol:r,customSymbol:i}=e;return t.view.type===`2d`?await this._makeDrawToolRenderer2D({view:t.view,svm:t,useTextSymbol:r,customSymbol:i,abortOptions:n}):await this._makeDrawToolRenderer3D({view:t.view,svm:t,useTextSymbol:r,abortOptions:n})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||=(async()=>{let[{PointPlugin:e},{MultipointPlugin:t},{PolylinePlugin:n},{PolygonPlugin:r},{FreehandSegmentPlugin:i},{BezierSegmentPlugin:a},{TangentArcSegmentPlugin:o},{CircularArcSegmentPlugin:s},{ShapePlugin:c}]=await Promise.all([import(`../../../views/draw/plugins/PointPlugin.js`),import(`../../../views/draw/plugins/MultipointPlugin.js`),import(`../../../views/draw/plugins/PolylinePlugin.js`),import(`../../../views/draw/plugins/PolygonPlugin.js`),import(`../../../views/draw/plugins/FreehandSegmentPlugin.js`),import(`../../../views/draw/plugins/BezierSegmentPlugin.js`),import(`../../../views/draw/plugins/TangentArcSegmentPlugin.js`),import(`../../../views/draw/plugins/CircularArcSegmentPlugin.js`),import(`../../../views/draw/plugins/ShapePlugin.js`)]);this._pluginConstructors=new Map([[Symbol.for(`esri-builtin-plugin-leaf-point`),e],[Symbol.for(`esri-builtin-plugin-text-point`),e],[Symbol.for(`esri-builtin-plugin-multipoint`),t],[Symbol.for(`esri-builtin-plugin-freehand`),i],[Symbol.for(`esri-builtin-plugin-bezier-segment`),a],[Symbol.for(`esri-builtin-plugin-tangent-arc-segment`),o],[Symbol.for(`esri-builtin-plugin-circular-arc-segment-end-first`),s],[Symbol.for(`esri-builtin-plugin-circular-arc-segment-interior-first`),s],[Symbol.for(`esri-builtin-plugin-simple-polyline`),n],[Symbol.for(`esri-builtin-plugin-simple-polygon`),r],[Symbol.for(`esri-builtin-plugin-simple-rectangle`),c],[Symbol.for(`esri-builtin-plugin-simple-ellipse`),c]])})().catch(e=>{throw this._pluginLoadPromise=null,e}),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return this.sketch?!this.sketch.availableCreateTools?.includes(e):!1}_createPlugin(e){let t=this._pluginConstructors?.get(e);if(!t)throw new r(`Sketch:PluginManager`,`Plugin implementations are not loaded. Call loadPlugins() before creating plugins.`);return new t}async _makeDrawToolRenderer2D(e){let{DrawToolRenderer2D:t}=await import(`../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js`),{view:n,svm:r,useTextSymbol:i,abortOptions:a}=e;o(a);let s=i?r.textSymbol??r.pointSymbol:r.pointSymbol,c=new t({symbolOverrides:{polyline:{outputGeometry:{default:e.customSymbol??r.polylineSymbol},outline:{active:r.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:e.customSymbol??r.activeFillSymbol??r.polygonSymbol}},point:{outputGeometry:{default:e.customSymbol??s},vertex:{default:r.vertexSymbol,active:r.activeVertexSymbol??void 0}}},view:n}),l=this._setupSymbolWatcher(c,r,!!i,!!e.customSymbol);return c.addHandles(l),c}async _makeDrawToolRenderer3D(e){let{view:t,svm:n,useTextSymbol:r,abortOptions:i}=e;return a.getLogger(this).warnOnce(`Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available.`),this._makeDrawToolRenderer2D({view:t,svm:n,useTextSymbol:r,abortOptions:i})}_setupSymbolWatcher(e,t,n,r){let a=(t,n,r)=>(i,a)=>{i!==a&&e.overrideSymbol({symbol:i,geometryType:t,role:n,state:r})},o=[s(()=>t.activeLineSymbol,a(`polyline`,`outline`,`active`)),s(()=>t.vertexSymbol,a(`point`,`vertex`)),s(()=>t.activeVertexSymbol,a(`point`,`vertex`,`active`))];return r||o.push(s(()=>t.polylineSymbol,a(`polyline`,`outputGeometry`)),s(()=>t.activeFillSymbol??t.polygonSymbol,a(`polygon`,`outputGeometry`)),s(()=>n?t.textSymbol??t.pointSymbol:t.pointSymbol,a(`point`,`outputGeometry`))),i(o)}};e([c()],f.prototype,`_freehandPluginSettings`,null),e([c()],f.prototype,`_simplePointPlugin`,null),e([c()],f.prototype,`_hybridSegmentPlugin`,null),e([c()],f.prototype,`_pointLikeFreehandSegmentPlugin`,null),e([c()],f.prototype,`_effectiveConfiguredDrawingMode`,null),e([c()],f.prototype,`_effectivePointLikePlugin`,null),e([c()],f.prototype,`_simplePointPluginRoot`,null),e([c()],f.prototype,`_textPointPlugin`,null),e([c()],f.prototype,`_multipointPlugin`,null),e([c()],f.prototype,`_freehandPlugin`,null),e([c()],f.prototype,`_bezierPlugin`,null),e([c()],f.prototype,`_tangentArcPlugin`,null),e([c()],f.prototype,`_endpointArcPlugin`,null),e([c()],f.prototype,`_interiorArcPlugin`,null),e([c()],f.prototype,`_singlePartPolylinePlugin`,null),e([c()],f.prototype,`_singlePartPolygonPlugin`,null),e([c()],f.prototype,`_rectanglePlugin`,null),e([c()],f.prototype,`_circlePlugin`,null),e([c()],f.prototype,`sketch`,null),e([c()],f.prototype,`sketchViewModel`,null),e([c()],f.prototype,`effectiveRootPoint`,null),e([c()],f.prototype,`effectiveRootText`,null),e([c()],f.prototype,`effectiveRootMultipoint`,null),e([c()],f.prototype,`effectiveRootPolyline`,null),e([c()],f.prototype,`effectiveRootPolygon`,null),e([c()],f.prototype,`effectiveRootRectangle`,null),e([c()],f.prototype,`effectiveRootCircle`,null),e([c()],f.prototype,`availablePlugins`,null),e([c()],f.prototype,`visiblePluginsFlat`,null),e([c()],f.prototype,`loaded`,null),f=e([l(`esri.widgets.Sketch.support.PluginManager`)],f);export{f as PluginManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Error.js";import{handlesGroup as i}from"../../../core/handleUtils.js";import a from"../../../core/Logger.js";import{throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{freehandSnappingEnabledSettingKey as u,bezierEnableSplineBehaviorSettingKey as d}from"../../../views/draw/support/types.js";let f=class extends t{constructor(e){super(e),this._pluginLoadPromise=null,this._pluginConstructors=null}get _freehandPluginSettings(){return{[u]:{titleLocalizationKey:`settings.freehandSnappingEnabledTitle`,descriptionLocalizationKey:`settings.freehandSnappingEnabledDescription`,type:`toggle`,default:!0}}}get _simplePointPlugin(){let e=Symbol.for(`esri-builtin-plugin-leaf-point`);return{uniqueId:e,localizationKey:`leaf-point-segment`,kind:[`vertex`],geometryType:`point`,icon:`line-straight`,legacyCreateTool:`point`,create:()=>this._createPlugin(e),[Symbol.toStringTag]:`Point`}}get _hybridSegmentPlugin(){let e=Symbol.for(`esri-builtin-plugin-freehand`);return{...this._simplePointPlugin,create:()=>{let t=this._createPlugin(e);return t.completeOnDragEnd=!0,t.snappingBehavior=`when-not-capturing`,t},settings:this._freehandPluginSettings,[Symbol.toStringTag]:`Hybrid Segment`}}get _pointLikeFreehandSegmentPlugin(){let e=Symbol.for(`esri-builtin-plugin-freehand`);return{...this._simplePointPlugin,create:()=>{let t=this._createPlugin(e);return t.completeOnDragEnd=!0,t.snappingBehavior=`when-not-capturing`,t},settings:this._freehandPluginSettings,[Symbol.toStringTag]:`Freehand Segment`}}get _effectiveConfiguredDrawingMode(){return this.sketchViewModel?.defaultCreateOptions?.mode??`click`}get _effectivePointLikePlugin(){switch(this._effectiveConfiguredDrawingMode){case`hybrid`:return this._hybridSegmentPlugin;case`freehand`:return this._pointLikeFreehandSegmentPlugin;default:return this._simplePointPlugin}}get _simplePointPluginRoot(){return{...this._simplePointPlugin,icon:`pin`,localizationKey:`root-point`,create:()=>{let e=this._createPlugin(this._simplePointPlugin.uniqueId);return e.enableHelpMessages=!0,e}}}get _textPointPlugin(){let e=Symbol.for(`esri-builtin-plugin-text-point`);return{uniqueId:e,localizationKey:`root-text`,kind:[`vertex`],geometryType:`point`,icon:`text`,legacyCreateTool:`text`,create:()=>this._createPlugin(e),[Symbol.toStringTag]:`Text`}}get _multipointPlugin(){let e={...this._simplePointPlugin,localizationKey:`leaf-point`,icon:`point`,hidden:!0},t=Symbol.for(`esri-builtin-plugin-multipoint`);return{uniqueId:t,localizationKey:`root-multipoint`,kind:[`part`],geometryType:`multipoint`,icon:`pins`,legacyCreateTool:`multipoint`,excludedViews:[`3d`],create:()=>this._createPlugin(t),availableDownstreamPlugins:[e],defaultDownstreamPlugin:e,[Symbol.toStringTag]:`Multipoint`}}get _freehandPlugin(){let e=Symbol.for(`esri-builtin-plugin-freehand`);return{uniqueId:e,localizationKey:`leaf-stream`,kind:[`vertex`,`section`,`part`],geometryType:`polyline`,icon:`freehand`,legacyCreateTool:`freehandPolyline`,create:()=>{let t=this._createPlugin(e);return t.completeOnDragEnd=!0,t.snappingBehavior=`when-not-capturing`,t},settings:this._freehandPluginSettings,[Symbol.toStringTag]:`Freehand`}}get _bezierPlugin(){let e=Symbol.for(`esri-builtin-plugin-bezier-segment`);return{uniqueId:e,localizationKey:`leaf-bezier`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`cubic-bezier`],icon:`bezier-curve`,excludedViews:[`3d`],create:()=>this._createPlugin(e),settings:{[d]:{titleLocalizationKey:`settings.bezierEnableSplineBehaviorTitle`,descriptionLocalizationKey:`settings.bezierEnableSplineBehaviorDescription`,type:`toggle`,default:!0}},[Symbol.toStringTag]:`Bezier`}}get _tangentArcPlugin(){let e=Symbol.for(`esri-builtin-plugin-tangent-arc-segment`);return{uniqueId:e,localizationKey:`leaf-tangent-arc`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`circular-arc`],icon:`tangent-curve`,excludedViews:[`3d`],create:()=>this._createPlugin(e),availableDownstreamPlugins:[],[Symbol.toStringTag]:`Tangent Arc`}}get _endpointArcPlugin(){let e=Symbol.for(`esri-builtin-plugin-circular-arc-segment-end-first`);return{uniqueId:e,localizationKey:`leaf-endpoint-arc`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`circular-arc`],icon:`end-point-arc-segment`,excludedViews:[`3d`],create:()=>{let t=this._createPlugin(e);return t.arcDrawingMode=`end-first`,t},availableDownstreamPlugins:[],[Symbol.toStringTag]:`Endpoint Arc`}}get _interiorArcPlugin(){let e=Symbol.for(`esri-builtin-plugin-circular-arc-segment-interior-first`);return{uniqueId:e,localizationKey:`leaf-circular-arc`,kind:[`vertex`,`section`],geometryType:`point`,curveTypes:[`circular-arc`],icon:`arc-segment`,excludedViews:[`3d`],create:()=>{let t=this._createPlugin(e);return t.arcDrawingMode=`interior-first`,t},availableDownstreamPlugins:[],[Symbol.toStringTag]:`Interior Arc`}}get _singlePartPolylinePlugin(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`freehandPolyline`)&&e?.freehandPolyline!==!1,r=!this._isExcludedByAvailableCreateTools(`polyline`)&&e?.polyline!==!1,i=this._effectiveConfiguredDrawingMode===`freehand`&&t?this._simplePointPlugin:this._effectivePointLikePlugin,a=Symbol.for(`esri-builtin-plugin-simple-polyline`);return{uniqueId:a,localizationKey:`root-polyline`,kind:[`section`,`part`],geometryType:`polyline`,legacyCreateTool:`polyline`,icon:r?`line`:`freehand`,create:()=>this._createPlugin(a),availableDownstreamPlugins:r?[i,t?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(n):[t?this._freehandPlugin:null].filter(n),defaultDownstreamPlugin:r?i:this._freehandPlugin,[Symbol.toStringTag]:`Polyline`}}get _singlePartPolygonPlugin(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`freehandPolygon`)&&e?.freehandPolygon!==!1,r=!this._isExcludedByAvailableCreateTools(`polygon`)&&e?.polygon!==!1,i=this._effectiveConfiguredDrawingMode===`freehand`&&t?this._simplePointPlugin:this._effectivePointLikePlugin,a=Symbol.for(`esri-builtin-plugin-simple-polygon`);return{uniqueId:a,localizationKey:`root-polygon`,kind:[`section`,`part`],geometryType:`polygon`,legacyCreateTool:`polygon`,icon:r?`polygon`:`freehand-area`,create:()=>this._createPlugin(a),availableDownstreamPlugins:r?[i,t?this._freehandPlugin:null,this._bezierPlugin,this._tangentArcPlugin,this._interiorArcPlugin,this._endpointArcPlugin].filter(n):[t?this._freehandPlugin:null].filter(n),defaultDownstreamPlugin:r?i:this._freehandPlugin,[Symbol.toStringTag]:`Polygon`}}get _rectanglePlugin(){let e=Symbol.for(`esri-builtin-plugin-simple-rectangle`);return{uniqueId:e,localizationKey:`root-rectangle`,kind:[`part`],geometryType:`polygon`,icon:`rectangle`,legacyCreateTool:`rectangle`,create:()=>this._createPlugin(e),[Symbol.toStringTag]:`Rectangle`}}get _circlePlugin(){let e=Symbol.for(`esri-builtin-plugin-simple-ellipse`);return{uniqueId:e,localizationKey:`root-circle`,kind:[`part`],geometryType:`polygon`,icon:`circle`,legacyCreateTool:`circle`,create:()=>{let t=this._createPlugin(e);return t.shapeType=`circle`,t.defaultUniform=!0,t.defaultCentered=!0,t},[Symbol.toStringTag]:`Circle`}}get _ellipsePlugin(){let e=Symbol.for(`esri-builtin-plugin-simple-ellipse-unconstrained`);return{uniqueId:e,localizationKey:`root-circle`,kind:[`part`],geometryType:`polygon`,icon:`ellipse`,legacyCreateTool:`circle`,create:()=>{let t=this._createPlugin(e);return t.shapeType=`circle`,t.defaultUniform=!1,t.defaultCentered=!0,t},[Symbol.toStringTag]:`Ellipse`}}set sketch(e){this._set(`sketch`,e)}set sketchViewModel(e){this._overrideIfSome(`sketchViewModel`,e)}get sketchViewModel(){return this.sketch?.viewModel}get effectiveRootPoint(){return this.sketch?.visibleElements.createTools?.point!==!1&&!this._isExcludedByAvailableCreateTools(`point`)?this._simplePointPluginRoot:null}get effectiveRootText(){return this.sketch?.visibleElements.createTools?.text!==!1&&!this._isExcludedByAvailableCreateTools(`text`)?this._textPointPlugin:null}get effectiveRootMultipoint(){return this.sketch?.visibleElements.createTools?.multipoint!==!1&&!this._isExcludedByAvailableCreateTools(`multipoint`)&&this.sketchViewModel?.view?.type!==`3d`?this._multipointPlugin:null}get effectiveRootPolyline(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`polyline`)&&e?.polyline!==!1,n=!this._isExcludedByAvailableCreateTools(`freehandPolyline`)&&e?.freehandPolyline!==!1;return t||n?this._singlePartPolylinePlugin:null}get effectiveRootPolygon(){let e=this.sketch?.visibleElements.createTools,t=!this._isExcludedByAvailableCreateTools(`polygon`)&&e?.polygon!==!1,n=!this._isExcludedByAvailableCreateTools(`freehandPolygon`)&&e?.freehandPolygon!==!1;return t||n?this._singlePartPolygonPlugin:null}get effectiveRootRectangle(){return this.sketch?.visibleElements.createTools?.rectangle!==!1&&!this._isExcludedByAvailableCreateTools(`rectangle`)?this._rectanglePlugin:null}get effectiveRootCircle(){return this.sketch?.visibleElements.createTools?.circle!==!1&&!this._isExcludedByAvailableCreateTools(`circle`)?this._circlePlugin:null}get effectiveRootEllipse(){return this.sketch?.visibleElements.createTools?.circle!==!1&&!this._isExcludedByAvailableCreateTools(`circle`)?this._ellipsePlugin:null}get availablePlugins(){let e=this.sketch?.viewModel.defaultCreateOptions.optionsPerTool?.get(`circle`)?.preserveAspectRatio===!1,t=[this.effectiveRootPoint,this.effectiveRootText,this.effectiveRootMultipoint,this.effectiveRootPolyline,this.effectiveRootPolygon,this.effectiveRootRectangle,e?this.effectiveRootEllipse:this.effectiveRootCircle].filter(n),r=this.sketch?.availableCreateTools;if(!r)return t;let i=e=>{if(!e.legacyCreateTool)return 2**53-1;let t=r.indexOf(e.legacyCreateTool);return t===-1?2**53-1:t};return t.map((e,t)=>({plugin:e,index:t,order:i(e)})).sort((e,t)=>e.order-t.order||e.index-t.index).map(({plugin:e})=>e)}get visiblePluginsFlat(){if(this.sketchViewModel?.isUsingLegacyCreateTools)return[];let e=this.sketchViewModel?.view?.type??`2d`,t=new Set,n=[],r=i=>{i&&!i.excludedViews?.includes(e)&&(t.has(i.uniqueId)||(t.add(i.uniqueId),i.hidden||n.push(i)),i.availableDownstreamPlugins?.forEach(e=>r(e)))};return this.availablePlugins.forEach(e=>r(e)),n}get loaded(){return this._pluginConstructors!=null}getPluginsEquivalentToCreateTool(e,t){switch(e){case`text`:return[this._textPointPlugin];case`point`:return[this._simplePointPluginRoot];case`rectangle`:return[this._rectanglePlugin];case`circle`:return t.optionsPerTool?.get(`circle`)?.preserveAspectRatio===!1?[this._ellipsePlugin]:[this._circlePlugin];case`freehandPolyline`:return[this._singlePartPolylinePlugin,this._freehandPlugin];case`freehandPolygon`:return[this._singlePartPolygonPlugin,this._freehandPlugin];case`polyline`:return t.mode===`freehand`?this.sketch?.viewModel?.defaultCreateOptions?.mode===`freehand`?[this._singlePartPolylinePlugin,this._effectivePointLikePlugin]:[this._singlePartPolylinePlugin,this._freehandPlugin]:t.mode===`hybrid`?[this._singlePartPolylinePlugin,this._hybridSegmentPlugin]:[this._singlePartPolylinePlugin,this._simplePointPlugin];case`polygon`:return t.mode===`freehand`?this.sketch?.viewModel?.defaultCreateOptions?.mode===`freehand`?[this._singlePartPolygonPlugin,this._effectivePointLikePlugin]:[this._singlePartPolygonPlugin,this._freehandPlugin]:t.mode===`hybrid`?[this._singlePartPolygonPlugin,this._hybridSegmentPlugin]:[this._singlePartPolygonPlugin,this._simplePointPlugin];case`multipoint`:return[this._multipointPlugin];case`mesh`:return null;default:return null}}getDrawingModeEquivalentToPluginStack(e){let t=e.at(-1);return t===this._freehandPlugin?`freehand`:t===this._hybridSegmentPlugin||t===this._rectanglePlugin||t===this._circlePlugin?`hybrid`:`click`}async makeRenderer(e={}){let t=this.sketchViewModel;if(!t?.view)return null;let{abortOptions:n,useTextSymbol:r,customSymbol:i}=e;return t.view.type===`2d`?await this._makeDrawToolRenderer2D({view:t.view,svm:t,useTextSymbol:r,customSymbol:i,abortOptions:n}):await this._makeDrawToolRenderer3D({view:t.view,svm:t,useTextSymbol:r,abortOptions:n})}async loadPlugins(){if(!this.loaded)return this._pluginLoadPromise||=(async()=>{let[{PointPlugin:e},{MultipointPlugin:t},{PolylinePlugin:n},{PolygonPlugin:r},{FreehandSegmentPlugin:i},{BezierSegmentPlugin:a},{TangentArcSegmentPlugin:o},{CircularArcSegmentPlugin:s},{ShapePlugin:c}]=await Promise.all([import(`../../../views/draw/plugins/PointPlugin.js`),import(`../../../views/draw/plugins/MultipointPlugin.js`),import(`../../../views/draw/plugins/PolylinePlugin.js`),import(`../../../views/draw/plugins/PolygonPlugin.js`),import(`../../../views/draw/plugins/FreehandSegmentPlugin.js`),import(`../../../views/draw/plugins/BezierSegmentPlugin.js`),import(`../../../views/draw/plugins/TangentArcSegmentPlugin.js`),import(`../../../views/draw/plugins/CircularArcSegmentPlugin.js`),import(`../../../views/draw/plugins/ShapePlugin.js`)]);this._pluginConstructors=new Map([[Symbol.for(`esri-builtin-plugin-leaf-point`),e],[Symbol.for(`esri-builtin-plugin-text-point`),e],[Symbol.for(`esri-builtin-plugin-multipoint`),t],[Symbol.for(`esri-builtin-plugin-freehand`),i],[Symbol.for(`esri-builtin-plugin-bezier-segment`),a],[Symbol.for(`esri-builtin-plugin-tangent-arc-segment`),o],[Symbol.for(`esri-builtin-plugin-circular-arc-segment-end-first`),s],[Symbol.for(`esri-builtin-plugin-circular-arc-segment-interior-first`),s],[Symbol.for(`esri-builtin-plugin-simple-polyline`),n],[Symbol.for(`esri-builtin-plugin-simple-polygon`),r],[Symbol.for(`esri-builtin-plugin-simple-rectangle`),c],[Symbol.for(`esri-builtin-plugin-simple-ellipse`),c],[Symbol.for(`esri-builtin-plugin-simple-ellipse-unconstrained`),c]])})().catch(e=>{throw this._pluginLoadPromise=null,e}),this._pluginLoadPromise}_isExcludedByAvailableCreateTools(e){return this.sketch?!this.sketch.availableCreateTools?.includes(e):!1}_createPlugin(e){let t=this._pluginConstructors?.get(e);if(!t)throw new r(`Sketch:PluginManager`,`Plugin implementations are not loaded. Call loadPlugins() before creating plugins.`);return new t}async _makeDrawToolRenderer2D(e){let{DrawToolRenderer2D:t}=await import(`../../../views/2d/interactive/editingTools/draw/DrawToolRenderer2D.js`),{view:n,svm:r,useTextSymbol:i,abortOptions:a}=e;o(a);let s=i?r.textSymbol??r.pointSymbol:r.pointSymbol,c=new t({symbolOverrides:{polyline:{outputGeometry:{default:e.customSymbol??r.polylineSymbol},outline:{active:r.activeLineSymbol??void 0}},polygon:{outputGeometry:{default:e.customSymbol??r.activeFillSymbol??r.polygonSymbol}},point:{outputGeometry:{default:e.customSymbol??s},vertex:{default:r.vertexSymbol,active:r.activeVertexSymbol??void 0}}},view:n}),l=this._setupSymbolWatcher(c,r,!!i,!!e.customSymbol);return c.addHandles(l),c}async _makeDrawToolRenderer3D(e){let{view:t,svm:n,useTextSymbol:r,abortOptions:i}=e;return a.getLogger(this).warnOnce(`Using DrawToolRenderer2D in 3D view. A 3D-specific implementation of DrawToolRenderer is not yet available.`),this._makeDrawToolRenderer2D({view:t,svm:n,useTextSymbol:r,abortOptions:i})}_setupSymbolWatcher(e,t,n,r){let a=(t,n,r)=>(i,a)=>{i!==a&&e.overrideSymbol({symbol:i,geometryType:t,role:n,state:r})},o=[s(()=>t.activeLineSymbol,a(`polyline`,`outline`,`active`)),s(()=>t.vertexSymbol,a(`point`,`vertex`)),s(()=>t.activeVertexSymbol,a(`point`,`vertex`,`active`))];return r||o.push(s(()=>t.polylineSymbol,a(`polyline`,`outputGeometry`)),s(()=>t.activeFillSymbol??t.polygonSymbol,a(`polygon`,`outputGeometry`)),s(()=>n?t.textSymbol??t.pointSymbol:t.pointSymbol,a(`point`,`outputGeometry`))),i(o)}};e([c()],f.prototype,`_freehandPluginSettings`,null),e([c()],f.prototype,`_simplePointPlugin`,null),e([c()],f.prototype,`_hybridSegmentPlugin`,null),e([c()],f.prototype,`_pointLikeFreehandSegmentPlugin`,null),e([c()],f.prototype,`_effectiveConfiguredDrawingMode`,null),e([c()],f.prototype,`_effectivePointLikePlugin`,null),e([c()],f.prototype,`_simplePointPluginRoot`,null),e([c()],f.prototype,`_textPointPlugin`,null),e([c()],f.prototype,`_multipointPlugin`,null),e([c()],f.prototype,`_freehandPlugin`,null),e([c()],f.prototype,`_bezierPlugin`,null),e([c()],f.prototype,`_tangentArcPlugin`,null),e([c()],f.prototype,`_endpointArcPlugin`,null),e([c()],f.prototype,`_interiorArcPlugin`,null),e([c()],f.prototype,`_singlePartPolylinePlugin`,null),e([c()],f.prototype,`_singlePartPolygonPlugin`,null),e([c()],f.prototype,`_rectanglePlugin`,null),e([c()],f.prototype,`_circlePlugin`,null),e([c()],f.prototype,`_ellipsePlugin`,null),e([c()],f.prototype,`sketch`,null),e([c()],f.prototype,`sketchViewModel`,null),e([c()],f.prototype,`effectiveRootPoint`,null),e([c()],f.prototype,`effectiveRootText`,null),e([c()],f.prototype,`effectiveRootMultipoint`,null),e([c()],f.prototype,`effectiveRootPolyline`,null),e([c()],f.prototype,`effectiveRootPolygon`,null),e([c()],f.prototype,`effectiveRootRectangle`,null),e([c()],f.prototype,`effectiveRootCircle`,null),e([c()],f.prototype,`effectiveRootEllipse`,null),e([c()],f.prototype,`availablePlugins`,null),e([c()],f.prototype,`visiblePluginsFlat`,null),e([c()],f.prototype,`loaded`,null),f=e([l(`esri.widgets.Sketch.support.PluginManager`)],f);export{f as PluginManager};