@arcgis/core 5.2.0-next.73 → 5.2.0-next.74

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 (183) hide show
  1. package/analysis/ViewshedAnalysis.js +1 -1
  2. package/arcgisGlobal.d.ts +1 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{d3be4d914fc99a1d686c.js → 075e65cc4275ac886f08.js} +1 -1
  5. package/assets/esri/core/workers/chunks/087bd698b80ca0cea71e.js +1 -0
  6. package/assets/esri/core/workers/chunks/{b6c7b7b7f87dce5de811.js → 0bf644f93c180a2bc2f8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0e81c6d4f1c81f9b0a1b.js +1 -0
  8. package/assets/esri/core/workers/chunks/193aed69de2dec4f36b6.js +1 -0
  9. package/assets/esri/core/workers/chunks/1a3afee3ecd806b4aa81.js +1 -0
  10. package/assets/esri/core/workers/chunks/{014f9fd2818e2c9d9a3b.js → 264fd750691d517ab1f3.js} +1 -1
  11. package/assets/esri/core/workers/chunks/28f87daaba1ae3441364.js +1 -0
  12. package/assets/esri/core/workers/chunks/2baa16ec8559e77c226f.js +1 -0
  13. package/assets/esri/core/workers/chunks/2c31648a4b95275516ee.js +1 -0
  14. package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +1 -0
  15. package/assets/esri/core/workers/chunks/305eea9c1fc4aee3309e.js +1 -0
  16. package/assets/esri/core/workers/chunks/31d19bb72a9e79b30070.js +1 -0
  17. package/assets/esri/core/workers/chunks/45ccca01db0027b9dc16.js +1 -0
  18. package/assets/esri/core/workers/chunks/495f90fe3d0ad32bb82d.js +1 -0
  19. package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +1 -0
  20. package/assets/esri/core/workers/chunks/509aecafbc629bee1c15.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d901f8503a73277cfa58.js → 553be2bd69bd311477ea.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{31669511cfddf116d991.js → 66e60351aacbd162775f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/762be5d3e6aeaea33f74.js +29 -0
  24. package/assets/esri/core/workers/chunks/76b573143d1a65fdbcb6.js +1 -0
  25. package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +1 -0
  26. package/assets/esri/core/workers/chunks/{44b50d4716a2567ab6f1.js → 7b5b66ae79e0287e3ade.js} +1 -1
  27. package/assets/esri/core/workers/chunks/81130dbcb738d40f723b.js +1 -0
  28. package/assets/esri/core/workers/chunks/835af7b4fd92cb4e7af0.js +1 -0
  29. package/assets/esri/core/workers/chunks/859dd86c921053bf03a1.js +1 -0
  30. package/assets/esri/core/workers/chunks/877594b6db08da98acd7.js +1 -0
  31. package/assets/esri/core/workers/chunks/{96d861265566854760cd.js → 88fd698b940dadcc6dc5.js} +1 -1
  32. package/assets/esri/core/workers/chunks/8f0d4aec8bd3cbfefc40.js +1 -0
  33. package/assets/esri/core/workers/chunks/{7f208ef75ef2ce0d7cf9.js → 910c93bbbf8113a4a51f.js} +1 -1
  34. package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +1 -0
  35. package/assets/esri/core/workers/chunks/{509cfac9e5d86a8ee449.js → 936d44c7bc3a181e64a3.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{b9953277d0cd4a01bdc6.js → 94368a097e6190ce3c7a.js} +1 -1
  37. package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +1 -0
  38. package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +1 -0
  39. package/assets/esri/core/workers/chunks/{c203df41f9d2e4b80889.js → 9ca59077712e45ef4d56.js} +1 -1
  40. package/assets/esri/core/workers/chunks/9e25f715cda59c686a4c.js +1 -0
  41. package/assets/esri/core/workers/chunks/{36171c72a3c04b0d13ef.js → a0a1f0bd3648738354a6.js} +1 -1
  42. package/assets/esri/core/workers/chunks/a101152066dd56259619.js +1 -0
  43. package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +1 -0
  44. package/assets/esri/core/workers/chunks/a50421fe79f264ae3619.js +1 -0
  45. package/assets/esri/core/workers/chunks/a9053ad0f4e8c4705665.js +1 -0
  46. package/assets/esri/core/workers/chunks/aca5c524bd3c955e9243.js +1 -0
  47. package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +1 -0
  48. package/assets/esri/core/workers/chunks/b3b53cf0a3a30164d337.js +1 -0
  49. package/assets/esri/core/workers/chunks/b6d26d9738c0787acc38.js +1 -0
  50. package/assets/esri/core/workers/chunks/b9c61b20bbc91cb63036.js +1 -0
  51. package/assets/esri/core/workers/chunks/bf3dc3ad8df8488da3f0.js +1 -0
  52. package/assets/esri/core/workers/chunks/bff75cc7413bf0d319db.js +1 -0
  53. package/assets/esri/core/workers/chunks/c1568bcd3f04014152e1.js +1 -0
  54. package/assets/esri/core/workers/chunks/c1a4d499a30f3d80567b.js +1 -0
  55. package/assets/esri/core/workers/chunks/c374e5d5980db74c4aca.js +1 -0
  56. package/assets/esri/core/workers/chunks/{8c76f31a363dd0c3354d.js → c46f79d5b7712adbbd1c.js} +1 -1
  57. package/assets/esri/core/workers/chunks/c67e4a848d41038367b8.js +1 -0
  58. package/assets/esri/core/workers/chunks/de5013f89f0eae93978f.js +1 -0
  59. package/assets/esri/core/workers/chunks/e557043f90c051e93925.js +1 -0
  60. package/assets/esri/core/workers/chunks/{bee5e738ecf8680909c4.js → eaf26c1cc938789d5336.js} +1 -1
  61. package/assets/esri/core/workers/chunks/ebfb3cdc0df15eb05d75.js +1 -0
  62. package/assets/esri/core/workers/chunks/f1727b4a32cb6f36a5e6.js +1 -0
  63. package/assets/esri/core/workers/chunks/f4bc563c71c478d3912f.js +1 -0
  64. package/assets/esri/core/workers/chunks/fb0b89bbb4f8607d5f20.js +1 -0
  65. package/assets/esri/core/workers/chunks/fdca9873914b9dbd9244.js +1 -0
  66. package/assets/esri/core/workers/chunks/ff890167ff2baabfc4ce.js +1 -0
  67. package/config.js +1 -1
  68. package/kernel.js +1 -1
  69. package/layers/DimensionFeatureLayer.d.ts +22 -0
  70. package/layers/DimensionFeatureLayer.js +1 -1
  71. package/layers/save/featureLayerUtils.js +1 -1
  72. package/layers/support/layerUtils.js +1 -1
  73. package/layers/support/layersMapping.js +1 -1
  74. package/package.json +1 -1
  75. package/support/revision.js +1 -1
  76. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  77. package/views/3d/analysis/LineOfSight/LineOfSightReshapeTool3D.js +1 -1
  78. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  79. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  80. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  81. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  82. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  83. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  84. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  85. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  86. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  87. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  88. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
  89. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  90. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  91. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  92. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  93. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
  94. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  95. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  96. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  97. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  98. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  99. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  100. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  101. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  102. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  103. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  104. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  105. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  106. package/views/draw/DrawGraphicTool.js +1 -1
  107. package/views/draw/DrawTool.js +1 -1
  108. package/views/draw/plugins/PolylinePlugin.js +1 -1
  109. package/views/draw/support/Box.js +1 -1
  110. package/views/draw/support/InteractiveHandle.js +1 -1
  111. package/views/draw/support/Reshape.js +1 -1
  112. package/views/draw/support/drawToolUtils.js +1 -1
  113. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  114. package/views/draw/support/managers/TooltipManager.js +1 -1
  115. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  116. package/views/draw/support/tooltipUtils.js +1 -1
  117. package/views/interactive/options/InteractiveToolOptions.d.ts +36 -0
  118. package/views/interactive/options/InteractiveToolOptions.js +2 -0
  119. package/views/interactive/sketch/SketchOptions.d.ts +4 -3
  120. package/views/interactive/sketch/SketchOptions.js +1 -1
  121. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  122. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  123. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  124. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  125. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  126. package/views/interactive/tooltip/fields/fields.js +1 -1
  127. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  128. package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
  129. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  130. package/widgets/Sketch/SketchViewModel.js +1 -1
  131. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  132. package/assets/esri/core/workers/chunks/00cbff0b785e24e87d97.js +0 -1
  133. package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +0 -29
  134. package/assets/esri/core/workers/chunks/06c9aac75a01d3af6d54.js +0 -1
  135. package/assets/esri/core/workers/chunks/089f8c60e96d920a2cb2.js +0 -1
  136. package/assets/esri/core/workers/chunks/0c3c311400ee352187ea.js +0 -1
  137. package/assets/esri/core/workers/chunks/158d2ac0333d53556e33.js +0 -1
  138. package/assets/esri/core/workers/chunks/16cade1c2ddf44e336ee.js +0 -1
  139. package/assets/esri/core/workers/chunks/1b130af7d14eaae69d96.js +0 -1
  140. package/assets/esri/core/workers/chunks/1e0140556c2e3fa72545.js +0 -1
  141. package/assets/esri/core/workers/chunks/1e5cb72830c7f32f2961.js +0 -1
  142. package/assets/esri/core/workers/chunks/259bdacfb7b0f866a8d0.js +0 -1
  143. package/assets/esri/core/workers/chunks/2f58e1f64df2da8259a2.js +0 -1
  144. package/assets/esri/core/workers/chunks/383304d33b496c5d8baa.js +0 -1
  145. package/assets/esri/core/workers/chunks/3aacb935d632834d4154.js +0 -1
  146. package/assets/esri/core/workers/chunks/3c8e98cf23ad8ef12fcb.js +0 -1
  147. package/assets/esri/core/workers/chunks/3dc71e03a630dd50b28e.js +0 -1
  148. package/assets/esri/core/workers/chunks/3fd022df127af32782ce.js +0 -1
  149. package/assets/esri/core/workers/chunks/4344ab1250a1c550bf8b.js +0 -1
  150. package/assets/esri/core/workers/chunks/43de723f765ec8f268ac.js +0 -1
  151. package/assets/esri/core/workers/chunks/4695cd6120f60b234d5c.js +0 -1
  152. package/assets/esri/core/workers/chunks/582a1d468089b9986416.js +0 -1
  153. package/assets/esri/core/workers/chunks/5f201c77a09ae0df29d6.js +0 -1
  154. package/assets/esri/core/workers/chunks/6080e46fc79127500283.js +0 -1
  155. package/assets/esri/core/workers/chunks/67d3ff7fcefaa7d5d27f.js +0 -1
  156. package/assets/esri/core/workers/chunks/6a9002fcba11e2cf3f2e.js +0 -1
  157. package/assets/esri/core/workers/chunks/72dcd4bd1a28bf8605c5.js +0 -1
  158. package/assets/esri/core/workers/chunks/73f228d966b89c73c9e9.js +0 -1
  159. package/assets/esri/core/workers/chunks/77df0bb35d2688729479.js +0 -1
  160. package/assets/esri/core/workers/chunks/7a143ca61c0a70306185.js +0 -1
  161. package/assets/esri/core/workers/chunks/869d292a60747c93dc84.js +0 -1
  162. package/assets/esri/core/workers/chunks/9c57161ad48d8d546dc7.js +0 -1
  163. package/assets/esri/core/workers/chunks/a7f42ada0aa69873a938.js +0 -1
  164. package/assets/esri/core/workers/chunks/a988fd54912969b812ce.js +0 -1
  165. package/assets/esri/core/workers/chunks/aff0e7761276036e029d.js +0 -1
  166. package/assets/esri/core/workers/chunks/b7d8817018b3d277c454.js +0 -1
  167. package/assets/esri/core/workers/chunks/ba4f419f46be09a9a55c.js +0 -1
  168. package/assets/esri/core/workers/chunks/bfb6566c27c09deb0929.js +0 -1
  169. package/assets/esri/core/workers/chunks/c715c585c42d8c2b86f5.js +0 -1
  170. package/assets/esri/core/workers/chunks/c7e9513f75b8ec205562.js +0 -1
  171. package/assets/esri/core/workers/chunks/c838cc1c786368b78598.js +0 -1
  172. package/assets/esri/core/workers/chunks/cd4e5c948d1bfa9b9a2d.js +0 -1
  173. package/assets/esri/core/workers/chunks/cfe31b7d1c6c05fbd268.js +0 -1
  174. package/assets/esri/core/workers/chunks/d0c1bc90e474f706211c.js +0 -1
  175. package/assets/esri/core/workers/chunks/da484787bd9fd3b13d15.js +0 -1
  176. package/assets/esri/core/workers/chunks/e21b3490bfce75405e55.js +0 -1
  177. package/assets/esri/core/workers/chunks/e4353f0792f45aa6a62f.js +0 -1
  178. package/assets/esri/core/workers/chunks/e702abaeccef20b64a81.js +0 -1
  179. package/assets/esri/core/workers/chunks/ebd619533be077059494.js +0 -1
  180. package/assets/esri/core/workers/chunks/f475672ff4c2ec9367c2.js +0 -1
  181. package/assets/esri/core/workers/chunks/f69329b85b362b349a8c.js +0 -1
  182. package/assets/esri/core/workers/chunks/fba8065a3a6fbd877e23.js +0 -1
  183. package/assets/esri/core/workers/chunks/fec07a16b72cdcafc641.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as H}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as k,getEndpoint as O,isCircularArc as P,isEllipticArc4 as L,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as Z}from"./drawUtils.js";import $ from"./GraphicMover.js";import q from"./HighlightHelper.js";import{addUniqueLayer as X,isConnectedReshapeSupportedLayer as Y}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as ee}from"./reshapeTooltipUtils.js";import{defaultSymbols as te,createMidpointGraphics as ie,createVertexGraphics as se,createCurveControlPointGraphics as oe,createCurveConstructionLineGraphics as re,attributeKeys as ne,getMidpoint as ae,controlPointKinds as he,fastCloneGeometry as pe,saveUpdatedCurveOrCoordinate as le,toolIdAttribute as ce,splitCurve as de,isSingleSegmentCircle as me,isSingleSegmentEllipse as ve}from"./reshapeUtils.js";import{ViewEventPriorities as ue}from"../../input/InputManager.js";import{createCoordinateHelper as ye}from"../../interactive/coordinateHelper.js";import{sketchKeys as _e}from"../../interactive/keybindings.js";import{EditGeometryOperations as ge}from"../../interactive/editGeometry/EditGeometryOperations.js";import fe from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as Ge}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as be,enterInputModeIfAvailable as xe}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Me}from"../../support/GeometryWorkerHandle.js";const Se=Symbol(),Ce={mode:"on-the-ground",offset:0};let Ee=class extends r{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Me({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=te,this.tooltip=null,this.activeTooltipInfo=null,this.sketchOptions=new fe,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new q({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,e=>{if(!e||!0===this._primaryGraphicMoving)return;const t=new Set(this.selectedManipulators.map(Re));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(Re(e))).forEach(e=>this._addToSelection(e)),this.curveControlPointGraphics.filter(e=>t.has(Re(e))).forEach(e=>this._addToSelection(e));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=be(()=>({view:e,options:this.sketchOptions.tooltips})),this.tooltipInfos=B(this.sketchOptions),this.addHandles([m(()=>e?.ready,()=>{const{layer:e,view:t}=this;X(t,e),this.addHandles(t.on("key-down",e=>this._keyDownHandler(e),ue.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.sketchOptions.labels.enabled,e=>{this._segmentLabels?this._segmentLabels.visible=e:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??ye(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{sketchOptions:e,activeTooltipInfo:t,graphic:i}=this;return{sketchOptions:e,activeTooltipInfo:t,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(e,t,i,s,o)=>{this._setUpGeometryHelper();const r=e===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e);const n=!0;if(this._syncGeometryAfterVertexMove(e,t,s,o,n),r){const{view:e}=this,s=e.toScreen(i),o=e.toScreen(t),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}get updating(){return!!(this._updatingHandles?.updating||this._connectedReshapeManager?.updating||this._segmentLabels?.updating||this.snappingManager?.updating)}isUIGraphic(e){return e===this.graphic||this._isMidpoint(e)||this._isCurveControlPoint(e)||this._isVertex(e)||this._isConstructionLine(e)}refresh(e){if(this._reset(),this._setup(),e){for(const t of this.vertexGraphics)e.has(Re(t))&&this._addToSelection(t);for(const t of this.curveControlPointGraphics)e.has(Re(t))&&this._addToSelection(t)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(null==e||"mesh"===e.type||"extent"===e.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(e):this._editGeometryOperations=ge.fromGeometry(e,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Ge({editGeometryOperations:i,elevationInfo:Ce,pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(Se),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),h(this._snappingGraphicsLayer)),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._removeCurveGraphics(e),this._updateTooltip()}_removeMidpointGraphics(e=this.layer){const{midpointGraphics:t}=this;e?.removeMany(t.items),t.drain(h)}_removeVertexGraphics(e=this.layer){const{vertexGraphics:t}=this;this._relatedGraphicIndex=null,e?.removeMany(t.items),t.drain(h)}_removeCurveGraphics(e=this.layer){const{curveControlPointGraphics:t,constructionLineGraphics:i}=this;e?.removeMany(t.items),e?.removeMany(i.items),t.drain(h),i.drain(h)}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type||"multipoint"===e.type)){const t=we(e);this.enableMidpoints&&"multipoint"!==e.type&&this._setUpMidpointGraphics(t),this.enableVertices&&(this._setUpVertexGraphics(t),this._setupCurveGraphics(t))}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=ie(e,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const t=se(e,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=t.graphicIndex,this.vertexGraphics.addMany(t.graphics),this.layer.addMany(t.graphics)}else{const t=se(e,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}}_setupCurveGraphics(e){this._removeCurveGraphics();const t=oe(e,this.symbols,this._coordinateHelper),i=re(e,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(t),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(t)}async _setupSegmentLabels(){const e=this._editGeometryOperations,t=this.sketchOptions.labels.enabled;if(e&&this._segmentLabels?.context?.editGeometryOperations===e&&t||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&e&&t){const t=this._segmentLabelsImportTask??=i(async e=>{const t=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(t);return e.aborted?null:i}),s=await this._updatingHandles.addPromise(t.promise);if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:e,elevationInfo:Ce,labelOptions:this.sketchOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",e),hover:this.symbols.vertices.hover?.clone().set("color",e)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",e),hover:this.symbols.controlPoints.hover?.clone().set("color",e)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",e)};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default;for(const t of this.curveControlPointGraphics)this._isSelected(t)?t.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===t?t.symbol=this.symbols.controlPoints.hover:t.symbol=this.symbols.controlPoints.default;for(const t of this.constructionLineGraphics)t.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes[ne.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();e&&"multipoint"!==t.geometry?.type&&r.push(t),this._mover=new $({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:e}=this;null!=e&&0!==e.length&&(this._connectedReshapeManager??=new K({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic,i=this._isCurveControlPoint(t);if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(e);this.refresh(),s.length&&this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t)||i){if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)return void(i||this._removeVertices(t));e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e,o=this._connectedReshapeManager,r=o?je(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(e),this._emitMoveStartEvent(t,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const t=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(e);i.length&&(this._emitVertexAddEvent([s],t,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(e),r){const e=n.filter(e=>this._isVertex(e));o?.startVertexMove(r,Ue(e))}this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:t,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const e=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const t of e){if("point"===t.geometry?.type){const{pathIndex:e,pointIndex:i}=t.attributes,s=k(n)[e][i];if(s){const e=O(s);t.geometry=this._coordinateHelper.arrayToPoint(e)}}this._addToSelection(t.clone())}}}else{const e=we(n);this._updateVertexGraphicLocations(e)}this._connectedReshapeManager?.translate(t,o,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!t)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=e,{operationType:a}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(e,t){if(this._effectiveFilterVerticesEnabled&&"move"===t){const e=new Set;for(const t of this.selectedManipulators)e.add(Re(t));return this.refresh(e),void this._updateTooltip()}this._isMidpoint(e)||e.getAttribute(ne.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(e)?e:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(e,t,s){const o=e.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(e);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(e,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,t,r);c(i);const a=E(s);this._coordinateHelper.hasZ()||(a.z=void 0),this._syncGeometryAfterVertexMove(e,a,0,0),e.geometry=a}finally{a(),this._afterMoveStop(e,s)}})}_updateVertexGraphicLocations(e){const{_coordinateHelper:t}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=t.arrayToPoint(O(e[s][o]))}this._updateMidpointGraphicLocations(e),this._updateCurveGraphicLocations(e)}_updateMidpointGraphicLocations(e,t){const{_coordinateHelper:i}=this;if(t)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!t.has(o))continue;const a=t.get(o);if(!a.has(r)&&!a.has(n))continue;const h=e[o];s.geometry=new G(ae(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:t,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=e[t];s.geometry=new G(ae(n[o],n[r],i))}}_updateCurveGraphicLocations(e){const{spatialReference:t}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[e,t]=Te(s);null!=e&&null!=t&&s.getAttribute(ne.controlPointKind)&&a(i,e,()=>new Set)?.add(t)}for(const s of this.curveControlPointGraphics){const[t,o]=Te(s);if(i.get(t)?.has(o))continue;const r=e[t][o];if(P(r)||L(r)){const i=O(e[t][o-1]),n=P(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const e=s.getAttribute(ne.controlPointKind),[t,i]=e===he.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:t,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(ne.controlPointKind),[o,r]=Te(s),n=e[o],a=O(n[r-1]),h=O(n[r]),p=e[o][r];i===he.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:t}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:t})}}_refreshGraphicIndicesAttributes(e){const{componentIndex:t,vertexIndex:i}=e,s=e=>{const[s,o]=Te(e);s===t&&o>=i&&e.setAttribute(ne.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(ne.pathIndex)!==t)continue;const e=o.getAttribute(ne.pointIndexStart);e>=i&&(o.setAttribute(ne.pointIndexStart,e+1),o.setAttribute(ne.pointIndexEnd,o.getAttribute(ne.pointIndexEnd)+1))}}_getVertexFromEditGeometry(e){const[t,i]=Te(e);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=e.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(e,new G(this._stagedVertex),t,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=this._coordinateHelper.hasZ()?W(this.snappingManager)??i.z:void 0,this._stagedVertex=i,this._syncGeometryAfterVertexMove(e,new G(this._stagedVertex),t,s,h),r()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(e,i,t,s,h),r()}else r()}_syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=pe(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(t),h=this._getVertexFromEditGeometry(e);let p=null;if(h){const e=n.getZ(a);p=[h.pos[0],h.pos[1]];const t=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=e?e-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],t,i,s),this._connectedReshapeManager?.translate(t,i,s)}if("point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{if(e!==this.graphic){p&&!this._isVertex(e)&&(p=null);const o=n.spatialReference,[a,h]=Te(e);let l=Ie(r);const c=n.pointToArray(t);if(this._updateGeometryFromGraphic(e,l,a,h,c,o,"polygon"===r.type),this._isVertex(e)||this._isCurveControlPoint(e)){const t=new Map;t.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,e,c,t,p),l=this._moveSelectedHandleCoordinates(l,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,t),this._updateCurveGraphicLocations(l)}else this._isMidpoint(e)&&this._updateCurveGraphicLocations(l);le(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_syncEditGeometryOperations(e){const t=this._editGeometryOperations?.trySetGeometry(e);t||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(e,t,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),Le(e,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=t.geometry.x,n.coordinate[1]=t.geometry.y,n.graphic.geometry=t.geometry,this._relatedGraphicIndex.insert(n));return e}const{relatedGraphicIndices:r}=t.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return e;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Te(o);s&&a(s,r,()=>new Set).add(p),Le(e,r,p,i,n),o.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==t){const[t,a]=Te(n),h=n.getAttribute(ne.relatedGraphicIndices),p=Z(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,e,t,a,l,r,o),h?.length)for(const i of h){const t=this.vertexGraphics.at(i),[s,o]=Te(t);Le(e,s,o,l,r),t.geometry=p}}return e}_updateGeometryFromGraphic(e,t,i,s,o,r,n){const a=t[i].length-1;this._isCurveControlPoint(e)?He(t,i,s,[o[0],o[1]],e.getAttribute(ne.controlPointKind)):(Le(t,i,s,o,r),n&&(0===s?Le(t,i,a,o,r):s===a&&(t[i][0]=o)))}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)?t.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this._isCurveControlPoint(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.controlPoints.default),this.removeHandles(Se),this._updateTooltip()}_handleMidpointClickOrStartMove(e){const{graphic:t}=e,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pe(i),o=[],{[ne.pathIndex]:r,[ne.pointIndexStart]:n,[ne.pointIndexEnd]:a}=t.attributes,h=C(t.geometry),p=0===a?n+1:a;t.attributes={[ne.tool]:ce,[ne.pathIndex]:r,[ne.pointIndex]:p,[ne.relatedGraphicIndices]:[]};const l=Ie(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&e.viewEvent.native.shiftKey){const e=O(l[r][p]);l[r].splice(p,1,{c:[e,[h[0],h[1]]]}),t.setAttribute(ne.controlPointKind,he.circle.interior),t.setAttribute(ne.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(t),this.curveControlPointGraphics.push(t),le(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const e=O(l[r][n]),t=de(e,c,.5,this._coordinateHelper);l[r].splice(a,1,...t),o.push({coordinates:O(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(e){const t=Ae(e);for(const i of t)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(t)}_removeFromSelection(e,t){if(this._isVertex(e)){const{vertices:i}=this.symbols;e.symbol=t?i.hover:i.default}else if(this._isCurveControlPoint(e)){const{controlPoints:i}=this.symbols;e.symbol=t?i.hover:i.default}this.selectedManipulators.remove(e),this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){const e=this.selectedManipulators.toArray(),{controlPoints:t,vertices:i}=this.symbols;if(e.length>0){for(const s of e)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=t.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){null==this._activeOperationInfo&&xe(e,this.tooltip)||_e.delete.includes(e.key)&&!e.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),e.stopPropagation())}_removeVertices(e){const t=this.graphic.geometry,i=this.vertexGraphics.length;if(null==t||"polygon"!==t.type&&"polyline"!==t.type&&"multipoint"!==t.type)return;if("polygon"===t.type&&i<4||"multipoint"===t.type&&i<2||"polyline"===t.type&&i<3)return;const s=this.graphic.clone(),o=pe(t);let r=Ie(o);const n=[],a=Ae(e);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:e,y:t}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(e===a&&t===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const e=r[i][o];e&&!R(e)&&(r[i][o]=O(e))}}}}if("polygon"===o.type)r=r.filter(e=>{if(e.length<2)return!1;const[t,i]=O(e[0]),[s,o]=O(e[e.length-1]);return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);le(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isCurveControlPoint(e){return this.curveControlPointGraphics.includes(e)}_isConstructionLine(e){return this.constructionLineGraphics.includes(e)}_isSelected(e){return(this._isVertex(e)||this.curveControlPointGraphics.includes(e))&&this.selectedManipulators.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){const t=this._isMidpoint(e)?"copy":"move";this.addHandles(this.view.acquireCursor(t,"high"),Se)}_updateTooltip(e,t){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:e===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,t)):e&&this.selectedManipulators.length>1&&(i=r.translateVertices,ee(i,o,n,this._tooltipsContext,this._updatingHandles,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i={type:"move-start",mover:this.graphic,dx:e,dy:t};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i={type:"move",mover:this.graphic,dx:e,dy:t};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(e,t){if(null==e||null==t){const i=this._activeOperationInfo;if(!i)return;e=i.totalDx,t=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:e,dy:t};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t={type:"reshape-start",graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t={type:"reshape",graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t={type:"reshape-stop",graphic:this.graphic,mover:e,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t={type:"vertex-select",added:e};this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t={type:"vertex-deselect",removed:e};this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s={type:"vertex-add",added:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s={type:"vertex-remove",removed:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function we(e){let t=Ie(e);t=t.map(e=>e.slice());for(const i of t)for(let e=0;e<i.length;e++)i[e]=A(i[e]);if("polygon"===e.type)for(const i of t){const e=i[i.length-1];if(!R(e))continue;const t=i[0];t[0]===e[0]&&t[1]===e[1]&&i.length>2&&i.pop()}return t}function Ie(e){return"polygon"===e.type?e.curveRings?.slice()??e.rings.slice():"polyline"===e.type?e.curvePaths?.slice()??e.paths.slice():e.points.map(e=>[e])}function Ve(e,t,i,s){const o=e[t][i];if(P(o))o.c[1]=s;else if(L(o)){const o=O(e[t][i]);e[t][i]={c:[o,s]}}}function He(e,t,i,s,o){switch(o){case he.circle.interior:Ve(e,t,i,s);break;case he.bezier.cp1:e[t][i].b[1]=s;break;case he.bezier.cp2:e[t][i].b[2]=s}}function ke(e,t){return e<1e-8*t}function Oe(e,{cx:t,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=e,[l,c]=n,d=l-h,m=c-p;t-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[t,i]:v?[-i,t]:[i,-t],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(ke(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(ke(E**2+w**2,C)){const[e,t]=v?[-S,M]:[S,-M];return[e+M+h,t+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Pe(e,t,i){const s=x(new b({curvePaths:[[e,t]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:H(e,r)}function Le(e,t,i,s,o){const r=e[t][i],n=e[t].at(i+1);if(me(e,t)){const i=e[t][1];return e[t][0]=[...s],void(e[t][1]={a:[[...s],[...i.a[1]],0,0]})}if(ve(e,t)){const i=e[t][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return e[t][0]=[...s],void(e[t][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=O(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(P(r)||L(r)){const o=O(e[t][i-1]),n=P(r)?V(o,r):U(o,r);e[t].splice(i,1,{c:[[...s],Oe(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(e[t][i-1]);r.a=Pe(n,r,o).a}if(n&&!R(n)&&!T(r))if(P(n)||L(n)){const o=O(n),r=P(n)?V(a,n):U(a,n);e[t].splice(i+1,1,{c:[o,Oe(o,r,s,!1)]})}else if(j(n)){const e=O(r);n.a=Pe(e,n,o).a}}function Te({attributes:e}){return[e?.[ne.pathIndex]||0,e?.[ne.pointIndex]||0]}function Re({attributes:e}){return`${e?.[ne.pathIndex]}-${e?.[ne.pointIndex]}-${e?.[ne.controlPointKind]??"vertex"}`}function Ae(e){return e instanceof t?[e]:[...e]}function je(e){const t=e.sourceLayer??e.layer;return Y(t)?{graphic:e,layer:t}:null}function Ue(e){return e.toArray().map(({attributes:e})=>({pathIndex:e[ne.pathIndex],vertexIndex:e[ne.pointIndex]}))}e([_()],Ee.prototype,"_activeOperationInfo",void 0),e([_()],Ee.prototype,"_connectedReshapeManager",void 0),e([_()],Ee.prototype,"_coordinateHelper",null),e([_()],Ee.prototype,"_editGeometryOperations",void 0),e([_()],Ee.prototype,"_effectiveFilterVerticesEnabled",null),e([_()],Ee.prototype,"_primaryGraphicMoving",void 0),e([_()],Ee.prototype,"_segmentLabels",void 0),e([_()],Ee.prototype,"test",null),e([_()],Ee.prototype,"_segmentLabelsImportTask",void 0),e([_()],Ee.prototype,"_updatingHandles",void 0),e([_()],Ee.prototype,"_selectedManipulator",null),e([_()],Ee.prototype,"_tooltipsContext",null),e([_()],Ee.prototype,"callbacks",void 0),e([_()],Ee.prototype,"connectedReshapeProviders",void 0),e([_()],Ee.prototype,"enableMidpoints",void 0),e([_()],Ee.prototype,"enableCurveOnMidpoint",void 0),e([_()],Ee.prototype,"enableMovement",void 0),e([_()],Ee.prototype,"enableVertices",void 0),e([_()],Ee.prototype,"filterVerticesEnabled",void 0),e([_()],Ee.prototype,"graphic",void 0),e([_()],Ee.prototype,"highlightName",void 0),e([_()],Ee.prototype,"highlightsEnabled",void 0),e([_()],Ee.prototype,"layer",void 0),e([_()],Ee.prototype,"snappingManager",void 0),e([_({readOnly:!0})],Ee.prototype,"state",null),e([_()],Ee.prototype,"symbols",void 0),e([_()],Ee.prototype,"tooltip",void 0),e([_()],Ee.prototype,"tooltipInfos",void 0),e([_()],Ee.prototype,"activeTooltipInfo",void 0),e([_()],Ee.prototype,"updating",null),e([_({type:fe})],Ee.prototype,"sketchOptions",void 0),e([_({readOnly:!0})],Ee.prototype,"type",void 0),e([_({readOnly:!0})],Ee.prototype,"vertexGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"curveControlPointGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"constructionLineGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"midpointGraphics",void 0),e([_({readOnly:!0})],Ee.prototype,"selectedManipulators",void 0),e([_()],Ee.prototype,"view",void 0),Ee=e([g("esri.views.draw.support.Reshape")],Ee);const Fe=Ee;export{Fe as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,abortMaybe as p,assertIsSome as l}from"../../../core/maybe.js";import{throwIfAborted as c}from"../../../core/promiseUtils.js";import{pausable as d,when as m,watch as v,initial as u,sync as y}from"../../../core/reactiveUtils.js";import{property as _,subclass as g}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import G from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import{fromPolylineUsingImportOperator as x,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as S,geometryToCoordinates as C}from"../../../geometry/support/coordsUtils.js";import{fromJSON as E}from"../../../geometry/support/jsonUtils.js";import{isPoint as w}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as I}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as V,toEllipticArc7 as H}from"../../../geometry/support/curves/circularArcUtils.js";import{getPaths as O,getEndpoint as P,isCircularArc as L,isEllipticArc4 as k,isBezierCurve as T,isCoordinate as R,cloneCurve as A,isEllipticArc7 as j}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as U}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as F}from"../../../geometry/support/curves/mathUtils.js";import D from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as z}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as K}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as N,getZFromVertexSnappingCandidates as W,cloneMove as Z}from"./drawUtils.js";import $ from"./GraphicMover.js";import q from"./HighlightHelper.js";import{addUniqueLayer as X,isConnectedReshapeSupportedLayer as Y}from"./layerUtils.js";import{createTooltipInfos as B,connectTooltip as J,updateTranslateTooltipInfo as Q,updateTranslateVertexTooltipInfo as tt}from"./reshapeTooltipUtils.js";import{defaultSymbols as et,createMidpointGraphics as it,createVertexGraphics as st,createCurveControlPointGraphics as ot,createCurveConstructionLineGraphics as rt,attributeKeys as nt,getMidpoint as at,controlPointKinds as ht,fastCloneGeometry as pt,saveUpdatedCurveOrCoordinate as lt,toolIdAttribute as ct,splitCurve as dt,isSingleSegmentCircle as mt,isSingleSegmentEllipse as vt}from"./reshapeUtils.js";import{ViewEventPriorities as ut}from"../../input/InputManager.js";import{createCoordinateHelper as yt}from"../../interactive/coordinateHelper.js";import{sketchKeys as _t}from"../../interactive/keybindings.js";import{EditGeometryOperations as gt}from"../../interactive/editGeometry/EditGeometryOperations.js";import ft from"../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as Gt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as bt,enterInputModeIfAvailable as xt}from"../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Mt}from"../../support/GeometryWorkerHandle.js";const St=Symbol(),Ct={mode:"on-the-ground",offset:0};let Et=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._primaryGraphicMoving=!1,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._relatedGraphicIndex=null,this._updatingHandles=new f,this._measurementWorker=new Mt({preloadGeodetic:!0}),this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!1,this.enableMovement=!0,this.enableVertices=!0,this.filterVerticesEnabled=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=et,this.tooltip=null,this.activeTooltipInfo=null,this.toolOptions=new ft,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new q({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=d(()=>this.graphic?.geometry,t=>{if(!t||!0===this._primaryGraphicMoving)return;const e=new Set(this.selectedManipulators.map(Rt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t)),this.curveControlPointGraphics.filter(t=>e.has(Rt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).toArray();i&&h.push(o),s?.set("graphics",h)},y),this.tooltip=bt(()=>({view:t,options:this.toolOptions.tooltips})),this.tooltipInfos=B(this.toolOptions),this.addHandles([m(()=>t?.ready,()=>{const{layer:t,view:e}=this;X(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ut.TOOL))},{once:!0,initial:!0}),v(()=>this.graphic,()=>this.refresh()),...this._effectiveFilterVerticesEnabled?[v(()=>[this.view.viewpoint,this.view.stationary],()=>{this.view.stationary&&this.refresh()})]:[],v(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),v(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),v(()=>this.enableMidpoints,()=>this.refresh()),J(this.tooltip,()=>this._tooltipsContext,this._updatingHandles),v(()=>this.toolOptions.labels.enabled,t=>{this._segmentLabels?this._segmentLabels.visible=t:this._setUpGeometryHelper()}),v(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),u),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover=h(this._mover),this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._updatingHandles=h(this._updatingHandles),this._measurementWorker.destroy()}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??yt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _effectiveFilterVerticesEnabled(){return"2d"===this.view?.type&&this.filterVerticesEnabled}get test(){return{segmentLabels:this._segmentLabels}}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{toolOptions:t,activeTooltipInfo:e,graphic:i}=this;return{toolOptions:t,activeTooltipInfo:e,graphic:i,selectedVertex:this._selectedManipulator,measurementWorker:this._measurementWorker,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}get updating(){return!!(this._updatingHandles?.updating||this._connectedReshapeManager?.updating||this._segmentLabels?.updating||this.snappingManager?.updating)}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(t){if(this._reset(),this._setup(),t){for(const e of this.vertexGraphics)t.has(Rt(e))&&this._addToSelection(e);for(const e of this.curveControlPointGraphics)t.has(Rt(e))&&this._addToSelection(e)}}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&S(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager(),this._setUpGeometryHelper()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;if(null==t||"mesh"===t.type||"extent"===t.type)return this._segmentLabels=h(this._segmentLabels),void this._logGeometryTypeError();this._editGeometryOperations?this._syncEditGeometryOperations(t):this._editGeometryOperations=gt.fromGeometry(t,2,{allowCurves:!0}),this._updatingHandles.consumePromise(this._setupSegmentLabels())}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new D({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;l(i),this._snappingContext=new Gt({editGeometryOperations:i,elevationInfo:Ct,pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new z(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._segmentLabelsImportTask=p(this._segmentLabelsImportTask),this._segmentLabels=h(this._segmentLabels),this._activeOperationInfo=null,this._mover=h(this._mover),this.removeHandles(St),this._connectedReshapeManager?.finish()}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view.map?.layers.remove(this._snappingGraphicsLayer),h(this._snappingGraphicsLayer)),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;this._relatedGraphicIndex=null,t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=wt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=it(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type,this.filterVerticesEnabled?this.view.extent:null,this.filterVerticesEnabled?this.view.resolution:-1);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){if(this._removeVertexGraphics(),this._effectiveFilterVerticesEnabled){const e=st(t,this.symbols,this._coordinateHelper,this.view.extent,this.view.resolution);this._relatedGraphicIndex=e.graphicIndex,this.vertexGraphics.addMany(e.graphics),this.layer.addMany(e.graphics)}else{const e=st(t,this.symbols,this._coordinateHelper,null,-1).graphics;this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}}_setupCurveGraphics(t){this._removeCurveGraphics();const e=ot(t,this.symbols,this._coordinateHelper),i=rt(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}async _setupSegmentLabels(){const t=this._editGeometryOperations,e=this.toolOptions.labels.enabled;if(t&&this._segmentLabels?.context?.editGeometryOperations===t&&e||(this._segmentLabels=h(this._segmentLabels)),!this._segmentLabels&&t&&e){const e=this._segmentLabelsImportTask??=i(async t=>{const e=import("../../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:i}=await this._updatingHandles.addPromise(e);return t.aborted?null:i}),s=await this._updatingHandles.addPromise(e.promise);if(!s)return;this._segmentLabels=h(this._segmentLabels),this._segmentLabels=new s({context:{view:this.view,editGeometryOperations:t,elevationInfo:Ct,labelOptions:this.toolOptions.labels},visible:!0})}}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[nt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).toArray();t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new $({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager??=new K({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?jt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._primaryGraphicMoving=!0,this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),this._effectiveFilterVerticesEnabled&&this._resetGraphics(this.layer),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Ut(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else{if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const{dxMap:e,dyMap:o}=N(i,s,this.view);if(this._effectiveFilterVerticesEnabled){if(this.selectedManipulators.length>0){const t=this.selectedManipulators.toArray();this.selectedManipulators.removeAll();for(const e of t){if("point"===e.geometry?.type){const{pathIndex:t,pointIndex:i}=e.attributes,s=O(n)[t][i];if(s){const t=P(s);e.geometry=this._coordinateHelper.arrayToPoint(t)}}this._addToSelection(e.clone())}}}else{const t=wt(n);this._updateVertexGraphicLocations(t)}this._connectedReshapeManager?.translate(e,o,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}this._syncEditGeometryOperations(n)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(this._primaryGraphicMoving=!1,!e)return;const{dx:i,dy:s,graphic:o,x:r,y:n}=t,{operationType:a}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>this._handleVertexSnap(o,{x:r,y:n},a))}_afterMoveStop(t,e){if(this._effectiveFilterVerticesEnabled&&"move"===e){const t=new Set;for(const e of this.selectedManipulators)t.add(Rt(e));return this.refresh(t),void this._updateTooltip()}this._isMidpoint(t)||t.getAttribute(nt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(t)?t:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_handleVertexSnap(t,e,s){const o=t.geometry,r=this.snappingManager?.getVertexCandidates(),n=this.callbacks.onVertexSnap,a=()=>"move"===s?this._emitMoveStopEvent():this._emitReshapeStopEvent(t);if(!(n&&o&&w(o)&&r&&0!==r.length))return a(),void this._afterMoveStop(t,s);p(this._snappingTask),this._snappingTask=i(async i=>{try{const s=await n(o,e,r);c(i);const a=E(s);this._coordinateHelper.hasZ()||(a.z=void 0),this._syncGeometryAfterVertexMove(t,a,0,0),t.geometry=a}finally{a(),this._afterMoveStop(t,s)}})}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(P(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t,e){const{_coordinateHelper:i}=this;if(e)for(const s of this.midpointGraphics){const{pathIndex:o,pointIndexStart:r,pointIndexEnd:n}=s.attributes;if(!e.has(o))continue;const a=e.get(o);if(!a.has(r)&&!a.has(n))continue;const h=t[o];s.geometry=new G(at(h[r],h[n],i))}else for(const s of this.midpointGraphics){const{pathIndex:e,pointIndexStart:o,pointIndexEnd:r}=s.attributes,n=t[e];s.geometry=new G(at(n[o],n[r],i))}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Tt(s);null!=t&&null!=e&&s.getAttribute(nt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Tt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(L(r)||k(r)){const i=P(t[e][o-1]),n=L(r)?V(i,r):U(i,r),[a,h]=I(n,.25);s.geometry=new G({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(T(r)){const t=s.getAttribute(nt.controlPointKind),[e,i]=t===ht.bezier.cp1?r.b[1]:r.b[2];s.geometry=new G({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(nt.controlPointKind),[o,r]=Tt(s),n=t[o],a=P(n[r-1]),h=P(n[r]),p=t[o][r];i===ht.bezier.line1?s.geometry=new b({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new b({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Tt(t);s===e&&o>=i&&t.setAttribute(nt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(nt.pathIndex)!==e)continue;const t=o.getAttribute(nt.pointIndexStart);t>=i&&(o.setAttribute(nt.pointIndexStart,t+1),o.setAttribute(nt.pointIndexEnd,o.getAttribute(nt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Tt(t);return l(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&w(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});if(p.valid){const i=p.apply();i.z=this._coordinateHelper.hasZ()?W(this.snappingManager)??i.z:void 0,this._stagedVertex=i,this._syncGeometryAfterVertexMove(t,new G(this._stagedVertex),e,s,h),r()}}),this._updatingHandles.consumePromise(this._snappingTask.promise)}else{const i=null!=this._stagedVertex?new G(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}else r()}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=pt(this._editGeometryOperations?.data.geometry);if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);let p=null;if(h){const t=n.getZ(a);p=[h.pos[0],h.pos[1]];const e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){p&&!this._isVertex(t)&&(p=null);const o=n.spatialReference,[a,h]=Tt(t);let l=It(r);const c=n.pointToArray(e);if(this._updateGeometryFromGraphic(t,l,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)){const e=new Map;e.set(a,new Set([h])),l=this._moveRelatedCoordinates(l,t,c,e,p),l=this._moveSelectedHandleCoordinates(l,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(l,e),this._updateCurveGraphicLocations(l)}else this._isMidpoint(t)&&this._updateCurveGraphicLocations(l);lt(r,l)}this._updateGraphicGeometry(r),this._syncEditGeometryOperations(r),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_syncEditGeometryOperations(t){const e=this._editGeometryOperations?.trySetGeometry(t);e||(this._editGeometryOperations=null,this._setUpGeometryHelper())}_moveRelatedCoordinates(t,e,i,s,o){if(this._effectiveFilterVerticesEnabled&&this._relatedGraphicIndex&&o){const r=this._relatedGraphicIndex.search({minX:o[0],maxX:o[0],minY:o[1],maxY:o[1]});for(const n of r)n.coordinate[0]===o[0]&&n.coordinate[1]===o[1]&&n.graphic&&(s&&a(s,n.pathIndex,()=>new Set).add(n.pointIndex),kt(t,n.pathIndex,n.pointIndex,i,this._coordinateHelper.spatialReference),this._relatedGraphicIndex.remove(n),n.coordinate[0]=e.geometry.x,n.coordinate[1]=e.geometry.y,n.graphic.geometry=e.geometry,this._relatedGraphicIndex.insert(n));return t}const{relatedGraphicIndices:r}=e.attributes,n=this._coordinateHelper.spatialReference;if(!r?.length)return t;for(const h of r){const o=this.vertexGraphics.at(h),[r,p]=Tt(o);s&&a(s,r,()=>new Set).add(p),kt(t,r,p,i,n),o.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Tt(n),h=n.getAttribute(nt.relatedGraphicIndices),p=Z(n.geometry,i,s,this.view),l=C(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,l,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Tt(e);kt(t,s,o,l,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?Ht(e,i,s,[o[0],o[1]],t.getAttribute(nt.controlPointKind)):(kt(e,i,s,o,r),n&&(0===s?kt(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(St),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=pt(i),o=[],{[nt.pathIndex]:r,[nt.pointIndexStart]:n,[nt.pointIndexEnd]:a}=e.attributes,h=C(e.geometry),p=0===a?n+1:a;e.attributes={[nt.tool]:ct,[nt.pathIndex]:r,[nt.pointIndex]:p,[nt.relatedGraphicIndices]:[]};const l=It(s),c=l[r][a];if(R(c)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=P(l[r][p]);l[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(nt.controlPointKind,ht.circle.interior),e.setAttribute(nt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),lt(s,l)}else l[r].splice(p,0,h),o.push({coordinates:l[r][p],componentIndex:r,vertexIndex:p})}else{const t=P(l[r][n]),e=dt(t,c,.5,this._coordinateHelper);l[r].splice(a,1,...e),o.push({coordinates:P(l[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),this._syncEditGeometryOperations(s),o}_addToSelection(t){const e=At(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&xt(t,this.tooltip)||_t.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&(this._removeVertices(this.selectedManipulators),t.stopPropagation())}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=pt(e);let r=It(o);const n=[],a=At(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=P(s[o]);if(t===a&&e===h){n.push({coordinates:P(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!R(t)&&(r[i][o]=P(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=P(t[0]),[s,o]=P(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);lt(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),St)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,Q(i,o,this._tooltipsContext,this._updatingHandles,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,tt(i,o,n,this._tooltipsContext,this._updatingHandles,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function wt(t){let e=It(t);e=e.map(t=>t.slice());for(const i of e)for(let t=0;t<i.length;t++)i[t]=A(i[t]);if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!R(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function It(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Vt(t,e,i,s){const o=t[e][i];if(L(o))o.c[1]=s;else if(k(o)){const o=P(t[e][i]);t[e][i]={c:[o,s]}}}function Ht(t,e,i,s,o){switch(o){case ht.circle.interior:Vt(t,e,i,s);break;case ht.bezier.cp1:t[e][i].b[1]=s;break;case ht.bezier.cp2:t[e][i].b[2]=s}}function Ot(t,e){return t<1e-8*e}function Pt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[l,c]=n,d=l-h,m=c-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],b=_*G-g*f,x=(d**2+m**2)/2;if(Ot(Math.abs(b),x))return[(h+l)/2,(p+c)/2];const[M,S]=[G/b*x,-f/b*x],C=M**2+S**2,[E,w]=[d/2-M,m/2-S];if(Ot(E**2+w**2,C)){const[t,e]=v?[-S,M]:[S,-M];return[t+M+h,e+S+p]}const I=Math.sqrt((M**2+S**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*I+M+h,w*I+S+p]}function Lt(t,e,i){const s=x(new b({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return j(r)?r:H(t,r)}function kt(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(mt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(vt(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,l]=[n-o,a-r],c=F(l,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,c,h,i.a[6]]})}const a=P(r);if(R(r))r.splice(0,r.length,...s);else if(T(r))r.b[0].splice(0,r.b[0].length,...s);else if(L(r)||k(r)){const o=P(t[e][i-1]),n=L(r)?V(o,r):U(o,r);t[e].splice(i,1,{c:[[...s],Pt(o,n,s,!0)]})}else if(j(r)){r.a[0].splice(0,r.a[0].length,...s);const n=P(t[e][i-1]);r.a=Lt(n,r,o).a}if(n&&!R(n)&&!T(r))if(L(n)||k(n)){const o=P(n),r=L(n)?V(a,n):U(a,n);t[e].splice(i+1,1,{c:[o,Pt(o,r,s,!1)]})}else if(j(n)){const t=P(r);n.a=Lt(t,n,o).a}}function Tt({attributes:t}){return[t?.[nt.pathIndex]||0,t?.[nt.pointIndex]||0]}function Rt({attributes:t}){return`${t?.[nt.pathIndex]}-${t?.[nt.pointIndex]}-${t?.[nt.controlPointKind]??"vertex"}`}function At(t){return t instanceof e?[t]:[...t]}function jt(t){const e=t.sourceLayer??t.layer;return Y(e)?{graphic:t,layer:e}:null}function Ut(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[nt.pathIndex],vertexIndex:t[nt.pointIndex]}))}t([_()],Et.prototype,"_activeOperationInfo",void 0),t([_()],Et.prototype,"_connectedReshapeManager",void 0),t([_()],Et.prototype,"_coordinateHelper",null),t([_()],Et.prototype,"_editGeometryOperations",void 0),t([_()],Et.prototype,"_effectiveFilterVerticesEnabled",null),t([_()],Et.prototype,"_primaryGraphicMoving",void 0),t([_()],Et.prototype,"_segmentLabels",void 0),t([_()],Et.prototype,"test",null),t([_()],Et.prototype,"_segmentLabelsImportTask",void 0),t([_()],Et.prototype,"_updatingHandles",void 0),t([_()],Et.prototype,"_selectedManipulator",null),t([_()],Et.prototype,"_tooltipsContext",null),t([_()],Et.prototype,"callbacks",void 0),t([_()],Et.prototype,"connectedReshapeProviders",void 0),t([_()],Et.prototype,"enableMidpoints",void 0),t([_()],Et.prototype,"enableCurveOnMidpoint",void 0),t([_()],Et.prototype,"enableMovement",void 0),t([_()],Et.prototype,"enableVertices",void 0),t([_()],Et.prototype,"filterVerticesEnabled",void 0),t([_()],Et.prototype,"graphic",void 0),t([_()],Et.prototype,"highlightName",void 0),t([_()],Et.prototype,"highlightsEnabled",void 0),t([_()],Et.prototype,"layer",void 0),t([_()],Et.prototype,"snappingManager",void 0),t([_({readOnly:!0})],Et.prototype,"state",null),t([_()],Et.prototype,"symbols",void 0),t([_()],Et.prototype,"tooltip",void 0),t([_()],Et.prototype,"tooltipInfos",void 0),t([_()],Et.prototype,"activeTooltipInfo",void 0),t([_()],Et.prototype,"updating",null),t([_()],Et.prototype,"toolOptions",void 0),t([_({readOnly:!0})],Et.prototype,"type",void 0),t([_({readOnly:!0})],Et.prototype,"vertexGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"curveControlPointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"constructionLineGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"midpointGraphics",void 0),t([_({readOnly:!0})],Et.prototype,"selectedManipulators",void 0),t([_()],Et.prototype,"view",void 0),Et=t([g("esri.views.draw.support.Reshape")],Et);const Ft=Et;export{Ft as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../geometry/Multipoint.js";import{getEndpoint as e}from"../../../geometry/support/curves/curveUtils.js";function n(t){if(!t)return"mouse";if("pointerType"in t)return t.pointerType;if("native"in t&&t.native&&"pointerType"in t.native){const e=t.native.pointerType;if("pen"===e||"touch"===e)return e}return"mouse"}function i(t){const{originalEvent:e,stopPropagation:n}=t;e&&n&&"stopPropagation"in e&&e.stopPropagation()}function o(n){if("multipoint"===n.type||"point"===n.type)return n;const i=new t({spatialReference:n.spatialReference});return"polyline"===n.type?i.points=n.curvePaths?.flatMap(t=>t.map(t=>e(t)))??n.paths.flat():"polygon"===n.type&&(i.points=n.curveRings?.flatMap(t=>t.map(t=>e(t)))??n.rings.flat()),i}export{n as getPointerType,i as markHandled,o as multipointFromGeometry};
2
+ import t from"../../../geometry/Multipoint.js";import{getEndpoint as n}from"../../../geometry/support/curves/curveUtils.js";function e(t){if(!t)return"mouse";if("pointerType"in t)return t.pointerType;if("native"in t&&t.native&&"pointerType"in t.native){const n=t.native.pointerType;if("pen"===n||"touch"===n)return n}return"mouse"}function i(t){if(!t)return null;const n="native"in t?t.native:t;return"pointerId"in n&&"number"==typeof n.pointerId?n.pointerId:null}function o(t){const{originalEvent:n,stopPropagation:e}=t;n&&e&&"stopPropagation"in n&&n.stopPropagation()}function r(e){if("multipoint"===e.type||"point"===e.type)return e;const i=new t({spatialReference:e.spatialReference});return"polyline"===e.type?i.points=e.curvePaths?.flatMap(t=>t.map(t=>n(t)))??e.paths.flat():"polygon"===e.type&&(i.points=e.curveRings?.flatMap(t=>t.map(t=>n(t)))??e.rings.flat()),i}export{i as getPointerId,e as getPointerType,o as markHandled,r as multipointFromGeometry};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import a from"../../../../core/Collection.js";import{getOrCreateMapValue as n}from"../../../../core/MapUtils.js";import r from"../../../../core/ReactiveMap.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as p}from"../../DrawManipulator.js";import{DrawManipulator3D as d}from"../../DrawManipulator3D.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as h}from"../../../interactive/ManipulatorCollection.js";const c=Symbol("manipulator-handle-watch");let g=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new r,this._pluginHandleRegistry=new r,this._handleManipulatorMap=new a,this.renderer=null,this.manipulators=new h,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){const{capturingHandle:t,_handleManipulatorMap:a}=this;if(!t)return void this.followHandle(a.at(0)?.handle);const n=a.findIndex(({handle:e})=>e===t),r="forward"===e?n+1:n-1;this.followHandle(a.at(r%a.length)?.handle)}toggleFollow(){const e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;const t=this._handleManipulatorMap.find(e=>"grabbable-object"!==e.handle.defaultCaptureMode)?.handle;return!!t&&(this.followHandle(t),!0)}releaseHandle(e){e&&(e.captureMode="grabbable-object",e.drawToolDragging=!1),e&&e!==this.capturingHandle||(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode="grabbable-object"),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{"grabbable-object"!==e.captureMode&&(e.captureMode="grabbable-object")}),e&&(e.captureMode="grabbable-object"===e.defaultCaptureMode?"capture-always":e.defaultCaptureMode),"grabbable-object"!==e?.captureMode&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let a=null,n=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:r,manipulator:i})=>{if("grabbable-object"!==r.captureMode||!i.interactive)return;const o=i.intersectionDistance(e,t);null!=o&&o<n&&(n=o,a=r)}),a}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,a){const{view:n}=this,{surfaceManager:r}=a,l=a.editGeometryOperations?.data.coordinateHelper;if(!n||!r||!l)return;const s="3d"===n.type?new d({view:n,renderer:this.renderer,managedHandle:e}):new p({renderer:this.renderer,managedHandle:e});this._handleManipulatorMap.push({handle:e,manipulator:s}),this.manipulators.add(s),e.addHandles([i(()=>s.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],c),e.following&&(this.capturingHandle=e);const u=(e.inputMapPosition&&r.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(n?.width/2,n.height/2);await(e?.moveTo(u,{...a,pointerType:"mouse"}))}removeManipulatorForHandle(e){const t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(c)}registerHandle(e,t){const r=n(this._pluginHandleRegistry,e,()=>new a),i=new u(t);return r.push(i),i}unregisterHandle(e,t){const a=this._pluginHandleRegistry.get(e);a&&(t?(a.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(a.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,a){n(this._pluginConstraintRegistry,e,()=>new r).set(t,a)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){const a=this._pluginHandleRegistry.get(e);if(a)for(const n of a)n.editSession=t}updateAllScreenPositions(e=null){const{view:t}=this;this._handleManipulatorMap.forEach(({handle:a})=>{const n=a.outputMapPosition;n&&(a.screenPosition=e?.mapToScreen(n,{firstPointZ:a.firstPointZ})??t?.toScreen(n))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}};e([l({constructOnly:!0})],g.prototype,"renderer",void 0),e([l({readOnly:!0})],g.prototype,"manipulators",void 0),e([l({constructOnly:!0})],g.prototype,"view",void 0),e([l()],g.prototype,"capturingHandle",void 0),e([l()],g.prototype,"customConstraints",null),e([l()],g.prototype,"focusedHandle",null),e([l()],g.prototype,"handleCount",null),e([l()],g.prototype,"allhandles",null),g=e([s("esri.views.draw.support.managers.InteractiveHandleManager")],g);export{g as InteractiveHandleManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import n from"../../../../core/Collection.js";import{getOrCreateMapValue as a}from"../../../../core/MapUtils.js";import r from"../../../../core/ReactiveMap.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as o}from"../../../../core/screenUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{DrawManipulator as p}from"../../DrawManipulator.js";import{DrawManipulator3D as d}from"../../DrawManipulator3D.js";import{InteractiveHandle as u}from"../InteractiveHandle.js";import{ManipulatorCollection as c}from"../../../interactive/ManipulatorCollection.js";const h=Symbol("manipulator-handle-watch");let g=class extends t{constructor(e){super(e),this._pluginConstraintRegistry=new r,this._pluginHandleRegistry=new r,this._handleManipulatorMap=new n,this.renderer=null,this.manipulators=new c,this.view=null,this.capturingHandle=null}initialize(){super.initialize()}destroy(){this._pluginConstraintRegistry.clear(),this._pluginHandleRegistry.forEach(e=>e.drain(e=>e.destroy())),this._pluginHandleRegistry.clear(),this._handleManipulatorMap.removeAll()}get customConstraints(){return Array.from(this._pluginConstraintRegistry.values()).flatMap(e=>Array.from(e.values()))}get focusedHandle(){return this.capturingHandle??this._handleManipulatorMap.find(({handle:e,manipulator:t})=>e.dragging||t.grabbing||t.selected||t.hovering)?.handle}get handleCount(){return this._handleManipulatorMap.length}get allhandles(){return this._handleManipulatorMap.map(({handle:e})=>e).toArray()}cycleManipulator(e){const{capturingHandle:t,_handleManipulatorMap:n}=this;if(!t)return void this.followHandle(n.at(0)?.handle);const a=n.findIndex(({handle:e})=>e===t),r="forward"===e?a+1:a-1;this.followHandle(n.at(r%n.length)?.handle)}toggleFollow(){const e=this.capturingHandle;if(e)return this.releaseHandle(e),!0;const t=this._handleManipulatorMap.find(e=>"grabbable-object"!==e.handle.defaultCaptureMode)?.handle;return!!t&&(this.followHandle(t),!0)}shouldCaptureInput(e=null,t=null){const n=this.capturingHandle;return!n||(null==e||null==n.activePointerId||n.activePointerId===e)&&("touch"!==t||"pen"!==n.activePointerType)}notePointerDown(e=null,t=null){this.shouldCaptureInput(e,t)&&this.capturingHandle?.notePointerDown(e,t)}notePointerUp(e=null,t=null){this.capturingHandle?.notePointerUp(e,t)}releaseHandle(e){e&&(e.captureMode="grabbable-object",e.drawToolDragging=!1),e&&e!==this.capturingHandle||(this.capturingHandle&&(this.capturingHandle.drawToolDragging=!1,this.capturingHandle.captureMode="grabbable-object"),this.capturingHandle=null)}followHandle(e){this._handleManipulatorMap.forEach(({handle:e})=>{"grabbable-object"!==e.captureMode&&(e.captureMode="grabbable-object")}),e&&(e.captureMode="grabbable-object"===e.defaultCaptureMode?"capture-always":e.defaultCaptureMode),"grabbable-object"!==e?.captureMode&&(this.capturingHandle=e)}findHandleByManipulator(e,t){let n=null,a=Number.MAX_VALUE;return this._handleManipulatorMap.forEach(({handle:r,manipulator:i})=>{if("grabbable-object"!==r.captureMode||!i.interactive)return;const o=i.intersectionDistance(e,t);null!=o&&o<a&&(a=o,n=r)}),n}findHandleDragging(){return this._handleManipulatorMap.find(({handle:e})=>e.dragging)?.handle}async setupManipulatorForHandle(e,t,n){const{view:a}=this,{surfaceManager:r}=n,l=n.editGeometryOperations?.data.coordinateHelper;if(!a||!r||!l)return;const s="3d"===a.type?new d({view:a,renderer:this.renderer,managedHandle:e}):new p({renderer:this.renderer,managedHandle:e});this._handleManipulatorMap.push({handle:e,manipulator:s}),this.manipulators.add(s),e.addHandles([i(()=>s.dragging,t=>{e.manipulatorDragging=t,t||this.releaseHandle(e)})],h),e.following&&(this.capturingHandle=e);const u=(e.inputMapPosition&&r.mapToScreen(e.inputMapPosition,{firstPointZ:e.firstPointZ}))??e.screenPosition??t??o(a?.width/2,a.height/2);await(e?.moveTo(u,{...n,pointerType:"mouse"}))}removeManipulatorForHandle(e){const t=this._handleManipulatorMap.find(t=>t.handle===e);t&&(this.manipulators.remove(t.manipulator),this._handleManipulatorMap.remove(t),t.manipulator.destroy()),e.removeHandles(h)}registerHandle(e,t){const r=a(this._pluginHandleRegistry,e,()=>new n),i=new u(t);return r.push(i),i}unregisterHandle(e,t){const n=this._pluginHandleRegistry.get(e);n&&(t?(n.remove(t),this.removeManipulatorForHandle(t),t.destroy()):(n.drain(e=>{this.removeManipulatorForHandle(e),e.destroy()}),this._pluginHandleRegistry.delete(e)))}registerCustomConstraint(e,t,n){a(this._pluginConstraintRegistry,e,()=>new r).set(t,n)}unregisterCustomConstraint(e,t){t?this._pluginConstraintRegistry.get(e)?.delete(t):(this._pluginConstraintRegistry.get(e)?.clear(),this._pluginConstraintRegistry.delete(e))}replaceEditSessions(e,t){const n=this._pluginHandleRegistry.get(e);if(n)for(const a of n)a.editSession=t}updateAllScreenPositions(e=null){const{view:t}=this;this._handleManipulatorMap.forEach(({handle:n})=>{const a=n.outputMapPosition;a&&(n.screenPosition=e?.mapToScreen(a,{firstPointZ:n.firstPointZ})??t?.toScreen(a))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}};e([l({constructOnly:!0})],g.prototype,"renderer",void 0),e([l({readOnly:!0})],g.prototype,"manipulators",void 0),e([l({constructOnly:!0})],g.prototype,"view",void 0),e([l()],g.prototype,"capturingHandle",void 0),e([l()],g.prototype,"customConstraints",null),e([l()],g.prototype,"focusedHandle",null),e([l()],g.prototype,"handleCount",null),e([l()],g.prototype,"allhandles",null),g=e([s("esri.views.draw.support.managers.InteractiveHandleManager")],g);export{g as InteractiveHandleManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{createTask as o}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import{getOrCreateMapValue as n}from"../../../../core/MapUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import r from"../../../../core/ReactiveMap.js";import{watch as l,syncAndInitial as a,initial as p}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{isLoaded as h,load as m}from"../../../../geometry/coordinateFormatter.js";import{absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import{ManagedTooltipField as g}from"../ManagedTooltipField.js";import{getConstraintContext as v}from"../../../interactive/sketch/constraintUtils.js";import{makeTooltip as y}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{makeScalarField as _,makeOrientationField as H,makeAreaField as F,makeLengthField as T,makeRadiusField as I,makeTotalLengthField as k,makeSizeField as x,makeScaleField as w,makeYField as M,makeXField as j,makeLongitudeField as A,makeLatitudeField as b,makeElevationField as E,makeDistanceField as C,makeDirectionField as O}from"../../../interactive/tooltip/fields/fields.js";import{TooltipField as L}from"../../../interactive/tooltip/fields/TooltipField.js";import{DynamicTooltipInfo as P,isKnownConstraintField as S}from"../../../interactive/tooltip/infos/DynamicTooltipInfo.js";let R=class extends e{constructor(t){super(t),this._pluginTooltipFieldRegistry=new r,this._updatingHandles=new u,this._coordinateFormatterLoadTask=null,this._constraintSnapshot=null,this.constraintsEnabled=!0,this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled=!1}initialize(){this.addHandles([l(()=>[this.effectiveEnabled,this.context?.view,this.context?.sketchOptions],([t,e,o])=>{const{context:i}=this;t&&e&&o?(this._tooltipInfo??=new P({sketchOptions:o,getAllFields:()=>this.allFields,getActiveHandle:()=>this.effectiveActiveHandle,getHelpMessageKey:()=>this.context?.getHelpMessageKey(),viewType:e.type}),this._tooltip||this._setupTooltip(i)):(this._tooltip=s(this._tooltip),this._tooltipInfo=s(this._tooltipInfo),this.inputModeHandle=null)},a)])}destroy(){this._tooltip=s(this._tooltip),this._tooltipInfo=s(this._tooltipInfo)}get context(){return this.getDependencies?.()}get focusedHandle(){return this.context?.getActiveHandle?.()}get allHandles(){return this.context?.getAllHandles?.()}get effectiveActiveHandle(){return this._tooltip?.isInInputMode?this.inputModeHandle:this.focusedHandle}get updating(){return this._updatingHandles.updating}get tooltip(){return this._tooltip}get tooltipInfo(){return this._tooltipInfo}get elevationConstraint(){return this.getConstraints(this.focusedHandle)?.elevation}get allFields(){return Array.from(this._pluginTooltipFieldRegistry.values()).flatMap(t=>Array.from(t.values()))}get effectiveEnabled(){return this.context?.sketchOptions.tooltips.effectiveEnabled||this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled}getConstraints(t){const{tooltipInfo:e,context:o}=this,{view:i,editGeometryOperations:n,elevationInfo:s,sketchOptions:r}=o??{},l=this.getLastScreenPosition?.();if(!(l&&i&&e&&n&&r))return null;const{coordinateHelper:a,spatialReference:p}=n.data,d=i.toMap(l);if(!d)return null;const c=v(d,i,p,s??f,a.hasZ(),r.values.effectiveDirectionMode);return{...V(e.getConstraintFieldsForHandle(t)),context:c}}storeConstraintSnapshot(){const t=this.tooltipInfo?.allFields.filter(t=>t.locked&&!t.unlockOnVertexPlacement).filter(S);this._constraintSnapshot=t?.length?V(t):null}unlockOnVertexPlacement(){this.tooltipInfo?.allFields.forEach(t=>{t.unlockOnVertexPlacement&&(t.committed=null)})}unregisterPluginFields(t){const e=this._pluginTooltipFieldRegistry.get(t);e?.forEach(t=>t.destroy()),e?.clear(),this._pluginTooltipFieldRegistry.delete(t)}createMeasuredField(t,{id:e,preset:o,getMeasurementInput:i,measure:n,fieldProperties:s,fieldFilters:r}){const a=this._getOrCreateField(t,e,o,s,r);return a.registerMeasurement(i,n,()=>this.tooltipInfo?.renderContext),a.addHandles(l(()=>this.tooltipInfo?.isEffectiveVisibleField(a.field),t=>a.enabled=!!t,p)),a}createCustomField(t,{id:e,preset:o,fieldProperties:i,fieldFilters:n}){return this._getOrCreateField(t,e,o,i,n)}_setupTooltip(t){const e=this._tooltip=y(()=>({view:t.view,options:t.sketchOptions.tooltips,info:this.tooltipInfo}));e.addHandles([l(()=>this.focusedHandle,t=>{(t&&(!e.isInInputMode||null==this.inputModeHandle)||this.inputModeHandle&&!this.allHandles?.includes(this.inputModeHandle))&&(this.inputModeHandle=t)},a),l(()=>this.focusedHandle?.screenPosition,t=>{t?(e.position=t,e.hidden=!1):e.hidden=!0},a),e.on("commit",()=>{this.context?.notifyTooltipsChanged()})]),this._coordinateFormatterLoadTask||h()||(this._coordinateFormatterLoadTask=o(()=>m()),this.addHandles(this._coordinateFormatterLoadTask),this._updatingHandles.addPromise(this._coordinateFormatterLoadTask.promise))}_getOrCreateField(t,e,o,i,s){const l=n(this._pluginTooltipFieldRegistry,t,()=>new r);if(l.has(e))return l.get(e);const a=G(o,i),p=new g({field:a,displayGroup:i?.displayGroup,...s});l.set(e,p);const d=S(a)?this._constraintSnapshot?.[a.name]:void 0;return d&&a.lock(d),p}};function U(t){return null!=t&&"unit"in t&&"rotationType"in t?t:null}function D(t){return null==t||"rotationType"in t?null:t}function G(t,e){const o=e?{...e}:{};switch(delete o.displayGroup,t){case"area":return F({...o,name:"area"});case"direction":return O({...o,name:"direction"});case"distance":return C({...o,name:"distance"});case"elevation":{const t=E({...o,name:"elevation"});return t.showAsZ=!0,t}case"latitude":return b({...o,name:"y"});case"longitude":return A({...o,name:"x"});case"x":return j({...o,name:"x"});case"y":return M({...o,name:"y"});case"orientation":return H({...o,name:"orientation"});case"scale":return w({...o,name:"scale"});case"size":return x({...o,name:"size"});case"totalLength":return k({...o,name:"totalLength"});case"radius":return I({...o,name:"radius"});case"generic-length":return T({...o,name:null});case"generic-area":return F({...o,name:null});case"generic-angle":return H({...o,name:null});case"generic-scalar":return _({...o,name:null});default:if(!o)throw new i("draw-tool:tooltips:invalid-field-config","Attempted to create a tooltip without a preset definition and without tooltip configuration.");return new L(o)}}function V(t){const e={};for(const o of t)switch(o.name){case"direction":case"distance":case"elevation":e[o.name]=o.committed;break;case"x":e[o.name]=D(o.committed),e.longitude=U(o.committed);break;case"y":e[o.name]=D(o.committed),e.latitude=U(o.committed)}return e}t([d()],R.prototype,"_updatingHandles",void 0),t([d()],R.prototype,"_tooltip",void 0),t([d()],R.prototype,"_tooltipInfo",void 0),t([d()],R.prototype,"_coordinateFormatterLoadTask",void 0),t([d()],R.prototype,"_constraintSnapshot",void 0),t([d()],R.prototype,"getDependencies",void 0),t([d()],R.prototype,"getLastScreenPosition",void 0),t([d()],R.prototype,"context",null),t([d()],R.prototype,"inputModeHandle",void 0),t([d()],R.prototype,"focusedHandle",null),t([d()],R.prototype,"allHandles",null),t([d()],R.prototype,"effectiveActiveHandle",null),t([d()],R.prototype,"updating",null),t([d()],R.prototype,"tooltip",null),t([d()],R.prototype,"tooltipInfo",null),t([d()],R.prototype,"constraintsEnabled",void 0),t([d()],R.prototype,"elevationConstraint",null),t([d()],R.prototype,"allFields",null),t([d()],R.prototype,"keepTooltipAliveEvenWhenTooltipsAreNotEnabled",void 0),t([d()],R.prototype,"effectiveEnabled",null),R=t([c("esri.views.draw.support.managers.TooltipManager")],R);export{R as TooltipManager};
2
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{createTask as o}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import{getOrCreateMapValue as n}from"../../../../core/MapUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import s from"../../../../core/ReactiveMap.js";import{watch as l,syncAndInitial as a,initial as p}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{isLoaded as m,load as f}from"../../../../geometry/coordinateFormatter.js";import{absoluteHeightElevationInfo as h}from"../../../../support/elevationInfoUtils.js";import{ManagedTooltipField as g}from"../ManagedTooltipField.js";import{getConstraintContext as v}from"../../../interactive/sketch/constraintUtils.js";import{makeTooltip as y}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{makeScalarField as _,makeOrientationField as H,makeAreaField as F,makeLengthField as T,makeRadiusField as I,makeTotalLengthField as x,makeSizeField as w,makeScaleField as M,makeYField as j,makeXField as A,makeLongitudeField as k,makeLatitudeField as b,makeElevationField as E,makeDistanceField as C,makeDirectionField as O}from"../../../interactive/tooltip/fields/fields.js";import{TooltipField as L}from"../../../interactive/tooltip/fields/TooltipField.js";import{DynamicTooltipInfo as P,isKnownConstraintField as S}from"../../../interactive/tooltip/infos/DynamicTooltipInfo.js";let R=class extends e{constructor(t){super(t),this._pluginTooltipFieldRegistry=new s,this._updatingHandles=new u,this._coordinateFormatterLoadTask=null,this._constraintSnapshot=null,this.constraintsEnabled=!0,this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled=!1}initialize(){this.addHandles([l(()=>[this.effectiveEnabled,this.context?.view,this.context?.toolOptions],([t,e,o])=>{const{context:i}=this;t&&e&&o?(this._tooltipInfo??=new P({toolOptions:o,getAllFields:()=>this.allFields,getActiveHandle:()=>this.effectiveActiveHandle,getHelpMessageKey:()=>this.context?.getHelpMessageKey(),viewType:e.type}),this._tooltip||this._setupTooltip(i)):(this._tooltip=r(this._tooltip),this._tooltipInfo=r(this._tooltipInfo),this.inputModeHandle=null)},a)])}destroy(){this._tooltip=r(this._tooltip),this._tooltipInfo=r(this._tooltipInfo)}get context(){return this.getDependencies?.()}get focusedHandle(){return this.context?.getActiveHandle?.()}get allHandles(){return this.context?.getAllHandles?.()}get effectiveActiveHandle(){return this._tooltip?.isInInputMode?this.inputModeHandle:this.focusedHandle}get updating(){return this._updatingHandles.updating}get tooltip(){return this._tooltip}get tooltipInfo(){return this._tooltipInfo}get elevationConstraint(){return this.getConstraints(this.focusedHandle)?.elevation}get allFields(){return Array.from(this._pluginTooltipFieldRegistry.values()).flatMap(t=>Array.from(t.values()))}get effectiveEnabled(){return this.context?.toolOptions.tooltips.effectiveEnabled||this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled}getConstraints(t){const{tooltipInfo:e,context:o}=this,{view:i,editGeometryOperations:n,elevationInfo:r,toolOptions:s}=o??{},l=this.getLastScreenPosition?.();if(!(l&&i&&e&&n&&s))return null;const{coordinateHelper:a,spatialReference:p}=n.data,d=i.toMap(l);if(!d)return null;const c=v(d,i,p,r??h,a.hasZ(),s.values.effectiveDirectionMode);return{...V(e.getConstraintFieldsForHandle(t)),context:c}}storeConstraintSnapshot(){const t=this.tooltipInfo?.allFields.filter(t=>t.locked&&!t.unlockOnVertexPlacement).filter(S);this._constraintSnapshot=t?.length?V(t):null}unlockOnVertexPlacement(){this.tooltipInfo?.allFields.forEach(t=>{t.unlockOnVertexPlacement&&(t.committed=null)})}unregisterPluginFields(t){const e=this._pluginTooltipFieldRegistry.get(t);e?.forEach(t=>t.destroy()),e?.clear(),this._pluginTooltipFieldRegistry.delete(t)}createMeasuredField(t,{id:e,preset:o,getMeasurementInput:i,measure:n,fieldProperties:r,fieldFilters:s}){const a=this._getOrCreateField(t,e,o,r,s);return a.registerMeasurement(i,n,()=>this.tooltipInfo?.renderContext),a.addHandles(l(()=>this.tooltipInfo?.isEffectiveVisibleField(a.field),t=>a.enabled=!!t,p)),a}createCustomField(t,{id:e,preset:o,fieldProperties:i,fieldFilters:n}){return this._getOrCreateField(t,e,o,i,n)}_setupTooltip(t){const e=this._tooltip=y(()=>({view:t.view,options:t.toolOptions.tooltips,info:this.tooltipInfo}));e.addHandles([l(()=>this.focusedHandle,t=>{(t&&(!e.isInInputMode||null==this.inputModeHandle)||this.inputModeHandle&&!this.allHandles?.includes(this.inputModeHandle))&&(this.inputModeHandle=t)},a),l(()=>this.focusedHandle?.screenPosition,t=>{t?(e.position=t,e.hidden=!1):e.hidden=!0},a),e.on("commit",()=>{this.context?.notifyTooltipsChanged()})]),this._coordinateFormatterLoadTask||m()||(this._coordinateFormatterLoadTask=o(()=>f()),this.addHandles(this._coordinateFormatterLoadTask),this._updatingHandles.addPromise(this._coordinateFormatterLoadTask.promise))}_getOrCreateField(t,e,o,i,r){const l=n(this._pluginTooltipFieldRegistry,t,()=>new s);if(l.has(e))return l.get(e);const a=G(o,i),p=new g({field:a,displayGroup:i?.displayGroup,...r});l.set(e,p);const d=S(a)?this._constraintSnapshot?.[a.name]:void 0;return d&&a.lock(d),p}};function U(t){return null!=t&&"unit"in t&&"rotationType"in t?t:null}function D(t){return null==t||"rotationType"in t?null:t}function G(t,e){const o=e?{...e}:{};switch(delete o.displayGroup,t){case"area":return F({...o,name:"area"});case"direction":return O({...o,name:"direction"});case"distance":return C({...o,name:"distance"});case"elevation":{const t=E({...o,name:"elevation"});return t.showAsZ=!0,t}case"latitude":return b({...o,name:"y"});case"longitude":return k({...o,name:"x"});case"x":return A({...o,name:"x"});case"y":return j({...o,name:"y"});case"orientation":return H({...o,name:"orientation"});case"scale":return M({...o,name:"scale"});case"size":return w({...o,name:"size"});case"totalLength":return x({...o,name:"totalLength"});case"radius":return I({...o,name:"radius"});case"generic-length":return T({...o,name:null});case"generic-area":return F({...o,name:null});case"generic-angle":return H({...o,name:null});case"generic-scalar":return _({...o,name:null});default:if(!o)throw new i("draw-tool:tooltips:invalid-field-config","Attempted to create a tooltip without a preset definition and without tooltip configuration.");return new L(o)}}function V(t){const e={};for(const o of t)switch(o.name){case"direction":case"distance":case"elevation":e[o.name]=o.committed;break;case"x":e[o.name]=D(o.committed),e.longitude=U(o.committed);break;case"y":e[o.name]=D(o.committed),e.latitude=U(o.committed)}return e}t([d()],R.prototype,"_updatingHandles",void 0),t([d()],R.prototype,"_tooltip",void 0),t([d()],R.prototype,"_tooltipInfo",void 0),t([d()],R.prototype,"_coordinateFormatterLoadTask",void 0),t([d()],R.prototype,"_constraintSnapshot",void 0),t([d()],R.prototype,"getDependencies",void 0),t([d()],R.prototype,"getLastScreenPosition",void 0),t([d()],R.prototype,"context",null),t([d()],R.prototype,"inputModeHandle",void 0),t([d()],R.prototype,"focusedHandle",null),t([d()],R.prototype,"allHandles",null),t([d()],R.prototype,"effectiveActiveHandle",null),t([d()],R.prototype,"updating",null),t([d()],R.prototype,"tooltip",null),t([d()],R.prototype,"tooltipInfo",null),t([d()],R.prototype,"constraintsEnabled",void 0),t([d()],R.prototype,"elevationConstraint",null),t([d()],R.prototype,"allFields",null),t([d()],R.prototype,"keepTooltipAliveEvenWhenTooltipsAreNotEnabled",void 0),t([d()],R.prototype,"effectiveEnabled",null),R=t([c("esri.views.draw.support.managers.TooltipManager")],R);export{R as TooltipManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{debounce as t}from"../../../core/promiseUtils.js";import{zeroMeters as o}from"../../../core/quantity.js";import{watch as n,syncAndInitial as i,sync as r}from"../../../core/reactiveUtils.js";import{createScreenPoint as a}from"../../../core/screenUtils.js";import s from"../../../geometry/Point.js";import{isCurvedGeometry as c}from"../../../geometry/support/curves/curveUtils.js";import{connectPasteEvent as l,getXYZDeltasFromTooltipInfo as p}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as m}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as u}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as f}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as y}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as v}from"../../support/euclideanLengthMeasurementUtils.js";function g(e){const t={sketchOptions:e,viewType:"2d"};return{movePoint:new m(t),selectedVertex:new u(t),translateGraphic:new f(t),translateVertices:new y(t)}}function h(o,a,s){function c(){const e=a(),t=e.sketchOptions.tooltips.effectiveEnabled?e.activeTooltipInfo:null;return{...e,activeTooltipInfo:t}}let p=!1;function m(e){p||(p=!0,e(),p=!1)}const u=t(e=>x(e)),f=e=>{m(()=>{d(e),o.info=e.activeTooltipInfo,s.consumePromise(u(e))})};return e([n(()=>{const e=c();return{context:e,geometry:e.graphic?.geometry,vertexGeometry:e.selectedVertex?.geometry}},({context:e})=>f(e),i),n(()=>{const e=c(),{activeTooltipInfo:t}=e;if(t&&"key"in t)return{context:e,key:t.key}},(e,t)=>{e&&t&&e.key!==t.key&&m(()=>b(e.context))},r),l(o,{onBeforePaste:()=>{p=!0},onAfterPaste:()=>{b(c()),p=!1}})])}function d(e){const t=e.activeTooltipInfo;if(t)switch(t.sketchOptions=e.sketchOptions,t?.type){case"move-point":w(t,e);break;case"selected-vertex":k(t,e)}}async function x(e){const t=e.activeTooltipInfo;if("selected-vertex"===t?.type)return await T(t,e)}function w(e,{graphic:t}){j(e,t,t?.geometry)}function k(e,{graphic:t,selectedVertex:o}){j(e,t,o?.geometry);const n=t?.geometry;if(!n||!c(n))switch(n?.type){case"polygon":e.geometryType="polygon",e.totalLength.visible=!1;break;case"polyline":e.geometryType="polyline",e.area.visible=!1;break;case"multipoint":e.geometryType="multipoint",e.area.visible=!1,e.totalLength.visible=!1}}async function T(e,{graphic:t,measurementWorker:o}){const n=t?.geometry;switch(n?.type){case"polygon":e.area.actual=(await o.autoArea2D(n)).area;break;case"polyline":e.totalLength.actual=await o.autoLength2D(n)}}function j(e,t,o){t&&"point"===o?.type&&(e.setLocationFromPoint(o),e.elevation.actual=v(o),e.elevation.visible=!!t.geometry?.hasZ,e.elevation.readOnly=!1,e.elevation.showAsZ=!0)}function b(e){function t(t,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:a}=p(t,n);if(0===i&&0===r&&0===a)return;const{x:c,y:l,z:m,m:u,spatialReference:f}=n,y=new s({x:c+i,y:l+r,z:null!=m?m+a:void 0,m:u,spatialReference:f});e.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=e;switch(o?.type){case"move-point":return t(o,n);case"selected-vertex":return t(o,i)}}function P(e,t,o,n,i){n.consumePromise(I(e,t,i,o))}const I=t(V);function L(e,t,o,n,i,r){e.elevation=null,i.consumePromise(D(e,t,r,o,n))}const D=t(U);async function U(e,t,n,i,{measurementWorker:r}){const s=[];if(n){const{x:o,y:i}=n.origin,c=t.toMap(n),l=t.toMap(a(o,i));s.push(r.autoDistance2DBetweenPoints(l,c).then(t=>{e.distance=t}))}else e.distance=o;switch(i?.type){case"polygon":s.push(r.autoArea2D(i).then(({area:t})=>{e.area=t,e.totalLength=null}));break;case"polyline":s.push(r.autoLength2D(i).then(t=>{e.area=null,e.totalLength=t}));break;default:e.area=null}await Promise.allSettled(s)}async function V(e,t,n,{measurementWorker:i}){if(!n)return void(e.distance=o);const{x:r,y:s}=n.origin,c=t.toMap(n),l=t.toMap(a(r,s));e.distance=await i.autoDistance2DBetweenPoints(l,c)}export{h as connectTooltip,g as createTooltipInfos,P as updateTranslateTooltipInfo,L as updateTranslateVertexTooltipInfo};
2
+ import{handlesGroup as e}from"../../../core/handleUtils.js";import{debounce as t}from"../../../core/promiseUtils.js";import{zeroMeters as o}from"../../../core/quantity.js";import{watch as n,syncAndInitial as i,sync as r}from"../../../core/reactiveUtils.js";import{createScreenPoint as a}from"../../../core/screenUtils.js";import s from"../../../geometry/Point.js";import{isCurvedGeometry as c}from"../../../geometry/support/curves/curveUtils.js";import{connectPasteEvent as l,getXYZDeltasFromTooltipInfo as p}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as m}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as u}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as f}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as y}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as v}from"../../support/euclideanLengthMeasurementUtils.js";function g(e){const t={toolOptions:e,viewType:"2d"};return{movePoint:new m(t),selectedVertex:new u(t),translateGraphic:new f(t),translateVertices:new y(t)}}function h(o,a,s){function c(){const e=a(),t=e.toolOptions.tooltips.effectiveEnabled?e.activeTooltipInfo:null;return{...e,activeTooltipInfo:t}}let p=!1;function m(e){p||(p=!0,e(),p=!1)}const u=t(e=>x(e)),f=e=>{m(()=>{d(e),o.info=e.activeTooltipInfo,s.consumePromise(u(e))})};return e([n(()=>{const e=c();return{context:e,geometry:e.graphic?.geometry,vertexGeometry:e.selectedVertex?.geometry}},({context:e})=>f(e),i),n(()=>{const e=c(),{activeTooltipInfo:t}=e;if(t&&"key"in t)return{context:e,key:t.key}},(e,t)=>{e&&t&&e.key!==t.key&&m(()=>b(e.context))},r),l(o,{onBeforePaste:()=>{p=!0},onAfterPaste:()=>{b(c()),p=!1}})])}function d(e){const t=e.activeTooltipInfo;if(t)switch(t.toolOptions=e.toolOptions,t?.type){case"move-point":w(t,e);break;case"selected-vertex":T(t,e)}}async function x(e){const t=e.activeTooltipInfo;if("selected-vertex"===t?.type)return await k(t,e)}function w(e,{graphic:t}){j(e,t,t?.geometry)}function T(e,{graphic:t,selectedVertex:o}){j(e,t,o?.geometry);const n=t?.geometry;if(!n||!c(n))switch(n?.type){case"polygon":e.geometryType="polygon",e.totalLength.visible=!1;break;case"polyline":e.geometryType="polyline",e.area.visible=!1;break;case"multipoint":e.geometryType="multipoint",e.area.visible=!1,e.totalLength.visible=!1}}async function k(e,{graphic:t,measurementWorker:o}){const n=t?.geometry;switch(n?.type){case"polygon":e.area.actual=(await o.autoArea2D(n)).area;break;case"polyline":e.totalLength.actual=await o.autoLength2D(n)}}function j(e,t,o){t&&"point"===o?.type&&(e.setLocationFromPoint(o),e.elevation.actual=v(o),e.elevation.visible=!!t.geometry?.hasZ,e.elevation.readOnly=!1,e.elevation.showAsZ=!0)}function b(e){function t(t,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:a}=p(t,n);if(0===i&&0===r&&0===a)return;const{x:c,y:l,z:m,m:u,spatialReference:f}=n,y=new s({x:c+i,y:l+r,z:null!=m?m+a:void 0,m:u,spatialReference:f});e.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=e;switch(o?.type){case"move-point":return t(o,n);case"selected-vertex":return t(o,i)}}function P(e,t,o,n,i){n.consumePromise(I(e,t,i,o))}const I=t(V);function L(e,t,o,n,i,r){e.elevation=null,i.consumePromise(D(e,t,r,o,n))}const D=t(U);async function U(e,t,n,i,{measurementWorker:r}){const s=[];if(n){const{x:o,y:i}=n.origin,c=t.toMap(n),l=t.toMap(a(o,i));s.push(r.autoDistance2DBetweenPoints(l,c).then(t=>{e.distance=t}))}else e.distance=o;switch(i?.type){case"polygon":s.push(r.autoArea2D(i).then(({area:t})=>{e.area=t,e.totalLength=null}));break;case"polyline":s.push(r.autoLength2D(i).then(t=>{e.area=null,e.totalLength=t}));break;default:e.area=null}await Promise.allSettled(s)}async function V(e,t,n,{measurementWorker:i}){if(!n)return void(e.distance=o);const{x:r,y:s}=n.origin,c=t.toMap(n),l=t.toMap(a(r,s));e.distance=await i.autoDistance2DBetweenPoints(l,c)}export{h as connectTooltip,g as createTooltipInfos,P as updateTranslateTooltipInfo,L as updateTranslateVertexTooltipInfo};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{debounce as e}from"../../../core/promiseUtils.js";import{valueInUnit as t,createLength as o,zeroDegreesGeographic as n,zeroMeters as i,zeroSquareMeters as r}from"../../../core/quantity.js";import{getMetersPerVerticalUnitForSR as a}from"../../../core/units.js";import{ensureType as c}from"../../../core/accessorSupport/ensureType.js";import s from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as l,getConvertedElevationFromXYZ as p}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as u}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as m}from"./helpMessageUtils3d.js";import{getConstraintContext as d}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as y}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as w}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as h}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as O}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as k}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as M}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as x}from"../../support/euclideanLengthMeasurementUtils.js";function P(e,t){return{point:new g({sketchOptions:t,viewType:e}),multipoint:new h({sketchOptions:t,viewType:e}),polyline:new O({sketchOptions:t,viewType:e}),polygon:new v({sketchOptions:t,viewType:e}),mesh:new w({sketchOptions:t,viewType:e}),rectangle:new k({sketchOptions:t}),circle:new f({sketchOptions:t})}}function D(e){const{directionOptions:t,geometryType:o,sketchOptions:n,tooltipInfos:i}=e,r=t=>{const o=ee(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(oe(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function j(e,t){const{drawOperation:o,view:n}=t,i=b(t),r=ee(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,c,s]=e,l=_(a,c,s,r,t);null!=l&&i.elevation.lock(l)}function T(e){b(e)?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&e.unlock()})}function b({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==I[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const I={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline",text:"point"};function V(e,t,o){switch(e?.type){case"draw-point":G(e,t);break;case"draw-multipoint":L(e,t);break;case"draw-polyline":W(e,t);break;case"draw-polygon":F(e,t);break;case"draw-rectangle":R(e,t);break;case"draw-circle":X(e,t);break;case"draw-mesh":S(e,t)}o.consumePromise(U(e,t))}const U=e(async(e,t)=>{switch(e?.type){case"draw-polygon":return await B(e,t);case"draw-polyline":return await Z(e,t);case"draw-rectangle":return await q(e,t);case"draw-circle":return await Y(e,t)}});function G(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(z(e,t),e.helpMessage=u("point",o,t.drawOperation.drawingMode))}function L(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(z(e,t),e.helpMessage=u("multipoint",o,t.drawOperation.drawingMode))}function S(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(z(e,t),i&&y(e,i),e.helpMessage=m(o,n))}function z(e,t){const{drawOperation:o,view:n,sketchOptions:i}=t,{cursorVertex:r,hasZ:a}=o;e.sketchOptions=i,e.viewType=n.type,e.setLocationFromPoint(r,te(t)),e.setElevationFromPoint(r,{hasZ:a}),o.constraints=r?{context:ne(r,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}:void 0}function W(e,t){const{createOperationGeometry:o}=t,n=null!=o?o.full:null;n&&"polyline"!==n.type||(E(e,t),e.helpMessage=u("polyline",n,t.drawOperation.drawingMode))}async function Z(e,t){const{createOperationGeometry:o,drawOperation:n}=t,r=null!=o?o.full:null;if(r&&"polyline"!==r.type)return;const a=[A(e,t)];n.lastVertex?r?a.push(t.measurementWorker.autoLength2D(r).then(t=>e.totalLength.actual=t)):e.totalLength.actual=i:e.totalLength.actual=null,await Promise.all(a)}function F(e,t){const{createOperationGeometry:o}=t,n=null!=o?o.full:null;n&&"polygon"!==n.type||(E(e,t),e.helpMessage=u("polygon",n,t.drawOperation.drawingMode))}async function B(e,t){const{createOperationGeometry:o,drawOperation:n}=t,i=null!=o?o.full:null;if(i&&"polygon"!==i.type)return;const a=[A(e,t)];n.lastVertex?i?a.push(t.measurementWorker.autoArea2D(i).then(({area:t})=>e.area.actual=t)):e.area.actual=r:e.area.actual=null,await Promise.all(a)}const C=c(s);function E(e,t){const{drawOperation:o,sketchOptions:i,view:r}=t,{cursorVertex:a,lastVertex:c,secondToLastVertex:s,hasZ:l}=o,p=i.values.effectiveDirectionMode;e.sketchOptions=i,e.viewType=r.type,e.distance.readOnly=null==c;const u=null!==c&&("absolute"===p||s);if(e.direction.actual=null,e.direction.readOnly=!u,u&&a){const t=M(s,c,a,p);e.direction.actual=t??n}e.setLocationFromPoint(a,te(t)),e.setElevationFromPoint(a,{hasZ:l});const m=H(c,t);e.xyMode=m,e.direction.visible="direction-distance"===m,e.distance.visible="direction-distance"===m,e.effectiveX.visible="coordinates"===m,e.effectiveY.visible="coordinates"===m;const d=a??c;o.constraints=d?{context:ne(d,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}async function A(e,t){const{drawOperation:o,measurementWorker:n}=t,{cursorVertex:r,lastVertex:a}=o,c=a&&r?await(n.autoDistance2DBetweenPoints(C(a),C(r))??i):null;e.distance.actual=c}function H(e,{sketchOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function R(e,t){e.sketchOptions=t.sketchOptions,e.helpMessage=u("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}async function q(e,t){await Promise.all([K(t).then(t=>e.xSize=t),N(t).then(t=>e.ySize=t),J(t).then(t=>e.area=t)])}function X(e,t){const{sketchOptions:o}=t;e.sketchOptions=o,e.helpMessage=u("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}async function Y(e,t){const{forceUniformSize:o}=t,n=[J(t).then(t=>e.area=t)];o?(e.xSize=null,e.ySize=null,n.push(Q(t).then(t=>e.radius=t))):(e.radius=null,n.push(K(t).then(t=>e.xSize=t)),n.push(N(t).then(t=>e.ySize=t))),await Promise.all(n)}async function J({createOperationGeometry:e,measurementWorker:t}){const o=e?.full;return"polygon"!==o?.type?r:(await t.autoArea2D(o)).area??r}async function K({createOperationGeometry:e,measurementWorker:t}){const o=e?.rectangle?.midpoints;return(null!=o?await t.autoDistance2DBetweenPoints(o.left,o.right):null)??i}async function N({createOperationGeometry:e,measurementWorker:t}){const o=e?.rectangle?.midpoints;return(null!=o?await t.autoDistance2DBetweenPoints(o.top,o.bottom):null)??i}async function Q({createOperationGeometry:e,measurementWorker:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?await t.autoDistance2DBetweenPoints(e.circle.center,e.circle.edge):null)??i}function $(e){const{geometryType:o,tooltipInfos:n}=e;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return t(i,"meters")/a(te(e))}default:return}}function _(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const c=te(i),s=ee(i),l=p(r,e,t,o,c,s,n);return x(l,c)??oe(i)}function ee(e){return e.drawOperation.elevationInfo??l}function te(e){return e.drawOperation.coordinateHelper.spatialReference}function oe(e){const t=a(te(e));return o(e.defaultZ*t,"meters")}function ne(e,t){return d(e,t.view,te(t),ee(t),t.drawOperation.coordinateHelper.hasZ(),t.sketchOptions.values.effectiveDirectionMode)}export{P as createTooltipInfos,b as getActiveTooltipInfo,$ as getConstraintZ,D as initializeConstraints,j as lockElevationOnVertexAdd,T as unlockConstraintsOnVertexAddOrRemove,V as updateTooltipInfo};
2
+ import{debounce as e}from"../../../core/promiseUtils.js";import{valueInUnit as t,createLength as o,zeroDegreesGeographic as n,zeroMeters as i,zeroSquareMeters as r}from"../../../core/quantity.js";import{getMetersPerVerticalUnitForSR as a}from"../../../core/units.js";import{ensureType as l}from"../../../core/accessorSupport/ensureType.js";import c from"../../../geometry/Point.js";import{absoluteHeightElevationInfo as s,getConvertedElevationFromXYZ as p}from"../../../support/elevationInfoUtils.js";import{getDrawHelpMessage as u}from"./helpMessageUtils.js";import{getDrawMeshHelpMessage as m}from"./helpMessageUtils3d.js";import{getConstraintContext as d}from"../../interactive/sketch/constraintUtils.js";import{updateTooltipInfoFromMeshTransform as y}from"../../interactive/tooltip/tooltipCommonUtils.js";import{DrawCircleTooltipInfo as f}from"../../interactive/tooltip/infos/DrawCircleTooltipInfo.js";import{DrawMeshTooltipInfo as w}from"../../interactive/tooltip/infos/DrawMeshTooltipInfo.js";import{DrawMultipointTooltipInfo as g}from"../../interactive/tooltip/infos/DrawMultipointTooltipInfo.js";import{DrawPointTooltipInfo as h}from"../../interactive/tooltip/infos/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as v}from"../../interactive/tooltip/infos/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as O}from"../../interactive/tooltip/infos/DrawPolylineTooltipInfo.js";import{DrawRectangleTooltipInfo as M}from"../../interactive/tooltip/infos/DrawRectangleTooltipInfo.js";import{directionForVertices as x}from"../../support/angularMeasurementUtils.js";import{elevationFromZ as k}from"../../support/euclideanLengthMeasurementUtils.js";function P(e,t){return{point:new h({toolOptions:t,viewType:e}),multipoint:new g({toolOptions:t,viewType:e}),polyline:new O({toolOptions:t,viewType:e}),polygon:new v({toolOptions:t,viewType:e}),mesh:new w({toolOptions:t,viewType:e}),rectangle:new M({toolOptions:t}),circle:new f({toolOptions:t})}}function D(e){const{directionOptions:t,geometryType:o,toolOptions:n,tooltipInfos:i}=e,r=t=>{const o=ee(e).mode,n=i[t].elevation;"relative-to-ground"===o||"relative-to-scene"===o||"on-the-ground"===o?n.lock(oe(e)):n.unlock()},a=e=>{if(t){const o=i[e].direction;o.committed=t.angle,o.unlockOnVertexPlacement=!1,n.values.directionMode=t.mode}};switch(o){case"polygon":case"polyline":r(o),a(o);break;case"point":case"mesh":r(o)}}function j(e,t){const{drawOperation:o,view:n}=t,i=b(t),r=ee(t);if("2d"===n.type||!e||"absolute-height"!==r.mode||1!==o?.numCommittedVertices||!i||"draw-polyline"!==i.type&&"draw-polygon"!==i.type||i.elevation.locked)return;const[a,l,c]=e,s=_(a,l,c,r,t);null!=s&&i.elevation.lock(s)}function T(e){b(e)?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&e.unlock()})}function b({geometryType:e,graphic:t,tooltipInfos:o}){return t?.geometry?.type!==I[e]?"circle"===e||"rectangle"===e?o[e]:null:o[e]}const I={point:"point",multipoint:"multipoint",mesh:"mesh",polyline:"polyline",polygon:"polygon",circle:"polygon",rectangle:"polygon",freehandPolygon:"polygon",freehandPolyline:"polyline",text:"point"};function V(e,t,o){switch(e?.type){case"draw-point":G(e,t);break;case"draw-multipoint":L(e,t);break;case"draw-polyline":W(e,t);break;case"draw-polygon":F(e,t);break;case"draw-rectangle":R(e,t);break;case"draw-circle":X(e,t);break;case"draw-mesh":S(e,t)}o.consumePromise(U(e,t))}const U=e(async(e,t)=>{switch(e?.type){case"draw-polygon":return await B(e,t);case"draw-polyline":return await Z(e,t);case"draw-rectangle":return await q(e,t);case"draw-circle":return await Y(e,t)}});function G(e,t){const o=t.graphic?.geometry;"point"===o?.type&&(z(e,t),e.helpMessage=u("point",o,t.drawOperation.drawingMode))}function L(e,t){const o=t.graphic?.geometry;"multipoint"===o?.type&&(z(e,t),e.helpMessage=u("multipoint",o,t.drawOperation.drawingMode))}function S(e,t){const{graphic:o,view:n}=t,i=o?.geometry;"3d"!==n.type||i&&"mesh"!==i.type||(z(e,t),i&&y(e,i),e.helpMessage=m(o,n))}function z(e,t){const{drawOperation:o,view:n,toolOptions:i}=t,{cursorVertex:r,hasZ:a}=o;e.toolOptions=i,e.viewType=n.type,e.setLocationFromPoint(r,te(t)),e.setElevationFromPoint(r,{hasZ:a}),o.constraints=r?{context:ne(r,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:null,direction:null}:void 0}function W(e,t){const{createOperationGeometry:o}=t,n=null!=o?o.full:null;n&&"polyline"!==n.type||(E(e,t),e.helpMessage=u("polyline",n,t.drawOperation.drawingMode))}async function Z(e,t){const{createOperationGeometry:o,drawOperation:n}=t,r=null!=o?o.full:null;if(r&&"polyline"!==r.type)return;const a=[A(e,t)];n.lastVertex?r?a.push(t.measurementWorker.autoLength2D(r).then(t=>e.totalLength.actual=t)):e.totalLength.actual=i:e.totalLength.actual=null,await Promise.all(a)}function F(e,t){const{createOperationGeometry:o}=t,n=null!=o?o.full:null;n&&"polygon"!==n.type||(E(e,t),e.helpMessage=u("polygon",n,t.drawOperation.drawingMode))}async function B(e,t){const{createOperationGeometry:o,drawOperation:n}=t,i=null!=o?o.full:null;if(i&&"polygon"!==i.type)return;const a=[A(e,t)];n.lastVertex?i?a.push(t.measurementWorker.autoArea2D(i).then(({area:t})=>e.area.actual=t)):e.area.actual=r:e.area.actual=null,await Promise.all(a)}const C=l(c);function E(e,t){const{drawOperation:o,toolOptions:i,view:r}=t,{cursorVertex:a,lastVertex:l,secondToLastVertex:c,hasZ:s}=o,p=i.values.effectiveDirectionMode;e.toolOptions=i,e.viewType=r.type,e.distance.readOnly=null==l;const u=null!==l&&("absolute"===p||c);if(e.direction.actual=null,e.direction.readOnly=!u,u&&a){const t=x(c,l,a,p);e.direction.actual=t??n}e.setLocationFromPoint(a,te(t)),e.setElevationFromPoint(a,{hasZ:s});const m=H(l,t);e.xyMode=m,e.direction.visible="direction-distance"===m,e.distance.visible="direction-distance"===m,e.effectiveX.visible="coordinates"===m,e.effectiveY.visible="coordinates"===m;const d=a??l;o.constraints=d?{context:ne(d,t),x:e.x.committed,y:e.y.committed,longitude:e.longitude.committed,latitude:e.latitude.committed,elevation:e.elevation.committed,distance:e.distance.committed,direction:e.direction.committed}:void 0}async function A(e,t){const{drawOperation:o,measurementWorker:n}=t,{cursorVertex:r,lastVertex:a}=o,l=a&&r?await(n.autoDistance2DBetweenPoints(C(a),C(r))??i):null;e.distance.actual=l}function H(e,{toolOptions:t}){const o=t.tooltips.xyMode;return"auto"===o?e?"direction-distance":"coordinates":o}function R(e,t){e.toolOptions=t.toolOptions,e.helpMessage=u("rectangle",t.graphic?.geometry,t.drawOperation.drawingMode)}async function q(e,t){await Promise.all([K(t).then(t=>e.xSize=t),N(t).then(t=>e.ySize=t),J(t).then(t=>e.area=t)])}function X(e,t){const{toolOptions:o}=t;e.toolOptions=o,e.helpMessage=u("circle",t.graphic?.geometry,t.drawOperation.drawingMode)}async function Y(e,t){const{forceUniformSize:o}=t,n=[J(t).then(t=>e.area=t)];o?(e.xSize=null,e.ySize=null,n.push(Q(t).then(t=>e.radius=t))):(e.radius=null,n.push(K(t).then(t=>e.xSize=t)),n.push(N(t).then(t=>e.ySize=t))),await Promise.all(n)}async function J({createOperationGeometry:e,measurementWorker:t}){const o=e?.full;return"polygon"!==o?.type?r:(await t.autoArea2D(o)).area??r}async function K({createOperationGeometry:e,measurementWorker:t}){const o=e?.rectangle?.midpoints;return(null!=o?await t.autoDistance2DBetweenPoints(o.left,o.right):null)??i}async function N({createOperationGeometry:e,measurementWorker:t}){const o=e?.rectangle?.midpoints;return(null!=o?await t.autoDistance2DBetweenPoints(o.top,o.bottom):null)??i}async function Q({createOperationGeometry:e,measurementWorker:t}){return(null!=e?.circle?.center&&null!=e.circle.edge?await t.autoDistance2DBetweenPoints(e.circle.center,e.circle.edge):null)??i}function $(e){const{geometryType:o,tooltipInfos:n}=e;switch(o){case"point":case"multipoint":case"mesh":case"polyline":case"polygon":{const i=n[o].elevation.committed;if(!i)return;return t(i,"meters")/a(te(e))}default:return}}function _(e,t,o,n,i){const{view:r,drawOperation:a}=i;if("3d"!==r.type||!a)return;o??=0;const l=te(i),c=ee(i),s=p(r,e,t,o,l,c,n);return k(s,l)??oe(i)}function ee(e){return e.drawOperation.elevationInfo??s}function te(e){return e.drawOperation.coordinateHelper.spatialReference}function oe(e){const t=a(te(e));return o(e.defaultZ*t,"meters")}function ne(e,t){return d(e,t.view,te(t),ee(t),t.drawOperation.coordinateHelper.hasZ(),t.toolOptions.values.effectiveDirectionMode)}export{P as createTooltipInfos,b as getActiveTooltipInfo,$ as getConstraintZ,D as initializeConstraints,j as lockElevationOnVertexAdd,T as unlockConstraintsOnVertexAddOrRemove,V as updateTooltipInfo};
@@ -0,0 +1,36 @@
1
+ import type Accessor from "../../../core/Accessor.js";
2
+ import type LabelOptions from "./LabelOptions.js";
3
+ import type TooltipOptions from "./TooltipOptions.js";
4
+ import type ValueOptions from "./ValueOptions.js";
5
+ import type { LabelOptionsProperties } from "./LabelOptions.js";
6
+ import type { TooltipOptionsProperties } from "./TooltipOptions.js";
7
+ import type { ValueOptionsProperties } from "./ValueOptions.js";
8
+
9
+ /** @internal */
10
+ export interface InteractiveToolOptionsProperties {
11
+ /** @internal */
12
+ labels?: LabelOptionsProperties;
13
+ /** @internal */
14
+ tooltips?: TooltipOptionsProperties;
15
+ /** @internal */
16
+ values?: ValueOptionsProperties;
17
+ }
18
+
19
+ /**
20
+ * Class which groups settings used by interactive tools so that they can be passed around together.
21
+ *
22
+ * @internal
23
+ */
24
+ export default class InteractiveToolOptions extends Accessor {
25
+ /** @internal */
26
+ constructor(properties?: InteractiveToolOptionsProperties);
27
+ /** @internal */
28
+ get labels(): LabelOptions;
29
+ set labels(value: LabelOptionsProperties);
30
+ /** @internal */
31
+ get tooltips(): TooltipOptions;
32
+ set tooltips(value: TooltipOptionsProperties);
33
+ /** @internal */
34
+ get values(): ValueOptions;
35
+ set values(value: ValueOptionsProperties);
36
+ }
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as o}from"tslib";import t from"../../../core/Accessor.js";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"./LabelOptions.js";import p from"./TooltipOptions.js";import i from"./ValueOptions.js";let l=class extends t{constructor(o){super(o),this.labels=new r,this.tooltips=new p,this.values=new i}};o([e({nonNullable:!0,type:r})],l.prototype,"labels",void 0),o([e({nonNullable:!0,type:p})],l.prototype,"tooltips",void 0),o([e({nonNullable:!0,type:i})],l.prototype,"values",void 0),l=o([s("esri.views.interactive.options.InteractiveToolOptions")],l);const n=l;export{n as default};
@@ -1,13 +1,14 @@
1
- import type Accessor from "../../../core/Accessor.js";
1
+ import type InteractiveToolOptions from "../options/InteractiveToolOptions.js";
2
2
  import type SketchLabelOptions from "./SketchLabelOptions.js";
3
3
  import type SketchTooltipOptions from "./SketchTooltipOptions.js";
4
4
  import type SketchValueOptions from "./SketchValueOptions.js";
5
5
  import type { SketchLabelOptionsProperties } from "./SketchLabelOptions.js";
6
6
  import type { SketchTooltipOptionsProperties } from "./SketchTooltipOptions.js";
7
7
  import type { SketchValueOptionsProperties } from "./SketchValueOptions.js";
8
+ import type { InteractiveToolOptionsProperties } from "../options/InteractiveToolOptions.js";
8
9
 
9
10
  /** @internal */
10
- export interface SketchOptionsProperties {
11
+ export interface SketchOptionsProperties extends InteractiveToolOptionsProperties {
11
12
  /** @internal */
12
13
  labels?: SketchLabelOptionsProperties;
13
14
  /** @internal */
@@ -21,7 +22,7 @@ export interface SketchOptionsProperties {
21
22
  *
22
23
  * @internal
23
24
  */
24
- export default class SketchOptions extends Accessor {
25
+ export default class SketchOptions extends InteractiveToolOptions {
25
26
  /** @internal */
26
27
  constructor(properties?: SketchOptionsProperties);
27
28
  /** @internal */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import t from"../../../core/Accessor.js";import{property as e,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"./SketchLabelOptions.js";import p from"./SketchTooltipOptions.js";import i from"./SketchValueOptions.js";let l=class extends t{constructor(o){super(o),this.labels=new r,this.tooltips=new p,this.values=new i}};o([e({nonNullable:!0,type:r})],l.prototype,"labels",void 0),o([e({nonNullable:!0,type:p})],l.prototype,"tooltips",void 0),o([e({nonNullable:!0,type:i})],l.prototype,"values",void 0),l=o([s("esri.views.interactive.sketch.SketchOptions")],l);const c=l;export{c as default};
2
+ import{__decorate as o}from"tslib";import{property as t,subclass as e}from"../../../core/accessorSupport/decorators.js";import s from"../options/InteractiveToolOptions.js";import p from"./SketchLabelOptions.js";import i from"./SketchTooltipOptions.js";import r from"./SketchValueOptions.js";let l=class extends s{constructor(o){super(o),this.labels=new p,this.tooltips=new i,this.values=new r}};o([t({nonNullable:!0,type:p})],l.prototype,"labels",void 0),o([t({nonNullable:!0,type:i})],l.prototype,"tooltips",void 0),o([t({nonNullable:!0,type:r})],l.prototype,"values",void 0),l=o([e("esri.views.interactive.sketch.SketchOptions")],l);const n=l;export{n as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{drawContentHeaderActions as i}from"../css.js";import{directionModeIcons as s}from"./directionModeIcons.js";import r from"../../../../widgets/Widget.js";import{loadCalciteComponents as n}from"../../../../widgets/support/componentsUtils.js";import{tsx as c,messageBundle as d}from"../../../../widgets/support/widget.js";let l=class extends r{constructor(e){super(e),this.visibleElements={}}render(){return c("div",{class:i},this._isElementVisible("direction")?c(a,{messages:this.messages,sketchOptions:this.sketchOptions,topLayerDisabled:this.topLayerDisabled}):null)}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group")})}_isElementVisible(e){return this.visibleElements?.[e]??this.sketchOptions.tooltips.visibleElements[e]}};function a(e){const{directionMode:t}=e.sketchOptions.values,o=e.messages?.sketch,i=o?.directionModeSelect?.title,r="absolute",n="relative";return c("calcite-dropdown",{key:"direction-mode",placement:"bottom-end",scale:"s",topLayerDisabled:e.topLayerDisabled,onCalciteDropdownSelect:t=>{const o=t.currentTarget.selectedItems?.[0]?.getAttribute("data-mode");e.sketchOptions.values.directionMode=o??"absolute"}},c("calcite-button",{alignment:"end",appearance:"transparent",iconStart:s[t],kind:"neutral",label:i,scale:"s",slot:"trigger",title:i}),c("calcite-dropdown-group",{selectionMode:"single"},c("calcite-dropdown-item",{"data-mode":n,"data-testid":"tooltip-direction-mode-relative",iconStart:s.relative,key:"relative",selected:t===n},o?.directionModeSelect?.relative),c("calcite-dropdown-item",{"data-mode":r,"data-testid":"tooltip-direction-mode-absolute",iconStart:s.absolute,key:"absolute",selected:t===r},o?.directionModeSelect?.absolute)))}e([d("esri/views/interactive/tooltip/t9n/Tooltip"),t()],l.prototype,"messages",void 0),e([t()],l.prototype,"sketchOptions",void 0),e([t()],l.prototype,"visibleElements",void 0),l=e([o("esri.views.interactive.tooltip.components.DrawHeaderActions")],l);export{l as DrawHeaderActions};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{drawContentHeaderActions as i}from"../css.js";import{directionModeIcons as s}from"./directionModeIcons.js";import r from"../../../../widgets/Widget.js";import{loadCalciteComponents as n}from"../../../../widgets/support/componentsUtils.js";import{tsx as l,messageBundle as c}from"../../../../widgets/support/widget.js";let d=class extends r{constructor(e){super(e),this.visibleElements={}}render(){return l("div",{class:i},this._isElementVisible("direction")?l(a,{messages:this.messages,toolOptions:this.toolOptions,topLayerDisabled:this.topLayerDisabled}):null)}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group")})}_isElementVisible(e){return this.visibleElements?.[e]??this.toolOptions.tooltips.visibleElements[e]}};function a(e){const{directionMode:t}=e.toolOptions.values,o=e.messages?.sketch,i=o?.directionModeSelect?.title,r="absolute",n="relative";return l("calcite-dropdown",{key:"direction-mode",placement:"bottom-end",scale:"s",topLayerDisabled:e.topLayerDisabled,onCalciteDropdownSelect:t=>{const o=t.currentTarget.selectedItems?.[0]?.getAttribute("data-mode");e.toolOptions.values.directionMode=o??"absolute"}},l("calcite-button",{alignment:"end",appearance:"transparent",iconStart:s[t],kind:"neutral",label:i,scale:"s",slot:"trigger",title:i}),l("calcite-dropdown-group",{selectionMode:"single"},l("calcite-dropdown-item",{"data-mode":n,"data-testid":"tooltip-direction-mode-relative",iconStart:s.relative,key:"relative",selected:t===n},o?.directionModeSelect?.relative),l("calcite-dropdown-item",{"data-mode":r,"data-testid":"tooltip-direction-mode-absolute",iconStart:s.absolute,key:"absolute",selected:t===r},o?.directionModeSelect?.absolute)))}e([c("esri/views/interactive/tooltip/t9n/Tooltip"),t()],d.prototype,"messages",void 0),e([t()],d.prototype,"toolOptions",void 0),e([t()],d.prototype,"visibleElements",void 0),d=e([o("esri.views.interactive.tooltip.components.DrawHeaderActions")],d);export{d as DrawHeaderActions};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import{on as o}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as i}from"../../../../core/memoize.js";import{throwIfNotAbortError as s,throwIfAborted as n,after as r}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as a,waitTick as l}from"../../../../core/scheduling.js";import{unitName as c}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as p,defaultVerticalLengthUnit as d,defaultLengthUnit as u}from"../../../../core/units.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as f}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as _}from"../../keybindings.js";import{table as g,contentHeader as y,contentHeaderSpacer as v,contentHeaderActions as b,contentInputMode as w,content as I,helpMessageText as k,helpMessageIcon as A,helpMessage as C,drawContentHeaderActions as D}from"../css.js";import{getFormatters as M}from"../fields/parsingAndFormattingUtils.js";import U from"../../../../widgets/Widget.js";import{loadCalciteComponents as F}from"../../../../widgets/support/componentsUtils.js";import{tsx as j,tsxFragment as x,classes as E,messageBundle as T}from"../../../../widgets/support/widget.js";const H=Symbol("dragHandles");let N=class extends U{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode="feedback",this._getFormatters=i(M),this._onHeaderPointerDown=t=>{const e=t.target;if(!(e instanceof HTMLElement)||"calcite-button"===e?.tagName?.toLowerCase())return;this.removeHandles(H),t.preventDefault(),t.stopPropagation();const i="test"!==process.env.NODE_ENV;i&&e.setPointerCapture(t.pointerId),this.tooltip.onDragStart(t.clientX,t.clientY),this.addHandles([o(e,"pointermove",({clientX:t,clientY:e})=>{this.tooltip.onDrag(t,e)}),o(e,["pointerup","pointercancel"],o=>{this.removeHandles(H),i&&e.releasePointerCapture(t.pointerId),this.tooltip.onDragEnd()}),o(e,"touchstart",t=>t.preventDefault())],H)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit("discard"),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(t,e)=>{if(this.destroyed)return;if(this.tooltip.emit("commit",{type:e}),"commit-and-exit"===e)return void this.exitInputMode();if("commit-on-blur"===e)return;const o=this._getFocusableElements(),i=o.length,s=o.indexOf(t);if(-1===s)return void this.exitInputMode();const n=((s+("commit-and-next"===e?1:-1))%i+i)%i;O(o.at(n))},this._onKeyDown=t=>{switch(t.code){case _.next:return this._onNextKey(t);case _.discard:return t.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){const{displayUnits:t}=this.info.sketchOptions.values,e=f(this.tooltip.view);return{length:t.length??e,verticalLength:t.verticalLength??e,area:t.area??e}}get _inputUnitInfos(){const t=this._messagesUnits,e=e=>({unit:e,abbreviation:c(t,e,"abbr")}),{inputUnits:o}=this.info.sketchOptions.values,i=f(this.tooltip.view),s=o.length??i,n=o.verticalLength??i,r=o.area??i;return{length:e(u(s)),verticalLength:e(d(n)),area:e(p(r)),angle:e("degrees")}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,sketchOptions:this.info.sketchOptions,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){const{visibleElements:t}=this.info.sketchOptions.tooltips,e=this._renderedContent,o=this._renderedActions,i=this._renderedHelpMessage,s=e.length>0,n=s||!!i,r="input"===this.mode;return j("div",{class:E(I,r&&w),tabIndex:-1,onkeydown:this._onKeyDown},r&&n&&t.header?j("div",{class:y,"data-testid":"tooltip-header",key:"header",onpointerdown:this._onHeaderPointerDown},j("calcite-button",{appearance:"transparent","data-testid":"tooltip-back-button",iconFlipRtl:"both",iconStart:"chevron-left",key:"discard-button",kind:"neutral",scale:"s",tabIndex:-1,onclick:this._onDiscard}),o.length>0?j(x,null,j("div",{class:v,key:"spacer"}),j("div",{class:b,key:"actions"},o)):null):null,s?j("div",{class:g,key:"content"},...e):null,i)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return F({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input")})}async enterInputMode(t,e){try{await this._transitionTo("input",e),await this._focusField(t)}catch(o){s(o)}}async exitInputMode({focusOnView:t=!0}={}){try{const{container:e,info:o}=this;o.clearInputValues();const i=t?e?.closest(".esri-view")?.querySelector(".esri-view-surface"):null;await this._transitionTo("feedback"),i instanceof HTMLElement&&i.focus()}catch(e){s(e)}}_onNextKey(t){const e=this._getFocusableElements(),o=e.at(0),i=e.at(-1);o&&i&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),t.stopPropagation(),O(i)):document.activeElement===i&&(t.preventDefault(),t.stopPropagation(),O(o)))}get _renderedContent(){return S(this._renderContent())}get _renderedActions(){return S(this._renderActions())}get _renderedHelpMessage(){const{sketchOptions:t,visibleElements:e}=this.info;if(!e.helpMessage)return null;const o=t.tooltips.helpMessage??this._defaultHelpMessage;if(!o)return null;const i=t.tooltips.helpMessageIcon??"information";return j("div",{class:C,key:"help-message"},i?j("calcite-icon",{class:A,icon:i,scale:"s"}):null,j("div",{class:k},o))}get _defaultHelpMessage(){const{helpMessage:t,viewType:e}=this.info;if(null==t)return null;const o="3d"===e?"helpMessages3d":"helpMessages2d";return this._messagesTooltip?.sketch?.[o]?.[t]}async _focusField(t){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const{signal:e}=this._focusAbortController;await this._waitForInputs(),n(e);const o=this._getFocusableInputs(),i=t?o.find(e=>e.getAttribute("data-field-name")===t):o.at(0);await O(i)}async _transitionTo(t,o){if(this._mode===t&&!this._transitionInfo)return;if(this._transitionInfo?.mode===t)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();const i=async()=>{this.destroyed||(this._mode=t,await l(),this.destroyed||(this.renderNow(),await l(),this.destroyed||o?.()))};if("test"===process.env.NODE_ENV||!this.domNode?.firstChild||!document.startViewTransition||e())return void await i();this.autoRenderingEnabled=!1;const s=this._transitionInfo={transition:document.startViewTransition(async()=>{this.destroyed||s!==this._transitionInfo||(this.autoRenderingEnabled=!0,await i())}),mode:t};try{await s.transition.finished}finally{s===this._transitionInfo&&(this._transitionInfo=null)}}async _waitForInputs(){const t=()=>Array.from(this.domNode?.querySelectorAll("calcite-input")??[]);for(;0===t().length;)await r(P);await a()}_getFocusableInputs(){return Array.from(this.domNode?.querySelectorAll("calcite-input:not([read-only]):not([disabled])")??[])}_getFocusableElements(){const t=this.domNode?.querySelector(`.${D}`);return[...Array.from(t?.querySelectorAll(`.${b} calcite-button:not([disabled])`)??[]),...this._getFocusableInputs()]}};async function O(t){await(t?.componentOnReady?.()),await(t?.setFocus())}function S(t){return(Array.isArray(t)?t:[t]).flat(10).filter(t=>!!t)}t([T("esri/core/t9n/Units"),h()],N.prototype,"_messagesUnits",void 0),t([T("esri/views/interactive/tooltip/t9n/Tooltip"),h()],N.prototype,"_messagesTooltip",void 0),t([h()],N.prototype,"info",void 0),t([h()],N.prototype,"tooltip",void 0),t([h()],N.prototype,"_mode",void 0),t([h()],N.prototype,"mode",null),t([h()],N.prototype,"_displayUnits",null),t([h()],N.prototype,"_inputUnitInfos",null),t([h()],N.prototype,"_formatters",null),t([h()],N.prototype,"fieldContext",null),t([h()],N.prototype,"_renderedContent",null),t([h()],N.prototype,"_renderedActions",null),t([h()],N.prototype,"_renderedHelpMessage",null),t([h()],N.prototype,"_defaultHelpMessage",null),N=t([m("esri.views.interactive.tooltip.content.TooltipContent")],N);const P=20;export{N as TooltipContent};
2
+ import{__decorate as t}from"tslib";import{prefersReducedMotion as e}from"../../../../core/a11yUtils.js";import{on as o}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as i}from"../../../../core/memoize.js";import{throwIfNotAbortError as n,throwIfAborted as s,after as r}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as a,waitTick as l}from"../../../../core/scheduling.js";import{unitName as c}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as p,defaultVerticalLengthUnit as d,defaultLengthUnit as u}from"../../../../core/units.js";import{property as h,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as f}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as _}from"../../keybindings.js";import{table as g,contentHeader as y,contentHeaderSpacer as v,contentHeaderActions as b,contentInputMode as w,content as I,helpMessageText as A,helpMessageIcon as C,helpMessage as D,drawContentHeaderActions as M}from"../css.js";import{getFormatters as U}from"../fields/parsingAndFormattingUtils.js";import F from"../../../../widgets/Widget.js";import{loadCalciteComponents as j}from"../../../../widgets/support/componentsUtils.js";import{tsx as k,tsxFragment as x,classes as E,messageBundle as T}from"../../../../widgets/support/widget.js";const H=Symbol("dragHandles");let N=class extends F{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode="feedback",this._getFormatters=i(U),this._onHeaderPointerDown=t=>{const e=t.target;if(!(e instanceof HTMLElement)||"calcite-button"===e?.tagName?.toLowerCase())return;this.removeHandles(H),t.preventDefault(),t.stopPropagation();const i="test"!==process.env.NODE_ENV;i&&e.setPointerCapture(t.pointerId),this.tooltip.onDragStart(t.clientX,t.clientY),this.addHandles([o(e,"pointermove",({clientX:t,clientY:e})=>{this.tooltip.onDrag(t,e)}),o(e,["pointerup","pointercancel"],o=>{this.removeHandles(H),i&&e.releasePointerCapture(t.pointerId),this.tooltip.onDragEnd()}),o(e,"touchstart",t=>t.preventDefault())],H)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit("discard"),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(t,e)=>{if(this.destroyed)return;if(this.tooltip.emit("commit",{type:e}),"commit-and-exit"===e)return void this.exitInputMode();if("commit-on-blur"===e)return;const o=this._getFocusableElements(),i=o.length,n=o.indexOf(t);if(-1===n)return void this.exitInputMode();const s=((n+("commit-and-next"===e?1:-1))%i+i)%i;O(o.at(s))},this._onKeyDown=t=>{switch(t.code){case _.next:return this._onNextKey(t);case _.discard:return t.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){const{displayUnits:t}=this.info.toolOptions.values,e=f(this.tooltip.view);return{length:t.length??e,verticalLength:t.verticalLength??e,area:t.area??e}}get _inputUnitInfos(){const t=this._messagesUnits,e=e=>({unit:e,abbreviation:c(t,e,"abbr")}),{inputUnits:o}=this.info.toolOptions.values,i=f(this.tooltip.view),n=o.length??i,s=o.verticalLength??i,r=o.area??i;return{length:e(u(n)),verticalLength:e(d(s)),area:e(p(r)),angle:e("degrees")}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,toolOptions:this.info.toolOptions,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){const{visibleElements:t}=this.info.toolOptions.tooltips,e=this._renderedContent,o=this._renderedActions,i=this._renderedHelpMessage,n=e.length>0,s=n||!!i,r="input"===this.mode;return k("div",{class:E(I,r&&w),tabIndex:-1,onkeydown:this._onKeyDown},r&&s&&t.header?k("div",{class:y,"data-testid":"tooltip-header",key:"header",onpointerdown:this._onHeaderPointerDown},k("calcite-button",{appearance:"transparent","data-testid":"tooltip-back-button",iconFlipRtl:"both",iconStart:"chevron-left",key:"discard-button",kind:"neutral",scale:"s",tabIndex:-1,onclick:this._onDiscard}),o.length>0?k(x,null,k("div",{class:v,key:"spacer"}),k("div",{class:b,key:"actions"},o)):null):null,n?k("div",{class:g,key:"content"},...e):null,i)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return j({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input")})}async enterInputMode(t,e){try{await this._transitionTo("input",e),await this._focusField(t)}catch(o){n(o)}}async exitInputMode({focusOnView:t=!0}={}){try{const{container:e,info:o}=this;o.clearInputValues();const i=t?e?.closest(".esri-view")?.querySelector(".esri-view-surface"):null;await this._transitionTo("feedback"),i instanceof HTMLElement&&i.focus()}catch(e){n(e)}}_onNextKey(t){const e=this._getFocusableElements(),o=e.at(0),i=e.at(-1);o&&i&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),t.stopPropagation(),O(i)):document.activeElement===i&&(t.preventDefault(),t.stopPropagation(),O(o)))}get _renderedContent(){return S(this._renderContent())}get _renderedActions(){return S(this._renderActions())}get _renderedHelpMessage(){const{toolOptions:t,visibleElements:e}=this.info;if(!e.helpMessage)return null;const o=t.tooltips.helpMessage??this._defaultHelpMessage;if(!o)return null;const i=t.tooltips.helpMessageIcon??"information";return k("div",{class:D,key:"help-message"},i?k("calcite-icon",{class:C,icon:i,scale:"s"}):null,k("div",{class:A},o))}get _defaultHelpMessage(){const{helpMessage:t,viewType:e}=this.info;if(null==t)return null;const o="3d"===e?"helpMessages3d":"helpMessages2d";return this._messagesTooltip?.sketch?.[o]?.[t]}async _focusField(t){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const{signal:e}=this._focusAbortController;await this._waitForInputs(),s(e);const o=this._getFocusableInputs(),i=t?o.find(e=>e.getAttribute("data-field-name")===t):o.at(0);await O(i)}async _transitionTo(t,o){if(this._mode===t&&!this._transitionInfo)return;if(this._transitionInfo?.mode===t)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();const i=async()=>{this.destroyed||(this._mode=t,await l(),this.destroyed||(this.renderNow(),await l(),this.destroyed||o?.()))};if("test"===process.env.NODE_ENV||!this.domNode?.firstChild||!document.startViewTransition||e())return void await i();this.autoRenderingEnabled=!1;const n=this._transitionInfo={transition:document.startViewTransition(async()=>{this.destroyed||n!==this._transitionInfo||(this.autoRenderingEnabled=!0,await i())}),mode:t};try{await n.transition.finished}finally{n===this._transitionInfo&&(this._transitionInfo=null)}}async _waitForInputs(){const t=()=>Array.from(this.domNode?.querySelectorAll("calcite-input")??[]);for(;0===t().length;)await r(P);await a()}_getFocusableInputs(){return Array.from(this.domNode?.querySelectorAll("calcite-input:not([read-only]):not([disabled])")??[])}_getFocusableElements(){const t=this.domNode?.querySelector(`.${M}`);return[...Array.from(t?.querySelectorAll(`.${b} calcite-button:not([disabled])`)??[]),...this._getFocusableInputs()]}};async function O(t){await(t?.componentOnReady?.()),await(t?.setFocus())}function S(t){return(Array.isArray(t)?t:[t]).flat(10).filter(t=>!!t)}t([T("esri/core/t9n/Units"),h()],N.prototype,"_messagesUnits",void 0),t([T("esri/views/interactive/tooltip/t9n/Tooltip"),h()],N.prototype,"_messagesTooltip",void 0),t([h()],N.prototype,"info",void 0),t([h()],N.prototype,"tooltip",void 0),t([h()],N.prototype,"_mode",void 0),t([h()],N.prototype,"mode",null),t([h()],N.prototype,"_displayUnits",null),t([h()],N.prototype,"_inputUnitInfos",null),t([h()],N.prototype,"_formatters",null),t([h()],N.prototype,"fieldContext",null),t([h()],N.prototype,"_renderedContent",null),t([h()],N.prototype,"_renderedActions",null),t([h()],N.prototype,"_renderedHelpMessage",null),t([h()],N.prototype,"_defaultHelpMessage",null),N=t([m("esri.views.interactive.tooltip.content.TooltipContent")],N);const P=20;export{N as TooltipContent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as o}from"../../../../core/accessorSupport/decorators.js";import{DrawHeaderActions as t}from"../components/DrawHeaderActions.js";import{Fields as i}from"./Fields.js";import{TooltipContent as n}from"./TooltipContent.js";import{tsx as r}from"../../../../widgets/support/widget.js";let s=class extends n{_renderContent(){const{fieldContext:e,info:o,mode:t}=this,{xyMode:n,visibleElements:s}=o;return r(i,{context:e,fields:[..."direction-distance"===n?[s.direction?o.direction:void 0,s.distance?o.distance:void 0]:[s.coordinates?o.effectiveX:void 0,s.coordinates?o.effectiveY:void 0],s.elevation?o.elevation:void 0,s.area?o.area:void 0],mode:t})}_renderActions(){const{xyMode:e,sketchOptions:o}=this.info;return r(t,{sketchOptions:o,visibleElements:{direction:"direction-distance"===e}})}};s=e([o("esri.views.interactive.tooltip.content.TooltipContentDrawPolygon")],s);export{s as TooltipContentDrawPolygon};
2
+ import{__decorate as o}from"tslib";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{DrawHeaderActions as t}from"../components/DrawHeaderActions.js";import{Fields as i}from"./Fields.js";import{TooltipContent as n}from"./TooltipContent.js";import{tsx as r}from"../../../../widgets/support/widget.js";let s=class extends n{_renderContent(){const{fieldContext:o,info:e,mode:t}=this,{xyMode:n,visibleElements:s}=e;return r(i,{context:o,fields:[..."direction-distance"===n?[s.direction?e.direction:void 0,s.distance?e.distance:void 0]:[s.coordinates?e.effectiveX:void 0,s.coordinates?e.effectiveY:void 0],s.elevation?e.elevation:void 0,s.area?e.area:void 0],mode:t})}_renderActions(){const{xyMode:o,toolOptions:e}=this.info;return r(t,{toolOptions:e,visibleElements:{direction:"direction-distance"===o}})}};s=o([e("esri.views.interactive.tooltip.content.TooltipContentDrawPolygon")],s);export{s as TooltipContentDrawPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{DrawHeaderActions as o}from"../components/DrawHeaderActions.js";import{Fields as i}from"./Fields.js";import{TooltipContent as n}from"./TooltipContent.js";import{tsx as r}from"../../../../widgets/support/widget.js";let s=class extends n{_renderContent(){const{fieldContext:t,info:e,mode:o}=this,{xyMode:n,visibleElements:s}=e;return r(i,{context:t,fields:[..."direction-distance"===n?[s.direction?e.direction:void 0,s.distance?e.distance:void 0]:[s.coordinates?e.effectiveX:void 0,s.coordinates?e.effectiveY:void 0],s.elevation?e.elevation:void 0,s.totalLength?e.totalLength:void 0],mode:o})}_renderActions(){const{xyMode:t,sketchOptions:e}=this.info;return r(o,{sketchOptions:e,visibleElements:{direction:"direction-distance"===t}})}};s=t([e("esri.views.interactive.tooltip.content.TooltipContentDrawPolyline")],s);export{s as TooltipContentDrawPolyline};
2
+ import{__decorate as o}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{DrawHeaderActions as e}from"../components/DrawHeaderActions.js";import{Fields as i}from"./Fields.js";import{TooltipContent as n}from"./TooltipContent.js";import{tsx as r}from"../../../../widgets/support/widget.js";let s=class extends n{_renderContent(){const{fieldContext:o,info:t,mode:e}=this,{xyMode:n,visibleElements:s}=t;return r(i,{context:o,fields:[..."direction-distance"===n?[s.direction?t.direction:void 0,s.distance?t.distance:void 0]:[s.coordinates?t.effectiveX:void 0,s.coordinates?t.effectiveY:void 0],s.elevation?t.elevation:void 0,s.totalLength?t.totalLength:void 0],mode:e})}_renderActions(){const{xyMode:o,toolOptions:t}=this.info;return r(e,{toolOptions:t,visibleElements:{direction:"direction-distance"===o}})}};s=o([t("esri.views.interactive.tooltip.content.TooltipContentDrawPolyline")],s);export{s as TooltipContentDrawPolyline};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{when as e}from"../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{notAvailableString as o}from"../constants.js";import{DrawHeaderActions as n}from"../components/DrawHeaderActions.js";import{TooltipEditableField as r}from"../components/TooltipEditableField.js";import{TooltipField as s}from"../components/TooltipField.js";import{ValueByValue as l}from"../components/ValueByValue.js";import{TooltipContent as d}from"./TooltipContent.js";import{tsx as f,tsxFragment as m}from"../../../../widgets/support/widget.js";let c=class extends d{initialize(){this.addHandles(e(()=>this.info&&this._messagesUnits&&this._messagesTooltip&&this.fieldContext,()=>this.info.renderContext=this.fieldContext),{once:!0})}destroy(){this.info&&(this.info.renderContext=null)}_renderContent(){const{fieldContext:t,info:e,mode:i}=this,n=e.fieldsGroupedForDisplay;return n.length?f(m,null,n.map(e=>{if("left"in e&&(e.left.readOnly&&e.right.readOnly||"feedback"===i)){const i="string"==typeof e.left.title?e.left.title:e.left.title(t);return f(s,{title:i,value:f(l,{left:e.left.getFormattedValue(t)??o,right:e.right.getFormattedValue(t)??o})})}return"left"in e?f(m,null,f(r,{context:t,field:e.left,key:e.left.id,mode:i}),f(r,{context:t,field:e.right,key:e.right.id,mode:i})):f(r,{context:t,field:e,key:e.id,mode:i})})):null}_renderActions(){const{xyMode:t,sketchOptions:e}=this.info,i=this.info.allFields.some(t=>"direction"===t.name);return f(n,{sketchOptions:e,visibleElements:{direction:"direction-distance"===t&&i}})}};c=t([i("esri.views.interactive.tooltip.content.TooltipContentDynamic")],c);export{c as TooltipContentDynamic};
2
+ import{__decorate as t}from"tslib";import{when as e}from"../../../../core/reactiveUtils.js";import{subclass as o}from"../../../../core/accessorSupport/decorators.js";import{notAvailableString as i}from"../constants.js";import{DrawHeaderActions as n}from"../components/DrawHeaderActions.js";import{TooltipEditableField as r}from"../components/TooltipEditableField.js";import{TooltipField as s}from"../components/TooltipField.js";import{ValueByValue as l}from"../components/ValueByValue.js";import{TooltipContent as d}from"./TooltipContent.js";import{tsx as f,tsxFragment as m}from"../../../../widgets/support/widget.js";let p=class extends d{initialize(){this.addHandles(e(()=>this.info&&this._messagesUnits&&this._messagesTooltip&&this.fieldContext,()=>this.info.renderContext=this.fieldContext),{once:!0})}destroy(){this.info&&(this.info.renderContext=null)}_renderContent(){const{fieldContext:t,info:e,mode:o}=this,n=e.fieldsGroupedForDisplay;return n.length?f(m,null,n.map(e=>{if("left"in e&&(e.left.readOnly&&e.right.readOnly||"feedback"===o)){const o="string"==typeof e.left.title?e.left.title:e.left.title(t);return f(s,{title:o,value:f(l,{left:e.left.getFormattedValue(t)??i,right:e.right.getFormattedValue(t)??i})})}return"left"in e?f(m,null,f(r,{context:t,field:e.left,key:e.left.id,mode:o}),f(r,{context:t,field:e.right,key:e.right.id,mode:o})):f(r,{context:t,field:e,key:e.id,mode:o})})):null}_renderActions(){const{xyMode:t,toolOptions:e}=this.info,o=this.info.allFields.some(t=>"direction"===t.name);return f(n,{toolOptions:e,visibleElements:{direction:"direction-distance"===t&&o}})}};p=t([o("esri.views.interactive.tooltip.content.TooltipContentDynamic")],p);export{p as TooltipContentDynamic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{zeroSquareMeters as t,toUnit as e,createScalar as a,zeroMeters as n,zeroDegrees as r,createAngle as i,createLength as o,createArea as s}from"../../../../core/quantity.js";import{makeQuantityParser as u,formatLongitudeDecimalDegreesForInputMode as f,makeCoordinateExpressionParser as c,formatLatitudeDecimalDegreesForInputMode as l,sanitizeAngle as m,parseLongitude as p,parseLatitude as g}from"./parsingAndFormattingUtils.js";import{TooltipField as d}from"./TooltipField.js";import{TooltipFieldElevation as h}from"./TooltipFieldElevation.js";import{TooltipFieldOrientation as b}from"./TooltipFieldOrientation.js";import{TooltipFieldSize as I}from"./TooltipFieldSize.js";import{getNormalizedDirection as v}from"../../../support/angularMeasurementUtils.js";function y(t){const a=t=>t.inputUnitInfos.angle.unit,n=t=>t.sketchOptions.values.effectiveDirectionMode;return new d({name:"direction",actual:r,parse:u({createQuantity:(t,e)=>i(t,a(e),"geographic"),sanitize:m}),format:(t,e)=>{const a=n(e),r=v(t,a);switch(a){case"absolute":return e.formatters.direction(r);case"relative":return e.formatters.directionRelative(r);case"relative-bilateral":return e.formatters.directionRelativeBilateral(r)}},formatForInputMode:(t,r)=>{const i=v(t,n(r));return r.formatters.scalar(e(i,a(r)))},suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>{const e=n(t),{absolute:a,relative:r}=t.messages.sketch.direction;switch(e){case"absolute":return a;case"relative":case"relative-bilateral":return r}},...t})}function U(t){const a=t=>t.inputUnitInfos.length.unit;return new d({name:t?.name??"distance",actual:n,parse:u({createQuantity:(t,e)=>o(Math.max(t,0),a(e))}),format:(t,e)=>e.formatters.length(t),formatForInputMode:(t,n)=>n.formatters.scalar(e(t,a(n))),suffix:t=>t.inputUnitInfos.length.abbreviation,title:t=>t.messages.sketch.distance,...t})}function w(t){const a=t=>t.inputUnitInfos.length.unit;return new d({name:t?.name??"radius",actual:n,parse:u({createQuantity:(t,e)=>o(Math.max(t,0),a(e))}),format:(t,e)=>e.formatters.length(t),formatForInputMode:(t,n)=>n.formatters.scalar(e(t,a(n))),suffix:t=>t.inputUnitInfos.length.abbreviation,title:t=>t.messages.sketch.radius,...t})}function x(t){return U({format:(t,e)=>e.formatters.totalLength(t),title:t=>t.messages.sketch.totalLength,readOnly:!0,...t})}function F(t){return U({...t})}function M(t){const e=t=>t.inputUnitInfos.length.unit;return U({...t,parse:u({createQuantity:(t,a)=>o(t,e(a))}),format:(t,e)=>e.formatters.lengthRelative(t)})}function k(t){return new h(t)}function j(t){return new b(t)}function Q(t){return new I(t)}function D(t){return A("scale",{name:"scale",actual:null,parse:u({createQuantity:t=>a(Math.abs(t))}),...t})}function O(a){const n=t=>t.inputUnitInfos.area.unit;return new d({name:"area",actual:t,parse:u({createQuantity:(t,e)=>s(t,n(e))}),format:(t,e)=>e.formatters.area(t),formatForInputMode:(t,a)=>a.formatters.scalar(e(t,n(a))),suffix:t=>t.inputUnitInfos.area.abbreviation,title:t=>t.messages.sketch.area,readOnly:!0,...a})}function T(t){return new d({name:"x",actual:r,parse:c(p),format:(t,e)=>e.formatters.longitudeDecimalDegrees(t),formatForInputMode:t=>f(t),suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>t.messages.sketch.longitude,...t})}function R(t){return new d({name:"y",actual:r,parse:c(g),format:(t,e)=>e.formatters.latitudeDecimalDegrees(t),formatForInputMode:t=>l(t),suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>t.messages.sketch.latitude,...t})}function z(t){return A("x",{name:"x",...t})}function L(t){return A("y",{name:"y",...t})}function q(t){return new d({actual:a(0),parse:u({createQuantity:t=>a(t)}),format:(t,e)=>e.formatters.scalar(t),formatForInputMode:(t,e)=>e.formatters.scalar(t),title:t=>t.messages.sketch.scale,...t})}function A(t,e){return q({title:e=>e.messages.sketch[t],...e})}export{O as makeAreaField,y as makeDirectionField,F as makeDistanceField,k as makeElevationField,R as makeLatitudeField,U as makeLengthField,T as makeLongitudeField,j as makeOrientationField,w as makeRadiusField,M as makeRelativeDistanceField,q as makeScalarField,D as makeScaleField,Q as makeSizeField,x as makeTotalLengthField,z as makeXField,L as makeYField};
2
+ import{zeroSquareMeters as t,toUnit as e,createScalar as a,zeroMeters as n,zeroDegrees as r,createAngle as i,createLength as o,createArea as s}from"../../../../core/quantity.js";import{makeQuantityParser as u,formatLongitudeDecimalDegreesForInputMode as f,makeCoordinateExpressionParser as l,formatLatitudeDecimalDegreesForInputMode as c,sanitizeAngle as m,parseLongitude as p,parseLatitude as g}from"./parsingAndFormattingUtils.js";import{TooltipField as d}from"./TooltipField.js";import{TooltipFieldElevation as h}from"./TooltipFieldElevation.js";import{TooltipFieldOrientation as b}from"./TooltipFieldOrientation.js";import{TooltipFieldSize as I}from"./TooltipFieldSize.js";import{getNormalizedDirection as v}from"../../../support/angularMeasurementUtils.js";function y(t){const a=t=>t.inputUnitInfos.angle.unit,n=t=>t.toolOptions.values.effectiveDirectionMode;return new d({name:"direction",actual:r,parse:u({createQuantity:(t,e)=>i(t,a(e),"geographic"),sanitize:m}),format:(t,e)=>{const a=n(e),r=v(t,a);switch(a){case"absolute":return e.formatters.direction(r);case"relative":return e.formatters.directionRelative(r);case"relative-bilateral":return e.formatters.directionRelativeBilateral(r)}},formatForInputMode:(t,r)=>{const i=v(t,n(r));return r.formatters.scalar(e(i,a(r)))},suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>{const e=n(t),{absolute:a,relative:r}=t.messages.sketch.direction;switch(e){case"absolute":return a;case"relative":case"relative-bilateral":return r}},...t})}function U(t){const a=t=>t.inputUnitInfos.length.unit;return new d({name:t?.name??"distance",actual:n,parse:u({createQuantity:(t,e)=>o(Math.max(t,0),a(e))}),format:(t,e)=>e.formatters.length(t),formatForInputMode:(t,n)=>n.formatters.scalar(e(t,a(n))),suffix:t=>t.inputUnitInfos.length.abbreviation,title:t=>t.messages.sketch.distance,...t})}function w(t){const a=t=>t.inputUnitInfos.length.unit;return new d({name:t?.name??"radius",actual:n,parse:u({createQuantity:(t,e)=>o(Math.max(t,0),a(e))}),format:(t,e)=>e.formatters.length(t),formatForInputMode:(t,n)=>n.formatters.scalar(e(t,a(n))),suffix:t=>t.inputUnitInfos.length.abbreviation,title:t=>t.messages.sketch.radius,...t})}function x(t){return U({format:(t,e)=>e.formatters.totalLength(t),title:t=>t.messages.sketch.totalLength,readOnly:!0,...t})}function F(t){return U({...t})}function M(t){const e=t=>t.inputUnitInfos.length.unit;return U({...t,parse:u({createQuantity:(t,a)=>o(t,e(a))}),format:(t,e)=>e.formatters.lengthRelative(t)})}function k(t){return new h(t)}function j(t){return new b(t)}function Q(t){return new I(t)}function D(t){return A("scale",{name:"scale",actual:null,parse:u({createQuantity:t=>a(Math.abs(t))}),...t})}function O(a){const n=t=>t.inputUnitInfos.area.unit;return new d({name:"area",actual:t,parse:u({createQuantity:(t,e)=>s(t,n(e))}),format:(t,e)=>e.formatters.area(t),formatForInputMode:(t,a)=>a.formatters.scalar(e(t,n(a))),suffix:t=>t.inputUnitInfos.area.abbreviation,title:t=>t.messages.sketch.area,readOnly:!0,...a})}function T(t){return new d({name:"x",actual:r,parse:l(p),format:(t,e)=>e.formatters.longitudeDecimalDegrees(t),formatForInputMode:t=>f(t),suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>t.messages.sketch.longitude,...t})}function R(t){return new d({name:"y",actual:r,parse:l(g),format:(t,e)=>e.formatters.latitudeDecimalDegrees(t),formatForInputMode:t=>c(t),suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>t.messages.sketch.latitude,...t})}function z(t){return A("x",{name:"x",...t})}function L(t){return A("y",{name:"y",...t})}function q(t){return new d({actual:a(0),parse:u({createQuantity:t=>a(t)}),format:(t,e)=>e.formatters.scalar(t),formatForInputMode:(t,e)=>e.formatters.scalar(t),title:t=>t.messages.sketch.scale,...t})}function A(t,e){return q({title:e=>e.messages.sketch[t],...e})}export{O as makeAreaField,y as makeDirectionField,F as makeDistanceField,k as makeElevationField,R as makeLatitudeField,U as makeLengthField,T as makeLongitudeField,j as makeOrientationField,w as makeRadiusField,M as makeRelativeDistanceField,q as makeScalarField,D as makeScaleField,Q as makeSizeField,x as makeTotalLengthField,z as makeXField,L as makeYField};