@arcgis/core 4.34.0-next.60 → 4.34.0-next.62

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 (176) hide show
  1. package/applications/Components/actionUtils.d.ts +3 -0
  2. package/applications/Components/actionUtils.js +5 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/0264905da9fa56166538.js +1 -0
  5. package/assets/esri/core/workers/chunks/{007721d1d99233046420.js → 188feb2bcbf8e48e3163.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{0ff8b28a34b1825c227d.js → 220c8d6338f236298720.js} +1 -1
  7. package/assets/esri/core/workers/chunks/226833d408eb1225e168.js +1 -0
  8. package/assets/esri/core/workers/chunks/33718ea851645d9078d1.js +1 -0
  9. package/assets/esri/core/workers/chunks/{54b43876ae6fb078eb38.js → 77e27f318b5863dd0f5c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{2d74af2b383187bd59c3.js → 8005ae652361f506bc5f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{0468266dfe15ec41d60a.js → a35a439f053d1fe0541b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{4e21a1116be0d6340163.js → bdc18ef9cdc8242f014e.js} +1 -1
  13. package/assets/esri/core/workers/chunks/d6f5297f7b323c340727.js +1 -0
  14. package/assets/esri/core/workers/chunks/f4167fc895d4009df1c7.js +1 -0
  15. package/assets/esri/core/workers/chunks/f542bdc994a5ea3aa9d1.js +1 -0
  16. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
  17. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
  18. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
  19. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
  20. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
  21. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
  22. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
  23. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
  24. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
  25. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
  26. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
  27. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
  28. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
  29. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
  30. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
  31. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
  32. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
  33. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
  34. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
  35. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
  36. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
  37. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
  38. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_no.json +1 -1
  39. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
  40. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
  41. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
  42. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
  43. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
  44. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
  45. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
  46. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
  47. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
  48. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
  49. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
  50. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
  51. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
  52. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
  53. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
  54. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
  55. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ar.json +1 -1
  56. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_bg.json +1 -1
  57. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_bs.json +1 -1
  58. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ca.json +1 -1
  59. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_cs.json +1 -1
  60. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_da.json +1 -1
  61. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_de.json +1 -1
  62. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_el.json +1 -1
  63. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_es.json +1 -1
  64. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_et.json +1 -1
  65. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_fi.json +1 -1
  66. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_fr.json +1 -1
  67. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_he.json +1 -1
  68. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_hr.json +1 -1
  69. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_hu.json +1 -1
  70. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_id.json +1 -1
  71. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_it.json +1 -1
  72. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ja.json +1 -1
  73. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ko.json +1 -1
  74. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_lt.json +1 -1
  75. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_lv.json +1 -1
  76. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_nl.json +1 -1
  77. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_no.json +1 -1
  78. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_pl.json +1 -1
  79. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_pt-BR.json +1 -1
  80. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_pt-PT.json +1 -1
  81. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ro.json +1 -1
  82. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_ru.json +1 -1
  83. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sk.json +1 -1
  84. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sl.json +1 -1
  85. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sr.json +1 -1
  86. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_sv.json +1 -1
  87. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_th.json +1 -1
  88. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_tr.json +1 -1
  89. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_uk.json +1 -1
  90. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_vi.json +1 -1
  91. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_zh-CN.json +1 -1
  92. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_zh-HK.json +1 -1
  93. package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_zh-TW.json +1 -1
  94. package/chunks/BloomComposition.glsl.js +6 -5
  95. package/chunks/Fog.glsl.js +20 -13
  96. package/config.js +1 -1
  97. package/core/Collection.js +1 -1
  98. package/core/has.js +1 -1
  99. package/interfaces.d.ts +189 -55
  100. package/kernel.js +1 -1
  101. package/layers/OGCFeatureLayer.js +1 -1
  102. package/layers/SceneLayer.js +1 -1
  103. package/layers/VoxelLayer.js +1 -1
  104. package/layers/VoxelWasmPerSceneView.js +1 -1
  105. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  106. package/layers/graphics/data/QueryEngineResult.js +1 -1
  107. package/layers/video/VideoController.js +1 -1
  108. package/package.json +2 -2
  109. package/support/revision.js +1 -1
  110. package/symbols/IconSymbol3DLayer.js +1 -1
  111. package/symbols/TextSymbol3DLayer.js +1 -1
  112. package/symbols/support/IconSymbol3DLayerResource.js +1 -1
  113. package/symbols/support/OccludedVisibility.js +5 -0
  114. package/symbols/support/Symbol3DAnchorPosition2D.js +1 -1
  115. package/symbols/support/Symbol3DIconOutline.js +1 -1
  116. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  117. package/views/2d/layers/features/FeatureContainer.js +1 -1
  118. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  119. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  120. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  121. package/views/2d/layers/support/UpdateTracking2D.js +1 -1
  122. package/views/2d/navigation/actions/Pan.js +1 -1
  123. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +1 -1
  124. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  125. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  126. package/views/3d/environment/Fog.glsl.js +1 -1
  127. package/views/3d/environment/Fog.js +1 -1
  128. package/views/3d/environment/FogTechniqueConfiguration.js +5 -0
  129. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  130. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  131. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  132. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  133. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  134. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  135. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  136. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  137. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  138. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  139. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  140. package/views/3d/layers/graphics/Labeler.js +1 -1
  141. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  142. package/views/3d/state/ViewState.js +1 -1
  143. package/views/3d/state/controllers/CameraController.js +1 -1
  144. package/views/3d/support/MemoryController.js +1 -1
  145. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  146. package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
  147. package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechnique.js +1 -1
  148. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  149. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  150. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  151. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  152. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  153. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  154. package/views/GroundView.js +1 -1
  155. package/views/SceneView.js +1 -1
  156. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  157. package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +1 -1
  158. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  159. package/views/analysis/ElevationProfile/ElevationProfileTool.js +5 -0
  160. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  161. package/views/input/IViewEvents.js +5 -0
  162. package/views/interactive/Tooltip.js +1 -1
  163. package/views/support/LayerViewManager.js +1 -1
  164. package/webscene/SunLighting.js +1 -1
  165. package/webscene/VirtualLighting.js +1 -1
  166. package/widgets/CoordinateConversion/support/Format.js +1 -1
  167. package/widgets/Popup/actionUtils.js +1 -1
  168. package/widgets/Print/PrintViewModel.js +1 -1
  169. package/widgets/Search/SearchViewModel.js +1 -1
  170. package/widgets/UtilityNetworkTrace.js +1 -1
  171. package/assets/esri/core/workers/chunks/18f878ec695617650a96.js +0 -1
  172. package/assets/esri/core/workers/chunks/232c76f122b1f519e099.js +0 -1
  173. package/assets/esri/core/workers/chunks/5e1afea05b624b315d9f.js +0 -1
  174. package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +0 -1
  175. package/assets/esri/core/workers/chunks/981275b6f008431c983a.js +0 -1
  176. package/assets/esri/core/workers/chunks/e36d538915261ee0373f.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../analysis/LineOfSightAnalysisObserver.js";import a from"../../../../analysis/LineOfSightAnalysisTarget.js";import n from"../../../../core/Handles.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{when as o,syncAndInitial as l,initial as u}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as p,fromPoints as g}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as _,getConvertedElevation as m}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{getLaserLineColors as b,laserLineConfiguration as y}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as f,LineOfSightObserverManipulator as T}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{LaserlineVisualElement as M}from"../../interactive/visualElements/LaserlineVisualElement.js";import{AnalysisToolBase as w}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as C}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as k}from"../../../support/screenUtils.js";let H=class extends w{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new n,this._updatingHandles=new d,this._manipulatorHandles=new n,this._targetTrackerManipulator=null}initialize(){this._intersector=new L({view:this.view}),this.addHandles(o(()=>"created"===this.state,()=>this.finishToolCreation(),l)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>b(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u)])}destroy(){this._updatingHandles=s(this._updatingHandles),this._manipulatorHandles=s(this._manipulatorHandles),this._analysisHandles=s(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return null!=this.analysisViewData&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const i of t)this._disconnectComputation(i);for(const i of e)this._connectComputation(i)}_connectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&i.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>O(e),()=>P(i,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,i),u)],e)}_disconnectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=s(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const t={target:e,type:"target"},i=new f(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(i),i.events.on("grab-changed",e=>this._manipulatorGrabChanged(i,e)),i.events.on("immediate-click",e=>this._manipulatorClick(i,e))],i),this.manipulators.add(i),null!=e.position?i.elevationAlignedLocation=e.position:i.available=!1,i}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(i=>{const a=i.manipulator;null==t&&"target"===a.metadata.type&&a.metadata.target===e&&(t=a)}),t}_createObserverManipulator(){const e=new T(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return null==t?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return C(e,(t,i,a)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),a.next(V(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return C(e,(e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),i.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(null!=e.intersection.mapPoint?(null==this.analysis.observer&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.mapPoint;return null!=i&&(e.elevationAlignedLocation=i),t}}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:i,shouldRenderTracker:a,observerPosition:n,visible:r}=e;if(null==t)return;const s=null!=i?i:a&&null!=n?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=g(this._observerManipulator.renderLocation,s.renderLocation,D):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=y;this._laserlineVisualElement=new M({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,i,a){const n=this._laserlineVisualElement;if(null==n)return;const r=n.style;n.style={...r,glowColor:t.toUnitRGB(e),innerColor:t.toUnitRGB(i),globalAlpha:a}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(null!=t?.mapPoint)if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new a;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&2!==e.button&&(this._addPointFromClickEvent(k(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&2!==e.button&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||null==this.analysis.observer?.position)return;const t=k(e),i=this._intersector.getScreenPointIntersection(t);null!=i?.mapPoint&&(null==this.analysisViewData.cursorTarget&&(this.analysisViewData.cursorTarget=new a),this._updateFromIntersection(this.analysisViewData.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(null==t.mapPoint)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(t.type){case 0:if(null!=t.graphic){const i=t.graphic,a=_(i);"on-the-ground"===a.mode&&(a.mode="relative-to-ground",a.offset=0),e.elevationInfo=new v(a),e.feature=i}else e.elevationInfo=null,e.feature=null;break;case 2:e.elevationInfo=new v({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const i=t.mapPoint.clone();i.z=m(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||2!==t.button||this.analysis.targets.length<=1)return;const{target:i}=e.metadata;this.analysis.targets.remove(i),t.stopPropagation()}get testInfo(){}};function V(e){const t=e.position?.clone();return i=>(e.position=t,i)}function P(e,t){const{isValid:i,isTargetVisible:a}=t.computationResult;e.state=i?a?16:32:64}function O(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}e([c({constructOnly:!0})],H.prototype,"view",void 0),e([c({constructOnly:!0})],H.prototype,"analysis",void 0),e([c()],H.prototype,"_creationMode",void 0),e([c({readOnly:!0})],H.prototype,"state",null),e([c({readOnly:!0})],H.prototype,"cursor",null),e([c()],H.prototype,"removeIncompleteOnCancel",void 0),e([c({readOnly:!0})],H.prototype,"updating",null),e([c({constructOnly:!0})],H.prototype,"analysisViewData",void 0),e([c({readOnly:!0})],H.prototype,"_showTracker",null),e([c()],H.prototype,"_latestPointerMovePointerType",void 0),e([c()],H.prototype,"_shouldRenderTracker",null),e([c()],H.prototype,"_laserlineVisualElement",void 0),e([c()],H.prototype,"_grabbedManipulator",void 0),H=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],H);const D=p();export{H as LineOfSightTool};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../analysis/LineOfSightAnalysisObserver.js";import a from"../../../../analysis/LineOfSightAnalysisTarget.js";import n from"../../../../core/Handles.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{when as o,syncAndInitial as l,initial as u}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as p,fromPoints as g}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as _,getConvertedElevation as m}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{getLaserLineColors as b,laserLineConfiguration as y}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as f,LineOfSightObserverManipulator as T}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{LaserlineVisualElement as M}from"../../interactive/visualElements/LaserlineVisualElement.js";import{MouseButton as w}from"../../../input/IViewEvents.js";import{AnalysisToolBase as C}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as H}from"../../../support/screenUtils.js";let V=class extends C{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new n,this._updatingHandles=new d,this._manipulatorHandles=new n,this._targetTrackerManipulator=null}initialize(){this._intersector=new L({view:this.view}),this.addHandles(o(()=>"created"===this.state,()=>this.finishToolCreation(),l)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>b(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u)])}destroy(){this._updatingHandles=s(this._updatingHandles),this._manipulatorHandles=s(this._manipulatorHandles),this._analysisHandles=s(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return null!=this.analysisViewData&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const i of t)this._disconnectComputation(i);for(const i of e)this._connectComputation(i)}_connectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&i.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>I(e),()=>O(i,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,i),u)],e)}_disconnectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=s(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const t={target:e,type:"target"},i=new f(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(i),i.events.on("grab-changed",e=>this._manipulatorGrabChanged(i,e)),i.events.on("immediate-click",e=>this._manipulatorClick(i,e))],i),this.manipulators.add(i),null!=e.position?i.elevationAlignedLocation=e.position:i.available=!1,i}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(i=>{const a=i.manipulator;null==t&&"target"===a.metadata.type&&a.metadata.target===e&&(t=a)}),t}_createObserverManipulator(){const e=new T(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return null==t?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return k(e,(t,i,a)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),a.next(P(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return k(e,(e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),i.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(null!=e.intersection.mapPoint?(null==this.analysis.observer&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.mapPoint;return null!=i&&(e.elevationAlignedLocation=i),t}}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:i,shouldRenderTracker:a,observerPosition:n,visible:r}=e;if(null==t)return;const s=null!=i?i:a&&null!=n?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=g(this._observerManipulator.renderLocation,s.renderLocation,D):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=y;this._laserlineVisualElement=new M({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,i,a){const n=this._laserlineVisualElement;if(null==n)return;const r=n.style;n.style={...r,glowColor:t.toUnitRGB(e),innerColor:t.toUnitRGB(i),globalAlpha:a}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(null!=t?.mapPoint)if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new a;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==w.Right&&(this._addPointFromClickEvent(H(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==w.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||null==this.analysis.observer?.position)return;const t=H(e),i=this._intersector.getScreenPointIntersection(t);null!=i?.mapPoint&&(null==this.analysisViewData.cursorTarget&&(this.analysisViewData.cursorTarget=new a),this._updateFromIntersection(this.analysisViewData.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(null==t.mapPoint)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(t.type){case 0:if(null!=t.graphic){const i=t.graphic,a=_(i);"on-the-ground"===a.mode&&(a.mode="relative-to-ground",a.offset=0),e.elevationInfo=new v(a),e.feature=i}else e.elevationInfo=null,e.feature=null;break;case 2:e.elevationInfo=new v({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const i=t.mapPoint.clone();i.z=m(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==w.Right||this.analysis.targets.length<=1)return;const{target:i}=e.metadata;this.analysis.targets.remove(i),t.stopPropagation()}get testInfo(){}};function P(e){const t=e.position?.clone();return i=>(e.position=t,i)}function O(e,t){const{isValid:i,isTargetVisible:a}=t.computationResult;e.state=i?a?16:32:64}function I(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}e([h({constructOnly:!0})],V.prototype,"view",void 0),e([h({constructOnly:!0})],V.prototype,"analysis",void 0),e([h()],V.prototype,"_creationMode",void 0),e([h({readOnly:!0})],V.prototype,"state",null),e([h({readOnly:!0})],V.prototype,"cursor",null),e([h()],V.prototype,"removeIncompleteOnCancel",void 0),e([h({readOnly:!0})],V.prototype,"updating",null),e([h({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([h({readOnly:!0})],V.prototype,"_showTracker",null),e([h()],V.prototype,"_latestPointerMovePointerType",void 0),e([h()],V.prototype,"_shouldRenderTracker",null),e([h()],V.prototype,"_laserlineVisualElement",void 0),e([h()],V.prototype,"_grabbedManipulator",void 0),V=e([c("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],V);const D=p();export{V as LineOfSightTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import"../webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import"../webgl-engine/core/shaderModules/Float3BindUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Texture2DBindUniform.js";import"../webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js";import"../webgl-engine/shaders/SphereIntersect.glsl.js";import"../webgl-engine/shaders/ToneMapping.glsl.js";import"../../webgl/NoParameters.js";import"../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../chunks/Fog.glsl.js";
5
+ import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import"../webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js";import"../webgl-engine/core/shaderModules/Float3BindUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Texture2DBindUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js";import"../webgl-engine/shaders/SphereIntersect.glsl.js";import"../webgl-engine/shaders/ToneMapping.glsl.js";import"../../webgl/NoParameters.js";import"../../webgl/ShaderBuilder.js";export{F as FogPassParameters,b as build}from"../../../chunks/Fog.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{lerp as t,smoothstep as r}from"../../../core/mathUtils.js";import{watch as s,syncAndInitial as a}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{c as o,n,e as m,g as h,m as p,l as c}from"../../../chunks/vec32.js";import{fromValues as d,create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as g}from"../webgl.js";import{F as u}from"../../../chunks/Fog.glsl.js";import{FogTechnique as f}from"./FogTechnique.js";import{heightLimit as w}from"./weather.js";import{TransparentEnvironment as P}from"../webgl-engine/effects/TransparentEnvironment.js";import{DepthStencilAttachment as y}from"../../webgl/enums.js";const b=.95,v=1;let j=class extends P{constructor(e){super(e),this.requireGeometryDepth=!0,this._newParameters=new F,this._oldParameters=new F,this._fadedParameters=new F,this._parameters=this._newParameters,this._passParameters=new u;const t=_(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight,e.view.stage?.renderView.techniques.precompile(f)}toogle(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}initialize(){this.addHandles([s(()=>this.view.environment.atmosphereEnabled,()=>this.toogle(),a),s(()=>this.view.environment.weather,()=>this.toogle(),a),s(()=>this._updateFogParameters(),()=>{},a)]),this.addHandles(s(()=>this._fadeFactor,e=>this._fade(e),a))}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:r}=this;e>=1?(this._parameters=t,this._oldParameters.copyFrom(this._newParameters)):e<=0?this._parameters=r:(this._fadedParameters.lerp(r,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,r="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=r?1:0,"foggy"!==e.type&&"snowy"!==e.type||o(this._newParameters.color,x),"rainy"===e.type&&o(this._newParameters.color,E),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===g.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const r=this.techniques.get(f);if(!r.compiled)return this.requestRender(1),t;const s=this.renderingContext,a=t.getAttachment(y);return t.attachDepth(null),s.bindFramebuffer(t.fbo),s.bindTechnique(r,this.bindParameters,this._passParameters),s.screen.draw(),t.attachDepth(a),t}_update(){const e=this.bindParameters.camera;n(R,e.eye);const t=Math.max(0,m(R,this.bindParameters.lighting.mainLight.direction)),s=this._parameters.color;h(q,s,.1),p(this._passParameters.color,q,s,t);const a=c(e.eye);this._passParameters.atmosphereC=a**2-this._atmosphereRadius**2,this._passParameters.amount=(1-r(b*w,v*w,Math.abs(a-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}};j=e([i("esri.views.3d.environment.Fog")],j);class F{constructor(){this.color=l(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,o(this.color,e.color)}lerp(e,r,s){this.amount=t(e.amount,r.amount,s),this.strength=t(e.strength,r.strength,s),p(this.color,e.color,r.color,s)}}const R=l(),q=l(),E=d(.5,.5,.5),x=d(1.5,1.5,1.5);export{j as Fog,F as FogParameters};
5
+ import{__decorate as e}from"tslib";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{watch as r,syncAndInitial as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{c as n,n as m,e as h,g as c,m as p,l}from"../../../chunks/vec32.js";import{fromValues as d,create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{InternalRenderCategory as g}from"../webgl.js";import{F as _}from"../../../chunks/Fog.glsl.js";import{FogTechnique as w}from"./FogTechnique.js";import{FogTechniqueConfiguration as P}from"./FogTechniqueConfiguration.js";import{heightLimit as y}from"./weather.js";import{TransparentEnvironment as b}from"../webgl-engine/effects/TransparentEnvironment.js";import{Blit as v}from"../webgl-engine/effects/blit/Blit.js";import{ColorAttachment1 as j,DepthStencilAttachment as F}from"../../webgl/enums.js";const E=.95,R=1;let T=class extends b{constructor(e){super(e),this.consumes={required:[g.TRANSPARENT_ENVIRONMENT]},this._configuration=new P,this.requireGeometryDepth=!0,this._newParameters=new q,this._oldParameters=new q,this._fadedParameters=new q,this._parameters=this._newParameters,this._passParameters=new _,this._blit=null;const t=f(e.view.spatialReference);this._planetRadius=t.radius,this._atmosphereRadius=t.radius+t.atmosphereHeight;const s=e.view.stage.renderView.techniques;s.precompile(w,this._configuration),this._configuration.modifiedByEmissive=!this._configuration.modifiedByEmissive,s.precompile(w,this._configuration),this._configuration.modifiedByEmissive=!this._configuration.modifiedByEmissive}toogle(){this.view.environment.atmosphereEnabled&&this.view.environment.weather?this._enable():this._disable()}initialize(){this.addHandles([r(()=>this.view.environment.atmosphereEnabled,()=>this.toogle(),i),r(()=>this.view.environment.weather,()=>this.toogle(),i),r(()=>this._updateFogParameters(),()=>{},i)]),this.addHandles(r(()=>this._fadeFactor,e=>this._fade(e),i))}get _fadeFactor(){return this.view.stage?.renderer.renderContext.bind.clouds.fadeFactor??1}_fade(e){const{_newParameters:t,_oldParameters:s}=this;e>=1?(this._parameters=t,this._oldParameters.copyFrom(this._newParameters)):e<=0?this._parameters=s:(this._fadedParameters.lerp(s,t,e),this._parameters=this._fadedParameters)}_updateFogParameters(){const e=this.view.environment.weather,s="foggy"===e.type||"snowy"===e.type||"rainy"===e.type;this._newParameters.strength="foggy"===e.type?t(3e-5,.005,e.fogStrength**3):"snowy"===e.type||"rainy"===e.type?t(4e-6,2e-4,(e.precipitation??0)**3):0,this._newParameters.amount=s?1:0,"foggy"!==e.type&&"snowy"!==e.type||n(this._newParameters.color,B),"rainy"===e.type&&n(this._newParameters.color,A),this._fadeFactor>=1&&this._oldParameters.copyFrom(this._newParameters),this.requestRender(1)}render(e){const t=e.find(({name:e})=>e===g.TRANSPARENT_ENVIRONMENT);if(0===this._parameters.amount)return t;if(this._update(),this._passParameters.amount<=0)return t;const s=t.getAttachment(j);this._configuration.modifiedByEmissive=null!=s;const r=this.techniques.get(w,this._configuration);if(!r.compiled)return this.requestRender(1),t;const i=t.getAttachment(F),a=this.renderingContext,{fullWidth:o,fullHeight:n}=this.bindParameters.camera,m=o,h=n;let c=null;return s&&(c=this.fboCache.acquire(m,h,"bloomHorizontal",8),this._blit??=new v(this.techniques),this._blit.blitTexture(a,s?.attachment,c,this.bindParameters)),t.attachDepth(null),a.bindFramebuffer(t.fbo),s&&(this._passParameters.emission=c?.getTexture()),a.bindTechnique(r,this.bindParameters,this._passParameters),a.screen.draw(),t.attachDepth(i),c?.release(),t}_update(){const e=this.bindParameters.camera;m(N,e.eye);const t=Math.max(0,h(N,this.bindParameters.lighting.mainLight.direction)),r=this._parameters.color;c(x,r,.1),p(this._passParameters.color,x,r,t);const i=l(e.eye);this._passParameters.atmosphereC=i**2-this._atmosphereRadius**2,this._passParameters.amount=(1-s(E*y,R*y,Math.abs(i-this._planetRadius)))*this._parameters.amount,this._passParameters.strength=this._parameters.strength}};e([a()],T.prototype,"consumes",void 0),T=e([o("esri.views.3d.environment.Fog")],T);class q{constructor(){this.color=u(),this.strength=0,this.amount=0}copyFrom(e){this.amount=e.amount,this.strength=e.strength,n(this.color,e.color)}lerp(e,s,r){this.amount=t(e.amount,s.amount,r),this.strength=t(e.strength,s.strength,r),p(this.color,e.color,s.color,r)}}const N=u(),x=u(),A=d(.5,.5,.5),B=d(1.5,1.5,1.5);export{T as Fog,q as FogParameters};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as e}from"tslib";import{parameter as i,ShaderTechniqueConfiguration as o}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";class r extends o{constructor(){super(...arguments),this.modifiedByEmissive=!1}}e([i()],r.prototype,"modifiedByEmissive",void 0);export{r as FogTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as p,removeMaybe as h}from"../../../../../core/maybe.js";import{watch as d,on as u,initial as c,syncAndInitial as m,when as g,sync as f}from"../../../../../core/reactiveUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as b,d as x,m as y,i as O,f as E,g as j}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import V from"../../../../../geometry/Polyline.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as A}from"../../../../../symbols/support/utils.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{createManipulatorMaterial as G,createManipulatorOutlineMaterial as k,placeAtObject as C}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as Z}from"../dragEventPipeline3D.js";import{orientation as N}from"../geometryUtils.js";import{canMoveZOperations as q}from"../manipulatorUtils.js";import{Settings as X}from"../settings.js";import{createVisualElements as Y}from"../visualElementUtils.js";import{discRadiusSmall as B}from"../manipulations/config.js";import{MoveManipulation as W}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as K}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as J,createEdgeOffsetIntersectionPlane as Q,createEdgeOffsetOperation as $,edgeOffsetRotationMatrix as ee,screenEdgeLengthSquared as te,getDistanceInGeometrySR as ie}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as oe,getUpdatedEdgeOffsetTooltipInfo as se}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{sceneSnappingAtLocation as he,addMapDelta as de,createManipulatorDragEventPipeline as ue,dragAtLocation as ce,addScreenDelta as me}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ge}from"../../../../interactive/keybindings.js";import{SnappingContext as fe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as _e}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as ve,enterInputModeIfAvailable as Me}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const be=Symbol();let xe=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new w,this._recreatingManipulators=!1,this._settings=new X({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._sketchOptions,e),this._vertexManipulatorMaterial=G(a(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=k(a(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=k(a(i.hoverOutlineColor),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=G(a(n.color),n.renderOccluded),this._edgeManipulatorOutlineMaterial=k(a(n.outlineColor),n.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=G(a(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=G(a(o.hoverColor),o.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=G(a(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=k(a(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=k(a(s.hoverOutlineColor),s.renderOccluded),this.tooltip=ve(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([d(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),d(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Ie(t)&&(t.edgeManipulator.available=e)}),d(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),d(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},c),ne(this.tooltip,this.object,()=>this._tooltipsContext),d(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=p(this._segmentLabels),this.tooltip=p(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get automaticAreaMeasurementUtils(){return this.tool.automaticAreaMeasurementUtils}get automaticLengthMeasurementUtils(){return this.tool.automaticLengthMeasurementUtils}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===ge.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!Me(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._objectMoveManipulation=p(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._operations&&this._operations.canRedo}get canUndo(){return null!=this._operations&&this._operations.canUndo}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=p(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(be):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,be)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new K({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=h(e))}),n.next(()=>this._onDragCancel(!0,()=>e=h(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new W({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t.operations,t.elevationInfo),snapToScene:!1,radius:W.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:h}=_e({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(h),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(he(this.view,e,t.graphic??void 0)).next(...p).next(de()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),d(()=>t.visible,()=>this._updateMoveManipulationPosition(),c),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),d(()=>t.isDraped,e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),t):this.removeHandles(t)},c)])}_createVisualElements(){const{object:e,view:t}=this,i=Y({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof re?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,h=p/2,d=p*Math.sqrt(3)/2,{height:u,offset:c}=o,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,d,h,h,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-d,h,h,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new L(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new P({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:je(n)}),_=new P({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:je(n)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,o.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ue(f,this._createEdgeOffsetPipeline(v,t,a)),ue(_,this._createEdgePipeline(v,t,a)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?J(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=h(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=o&&te(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),r(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r(()=>{h(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=Q(this.view,e.manipulator.elevationAlignedLocation,$(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ee(i,o,s):M;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=b(x(we,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(ce(this.view,r)).next(R(this.view,r,t,s,e)).next(me()).next(de()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(ce(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(Z(this.view,i.data.spatialReference)).next(de()).next(ye()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=$(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),p=Q(n,e.manipulator.elevationAlignedLocation,r);let d;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),d=h(d)},c=this.events.on("undo",u);return d=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==p?(u(),null):{...e,operation:r,plane:p},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const o=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),r=new re({view:this.view,isDraped:t.isDraped,geometry:o(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),p=s([d(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{r.color=a(e),r.isDraped=t},m),t.on("committed",()=>{r.geometry=o()}),l(r)]);return r.attached=!0,p}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<He){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<He){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!Me(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Ie).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=$(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ie(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([g(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,o=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(o.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Oe(o.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const p="point"===r||"mesh"===r?[]:[new L(this._vertexManipulatorGeometry.instantiate(),4|Ve),new L(this._vertexManipulatorOutlineGeometry.instantiate(),5|Ve),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Ve),new L(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&p.push(new L(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|De),new L(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|De),new L(this._edgeManipulatorGeometry.instantiate(),5|De),new L(this._edgeManipulatorOutlineGeometry.instantiate(),5|De));const d=new P({view:a,renderObjects:p,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:je(l)});d.selected=i,this._setTypeSpecificManipulatorSettings(d,e,t);const u="vertex"===e.type?{manipulator:d,handle:e,type:"vertex",selectedIndex:0}:{manipulator:d,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(d),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=s(e),this._manipulatorHandles.add(u.locationUpdateHandle,d)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(d,!0),d);const c=ue(d,(e,i,o,s)=>{let r=null;const{snappingStep:p,cancelSnapping:d}=_e({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new fe({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=h(r)),t)).next(d);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(ce(a,c)).next(R(a,c,t,l,m)).next(he(a,t,m)).next(...p).next(de()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=h(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,d.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),d.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),d.events.on("focus-changed",()=>{this._resetTooltip()})],d),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.state=Ve,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=De,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Ie(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Se),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else y(we,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=we}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=h(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),a.leftSegment&&"line"===a.leftSegment.type&&this._createVertexOrEdgeManipulator(a.leftSegment),a.rightSegment&&"line"===a.rightSegment.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=O(we,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,E(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&q(this._operations,o.elevationInfo),this._moveManipulation.angle=N(s),this._moveManipulation.radius=W.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ee(t,e):o&&(i=Ee(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=B}0!==t&&i?(j(e,e,1/t),Se.spatialReference=this._operations.data.spatialReference,Se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Se),this._moveManipulation.elevationAlignedLocation=Se):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const a of e){const e=a.handle.part;if("vertex"===a.type&&i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightSegment));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a){e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&2===e.button&&this._removeVertices([t])),"edge"===t.type&&0===e.button&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(e,t,this._tooltipsContext))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?se(this.object,null,this._tooltipsContext):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}}get test(){}};function ye(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Oe(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ee(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function je(e){return new H({x:0,y:0,z:0,spatialReference:e})}function Ie(e){return"edge"===e.type&&"edgeManipulator"in e}e([_()],xe.prototype,"_numGrabbing",void 0),e([_()],xe.prototype,"_numDragging",void 0),e([_()],xe.prototype,"_pendingEdgeOffsetInfo",void 0),e([_()],xe.prototype,"_operations",null),e([_()],xe.prototype,"_segmentLabels",void 0),e([_({constructOnly:!0})],xe.prototype,"tool",void 0),e([_()],xe.prototype,"tooltip",void 0),e([_()],xe.prototype,"activeTooltipInfo",void 0),e([_({readOnly:!0})],xe.prototype,"updating",null),e([_()],xe.prototype,"manipulators",null),e([_()],xe.prototype,"view",null),e([_()],xe.prototype,"automaticAreaMeasurementUtils",null),e([_()],xe.prototype,"automaticLengthMeasurementUtils",null),e([_()],xe.prototype,"object",null),e([_()],xe.prototype,"enableZShape",null),e([_()],xe.prototype,"enableDeleteVertices",null),e([_()],xe.prototype,"enableZVertex",null),e([_()],xe.prototype,"autoHideManipulators",null),e([_()],xe.prototype,"enableMoveObject",null),e([_()],xe.prototype,"enableMidpoints",null),e([_()],xe.prototype,"enableEdgeOffset",null),e([_()],xe.prototype,"_sketchOptions",null),e([_()],xe.prototype,"_accentColor",null),e([_()],xe.prototype,"_tooltipsContext",null),xe=e([v("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],xe);const Se=T(0,0,void 0,D.WGS84),we=S(),He=1e-6,Ve=16,De=32;export{xe as ReshapeOperation};
5
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import{EventEmitter as n}from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as s,makeHandle as r,destroyHandle as l}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as p,removeMaybe as h}from"../../../../../core/maybe.js";import{watch as d,on as u,initial as c,syncAndInitial as m,when as g,sync as f}from"../../../../../core/reactiveUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as v}from"../../../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as M}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l as b,d as x,m as y,i as O,f as E,g as j}from"../../../../../chunks/vec32.js";import{fromValues as I,create as S}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as w}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Point.js";import V from"../../../../../geometry/Polyline.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{isVolumetricSymbol as A}from"../../../../../symbols/support/utils.js";import{Manipulator3D as P}from"../../Manipulator3D.js";import{createManipulatorMaterial as G,createManipulatorOutlineMaterial as k,placeAtObject as C}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{SegmentLabels3D as U}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as R,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as Z}from"../dragEventPipeline3D.js";import{orientation as N}from"../geometryUtils.js";import{canMoveZOperations as q}from"../manipulatorUtils.js";import{Settings as X}from"../settings.js";import{createVisualElements as Y}from"../visualElementUtils.js";import{discRadiusSmall as B}from"../manipulations/config.js";import{MoveManipulation as W}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as K}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as J,createEdgeOffsetIntersectionPlane as Q,createEdgeOffsetOperation as $,edgeOffsetRotationMatrix as ee,screenEdgeLengthSquared as te,getDistanceInGeometrySR as ie}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as oe,getUpdatedEdgeOffsetTooltipInfo as se}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{createExtrudedTriangle as le,createSphereGeometry as pe}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as he}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as de,addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as fe}from"../../../../interactive/keybindings.js";import{SnappingContext as _e}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ve}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Me,enterInputModeIfAvailable as be}from"../../../../interactive/tooltip/tooltipCommonUtils.js";const xe=Symbol();let ye=class extends t{get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new w,this._recreatingManipulators=!1,this._settings=new X({getTheme:()=>this.view.effectiveTheme}),this.events=new n,this.activeTooltipInfo=null,this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit("reshape",{type:"reshape",object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit("move",{type:"move",object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._sketchOptions,e),this._vertexManipulatorMaterial=G(a(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=k(a(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=k(a(i.hoverOutlineColor),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=G(a(n.color),n.renderOccluded),this._edgeManipulatorOutlineMaterial=k(a(n.outlineColor),n.renderOccluded);const o=t.edgeOffset;this._edgeOffsetManipulatorMaterial=G(a(o.color),o.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=G(a(o.hoverColor),o.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=G(a(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=k(a(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=k(a(s.hoverOutlineColor),s.renderOccluded),this.tooltip=Me(()=>({view:e,options:this._sketchOptions.tooltips})),this.addHandles([d(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{e.applyColor(this._vertexManipulatorMaterial),e.applyOutline(this._vertexManipulatorOutlineMaterial),e.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),t.applyColor(this._edgeManipulatorMaterial),t.applyOutline(this._edgeManipulatorOutlineMaterial),i.applyColor(this._edgeOffsetManipulatorMaterial),i.applyHover(this._edgeOffsetManipulatorHoverMaterial),a.applyColor(this._selectedManipulatorMaterial),a.applyOutline(this._selectedManipulatorOutlineMaterial),a.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),d(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Se(t)&&(t.edgeManipulator.available=e)}),d(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),d(()=>({labels:this._segmentLabels,enabled:this._sketchOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},c),ne(this.tooltip,this.object,()=>this._tooltipsContext),d(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),u(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),u(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=p(this._segmentLabels),this.tooltip=p(this.tooltip)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get automaticAreaMeasurementUtils(){return this.tool.automaticAreaMeasurementUtils}get automaticLengthMeasurementUtils(){return this.tool.automaticLengthMeasurementUtils}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _sketchOptions(){return this.tool.sketchOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return"key-down"===e.type&&e.key===fe.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!be(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._objectMoveManipulation=p(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._operations&&this._operations.canRedo}get canUndo(){return null!=this._operations&&this._operations.canUndo}redo(){return this._operations?.redo()}undo(){return this.events.emit("undo"),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),this._operations&&this._segmentLabels?.context?.editGeometryOperations===this._operations||(this._segmentLabels=p(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._sketchOptions.labels;this._segmentLabels=new U({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e,automaticLengthMeasurementUtils:this.automaticLengthMeasurementUtils},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected),o=1===e&&n;for(const s of this._manipulatorInfos)"vertex"===s.type&&(s.manipulator.grabbing||o&&!s.manipulator.selected||a.push(s),i++);this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(1),this.destroyed)return t;this.events.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._updateEventState(2),this.destroyed)return t;this.events.emit("reshape",{type:"reshape",object:this.object})}return t}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(xe):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,xe)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,1),this.events.emit("reshape",{type:"reshape",object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(0!==this._numGrabbing||0!==this._numDragging))return!1;switch(this._reshapeEventState){case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape-stop",object:this.object}),this.destroyed||this.events.emit("move",{type:"move-start",dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit("reshape",{type:"reshape-start",object:this.object});break;case 1:this.events.emit("move",{type:"move-stop",dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit("reshape",{type:"reshape-start",object:this.object})}}if(this.destroyed)return!1;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new K({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._resetTooltip(),e=h(e))}),n.next(()=>this._onDragCancel(!0,()=>e=h(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on("immediate-click",e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new W({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t.operations,t.elevationInfo),snapToScene:!1,radius:W.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on("immediate-click",t=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some(e=>e.manipulator.selected)||this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:h}=ve({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new _e({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(h),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(de(this.view,e,t.graphic??void 0)).next(...p).next(ue()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),d(()=>t.visible,()=>this._updateMoveManipulationPosition(),c),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),d(()=>t.isDraped,e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),t):this.removeHandles(t)},c)])}_createVisualElements(){const{object:e,view:t}=this,i=Y({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof re?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(u(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,h=p/2,d=p*Math.sqrt(3)/2,{height:u,offset:c}=o,m=this._edgeOffsetManipulatorMaterial;if(!this._edgeOffsetManipulatorGeometryInside){const e=le(m,d,h,h,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=le(m,-d,h,h,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new L(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),2)],f=new P({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:Ie(n)}),_=new P({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:Ie(n)}),v={manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:_,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(v,o.minSquaredEdgeLength);const M=()=>this._updateEdgeOffsetManipulator(v);M(),v.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",M)}));const b=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([v.locationUpdateHandle,this._watchAndUpdateGrabState(f,!0),this._watchAndUpdateGrabState(_,!0),ce(f,this._createEdgeOffsetPipeline(v,t,a)),ce(_,this._createEdgePipeline(v,t,a)),_.events.on("immediate-click",b),f.events.on("immediate-click",b),f.events.on("focus-changed",()=>this._resetTooltip()),f.events.on("grab-changed",({screenPoint:e,action:t})=>{v.grabMapPoint="start"===t?J(e,this.view,this.object,v):null})],f),this._manipulatorInfos.push(v),this.manipulators.addMany([f,_]),this.events.emit("manipulators-changed"),v}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=h(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=o&&te(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),r(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),r(()=>{h(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=Q(this.view,e.manipulator.elevationAlignedLocation,$(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ee(i,o,s):M;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=b(x(He,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(me(this.view,r)).next(R(this.view,r,t,s,e)).next(ge()).next(ue()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&this._resetTooltip()}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(me(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(Z(this.view,i.data.spatialReference)).next(ue()).next(Oe()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=$(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),p=Q(n,e.manipulator.elevationAlignedLocation,r);let d;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),d=h(d)},c=this.events.on("undo",u);return d=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==p?(u(),null):{...e,operation:r,plane:p},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,n){const o=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),r=new re({view:this.view,isDraped:t.isDraped,geometry:o(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),p=s([d(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{r.color=a(e),r.isDraped=t},m),t.on("committed",()=>{r.geometry=o()}),l(r)]);return r.attached=!0,p}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit("reshape",{type:"reshape",object:this.object})),this._updateEdgeOffsetTooltip(t))),t)}_cleanEdgeOffsetCollapsedEdges(e,t){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<Ve){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<Ve){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!be(e,this.tooltip)&&(t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"drag"},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:"hover"},this._connectEdgeOffsetTooltipOnHover(t),!0)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Se).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=$(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ie(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([g(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,o=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ee(o.manipulators.vertex);this._vertexManipulatorGeometry=pe(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=pe(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=Ee(o.manipulators.edge);this._edgeManipulatorGeometry=pe(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=pe(this._edgeManipulatorOutlineMaterial,t,16,16)}const p="point"===r||"mesh"===r?[]:[new L(this._vertexManipulatorGeometry.instantiate(),4|De),new L(this._vertexManipulatorOutlineGeometry.instantiate(),5|De),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|De),new L(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),8),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),9),new L(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),10)];this.enableMidpoints&&p.push(new L(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),6|Te),new L(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),6|Te),new L(this._edgeManipulatorGeometry.instantiate(),5|Te),new L(this._edgeManipulatorOutlineGeometry.instantiate(),5|Te));const d=new P({view:a,renderObjects:p,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:this.object.visible,metadata:{deleting:!1},location:Ie(l)});d.selected=i,this._setTypeSpecificManipulatorSettings(d,e,t);const u="vertex"===e.type?{manipulator:d,handle:e,type:"vertex",selectedIndex:0}:{manipulator:d,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(u),this.manipulators.add(d),this._updateManipulatorPosition(u),"edge"===u.type){const e=[];for(const t of[u.handle.leftVertex,u.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(u)))}u.locationUpdateHandle=s(e),this._manipulatorHandles.add(u.locationUpdateHandle,d)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(d,!0),d);const c=ce(d,(e,i,o,s)=>{let r=null;const{snappingStep:p,cancelSnapping:d}=ve({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new _e({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});o=o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=h(r)),t)).next(d);const{elevationAlignedLocation:c}=e,m=this.object.graphic??void 0;i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===u.type){const t=this._splitEdgeManipulator(u);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:u,snapOrigin:u.handle.pos}}).next(me(a,c)).next(R(a,c,t,l,m)).next(de(a,t,m)).next(...p).next(ue()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=h(r)),this._resetTooltip()})});return this._manipulatorHandles.add([c,d.events.on("immediate-click",e=>this._manipulatorClickCallback(e,u)),d.events.on("select-changed",()=>{u.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),d.events.on("focus-changed",()=>{this._resetTooltip()})],d),this.events.emit("manipulators-changed"),u}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit("move",{type:"move",dx:0,dy:0,object:this.object});break;case 2:this.events.emit("reshape",{type:"reshape",object:this.object})}t?.(),this.destroyed||this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,i){const a=this._settings;switch(t.type){case"vertex":{e.state=De,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const o=this._operations?.data.type;e.interactive=null!=o&&"point"!==o&&"mesh"!==o;break}case"line":{e.state=Te,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||A(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(0),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Se(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit("manipulators-changed"))}_removeManipulator(e){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(this._manipulatorInfos,e),this.events.emit("manipulators-changed"),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){for(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,we),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else y(He,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=He}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=h(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),a.leftSegment&&"line"===a.leftSegment.type&&this._createVertexOrEdgeManipulator(a.leftSegment),a.rightSegment&&"line"===a.rightSegment.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=O(He,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,E(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&q(this._operations,o.elevationInfo),this._moveManipulation.angle=N(s),this._moveManipulation.radius=W.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=je(t,e):o&&(i=je(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=B}0!==t&&i?(j(e,e,1/t),we.spatialReference=this._operations.data.spatialReference,we.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,we),this._moveManipulation.elevationAlignedLocation=we):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?C(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(i){for(const a of e){const e=a.handle.part;if("vertex"===a.type&&i.canRemoveVertex(e)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightSegment));const n=i.removeVertices([a.handle]),o=n.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a){e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);for(const t of e)this._updateManipulatorPosition(t)}}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===he.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===he.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(e,t,this._tooltipsContext))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?se(this.object,null,this._tooltipsContext):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}=this;return{sketchOptions:this._sketchOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,automaticAreaMeasurementUtils:i,automaticLengthMeasurementUtils:a}}get test(){}};function Oe(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ee(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function je(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Ie(e){return new H({x:0,y:0,z:0,spatialReference:e})}function Se(e){return"edge"===e.type&&"edgeManipulator"in e}e([_()],ye.prototype,"_numGrabbing",void 0),e([_()],ye.prototype,"_numDragging",void 0),e([_()],ye.prototype,"_pendingEdgeOffsetInfo",void 0),e([_()],ye.prototype,"_operations",null),e([_()],ye.prototype,"_segmentLabels",void 0),e([_({constructOnly:!0})],ye.prototype,"tool",void 0),e([_()],ye.prototype,"tooltip",void 0),e([_()],ye.prototype,"activeTooltipInfo",void 0),e([_({readOnly:!0})],ye.prototype,"updating",null),e([_()],ye.prototype,"manipulators",null),e([_()],ye.prototype,"view",null),e([_()],ye.prototype,"automaticAreaMeasurementUtils",null),e([_()],ye.prototype,"automaticLengthMeasurementUtils",null),e([_()],ye.prototype,"object",null),e([_()],ye.prototype,"enableZShape",null),e([_()],ye.prototype,"enableDeleteVertices",null),e([_()],ye.prototype,"enableZVertex",null),e([_()],ye.prototype,"autoHideManipulators",null),e([_()],ye.prototype,"enableMoveObject",null),e([_()],ye.prototype,"enableMidpoints",null),e([_()],ye.prototype,"enableEdgeOffset",null),e([_()],ye.prototype,"_sketchOptions",null),e([_()],ye.prototype,"_accentColor",null),e([_()],ye.prototype,"_tooltipsContext",null),ye=e([v("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],ye);const we=T(0,0,void 0,D.WGS84),He=S(),Ve=1e-6,De=16,Te=32;export{ye as ReshapeOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import{result as r,forEach as s}from"../../../core/asyncUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{destroyMaybe as n,abortMaybe as a}from"../../../core/maybe.js";import{estimateNumberArrayMemory as d,baseObjectMemory as l,estimateNumberMemory as u,estimateFixedArrayMemory as h,baseArrayMemory as p}from"../../../core/memoryEstimations.js";import{isAbortError as c,allSettledValues as _,throwIfAborted as m}from"../../../core/promiseUtils.js";import{initial as g,watch as f,sync as y}from"../../../core/reactiveUtils.js";import{pt2px as b}from"../../../core/screenUtils.js";import{isArrayBuffer as w}from"../../../core/typedArrayUtil.js";import{property as N}from"../../../core/accessorSupport/decorators/property.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{l as x,f as v,e as C,c as S}from"../../../chunks/vec32.js";import{clone as I}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import R from"../../../geometry/Extent.js";import j from"../../../geometry/Point.js";import{projectBoundingSphere as k}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as V}from"../../../geometry/projection/projectVectorToVector.js";import{create as Q,fromMinMax as F}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as L,create as E}from"../../../geometry/support/plane.js";import{f as D}from"../../../chunks/sphere.js";import O from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as U}from"../../../layers/graphics/data/QueryEngine.js";import{CodedValue as q}from"../../../layers/support/CodedValue.js";import M from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as W}from"../../../layers/support/fieldUtils.js";import G from"../../../rest/support/FeatureSet.js";import z from"../../../rest/support/Query.js";import{getElevationOffset as H}from"../../../support/elevationInfoUtils.js";import{LayerView3D as B}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as T,QueuePerformanceInfo as $}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as J}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as K}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as Z,checkPointCloudLayerCompatibleWithView as Y}from"./i3s/I3SUtil.js";import{nodeDiff as X,sortFrontToBack as ee,splitWorkEntries as te}from"./i3s/LoDUtil.js";import{PagedNodeIndex as ie}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as re}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as se}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as oe,PointCloudRendererNode as ne}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as ae,getFixedSizeAlgorithm as de,getRendererInfo as le,getFilterInfo as ue,rendererUsesFixedSizes as he,getAttributeInfo as pe}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as ce,readGeometry as _e,elevationFromPositions as me}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as ge,emptyHighlightHandle as fe}from"./support/highlightUtils.js";import{PopupSceneLayerView as ye}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as be}from"../support/extentUtils.js";import{computeMapPointFromVec3d as we}from"../support/hitTest.js";import{Obb as Ne}from"../support/orientedBoundingBox.js";import{updatingProgress as Pe}from"../support/updatingProperties.js";import xe from"../../layers/LayerView.js";import{PointCloudLayerView as ve}from"../../layers/PointCloudLayerView.js";import{getHighlightName as Ce}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Se}from"../../support/layerViewUtils.js";import{PromiseQueue as Ie}from"../../support/PromiseQueue.js";import{TaskPriority as Ae}from"../../support/Scheduler.js";const Re=8,je=E();let ke=class extends(ve(ye(B(xe)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Ie,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=ae(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=de(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=de(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=le(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=ue(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of W(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=Q(),t=this.view.renderSpatialReference;return be(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return e&&"absolute-height"===e.mode?H(e,this.layer.spatialReference):0}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){const e=this.view.resourceController,t=Ee(e);this._worker=new J(t),this.addResolvingPromise(this._worker.promise),Z(this.layer),Y(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(2),this._dataRequester=e.createStreamDataRequester(3),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),g),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),g),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([f(()=>this.view.quality,()=>this._setUpdateViewNeeded(),y)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(Ae.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks(()=>this._idleBegin(),()=>this._idleEnd()),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},g)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=n(this._worker),this._destroyRenderer(),this._memCache=n(this._memCache),this._queryFeaturesCache=n(this._queryFeaturesCache),this._queryEngine=n(this._queryEngine),this._codedDomainPopulationAbortController=a(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new se({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,g),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),g),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,g),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,g),this._updatingHandles.add(()=>this.pointSize,e=>{const t=b(e);this._renderer.size=e,this._renderer.sizePx=t},g),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,g),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},g)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:we(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new re({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=he(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=X([...this._renderedNodes],e,this._index),ee(this._workQueue,this.view.state.contentCamera.viewForward,this._index),te(this._workQueue,Re,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array,i=new Map;this._loadingNodes.forEach((r,s)=>{e.has(s)?i.set(s,r):t.push(r)}),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get readyToRun(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.readyToRun}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map(e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise})).then(t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)}).catch(()=>{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await r(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new M({name:"CLASS_CODE",codedValues:n.map(e=>new q({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),o=this.layer.attributeStorageInfo,n=t.map(e=>pe(o,e)).filter(i),a=async(e,t)=>{const i=this._index.getNode(t);await s(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return r.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof re&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?ce({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=_e(t,await this._loadGeometry(e,null));return me(i,i.length/3)}highlight(e,i){const r=ge(e);if(0===r.length)return fe;if(!(r[0]instanceof t))return fe;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Ce(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Se(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=G.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i}const s=j.fromJSON(e.geometry);return s.spatialReference=o.spatialReference??n,this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new z(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:R.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new z({outSpatialReference:this.view.spatialReference}).toJSON():z.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new U({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new K({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{let i=!1;this._renderer.forEachNode(r=>{if(i)return;if(t){const e=r.obb,s=D(e.center[0],e.center[1],e.center[2],x(e.halfSize));k(s,this.view.renderSpatialReference,s,this.view.spatialReference);const o=t(s);if(2===o)return;if(i=0===o,i)return}let s=this._queryFeaturesCache.get(`${r.id}`);s||(s=this._createQueryPointFeatures(r),this._queryFeaturesCache.put(`${r.id}`,s)),s.features.forEach(e)})},getFeatureExtent:({point:e},t)=>F(e,e,t),featureAdapter:{cloneWithGeometry:(e,t)=>new Qe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=A(t[s+0],t[s+1],t[s+2]);v(o,o,e.origin),V(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Qe(e,r,o);i.push(n)}return new Fe(i)}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new ie(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(t=>t.nodes.map((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:Ne.fromJSON(t.obb),obbInRenderSR:new Ne,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=C(s,t.eye),n=L(s,-o,je),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw c(i)||o.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,r){const s=this.layer.outFields;if(!s)return[];const o=W(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const i of o){if(n.has(i))continue;const e=pe(a,i);e&&d.push(t(e))}const l=await _(d);return m(r),l.filter(i)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=le(this.layer),s=ue(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,g,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);m(t);const w={geometryBuffer:_,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",...this.layer.customParameters,token:this.layer.apiKey};return this._indexRequester.request(e,0,{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,1,{query:{...this.layer.customParameters,token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(t.id.toString(),t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(oe(t))return t.splatSize=r,t.obb=s,S(t.origin,t.obb.center),t;const n=Ne.fromData(t.obbData),a=n.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;o.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(n)}`),0===--this._maxLoggedBoxWarnings&&o.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,n)}return new ne(e,r,I(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=Le,e+=d(t.coordinates);for(const i of t.attributes){const t=i.values;w(t.buffer)&&(e+=d(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*Le)/t)+i*Le}get performanceInfo(){return new T(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new $(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([N()],ke.prototype,"layer",void 0),e([N()],ke.prototype,"baseUrl",null),e([N()],ke.prototype,"pointScale",null),e([N()],ke.prototype,"useRealWorldSymbolSizes",null),e([N()],ke.prototype,"pointSize",null),e([N()],ke.prototype,"inverseDensity",null),e([N()],ke.prototype,"maximumPointCount",void 0),e([N({readOnly:!0})],ke.prototype,"availableFields",null),e([N({readOnly:!0})],ke.prototype,"_clippingBox",null),e([N({readOnly:!0})],ke.prototype,"_elevationOffset",null),e([N({type:Boolean})],ke.prototype,"slicePlaneEnabled",void 0),e([N()],ke.prototype,"_graphicOrigin",null),e([N()],ke.prototype,"updating",void 0),e([N(Pe)],ke.prototype,"updatingProgress",void 0),e([N({readOnly:!0})],ke.prototype,"updatingProgressValue",null),e([N({readOnly:!0})],ke.prototype,"visibleAtCurrentScale",null),ke=e([P("esri.views.3d.layers.PointCloudLayerView3D")],ke);const Ve=ke;class Qe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new O([1],Array.from(this.point))}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return l+l+u+h(this.point,u)}}class Fe{constructor(e){this.features=e}get cachedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,l+p)}}const Le=160;function Ee(e){return t=>e.immediate.schedule(t)}export{Ve as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import{result as r,forEach as s}from"../../../core/asyncUtils.js";import"../../../core/has.js";import o from"../../../core/Logger.js";import{destroyMaybe as n,abortMaybe as a}from"../../../core/maybe.js";import{estimateNumberArrayMemory as d,baseObjectMemory as l,estimateNumberMemory as u,estimateFixedArrayMemory as h,baseArrayMemory as p}from"../../../core/memoryEstimations.js";import{isAbortError as c,allSettledValues as _,throwIfAborted as m}from"../../../core/promiseUtils.js";import{initial as g,watch as f,sync as y}from"../../../core/reactiveUtils.js";import{pt2px as b}from"../../../core/screenUtils.js";import{isArrayBuffer as w}from"../../../core/typedArrayUtil.js";import{property as N}from"../../../core/accessorSupport/decorators/property.js";import{subclass as P}from"../../../core/accessorSupport/decorators/subclass.js";import{l as x,f as v,e as C,c as S}from"../../../chunks/vec32.js";import{clone as I}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import R from"../../../geometry/Extent.js";import j from"../../../geometry/Point.js";import{projectBoundingSphere as k}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as V}from"../../../geometry/projection/projectVectorToVector.js";import{create as Q,fromMinMax as F}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as L,create as E}from"../../../geometry/support/plane.js";import{f as D}from"../../../chunks/sphere.js";import O from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as U}from"../../../layers/graphics/data/QueryEngine.js";import{CodedValue as q}from"../../../layers/support/CodedValue.js";import M from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as W}from"../../../layers/support/fieldUtils.js";import G from"../../../rest/support/FeatureSet.js";import z from"../../../rest/support/Query.js";import{getElevationOffset as H}from"../../../support/elevationInfoUtils.js";import{LayerView3D as B}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as T,QueuePerformanceInfo as $}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as J}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as K}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as Z,checkPointCloudLayerCompatibleWithView as Y}from"./i3s/I3SUtil.js";import{nodeDiff as X,sortFrontToBack as ee,splitWorkEntries as te}from"./i3s/LoDUtil.js";import{PagedNodeIndex as ie}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as re}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as se}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as oe,PointCloudRendererNode as ne}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as ae,getFixedSizeAlgorithm as de,getRendererInfo as le,getFilterInfo as ue,rendererUsesFixedSizes as he,getAttributeInfo as pe}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as ce,readGeometry as _e,elevationFromPositions as me}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as ge,emptyHighlightHandle as fe}from"./support/highlightUtils.js";import{PopupSceneLayerView as ye}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as be}from"../support/extentUtils.js";import{computeMapPointFromVec3d as we}from"../support/hitTest.js";import{Obb as Ne}from"../support/orientedBoundingBox.js";import{updatingProgress as Pe}from"../support/updatingProperties.js";import xe from"../../layers/LayerView.js";import{PointCloudLayerView as ve}from"../../layers/PointCloudLayerView.js";import{getHighlightName as Ce}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Se}from"../../support/layerViewUtils.js";import{PromiseQueue as Ie}from"../../support/PromiseQueue.js";import{TaskPriority as Ae}from"../../support/Scheduler.js";const Re=8,je=E();let ke=class extends(ve(ye(B(xe)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Ie,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=ae(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=de(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=de(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=le(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=ue(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of W(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=Q(),t=this.view.renderSpatialReference;return be(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return e&&"absolute-height"===e.mode?H(e,this.layer.spatialReference):0}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){const e=this.view.resourceController,t=Ee(e);this._worker=new J(t),this.addResolvingPromise(this._worker.promise),Z(this.layer),Y(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(2),this._dataRequester=e.createStreamDataRequester(3),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),g),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),g),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),g),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([f(()=>this.view.quality,()=>this._setUpdateViewNeeded(),y)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(Ae.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks(()=>this._idleBegin(),()=>this._idleEnd()),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},g)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=n(this._worker),this._destroyRenderer(),this._memCache=n(this._memCache),this._queryFeaturesCache=n(this._queryFeaturesCache),this._queryEngine=n(this._queryEngine),this._codedDomainPopulationAbortController=a(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new se({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,g),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),g),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,g),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,g),this._updatingHandles.add(()=>this.pointSize,e=>{const t=b(e);this._renderer.size=e,this._renderer.sizePx=t},g),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,g),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),g),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},g)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:we(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new re({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=he(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=X([...this._renderedNodes],e,this._index),ee(this._workQueue,this.view.state.contentCamera.viewForward,this._index),te(this._workQueue,Re,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array,i=new Map;this._loadingNodes.forEach((r,s)=>{e.has(s)?i.set(s,r):t.push(r)}),this._loadingNodes=i;for(const{abortController:r}of t)r.abort();this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get readyToRun(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.readyToRun}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(t=>{this._index.addPage(e,t,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}_processWorkEntry(e){if(0!==e.load.length)Promise.all(e.load.map(e=>{const t=new AbortController,i=this._memCache.pop(e.toString());return null!=i?this._loadingNodes.set(e,{abortController:t,promise:Promise.resolve(i)}):this._loadingNodes.has(e)||this._loadingNodes.set(e,{abortController:t,promise:this._loadNode(e,t.signal)}),this._loadingNodes.get(e).promise})).then(t=>{for(let i=0;i<e.load.length;i++)if(t[i]){const r=this._setupRendererData(e.load[i],t[i]);this._addToRenderer(r)}for(const i of e.remove)this._removeFromRenderer(i)}).catch(()=>{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain)return;if(!e.includes(s.name))return;const o=await r(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(s.domain=new M({name:"CLASS_CODE",codedValues:n.map(e=>new q({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const r=this._splitGraphicsPerNode(e),o=this.layer.attributeStorageInfo,n=t.map(e=>pe(o,e)).filter(i),a=async(e,t)=>{const i=this._index.getNode(t);await s(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return r.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof re&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?ce({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=_e(t,await this._loadGeometry(e,null));return me(i,i.length/3)}highlight(e,i){const r=ge(e);if(0===r.length)return fe;if(!(r[0]instanceof t))return fe;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Ce(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Se(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=G.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i.layer=this.layer,i.sourceLayer=this.layer,i.origin=this._graphicOrigin,i}const s=e.geometry?j.fromJSON(e.geometry):void 0;return s&&(s.spatialReference=o.spatialReference??n),this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new z(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:R.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new z({outSpatialReference:this.view.spatialReference}).toJSON():z.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new U({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new K({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{let i=!1;this._renderer.forEachNode(r=>{if(i)return;if(t){const e=r.obb,s=D(e.center[0],e.center[1],e.center[2],x(e.halfSize));k(s,this.view.renderSpatialReference,s,this.view.spatialReference);const o=t(s);if(2===o)return;if(i=0===o,i)return}let s=this._queryFeaturesCache.get(`${r.id}`);s||(s=this._createQueryPointFeatures(r),this._queryFeaturesCache.put(`${r.id}`,s)),s.features.forEach(e)})},getFeatureExtent:({point:e},t)=>F(e,e,t),featureAdapter:{cloneWithGeometry:(e,t)=>new Qe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=A(t[s+0],t[s+1],t[s+2]);v(o,o,e.origin),V(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Qe(e,r,o);i.push(n)}return new Fe(i)}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new ie(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(e=>{this._index.addPage(0,e,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(t=>t.nodes.map((t,i)=>({resourceId:null!=t.resourceId?t.resourceId:e*this._index.pageSize+i,obb:Ne.fromJSON(t.obb),obbInRenderSR:new Ne,firstChild:t.firstChild,childCount:t.childCount,vertexCount:t.vertexCount??t.pointCount,lodThreshold:t.lodThreshold??t.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=C(s,t.eye),n=L(s,-o,je),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw c(i)||o.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,r){const s=this.layer.outFields;if(!s)return[];const o=W(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const i of o){if(n.has(i))continue;const e=pe(a,i);e&&d.push(t(e))}const l=await _(d);return m(r),l.filter(i)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=le(this.layer),s=ue(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,g,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);m(t);const w={geometryBuffer:_,primaryAttributeData:g,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}_requestNodePage(e,t){const i={f:"json",...this.layer.customParameters,token:this.layer.apiKey};return this._indexRequester.request(e,0,{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,1,{query:{...this.layer.customParameters,token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(t.id.toString(),t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(oe(t))return t.splatSize=r,t.obb=s,S(t.origin,t.obb.center),t;const n=Ne.fromData(t.obbData),a=n.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;o.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(n)}`),0===--this._maxLoggedBoxWarnings&&o.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,n)}return new ne(e,r,I(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=Le,e+=d(t.coordinates);for(const i of t.attributes){const t=i.values;w(t.buffer)&&(e+=d(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*Le)/t)+i*Le}get performanceInfo(){return new T(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new $(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([N()],ke.prototype,"layer",void 0),e([N()],ke.prototype,"baseUrl",null),e([N()],ke.prototype,"pointScale",null),e([N()],ke.prototype,"useRealWorldSymbolSizes",null),e([N()],ke.prototype,"pointSize",null),e([N()],ke.prototype,"inverseDensity",null),e([N()],ke.prototype,"maximumPointCount",void 0),e([N({readOnly:!0})],ke.prototype,"availableFields",null),e([N({readOnly:!0})],ke.prototype,"_clippingBox",null),e([N({readOnly:!0})],ke.prototype,"_elevationOffset",null),e([N({type:Boolean})],ke.prototype,"slicePlaneEnabled",void 0),e([N()],ke.prototype,"_graphicOrigin",null),e([N()],ke.prototype,"updating",void 0),e([N(Pe)],ke.prototype,"updatingProgress",void 0),e([N({readOnly:!0})],ke.prototype,"updatingProgressValue",null),e([N({readOnly:!0})],ke.prototype,"visibleAtCurrentScale",null),ke=e([P("esri.views.3d.layers.PointCloudLayerView3D")],ke);const Ve=ke;class Qe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new O([1],Array.from(this.point))}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return l+l+u+h(this.point,u)}}class Fe{constructor(e){this.features=e}get cachedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,l+p)}}const Le=160;function Ee(e){return t=>e.immediate.schedule(t)}export{Ve as default};