@arcgis/core 6.0.0-next.15 → 6.0.0-next.17

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 (439) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  11. package/assets/esri/core/workers/chunks/164c8eeefa8232b2b191.js +2 -0
  12. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  13. package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  17. package/assets/esri/core/workers/chunks/{261fea092ee7d27608a0.js → 20a2124cbe43e5527c40.js} +1 -1
  18. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  19. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  20. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  21. package/assets/esri/core/workers/chunks/2853606099602f73d379.js +1 -0
  22. package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +2 -0
  23. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  24. package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +2 -0
  25. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 34e0a8a3a2beea50f4f5.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  28. package/assets/esri/core/workers/chunks/3e30b96a8c75bd5b9ae2.js +1 -0
  29. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → 42753cf4965a94bc91ca.js} +1 -1
  30. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  31. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  32. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  33. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  34. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  35. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{b564ec4e03478f5659db.js → 4c240ca50f70bf30813f.js} +1 -1
  37. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  38. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  39. package/assets/esri/core/workers/chunks/{70d3055f15d8b0cf4074.js → 532e9cda8ac3601d8892.js} +1 -1
  40. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  41. package/assets/esri/core/workers/chunks/{953ba13299e7aa92c1a0.js → 564565246dae080f5e6c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  43. package/assets/esri/core/workers/chunks/{2145a512d269d64036b0.js → 58c3ae6030def2ed5f31.js} +1 -1
  44. package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +1 -0
  45. package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +1 -0
  46. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 5b91e2dffdc84c006539.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  48. package/assets/esri/core/workers/chunks/603fdbbe9534c614928f.js +1 -0
  49. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → 60f92eb03c6e17ab4747.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{67ebc5a3d46b254b725c.js → 612345f17f5eeb99ea8f.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{1b077c92345ffb5916c2.js → 65c98f3449044fa4fd79.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{2bd4ee083ca4ad221f8b.js → 65cb5e39c467a35621ca.js} +1 -1
  53. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  54. package/assets/esri/core/workers/chunks/67a35155b8b4d36f171e.js +1 -0
  55. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  56. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{ae31fd416bbb41a81392.js → 6ad309154fe84210d23c.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  59. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  60. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  61. package/assets/esri/core/workers/chunks/784d6c6949284ed6e10b.js +1 -0
  62. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{e2190361247f35b02b32.js → 7b5cd150a4d0139850be.js} +1 -1
  65. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  66. package/assets/esri/core/workers/chunks/7d2cbc767c336d15e4d5.js +1 -0
  67. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js → 844eedda8f749972f707.js} +2 -2
  70. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  76. package/assets/esri/core/workers/chunks/9503eedfdda55fc5adab.js +1 -0
  77. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  78. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  79. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  80. package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +1 -0
  81. package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +1 -0
  82. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  83. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  84. package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +1 -0
  85. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{ec8b7476eac4718eb0ac.js → a504a5e06cb89a620799.js} +1 -1
  88. package/assets/esri/core/workers/chunks/a596779eaeec7310671d.js +1 -0
  89. package/assets/esri/core/workers/chunks/{d5d0fe8e198ff5a902ee.js → a5c8f9f5be4ef5063b42.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → ab1660f5f8a5268c2fac.js} +1 -1
  92. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  93. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  94. package/assets/esri/core/workers/chunks/ae0563d573baf91e01f7.js +1 -0
  95. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  96. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  97. package/assets/esri/core/workers/chunks/b686cd74975da09b9c91.js +2 -0
  98. package/assets/esri/core/workers/chunks/{aa36c3a9bbaa086e3757.js → b8fd7c3b36981261378b.js} +1 -1
  99. package/assets/esri/core/workers/chunks/bd046399e05e759e0bc2.js +1 -0
  100. package/assets/esri/core/workers/chunks/bd46a04a9ee4ea9e6ef1.js +2 -0
  101. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  102. package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +1 -0
  103. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  104. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  105. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  106. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  107. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  108. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → dd0310184fe4832755a8.js} +1 -1
  109. package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +1 -0
  110. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  112. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  113. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  114. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  115. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  116. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  117. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  118. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  119. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  120. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  121. package/assets/esri/core/workers/chunks/{634523cc7757da9020e4.js → fb70ab267a08e24b710f.js} +1 -1
  122. package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +1 -0
  123. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  124. package/assets/esri/themes/base/widgets/_Weather.scss +1 -0
  125. package/assets/esri/themes/dark/main.css +1 -1
  126. package/assets/esri/themes/light/main.css +1 -1
  127. package/assets/esri/themes/light/view.css +1 -1
  128. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  129. package/chunks/Envelope.js +1 -1
  130. package/chunks/MultiPathImpl.js +1 -1
  131. package/chunks/OperatorGeodeticArea.js +1 -1
  132. package/chunks/OperatorShapePreservingLength.js +1 -1
  133. package/chunks/OperatorShapePreservingProject.js +1 -1
  134. package/chunks/UnitFactory.js +1 -1
  135. package/chunks/basis_encoder.js +1 -1
  136. package/chunks/basis_transcoder.js +1 -1
  137. package/chunks/index.js +1 -1
  138. package/chunks/lclayout.js +1 -1
  139. package/chunks/lerc-wasm.js +1 -1
  140. package/config.d.ts +2 -0
  141. package/config.js +1 -1
  142. package/core/accessorSupport/DefaultsStore.js +1 -1
  143. package/core/accessorSupport/MultiOriginStore.js +1 -1
  144. package/core/accessorSupport/Store.js +1 -1
  145. package/core/accessorSupport/decorators/reader.js +1 -1
  146. package/core/accessorSupport/decorators/writer.js +1 -1
  147. package/core/sql/WhereGrammar.js +2 -2
  148. package/core/workers/WorkerOwner.js +1 -1
  149. package/core/workers/workerFactory.js +1 -1
  150. package/core/workers/workers.js +2 -2
  151. package/core/workers.d.ts +9 -0
  152. package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
  153. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  154. package/geometry/Mesh.js +1 -1
  155. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  156. package/geometry/operators/gx/operatorOffset.js +1 -1
  157. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  158. package/geometry/operators/support/jsonConverter.js +1 -1
  159. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  160. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  161. package/geometry/support/meshUtils/merge.js +1 -1
  162. package/geometry/support/meshUtils/rotate.js +1 -1
  163. package/geometry/support/polygonExtentClipping.js +1 -1
  164. package/identity/Credential.js +1 -1
  165. package/kernel.js +1 -1
  166. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  167. package/layers/AnnotationFeatureLayer.js +1 -1
  168. package/layers/CatalogLayer.d.ts +2 -2
  169. package/layers/CatalogLayer.js +1 -1
  170. package/layers/DimensionFeatureLayer.d.ts +2 -2
  171. package/layers/DimensionFeatureLayer.js +1 -1
  172. package/layers/ElevationLayer.js +1 -1
  173. package/layers/FeatureLayer.d.ts +4 -4
  174. package/layers/FeatureLayer.js +1 -1
  175. package/layers/GeoJSONLayer.d.ts +1 -1
  176. package/layers/ImageryTileLayer.js +1 -1
  177. package/layers/LineOfSightLayer.d.ts +10 -8
  178. package/layers/SceneLayer.js +1 -1
  179. package/layers/SubtypeGroupLayer.d.ts +2 -2
  180. package/layers/SubtypeGroupLayer.js +1 -1
  181. package/layers/ViewshedLayer.d.ts +1 -1
  182. package/layers/VoxelLayer.js +1 -1
  183. package/layers/WMSLayer.js +1 -1
  184. package/layers/effects/parser.js +3 -3
  185. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  186. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  187. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  188. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  189. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  190. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  191. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  192. package/layers/graphics/data/QueryEngineResult.js +1 -1
  193. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  194. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  195. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  196. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  197. package/layers/mixins/ReloadableLayer.js +2 -0
  198. package/layers/raster/datasets/BaseRaster.js +1 -1
  199. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  200. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  201. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  202. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  203. package/layers/raster/datasets/MRFRaster.js +1 -1
  204. package/layers/raster/datasets/TIFFRaster.js +1 -1
  205. package/layers/raster/datasets/WCSRaster.js +1 -1
  206. package/layers/raster/formats/ElevationCodec.js +2 -0
  207. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  208. package/layers/raster/formats/Lerc.js +1 -1
  209. package/layers/raster/formats/RasterCodec.js +1 -1
  210. package/layers/raster/formats/TiffDecoder.js +1 -1
  211. package/layers/raster/formats/Zlib.js +1 -1
  212. package/layers/raster/functions/stretchUtils.js +1 -1
  213. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  214. package/layers/support/FieldsIndex.js +1 -1
  215. package/layers/support/LercWorker.js +1 -1
  216. package/layers/support/RasterWorker.js +1 -1
  217. package/layers/support/TileInfo.d.ts +1 -1
  218. package/layers/support/TileInfo.js +1 -1
  219. package/layers/support/featureReductionProperties.js +1 -1
  220. package/layers/support/kmlUtils.js +1 -1
  221. package/layers/support/layerOriginUtils.js +1 -1
  222. package/layers/video/VideoController.js +10 -10
  223. package/libs/maquette/projection.js +1 -1
  224. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  225. package/package.json +6 -6
  226. package/popup/FeatureModel.js +1 -1
  227. package/popup/FeaturesModel.js +1 -1
  228. package/portal/Portal.js +1 -1
  229. package/request/process.js +1 -1
  230. package/request/types.d.ts +7 -0
  231. package/rest/knowledgeGraphService.js +1 -1
  232. package/rest/networks/trace.js +1 -1
  233. package/rest/query/executeQuery.js +1 -1
  234. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  235. package/smartMapping/renderers/univariateColorSize.js +1 -1
  236. package/smartMapping/statistics/support/statsWorker.js +1 -1
  237. package/smartMapping/statistics/support/utils.js +1 -1
  238. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  239. package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
  240. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  241. package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
  242. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  243. package/smartMapping/support/adapters/support/utils.js +1 -1
  244. package/smartMapping/support/clusterUtils.js +1 -1
  245. package/statistics/utils.js +1 -1
  246. package/symbols/cim/CIMCursor.js +1 -1
  247. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  248. package/symbols/cim/cimAnalyzer.js +1 -1
  249. package/symbols/support/ElevationInfo.d.ts +4 -3
  250. package/time/TimeExtent.d.ts +1 -1
  251. package/undoredo/support/Services.js +1 -1
  252. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  253. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  254. package/views/2d/grid/GridView2D.js +1 -1
  255. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  256. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  257. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  258. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  259. package/views/2d/viewpointUtils.js +1 -1
  260. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  261. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  262. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  263. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  264. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  265. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  266. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  267. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  268. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  269. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  270. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  271. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  272. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  273. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  274. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  275. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  276. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  277. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  278. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  279. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  280. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  281. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  282. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  283. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  284. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  285. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  286. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  287. package/views/3d/layers/i3s/I3SNode.js +1 -1
  288. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  289. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  290. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  291. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  292. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  293. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  294. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  295. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  296. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  297. package/views/3d/state/utils/navigationUtils.js +1 -1
  298. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  299. package/views/3d/support/elevationUpdateUtils.js +1 -1
  300. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  301. package/views/3d/support/sphereExtentUtils.js +2 -0
  302. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  303. package/views/3d/terrain/OverlayRenderer.js +1 -1
  304. package/views/3d/terrain/PatchRenderData.js +1 -1
  305. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  306. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  307. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  308. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  309. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  310. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  311. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  312. package/views/SceneView.js +1 -1
  313. package/views/ToolViewManager.js +1 -1
  314. package/views/View.js +1 -1
  315. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  316. package/views/draw/DrawOperation.js +1 -1
  317. package/views/draw/support/InteractiveHandle.js +1 -1
  318. package/views/draw/support/Reshape.js +1 -1
  319. package/views/draw/support/createUtils.js +1 -1
  320. package/views/draw/support/editingSessionUtils.js +1 -1
  321. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  322. package/views/interactive/SegmentLabels.js +1 -1
  323. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  324. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  325. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  326. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  327. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  328. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  329. package/views/interactive/sketch/constraintUtils.js +1 -1
  330. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  331. package/views/interactive/snapping/SnappingManagerPool.js +1 -1
  332. package/views/interactive/snapping/allLayerSnapping.js +1 -1
  333. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  334. package/views/layers/LayerView.js +1 -1
  335. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  336. package/views/layers/SketchLayerView.d.ts +1 -0
  337. package/views/layers/ViewshedLayerView.d.ts +36 -12
  338. package/views/webgl/Program.js +1 -1
  339. package/views/webgl/Texture.js +1 -1
  340. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +2 -1
  341. package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +2 -0
  342. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  343. package/widgets/Directions.js +1 -1
  344. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +2 -1
  345. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  346. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  347. package/widgets/ElevationProfile/components/Statistics.js +1 -1
  348. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  349. package/widgets/Expand/ExpandViewModel.d.ts +2 -0
  350. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  351. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  352. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  353. package/widgets/Fullscreen/FullscreenViewModel.d.ts +3 -1
  354. package/widgets/Home/HomeViewModel.d.ts +2 -0
  355. package/widgets/OrientedImageryViewer.js +1 -1
  356. package/widgets/Print.js +1 -1
  357. package/widgets/Sketch/SketchViewModel.js +1 -1
  358. package/widgets/Slice.js +1 -1
  359. package/widgets/Swipe/SwipeViewModel.d.ts +2 -0
  360. package/widgets/Swipe/types.d.ts +9 -2
  361. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +9 -5
  362. package/widgets/TimeSlider/types.d.ts +7 -0
  363. package/widgets/TimeSlider.d.ts +2 -3
  364. package/widgets/TimeSlider.js +1 -1
  365. package/widgets/Track/TrackViewModel.d.ts +4 -0
  366. package/widgets/Track/types.d.ts +1 -0
  367. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  368. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  369. package/widgets/support/SelectionList.js +1 -1
  370. package/widgets/support/Selector3D/selectorUtils.js +1 -1
  371. package/widgets/support/componentsUtils.js +1 -1
  372. package/assets/esri/core/workers/chunks/0050916e462e3c9e0627.js +0 -1
  373. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  374. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  375. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  376. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  377. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  378. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  379. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  380. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  381. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  382. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  383. package/assets/esri/core/workers/chunks/34cbaf844730ac2d92c2.js +0 -2
  384. package/assets/esri/core/workers/chunks/3c301a689c7853c9fa67.js +0 -2
  385. package/assets/esri/core/workers/chunks/3f946c13ad97fbed867b.js +0 -1
  386. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  387. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  388. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  389. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  390. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  391. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  392. package/assets/esri/core/workers/chunks/604f0f4150fb79ee54c8.js +0 -1
  393. package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +0 -1
  394. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  395. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  396. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  397. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  398. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  399. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  400. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  401. package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +0 -1
  402. package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +0 -1
  403. package/assets/esri/core/workers/chunks/76ab353d80d786777161.js +0 -2
  404. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  405. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  406. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  407. package/assets/esri/core/workers/chunks/8483c50ed8f280fd74bb.js +0 -1
  408. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  409. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  410. package/assets/esri/core/workers/chunks/8cb716f110d164030309.js +0 -1
  411. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  412. package/assets/esri/core/workers/chunks/94e427040edb469d58ad.js +0 -1
  413. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  414. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  415. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  416. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  417. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  418. package/assets/esri/core/workers/chunks/b49df4ebd4be1181b0f9.js +0 -2
  419. package/assets/esri/core/workers/chunks/b557824bc1fa163d72a3.js +0 -2
  420. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  421. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  422. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  423. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  424. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  425. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  426. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  427. package/assets/esri/core/workers/chunks/ed8786fed345718ed684.js +0 -1
  428. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  429. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  430. package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +0 -1
  431. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  432. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  433. package/layers/mixins/FeatureLayerReload.js +0 -2
  434. /package/assets/esri/core/workers/chunks/{b557824bc1fa163d72a3.js.LICENSE.txt → 164c8eeefa8232b2b191.js.LICENSE.txt} +0 -0
  435. /package/assets/esri/core/workers/chunks/{b49df4ebd4be1181b0f9.js.LICENSE.txt → 2981e904ab62f3ed80d0.js.LICENSE.txt} +0 -0
  436. /package/assets/esri/core/workers/chunks/{34cbaf844730ac2d92c2.js.LICENSE.txt → 32cc59e126df8c96a0cf.js.LICENSE.txt} +0 -0
  437. /package/assets/esri/core/workers/chunks/{590e6c70206122e4cc3c.js.LICENSE.txt → 844eedda8f749972f707.js.LICENSE.txt} +0 -0
  438. /package/assets/esri/core/workers/chunks/{3c301a689c7853c9fa67.js.LICENSE.txt → b686cd74975da09b9c91.js.LICENSE.txt} +0 -0
  439. /package/assets/esri/core/workers/chunks/{76ab353d80d786777161.js.LICENSE.txt → bd46a04a9ee4ea9e6ef1.js.LICENSE.txt} +0 -0
package/views/View.js CHANGED
@@ -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"../Map.js";import{createTask as n}from"../core/asyncUtils.js";import r from"../core/Collection.js";import i from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as s}from"../core/Evented.js";import c from"../core/Handles.js";import{makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as u}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as f,abortMaybe as ee}from"../core/maybe.js";import{EsriPromise as te}from"../core/Promise.js";import{after as p}from"../core/promiseUtils.js";import m from"../core/ReactiveSet.js";import{watch as h,sync as g,whenOnce as _,when as v,syncAndInitial as y}from"../core/reactiveUtils.js";import{property as b,subclass as x}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import{UpdatingHandles as C}from"../core/support/UpdatingHandles.js";import ne from"../geometry/Extent.js";import w from"../geometry/HeightModelInfo.js";import T from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as D}from"../support/AnalysesCollection.js";import{GraphicsCollection as O}from"../support/GraphicsCollection.js";import{system as k}from"../time/constants.js";import A from"../time/TimeExtent.js";import{isTimeZoneValid as j}from"../time/timeZoneUtils.js";import M from"./BasemapView.js";import N from"./Magnifier.js";import P from"./SelectionManager.js";import F from"./Theme.js";import{ToolViewManager as I}from"./ToolViewManager.js";import{GlyphMosaic as L}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as R}from"./3d/support/DefaultHighlights.js";import z from"./input/Input.js";import{ViewEvents as B}from"./input/ViewEvents.js";import V from"./interactive/options/ViewOptions.js";import H from"./navigation/Navigation.js";import{deduplicateAttributionItems as U}from"./support/attributionUtils.js";import{DefaultsFromMap as W}from"./support/DefaultsFromMap.js";import{defaultHighlightName as G}from"./support/HighlightDefaults.js";import K from"./support/HighlightOptions.js";import q from"./support/LayerViewManager.js";import J from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as Y}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as X}from"./support/WebGLRequirements.js";var Z;let Q=class extends s(te){static{Z=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new c,this.updatingHandles=new C,this.allLayerViews=new i({getCollections:()=>this.layerviewCollections,getChildrenFunction:re}),this.animationsEnabled=!0,this.focusRegionVisible=!1,this.focusRegionShortcutEnabled=!1,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new N,this.options=new V,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new z,this.navigation=new H,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new B(this),this.requiredFieldsOptions=new J,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new m,this.handles.add(h(()=>this.preconditionsReady,e=>{let t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,Z.views.add(this)):(this._lockedSpatialReference=null,Z.views.remove(this)),this.notifyChange(`spatialReference`),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(e){queueMicrotask(()=>{this.fatalError=new o(`view:startup-error`,`View._startup failed`,e)});return}this._glyphMosaic=new L(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},g)),this.analyses=new D}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,_(()=>this.ready)))),this.basemapView=new M({view:this}),this.layerViewManager=new q({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new I({view:this}),this.selectionManager=new P({view:this}),this.addHandles([v(()=>this.readyState===`map-content-error`&&!this.spatialReference,()=>{d.getLogger(this).warn(`#spatialReference`,`no spatial reference could be derived from the currently added map layers`)}),h(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},y),h(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.viewReady=e)},g),h(()=>this.defaultsFromMapInputSpatialReference(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputSpatialReference=e)},y),h(()=>this.defaultsFromMapInputHeightModelInfo(),e=>{this.defaultsFromMap&&(this.defaultsFromMap.inputHeightModelInfo=e)},y)])}get _layerToLayerviewMapping(){return Z._layerToLayerview}static{this._layerToLayerview=[[`view.map.basemap.baseLayers`,`view.basemapView.baseLayerViews`],[`view.map.basemap.groundLayers`,`view.basemapView.groundLayerViews`],[`view.map.basemap.referenceLayers`,`view.basemapView.referenceLayerViews`],[`view.map.layers`,`view.layerViews`]]}destroy(){this.destroyed||(Z.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set(`navigation`,null)),this.graphics=f(this.graphics),this.analyses=f(this.analyses),this.defaultsFromMap.destroy(),this._set(`defaultsFromMap`,null),this.analysisViewManager=f(this.analysisViewManager),this.toolViewManager=f(this.toolViewManager),this.layerViewManager=f(this.layerViewManager),this.selectionManager=f(this.selectionManager),this.basemapView=f(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=f(this.map),this.updatingHandles.destroy())}_startup(){this._set(`ready`,!0)}_teardown(){this._set(`ready`,!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error(`#toMap()`,`Not implemented on this instance of View`),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get(`analyses`)}set analyses(e){this._set(`analyses`,e)}get animation(){return this._get(`animation`)}set animation(e){this._set(`animation`,e)}get focusRegion(){return null}get attributionItems(){return this.suspended?[]:U(this._get(`attributionItems`),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new W({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get(`extent`)}set extent(e){this._set(`extent`,e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get(`highlights`)??R()}set highlights(e){this._set(`highlights`,a(e,this._get(`highlights`),r.ofType(K)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===G)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;let{map:e,spatialReference:t}=this;return!!(!this.fatalError&&this._isValid&&!this._readyCycleForced&&e&&(!u(e)||e.loaded)&&this.width!==0&&this.height!==0&&t&&this._validateSpatialReference(t)&&(this._lockedSpatialReference||this.defaultsFromMap?.ready)&&this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){let t=this._get(`map`);e!==t&&(e?.destroyed&&(d.getLogger(this).warn(`#map`,`The provided map is already destroyed`,{map:e}),e=null),u(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set(`map`,e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get(`readyState`);if(!this.map)return`missing-map`;if(`container`in this&&!this.container)return`missing-container`;if(this.fatalError)return`rendering-error`;if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){let e=!(`loaded`in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?`empty-map`:(this._readyStateWaitingTask||(this._readyStateWaitingTask=n(e=>p(has(`view-readyState-waiting-delay`),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,`ready-state-task`)),this._readyStateWaitingTask?.finished?`map-content-error`:`loading`)}return this._readyStateWaitingTask=ee(this._readyStateWaitingTask),this.removeHandles(`ready-state-task`),this.ready?`ready`:`loading`}get spatialReference(){let{_userSpatialReference:e}=this;if(e&&e.vcsWkid!==null)return e;let t=e??this._lockedSpatialReference??this.getWebDocumentSpatialReference()??this.defaultsFromMap?.spatialReference??null,n=this.defaultsFromMap?.combinedHorizontalAndVerticalSpatialReference;return n?.equals(t)?n:t}set spatialReference(e){let t=!E(e,this._get(`spatialReference`));this._set(`_userSpatialReference`,e),t&&(this._set(`spatialReference`,e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}getWebDocumentSpatialReference(){return null}defaultsFromMapInputSpatialReference(){return this._userSpatialReference??this.getWebDocumentSpatialReference()??(this.ready?this._lockedSpatialReference:null)}defaultsFromMapInputHeightModelInfo(){return this.map?.heightModelInfo??null}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??k}set timeZone(e){this._userTimeZone=e,j(e)||d.getLogger(this).warn(`#timeZone`,`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??`default`}acquireCursor(e,t=`low`){let n=t===`high`?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},i=l(()=>n.remove(r));return n.add(r),this.addHandles(i),i}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new F}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultHeightModelInfo(){return(this.map&&`heightModelInfo`in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o(`view:importLayerView-missing`,`importLayerView() not implemented`)}hasLayerViewModule(e){return!1}async validate(){let e=X(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn(`#validate()`,e.message),e;let t=await Y();if(t)throw d.getLogger(this).warn(`#validate()`,t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return this.getSpatialReferenceSupport(e)!=null}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn(`#when()`,`Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead.`),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){let e=document.createElement(`div`);e.setAttribute(`style`,`display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;`);let t=document.createElement(`div`);t.innerHTML=`Unable to display map. WebGL2 support is required.`,t.setAttribute(`style`,`font-size: 24px; font-weight: bold;`);let n=document.createElement(`div`);n.innerHTML=`Ensure that your browser and hardware meet the minimum requirements.`,n.setAttribute(`style`,`font-size: 18px;`);let r=document.createElement(`a`);r.innerHTML=`https://esriurl.com/webgl-faq`,r.target=`_blank`,r.setAttribute(`style`,`font-size: 18px;`),r.href=`https://esriurl.com/webgl-faq`,e.appendChild(t),e.appendChild(n),e.appendChild(r);let i=this.getSurface();i&&i.appendChild(e)}};e([b()],Q.prototype,`_userSpatialReference`,void 0),e([b()],Q.prototype,`activeTool`,null),e([b({readOnly:!0})],Q.prototype,`allLayerViews`,void 0),e([b({readOnly:!0})],Q.prototype,`layerviewCollections`,null),e([b(S(D,`analyses`))],Q.prototype,`analyses`,null),e([b()],Q.prototype,`animation`,null),e([b()],Q.prototype,`animationsEnabled`,void 0),e([b()],Q.prototype,`focusRegionVisible`,void 0),e([b()],Q.prototype,`focusRegionShortcutEnabled`,void 0),e([b()],Q.prototype,`focusRegion`,null),e([b({readOnly:!0})],Q.prototype,`attributionItems`,null),e([b()],Q.prototype,`attributionVisible`,void 0),e([b()],Q.prototype,`basemapView`,void 0),e([b()],Q.prototype,`center`,null),e([b()],Q.prototype,`defaultsFromMapSettings`,null),e([b()],Q.prototype,`defaultsFromMap`,null),e([b()],Q.prototype,`dependencies`,void 0),e([b()],Q.prototype,`displayFilterEnabled`,void 0),e([b({type:ne})],Q.prototype,`extent`,null),e([b()],Q.prototype,`fatalError`,void 0),e([b(S(O,`graphics`))],Q.prototype,`graphics`,void 0),e([b({readOnly:!0,type:w})],Q.prototype,`heightModelInfo`,null),e([b({type:r.ofType(K)})],Q.prototype,`highlights`,null),e([b({readOnly:!0})],Q.prototype,`interacting`,null),e([b({constructOnly:!0})],Q.prototype,`layerViewFilter`,void 0),e([b({readOnly:!0})],Q.prototype,`navigating`,null),e([b({readOnly:!0})],Q.prototype,`preconditionsReady`,null),e([b({readOnly:!0})],Q.prototype,`typeSpecificPreconditionsReady`,void 0),e([b({type:r,readOnly:!0})],Q.prototype,`layerViews`,void 0),e([b()],Q.prototype,`resolution`,null),e([b({type:N})],Q.prototype,`magnifier`,void 0),e([b({nonNullable:!0,type:V})],Q.prototype,`options`,void 0),e([b({value:null,type:t})],Q.prototype,`map`,null),e([b()],Q.prototype,`padding`,void 0),e([b({readOnly:!0})],Q.prototype,`ready`,void 0),e([b({readOnly:!0})],Q.prototype,`canZoomIn`,null),e([b({readOnly:!0})],Q.prototype,`canZoomOut`,null),e([b()],Q.prototype,`_readyStateWaitingTask`,void 0),e([b({readOnly:!0})],Q.prototype,`readyState`,null),e([b({type:T})],Q.prototype,`spatialReference`,null),e([b()],Q.prototype,`stationary`,null),e([b({type:A})],Q.prototype,`timeExtent`,null),e([b({type:String,nonNullable:!0})],Q.prototype,`timeZone`,null),e([b()],Q.prototype,`tools`,null),e([b()],Q.prototype,`toolViewManager`,void 0),e([b({readOnly:!0})],Q.prototype,`type`,void 0),e([b({type:Number})],Q.prototype,`scale`,void 0),e([b({readOnly:!0})],Q.prototype,`updating`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtentRequired`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtent`,null),e([b()],Q.prototype,`cursor`,null),e([b({readOnly:!0})],Q.prototype,`input`,void 0),e([b({type:H,nonNullable:!0})],Q.prototype,`navigation`,void 0),e([b()],Q.prototype,`layerViewManager`,void 0),e([b()],Q.prototype,`analysisViewManager`,void 0),e([b()],Q.prototype,`selectionManager`,void 0),e([b()],Q.prototype,`width`,void 0),e([b()],Q.prototype,`height`,void 0),e([b({readOnly:!0})],Q.prototype,`resizing`,void 0),e([b({value:null,readOnly:!0})],Q.prototype,`size`,null),e([b({readOnly:!0})],Q.prototype,`suspended`,void 0),e([b({readOnly:!0})],Q.prototype,`viewEvents`,void 0),e([b()],Q.prototype,`_isValid`,void 0),e([b()],Q.prototype,`_readyCycleForced`,void 0),e([b()],Q.prototype,`_lockedSpatialReference`,void 0),e([b()],Q.prototype,`_userTimeZone`,void 0),e([b()],Q.prototype,`_lockedTimeZone`,void 0),e([b()],Q.prototype,`_userTimeExtent`,void 0),e([b()],Q.prototype,`_lockedTimeExtent`,void 0),e([b({type:F})],Q.prototype,`theme`,void 0),e([b({readOnly:!0,type:F})],Q.prototype,`effectiveTheme`,null),e([b({readOnly:!0})],Q.prototype,`registeredComponents`,void 0),Q=Z=e([x(`esri.views.View`)],Q);const $=globalThis.$arcgis;$&&!$.views&&Object.defineProperty($,"views",{configurable:!1,enumerable:!0,writable:!1,value:Q.views});function re(e){return e.layerViews}export{Q as default};
2
+ import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as n}from"../core/asyncUtils.js";import r from"../core/Collection.js";import i from"../core/CollectionFlattener.js";import{referenceSetter as a}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as s}from"../core/Evented.js";import c from"../core/Handles.js";import{makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as u}from"../core/Loadable.js";import d from"../core/Logger.js";import{destroyMaybe as f,abortMaybe as ee}from"../core/maybe.js";import{EsriPromise as te}from"../core/Promise.js";import{after as p}from"../core/promiseUtils.js";import m from"../core/ReactiveSet.js";import{watch as h,sync as g,whenOnce as _,when as v,syncAndInitial as y}from"../core/reactiveUtils.js";import{property as b,subclass as x}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import{UpdatingHandles as C}from"../core/support/UpdatingHandles.js";import ne from"../geometry/Extent.js";import w from"../geometry/HeightModelInfo.js";import T from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as D}from"../support/AnalysesCollection.js";import{GraphicsCollection as O}from"../support/GraphicsCollection.js";import{system as k}from"../time/constants.js";import A from"../time/TimeExtent.js";import{isTimeZoneValid as j}from"../time/timeZoneUtils.js";import M from"./BasemapView.js";import N from"./Magnifier.js";import P from"./SelectionManager.js";import F from"./Theme.js";import{ToolViewManager as I}from"./ToolViewManager.js";import{GlyphMosaic as L}from"./2d/engine/webgl/GlyphMosaic.js";import{makeDefaultHighlightOptions as R}from"./3d/support/DefaultHighlights.js";import z from"./input/Input.js";import{ViewEvents as B}from"./input/ViewEvents.js";import V from"./interactive/options/ViewOptions.js";import H from"./navigation/Navigation.js";import{deduplicateAttributionItems as U}from"./support/attributionUtils.js";import{DefaultsFromMap as W}from"./support/DefaultsFromMap.js";import{defaultHighlightName as G}from"./support/HighlightDefaults.js";import K from"./support/HighlightOptions.js";import q from"./support/LayerViewManager.js";import J from"./support/RequiredFieldsOptions.js";import{checkWebAssemblyRequirements as Y}from"./support/WebAssemblyRequirements.js";import{checkWebGLRequirements as X}from"./support/WebGLRequirements.js";var Z;let Q=class extends s(te){static{Z=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new c,this.updatingHandles=new C,this.allLayerViews=new i({getCollections:()=>this.layerviewCollections,getChildrenFunction:re}),this.animationsEnabled=!0,this.focusRegionVisible=!1,this.focusRegionShortcutEnabled=!1,this.attributionVisible=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new N,this.options=new V,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new z,this.navigation=new H,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new B(this),this.requiredFieldsOptions=new J,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this._glyphMosaic=null,this.theme=null,this.registeredComponents=new m,this.handles.add(h(()=>this.preconditionsReady,e=>{let t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,Z.views.add(this)):(this._lockedSpatialReference=null,Z.views.remove(this)),this.notifyChange(`spatialReference`),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._glyphMosaic?.dispose(),this._teardown();else if(e&&!t){try{this._startup()}catch(e){queueMicrotask(()=>{this.fatalError=new o(`view:startup-error`,`View._startup failed`,e)});return}this._glyphMosaic=new L(1024,1024,!0),this.analysisViewManager?.attach(),this.toolViewManager.attach()}},g)),this.analyses=new D}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,_(()=>this.ready)))),this.basemapView=new M({view:this}),this.layerViewManager=new q({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new I({view:this}),this.selectionManager=new P({view:this}),this.addHandles([v(()=>this.readyState===`map-content-error`&&!this.spatialReference,()=>{d.getLogger(this).warn(`#spatialReference`,`no spatial reference could be derived from the currently added map layers`)}),h(()=>[this.defaultsFromMap,this.initialExtentRequired],([e,t])=>{e&&(e.required={...e.required,extent:t})},y),h(()=>[this.defaultsFromMap,this.ready],([e,t])=>{e&&(e.viewReady=t)},g),h(()=>[this.defaultsFromMap,this.defaultsFromMapInputSpatialReference()],([e,t])=>{e&&(e.inputSpatialReference=t)},y),h(()=>[this.defaultsFromMap,this.defaultsFromMapInputHeightModelInfo()],([e,t])=>{e&&(e.inputHeightModelInfo=t)},y)])}get _layerToLayerviewMapping(){return Z._layerToLayerview}static{this._layerToLayerview=[[`view.map.basemap.baseLayers`,`view.basemapView.baseLayerViews`],[`view.map.basemap.groundLayers`,`view.basemapView.groundLayerViews`],[`view.map.basemap.referenceLayers`,`view.basemapView.referenceLayerViews`],[`view.map.layers`,`view.layerViews`]]}destroy(){this.destroyed||(Z.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set(`navigation`,null)),this.graphics=f(this.graphics),this.analyses=f(this.analyses),this.defaultsFromMap.destroy(),this._set(`defaultsFromMap`,null),this.analysisViewManager=f(this.analysisViewManager),this.toolViewManager=f(this.toolViewManager),this.layerViewManager=f(this.layerViewManager),this.selectionManager=f(this.selectionManager),this.basemapView=f(this.basemapView),this.layerViews.destroyAll(),this.invalidate(),this.handles.destroy(),this.map=f(this.map),this.updatingHandles.destroy())}_startup(){this._set(`ready`,!0)}_teardown(){this._set(`ready`,!1)}whenReady(){return Promise.resolve(this)}toMap(){return d.getLogger(this).error(`#toMap()`,`Not implemented on this instance of View`),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get analyses(){return this._get(`analyses`)}set analyses(e){this._set(`analyses`,e)}get animation(){return this._get(`animation`)}set animation(e){this._set(`animation`,e)}get focusRegion(){return null}get attributionItems(){return this.suspended?[]:U(this._get(`attributionItems`),this.getAttributionItems())}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new W({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get(`extent`)}set extent(e){this._set(`extent`,e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}glyphMosaic(){return this._glyphMosaic}get highlights(){return this._get(`highlights`)??R()}set highlights(e){this._set(`highlights`,a(e,this._get(`highlights`),r.ofType(K)))}get defaultHighlight(){return this.highlights.find(({name:e})=>e===G)}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){if(this.destroying||this.destroyed)return!1;let{map:e,spatialReference:t}=this;return!!(!this.fatalError&&this._isValid&&!this._readyCycleForced&&e&&(!u(e)||e.loaded)&&this.width!==0&&this.height!==0&&t&&this._validateSpatialReference(t)&&(this._lockedSpatialReference||this.defaultsFromMap?.ready)&&this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){let t=this._get(`map`);e!==t&&(e?.destroyed&&(d.getLogger(this).warn(`#map`,`The provided map is already destroyed`,{map:e}),e=null),u(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set(`map`,e))}get canZoomIn(){return!!this.ready}get canZoomOut(){return!!this.ready}get readyState(){if(this.destroyed)return this._get(`readyState`);if(!this.map)return`missing-map`;if(`container`in this&&!this.container)return`missing-container`;if(this.fatalError)return`rendering-error`;if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){let e=!(`loaded`in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?`empty-map`:(this._readyStateWaitingTask||(this._readyStateWaitingTask=n(e=>p(has(`view-readyState-waiting-delay`),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,`ready-state-task`)),this._readyStateWaitingTask?.finished?`map-content-error`:`loading`)}return this._readyStateWaitingTask=ee(this._readyStateWaitingTask),this.removeHandles(`ready-state-task`),this.ready?`ready`:`loading`}get spatialReference(){let{_userSpatialReference:e}=this;if(e&&e.vcsWkid!==null)return e;let t=e??this._lockedSpatialReference??this.getWebDocumentSpatialReference()??this.defaultsFromMap?.spatialReference??null,n=this.defaultsFromMap?.combinedHorizontalAndVerticalSpatialReference;return n?.equals(t)?n:t}set spatialReference(e){let t=!E(e,this._get(`spatialReference`));this._set(`_userSpatialReference`,e),t&&(this._set(`spatialReference`,e),this._spatialReferenceChanged(this.spatialReference))}_spatialReferenceChanged(e){}getWebDocumentSpatialReference(){return null}defaultsFromMapInputSpatialReference(){return this._userSpatialReference??this.getWebDocumentSpatialReference()??(this.ready?this._lockedSpatialReference:null)}defaultsFromMapInputHeightModelInfo(){return this.map?.heightModelInfo??null}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??k}set timeZone(e){this._userTimeZone=e,j(e)||d.getLogger(this).warn(`#timeZone`,`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??`default`}acquireCursor(e,t=`low`){let n=t===`high`?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},i=l(()=>n.remove(r));return n.add(r),this.addHandles(i),i}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new F}registerComponent(e){this.registeredComponents.add(e)}unregisterComponent(e){this.registeredComponents.delete(e)}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getAttributionItems(){return this.allLayerViews.items.flatMap(e=>e.attributionItems)}getDefaultHeightModelInfo(){return(this.map&&`heightModelInfo`in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o(`view:importLayerView-missing`,`importLayerView() not implemented`)}hasLayerViewModule(e){return!1}async validate(){let e=X(this.type);if(e)throw this._displayWebGLError(),d.getLogger(this).warn(`#validate()`,e.message),e;let t=await Y();if(t)throw d.getLogger(this).warn(`#validate()`,t.message),t}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return this.getSpatialReferenceSupport(e)!=null}when(e,t){return this.isResolved()&&!this.ready&&d.getLogger(this).warn(`#when()`,`Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead.`),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}_displayWebGLError(){let e=document.createElement(`div`);e.setAttribute(`style`,`display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;`);let t=document.createElement(`div`);t.innerHTML=`Unable to display map. WebGL2 support is required.`,t.setAttribute(`style`,`font-size: 24px; font-weight: bold;`);let n=document.createElement(`div`);n.innerHTML=`Ensure that your browser and hardware meet the minimum requirements.`,n.setAttribute(`style`,`font-size: 18px;`);let r=document.createElement(`a`);r.innerHTML=`https://esriurl.com/webgl-faq`,r.target=`_blank`,r.setAttribute(`style`,`font-size: 18px;`),r.href=`https://esriurl.com/webgl-faq`,e.appendChild(t),e.appendChild(n),e.appendChild(r);let i=this.getSurface();i&&i.appendChild(e)}};e([b()],Q.prototype,`_userSpatialReference`,void 0),e([b()],Q.prototype,`activeTool`,null),e([b({readOnly:!0})],Q.prototype,`allLayerViews`,void 0),e([b({readOnly:!0})],Q.prototype,`layerviewCollections`,null),e([b(S(D,`analyses`))],Q.prototype,`analyses`,null),e([b()],Q.prototype,`animation`,null),e([b()],Q.prototype,`animationsEnabled`,void 0),e([b()],Q.prototype,`focusRegionVisible`,void 0),e([b()],Q.prototype,`focusRegionShortcutEnabled`,void 0),e([b()],Q.prototype,`focusRegion`,null),e([b({readOnly:!0})],Q.prototype,`attributionItems`,null),e([b()],Q.prototype,`attributionVisible`,void 0),e([b()],Q.prototype,`basemapView`,void 0),e([b()],Q.prototype,`center`,null),e([b()],Q.prototype,`defaultsFromMapSettings`,null),e([b()],Q.prototype,`defaultsFromMap`,null),e([b()],Q.prototype,`dependencies`,void 0),e([b()],Q.prototype,`displayFilterEnabled`,void 0),e([b({type:ne})],Q.prototype,`extent`,null),e([b()],Q.prototype,`fatalError`,void 0),e([b(S(O,`graphics`))],Q.prototype,`graphics`,void 0),e([b({readOnly:!0,type:w})],Q.prototype,`heightModelInfo`,null),e([b({type:r.ofType(K)})],Q.prototype,`highlights`,null),e([b({readOnly:!0})],Q.prototype,`interacting`,null),e([b({constructOnly:!0})],Q.prototype,`layerViewFilter`,void 0),e([b({readOnly:!0})],Q.prototype,`navigating`,null),e([b({readOnly:!0})],Q.prototype,`preconditionsReady`,null),e([b({readOnly:!0})],Q.prototype,`typeSpecificPreconditionsReady`,void 0),e([b({type:r,readOnly:!0})],Q.prototype,`layerViews`,void 0),e([b()],Q.prototype,`resolution`,null),e([b({type:N})],Q.prototype,`magnifier`,void 0),e([b({nonNullable:!0,type:V})],Q.prototype,`options`,void 0),e([b({value:null,type:t})],Q.prototype,`map`,null),e([b()],Q.prototype,`padding`,void 0),e([b({readOnly:!0})],Q.prototype,`ready`,void 0),e([b({readOnly:!0})],Q.prototype,`canZoomIn`,null),e([b({readOnly:!0})],Q.prototype,`canZoomOut`,null),e([b()],Q.prototype,`_readyStateWaitingTask`,void 0),e([b({readOnly:!0})],Q.prototype,`readyState`,null),e([b({type:T})],Q.prototype,`spatialReference`,null),e([b()],Q.prototype,`stationary`,null),e([b({type:A})],Q.prototype,`timeExtent`,null),e([b({type:String,nonNullable:!0})],Q.prototype,`timeZone`,null),e([b()],Q.prototype,`tools`,null),e([b()],Q.prototype,`toolViewManager`,void 0),e([b({readOnly:!0})],Q.prototype,`type`,void 0),e([b({type:Number})],Q.prototype,`scale`,void 0),e([b({readOnly:!0})],Q.prototype,`updating`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtentRequired`,void 0),e([b({readOnly:!0})],Q.prototype,`initialExtent`,null),e([b()],Q.prototype,`cursor`,null),e([b({readOnly:!0})],Q.prototype,`input`,void 0),e([b({type:H,nonNullable:!0})],Q.prototype,`navigation`,void 0),e([b()],Q.prototype,`layerViewManager`,void 0),e([b()],Q.prototype,`analysisViewManager`,void 0),e([b()],Q.prototype,`selectionManager`,void 0),e([b()],Q.prototype,`width`,void 0),e([b()],Q.prototype,`height`,void 0),e([b({readOnly:!0})],Q.prototype,`resizing`,void 0),e([b({value:null,readOnly:!0})],Q.prototype,`size`,null),e([b({readOnly:!0})],Q.prototype,`suspended`,void 0),e([b({readOnly:!0})],Q.prototype,`viewEvents`,void 0),e([b()],Q.prototype,`_isValid`,void 0),e([b()],Q.prototype,`_readyCycleForced`,void 0),e([b()],Q.prototype,`_lockedSpatialReference`,void 0),e([b()],Q.prototype,`_userTimeZone`,void 0),e([b()],Q.prototype,`_lockedTimeZone`,void 0),e([b()],Q.prototype,`_userTimeExtent`,void 0),e([b()],Q.prototype,`_lockedTimeExtent`,void 0),e([b({type:F})],Q.prototype,`theme`,void 0),e([b({readOnly:!0,type:F})],Q.prototype,`effectiveTheme`,null),e([b({readOnly:!0})],Q.prototype,`registeredComponents`,void 0),Q=Z=e([x(`esri.views.View`)],Q);const $=globalThis.$arcgis;$&&!$.views&&Object.defineProperty($,"views",{configurable:!1,enumerable:!0,writable:!1,value:Q.views});function re(e){return e.layerViews}export{Q 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"../../../Graphic.js";import n from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{ignoreAbortErrors as s,isAborted as c,throwIfAborted as l}from"../../../core/promiseUtils.js";import{pausable as u,sync as d,watch as f,syncAndInitial as p}from"../../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import _ from"../../../layers/GraphicsLayer.js";import v from"../../../symbols/CIMSymbol.js";import y from"../../../symbols/SimpleLineSymbol.js";import b from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as x}from"../ExclusiveOperationManager.js";import{isPolyline as S,isValidInputGraphic as C,isInternalGraphic as w}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as T}from"../../input/InputManager.js";import{isCancelEvent as E}from"../../interactive/interactiveToolUtils.js";import{makeAllLayerSnappingOptions as D}from"../../interactive/snapping/allLayerSnapping.js";import O from"../../../widgets/Sketch/SketchViewModel.js";let k=class extends n{constructor(e){super(e),this._sketchViewModels=new i,this._updatingHandles=new g,this._operationManager=new x}initialize(){let{view:e}=this;this._allLayerSnappingOptions=D(this.view,{selfEnabled:!0,excludeInternal:!0}),this._graphicsLayer=new _({listMode:`hide`,internal:!0}),this._externalGeometryChangeHandle=u(()=>this._analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),d),this.addHandles([f(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,geometryVisualizationVisible:this._analysis.viewOptions.geometryVisualizationVisible,visible:this.analysisViewData.visible}),({map:e,internalGraphicsLayer:t,state:n,geometryVisualizationVisible:r,visible:i})=>{j(e,t);let a=this.sketchGraphic;switch(a&&(a.visible=i),n){case`idle`:case`reshaping-disabled`:a&&!r&&(a.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:s(this._startReshape());break;case`awaiting-sketch`:this.analysisViewData.interactive=!0}},p),f(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},p),this._allLayerSnappingOptions,this._externalGeometryChangeHandle])}destroy(){this._operationManager.destroy(),this._sketchViewModels.drain(e=>o(e));let e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateAnalysisFromSketchGraphic())}get state(){let{visible:e,interactive:t}=this.analysisViewData;if(!e)return`idle`;switch(this._operationManager.currentOperationType){case`place`:return this._sketching?`sketching`:`awaiting-sketch`;case`pick-feature`:return`picking`;default:return this._analysis.geometry?t?`reshaping`:`reshaping-disabled`:`idle`}}get updating(){return this._sketchViewModels.some(e=>e.updating)||this._updatingHandles.updating}get _sketching(){return this._sketchViewModels.some(e=>e.createGraphic===this.sketchGraphic)}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return A(this.view.type)}place(e){return this._operationManager.start(`place`,async t=>{let n=this._createSketchViewModel(),r=this._analysis.clone();this._ensureUpdatedSketchGraphic();let i=this.sketchGraphic,o=this._analysis.elevationInfo,l=a(()=>{this.sketchGraphic===i&&(this._graphicsLayer.elevationInfo=o)}),u=n.on(`create`,e=>{switch(e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo;break;case`active`:this._updateAnalysisFromSketchGraphic();break;case`complete`:this.sketchGraphic&&(this._updateAnalysisFromSketchGraphic(),this._addSketchGraphic(this.sketchGraphic)),t.stop();break;case`cancel`:t.stop()}});t.handles.push(u,a(()=>{if(u.remove(),n.destroy(),this._sketchViewModels.remove(n),this._updateAnalysisFromSketchGraphic(),!this._analysis.valid)return this._clear(),t.reject();if(c(e)||r.equals(this._analysis))return t.reject();t.resolve({})}),l),this._graphicsLayer.elevationInfo=M,await this._updatingHandles.addPromise(s(n.create(`polyline`)))},e)}async pickFeature(e){return this._operationManager.start(`pick-feature`,async e=>{let{view:t}=this;t.closePopup();let n=null;e.handles.push(t.on(`immediate-click`,i=>{i.defer(async()=>{n?.abort(),n=r(async n=>{let{results:r}=await t.hitTest(i);l(n);let a=null;for(let e of r)if(e.type===`graphic`&&C(e.graphic)&&!w(e.graphic)){a=e.graphic;break}a&&(i.preventDefault(),i.stopPropagation(),this._externalGeometryChangeHandle.pause(),this.sketchGraphic=null,this._analysis.setGeometryFromFeature(a),this._externalGeometryChangeHandle.resume(),e.resolve({feature:a}),e.stop())}),await n.promise})},T.TOOL),t.on(`key-down`,t=>{E(t)&&(e.reject(),e.stop())},T.TOOL),t.acquireCursor(`crosshair`,`high`),a(()=>{n?.abort(),e.reject()})),t.focus()},e)}_startReshape(){let e=this._createSketchViewModel();return this._sketchViewModels.add(e),this._operationManager.start(`reshape`,async t=>{let n=()=>{let t=this._ensureUpdatedSketchGraphic();return t?this._updatingHandles.addPromise(e.update(t,{tool:`reshape`})):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let r=e.on(`update`,e=>{this._updateAnalysisFromSketchGraphic(),e.state===`complete`&&(this.state===`reshaping`?s(n()):t.resolve())});t.handles.push(r,a(()=>{r.remove(),this._sketchViewModels.remove(e),e.destroy(),t.resolve()})),await n()})}_createSketchViewModel(){return new O({layer:this._graphicsLayer,view:this.view,defaultCreateOptions:{mode:`click`,hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol,snappingOptions:this._allLayerSnappingOptions.options})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,this._graphicsLayer.removeAll(),null;let n=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return n.geometry=e,this._addSketchGraphic(n),n}_addSketchGraphic(e){let{graphics:t}=this._graphicsLayer;t.includes(e)||t.add(e),t.length!==1&&t.removeMany(t.filter(t=>t!==e))}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic?.geometry;S(e)||(e=null);let t=this._analysis;t.geometry!==e&&(t.geometry=e),this._externalGeometryChangeHandle.resume()}};e([m({constructOnly:!0})],k.prototype,`analysisViewData`,void 0),e([m({constructOnly:!0})],k.prototype,`view`,void 0),e([m()],k.prototype,`sketchGraphic`,null),e([m({nonNullable:!0})],k.prototype,`state`,null),e([m()],k.prototype,`updating`,null),e([m()],k.prototype,`_sketching`,null),e([m()],k.prototype,`_analysis`,null),e([m()],k.prototype,`_lineSymbol`,null),k=e([h(`esri.views.analysis.ElevationProfile.ElevationProfileTool`)],k);function A(e){if(e===`2d`){let e={type:`CIMSolidStroke`,enable:!0,capStyle:`Butt`,joinStyle:`Round`,width:1.5};return new v({data:{type:`CIMSymbolReference`,symbol:{type:`CIMLineSymbol`,symbolLayers:[{...e,effects:[{type:`CIMGeometricEffectDashes`,dashTemplate:[5,4],lineDashEnding:`FullGap`,controlPointEnding:`NoConstraint`}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new y({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}const M=new b({mode:`on-the-ground`,offset:0});export{k as ElevationProfileTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{ignoreAbortErrors as s,isAborted as c,throwIfAborted as l}from"../../../core/promiseUtils.js";import{pausable as u,sync as d,watch as f,syncAndInitial as p}from"../../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import _ from"../../../layers/GraphicsLayer.js";import v from"../../../symbols/CIMSymbol.js";import y from"../../../symbols/SimpleLineSymbol.js";import b from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as x}from"../ExclusiveOperationManager.js";import{isPolyline as S,isValidInputGraphic as C,isInternalGraphic as w}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as T}from"../../input/InputManager.js";import{isCancelEvent as E}from"../../interactive/interactiveToolUtils.js";import{makeGeometryAnalysisSnappingOptions as D}from"../../interactive/snapping/allLayerSnapping.js";import O from"../../../widgets/Sketch/SketchViewModel.js";let k=class extends n{constructor(e){super(e),this._sketchViewModels=new i,this._updatingHandles=new g,this._operationManager=new x}initialize(){let{view:e}=this;this._allLayerSnappingOptions=D(e),this._graphicsLayer=new _({listMode:`hide`,internal:!0}),this._externalGeometryChangeHandle=u(()=>this._analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),d),this.addHandles([f(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,geometryVisualizationVisible:this._analysis.viewOptions.geometryVisualizationVisible,visible:this.analysisViewData.visible}),({map:e,internalGraphicsLayer:t,state:n,geometryVisualizationVisible:r,visible:i})=>{j(e,t);let a=this.sketchGraphic;switch(a&&(a.visible=i),n){case`idle`:case`reshaping-disabled`:a&&!r&&(a.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:s(this._startReshape());break;case`awaiting-sketch`:this.analysisViewData.interactive=!0}},p),f(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},p),this._allLayerSnappingOptions,this._externalGeometryChangeHandle])}destroy(){this._operationManager.destroy(),this._sketchViewModels.drain(e=>o(e));let e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateAnalysisFromSketchGraphic())}get state(){let{visible:e,interactive:t}=this.analysisViewData;if(!e)return`idle`;switch(this._operationManager.currentOperationType){case`place`:return this._sketching?`sketching`:`awaiting-sketch`;case`pick-feature`:return`picking`;default:return this._analysis.geometry?t?`reshaping`:`reshaping-disabled`:`idle`}}get updating(){return this._sketchViewModels.some(e=>e.updating)||this._updatingHandles.updating}get _sketching(){return this._sketchViewModels.some(e=>e.createGraphic===this.sketchGraphic)}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return A(this.view.type)}place(e){return this._operationManager.start(`place`,async t=>{let n=this._createSketchViewModel(),r=this._analysis.clone();this._ensureUpdatedSketchGraphic();let i=this.sketchGraphic,o=this._analysis.elevationInfo,l=a(()=>{this.sketchGraphic===i&&(this._graphicsLayer.elevationInfo=o)}),u=n.on(`create`,e=>{switch(e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo;break;case`active`:this._updateAnalysisFromSketchGraphic();break;case`complete`:this.sketchGraphic&&(this._updateAnalysisFromSketchGraphic(),this._addSketchGraphic(this.sketchGraphic)),t.stop();break;case`cancel`:t.stop()}});t.handles.push(u,a(()=>{if(u.remove(),n.destroy(),this._sketchViewModels.remove(n),this._updateAnalysisFromSketchGraphic(),!this._analysis.valid)return this._clear(),t.reject();if(c(e)||r.equals(this._analysis))return t.reject();t.resolve({})}),l),this._graphicsLayer.elevationInfo=M,await this._updatingHandles.addPromise(s(n.create(`polyline`)))},e)}async pickFeature(e){return this._operationManager.start(`pick-feature`,async e=>{let{view:t}=this;t.closePopup();let n=null;e.handles.push(t.on(`immediate-click`,i=>{i.defer(async()=>{n?.abort(),n=r(async n=>{let{results:r}=await t.hitTest(i);l(n);let a=null;for(let e of r)if(e.type===`graphic`&&C(e.graphic)&&!w(e.graphic)){a=e.graphic;break}a&&(i.preventDefault(),i.stopPropagation(),this._externalGeometryChangeHandle.pause(),this.sketchGraphic=null,this._analysis.setGeometryFromFeature(a),this._externalGeometryChangeHandle.resume(),e.resolve({feature:a}),e.stop())}),await n.promise})},T.TOOL),t.on(`key-down`,t=>{E(t)&&(e.reject(),e.stop())},T.TOOL),t.acquireCursor(`crosshair`,`high`),a(()=>{n?.abort(),e.reject()})),t.focus()},e)}_startReshape(){let e=this._createSketchViewModel();return this._sketchViewModels.add(e),this._operationManager.start(`reshape`,async t=>{let n=()=>{let t=this._ensureUpdatedSketchGraphic();return t?this._updatingHandles.addPromise(e.update(t,{tool:`reshape`})):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let r=e.on(`update`,e=>{this._updateAnalysisFromSketchGraphic(),e.state===`complete`&&(this.state===`reshaping`?s(n()):t.resolve())});t.handles.push(r,a(()=>{r.remove(),this._sketchViewModels.remove(e),e.destroy(),t.resolve()})),await n()})}_createSketchViewModel(){return new O({layer:this._graphicsLayer,view:this.view,defaultCreateOptions:{mode:`click`,hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol,snappingOptions:this._allLayerSnappingOptions.options})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,this._graphicsLayer.removeAll(),null;let n=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return n.geometry=e,this._addSketchGraphic(n),n}_addSketchGraphic(e){let{graphics:t}=this._graphicsLayer;t.includes(e)||t.add(e),t.length!==1&&t.removeMany(t.filter(t=>t!==e))}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic?.geometry;S(e)||(e=null);let t=this._analysis;t.geometry!==e&&(t.geometry=e),this._externalGeometryChangeHandle.resume()}};e([m({constructOnly:!0})],k.prototype,`analysisViewData`,void 0),e([m({constructOnly:!0})],k.prototype,`view`,void 0),e([m()],k.prototype,`sketchGraphic`,null),e([m({nonNullable:!0})],k.prototype,`state`,null),e([m()],k.prototype,`updating`,null),e([m()],k.prototype,`_sketching`,null),e([m()],k.prototype,`_analysis`,null),e([m()],k.prototype,`_lineSymbol`,null),k=e([h(`esri.views.analysis.ElevationProfile.ElevationProfileTool`)],k);function A(e){if(e===`2d`){let e={type:`CIMSolidStroke`,enable:!0,capStyle:`Butt`,joinStyle:`Round`,width:1.5};return new v({data:{type:`CIMSymbolReference`,symbol:{type:`CIMLineSymbol`,symbolLayers:[{...e,effects:[{type:`CIMGeometricEffectDashes`,dashTemplate:[5,4],lineDashEnding:`FullGap`,controlPointEnding:`NoConstraint`}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new y({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}const M=new b({mode:`on-the-ground`,offset:0});export{k as ElevationProfileTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{equalsMaybe as r,destroyMaybe as i}from"../../core/maybe.js";import{memoize as a}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveSet.js";import{watch as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{pointEquals as h,pointNear as g}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as y}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as b}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as C,Part as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as T}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as E}from"../interactive/sketch/constraints.js";import{getPointConstraint as D,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as k,constraintSpaceToPoint as A}from"../interactive/sketch/constraintUtils.js";import j from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as N}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../interactive/snapping/snappingUtils.js";const I=`crosshair`,L=`progress`,R=Symbol(),z=Symbol();let B=class extends t{constructor(e){super(e),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new s,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new m,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=a(D),this._getPolylineOrPolygonConstraint=a(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new j,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,e.elevationInfo??(this.elevationInfo=_(!!e.hasZ))}initializePointer(){let e=this.view.inputManager?.latestPointerInfo;e!=null&&e.type!==`touch`&&this._updatePointer(e.location,e.id,e.type)}initialize(){let{geometryType:e,view:t}=this,n=t.spatialReference,i=`viewingMode`in t.state?t.state.viewingMode:2,a=e===`segment`||e===`multipoint`?`polyline`:e;this.coordinateHelper=b(this.hasZ,this.hasM,n),this._editGeometryOperations=new T(new C(a,this.coordinateHelper),i),this._snappingOperation=new P({view:t}),this.addHandles([c(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:e,constraint:t},n)=>{let{snappingOptions:r}=this;if(r&&(r.forceDisabled=t!=null&&E(t)),n!=null&&e===n.stagedPoint&&t!==n.constraint)return this._onKeyboardBasedChange();this._processCursor(e??this._screenToMap(this._stagedScreenPoint))},{equals:(e,t)=>e.stagedPoint===t.stagedPoint&&r(e.constraint,t.constraint)}),c(()=>this.view.viewpoint,(e,t)=>{e&&t&&p(e,t)&&this._onKeyboardBasedChange()})]),this._activePart=new w(n,i),this._editGeometryOperations.data.parts.push(this._activePart);let s=this.segmentLabels;s!=null&&(s.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles(c(()=>this.labelOptions.enabled,e=>{s.visible=e},l))),this.addHandles(this._editGeometryOperations.on([`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates),r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;h(r,this.firstVertex)||(this.firstVertex=r);let i=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;h(i,this.lastVertex)||(this.lastVertex=i);let a=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(h(a,this.secondToLastVertex)||(this.secondToLastVertex=a),this._processCursor(this.cursorVertex),e.type){case`vertex-add`:this.emit(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this.emit(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this.emit(e.type,{...e,removed:n,vertices:t})}}));let u=this._manipulator=new y({consumesClicks:!1,grabbableForEvent:e=>this.drawingMode!==`click`||e.pointerType===`touch`&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(u),u.grabbable=e!==`point`&&e!==`multipoint`,this.addHandles([u.events.on(`immediate-click`,e=>this._onImmediateClick(e)),u.events.on(`immediate-double-click`,e=>this._onImmediateDoubleClick(e)),c(()=>this.drawingMode,()=>{this.removeHandles(R),this.addHandles(this._createManipulatorDragPipeline(u),R)},l),c(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:e})=>{u.cursor=e},l)]),F(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);if(this.snappingManager!=null){let e=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,t);this._updatingHandles.consumePromise(o(e))}})}destroy(){i(this.segmentLabels),i(this._snappingOperation),this._editGeometryOperations=i(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){let{_stagedPointerId:e,_manipulator:t}=this;return e!=null&&this._pointerDownStates.has(e)||t.grabbing||!t.interactive}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){let e=this._updateAndGetEffectiveDrawSurface();return this.view.type===`3d`&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(e=>this.coordinateHelper.vectorToArray(e.pos))}get _constraint(){let{constraints:e,constraintsEnabled:t}=this;if(e&&t)switch(this.geometryType){case`point`:case`multipoint`:return this._getPointConstraint(e);case`polygon`:case`polyline`:return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,e)}}set drawingMode(e){this._set(`drawingMode`,e??v)}get effectiveCursor(){return this.loading?L:this._hideDefaultCursor?null:this.cursor||I}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return this.snappingManager==null?null:this.snappingManager.options}get cursorVertex(){return this._get(`cursorVertex`)}get visualizationCursorVertex(){return this._stagedPointerType===`mouse`?this.cursorVertex:null}get committableVertex(){let{cursorVertex:e,lastVertex:t,firstVertex:n,geometryType:r}=this;return r===`polygon`&&g(e,n)||g(e,t)?null:e}get updating(){return this.loading||this._updatingHandles.updating||!!this.segmentLabels?.updating}get geometryIncludingUncommittedVertices(){let{committedVertices:e,committableVertex:t,coordinateHelper:n}=this,r=e.slice();return t!=null&&r.push(n.pointToArray(t)),r}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();let{committableVertex:e}=this;e!=null&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e),this._activePart)}complete(e){let t=e?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();let{geometryType:n,numCommittedVertices:r}=this,i=n===`multipoint`&&r===0||n===`polyline`&&r<2||n===`polygon`&&r<3;(n===`segment`||n===`point`)&&this.commitStagedVertex(),this._createOperationCompleted=!i,(this.isCompleted||t)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit(`complete`,{vertices:this.committedVertices.map((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e})),aborted:t,type:`complete`}))}onInputEvent(e){switch(e.type){case`pointer-down`:this._pointerDownStates.add(e.pointerId);break;case`pointer-up`:this._pointerDownStates.delete(e.pointerId)}switch(e.type){case`pointer-move`:return this._onPointerMove(e);case`hold`:return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(e){let t=n(this.cursorVertex),r=n(e),i=r&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(r)??r),a=this._snapToClosingVertex(i),o=this._applyConstraints(a);g(t,o)||(this._set(`cursorVertex`,o),this.segmentLabels?.set(`stagedVertex`,o==null?null:this.coordinateHelper.pointToVector(o)),o==null||this._stagedPointerType!==`mouse`?this.emit(`cursor-remove`):this.emit(`cursor-update`,{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:`apply`,type:`vertex-update`}))}_snapToClosingVertex(e){if(e==null||this._isDragging||this.geometryType!==`polygon`||this.numCommittedVertices<=2)return e;let t=this._mapToScreen(e);if(!t)return e;let n=this._activePart;return this._vertexWithinPointerDistance(n.vertices[0].pos,t)?this.firstVertex:this._vertexWithinPointerDistance(n.vertices.at(-1).pos,t)?this.lastVertex:e}_createManipulatorDragPipeline(e){switch(this.drawingMode){case`click`:return this._createManipulatorDragPipelineClick(e);case`freehand`:return this._createManipulatorDragPipelineFreehand(e);case`hybrid`:return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,(e,t,n,r)=>{let i=r===`touch`&&this._snappingEnabled;if(this.isCompleted||!i)return;let{snappingStep:a,cancelSnapping:o}=N({predicate:()=>i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:r,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n.next(e=>(i&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),e)).next(o),t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._processCursor(e.mapStart),(this.geometryType===`segment`||i&&!this.numCommittedVertices)&&this.commitStagedVertex()),e)).next(S(this.view,this.elevationInfo)).next(...a).next(e=>(i&&(this._processCursor(e.mapEnd),e.action===`end`&&this.commitStagedVertex()),e)).next(e=>(e.action===`end`&&(this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()),e))})}_createManipulatorDragPipelineFreehand(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.committableVertex??this._processCursor(e.mapStart),this.geometryType===`segment`&&this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this.complete()}return e})})}_createManipulatorDragPipelineHybrid(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),z),this._processCursor(e.mapStart),this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),this.removeHandles(z),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()}return e})})}get _drawAtFixedElevation(){let{constraintsEnabled:e,constraintZ:t,geometryType:n,numCommittedVertices:r}=this;return e?t!=null||n===`segment`&&r>0:(n===`segment`||n===`polygon`)&&r>0}_updateAndGetEffectiveDrawSurface(){let{constraintsEnabled:e,coordinateHelper:t,drawSurface:n,elevationDrawSurface:r,snapToSceneEnabled:i}=this;if(r==null)return n;if(!this.hasZ)return r.defaultZ=null,r;let a=this.elevationInfo?.mode,o=this.defaultZ,s=e||a===`absolute-height`;return i!=null&&(s=i),a===`on-the-ground`&&(s=!1),this._drawAtFixedElevation&&(o=(e?this.constraintZ:null)??t.getZ(this._activePart.vertices[0].pos),s=!1),s?n:(r.defaultZ=o,r)}_mapToScreen(e){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),this.drawingMode===`click`&&e.pointerType===`touch`&&this._snappingEnabled&&this._processCursor(e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if(!(e.pointerType===`mouse`&&e.button===2||this._manipulator.dragging))try{let{drawingMode:t,geometryType:n}=this;this._stagedPointerType=e.pointerType,this._stagedScreenPoint=e.screenPoint;let r=this._screenToMap(e.screenPoint);if(r==null||r==null||t===`freehand`&&n!==`point`&&n!==`multipoint`)return;if((!this._snappingEnabled||this.cursorVertex==null)&&this._processCursor(r),this.committableVertex==null){this.complete();return}this.commitStagedVertex(),e.pointerType!==`mouse`&&this._processCursor(null),(t===`freehand`&&this.geometryType!==`multipoint`||n===`point`||n===`segment`&&this.numCommittedVertices===2||n===`segment`&&t===`hybrid`&&this.numCommittedVertices===1)&&this.complete()}finally{e.stopPropagation()}}_onImmediateDoubleClick(e){this._manipulator.dragging||this.geometryType===`point`||(this.complete(),e.stopPropagation())}_onPointerMove(e){let t=u(e.x,e.y);this._updatePointer(t,e.pointerId,e.pointerType)&&e.stopPropagation()}_updatePointer(e,t,n){return this._stagedScreenPoint=e,this._stagedPointerType=n,this._stagedPointerId=t,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(e,n),!0)}_onKeyboardBasedChange(){this._stagedPointerType!==`mouse`||!this._stagedScreenPoint||this._stagedPointerId==null||this._isDragging?this._snappingOperation.abort():this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType)}_processCursorMovementRelativeToSurface(e,t){let n=this._snappingOperation,r=this._screenToMap(e),i=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(r==null){this._hideDefaultCursor=!0,this._processCursor(null),n.abort();return}this._hideDefaultCursor=!1;let a=this.snappingManager;if(a==null){this._processCursor(r),n.abort();return}let s=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(n.snap({point:r,scenePoint:i},a,s)))}_applyConstraints(e){let{_constraint:t,constraints:n}=this;if(!e||!n||!t)return e;let{context:r}=n,i=k(e,r),a=i?t.closestTo(i):void 0;if(!a)return e;let o=A(a,e,r),s=this.view.type===`2d`||r.elevationInfo.mode!==`absolute-height`;return o!=null&&s&&this.constraintZ!=null&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(e){return e?this._updateAndGetEffectiveDrawSurface()?.screenToMap(e):null}_screenToMapDragEventStep(){let e=null;return t=>{if(t.action===`start`&&(e=this._screenToMap(t.screenStart)),e==null)return null;let n=this._screenToMap(t.screenEnd);return n==null?null:{...t,mapStart:e,mapEnd:n}}}_vertexWithinPointerDistance(e,t){let n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return n!=null&&V(n,t,25)}_getSnappingContext(e){let t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:t==null?null:{value:t,elevationInfo:this.elevationInfo},drawConstraints:this.constraints})}};e([d()],B.prototype,`_hideDefaultCursor`,void 0),e([d()],B.prototype,`_stagedPointerId`,void 0),e([d()],B.prototype,`_isDragging`,null),e([d()],B.prototype,`_snappingOperation`,void 0),e([d()],B.prototype,`_snappingEnabled`,null),e([d({constructOnly:!0})],B.prototype,`graphic`,void 0),e([d()],B.prototype,`constraintsEnabled`,void 0),e([d()],B.prototype,`constraints`,void 0),e([d()],B.prototype,`_constraint`,null),e([d()],B.prototype,`constraintZ`,void 0),e([d()],B.prototype,`defaultZ`,void 0),e([d()],B.prototype,`isDraped`,void 0),e([d({value:v})],B.prototype,`drawingMode`,null),e([d({constructOnly:!0})],B.prototype,`elevationDrawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`elevationInfo`,void 0),e([d({constructOnly:!0,type:j})],B.prototype,`labelOptions`,void 0),e([d({constructOnly:!0})],B.prototype,`geometryType`,void 0),e([d({constructOnly:!0})],B.prototype,`hasM`,void 0),e([d({constructOnly:!0})],B.prototype,`hasZ`,void 0),e([d()],B.prototype,`cursor`,void 0),e([d()],B.prototype,`effectiveCursor`,null),e([d()],B.prototype,`loading`,void 0),e([d({constructOnly:!0})],B.prototype,`manipulators`,void 0),e([d({constructOnly:!0})],B.prototype,`drawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`segmentLabels`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingManager`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingVisualizer`,void 0),e([d()],B.prototype,`snapToSceneEnabled`,void 0),e([d({readOnly:!0})],B.prototype,`cursorVertex`,null),e([d({readOnly:!0})],B.prototype,`visualizationCursorVertex`,null),e([d()],B.prototype,`committableVertex`,null),e([d()],B.prototype,`firstVertex`,void 0),e([d()],B.prototype,`lastVertex`,void 0),e([d()],B.prototype,`secondToLastVertex`,void 0),e([d()],B.prototype,`updating`,null),e([d({constructOnly:!0})],B.prototype,`view`,void 0),B=e([f(`esri.views.draw.DrawOperation`)],B);function V(e,t,n){let r=e.x-t.x,i=e.y-t.y;return r*r+i*i<=n}export{B as DrawOperation,I as defaultCursor,L as defaultLoadingCursor};
2
+ import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{equalsMaybe as r,destroyMaybe as i}from"../../core/maybe.js";import{memoize as a}from"../../core/memoize.js";import{ignoreAbortErrors as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveSet.js";import{watch as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{diff as p}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{pointEquals as h,pointNear as g}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as _}from"../../support/elevationInfoUtils.js";import{defaultDrawingMode as v}from"./drawingModes.js";import{LegacyDrawManipulator as y}from"./LegacyDrawManipulator.js";import{createCoordinateHelper as b}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as C,Part as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as T}from"../interactive/editGeometry/EditGeometryOperations.js";import{isPoint as E}from"../interactive/sketch/constraints.js";import{getPointConstraint as D,getPolylineOrPolygonConstraint as O,pointToConstraintSpace as k,constraintSpaceToPoint as A}from"../interactive/sketch/constraintUtils.js";import j from"../interactive/sketch/SketchLabelOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as N}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as P}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as F}from"../interactive/snapping/snappingUtils.js";const I=`crosshair`,L=`progress`,R=Symbol(),z=Symbol();let B=class extends t{constructor(e){super(e),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new s,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new m,this._stagedPointerId=null,this.constraintsEnabled=!1,this.constraints=void 0,this._getPointConstraint=a(D),this._getPolylineOrPolygonConstraint=a(O),this.constraintZ=null,this.defaultZ=null,this.isDraped=!0,this.labelOptions=new j,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.firstVertex=null,this.lastVertex=null,this.secondToLastVertex=null,e.elevationInfo??(this.elevationInfo=_(!!e.hasZ))}initializePointer(){let e=this.view.inputManager?.latestPointerInfo;e!=null&&e.type!==`touch`&&this._updatePointer(e.location,e.id,e.type)}initialize(){let{geometryType:e,view:t}=this,n=t.spatialReference,i=`viewingMode`in t.state?t.state.viewingMode:2,a=e===`segment`||e===`multipoint`?`polyline`:e;this.coordinateHelper=b(this.hasZ,this.hasM,n),this._editGeometryOperations=new T(new C(a,this.coordinateHelper),i),this._snappingOperation=new P({view:t}),this.addHandles([c(()=>({stagedPoint:this._snappingOperation.stagedPoint,constraint:this._constraint}),({stagedPoint:e,constraint:t},n)=>{let{snappingOptions:r}=this;if(r&&(r.forceDisabled=t!=null&&E(t)),n!=null&&e===n.stagedPoint&&t!==n.constraint)return this._onKeyboardBasedChange();this._processCursor(e??this._screenToMap(this._stagedScreenPoint))},{equals:(e,t)=>e.stagedPoint===t.stagedPoint&&r(e.constraint,t.constraint)}),c(()=>this.view.viewpoint,(e,t)=>{e&&t&&p(e,t)&&this._onKeyboardBasedChange()})]),this._activePart=new w(n,i),this._editGeometryOperations.data.parts.push(this._activePart);let s=this.segmentLabels;s!=null&&(s.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles(c(()=>this.labelOptions.enabled,e=>{s.visible=e},l))),this.addHandles(this._editGeometryOperations.on([`vertex-add`,`vertex-update`,`vertex-remove`],e=>{let t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),n=t.map(e=>e.coordinates),r=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getFirstVertex()?.pos)??null;h(r,this.firstVertex)||(this.firstVertex=r);let i=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.getLastVertex()?.pos)??null;h(i,this.lastVertex)||(this.lastVertex=i);let a=this.coordinateHelper.vectorToDehydratedPoint(this._activePart.segments.at(-1)?.leftVertex?.pos)??null;switch(h(a,this.secondToLastVertex)||(this.secondToLastVertex=a),this._processCursor(this.cursorVertex),e.type){case`vertex-add`:this.emit(e.type,{...e,added:n,vertices:t});break;case`vertex-update`:this.emit(e.type,{...e,updated:n,vertices:t});break;case`vertex-remove`:this.emit(e.type,{...e,removed:n,vertices:t})}}));let u=this._manipulator=new y({consumesClicks:!1,grabbableForEvent:e=>this.drawingMode!==`click`||e.pointerType===`touch`&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(u),u.grabbable=e!==`point`&&e!==`multipoint`,this.addHandles([u.events.on(`immediate-click`,e=>this._onImmediateClick(e)),u.events.on(`immediate-double-click`,e=>this._onImmediateDoubleClick(e)),c(()=>this.drawingMode,()=>{this.removeHandles(R),this.addHandles(this._createManipulatorDragPipeline(u),R)},l),c(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:e})=>{u.cursor=e},l)]),F(this,()=>{let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);if(this.snappingManager!=null){let e=this._snappingOperation.snapAgainNearPreviousMapPoint(this.snappingManager,t);this._updatingHandles.consumePromise(o(e))}})}destroy(){i(this.segmentLabels),i(this._snappingOperation),this._editGeometryOperations=i(this._editGeometryOperations),this._updatingHandles.destroy()}get _isDragging(){let{_stagedPointerId:e,_manipulator:t}=this;return e!=null&&this._pointerDownStates.has(e)||t.grabbing||!t.interactive}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){let e=this._updateAndGetEffectiveDrawSurface();return this.view.type===`3d`&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activePart.vertices.map(e=>this.coordinateHelper.vectorToArray(e.pos))}get _constraint(){let{constraints:e,constraintsEnabled:t}=this;if(e&&t)switch(this.geometryType){case`point`:case`multipoint`:return this._getPointConstraint(e);case`polygon`:case`polyline`:return this._getPolylineOrPolygonConstraint(this.lastVertex,this.secondToLastVertex,e)}}set drawingMode(e){this._set(`drawingMode`,e??v)}get effectiveCursor(){return this.loading?L:this._hideDefaultCursor?null:this.cursor||I}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activePart.vertices.length}get snappingOptions(){return this.snappingManager==null?null:this.snappingManager.options}get cursorVertex(){return this._get(`cursorVertex`)}get visualizationCursorVertex(){return this._stagedPointerType===`mouse`?this.cursorVertex:null}get committableVertex(){let{cursorVertex:e,lastVertex:t,firstVertex:n,geometryType:r}=this;return r===`polygon`&&g(e,n)||g(e,t)?null:e}get updating(){return this.loading||this._updatingHandles.updating||!!this.segmentLabels?.updating}get geometryIncludingUncommittedVertices(){let{committedVertices:e,committableVertex:t,coordinateHelper:n}=this,r=e.slice();return t!=null&&r.push(n.pointToArray(t)),r}cancel(){this.complete({aborted:!0})}commitStagedVertex(){this._snappingOperation.abort();let{committableVertex:e}=this;e!=null&&this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e),this._activePart)}complete(e){let t=e?.aborted||!1;this._snappingOperation.abort(),this.snappingManager?.doneSnapping();let{geometryType:n,numCommittedVertices:r}=this,i=n===`multipoint`&&r===0||n===`polyline`&&r<2||n===`polygon`&&r<3;(n===`segment`||n===`point`)&&this.commitStagedVertex(),this._createOperationCompleted=!i,(this.isCompleted||t)&&(this._stagedScreenPoint=null,this._stagedPointerId=null,this._stagedPointerType=null,this._processCursor(null),this.emit(`complete`,{vertices:this.committedVertices.map((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e})),aborted:t,type:`complete`}))}onInputEvent(e){switch(e.type){case`pointer-down`:this._pointerDownStates.add(e.pointerId);break;case`pointer-up`:this._pointerDownStates.delete(e.pointerId)}switch(e.type){case`pointer-move`:return this._onPointerMove(e);case`hold`:return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_processCursor(e){let t=n(this.cursorVertex),r=n(e),i=r&&(this._updateAndGetEffectiveDrawSurface()?.constrainZ(r)??r),a=this._snapToClosingVertex(i),o=this._applyConstraints(a);g(t,o)||(this._set(`cursorVertex`,o),this.segmentLabels?.set(`stagedVertex`,o==null?null:this.coordinateHelper.pointToVector(o)),o==null||this._stagedPointerType!==`mouse`?this.emit(`cursor-remove`):this.emit(`cursor-update`,{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activePart.vertices.length,coordinates:this.coordinateHelper.pointToArray(o)}],operation:`apply`,type:`vertex-update`}))}_snapToClosingVertex(e){if(e==null||this._isDragging||this.geometryType!==`polygon`||this.numCommittedVertices<=2)return e;let t=this._mapToScreen(e);if(!t)return e;let n=this._activePart;return this._vertexWithinPointerDistance(n.vertices[0].pos,t)?this.firstVertex:this._vertexWithinPointerDistance(n.vertices.at(-1).pos,t)?this.lastVertex:e}_createManipulatorDragPipeline(e){switch(this.drawingMode){case`click`:return this._createManipulatorDragPipelineClick(e);case`freehand`:return this._createManipulatorDragPipelineFreehand(e);case`hybrid`:return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,(e,t,n,r)=>{let i=r===`touch`&&this._snappingEnabled;if(this.isCompleted||!i)return;let{snappingStep:a,cancelSnapping:o}=N({predicate:()=>i,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:r,visualizer:this.snappingVisualizer,drawConstraints:this.constraints}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n.next(e=>(i&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),e)).next(o),t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._processCursor(e.mapStart),(this.geometryType===`segment`||i&&!this.numCommittedVertices)&&this.commitStagedVertex()),e)).next(S(this.view,this.elevationInfo)).next(...a).next(e=>(i&&(this._processCursor(e.mapEnd),e.action===`end`&&this.commitStagedVertex()),e)).next(e=>(e.action===`end`&&(this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()),e))})}_createManipulatorDragPipelineFreehand(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.committableVertex??this._processCursor(e.mapStart),this.geometryType===`segment`&&this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this.complete()}return e})})}_createManipulatorDragPipelineHybrid(e){return x(e,(e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next(e=>(e.action===`start`&&(this._snappingOperation.abort(),this.addHandles(this._editGeometryOperations.createUndoGroup(),z),this._processCursor(e.mapStart),this.commitStagedVertex()),e)).next(e=>{switch(e.action){case`start`:case`update`:this._processCursor(e.mapEnd),(this.geometryType===`polygon`||this.geometryType===`polyline`)&&this.commitStagedVertex();break;case`end`:this._stagedPointerType!==`mouse`&&this._snappingOperation.abort(),this.removeHandles(z),(this.geometryType===`segment`||this.geometryType===`point`)&&this.complete()}return e})})}get _drawAtFixedElevation(){let{constraintsEnabled:e,constraintZ:t,geometryType:n,numCommittedVertices:r}=this;return e?t!=null||n===`segment`&&r>0:(n===`segment`||n===`polygon`)&&r>0}_updateAndGetEffectiveDrawSurface(){let{constraintsEnabled:e,coordinateHelper:t,drawSurface:n,elevationDrawSurface:r,snapToSceneEnabled:i}=this;if(r==null)return n;if(!this.hasZ)return r.defaultZ=null,r;let a=this.elevationInfo?.mode,o=this.defaultZ,s=e||a===`absolute-height`;return i!=null&&(s=i),a===`on-the-ground`&&(s=!1),this._drawAtFixedElevation&&(o=(e?this.constraintZ:null)??t.getZ(this._activePart.vertices[0].pos),s=!1),s?n:(r.defaultZ=o,r)}_mapToScreen(e){return this._updateAndGetEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),this.drawingMode===`click`&&e.pointerType===`touch`&&this._snappingEnabled&&this._processCursor(e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if(!(e.pointerType===`mouse`&&e.button===2||this._manipulator.dragging))try{let{drawingMode:t,geometryType:n}=this;this._stagedPointerType=e.pointerType,this._stagedScreenPoint=e.screenPoint;let r=this._screenToMap(e.screenPoint);if(r==null||r==null||t===`freehand`&&n!==`point`&&n!==`multipoint`)return;if(this._snappingEnabled&&this.cursorVertex!=null||this._processCursor(r),this.committableVertex==null){this.complete();return}this.commitStagedVertex(),e.pointerType!==`mouse`&&this._processCursor(null),(t===`freehand`&&this.geometryType!==`multipoint`||n===`point`||n===`segment`&&this.numCommittedVertices===2||n===`segment`&&t===`hybrid`&&this.numCommittedVertices===1)&&this.complete()}finally{e.stopPropagation()}}_onImmediateDoubleClick(e){this._manipulator.dragging||this.geometryType===`point`||(this.complete(),e.stopPropagation())}_onPointerMove(e){let t=u(e.x,e.y);this._updatePointer(t,e.pointerId,e.pointerType)&&e.stopPropagation()}_updatePointer(e,t,n){return this._stagedScreenPoint=e,this._stagedPointerType=n,this._stagedPointerId=t,this._isDragging?(this._snappingOperation.abort(),!1):(this._processCursorMovementRelativeToSurface(e,n),!0)}_onKeyboardBasedChange(){this._stagedPointerType!==`mouse`||!this._stagedScreenPoint||this._stagedPointerId==null||this._isDragging?this._snappingOperation.abort():this._processCursorMovementRelativeToSurface(this._stagedScreenPoint,this._stagedPointerType)}_processCursorMovementRelativeToSurface(e,t){let n=this._snappingOperation,r=this._screenToMap(e),i=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(r==null){this._hideDefaultCursor=!0,this._processCursor(null),n.abort();return}this._hideDefaultCursor=!1;let a=this.snappingManager;if(a==null){this._processCursor(r),n.abort();return}let s=this._getSnappingContext(t);this._updatingHandles.consumePromise(o(n.snap({point:r,scenePoint:i},a,s)))}_applyConstraints(e){let{_constraint:t,constraints:n}=this;if(!e||!n||!t)return e;let{context:r}=n,i=k(e,r),a=i?t.closestTo(i):void 0;if(!a)return e;let o=A(a,e,r),s=this.view.type===`2d`||r.elevationInfo.mode!==`absolute-height`;return o!=null&&s&&this.constraintZ!=null&&this.hasZ&&(o.z=this.constraintZ),o}_screenToMap(e){return e?this._updateAndGetEffectiveDrawSurface()?.screenToMap(e):null}_screenToMapDragEventStep(){let e=null;return t=>{if(t.action===`start`&&(e=this._screenToMap(t.screenStart)),e==null)return null;let n=this._screenToMap(t.screenEnd);return n==null?null:{...t,mapStart:e,mapEnd:n}}}_vertexWithinPointerDistance(e,t){let n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return n!=null&&V(n,t,25)}_getSnappingContext(e){let t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:t==null?null:{value:t,elevationInfo:this.elevationInfo},drawConstraints:this.constraints})}};e([d()],B.prototype,`_hideDefaultCursor`,void 0),e([d()],B.prototype,`_stagedPointerId`,void 0),e([d()],B.prototype,`_isDragging`,null),e([d()],B.prototype,`_snappingOperation`,void 0),e([d()],B.prototype,`_snappingEnabled`,null),e([d({constructOnly:!0})],B.prototype,`graphic`,void 0),e([d()],B.prototype,`constraintsEnabled`,void 0),e([d()],B.prototype,`constraints`,void 0),e([d()],B.prototype,`_constraint`,null),e([d()],B.prototype,`constraintZ`,void 0),e([d()],B.prototype,`defaultZ`,void 0),e([d()],B.prototype,`isDraped`,void 0),e([d({value:v})],B.prototype,`drawingMode`,null),e([d({constructOnly:!0})],B.prototype,`elevationDrawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`elevationInfo`,void 0),e([d({constructOnly:!0,type:j})],B.prototype,`labelOptions`,void 0),e([d({constructOnly:!0})],B.prototype,`geometryType`,void 0),e([d({constructOnly:!0})],B.prototype,`hasM`,void 0),e([d({constructOnly:!0})],B.prototype,`hasZ`,void 0),e([d()],B.prototype,`cursor`,void 0),e([d()],B.prototype,`effectiveCursor`,null),e([d()],B.prototype,`loading`,void 0),e([d({constructOnly:!0})],B.prototype,`manipulators`,void 0),e([d({constructOnly:!0})],B.prototype,`drawSurface`,void 0),e([d({constructOnly:!0})],B.prototype,`segmentLabels`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingManager`,void 0),e([d({constructOnly:!0})],B.prototype,`snappingVisualizer`,void 0),e([d()],B.prototype,`snapToSceneEnabled`,void 0),e([d({readOnly:!0})],B.prototype,`cursorVertex`,null),e([d({readOnly:!0})],B.prototype,`visualizationCursorVertex`,null),e([d()],B.prototype,`committableVertex`,null),e([d()],B.prototype,`firstVertex`,void 0),e([d()],B.prototype,`lastVertex`,void 0),e([d()],B.prototype,`secondToLastVertex`,void 0),e([d()],B.prototype,`updating`,null),e([d({constructOnly:!0})],B.prototype,`view`,void 0),B=e([f(`esri.views.draw.DrawOperation`)],B);function V(e,t,n){let r=e.x-t.x,i=e.y-t.y;return r*r+i*i<=n}export{B as DrawOperation,I as defaultCursor,L as defaultLoadingCursor};
@@ -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 n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||(e.z==null||!e.hasZ)&&(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{memoize as i}from"../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../core/promiseUtils.js";import{valueInUnit as o}from"../../../core/quantity.js";import{createScreenPoint as s}from"../../../core/screenUtils.js";import{property as c,subclass as l}from"../../../core/accessorSupport/decorators.js";import{fromArray as u,create as d}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as f}from"../../../core/libs/gl-matrix-2/math/vec2.js";import p from"../../../geometry/Point.js";import{pointEquals as m}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{makeDehydratedPoint as h}from"../../../layers/graphics/dehydratedPoint.js";import{getZFromVertexSnappingCandidates as g}from"./drawUtils.js";import{getPolylineOrPolygonConstraint as _,getPointConstraint as v,pointToConstraintSpace as y,constraintSpaceToPoint as b}from"../../interactive/sketch/constraintUtils.js";import{SnappingContext as x}from"../../interactive/snapping/SnappingContext.js";import{SnappingOperation as S}from"../../interactive/snapping/SnappingOperation.js";let C=class extends t{constructor(e){super(e),this._snappingOperation=null,this.role=`primary`,this.captureMode=`capture-always`,this.defaultCaptureMode=`capture-always`,this.snappingEnabled=!0,this.selfSnappingEnabled=!0,this.editSession=null,this.outputMapPositionOfDragStart=null,this.selectedSnappingResult=null,this.screenPosition=null,this.inputMapPosition=null,this.drawToolDragging=!1,this.manipulatorDragging=!1,this.activePointerId=null,this.activePointerType=null,this._getSnappingContext=i((e,t,n,r,i,a)=>n?new x({elevationInfo:r,pointer:e,vertexHandle:t,editGeometryOperations:n,visualizer:i,suppressSelfSnapping:!a}):null)}destroy(){this._snappingOperation=r(this._snappingOperation)}get grabbable(){return this.captureMode===`grabbable-object`}get following(){let{captureMode:e}=this;return e===`capture-always`||e===`capture-when-engaged`}get outputMapPosition(){return this._get(`outputMapPosition`)}set outputMapPosition(e){let t=this._get(`outputMapPosition`);e&&t&&m(e,t)||this._set(`outputMapPosition`,e)}get dragging(){return this.drawToolDragging||this.manipulatorDragging}get firstPointZ(){let e=this.editSession?.lastPointAddedBySession;if(!e)return null;let t=this.editSession?.getInformationAboutPoint(0,e.partIndex);return t?.point.hasZ?t.point.z:null}async moveTo(e,t){let{snappingManager:n,skipSnapping:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t;this.notePointerActivity(t.pointerId,o);let l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t);e&&(this.screenPosition=e);let d=this.screenPosition;if(!d)return null;let f=this.firstPointZ,g=i?.screenToMap(d,{firstPointZ:f});if(this.inputMapPosition=g,this.selectedSnappingResult=null,!n||!g||!l||r||!this.snappingEnabled)return this.selectedSnappingResult=void 0,this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,g,t);let _=h(g.x,g.y,g.z,g?.spatialReference),v=i?.screenToScene?.(d,{firstPointZ:f}),y=u.snap({point:_,scenePoint:v},n,l),b=()=>{let e=u.stagedPoint;return m(this.selectedSnappingResult,e)||(this.selectedSnappingResult=e==null?null:new p({...e})),this.outputMapPosition=this._finalizeSnappingAndConstraintResult(this.selectedSnappingResult,g,t)};return b(),a(y.then(b))}async moveDeltaRelativeToScreen(e,t,n){let{inputMapPosition:r,screenPosition:i,firstPointZ:a}=this;if(!r)return null;let o=n.surfaceManager?n.surfaceManager.mapToScreen(r,{firstPointZ:a}):i;if(!o)return null;let c=s(o.x+e,o.y+t);return this.moveTo(c,n)}async noteDragStart(e,t){if(this.notePointerDown(t.pointerId,t.pointerType),this.drawToolDragging=!0,t.skipSnapping||!this.snappingEnabled)return null;let{snappingManager:r,surfaceManager:i,pointerType:o,editGeometryOperations:s,snappingVisualizer:c}=t,l=this._getSnappingContext(o??`mouse`,this.editSession?.endVertex,s,i?.elevationInfo,c,this.selfSnappingEnabled),u=this._ensureSnappingOperation(t),d=this.firstPointZ,f=i?.screenToMap(e,{firstPointZ:d});if(this.outputMapPositionOfDragStart=null,r&&l&&f){let o=u.snap({point:h(f.x,f.y,f.z,f?.spatialReference),scenePoint:i?.screenToScene?.(e,{firstPointZ:d})},r,l);return a(o.then(()=>{let e=u.stagedPoint?new p({...u.stagedPoint}):null;return this.outputMapPositionOfDragStart=this._finalizeSnappingAndConstraintResult(e,f,t)})).catch(e=>(n.getLogger(this).error(`drawtool:handle:snapping-failed`,e),null))}return this.outputMapPositionOfDragStart=f,null}async noteDragEnd(e,t){return this.moveTo(e,t).finally(()=>{this.drawToolDragging=!1,this.notePointerUp(t.pointerId,t.pointerType)})}notePointerActivity(e=null,t=null){t&&(this.activePointerType=t),e!=null&&this.dragging&&(this.activePointerId=e)}notePointerDown(e=null,t=null){e!=null&&(this.activePointerId=e),t&&(this.activePointerType=t)}notePointerUp(e=null,t=null){(e==null||this.activePointerId==null||this.activePointerId===e)&&(this.activePointerId=null),t&&this.activePointerType===t&&(this.activePointerType=null)}async moveDeltaRelativeToSketchSegment(e,t){let n=this.editSession?.endVertex?.leftSegment?.leftVertex?.pos,{firstPointZ:r}=this,i=this.inputMapPosition?t.surfaceManager?.mapToScreen(this.inputMapPosition,{firstPointZ:r})??this.screenPosition:this.screenPosition;if(!n||!i)return null;let a=t.editGeometryOperations?.data?.coordinateHelper.vectorToPoint(n);if(!a)return null;let o=t.surfaceManager?.mapToScreen(a,{firstPointZ:r});if(!o)return null;let s=[i.x-o.x,i.y-o.y],c=f(d(),u(s)),[l,p]=[c[0]*e,c[1]*e];return this.moveDeltaRelativeToScreen(l,p,t)}refreshConstraint(e){let t=this.outputMapPosition??this.inputMapPosition;return this.outputMapPosition=this._finalizeSnappingAndConstraintResult(null,t,e)}_finalizeSnappingAndConstraintResult(e,t,n){let r=e??t;r&&n.view.type===`2d`&&(r.z=g(n.snappingManager)??r.z);let i=(r?n.surfaceManager?.constrainZToEffectiveSurface?.(r):null)??r;return this._ensureZ(this._applyTooltipConstraints(i,n),n)}_applyTooltipConstraints(e,t){let n=e,r=t.tooltipManager?.getConstraints(this);if(!r&&!t.interactiveHandleManager?.customConstraints||!n)return n;let i=t.interactiveHandleManager?.customConstraints,a=t.editGeometryOperations?.data?.coordinateHelper;if(!a)return n;if(i&&this.editSession&&n){let e={handle:this,editSession:this.editSession,toScreen:e=>t.surfaceManager?.mapToScreen(e,{firstPointZ:this.firstPointZ})??null};for(let t of i)n=t(n,e)||n}let s=(this.editSession?.endVertex)?.leftSegment?.leftVertex,c=s?.leftSegment?.leftVertex,l=s&&a.vectorToPoint(s.pos),u=c&&a.vectorToPoint(c.pos);if(!r)return n;let d=(l||u)&&this.role===`primary`?_(l,u,r):v(r);if(!n||!r||!d)return n;let{context:f}=r,m=y(n,f),h=m?d.closestTo(m):void 0;if(!h)return n;let g=b(h,n,f),x=t.surfaceManager?.view?.type===`2d`||f.elevationInfo.mode!==`absolute-height`,S=r.elevation,{hasZ:C,metersPerVerticalUnit:w}=t.surfaceManager??{};return g!=null&&x&&S!=null&&C&&w&&(g.z=o(S,`meters`)/w),g?new p({x:g.x,y:g.y,z:g.z,hasM:g.hasM,hasZ:g.hasZ,m:g.m,spatialReference:g.spatialReference}):null}_ensureZ(e,t){return!e||!t.hasZ||e.z!=null&&e.hasZ||(e.z=t.defaultZ??0,e.hasZ=!0),e}_ensureSnappingOperation({view:e}){return this._snappingOperation??=new S({view:e})}};e([c()],C.prototype,`_snappingOperation`,void 0),e([c()],C.prototype,`role`,void 0),e([c()],C.prototype,`name`,void 0),e([c()],C.prototype,`captureMode`,void 0),e([c()],C.prototype,`defaultCaptureMode`,void 0),e([c()],C.prototype,`grabbable`,null),e([c()],C.prototype,`following`,null),e([c()],C.prototype,`snappingEnabled`,void 0),e([c()],C.prototype,`selfSnappingEnabled`,void 0),e([c()],C.prototype,`editSession`,void 0),e([c()],C.prototype,`outputMapPosition`,null),e([c()],C.prototype,`outputMapPositionOfDragStart`,void 0),e([c()],C.prototype,`selectedSnappingResult`,void 0),e([c()],C.prototype,`screenPosition`,void 0),e([c()],C.prototype,`inputMapPosition`,void 0),e([c()],C.prototype,`dragging`,null),e([c()],C.prototype,`drawToolDragging`,void 0),e([c()],C.prototype,`manipulatorDragging`,void 0),e([c()],C.prototype,`activePointerId`,void 0),e([c()],C.prototype,`activePointerType`,void 0),e([c({readOnly:!0})],C.prototype,`firstPointZ`,null),C=e([l(`esri.views.draw.support.InteractiveHandle`)],C);export{C as InteractiveHandle};
@@ -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{createTask as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l,assertIsSome as u}from"../../../core/maybe.js";import{throwIfAborted as d}from"../../../core/promiseUtils.js";import{pausable as f,when as p,watch as m,initial as h,sync as g}from"../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import b from"../../../geometry/Point.js";import x from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{isPoint as T}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as D}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as k,isCircularArc as A,isEllipticArc4 as j,isBezierCurve as M,isCoordinate as N,cloneCurve as ee,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as F}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as I}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import ne from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as re}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as ie}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ae,getZFromVertexSnappingCandidates as oe,cloneMove as se}from"./drawUtils.js";import ce from"./GraphicMover.js";import le from"./HighlightHelper.js";import{addUniqueLayer as ue,isConnectedReshapeSupportedLayer as de}from"./layerUtils.js";import{createTooltipInfos as fe,connectTooltip as pe,updateTranslateTooltipInfo as me,updateTranslateVertexTooltipInfo as he}from"./reshapeTooltipUtils.js";import{defaultSymbols as ge,createMidpointGraphics as _e,createVertexGraphics as L,createCurveControlPointGraphics as ve,createCurveConstructionLineGraphics as ye,attributeKeys as R,getMidpoint as z,controlPointKinds as B,fastCloneGeometry as V,saveUpdatedCurveOrCoordinate as H,toolIdAttribute as be,splitCurve as xe,isSingleSegmentCircle as Se,isSingleSegmentEllipse as Ce}from"./reshapeUtils.js";import{ViewEventPriorities as we}from"../../input/InputManager.js";import{createCoordinateHelper as Te}from"../../interactive/coordinateHelper.js";import{sketchKeys as Ee}from"../../interactive/keybindings.js";import{EditGeometryOperations as De}from"../../interactive/editGeometry/EditGeometryOperations.js";import Oe from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as ke}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as Ae,enterInputModeIfAvailable as je}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const U=Symbol(),W={mode:`on-the-ground`,offset:0};let G=class extends a{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new y,this._measurementWorker=new Me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=ge,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new Oe,this.type=`reshape`,this.vertexGraphics=new r,this.curveControlPointGraphics=new r,this.constructionLineGraphics=new r,this.midpointGraphics=new r,this.selectedManipulators=new r,this.view=null}initialize(){let e=this.view;this._highlightHelper=new le({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=f(()=>this.graphic?.geometry,e=>{if(!e||this._primaryGraphicMoving===!0)return;let t=new Set(this.selectedManipulators.map(Q));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e));let{enableMovement:n,_mover:r,graphic:i,midpointGraphics:a,vertexGraphics:o,curveControlPointGraphics:s}=this,c=o.concat(a,s).toArray();n&&c.push(i),r?.set(`graphics`,c)},g),this.tooltip=Ae(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=fe(this.toolOptions),this.addHandles([p(()=>e?.ready,()=>{let{layer:e,view:t}=this;ue(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),we.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[m(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],m(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),pe(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),m(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),h),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=c(this._mover),this._connectedReshapeManager=c(this._connectedReshapeManager),this.tooltip=c(this.tooltip),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._updatingHandles=c(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??Te(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return this.view?.type===`2d`&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return this.selectedManipulators.length===1?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){let{toolOptions:e,activeTooltipInfo:t,graphic:n}=this;return{toolOptions:e,activeTooltipInfo:t,graphic:n,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,n,r,i)=>{this._setUpGeometryHelper();let a=e===this.graphic;if(a?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e),this._syncGeometryAfterVertexMove(e,t,r,i,!0),a){let{view:e}=this,r=e.toScreen(n),i=e.toScreen(t),a=(i?.x??0)-(r?.x??0),o=(i?.y??0)-(r?.y??0);this._emitMoveEvent(a,o),this._emitMoveStopEvent(a,o)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){let e=this.view.ready,t=!!(this.graphic&&this.layer);return e&&t?`active`:e?`ready`:`disabled`}get updating(){return!!this._updatingHandles?.updating||!!this._connectedReshapeManager?.updating||!!this._segmentLabels?.updating||!!this.snappingManager?.updating}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(let t of this.vertexGraphics)e.has(Q(t))&&this._addToSelection(t);for(let t of this.curveControlPointGraphics)e.has(Q(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){let{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){let{graphic:e,layer:t}=this;if(!t||e?.geometry==null)return;let n=e.geometry;n.type===`mesh`||n.type===`extent`?this._logGeometryTypeError():(n.type===`polygon`&&S(n),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper())}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){let e=this.graphic.geometry;e==null||e.type===`mesh`||e.type===`extent`?(this._segmentLabels=c(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=De.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ne({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;u(n),this._snappingContext=new ke({editGeometryOperations:n,elevationInfo:W,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new re(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._activeOperationInfo=null,this._mover=c(this._mover),this.removeHandles(U),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),c(this._snappingGraphicsLayer)),this._snappingTask=l(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){let{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(c)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(c)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(c),n.drain(c)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=K(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=_e(e,this.symbols,this._coordinateHelper,this.graphic.geometry?.type===`polygon`,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){let t=L(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{let t=L(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=ve(e,this.symbols,this._coordinateHelper),n=ye(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(n),this.layer.addMany(n),this.layer.addMany(t)}async _setupSegmentLabels(){let e=this._editGeometryOperations,t=this.toolOptions.labels.enabled;if((!e||this._segmentLabels?.context?.editGeometryOperations!==e||!t)&&(this._segmentLabels=c(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=n(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),r=await this._updatingHandles.addPromise(t.promise);if(!r)return;this._segmentLabels=c(this._segmentLabels),this._segmentLabels=new r({context:{view:this.view,editGeometryOperations:e,elevationInfo:W,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){let e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set(`color`,e),hover:this.symbols.vertices.hover?.clone().set(`color`,e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set(`color`,e),hover:this.symbols.controlPoints.hover?.clone().set(`color`,e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set(`color`,e)};for(let e of this.vertexGraphics)e.symbol=this._isSelected(e)?this.symbols.vertices.selected:this._hoverGraphic===e?this.symbols.vertices.hover:this.symbols.vertices.default;for(let e of this.curveControlPointGraphics)e.symbol=this._isSelected(e)?this.symbols.controlPoints.selected:this._hoverGraphic===e?this.symbols.controlPoints.hover:this.symbols.controlPoints.default;for(let e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){let e=this.vertexGraphics.items;if(!e)return;let t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let n=0;n<t.length;n++){let r=[];for(let e=0;e<t.length;e++){if(n===e)continue;let i=t[n],a=t[e];i.x===a.x&&i.y===a.y&&r.push(e)}e[n].attributes[R.relatedGraphicIndices]=r}}_setupMover(){let{enableMovement:e,graphic:t,midpointGraphics:n,vertexGraphics:r,view:i}=this,a=r.concat(n,this.curveControlPointGraphics).toArray();e&&t.geometry?.type!==`multipoint`&&a.push(t),this._mover=new ce({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:a,view:i,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){let{connectedReshapeProviders:e}=this;e!=null&&e.length!==0&&(this._connectedReshapeManager??=new ie({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();let t=e.graphic,n=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit(`graphic-click`,e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(e.viewEvent.button===2)return;let n=this.graphic.clone(),r=this._handleMidpointClickOrStartMove(e);this.refresh(),r.length&&this._emitVertexAddEvent([t],n,r)}else if(this._isVertex(t)||n){if(e.viewEvent.stopPropagation(),e.viewEvent.button===2){n||this._removeVertices(t);return}e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){let{graphic:t,dx:n,dy:r}=e,i=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:i?`move`:`reshape`,totalDx:n,totalDy:r}}_onGraphicMoveStartCallback(e){let{dx:t,dy:n,graphic:r}=e,i=this._connectedReshapeManager,a=i?Fe(this.graphic):null;if(r===this.graphic){let{geometry:o}=r;this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,n),a&&i?.startFeatureMove([a]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),o!=null&&o.type===`point`&&this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,n)});return}let{selectedManipulators:o}=this;if(!o.includes(r)){if(this._clearSelection(),this._isMidpoint(r)){let t=this.graphic.clone(),n=this._handleMidpointClickOrStartMove(e);n.length&&(this._emitVertexAddEvent([r],t,n),this._refreshGraphicIndicesAttributes(n[0]))}this._addToSelection(r)}if(this._setUpOperation(e),a){let e=o.filter(e=>this._isVertex(e));i?.startVertexMove(a,Ie(e))}this._emitReshapeStartEvent(r),this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(r,e.viewEvent),this._emitReshapeEvent(r)})}_onGraphicMoveCallback(e){let t=this._activeOperationInfo;if(!t)return;let{dx:n,dy:r,graphic:i}=e;t.totalDx+=n,t.totalDy+=r;let{operationType:a}=t,{geometry:o}=i;if(o!=null){if(a===`move`){if(o.type===`point`)this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)});else if(o.type===`polyline`||o.type===`polygon`){let{dxMap:t,dyMap:i}=ae(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=K(o);this._updateVertexGraphicLocations(e)}else if(this.selectedManipulators.length>0){let e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(let t of e){if(t.geometry?.type===`point`){let{pathIndex:e,pointIndex:n}=t.attributes,r=O(o)[e][n];if(r){let e=k(r);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}this._connectedReshapeManager?.translate(t,i,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)}this._syncEditGeometryOperations(o)}else this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(i,e.viewEvent),this._emitReshapeEvent(i)})}}_onGraphicMoveStopCallback(e){let t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;let{dx:n,dy:r,graphic:i,x:a,y:o}=e,{operationType:s}=t;t.totalDx+=n,t.totalDy+=r,this._onHandleMove(i,n,r,e,()=>this._handleVertexSnap(i,{x:a,y:o},s))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&t===`move`){let e=new Set;for(let t of this.selectedManipulators)e.add(Q(t));this.refresh(e),this._updateTooltip()}else this._isMidpoint(e)||e.getAttribute(R.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,r){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>r===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!T(i)||!a||a.length===0?(s(),this._afterMoveStop(e,r)):(l(this._snappingTask),this._snappingTask=n(async n=>{try{let r=await o(i,t,a);d(n);let s=w(r);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,r)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(k(e[r][i]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){let{_coordinateHelper:n}=this;if(t)for(let r of this.midpointGraphics){let{pathIndex:i,pointIndexStart:a,pointIndexEnd:o}=r.attributes;if(!t.has(i))continue;let s=t.get(i);if(!s.has(a)&&!s.has(o))continue;let c=e[i];r.geometry=new b(z(c[a],c[o],n))}else for(let t of this.midpointGraphics){let{pathIndex:r,pointIndexStart:i,pointIndexEnd:a}=t.attributes,o=e[r];t.geometry=new b(z(o[i],o[a],n))}}_updateCurveGraphicLocations(e){let{spatialReference:t}=this._coordinateHelper,n=new Map;for(let e of this.selectedManipulators){let[t,r]=Z(e);t!=null&&r!=null&&e.getAttribute(R.controlPointKind)&&s(n,t,()=>new Set)?.add(r)}for(let t of this.curveControlPointGraphics){let[r,i]=Z(t);if(n.get(r)?.has(i))continue;let a=e[r][i];if(A(a)||j(a)){let n=k(e[r][i-1]),o=A(a)?D(n,a):F(n,a),[s,c]=E(o,.25);t.geometry=new b({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(M(a)){let[e,n]=t.getAttribute(R.controlPointKind)===B.bezier.cp1?a.b[1]:a.b[2];t.geometry=new b({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(R.controlPointKind),[i,a]=Z(n),o=e[i],s=k(o[a-1]),c=k(o[a]),l=e[i][a];n.geometry=r===B.bezier.line1?new x({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new x({paths:[[[c[0],c[1]],[...l.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){let{componentIndex:t,vertexIndex:n}=e,r=e=>{let[r,i]=Z(e);r===t&&i>=n&&e.setAttribute(R.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(R.pathIndex)!==t)continue;let r=e.getAttribute(R.pointIndexStart);r>=n&&(e.setAttribute(R.pointIndexStart,r+1),e.setAttribute(R.pointIndexEnd,e.getAttribute(R.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return u(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,r,i,a){l(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!T(s))a();else if(this.snappingManager!=null&&this.selectedManipulators.length<2&&!c){let i=this.snappingManager;this._stagedVertex=i.update({point:s,context:o}),this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a(),this._snappingTask=n(async n=>{let l=await i.snap({point:s,context:o,signal:n});if(l.valid){let n=l.apply();n.z=this._coordinateHelper.hasZ()?oe(this.snappingManager)??n.z:void 0,this._stagedVertex=n,this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let n=this._stagedVertex==null?s:new b(this._stagedVertex);this._syncGeometryAfterVertexMove(e,n,t,r,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=V(this._editGeometryOperations?.data.geometry);if(!a)return;let{_coordinateHelper:o}=this,s=o.pointToVector(t),c=this._getVertexFromEditGeometry(e),l=null;if(c){let e=o.getZ(s);l=[c.pos[0],c.pos[1]];let t=s[0]-c.pos[0],n=s[1]-c.pos[1],r=e==null?0:e-c.pos[2];(a.type===`point`||a.type===`mesh`)&&this._editGeometryOperations?.moveVertices([c],t,n,r),this._connectedReshapeManager?.translate(t,n,r)}if(a.type===`point`)e.geometry=t;else if(a.type===`mesh`)e.geometry=a.centerAt(t);else{if(e!==this.graphic){l&&!this._isVertex(e)&&(l=null);let[i,s]=Z(e),c=q(a),u=o.pointToArray(t);if(this._updateGeometryFromGraphic(e,c,i,s,u,a.type===`polygon`),this._isVertex(e)||this._isCurveControlPoint(e)){let t=new Map;t.set(i,new Set([s])),c=this._moveRelatedCoordinates(c,e,u,t,l),c=this._moveSelectedHandleCoordinates(c,e,n,r,a.type===`polygon`),this._updateMidpointGraphicLocations(c,t),this._updateCurveGraphicLocations(c)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(c);H(a,c)}this._updateGraphicGeometry(a),this._syncEditGeometryOperations(a),i&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){this._editGeometryOperations?.trySetGeometry(e)||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,n,r,i){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&i){let a=this._relatedGraphicIndex.search({minX:i[0],maxX:i[0],minY:i[1],maxY:i[1]});for(let o of a)o.coordinate[0]===i[0]&&o.coordinate[1]===i[1]&&o.graphic&&(r&&s(r,o.pathIndex,()=>new Set).add(o.pointIndex),X(e,o.pathIndex,o.pointIndex,n),this._relatedGraphicIndex.remove(o),o.coordinate[0]=t.geometry.x,o.coordinate[1]=t.geometry.y,o.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(o));return e}let{relatedGraphicIndices:a}=t.attributes;if(!a?.length)return e;for(let i of a){let a=this.vertexGraphics.at(i),[o,c]=Z(a);r&&s(r,o,()=>new Set).add(c),X(e,o,c,n),a.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,n,r,i){for(let a of this.selectedManipulators)if(a!==t){let[t,o]=Z(a),s=a.getAttribute(R.relatedGraphicIndices),c=se(a.geometry,n,r,this.view),l=C(c);if(a.geometry=c,this._updateGeometryFromGraphic(a,e,t,o,l,i),s?.length)for(let t of s){let n=this.vertexGraphics.at(t),[r,i]=Z(n);X(e,r,i,l),n.geometry=c}}return e}_updateGeometryFromGraphic(e,t,n,r,i,a){let o=t[n].length-1;this._isCurveControlPoint(e)?Pe(t,n,r,[i[0],i[1]],e.getAttribute(R.controlPointKind)):(X(t,n,r,i),a&&(r===0?X(t,n,o,i):r===o&&(t[n][0]=i)))}_onGraphicPointerOverCallback(e){let t=e.graphic;this._hoverGraphic=t;let n=this._isVertex(t);n&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(n?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){let t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(U),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=V(n),i=[],{[R.pathIndex]:a,[R.pointIndexStart]:o,[R.pointIndexEnd]:s}=t.attributes,c=C(t.geometry),l=s===0?o+1:s;t.attributes={[R.tool]:be,[R.pathIndex]:a,[R.pointIndex]:l,[R.relatedGraphicIndices]:[]};let u=q(r),d=u[a][s];if(N(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=k(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(R.controlPointKind,B.circle.interior),t.setAttribute(R.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),H(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=k(u[a][o]),t=xe(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:k(u[a][l]),componentIndex:a,vertexIndex:l})}return this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),i}_addToSelection(e){let t=$(e);for(let e of t)e.symbol=this._isCurveControlPoint(e)?this.symbols.controlPoints.selected:this.symbols.vertices.selected,this.selectedManipulators.add(e),this._updateTooltip(e);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){let{vertices:n}=this.symbols;e.symbol=t?n.hover:n.default}else if(this._isCurveControlPoint(e)){let{controlPoints:n}=this.symbols;e.symbol=t?n.hover:n.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){let e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:n}=this.symbols;if(e.length>0){for(let r of e)this._isVertex(r)?r.symbol=n.default:this._isCurveControlPoint(r)&&(r.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){this._activeOperationInfo==null&&je(e,this.tooltip)||Ee.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){let t=this.graphic.geometry,n=this.vertexGraphics.length;if(t==null||t.type!==`polygon`&&t.type!==`polyline`&&t.type!==`multipoint`||t.type===`polygon`&&n<4||t.type===`multipoint`&&n<2||t.type===`polyline`&&n<3)return;let r=this.graphic.clone(),i=V(t),a=q(i),o=[],s=$(e);for(let e of s){if(this._isCurveControlPoint(e))continue;let{x:t,y:n}=e.geometry;for(let e=0;e<a.length;e++){let r=a[e];for(let i=0;i<r.length;i++){let[s,c]=k(r[i]);if(t===s&&n===c){o.push({coordinates:k(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!N(t)&&(a[e][i]=k(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=k(e[0]),[r,i]=k(e[e.length-1]);return e.length===2&&t===r&&n===i?!1:((t!==r||n!==i)&&e.push(e[0]),!0)});else if(i.type===`polyline`)for(let e of a)e.length===1&&a.splice(a.indexOf(e),1);H(i,a),this._updateGraphicGeometry(i),this.refresh(),this._emitVertexRemoveEvent(s,r,o)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){let t=this._isMidpoint(e)?`copy`:`move`;this.addHandles(this.view.acquireCursor(t,`high`),U)}_updateTooltip(e,t){let n=null,{graphic:r,view:i,tooltipInfos:a}=this,o=r?.geometry;o?.type===`point`?n=a.movePoint:this._selectedManipulator?n=a.selectedVertex:e===this.graphic?(n=a.translateGraphic,me(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,he(n,i,o,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=n}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){let n={type:`move-start`,mover:this.graphic,dx:e,dy:t};this.emit(`move-start`,n),this.callbacks.onMoveStart?.(n)}_emitMoveEvent(e,t){let n={type:`move`,mover:this.graphic,dx:e,dy:t};this.emit(`move`,n),this.callbacks.onMove?.(n)}_emitMoveStopEvent(e,t){if(e==null||t==null){let n=this._activeOperationInfo;if(!n)return;e=n.totalDx,t=n.totalDy}let n={type:`move-stop`,mover:this.graphic,dx:e,dy:t};this.emit(`move-stop`,n),this.callbacks.onMoveStop?.(n)}_emitReshapeStartEvent(e){let t={type:`reshape-start`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-start`,t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){let t={type:`reshape`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape`,t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){let t={type:`reshape-stop`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-stop`,t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){let t={type:`vertex-select`,added:e};this.emit(`select`,t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){let t={type:`vertex-deselect`,removed:e};this.emit(`deselect`,t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,n){let r={type:`vertex-add`,added:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-add`,r),this.callbacks.onVertexAdd?.(r)}_emitVertexRemoveEvent(e,t,n){let r={type:`vertex-remove`,removed:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-remove`,r),this.callbacks.onVertexRemove?.(r)}_logGeometryTypeError(){o.getLogger(this).error(new i(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([_()],G.prototype,`_activeOperationInfo`,void 0),e([_()],G.prototype,`_connectedReshapeManager`,void 0),e([_()],G.prototype,`_coordinateHelper`,null),e([_()],G.prototype,`_editGeometryOperations`,void 0),e([_()],G.prototype,`_effectiveFilterVerticesEnabled`,null),e([_()],G.prototype,`_primaryGraphicMoving`,void 0),e([_()],G.prototype,`_segmentLabels`,void 0),e([_()],G.prototype,`test`,null),e([_()],G.prototype,`_segmentLabelsImportTask`,void 0),e([_()],G.prototype,`_updatingHandles`,void 0),e([_()],G.prototype,`_selectedManipulator`,null),e([_()],G.prototype,`_tooltipsContext`,null),e([_()],G.prototype,`callbacks`,void 0),e([_()],G.prototype,`connectedReshapeProviders`,void 0),e([_()],G.prototype,`enableMidpoints`,void 0),e([_()],G.prototype,`enableCurveOnMidpoint`,void 0),e([_()],G.prototype,`enableMovement`,void 0),e([_()],G.prototype,`enableVertices`,void 0),e([_()],G.prototype,`filterVerticesEnabled`,void 0),e([_()],G.prototype,`graphic`,void 0),e([_()],G.prototype,`highlightName`,void 0),e([_()],G.prototype,`highlightsEnabled`,void 0),e([_()],G.prototype,`layer`,void 0),e([_()],G.prototype,`snappingManager`,void 0),e([_({readOnly:!0})],G.prototype,`state`,null),e([_()],G.prototype,`symbols`,void 0),e([_()],G.prototype,`tooltip`,void 0),e([_()],G.prototype,`tooltipInfos`,void 0),e([_()],G.prototype,`activeTooltipInfo`,void 0),e([_()],G.prototype,`updating`,null),e([_()],G.prototype,`toolOptions`,void 0),e([_({readOnly:!0})],G.prototype,`type`,void 0),e([_({readOnly:!0})],G.prototype,`vertexGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`curveControlPointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`constructionLineGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`midpointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`selectedManipulators`,void 0),e([_()],G.prototype,`view`,void 0),G=e([v(`esri.views.draw.support.Reshape`)],G);function K(e){let t=q(e);t=t.map(e=>e.slice());for(let e of t)for(let t=0;t<e.length;t++)e[t]=ee(e[t]);if(e.type===`polygon`)for(let e of t){let t=e[e.length-1];if(!N(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function q(e){return e.type===`polygon`?e.curveRings?.slice()??e.rings.slice():e.type===`polyline`?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Ne(e,t,n,r){let i=e[t][n];if(A(i))i.c[1]=r;else if(j(i)){let i=k(e[t][n]);e[t][n]={c:[i,r]}}}function Pe(e,t,n,r,i){switch(i){case B.circle.interior:Ne(e,t,n,r);break;case B.bezier.cp1:e[t][n].b[1]=r;break;case B.bezier.cp2:e[t][n].b[2]=r}}function J(e,t){return e<t*1e-8}function Y(e,{cx:t,cy:n,isInvalid:r,thetaStart:i,thetaEnd:a},o,s){let[c,l]=e,[u,d]=o,f=u-c,p=d-l;t-=c,n-=l;let m=s?i>a:i<a,[h,g]=r?[t,n]:m?[-n,t]:[n,-t],[_,v]=[f,p],[y,b]=[h,g],x=_*b-v*y,S=(f**2+p**2)/2;if(J(Math.abs(x),S))return[(c+u)/2,(l+d)/2];let[C,w]=[b/x*S,-y/x*S],T=C**2+w**2,[E,D]=[f/2-C,p/2-w];if(J(E**2+D**2,T)){let[e,t]=m?[-w,C]:[w,-C];return[e+C+c,t+w+l]}let O=Math.sqrt((C**2+w**2)/(E**2+D**2))*Math.sign(f*h+p*g);return[E*O+C+c,D*O+w+l]}function X(e,t,n,r){let i=e[t][n],a=e[t].at(n+1);if(Se(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ce(e,t)){let n=e[t][1],[i,a]=n.a[1],[o,s]=r,c=Math.hypot(o-i,s-a),[l,u]=[o-i,s-a],d=te(u,l);e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0,d,c,n.a[6]]};return}let o=k(i);if(N(i))i.splice(0,i.length,...r);else if(M(i))i.b[0].splice(0,i.b[0].length,...r);else if(A(i)||j(i)){let a=k(e[t][n-1]),o=A(i)?D(a,i):F(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(P(i)){i.a[0].splice(0,i.a[0].length,...r);let a=k(e[t][n-1]);I(a,i)}if(a&&!N(a)&&!M(i)){if(A(a)||j(a)){let i=k(a),s=A(a)?D(o,a):F(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(P(a)){let e=k(i);I(e,a)}}}function Z({attributes:e}){return[e?.[R.pathIndex]||0,e?.[R.pointIndex]||0]}function Q({attributes:e}){return`${e?.[R.pathIndex]}-${e?.[R.pointIndex]}-${e?.[R.controlPointKind]??`vertex`}`}function $(e){return e instanceof t?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return de(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[R.pathIndex],vertexIndex:e[R.pointIndex]}))}const Le=G;export{Le as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../core/MapUtils.js";import{destroyMaybe as c,abortMaybe as l,assertIsSome as u}from"../../../core/maybe.js";import{throwIfAborted as d}from"../../../core/promiseUtils.js";import{pausable as f,when as p,watch as m,initial as h,sync as g}from"../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import b from"../../../geometry/Point.js";import x from"../../../geometry/Polyline.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{isPoint as T}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as E}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as D}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as k,isCircularArc as A,isEllipticArc4 as j,isBezierCurve as M,isCoordinate as N,cloneCurve as ee,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as F}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{normalizeEllipticArcAfterEndpointChange as I}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{wrapAtan2 as te}from"../../../geometry/support/curves/mathUtils.js";import ne from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as re}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as ie}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as ae,getZFromVertexSnappingCandidates as oe,cloneMove as se}from"./drawUtils.js";import ce from"./GraphicMover.js";import le from"./HighlightHelper.js";import{addUniqueLayer as ue,isConnectedReshapeSupportedLayer as de}from"./layerUtils.js";import{createTooltipInfos as fe,connectTooltip as pe,updateTranslateTooltipInfo as me,updateTranslateVertexTooltipInfo as he}from"./reshapeTooltipUtils.js";import{defaultSymbols as ge,createMidpointGraphics as _e,createVertexGraphics as L,createCurveControlPointGraphics as ve,createCurveConstructionLineGraphics as ye,attributeKeys as R,getMidpoint as z,controlPointKinds as B,fastCloneGeometry as V,saveUpdatedCurveOrCoordinate as H,toolIdAttribute as be,splitCurve as xe,isSingleSegmentCircle as Se,isSingleSegmentEllipse as Ce}from"./reshapeUtils.js";import{ViewEventPriorities as we}from"../../input/InputManager.js";import{createCoordinateHelper as Te}from"../../interactive/coordinateHelper.js";import{sketchKeys as Ee}from"../../interactive/keybindings.js";import{EditGeometryOperations as De}from"../../interactive/editGeometry/EditGeometryOperations.js";import Oe from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as ke}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as Ae,enterInputModeIfAvailable as je}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const U=Symbol(),W={mode:`on-the-ground`,offset:0};let G=class extends a{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new y,this._measurementWorker=new Me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=ge,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new Oe,this.type=`reshape`,this.vertexGraphics=new r,this.curveControlPointGraphics=new r,this.constructionLineGraphics=new r,this.midpointGraphics=new r,this.selectedManipulators=new r,this.view=null}initialize(){let e=this.view;this._highlightHelper=new le({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=f(()=>this.graphic?.geometry,e=>{if(!e||this._primaryGraphicMoving===!0)return;let t=new Set(this.selectedManipulators.map(Q));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Q(e))).forEach(e=>this._addToSelection(e));let{enableMovement:n,_mover:r,graphic:i,midpointGraphics:a,vertexGraphics:o,curveControlPointGraphics:s}=this,c=o.concat(a,s).toArray();n&&c.push(i),r?.set(`graphics`,c)},g),this.tooltip=Ae(()=>({view:e,options:this.toolOptions.tooltips})),this.tooltipInfos=fe(this.toolOptions),this.addHandles([p(()=>e?.ready,()=>{let{layer:e,view:t}=this;ue(t,e),this.addHandles(t.on(`key-down`,e=>this._keyDownHandler(e),we.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[m(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],m(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),pe(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),m(()=>this.toolOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),h),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=c(this._mover),this._connectedReshapeManager=c(this._connectedReshapeManager),this.tooltip=c(this.tooltip),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._updatingHandles=c(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??Te(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return this.view?.type===`2d`&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return this.selectedManipulators.length===1?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){let{toolOptions:e,activeTooltipInfo:t,graphic:n}=this;return{toolOptions:e,activeTooltipInfo:t,graphic:n,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,n,r,i)=>{this._setUpGeometryHelper();let a=e===this.graphic;if(a?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e),this._syncGeometryAfterVertexMove(e,t,r,i,!0),a){let{view:e}=this,r=e.toScreen(n),i=e.toScreen(t),a=(i?.x??0)-(r?.x??0),o=(i?.y??0)-(r?.y??0);this._emitMoveEvent(a,o),this._emitMoveStopEvent(a,o)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){let e=this.view.ready,t=!!(this.graphic&&this.layer);return e&&t?`active`:e?`ready`:`disabled`}get updating(){return!!this._updatingHandles?.updating||!!this._connectedReshapeManager?.updating||!!this._segmentLabels?.updating||!!this.snappingManager?.updating}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(let t of this.vertexGraphics)e.has(Q(t))&&this._addToSelection(t);for(let t of this.curveControlPointGraphics)e.has(Q(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){let{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){let{graphic:e,layer:t}=this;if(!t||e?.geometry==null)return;let n=e.geometry;n.type===`mesh`||n.type===`extent`?this._logGeometryTypeError():(n.type===`polygon`&&S(n),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper())}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){let e=this.graphic.geometry;e==null||e.type===`mesh`||e.type===`extent`?(this._segmentLabels=c(this._segmentLabels),this._logGeometryTypeError()):(this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=De.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels()))}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new ne({listMode:`hide`,internal:!0,title:`Reshape snapping layer`}),this.view.map.layers.add(this._snappingGraphicsLayer);let n=this._editGeometryOperations;u(n),this._snappingContext=new ke({editGeometryOperations:n,elevationInfo:W,pointer:t.viewEvent?.pointerType||`mouse`,excludeFeature:this.graphic,feature:this.graphic,visualizer:new re(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=l(this._segmentLabelsImportTask),this._segmentLabels=c(this._segmentLabels),this._activeOperationInfo=null,this._mover=c(this._mover),this.removeHandles(U),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),c(this._snappingGraphicsLayer)),this._snappingTask=l(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){let{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(c)}_removeVertexGraphics(e=this.layer){let{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(c)}_removeCurveGraphics(e=this.layer){let{curveControlPointGraphics:t,constructionLineGraphics:n}=this;e?.removeMany(t.items),e?.removeMany(n.items),t.drain(c),n.drain(c)}_setupGraphics(){let e=this.graphic.geometry;if(e!=null&&(e.type===`polyline`||e.type===`polygon`||e.type===`multipoint`)){let t=K(e);this.enableMidpoints&&e.type!==`multipoint`&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();let t=_e(e,this.symbols,this._coordinateHelper,this.graphic.geometry?.type===`polygon`,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){let t=L(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{let t=L(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();let t=ve(e,this.symbols,this._coordinateHelper),n=ye(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(n),this.layer.addMany(n),this.layer.addMany(t)}async _setupSegmentLabels(){let e=this._editGeometryOperations,t=this.toolOptions.labels.enabled;if(e&&this._segmentLabels?.context?.editGeometryOperations===e&&t||(this._segmentLabels=c(this._segmentLabels)),!this._segmentLabels&&e&&t){let t=this._segmentLabelsImportTask??=n(async e=>{let t=import(`../../2d/interactive/SegmentLabels2D.js`),{SegmentLabels2D:n}=await this._updatingHandles.addPromise(t);return e.aborted?null:n}),r=await this._updatingHandles.addPromise(t.promise);if(!r)return;this._segmentLabels=c(this._segmentLabels),this._segmentLabels=new r({context:{view:this.view,editGeometryOperations:e,elevationInfo:W,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){let e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set(`color`,e),hover:this.symbols.vertices.hover?.clone().set(`color`,e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set(`color`,e),hover:this.symbols.controlPoints.hover?.clone().set(`color`,e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set(`color`,e)};for(let e of this.vertexGraphics)e.symbol=this._isSelected(e)?this.symbols.vertices.selected:this._hoverGraphic===e?this.symbols.vertices.hover:this.symbols.vertices.default;for(let e of this.curveControlPointGraphics)e.symbol=this._isSelected(e)?this.symbols.controlPoints.selected:this._hoverGraphic===e?this.symbols.controlPoints.hover:this.symbols.controlPoints.default;for(let e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){let e=this.vertexGraphics.items;if(!e)return;let t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let n=0;n<t.length;n++){let r=[];for(let e=0;e<t.length;e++){if(n===e)continue;let i=t[n],a=t[e];i.x===a.x&&i.y===a.y&&r.push(e)}e[n].attributes[R.relatedGraphicIndices]=r}}_setupMover(){let{enableMovement:e,graphic:t,midpointGraphics:n,vertexGraphics:r,view:i}=this,a=r.concat(n,this.curveControlPointGraphics).toArray();e&&t.geometry?.type!==`multipoint`&&a.push(t),this._mover=new ce({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:a,view:i,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){let{connectedReshapeProviders:e}=this;e!=null&&e.length!==0&&(this._connectedReshapeManager??=new ie({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();let t=e.graphic,n=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit(`graphic-click`,e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(e.viewEvent.button===2)return;let n=this.graphic.clone(),r=this._handleMidpointClickOrStartMove(e);this.refresh(),r.length&&this._emitVertexAddEvent([t],n,r)}else if(this._isVertex(t)||n){if(e.viewEvent.stopPropagation(),e.viewEvent.button===2){n||this._removeVertices(t);return}e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){let{graphic:t,dx:n,dy:r}=e,i=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:i?`move`:`reshape`,totalDx:n,totalDy:r}}_onGraphicMoveStartCallback(e){let{dx:t,dy:n,graphic:r}=e,i=this._connectedReshapeManager,a=i?Fe(this.graphic):null;if(r===this.graphic){let{geometry:o}=r;this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,n),a&&i?.startFeatureMove([a]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),o!=null&&o.type===`point`&&this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,n)});return}let{selectedManipulators:o}=this;if(!o.includes(r)){if(this._clearSelection(),this._isMidpoint(r)){let t=this.graphic.clone(),n=this._handleMidpointClickOrStartMove(e);n.length&&(this._emitVertexAddEvent([r],t,n),this._refreshGraphicIndicesAttributes(n[0]))}this._addToSelection(r)}if(this._setUpOperation(e),a){let e=o.filter(e=>this._isVertex(e));i?.startVertexMove(a,Ie(e))}this._emitReshapeStartEvent(r),this._onHandleMove(r,t,n,e,()=>{this._updateTooltip(r,e.viewEvent),this._emitReshapeEvent(r)})}_onGraphicMoveCallback(e){let t=this._activeOperationInfo;if(!t)return;let{dx:n,dy:r,graphic:i}=e;t.totalDx+=n,t.totalDy+=r;let{operationType:a}=t,{geometry:o}=i;if(o!=null){if(a===`move`){if(o.type===`point`)this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)});else if(o.type===`polyline`||o.type===`polygon`){let{dxMap:t,dyMap:i}=ae(n,r,this.view);if(!this._effectiveFilterVerticesEnabled){let e=K(o);this._updateVertexGraphicLocations(e)}else if(this.selectedManipulators.length>0){let e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(let t of e){if(t.geometry?.type===`point`){let{pathIndex:e,pointIndex:n}=t.attributes,r=O(o)[e][n];if(r){let e=k(r);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}this._connectedReshapeManager?.translate(t,i,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(n,r)}this._syncEditGeometryOperations(o)}else this._onHandleMove(i,n,r,e,()=>{this._updateTooltip(i,e.viewEvent),this._emitReshapeEvent(i)})}}_onGraphicMoveStopCallback(e){let t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;let{dx:n,dy:r,graphic:i,x:a,y:o}=e,{operationType:s}=t;t.totalDx+=n,t.totalDy+=r,this._onHandleMove(i,n,r,e,()=>this._handleVertexSnap(i,{x:a,y:o},s))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&t===`move`){let e=new Set;for(let t of this.selectedManipulators)e.add(Q(t));this.refresh(e),this._updateTooltip()}else this._isMidpoint(e)||e.getAttribute(R.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,r){let i=e.geometry,a=this.snappingManager?.getVertexCandidates(),o=this.callbacks.onVertexSnap,s=()=>r===`move`?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);!o||!i||!T(i)||!a||a.length===0?(s(),this._afterMoveStop(e,r)):(l(this._snappingTask),this._snappingTask=n(async n=>{try{let r=await o(i,t,a);d(n);let s=w(r);this._coordinateHelper.hasZ()||(s.z=void 0),this._syncGeometryAfterVertexMove(e,s,0,0),e.geometry=s}finally{s(),this._afterMoveStop(e,r)}}))}_updateVertexGraphicLocations(e){let{_coordinateHelper:t}=this;for(let n of this.vertexGraphics){let{pathIndex:r,pointIndex:i}=n.attributes;n.geometry=t.arrayToPoint(k(e[r][i]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){let{_coordinateHelper:n}=this;if(t)for(let r of this.midpointGraphics){let{pathIndex:i,pointIndexStart:a,pointIndexEnd:o}=r.attributes;if(!t.has(i))continue;let s=t.get(i);if(!s.has(a)&&!s.has(o))continue;let c=e[i];r.geometry=new b(z(c[a],c[o],n))}else for(let t of this.midpointGraphics){let{pathIndex:r,pointIndexStart:i,pointIndexEnd:a}=t.attributes,o=e[r];t.geometry=new b(z(o[i],o[a],n))}}_updateCurveGraphicLocations(e){let{spatialReference:t}=this._coordinateHelper,n=new Map;for(let e of this.selectedManipulators){let[t,r]=Z(e);t!=null&&r!=null&&e.getAttribute(R.controlPointKind)&&s(n,t,()=>new Set)?.add(r)}for(let t of this.curveControlPointGraphics){let[r,i]=Z(t);if(n.get(r)?.has(i))continue;let a=e[r][i];if(A(a)||j(a)){let n=k(e[r][i-1]),o=A(a)?D(n,a):F(n,a),[s,c]=E(o,.25);t.geometry=new b({x:s,y:c,spatialReference:this._coordinateHelper.spatialReference})}else if(M(a)){let[e,n]=t.getAttribute(R.controlPointKind)===B.bezier.cp1?a.b[1]:a.b[2];t.geometry=new b({x:e,y:n,spatialReference:this._coordinateHelper.spatialReference})}}for(let n of this.constructionLineGraphics){let r=n.getAttribute(R.controlPointKind),[i,a]=Z(n),o=e[i],s=k(o[a-1]),c=k(o[a]),l=e[i][a];n.geometry=r===B.bezier.line1?new x({paths:[[[s[0],s[1]],[...l.b[1]]]],spatialReference:t}):new x({paths:[[[c[0],c[1]],[...l.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){let{componentIndex:t,vertexIndex:n}=e,r=e=>{let[r,i]=Z(e);r===t&&i>=n&&e.setAttribute(R.pointIndex,i+1)};this.vertexGraphics.forEach(r),this.curveControlPointGraphics.forEach(r),this.constructionLineGraphics.forEach(r);for(let e of this.midpointGraphics){if(e.getAttribute(R.pathIndex)!==t)continue;let r=e.getAttribute(R.pointIndexStart);r>=n&&(e.setAttribute(R.pointIndexStart,r+1),e.setAttribute(R.pointIndexEnd,e.getAttribute(R.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){let[t,n]=Z(e);return u(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[n]}_onHandleMove(e,t,r,i,a){l(this._snappingTask);let o=this._snappingContext;if(!o)return;let s=e.geometry,c=i.type===`graphic-move-stop`;if(!s||!T(s))a();else if(this.snappingManager!=null&&this.selectedManipulators.length<2&&!c){let i=this.snappingManager;this._stagedVertex=i.update({point:s,context:o}),this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a(),this._snappingTask=n(async n=>{let l=await i.snap({point:s,context:o,signal:n});if(l.valid){let n=l.apply();n.z=this._coordinateHelper.hasZ()?oe(this.snappingManager)??n.z:void 0,this._stagedVertex=n,this._syncGeometryAfterVertexMove(e,new b(this._stagedVertex),t,r,c),a()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{let n=this._stagedVertex==null?s:new b(this._stagedVertex);this._syncGeometryAfterVertexMove(e,n,t,r,c),a()}}_syncGeometryAfterVertexMove(e,t,n,r,i=!1){let a=V(this._editGeometryOperations?.data.geometry);if(!a)return;let{_coordinateHelper:o}=this,s=o.pointToVector(t),c=this._getVertexFromEditGeometry(e),l=null;if(c){let e=o.getZ(s);l=[c.pos[0],c.pos[1]];let t=s[0]-c.pos[0],n=s[1]-c.pos[1],r=e==null?0:e-c.pos[2];(a.type===`point`||a.type===`mesh`)&&this._editGeometryOperations?.moveVertices([c],t,n,r),this._connectedReshapeManager?.translate(t,n,r)}if(a.type===`point`)e.geometry=t;else if(a.type===`mesh`)e.geometry=a.centerAt(t);else{if(e!==this.graphic){l&&!this._isVertex(e)&&(l=null);let[i,s]=Z(e),c=q(a),u=o.pointToArray(t);if(this._updateGeometryFromGraphic(e,c,i,s,u,a.type===`polygon`),this._isVertex(e)||this._isCurveControlPoint(e)){let t=new Map;t.set(i,new Set([s])),c=this._moveRelatedCoordinates(c,e,u,t,l),c=this._moveSelectedHandleCoordinates(c,e,n,r,a.type===`polygon`),this._updateMidpointGraphicLocations(c,t),this._updateCurveGraphicLocations(c)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(c);H(a,c)}this._updateGraphicGeometry(a),this._syncEditGeometryOperations(a),i&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){this._editGeometryOperations?.trySetGeometry(e)||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,n,r,i){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&i){let a=this._relatedGraphicIndex.search({minX:i[0],maxX:i[0],minY:i[1],maxY:i[1]});for(let o of a)o.coordinate[0]===i[0]&&o.coordinate[1]===i[1]&&o.graphic&&(r&&s(r,o.pathIndex,()=>new Set).add(o.pointIndex),X(e,o.pathIndex,o.pointIndex,n),this._relatedGraphicIndex.remove(o),o.coordinate[0]=t.geometry.x,o.coordinate[1]=t.geometry.y,o.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(o));return e}let{relatedGraphicIndices:a}=t.attributes;if(!a?.length)return e;for(let i of a){let a=this.vertexGraphics.at(i),[o,c]=Z(a);r&&s(r,o,()=>new Set).add(c),X(e,o,c,n),a.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,n,r,i){for(let a of this.selectedManipulators)if(a!==t){let[t,o]=Z(a),s=a.getAttribute(R.relatedGraphicIndices),c=se(a.geometry,n,r,this.view),l=C(c);if(a.geometry=c,this._updateGeometryFromGraphic(a,e,t,o,l,i),s?.length)for(let t of s){let n=this.vertexGraphics.at(t),[r,i]=Z(n);X(e,r,i,l),n.geometry=c}}return e}_updateGeometryFromGraphic(e,t,n,r,i,a){let o=t[n].length-1;this._isCurveControlPoint(e)?Pe(t,n,r,[i[0],i[1]],e.getAttribute(R.controlPointKind)):(X(t,n,r,i),a&&(r===0?X(t,n,o,i):r===o&&(t[n][0]=i)))}_onGraphicPointerOverCallback(e){let t=e.graphic;this._hoverGraphic=t;let n=this._isVertex(t);n&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(n?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){let t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(U),this._updateTooltip()}_handleMidpointClickOrStartMove(e){let{graphic:t}=e,n=this.graphic.geometry;if(n==null||n.type!==`polygon`&&n.type!==`polyline`)return[];let r=V(n),i=[],{[R.pathIndex]:a,[R.pointIndexStart]:o,[R.pointIndexEnd]:s}=t.attributes,c=C(t.geometry),l=s===0?o+1:s;t.attributes={[R.tool]:be,[R.pathIndex]:a,[R.pointIndex]:l,[R.relatedGraphicIndices]:[]};let u=q(r),d=u[a][s];if(N(d)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){let e=k(u[a][l]);u[a].splice(l,1,{c:[e,[c[0],c[1]]]}),t.setAttribute(R.controlPointKind,B.circle.interior),t.setAttribute(R.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),H(r,u)}else u[a].splice(l,0,c),i.push({coordinates:u[a][l],componentIndex:a,vertexIndex:l})}else{let e=k(u[a][o]),t=xe(e,d,.5,this._coordinateHelper);u[a].splice(s,1,...t),i.push({coordinates:k(u[a][l]),componentIndex:a,vertexIndex:l})}return this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),i}_addToSelection(e){let t=$(e);for(let e of t)e.symbol=this._isCurveControlPoint(e)?this.symbols.controlPoints.selected:this.symbols.vertices.selected,this.selectedManipulators.add(e),this._updateTooltip(e);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){let{vertices:n}=this.symbols;e.symbol=t?n.hover:n.default}else if(this._isCurveControlPoint(e)){let{controlPoints:n}=this.symbols;e.symbol=t?n.hover:n.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){let e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:n}=this.symbols;if(e.length>0){for(let r of e)this._isVertex(r)?r.symbol=n.default:this._isCurveControlPoint(r)&&(r.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){this._activeOperationInfo==null&&je(e,this.tooltip)||Ee.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){let t=this.graphic.geometry,n=this.vertexGraphics.length;if(t==null||t.type!==`polygon`&&t.type!==`polyline`&&t.type!==`multipoint`||t.type===`polygon`&&n<4||t.type===`multipoint`&&n<2||t.type===`polyline`&&n<3)return;let r=this.graphic.clone(),i=V(t),a=q(i),o=[],s=$(e);for(let e of s){if(this._isCurveControlPoint(e))continue;let{x:t,y:n}=e.geometry;for(let e=0;e<a.length;e++){let r=a[e];for(let i=0;i<r.length;i++){let[s,c]=k(r[i]);if(t===s&&n===c){o.push({coordinates:k(a[e][i]),componentIndex:e,vertexIndex:i}),a[e].splice(Number(i),1);let t=a[e][i];t&&!N(t)&&(a[e][i]=k(t))}}}}if(i.type===`polygon`)a=a.filter(e=>{if(e.length<2)return!1;let[t,n]=k(e[0]),[r,i]=k(e[e.length-1]);return e.length===2&&t===r&&n===i?!1:((t!==r||n!==i)&&e.push(e[0]),!0)});else if(i.type===`polyline`)for(let e of a)e.length===1&&a.splice(a.indexOf(e),1);H(i,a),this._updateGraphicGeometry(i),this.refresh(),this._emitVertexRemoveEvent(s,r,o)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){let t=this._isMidpoint(e)?`copy`:`move`;this.addHandles(this.view.acquireCursor(t,`high`),U)}_updateTooltip(e,t){let n=null,{graphic:r,view:i,tooltipInfos:a}=this,o=r?.geometry;o?.type===`point`?n=a.movePoint:this._selectedManipulator?n=a.selectedVertex:e===this.graphic?(n=a.translateGraphic,me(n,i,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(n=a.translateVertices,he(n,i,o,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=n}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){let n={type:`move-start`,mover:this.graphic,dx:e,dy:t};this.emit(`move-start`,n),this.callbacks.onMoveStart?.(n)}_emitMoveEvent(e,t){let n={type:`move`,mover:this.graphic,dx:e,dy:t};this.emit(`move`,n),this.callbacks.onMove?.(n)}_emitMoveStopEvent(e,t){if(e==null||t==null){let n=this._activeOperationInfo;if(!n)return;e=n.totalDx,t=n.totalDy}let n={type:`move-stop`,mover:this.graphic,dx:e,dy:t};this.emit(`move-stop`,n),this.callbacks.onMoveStop?.(n)}_emitReshapeStartEvent(e){let t={type:`reshape-start`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-start`,t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){let t={type:`reshape`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape`,t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){let t={type:`reshape-stop`,graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit(`reshape-stop`,t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){let t={type:`vertex-select`,added:e};this.emit(`select`,t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){let t={type:`vertex-deselect`,removed:e};this.emit(`deselect`,t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,n){let r={type:`vertex-add`,added:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-add`,r),this.callbacks.onVertexAdd?.(r)}_emitVertexRemoveEvent(e,t,n){let r={type:`vertex-remove`,removed:e,graphic:this.graphic,oldGraphic:t,vertices:n};this.emit(`vertex-remove`,r),this.callbacks.onVertexRemove?.(r)}_logGeometryTypeError(){o.getLogger(this).error(new i(`reshape:invalid-geometry`,`Reshape operation not supported for the provided graphic. The geometry type is not supported.`))}};e([_()],G.prototype,`_activeOperationInfo`,void 0),e([_()],G.prototype,`_connectedReshapeManager`,void 0),e([_()],G.prototype,`_coordinateHelper`,null),e([_()],G.prototype,`_editGeometryOperations`,void 0),e([_()],G.prototype,`_effectiveFilterVerticesEnabled`,null),e([_()],G.prototype,`_primaryGraphicMoving`,void 0),e([_()],G.prototype,`_segmentLabels`,void 0),e([_()],G.prototype,`test`,null),e([_()],G.prototype,`_segmentLabelsImportTask`,void 0),e([_()],G.prototype,`_updatingHandles`,void 0),e([_()],G.prototype,`_selectedManipulator`,null),e([_()],G.prototype,`_tooltipsContext`,null),e([_()],G.prototype,`callbacks`,void 0),e([_()],G.prototype,`connectedReshapeProviders`,void 0),e([_()],G.prototype,`enableMidpoints`,void 0),e([_()],G.prototype,`enableCurveOnMidpoint`,void 0),e([_()],G.prototype,`enableMovement`,void 0),e([_()],G.prototype,`enableVertices`,void 0),e([_()],G.prototype,`filterVerticesEnabled`,void 0),e([_()],G.prototype,`graphic`,void 0),e([_()],G.prototype,`highlightName`,void 0),e([_()],G.prototype,`highlightsEnabled`,void 0),e([_()],G.prototype,`layer`,void 0),e([_()],G.prototype,`snappingManager`,void 0),e([_({readOnly:!0})],G.prototype,`state`,null),e([_()],G.prototype,`symbols`,void 0),e([_()],G.prototype,`tooltip`,void 0),e([_()],G.prototype,`tooltipInfos`,void 0),e([_()],G.prototype,`activeTooltipInfo`,void 0),e([_()],G.prototype,`updating`,null),e([_()],G.prototype,`toolOptions`,void 0),e([_({readOnly:!0})],G.prototype,`type`,void 0),e([_({readOnly:!0})],G.prototype,`vertexGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`curveControlPointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`constructionLineGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`midpointGraphics`,void 0),e([_({readOnly:!0})],G.prototype,`selectedManipulators`,void 0),e([_()],G.prototype,`view`,void 0),G=e([v(`esri.views.draw.support.Reshape`)],G);function K(e){let t=q(e);t=t.map(e=>e.slice());for(let e of t)for(let t=0;t<e.length;t++)e[t]=ee(e[t]);if(e.type===`polygon`)for(let e of t){let t=e[e.length-1];if(!N(t))continue;let n=e[0];n[0]===t[0]&&n[1]===t[1]&&e.length>2&&e.pop()}return t}function q(e){return e.type===`polygon`?e.curveRings?.slice()??e.rings.slice():e.type===`polyline`?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Ne(e,t,n,r){let i=e[t][n];if(A(i))i.c[1]=r;else if(j(i)){let i=k(e[t][n]);e[t][n]={c:[i,r]}}}function Pe(e,t,n,r,i){switch(i){case B.circle.interior:Ne(e,t,n,r);break;case B.bezier.cp1:e[t][n].b[1]=r;break;case B.bezier.cp2:e[t][n].b[2]=r}}function J(e,t){return e<t*1e-8}function Y(e,{cx:t,cy:n,isInvalid:r,thetaStart:i,thetaEnd:a},o,s){let[c,l]=e,[u,d]=o,f=u-c,p=d-l;t-=c,n-=l;let m=s?i>a:i<a,[h,g]=r?[t,n]:m?[-n,t]:[n,-t],[_,v]=[f,p],[y,b]=[h,g],x=_*b-v*y,S=(f**2+p**2)/2;if(J(Math.abs(x),S))return[(c+u)/2,(l+d)/2];let[C,w]=[b/x*S,-y/x*S],T=C**2+w**2,[E,D]=[f/2-C,p/2-w];if(J(E**2+D**2,T)){let[e,t]=m?[-w,C]:[w,-C];return[e+C+c,t+w+l]}let O=Math.sqrt((C**2+w**2)/(E**2+D**2))*Math.sign(f*h+p*g);return[E*O+C+c,D*O+w+l]}function X(e,t,n,r){let i=e[t][n],a=e[t].at(n+1);if(Se(e,t)){let n=e[t][1];e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0]};return}if(Ce(e,t)){let n=e[t][1],[i,a]=n.a[1],[o,s]=r,c=Math.hypot(o-i,s-a),[l,u]=[o-i,s-a],d=te(u,l);e[t][0]=[...r],e[t][1]={a:[[...r],[...n.a[1]],0,0,d,c,n.a[6]]};return}let o=k(i);if(N(i))i.splice(0,i.length,...r);else if(M(i))i.b[0].splice(0,i.b[0].length,...r);else if(A(i)||j(i)){let a=k(e[t][n-1]),o=A(i)?D(a,i):F(a,i);e[t].splice(n,1,{c:[[...r],Y(a,o,r,!0)]})}else if(P(i)){i.a[0].splice(0,i.a[0].length,...r);let a=k(e[t][n-1]);I(a,i)}if(a&&!N(a)&&!M(i)){if(A(a)||j(a)){let i=k(a),s=A(a)?D(o,a):F(o,a);e[t].splice(n+1,1,{c:[i,Y(i,s,r,!1)]})}else if(P(a)){let e=k(i);I(e,a)}}}function Z({attributes:e}){return[e?.[R.pathIndex]||0,e?.[R.pointIndex]||0]}function Q({attributes:e}){return`${e?.[R.pathIndex]}-${e?.[R.pointIndex]}-${e?.[R.controlPointKind]??`vertex`}`}function $(e){return e instanceof t?[e]:[...e]}function Fe(e){let t=e.sourceLayer??e.layer;return de(t)?{graphic:e,layer:t}:null}function Ie(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[R.pathIndex],vertexIndex:e[R.pointIndex]}))}const Le=G;export{Le as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e,equals as t}from"../../../core/arrayUtils.js";import{clone as n}from"../../../core/lang.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{lerp as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../geometry/Circle.js";import s from"../../../geometry/Multipoint.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{distanceExecute as d}from"../../../geometry/operators/distanceOperator.js";import{simplifyIsSimple as f,simplifyExecute as p}from"../../../geometry/operators/simplifyOperator.js";import{isClockwise as m}from"../../../geometry/support/coordsUtils.js";import{isValid as h}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as g}from"./surfaceCoordinateSystems.js";import{unnormalize as _}from"../../support/unnormalizationUtils.js";function v(e,t){let n=new c({x:e[0],y:e[1],spatialReference:t});return e.length>2&&(n.z=e[2]),n}function y(e,t){return new s({points:e,spatialReference:t})}function b(e,t,n){let r=new u({paths:e,spatialReference:t});return n&&_(r,r.spatialReference),r}function x(e,r,i,a=!0){let o=n(e);o.forEach(e=>{let n=e[0],r=e[e.length-1];(!t(n,r)||e.length===1)&&e.push(e[0])});let s=new l({rings:o,spatialReference:r});return s.rings.forEach(e=>{m(e)||e.reverse()}),i&&_(s,s.spatialReference),a&&!f(s)&&h(r)&&(s=p(s)||s),s}function S(t,n,r){let i=n.mapToLocalMultiple(t),a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y},c=Math.round(s.x-o.x),l=Math.round(s.y-o.y),u=Math.max(Math.abs(c),Math.abs(l));if(r){let e={x:o.x+u,y:o.y+u},t={x:o.x-u,y:o.y-u};a.push(g(e.x,t.y),g(t.x,t.y),g(t.x,e.y),g(e.x,e.y))}else{let e={x:c>0?o.x+u:o.x-u,y:l>0?o.y+u:o.y-u};a.push(g(o.x,o.y),g(e.x,o.y),g(e.x,e.y),g(o.x,e.y))}return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function C(t,n,r){let i=n.mapToLocalMultiple(t);if(i.length===1){let e=i[0];i=[g(e.x-48,e.y+48),g(e.x+48,e.y-48),g(e.x+48,e.y-48),g(e.x-48,e.y+48)]}let a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y};if(r){let e=Math.round(s.x-o.x),t=Math.round(s.y-o.y);a.push(g(o.x-e,o.y-t),g(s.x,o.y-t),g(s.x,s.y),g(o.x-e,s.y))}else a.push(g(o.x,o.y),g(s.x,o.y),g(s.x,s.y),g(o.x,s.y));return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function w(e,t,n){let r=T(t[3],t[2],n),i=T(t[1],t[2],n),a=T(t[0],t[1],n),o=T(t[0],t[3],n);return{geometry:e,midpoints:r!=null&&i!=null&&a!=null&&o!=null?{top:r,right:i,bottom:a,left:o}:null}}function T(e,t,n){D[0]=e.x,D[1]=e.y,D[2]=0,O[0]=t.x,O[1]=t.y,O[2]=0,i(D,D,O,.5),E.x=D[0],E.y=O[1],E.z=O[2];let r=n.localToMap(E);return r==null?null:v(r,n.spatialReference)}const E=g(0,0,0),D=a(),O=a();function k(e,t,n,i){let a=t.mapToLocalMultiple(e),s=null,c=null;if(n)s=a[0],c=a[1];else{let e=a[0],t=a[1],n=Math.round(t.x-e.x),r=Math.round(t.y-e.y),i=Math.max(Math.abs(n),Math.abs(r));s=g(n>0?e.x+i/2:e.x-i/2,r>0?e.y+i/2:e.y-i/2),c=g(Math.abs(n)>Math.abs(r)?s.x-i/2:s.x,Math.abs(n)>Math.abs(r)?s.y:s.y-i/2)}let l=t.localToMap(s),u=t.localToMap(c);if(l==null||u==null)return null;t.doUnnormalization&&_([[l,u]],t.spatialReference);let f=v(l,t.spatialReference),p=v(u,t.spatialReference),m=r(t.spatialReference),y=0;if(h(t.spatialReference))y=m*d(f,p);else{let e=s.x-c.x,t=s.y-c.y;y=m*Math.sqrt(e*e+t*t)*(i||1)}let b=new o({center:f,radius:y,radiusUnit:`meters`,spatialReference:t.spatialReference});return{geometry:x(b.rings,b.spatialReference,!1),center:f,edge:p}}function A(t,n,r){let i=n.mapToLocalMultiple(t),a=i[0],o=i[1],s=Math.round(o.x-a.x),c=Math.round(o.y-a.y),l=g(r?a.x:a.x+s/2,r?a.y:a.y+c/2),u=r?s:s/2,d=r?c:c/2,f=[],p=2*Math.PI/60;function m(e){let t=Math.cos(e),n=Math.sin(e);return g(u*t+l.x,d*n+l.y)}for(let e=0;e<60;e++)f.push(m(e*p));f.push(f[0]);let{spatialReference:h,doUnnormalization:_}=n,y=x([f.map(e=>n.localToMap(e)).filter(e)],h,_,!1),b=n.localToMap(m(Math.PI/2)),S=n.localToMap(m(0)),C=n.localToMap(m(-Math.PI/2)),w=n.localToMap(m(Math.PI));return{geometry:y,midpoints:b!=null&&S!=null&&C!=null&&w!=null?{top:v(b,h),right:v(S,h),bottom:v(C,h),left:v(w,h)}:null}}export{k as createCircle,A as createEllipse,y as createMultipoint,v as createPoint,x as createPolygon,b as createPolyline,C as createRectangle,S as createSquare};
2
+ import{isSome as e,equals as t}from"../../../core/arrayUtils.js";import{clone as n}from"../../../core/lang.js";import{getMetersPerUnitForSR as r}from"../../../core/units.js";import{lerp as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../geometry/Circle.js";import s from"../../../geometry/Multipoint.js";import c from"../../../geometry/Point.js";import l from"../../../geometry/Polygon.js";import u from"../../../geometry/Polyline.js";import{distanceExecute as d}from"../../../geometry/operators/distanceOperator.js";import{simplifyIsSimple as f,simplifyExecute as p}from"../../../geometry/operators/simplifyOperator.js";import{isClockwise as m}from"../../../geometry/support/coordsUtils.js";import{isValid as h}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as g}from"./surfaceCoordinateSystems.js";import{unnormalize as _}from"../../support/unnormalizationUtils.js";function v(e,t){let n=new c({x:e[0],y:e[1],spatialReference:t});return e.length>2&&(n.z=e[2]),n}function y(e,t){return new s({points:e,spatialReference:t})}function b(e,t,n){let r=new u({paths:e,spatialReference:t});return n&&_(r,r.spatialReference),r}function x(e,r,i,a=!0){let o=n(e);o.forEach(e=>{let n=e[0],r=e[e.length-1];t(n,r)&&e.length!==1||e.push(e[0])});let s=new l({rings:o,spatialReference:r});return s.rings.forEach(e=>{m(e)||e.reverse()}),i&&_(s,s.spatialReference),a&&!f(s)&&h(r)&&(s=p(s)||s),s}function S(t,n,r){let i=n.mapToLocalMultiple(t),a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y},c=Math.round(s.x-o.x),l=Math.round(s.y-o.y),u=Math.max(Math.abs(c),Math.abs(l));if(r){let e={x:o.x+u,y:o.y+u},t={x:o.x-u,y:o.y-u};a.push(g(e.x,t.y),g(t.x,t.y),g(t.x,e.y),g(e.x,e.y))}else{let e={x:c>0?o.x+u:o.x-u,y:l>0?o.y+u:o.y-u};a.push(g(o.x,o.y),g(e.x,o.y),g(e.x,e.y),g(o.x,e.y))}return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function C(t,n,r){let i=n.mapToLocalMultiple(t);if(i.length===1){let e=i[0];i=[g(e.x-48,e.y+48),g(e.x+48,e.y-48),g(e.x+48,e.y-48),g(e.x-48,e.y+48)]}let a=[],o={x:i[0].x,y:i[0].y},s={x:i[1].x,y:i[1].y};if(r){let e=Math.round(s.x-o.x),t=Math.round(s.y-o.y);a.push(g(o.x-e,o.y-t),g(s.x,o.y-t),g(s.x,s.y),g(o.x-e,s.y))}else a.push(g(o.x,o.y),g(s.x,o.y),g(s.x,s.y),g(o.x,s.y));return w(x([a.map(e=>n.localToMap(e)).filter(e)],n.spatialReference,n.doUnnormalization,!0),a,n)}function w(e,t,n){let r=T(t[3],t[2],n),i=T(t[1],t[2],n),a=T(t[0],t[1],n),o=T(t[0],t[3],n);return{geometry:e,midpoints:r!=null&&i!=null&&a!=null&&o!=null?{top:r,right:i,bottom:a,left:o}:null}}function T(e,t,n){D[0]=e.x,D[1]=e.y,D[2]=0,O[0]=t.x,O[1]=t.y,O[2]=0,i(D,D,O,.5),E.x=D[0],E.y=O[1],E.z=O[2];let r=n.localToMap(E);return r==null?null:v(r,n.spatialReference)}const E=g(0,0,0),D=a(),O=a();function k(e,t,n,i){let a=t.mapToLocalMultiple(e),s=null,c=null;if(n)s=a[0],c=a[1];else{let e=a[0],t=a[1],n=Math.round(t.x-e.x),r=Math.round(t.y-e.y),i=Math.max(Math.abs(n),Math.abs(r));s=g(n>0?e.x+i/2:e.x-i/2,r>0?e.y+i/2:e.y-i/2),c=g(Math.abs(n)>Math.abs(r)?s.x-i/2:s.x,Math.abs(n)>Math.abs(r)?s.y:s.y-i/2)}let l=t.localToMap(s),u=t.localToMap(c);if(l==null||u==null)return null;t.doUnnormalization&&_([[l,u]],t.spatialReference);let f=v(l,t.spatialReference),p=v(u,t.spatialReference),m=r(t.spatialReference),y=0;if(h(t.spatialReference))y=m*d(f,p);else{let e=s.x-c.x,t=s.y-c.y;y=m*Math.sqrt(e*e+t*t)*(i||1)}let b=new o({center:f,radius:y,radiusUnit:`meters`,spatialReference:t.spatialReference});return{geometry:x(b.rings,b.spatialReference,!1),center:f,edge:p}}function A(t,n,r){let i=n.mapToLocalMultiple(t),a=i[0],o=i[1],s=Math.round(o.x-a.x),c=Math.round(o.y-a.y),l=g(r?a.x:a.x+s/2,r?a.y:a.y+c/2),u=r?s:s/2,d=r?c:c/2,f=[],p=2*Math.PI/60;function m(e){let t=Math.cos(e),n=Math.sin(e);return g(u*t+l.x,d*n+l.y)}for(let e=0;e<60;e++)f.push(m(e*p));f.push(f[0]);let{spatialReference:h,doUnnormalization:_}=n,y=x([f.map(e=>n.localToMap(e)).filter(e)],h,_,!1),b=n.localToMap(m(Math.PI/2)),S=n.localToMap(m(0)),C=n.localToMap(m(-Math.PI/2)),w=n.localToMap(m(Math.PI));return{geometry:y,midpoints:b!=null&&S!=null&&C!=null&&w!=null?{top:v(b,h),right:v(S,h),bottom:v(C,h),left:v(w,h)}:null}}export{k as createCircle,A as createEllipse,y as createMultipoint,v as createPoint,x as createPolygon,b as createPolyline,C as createRectangle,S as createSquare};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{createTask as e}from"../../../core/asyncUtils.js";import{throwIfAborted as t,isAborted as n,isAbortError as r}from"../../../core/promiseUtils.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{diff as a}from"../../../core/accessorSupport/diffUtils.js";import{isGraphicsLayer as o,isSceneLayer as s}from"../../../layers/support/layerUtils.js";import{getDisplayedSymbol as c}from"../../../symbols/support/symbolUtils.js";import{GraphicState as l}from"../../3d/layers/graphics/GraphicState.js";async function u(e,n,r,i){let a=n.createQuery();a.objectIds=e,a.outFields=[`*`],a.returnM=n.capabilities.data.supportsM,a.returnZ=n.capabilities.data.supportsZ,a.returnGeometry=!0,(!s(n)||n.infoFor3D==null)&&(a.outSpatialReference=r),!s(n)&&n.capabilities?.data.supportsTrueCurve&&(a.returnTrueCurves=!0);let o=await n.queryFeatures(a,{signal:i});return t(i),o.features}async function d(e,n,r){let i=await c(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,scale:n});t(r),a(e.symbol,i)!=null&&(e.symbol=i)}async function f(a,s,c,l,u){t(u),a.graphics.includes(l)||a.add(l);let d=c.sourceLayer,f=c.layer??d,h=c.getObjectId(),g=null,_=null;function v(r){return g?.abort(),o(f)?(c.visible=r,Promise.resolve()):(g=e(async e=>{let i=await p(s,f);if(t(e),!(!i||s.destroyed||i.destroyed))try{h!=null&&typeof h==`number`&&`setVisibility`in i&&i.setVisibility?.(h,r)}catch(t){if(n(e)||s.destroyed||i.destroyed)return;throw t}}),g.promise)}async function y(){return _||(_=(async()=>{try{await v(!0);let e=s.destroyed?null:await p(s,f).catch(()=>{});e&&!e.destroyed&&await i(()=>!e.updating)}catch(e){if(e&&!r(e))throw e}finally{a.remove(l)}})(),s.addUpdatingPromise(_).catch(()=>{}),_)}try{await m(s,l,u),t(u),v(!1).catch(()=>{})}catch(e){throw await y(),e}let b=async()=>y().catch(()=>{});return{remove:b,[Symbol.asyncDispose](){return b()}}}async function p(e,t){if(!t||t.type===`building-component`)return;let n=t.type===`subtype-sublayer`?t.parent:t;return n?e.whenLayerView(n):void 0}async function m(e,t,n){if(e.type===`3d`){let r=new l({graphic:t}),a=e.trackGraphicState(r);try{await i(()=>r.displaying||r.error,n)}finally{a.remove()}}else await i(()=>t.visible,n)}export{u as fetchFullFeaturesByObjectId,f as swapForEditingSession,d as updateGraphicSymbolWhenRequired};
2
+ import{createTask as e}from"../../../core/asyncUtils.js";import{throwIfAborted as t,isAborted as n,isAbortError as r}from"../../../core/promiseUtils.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{diff as a}from"../../../core/accessorSupport/diffUtils.js";import{isGraphicsLayer as o,isSceneLayer as s}from"../../../layers/support/layerUtils.js";import{getDisplayedSymbol as c}from"../../../symbols/support/symbolUtils.js";import{GraphicState as l}from"../../3d/layers/graphics/GraphicState.js";async function u(e,n,r,i){let a=n.createQuery();a.objectIds=e,a.outFields=[`*`],a.returnM=n.capabilities.data.supportsM,a.returnZ=n.capabilities.data.supportsZ,a.returnGeometry=!0,s(n)&&n.infoFor3D!=null||(a.outSpatialReference=r),!s(n)&&n.capabilities?.data.supportsTrueCurve&&(a.returnTrueCurves=!0);let o=await n.queryFeatures(a,{signal:i});return t(i),o.features}async function d(e,n,r){let i=await c(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,scale:n});t(r),a(e.symbol,i)!=null&&(e.symbol=i)}async function f(a,s,c,l,u){t(u),a.graphics.includes(l)||a.add(l);let d=c.sourceLayer,f=c.layer??d,h=c.getObjectId(),g=null,_=null;function v(r){return g?.abort(),o(f)?(c.visible=r,Promise.resolve()):(g=e(async e=>{let i=await p(s,f);if(t(e),!(!i||s.destroyed||i.destroyed))try{h!=null&&typeof h==`number`&&`setVisibility`in i&&i.setVisibility?.(h,r)}catch(t){if(n(e)||s.destroyed||i.destroyed)return;throw t}}),g.promise)}async function y(){return _||(_=(async()=>{try{await v(!0);let e=s.destroyed?null:await p(s,f).catch(()=>{});e&&!e.destroyed&&await i(()=>!e.updating)}catch(e){if(e&&!r(e))throw e}finally{a.remove(l)}})(),s.addUpdatingPromise(_).catch(()=>{}),_)}try{await m(s,l,u),t(u),v(!1).catch(()=>{})}catch(e){throw await y(),e}let b=async()=>y().catch(()=>{});return{remove:b,[Symbol.asyncDispose](){return b()}}}async function p(e,t){if(!t||t.type===`building-component`)return;let n=t.type===`subtype-sublayer`?t.parent:t;return n?e.whenLayerView(n):void 0}async function m(e,t,n){if(e.type===`3d`){let r=new l({graphic:t}),a=e.trackGraphicState(r);try{await i(()=>r.displaying||r.error,n)}finally{a.remove()}}else await i(()=>t.visible,n)}export{u as fetchFullFeaturesByObjectId,f as swapForEditingSession,d as updateGraphicSymbolWhenRequired};
@@ -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 n from"../../../../core/Collection.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import i from"../../../../core/ReactiveMap.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as l}from"../../DrawManipulator.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as d}from"../../../interactive/ManipulatorCollection.js";const f=Symbol(`manipulator-handle-watch`);let p=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new i,this._pluginHandleRegistry=new i,this._handleManipulatorMap=new n,this.renderer=null,this.manipulators=new d,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){let{capturingHandle:t,_handleManipulatorMap:n}=this;if(!t){this.followHandle(n.at(0)?.handle);return}let r=n.findIndex(({handle:e})=>e===t),i=e===`forward`?r+1:r-1;this.followHandle(n.at(i%n.length)?.handle)}toggleFollow(){let e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;let t=this._handleManipulatorMap.find(e=>e.handle.defaultCaptureMode!==`grabbable-object`)?.handle;return t?(this.followHandle(t),!0):!1}shouldCaptureInput(e=null,t=null){let n=this.capturingHandle;return!n||!(e!=null&&n.activePointerId!=null&&n.activePointerId!==e||t===`touch`&&n.activePointerType===`pen`)}notePointerDown(e=null,t=null){this.shouldCaptureInput(e,t)&&this.capturingHandle?.notePointerDown(e,t)}notePointerUp(e=null,t=null){this.capturingHandle?.notePointerUp(e,t)}releaseHandle(e){e&&(e.captureMode=`grabbable-object`,e.drawToolDragging=!1),(!e||e===this.capturingHandle)&&(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode=`grabbable-object`),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{e.captureMode!==`grabbable-object`&&(e.captureMode=`grabbable-object`)}),e&&(e.captureMode=e.defaultCaptureMode===`grabbable-object`?`capture-always`:e.defaultCaptureMode),e?.captureMode!==`grabbable-object`&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let n=null,r=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:i,manipulator:a})=>{if(i.captureMode!==`grabbable-object`||!a.interactive)return;let o=a.intersectionDistance(e,t);o!=null&&o<r&&(r=o,n=i)}),n}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,n){let{view:r}=this,{surfaceManager:i}=n,s=n.editGeometryOperations?.data.coordinateHelper;if(!r||!i||!s)return;let c=await this._createManipulator(r,this.renderer,e);if(this.destroyed||e.destroyed){c.destroy();return}this._handleManipulatorMap.push({handle:e,manipulator:c}),this.manipulators.add(c),e.addHandles([a(()=>c.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],f),e.following&&(this.capturingHandle=e);let l=(e.inputMapPosition&&i.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(r?.width/2,r.height/2);await e?.moveTo(l,{...n,pointerType:`mouse`})}removeManipulatorForHandle(e){let t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(f)}registerHandle(e,t){let i=r(this._pluginHandleRegistry,e,()=>new n),a=new u(t);return i.push(a),a}unregisterHandle(e,t){let n=this._pluginHandleRegistry.get(e);n&&(t?(n.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(n.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,n){r(this._pluginConstraintRegistry,e,()=>new i).set(t,n)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){let n=this._pluginHandleRegistry.get(e);if(n)for(let e of n)e.editSession=t}updateAllScreenPositions(e=null){let{view:t}=this;this._handleManipulatorMap.forEach(({handle:n})=>{let r=n.outputMapPosition;r&&(n.screenPosition=e?.mapToScreen(r,{firstPointZ:n.firstPointZ})??t?.toScreen(r))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}async _createManipulator(e,t,n){if(e.type===`3d`){let{DrawManipulator3D:r}=await import(`../../DrawManipulator3D.js`);return new r({view:e,renderer:t,managedHandle:n})}return new l({renderer:t,managedHandle:n})}};e([s({constructOnly:!0})],p.prototype,`renderer`,void 0),e([s({readOnly:!0})],p.prototype,`manipulators`,void 0),e([s({constructOnly:!0})],p.prototype,`view`,void 0),e([s()],p.prototype,`capturingHandle`,void 0),e([s()],p.prototype,`customConstraints`,null),e([s()],p.prototype,`focusedHandle`,null),e([s()],p.prototype,`handleCount`,null),e([s()],p.prototype,`allhandles`,null),p=e([c(`esri.views.draw.support.managers.InteractiveHandleManager`)],p);export{p as InteractiveHandleManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Collection.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import i from"../../../../core/ReactiveMap.js";import{watch as a}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as l}from"../../DrawManipulator.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as d}from"../../../interactive/ManipulatorCollection.js";const f=Symbol(`manipulator-handle-watch`);let p=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new i,this._pluginHandleRegistry=new i,this._handleManipulatorMap=new n,this.renderer=null,this.manipulators=new d,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){let{capturingHandle:t,_handleManipulatorMap:n}=this;if(!t){this.followHandle(n.at(0)?.handle);return}let r=n.findIndex(({handle:e})=>e===t),i=e===`forward`?r+1:r-1;this.followHandle(n.at(i%n.length)?.handle)}toggleFollow(){let e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;let t=this._handleManipulatorMap.find(e=>e.handle.defaultCaptureMode!==`grabbable-object`)?.handle;return t?(this.followHandle(t),!0):!1}shouldCaptureInput(e=null,t=null){let n=this.capturingHandle;return!n||!(e!=null&&n.activePointerId!=null&&n.activePointerId!==e||t===`touch`&&n.activePointerType===`pen`)}notePointerDown(e=null,t=null){this.shouldCaptureInput(e,t)&&this.capturingHandle?.notePointerDown(e,t)}notePointerUp(e=null,t=null){this.capturingHandle?.notePointerUp(e,t)}releaseHandle(e){e&&(e.captureMode=`grabbable-object`,e.drawToolDragging=!1),e&&e!==this.capturingHandle||(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode=`grabbable-object`),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{e.captureMode!==`grabbable-object`&&(e.captureMode=`grabbable-object`)}),e&&(e.captureMode=e.defaultCaptureMode===`grabbable-object`?`capture-always`:e.defaultCaptureMode),e?.captureMode!==`grabbable-object`&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let n=null,r=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:i,manipulator:a})=>{if(i.captureMode!==`grabbable-object`||!a.interactive)return;let o=a.intersectionDistance(e,t);o!=null&&o<r&&(r=o,n=i)}),n}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,n){let{view:r}=this,{surfaceManager:i}=n,s=n.editGeometryOperations?.data.coordinateHelper;if(!r||!i||!s)return;let c=await this._createManipulator(r,this.renderer,e);if(this.destroyed||e.destroyed){c.destroy();return}this._handleManipulatorMap.push({handle:e,manipulator:c}),this.manipulators.add(c),e.addHandles([a(()=>c.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],f),e.following&&(this.capturingHandle=e);let l=(e.inputMapPosition&&i.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(r?.width/2,r.height/2);await e?.moveTo(l,{...n,pointerType:`mouse`})}removeManipulatorForHandle(e){let t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(f)}registerHandle(e,t){let i=r(this._pluginHandleRegistry,e,()=>new n),a=new u(t);return i.push(a),a}unregisterHandle(e,t){let n=this._pluginHandleRegistry.get(e);n&&(t?(n.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(n.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,n){r(this._pluginConstraintRegistry,e,()=>new i).set(t,n)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){let n=this._pluginHandleRegistry.get(e);if(n)for(let e of n)e.editSession=t}updateAllScreenPositions(e=null){let{view:t}=this;this._handleManipulatorMap.forEach(({handle:n})=>{let r=n.outputMapPosition;r&&(n.screenPosition=e?.mapToScreen(r,{firstPointZ:n.firstPointZ})??t?.toScreen(r))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}async _createManipulator(e,t,n){if(e.type===`3d`){let{DrawManipulator3D:r}=await import(`../../DrawManipulator3D.js`);return new r({view:e,renderer:t,managedHandle:n})}return new l({renderer:t,managedHandle:n})}};e([s({constructOnly:!0})],p.prototype,`renderer`,void 0),e([s({readOnly:!0})],p.prototype,`manipulators`,void 0),e([s({constructOnly:!0})],p.prototype,`view`,void 0),e([s()],p.prototype,`capturingHandle`,void 0),e([s()],p.prototype,`customConstraints`,null),e([s()],p.prototype,`focusedHandle`,null),e([s()],p.prototype,`handleCount`,null),e([s()],p.prototype,`allhandles`,null),p=e([c(`esri.views.draw.support.managers.InteractiveHandleManager`)],p);export{p as InteractiveHandleManager};
@@ -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"../../Color.js";import{onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{createTask as i}from"../../core/asyncUtils.js";import{multiplyOpacity as a,getContrast as o}from"../../core/colorUtils.js";import{makeHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as c}from"../../core/MapUtils.js";import{deg2rad as l}from"../../core/mathUtils.js";import{debounce as u}from"../../core/promiseUtils.js";import{formatLength as d}from"../../core/quantityFormatUtils.js";import{on as f}from"../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../core/screenUtils.js";import{getMetersPerUnit as m,getMetersPerVerticalUnitForSR as h}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as v,set as y,normalize as b,scale as x,add as S,lerp as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as w}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as T}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as E}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as D}from"../../core/support/UpdatingHandles.js";import O from"../../geometry/Polyline.js";import{isClockwise as k}from"../../geometry/support/coordsUtils.js";import{getEndpoint as A,isCoordinate as j,cloneCurve as M}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as N}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as P}from"../../intl/messages.js";import{getConvertedElevationFromVector as F,absoluteHeightElevationInfo as I}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as L}from"../../support/getDefaultUnitForView.js";import R from"../overlay/TextOverlayItem.js";import{GeometryWorkerHandle as z}from"../support/GeometryWorkerHandle.js";const B={default:15,far:25};let V=class extends r{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance=`default`,this._updatingHandles=new D,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new z({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[this.context!=null&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),f(()=>this.context?.editGeometryOperations,[`vertex-add`,`vertex-remove`],()=>this._update()),f(()=>this.context?.editGeometryOperations,`vertex-update`,e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),n(()=>this._refreshMessages()),s(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return B[this.edgeDistance]}get _colors(){let e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:a(o(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;let{context:t,stagedVertex:n}=this;if(!t)return this._destroyUnusedLabels();let r=t.editGeometryOperations.data,{parts:i,geometry:a,coordinateHelper:o}=r;if(!a)return this._destroyUnusedLabels();let s=i.length;for(let i=0;i<s;++i){let c=this.getRing(a,r,n,o,i),l=c.map(e=>E(e)?e:o.arrayToXYZ(A(e)));if(c.length<2||!H(c,t.view,t.elevationInfo,o.spatialReference))continue;let u=s===1&&!k(l),d=K,f=q;this.toScreenPointArray(t,l[0],d);for(let n=1;n<c.length;++n){let r=l[n-1],a=l[n],o=c[n];this.toScreenPointArray(t,a,f);let s=n===l.length-1,p=!(!e?.length||e.some(({index:e,part:t})=>t.index===i&&(e===n-1||e===n||s&&e===0)));this._addLabel(t,r,d,a,E(o)?null:o,f,u,p),[d,f]=[f,d]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){let n=this._nextLabelIndex,r=this._labelInfos;for(let i=0;i<n;++i){let{label:n}=r[i];n.textColor=e,n.backgroundColor=t}}_updateLabelMeasurement(e,t,n,r,i){return c(this._debouncedLabelUpdates,r,()=>u(async(e,t,n,r,i)=>{let{spatialReference:a,coordinateHelper:o}=e.editGeometryOperations.data,s=await(!i||j(i)?this._measurementWorker.autoDistance2DBetweenPoints(o.arrayToPoint(t),o.arrayToPoint(n)):this._measurementWorker.autoLength2D(new O({spatialReference:a,curvePaths:[[[t[0],t[1]],i]]})));if(r.destroyed)return;let c=this._messagesUnits,l=L(e.view);r.text=c!=null&&s!=null&&!Number.isNaN(s.value)?d(c,s,l):``}))(e,T(t),T(n),r,i?M(i):void 0)}_addLabel(e,t,n,r,i,a,o,s=!1){let{label:c,wasReused:l}=this._getOrCreateLabel(e);if(!this.visible||v(n,a)<3025){c.visible=!1;return}let{coordinateHelper:u}=e.editGeometryOperations.data;(!s||!l)&&this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,r,c,i)),c.visible=!0;let d=a[0]-n[0],f=a[1]-n[1];if(o?y(W,-f,d):y(W,f,-d),b(W,W),x(W,W,this._edgeDistancePixels),i&&!j(i)){let n=u.arrayToXYZ(N(t,i,.5)),r=this.toScreenPointArray(e,n);S(G,r,W)}else C(G,n,a,.5),S(G,G,W);c.position=[G[0],G[1]],c.anchor=Math.abs(W[0])>Math.abs(W[1])?W[0]>0?`left`:`right`:-W[1]<0?`top`:`bottom`}_getOrCreateLabel(e){let t=this._labelInfos.length>this._nextLabelIndex,{textColor:n,backgroundColor:r}=this._colors;if(t){let e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=n,t.backgroundColor=r,e.wasReused=!0,e}let i=new R({anchor:`center`,fontSize:8,textColor:n,backgroundColor:r});e.view.overlay?.items.add(i);let a={label:i,wasReused:!1};return this._labelInfos.push(a),this._nextLabelIndex=this._labelInfos.length,a}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=i(()=>P(`esri/core/t9n/Units`))}};e([g()],V.prototype,`context`,void 0),e([g()],V.prototype,`stagedVertex`,void 0),e([g()],V.prototype,`visible`,void 0),e([g()],V.prototype,`edgeDistance`,void 0),e([g()],V.prototype,`updating`,null),e([g()],V.prototype,`_messageUnitsTask`,void 0),e([g()],V.prototype,`_messagesUnits`,null),e([g()],V.prototype,`_edgeDistancePixels`,null),e([g()],V.prototype,`_colors`,null),V=e([_(`esri.views.interactive.SegmentLabels`)],V);function H(e,t,n,r){if(t.type===`2d`)return!0;let i=m(r)??1,a=h(r),o=e=>F(t,e,r,n,I)??0;for(let t=1;t<e.length;++t){let n=e[t-1],r=e[t];if(!E(n)||!E(r))return!1;let s=(r[0]-n[0])*i,c=(r[1]-n[1])*i,l=(o(r)-o(n))*a;if(Math.abs(l)/Math.sqrt(s*s+c*c)>U)return!1}return!0}const U=l(5),W=w(),G=w(),K=p(),q=p();export{V as SegmentLabels};
2
+ import{__decorate as e}from"tslib";import t from"../../Color.js";import{onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{createTask as i}from"../../core/asyncUtils.js";import{multiplyOpacity as a,getContrast as o}from"../../core/colorUtils.js";import{makeHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import{getOrCreateMapValue as c}from"../../core/MapUtils.js";import{deg2rad as l}from"../../core/mathUtils.js";import{debounce as u}from"../../core/promiseUtils.js";import{formatLength as d}from"../../core/quantityFormatUtils.js";import{on as f}from"../../core/reactiveUtils.js";import{createScreenPointArray as p}from"../../core/screenUtils.js";import{getMetersPerUnit as m,getMetersPerVerticalUnitForSR as h}from"../../core/units.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{squaredDistance as v,set as y,normalize as b,scale as x,add as S,lerp as C}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as w}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{clone as T}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isVec3 as E}from"../../core/libs/gl-matrix-2/types/vec3.js";import{UpdatingHandles as D}from"../../core/support/UpdatingHandles.js";import O from"../../geometry/Polyline.js";import{isClockwise as k}from"../../geometry/support/coordsUtils.js";import{getEndpoint as A,isCoordinate as j,cloneCurve as M}from"../../geometry/support/curves/curveUtils.js";import{interpolate2D as N}from"../../geometry/support/curves/interpolateCurve.js";import{fetchMessageBundle as P}from"../../intl/messages.js";import{getConvertedElevationFromVector as F,absoluteHeightElevationInfo as I}from"../../support/elevationInfoUtils.js";import{getDefaultUnitForView as L}from"../../support/getDefaultUnitForView.js";import R from"../overlay/TextOverlayItem.js";import{GeometryWorkerHandle as z}from"../support/GeometryWorkerHandle.js";const B={default:15,far:25};let V=class extends r{constructor(e){super(e),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance=`default`,this._updatingHandles=new D,this._messageUnitsTask=null,this._labelInfos=[],this._nextLabelIndex=0,this._debouncedLabelUpdates=new Map,this._measurementWorker=new z({preloadGeodetic:!0})}initialize(){this.addHandles([this._updatingHandles.add(()=>[this.context!=null&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),f(()=>this.context?.editGeometryOperations,[`vertex-add`,`vertex-remove`],()=>this._update()),f(()=>this.context?.editGeometryOperations,`vertex-update`,e=>this._update(e.vertices)),this._updatingHandles.add(()=>this._colors,e=>this._updateStyle(e)),n(()=>this._refreshMessages()),s(()=>this._messageUnitsTask?.abort())]),this._refreshMessages()}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop());this._measurementWorker.destroy(),this._updatingHandles.destroy()}get updating(){return!this._messageUnitsTask?.finished||this._updatingHandles.updating}get test(){}get _messagesUnits(){return this._messageUnitsTask?.value}get _edgeDistancePixels(){return B[this.edgeDistance]}get _colors(){let e=this.context?.view.effectiveTheme.textColor??t.fromArray([255,255,255]);return{textColor:e,backgroundColor:a(o(e,160),.6)}}_update(e){if(this.destroyed)return;this._nextLabelIndex=0;let{context:t,stagedVertex:n}=this;if(!t)return this._destroyUnusedLabels();let r=t.editGeometryOperations.data,{parts:i,geometry:a,coordinateHelper:o}=r;if(!a)return this._destroyUnusedLabels();let s=i.length;for(let i=0;i<s;++i){let c=this.getRing(a,r,n,o,i),l=c.map(e=>E(e)?e:o.arrayToXYZ(A(e)));if(c.length<2||!H(c,t.view,t.elevationInfo,o.spatialReference))continue;let u=s===1&&!k(l),d=K,f=q;this.toScreenPointArray(t,l[0],d);for(let n=1;n<c.length;++n){let r=l[n-1],a=l[n],o=c[n];this.toScreenPointArray(t,a,f);let s=n===l.length-1,p=!(!e?.length||e.some(({index:e,part:t})=>t.index===i&&(e===n-1||e===n||s&&e===0)));this._addLabel(t,r,d,a,E(o)?null:o,f,u,p),[d,f]=[f,d]}}this._destroyUnusedLabels()}_updateStyle({textColor:e,backgroundColor:t}){let n=this._nextLabelIndex,r=this._labelInfos;for(let i=0;i<n;++i){let{label:n}=r[i];n.textColor=e,n.backgroundColor=t}}_updateLabelMeasurement(e,t,n,r,i){return c(this._debouncedLabelUpdates,r,()=>u(async(e,t,n,r,i)=>{let{spatialReference:a,coordinateHelper:o}=e.editGeometryOperations.data,s=await(!i||j(i)?this._measurementWorker.autoDistance2DBetweenPoints(o.arrayToPoint(t),o.arrayToPoint(n)):this._measurementWorker.autoLength2D(new O({spatialReference:a,curvePaths:[[[t[0],t[1]],i]]})));if(r.destroyed)return;let c=this._messagesUnits,l=L(e.view);r.text=c!=null&&s!=null&&!Number.isNaN(s.value)?d(c,s,l):``}))(e,T(t),T(n),r,i?M(i):void 0)}_addLabel(e,t,n,r,i,a,o,s=!1){let{label:c,wasReused:l}=this._getOrCreateLabel(e);if(!this.visible||v(n,a)<3025){c.visible=!1;return}let{coordinateHelper:u}=e.editGeometryOperations.data;s&&l||this._updatingHandles.consumePromise(this._updateLabelMeasurement(e,t,r,c,i)),c.visible=!0;let d=a[0]-n[0],f=a[1]-n[1];if(o?y(W,-f,d):y(W,f,-d),b(W,W),x(W,W,this._edgeDistancePixels),i&&!j(i)){let n=u.arrayToXYZ(N(t,i,.5)),r=this.toScreenPointArray(e,n);S(G,r,W)}else C(G,n,a,.5),S(G,G,W);c.position=[G[0],G[1]],c.anchor=Math.abs(W[0])>Math.abs(W[1])?W[0]>0?`left`:`right`:-W[1]<0?`top`:`bottom`}_getOrCreateLabel(e){let t=this._labelInfos.length>this._nextLabelIndex,{textColor:n,backgroundColor:r}=this._colors;if(t){let e=this._labelInfos[this._nextLabelIndex++],{label:t}=e;return t.textColor=n,t.backgroundColor=r,e.wasReused=!0,e}let i=new R({anchor:`center`,fontSize:8,textColor:n,backgroundColor:r});e.view.overlay?.items.add(i);let a={label:i,wasReused:!1};return this._labelInfos.push(a),this._nextLabelIndex=this._labelInfos.length,a}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:e}){this.context?.view.overlay?.items.remove(e),e.destroy(),this._debouncedLabelUpdates.delete(e)}_refreshMessages(){this._messageUnitsTask?.abort(),this._messageUnitsTask=i(()=>P(`esri/core/t9n/Units`))}};e([g()],V.prototype,`context`,void 0),e([g()],V.prototype,`stagedVertex`,void 0),e([g()],V.prototype,`visible`,void 0),e([g()],V.prototype,`edgeDistance`,void 0),e([g()],V.prototype,`updating`,null),e([g()],V.prototype,`_messageUnitsTask`,void 0),e([g()],V.prototype,`_messagesUnits`,null),e([g()],V.prototype,`_edgeDistancePixels`,null),e([g()],V.prototype,`_colors`,null),V=e([_(`esri.views.interactive.SegmentLabels`)],V);function H(e,t,n,r){if(t.type===`2d`)return!0;let i=m(r)??1,a=h(r),o=e=>F(t,e,r,n,I)??0;for(let t=1;t<e.length;++t){let n=e[t-1],r=e[t];if(!E(n)||!E(r))return!1;let s=(r[0]-n[0])*i,c=(r[1]-n[1])*i,l=(o(r)-o(n))*a;if(Math.abs(l)/Math.sqrt(s*s+c*c)>U)return!1}return!0}const U=l(5),W=w(),G=w(),K=p(),q=p();export{V as SegmentLabels};