@arcgis/core 5.1.0-next.73 → 5.1.0-next.75

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 (373) hide show
  1. package/Viewpoint.js +1 -1
  2. package/applications/Urban/editingSessionUtils.d.ts +95 -0
  3. package/applications/Urban/editingSessionUtils.js +2 -0
  4. package/arcade/ArcadePortal.js +1 -1
  5. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  6. package/arcade/functions/aiServices.js +1 -1
  7. package/arcade/functions/featuresetbase.js +1 -1
  8. package/arcade/functions/geomasync.js +1 -1
  9. package/arcade/functions/knowledgegraph.js +1 -1
  10. package/arcade/functions/string.js +1 -1
  11. package/arcade/languageUtils.js +1 -1
  12. package/arcade/portalUtils.js +1 -1
  13. package/assets/esri/core/workers/RemoteClient.js +1 -1
  14. package/assets/esri/core/workers/chunks/{d17fcfc502f0e0fa6523.js → 003476e950bd27a2f884.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{8a664451845a47048859.js → 0539b5d015157c1d34a0.js} +1 -1
  16. package/assets/esri/core/workers/chunks/07aca5ecad659d55e795.js +2 -0
  17. package/assets/esri/core/workers/chunks/{5a4d7ba6dc1d4b41d80d.js → 07eff82916681fcff069.js} +1 -1
  18. package/assets/esri/core/workers/chunks/09630888267cde87654f.js +1 -0
  19. package/assets/esri/core/workers/chunks/{8a14e3db28c403b046cf.js → 0d2bc1be5802681666a4.js} +1 -1
  20. package/assets/esri/core/workers/chunks/0eed2b1b06355ab89013.js +1 -0
  21. package/assets/esri/core/workers/chunks/0fa207c68dfd7ddee160.js +1 -0
  22. package/assets/esri/core/workers/chunks/146424b5717d0a645ee1.js +1 -0
  23. package/assets/esri/core/workers/chunks/{cfe246adb5e6cb6f0cfc.js → 14eb2cc8e2ad6d8d03fd.js} +1 -1
  24. package/assets/esri/core/workers/chunks/1765dfeac20e34ce25b7.js +1 -0
  25. package/assets/esri/core/workers/chunks/176dd195f77b98cb0b0f.js +1 -0
  26. package/assets/esri/core/workers/chunks/18f77ee3552d92962f15.js +1 -0
  27. package/assets/esri/core/workers/chunks/1906416c84bab369bbd6.js +1 -0
  28. package/assets/esri/core/workers/chunks/1a87e9bbd85ba29b1514.js +1 -0
  29. package/assets/esri/core/workers/chunks/{b98c24229463029504e8.js → 1f6b7626f333809837ef.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b54b7cc6b23a70fed700.js → 1f8ccf96069ac3a40c3d.js} +1 -1
  31. package/assets/esri/core/workers/chunks/1ff3c15a51c4dc991806.js +1 -0
  32. package/assets/esri/core/workers/chunks/{cdf6ad970dc1893dac58.js → 24646a1176ce34039155.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2a2e97918524e0f436d7.js +1 -0
  34. package/assets/esri/core/workers/chunks/2b0b398180ed98c2c84c.js +1 -0
  35. package/assets/esri/core/workers/chunks/{03894992558d063d0d5e.js → 312036c89a6a09bb06c2.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{80ace1c7203c5059525d.js → 330b47ac0759c3c35cc5.js} +1 -1
  37. package/assets/esri/core/workers/chunks/34b6b5dd415c68f0b0d1.js +1 -0
  38. package/assets/esri/core/workers/chunks/{422824e407b550170c8c.js → 34ea3ed78041437a8fc8.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{93ceb74ac88ef460fe5f.js → 359d3acb3953e64e5a78.js} +1 -1
  40. package/assets/esri/core/workers/chunks/384c235d36f32769e32b.js +1 -0
  41. package/assets/esri/core/workers/chunks/3a183259805638c25363.js +1 -0
  42. package/assets/esri/core/workers/chunks/{0839da55707f7c4cf780.js → 3b9100c59a8050f4834e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{deaca3cd202851ecf9c2.js → 3cce9dad8ee0e4971d50.js} +1 -1
  44. package/assets/esri/core/workers/chunks/3efbb684c0409955186d.js +1 -0
  45. package/assets/esri/core/workers/chunks/40d251b6b42a41d68bd2.js +1 -0
  46. package/assets/esri/core/workers/chunks/42336e0d1ef88737b078.js +1 -0
  47. package/assets/esri/core/workers/chunks/452c01cecbbd1e370098.js +1 -0
  48. package/assets/esri/core/workers/chunks/47656ec12401e53f4bd3.js +1 -0
  49. package/assets/esri/core/workers/chunks/47b3a5213539548ff3a6.js +1 -0
  50. package/assets/esri/core/workers/chunks/{260d4571722cb1ff1366.js → 484d6c1b0fe1633515b7.js} +1 -1
  51. package/assets/esri/core/workers/chunks/4a23b27bfbcfa08fd9a7.js +1 -0
  52. package/assets/esri/core/workers/chunks/4c97cc922eece3a91b6b.js +1 -0
  53. package/assets/esri/core/workers/chunks/52b3a11c962810bc6dbe.js +1 -0
  54. package/assets/esri/core/workers/chunks/53750e85f3128993a43a.js +1 -0
  55. package/assets/esri/core/workers/chunks/{f207b3be0714cc50030a.js → 537fe2522dff1e6ce03b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{656d6963e8f837fbf28f.js → 54023458195549f66215.js} +1 -1
  57. package/assets/esri/core/workers/chunks/55fd201ca5e10c6e4761.js +1 -0
  58. package/assets/esri/core/workers/chunks/56941e8bbd2d49bf2656.js +1 -0
  59. package/assets/esri/core/workers/chunks/{faad127dc07e54e7f6d1.js → 5abe34bb0110694f7b42.js} +1 -1
  60. package/assets/esri/core/workers/chunks/5d8e944b192aad4cf986.js +1 -0
  61. package/assets/esri/core/workers/chunks/{a78bc340a794fd332667.js → 5e1b847b116d21908a54.js} +1 -1
  62. package/assets/esri/core/workers/chunks/5ed8d8b5336c81fbcda3.js +1 -0
  63. package/assets/esri/core/workers/chunks/60915a3708a34da1977e.js +1 -0
  64. package/assets/esri/core/workers/chunks/6124141ac642e4ce1454.js +1 -0
  65. package/assets/esri/core/workers/chunks/61c523dd9d8027922465.js +1 -0
  66. package/assets/esri/core/workers/chunks/65c61171e6c6be5c5c2f.js +1 -0
  67. package/assets/esri/core/workers/chunks/6a3d207308b29651f397.js +1 -0
  68. package/assets/esri/core/workers/chunks/{b6cadb8a579241adcb86.js → 6b66fc32451433129a88.js} +1 -1
  69. package/assets/esri/core/workers/chunks/6c35583707f5c339ee99.js +1 -0
  70. package/assets/esri/core/workers/chunks/6f7aaba26773fe416ac2.js +1 -0
  71. package/assets/esri/core/workers/chunks/702e8468836863abd81b.js +1 -0
  72. package/assets/esri/core/workers/chunks/7540f7df86620f067b5a.js +1 -0
  73. package/assets/esri/core/workers/chunks/{9f4b97204def91567e3c.js → 7595ceba529ed01c7590.js} +1 -1
  74. package/assets/esri/core/workers/chunks/75d5ea0da181f9e7425f.js +1312 -0
  75. package/assets/esri/core/workers/chunks/{af75e91b88e747aa76ac.js → 7601278ebced0c0c31cf.js} +1 -1
  76. package/assets/esri/core/workers/chunks/76e34f81bb4a7b0e694c.js +1 -0
  77. package/assets/esri/core/workers/chunks/{1661684357912726a72a.js → 77dd719516138afb1a2a.js} +1 -1
  78. package/assets/esri/core/workers/chunks/7b6c8be59ed87e386aa4.js +1 -0
  79. package/assets/esri/core/workers/chunks/7c820c5f6f05480d5050.js +1 -0
  80. package/assets/esri/core/workers/chunks/{ce2aa75e084ee56f5e29.js → 7f55eef696e9ed717bfc.js} +1 -1
  81. package/assets/esri/core/workers/chunks/80f4f686ce403cb2693f.js +1 -0
  82. package/assets/esri/core/workers/chunks/852f4cd514008fee5a55.js +1 -0
  83. package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +1 -0
  84. package/assets/esri/core/workers/chunks/{50d5d6654ada9f28345d.js → 85e65ced3312bf9cf162.js} +1 -1
  85. package/assets/esri/core/workers/chunks/8a3bff0f58483c1665f9.js +1 -0
  86. package/assets/esri/core/workers/chunks/8b046e28f879079caada.js +1 -0
  87. package/assets/esri/core/workers/chunks/8d738e9acc2f222235ea.js +1 -0
  88. package/assets/esri/core/workers/chunks/{b9848bdbaf3d9ac93d54.js → 8f4cd30ce23e41c1a42c.js} +1 -1
  89. package/assets/esri/core/workers/chunks/9103eb0b9078019d3a26.js +1 -0
  90. package/assets/esri/core/workers/chunks/915e2711d3a2cfa402b2.js +1 -0
  91. package/assets/esri/core/workers/chunks/91f9e0e3662d4bf9f163.js +1 -0
  92. package/assets/esri/core/workers/chunks/983f6c8727fd9484718e.js +1 -0
  93. package/assets/esri/core/workers/chunks/99c161fecae710b53b40.js +1 -0
  94. package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +1 -0
  95. package/assets/esri/core/workers/chunks/9a5ef33d99a8f89956ff.js +1 -0
  96. package/assets/esri/core/workers/chunks/9d10db72e342fe63c981.js +1 -0
  97. package/assets/esri/core/workers/chunks/{bef27a25fbc4a6e19ec0.js → 9d6491f996eeb0c646ed.js} +1 -1
  98. package/assets/esri/core/workers/chunks/a015c2f54eb91e43a1f4.js +1 -0
  99. package/assets/esri/core/workers/chunks/a242ec19a7508de436da.js +1 -0
  100. package/assets/esri/core/workers/chunks/a320998f18922a35899f.js +1 -0
  101. package/assets/esri/core/workers/chunks/a7f9f478bd1493fc3c76.js +1 -0
  102. package/assets/esri/core/workers/chunks/aac6a57edd7494125204.js +1 -0
  103. package/assets/esri/core/workers/chunks/b73c146d3e550eaf07eb.js +1 -0
  104. package/assets/esri/core/workers/chunks/b7af0e6b9aadbcaf6a0b.js +1 -0
  105. package/assets/esri/core/workers/chunks/b803e7b0d489bb628d72.js +1 -0
  106. package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +1 -0
  107. package/assets/esri/core/workers/chunks/baeb96aef03d4c566af7.js +1 -0
  108. package/assets/esri/core/workers/chunks/bc75ab48f4c7609ef09d.js +1 -0
  109. package/assets/esri/core/workers/chunks/bc78937986854e500b8e.js +1 -0
  110. package/assets/esri/core/workers/chunks/{6ef3b8d67b498d655a99.js → bcb021a167580bb1619f.js} +1 -1
  111. package/assets/esri/core/workers/chunks/bd10d21545bca9a49de0.js +1 -0
  112. package/assets/esri/core/workers/chunks/bec3ee5ea945e1e07a35.js +1 -0
  113. package/assets/esri/core/workers/chunks/{5c663d5f98bdfa29151b.js → bf8f603848bad4a7deb4.js} +1 -1
  114. package/assets/esri/core/workers/chunks/bfe575da727ce7c8d331.js +2 -0
  115. package/assets/esri/core/workers/chunks/c31ee5617c61a933cb0e.js +1 -0
  116. package/assets/esri/core/workers/chunks/cb45e5d4a4ef82cda583.js +1 -0
  117. package/assets/esri/core/workers/chunks/ce7ef7c4ca14d66d96f6.js +1 -0
  118. package/assets/esri/core/workers/chunks/{f5c57ff48ca505ed701d.js → cf14b3a44705dacefac4.js} +1 -1
  119. package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +1 -0
  120. package/assets/esri/core/workers/chunks/{06df187a116709f69952.js → d35c475f004367e333eb.js} +1 -1
  121. package/assets/esri/core/workers/chunks/d3b086eb9aa8c7d09048.js +1 -0
  122. package/assets/esri/core/workers/chunks/d55cef8199b8246fea3f.js +1 -0
  123. package/assets/esri/core/workers/chunks/d82da31dc702b8fd6a07.js +1 -0
  124. package/assets/esri/core/workers/chunks/d8decaee2c780e1b5e35.js +1 -0
  125. package/assets/esri/core/workers/chunks/{41809c16544ec25120fa.js → d95ffd990b3a7df69e1e.js} +1 -1
  126. package/assets/esri/core/workers/chunks/dc54d4a9fe1691862356.js +1 -0
  127. package/assets/esri/core/workers/chunks/dd4f431511edd975a53b.js +1 -0
  128. package/assets/esri/core/workers/chunks/dda2cb5c073d1e65f14f.js +1 -0
  129. package/assets/esri/core/workers/chunks/e18badd11f360cc2912b.js +1 -0
  130. package/assets/esri/core/workers/chunks/{e25a684eb9f025bdcc01.js → e262c4864dc06c43b380.js} +1 -1
  131. package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +1 -0
  132. package/assets/esri/core/workers/chunks/{99101789035f1787c630.js → e785f76c1a75cb1d1e1f.js} +1 -1
  133. package/assets/esri/core/workers/chunks/e9c5c295b6bf10e942a4.js +1 -0
  134. package/assets/esri/core/workers/chunks/ea59b81299acaf0d85ee.js +1 -0
  135. package/assets/esri/core/workers/chunks/{873c1b705ac3d4e6c384.js → ea97619a4470f1540b99.js} +1 -1
  136. package/assets/esri/core/workers/chunks/eaab5ac049622986e3bc.js +1 -0
  137. package/assets/esri/core/workers/chunks/edee616b6f1b5be8fd39.js +1 -0
  138. package/assets/esri/core/workers/chunks/ef0085aa743b33cb549f.js +1 -0
  139. package/assets/esri/core/workers/chunks/f0250cecb243b32cdba7.js +1 -0
  140. package/assets/esri/core/workers/chunks/f518835b2dc89a48cfb1.js +1 -0
  141. package/assets/esri/core/workers/chunks/f590b60fca607d66001a.js +1 -0
  142. package/assets/esri/core/workers/chunks/{f6d047358d14328f3622.js → f60292d97bcdbf19165b.js} +1 -1
  143. package/assets/esri/core/workers/chunks/f6c8e93ca2987e83f925.js +1 -0
  144. package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +1 -0
  145. package/assets/esri/themes/base/widgets/_Sketch.scss +32 -0
  146. package/assets/esri/themes/dark/main.css +1 -1
  147. package/assets/esri/themes/light/main.css +1 -1
  148. package/assets/esri/themes/light/view.css +1 -1
  149. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  150. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  151. package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
  152. package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
  153. package/chunks/MultiPathImpl.js +1 -1
  154. package/chunks/Point2D.js +1 -1
  155. package/chunks/SpatialReference.js +1 -1
  156. package/chunks/aiServices.js +1 -1
  157. package/chunks/geometryEngineBase.js +1 -1
  158. package/chunks/languageUtils.js +1 -1
  159. package/config.js +1 -1
  160. package/core/has.js +1 -1
  161. package/core/workers/registry.js +1 -1
  162. package/form/elements/AttachmentElement.d.ts +15 -16
  163. package/form/elements/FieldElement.js +1 -1
  164. package/form/elements/GroupElement.d.ts +3 -2
  165. package/form/elements/inputs/attachments/AttachmentInput.d.ts +7 -9
  166. package/form/elements/inputs/attachments/AudioInput.d.ts +6 -8
  167. package/form/elements/inputs/attachments/DocumentInput.d.ts +5 -7
  168. package/form/elements/inputs/attachments/ImageInput.d.ts +6 -8
  169. package/form/elements/inputs/attachments/Input.d.ts +2 -6
  170. package/form/elements/inputs/attachments/SignatureInput.d.ts +5 -7
  171. package/form/elements/inputs/attachments/VideoInput.d.ts +6 -8
  172. package/form/elements/inputs/attachments/types.d.ts +3 -3
  173. package/geometry/FlatGeometry.js +1 -1
  174. package/geometry/geometryEngine.js +1 -1
  175. package/geometry/geometryEngineJSON.js +1 -1
  176. package/geometry/operators/projectOperator.d.ts +5 -4
  177. package/geometry/operators/projectOperator.js +1 -1
  178. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  179. package/geometry/support/normalizeUtils.js +1 -1
  180. package/geometry/support/normalizeUtilsCommon.js +1 -1
  181. package/graphic/ImageryGraphicOrigin.js +1 -1
  182. package/graphic/ImageryTileGraphicOrigin.js +1 -1
  183. package/graphic/WCSGraphicOrigin.js +1 -1
  184. package/identity/IdentityManagerBase.js +1 -1
  185. package/kernel.js +1 -1
  186. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  187. package/layers/IntegratedMeshLayer.js +1 -1
  188. package/layers/mixins/ArcGISImageService.js +1 -1
  189. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  190. package/layers/support/SymbolLayerDrawing.d.ts +18 -4
  191. package/package.json +4 -4
  192. package/popup/Features.d.ts +9 -9
  193. package/popup/Features.js +1 -1
  194. package/popup/actionUtils.js +1 -1
  195. package/popup/actions.js +1 -1
  196. package/portal/Portal.js +1 -1
  197. package/portal/PortalQueryParams.js +1 -1
  198. package/rest/print.js +1 -1
  199. package/support/revision.js +1 -1
  200. package/symbols/cim/CIMSymbolHelper.js +1 -1
  201. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  202. package/symbols/support/previewCIMSymbol.js +1 -1
  203. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  204. package/views/2d/engine/webgl/TextureManager.js +1 -1
  205. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  206. package/views/2d/layers/MediaLayerView2D.js +1 -1
  207. package/views/2d/layers/TileLayerView2D.js +1 -1
  208. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  209. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  210. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  211. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  212. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  213. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  214. package/views/3d/camera/intersectionUtils.js +1 -1
  215. package/views/3d/input/SceneInputManager.js +1 -1
  216. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  217. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  218. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  219. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  220. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  221. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  222. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  225. package/views/3d/state/GoToOperation.js +1 -1
  226. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  227. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  228. package/views/3d/support/cameraScaleUtils.js +2 -0
  229. package/views/3d/support/cameraUtils.js +1 -1
  230. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  231. package/views/3d/support/renderInfoUtils/line.js +1 -1
  232. package/views/3d/support/viewpointUtils.js +1 -1
  233. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  234. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +13 -12
  235. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  236. package/views/3d/webgl.js +1 -1
  237. package/views/SceneView.d.ts +1 -0
  238. package/views/VideoView.js +1 -1
  239. package/views/draw/DrawGraphicTool.js +1 -1
  240. package/views/draw/DrawTool.js +1 -1
  241. package/views/draw/support/Box.js +1 -1
  242. package/views/draw/support/Reshape.js +1 -1
  243. package/views/draw/support/editingSessionUtils.js +2 -0
  244. package/views/draw/support/managers/MeasurementManager.js +1 -1
  245. package/views/interactive/SegmentLabels.js +1 -1
  246. package/views/interactive/sketch/SketchTooltipOptions.d.ts +9 -1
  247. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  248. package/views/support/GeometryWorker.js +2 -0
  249. package/views/support/GeometryWorkerHandle.js +2 -0
  250. package/views/support/Scheduler.js +1 -1
  251. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  252. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  253. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  254. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  255. package/widgets/Editor/EditorViewModel.js +1 -1
  256. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  257. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  258. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  259. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  260. package/widgets/Editor/support/SketchController.js +1 -1
  261. package/widgets/Editor/workflowUtils.js +1 -1
  262. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -3
  263. package/widgets/FeatureTable/Grid/GridViewModel.d.ts +2 -11
  264. package/widgets/FeatureTable/support/types.d.ts +2 -1
  265. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.d.ts +28 -0
  266. package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
  267. package/widgets/OrientedImageryViewer.d.ts +27 -0
  268. package/widgets/Sketch/SketchViewModel.d.ts +10 -2
  269. package/widgets/Sketch/SketchViewModel.js +1 -1
  270. package/widgets/Sketch/support/ResponsiveToolbar/MeasuredContentGroup.js +1 -1
  271. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  272. package/widgets/Sketch.js +1 -1
  273. package/assets/esri/core/workers/chunks/00bae4b7e179336e0362.js +0 -1
  274. package/assets/esri/core/workers/chunks/027c3ea756db68e51f0a.js +0 -1
  275. package/assets/esri/core/workers/chunks/041c372e98a6fba90b36.js +0 -1
  276. package/assets/esri/core/workers/chunks/0783890816bac45277b9.js +0 -1
  277. package/assets/esri/core/workers/chunks/07aac6245a0d1adbb2d4.js +0 -1
  278. package/assets/esri/core/workers/chunks/0c00e5e4bd18467bcecd.js +0 -1
  279. package/assets/esri/core/workers/chunks/0dad0bca8d58b2c63d22.js +0 -1
  280. package/assets/esri/core/workers/chunks/0ef93722524620023f69.js +0 -1
  281. package/assets/esri/core/workers/chunks/1286f41f245ef22b3a26.js +0 -1
  282. package/assets/esri/core/workers/chunks/12e575a6d2b008b8fc2b.js +0 -1
  283. package/assets/esri/core/workers/chunks/161d60fdac2013c15543.js +0 -1
  284. package/assets/esri/core/workers/chunks/168de44a789d1cecc1f8.js +0 -1
  285. package/assets/esri/core/workers/chunks/1d9d7915cf7449e5d468.js +0 -1
  286. package/assets/esri/core/workers/chunks/235cb82952a18ff8d206.js +0 -1
  287. package/assets/esri/core/workers/chunks/266ba61b72a278d93a26.js +0 -1
  288. package/assets/esri/core/workers/chunks/27b80c386cebadcaca3c.js +0 -1
  289. package/assets/esri/core/workers/chunks/29d3890a5a43d934067a.js +0 -1
  290. package/assets/esri/core/workers/chunks/29e76256e3e867e80520.js +0 -1
  291. package/assets/esri/core/workers/chunks/2abf124e2956e4f76688.js +0 -1
  292. package/assets/esri/core/workers/chunks/2f17438d215bea3ce70f.js +0 -1
  293. package/assets/esri/core/workers/chunks/30f04dc001eaf838d64c.js +0 -1
  294. package/assets/esri/core/workers/chunks/356cb86606b8c674f947.js +0 -1
  295. package/assets/esri/core/workers/chunks/398e0dd2bc7e1ab84831.js +0 -1
  296. package/assets/esri/core/workers/chunks/3b1052aa30af3f6186cc.js +0 -1
  297. package/assets/esri/core/workers/chunks/3e87e3ad857d72f6ecbb.js +0 -1
  298. package/assets/esri/core/workers/chunks/42e483fde18f12da32a6.js +0 -1
  299. package/assets/esri/core/workers/chunks/43678e08a3d9d51c2a6d.js +0 -1
  300. package/assets/esri/core/workers/chunks/43ab44d37bc0ea97ef98.js +0 -1
  301. package/assets/esri/core/workers/chunks/47f2113357b2aa4f4f37.js +0 -1
  302. package/assets/esri/core/workers/chunks/488ed9584b527ec47be3.js +0 -1
  303. package/assets/esri/core/workers/chunks/4ad32580e0c0699fde1f.js +0 -1
  304. package/assets/esri/core/workers/chunks/54ed37ec9682ea739deb.js +0 -1
  305. package/assets/esri/core/workers/chunks/55369c5bd65bcaf78da1.js +0 -1
  306. package/assets/esri/core/workers/chunks/56fd3da911c2c4511e5d.js +0 -1
  307. package/assets/esri/core/workers/chunks/59592bb25f226865e88a.js +0 -1
  308. package/assets/esri/core/workers/chunks/5a83ea967ecde01d5622.js +0 -1
  309. package/assets/esri/core/workers/chunks/5b278b9980752ef495a2.js +0 -1
  310. package/assets/esri/core/workers/chunks/5d55b4449bcb24cd72b6.js +0 -1
  311. package/assets/esri/core/workers/chunks/5d8fe41a3c06ddb4094b.js +0 -1
  312. package/assets/esri/core/workers/chunks/5e59ff96aecdf2adcb3b.js +0 -1
  313. package/assets/esri/core/workers/chunks/608d707fd9d9f9088473.js +0 -1
  314. package/assets/esri/core/workers/chunks/6a21c9a4aeebe806ea39.js +0 -1
  315. package/assets/esri/core/workers/chunks/6c7ff968bd4fc816442d.js +0 -1
  316. package/assets/esri/core/workers/chunks/6d11ec355e5474b2968b.js +0 -1
  317. package/assets/esri/core/workers/chunks/6ea8b0d68881d16a2432.js +0 -1
  318. package/assets/esri/core/workers/chunks/7027d93dc5a4595d70c6.js +0 -1
  319. package/assets/esri/core/workers/chunks/70b35b2446558d5280e3.js +0 -1
  320. package/assets/esri/core/workers/chunks/7349cb45a93e6916f115.js +0 -1
  321. package/assets/esri/core/workers/chunks/74be994d789c57031631.js +0 -1
  322. package/assets/esri/core/workers/chunks/76edaeaf8fe344bb77a8.js +0 -1
  323. package/assets/esri/core/workers/chunks/76fe5b821d6b54db5721.js +0 -1
  324. package/assets/esri/core/workers/chunks/770880ad43f252962017.js +0 -1
  325. package/assets/esri/core/workers/chunks/7951d93f5f15aa76f49c.js +0 -1
  326. package/assets/esri/core/workers/chunks/7a56c836c89a8b978800.js +0 -1
  327. package/assets/esri/core/workers/chunks/81750c5177d8d52a3e05.js +0 -1
  328. package/assets/esri/core/workers/chunks/81d30c9062ad0120a863.js +0 -1
  329. package/assets/esri/core/workers/chunks/84772b023d04e415f17f.js +0 -1
  330. package/assets/esri/core/workers/chunks/88c5f7c712c6b89b5109.js +0 -1
  331. package/assets/esri/core/workers/chunks/88e469b82d2594f23649.js +0 -1
  332. package/assets/esri/core/workers/chunks/8a8242e7cc7e6a9e7876.js +0 -1
  333. package/assets/esri/core/workers/chunks/9444ed8ea117861ae89b.js +0 -1
  334. package/assets/esri/core/workers/chunks/9a38fd68b02b617c45d3.js +0 -1
  335. package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +0 -2
  336. package/assets/esri/core/workers/chunks/a11f05ddd8314b648f76.js +0 -1
  337. package/assets/esri/core/workers/chunks/a37c28e3c4a2be9fd1d5.js +0 -1
  338. package/assets/esri/core/workers/chunks/a8d7f59927bdad564141.js +0 -1
  339. package/assets/esri/core/workers/chunks/a94bd20551c1179c7ec5.js +0 -1
  340. package/assets/esri/core/workers/chunks/abe22ae8ee0dcc9efbb7.js +0 -1
  341. package/assets/esri/core/workers/chunks/af5db0372d526e592fcc.js +0 -1
  342. package/assets/esri/core/workers/chunks/b702279c48f3009f6dd8.js +0 -1
  343. package/assets/esri/core/workers/chunks/bc53ce9a643f82d516c2.js +0 -1
  344. package/assets/esri/core/workers/chunks/bc887bd62579dba81e2b.js +0 -1
  345. package/assets/esri/core/workers/chunks/be1d6a571f76933dfbb0.js +0 -1
  346. package/assets/esri/core/workers/chunks/bfcdc5c315131aae34d8.js +0 -1
  347. package/assets/esri/core/workers/chunks/c0f624a2ca0d07ef8f8c.js +0 -1
  348. package/assets/esri/core/workers/chunks/c327fe276238af60fda4.js +0 -1
  349. package/assets/esri/core/workers/chunks/c3381b9a36299210ee47.js +0 -1
  350. package/assets/esri/core/workers/chunks/cb5e4b9b4a59c2622eb5.js +0 -1
  351. package/assets/esri/core/workers/chunks/d201a5dff18a5bb467ab.js +0 -1
  352. package/assets/esri/core/workers/chunks/d21fdd67477800101f3b.js +0 -1
  353. package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +0 -2
  354. package/assets/esri/core/workers/chunks/d8d7331600d93bbca2b4.js +0 -1
  355. package/assets/esri/core/workers/chunks/db588bf3256e95c977b7.js +0 -1
  356. package/assets/esri/core/workers/chunks/dfdd474fddcd1d6091ce.js +0 -1
  357. package/assets/esri/core/workers/chunks/e1bc9ad767e08dc18bbc.js +0 -1
  358. package/assets/esri/core/workers/chunks/e235ea4293d5d463acfb.js +0 -1
  359. package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +0 -1312
  360. package/assets/esri/core/workers/chunks/e43486113aaf72ac4dc1.js +0 -1
  361. package/assets/esri/core/workers/chunks/ea4c3393c5757e309a71.js +0 -1
  362. package/assets/esri/core/workers/chunks/ed216ddeb7f59f510bd0.js +0 -1
  363. package/assets/esri/core/workers/chunks/ef8886dff54063928bcb.js +0 -1
  364. package/assets/esri/core/workers/chunks/f43a63094190d2074cd0.js +0 -1
  365. package/assets/esri/core/workers/chunks/f5223ffb3be548c9b0a1.js +0 -1
  366. package/assets/esri/core/workers/chunks/fa160a2a5dc9f5a7c34b.js +0 -1
  367. package/geometry/support/triangulationUtilsDeprecated.js +0 -2
  368. package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +0 -2
  369. package/views/3d/support/renderInfoUtils/polygonDeprecated.js +0 -2
  370. package/views/support/MeasurementWorker.js +0 -2
  371. package/views/support/MeasurementWorkerHandle.js +0 -2
  372. /package/assets/esri/core/workers/chunks/{9eb4ae556950e1d0124d.js.LICENSE.txt → 07aca5ecad659d55e795.js.LICENSE.txt} +0 -0
  373. /package/assets/esri/core/workers/chunks/{d65b1234867f7d773d50.js.LICENSE.txt → bfe575da727ce7c8d331.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as o}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{drainHandles as r,destroyHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import p from"../../core/Logger.js";import{destroyMaybe as l,abortMaybe as h}from"../../core/maybe.js";import{createAbortError as c,whenOrAbort as d,ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{watch as g,syncAndInitial as m,on as y,when as v,whenOnce as f}from"../../core/reactiveUtils.js";import{property as _,subclass as b}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as G}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as T,isLoaded as O,load as S,project as E}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as C}from"../../geometry/support/coordsUtils.js";import{equals as M}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as k}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as H}from"../../support/elevationInfoUtils.js";import D from"../../symbols/FillSymbol3DLayer.js";import I from"../../symbols/MeshSymbol3D.js";import P from"../../symbols/SimpleFillSymbol.js";import U from"../../symbols/SimpleLineSymbol.js";import j from"../../symbols/SimpleMarkerSymbol.js";import R from"../../symbols/TextSymbol.js";import{symbolTypes as x}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as L}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as F}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as V}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as K}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as W}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Z}from"../../views/input/InputManager.js";import{sketchKeys as q}from"../../views/interactive/keybindings.js";import N from"../../views/interactive/sketch/SketchLabelOptions.js";import z from"../../views/interactive/sketch/SketchOptions.js";import B from"../../views/interactive/sketch/SketchTooltipOptions.js";import $ from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as Y}from"../../views/interactive/snapping/SnappingManager.js";import J from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as Q}from"../../views/interactive/snapping/snappingUtils.js";import{defaultHighlightName as X}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ee}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as te}from"../../views/support/screenUtils.js";import oe from"./adapters/layer/GraphicsLayerAdapter.js";import ie from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,DrawToolOperationHandle as se,UpdateOperationHandle as re}from"./support/OperationHandle.js";import{PluginManager as ne}from"./support/PluginManager.js";import{getLegacyTool as pe,isCompletelyDegenerate as le,graphicsHaveTooFewVerticesForBox as he,getModeFromCreateOptions as ce,getDrawToolGeometryTypeFromCreateTool as de}from"./support/sketchUtils.js";const ue={defaultZ:0},ge={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:X},tool:"transform"},me=Symbol(),ye=Symbol();let ve=class extends s{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ne({sketchViewModel:this}),this._operationHandle=null,this._updatingHandles=new w,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new P({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new U({color:[130,130,130,1],width:2}),this.meshSymbol=new I({symbolLayers:new i([new D])}),this.updateGraphics=new i,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new z,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ye),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),g(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},m)].filter(o);this.addHandles(t,ye)},this._originalPopupEnabled=null,this.defaultCreateOptions=ue,this.defaultUpdateOptions=ge,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new J,this.textSymbol=new R({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([y(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),g(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),m),g(()=>this.view,e=>{this._defaultSnappingManager=l(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new Y({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},m),g(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),Q(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=l(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new oe(e);case"map-notes":return new ie(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(o).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...ue,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...ge,...e,reshapeOptions:{...ge.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...ge.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=l(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new Y({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(v(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},m),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(o)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=h(this._moduleLoaderAbortController),this._viewReadyAbortController=h(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),c();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");W(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const s=pe(e),r=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:s??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(u(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.consumePromise(u(this.update([o])))}};a.on("complete",r),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),c();null!=i.activeTool&&(i.activeTool=null);const s=Array.isArray(e)?e:[e];if(null==e||!s?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(s.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const r=await this._updatingHandles.addPromise(this._setupUpdateOperation(s,t));this.destroyed||null==r||Ce(r)||(W(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(r,t),this.emit("update",{graphics:s,state:"start",aborted:!1,tool:r.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||M(o.geometry.spatialReference,t.spatialReference)||(T(o.geometry.spatialReference,t.spatialReference)||O()||await S(),o.geometry=E(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ee(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{k(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?G(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Z.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(te(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,s=pe(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,s??"polyline");if(e)return this._setupDrawToolOperationHandle(e,s??"point")}if(!s)return null;const r=await this._setupDrawGraphicTool(s,o,i);return null==r?null:(o.tools.add(r),o.activeTool=r,this._setupCreateOperationHandle(r,s))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:s,geometryToPlace:r,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=ce(p,e),c=de(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,g={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:r,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:s,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(g):this._makeDrawGraphicTool3D(g)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return Ce(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:be(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return Ce(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,s=e.centered,n=[o.on("key-down",t=>{if(t.key===q.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===q.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==q.vertexAdd||t.repeat)t.key===q.undo?(t.stopPropagation(),p.undo()):t.key===q.redo?(t.stopPropagation(),p.redo()):t.key!==q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===q.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Z.WIDGET),o.on("key-up",t=>{t.key===q.pan?e.enabled=!0:t.key!==q.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===q.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Z.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?p&&p.cancel():p&&p.complete()}),g(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{r(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_setupDrawToolOperationHandle(e,t){const i=this.view;if(!i)return this._logMissingView(),null;let a=null;const s=[i.on("key-down",t=>{t.key===q.pan&&(t.stopPropagation(),t.repeat||(e.editable=!1))},Z.WIDGET),i.on("key-up",t=>{t.key===q.pan&&(e.editable=!0)},Z.WIDGET),e.on("before-vertex-add",t=>{const o=e.mostUpstreamPlugin?.configuration;if(o&&"legacyCreateTool"in o&&("point"===o?.legacyCreateTool||"text"===o.legacyCreateTool)){const e=t.detail.originalEvent;return void(e&&"key"in e&&e.key===q.vertexAdd&&t.preventDefault())}}),e.on("before-complete",t=>{const o=e.getGeometryIfCompleted();(!o||le(o))&&t.preventDefault()}),e.on(["vertex-add","vertex-remove"],i=>{switch(this.createGraphic&&(this.createGraphic.geometry=e.getGeometryIfCompleted()),a=null==a&&"vertex-remove"!==i.type?"start":"active",i.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:a,tool:this.activeTool,toolEventInfo:i,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(o),tool:t});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(o),tool:t})}}),e.on("cursor-update",t=>{this.createGraphic&&(this.createGraphic.geometry=e.unprocessedGeometry),(t.vertices[0]?.vertexIndex>0||t.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("complete",({geometry:e})=>{const t=this.createGraphic;t&&e&&(t.geometry=e),n.complete()})],n=new se({activeComponent:e,type:"create",onEnd:()=>{r(s),i.tools.remove(e)},undo:()=>e.undo(),redo:()=>e.redo(),canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return s.push(e.on("cancel",()=>n.cancel())),n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??ge.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return he(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const s=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ce(s))return s;const{ManipulatedObject3DGraphic:n,MoveTool3D:p}=s.module,l=new Map,h=()=>{l.forEach(e=>e.destroy()),l.clear()};for(const r of e){const e=new n({view:o,graphic:r}),t=F(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${L(t)}).`),null;l.set(r,e)}const c=new p({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),c.objects.addMany(Array.from(l.values())),a||this.updateGraphics.addMany(e);const d=[],u=new re({activeComponent:c,tool:i,type:"update",onEnd:()=>{r(d),Ee(o,c),h()},undo:()=>{Oe(this.view,c),we(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Ge(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new n({view:o,graphic:e});l.set(e,t),c.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=l.get(e);o&&(c.objects.remove(o),o.destroy(),l.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!Ce(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Z.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===K(e[0])){const a=e[0],s=a.geometry;if(null!=s&&("point"===s.type||"mesh"===s.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=s&&("polygon"===s.type||"polyline"===s.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:s,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ce(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:a,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],g=new re({activeComponent:d,tool:i,type:"update",onEnd:()=>{r(u),Ee(o,d),c.destroy()},undo:()=>{Oe(this.view,d),we(g,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Ge(g,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Ce(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},Z.WIDGET)),g}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ce(h))return h;const{ManipulatedObject3DGraphic:c,ExtentTransformTool:d}=h.module,u=this.view?.inputManager?.isModifierKeyDown(q.constraint),g=new c({view:o,graphic:e}),m=new d({object:g,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const y=[],v=new re({activeComponent:m,tool:a,type:"update",onEnd:()=>{r(y),Ee(o,m),g.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Ce(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!Ce(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return y.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Z.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Z.WIDGET),o.on("key-down",e=>{e.key!==q.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},Z.WIDGET),o.on("key-up",e=>{e.key===q.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},Z.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(Ce(a))return a;const s=new re({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),r(l),r(p),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();we(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();Ge(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==q.constraint||e.repeat||(n=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Z.WIDGET),o.on("key-up",e=>{e.key===q.constraint&&n&&(n=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Z.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",s=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(Ce(s))return s;const{ManipulatedObject3DGraphic:n,ReshapeTool3D:p}=s.module,l=new n({view:o,graphic:e}),h=V(l);if(0!==h)return l.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${L(h)}).`),null;const c=t.reshapeOptions,d=new p({view:o,object:l,enableZVertex:t.enableZ&&"move"===c?.vertexOperation,enableZShape:t.enableZ&&"move"===c?.shapeOperation,enableMoveObject:"move"===c?.shapeOperation||"move-xy"===c?.shapeOperation,enableMidpoints:"split"===c?.edgeOperation,enableEdgeOffset:"offset"===c?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(l.graphic);const u=[],g=new re({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),Ee(o,d),l.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));Ce(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));Ce(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),Z.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},Z.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(Ce(a))return a;const s=new re({activeComponent:a,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{we(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{Ge(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(Ce(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?s.complete():he(o)?s.toggleTool():s.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===s.tool&&"point"===t.type||"transform"===s.tool&&"extent"===t.type))return;let a=null;const n={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===s.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],n,i)):"reshape"===s.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],n,i))),Ce(a)||(s.activeComponent?.destroy(),s.activeComponent=a,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,n)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,o),Z.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===q.constraint&&!e.repeat&&s){const e=s.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Z.WIDGET),i.on("key-up",e=>{if(e.key===q.constraint&&s){const e=s.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Z.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,s=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Ce(s)?s:new s.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:s,preserveAspectRatio:r}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(Ce(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(q.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:s?.name,highlightsEnabled:!!s?.enabled,preserveAspectRatio:!!r!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(g(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},m)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,s="split"===a?.edgeOperation,r="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return Ce(p)?p:new p.module.default({enableMidpoints:s,enableMovement:r,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>C(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>C(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Se(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Se(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Se(t.graphics))),o.on("scale-start",t=>e.addToHistory(Se(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Se([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Se([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Se([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Se([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=te(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===q.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===q.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===q.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&q.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=l(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(me)}_displayCursor(e){this.removeHandles(me),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),me)}_logError(e,t,o){p.getLogger(this).error(new a(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,o,i){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,s=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const r=await this.pluginManager.makeRenderer({customSymbol:o.graphicSymbol,useTextSymbol:"text"===i}),p=new s.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??H("3d"===a.type),hasZ:!!o.hasZ,sketchOptions:this.sketchOptions,renderer:r,defaultZ:o.defaultZ??0,directionOptions:o.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==i&&"circle"!==i});p.addHandles(n(r));const l=new t({...o.graphicProperties,attributes:{...o.graphicProperties?.attributes},symbol:o.graphicSymbol??this._getGraphicSymbolFromTool(i)});return o.graphicSymbol||p.addHandles(g(()=>this._getGraphicSymbolFromTool(i),e=>l.symbol=e)),this._set("createGraphic",l),a.addAndActivateTool(p),p.begin(e),p}get test(){}wait(){return f(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(h(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await d(f(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",_e("view"))}_logMissingLayer(){this._logError(fe,_e("layer"))}};e([_()],ve.prototype,"_defaultSnappingManager",void 0),e([_()],ve.prototype,"_layerAdapter",null),e([_()],ve.prototype,"_pluginManager",void 0),e([_()],ve.prototype,"_operationHandle",void 0),e([_({readOnly:!0})],ve.prototype,"_updatingHandles",void 0),e([_({readOnly:!0})],ve.prototype,"activeTool",null),e([_({readOnly:!0})],ve.prototype,"activeCreateToolDrawMode",null),e([_()],ve.prototype,"activeTooltip",null),e([_({types:x})],ve.prototype,"activeFillSymbol",void 0),e([_()],ve.prototype,"activeLineSymbol",void 0),e([_()],ve.prototype,"activeVertexSymbol",void 0),e([_()],ve.prototype,"allowDeleteKey",void 0),e([_({readOnly:!0})],ve.prototype,"createGraphic",null),e([_()],ve.prototype,"defaultCreateOptions",null),e([_()],ve.prototype,"defaultUpdateOptions",null),e([_()],ve.prototype,"activeUpdateOptions",void 0),e([_({type:N,nonNullable:!0})],ve.prototype,"labelOptions",null),e([_()],ve.prototype,"layer",void 0),e([_({types:x})],ve.prototype,"pointSymbol",void 0),e([_({types:x})],ve.prototype,"polygonSymbol",void 0),e([_({types:x})],ve.prototype,"polylineSymbol",void 0),e([_()],ve.prototype,"meshSymbol",void 0),e([_({type:R})],ve.prototype,"textSymbol",null),e([_({type:J,nonNullable:!0})],ve.prototype,"snappingOptions",null),e([_()],ve.prototype,"snappingManager",null),e([_({readOnly:!0})],ve.prototype,"state",null),e([_({type:B,nonNullable:!0})],ve.prototype,"tooltipOptions",null),e([_({readOnly:!0})],ve.prototype,"updateGraphics",void 0),e([_()],ve.prototype,"updateOnGraphicClick",void 0),e([_()],ve.prototype,"updating",null),e([_()],ve.prototype,"creationMode",void 0),e([_({type:$,nonNullable:!0})],ve.prototype,"valueOptions",null),e([_({types:x})],ve.prototype,"vertexSymbol",void 0),e([_({value:null})],ve.prototype,"view",null),e([_({constructOnly:!0,type:z})],ve.prototype,"sketchOptions",void 0),e([_()],ve.prototype,"useLegacyCreateTools",void 0),e([_()],ve.prototype,"isUsingLegacyCreateTools",null),e([_()],ve.prototype,"pluginManager",null),e([_()],ve.prototype,"drawTool",null),e([_()],ve.prototype,"rootPlugins",null),e([_()],ve.prototype,"effectiveAvailablePlugins",null),e([_()],ve.prototype,"firstPluginWithSwappableLeaf",null),e([_()],ve.prototype,"multiplePluginsActive",null),ve=e([b("esri.widgets.Sketch.SketchViewModel")],ve);const fe="sketch:missing-property",_e=e=>`Property '${e}' is missing on SketchViewModel.`;function be(e){return"polygon"===e||"rectangle"===e||"circle"===e}function we(e,t){Te("undo",e.history.undo,e.history.redo,t)}function Ge(e,t){Te("redo",e.history.redo,e.history.undo,t)}function Te(e,t,o,i){const a=t.pop();if(!a)return;const s=a.updates,r=[];i.forEach((t,o)=>{const i=s[o];null!=i&&("geometry"in i&&null!=i.geometry&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(r.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(r.push(i),i[e](t)))}),o.push({updates:r})}function Oe(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Se(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Ee(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Ce(e){return"requireError"in e&&"aborted"===e.requireError}export{ve as default};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import i from"../../Graphic.js";import{prefersReducedMotion as a}from"../../core/a11yUtils.js";import{isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as p}from"../../core/Evented.js";import{drainHandles as l,disposable as h,makeHandle as c,destroyHandle as d}from"../../core/handleUtils.js";import"../../core/has.js";import u from"../../core/Logger.js";import{destroyMaybe as y,abortMaybe as m}from"../../core/maybe.js";import{createAbortError as g,ignoreAbortErrors as v,whenOrAbort as f}from"../../core/promiseUtils.js";import{watch as _,syncAndInitial as b,on as w,when as G,whenOnce as T}from"../../core/reactiveUtils.js";import{property as O,subclass as S}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as A}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as E,isLoaded as M,load as k,project as H}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as I}from"../../geometry/support/coordsUtils.js";import{equals as P}from"../../geometry/support/spatialReferenceUtils.js";import D from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as j}from"../../layers/support/layerUtils.js";import{getEffectiveElevationInfo as U}from"../../support/elevationInfoUtils.js";import R from"../../symbols/CIMSymbol.js";import x from"../../symbols/FillSymbol3DLayer.js";import L from"../../symbols/MeshSymbol3D.js";import F from"../../symbols/SimpleFillSymbol.js";import V from"../../symbols/SimpleLineSymbol.js";import W from"../../symbols/SimpleMarkerSymbol.js";import K from"../../symbols/TextSymbol.js";import{symbolTypes as Z}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as q}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as N}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as z}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as B}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as $}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as Y}from"../../views/input/InputManager.js";import{sketchKeys as X}from"../../views/interactive/keybindings.js";import J from"../../views/interactive/sketch/SketchLabelOptions.js";import Q from"../../views/interactive/sketch/SketchOptions.js";import ee from"../../views/interactive/sketch/SketchTooltipOptions.js";import te from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as oe}from"../../views/interactive/snapping/SnappingManager.js";import ie from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as ae}from"../../views/interactive/snapping/snappingUtils.js";import{GeometryWorkerHandle as re}from"../../views/support/GeometryWorkerHandle.js";import{defaultHighlightName as se}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as ne}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as pe}from"../../views/support/screenUtils.js";import le from"./adapters/layer/GraphicsLayerAdapter.js";import he from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ce,DrawToolOperationHandle as de,UpdateOperationHandle as ue}from"./support/OperationHandle.js";import{PluginManager as ye}from"./support/PluginManager.js";import{getLegacyTool as me,isCompletelyDegenerate as ge,graphicsHaveTooFewVerticesForBox as ve,getModeFromCreateOptions as fe,getDrawToolGeometryTypeFromCreateTool as _e}from"./support/sketchUtils.js";const be={defaultZ:0},we={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:se},tool:"transform"},Ge=Symbol(),Te=Symbol();let Oe=class extends p{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new D({listMode:"hide",internal:!0,title:"SVM Internal"}),this._pluginManager=new ye({sketchViewModel:this}),this._operationHandle=null,this._updatingHandles=new C,this._drawToolSimplifyAbortController=null,this._geometryWorkerHandle=new re,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.activeUpdateOptions=null,this.layer=null,this.pointSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new F({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new V({color:[130,130,130,1],width:2}),this.meshSymbol=new L({symbolLayers:new s([new x])}),this.updateGraphics=new s,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new W({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Q,this.useLegacyCreateTools=!0,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(Te),!e)return;const t=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),_(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},b)].filter(r);this.addHandles(t,Te)},this._originalPopupEnabled=null,this.defaultCreateOptions=be,this.defaultUpdateOptions=we,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new ie,this.textSymbol=new K({text:"text"})}initialize(){this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe()),this.addHandles([w(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),_(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),b),_(()=>this.view,e=>{this._defaultSnappingManager=y(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new oe({view:e,options:this.snappingOptions})),"2d"===e.type?(import("../../views/2d/interactive/editingTools.js"),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},b),_(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),ae(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=y(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._geometryWorkerHandle.destroy(),this._pluginManager?.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new le(e);case"map-notes":return new he(e);default:return null}}get activeTool(){return this._operationHandle?.tool??null}get geometrySimplificationInProgress(){return!!this._drawToolSimplifyAbortController}get activeCreateToolDrawMode(){const e=this._operationHandle;if("create"===e?.type&&e.activeComponent&&"mode"in e.activeComponent)return e.activeComponent.mode;if("draw-2.0"===e?.activeComponent?.type){const t=e.activeComponent.pluginStack.map(e=>e.configuration).filter(r).toArray();if(t.length>0)return this._pluginManager?.getDrawingModeEquivalentToPluginStack(t)}return null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...be,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...we,...e,reshapeOptions:{...we.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...we.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",e)}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=y(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new oe({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get updating(){return this.activeComponent&&"updating"in this.activeComponent&&this.activeComponent.updating||!!(this._updatingHandles.updating||this._drawToolSimplifyAbortController||this.snappingManager?.updating||this.drawTool?.updating)}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(G(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},b),o),this._set("view",e),this._updatingHandles.addPromise(this._setupAdvancedDrawToolIntegrationMaybe())}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||"2d"!==this.view?.type}get pluginManager(){return this._pluginManager}get drawTool(){return"draw-2.0"!==this.activeComponent?.type?null:this.activeComponent}get rootPlugins(){return this._pluginManager?.availablePlugins}set rootPlugins(e){this._overrideIfSome("rootPlugins",e)}get effectiveAvailablePlugins(){if(this.isUsingLegacyCreateTools)return null;const e=this.view?.type??"2d",{firstPluginWithSwappableLeaf:t}=this;return t?t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e)):this.rootPlugins?.filter(t=>!t.excludedViews?.includes(e)).filter(r)??[]}get firstPluginWithSwappableLeaf(){const e=this.view?.type??"2d",t=this.drawTool?.pluginStack.toArray().map(e=>e.configuration).findLast(t=>null!=t&&!t.hidden&&t.availableDownstreamPlugins&&t.availableDownstreamPlugins.filter(t=>!t.excludedViews?.includes(e))?.length>1);return t}get multiplePluginsActive(){return!!this.drawTool&&this.drawTool.pluginStack.length>1}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=m(this._moduleLoaderAbortController),this._viewReadyAbortController=m(this._viewReadyAbortController),this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),this._sketchContinuationFlag=!0,this._operationHandle?.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),g();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");$(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=me(e),s=()=>{if(a===this._operationHandle){const o=this.createGraphic,i=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),a.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:i?"cancel":"complete",tool:r??"point",toolEventInfo:null,type:"create"}),i||this._sketchContinuationFlag)return;const{creationMode:s}=this;if("continuous"===s){if(t?.geometryToPlace)return;this._updatingHandles.consumePromise(v(this.create(e,t)))}else"update"===s&&o&&this._updatingHandles.consumePromise(v(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),g();null!=i.activeTool&&(i.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||De(s)||($(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||P(o.geometry.spatialReference,t.spatialReference)||(E(o.geometry.spatialReference,t.spatialReference)||M()||await k(),o.geometry=H(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return ne(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{j(e)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?A(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},Y.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(pe(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||this.hasGraphic(i)?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a="string"==typeof e?this.pluginManager?.getPluginsEquivalentToCreateTool(e,i.mode):e,r=me(e);if(a&&!this.isUsingLegacyCreateTools){const e=await this._setupDrawTool(a,i,r??"polyline");if(e)return this._setupDrawToolOperationHandle(e,r??"point")}if(!r)return null;const s=await this._setupDrawGraphicTool(r,o,i);return null==s?null:(o.tools.add(s),o.activeTool=s,this._setupCreateOperationHandle(s,r))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=fe(p,e),c=_e(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,y={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(y):this._makeDrawGraphicTool3D(y)}async _makeDrawGraphicTool2D(e){const t=await this._requireModule(import("../../views/2d/interactive/editingTools.js"));return De(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Ae(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions})}async _makeDrawGraphicTool3D(e){const t=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));return De(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let i=null;const a=e.forceUniformSize,r=e.centered,s=[o.on("key-down",t=>{if(t.key===X.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===X.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==X.vertexAdd||t.repeat)t.key===X.undo?(t.stopPropagation(),n.undo()):t.key===X.redo?(t.stopPropagation(),n.redo()):t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===X.center&&(t.repeat||(e.centered=!r,t.stopPropagation())):(e.forceUniformSize=!a,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},Y.WIDGET),o.on("key-up",t=>{t.key===X.pan?e.enabled=!0:t.key!==X.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===X.center&&(e.centered=r,t.stopPropagation()):(e.forceUniformSize=a,t.stopPropagation())},Y.WIDGET),e.on("vertex-add",t=>{switch(i=null==i?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:i,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),i="complete",e.aborted?n&&n.cancel():n&&n.complete()}),_(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],n=new ce({activeComponent:e,type:"create",onEnd:()=>{l(s),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_setupDrawToolOperationHandle(o,i){const a=this.view;if(!a)return this._logMissingView(),null;let s=null;const n=[a.on("key-down",e=>{e.key===X.pan&&(e.stopPropagation(),e.repeat||(o.editable=!1))},Y.WIDGET),a.on("key-up",e=>{e.key===X.pan&&(o.editable=!0)},Y.WIDGET),o.on("before-vertex-add",e=>{const t=o.mostUpstreamPlugin?.configuration;if(t&&"legacyCreateTool"in t&&("point"===t?.legacyCreateTool||"text"===t.legacyCreateTool)){const t=e.detail.originalEvent;return void(t&&"key"in t&&t.key===X.vertexAdd&&e.preventDefault())}}),o.on("before-complete",e=>{const t=o.getGeometryIfCompleted();(!t||ge(t))&&e.preventDefault()}),o.on(["vertex-add","vertex-remove"],e=>{switch(this.createGraphic&&(this.createGraphic.geometry=o.getGeometryIfCompleted()),s=null==s&&"vertex-remove"!==e.type?"start":"active",e.operation){case"apply":this.emit("create",{graphic:this.createGraphic,state:s,tool:this.activeTool,toolEventInfo:e,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[this.createGraphic].filter(r),tool:i});break;case"redo":this._emitRedoEvent({graphics:[this.createGraphic].filter(r),tool:i})}}),o.on("cursor-update",e=>{this.createGraphic&&(this.createGraphic.geometry=o.unprocessedGeometry),(e.vertices[0]?.vertexIndex>0||e.vertices[0]?.componentIndex>0)&&this.emit("create",{graphic:this.createGraphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:e.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),o.on("complete",async({geometry:i,isSimple:a})=>{const r=this.createGraphic;if(!!i&&"mesh"!==i.type&&"extent"!==i.type&&!a&&r){const a={stack:[],error:void 0,hasError:!1};try{const t=new AbortController;this._drawToolSimplifyAbortController?.abort(),this._drawToolSimplifyAbortController=t;e(a,h(this._createDrawToolCompletionPreviewGraphic(o,i,r)),!1);await this._updatingHandles.addPromise(v(this._finalizeDrawToolCompletion({abortController:t,geometry:i,graphic:r,handle:p})))}catch(s){a.error=s,a.hasError=!0}finally{t(a)}}else r&&(r.geometry=i),p.complete()})],p=new de({activeComponent:o,type:"create",onEnd:()=>{l(n),a.tools.remove(o)},undo:()=>o.undo(),redo:()=>o.redo(),canUndo:()=>o.canUndo,canRedo:()=>o.canRedo});return n.push(o.on("cancel",()=>{this._drawToolSimplifyAbortController=m(this._drawToolSimplifyAbortController),p.cancel()})),p}_createDrawToolCompletionPreviewGraphic(e,t,o){const a="polygon"===t?.type?this._createAnimatedPolygonPreviewSymbol():o?.symbol,r=t?e.simplifiedGeometryPreview??t:null;if(!r||!a)return c();const s=new i({geometry:r,symbol:a});return this._internalGraphicsLayer.add(s),c(()=>this._internalGraphicsLayer.remove(s))}async _finalizeDrawToolCompletion({abortController:e,geometry:t,graphic:o,handle:i}){const a=this.view?.acquireCursor("progress","high");a&&this.addHandles(a);const r=()=>!!e.signal.aborted&&(o&&this._layerAdapter?.remove(o),this._set("createGraphic",null),!0);try{const a=await this._geometryWorkerHandle.simplify(t,e.signal);if(r())return;o.geometry=a??t,i.complete()}finally{a?.remove(),this._drawToolSimplifyAbortController===e&&(this._drawToolSimplifyAbortController=null)}}_createAnimatedPolygonPreviewSymbol(){const e={type:"CIMAnimatedSymbolProperties",playAnimation:!a(),duration:1,repeatType:"Oscillate",easing:"EaseInOut"};return new R({data:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[180,180,180,36],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]},{type:"CIMHatchFill",enable:!0,separation:6,rotation:-45,offsetX:0,offsetY:0,lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:.8,color:[100,100,100,110],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:30,animatedSymbolProperties:e}]}]}},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.8,color:[60,60,60,255],effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[6,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],animations:[{type:"CIMSymbolAnimationTransparency",toTransparency:70,animatedSymbolProperties:e}]}]}}})}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const i={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};this.activeUpdateOptions=i;let a=i.tool??we.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(a){case"move":return this._setupMove3DOperation(e,i,o,a);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],i,o);case"transform":return this._setupGraphicTransform3DOperation(e,i,o)}}switch(a){case"move":return this._setupMove2DOperation(e,i,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,a,i,o);case"transform":return ve(e)&&(a="reshape"),this._setupTransformOrReshape2DOperation(e,a,i,o)}}async _setupMove3DOperation(e,t,o,i,a=!1){const r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(De(r))return r;const{ManipulatedObject3DGraphic:s,MoveTool3D:n}=r.module,p=new Map,h=()=>{p.forEach(e=>e.destroy()),p.clear()};for(const l of e){const e=new s({view:o,graphic:l}),t=N(e);if(0!==t)return h(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${q(t)}).`),null;p.set(l,e)}const c=new n({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(c),c.objects.addMany(Array.from(p.values())),a||this.updateGraphics.addMany(e);const d=[],u=new ue({activeComponent:c,tool:i,type:"update",onEnd:()=>{l(d),Pe(o,c),h()},undo:()=>{He(this.view,c),Ee(u,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Me(u,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new s({view:o,graphic:e});p.set(e,t),c.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(u.history.undo.forEach(e=>e.updates.splice(t,1)),u.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void u.complete();const o=p.get(e);o&&(c.objects.remove(o),o.destroy(),p.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));a&&!De(a)&&(u.onEnd(),u.destroy(),this._setUpdateOperationHandle(a,t))}});return d.push(...this._getHandlesForComponent(u,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(u,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(u,e)},Y.WIDGET)),u}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===B(e[0])){const a=e[0],r=a.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:a,enableScaling:r,enableZ:s}=t,n=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(De(n))return n;const{TransformTool3D:p,ManipulatedObject3DGraphic:h}=n.module,c=new h({graphic:e,view:o}),d=new p({object:c,view:o,enableRotation:a,enableScaling:r,enableZ:s,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],y=new ue({activeComponent:d,tool:i,type:"update",onEnd:()=>{l(u),Pe(o,d),c.destroy()},undo:()=>{He(this.view,d),Ee(y,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{Me(y,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));De(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},Y.WIDGET)),y}async _setupPolyTransform3DOperation(e,t,o,i=!1){const a="transform",{enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:p}=t,h=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(De(h))return h;const{ManipulatedObject3DGraphic:c,ExtentTransformTool:d}=h.module,u=this.view?.inputManager?.isModifierKeyDown(X.constraint),y=new c({view:o,graphic:e}),m=new d({object:y,view:o,enableRotation:r,enableScaling:s,enableZ:n,preserveAspectRatio:!!p!=!!u,sketchOptions:this.sketchOptions});o.tools.add(m),i||this.updateGraphics.add(e);const g=[],v=new ue({activeComponent:m,tool:a,type:"update",onEnd:()=>{l(g),Pe(o,m),y.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),v.onEnd(),v.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));De(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),v.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._updatingHandles.addPromise(this._setupReshape3DOperation(e,t,o,!0));i&&!De(i)&&(v.onEnd(),v.destroy(),this._setUpdateOperationHandle(i,t))}});return g.push(...this._getHandlesForComponent(v,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(v,e,t),Y.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(v,e),Y.WIDGET),o.on("key-down",e=>{e.key!==X.constraint||e.repeat||(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&(m.preserveAspectRatio=!m.preserveAspectRatio,e.stopPropagation())},Y.WIDGET)),v}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise(this._getGraphicMover(e,t,o));if(De(a))return a;const r=new ue({activeComponent:a,tool:i,type:"update",onEnd:()=>{this._clearCursor(),l(p),l(n),a.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();Ee(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();Me(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),a.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?a.graphics=o:r.complete()}});let s=!1;const n=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==X.constraint||e.repeat||(s=!0,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET),o.on("key-up",e=>{e.key===X.constraint&&s&&(s=!1,a.enableMoveAllGraphics=!a.enableMoveAllGraphics)},Y.WIDGET)],p=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const a="reshape",r=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(De(r))return r;const{ManipulatedObject3DGraphic:s,ReshapeTool3D:n}=r.module,p=new s({view:o,graphic:e}),h=z(p);if(0!==h)return p.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${q(h)}).`),null;const c=t.reshapeOptions,d=new n({view:o,object:p,enableZVertex:t.enableZ&&"move"===c?.vertexOperation,enableZShape:t.enableZ&&"move"===c?.shapeOperation,enableMoveObject:"move"===c?.shapeOperation||"move-xy"===c?.shapeOperation,enableMidpoints:"split"===c?.edgeOperation,enableEdgeOffset:"offset"===c?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),i||this.updateGraphics.add(p.graphic);const u=[],y=new ue({activeComponent:d,tool:a,type:"update",onEnd:()=>{l(u),Pe(o,d),p.destroy()},canUndo:()=>!d.destroyed&&d.canUndo,undo:()=>{d.destroyed||(d.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},canRedo:()=>!d.destroyed&&d.canRedo,redo:()=>{d.destroyed||(d.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),y.onEnd(),y.destroy();const i=await this._updatingHandles.addPromise(this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0));De(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),y.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;y.onEnd(),y.destroy();const e=await this._updatingHandles.addPromise(this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0));De(e)||this._setUpdateOperationHandle(e,t)}});return u.push(...this._getHandlesForComponent(y,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(y,e,t),Y.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(y,e)},Y.WIDGET)),y}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const a=await this._updatingHandles.addPromise("transform"===t?this._getBox(e,o,i):this._getReshape(e,o,i));if(De(a))return a;const r=new ue({activeComponent:a,type:"update",onEnd:()=>{l(n),l(s),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{Ee(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{Me(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._updatingHandles.addPromise(this._setupTransformOrReshape2DOperation(t,"transform",o,i));if(De(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?r.complete():ve(o)?r.toggleTool():r.activeComponent.graphics=o,this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&"point"===t.type||"transform"===r.tool&&"extent"===t.type))return;let a=null;const s={...this.defaultUpdateOptions,...o,...this.activeUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...o?.reshapeOptions,...this.activeUpdateOptions?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...o?.highlightOptions,...this.activeUpdateOptions?.highlightOptions}};"transform"===r.tool?a=await this._updatingHandles.addPromise(this._getReshape([e],s,i)):"reshape"===r.tool&&(a=await this._updatingHandles.addPromise(this._getBox([e],s,i))),De(a)||(r.activeComponent?.destroy(),r.activeComponent=a,r.activeComponent&&(l(n),n=this._getHandlesForComponent(r,s)))}}),s=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),Y.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===X.constraint&&!e.repeat&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET),i.on("key-up",e=>{if(e.key===X.constraint&&r){const e=r.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},Y.WIDGET)];let n=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return De(r)?r:new r.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:r,preserveAspectRatio:s}=t,n=await this._requireModule(import("../../views/draw/support/Box.js"));if(De(n))return n;const p=this.view?.inputManager?.isModifierKeyDown(X.constraint),l=new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!p,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}});return l.addHandles(_(()=>[this.activeUpdateOptions?.enableRotation,this.activeUpdateOptions?.enableScaling],([e,o])=>{l.enableRotation=e??t.enableRotation??!0,l.enableScaling=o??t.enableScaling??!0,l.refresh()},b)),l}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,r="split"===a?.edgeOperation,s="move"===a?.shapeOperation,n=!!a?.enableCreateCurveFromStraightEdge,p=await this._requireModule(import("../../views/draw/support/Reshape.js"));return De(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>I(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>I(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(Ie(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Ie(t.graphics))),o.on("rotate-start",t=>e.addToHistory(Ie(t.graphics))),o.on("scale-start",t=>e.addToHistory(Ie(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(Ie([t.mover]))),o.on("reshape-start",t=>e.addToHistory(Ie([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(Ie([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(Ie([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&this.hasGraphic(i)?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=pe(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void(this.updateOnGraphicClick&&e.complete());if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===X.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===X.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===X.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&X.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=y(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(Ge)}_displayCursor(e){this.removeHandles(Ge),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),Ge)}_logError(e,t,o){u.getLogger(this).error(new n(e,t,o))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}async _setupAdvancedDrawToolIntegrationMaybe(){this.isUsingLegacyCreateTools||this.pluginManager.loaded||await this.pluginManager.loadPlugins()}async _setupDrawTool(e,t,o){if(this.isUsingLegacyCreateTools||!this._pluginManager)return null;const a=this.view,r=await import("../../views/draw/DrawTool.js");await this.pluginManager.loadPlugins();const s=await this.pluginManager.makeRenderer({customSymbol:t.graphicSymbol,useTextSymbol:"text"===o}),n=new r.DrawTool({view:a,elevationInfo:this._layerAdapter?.elevationInfo??U("3d"===a.type),hasZ:!!t.hasZ,sketchOptions:this.sketchOptions,renderer:s,defaultZ:t.defaultZ??0,directionOptions:t.directionOptions,snappingManager:this.snappingManager,enableVertexVisuals:"rectangle"!==o&&"circle"!==o});n.addHandles(d(s));const p=new i({...t.graphicProperties,attributes:{...t.graphicProperties?.attributes},symbol:t.graphicSymbol??this._getGraphicSymbolFromTool(o)});return t.graphicSymbol||n.addHandles(_(()=>this._getGraphicSymbolFromTool(o),e=>p.symbol=e)),this._set("createGraphic",p),a.addAndActivateTool(n),n.begin(e),n}get test(){}wait(){return T(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(m(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await f(T(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Ce("view"))}_logMissingLayer(){this._logError(Se,Ce("layer"))}};o([O()],Oe.prototype,"_defaultSnappingManager",void 0),o([O()],Oe.prototype,"_layerAdapter",null),o([O()],Oe.prototype,"_pluginManager",void 0),o([O()],Oe.prototype,"_operationHandle",void 0),o([O({readOnly:!0})],Oe.prototype,"_updatingHandles",void 0),o([O()],Oe.prototype,"_drawToolSimplifyAbortController",void 0),o([O({readOnly:!0})],Oe.prototype,"activeTool",null),o([O()],Oe.prototype,"geometrySimplificationInProgress",null),o([O({readOnly:!0})],Oe.prototype,"activeCreateToolDrawMode",null),o([O()],Oe.prototype,"activeTooltip",null),o([O({types:Z})],Oe.prototype,"activeFillSymbol",void 0),o([O()],Oe.prototype,"activeLineSymbol",void 0),o([O()],Oe.prototype,"activeVertexSymbol",void 0),o([O()],Oe.prototype,"allowDeleteKey",void 0),o([O({readOnly:!0})],Oe.prototype,"createGraphic",null),o([O()],Oe.prototype,"defaultCreateOptions",null),o([O()],Oe.prototype,"defaultUpdateOptions",null),o([O()],Oe.prototype,"activeUpdateOptions",void 0),o([O({type:J,nonNullable:!0})],Oe.prototype,"labelOptions",null),o([O()],Oe.prototype,"layer",void 0),o([O({types:Z})],Oe.prototype,"pointSymbol",void 0),o([O({types:Z})],Oe.prototype,"polygonSymbol",void 0),o([O({types:Z})],Oe.prototype,"polylineSymbol",void 0),o([O()],Oe.prototype,"meshSymbol",void 0),o([O({type:K})],Oe.prototype,"textSymbol",null),o([O({type:ie,nonNullable:!0})],Oe.prototype,"snappingOptions",null),o([O()],Oe.prototype,"snappingManager",null),o([O({readOnly:!0})],Oe.prototype,"state",null),o([O({type:ee,nonNullable:!0})],Oe.prototype,"tooltipOptions",null),o([O({readOnly:!0})],Oe.prototype,"updateGraphics",void 0),o([O()],Oe.prototype,"updateOnGraphicClick",void 0),o([O()],Oe.prototype,"updating",null),o([O()],Oe.prototype,"creationMode",void 0),o([O({type:te,nonNullable:!0})],Oe.prototype,"valueOptions",null),o([O({types:Z})],Oe.prototype,"vertexSymbol",void 0),o([O({value:null})],Oe.prototype,"view",null),o([O({constructOnly:!0,type:Q})],Oe.prototype,"sketchOptions",void 0),o([O()],Oe.prototype,"useLegacyCreateTools",void 0),o([O()],Oe.prototype,"isUsingLegacyCreateTools",null),o([O()],Oe.prototype,"pluginManager",null),o([O()],Oe.prototype,"drawTool",null),o([O()],Oe.prototype,"rootPlugins",null),o([O()],Oe.prototype,"effectiveAvailablePlugins",null),o([O()],Oe.prototype,"firstPluginWithSwappableLeaf",null),o([O()],Oe.prototype,"multiplePluginsActive",null),Oe=o([S("esri.widgets.Sketch.SketchViewModel")],Oe);const Se="sketch:missing-property",Ce=e=>`Property '${e}' is missing on SketchViewModel.`;function Ae(e){return"polygon"===e||"rectangle"===e||"circle"===e}function Ee(e,t){ke("undo",e.history.undo,e.history.redo,t)}function Me(e,t){ke("redo",e.history.redo,e.history.undo,t)}function ke(e,t,o,i){const a=t.pop();if(!a)return;const r=a.updates,s=[];i.forEach((t,o)=>{const i=r[o];null!=i&&("geometry"in i&&null!=i.geometry&&(s.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(s.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(s.push(i),i[e](t)))}),o.push({updates:s})}function He(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function Ie(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function Pe(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function De(e){return"requireError"in e&&"aborted"===e.requireError}export{Oe as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../../../core/accessorSupport/decorators.js";import s from"../../../Widget.js";import{ToolbarGroupBase as i}from"./ToolbarGroupBase.js";import{tsx as o}from"../../../support/widget.js";import{onResize as d}from"../../../support/widgetUtils.js";const m=Symbol("on-resize-handle-key");let a=class extends(i(s)){constructor(e){super(e),this._measuredWidth=0,this._measuredHeight=0,this._measuredElement=null}destroy(){this._measuredElement=null}get lengthOptions(){return["horizontal"===this.layout?this._measuredWidth:this._measuredHeight]}render(){return o("div",{afterCreate:e=>{this._measuredElement=e.firstElementChild,this.addHandles(d(this._measuredElement,()=>{this._measuredWidth=this._measuredElement?.clientWidth??0,this._measuredHeight=this._measuredElement?.clientHeight??0}),m)},afterRemoved:()=>this.removeHandles(m)},this.children)}};e([t()],a.prototype,"_measuredWidth",void 0),e([t()],a.prototype,"_measuredHeight",void 0),e([t()],a.prototype,"lengthOptions",null),e([t()],a.prototype,"_measuredElement",void 0),a=e([r("esri.widgets.Sketch.support.ResponsiveToolbar.MeasuredContentGroup")],a);export{a as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../Widget.js";import{ToolbarGroupBase as r}from"./ToolbarGroupBase.js";import{loadCalciteComponents as i}from"../../../support/componentsUtils.js";import{tsx as n}from"../../../support/widget.js";import{onResize as d}from"../../../support/widgetUtils.js";const u=Symbol("on-resize-handle-key");let p=class extends(r(s)){constructor(e){super(e),this._measuredWidth=0,this._measuredHeight=0,this._measuredElement=null,this.useActionGroup=!1}loadDependencies(){return this.useActionGroup?i({"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group")}):void 0}destroy(){this._measuredElement=null}get lengthOptions(){return["horizontal"===this.layout?this._measuredWidth:this._measuredHeight]}render(){const e={afterCreate:e=>{this._measuredElement=this.useActionGroup?e:e.firstElementChild,this.addHandles(d(this._measuredElement,()=>{this._measuredWidth=this._measuredElement?.clientWidth??0,this._measuredHeight=this._measuredElement?.clientHeight??0}),u)},afterRemoved:()=>this.removeHandles(u),slot:this.slot,layout:this.layout};return this.useActionGroup?n("calcite-action-group",{...e},this.children):n("div",{...e},this.children)}};e([t()],p.prototype,"_measuredWidth",void 0),e([t()],p.prototype,"_measuredHeight",void 0),e([t()],p.prototype,"lengthOptions",null),e([t()],p.prototype,"_measuredElement",void 0),e([t()],p.prototype,"useActionGroup",void 0),p=e([o("esri.widgets.Sketch.support.ResponsiveToolbar.MeasuredContentGroup")],p);export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as r}from"../../../../core/arrayUtils.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../Widget.js";import i from"./MeasuredContentGroup.js";import l from"./OverflowGroup.js";import n from"./ResponsiveToolbarManager.js";import{SplitButton as d}from"./SplitButton.js";import{loadCalciteComponents as c}from"../../../support/componentsUtils.js";import{tsx as p}from"../../../support/widget.js";const u="esri-responsive-toolbar",m={rulerBase:`${u}__ruler`,rulerBarHorizontal:`${u}__ruler--bar`,rulerBarVertical:`${u}__ruler--bar--vertical`,rulerPadVertical:`${u}__ruler--pad--vertical`,rulerPadHorizontal:`${u}__ruler--pad--horizontal`,bar:`${u}__bar`,barHorizontal:`${u}__bar--horizontal`,barVertical:`${u}__bar--vertical`,pad:`${u}__pad`,padVertical:`${u}__pad--vertical`,padHorizontal:`${u}__pad--horizontal`};let h=class extends s{constructor(e){super(e),this.scale="m",this.barStyle="floating",this._measurementManager=new n,this._managedWidgets=new Map}loadDependencies(){return c({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")})}destroy(){this._measurementManager=t(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){const r=this._get("layout");this._set("layout",e),this._measurementManager&&(this._measurementManager.layout=e),r!==e&&this.scheduleRender()}get _barClasses(){const e="docked"===this.barStyle,r="vertical"===this.layout;return{[m.barHorizontal]:e&&!r,[m.barVertical]:e&&r,[m.bar]:e,[m.padHorizontal]:!e&&!r,[m.padVertical]:!e&&r,[m.pad]:!e}}render(){const{layout:e,scale:r,barStyle:t}=this,a={layout:e,scale:r,expandDisabled:!0,key:"measured-toolbar"},o="docked"===t?"vertical"===e?m.rulerBarVertical:m.rulerBarHorizontal:"horizontal"===e?m.rulerPadHorizontal:m.rulerPadVertical,s=this._renderChildren();return s.length?p("div",{key:"toolbar-wrapper"},p("div",{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(m.rulerBase,o),key:"ruler-element"}),p("calcite-action-bar",{...a,classes:this._barClasses,floating:"docked"!==t,overflowActionsDisabled:!0},s)):null}_renderChildren(){if(!this.children)return[];const e=new Set,t=[];for(const r of this.children){if(!r.properties?.key||!("group-kind"in r.properties)||!r.children?.length)continue;const a=r.properties,o=a.key;e.add(o);const s="docked"===this.barStyle?a.slot??void 0:void 0,n=a.priority??0,c=a["group-kind"]??"overflow-group",p=a["allow-collapse"]??!0,u=this._managedWidgets.get(o);if(u)u.children=r.children,u.priority=n,"allowCollapse"in u&&(u.allowCollapse=p),u.slot=s,u.layout=this.layout,u.scale=this.scale,u.measurementManager=this._measurementManager,t.push(u);else{const e={scale:this.scale,priority:n,measurementManager:this._measurementManager,children:r.children,slot:s,layout:this.layout};switch(c){case"split-button":{const r=new d({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"overflow-group":{const r=new l({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"measured-content":{const r=new i({...e});this._managedWidgets.set(o,r),t.push(r);break}}}}for(const[r]of this._managedWidgets.entries())e.has(r)||(this._managedWidgets.get(r)?.destroy(),this._managedWidgets.delete(r));return this._measurementManager?.allocate(),t.map(e=>e.render()).filter(r)}};e([a()],h.prototype,"scale",void 0),e([a({value:"horizontal"})],h.prototype,"layout",null),e([a()],h.prototype,"barStyle",void 0),e([a()],h.prototype,"_measurementManager",void 0),e([a()],h.prototype,"_managedWidgets",void 0),e([a()],h.prototype,"_barClasses",null),h=e([o("esri.widgets.Sketch.support.ResponsiveToolbar.ResponsiveToolbar")],h);export{h as default};
2
+ import{__decorate as e}from"tslib";import{isSome as r}from"../../../../core/arrayUtils.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import s from"../../../Widget.js";import i from"./MeasuredContentGroup.js";import l from"./OverflowGroup.js";import n from"./ResponsiveToolbarManager.js";import{SplitButton as d}from"./SplitButton.js";import{loadCalciteComponents as c}from"../../../support/componentsUtils.js";import{tsx as p}from"../../../support/widget.js";const u="esri-responsive-toolbar",m={rulerBase:`${u}__ruler`,rulerBarHorizontal:`${u}__ruler--bar`,rulerBarVertical:`${u}__ruler--bar--vertical`,rulerPadVertical:`${u}__ruler--pad--vertical`,rulerPadHorizontal:`${u}__ruler--pad--horizontal`,bar:`${u}__bar`,barHorizontal:`${u}__bar--horizontal`,barVertical:`${u}__bar--vertical`,pad:`${u}__pad`,padVertical:`${u}__pad--vertical`,padHorizontal:`${u}__pad--horizontal`};let h=class extends s{constructor(e){super(e),this.scale="m",this.barStyle="floating",this._measurementManager=new n,this._managedWidgets=new Map}loadDependencies(){return c({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar")})}destroy(){this._measurementManager=t(this._measurementManager),this._managedWidgets.forEach(e=>e.destroy()),this._managedWidgets.clear()}set layout(e){const r=this._get("layout");this._set("layout",e),this._measurementManager&&(this._measurementManager.layout=e),r!==e&&this.scheduleRender()}get _barClasses(){const e="docked"===this.barStyle,r="vertical"===this.layout;return{[m.barHorizontal]:e&&!r,[m.barVertical]:e&&r,[m.bar]:e,[m.padHorizontal]:!e&&!r,[m.padVertical]:!e&&r,[m.pad]:!e}}render(){const{layout:e,scale:r,barStyle:t}=this,a={layout:e,scale:r,expandDisabled:!0,key:"measured-toolbar"},o="docked"===t?"vertical"===e?m.rulerBarVertical:m.rulerBarHorizontal:"horizontal"===e?m.rulerPadHorizontal:m.rulerPadVertical,s=this._renderChildren();return s.length?p("div",{key:"toolbar-wrapper"},p("div",{afterCreate:e=>{this._measurementManager?.connect(e)},class:this.classes(m.rulerBase,o),key:"ruler-element"}),p("calcite-action-bar",{...a,classes:this._barClasses,floating:"docked"!==t,overflowActionsDisabled:!0},s)):null}_renderChildren(){if(!this.children)return[];const e=new Set,t=[];for(const r of this.children){if(!r.properties?.key||!("group-kind"in r.properties)||!r.children?.length)continue;const a=r.properties,o=a.key;e.add(o);const s="docked"===this.barStyle?a.slot??void 0:void 0,n=a.priority??0,c=a["group-kind"]??"overflow-group",p=a["allow-collapse"]??!0,u="measured-content-group"===c,m=this._managedWidgets.get(o);if(m)m.children=r.children,m.priority=n,"allowCollapse"in m&&(m.allowCollapse=p),m.slot=s,m.layout=this.layout,m.scale=this.scale,m.measurementManager=this._measurementManager,m instanceof i&&(m.useActionGroup=u),t.push(m);else{const e={scale:this.scale,priority:n,measurementManager:this._measurementManager,children:r.children,slot:s,layout:this.layout};switch(c){case"split-button":{const r=new d({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"overflow-group":{const r=new l({...e,allowCollapse:p});this._managedWidgets.set(o,r),t.push(r);break}case"measured-content":{const r=new i({...e});this._managedWidgets.set(o,r),t.push(r);break}case"measured-content-group":{const r=new i({...e,useActionGroup:!0});this._managedWidgets.set(o,r),t.push(r);break}}}}for(const[r]of this._managedWidgets.entries())e.has(r)||(this._managedWidgets.get(r)?.destroy(),this._managedWidgets.delete(r));return this._measurementManager?.allocate(),t.map(e=>e.render()).filter(r)}};e([a()],h.prototype,"scale",void 0),e([a({value:"horizontal"})],h.prototype,"layout",null),e([a()],h.prototype,"barStyle",void 0),e([a()],h.prototype,"_measurementManager",void 0),e([a()],h.prototype,"_managedWidgets",void 0),e([a()],h.prototype,"_barClasses",null),h=e([o("esri.widgets.Sketch.support.ResponsiveToolbar.ResponsiveToolbar")],h);export{h as default};
package/widgets/Sketch.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as o}from"../core/arrayUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import{handlesGroup as l}from"../core/handleUtils.js";import s from"../core/Logger.js";import{removeMaybe as n,destroyMaybe as r}from"../core/maybe.js";import{ignoreAbortErrors as a}from"../core/promiseUtils.js";import{watch as p,syncAndInitial as c,when as d}from"../core/reactiveUtils.js";import{property as u,subclass as h}from"../core/accessorSupport/decorators.js";import{symbolTypes as v}from"../symbols/support/typeUtils.js";import m from"../views/interactive/sketch/SketchLabelOptions.js";import g from"../views/interactive/sketch/SketchTooltipOptions.js";import y from"../views/interactive/sketch/SketchValueOptions.js";import f from"./Widget.js";import b from"./Sketch/SketchViewModel.js";import w from"./Sketch/VisibleElements.js";import _ from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import M from"./support/SelectionToolbar.js";import C from"./support/SketchTooltipControls.js";import S from"./support/SnappingControls.js";import{tsx as O,messageBundle as k,vmEvent as P}from"./support/widget.js";import I from"./support/SelectionToolbar/VisibleElements.js";import L from"./support/SketchTooltipControls/VisibleElements.js";const x="esri-sketch",E={base:x,vertical:`${x}--vertical`,docked:`${x}-bar`,floating:`${x}-pad`,chipHorizontal:`${x}__selection-count-chip--horizontal`,chipVertical:`${x}__selection-count-chip--vertical`,chipVerticalSmall:`${x}__selection-count-chip--vertical--s`,popoverWrapper:`${x}__popover-wrapper`},R={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"add-text"};let B=class extends f{constructor(e,t){super(e,t),this._selectionToolbar=null,this._viewModelHandlesGroup=null,this._popoverElement=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new w,this._defaultViewModel=null,this._activeCustomToolOptions=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,!0!==e?.suppressDeprecationWarning&&(this.announceDeprecation=()=>{i(s.getLogger(this),"Sketch","arcgis-sketch",{version:"5.0"})}),this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new b({creationMode:e?.creationMode??"continuous",useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type})),this.viewModel.pluginManager.sketch=this}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...o}=e;return o}initialize(){const{layer:e,view:t}=this,o="2d"===t?.type,i=new M({persistSelection:!1,visibleElements:new I({chip:!1,lassoTool:o,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:o}),view:t,sources:e?[e]:null,scale:this.scale});this.addHandles([p(()=>this.viewModel,e=>{this._viewModelHandlesGroup=n(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=l([e.on("create",()=>this.scheduleRender()),e.on("update",()=>this.scheduleRender()),e.on("delete",e=>this.emit("delete",e)),e.on("undo",()=>this.scheduleRender()),e.on("redo",()=>this.scheduleRender()),p(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),p(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),p(()=>e.state,()=>this.notifyChange("state"))]))},c),d(()=>i.activeOperation,()=>{this.viewModel.cancel(),this._activeCustomToolOptions=null}),i.on("complete",e=>this._onSelectionOperationComplete(e)),p(()=>{const{view:e,visibleElements:{selectionTools:t}}=this;return{lassoTool:"3d"!==e?.type&&!!t?.["lasso-selection"],rectangleTool:"3d"!==e?.type&&!!t?.["rectangle-selection"]}},e=>{Object.assign(i.visibleElements,e)},c)]),this._selectionToolbar=i}loadDependencies(){return T({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=n(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const{availableCreateTools:t}=this,{activeTool:o,activeCreateToolDrawMode:i}=this.viewModel;return"polygon"===o&&"freehand"===i&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===o&&"freehand"===i&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}get pointSymbol(){return this.viewModel.pointSymbol}set pointSymbol(e){this.viewModel.pointSymbol=e}get polygonSymbol(){return this.viewModel.polygonSymbol}set polygonSymbol(e){this.viewModel.polygonSymbol=e}get polylineSymbol(){return this.viewModel.polylineSymbol}set polylineSymbol(e){this.viewModel.polylineSymbol=e}get textSymbol(){return this.viewModel.textSymbol}set textSymbol(e){this.viewModel.textSymbol=e}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&r(t),t?.pluginManager?.sketch===this&&(t.pluginManager.sketch=null),this._set("viewModel",e),e.pluginManager.sketch=this)}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get _effectiveAvailableCreateTools(){if(this.viewModel.effectiveAvailablePlugins?.length)return this.viewModel.effectiveAvailablePlugins;const{availableCreateTools:e,view:t,visibleElements:o}=this,i=e?.filter(e=>!!o.createTools?.[e]);return"3d"===t?.type?i?.filter(e=>"multipoint"!==e):i}create(e,t,o){const i=o?.createOptions??t;return this._activeCustomToolOptions=o,a(this.viewModel.create(e,i))}update(e,t){return a(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:o}=this;return O("div",null,O("div",{classes:{[E.base]:!0,[E.floating]:"floating"===e,[E.docked]:"docked"===e,[E.vertical]:"vertical"===t}},O(_,{barStyle:e,layout:t,scale:o},this._renderSelectionSetItemGroupInline(),this._renderSelectionToolsOrBack(),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup()),this._renderSelectionSetToolbar(),this._renderSettingsMenuPopover()))}_renderSelectionToolsOrBack(){if(!this.viewModel.isUsingLegacyCreateTools&&this.viewModel.firstPluginWithSwappableLeaf)return this._renderBackButton();const e=this.customActions?.filter(e=>"selection-toolbar"===e.position);return O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionTools")??!0,"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),e?.map(e=>this._renderToolbarItem(e)))}_renderSettingsMenuPopover(){const{messagesCommon:e,snappingOptions:t,view:o,viewModel:i,visibleElements:l}=this;if(!this._calcitePopoverReferenceElement)return;const s={directionModePicker:l.directionModePicker,labelsToggle:l.labelsToggle,tooltipsToggle:l.tooltipsToggle},n="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return O("calcite-popover",{afterCreate:e=>this._popoverElement=e,closable:!0,heading:e.settings,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:n,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforePopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},O("div",{class:E.popoverWrapper},Object.values(s).includes(!0)?O(C,{sketchOptions:i.sketchOptions,view:o,visibleElements:new L(s)}):void 0,l.snappingControls&&o&&t?O(S,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:o,visibleElements:l.snappingControlsElements}):void 0))}_beforePopoverClose(e){e===this._popoverElement&&(this._popoverOpen=!1)}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?O(_,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("undoRedo")??!0,"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??10,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],t=[];this.customActions?.forEach(o=>{"settings-before"===o.position?t.push(o):"settings-after"===o.position&&e.push(o)});const i=[...t.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(o);if(i.length)return O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("settings")??!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??1e3,slot:"actions-end"},i)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter(e=>"before-selection-set"===e.position),o=this.customActions?.filter(e=>"after-selection-set"===e.position),i=this.groupCollapsePriorities?.get("selectionSet")??100;return[O("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:i,slot:e},this._renderFeatureCountChip()),O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionSet")??!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:i,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),o?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderBackButton(){const{viewModel:e,isUsingLegacyCreateTools:t}=this;if(!t&&e.multiplePluginsActive&&e.firstPluginWithSwappableLeaf&&e.rootPlugins&&(!(e.rootPlugins.length<2&&e.rootPlugins.includes(e.firstPluginWithSwappableLeaf))||this.visibleElements.singlePluginBackButton))return O("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"back-button-group"},O("calcite-action",{icon:"chevron-left",onclick:()=>{this.viewModel?.cancel()},scale:this.scale,text:this.messagesCommon.back}))}_renderCreateToolActionGroup(){const e=this.viewModel.firstPluginWithSwappableLeaf?[]:this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[],t=this._effectiveAvailableCreateTools,o=t?.filter(e=>"string"==typeof e),i=o?.map(e=>this._renderCreateToolItem(e)),l=t?.filter(e=>"string"!=typeof e).map(e=>this._renderCreateToolItem(e));return[i?.length||e?.length||l?.length?O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("createTools")??!0,"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??100},i,e,l):void 0]}_renderCreateToolItem(e){return"string"==typeof e?this._renderBuiltInCreateToolItem(e):this._renderDrawToolPluginItem(e)}_renderDrawToolPluginItem(e){const{icon:t,localizationKey:o,uniqueId:i,hidden:l}=e;if(l)return[];const s=this.messages.digitizers,n=s?.[o]??o,r=!this._activeCustomToolOptions&&this.viewModel.drawTool?.pluginStack.some(e=>!e.configuration?.hidden&&e.configuration?.uniqueId===i);return this._renderToolbarItem({id:`${o}-button`,text:n,icon:t,onclick:()=>this._activatePlugin([e]),active:r})}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:R[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:"settings-menu-action",text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:o,scale:i,id:l,updateGraphics:{length:s}}=this,n=t(o.selectedCount,{count:s}),r="l"===i?999:99,a=s>r?t(o.selectedCountTruncated,{truncated:r}):s,p="l"!==i&&"vertical"===e,c=p?`${l}-selection-chip-small`:`${l}-selection-chip`;return[p?O("span",{classes:{[E.chipVertical]:!0,[E.chipVerticalSmall]:"s"===this.scale},id:c,tabIndex:0,title:n},a):O("calcite-chip",{appearance:"outline",class:"horizontal"===e?E.chipHorizontal:E.chipVertical,id:c,kind:"brand",label:n,scale:"l"===i?"m":"s",tabIndex:0,title:"vertical"===e?n:void 0},"vertical"===e?a:n)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:o,disabled:i,onclick:l,active:s,flipRTL:n,afterCreate:r,afterUpdate:a,afterRemoved:p}){const c=`${this.id}-${e}`;return[O("calcite-action",{active:s,afterCreate:r,afterRemoved:p,afterUpdate:a,bind:this,"data-testid":e,disabled:i||"disabled"===this.state,icon:o,iconFlipRtl:n??!1,id:c,key:e,onclick:l,scale:this.scale,text:t,title:t})]}_remeasurePopoverSizes(e){try{const t=e.parentElement,o=this?.view?.container?.getBoundingClientRect(),i=t?.style;if(!(t&&o&&i&&this.view?.container?.contains(t)))return;const l=this._calcitePopoverReferenceElement;if(!l)return;const{bottom:s,top:n}=l.getBoundingClientRect();if("horizontal"===this.layout){const e=s<o.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(i?.setProperty("--sketch-view-height-offset",s-o.top+"px"),i?.setProperty("--sketch-view-margin-offset","30px")):(i?.setProperty("--sketch-view-height-offset",o.bottom-n+"px"),i?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(i.setProperty("--sketch-view-height-offset","15px"),i.setProperty("--sketch-view-margin-offset","15px"));const r=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;i.setProperty("--sketch-popover-header-offset",`${r}px`)}catch(t){s.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",t)}}_activateCreateTool(e,t,o){const i=this._activeCustomToolOptions;if(o||i){if(o?.toolKey===i?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,o)}_activatePlugin(e){this._selectionToolbar?.cancel(),this.viewModel.firstPluginWithSwappableLeaf?(this.viewModel.drawTool?.replaceLeaf(e),this.view?.ready&&this.view.focus()):this._activateCreateTool(e)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:o}=e;if(!e.aborted&&o.length){const e=t.tool,i=o.length>1&&"reshape"===e?"transform":e;this.update(o,{...t,tool:i})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(e){this.activeTool&&e===this._popoverElement&&this.view?.focus()}};e([u()],B.prototype,"activeTool",null),e([u({readOnly:!0})],B.prototype,"activeTooltip",null),e([u({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh","text"]);return e.filter(e=>t.has(e))}})],B.prototype,"availableCreateTools",void 0),e([u({readOnly:!0})],B.prototype,"createGraphic",null),e([u()],B.prototype,"creationMode",null),e([u()],B.prototype,"customToolOptions",void 0),e([u()],B.prototype,"customActions",void 0),e([u()],B.prototype,"defaultCreateOptions",null),e([u()],B.prototype,"defaultUpdateOptions",null),e([u()],B.prototype,"icon",null),e([u()],B.prototype,"label",null),e([u({type:m})],B.prototype,"labelOptions",null),e([u()],B.prototype,"layer",null),e([u({type:["horizontal","vertical"],value:"horizontal"})],B.prototype,"layout",null),e([u({types:v})],B.prototype,"pointSymbol",null),e([u({types:v})],B.prototype,"polygonSymbol",null),e([u({types:v})],B.prototype,"polylineSymbol",null),e([u()],B.prototype,"textSymbol",null),e([u({value:"m"})],B.prototype,"scale",null),e([u()],B.prototype,"toolbarKind",void 0),e([u()],B.prototype,"contextualToolLocation",void 0),e([u()],B.prototype,"groupCollapsePriorities",void 0),e([u()],B.prototype,"groupAllowCollapseOptions",void 0),e([u(),k("esri/widgets/Sketch/t9n/Sketch")],B.prototype,"messages",void 0),e([u(),k("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([u()],B.prototype,"snappingOptions",null),e([u()],B.prototype,"state",null),e([u({type:g})],B.prototype,"tooltipOptions",null),e([u({readOnly:!0})],B.prototype,"updateGraphics",null),e([u({type:y,nonNullable:!0})],B.prototype,"valueOptions",null),e([u()],B.prototype,"view",null),e([u({type:b}),P(["create","update","undo","redo"])],B.prototype,"viewModel",null),e([u({type:w,nonNullable:!0})],B.prototype,"visibleElements",void 0),e([u()],B.prototype,"useLegacyCreateTools",null),e([u()],B.prototype,"isUsingLegacyCreateTools",null),e([u()],B.prototype,"_effectiveAvailableCreateTools",null),e([u()],B.prototype,"_defaultViewModel",void 0),e([u()],B.prototype,"_activeCustomToolOptions",void 0),e([u()],B.prototype,"_calcitePopoverReferenceElement",void 0),e([u()],B.prototype,"_relativeLocation",void 0),e([u()],B.prototype,"_popoverOpen",void 0),B=e([h("esri.widgets.Sketch")],B);const G=B;export{G as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as i}from"../core/arrayUtils.js";import{deprecateWidget as o}from"../core/deprecate.js";import{handlesGroup as n}from"../core/handleUtils.js";import l from"../core/Logger.js";import{removeMaybe as s,destroyMaybe as r}from"../core/maybe.js";import{ignoreAbortErrors as a}from"../core/promiseUtils.js";import{watch as c,syncAndInitial as p,when as d}from"../core/reactiveUtils.js";import{property as h,subclass as u}from"../core/accessorSupport/decorators.js";import{symbolTypes as m}from"../symbols/support/typeUtils.js";import g from"../views/interactive/sketch/SketchLabelOptions.js";import v from"../views/interactive/sketch/SketchTooltipOptions.js";import f from"../views/interactive/sketch/SketchValueOptions.js";import _ from"./Widget.js";import y from"./Sketch/SketchViewModel.js";import b from"./Sketch/VisibleElements.js";import w from"./Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import S from"./support/SelectionToolbar.js";import C from"./support/SketchTooltipControls.js";import M from"./support/SnappingControls.js";import{tsx as O,messageBundle as P,vmEvent as k}from"./support/widget.js";import I from"./support/SelectionToolbar/VisibleElements.js";import L from"./support/SketchTooltipControls/VisibleElements.js";const R="esri-sketch",E="settings-menu-action",W={base:R,vertical:`${R}--vertical`,docked:`${R}-bar`,floating:`${R}-pad`,chipHorizontal:`${R}__selection-count-chip--horizontal`,chipVertical:`${R}__selection-count-chip--vertical`,chipVerticalSmall:`${R}__selection-count-chip--vertical--s`,popoverWrapper:`${R}__popover-wrapper`,simplificationWarningAction:`${R}__simplification-warning-action`,simplificationWarningLoader:`${R}__simplification-warning-loader`,simplificationWarningContent:`${R}__simplification-warning-content`,simplificationWarningDescription:`${R}__simplification-warning-description`,simplificationWarningCancelButton:`${R}__simplification-warning-cancel-button`},x={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"add-text"};let D=class extends _{constructor(e,t){super(e,t),this._selectionToolbar=null,this._viewModelHandlesGroup=null,this._popoverElement=null,this.availableCreateTools=["point","polyline","polygon","rectangle","circle"],this.customToolOptions=null,this.customActions=null,this.toolbarKind="floating",this.contextualToolLocation="separate",this.groupCollapsePriorities=null,this.groupAllowCollapseOptions=null,this.messages=null,this.messagesCommon=null,this.visibleElements=new b,this._defaultViewModel=null,this._activeCustomToolOptions=null,this._calcitePopoverReferenceElement=null,this._relativeLocation="top",this._popoverOpen=!1,this._simplificationPopoverOpen=!1,this._showSimplificationWarning=!1,this._simplificationPopoverElement=null,this._simplificationPopoverReferenceElement=null,!0!==e?.suppressDeprecationWarning&&(this.announceDeprecation=()=>{o(l.getLogger(this),"Sketch","arcgis-sketch",{version:"5.0"})}),this._activateCreateTool=this._activateCreateTool.bind(this),this.viewModel=e?.viewModel||(this._defaultViewModel=new y({creationMode:e?.creationMode??"continuous",useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type})),this.viewModel.pluginManager.sketch=this}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){const{layer:e,view:t}=this,i="2d"===t?.type,o=new S({persistSelection:!1,visibleElements:new I({chip:!1,lassoTool:i,operationTypeControls:!1,pan:!1,pointTool:!1,rectangleTool:i}),view:t,sources:e?[e]:null,scale:this.scale,disabled:"disabled"===this.state||this._hasLongRunningOperation});this.addHandles([c(()=>this.viewModel,e=>{this._viewModelHandlesGroup=s(this._viewModelHandlesGroup),e&&(this._viewModelHandlesGroup=n([e.on("create",()=>this.scheduleRender()),e.on("update",()=>this.scheduleRender()),e.on("delete",e=>this.emit("delete",e)),e.on("undo",()=>this.scheduleRender()),e.on("redo",()=>this.scheduleRender()),c(()=>e.layer,e=>{this._selectionToolbar&&(this._selectionToolbar.sources=e?[e]:null)}),c(()=>e.view,e=>{this._selectionToolbar&&(this._selectionToolbar.view=e)}),c(()=>e.state,()=>{this.notifyChange("state"),this._syncSelectionToolbarDisabledState()}),c(()=>e.geometrySimplificationInProgress,e=>{this._syncSelectionToolbarDisabledState(),e&&(this._showSimplificationWarning=!0)})]))},p),d(()=>o.activeOperation,()=>{this._clearCompletedSimplificationWarningForToolbarInteraction(),this.viewModel.cancel(),this._activeCustomToolOptions=null}),o.on("complete",e=>this._onSelectionOperationComplete(e)),c(()=>{const{view:e,visibleElements:{selectionTools:t}}=this;return{lassoTool:"3d"!==e?.type&&!!t?.["lasso-selection"],rectangleTool:"3d"!==e?.type&&!!t?.["rectangle-selection"]}},e=>{Object.assign(o.visibleElements,e)},p)]),this._selectionToolbar=o,this._syncSelectionToolbarDisabledState()}loadDependencies(){return T({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}destroy(){this._selectionToolbar?.destroy(),this._viewModelHandlesGroup=s(this._viewModelHandlesGroup)}get activeTool(){const e=this._selectionToolbar?.activeOperation;if(e)switch(e.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}const{availableCreateTools:t}=this,{activeTool:i,activeCreateToolDrawMode:o}=this.viewModel;return"polygon"===i&&"freehand"===o&&t?.includes("freehandPolygon")?"freehandPolygon":"polyline"===i&&"freehand"===o&&t?.includes("freehandPolyline")?"freehandPolyline":this.viewModel.activeTool}get activeTooltip(){return this.viewModel.activeTooltip}get createGraphic(){return this.viewModel.createGraphic}get creationMode(){return this.viewModel.creationMode}set creationMode(e){this.viewModel.creationMode=e}get defaultCreateOptions(){return this.viewModel.defaultCreateOptions}set defaultCreateOptions(e){this.viewModel.defaultCreateOptions=e}get defaultUpdateOptions(){return this.viewModel.defaultUpdateOptions}set defaultUpdateOptions(e){this.viewModel.defaultUpdateOptions=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}set layout(e){this._set("layout",e),this._selectionToolbar&&(this._selectionToolbar.layout=e)}get pointSymbol(){return this.viewModel.pointSymbol}set pointSymbol(e){this.viewModel.pointSymbol=e}get polygonSymbol(){return this.viewModel.polygonSymbol}set polygonSymbol(e){this.viewModel.polygonSymbol=e}get polylineSymbol(){return this.viewModel.polylineSymbol}set polylineSymbol(e){this.viewModel.polylineSymbol=e}get textSymbol(){return this.viewModel.textSymbol}set textSymbol(e){this.viewModel.textSymbol=e}set scale(e){this._set("scale",e),this._selectionToolbar&&(this._selectionToolbar.scale=e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get state(){return this._selectionToolbar?.activeOperation?"active":this.viewModel.state}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get updateGraphics(){return this.viewModel.updateGraphics}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}set viewModel(e){const t=this._get("viewModel");e!==t&&(t&&t===this._defaultViewModel&&r(t),t?.pluginManager?.sketch===this&&(t.pluginManager.sketch=null),this._set("viewModel",e),e.pluginManager.sketch=this)}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get _effectiveAvailableCreateTools(){if(this.viewModel.effectiveAvailablePlugins?.length)return this.viewModel.effectiveAvailablePlugins;const{availableCreateTools:e,view:t,visibleElements:i}=this,o=e?.filter(e=>!!i.createTools?.[e]);return"3d"===t?.type?o?.filter(e=>"multipoint"!==e):o}create(e,t,i){const o=i?.createOptions??t;return this._showSimplificationWarning&&!this._hasLongRunningOperation&&this._hideSimplificationWarning(),this._activeCustomToolOptions=i,a(this.viewModel.create(e,o))}update(e,t){return a(this.viewModel.update(e,t))}complete(){this.viewModel.complete()}cancel(){this._selectionToolbar?.cancel(),this.viewModel.cancel(),this._activeCustomToolOptions=null}undo(){this.viewModel.undo(),this.view?.focus()}redo(){this.viewModel.redo(),this.view?.focus()}delete(){this.viewModel.delete()}duplicate(){return this.viewModel.duplicate()}dismissFloatingElements(){this._popoverOpen=!1,this._simplificationPopoverOpen=!1}render(){const{toolbarKind:e,layout:t,scale:i}=this;return O("div",null,O("div",{classes:{[W.base]:!0,[W.floating]:"floating"===e,[W.docked]:"docked"===e,[W.vertical]:"vertical"===t}},O(w,{barStyle:e,layout:t,scale:i},this._renderSelectionSetItemGroupInline(),this._renderSelectionToolsOrBack(),this._renderCreateToolActionGroup(),this._renderUndoRedoMenuItemGroup(),this._renderSettingsMenuItemGroup(),this._renderSimplificationWarningItemGroupInline()),this._renderSelectionSetToolbar(),this._renderSimplificationWarningToolbar(),this._renderSettingsMenuPopover(),this._renderSimplificationWarningPopover()))}_renderSimplificationWarningToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSimplificationWarningItemGroup();return e?O(w,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSimplificationWarningItemGroupInline(){if("separate"!==this.contextualToolLocation)return this._renderSimplificationWarningItemGroup()}_renderSelectionToolsOrBack(){if(!this.viewModel.isUsingLegacyCreateTools&&this.viewModel.firstPluginWithSwappableLeaf)return this._renderBackButton();const e=this.customActions?.filter(e=>"selection-toolbar"===e.position);return O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionTools")??!0,"group-kind":"split-button",key:"selection-split-button",priority:this.groupCollapsePriorities?.get("selectionTools")??0},this._renderDefaultSelectionButton(),this._selectionToolbar?.render(),e?.map(e=>this._renderToolbarItem(e)))}_renderSettingsMenuPopover(){const{messagesCommon:e,snappingOptions:t,view:i,viewModel:o,visibleElements:n}=this;if(!this._calcitePopoverReferenceElement)return;const l={directionModePicker:n.directionModePicker,labelsToggle:n.labelsToggle,tooltipsToggle:n.tooltipsToggle},s="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return O("calcite-popover",{afterCreate:e=>this._popoverElement=e,closable:!0,heading:e.settings,key:`${this.id}-settings`,label:e.settings,open:this._popoverOpen,overlayPositioning:"fixed",placement:s,referenceElement:this._calcitePopoverReferenceElement,scale:this.scale,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforePopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},O("div",{class:W.popoverWrapper},Object.values(l).includes(!0)?O(C,{sketchOptions:o.sketchOptions,view:i,visibleElements:new L(l)}):void 0,n.snappingControls&&i&&t?O(M,{snappingManager:this.viewModel.snappingManager,snappingOptions:t,view:i,visibleElements:n.snappingControlsElements}):void 0))}_beforePopoverClose(e){e===this._popoverElement&&(this._popoverOpen=!1)}_renderSelectionSetToolbar(){if("separate"!==this.contextualToolLocation)return;const e=this._renderSelectionSetItemGroup();return e?.length?O(w,{barStyle:this.toolbarKind,layout:this.layout,scale:this.scale},e):void 0}_renderSimplificationWarningItemGroup(){if(!this._showSimplificationWarning)return;const{messages:e,viewModel:t}=this,{finalizingDrawingCompleteTitle:i,finalizingDrawingTitle:o}=e,n=t.geometrySimplificationInProgress,l=n?o:i,s=n?void 0:"exclamation-mark-triangle",r=`${this.id}__simplification-warning-action`;return O("div",{"group-kind":"measured-content-group",key:"simplification-warning-group",slot:"actions-end"},O("calcite-action",{active:this._simplificationPopoverOpen,afterCreate:e=>this._simplificationPopoverReferenceElement=e,afterRemoved:()=>this._simplificationPopoverReferenceElement=null,afterUpdate:e=>this._simplificationPopoverReferenceElement=e,class:W.simplificationWarningAction,"data-testid":"simplification-warning",disabled:"disabled"===this.state,icon:s,id:r,key:"simplification-warning",onclick:()=>this._simplificationPopoverOpen=!this._simplificationPopoverOpen,scale:this.scale,text:l,title:l},n?O("calcite-loader",{class:W.simplificationWarningLoader,inline:!0,label:e.finalizingDrawing,scale:this.scale,type:"indeterminate"}):void 0))}_renderSimplificationWarningPopover(){if(!this._showSimplificationWarning||!this._simplificationPopoverReferenceElement)return;const{messages:e,messagesCommon:t}=this,{finalizingDrawingCompleteHint:i,finalizingDrawingCompleteTitle:o,finalizingDrawingHint:n,finalizingDrawingTitle:l,simplificationDismiss:s}=e,r=this._hasLongRunningOperation,a=r?l:o,c="l"===this.scale?"l":"s",p="horizontal"===this.layout?"top"===this._relativeLocation?"bottom-end":"top-end":"right-end";return O("calcite-popover",{afterCreate:e=>this._simplificationPopoverElement=e,closable:!0,heading:a,key:`${this.id}-simplification`,label:a,open:this._simplificationPopoverOpen,overlayPositioning:"fixed",placement:p,referenceElement:this._simplificationPopoverReferenceElement,scale:c,topLayerDisabled:this.topLayerDisabled,onCalcitePopoverBeforeClose:e=>this._beforeSimplificationPopoverClose(e.target),onCalcitePopoverBeforeOpen:e=>this._remeasurePopoverSizes(e.currentTarget,this._simplificationPopoverReferenceElement),onCalcitePopoverClose:e=>this._refocusOnView(e.target)},O("div",{class:W.simplificationWarningContent},O("div",{class:W.simplificationWarningDescription},r?n:i),r?O("calcite-button",{class:W.simplificationWarningCancelButton,iconStart:"trash",kind:"danger",label:t.cancel,onclick:()=>this.cancel(),scale:this.scale,width:"full"},t.cancel):O("calcite-button",{appearance:"outline",class:W.simplificationWarningCancelButton,iconStart:"check-circle",kind:"brand",label:s,onclick:()=>this._hideSimplificationWarning(),scale:this.scale,width:"full"},s)))}_renderSelectionSetItemGroupInline(){return"separate"===this.contextualToolLocation?[]:this._renderSelectionSetItemGroup()}_renderUndoRedoMenuItemGroup(){return O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("undoRedo")??!0,"group-kind":"split-button",key:"undo-redo-menu",priority:this.groupCollapsePriorities?.get("undoRedo")??10,slot:"actions-end"},this._renderUndoButton(),this._renderRedoButton())}_renderSettingsMenuItemGroup(){const e=[],t=[];this.customActions?.forEach(i=>{"settings-before"===i.position?t.push(i):"settings-after"===i.position&&e.push(i)});const o=[...t.map(e=>this._renderToolbarItem(e)),this._renderSettingsMenuButton(),...e.map(e=>this._renderToolbarItem(e))].filter(i);if(o.length)return O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("settings")??!1,"group-kind":"overflow-group",key:"settings-menu",priority:this.groupCollapsePriorities?.get("settings")??1e3,slot:"actions-end"},o)}_renderSelectionSetItemGroup(){if(!this.updateGraphics.length)return[];const e="inline-end"===this.contextualToolLocation?"actions-end":void 0,t=this.customActions?.filter(e=>"before-selection-set"===e.position),i=this.customActions?.filter(e=>"after-selection-set"===e.position),o=this.groupCollapsePriorities?.get("selectionSet")??100;return[O("div",{"group-kind":"measured-content",key:"selection-count-chip-group",priority:o,slot:e},this._renderFeatureCountChip()),O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("selectionSet")??!1,"group-kind":"overflow-group",key:"selection-set-tool-group",priority:o,slot:e},t?.map(e=>this._renderToolbarItem(e)),this._renderDuplicateButton(),this._renderDeleteButton(),i?.map(e=>this._renderToolbarItem(e)))]}_renderDefaultSelectionButton(){if(!this.viewModel.updateOnGraphicClick)return[];const{messages:e,state:t}=this;return this._renderToolbarItem({id:"pointer-select",text:e.selectFeature,icon:"cursor",onclick:this._activateDefaultSelectTool,active:"ready"===t})}_renderBackButton(){const{viewModel:e,isUsingLegacyCreateTools:t}=this;if(!t&&e.multiplePluginsActive&&e.firstPluginWithSwappableLeaf&&e.rootPlugins&&(!(e.rootPlugins.length<2&&e.rootPlugins.includes(e.firstPluginWithSwappableLeaf))||this.visibleElements.singlePluginBackButton))return O("div",{"allow-collapse":!1,"group-kind":"overflow-group",key:"back-button-group"},O("calcite-action",{disabled:"disabled"===this.state||this._hasLongRunningOperation,icon:"chevron-left",onclick:()=>{this.viewModel?.cancel()},scale:this.scale,text:this.messagesCommon.back}))}_renderCreateToolActionGroup(){const e=this.viewModel.firstPluginWithSwappableLeaf?[]:this.customToolOptions?.flatMap(e=>this._renderCustomToolItem(e))??[],t=this._effectiveAvailableCreateTools,i=t?.filter(e=>"string"==typeof e),o=i?.map(e=>this._renderCreateToolItem(e)),n=t?.filter(e=>"string"!=typeof e).map(e=>this._renderCreateToolItem(e));return[o?.length||e?.length||n?.length?O("div",{"allow-collapse":this.groupAllowCollapseOptions?.get("createTools")??!0,"group-kind":"overflow-group",key:"create-tools-group",priority:this.groupCollapsePriorities?.get("createTools")??100},o,e,n):void 0]}_renderCreateToolItem(e){return"string"==typeof e?this._renderBuiltInCreateToolItem(e):this._renderDrawToolPluginItem(e)}_renderDrawToolPluginItem(e){const{icon:t,localizationKey:i,uniqueId:o,hidden:n}=e;if(n)return[];const l=this.messages.digitizers,s=l?.[i]??i,r=!this._activeCustomToolOptions&&this.viewModel.drawTool?.pluginStack.some(e=>!e.configuration?.hidden&&e.configuration?.uniqueId===o);return this._renderToolbarItem({id:`${i}-button`,text:s,icon:t,onclick:()=>this._activatePlugin([e]),active:r})}_renderBuiltInCreateToolItem(e){return this._renderToolbarItem({id:`${e}-button`,text:this.messages.draw[e],icon:x[e],onclick:()=>this._activateCreateTool(e),active:this.activeTool===e&&!this._activeCustomToolOptions})}_renderCustomToolItem(e){const{toolKey:t}=e;return this._renderToolbarItem({id:`custom-${e.toolKey}`,text:e.label,icon:e.icon,onclick:()=>this._activateCreateTool(e.toolName,null,e),active:this._activeCustomToolOptions?.toolKey===t})}_renderUndoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"undo-button",text:this.messages.undo,icon:"undo",disabled:!this.viewModel.canUndo(),onclick:this.undo,flipRTL:!0}):[]}_renderRedoButton(){return this.visibleElements.undoRedoMenu?this._renderToolbarItem({id:"redo-button",text:this.messages.redo,icon:"redo",disabled:!this.viewModel.canRedo(),onclick:this.redo,flipRTL:!0}):[]}_renderSettingsMenuButton(){return this.visibleElements.settingsMenu?this._renderToolbarItem({id:E,text:this.messagesCommon.settings,icon:"gear",active:this._popoverOpen,onclick:()=>this._popoverOpen=!this._popoverOpen,afterCreate:e=>this._calcitePopoverReferenceElement=e,afterUpdate:e=>this._calcitePopoverReferenceElement=e,afterRemoved:()=>this._calcitePopoverReferenceElement=null}):[]}_renderFeatureCountChip(){if(!this.visibleElements.selectionCountLabel)return[];const{layout:e,messages:i,scale:o,id:n,updateGraphics:{length:l}}=this,s=t(i.selectedCount,{count:l}),r="l"===o?999:99,a=l>r?t(i.selectedCountTruncated,{truncated:r}):l,c="l"!==o&&"vertical"===e,p=c?`${n}-selection-chip-small`:`${n}-selection-chip`;return[c?O("span",{classes:{[W.chipVertical]:!0,[W.chipVerticalSmall]:"s"===this.scale},id:p,tabIndex:0,title:s},a):O("calcite-chip",{appearance:"outline",class:"horizontal"===e?W.chipHorizontal:W.chipVertical,id:p,kind:"brand",label:s,scale:"l"===o?"m":"s",tabIndex:0,title:"vertical"===e?s:void 0},"vertical"===e?a:s)]}_renderDuplicateButton(){if(!this.visibleElements.duplicateButton)return[];const{messages:e}=this;return this._renderToolbarItem({id:"duplicate",text:this.updateGraphics.length>1?e.duplicateFeatures:e.duplicateFeature,icon:"copy",onclick:this._onDuplicateSelect})}_renderDeleteButton(){if(!this.visibleElements.deleteButton)return[];const{messages:e}=this,t=this.updateGraphics.length>1?e.deleteFeatures:e.deleteFeature;return this._renderToolbarItem({id:"delete",text:t,icon:"trash",onclick:this.delete})}_renderToolbarItem({id:e,text:t,icon:i,disabled:o,onclick:n,active:l,flipRTL:s,afterCreate:r,afterUpdate:a,afterRemoved:c}){const p=`${this.id}-${e}`,d=n?()=>{e!==E&&this._clearCompletedSimplificationWarningForToolbarInteraction(),n.call(this)}:void 0;return[O("calcite-action",{active:l,afterCreate:r,afterRemoved:c,afterUpdate:a,bind:this,"data-testid":e,disabled:o||"disabled"===this.state||this._hasLongRunningOperation,icon:i,iconFlipRtl:s??!1,id:p,key:e,onclick:d,scale:this.scale,text:t,title:t})]}get _hasLongRunningOperation(){return this.viewModel.geometrySimplificationInProgress}_remeasurePopoverSizes(e,t=this._calcitePopoverReferenceElement){try{const i=e.parentElement,o=this?.view?.container?.getBoundingClientRect(),n=i?.style;if(!(i&&o&&n&&this.view?.container?.contains(i)&&t))return;const{bottom:l,top:s}=t.getBoundingClientRect();if("horizontal"===this.layout){const e=l<o.height/2;e!==("top"===this._relativeLocation)&&(this._relativeLocation=e?"top":"bottom"),e?(n?.setProperty("--sketch-view-height-offset",l-o.top+"px"),n?.setProperty("--sketch-view-margin-offset","30px")):(n?.setProperty("--sketch-view-height-offset",o.bottom-s+"px"),n?.setProperty("--sketch-view-margin-offset","15px"))}else"vertical"===this.layout&&(n.setProperty("--sketch-view-height-offset","15px"),n.setProperty("--sketch-view-margin-offset","15px"));const r=e.shadowRoot?.querySelector("div.header")?.getBoundingClientRect().height;n.setProperty("--sketch-popover-header-offset",`${r}px`)}catch(i){l.getLogger(this.declaredClass).warnOnce("Sketch failed to lay out settings menu.",i)}}_activateCreateTool(e,t,i){const o=this._activeCustomToolOptions;if(i||o){if(i?.toolKey===o?.toolKey)return void this.cancel()}else if(this.activeTool===e)return void this.cancel();this._selectionToolbar?.cancel(),this.create(e,t,i)}_activatePlugin(e){this._selectionToolbar?.cancel(),this.viewModel.firstPluginWithSwappableLeaf?(this.viewModel.drawTool?.replaceLeaf(e),this.view?.ready&&this.view.focus()):this._activateCreateTool(e)}_onDuplicateSelect(){const e=this.duplicate(),t=this.viewModel.activeTool;"transform"!==t&&"reshape"!==t||this.update(e,{tool:t})}_onSelectionOperationComplete(e){const{viewModel:{defaultUpdateOptions:t}}=this,{selection:i}=e;if(!e.aborted&&i.length){const e=t.tool,o=i.length>1&&"reshape"===e?"transform":e;this.update(i,{...t,tool:o})}this.notifyChange("state")}_activateDefaultSelectTool(){this.cancel(),this.view?.focus()}_refocusOnView(e){!this.activeTool||e!==this._popoverElement&&e!==this._simplificationPopoverElement||this.view?.focus()}_beforeSimplificationPopoverClose(e){e===this._simplificationPopoverElement&&(this._simplificationPopoverOpen=!1)}_hideSimplificationWarning(){this._showSimplificationWarning=!1,this._simplificationPopoverOpen=!1}_clearCompletedSimplificationWarningForToolbarInteraction(){this._hasLongRunningOperation||this._hideSimplificationWarning()}_syncSelectionToolbarDisabledState(){this._selectionToolbar&&(this._selectionToolbar.disabled="disabled"===this.state||this._hasLongRunningOperation)}};e([h()],D.prototype,"activeTool",null),e([h({readOnly:!0})],D.prototype,"activeTooltip",null),e([h({cast:e=>{if(!e?.length)return null;const t=new Set(["point","polyline","polygon","rectangle","circle","multipoint","freehandPolyline","freehandPolygon","mesh","text"]);return e.filter(e=>t.has(e))}})],D.prototype,"availableCreateTools",void 0),e([h({readOnly:!0})],D.prototype,"createGraphic",null),e([h()],D.prototype,"creationMode",null),e([h()],D.prototype,"customToolOptions",void 0),e([h()],D.prototype,"customActions",void 0),e([h()],D.prototype,"defaultCreateOptions",null),e([h()],D.prototype,"defaultUpdateOptions",null),e([h()],D.prototype,"icon",null),e([h()],D.prototype,"label",null),e([h({type:g})],D.prototype,"labelOptions",null),e([h()],D.prototype,"layer",null),e([h({type:["horizontal","vertical"],value:"horizontal"})],D.prototype,"layout",null),e([h({types:m})],D.prototype,"pointSymbol",null),e([h({types:m})],D.prototype,"polygonSymbol",null),e([h({types:m})],D.prototype,"polylineSymbol",null),e([h()],D.prototype,"textSymbol",null),e([h({value:"m"})],D.prototype,"scale",null),e([h()],D.prototype,"toolbarKind",void 0),e([h()],D.prototype,"contextualToolLocation",void 0),e([h()],D.prototype,"groupCollapsePriorities",void 0),e([h()],D.prototype,"groupAllowCollapseOptions",void 0),e([h(),P("esri/widgets/Sketch/t9n/Sketch")],D.prototype,"messages",void 0),e([h(),P("esri/t9n/common")],D.prototype,"messagesCommon",void 0),e([h()],D.prototype,"snappingOptions",null),e([h()],D.prototype,"state",null),e([h({type:v})],D.prototype,"tooltipOptions",null),e([h({readOnly:!0})],D.prototype,"updateGraphics",null),e([h({type:f,nonNullable:!0})],D.prototype,"valueOptions",null),e([h()],D.prototype,"view",null),e([h({type:y}),k(["create","update","undo","redo"])],D.prototype,"viewModel",null),e([h({type:b,nonNullable:!0})],D.prototype,"visibleElements",void 0),e([h()],D.prototype,"useLegacyCreateTools",null),e([h()],D.prototype,"isUsingLegacyCreateTools",null),e([h()],D.prototype,"_effectiveAvailableCreateTools",null),e([h()],D.prototype,"_defaultViewModel",void 0),e([h()],D.prototype,"_activeCustomToolOptions",void 0),e([h()],D.prototype,"_calcitePopoverReferenceElement",void 0),e([h()],D.prototype,"_hasLongRunningOperation",null),e([h()],D.prototype,"_relativeLocation",void 0),e([h()],D.prototype,"_popoverOpen",void 0),e([h()],D.prototype,"_simplificationPopoverOpen",void 0),e([h()],D.prototype,"_showSimplificationWarning",void 0),e([h()],D.prototype,"_simplificationPopoverElement",void 0),e([h()],D.prototype,"_simplificationPopoverReferenceElement",void 0),D=e([u("esri.widgets.Sketch")],D);const B=D;export{B as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1550,1666,1948,2722,3931,5611,6061,6312,6861,7992,8125,9169,9285],{61691(t,e,n){n.d(e,{G:()=>r});class r{*[Symbol.iterator](){let t=this.next();for(;t;)yield t,t=this.next()}}},98783(t,e,n){n.d(e,{O:()=>o});var r=n(61691),s=n(55537),i=n(76061),a=n(15756);class o{getOperatorType(){return 10104}accelerateGeometry(t,e,n){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}isSimple(t,e,n,r,s){return 5===(0,a.s)(t,e,n,r,s)}executeMany(t,e,n,r){return new u(t,e,n,r)}execute(t,e,n,r){const a=new i.S([t]),o=this.executeMany(a,e,n,r).next();return o||(0,s.d)("null output"),o}}class u extends r.G{constructor(t,e,n,r){super(),t||(0,s.a)(""),this.m_progressTracker=r,this.m_bForceSimplify=n,this.m_index=-1,this.m_inputGeometryCursor=t,this.m_spatialReference=e}next(){const t=this.m_inputGeometryCursor.next();return t?((0,s.c)(t),this.m_index=this.m_inputGeometryCursor.getGeometryID(),this.simplify(t)):null}getGeometryID(){return this.m_index}tock(){return!1}getRank(){return 1}simplify(t){return t||(0,s.a)(""),(0,a.t)(t,this.m_spatialReference,this.m_bForceSimplify,this.m_progressTracker)}}},76061(t,e,n){n.d(e,{S:()=>s});var r=n(61691);class s extends r.G{constructor(t){super(),this.m_iGeom=-1,this.m_aGeoms=t?t.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const t=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,t}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},9093(t,e,n){function r(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function s(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}n.d(e,{o8:()=>s,vt:()=>r,zK:()=>i});const i=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:i,clone:s,create:r,fromValues:function(t,e,n,r,s,i,a,o,u,h,c,l,f,m,g,x){return[t,e,n,r,s,i,a,o,u,h,c,l,f,m,g,x]}},Symbol.toStringTag,{value:"Module"}))},51850(t,e,n){function r(){return[0,0,0]}function s(t){return[t[0],t[1],t[2]]}function i(t,e,n){return[t,e,n]}function a(t,e,n){return[t,e,n]}function o(t,e=[0,0,0]){const n=Math.min(3,t.length);for(let r=0;r<n;++r)e[r]=t[r];return e}function u(){return[0,0,0]}function h(){return i(1,1,1)}function c(){return i(1,0,0)}function l(){return i(0,1,0)}function f(){return i(0,0,1)}n.d(e,{CN:()=>a,Cb:()=>y,Cw:()=>x,JP:()=>p,S:()=>h,Ul:()=>u,Un:()=>g,ci:()=>o,fA:()=>i,o8:()=>s,uY:()=>m,vt:()=>r});const m=[0,0,0],g=h(),x=c(),p=l(),y=f();Object.freeze(Object.defineProperty({__proto__:null,ONES:g,UNIT_X:x,UNIT_Y:p,UNIT_Z:y,ZEROS:m,clone:s,create:r,freeze:a,fromArray:o,fromValues:i,ones:h,unitX:c,unitY:l,unitZ:f,zeros:u},Symbol.toStringTag,{value:"Module"}))},35522(t,e,n){n.d(e,{$A:()=>b,Bw:()=>i,C:()=>a,Cc:()=>I,DI:()=>E,Il:()=>L,Io:()=>d,Ln:()=>y,Om:()=>P,Qr:()=>l,Re:()=>h,S8:()=>_,T9:()=>x,WQ:()=>u,Z0:()=>S,_S:()=>m,aI:()=>F,ei:()=>A,fw:()=>V,g7:()=>Z,gL:()=>O,hG:()=>M,hZ:()=>o,hs:()=>p,jb:()=>G,jk:()=>g,lo:()=>k,lw:()=>c,m3:()=>v,oW:()=>N,t2:()=>Y,tn:()=>f,uE:()=>B,xg:()=>z,ze:()=>C});var r=n(51850),s=n(34304);function i(t){const e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function o(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function u(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function h(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function c(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function l(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function f(t,e){return t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t}function m(t,e){return t[0]=Math.sign(e[0]),t[1]=Math.sign(e[1]),t[2]=Math.sign(e[2]),t}function g(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function x(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function p(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function y(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function d(t,e){const n=e[0]-t[0],r=e[1]-t[1],s=e[2]-t[2];return Math.sqrt(n*n+r*r+s*s)}function M(t,e){const n=e[0]-t[0],r=e[1]-t[1],s=e[2]-t[2];return n*n+r*r+s*s}function v(t){const e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function C(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function E(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function _(t,e){const n=e[0],r=e[1],s=e[2];let i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i),t}function P(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function b(t,e,n){const r=e[0],s=e[1],i=e[2],a=n[0],o=n[1],u=n[2];return t[0]=s*u-i*o,t[1]=i*a-r*u,t[2]=r*o-s*a,t}function I(t,e,n,r){const s=e[0],i=e[1],a=e[2];return t[0]=s+r*(n[0]-s),t[1]=i+r*(n[1]-i),t[2]=a+r*(n[2]-a),t}function S(t,e,n){const r=e[0],s=e[1],i=e[2];return t[0]=n[0]*r+n[4]*s+n[8]*i+n[12],t[1]=n[1]*r+n[5]*s+n[9]*i+n[13],t[2]=n[2]*r+n[6]*s+n[10]*i+n[14],t}function A(t,e,n){const r=e[0],s=e[1],i=e[2];return t[0]=r*n[0]+s*n[3]+i*n[6],t[1]=r*n[1]+s*n[4]+i*n[7],t[2]=r*n[2]+s*n[5]+i*n[8],t}function O(t,e,n){return V(t,e,n[0],n[1],n[2],n[3])}function V(t,e,n,r,s,i){const a=e[0],o=e[1],u=e[2],h=r*u-s*o,c=s*a-n*u,l=n*o-r*a,f=r*l-s*c,m=s*h-n*l,g=n*c-r*h,x=2*i;return t[0]=a+h*x+2*f,t[1]=o+c*x+2*m,t[2]=u+l*x+2*g,t}function Z(t,e){_(w,t),_(R,e);const n=P(w,R);return n>1?0:n<-1?Math.PI:Math.acos(n)}const w=(0,r.vt)(),R=(0,r.vt)();function Y(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function F(t,e){if(t===e)return!0;const n=t[0],r=t[1],i=t[2],a=e[0],o=e[1],u=e[2],h=(0,s.FD)();return Math.abs(n-a)<=h*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=h*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-u)<=h*Math.max(1,Math.abs(i),Math.abs(u))}function N(t,e,n){const r=n[0]-e[0],s=n[1]-e[1],i=n[2]-e[2];let a=r*r+s*s+i*i;return a>0?(a=1/Math.sqrt(a),t[0]=r*a,t[1]=s*a,t[2]=i*a,t):(t[0]=0,t[1]=0,t[2]=0,t)}const G=h,T=c,X=l,z=d,k=M,L=i,B=v;Object.freeze(Object.defineProperty({__proto__:null,abs:f,add:u,angle:Z,bezier:function(t,e,n,r,s,i){const a=1-i,o=a*a,u=i*i,h=o*a,c=3*i*o,l=3*u*a,f=u*i;return t[0]=e[0]*h+n[0]*c+r[0]*l+s[0]*f,t[1]=e[1]*h+n[1]*c+r[1]*l+s[1]*f,t[2]=e[2]*h+n[2]*c+r[2]*l+s[2]*f,t},ceil:function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},clamp:function(t,e=0,n=1){return t[0]=Math.min(Math.max(t[0],e),n),t[1]=Math.min(Math.max(t[1],e),n),t[2]=Math.min(Math.max(t[2],e),n),t},copy:a,cross:b,crossAndNormalize:function(t,e,n){const r=e[0],s=e[1],i=e[2],a=n[0],o=n[1],u=n[2],h=s*u-i*o,c=i*a-r*u,l=r*o-s*a,f=Math.sqrt(h*h+c*c+l*l);return t[0]=h/f,t[1]=c/f,t[2]=l/f,t},direction:N,dist:z,distance:d,div:X,divide:l,dot:P,equals:F,exactEquals:Y,floor:function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},hermite:function(t,e,n,r,s,i){const a=i*i,o=a*(2*i-3)+1,u=a*(i-2)+i,h=a*(i-1),c=a*(3-2*i);return t[0]=e[0]*o+n[0]*u+r[0]*h+s[0]*c,t[1]=e[1]*o+n[1]*u+r[1]*h+s[1]*c,t[2]=e[2]*o+n[2]*u+r[2]*h+s[2]*c,t},inverse:E,len:L,length:i,lerp:I,max:x,min:g,mul:T,multiply:c,negate:C,normalize:_,random:function(t,e=1){const n=s.Ov,r=2*n()*Math.PI,i=2*n()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},rotateX:function(t,e,n,r){const s=[],i=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t},rotateY:function(t,e,n,r){const s=[],i=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t},rotateZ:function(t,e,n,r){const s=[],i=[];return s[0]=e[0]-n[0],s[1]=e[1]-n[1],s[2]=e[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],t[0]=i[0]+n[0],t[1]=i[1]+n[1],t[2]=i[2]+n[2],t},round:function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},scale:p,scaleAndAdd:y,set:o,sign:m,sqrDist:k,sqrLen:B,squaredDistance:M,squaredLength:v,str:function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},sub:G,subtract:h,transformMat3:A,transformMat4:S,transformQuat:O,transformQuatValues:V},Symbol.toStringTag,{value:"Module"}))},69397(t,e,n){n.d(e,{Qf:()=>u,Qh:()=>a,RS:()=>s,Ul:()=>m,i5:()=>f,lM:()=>i,qK:()=>c});var r=n(34275);const s=16;function i(t){if(!t)return 0;let e=c;for(const n in t)t.hasOwnProperty(n)&&(e+=o(t[n],!1));return e}function a(t){if(!t)return 0;if("number"==typeof t[0])return u(t);if(Array.isArray(t))return function(t){const e=t.length;if(0===e||"number"==typeof t[0])return h(t,8);let n=l;for(let r=0;r<e;r++)n+=o(t[r]);return n}(t);let e=c;for(const n in t)t.hasOwnProperty(n)&&(e+=o(t[n]));return e}function o(t,e=!0){switch(typeof t){case"object":return e?a(t):c;case"string":return function(t){return 32+t.length}(t);case"number":return s;case"boolean":return 4;default:return 8}}function u(...t){return t.reduce((t,e)=>t+(e?(0,r.iu)(e)?e.byteLength+f:Array.isArray(e)?h(e,s):0:0),0)}function h(t,e){return l+t.length*e}const c=32,l=16,f=145,m=64},87992(t,e,n){n.d(e,{JR:()=>b,ME:()=>E,MY:()=>I,NO:()=>C,Nh:()=>P,V2:()=>Z,_s:()=>w,e6:()=>Y,gh:()=>_,tr:()=>N,uX:()=>p});var r=n(5482),s=n(69397),i=n(16930),a=(n(70328),n(19419)),o=n(60408),u=n(21325),h=n(513),c=n(50954),l=n(79567),f=n(52006),m=n(49663),g=n(46068),x=n(92722);class p{constructor({type:t,spatialReference:e,vertexCount:n,vertexXY:r,vertexZ:s,vertexM:i,partCount:a,partOffsets:o,partFlags:u,segmentFlags:h,segmentIndices:c,segmentParams:l,segmentCountArc:f,segmentCountBezier:m}){this.segmentCountArc=0,this.segmentCountBezier=0,this.type=t,this.spatialReference=e,this.vertexCount=n,this.vertexXY=r,this.vertexZ=s,this.vertexM=i,this.partCount=a,this.partOffsets=o,this.partFlags=u,this.segmentFlags=h,this.segmentIndices=c,this.segmentParams=l,this.segmentCountArc=f,this.segmentCountBezier=m}get segmentParamCount(){return 10*this.segmentCountArc+4*this.segmentCountBezier}get segmentCountLine(){const{segmentCount:t,segmentCountArc:e,segmentCountBezier:n}=this;return t&&t-e-n}get segmentCount(){return"polyline"===this.type?this.vertexCount-this.partCount:"polygon"===this.type?this.vertexCount:0}get hasZ(){return null!=this.vertexZ}get hasM(){return null!=this.vertexM}hasCurves(){return null!=this.segmentFlags}isMultipart(){return"polyline"===this.type||"polygon"===this.type}get usedMemory(){function t(t){return t?s.Ul+t.byteLength:0}return t(this.vertexXY)+t(this.vertexZ)+t(this.vertexM)+t(this.partOffsets)+t(this.partFlags)+t(this.segmentFlags)+t(this.segmentIndices)+t(this.segmentParams)}clone(){const{type:t,vertexCount:e,partCount:n,hasZ:r,hasM:s,segmentCountArc:i,segmentCountBezier:a}=this,o=Z(t,e,n,r,s,this.hasCurves(),i,a);o.spatialReference=this.spatialReference;const{vertexXY:u,vertexZ:h,vertexM:c}=this;if(o.vertexXY.set(u.subarray(0,2*e),0),o.vertexZ?.set(h.subarray(0,e),0),o.vertexM?.set(c.subarray(0,e),0),this.isMultipart()){const{partOffsets:t,partFlags:e}=this;o.partFlags.set(e.subarray(0,n+1)),o.partOffsets.set(t.subarray(0,n+1))}if(this.hasCurves()){const{segmentFlags:t,segmentIndices:n,segmentParams:r,segmentParamCount:s}=this;o.segmentFlags.set(t.subarray(0,e),0),o.segmentIndices.set(n.subarray(0,e),0),o.segmentParams.set(r.subarray(0,s),0)}return o}equals(t){return this.equalsWithinTolerance(t,0)}equalsWithinTolerance(t,e){if(null==t)return!1;if(this===t)return!0;if(!(0,u.aI)(this.spatialReference,t.spatialReference))return!1;if(this.vertexCount!==t.vertexCount||this.partCount!==t.partCount)return!1;if(this.hasZ!==t.hasZ||this.hasM!==t.hasM)return!1;if(this.hasCurves()!==t.hasCurves()||this.segmentCountArc!==t.segmentCountArc||this.segmentCountBezier!==t.segmentCountBezier)return!1;const n=0===e?(t,e)=>t!==e||isNaN(t)!==isNaN(e):(t,n)=>Math.abs(t-n)>e||isNaN(t)!==isNaN(n);for(let e=0;e<this.vertexCount;++e)if(n(this.vertexXY[2*e],t.vertexXY[2*e])||n(this.vertexXY[2*e+1],t.vertexXY[2*e+1]))return!1;if(this.hasZ)for(let e=0;e<this.vertexCount;++e)if(n(this.vertexZ[e],t.vertexZ[e]))return!1;if(this.hasM)for(let e=0;e<this.vertexCount;++e)if(n(this.vertexM[e],t.vertexM[e]))return!1;for(let e=0;e<this.partCount;++e)if(this.partFlags[e]!==t.partFlags[e]||this.partOffsets[e]!==t.partOffsets[e])return!1;if(this.hasCurves()){for(let e=0;e<this.vertexCount;++e)if(this.segmentFlags[e]!==t.segmentFlags[e]||this.segmentIndices[e]!==t.segmentIndices[e])return!1;for(let e=0;e<this.segmentParamCount;++e)if(n(this.segmentParams[e],t.segmentParams[e]))return!1}return!0}get parts(){return this.isMultipart()?new y(this):[][Symbol.iterator]()}}class y{constructor(t){this.geometry=t,this.value=new d(t)}get done(){return this.value.index>=this.geometry.partCount}next(){return++this.value.index,this}[Symbol.iterator](){return this}}class d{constructor(t){this.geometry=t,this.index=-1,this._readVertex=O(t),this._segments=new M(this)}get segments(){return this._segments.reset(),this._segments}get startVertex(){return this._readVertex(this.geometry.partOffsets[this.index])}get vertexCount(){const t=this.geometry.partOffsets;return t[this.index+1]-t[this.index]}}class M{constructor(t){this._part=t,this._partStart=0,this._partEnd=0,this._isPolygon="polygon"===t.geometry.type,this.value=new v(t.geometry)}get done(){return this.value.indexOfStartVertex>this._partEnd}next(){++this.value.indexOfStartVertex;const t=this.value.indexOfStartVertex>=this._partEnd;return this.value.indexOfEndVertex=t&&this._isPolygon?this._partStart:this.value.indexOfStartVertex+1,this}[Symbol.iterator](){return this}reset(){const{index:t}=this._part,e=this._part.geometry.partOffsets;this._partStart=e[t],this._partEnd=e[t+1]-(this._isPolygon?1:2),this.value.indexOfStartVertex=this._partStart-1}}class v{constructor(t){this.geometry=t,this.indexOfStartVertex=-1,this.indexOfEndVertex=-1,this._readVertex=O(t)}get xStart(){return this.geometry.vertexXY[2*this.indexOfStartVertex]}get yStart(){return this.geometry.vertexXY[2*this.indexOfStartVertex+1]}get zStart(){return this.geometry.vertexZ[this.indexOfStartVertex]}get mStart(){return this.geometry.vertexM[this.indexOfStartVertex]}get xEnd(){return this.geometry.vertexXY[2*this.indexOfEndVertex]}get yEnd(){return this.geometry.vertexXY[2*this.indexOfEndVertex+1]}get zEnd(){return this.geometry.vertexZ[this.indexOfEndVertex]}get mEnd(){return this.geometry.vertexM[this.indexOfEndVertex]}get start(){return this._readVertex(this.indexOfStartVertex)}get end(){return this._readVertex(this.indexOfEndVertex)}get curve(){const t=this.geometry.segmentFlags?.[this.indexOfStartVertex]??1;if(1===t)return this.end;const e=this.geometry.segmentParams;let n=this.geometry.segmentIndices[this.indexOfStartVertex];if(2===t){const t=e[n++],r=e[n++],s=e[n++],i=e[n++];return{b:[this.end,[t,r],[s,i]]}}const r=e[n++],s=e[n++],i=e[n++],a=e[n++],o=e[n++],u=e[n++];n++,n++;const h=e[n++],c=e[n++];if(!Boolean(4&r)&&1===i)return{c:[this.end,[h,c]]};const l=2&r?0:1,f=1&r?0:1;return{a:[this.end,[o,u],l,f,a,s,i]}}}function C(t,e){const n={stack:[],error:void 0,hasError:!1};try{return e??=(0,a.Ie)(),(0,r.mS)(n,new S(t,["vertexZ","vertexM","spatialReference"]),!1),(0,a.bx)(e,function(t){let e;const{vertexCount:n,vertexXY:s,vertexZ:i,vertexM:o}=t,u=A(t);if(t.hasCurves()){const n={stack:[],error:void 0,hasError:!1};try{(0,r.mS)(n,new S(t,["vertexZ","vertexM"]),!1);const s=(0,a.Ie)();for(const e of t.parts){let t=e.startVertex;for(const{curve:n}of e.segments)(0,l.e)(s,t,n),t=(0,f.yP)(n)}const[i,o,h,c]=s;e={xmin:i,ymin:o,xmax:h,ymax:c,spatialReference:u}}catch(t){n.error=t,n.hasError=!0}finally{(0,r.hk)(n)}}else{let t,r,i,a;t=r=1/0,i=a=-1/0;for(let e=0;e<n;++e){const n=s[2*e],o=s[2*e+1];t=Math.min(t,n),i=Math.max(i,n),r=Math.min(r,o),a=Math.max(a,o)}e={xmin:t,ymin:r,xmax:i,ymax:a,spatialReference:u}}if(i){let t=1/0,n=-1/0;for(const e of i)t=Math.min(t,e),n=Math.max(n,e);e.zmin=t,e.zmax=n}if(o){let t=1/0,n=-1/0;for(const e of o)t=Math.min(t,e),n=Math.max(n,e);e.mmin=t,e.mmax=n}return e}(t)),e}catch(t){n.error=t,n.hasError=!0}finally{(0,r.hk)(n)}}function E(t){let e,n,r;if((0,o.fT)(t)){r="point";const{x:s,y:i,z:a,m:o}=t,u=[s,i];null!=a&&u.push(a),null!=o&&u.push(o),n=[[u]],e=1}else(0,o.U9)(t)?(r="multipoint",n=[t.points],e=t.points.length):(0,o.Rg)(t)?(r="polyline",n=t.curvePaths??t.paths,e=n.reduce((t,e)=>t+e.length,0)):(r="polygon",n=t.curveRings??t.rings,e=n.reduce((t,e)=>(0===e.length||(t+=e.length,V(e[0],(0,f.yP)(e.at(-1)))&&--t),t),0));const s=Z(r,e,r.includes("point")?0:n.length,(0,o.Pv)(t),(0,o.W0)(t),(0,f.Ed)(t)),{hasZ:i,hasM:a,vertexXY:u,vertexZ:h,vertexM:c}=s;function l(t){u[2*g]=t[0],u[2*g+1]=t[1],i&&(h[g]=t[2]),a&&(c[g]=t[m]),++g}s.spatialReference=t.spatialReference??void 0;const m=s.hasZ?3:2;let g=0;if(!s.isMultipart()){if(!i&&!a){for(const[t,e]of n[0])u[2*g]=t,u[2*g+1]=e,++g;return s}for(const t of n[0])l(t);return s}const x="polygon"===r,{partOffsets:p}=s;let y=0;if(!s.hasCurves()){for(const t of n){if(p[y++]=g,0===t.length)continue;let e=t.length;if(x&&V(t[0],t.at(-1))&&--e,i||a)for(let n=0;n<e;++n)l(t[n]);else for(let n=0;n<e;++n){const[e,r]=t[n];u[2*g]=e,u[2*g+1]=r,++g}}return p[y]=g,s}function d(t){const e=M+t;if(e<=(s.segmentParams?.length??0))return;let n=e*G;n=20*Math.ceil(n/20);const r=s.segmentParams;s.segmentParams=new Float64Array(n),null!=r&&s.segmentParams.set(r)}let M=0;for(const t of n){if(s.partOffsets[y++]=g,0===t.length)continue;const e=t[0];let n=e;for(let e=1;e<t.length;++e){const r=t[e];l(n);const i=g-1;(0,f.wY)(r)?(d(10),++s.segmentCountArc,M=w(n,r,s,i,M),n=r.a[0]):(0,f.DA)(r)?(d(10),++s.segmentCountArc,M=R(n,r,s,i,M),n=r.a[0]):(0,f.aO)(r)?(d(10),++s.segmentCountArc,M=Y(n,r,s,i,M),n=r.c[0]):(0,f.n1)(r)?(d(4),++s.segmentCountBezier,M=N(0,r,s,i,M),n=r.b[0]):n=r}x&&V(e,n)||l(n)}return s.partOffsets[y]=g,s}function _(t){const e=O(t),{vertexCount:n,partCount:r,hasZ:s,hasM:i}=t,a=A(t);if("point"===t.type){const[e,n]=t.vertexXY,r=t.vertexZ?.[0],s=t.vertexM?.[0];return{x:e,y:n,z:r,m:s,spatialReference:a}}let o=0;if("multipoint"===t.type){const t=[];for(;o<n;)t.push(e(o++));return{points:t,spatialReference:a,hasZ:s,hasM:i}}const u="polygon"===t.type;if(!t.hasCurves()){const n=new Array;for(let s=0;s<r;++s){const r=t.partOffsets[s+1],i=new Array;for(;o<r;)i.push(e(o++));u&&i.length>0&&i.push(i[0]),n.push(i)}return u?{rings:n,hasZ:s,hasM:i,spatialReference:a}:{paths:n,hasZ:s,hasM:i,spatialReference:a}}const h=new Array;for(const{segments:e,startVertex:n}of t.parts){const t=[n];for(const{curve:n}of e)t.push(n);h.push(t)}return u?{rings:[],curveRings:h,hasZ:s,hasM:i,spatialReference:a}:{paths:[],curvePaths:h,hasZ:s,hasM:i,spatialReference:a}}function P(t,{lengths:e,coords:n,hasZ:r,hasM:s},i){const a=t.includes("point")?0:e.length,o="polygon"===t,u="point"===t?1:e.reduce((t,e)=>t+e,0)-(o?a:0);r??=!1,s??=!1;const h=Z(t,u,a,r,s,!1,0,0);if(h.spatialReference=i??void 0,!h.isMultipart()){for(let t=0,e=0;t<u;++t)h.vertexXY[2*t]=n[e++],h.vertexXY[2*t+1]=n[e++],r&&(h.vertexZ[t]=n[e++]),s&&(h.vertexM[t]=n[e++]);return h}const c=2+Number(r)+Number(s);let l=0,f=0;h.partOffsets[0]=0;for(const t of e){const e=h.partOffsets[f],i=e+t-Number(o);h.partOffsets[++f]=i;for(let t=e;t<i;++t)h.vertexXY[2*t]=n[l++],h.vertexXY[2*t+1]=n[l++],r&&(h.vertexZ[t]=n[l++]),s&&(h.vertexM[t]=n[l++]);o&&(l+=c)}return h}function b({type:t,vertexCount:e,vertexXY:n,vertexZ:r,vertexM:s,partCount:i,partOffsets:a,hasZ:o,hasM:u}){const h=new x.A([],[],o,u);i=Math.max(i,1);const c="polygon"===t;let l=0;for(let t=0;t<i;++t){const i=a?.[t+1]??e,f=h.coords.length;for(let t=l;t<i;++t)h.coords.push(n[2*t],n[2*t+1]),o&&h.coords.push(r[t]),u&&h.coords.push(s[t]);if(c){const t=l;h.coords.push(n[2*t],n[2*t+1]),o&&h.coords.push(r[t]),u&&h.coords.push(s[t])}h.lengths.push((h.coords.length-f)/h.stride),l=i}return"point"===t&&(h.lengths.length=0),h}function I(t,e){return"getSpatialReference"in t&&(e=function(t){if(null==t)return;const e=t.getText()||void 0,n=t.isCustomWkid()?0:t.getOldID();if(n<=0)return{wkt:e};let r=t.getLatestID();(r<=0||r===n)&&(r=void 0);const s=t.getVCS();if(null==s)return{wkid:n,latestWkid:r,wkt:e};const i=s.isCustomWkid()?0:s.getOldID();if(i<=0)return{wkt:e};let a=t.getLatestVerticalID();return(a<=0||a===i)&&(a=void 0),{wkid:n,wkt:e,latestWkid:r,vcsWkid:i,latestVcsWkid:a}}(t.getSpatialReference()),t=t.getGeometry()),new p({...t.toFlatGeometry(),spatialReference:e})}class S{constructor(t,e){this.target=t,this.keys=e,this.oldValues=e.map(e=>t[e]);for(const n of e)t[n]=void 0}[Symbol.dispose](){this.keys.map((t,e)=>{this.target[t]=this.oldValues[e]})}}function A({spatialReference:t}){return t instanceof i.A?t.toJSON():t}function O({vertexXY:t,vertexZ:e,vertexM:n}){return e?n?r=>[t[2*r],t[2*r+1],e[r],n[r]]:n=>[t[2*n],t[2*n+1],e[n]]:n?e=>[t[2*e],t[2*e+1],n[e]]:e=>[t[2*e],t[2*e+1]]}function V(t,e){return t.every((t,n)=>t===e[n])}function Z(t,e,n,r,s,i,a,o){a??=0,o??=0;const u=new p({type:t,vertexCount:e,vertexXY:null,vertexZ:void 0,vertexM:void 0,partCount:n,partOffsets:void 0,partFlags:void 0,segmentFlags:void 0,segmentIndices:void 0,segmentParams:void 0,segmentCountArc:a,segmentCountBezier:o});let h=2*Float64Array.BYTES_PER_ELEMENT*e;r&&(h+=Float64Array.BYTES_PER_ELEMENT*e),s&&(h+=Float64Array.BYTES_PER_ELEMENT*e),u.isMultipart()&&(h+=(n+1)*Int32Array.BYTES_PER_ELEMENT,h+=(n+1)*Int8Array.BYTES_PER_ELEMENT),i&&(h+=e*Int8Array.BYTES_PER_ELEMENT,h+=e*Int32Array.BYTES_PER_ELEMENT,h+=u.segmentParamCount*Float64Array.BYTES_PER_ELEMENT);const c=new ArrayBuffer(h);let l=0;return u.vertexXY=new Float64Array(c,l,2*e),l+=u.vertexXY.byteLength,r&&(u.vertexZ=new Float64Array(c,l,e),l+=u.vertexZ.byteLength),s&&(u.vertexM=new Float64Array(c,l,e),l+=u.vertexM.byteLength),i&&(u.segmentParams=new Float64Array(c,l,u.segmentParamCount),l+=u.segmentParams.byteLength,u.segmentIndices=new Int32Array(c,l,e),u.segmentIndices.fill(T),l+=u.segmentIndices.byteLength),u.isMultipart()&&(u.partOffsets=new Int32Array(c,l,n+1),l+=u.partOffsets.byteLength,u.partFlags=new Int8Array(c,l,n+1),l+=u.partFlags.byteLength,"polygon"===u.type&&u.partFlags.subarray(0,n).fill(1)),i&&(u.segmentFlags=new Int8Array(c,l,e),u.segmentFlags.fill(1),l+=u.segmentFlags.byteLength),u}function w(t,e,{segmentFlags:n,segmentIndices:r,segmentParams:s},i,a){n[i]=4,r[i]=a;const[o,[u,h],c,l,f,m,x]=e.a;let p=4;l||(p|=1),c||(p|=2);const y=(0,g.SW)(t,e),[d,M]=(0,g.Uk)(y,.5);return s[a++]=p,s[a++]=m,s[a++]=x,s[a++]=f,s[a++]=u,s[a++]=h,s[a++]=y.u2-y.u1,s[a++]=y.u1,s[a++]=d,s[a++]=M,a}function R(t,e,{segmentFlags:n,segmentIndices:r,segmentParams:s},i,a){n[i]=4,r[i]=a;const o=(0,m.io)(t,e);return F(o,4,...(0,h.mq)(o,.5),s,a)}function Y(t,e,{segmentFlags:n,segmentIndices:r,segmentParams:s},i,a){return n[i]=4,r[i]=a,F((0,c.pM)(t,e),0,...e.c[1],s,a)}function F(t,e,n,r,s,i){const{cx:a,cy:o,thetaStart:u,thetaEnd:h,radius:c}=t;return u>h||(e|=1),Math.abs(h-u)<=Math.PI||(e|=2),s[i++]=e,s[i++]=c,s[i++]=1,s[i++]=0,s[i++]=a,s[i++]=o,s[i++]=h-u,s[i++]=u,s[i++]=n,s[i++]=r,i}function N(t,{b:[e,[n,r],[s,i]]},{segmentFlags:a,segmentIndices:o,segmentParams:u},h,c){return a[h]=2,o[h]=c,u[c++]=n,u[c++]=r,u[c++]=s,u[c++]=i,c}const G=1.61803,T=-1},5874(t,e,n){n.d(e,{isSimple:()=>i}),n(76061);const r=new(n(98783).O);var s=n(78125);function i(t,e){return function(t,e,n,s){return r.isSimple(t,e,n,s,null)}((0,s.fromGeometry)(t),(0,s.fromSpatialReference)((0,s.getSpatialReference)(t)),null!=e,e??null)}r.supportsCurves()},78125(t,e,n){n.r(e),n.d(e,{fromExtent:()=>p,fromGeometry:()=>x,fromMultipoint:()=>y,fromPoint:()=>d,fromPolygon:()=>M,fromPolyline:()=>v,fromPolylineUsingImportOperator:()=>C,fromSpatialReference:()=>E,getSpatialReference:()=>g,toExtent:()=>P,toGeometry:()=>_,toMultipoint:()=>b,toPoint:()=>I,toPolygon:()=>S,toPolyline:()=>A});var r=n(83661),s=(n(79187),n(55537)),i=n(95213),a=n(88885),o=n(5443),u=n(48526),h=n(86738),c=n(39829),l=n(82799),f=(n(90293),n(83299));const m="_gxVersion";function g(t){return Array.isArray(t)?t[0].spatialReference:t.spatialReference}function x(t){switch(t.type){case"point":return d(t);case"multipoint":return y(t);case"polyline":return v(t);case"polygon":return M(t);case"extent":return p(t);default:throw new Error(`Unsupported geometry type: ${t.type}`)}}function p(t){if(!t.getCacheValue(m)){const e=new i.E;e.setCoords(t.xmin,t.ymin,t.xmax,t.ymax),t.hasM&&e.setInterval(2,0,t.mmin,t.mmax),t.hasZ&&e.setInterval(1,0,t.zmin,t.zmax),t.setCacheValue(m,e)}return t.getCacheValue(m)}function y(t){if(!t.getCacheValue(m)){const e=new a.M,n=new i.P,r=t.points,s=t.hasM,o=t.hasZ,u=o?3:2;for(let t=0,i=r.length;t<i;t++){const i=r[t];n.setXYCoords(i[0],i[1]),o&&n.setZ(i[2]??0),s&&n.setM(i[u]??NaN),e.add(n)}t.setCacheValue(m,e)}return t.getCacheValue(m)}function d(t){if(!t.getCacheValue(m)){const e=new i.P;e.setXYCoords(t.x,t.y),t.hasM&&e.setM(t.m),t.hasZ&&e.setZ(t.z),t.setCacheValue(m,e)}return t.getCacheValue(m)}function M(t){if(!t.getCacheValue(m)){const{curveRings:e,hasM:n,hasZ:r,rings:s}=t,i=(0,f.fromGeometryToGXGeometry)({curveRings:e,hasM:n,hasZ:r,rings:s});t.setCacheValue(m,i)}return t.getCacheValue(m)}function v(t){if(!t.getCacheValue(m)){const{curvePaths:e,hasM:n,hasZ:r,paths:s}=t,i=(0,f.fromGeometryToGXGeometry)({curvePaths:e,hasM:n,hasZ:r,paths:s});t.setCacheValue(m,i)}return t.getCacheValue(m)}function C(t){if(!t.getCacheValue(m)){const{curvePaths:e,hasM:n,hasZ:r,paths:s}=t,i=(0,f.fromGeometryToGXGeometryUsingImportOperator)({curvePaths:e,hasM:n,hasZ:r,paths:s});t.setCacheValue(m,i)}return t.getCacheValue(m)}function E(t){return t.cache?(t.cache[m]??=(0,f.fromSpatialReference)(t),t.cache[m]):(0,f.fromSpatialReference)(t)}function _(t,e){if(t)switch(t.getGeometryType()){case s.G.enumPoint:return I(t,e);case s.G.enumEnvelope:return P(t,e);case s.G.enumMultiPoint:return b(t,e);case s.G.enumPolyline:return A(t,e);case s.G.enumPolygon:return S(t,e)}return null}function P(t,e){if(t.isEmpty())return null;const n=new o.A({xmin:t.getXMin(),ymin:t.getYMin(),xmax:t.getXMax(),ymax:t.getYMax(),spatialReference:e}),r=t.getDescription();if(r.hasM()){const e=t.queryInterval(2,0);n.mmin=e.vmin,n.mmax=e.vmax}if(r.hasZ()){const e=t.queryInterval(1,0);n.zmin=e.vmin,n.zmax=e.vmax}return n.setCacheValue(m,t),n}function b(t,e){if(t.isEmpty())return null;const n=t.getDescription(),r=n.hasM(),s=n.hasZ(),a=[],o=new i.P;for(let e=0,n=t.getPointCount();e<n;e++){t.getPointByVal(e,o);const n=[o.getX(),o.getY()];s&&n.push(o.getZ()),r&&n.push(o.getM()),a.push(n)}const h=new u.A({hasM:r,hasZ:s,points:a,spatialReference:e});return h.setCacheValue(m,t),h}function I(t,e){if(t instanceof r.P)return new h.A({x:t.x,y:t.y,spatialReference:e});if(t.isEmpty())return null;const n=new h.A({x:t.getX(),y:t.getY(),spatialReference:e}),s=t.getDescription();return s.hasM()&&(n.m=t.getM()),s.hasZ()&&(n.z=t.getZ()),n.setCacheValue(m,t),n}function S(t,e){if(t.isEmpty())return null;const n=c.A.fromJSON({...(0,f.toGeometry)(t,null),spatialReference:e});return n.setCacheValue(m,t),n}function A(t,e){if(t.isEmpty())return null;const n=l.A.fromJSON({...(0,f.toGeometry)(t,null),spatialReference:e});return n.setCacheValue(m,t),n}},4197(t,e,n){n.d(e,{Vj:()=>u,cj:()=>o,jh:()=>i,l5:()=>a});var r=n(34275),s=n(9093);function i(t){return t<=r.y9?new Array(t).fill(0):new Float64Array(t)}function a(t,e,n){return Array.isArray(t)?t.slice(e,e+n):t.subarray(e,e+n)}function o(t){return[...t]}function u(t){const e=(0,s.vt)();for(let n=0;n<16;++n)e[n]=t[n];return e}},70328(t,e,n){n.d(e,{BI:()=>M,DC:()=>l,Ej:()=>m,Ie:()=>y,Jt:()=>d,Ne:()=>g,RF:()=>c,aI:()=>C,fA:()=>a,gE:()=>u,hZ:()=>p,iT:()=>f,is:()=>v,qv:()=>E,vI:()=>x,vY:()=>o,v_:()=>_,vt:()=>i,w1:()=>h}),n(35522);var r=n(5443),s=(n(19419),n(4197));function i(t=_){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function a(t,e,n,r,s,a,o=i()){return o[0]=t,o[1]=e,o[2]=n,o[3]=r,o[4]=s,o[5]=a,o}function o(t,e=i()){return function(t,e,n,r=i()){return p(r,E),function(t,e,n=0,r=e.length/3){let s=t[0],i=t[1],a=t[2],o=t[3],u=t[4],h=t[5];for(let t=0;t<r;t++)s=Math.min(s,e[n+3*t]),i=Math.min(i,e[n+3*t+1]),a=Math.min(a,e[n+3*t+2]),o=Math.max(o,e[n+3*t]),u=Math.max(u,e[n+3*t+1]),h=Math.max(h,e[n+3*t+2]);t[0]=s,t[1]=i,t[2]=a,t[3]=o,t[4]=u,t[5]=h}(r,t,e,n),r}(t,0,t.length/3,e)}function u(t,e=(0,s.jh)(24)){const[n,r,i,a,o,u]=t;return e[0]=n,e[1]=r,e[2]=i,e[3]=n,e[4]=r,e[5]=u,e[6]=n,e[7]=o,e[8]=i,e[9]=n,e[10]=o,e[11]=u,e[12]=a,e[13]=r,e[14]=i,e[15]=a,e[16]=r,e[17]=u,e[18]=a,e[19]=o,e[20]=i,e[21]=a,e[22]=o,e[23]=u,e}function h(t,e){const n=isFinite(t[2])||isFinite(t[5]);return new r.A(n?{xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],zmin:t[2],zmax:t[5],spatialReference:e}:{xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],spatialReference:e})}function c(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2]),t[3]=Math.max(t[3],e[3]),t[4]=Math.max(t[4],e[4]),t[5]=Math.max(t[5],e[5])}function l(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[3]=Math.max(t[3],e[2]),t[4]=Math.max(t[4],e[3])}function f(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2]),t[3]=Math.max(t[3],e[0]),t[4]=Math.max(t[4],e[1]),t[5]=Math.max(t[5],e[2])}function m(t,e=[0,0,0]){return e[0]=function(t){return t[0]>=t[3]?0:t[3]-t[0]}(t),e[1]=function(t){return t[1]>=t[4]?0:t[4]-t[1]}(t),e[2]=function(t){return t[2]>=t[5]?0:t[5]-t[2]}(t),e}function g(t,e,n=t){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n!==t&&(n[3]=t[3],n[4]=t[4],n[5]=t[5]),n}function x(t,e,n=t){return n[3]=e[0],n[4]=e[1],n[5]=e[2],n!==t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2]),t}function p(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function y(t){return t?p(t,E):i(E)}function d(t,e){return t[0]=e[0],t[1]=e[1],t[2]=Number.NEGATIVE_INFINITY,t[3]=e[2],t[4]=e[3],t[5]=Number.POSITIVE_INFINITY,t}function M(t,e,n,r,s){return t[0]=e,t[1]=n,t[2]=Number.NEGATIVE_INFINITY,t[3]=r,t[4]=s,t[5]=Number.POSITIVE_INFINITY,t}function v(t){return 6===t.length}function C(t,e,n){if(null==t||null==e)return t===e;if(!v(t)||!v(e))return!1;if(n){for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1}else for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}const E=[1/0,1/0,1/0,-1/0,-1/0,-1/0],_=[0,0,0,0,0,0];i()},92722(t,e,n){n.d(e,{A:()=>s});var r=n(69397);class s{constructor(t=[],e=[],n=!1,r=!1){this.lengths=t??[],this.coords=e??[],this.hasZ=n,this.hasM=r}static fromJSON({lengths:t,coords:e,hasZ:n,hasM:r}){return new s(t,e,n||!1,r||!1)}static fromRect([t,e,n,r]){const i=n-t,a=r-e;return new s([5],[t,e,i,0,0,a,-i,0,0,-a])}get isPoint(){return 0===this.lengths.length&&this.coords.length>=2}get maxLength(){return Math.max(...this.lengths)}get size(){return this.isPoint?1:this.lengths.reduce((t,e)=>t+e,0)}get usedMemory(){return 64+(0,r.Qf)(this.lengths,this.coords)}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}area(){if(this.isPoint)return 0;let t=0,e=0;for(const n of this.lengths){if(n<3)continue;const{stride:r}=this;let s=this.coords[r*e],i=this.coords[r*e+1];for(let a=1;a<n;a+=1){const n=r*(e+a),o=this.coords[n],u=this.coords[n+1];t+=-.5*(o-s)*(u+i),s=o,i=u}e+=n}return t}forEachVertex(t){let e=0;if(this.isPoint)return t(this.coords[0],this.coords[1]);const{stride:n}=this;for(const r of this.lengths){for(let s=0;s<r;s++){const r=n*(e+s);t(this.coords[r],this.coords[r+1])}e+=r}}deltaDecode(){const t=this.clone(),{coords:e,lengths:n}=t;let r=0;const{stride:s}=this;for(const t of n){for(let n=1;n<t;n++){const t=s*(r+n);e[t]+=e[t-s],e[t+1]+=e[t+1-s]}r+=t}return t}clone(t){if(this.isPoint)return new s([],Array.from(this.coords.slice(0,this.stride)),this.hasZ,this.hasM);const e=Array.from(this.lengths),{stride:n,size:r}=this,i=this.coords.slice(0,r*n);return t?(t.set(i),new s(e,t,this.hasZ,this.hasM)):new s(e,Array.from(i),this.hasZ,this.hasM)}justXY(){const{stride:t,size:e}=this;if(2===t)return this;const n=new Array(e*t);for(let e=0,r=0;e<n.length;e+=t)n[r++]=this.coords[e],n[r++]=this.coords[e+1];return new s(this.lengths,n,!1,!1)}}}}]);