@arcgis/core 4.33.0-next.20250424 → 4.33.0-next.20250425

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 (115) hide show
  1. package/analysis/Analysis.js +1 -1
  2. package/analysis/support/AnalysisOriginWebScene.d.ts +1 -1
  3. package/analysis/support/AnalysisOriginWebScene.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/070839cb71c8e764b8d7.js +1 -0
  6. package/assets/esri/core/workers/chunks/19084a293694c5a00cae.js +1 -0
  7. package/assets/esri/core/workers/chunks/{5958af341014e13475d2.js → 2bed8a5ed9ae3760fa2f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{7ffa68d69c138db1295d.js → 2e3019ce49e972a815ca.js} +1 -1
  9. package/assets/esri/core/workers/chunks/38f5e6a202ce292edd9f.js +1 -0
  10. package/assets/esri/core/workers/chunks/415903f481392c72870f.js +1 -0
  11. package/assets/esri/core/workers/chunks/4351b3e54b309935faed.js +1 -0
  12. package/assets/esri/core/workers/chunks/4da99f058cca83937e9b.js +1 -0
  13. package/assets/esri/core/workers/chunks/5acdd49c5f1a49fdc6e7.js +1 -0
  14. package/assets/esri/core/workers/chunks/968f2f841c011095a6d2.js +1 -0
  15. package/assets/esri/core/workers/chunks/a2676f3f135ad5fdf872.js +1 -0
  16. package/assets/esri/core/workers/chunks/a8430e1e2142f1ce9b92.js +1 -0
  17. package/assets/esri/core/workers/chunks/b53300b46646cfad2526.js +319 -0
  18. package/assets/esri/core/workers/chunks/bf543bdec3da0fe278fb.js +1 -0
  19. package/assets/esri/core/workers/chunks/f52e597dca4b32a81881.js +1 -0
  20. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  21. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  22. package/chunks/ShadowCastAccumulate.glsl.js +13 -9
  23. package/chunks/ShadowCastVisualize.glsl.js +24 -9
  24. package/chunks/lyr3DMain.js +1 -1
  25. package/chunks/lyr3DWorker.js +1 -1
  26. package/interfaces.d.ts +200 -5
  27. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  28. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  29. package/layers/ParquetLayer.js +1 -1
  30. package/layers/mixins/ImageryTileMixin.js +1 -1
  31. package/layers/support/ParquetEncodingLocation.d.ts +4 -0
  32. package/layers/support/ParquetEncodingLocation.js +1 -1
  33. package/layers/support/ParquetEncodingWkb.d.ts +4 -0
  34. package/layers/support/ParquetEncodingWkb.js +1 -1
  35. package/layers/support/RasterStorageInfo.js +1 -1
  36. package/layers/support/layerUtils.js +1 -1
  37. package/layers/support/parquetUtils.d.ts +3 -0
  38. package/layers/support/parquetUtils.js +1 -1
  39. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  40. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  41. package/layers/support/rasterDatasets/RawBlockCache.js +1 -1
  42. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  43. package/package.json +2 -2
  44. package/portal/schemas/definitions.js +1 -1
  45. package/portal/schemas/integratedMesh3DTilesLayerItem.js +1 -1
  46. package/support/revision.js +1 -1
  47. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  48. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  49. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  50. package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
  51. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  52. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  53. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  54. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  55. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  56. package/views/3d/layers/Lyr3DWorker.js +1 -1
  57. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  58. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  59. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  60. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  61. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  62. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  63. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  64. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  65. package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +5 -0
  66. package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +5 -0
  67. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  68. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  69. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  70. package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
  71. package/views/3d/webgl/ManagedFBO.js +1 -1
  72. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  73. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +7 -13
  74. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js +5 -0
  75. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  76. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  77. package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
  78. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
  79. package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +5 -0
  80. package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
  81. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  82. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  83. package/views/PopupView.js +1 -1
  84. package/views/SelectionManager.js +1 -1
  85. package/views/analysis/analysisViewUtils.js +1 -1
  86. package/views/input/InputManager.js +1 -1
  87. package/views/input/ViewEvents.js +1 -1
  88. package/views/support/selectionUtils.js +1 -1
  89. package/webscene/support/analysisUtils.js +1 -1
  90. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  91. package/widgets/Editor/UpdateWorkflow.js +1 -1
  92. package/widgets/Editor/workflowUtils.js +1 -1
  93. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  94. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  95. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  96. package/widgets/FeatureTable.js +1 -1
  97. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  98. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  99. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  100. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  101. package/widgets/Sketch/SketchViewModel.js +1 -1
  102. package/widgets/VideoPlayer.js +1 -1
  103. package/widgets/support/AnalysisViewModel.js +1 -1
  104. package/assets/esri/core/workers/chunks/0a48b9734ab4c64a6f4f.js +0 -1
  105. package/assets/esri/core/workers/chunks/1427e7953c3d8c87c5e8.js +0 -1
  106. package/assets/esri/core/workers/chunks/146b3699a9e8b1f2dcc2.js +0 -1
  107. package/assets/esri/core/workers/chunks/22f604726529ee6f8c25.js +0 -1
  108. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +0 -319
  109. package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +0 -1
  110. package/assets/esri/core/workers/chunks/931275cfa2c55eb0f504.js +0 -1
  111. package/assets/esri/core/workers/chunks/9f416cc5673665f8c37c.js +0 -1
  112. package/assets/esri/core/workers/chunks/b42ecc7c3eb2fd8d1308.js +0 -1
  113. package/assets/esri/core/workers/chunks/d04efa51da9b4eb3a8a7.js +0 -1
  114. package/assets/esri/core/workers/chunks/d8474dca270b25705699.js +0 -1
  115. package/assets/esri/core/workers/chunks/ed3d1d0465f4a4d8df4a.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as s}from"../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{watch as o,syncAndInitial as a,sync as n}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as _,c as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as u}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as f,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as w,shadowCastDisableElevationMin as v}from"./ShadowCastRenderer.js";import{ShadowMap as y}from"./ShadowMap.js";import{S as R}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{PixelFormat as S,PixelType as F,SizedPixelFormat as C,TextureWrapMode as x,FramebufferBit as P}from"../../../webgl/enums.js";import{FramebufferObject as D}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as E}from"../../../webgl/TextureDescriptor.js";import{vertexCount as q}from"../../../webgl/Util.js";let M=class extends t{constructor(e,t,r,s,i,h){super({}),this.fbos=e,this._techniques=t,this._stage=r,this._prepareForShadowMapPass=s,this._renderToShadowMap=i,this._requestRender=h,this._progress=0,this._sampleCount=0,this._passParameters=new u,this._cachedLightDirections=[],this._depthRange=d.zero,this._previewing=!1,this._cameraForcedForScreenshot=!1,this._shadowAccumulatorKey="shadowAccumulator",this._rctx=e.rctx,this._bindParameters=new p(new y(e,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(this._rctx),this._accumulationRenderer=new f(t,this._rctx,this,h);const c=this._stage.view.resourceController.scheduler;this.addHandles([c.registerTask(j.SHADOW_ACCUMULATOR,this),o((()=>r.renderView),(e=>{this.removeHandles(L),null!=e&&this.addHandles(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),L)}),a),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),n)],this._shadowAccumulatorKey),t.precompile(A)}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=i(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=i(this._fbo),this._vao=i(this._vao),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this._active&&this._previewing||this._refining}get _refining(){return this._active&&!this._doneAccumulating&&!this._previewing}get _active(){return null!=this._fbo&&this._sampleCount>0}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.zero&&this._opacityFromElevation>b}get _doneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const t=this._cachedLightDirections;if(r(t,e,_))return;const s=Math.min(R,e.length);t.length=s,this._sampleCount=s;for(let r=0;r<s;++r)t[r]=l(t[r]??m(),e[r]);this._invalidate()}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get running(){return this._refining&&this.canAccumulate&&this._progress>0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._doneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,t,r,s){if(this._depthRange=t,this._updateCamera(r),this._bindParameters.contentCamera=s,this._bindParameters.depth=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.accumulating||!this.canAccumulate)return!1;(this._previewing||0===this._progress||this._cameraForcedForScreenshot)&&this._clear();let i=this._cameraForcedForScreenshot?this._sampleCount:Math.min(T,this._sampleCount);i-=this._progress;for(let o=0;o<i;++o)this._accumulateShadow(),this._requestRender();return this._cameraForcedForScreenshot=!1,i>0}precompile(){this._accumulationRenderer.precompile()}render(e){this._accumulationRenderer.render(e)}setOptions(e){if(void 0!==e.enabled){const t=null!=this._fbo;e.enabled!==t&&(e.enabled?this._enable():this._disable())}void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._lightDirections=e.lightDirections),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){return!this._active||!this._fbo||this._progress<1||e<0||e>=this._fbo.width||t<0||t>=this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,S.RGBA,F.UNSIGNED_BYTE,O),O[0]/this._progress)}_enable(){this._progress=0;const e=new E;e.pixelFormat=S.RED,e.internalFormat=C.R8,e.wrapMode=x.CLAMP_TO_EDGE,this._fbo=new D(this._rctx,e),this._requestRender()}_disable(){this._fbo=i(this._fbo),this._requestRender()}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(P.COLOR),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._lightDirections[this._progress++],this._depthRange);const e=this._techniques.get(A);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,q(this._vao,"geometry"))}_updateCamera(e){const t=this._fbo;if(null==t)return;const r=this._bindParameters.camera;e.equals(r)||r.copyFrom(e),t.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-s(v,w,e.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};e([h()],M.prototype,"_progress",void 0),e([h()],M.prototype,"_sampleCount",void 0),e([h()],M.prototype,"_fbo",void 0),e([h()],M.prototype,"_depthRange",void 0),e([h()],M.prototype,"_previewing",void 0),e([h()],M.prototype,"_accumulationRenderer",void 0),e([h()],M.prototype,"_refining",null),e([h()],M.prototype,"_active",null),e([h()],M.prototype,"canAccumulate",null),e([h()],M.prototype,"_doneAccumulating",null),e([h()],M.prototype,"_opacityFromElevation",null),e([h()],M.prototype,"running",null),M=e([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],M);const T=6,L="renderView",O=new Uint8Array(4);export{M as ShadowAccumulator};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,syncAndInitial as a,sync as n}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as l,c as m}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as p}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as d}from"./BindParameters.js";import{DepthRange as g}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as v,shadowCastDisableElevationMax as w,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as F}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as x}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as R,ShadowCastAccumulateIndex as A}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{PixelFormat as j,SizedPixelFormat as P,PixelType as D,TextureWrapMode as T,FramebufferBit as E}from"../../../webgl/enums.js";import{FramebufferObject as q}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as M}from"../../../webgl/TextureDescriptor.js";import{vertexCount as O}from"../../../webgl/Util.js";let L=class extends t{constructor(e,t,r,i,s,c){super({}),this.fbos=e,this._techniques=t,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=c,this._primarySet=new G(new R(A.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new G(new R(A.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new p,this._depthRange=g.zero,this._previewing=!1,this._cameraForcedForScreenshot=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=e.rctx,this._bindParameters=new d(new F(e,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new b(t,this._rctx,this,c);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(C.SHADOW_ACCUMULATOR,this),o((()=>r.renderView),(e=>{this.removeHandles(k),null!=e&&this.addHandles(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),k)}),a),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),n),o((()=>this._pixelFormat),(()=>this._pixelFormatChanged()),n)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(t)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const e of this._accumulationSets())e.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this._active&&this._previewing||this._refining}get _refining(){return this._active&&!this._doneAccumulating&&!this._previewing}get _active(){return null!=this._fbo&&[...this._accumulationSets()].some((e=>e.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==g.zero&&this._opacityFromElevation>v}get _doneAccumulating(){return[...this._accumulationSets()].every((e=>e.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get _numActive(){return[...this._accumulationSets()].reduce(((e,t)=>e+(t.active?1:0)),0)}get _pixelFormat(){return 1===this._numActive?{pixelFormat:j.RED,internalFormat:P.R8}:{pixelFormat:j.RG,internalFormat:P.RG8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((e=>e.running))}runTask(e){this._prepareForShadowMapPass(this._bindParameters);let t=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,e)&&(t=!0);t&&this._requestRender()}_runTaskForSet(e,t){let r=!1;for(;!t.done&&!e.doneAccumulating;)this._accumulateShadow(e),t.madeProgress(),r=!0;return r}renderAccumulation(e,t,r,i){if(this._depthRange=t,this._updateCamera(r),this._bindParameters.contentCamera=i,this._bindParameters.depth=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.accumulating||!this.canAccumulate)return!1;(this._previewing||[...this._accumulationSets()].every((e=>0===e.progress))||this._cameraForcedForScreenshot)&&this._clear();const s=this._accumulateSets();return this._cameraForcedForScreenshot=!1,s}_accumulateSets(){let e=!1;for(const t of this._accumulationSets())this._accumulateSet(t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSet(e){let t=this._cameraForcedForScreenshot?e.sampleCount:Math.min(U,e.sampleCount);t-=e.progress;for(let r=0;r<t;++r)this._accumulateShadow(e);return t>0}precompile(){this._accumulationRenderer.precompile()}render(e){this._accumulationRenderer.render(e)}setOptions(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const r=this._primarySet.progress;return!this._active||!this._fbo||r<1||e<0||e>=this._fbo.width||t<0||t>=this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,j.RGBA,D.UNSIGNED_BYTE,I),I[A.PRIMARY]/r)}_pixelFormatChanged(){const e=this._fbo?.colorTexture;if(!e)return;const{pixelFormat:t,internalFormat:r}=this._pixelFormat,{descriptor:i}=e;i.pixelFormat===t&&i.internalFormat===r||this._recreateFBO()}_recreateFBO(){this._disable(),this._enable()}_enable(){if(this._fbo)return;const{pixelFormat:e,internalFormat:t}=this._pixelFormat,r=new M;r.pixelFormat=e,r.internalFormat=t,r.wrapMode=T.CLAMP_TO_EDGE,this._fbo=new q(this._rctx,r);for(const i of this._accumulationSets())i.invalidate()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(E.COLOR);for(const e of this._accumulationSets())e.clear()}_accumulateShadow(e){this._renderToShadowMap(this._bindParameters,e.lightDirections[e.progress++],this._depthRange);const t=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(t,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(t.primitiveType,0,O(this._vao,"geometry"))}_updateCamera(e){const t=this._fbo;if(null==t)return;const r=this._bindParameters.camera;e.equals(r)||r.copyFrom(e),t.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-i(S,w,e.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};e([h()],L.prototype,"_fbo",void 0),e([h()],L.prototype,"_depthRange",void 0),e([h()],L.prototype,"_previewing",void 0),e([h()],L.prototype,"_accumulationRenderer",void 0),e([h()],L.prototype,"_refining",null),e([h()],L.prototype,"_active",null),e([h()],L.prototype,"canAccumulate",null),e([h()],L.prototype,"_doneAccumulating",null),e([h()],L.prototype,"_opacityFromElevation",null),e([h()],L.prototype,"_numActive",null),e([h()],L.prototype,"_pixelFormat",null),e([h()],L.prototype,"running",null),L=e([u("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],L);const U=6,k="renderView",I=new Uint8Array(4);class G{constructor(e,t){this.configuration=e,this._requestRender=t,this._cachedLightDirections=[],this._progress=c(0),this._sampleCount=c(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections;if(r(t,e,l))return;const i=Math.min(y,e.length);t.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)t[r]=m(t[r]??_(),e[r]);this.invalidate()}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}invalidate(){this.clear(),this._requestRender()}clear(){this.progress=0}precompile(e){e.precompile(x,this.configuration)}}export{L as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{disposeMaybe as e}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as r,c as o}from"../../../../chunks/vec42.js";import{createQuadVAO as n}from"./glUtil3D.js";import{S as h}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as d}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as _}from"../../../webgl/Util.js";const c=4e4,p=5e4,m=1/512;let u=class extends t{constructor(s,t,e,i){super({}),this._techniques=s,this._rctx=t,this._data=e,this._requestRender=i,this._passParameters=new h(this._data),this._configuration=new l,this._enabled=!1,this._vao=n(t)}dispose(){this._stop(),this._vao=e(this._vao)}precompile(){this._showVisualization&&this._techniques.precompile(d,this._configuration)}render(s){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const t=this._techniques.get(d,this._configuration);this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(t,s,this._passParameters),this._rctx.drawArrays(t.primitiveType,0,_(this._vao,"geometry"))}setOptions(s){void 0!==s.enabled&&this._setEnabled(s.enabled),void 0!==s.color&&this._setColor(s.color),void 0!==s.threshold&&(this._threshold=s.threshold),void 0!==s.visualization&&(this._visualization=s.visualization),void 0!==s.bandSize&&(this._bandSize=s.bandSize),void 0!==s.bandsEnabled&&(this._bandsEnabled=s.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(s){this._passParameters.opacityFromElevation!==s&&(this._passParameters.opacityFromElevation=s,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>m}get _threshold(){return this._passParameters.threshold}set _threshold(s){this._threshold!==s&&(this._passParameters.threshold=s,this._requestRenderIfEnabled())}get _visualization(){return this._configuration.visualization}set _visualization(s){s!==this._visualization&&(this._configuration.visualization=s,this._requestRenderIfEnabled())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(s){s!==this._bandSize&&(this._passParameters.bandSize=s,this._requestRenderIfEnabled())}get _bandsEnabled(){return this._configuration.bandsEnabled}set _bandsEnabled(s){s!==this._bandsEnabled&&(this._configuration.bandsEnabled=s,this._requestRenderIfEnabled())}_setColor(s){const t=this._passParameters.color;r(s,t)||(o(this._passParameters.color,s),this._requestRenderIfEnabled())}_setEnabled(s){s!==this._enabled&&(s?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};s([i()],u.prototype,"opacityFromElevation",null),u=s([a("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],u);export{u as ShadowCastRenderer,p as shadowCastDisableElevationMax,c as shadowCastDisableElevationMin,m as shadowCastDisabledElevationThreshold};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Accessor.js";import{disposeMaybe as t}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{a,c as o}from"../../../../chunks/vec42.js";import{createQuadVAO as h}from"./glUtil3D.js";import{S as n}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as d}from"../shaders/ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as l}from"../shaders/ShadowCastVisualizeTechniqueConfiguration.js";import{vertexCount as _}from"../../../webgl/Util.js";const p=4e4,m=5e4,c=1/512;let u=class extends s{constructor(e,s,t,i){super({}),this._techniques=e,this._rctx=s,this._data=t,this._requestRender=i,this._passParameters=new n(this._data),this._configuration=new l,this._enabled=!1,this._vao=h(s)}dispose(){this._stop(),this._vao=t(this._vao)}precompile(){this._showVisualization&&this._techniques.precompile(d,this._configuration)}render(e){if(!this._showVisualization)return;this._passParameters.sampleScale=[1/this._data.computedSamples[0],1/this._data.computedSamples[1]];const s=this._techniques.get(d,this._configuration);this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(s,e,this._passParameters),this._rctx.drawArrays(s.primitiveType,0,_(this._vao,"geometry"))}setOptions(e){void 0!==e.enabled&&this._setEnabled(e.enabled),void 0!==e.thresholdColor&&this._setThresholdColor(e.thresholdColor),void 0!==e.gradientColor&&this._setGradientColor(e.gradientColor),void 0!==e.bandedGradientColor&&this._setBandedGradientColor(e.bandedGradientColor),void 0!==e.threshold&&(this._threshold=e.threshold),void 0!==e.visualization&&(this._visualization=e.visualization),void 0!==e.bandSize&&(this._bandSize=e.bandSize)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&(this._data.computedSamples[0]>0||this._data.computedSamples[1]>0)&&this.opacityFromElevation>c}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfEnabled())}get _visualization(){return this._configuration.visualization}set _visualization(e){e!==this._visualization&&(this._configuration.visualization=e,this._requestRenderIfEnabled())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfEnabled())}_setThresholdColor(e){const s=this._passParameters.thresholdColor;a(e,s)||(o(this._passParameters.thresholdColor,e),this._requestRenderIfEnabled())}_setGradientColor(e){const s=this._passParameters.gradientColor;a(e,s)||(o(this._passParameters.gradientColor,e),this._requestRenderIfEnabled())}_setBandedGradientColor(e){const s=this._passParameters.bandedGradientColor;a(e,s)||(o(this._passParameters.bandedGradientColor,e),this._requestRenderIfEnabled())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfEnabled(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};e([i()],u.prototype,"opacityFromElevation",null),u=e([r("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],u);export{u as ShadowCastRenderer,m as shadowCastDisableElevationMax,p as shadowCastDisableElevationMin,c as shadowCastDisabledElevationThreshold};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"./ReadShadowMapConfiguration.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastMaxSamples,b as build}from"../../../../chunks/ShadowCastAccumulate.glsl.js";
5
+ import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Matrix4BindUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"./ReadShadowMapConfiguration.js";import"./ShadowCastAccumulateTechniqueConfiguration.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastMaxSamples,b as build}from"../../../../chunks/ShadowCastAccumulate.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{PrimitiveType as i}from"../../../webgl/enums.js";import{makePipelineState as o,add as s,defaultColorWrite as l}from"../../../webgl/renderState.js";class a extends r{constructor(r,o){super(r,o,new e(t,(()=>import("./ShadowCastAccumulate.glsl.js")))),this.primitiveType=i.TRIANGLE_STRIP}initializePipeline(){return o({blending:s,colorWrite:l,depthTest:null,depthWrite:null})}}export{a as ShadowCastAccumulateTechnique};
5
+ import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateIndex as i}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{PrimitiveType as o}from"../../../webgl/enums.js";import{makePipelineState as s,add as a}from"../../../webgl/renderState.js";class n extends r{constructor(r,i){super(r,i,new e(t,(()=>import("./ShadowCastAccumulate.glsl.js")))),this.primitiveType=o.TRIANGLE_STRIP}initializePipeline(e){const r={r:e.index===i.PRIMARY,g:e.index===i.CONTEXT,b:!1,a:!1};return s({blending:a,colorWrite:r,depthTest:null,depthWrite:null})}}export{n as ShadowCastAccumulateTechnique};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{parameter as o,ShaderTechniqueConfiguration as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";var r;!function(e){e[e.PRIMARY=0]="PRIMARY",e[e.CONTEXT=1]="CONTEXT",e[e.COUNT=2]="COUNT"}(r||(r={}));class s extends i{constructor(e){super(),this.index=r.PRIMARY,this.index=e}}e([o({count:r.COUNT})],s.prototype,"index",void 0);export{r as ShadowCastAccumulateIndex,s as ShadowCastAccumulateTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/ShadowCastAccumulate.glsl.js";import"./ShadowCastVisualizeTechniqueConfiguration.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../chunks/ShadowCastVisualize.glsl.js";
5
+ import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js";import"../core/shaderLibrary/util/CameraSpace.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/ShadowCastAccumulate.glsl.js";import"./ShadowCastVisualizeTechniqueConfiguration.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../chunks/ShadowCastVisualize.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{PrimitiveType as s}from"../../../webgl/enums.js";import{makePipelineState as t,unpremultipliedAlphaToPremultipliedAlpha as o,defaultColorWrite as l}from"../../../webgl/renderState.js";class a extends r{constructor(r,t){super(r,t,new e(i,(()=>import("./ShadowCastVisualize.glsl.js")))),this.primitiveType=s.TRIANGLE_STRIP}initializePipeline(){return t({blending:o,colorWrite:l,depthTest:null,depthWrite:null})}}export{a as ShadowCastVisualizeTechnique};
5
+ import{ReloadableShaderModule as e}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../chunks/ShadowCastVisualize.glsl.js";import{PrimitiveType as s}from"../../../webgl/enums.js";import{makePipelineState as t,premultipliedAlpha as o,defaultColorWrite as l}from"../../../webgl/renderState.js";class a extends r{constructor(r,t){super(r,t,new e(i,(()=>import("./ShadowCastVisualize.glsl.js")))),this.primitiveType=s.TRIANGLE_STRIP}initializePipeline(){return t({blending:o,colorWrite:l,depthTest:null,depthWrite:null})}}export{a as ShadowCastVisualizeTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../../chunks/tslib.es6.js";import{parameter as e,ShaderTechniqueConfiguration as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";var t;!function(o){o[o.Gradient=0]="Gradient",o[o.Threshold=1]="Threshold",o[o.COUNT=2]="COUNT"}(t||(t={}));class r extends i{constructor(){super(...arguments),this.visualization=t.Gradient,this.bandsEnabled=!1}}o([e({count:t.COUNT})],r.prototype,"visualization",void 0),o([e()],r.prototype,"bandsEnabled",void 0);export{t as ShadowCastVisualization,r as ShadowCastVisualizeTechniqueConfiguration};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{parameter as r,ShaderTechniqueConfiguration as i}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";var n;!function(e){e[e.Gradient=0]="Gradient",e[e.BandedGradient=1]="BandedGradient",e[e.Threshold=2]="Threshold",e[e.ThresholdAndGradient=3]="ThresholdAndGradient",e[e.COUNT=4]="COUNT"}(n||(n={}));class t extends i{constructor(){super(...arguments),this.visualization=n.Gradient}}e([r({count:n.COUNT})],t.prototype,"visualization",void 0);export{n as ShadowCastVisualization,t as ShadowCastVisualizeTechniqueConfiguration};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as p}from"../chunks/tslib.es6.js";import{createTask as e}from"../core/asyncUtils.js";import t from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{throwIfAborted as i,wrapAbortWithTimeout as s,allSettledValues as r,createResolver as a}from"../core/promiseUtils.js";import{watch as u,syncAndInitial as n,whenOnce as c}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as d}from"./input/InputManager.js";function m(p){return null!=p&&"open"in p&&"declaredClass"in p}function y(p){return null!=p&&"declaredClass"in p&&"dockOptions"in p}const f=a=>{let f=class extends a{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([u((()=>[this.ui,this.popup]),(([p,e],t)=>{const o="popup",i="manual";if(t){const[p,i]=t;p&&m(i)&&(i.view=null,y(i)&&(p.remove(i,o),i!==e&&e&&i.destroy()))}p&&m(e)&&(e.view=this,y(e)&&p.add(e,{key:o,position:i,internal:!0}))}),n),this.on("click",(p=>{this.popup&&this.popupEnabled&&("mouse"!==p.pointerType||0===p.button)&&(m(this.popup)?this.popup.viewModel.handleViewClick(p):p.async((async()=>{await this.setupPopup(),m(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(p)})))}),d.WIDGET)]),c((()=>this.ready&&this.popupEnabled&&!this.updating)).then((()=>{import("../widgets/Popup.js")}))}destroy(){this.destroyed||this.closePopup()}async openPopup(p){if(m(this.popup))return this.popup.open(p);try{if(await this.setupPopup(),!this.popup)return void o.getLogger(this).error(new t("view:null-popup","Popup is null and can't be opened"));this.popup.open(p)}catch{}}closePopup(){this._popupSetupTask?.abort(),m(this.popup)&&this.popup.close()}async fetchPopupFeatures(p,e){return await this.when(),this._popupHitsToFeatures(await this._getPopupHits(p,e),e)}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!m(this.popup))return this._popupSetupTask=e((async p=>{const{default:e}=await import("../widgets/Popup.js");if(i(p),!this.popup||m(this.popup))return;const t=this.popup;delete t.open,delete t.close,this.popup=new e(t)})),this._popupSetupTask.promise}async _popupHitsToFeatures({location:p,hits:e},t){const o=[],i=[];let a=!1;const u=s(t,has("popup-view-fetch-timeout")??P),n=p=>{const e=new w(p);return i.push(e),o.push(e.promise),e},c=p=>{const e=i.at(-1);return e&&e.layerView===p&&!a?e:n(p)};for(const s of e)if("graphic"in s){c(s.layerView).graphics.push(s.graphic),a=!1}else o.push(s.layerView.fetchPopupFeaturesAtLocation(s.mapPoint,u)),a=!0;i.map((p=>p.resolve(u)));const h=r(o).then((p=>p.filter((p=>!!p)).flat()));return{pendingFeatures:o,allGraphicsPromise:h,location:p}}async _getPopupHits(p,e){const{hits:t,location:o}=await this.popupHitTest(p);i(e);const s=[];for(const i of t)if("graphic"in i){if(this._isValidPopupGraphic(i.graphic,e)){const p=this._isValidPopupGraphicsLayerView(i.layerView)?i.layerView:void 0;s.push({graphic:i.graphic,layerView:p})}}else this._isValidPopupLocationLayerView(i.layerView)&&s.push({mapPoint:i.mapPoint,layerView:i.layerView});return{hits:s,location:o}}_isValidPopupGraphic(p,e){return p&&!!p.getEffectivePopupTemplate(e?.defaultPopupTemplateEnabled)}_isValidPopupGraphicsLayerView(p){return!p||(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesFromGraphics"in p}_isValidPopupLocationLayerView(p){return(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesAtLocation"in p}};return p([h()],f.prototype,"popup",void 0),p([h()],f.prototype,"popupEnabled",void 0),f=p([l("esri.views.PopupView")],f),f};class w{constructor(p){this.layerView=p,this._resolver=a(),this.graphics=[]}get promise(){return this._resolver.promise}resolve(p){const{layerView:e,graphics:t,_resolver:o}=this;if(!e)return o.resolve(t),o.promise;let i;return e.fetchPopupFeaturesFromGraphics(t,p).catch((p=>(i=p,null))).then((p=>{p?o.resolve(p):o.reject(i)})),o.promise}}const P=5e3;export{f as PopupView};
5
+ import{_ as p}from"../chunks/tslib.es6.js";import{createTask as e}from"../core/asyncUtils.js";import t from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{throwIfAborted as i,wrapAbortWithTimeout as s,allSettledValues as r,createResolver as a}from"../core/promiseUtils.js";import{watch as u,syncAndInitial as n,whenOnce as c}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as d}from"./input/InputManager.js";function m(p){return null!=p&&"open"in p&&"declaredClass"in p}function f(p){return null!=p&&"declaredClass"in p&&"dockOptions"in p}const w=a=>{let w=class extends a{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([u((()=>[this.ui,this.popup]),(([p,e],t)=>{const o="popup",i="manual";if(t){const[p,i]=t;p&&m(i)&&(i.view=null,f(i)&&(p.remove(i,o),i!==e&&e&&i.destroy()))}p&&m(e)&&(e.view=this,f(e)&&p.add(e,{key:o,position:i,internal:!0}))}),n),this.on("click",(p=>{this.popup&&this.popupEnabled&&("mouse"!==p.pointerType||0===p.button)&&(m(this.popup)?this.popup.viewModel.handleViewClick(p):p.defer((async()=>{await this.setupPopup(),m(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(p)})))}),d.WIDGET)]),c((()=>this.ready&&this.popupEnabled&&!this.updating)).then((()=>{import("../widgets/Popup.js")}))}destroy(){this.destroyed||this.closePopup()}async openPopup(p){if(m(this.popup))return this.popup.open(p);try{if(await this.setupPopup(),!this.popup)return void o.getLogger(this).error(new t("view:null-popup","Popup is null and can't be opened"));this.popup.open(p)}catch{}}closePopup(){this._popupSetupTask?.abort(),m(this.popup)&&this.popup.close()}async fetchPopupFeatures(p,e){return await this.when(),this._popupHitsToFeatures(await this._getPopupHits(p,e),e)}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!m(this.popup))return this._popupSetupTask=e((async p=>{const{default:e}=await import("../widgets/Popup.js");if(i(p),!this.popup||m(this.popup))return;const t=this.popup;delete t.open,delete t.close,this.popup=new e(t)})),this._popupSetupTask.promise}async _popupHitsToFeatures({location:p,hits:e},t){const o=[],i=[];let a=!1;const u=s(t,has("popup-view-fetch-timeout")??P),n=p=>{const e=new y(p);return i.push(e),o.push(e.promise),e},c=p=>{const e=i.at(-1);return e&&e.layerView===p&&!a?e:n(p)};for(const s of e)if("graphic"in s){c(s.layerView).graphics.push(s.graphic),a=!1}else o.push(s.layerView.fetchPopupFeaturesAtLocation(s.mapPoint,u)),a=!0;i.map((p=>p.resolve(u)));const h=r(o).then((p=>p.filter((p=>!!p)).flat()));return{pendingFeatures:o,allGraphicsPromise:h,location:p}}async _getPopupHits(p,e){const{hits:t,location:o}=await this.popupHitTest(p);i(e);const s=[];for(const i of t)if("graphic"in i){if(this._isValidPopupGraphic(i.graphic,e)){const p=this._isValidPopupGraphicsLayerView(i.layerView)?i.layerView:void 0;s.push({graphic:i.graphic,layerView:p})}}else this._isValidPopupLocationLayerView(i.layerView)&&s.push({mapPoint:i.mapPoint,layerView:i.layerView});return{hits:s,location:o}}_isValidPopupGraphic(p,e){return p&&!!p.getEffectivePopupTemplate(e?.defaultPopupTemplateEnabled)}_isValidPopupGraphicsLayerView(p){return!p||(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesFromGraphics"in p}_isValidPopupLocationLayerView(p){return(!("layer"in p)||!p.suspended)&&"fetchPopupFeaturesAtLocation"in p}};return p([h()],w.prototype,"popup",void 0),p([h()],w.prototype,"popupEnabled",void 0),w=p([l("esri.views.PopupView")],w),w};class y{constructor(p){this.layerView=p,this._resolver=a(),this.graphics=[]}get promise(){return this._resolver.promise}resolve(p){const{layerView:e,graphics:t,_resolver:o}=this;if(!e)return o.resolve(t),o.promise;let i;return e.fetchPopupFeaturesFromGraphics(t,p).catch((p=>(i=p,null))).then((p=>{p?o.resolve(p):o.reject(i)})),o.promise}}const P=5e3;export{w as PopupView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeGroupLayer as f,isSubtypeSublayer as g}from"../layers/support/layerUtils.js";import m from"../rest/support/Query.js";import{isSelectableLayer as _}from"./support/selectionUtils.js";let y=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new i,this._trashCan=[],this._layerEditHandles=new i,this._vizTaskId=0,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new i;this.view.when().then((()=>{this.view.map&&(this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(_(t)&&!f(t)||g(t))&&e.add(t)})),this.sources=e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}async getSelectedFeatures(e,t={},s="layerView"){const{view:i,selections:o}=this,n=(void 0!==e?o.filter((t=>e.includes(t.layer))):o).filter((e=>e.selection.length>0)).map((async e=>{const{layer:o,selection:n}=e,l=g(o)?o.parent:o;if(null==l||!S(l))return null;if("layer"===s)return M(l,n,t);if(v(l))return null;const r=await i.whenLayerView(l).catch((()=>null));return r?M(r,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let i=!1;const o=e.current.concat(e.added);for(const t of o){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(_(e)||g(e))&&null!==o){const t=l(s,e,(()=>[]));t.includes(o)||(t.push(o),i=!0)}}for(const t of e.removed){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(_(e)||g(e))&&null!==o){const t=s.get(e),n=t?.indexOf(o);void 0!==n&&n>=0&&(t?.splice(n,1),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,l]of s){const s=e.get(n);void 0!==s&&i.push(s),e.set(n,{selection:l}),o.push({layer:n,selection:l,...t(void 0!==s?s.selection:[],l)})}this._onSelectionChange(o)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),i=void 0!==s?[...s.selection]:[];for(const o of t)i.includes(o)||i.push(o);this._setSelection(e,i)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[];for(const o of s.selection)t.includes(o)||i.push(o);this._setSelection(e,i)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const i=new Set(s.selection),o=new Set(t),n=u(i,o);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:i}=this,o=this._vizTaskId;for(const n of e){const e=s.get(n),l=g(n)?n.parent:n;if(null!=l&&S(l)){if(v(l))continue;t.whenLayerView(l).then((t=>{e?.highlightHandle?.remove(),null!=e&&i&&o===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources){const t=g(e)?e.parent:e;if(null!=t&&_(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const i=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,i)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(void 0===i||!j(i,{selection:s})){void 0!==i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...s]});const o={layer:e,selection:[...s],...t(void 0!==i?i.selection:[],s)};this._onSelectionChange([o])}}};e([d({readOnly:!0,nonNullable:!0})],y.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"hasSelection",null),e([d()],y.prototype,"showHighlight",void 0),e([d()],y.prototype,"sources",null),e([d()],y.prototype,"highlightName",void 0),y=e([p("esri.views.SelectionManager")],y);const v=e=>g(e)?!0===e.parent?.isTable:e.isTable,w=e=>void 0!==e.layer,S=e=>void 0!==e?.when,j=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},M=async(e,t,s={})=>{let i;if(w(e)){const o=e;i=void 0===o?null:await o.queryFeatures(new m({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const o=e;i=void 0===o?null:await o.queryFeatures(new m({...s,objectIds:t})).then((e=>({data:e,layer:o})))}return i},b=y;export{b as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as f,isKnowledgeGraphLayer as g,isMapImageLayer as m,isSubtypeGroupLayer as _}from"../layers/support/layerUtils.js";import y from"../rest/support/Query.js";import{isSelectableLayer as v}from"./support/selectionUtils.js";let w=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]),this.view.when().then((()=>this.syncSources()))}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,{map:t}=this.view;if(!t)return;const s=t=>{g(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):m(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):_(t)?t.sublayers?.forEach(s):v(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this,n=(void 0!==e?i.filter((t=>e.includes(t.layer))):i).filter((e=>e.selection.length>0)).map((async e=>{const{layer:i,selection:n}=e,r=f(i)?i.parent:i;if(null==r||!b(r))return null;if("layer"===s)return E(r,n,t);if(S(r))return null;const l=await o.whenLayerView(r).catch((()=>null));return l?E(l,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(v(e)||f(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(v(e)||f(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=u(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=f(n)?n.parent:n;if(null!=r&&b(r)){if(S(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);for(const e of this.sources){const t=f(e)?e.parent:e;if(null!=t&&v(t)&&"on"in t&&t.on){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([d({readOnly:!0,nonNullable:!0})],w.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],w.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],w.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],w.prototype,"hasSelection",null),e([d()],w.prototype,"showHighlight",void 0),e([d()],w.prototype,"sources",null),e([d()],w.prototype,"highlightName",void 0),w=e([p("esri.views.SelectionManager")],w);const S=e=>f(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,b=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},E=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new y({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new y({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},C=w;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as i}from"../../core/maybe.js";import{onAbort as n,ignoreAbortErrors as e,throwIfAborted as r,isAbortError as a}from"../../core/promiseUtils.js";import{whenOnce as l,watch as s,syncAndInitial as c,on as m}from"../../core/reactiveUtils.js";function u(t,e){t.interactive=!0;const{tool:r,view:a}=t;a.activeTool=r;let s=n(e,(()=>{a.activeTool===r&&(a.activeTool=null)}));return o((async o=>{await l((()=>null==r||!r.active),o),s=i(s)}),e)}function v(o,t){return s((()=>o.interactive),(()=>f(o,t)),c)}function f(o,t){o.interactive?p(o,t):w(o)}function p(o,t){w(o);const{view:i,analysis:n}=o,e=new t({view:i,analysis:n,analysisViewData:o});return o.tool=e,i.tools.add(e),e}function w(o){const{view:t,tool:i}=o;null!=i&&(t.tools.remove(i),o.tool=null)}function y(i,n){const{userOperation:l}=i;return o((async o=>{if(l){const t=e(l.promise);l?.abort(),await t,r(o)}const n=u(i,{signal:o}),{analysis:s}=i,c=()=>!s.valid,v=t([m((()=>i.tool),"cancel",(()=>{c()&&n.abort()}))]);try{await n.promise}catch(f){if(!a(f)||c())throw f}finally{v?.remove()}}),n)}export{u as activateAnalysisViewTool,v as connectAnalysisViewToTool,w as removeAnalysisViewTool,y as startExclusiveInteractiveOperation};
5
+ import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as i}from"../../core/maybe.js";import{onAbort as e,ignoreAbortErrors as n,throwIfAborted as r,isAbortError as a}from"../../core/promiseUtils.js";import{whenOnce as l,watch as s,syncAndInitial as c,on as m}from"../../core/reactiveUtils.js";function u(t,n){t.interactive=!0;const{tool:r,view:a}=t;a.activeTool=r;let s=e(n,(()=>{a.activeTool===r&&(a.activeTool=null)}));return o((async o=>{await l((()=>null==r||!r.active),o),s=i(s)}),n)}function v(o,t){return s((()=>o.interactive),(()=>f(o,t)),c)}function f(o,t){o.interactive?p(o,t):w(o)}function p(o,t){w(o);const{view:i,analysis:e}=o,n=new t({view:i,analysis:e,analysisViewData:o});return o.tool=n,i.tools.add(n),n}function w(o){const{view:t,tool:i}=o;null!=i&&(t.tools.remove(i),o.tool=null)}function y(i,e){const{userOperation:l}=i;return o((async o=>{if(l){const t=n(l.promise);l?.abort(),await t,r(o)}const e=u(i,{signal:o}),{analysis:s}=i,c=()=>!s.valid,v=t([m((()=>i.tool),"cancel",(()=>{c()&&e.abort()}))]);try{i.tool?.resetCreated(),await e.promise}catch(f){if(!a(f)||c())throw f}finally{v?.remove()}}),e)}export{u as activateAnalysisViewTool,v as connectAnalysisViewToTool,w as removeAnalysisViewTool,y as startExclusiveInteractiveOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import"../../core/has.js";import i from"../../core/Logger.js";import r from"../../core/Queue.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{primaryKey as o,isSystemModifier as a}from"./keys.js";import{LatestPointer as l}from"./handlers/LatestPointer.js";import{MultiTouch as h}from"./handlers/MultiTouch.js";import{PropertiesPool as p}from"../support/PropertiesPool.js";let d=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=o,this._latestPointerType="mouse",this._propertiesPool=new p({latestPointerLocation:P},this),this.latestPointerLocation=null,this._paused=!1,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some((e=>e.handler.hasPendingInputs))}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,i=_.INTERNAL){if(this._nameToGroup[e])return;if(0===t.length)return;const r={name:e,handlers:t.map((e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null})))};this._nameToGroup[e]=r;for(let n=r.handlers.length-1;n>=0;n--){const e=r.handlers[n];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,i,r,n,s)=>{this._emitInputEvent(e.priorityIndex+1,t,i,r,s,n)},setPointerCapture:(t,i)=>{this._setPointerCapture(r,e,t,i)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach((e=>{e.removed=!0,e.uninstallCallback?.()})),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):i.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}isModifierKeyDown(e){return this._activeKeyModifiers.has(e)}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let i=this._handlers.length-1;i>=0;i--){const e=this._handlers[i];e.priorityIndex=i,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let i=this._handlersPriority.length-1;i>=0;i--){const r=this._handlersPriority[i];r.priorityIndex=i;let n=r.handler.hasSideEffects;if(!n)for(const t of r.handler.outgoingEventTypes)if(e.has(t)){n=!0;break}if(n)for(const i of r.handler.incomingEventMatches){e.add(i.eventType);for(const e of i.keyModifiers)a(e)||t.add(e)}r.active=n}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,i){this._latestPointerType=e;const r=this._get("latestPointerLocation");if(null==r||r.x!==t||r.y!==i){const e=this._propertiesPool.get("latestPointerLocation");e.x=t,e.y=i,this._set("latestPointerLocation",e)}}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const i=null!=this.test.timestamp?this.test.timestamp:t.native?t.native.timestamp:void 0,r=t.native?t.native.cancelable:void 0;this._emitInputEventFromSource(e,t,i,r)}_updateKeyModifiers(e,t){if(!t)return;let i=!1;const r=()=>{i||(this._activeKeyModifiers=new Set(this._activeKeyModifiers),i=!0)},n=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(r(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(r(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const i=t.key;this._keyModifiers.has(i)&&n(i,"key-down"===e)}const s=t.native;n("Alt",!!s?.altKey),n("Control",!!s?.ctrlKey),n("Ctrl",!!s?.ctrlKey),n("Shift",!!s?.shiftKey),n("Meta",!!s?.metaKey),n("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new l(((e,t,i)=>this._setLatestPointer(e,t,i))),this._multiTouchHandler=new h,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],_.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,_.INTERNAL)}_setPointerCapture(e,t,i,r){const n=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(i.pointerId)||new Set;this._pointerCaptures.set(i.pointerId,s),r?(s.add(n),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(i,!0)):s.has(n)&&(s.delete(n),0===s.size&&(this._pointerCaptures.delete(i.pointerId),this.eventSource&&this.eventSource.setPointerCapture(i,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter((e=>!e.removed)),this.updateDependencies()}_emitInputEventFromSource(e,t,i,r){this._emitInputEvent(0,e,t,i,r)}_emitInputEvent(e,t,i,r,n,s){const o=void 0!==r?r:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),a=void 0!==n&&n,l={event:new u(t,i,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new r,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:t,priorityIndex:i}=e.events.pop(),r=t.data?.eventId;if(!(null!=r&&this._stoppedPropagationEventIds.has(r)))for(e.currentHandler=this._handlersPriority[i];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){null!=r&&this._stoppedPropagationEventIds.add(r);break}if(t.shouldPausePropagation((()=>this._continuePropagation())))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new r;t.push(e);const i=this._currentPropagation;if(i){for(;i.events.length;)t.push(i.events.pop());i.events=t,i.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const i of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(i.eventType!==e.eventType)continue;const t=i.keyModifiers.filter((t=>e.keyModifiers.includes(t)));if(t.length===i.keyModifiers.length!==(t.length===e.keyModifiers.length))return i.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const i of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(i,t[e])>=0;)e++;t.splice(e,0,i)}return t}get debug(){const e=e=>{const t=this._setPointerCapture;this._setPointerCapture=()=>{},e(),this._setPointerCapture=t};return{injectEvent:(t,i)=>{e((()=>this._onEventReceived(t,i)))},disablePointerCapture:e}}};e([n({readOnly:!0})],d.prototype,"hasPendingInputs",null),e([n({constructOnly:!0})],d.prototype,"eventSource",void 0),e([n({constructOnly:!0})],d.prototype,"recognizers",void 0),e([n()],d.prototype,"_latestPointerType",void 0),e([n()],d.prototype,"latestPointerType",null),e([n()],d.prototype,"multiTouchActive",null),e([n({readOnly:!0})],d.prototype,"latestPointerLocation",void 0),e([n()],d.prototype,"_paused",void 0),e([n({readOnly:!0})],d.prototype,"updating",null),d=e([s("esri.views.input.InputManager")],d);class u{constructor(e,t,i,r,n){this.type=e,this.data=t,this.timestamp=i,this.modifiers=r,this.cancelable=n,this._propagationState=c.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=c.STOPPED}shouldStopPropagation(){return!!(this._propagationState&c.STOPPED)}async(e){this._propagationState|=c.PAUSED;const t=(e,t)=>{this._propagationState&=~c.PAUSED;const i=this._resumeCallback;if(this._resumeCallback=null,i&&i(),t)throw e;return e};return("function"==typeof e?e():e).then((e=>t(e,!1)),(e=>t(e,!0)))}shouldPausePropagation(e){return!!(this._propagationState&c.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}var c;!function(e){e[e.NONE=0]="NONE",e[e.STOPPED=1]="STOPPED",e[e.PAUSED=2]="PAUSED"}(c||(c={}));const _={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};class g{}const P=g;export{d as InputManager,_ as ViewEventPriorities};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import"../../core/has.js";import i from"../../core/Logger.js";import r from"../../core/Queue.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{primaryKey as o,isSystemModifier as a}from"./keys.js";import{LatestPointer as l}from"./handlers/LatestPointer.js";import{MultiTouch as h}from"./handlers/MultiTouch.js";import{PropertiesPool as p}from"../support/PropertiesPool.js";let d=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=o,this._latestPointerType="mouse",this._propertiesPool=new p({latestPointerLocation:P},this),this.latestPointerLocation=null,this._paused=!1,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some((e=>e.handler.hasPendingInputs))}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,i=_.INTERNAL){if(this._nameToGroup[e])return;if(0===t.length)return;const r={name:e,handlers:t.map((e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null})))};this._nameToGroup[e]=r;for(let n=r.handlers.length-1;n>=0;n--){const e=r.handlers[n];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,i,r,n,s)=>{this._emitInputEvent(e.priorityIndex+1,t,i,r,s,n)},setPointerCapture:(t,i)=>{this._setPointerCapture(r,e,t,i)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach((e=>{e.removed=!0,e.uninstallCallback?.()})),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):i.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}isModifierKeyDown(e){return this._activeKeyModifiers.has(e)}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let i=this._handlers.length-1;i>=0;i--){const e=this._handlers[i];e.priorityIndex=i,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let i=this._handlersPriority.length-1;i>=0;i--){const r=this._handlersPriority[i];r.priorityIndex=i;let n=r.handler.hasSideEffects;if(!n)for(const t of r.handler.outgoingEventTypes)if(e.has(t)){n=!0;break}if(n)for(const i of r.handler.incomingEventMatches){e.add(i.eventType);for(const e of i.keyModifiers)a(e)||t.add(e)}r.active=n}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,i){this._latestPointerType=e;const r=this._get("latestPointerLocation");if(null==r||r.x!==t||r.y!==i){const e=this._propertiesPool.get("latestPointerLocation");e.x=t,e.y=i,this._set("latestPointerLocation",e)}}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const i=null!=this.test.timestamp?this.test.timestamp:t.native?t.native.timestamp:void 0,r=t.native?t.native.cancelable:void 0;this._emitInputEventFromSource(e,t,i,r)}_updateKeyModifiers(e,t){if(!t)return;let i=!1;const r=()=>{i||(this._activeKeyModifiers=new Set(this._activeKeyModifiers),i=!0)},n=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(r(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(r(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const i=t.key;this._keyModifiers.has(i)&&n(i,"key-down"===e)}const s=t.native;n("Alt",!!s?.altKey),n("Control",!!s?.ctrlKey),n("Ctrl",!!s?.ctrlKey),n("Shift",!!s?.shiftKey),n("Meta",!!s?.metaKey),n("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new l(((e,t,i)=>this._setLatestPointer(e,t,i))),this._multiTouchHandler=new h,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],_.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,_.INTERNAL)}_setPointerCapture(e,t,i,r){const n=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(i.pointerId)||new Set;this._pointerCaptures.set(i.pointerId,s),r?(s.add(n),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(i,!0)):s.has(n)&&(s.delete(n),0===s.size&&(this._pointerCaptures.delete(i.pointerId),this.eventSource&&this.eventSource.setPointerCapture(i,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter((e=>!e.removed)),this.updateDependencies()}_emitInputEventFromSource(e,t,i,r){this._emitInputEvent(0,e,t,i,r)}_emitInputEvent(e,t,i,r,n,s){const o=void 0!==r?r:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),a=void 0!==n&&n,l={event:new u(t,i,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new r,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:t,priorityIndex:i}=e.events.pop(),r=t.data?.eventId;if(!(null!=r&&this._stoppedPropagationEventIds.has(r)))for(e.currentHandler=this._handlersPriority[i];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){null!=r&&this._stoppedPropagationEventIds.add(r);break}if(t.shouldPausePropagation((()=>this._continuePropagation())))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new r;t.push(e);const i=this._currentPropagation;if(i){for(;i.events.length;)t.push(i.events.pop());i.events=t,i.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const i of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(i.eventType!==e.eventType)continue;const t=i.keyModifiers.filter((t=>e.keyModifiers.includes(t)));if(t.length===i.keyModifiers.length!==(t.length===e.keyModifiers.length))return i.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const i of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(i,t[e])>=0;)e++;t.splice(e,0,i)}return t}get debug(){const e=e=>{const t=this._setPointerCapture;this._setPointerCapture=()=>{},e(),this._setPointerCapture=t};return{injectEvent:(t,i)=>{e((()=>this._onEventReceived(t,i)))},disablePointerCapture:e}}};e([n({readOnly:!0})],d.prototype,"hasPendingInputs",null),e([n({constructOnly:!0})],d.prototype,"eventSource",void 0),e([n({constructOnly:!0})],d.prototype,"recognizers",void 0),e([n()],d.prototype,"_latestPointerType",void 0),e([n()],d.prototype,"latestPointerType",null),e([n()],d.prototype,"multiTouchActive",null),e([n({readOnly:!0})],d.prototype,"latestPointerLocation",void 0),e([n()],d.prototype,"_paused",void 0),e([n({readOnly:!0})],d.prototype,"updating",null),d=e([s("esri.views.input.InputManager")],d);class u{constructor(e,t,i,r,n){this.type=e,this.data=t,this.timestamp=i,this.modifiers=r,this.cancelable=n,this._propagationState=c.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=c.STOPPED}shouldStopPropagation(){return!!(this._propagationState&c.STOPPED)}defer(e){this._propagationState|=c.PAUSED;const t=(e,t)=>{this._propagationState&=~c.PAUSED;const i=this._resumeCallback;if(this._resumeCallback=null,i&&i(),t)throw e;return e};return("function"==typeof e?e():e).then((e=>t(e,!1)),(e=>t(e,!0)))}shouldPausePropagation(e){return!!(this._propagationState&c.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}var c;!function(e){e[e.NONE=0]="NONE",e[e.STOPPED=1]="STOPPED",e[e.PAUSED=2]="PAUSED"}(c||(c={}));const _={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};class g{}const P=g;export{d as InputManager,_ as ViewEventPriorities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{makeHandle as t}from"../../core/handleUtils.js";import{rad2deg as e}from"../../core/mathUtils.js";import{createScreenPoint as n}from"../../core/screenUtils.js";import{InputHandler as a}from"./InputHandler.js";import{ViewEventPriorities as i}from"./InputManager.js";export{MouseButton}from"./IViewEvents.js";const r=["click","double-click","immediate-click","immediate-double-click","hold","drag","key-down","key-up","pointer-down","pointer-move","pointer-up","pointer-drag","mouse-wheel","pointer-enter","pointer-leave","gamepad","focus","blur"],o={};function s(t){return!!o[t]}function p(t){for(const e of t)if(!s(e))return!1;return!0}r.forEach((t=>{o[t]=!0}));class c{constructor(t){this._handlers=new Map,this._counter=0,this._handlerCounts=new Map,this.view=t,this.inputManager=null}connect(t){t&&this.disconnect(),this.inputManager=t,this._handlers.forEach((({handler:t,priority:e},n)=>this.inputManager?.installHandlers(n,[t],e)))}disconnect(){this.inputManager&&this._handlers.forEach(((t,e)=>this.inputManager?.uninstallHandlers(e))),this.inputManager=null}destroy(){this.disconnect(),this._handlers.clear(),this.view=null}on(e,n,a,r){const o=Array.isArray(e)?e:e.split(",");if(!p(o))return o.some(s)&&console.error("Error: registering input events and other events on the view at the same time is not supported."),null;let c,u;Array.isArray(n)?u=n:(c=n,u=[]),"function"==typeof a?c=a:r=a,r=null!=r?r:i.DEFAULT;const m=this._createUniqueGroupName(),d=new l(this.view,o,u,c);this._handlers.set(m,{handler:d,priority:r});for(const t of o){const e=this._handlerCounts.get(t)||0;this._handlerCounts.set(t,e+1)}return this.inputManager&&this.inputManager.installHandlers(m,[d],r),t((()=>this._removeHandler(m,o)))}hasHandler(t){return!!this._handlerCounts.get(t)}_removeHandler(t,e){if(this._handlers.has(t)){this._handlers.delete(t);for(const t of e){const e=this._handlerCounts.get(t);void 0===e||(1===e?this._handlerCounts.delete(t):this._handlerCounts.set(t,e-1))}}this.inputManager&&this.inputManager.uninstallHandlers(t)}_createUniqueGroupName(){return this._counter+=1,`viewEvents_${this._counter}`}}class l extends a{constructor(t,e,n,a){super(!0),this._latestDragStart=void 0,this.view=t;for(const i of e)switch(i){case"click":this.registerIncoming("click",n,(e=>a(d(t,e))));break;case"double-click":this.registerIncoming("double-click",n,(e=>a(g(t,e))));break;case"immediate-click":this.registerIncoming("immediate-click",n,(e=>a(y(t,e))));break;case"immediate-double-click":this.registerIncoming("immediate-double-click",n,(e=>a(v(t,e))));break;case"hold":this.registerIncoming("hold",n,(e=>a(h(t,e))));break;case"drag":this.registerIncoming("drag",n,(t=>{const e=this._wrapDrag(t);e&&a(e)}));break;case"key-down":this.registerIncoming("key-down",n,(t=>a(f(t))));break;case"key-up":this.registerIncoming("key-up",n,(t=>a(k(t))));break;case"pointer-down":this.registerIncoming("pointer-down",n,(t=>a(I(t,"pointer-down"))));break;case"pointer-move":this.registerIncoming("pointer-move",n,(t=>a(I(t,"pointer-move"))));break;case"pointer-up":this.registerIncoming("pointer-up",n,(t=>a(I(t,"pointer-up"))));break;case"pointer-drag":this.registerIncoming("pointer-drag",n,(t=>a(D(t))));break;case"mouse-wheel":this.registerIncoming("mouse-wheel",n,(t=>a(P(t))));break;case"pointer-enter":this.registerIncoming("pointer-enter",n,(t=>a(I(t,"pointer-enter"))));break;case"pointer-leave":this.registerIncoming("pointer-leave",n,(t=>a(I(t,"pointer-leave"))));break;case"gamepad":this.registerIncoming("gamepad",n,(t=>{a(_(t))}));break;case"focus":this.registerIncoming("focus",n,(t=>{a(u(t))}));break;case"blur":this.registerIncoming("blur",n,(t=>{a(m(t))}))}}_wrapDrag(t){const n=t.data,{x:a,y:i}=n.center,{action:r,pointerType:o,button:s}=n;if("start"===r&&(this._latestDragStart=n),!this._latestDragStart)return;const p=n.pointer.native,c=n.buttons,{cancelable:l,timestamp:u}=t,m={x:this._latestDragStart.center.x,y:this._latestDragStart.center.y};return"end"===r&&(this._latestDragStart=void 0),{type:"drag",action:r,x:a,y:i,origin:m,pointerType:o,button:s,buttons:c,radius:n.radius,angle:e(n.angle),native:p,timestamp:u,cancelable:l,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}}function u(t){return{type:"focus",timestamp:t.timestamp,native:t.data.native,cancelable:t.cancelable,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function m(t){return{type:"blur",timestamp:t.timestamp,native:t.data.native,cancelable:t.cancelable,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function d(t,e){const{pointerType:a,button:i,buttons:r,x:o,y:s,native:p,eventId:c}=e.data,{cancelable:l,timestamp:u}=e;return{type:"click",pointerType:a,button:i,buttons:r,x:o,y:s,native:p,timestamp:u,screenPoint:n(o,s),mapPoint:b(t,o,s),eventId:c,cancelable:l,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function g(t,e){const{pointerType:n,button:a,buttons:i,x:r,y:o,native:s,eventId:p}=e.data,{cancelable:c,timestamp:l}=e;return{type:"double-click",pointerType:n,button:a,buttons:i,x:r,y:o,native:s,timestamp:l,mapPoint:b(t,r,o),eventId:p,cancelable:c,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function y(t,e){const{pointerType:n,button:a,buttons:i,x:r,y:o,native:s,eventId:p}=e.data,c=s.pointerId,{cancelable:l,timestamp:u}=e;return{type:"immediate-click",pointerId:c,pointerType:n,button:a,buttons:i,x:r,y:o,native:s,timestamp:u,mapPoint:b(t,r,o),eventId:p,cancelable:l,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function v(t,e){const{pointerType:n,button:a,buttons:i,x:r,y:o,native:s,eventId:p}=e.data,c=s.pointerId,{cancelable:l,timestamp:u}=e;return{type:"immediate-double-click",pointerId:c,pointerType:n,button:a,buttons:i,x:r,y:o,native:s,timestamp:u,mapPoint:b(t,r,o),eventId:p,cancelable:l,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function h(t,e){const{pointerType:n,button:a,buttons:i,x:r,y:o,native:s}=e.data,{cancelable:p,timestamp:c}=e;return{type:"hold",pointerType:n,button:a,buttons:i,x:r,y:o,native:s,timestamp:c,mapPoint:b(t,r,o),cancelable:p,stopPropagation:()=>e.stopPropagation(),async:t=>e.async(t),preventDefault:()=>e.preventDefault()}}function b(t,e,a){return t.toMap(n(e,a),{exclude:[]})}function f(t){const{key:e,repeat:n,native:a}=t.data,{cancelable:i,timestamp:r}=t;return{type:"key-down",key:e,repeat:n,native:a,timestamp:r,cancelable:i,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function k(t){const{key:e,native:n}=t.data,{cancelable:a,timestamp:i}=t;return{type:"key-up",key:e,native:n,timestamp:i,cancelable:a,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function I(t,e){const{x:n,y:a,button:i,buttons:r,native:o,eventId:s}=t.data,p=o.pointerId,c=o.pointerType,{cancelable:l,timestamp:u}=t;return{type:e,x:n,y:a,pointerId:p,pointerType:c,button:i,buttons:r,native:o,timestamp:u,eventId:s,cancelable:l,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function D(t){const{x:e,y:n,buttons:a,native:i,eventId:r}=t.data.currentEvent,{button:o}=t.data.startEvent,s=t.data.startEvent.native.pointerId,p=t.data.startEvent.native.pointerType,c=t.data.action,l={x:t.data.startEvent.x,y:t.data.startEvent.y},{cancelable:u,timestamp:m}=t;return{type:"pointer-drag",x:e,y:n,pointerId:s,pointerType:p,button:o,buttons:a,action:c,origin:l,native:i,timestamp:m,eventId:r,cancelable:u,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function P(t){const{cancelable:e,data:n,timestamp:a}=t,{x:i,y:r,deltaY:o,native:s}=n;return{type:"mouse-wheel",x:i,y:r,deltaY:o,native:s,timestamp:a,cancelable:e,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}function _(t){const{action:e,state:n,device:a}=t.data,{cancelable:i,timestamp:r}=t,{buttons:o,axes:s}=n;return{type:"gamepad",device:a,timestamp:r,action:e,buttons:o,axes:s,cancelable:i,stopPropagation:()=>t.stopPropagation(),async:e=>t.async(e),preventDefault:()=>t.preventDefault()}}export{c as ViewEvents,r as eventTypes};
5
+ import"../../core/has.js";import{makeHandle as e}from"../../core/handleUtils.js";import{rad2deg as t}from"../../core/mathUtils.js";import{createScreenPoint as n}from"../../core/screenUtils.js";import{InputHandler as a}from"./InputHandler.js";import{ViewEventPriorities as r}from"./InputManager.js";export{MouseButton}from"./IViewEvents.js";const i=["click","double-click","immediate-click","immediate-double-click","hold","drag","key-down","key-up","pointer-down","pointer-move","pointer-up","pointer-drag","mouse-wheel","pointer-enter","pointer-leave","gamepad","focus","blur"],o={};function s(e){return!!o[e]}function p(e){for(const t of e)if(!s(t))return!1;return!0}i.forEach((e=>{o[e]=!0}));class c{constructor(e){this._handlers=new Map,this._counter=0,this._handlerCounts=new Map,this.view=e,this.inputManager=null}connect(e){e&&this.disconnect(),this.inputManager=e,this._handlers.forEach((({handler:e,priority:t},n)=>this.inputManager?.installHandlers(n,[e],t)))}disconnect(){this.inputManager&&this._handlers.forEach(((e,t)=>this.inputManager?.uninstallHandlers(t))),this.inputManager=null}destroy(){this.disconnect(),this._handlers.clear(),this.view=null}on(t,n,a,i){const o=Array.isArray(t)?t:t.split(",");if(!p(o))return o.some(s)&&console.error("Error: registering input events and other events on the view at the same time is not supported."),null;let c,u;Array.isArray(n)?u=n:(c=n,u=[]),"function"==typeof a?c=a:i=a,i=null!=i?i:r.DEFAULT;const d=this._createUniqueGroupName(),m=new l(this.view,o,u,c);this._handlers.set(d,{handler:m,priority:i});for(const e of o){const t=this._handlerCounts.get(e)||0;this._handlerCounts.set(e,t+1)}return this.inputManager&&this.inputManager.installHandlers(d,[m],i),e((()=>this._removeHandler(d,o)))}hasHandler(e){return!!this._handlerCounts.get(e)}_removeHandler(e,t){if(this._handlers.has(e)){this._handlers.delete(e);for(const e of t){const t=this._handlerCounts.get(e);void 0===t||(1===t?this._handlerCounts.delete(e):this._handlerCounts.set(e,t-1))}}this.inputManager&&this.inputManager.uninstallHandlers(e)}_createUniqueGroupName(){return this._counter+=1,`viewEvents_${this._counter}`}}class l extends a{constructor(e,t,n,a){super(!0),this._latestDragStart=void 0,this.view=e;for(const r of t)switch(r){case"click":this.registerIncoming("click",n,(t=>a(m(e,t))));break;case"double-click":this.registerIncoming("double-click",n,(t=>a(g(e,t))));break;case"immediate-click":this.registerIncoming("immediate-click",n,(t=>a(f(e,t))));break;case"immediate-double-click":this.registerIncoming("immediate-double-click",n,(t=>a(v(e,t))));break;case"hold":this.registerIncoming("hold",n,(t=>a(h(e,t))));break;case"drag":this.registerIncoming("drag",n,(e=>{const t=this._wrapDrag(e);t&&a(t)}));break;case"key-down":this.registerIncoming("key-down",n,(e=>a(y(e))));break;case"key-up":this.registerIncoming("key-up",n,(e=>a(k(e))));break;case"pointer-down":this.registerIncoming("pointer-down",n,(e=>a(I(e,"pointer-down"))));break;case"pointer-move":this.registerIncoming("pointer-move",n,(e=>a(I(e,"pointer-move"))));break;case"pointer-up":this.registerIncoming("pointer-up",n,(e=>a(I(e,"pointer-up"))));break;case"pointer-drag":this.registerIncoming("pointer-drag",n,(e=>a(D(e))));break;case"mouse-wheel":this.registerIncoming("mouse-wheel",n,(e=>a(P(e))));break;case"pointer-enter":this.registerIncoming("pointer-enter",n,(e=>a(I(e,"pointer-enter"))));break;case"pointer-leave":this.registerIncoming("pointer-leave",n,(e=>a(I(e,"pointer-leave"))));break;case"gamepad":this.registerIncoming("gamepad",n,(e=>{a(_(e))}));break;case"focus":this.registerIncoming("focus",n,(e=>{a(u(e))}));break;case"blur":this.registerIncoming("blur",n,(e=>{a(d(e))}))}}_wrapDrag(e){const n=e.data,{x:a,y:r}=n.center,{action:i,pointerType:o,button:s}=n;if("start"===i&&(this._latestDragStart=n),!this._latestDragStart)return;const p=n.pointer.native,c=n.buttons,{cancelable:l,timestamp:u}=e,d={x:this._latestDragStart.center.x,y:this._latestDragStart.center.y};return"end"===i&&(this._latestDragStart=void 0),{type:"drag",action:i,x:a,y:r,origin:d,pointerType:o,button:s,buttons:c,radius:n.radius,angle:t(n.angle),native:p,timestamp:u,cancelable:l,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}}function u(e){return{type:"focus",timestamp:e.timestamp,native:e.data.native,cancelable:e.cancelable,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function d(e){return{type:"blur",timestamp:e.timestamp,native:e.data.native,cancelable:e.cancelable,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function m(e,t){const{pointerType:a,button:r,buttons:i,x:o,y:s,native:p,eventId:c}=t.data,{cancelable:l,timestamp:u}=t;return{type:"click",pointerType:a,button:r,buttons:i,x:o,y:s,native:p,timestamp:u,screenPoint:n(o,s),mapPoint:b(e,o,s),eventId:c,cancelable:l,stopPropagation:()=>t.stopPropagation(),defer:e=>t.defer(e),preventDefault:()=>t.preventDefault()}}function g(e,t){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s,eventId:p}=t.data,{cancelable:c,timestamp:l}=t;return{type:"double-click",pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:l,mapPoint:b(e,i,o),eventId:p,cancelable:c,stopPropagation:()=>t.stopPropagation(),defer:e=>t.defer(e),preventDefault:()=>t.preventDefault()}}function f(e,t){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s,eventId:p}=t.data,c=s.pointerId,{cancelable:l,timestamp:u}=t;return{type:"immediate-click",pointerId:c,pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:u,mapPoint:b(e,i,o),eventId:p,cancelable:l,stopPropagation:()=>t.stopPropagation(),defer:e=>t.defer(e),preventDefault:()=>t.preventDefault()}}function v(e,t){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s,eventId:p}=t.data,c=s.pointerId,{cancelable:l,timestamp:u}=t;return{type:"immediate-double-click",pointerId:c,pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:u,mapPoint:b(e,i,o),eventId:p,cancelable:l,stopPropagation:()=>t.stopPropagation(),defer:e=>t.defer(e),preventDefault:()=>t.preventDefault()}}function h(e,t){const{pointerType:n,button:a,buttons:r,x:i,y:o,native:s}=t.data,{cancelable:p,timestamp:c}=t;return{type:"hold",pointerType:n,button:a,buttons:r,x:i,y:o,native:s,timestamp:c,mapPoint:b(e,i,o),cancelable:p,stopPropagation:()=>t.stopPropagation(),defer:e=>t.defer(e),preventDefault:()=>t.preventDefault()}}function b(e,t,a){return e.toMap(n(t,a),{exclude:[]})}function y(e){const{key:t,repeat:n,native:a}=e.data,{cancelable:r,timestamp:i}=e;return{type:"key-down",key:t,repeat:n,native:a,timestamp:i,cancelable:r,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function k(e){const{key:t,native:n}=e.data,{cancelable:a,timestamp:r}=e;return{type:"key-up",key:t,native:n,timestamp:r,cancelable:a,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function I(e,t){const{x:n,y:a,button:r,buttons:i,native:o,eventId:s}=e.data,p=o.pointerId,c=o.pointerType,{cancelable:l,timestamp:u}=e;return{type:t,x:n,y:a,pointerId:p,pointerType:c,button:r,buttons:i,native:o,timestamp:u,eventId:s,cancelable:l,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function D(e){const{x:t,y:n,buttons:a,native:r,eventId:i}=e.data.currentEvent,{button:o}=e.data.startEvent,s=e.data.startEvent.native.pointerId,p=e.data.startEvent.native.pointerType,c=e.data.action,l={x:e.data.startEvent.x,y:e.data.startEvent.y},{cancelable:u,timestamp:d}=e;return{type:"pointer-drag",x:t,y:n,pointerId:s,pointerType:p,button:o,buttons:a,action:c,origin:l,native:r,timestamp:d,eventId:i,cancelable:u,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function P(e){const{cancelable:t,data:n,timestamp:a}=e,{x:r,y:i,deltaY:o,native:s}=n;return{type:"mouse-wheel",x:r,y:i,deltaY:o,native:s,timestamp:a,cancelable:t,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}function _(e){const{action:t,state:n,device:a}=e.data,{cancelable:r,timestamp:i}=e,{buttons:o,axes:s}=n;return{type:"gamepad",device:a,timestamp:i,action:t,buttons:o,axes:s,cancelable:r,stopPropagation:()=>e.stopPropagation(),defer:t=>e.defer(t),preventDefault:()=>e.preventDefault()}}export{c as ViewEvents,i as eventTypes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- function e(e){return!!(null!=e&&"object"==typeof e&&"createQuery"in e&&e.createQuery&&"on"in e&&e.on)}export{e as isSelectableLayer};
5
+ function e(e){return!(null==e||"object"!=typeof e||!("createQuery"in e)||!e.createQuery)}export{e as isSelectableLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{AnalysisOriginWebScene as s}from"../../analysis/support/AnalysisOriginWebScene.js";import t from"../../core/Collection.js";import{castForReferenceSetter as i,referenceSetter as o}from"../../core/collectionUtils.js";import"../../core/Logger.js";import"../../core/has.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const r=["slice"];let a=class extends t{constructor(e){super(e),this.addHandles([this.on("after-add",(e=>{this._setOrigin(e.item)})),this.on("before-remove",(e=>{const{origin:s}=e.item;"web-scene"===s?.type&&this._setOrigin(e.item,null)}))])}initialize(){for(const e of this.items)this._setOrigin(e)}_setOrigin(e,t=new s){e.origin=t}updateFrom(e){const t=e.analyses.filter((e=>c(e)));this.removeAll(),t.length&&this.addMany(t.map((e=>(e.origin=new s,e.clone()))))}applyTo(e){e.analyses.destroyMany(e.analyses.filter((({origin:e})=>"web-scene"===e?.type))),e.analyses.addMany(this.map((e=>e.clone())))}toJSON(e){return this.items.filter(c).map((s=>s.toJSON(e)))}};function l(e){return{type:a,cast:i,set(s){this._set(e,o(s,this._get(e),a))},json:{read(s,t,i){i?.hooks?.onAfterLoad((()=>p(this[e],s,i)))},write:{overridePolicy:e=>({enabled:e.length>0})}}}}function c(e){return r.includes(e.type)&&e.valid}async function p(e,s,t){if(!s)return;const i=await Promise.allSettled(s.map((e=>m(e,t))));for(const o of i)"fulfilled"===o.status&&e.add(o.value)}async function m(e,s){const t=new(await d[e.type]());return t.read(e,s),t}a=e([n("esri.webscene.support.analysisUtils.WebSceneAnalysesCollection")],a);const d={slice:async()=>{const{default:e}=await import("../../analysis/SliceAnalysis.js");return e}};export{a as WebSceneAnalysesCollection,l as webSceneAnalysisCollectionProperty,d as webSceneAnalysisRegistry};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../analysis/support/AnalysisOriginWebScene.js";import t from"../../core/Collection.js";import{castForReferenceSetter as i,referenceSetter as o}from"../../core/collectionUtils.js";import"../../core/Logger.js";import"../../core/has.js";import"../../core/RandomLCG.js";import"../../core/Error.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const r=["slice"];let a=class extends t{constructor(e){super(e),this.addHandles([this.on("after-add",(e=>{this._setOrigin(e.item)})),this.on("before-remove",(e=>{const{origin:s}=e.item;"web-scene"===s?.type&&this._setOrigin(e.item,null)}))])}initialize(){for(const e of this.items)this._setOrigin(e)}_setOrigin(e,t=new s){e.origin=t}updateFrom(e){const t=e.analyses.filter((e=>c(e)));this.removeAll(),t.length&&this.addMany(t.map((e=>(e.origin=new s,e.clone()))))}applyTo(e){e.analyses.destroyMany(e.analyses.filter((({origin:e})=>"web-scene"===e?.type))),e.analyses.addMany(this.map((e=>e.clone())))}toJSON(e){return this.items.filter(c).map((s=>s.toJSON(e)))}};function l(e){return{type:a,cast:i,set(s){this._set(e,o(s,this._get(e),a))},json:{read(s,t,i){i?.hooks?.onAfterLoad((()=>p(this[e],s,i)))},write:{overridePolicy:e=>({enabled:e.length>0})}}}}function c(e){return r.includes(e.type)&&e.valid}async function p(e,s,t){if(!s)return;const i=await Promise.allSettled(s.map((e=>m(e,t))));for(const o of i)"fulfilled"===o.status&&e.add(o.value)}async function m(e,s){const t=new(await d[e.type]());return t.read(e,s),t}a=e([n("esri.webscene.support.analysisUtils.WebSceneAnalysesCollection")],a);const d={slice:async()=>{const{default:e}=await import("../../analysis/SliceAnalysis.js");return e}};export{a as WebSceneAnalysesCollection,l as webSceneAnalysisCollectionProperty,d as webSceneAnalysisRegistry};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/DirectLineMeasurementAnalysis.js";import{watch as i,syncAndInitial as s}from"../../core/reactiveUtils.js";import{measurementLengthUnits as n}from"../../core/unitUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as o}from"../../properties/defaultUnit.js";import a from"../../views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js";import{InteractiveAnalysisViewModel as u}from"../support/InteractiveAnalysisViewModel.js";let p=class extends u{constructor(t){super(t),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",this._userUnit=null,this._userUnitOptions=null}initialize(){this.addHandles(i((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),s))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){const{tool:t}=this;if(null==t)return null;const e=()=>({text:null,state:"unavailable"}),i=t=>({text:t,state:"available"}),{analysisViewData:s}=t,n=null!=s.result;return{mode:s.result?.mode??"euclidean",directDistance:n&&"euclidean"===s.actualVisualizedMeasurement?i(s.directLabelText):e(),horizontalDistance:n?i(s.horizontalLabelText):e(),verticalDistance:n?i(s.verticalLabelText):e()}}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}constructAnalysis(){return new e}constructTool(){return new a({view:this.view,analysis:this.analysis,analysisViewData:this.analysisView,visible:this.visible})}_findSelectableUnit(t,e){const i=this.unitOptions;return i.includes(t)?t:e?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){if(!t)return n.slice();const e=t.filter((t=>n.includes(t)));return 0===e.length?n.slice():e}};t([r({type:e})],p.prototype,"analysis",void 0),t([r({readOnly:!0})],p.prototype,"state",null),t([r({readOnly:!0})],p.prototype,"measurement",null),t([r()],p.prototype,"unitOptions",null),t([r()],p.prototype,"unit",null),t([r(o)],p.prototype,"defaultUnit",void 0),t([r()],p.prototype,"_userUnit",void 0),t([r()],p.prototype,"_userUnitOptions",void 0),p=t([l("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],p);const c=p;export{c as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/DirectLineMeasurementAnalysis.js";import{watch as s,syncAndInitial as i}from"../../core/reactiveUtils.js";import{measurementLengthUnits as r}from"../../core/unitUtils.js";import{property as n}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{defaultUnitPropertyMetadata as l}from"../../properties/defaultUnit.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";let u=class extends a{constructor(t){super(t),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",this._userUnit=null,this._userUnitOptions=null}initialize(){this.addHandles(s((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),i))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){const{tool:t}=this;if(null==t)return null;const e=()=>({text:null,state:"unavailable"}),s=t=>({text:t,state:"available"}),{analysisViewData:i}=t,r=null!=i.result;return{mode:i.result?.mode??"euclidean",directDistance:r&&"euclidean"===i.actualVisualizedMeasurement?s(i.directLabelText):e(),horizontalDistance:r?s(i.horizontalLabelText):e(),verticalDistance:r?s(i.verticalLabelText):e()}}set unitOptions(t){this._userUnitOptions=t}get unitOptions(){const t=this._userUnitOptions?.filter((t=>r.includes(t)));return t&&t.length>0?t:r.slice()}set unit(t){this._userUnit=t}get unit(){const t=this._userUnit,e=this.unitOptions;if(t&&e.includes(t))return t;const s=this.defaultUnit;return s&&e.includes(s)?s:e[0]}constructAnalysis(){return new e}};t([n({type:e})],u.prototype,"analysis",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n({readOnly:!0})],u.prototype,"measurement",null),t([n()],u.prototype,"unitOptions",null),t([n()],u.prototype,"unit",null),t([n(l)],u.prototype,"defaultUnit",void 0),t([n()],u.prototype,"_userUnit",void 0),t([n()],u.prototype,"_userUnitOptions",void 0),u=t([o("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],u);const p=u;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import o from"../../core/Logger.js";import{abortMaybe as r}from"../../core/maybe.js";import{createResolver as s,onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,when as h,watch as w,sync as f}from"../../core/reactiveUtils.js";import{last as g}from"../../core/SetUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isEditableLayer as m}from"../../layers/support/editableLayers.js";import{isFeatureLayer as y,isSubtypeSublayer as W,isSubtypeGroupLayer as b,isTable as A}from"../../layers/support/layerUtils.js";import{createFeatureServices as C}from"../../rest/featureService/utils.js";import _ from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as M}from"../../views/input/InputManager.js";import S from"../../views/interactive/sketch/SketchOptions.js";import{temporaryHighlightName as F}from"../../views/support/HighlightDefaults.js";import I from"./CreateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as E}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as j}from"./UpdateRecordWorkflow.js";import U from"./UpdateWorkflowData.js";import P from"./Workflow.js";import{createWorkflowSteps as V,fetchCandidates as R}from"./workflowUtils.js";import{findUtilityNetwork as L,isGraphicForRelatableFeatureSupportedLayer as x}from"../Feature/support/featureUtils.js";var T;let H=T=class extends P{constructor(e){super(e),this._workflowStack=new p(g),this._sketchStack=new p(g),this.data=void 0,this.type="update"}destroy(){this._drainWorkflowStack((e=>e.cancel({force:!0})))}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeUtilityNetworkAssociationAddAssociationViewModel(){return"add-association"===this.activeWorkflow?.type?this.activeWorkflow.utilityNetworkAssociationAddAssociationViewModel:null}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get canDeleteAssociation(){const{activeFeatureFormViewModel:e}=this;if(!this.activeWorkflow||!this.data.viewModel.view?.map||!e)return!1;const{activeAssociation:t,feature:a}=e;return!(!t||!a?.sourceLayer||!y(a?.sourceLayer)&&!W(a?.sourceLayer))}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.featureFormViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||null!=e?.relationshipId||"view"!==this.data.viewModel.attachmentsViewModel.mode||null!=e?.associationId||null!=e?.associatedLayer}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some((({layer:e})=>t.findEditorItemForLayer(e)?.supportsUpdateWorkflow))}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some((e=>e.hasPendingEdits))}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,a=t?.featureFormViewModel;if(a?.activeRelationshipInput){const e=a.activeRelationshipInput;if(e.activeCategory)return void(e.activeCategory=null);if(null!=a.relationshipId)return void(a.relationshipId=null);if(e.showAllEnabled)return void(e.showAllEnabled=!1)}if("add-association"===t?.type){const{activeUtilityNetworkAssociationAddAssociationViewModel:e}=this;if(e?.filterOptionsVisible)return void(e.filterOptionsVisible=!1);e?.featureSpatialItems.length&&e.reset()}if(null==a?.associatedLayer)if(null==a?.associationId)if("create-features"===t?.type&&t.hasPreviousStep)await t.previous({cancelCurrentStep:!0});else if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0});else a.associationId=null;else a.associatedLayer=null}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflow()}async commit(){await this._drainWorkflowStack((e=>e.commit())),await super.commit()}static create(e){const{viewModel:t,snappingManager:a,startAt:i,addAttachmentsCallback:o,applyEditsCallback:r,applyEditsFeatureServiceCallback:s}=e,n=e.sketchOptions??new S,l=new T({data:new U({addAttachmentsCallback:o,applyEditsCallback:r,applyEditsFeatureServiceCallback:s,sketchOptions:n,snappingManager:a,viewModel:t}),onCommit:async()=>{}});return l._set("steps",this._createWorkflowSteps(l,i)),l}async save(){this.nestedWorkflowCount>1?(await(this.activeWorkflow?.commit()),await this._popWorkflow()):await this.commit()}async startCreatingRelatedRecord(e){try{const t=await this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:t})}}async startUpdating(e,t){try{const a=await this._createNestedUpdateWorkflow(e,t);await this._pushWorkflow(a)}catch(i){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:i})}}async startAddAssociation(e,t,i){try{const a=await this._createNestedAddAssociationWorkflow(e,t,i);await this._pushWorkflow(a)}catch(o){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:o})}}async deleteActiveFeature(){const{activeWorkflow:e}=this;if(!e)throw new a("editor:nothing-to-delete","There is no feature to delete");N(e)?await e.deleteAndCommit():await e.cancel(),1===this.nestedWorkflowCount?await this.reset():(await this._popWorkflow(),await this._returnToPageWithContent())}async deleteActiveAssociation(){if(!this.canDeleteAssociation)throw new a("editor:nothing-to-delete","There is no association to delete");await this._deleteActiveAssociation(),await this._popWorkflow(),await this._returnToPageWithContent()}async cancelAll(){await this._drainWorkflowStack((e=>e.cancel({force:!0})))}async _deleteActiveAssociation(){const{activeFeatureFormViewModel:e,data:t}=this,{activeAssociation:i,feature:o}=e,{applyEditsFeatureServiceCallback:r,viewModel:s}=t,{sourceLayer:n}=o,l=W(n)&&n.parent?n.parent:n,d=C([l]),c=d.values().next().value?.featureService;if(!c)throw new a("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(c?.load());const p=s.view.map,u=L(p,l);await(u?.networkSystemLayers.loadAssociationsTable());const h=u?.generateDeleteAssociations([i]);if(!h)throw new a("editor:failed-to-delete-association","Could not create payload needed to delete association");const w=u?.gdbVersion??void 0;await r(c,[h],{gdbVersion:w,globalIdUsed:!0})}async _returnToPageWithContent(){const{activeFeatureFormViewModel:e}=this;if(!e?.activeAssociationInput)return;const{activeAssociationInput:t,associationId:a}=e;await t.refresh(),t.associatedLayer&&!t.associatedFeatures?.length&&(e.associatedLayer=null),null==a||t.associatedFeatureInfos.size||(e.associationId=null)}async _createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:i,applyEditsCallback:o,applyEditsFeatureServiceCallback:r,sketchOptions:s,snappingManager:n,viewModel:l}=this.data;if(!m(t))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const d=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),c=d.template||d.initialFeature?"creating-features":"awaiting-feature-creation-info",p="create-features"!==this.activeWorkflow?.type&&"add-association"!==this.activeWorkflow?.type?this.activeWorkflow:void 0;return I.create({addAttachmentsCallback:i,applyEditsCallback:o,applyEditsFeatureServiceCallback:r,creationInfo:d,isNested:!0,parent:p,sketchOptions:s,snappingManager:n,startAt:c,viewModel:l})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:i}=e;if(!m(i)||b(i))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const{viewModel:o}=this.data,r={layer:i,maxFeatures:1},s=this._makeRelatedRecordAttributes(e),n=o.getTemplatesForLayer(i);return n?.length>0?(r.attributeOverrides=s,1===n.length&&(r.template=n[0])):r.initialFeature=new t({sourceLayer:i,attributes:s}),r}async _createNestedUpdateWorkflow(e,t){const a=A(e.sourceLayer)?j:E,{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,sketchOptions:r,snappingManager:s,viewModel:n}=this.data,l="create-features"!==this.activeWorkflow?.type&&"add-association"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,d=await a.create({association:t,feature:e,parent:l,sketchOptions:r,snappingManager:s,viewModel:n,applyEdits:i,applyEditsFeatureService:o,featureFormCallbacks:{addRelatedRecord:async e=>await this._updatingHandles.addPromise(this.startCreatingRelatedRecord(e)),editRelatedRecord:async({relatedFeature:e})=>await this._updatingHandles.addPromise(this.startUpdating(e)),selectAssociatedFeature:async({feature:e,association:t})=>await this._updatingHandles.addPromise(this.startUpdating(e,t)),addAssociation:async e=>await this._updatingHandles.addPromise(this.startAddAssociation(e.feature,e.utilityNetwork,e.associationType))}});return await u((()=>!d.updating)),d}async _createNestedAddAssociationWorkflow(e,t,a){const{AddAssociationWorkflow:i}=await import("./AddAssociationWorkflow.js"),{applyEditsCallback:o,applyEditsFeatureServiceCallback:r,viewModel:s}=this.data,n="create-features"!==this.activeWorkflow?.type&&"add-association"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,l=this.activeFeatureFormViewModel?.activeAssociationInput,d=await i.create({utilityNetwork:t,associationType:a,feature:e,parent:n,viewModel:s,associationInput:l,applyEdits:o,applyEditsFeatureService:r});return await u((()=>!d.updating)),d}async _drainWorkflowStack(e){const t=this._workflowStack,a=[];for(;t.length>0;){const i=t.pop();this._sketchStack.pop();const o=e(i).then((()=>i.destroy()));this._updatingHandles.addPromise(o),a.push(o)}await Promise.all(a)}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:a,relationshipId:i}=e;if(!x(t))return;const o=a.relationships?.find((e=>e.id===i));if(!o)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===o.role)return void this._logContinuingWithoutRelationshipWarning("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;o.relatedTableId!==r.layerId&&this._logContinuingWithoutRelationshipWarning("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find((e=>e.id===i));if(!s)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=O(r,s),l=t.getAttribute(n);l||this._logContinuingWithoutRelationshipWarning("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=O(a,o);return{[d]:l}}async _popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new a("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflow(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const i=this._sketchStack,o=await(e?.start()),r=i.peek();o?(r?.exit(),i.push(o)):i.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new a("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const a=e.peek();return await(a?.enter()),await(t.peek()?.enter()),{activeWorkflow:a,failureCount:0}}catch(a){e.pop().destroy(),t.pop();const{activeWorkflow:i,failureCount:o}=await this._reconcileWorkflowStack();return{activeWorkflow:i,failureCount:o+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!A(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:o}=e;return V(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=o.viewModel,a=o.viewModel.view;a.activeTool=null;let c=null;e.addHandles(i((()=>{c=r(c)})),this.id),o.rootFeature=null,o.candidates=[];const p=a.on("immediate-click",(async i=>{const r=s();e._updatingHandles.addPromise(r.promise);try{t.location=i.mapPoint,t.visible=!0,c?.abort();const{editorItems:r}=o.viewModel;c=new AbortController;const s=await i.async((()=>new Promise(((e,t)=>{n(c?.signal,(()=>t(l()))),e(R(r,a,i,c?.signal))}))));if(d(c),o.candidates=s.filter((e=>"fulfilled"===e.status)).flatMap((e=>e.value)).filter((e=>!e.isAggregate)),t.visible=1===o.candidates.length,0===o.candidates.length)return;i.stopPropagation(),1===o.candidates.length?(o.rootFeature=o.candidates[0],e.go("editing-existing-feature").catch((()=>{})).then((()=>t.visible=!1))):e.next()}finally{r.resolve()}}),M.TOOL),u=h((()=>null!=a.activeTool),(()=>e.cancel({force:!0})),{once:!0});a.focus(),e.addHandles([p,u],this.id)},async tearDown(){0===o.candidates.length&&(o.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){o.rootFeature=null;const{view:t}=o.viewModel;if(!t)return;const a=new _({view:t,highlightName:F});e.addHandles([w((()=>o.rootFeature),((e,t)=>{a.remove(t),a.add(e)}),f),i((()=>a.removeAll()))],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const{rootFeature:t,viewModel:i}=e.data;if(!t)throw new a("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined");await e.startUpdating(t),i.spinnerViewModel.visible=!1;const o=c((async()=>{await u((()=>!e.updating)),e.previous()}));e.addHandles([w((()=>e.nestedWorkflowCount),((e,t)=>{0===e&&0!==t&&o()}),f)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){o.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){o.viewModel.attachmentsViewModel.mode="view"}})})}_logContinuingWithoutRelationshipWarning(e,t){o.getLogger(this).warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.")}};function O(e,{keyField:t}){return e.getField(t)?.name??t}e([v()],H.prototype,"activeEditorItem",null),e([v()],H.prototype,"activeFeatureFormViewModel",null),e([v()],H.prototype,"activeUtilityNetworkAssociationAddAssociationViewModel",null),e([v()],H.prototype,"activeSketchViewModel",null),e([v()],H.prototype,"canDeleteAssociation",null),e([v()],H.prototype,"activeWorkflow",null),e([v()],H.prototype,"updating",null),e([v()],H.prototype,"data",void 0),e([v()],H.prototype,"hasPreviousStep",null),e([v()],H.prototype,"hasUpdatableCandidates",null),e([v()],H.prototype,"nestedWorkflowCount",null),e([v()],H.prototype,"shouldShowAttachments",null),e([v()],H.prototype,"shouldAllowAttachmentEditing",null),e([v()],H.prototype,"hasPendingEdits",null),e([v()],H.prototype,"helpMessage",null),e([v()],H.prototype,"reliesOnOwnerAdminPrivileges",null),e([v()],H.prototype,"hasInvalidFormTemplate",null),H=T=e([k("esri.widgets.Editor.UpdateWorkflow")],H);const N=e=>!!e&&/update-/.test(e.type),D=H;export{D as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import o from"../../core/Logger.js";import{abortMaybe as r}from"../../core/maybe.js";import{createResolver as s,onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,when as h,watch as w,sync as f}from"../../core/reactiveUtils.js";import{last as g}from"../../core/SetUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isEditableLayer as m}from"../../layers/support/editableLayers.js";import{isFeatureLayer as y,isSubtypeSublayer as W,isSubtypeGroupLayer as b,isTable as A}from"../../layers/support/layerUtils.js";import{createFeatureServices as C}from"../../rest/featureService/utils.js";import _ from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as M}from"../../views/input/InputManager.js";import S from"../../views/interactive/sketch/SketchOptions.js";import{temporaryHighlightName as F}from"../../views/support/HighlightDefaults.js";import I from"./CreateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as E}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as j}from"./UpdateRecordWorkflow.js";import U from"./UpdateWorkflowData.js";import P from"./Workflow.js";import{createWorkflowSteps as V,fetchCandidates as R}from"./workflowUtils.js";import{findUtilityNetwork as L,isGraphicForRelatableFeatureSupportedLayer as x}from"../Feature/support/featureUtils.js";var T;let H=T=class extends P{constructor(e){super(e),this._workflowStack=new p(g),this._sketchStack=new p(g),this.data=void 0,this.type="update"}destroy(){this._drainWorkflowStack((e=>e.cancel({force:!0})))}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeUtilityNetworkAssociationAddAssociationViewModel(){return"add-association"===this.activeWorkflow?.type?this.activeWorkflow.utilityNetworkAssociationAddAssociationViewModel:null}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get canDeleteAssociation(){const{activeFeatureFormViewModel:e}=this;if(!this.activeWorkflow||!this.data.viewModel.view?.map||!e)return!1;const{activeAssociation:t,feature:a}=e;return!(!t||!a?.sourceLayer||!y(a?.sourceLayer)&&!W(a?.sourceLayer))}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){const e=this.activeWorkflow?.featureFormViewModel;return this._stepIndex>0||this.nestedWorkflowCount>1||null!=e?.relationshipId||"view"!==this.data.viewModel.attachmentsViewModel.mode||null!=e?.associationId||null!=e?.associatedLayer}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some((({layer:e})=>t.findEditorItemForLayer(e)?.supportsUpdateWorkflow))}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some((e=>e.hasPendingEdits))}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this,a=t?.featureFormViewModel;if(a?.activeRelationshipInput){const e=a.activeRelationshipInput;if(e.activeCategory)return void(e.activeCategory=null);if(null!=a.relationshipId)return void(a.relationshipId=null);if(e.showAllEnabled)return void(e.showAllEnabled=!1)}if("add-association"===t?.type){const{activeUtilityNetworkAssociationAddAssociationViewModel:e}=this;if(e?.filterOptionsVisible)return void(e.filterOptionsVisible=!1);e?.featureSpatialItems.length&&e.reset()}if(null==a?.associatedLayer)if(null==a?.associationId)if("create-features"===t?.type&&t.hasPreviousStep)await t.previous({cancelCurrentStep:!0});else if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0});else a.associationId=null;else a.associatedLayer=null}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflow()}async commit(){await this._drainWorkflowStack((e=>e.commit())),await super.commit()}static create(e){const{viewModel:t,snappingManager:a,startAt:i,addAttachmentsCallback:o,applyEditsCallback:r,applyEditsFeatureServiceCallback:s}=e,n=e.sketchOptions??new S,l=new T({data:new U({addAttachmentsCallback:o,applyEditsCallback:r,applyEditsFeatureServiceCallback:s,sketchOptions:n,snappingManager:a,viewModel:t}),onCommit:async()=>{}});return l._set("steps",this._createWorkflowSteps(l,i)),l}async save(){this.nestedWorkflowCount>1?(await(this.activeWorkflow?.commit()),await this._popWorkflow()):await this.commit()}async startCreatingRelatedRecord(e){try{const t=await this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:t})}}async startUpdating(e,t){try{const a=await this._createNestedUpdateWorkflow(e,t);await this._pushWorkflow(a)}catch(i){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:i})}}async startAddAssociation(e,t,i){try{const a=await this._createNestedAddAssociationWorkflow(e,t,i);await this._pushWorkflow(a)}catch(o){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:o})}}async deleteActiveFeature(){const{activeWorkflow:e}=this;if(!e)throw new a("editor:nothing-to-delete","There is no feature to delete");N(e)?await e.deleteAndCommit():await e.cancel(),1===this.nestedWorkflowCount?await this.reset():(await this._popWorkflow(),await this._returnToPageWithContent())}async deleteActiveAssociation(){if(!this.canDeleteAssociation)throw new a("editor:nothing-to-delete","There is no association to delete");await this._deleteActiveAssociation(),await this._popWorkflow(),await this._returnToPageWithContent()}async cancelAll(){await this._drainWorkflowStack((e=>e.cancel({force:!0})))}async _deleteActiveAssociation(){const{activeFeatureFormViewModel:e,data:t}=this,{activeAssociation:i,feature:o}=e,{applyEditsFeatureServiceCallback:r,viewModel:s}=t,{sourceLayer:n}=o,l=W(n)&&n.parent?n.parent:n,d=C([l]),c=d.values().next().value?.featureService;if(!c)throw new a("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(c?.load());const p=s.view.map,u=L(p,l);await(u?.networkSystemLayers.loadAssociationsTable());const h=u?.generateDeleteAssociations([i]);if(!h)throw new a("editor:failed-to-delete-association","Could not create payload needed to delete association");const w=u?.gdbVersion??void 0;await r(c,[h],{gdbVersion:w,globalIdUsed:!0})}async _returnToPageWithContent(){const{activeFeatureFormViewModel:e}=this;if(!e?.activeAssociationInput)return;const{activeAssociationInput:t,associationId:a}=e;await t.refresh(),t.associatedLayer&&!t.associatedFeatures?.length&&(e.associatedLayer=null),null==a||t.associatedFeatureInfos.size||(e.associationId=null)}async _createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:i,applyEditsCallback:o,applyEditsFeatureServiceCallback:r,sketchOptions:s,snappingManager:n,viewModel:l}=this.data;if(!m(t))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const d=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),c=d.template||d.initialFeature?"creating-features":"awaiting-feature-creation-info",p="create-features"!==this.activeWorkflow?.type&&"add-association"!==this.activeWorkflow?.type?this.activeWorkflow:void 0;return I.create({addAttachmentsCallback:i,applyEditsCallback:o,applyEditsFeatureServiceCallback:r,creationInfo:d,isNested:!0,parent:p,sketchOptions:s,snappingManager:n,startAt:c,viewModel:l})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:i}=e;if(!m(i)||b(i))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const{viewModel:o}=this.data,r={layer:i,maxFeatures:1},s=this._makeRelatedRecordAttributes(e),n=o.getTemplatesForLayer(i);return n?.length>0?(r.attributeOverrides=s,1===n.length&&(r.template=n[0])):r.initialFeature=new t({sourceLayer:i,attributes:s}),r}async _createNestedUpdateWorkflow(e,t){const a=A(e.sourceLayer)?j:E,{applyEditsCallback:i,applyEditsFeatureServiceCallback:o,sketchOptions:r,snappingManager:s,viewModel:n}=this.data,l="create-features"!==this.activeWorkflow?.type&&"add-association"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,d=await a.create({association:t,feature:e,parent:l,sketchOptions:r,snappingManager:s,viewModel:n,applyEdits:i,applyEditsFeatureService:o,featureFormCallbacks:{addRelatedRecord:async e=>await this._updatingHandles.addPromise(this.startCreatingRelatedRecord(e)),editRelatedRecord:async({relatedFeature:e})=>await this._updatingHandles.addPromise(this.startUpdating(e)),selectAssociatedFeature:async({feature:e,association:t})=>await this._updatingHandles.addPromise(this.startUpdating(e,t)),addAssociation:async e=>await this._updatingHandles.addPromise(this.startAddAssociation(e.feature,e.utilityNetwork,e.associationType))}});return await u((()=>!d.updating)),d}async _createNestedAddAssociationWorkflow(e,t,a){const{AddAssociationWorkflow:i}=await import("./AddAssociationWorkflow.js"),{applyEditsCallback:o,applyEditsFeatureServiceCallback:r,viewModel:s}=this.data,n="create-features"!==this.activeWorkflow?.type&&"add-association"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,l=this.activeFeatureFormViewModel?.activeAssociationInput,d=await i.create({utilityNetwork:t,associationType:a,feature:e,parent:n,viewModel:s,associationInput:l,applyEdits:o,applyEditsFeatureService:r});return await u((()=>!d.updating)),d}async _drainWorkflowStack(e){const t=this._workflowStack,a=[];for(;t.length>0;){const i=t.pop();this._sketchStack.pop();const o=e(i).then((()=>i.destroy()));this._updatingHandles.addPromise(o),a.push(o)}await Promise.all(a)}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:a,relationshipId:i}=e;if(!x(t))return;const o=a.relationships?.find((e=>e.id===i));if(!o)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===o.role)return void this._logContinuingWithoutRelationshipWarning("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;o.relatedTableId!==r.layerId&&this._logContinuingWithoutRelationshipWarning("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find((e=>e.id===i));if(!s)return void this._logContinuingWithoutRelationshipWarning("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=O(r,s),l=t.getAttribute(n);l||this._logContinuingWithoutRelationshipWarning("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=O(a,o);return{[d]:l}}async _popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new a("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflow(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const i=this._sketchStack,o=await(e?.start()),r=i.peek();o?(r?.exit(),i.push(o)):i.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new a("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const a=e.peek();return await(a?.enter()),await(t.peek()?.enter()),{activeWorkflow:a,failureCount:0}}catch(a){e.pop().destroy(),t.pop();const{activeWorkflow:i,failureCount:o}=await this._reconcileWorkflowStack();return{activeWorkflow:i,failureCount:o+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!A(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:o}=e;return V(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=o.viewModel,a=o.viewModel.view;a.activeTool=null;let c=null;e.addHandles(i((()=>{c=r(c)})),this.id),o.rootFeature=null,o.candidates=[];const p=a.on("immediate-click",(async i=>{const r=s();e._updatingHandles.addPromise(r.promise);try{t.location=i.mapPoint,t.visible=!0,c?.abort();const{editorItems:r}=o.viewModel;c=new AbortController;const s=await i.defer((()=>new Promise(((e,t)=>{n(c?.signal,(()=>t(l()))),e(R(r,a,i,c?.signal))}))));if(d(c),o.candidates=s.filter((e=>"fulfilled"===e.status)).flatMap((e=>e.value)).filter((e=>!e.isAggregate)),t.visible=1===o.candidates.length,0===o.candidates.length)return;i.stopPropagation(),1===o.candidates.length?(o.rootFeature=o.candidates[0],e.go("editing-existing-feature").catch((()=>{})).then((()=>t.visible=!1))):e.next()}finally{r.resolve()}}),M.TOOL),u=h((()=>null!=a.activeTool),(()=>e.cancel({force:!0})),{once:!0});a.focus(),e.addHandles([p,u],this.id)},async tearDown(){0===o.candidates.length&&(o.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){o.rootFeature=null;const{view:t}=o.viewModel;if(!t)return;const a=new _({view:t,highlightName:F});e.addHandles([w((()=>o.rootFeature),((e,t)=>{a.remove(t),a.add(e)}),f),i((()=>a.removeAll()))],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const{rootFeature:t,viewModel:i}=e.data;if(!t)throw new a("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined");await e.startUpdating(t),i.spinnerViewModel.visible=!1;const o=c((async()=>{await u((()=>!e.updating)),e.previous()}));e.addHandles([w((()=>e.nestedWorkflowCount),((e,t)=>{0===e&&0!==t&&o()}),f)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){o.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){o.viewModel.attachmentsViewModel.mode="view"}})})}_logContinuingWithoutRelationshipWarning(e,t){o.getLogger(this).warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature.")}};function O(e,{keyField:t}){return e.getField(t)?.name??t}e([v()],H.prototype,"activeEditorItem",null),e([v()],H.prototype,"activeFeatureFormViewModel",null),e([v()],H.prototype,"activeUtilityNetworkAssociationAddAssociationViewModel",null),e([v()],H.prototype,"activeSketchViewModel",null),e([v()],H.prototype,"canDeleteAssociation",null),e([v()],H.prototype,"activeWorkflow",null),e([v()],H.prototype,"updating",null),e([v()],H.prototype,"data",void 0),e([v()],H.prototype,"hasPreviousStep",null),e([v()],H.prototype,"hasUpdatableCandidates",null),e([v()],H.prototype,"nestedWorkflowCount",null),e([v()],H.prototype,"shouldShowAttachments",null),e([v()],H.prototype,"shouldAllowAttachmentEditing",null),e([v()],H.prototype,"hasPendingEdits",null),e([v()],H.prototype,"helpMessage",null),e([v()],H.prototype,"reliesOnOwnerAdminPrivileges",null),e([v()],H.prototype,"hasInvalidFormTemplate",null),H=T=e([k("esri.widgets.Editor.UpdateWorkflow")],H);const N=e=>!!e&&/update-/.test(e.type),D=H;export{D as default};