@arcgis/core 5.1.0-next.67 → 5.1.0-next.68

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 (132) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{2e1aecdf59ad3421bbad.js → 0e2e4cb34ac6aac88ebf.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{38816f95e801f1c5bbad.js → 1c742bfe3b0aa51823d1.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{27262083d37fe623ca9c.js → 210629f3c28d4339c655.js} +1 -1
  5. package/assets/esri/core/workers/chunks/27643750dce502fedef3.js +1 -0
  6. package/assets/esri/core/workers/chunks/29878b52aa12b3815230.js +1 -0
  7. package/assets/esri/core/workers/chunks/{7fb9a5bc22d7581f1d20.js → 29b1a4ce7646b403008e.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{eb7392799a01c2a8497a.js → 2da62687ff678b690839.js} +1 -1
  9. package/assets/esri/core/workers/chunks/2fd4220131bfc3f5e2dd.js +1 -0
  10. package/assets/esri/core/workers/chunks/{a118de5a163ae42bee60.js → 333a0038d782d8a34d58.js} +1 -1
  11. package/assets/esri/core/workers/chunks/38328a785365c4783b1e.js +1 -0
  12. package/assets/esri/core/workers/chunks/{e268e5be096392c2e69b.js → 3eef3c2e94aa2a00d76a.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{a5b395e518e4c5fc95d0.js → 40d6ad030614099155cd.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{427183ea93e759943a78.js → 43678e08a3d9d51c2a6d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{af007ec833ab49e4c958.js → 453280ea87a696a4df81.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{921c30b7f4dfc3e018d9.js → 4605a68e40c5c3ac6e3e.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{abd5c1d4b7b91d9ea1eb.js → 478879ba965798f61bf3.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{aa69cbaa38b49677ddff.js → 499b899bf88aaf29230d.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{8a0f254d45d00b293479.js → 49fb9c47070641bce9a9.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{f8eb14170f927aecfbc8.js → 4f9d027055f3a616173c.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4e7b084f7104deea1ddb.js → 53b797e384be9628fc94.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{ff0cb1eec14d34214f12.js → 5fe97253f80c797fad7f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2f8ed1e7c1b10cb30972.js → 678c9f15712cf3d3bb9e.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4005d37d03c834da7629.js → 68a313155ddc29bd024d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{684ea7f75a7a5fb52cde.js → 6a21c9a4aeebe806ea39.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{0f196ec93925dfefc69a.js → 6bb090f3e5c18604cb39.js} +1 -1
  27. package/assets/esri/core/workers/chunks/73e000cc3c4da10e9937.js +1 -0
  28. package/assets/esri/core/workers/chunks/{79df97e3f5975b42dc4d.js → 75669912cddcb5db52c8.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{749c368f5cc2366716f1.js → 7bd1d624f4f4a11a31e8.js} +1 -1
  30. package/assets/esri/core/workers/chunks/7cadfd7444a2a05cf2fb.js +1 -0
  31. package/assets/esri/core/workers/chunks/{1515824f11ef5ab95378.js → 7d0350f459844162d3a7.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{4d069a0ebadb9c53b550.js → 7e39e9d4d68843b60e4c.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{8d5bc17557a31ed79ed8.js → 81750c5177d8d52a3e05.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{7d73472696ec76458758.js → 81b2985b83be8f8f1090.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{a8ef9ed9b59de95f2b23.js → 823127b23bec07e1f9d0.js} +2 -2
  36. package/assets/esri/core/workers/chunks/{b8bf3e8b8b870f69f231.js → 8969788c57bcc11bf77b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{4e7bb224bde9e5039263.js → 8b8f391f27774aec6db9.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{0e90e9ea1ad587eb3495.js → 8ea4584e07ccc85caabd.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{6c40b3c2b9071edb758d.js → 8fb336c2066113300d0d.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{b5648a0b92cf1a2c81ad.js → 915a5e8aecf25f3bc72b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{7ffcd308087c35adda04.js → 9bd713d96502ddc2ce25.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{9622a83b29acb768fcb5.js → a25acccda8febac71a3d.js} +1 -1
  43. package/assets/esri/core/workers/chunks/a30815a0155a3b8790b4.js +1 -0
  44. package/assets/esri/core/workers/chunks/{90cef6f96df7dc27db39.js → a43decc8ede8b4910553.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{dd26e3a29161ea411e41.js → a94bd20551c1179c7ec5.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{fa7ae035472540999721.js → b2120c4c56656be941ae.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{a59db907ec1e31002100.js → b85c9ceeece1bae67a16.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{c4e936879c6cb25cf586.js → b8a11d32a4847513619b.js} +1 -1
  49. package/assets/esri/core/workers/chunks/bbaf1d9835671c0165ca.js +1 -0
  50. package/assets/esri/core/workers/chunks/{cb9185ed31109781fe59.js → bc887bd62579dba81e2b.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{7e9b790fe01b89acdf6d.js → bcefdf9753d9d2f6f1be.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{927773ed23b1fc245bf7.js → be61ea8e1883b915bbb1.js} +1 -1
  53. package/assets/esri/core/workers/chunks/c02ba921c0a32d2021e3.js +1 -0
  54. package/assets/esri/core/workers/chunks/{9a95c28d4a3b3b4b2c50.js → c49c078be08c38a6088d.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{d94dfb2ce31e59b3306b.js → c79827f879d1d58d3f1b.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{56036327e721f9c42b33.js → c7ca47f5d4b2f3885239.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{d83ac66478a419e08af6.js → d3d9d40556c847bba1a7.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{789357e0f79823f145dd.js → d4e55eb75fa4d3ac1e84.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{fee31d9297648219375d.js → d8d7331600d93bbca2b4.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{e907acaec4c62adac2f2.js → e0fe23019410dea8236b.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{4f847a426973bd350c11.js → e5801b0f3893d4d4f5b0.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{6ab8ed12d162d79a8c55.js → e62d08f5488a74cbda82.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{b4fb4484fa39eede1f62.js → e66b9d00d02fc08cbb2d.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{69520cad347947b09f21.js → ecb7ede6a8e6c05e4c6c.js} +1 -1
  65. package/assets/esri/core/workers/chunks/ef9d74f8d5a502fda809.js +1 -0
  66. package/assets/esri/core/workers/chunks/f0bc5e8e44d53b73d431.js +1 -0
  67. package/assets/esri/core/workers/chunks/f11ea0d3de93ec0392af.js +1 -0
  68. package/assets/esri/core/workers/chunks/{cc8e6d1eb90221103023.js → f1e5626a0cc1631a1efb.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{afea4a4b072c329d3749.js → fc64ae69581e4c38fa8a.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{3f8e8f83ebda07d29ca8.js → fd6bbe47773bbd9f7dd9.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{8418ad9ad7b6481ebe82.js → ffb70e9358c0b171a315.js} +1 -1
  72. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  73. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  74. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  75. package/chunks/arcgis-knowledge-client-core.js +1 -1
  76. package/config.js +1 -1
  77. package/core/string.js +1 -1
  78. package/geometry/support/lineSegment.js +1 -1
  79. package/kernel.js +1 -1
  80. package/layers/GroupLayer.js +1 -1
  81. package/layers/SceneLayer.js +1 -1
  82. package/layers/VoxelWasmPerSceneView.js +1 -1
  83. package/layers/mixins/OperationalLayer.js +1 -1
  84. package/layers/support/arcgisLayers.js +1 -1
  85. package/layers/support/layersCreator.js +1 -1
  86. package/layers/support/{lazyLayerLoader.js → layersLoader.js} +1 -1
  87. package/layers/support/layersMapping.js +2 -0
  88. package/package.json +2 -2
  89. package/popup/Feature.d.ts +3 -3
  90. package/popup/Features.d.ts +1 -13
  91. package/popup/Features.js +1 -1
  92. package/popup/actionUtils.js +1 -1
  93. package/portal/support/portalLayers.js +1 -1
  94. package/rest/knowledgeGraph/GraphQueryResultHeader.js +1 -1
  95. package/rest/knowledgeGraph/wasmInterface/wasmToQueryResponseObjFactories.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
  98. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  99. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  100. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  101. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  102. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  103. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  104. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  105. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  106. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  107. package/views/3d/webgl.js +1 -1
  108. package/views/SelectionManager.d.ts +1 -1
  109. package/views/VideoView.js +1 -1
  110. package/views/draw/DrawManipulator.js +1 -1
  111. package/views/draw/DrawManipulator3D.js +2 -0
  112. package/views/draw/DrawTool.js +1 -1
  113. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  114. package/webscene/spec-certification/api.js +1 -1
  115. package/widgets/Compass/CompassViewModel.d.ts +1 -0
  116. package/widgets/Compass/CompassViewModel.js +1 -1
  117. package/widgets/Compass.js +1 -1
  118. package/assets/esri/core/workers/chunks/12294f8c32c34788b6de.js +0 -1
  119. package/assets/esri/core/workers/chunks/151c2766a4cacc6adbd6.js +0 -1
  120. package/assets/esri/core/workers/chunks/1984c0f037065acd21d3.js +0 -1
  121. package/assets/esri/core/workers/chunks/4fd1bf82939e3bb9bc03.js +0 -1
  122. package/assets/esri/core/workers/chunks/61794a861a9209b72622.js +0 -1
  123. package/assets/esri/core/workers/chunks/644dd906bee3ef465ec0.js +0 -1
  124. package/assets/esri/core/workers/chunks/6f079f1fd6d00d2d174c.js +0 -1
  125. package/assets/esri/core/workers/chunks/751f3cfb000045ac78bb.js +0 -1
  126. package/assets/esri/core/workers/chunks/a80eb704e75d13732878.js +0 -1
  127. package/assets/esri/core/workers/chunks/c72e90a952543d06d84b.js +0 -1
  128. package/assets/esri/core/workers/chunks/e9f2b573f482718306e6.js +0 -1
  129. package/assets/esri/core/workers/chunks/f62e42659b406435573d.js +0 -1
  130. package/layers/mixins/operationalLayerModuleMap.js +0 -2
  131. package/layers/mixins/operationalLayers.js +0 -2
  132. /package/assets/esri/core/workers/chunks/{a8ef9ed9b59de95f2b23.js.LICENSE.txt → 823127b23bec07e1f9d0.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{createTask as n}from"../../core/asyncUtils.js";import{makeHandle as a,disposable as s}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as d}from"../../core/maybe.js";import{when as p,initial as c,watch as h,on as g,sync as u}from"../../core/reactiveUtils.js";import{screenPointEqual as m,createScreenPoint as v}from"../../core/screenUtils.js";import{diff as y}from"../../core/accessorSupport/diffUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{subclass as M}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import b from"../../geometry/Polygon.js";import{i as w,e as S}from"../../chunks/simplifyOperator.js";import{isExtent as C}from"../../geometry/support/jsonTypeUtils.js";import{isPolygon as x}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as H}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as P}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as L}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as k,getMinSegmentsPerCurve as O}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as I}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as j,markHandled as G,getPointerType as T}from"./support/drawToolUtils.js";import{PluginContext as E}from"./support/PluginContext.js";import{viewEventToCommand as V}from"./support/input/drawToolInput.js";import{EditSessionManager as U}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as A}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as D}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as R}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as F}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as Z}from"./support/managers/SurfaceManager.js";import{TooltipManager as q}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as B}from"../input/InputManager.js";import{createCoordinateHelper as z}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as K}from"../interactive/InteractiveToolBase.js";import{KeyBindings as N,mediaKeys as Q,sketchKeys as W,advancedSketchKeys as $,tooltipKeys as J}from"../interactive/keybindings.js";import{isInputModeAvailable as X}from"../interactive/tooltip/tooltipCommonUtils.js";const Y=Symbol();let ee=class extends K{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new _,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new R,this.globalStateManager=new A({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new U({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new F({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new D({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new q({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(p(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(I(e,t).then(e=>this._snappingVisualizer=e))},c)),this.addHandles([p(()=>this.view,e=>{this.surfaceManager?.destroy(),this.surfaceManager=new Z({spatialReference:this.coordinateHelper.spatialReference,excludedGraphicsLayer:null,defaultZ:this.defaultZ,hasZ:this.hasZ,view:e,elevationInfo:this.elevationInfo,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},c),p(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),h(()=>[this.editGeometryOperations,this.sketchOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},c),g(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},u),g(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},u),h(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},u),g(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=l(this.surfaceManager),this.interactiveHandleManager=l(this.interactiveHandleManager),this._segmentLabelsImportTask=d(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this.tooltipManager=l(this.tooltipManager)}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:n,view:a}=this;return t&&i&&a?{defaultZ:e,directionOptions:n,editGeometryOperations:t,sketchOptions:i,view:a,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,n=e?.spatialReference,a=e.resolution;if(!(i&&n&&a&&Number.isFinite(a)))return null;const s=n.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(a))*k()*s,minSegmentsPerCurve:O()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return z(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&x(e))try{const t=this._densificationParameters,i=H(e)&&t?new b({...P(e,t)}):e;if(!w(i))return S(i)}catch(t){return e}return e}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){return this.lastScreenPosition?this.view.toMap(this.lastScreenPosition):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:n,interactiveHandleManager:a,_snappingVisualizer:s,defaultZ:r,hasZ:o,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:a,snappingManager:n,snappingVisualizer:s,pointerType:"mouse",hasZ:o,defaultZ:r,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;e&&t.complete(e),0===t.pluginStack.length&&(this._finalizeAndSimplifyGeometryResult(),this.emit("complete",{geometry:this.finalGeometry,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null))}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return"secondary"===this.interactiveHandleManager?.capturingHandle?.role?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){const t=this.lifecycleManager;t.updating?r.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:"undo"})}redo(){this._handleCommand({action:"redo"})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,a(()=>{this._commandsSuspended=!1;const e=this.view?.inputManager.latestPointerInfo;if(e){const{x:t,y:i}=e.location;this._handleCommand({action:"manipulator-move-to",x:t,y:i})}})}addPromise(e){return this._updatingHandles.addPromise(e)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(h(()=>this.unprocessedGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?j(e):null})},c)),this.addHandles([h(()=>this.simplifiedGeometryPreview,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},c),p(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:m}),h(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},u),this._keybindings.register(e,B.TOOL),h(()=>e.viewpoint,(e,t)=>{e&&t&&y(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],Y)}onDeactivate(){super.onDeactivate(),this.removeHandles(Y),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=V(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended)if(this.lifecycleManager.updating)r.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{G(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(G(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&G(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&X(t.info)&&(await t.enterInputMode(),G(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&G(e):G(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(G(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:T(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions())}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&G(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:T(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=T(e.originalEvent),i=this._updateLastScreenPosition(e),n=this.interactiveHandleManager?.findHandleByManipulator(i);"touch"===t&&n&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const a=this.interactiveHandleManager?.findHandleDragging(),s=this.interactiveHandleManager?.capturingHandle,r=a??s??n;r&&!n&&G(e),"capture-when-engaged"===r?.captureMode||"capture-always"===r?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(r.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===T(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&"primary"===r.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(r.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===T(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&!r.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(r?.moveTo(i,{...this.movementCommandContext,pointerType:T(e.originalEvent)})):"grabbable-object"===r?.captureMode&&(this.interactiveHandleManager?.releaseHandle(s),await this._updatingHandles.addPromise(r.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t);this.editable&&i&&(this._before(e)||(G(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:T(e.originalEvent)}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new N,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(Q.preserveAspectRatio,"constraint-aspect"),t(W.center,"constraint-center"),i($.toggleFollowManipulator,"toggle-manipulator-follow"),i(W.undo,"undo"),i(W.redo,"redo"),i(W.complete,"complete"),i(W.vertexAdd,"vertex-add"),i({key:J.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const a=this.editGeometryOperations;e(i,a?s(a.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=v(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=o(this._pluginContexts,e,()=>new E({drawTool:this,plugin:e,session:t}));return i.session=t,i}_finalizeAndSimplifyGeometryResult(){const e=this.unprocessedGeometry;try{const t=e?S(e):e;t&&!C(t)?this.finalGeometry=t:this.finalGeometry=e}catch(t){r.getLogger(this).error("draw-tool:complete","geometry simplification failed",t)}}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}async _setupSegmentLabels(){const e=this.editGeometryOperations,t=this.sketchOptions?.labels,i=!!t?.enabled,n=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!i)return void(this._segmentLabels=l(this._segmentLabels));if(n)return void(this._segmentLabels&&(this._segmentLabels.visible=!1));if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t)return void(this._segmentLabels.visible=!0);const a=await this._createSegmentLabels(e,t);a&&(this._segmentLabels=l(this._segmentLabels),this._segmentLabels=a)}async _createSegmentLabels(e,t){return(this._segmentLabelsImportTask??=n(async i=>{if("3d"===this.view.type){const n=import("../3d/interactive/SegmentLabels3D.js"),{SegmentLabels3D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:L(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}const n=import("../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:L(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})})).promise}_isSegmentLabelsSetupStale(e,t,i){return e.aborted||this.editGeometryOperations!==t||this.sketchOptions?.labels!==i||!i.enabled||this.globalStateManager.segmentLabelsDisabled}};i([f()],ee.prototype,"_commandsSuspended",void 0),i([f()],ee.prototype,"_snappingVisualizer",void 0),i([f()],ee.prototype,"_segmentLabels",void 0),i([f()],ee.prototype,"_segmentLabelsImportTask",void 0),i([f()],ee.prototype,"_tooltipDependencies",null),i([f()],ee.prototype,"_editSessionManagerContext",null),i([f()],ee.prototype,"_densificationParameters",null),i([f({constructOnly:!0,nonNullable:!0})],ee.prototype,"view",void 0),i([f()],ee.prototype,"automaticManipulatorSelection",void 0),i([f()],ee.prototype,"updating",null),i([f()],ee.prototype,"coordinateHelper",null),i([f()],ee.prototype,"editGeometry",null),i([f()],ee.prototype,"editGeometryOperations",null),i([f()],ee.prototype,"unprocessedGeometry",null),i([f()],ee.prototype,"finalGeometry",void 0),i([f()],ee.prototype,"simplifiedGeometryPreview",null),i([f()],ee.prototype,"snappingManager",void 0),i([f()],ee.prototype,"sketchOptions",void 0),i([f()],ee.prototype,"elevationInfo",void 0),i([f()],ee.prototype,"hasZ",void 0),i([f()],ee.prototype,"defaultZ",void 0),i([f()],ee.prototype,"directionOptions",void 0),i([f()],ee.prototype,"canUndo",null),i([f()],ee.prototype,"canRedo",null),i([f()],ee.prototype,"pluginStack",null),i([f()],ee.prototype,"mostDownstreamPlugin",null),i([f()],ee.prototype,"mostUpstreamPlugin",null),i([f()],ee.prototype,"lastScreenPosition",void 0),i([f()],ee.prototype,"positionOfLastUserInput",null),i([f()],ee.prototype,"tooltipManager",void 0),i([f()],ee.prototype,"measurementManager",void 0),i([f()],ee.prototype,"globalStateManager",void 0),i([f()],ee.prototype,"editSessionManager",void 0),i([f()],ee.prototype,"lifecycleManager",void 0),i([f()],ee.prototype,"surfaceManager",void 0),i([f()],ee.prototype,"interactiveHandleManager",void 0),i([f()],ee.prototype,"renderer",void 0),i([f()],ee.prototype,"movementCommandContext",null),i([f()],ee.prototype,"tooltip",null),i([f()],ee.prototype,"activeTooltipInfo",null),i([f()],ee.prototype,"helpMessageKey",null),i([f({constructOnly:!0})],ee.prototype,"enableVertexVisuals",void 0),ee=i([M("esri.views.draw.DrawTool")],ee);export{ee as DrawTool};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{createTask as n}from"../../core/asyncUtils.js";import{makeHandle as a,disposable as s}from"../../core/handleUtils.js";import r from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{destroyMaybe as l,abortMaybe as d}from"../../core/maybe.js";import{when as p,initial as c,watch as u,syncAndInitial as h,on as g,sync as m}from"../../core/reactiveUtils.js";import{screenPointEqual as v,createScreenPoint as y}from"../../core/screenUtils.js";import{diff as f}from"../../core/accessorSupport/diffUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import{subclass as M}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as b}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/Polygon.js";import{i as S,e as C}from"../../chunks/simplifyOperator.js";import{isExtent as x}from"../../geometry/support/jsonTypeUtils.js";import{isPolygon as P}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as H}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as L}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getEffectiveElevationInfo as k}from"../../support/elevationInfoUtils.js";import{getMaxDeviationInPixels as I,getMinSegmentsPerCurve as O}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as G}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as j,markHandled as T,getPointerType as V}from"./support/drawToolUtils.js";import{PluginContext as E}from"./support/PluginContext.js";import{viewEventToCommand as D}from"./support/input/drawToolInput.js";import{EditSessionManager as U}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as A}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as R}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as F}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as Z}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as B}from"./support/managers/SurfaceManager.js";import{TooltipManager as q}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as z}from"../input/InputManager.js";import{createCoordinateHelper as K}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as N}from"../interactive/InteractiveToolBase.js";import{KeyBindings as Q,mediaKeys as W,sketchKeys as $,advancedSketchKeys as J,tooltipKeys as X}from"../interactive/keybindings.js";import{isInputModeAvailable as Y}from"../interactive/tooltip/tooltipCommonUtils.js";const ee=Symbol();let te=class extends N{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._commandsSuspended=!1,this._snappingVisualizer=null,this._segmentLabels=null,this._segmentLabelsImportTask=null,this._updatingHandles=new b,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new F,this.globalStateManager=new A({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new U({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new Z({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new R({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new q({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(p(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(G(e,t).then(e=>this._snappingVisualizer=e))},c)),this.addHandles([u(()=>[this.view,this.coordinateHelper.spatialReference,this.defaultZ,this.hasZ,this.elevationInfo],([e,t,i,n,a])=>{this.surfaceManager?.destroy(),this.surfaceManager=new B({spatialReference:t,excludedGraphicsLayer:null,defaultZ:i,hasZ:n,view:e,elevationInfo:a,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},h),p(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),u(()=>[this.editGeometryOperations,this.sketchOptions?.labels.enabled,this.globalStateManager.segmentLabelsDisabled],()=>{this._updatingHandles.addPromise(this._setupSegmentLabels())},c),g(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},m),g(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},m),u(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},m),g(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=l(this.surfaceManager),this.interactiveHandleManager=l(this.interactiveHandleManager),this._segmentLabelsImportTask=d(this._segmentLabelsImportTask),this._segmentLabels=l(this._segmentLabels),this.tooltipManager=l(this.tooltipManager)}get _zOfLastUserInput(){const e=this.mostDownstreamPlugin&&this.editSessionManager.getSession(this.mostDownstreamPlugin),t=e?.firstPointAddedBySession?.point;return t?.hasZ?t.z:null}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:n,elevationInfo:a,view:s}=this;return t&&i&&s?{defaultZ:e,directionOptions:n,elevationInfo:a,editGeometryOperations:t,sketchOptions:i,view:s,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,n=e?.spatialReference,a=e.resolution;if(!(i&&n&&a&&Number.isFinite(a)))return null;const s=n.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(a))*I()*s,minSegmentsPerCurve:O()}}get test(){return{densificationParameters:this._densificationParameters,segmentLabels:this._segmentLabels}}get updating(){return this._updatingHandles.updating||this.lifecycleManager.updating||!!this._segmentLabels?.updating}get coordinateHelper(){return K(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&P(e))try{const t=this._densificationParameters,i=H(e)&&t?new w({...L(e,t)}):e;if(!S(i))return C(i)}catch(t){return e}return e}get _suppressCoincidentPointOverlaysIn3D(){return"3d"===this.view.type&&"point"===this.unprocessedGeometry?.type&&!!this.interactiveHandleManager?.allhandles?.find(e=>"primary"===e.role)?.outputMapPosition}get _shapeVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.simplifiedGeometryPreview}get _vertexVisualGeometry(){return this._suppressCoincidentPointOverlaysIn3D?null:this.unprocessedGeometry}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){const e=this.lastScreenPosition;return e?this.surfaceManager?.screenToMap(e,{firstPointZ:this._zOfLastUserInput})??this.view.toMap(e):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:n,interactiveHandleManager:a,_snappingVisualizer:s,defaultZ:r,hasZ:o,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:a,snappingManager:n,snappingVisualizer:s,pointerType:"mouse",hasZ:o,defaultZ:r,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;e&&t.complete(e),0===t.pluginStack.length&&(this._finalizeAndSimplifyGeometryResult(),this.emit("complete",{geometry:this.finalGeometry,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null))}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}getVertexSnappingCandidates(){return"secondary"===this.interactiveHandleManager?.capturingHandle?.role?[]:this.snappingManager?.getVertexCandidates()??[]}replaceLeaf(e){const t=this.lifecycleManager;t.updating?r.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._handleCommand({action:"undo"})}redo(){this._handleCommand({action:"redo"})}executeCommand(e){return this._handleCommand(e)}suspendCommands(){return this._commandsSuspended=!0,a(()=>{this._commandsSuspended=!1;const e=this.view?.inputManager.latestPointerInfo;if(e){const{x:t,y:i}=e.location;this._handleCommand({action:"manipulator-move-to",x:t,y:i})}})}addPromise(e){return this._updatingHandles.addPromise(e)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(u(()=>this._vertexVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?j(e):null})},c)),this.addHandles([u(()=>this._shapeVisualGeometry,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},c),p(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:v}),u(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},m),this._keybindings.register(e,z.TOOL),u(()=>e.viewpoint,(e,t)=>{e&&t&&f(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],ee)}onDeactivate(){super.onDeactivate(),this.removeHandles(ee),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=D(e);t&&this._handleCommand(t)}forceAddVertex(){this._commitNext()}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(!this._commandsSuspended)if(this.lifecycleManager.updating)r.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{T(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(T(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&T(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&Y(t.info)&&(await t.enterInputMode(),T(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&T(e):T(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(T(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:V(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions(this.movementCommandContext.surfaceManager))}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&T(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:V(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=V(e.originalEvent),i=this._updateLastScreenPosition(e),n=this.interactiveHandleManager?.findHandleByManipulator(i,t);"touch"===t&&n&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const a=this.interactiveHandleManager?.findHandleDragging(),s=this.interactiveHandleManager?.capturingHandle,r=a??s??n;r&&!n&&T(e),"capture-when-engaged"===r?.captureMode||"capture-always"===r?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(r.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===V(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&"primary"===r.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(r.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{r&&"touch"===V(e.originalEvent)&&"grabbable-object"!==r.captureMode&&"capture-when-engaged"!==r.defaultCaptureMode&&!r.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(r?.moveTo(i,{...this.movementCommandContext,pointerType:V(e.originalEvent)})):"grabbable-object"===r?.captureMode&&(this.interactiveHandleManager?.releaseHandle(s),await this._updatingHandles.addPromise(r.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=V(e.originalEvent),n=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t,i);this.editable&&n&&(this._before(e)||(T(e),await this._updatingHandles.addPromise(n.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:i}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new Q,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(W.preserveAspectRatio,"constraint-aspect"),t($.center,"constraint-center"),i(J.toggleFollowManipulator,"toggle-manipulator-follow"),i($.undo,"undo"),i($.redo,"redo"),i($.complete,"complete"),i($.vertexAdd,"vertex-add"),i({key:X.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const a=this.editGeometryOperations;e(i,a?s(a.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=y(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=o(this._pluginContexts,e,()=>new E({drawTool:this,plugin:e,session:t}));return i.session=t,i}_finalizeAndSimplifyGeometryResult(){const e=this.unprocessedGeometry;try{const t=e?C(e):e;t&&!x(t)?this.finalGeometry=t:this.finalGeometry=e}catch(t){r.getLogger(this).error("draw-tool:complete","geometry simplification failed",t)}}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}async _setupSegmentLabels(){const e=this.editGeometryOperations,t=this.sketchOptions?.labels,i=!!t?.enabled,n=this.globalStateManager.segmentLabelsDisabled;if(!e||!t||!i)return void(this._segmentLabels=l(this._segmentLabels));if(n)return void(this._segmentLabels&&(this._segmentLabels.visible=!1));if(this._segmentLabels?.context?.editGeometryOperations===e&&this._segmentLabels.context.labelOptions===t)return void(this._segmentLabels.visible=!0);const a=await this._createSegmentLabels(e,t);a&&(this._segmentLabels=l(this._segmentLabels),this._segmentLabels=a)}async _createSegmentLabels(e,t){return(this._segmentLabelsImportTask??=n(async i=>{if("3d"===this.view.type){const n=import("../3d/interactive/SegmentLabels3D.js"),{SegmentLabels3D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:k(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})}const n=import("../2d/interactive/SegmentLabels2D.js"),{SegmentLabels2D:a}=await this._updatingHandles.addPromise(n);return this._isSegmentLabelsSetupStale(i,e,t)?null:new a({context:{view:this.view,editGeometryOperations:e,elevationInfo:k(this.hasZ,this.elevationInfo),labelOptions:t},visible:!0})})).promise}_isSegmentLabelsSetupStale(e,t,i){return e.aborted||this.editGeometryOperations!==t||this.sketchOptions?.labels!==i||!i.enabled||this.globalStateManager.segmentLabelsDisabled}};i([_()],te.prototype,"_commandsSuspended",void 0),i([_()],te.prototype,"_zOfLastUserInput",null),i([_()],te.prototype,"_snappingVisualizer",void 0),i([_()],te.prototype,"_segmentLabels",void 0),i([_()],te.prototype,"_segmentLabelsImportTask",void 0),i([_()],te.prototype,"_tooltipDependencies",null),i([_()],te.prototype,"_editSessionManagerContext",null),i([_()],te.prototype,"_densificationParameters",null),i([_({constructOnly:!0,nonNullable:!0})],te.prototype,"view",void 0),i([_()],te.prototype,"automaticManipulatorSelection",void 0),i([_()],te.prototype,"updating",null),i([_()],te.prototype,"coordinateHelper",null),i([_()],te.prototype,"editGeometry",null),i([_()],te.prototype,"editGeometryOperations",null),i([_()],te.prototype,"unprocessedGeometry",null),i([_()],te.prototype,"finalGeometry",void 0),i([_()],te.prototype,"simplifiedGeometryPreview",null),i([_()],te.prototype,"_suppressCoincidentPointOverlaysIn3D",null),i([_()],te.prototype,"_shapeVisualGeometry",null),i([_()],te.prototype,"_vertexVisualGeometry",null),i([_()],te.prototype,"snappingManager",void 0),i([_()],te.prototype,"sketchOptions",void 0),i([_()],te.prototype,"elevationInfo",void 0),i([_()],te.prototype,"hasZ",void 0),i([_()],te.prototype,"defaultZ",void 0),i([_()],te.prototype,"directionOptions",void 0),i([_()],te.prototype,"canUndo",null),i([_()],te.prototype,"canRedo",null),i([_()],te.prototype,"pluginStack",null),i([_()],te.prototype,"mostDownstreamPlugin",null),i([_()],te.prototype,"mostUpstreamPlugin",null),i([_()],te.prototype,"lastScreenPosition",void 0),i([_()],te.prototype,"positionOfLastUserInput",null),i([_()],te.prototype,"tooltipManager",void 0),i([_()],te.prototype,"measurementManager",void 0),i([_()],te.prototype,"globalStateManager",void 0),i([_()],te.prototype,"editSessionManager",void 0),i([_()],te.prototype,"lifecycleManager",void 0),i([_()],te.prototype,"surfaceManager",void 0),i([_()],te.prototype,"interactiveHandleManager",void 0),i([_()],te.prototype,"renderer",void 0),i([_()],te.prototype,"movementCommandContext",null),i([_()],te.prototype,"tooltip",null),i([_()],te.prototype,"activeTooltipInfo",null),i([_()],te.prototype,"helpMessageKey",null),i([_({constructOnly:!0})],te.prototype,"enableVertexVisuals",void 0),te=i([M("esri.views.draw.DrawTool")],te);export{te as DrawTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../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{InteractiveHandle as d}from"../InteractiveHandle.js";import{ManipulatorCollection as u}from"../../../interactive/ManipulatorCollection.js";const h=Symbol("manipulator-handle-watch");let c=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 u,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){return this._handleManipulatorMap.toArray().findLast(({handle:t,manipulator:a})=>"grabbable-object"===t.captureMode&&null!=a.intersectionDistance(e))?.handle}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=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 d=(e.inputMapPosition&&this.view?.toScreen(e.inputMapPosition))??e.screenPosition??t??o(n?.width/2,n.height/2);await(e?.moveTo(d,{...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(h)}registerHandle(e,t){const r=n(this._pluginHandleRegistry,e,()=>new a),i=new d(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(){const{view:e}=this;this._handleManipulatorMap.forEach(({handle:t})=>{const a=t.outputMapPosition;a&&(t.screenPosition=e?.toScreen(a))})}reapplyPositions(e){this._handleManipulatorMap.forEach(({handle:t})=>t.refreshConstraint(e))}};e([l({constructOnly:!0})],c.prototype,"renderer",void 0),e([l({readOnly:!0})],c.prototype,"manipulators",void 0),e([l({constructOnly:!0})],c.prototype,"view",void 0),e([l()],c.prototype,"capturingHandle",void 0),e([l()],c.prototype,"customConstraints",null),e([l()],c.prototype,"focusedHandle",null),e([l()],c.prototype,"handleCount",null),e([l()],c.prototype,"allhandles",null),c=e([s("esri.views.draw.support.managers.InteractiveHandleManager")],c);export{c as InteractiveHandleManager};
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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../Basemap.js";import n from"../../Ground.js";import a from"../../WebScene.js";import{isLongFormType as s,Null as l,Integer as y}from"../../core/accessorSupport/ensureType.js";import{isCollection as i}from"../../core/accessorSupport/extensions/serializableProperty/type.js";import o from"../../layers/GroupLayer.js";import p from"../../layers/KMLLayer.js";import{typeModuleMap as u}from"../../layers/mixins/operationalLayerModuleMap.js";import{supportedTypes as c}from"../../layers/mixins/operationalLayers.js";import f from"../../layers/support/Sublayer.js";import m from"../../rest/layerSources/DynamicDataLayer.js";import d from"../../rest/layerSources/DynamicMapLayer.js";import b from"../../rest/layerSources/JoinTableDataSource.js";import w from"../InitialViewProperties.js";import{ScanContext as j,sorted as N}from"./utils.js";import{webSceneAnalysisRegistry as g}from"../support/analysisUtils.js";import v from"../support/SlideElements.js";async function T(r){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new j,!1);return await P(null,{typeName:"json",type:r},void 0,t)}catch(a){n.error=a,n.hasError=!0}finally{t(n)}}async function q(e,t,r,n){switch(t.typeName){case"array":await S(e,t,r,n);break;case"union":await M(e,t,r,n);break;case"json":await P(e,t,r,n);break;case"native":await k(e,t,r,n);break;case"enum":await h(e,t,r,n)}}async function k(e,t,r,n){const a=r??t;n.addProperty({name:e,type:O(n,t),default:a.default,required:a.isRequired,nullable:a.nullable})}async function h(e,t,r,n){const a=r??t;n.currentClass?.typeValue&&"type"===e?n.addProperty({name:e,type:"string",enum:`"${n.currentClass.typeValue}"`,default:a.default,required:a.isRequired,nullable:a.nullable}):n.addProperty({name:e,type:O(n,t),enum:N(t.values).map(e=>"string"==typeof e?`"${e}"`:`${e}`).join("|"),default:a.default,required:a.isRequired,nullable:a.nullable})}async function S(e,t,r,n){t.elementType.isRequired=t.isRequired,await q(`${e}[]`,t.elementType,r??t.elementType,n)}function R(e,t){if("json"===e.typeName){const t=e.type.__accessorMetadata__,r=t?.type,n=r&&U(r),a=n?.type,s=a||r?.type;if(s&&Array.isArray(s)&&1===s.length&&"string"==typeof s[0])return a?s[0]:V(r,s[0])}return t}async function M(e,t,r,n){const a=[],s=r??t;for(const l of t.types)if("native"!==l.type.typeName&&t.key){const a=`${e}<${R(l.type,l.value)}>`;await q(a,l.type,r??t,n)}else a.push(l.type);if(a.length){const t=N(a.map(e=>O(n,e)));n.addProperty({type:t.join("|"),name:e,default:s.default,required:s.isRequired,nullable:s.nullable})}}async function C(e,t){return e.type===a&&"layers"===t?_("web-scene/operational-layers","operational-layers"):e.type===a&&"tables"===t?_("web-scene/tables","tables"):e.type!==r||"baseLayers"!==t&&"baseMapLayers"!==t?e.type===r&&"groundLayers"===t?_("web-scene/basemap-ground-layers","basemap-ground-layers"):e.type===r&&"elevationLayers"===t||e.type===n&&"layers"===t?_("web-scene/ground","ground"):e.type===o&&"layers"===t?_("web-scene/operational-layers","operational-layers",e=>e!==o):e.type!==v&&e.type!==w||"analyses"!==t?e.type!==b||"leftTableSource"!==t&&"rightTableSource"!==t?null:I({},{key:"type",base:null,typeMap:{"data-layer":m,"map-layer":d}}):{typeName:"array",elementType:{typeName:"union",key:"type",types:await Promise.all(Object.entries(g).map(async([e,t])=>({type:{typeName:"json",type:await t()},value:e})))}}:_("web-scene/basemap-base-layers","basemap-base-layers")}async function L(e,t,r){const n=E(r),a=await C(e,t);return a?(a.isRequired=n.isRequired,a.nullable=n.nullable,a.default=n.default,a):n}async function P(e,t,r,n){const a=t.type.__accessorMetadata__,s=n.getDeclaredClass(t.type);if(!a)return e&&n.addProperty({name:e,type:"unknown"}),null;let l=s,y=null;t.layerContainerType&&(l+=`--${t.layerContainerType}`);const i=e?.match(/<([^>]+)>$/);i&&(l+=`--${i[1]}`,y=i[1]);const o=r??t;t.type===f&&(l+=`--${n.currentClass?.name}`,y=n.currentClass?.name);const p=n.seen.get(l);if(p&&e)return n.addProperty({name:e,type:p,required:o.isRequired,default:o.default,nullable:o.nullable}),p;const u={type:t.type,name:s,id:l,properties:[]};e&&(n.addProperty({name:e,type:u,required:o.isRequired,default:o.default,nullable:o.nullable}),u.typeValue=y),n.push(e,u);for(const c in a){const e=a[c],r=F(e);if(!r?.enabled)continue;if(r.layerContainerTypes&&t.layerContainerType&&!r.layerContainerTypes.includes(t.layerContainerType))continue;if(t.type===f){const e="esri/layers/TileLayer"===n.stack[n.stack.length-2].klass.name;if(e&&f.test.isMapImageLayerOverridePolicy(r.overridePolicy)||!e&&f.test.isTileImageLayerOverridePolicy(r.overridePolicy))continue}const s=r.target;if("string"==typeof s||null==s){const r=await L(t,c,e);if(!r)continue;await q("string"==typeof s?s:c,r,void 0,n)}else await $(t,s,n)}return n.pop()}async function $(e,t,r){for(const n in t){let a=await C(e,n);if(!a){const e=t[n];a=e.types?I({default:e.default,write:e},e.types):G(e.type),a.default=e.default,a.isRequired=e.isRequired,a.nullable=e.allowNull,a=x(a)}await q(n,a,void 0,r)}}async function _(e,t,r){const n={typeName:"union",key:"layerType",types:[]};for(const a in c[e]){if("web-scene/operational-layers"===e&&"ArcGISTiledElevationServiceLayer"===a)continue;const s=await u[a]();s&&(r&&!r(s)||s!==p&&n.types.push({type:{typeName:"json",layerContainerType:t,type:s},value:a}))}if(0===n.types.length)return null;return{typeName:"array",elementType:1===n.types.length?n.types[0].type:n}}function O(e,t){switch(t.typeName){case"array":return`${O(e,t.elementType)}[]`;case"union":return`${N(t.types.map(t=>O(e,t.type))).join(" | ")}`;case"native":switch(t.type){case Number:return"number";case y:return"integer";case String:return"string";case Boolean:return"boolean";case Object:return"object";default:return"unknown"}case"json":return e.getDeclaredClass(t.type);case"enum":return"string"}}function A(e){const t=e.prototype.itemType?.Type;if(!t)return{typeName:"array",elementType:{typeName:"native",type:null}};if("function"==typeof t)return{typeName:"array",elementType:G(t)};if(t.typeMap){const e=[];for(const r in t.typeMap){const n=t.typeMap[r];e.push({type:G(n),value:K(n)?null:r})}return{typeName:"array",elementType:{typeName:"union",key:"string"==typeof t.key?t.key:"type",types:e}}}}function D(e){if("json"!==e.typeName)return null;const t=e.type.__accessorMetadata__,r=t?.type,n=r&&U(r),a=n?.type,s=a||r?.type;return s&&Array.isArray(s)&&"string"==typeof s[0]?a||r.type.map(e=>V(r,e)):null}function x(e){if("array"===e.typeName)return e.elementType=x(e.elementType),e;const t=D(e);return t?{typeName:"union",key:"type",nullable:e.nullable,isRequired:e.isRequired,types:t.map(t=>({value:t,type:e}))}:e}function E(e){const t=U(e);return t?.types?I(t,t.types):!t?.type&&e.types?I(t,e.types):x(B(e))}function I(e,t){if(Array.isArray(t))return{typeName:"array",elementType:I(e,t[0])};const r=[];for(const n in t.typeMap){const e=t.typeMap[n];r.push({type:G(e),value:K(e)?null:n})}return{typeName:"union",key:"string"==typeof t.key?t.key:"type",types:r,nullable:e?.write?.allowNull,isRequired:e?.write?.isRequired,default:e?.default}}function J(e){return null!=e&&e.isJSONMapWriter}function V(e,t){const r=F(e);if(r&&J(r.writer)){const e={value:""};return r.writer?.(t,e,"value"),e.value}return t}function B(e){const t=U(e),r=F(e),n=t?.type,a=G(n||e.type);return void 0!==t?.default&&"function"!=typeof t.default&&(a.default=V(e,t.default)),r?.allowNull&&(a.nullable=!0),r?.isRequired&&(a.isRequired=!0),a}function G(e){if(!e)return{typeName:"native",type:null};if(s(e))return W(e);if(Array.isArray(e)){if("string"==typeof e[0]||"number"==typeof e[0])return{typeName:"enum",values:e};if(e.length>1){const t=[];let r;for(const n of e)n!==l?t.push({type:G(n),value:null}):r=!0;return 1===t.length?{...t[0].type,nullable:r}:{typeName:"union",key:null,types:t,nullable:r}}return{typeName:"array",elementType:G(e[0])}}return i(e)?A(e):K(e)?{typeName:"native",type:e}:z(e)?{typeName:"json",type:e}:{typeName:"native",type:null}}function W(e){switch(e.type){case"native":return{typeName:"native",type:e.value};case"array":return{typeName:"array",elementType:G(e.value)};case"one-of":return{typeName:"union",key:null,types:e.values.map(e=>({type:W(e),value:null}))}}}function z(e){let t=e;for(;t;){if(t.prototype&&("esri.core.JSONSupport"===t.prototype.declaredClass||"esri.core.MultiOriginJSONSupport"===t.prototype.declaredClass))return!0;t=Object.getPrototypeOf(t)}return!1}function K(e){return e===String||e===Boolean||e===Number||e===y||e===Object||e===l}function U(e){if(!e.json)return null;const t=e.json.origins,r=e.json,n=t?.["web-scene"],a=t?.["web-document"];return n||a||r||null}function F(e){if(!e.json)return null;const t=e.json.origins,r=e.json.write,n=t?.["web-scene"]?.write,a=t?.["web-document"]?.write;return n||a||r||null}export{T as scan};
2
+ import{__addDisposableResource as e,__disposeResources as a}from"tslib";import t from"../../Basemap.js";import r from"../../Ground.js";import n from"../../WebScene.js";import{isLongFormType as y,Null as s,Integer as i}from"../../core/accessorSupport/ensureType.js";import{isCollection as l}from"../../core/accessorSupport/extensions/serializableProperty/type.js";import o from"../../layers/GroupLayer.js";import u from"../../layers/KMLLayer.js";import{layerTypeMapForReadContext as p}from"../../layers/support/layersMapping.js";import c from"../../layers/support/Sublayer.js";import m from"../../rest/layerSources/DynamicDataLayer.js";import f from"../../rest/layerSources/DynamicMapLayer.js";import d from"../../rest/layerSources/JoinTableDataSource.js";import L from"../InitialViewProperties.js";import{ScanContext as w,sorted as j}from"./utils.js";import{webSceneAnalysisRegistry as b}from"../support/analysisUtils.js";import S from"../support/SlideElements.js";async function g(t){const r={stack:[],error:void 0,hasError:!1};try{const a=e(r,new w,!1);return await q(null,{typeName:"json",type:t},void 0,a)}catch(n){r.error=n,r.hasError=!0}finally{a(r)}}async function v(e,a,t,r){switch(a.typeName){case"array":await M(e,a,t,r);break;case"union":await G(e,a,t,r);break;case"json":await q(e,a,t,r);break;case"native":await T(e,a,t,r);break;case"enum":await N(e,a,t,r)}}async function T(e,a,t,r){const n=t??a;r.addProperty({name:e,type:A(r,a),default:n.default,required:n.isRequired,nullable:n.nullable})}async function N(e,a,t,r){const n=t??a;r.currentClass?.typeValue&&"type"===e?r.addProperty({name:e,type:"string",enum:`"${r.currentClass.typeValue}"`,default:n.default,required:n.isRequired,nullable:n.nullable}):r.addProperty({name:e,type:A(r,a),enum:j(a.values).map(e=>"string"==typeof e?`"${e}"`:`${e}`).join("|"),default:n.default,required:n.isRequired,nullable:n.nullable})}async function M(e,a,t,r){a.elementType.isRequired=a.isRequired,await v(`${e}[]`,a.elementType,t??a.elementType,r)}function h(e,a){if("json"===e.typeName){const a=e.type.__accessorMetadata__,t=a?.type,r=t&&x(t),n=r?.type,y=n||t?.type;if(y&&Array.isArray(y)&&1===y.length&&"string"==typeof y[0])return n?y[0]:B(t,y[0])}return a}async function G(e,a,t,r){const n=[],y=t??a;for(const s of a.types)if("native"!==s.type.typeName&&a.key){const n=`${e}<${h(s.type,s.value)}>`;await v(n,s.type,t??a,r)}else n.push(s.type);if(n.length){const a=j(n.map(e=>A(r,e)));r.addProperty({type:a.join("|"),name:e,default:y.default,required:y.isRequired,nullable:y.nullable})}}async function I(e,a){return e.type===n&&"layers"===a?P("web-scene","operational-layers"):e.type===n&&"tables"===a?P("web-scene","tables"):e.type!==t||"baseLayers"!==a&&"baseMapLayers"!==a?e.type===t&&"groundLayers"===a?P("web-scene","basemap-ground-layers"):e.type===t&&"elevationLayers"===a||e.type===r&&"layers"===a?P("web-scene","ground"):e.type===o&&"layers"===a?P("web-scene","operational-layers",e=>e!==o):e.type!==S&&e.type!==L||"analyses"!==a?e.type!==d||"leftTableSource"!==a&&"rightTableSource"!==a?null:$({},{key:"type",base:null,typeMap:{"data-layer":m,"map-layer":f}}):{typeName:"array",elementType:{typeName:"union",key:"type",types:await Promise.all(Object.entries(b).map(async([e,a])=>({type:{typeName:"json",type:await a()},value:e})))}}:P("web-scene","basemap-base-layers")}async function C(e,a,t){const r=D(t),n=await I(e,a);return n?(n.isRequired=r.isRequired,n.nullable=r.nullable,n.default=r.default,n):r}async function q(e,a,t,r){const n=a.type.__accessorMetadata__,y=r.getDeclaredClass(a.type);if(!n)return e&&r.addProperty({name:e,type:"unknown"}),null;let s=y,i=null;a.layerContainerType&&(s+=`--${a.layerContainerType}`);const l=e?.match(/<([^>]+)>$/);l&&(s+=`--${l[1]}`,i=l[1]);const o=t??a;a.type===c&&(s+=`--${r.currentClass?.name}`,i=r.currentClass?.name);const u=r.seen.get(s);if(u&&e)return r.addProperty({name:e,type:u,required:o.isRequired,default:o.default,nullable:o.nullable}),u;const p={type:a.type,name:y,id:s,properties:[]};e&&(r.addProperty({name:e,type:p,required:o.isRequired,default:o.default,nullable:o.nullable}),p.typeValue=i),r.push(e,p);for(const m in n){const e=n[m],t=z(e);if(!t?.enabled)continue;if(t.layerContainerTypes&&a.layerContainerType&&!t.layerContainerTypes.includes(a.layerContainerType))continue;if(a.type===c){const e="esri/layers/TileLayer"===r.stack[r.stack.length-2].klass.name;if(e&&c.test.isMapImageLayerOverridePolicy(t.overridePolicy)||!e&&c.test.isTileImageLayerOverridePolicy(t.overridePolicy))continue}const y=t.target;if("string"==typeof y||null==y){const t=await C(a,m,e);if(!t)continue;await v("string"==typeof y?y:m,t,void 0,r)}else await k(a,y,r)}return r.pop()}async function k(e,a,t){for(const r in a){let n=await I(e,r);if(!n){const e=a[r];n=e.types?$({default:e.default,write:e},e.types):E(e.type),n.default=e.default,n.isRequired=e.isRequired,n.nullable=e.allowNull,n=V(n)}await v(r,n,void 0,t)}}async function P(e,a,t){const r={typeName:"union",key:"layerType",types:[]},n=p({origin:e,layerContainerType:a});for(const y of Object.keys(n||{})){if("operational-layers"===a&&"ArcGISTiledElevationServiceLayer"===y)continue;const e=await H[y]();e&&(t&&!t(e)||e!==u&&r.types.push({type:{typeName:"json",layerContainerType:a,type:e},value:y}))}if(0===r.types.length)return null;return{typeName:"array",elementType:1===r.types.length?r.types[0].type:r}}function A(e,a){switch(a.typeName){case"array":return`${A(e,a.elementType)}[]`;case"union":return`${j(a.types.map(a=>A(e,a.type))).join(" | ")}`;case"native":switch(a.type){case Number:return"number";case i:return"integer";case String:return"string";case Boolean:return"boolean";case Object:return"object";default:return"unknown"}case"json":return e.getDeclaredClass(a.type);case"enum":return"string"}}function O(e){const a=e.prototype.itemType?.Type;if(!a)return{typeName:"array",elementType:{typeName:"native",type:null}};if("function"==typeof a)return{typeName:"array",elementType:E(a)};if(a.typeMap){const e=[];for(const t in a.typeMap){const r=a.typeMap[t];e.push({type:E(r),value:K(r)?null:t})}return{typeName:"array",elementType:{typeName:"union",key:"string"==typeof a.key?a.key:"type",types:e}}}}function R(e){if("json"!==e.typeName)return null;const a=e.type.__accessorMetadata__,t=a?.type,r=t&&x(t),n=r?.type,y=n||t?.type;return y&&Array.isArray(y)&&"string"==typeof y[0]?n||t.type.map(e=>B(t,e)):null}function V(e){if("array"===e.typeName)return e.elementType=V(e.elementType),e;const a=R(e);return a?{typeName:"union",key:"type",nullable:e.nullable,isRequired:e.isRequired,types:a.map(a=>({value:a,type:e}))}:e}function D(e){const a=x(e);return a?.types?$(a,a.types):!a?.type&&e.types?$(a,e.types):V(W(e))}function $(e,a){if(Array.isArray(a))return{typeName:"array",elementType:$(e,a[0])};const t=[];for(const r in a.typeMap){const e=a.typeMap[r];t.push({type:E(e),value:K(e)?null:r})}return{typeName:"union",key:"string"==typeof a.key?a.key:"type",types:t,nullable:e?.write?.allowNull,isRequired:e?.write?.isRequired,default:e?.default}}function _(e){return null!=e&&e.isJSONMapWriter}function B(e,a){const t=z(e);if(t&&_(t.writer)){const e={value:""};return t.writer?.(a,e,"value"),e.value}return a}function W(e){const a=x(e),t=z(e),r=a?.type,n=E(r||e.type);return void 0!==a?.default&&"function"!=typeof a.default&&(n.default=B(e,a.default)),t?.allowNull&&(n.nullable=!0),t?.isRequired&&(n.isRequired=!0),n}function E(e){if(!e)return{typeName:"native",type:null};if(y(e))return F(e);if(Array.isArray(e)){if("string"==typeof e[0]||"number"==typeof e[0])return{typeName:"enum",values:e};if(e.length>1){const a=[];let t;for(const r of e)r!==s?a.push({type:E(r),value:null}):t=!0;return 1===a.length?{...a[0].type,nullable:t}:{typeName:"union",key:null,types:a,nullable:t}}return{typeName:"array",elementType:E(e[0])}}return l(e)?O(e):K(e)?{typeName:"native",type:e}:J(e)?{typeName:"json",type:e}:{typeName:"native",type:null}}function F(e){switch(e.type){case"native":return{typeName:"native",type:e.value};case"array":return{typeName:"array",elementType:E(e.value)};case"one-of":return{typeName:"union",key:null,types:e.values.map(e=>({type:F(e),value:null}))}}}function J(e){let a=e;for(;a;){if(a.prototype&&("esri.core.JSONSupport"===a.prototype.declaredClass||"esri.core.MultiOriginJSONSupport"===a.prototype.declaredClass))return!0;a=Object.getPrototypeOf(a)}return!1}function K(e){return e===String||e===Boolean||e===Number||e===i||e===Object||e===s}function x(e){if(!e.json)return null;const a=e.json.origins,t=e.json,r=a?.["web-scene"],n=a?.["web-document"];return r||n||t||null}function z(e){if(!e.json)return null;const a=e.json.origins,t=e.json.write,r=a?.["web-scene"]?.write,n=a?.["web-document"]?.write;return r||n||t||null}const H={ArcGISAnnotationLayer:()=>Promise.resolve(null),ArcGISDimensionLayer:async()=>(await import("../../layers/DimensionLayer.js")).default,ArcGISFeatureLayer:async()=>(await import("../../layers/FeatureLayer.js")).default,ArcGISImageServiceLayer:async()=>(await import("../../layers/ImageryLayer.js")).default,ArcGISImageServiceVectorLayer:()=>Promise.resolve(null),ArcGISMapServiceLayer:async()=>(await import("../../layers/MapImageLayer.js")).default,ArcGISSceneServiceLayer:async()=>(await import("../../layers/SceneLayer.js")).default,ArcGISStreamLayer:async()=>(await import("../../layers/StreamLayer.js")).default,ArcGISTiledElevationServiceLayer:async()=>(await import("../../layers/ElevationLayer.js")).default,ArcGISTiledImageServiceLayer:async()=>(await import("../../layers/ImageryTileLayer.js")).default,ArcGISTiledMapServiceLayer:async()=>(await import("../../layers/TileLayer.js")).default,ArcGISVideoLayer:async()=>(await import("../../layers/VideoLayer.js")).default,BingMapsAerial:async()=>(await import("../../layers/BingMapsLayer.js")).default,BingMapsRoad:async()=>(await import("../../layers/BingMapsLayer.js")).default,BingMapsHybrid:async()=>(await import("../../layers/BingMapsLayer.js")).default,BuildingSceneLayer:async()=>(await import("../../layers/BuildingSceneLayer.js")).default,CatalogLayer:async()=>(await import("../../layers/CatalogLayer.js")).default,CSV:async()=>(await import("../../layers/CSVLayer.js")).default,GaussianSplatLayer:async()=>(await import("../../layers/GaussianSplatLayer.js")).default,GeoRSS:async()=>(await import("../../layers/GeoRSSLayer.js")).default,GeoJSON:async()=>(await import("../../layers/GeoJSONLayer.js")).default,GroupLayer:async()=>(await import("../../layers/GroupLayer.js")).default,IntegratedMeshLayer:async()=>(await import("../../layers/IntegratedMeshLayer.js")).default,KML:async()=>(await import("../../layers/KMLLayer.js")).default,KnowledgeGraphLayer:async()=>(await import("../../layers/KnowledgeGraphLayer.js")).default,MediaLayer:async()=>(await import("../../layers/MediaLayer.js")).default,LineOfSightLayer:async()=>(await import("../../layers/LineOfSightLayer.js")).default,LinkChartLayer:()=>Promise.resolve(null),OGCFeatureLayer:async()=>(await import("../../layers/OGCFeatureLayer.js")).default,OpenStreetMap:async()=>(await import("../../layers/OpenStreetMapLayer.js")).default,OrientedImageryLayer:async()=>(await import("../../layers/OrientedImageryLayer.js")).default,ParquetLayer:async()=>(await import("../../layers/ParquetLayer.js")).default,PointCloudLayer:async()=>(await import("../../layers/PointCloudLayer.js")).default,VectorTileLayer:async()=>(await import("../../layers/VectorTileLayer.js")).default,ViewshedLayer:async()=>(await import("../../layers/ViewshedLayer.js")).default,Voxel:async()=>(await import("../../layers/VoxelLayer.js")).default,WCS:async()=>(await import("../../layers/WCSLayer.js")).default,WebTiledLayer:async()=>(await import("../../layers/WebTileLayer.js")).default,WFS:async()=>(await import("../../layers/WFSLayer.js")).default,SubtypeGroupLayer:async()=>(await import("../../layers/SubtypeGroupLayer.js")).default,SubtypeGroupTable:async()=>(await import("../../layers/SubtypeGroupLayer.js")).default,WMS:async()=>(await import("../../layers/WMSLayer.js")).default,RasterDataLayer:()=>Promise.resolve(null),RasterDataElevationLayer:()=>Promise.resolve(null),IntegratedMesh3DTilesLayer:async()=>(await import("../../layers/IntegratedMesh3DTilesLayer.js")).default,Object3DTilesLayer:()=>Promise.resolve(null)};export{g as scan};
@@ -15,6 +15,7 @@ export type CompassViewModelState = "disabled" | "compass" | "rotation";
15
15
  * or [camera heading](https://developers.arcgis.com/javascript/latest/references/core/Camera/#heading). This is added to a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/)
16
16
  * by default.
17
17
  *
18
+ * @deprecated since version 5.1. Use the [Compass component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-compass/) instead. For information on widget deprecation, read about [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
18
19
  * @since 4.0
19
20
  * @see [Compass](https://developers.arcgis.com/javascript/latest/references/core/widgets/Compass/) widget - _Deprecated since 4.32. Use the [Compass component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-compass/) instead._
20
21
  * @see [Compass component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-compass/)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import o from"../../core/Accessor.js";import{initial as i,watch as e}from"../../core/reactiveUtils.js";import{property as a,subclass as r}from"../../core/accessorSupport/decorators.js";import{getGoToDuration as s}from"../../views/2d/navigation/duration.js";import{canShowNorth as n}from"./utils.js";import{GoTo as d}from"../support/GoTo.js";let h=class extends(d(o)){constructor(t){super(t),this.orientation={x:0,y:0,z:0},this.view=null,this._updateForCamera=this._updateForCamera.bind(this),this._updateForRotation=this._updateForRotation.bind(this),this._updateRotationWatcher=this._updateRotationWatcher.bind(this)}initialize(){this._watchForView(i)}destroy(){this.view=null}get canShowNorth(){return n(this.view)}get state(){return!this.view?.ready||"2d"===this.view.type&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){this.view?.ready&&("2d"===this.view?.type?this.callGoTo({target:{rotation:0},options:{animationMode:"always",duration:s()}}):this.callGoTo({target:{heading:0}}))}_updateForRotation(t){null!=t&&this._set("orientation",{z:t})}_updateForCamera(t){if(!t)return;const o=-t.heading;this._set("orientation",{x:0,y:0,z:o})}_updateRotationWatcher(t){this.removeAllHandles(),this._watchForView(),t&&this.addHandles("2d"===t.type?e(()=>t?.rotation,this._updateForRotation,i):e(()=>t?.camera,this._updateForCamera,i))}_watchForView(t){this.addHandles(e(()=>this.view,this._updateRotationWatcher,t))}};t([a({readOnly:!0})],h.prototype,"canShowNorth",null),t([a({readOnly:!0})],h.prototype,"orientation",void 0),t([a({readOnly:!0})],h.prototype,"state",null),t([a()],h.prototype,"view",void 0),h=t([r("esri.widgets.Compass.CompassViewModel")],h);const p=h;export{p as default};
2
+ import{__decorate as t}from"tslib";import o from"../../core/Accessor.js";import{deprecateUnnecessaryViewModel as e}from"../../core/deprecate.js";import i from"../../core/Logger.js";import{initial as r,watch as a}from"../../core/reactiveUtils.js";import{property as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{getGoToDuration as p}from"../../views/2d/navigation/duration.js";import{canShowNorth as d}from"./utils.js";import{GoTo as h}from"../support/GoTo.js";let c=class extends(h(o)){constructor(t){super(t),this.orientation={x:0,y:0,z:0},this.view=null,this._updateForCamera=this._updateForCamera.bind(this),this._updateForRotation=this._updateForRotation.bind(this),this._updateRotationWatcher=this._updateRotationWatcher.bind(this),t?.suppressDeprecationWarning||e(i.getLogger(this),"Compass","arcgis-compass",{version:"5.1"})}normalizeCtorArgs(t){const{suppressDeprecationWarning:o,...e}=t??{};return e}initialize(){this._watchForView(r)}destroy(){this.view=null}get canShowNorth(){return d(this.view)}get state(){return!this.view?.ready||"2d"===this.view.type&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){this.view?.ready&&("2d"===this.view?.type?this.callGoTo({target:{rotation:0},options:{animationMode:"always",duration:p()}}):this.callGoTo({target:{heading:0}}))}_updateForRotation(t){null!=t&&this._set("orientation",{z:t})}_updateForCamera(t){if(!t)return;const o=-t.heading;this._set("orientation",{x:0,y:0,z:o})}_updateRotationWatcher(t){this.removeAllHandles(),this._watchForView(),t&&this.addHandles("2d"===t.type?a(()=>t?.rotation,this._updateForRotation,r):a(()=>t?.camera,this._updateForCamera,r))}_watchForView(t){this.addHandles(a(()=>this.view,this._updateRotationWatcher,t))}};t([s({readOnly:!0})],c.prototype,"canShowNorth",null),t([s({readOnly:!0})],c.prototype,"orientation",void 0),t([s({readOnly:!0})],c.prototype,"state",null),t([s()],c.prototype,"view",void 0),c=t([n("esri.widgets.Compass.CompassViewModel")],c);const l=c;export{l as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Widget.js";import i from"./Compass/CompassViewModel.js";import{css as r}from"./Compass/css.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import{globalCss as l}from"./support/globalCss.js";import{messageBundle as a,tsx as d}from"./support/widget.js";let p=class extends s{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new i,this._reset=()=>{this.viewModel.reset()},this._toRotationTransform=e=>({transform:`rotateZ(${e.z}deg)`})}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"rotation"===this.viewModel.state?"arrow-up":"compass-needle"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}reset(){return this.viewModel.reset()}render(){const{orientation:e,state:t}=this.viewModel,{messages:o}=this;return d("div",{class:this.classes(r.base,l.widget)},d("calcite-button",{class:l.widgetButton,disabled:"disabled"===t,kind:"neutral",label:o.reset,onclick:this._reset,round:!0,scale:"s",title:o.reset},d("div",{"aria-hidden":"true",class:r.iconContainer,title:o.reset},d("calcite-icon",{icon:this.icon,styles:this._toRotationTransform(e)}))))}};e([t()],p.prototype,"goToOverride",null),e([t()],p.prototype,"icon",null),e([t()],p.prototype,"label",null),e([t(),a("esri/widgets/Compass/t9n/Compass")],p.prototype,"messages",void 0),e([t()],p.prototype,"view",null),e([t({type:i})],p.prototype,"viewModel",void 0),p=e([o("esri.widgets.Compass")],p);const c=p;export{c as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../core/accessorSupport/decorators.js";import o from"./Widget.js";import i from"./Compass/CompassViewModel.js";import{css as r}from"./Compass/css.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import{globalCss as l}from"./support/globalCss.js";import{messageBundle as a,tsx as p}from"./support/widget.js";let c=class extends o{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new i({suppressDeprecationWarning:!0}),this._reset=()=>{this.viewModel.reset()},this._toRotationTransform=e=>({transform:`rotateZ(${e.z}deg)`})}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"rotation"===this.viewModel.state?"arrow-up":"compass-needle"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}reset(){return this.viewModel.reset()}render(){const{orientation:e,state:t}=this.viewModel,{messages:s}=this;return p("div",{class:this.classes(r.base,l.widget)},p("calcite-button",{class:l.widgetButton,disabled:"disabled"===t,kind:"neutral",label:s.reset,onclick:this._reset,round:!0,scale:"s",title:s.reset},p("div",{"aria-hidden":"true",class:r.iconContainer,title:s.reset},p("calcite-icon",{icon:this.icon,styles:this._toRotationTransform(e)}))))}};e([t()],c.prototype,"goToOverride",null),e([t()],c.prototype,"icon",null),e([t()],c.prototype,"label",null),e([t(),a("esri/widgets/Compass/t9n/Compass")],c.prototype,"messages",void 0),e([t()],c.prototype,"view",null),e([t({type:i})],c.prototype,"viewModel",void 0),c=e([s("esri.widgets.Compass")],c);const d=c;export{d as default};