@arcgis/core 4.34.0-next.40 → 4.34.0-next.42

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 (180) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/016d421114118307d4dd.js +1 -0
  3. package/assets/esri/core/workers/chunks/1a2278b9fe9666342728.js +1 -0
  4. package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +1 -0
  5. package/assets/esri/core/workers/chunks/3245d20ea4bb779f87ef.js +1 -0
  6. package/assets/esri/core/workers/chunks/6b73926feb5c5d957062.js +1 -0
  7. package/assets/esri/core/workers/chunks/{6269c4bbf0f224a954e9.js → 6f4079b7a2b45f304ee6.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{4e6e5677b90b00622146.js → 7ef7f3925495b9ade88c.js} +1 -1
  9. package/assets/esri/core/workers/chunks/82955562805ad5514ed8.js +346 -0
  10. package/assets/esri/core/workers/chunks/{5fe3c279d57f44416c28.js → a1d3f1c221389eb6090c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{306a68137e62656b0f05.js → d5d2d4df407cf078bb81.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{94850c094e076d81a016.js → dca2b487152cde45fb65.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{31ad9949b08a5b07218c.js → eea3e0bd17479a767160.js} +2 -2
  14. package/assets/esri/core/workers/chunks/fe6fa1f2c2d54d41645e.js +1 -0
  15. package/config.js +1 -1
  16. package/core/workers/registry.js +1 -1
  17. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  18. package/geometry/support/curves/closestPointOnCurve.js +1 -1
  19. package/geometry/support/curves/curveExtent.js +1 -1
  20. package/geometry/support/curves/curveLength.js +1 -1
  21. package/geometry/support/curves/curveUtils.js +1 -1
  22. package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
  23. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  24. package/geometry/support/curves/splitCurveAtPoint.js +1 -1
  25. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  26. package/interfaces.d.ts +24 -2
  27. package/kernel.js +1 -1
  28. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  29. package/layers/PointCloudLayer.js +1 -1
  30. package/package.json +1 -1
  31. package/rest/networks/support/CircuitPath.js +1 -1
  32. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  33. package/support/revision.js +1 -1
  34. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  35. package/views/2d/engine/flow/styles/Particles.js +1 -1
  36. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  37. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  38. package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
  39. package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
  40. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  41. package/views/2d/engine/webgl/VertexStream.js +1 -1
  42. package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
  43. package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
  44. package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
  45. package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
  46. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
  47. package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
  48. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  49. package/views/2d/engine/webgl/meshing/SimpleMesh.js +1 -1
  50. package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
  51. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  52. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  53. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  54. package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
  55. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  56. package/views/2d/layers/KMLLayerView2D.js +1 -1
  57. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  58. package/views/2d/layers/MediaLayerView2D.js +1 -1
  59. package/views/2d/layers/TileLayerView2D.js +1 -1
  60. package/views/2d/layers/WMSLayerView2D.js +1 -1
  61. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  62. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  63. package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
  64. package/views/2d/layers/support/DebugOverlay.js +1 -1
  65. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  66. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  67. package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
  68. package/views/3d/environment/LocalAtmosphere.js +1 -1
  69. package/views/3d/environment/MarsAtmosphere.js +1 -1
  70. package/views/3d/environment/Precipitation.js +1 -1
  71. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  72. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  73. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  74. package/views/3d/layers/FlowSubView3D.js +1 -1
  75. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  76. package/views/3d/layers/I3SMeshView3D.js +1 -1
  77. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  78. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  79. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  80. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  81. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  82. package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
  83. package/views/3d/support/GaussianSplatSortWorker.js +5 -0
  84. package/views/3d/support/GaussianSplatWorkerHandle.js +5 -0
  85. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  86. package/views/3d/support/flow/geometryUtils.js +1 -1
  87. package/views/3d/support/flow/loadUtils.js +1 -1
  88. package/views/3d/support/intersectionUtils.js +1 -1
  89. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  90. package/views/3d/terrain/PatchRenderData.js +1 -1
  91. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  92. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  93. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  94. package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
  95. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  96. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  97. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
  98. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  99. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  100. package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
  101. package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
  102. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  103. package/views/3d/webgl-engine/lib/lodRendering/BackedBufferObject.js +1 -1
  104. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  105. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  106. package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
  107. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +5 -0
  108. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  109. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  110. package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
  111. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +5 -0
  112. package/views/PopupView.js +1 -1
  113. package/views/VideoView.js +1 -1
  114. package/views/draw/DrawAction.js +1 -1
  115. package/views/draw/DrawOperation.js +1 -1
  116. package/views/draw/SegmentDrawAction.js +1 -1
  117. package/views/draw/support/Reshape.js +1 -1
  118. package/views/interactive/SegmentLabels.js +1 -1
  119. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  120. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  121. package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
  122. package/views/interactive/editGeometry/operations/ClosePart.js +5 -0
  123. package/views/interactive/editGeometry/operations/MoveMesh.js +1 -1
  124. package/views/interactive/editGeometry/operations/MoveVertex.js +1 -1
  125. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  126. package/views/interactive/editGeometry/operations/RemoveVertices.js +1 -1
  127. package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
  128. package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
  129. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  130. package/views/interactive/editGeometry/operations/SetVertexPosition.js +1 -1
  131. package/views/interactive/editGeometry/operations/SplitSegment.js +5 -0
  132. package/views/interactive/editGeometry/operations/UpdateVertices.js +1 -1
  133. package/views/interactive/editGeometry/operations/curveOperationUtils.js +5 -0
  134. package/views/interactive/editGeometry/operations.js +1 -1
  135. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  136. package/views/interactive/snapping/LineSnapper.js +1 -1
  137. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  138. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  139. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  140. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  141. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  142. package/views/support/TileTreeDebugger.js +1 -1
  143. package/views/webgl/BufferObject.js +1 -1
  144. package/views/webgl/Util.js +1 -1
  145. package/views/webgl/VertexArrayObject.js +1 -1
  146. package/views/webgl/VertexBuffer.js +1 -1
  147. package/views/webgl/testFloatBufferBlend.js +1 -1
  148. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  149. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  150. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  151. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  152. package/widgets/Editor/EditorViewModel.js +1 -1
  153. package/widgets/Editor/support/SketchController.js +1 -1
  154. package/widgets/Feature/FeatureMedia.js +1 -1
  155. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  156. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  157. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  158. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  159. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  160. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  161. package/widgets/Features.js +1 -1
  162. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  163. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  164. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  165. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  166. package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +5 -0
  167. package/widgets/PanoramicViewer/support/PanoramicMeshWorker.js +5 -0
  168. package/widgets/Spinner.js +1 -1
  169. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  170. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  171. package/widgets/UtilityNetworkTrace.js +1 -1
  172. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  173. package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
  174. package/assets/esri/core/workers/chunks/01bd8f90e55081e65b38.js +0 -1
  175. package/assets/esri/core/workers/chunks/0a27f9b11d03874809ee.js +0 -346
  176. package/assets/esri/core/workers/chunks/34f677e8c1691c10e4e9.js +0 -1
  177. package/assets/esri/core/workers/chunks/e95a8c988ef822723503.js +0 -1
  178. package/assets/esri/core/workers/chunks/fd3009164d5e38fda85f.js +0 -1
  179. package/views/interactive/editGeometry/operations/CloseComponent.js +0 -5
  180. package/views/interactive/editGeometry/operations/SplitEdge.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}_notifyChanges(t){this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:t,updatedVertices:this._vertices})}apply(){this._vertices.forEach(t=>this.operation.apply(t)),this._notifyChanges(this._undone?"redo":"apply")}undo(){this._vertices.forEach(t=>this.operation.undo(t)),this._undone=!0,this._notifyChanges("undo")}canAccumulate(t){if(this._undone||t._vertices.length!==this._vertices.length)return!1;for(let e=0;e<t._vertices.length;++e)if(t._vertices[e]!==this._vertices[e])return!1;return this.operation.canAccumulate(t.operation)}accumulate(e){return!!(e instanceof t&&this.canAccumulate(e))&&(this._vertices.forEach(t=>this.operation.accumulate(t,e.operation)),this.operation.accumulateParams(e.operation),this._notifyChanges("apply"),!0)}}export{t as UpdateVertices};
5
+ class t{constructor(t,e,i){this._editGeometry=t,this._vertices=e,this.operation=i,this._undone=!1}_notifyChanges(t){this._editGeometry.parts.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:t,updatedVertices:this._vertices})}apply(){this._vertices.forEach(t=>this.operation.apply(t)),this._notifyChanges(this._undone?"redo":"apply")}undo(){this._vertices.forEach(t=>this.operation.undo(t)),this._undone=!0,this._notifyChanges("undo")}canAccumulate(t){if(this._undone||t._vertices.length!==this._vertices.length)return!1;for(let e=0;e<t._vertices.length;++e)if(t._vertices[e]!==this._vertices[e])return!1;return this.operation.canAccumulate(t.operation)}accumulate(e){return!!(e instanceof t&&this.canAccumulate(e))&&(this._vertices.forEach(t=>this.operation.accumulate(t,e.operation)),this.operation.accumulateParams(e.operation),this._notifyChanges("apply"),!0)}}export{t as UpdateVertices};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{fromValues as t,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{mul as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{deriveCircleFromCircularArc as s}from"../../../../geometry/support/curves/circularArcUtils.js";import{isCircularArc as c}from"../../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as e}from"../../../../geometry/support/curves/ellipticArc7Utils.js";function a(t,r){const[o]=r.c,c=s(t,r);return{a:[o,[c.cx,c.cy],Math.abs(c.thetaEnd-c.thetaStart)>Math.PI?0:1,1,0,c.radius,1]}}function i(r,o,s,i){const m=c(o)?a(r,o):o,[n,u,p,f,h,l,y]=m.a,M=h??0,g=l??Math.hypot(n[0]-u[0],n[1]-u[1]),j=y??1,x=Math.cos(i),v=Math.sin(i),[b,U]=s,d=t(x,v,0,-v,x,0,b-x*b+v*U,U-v*b-x*U,1);return e(r,{a:[n,u,p,f,M,g,j]},d)}function m(t,r,o,s,i,m,u,p){const f=r??o.leftVertex.pos,h=c(t)?a(f,t):t,[l,y,M,g,j,x,v]=h.a,b=j??0,U=x??Math.hypot(l[0]-y[0],l[1]-y[1]),d=v??1,A=n(s[0],s[1],i[0],i[1],m[0],m[1],u,p);return e(f,{a:[l,y,M,g,b,U,d]},A)}function n(s,c,e,a,i,m,n,u){const p=t(1,0,0,0,1,0,-s,-c,1),f=n-1,h=t(e*e*f+1,a*e*f,0,e*a*f,a*a*f+1,0,0,0,1),l=u-1,y=t(i*i*l+1,m*i*l,0,i*m*l,m*m*l+1,0,0,0,1),M=t(1,0,0,0,1,0,s,c,1),g=r();return o(g,h,p),o(g,y,g),o(g,M,g),g}export{n as getScaleTransform,i as rotateArc,m as scaleArc,a as toEllipticArc7};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- export{AppendVertex}from"./operations/AppendVertex.js";export{UpdateVertices}from"./operations/UpdateVertices.js";export{RemoveVertices}from"./operations/RemoveVertices.js";export{SplitEdge}from"./operations/SplitEdge.js";export{SetVertexPosition}from"./operations/SetVertexPosition.js";export{CloseComponent}from"./operations/CloseComponent.js";
5
+ export{AppendVertex}from"./operations/AppendVertex.js";export{UpdateVertices}from"./operations/UpdateVertices.js";export{RemoveVertices}from"./operations/RemoveVertices.js";export{SplitSegment}from"./operations/SplitSegment.js";export{SetVertexPosition}from"./operations/SetVertexPosition.js";export{ClosePart}from"./operations/ClosePart.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{destroyHandle as a}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as n}from"../../../core/mapCollectionUtils.js";import{allSettledValues as s,throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as i,sync as c}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as l}from"../../../core/unitUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{c as g,s as h}from"../../../chunks/vec32.js";import{create as S}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as f}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as _}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as v}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as j,markAsTarget as F}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as b}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as x,screenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as R}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as M}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as L}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as I}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as E}from"../support/viewUtils.js";let G=class extends t{get updating(){return this._snappingSources.some(e=>null==e?.valid||!0===e.valid&&!0===e.snappingSource?.updating)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=n(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([a(e),i(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(r)}),({rulesEnabled:e,sources:t})=>{for(const r of t)r.attributeRulesEnabled=e},c)])}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,t,r,a){if(!(t&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const n=[],i=this._computeScreenSizeDistanceParameters(e,r);for(const s of this._snappingSources){if(!s?.valid||!s.snappingSource?.layerSource?.enabled||s.layerView?.suspended)continue;const t=s.getFetchCandidatesParameters(e,r,i);for(const e of t)n.push(s.snappingSource.fetchCandidates(e,a).then(e=>e.filter(e=>!this._candidateIsExcluded(s.snappingSource,e,r.excludeFeature))))}const c=(await s(n)).flat();return this._addRightAngleCandidates(c,e,i,r),o(a),x(e,c),c}_addRightAngleCandidates(e,t,r,a){const n=null!=a.vertexHandle?a.vertexHandle.rightEdge?.rightVertex?.pos:null!=a.editGeometryOperations&&"polygon"===a.editGeometryOperations.data.type?a.editGeometryOperations.data.components[0]?.getFirstVertex()?.pos:null,s=null!=a.vertexHandle?a.vertexHandle.leftEdge?.leftVertex?.pos:null!=a.editGeometryOperations?a.editGeometryOperations.data.components[0]?.getLastVertex()?.pos:null,{view:o}=this,i=w(n,o,a),c=w(s,o,a),u=e.length;for(let l=0;l<u;l++)this._addRightAngleCandidate(e[l],c,t,r,e),this._addRightAngleCandidate(e[l],i,t,r,e)}_addRightAngleCandidate(e,t,r,a,n){if(null==t||!H(e))return;const s=e.constraint.closestTo(t),o=(s[0]-r[0])/a.x,i=(s[1]-r[1])/a.y,{start:c,end:u}=e.constraint;if(o*o+i*i<=1){const r=m(j(s),j(c))>m(j(s),j(u))?c:u,a=new I({targetPoint:F(s),otherVertex:t,otherVertexType:0,previousVertex:r,constraint:new v(t,s),objectId:e.objectId,isDraped:e.isDraped,domain:1});n.push(a)}}_computeScreenSizeDistanceParameters(e,t){let r=null!=this.options?this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:r,y:r,z:r,distance:r}:"2d"===this.view.type?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,r,a){const{spatialReference:n}=a;r.renderCoordsHelper.toRenderCoords(e,n,O);const s=r.state.camera.computeScreenPixelSizeAt(O),o=s*r.renderCoordsHelper.unitInMeters,i=o/u(n),c=o/l(n),p=t*i,d=t*c,m=E(e,n,_,r),g=m?z(m,e,i,0,0,r,a):0,h=m?z(m,e,0,i,0,r,a):0,S=m?z(m,e,0,0,c,r,a):0;return{x:0===g?0:p/g,y:0===h?0:p/h,z:0===S?0:d/S,distance:s*t}}_candidateIsExcluded(e,t,r){if(null==r)return!1;const a=this._getCandidateObjectId(t);if(null==a)return!1;const n=e.layerSource.layer;return"graphics"===n.type?r.uid===a:r.sourceLayer===n&&(!(!r.attributes||!("objectIdField"in n))&&r.attributes[n.objectIdField]===a)}_getCandidateObjectId(e){return e instanceof L?e.objectId:null}async _createSourceInfo(e,t){const r=e.layer;r.loaded||(await r.load(),o(t));const{view:a}=this,n=await this._createFeatureSnappingSourceType(e);return o(t),new b(null==n?{}:{snappingSource:n,view:a,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:t}=this;if(null==t||"3d"!==t.type)return null;return new((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case"feature-layer":case"oriented-imagery":return new((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":if("mesh"===e.layer.geometryType)return null;return new((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const t=this._sourceModules[e];if(null==t.loader){const t=this._loadSourceModule(e),r={module:null,loader:t};this._sourceModules[e]=r;const a=await t,n={module:a,loader:t};return this._sourceModules[e]=n,a}return null==t.module?t.loader:t.module}_loadSourceModule(e){const t=this._updatingHandles;switch(e){case"featureService":return t.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return t.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":case"notes":return t.addPromise(import("./featureSources/GraphicsSnappingSource.js"));case"scene":return t.addPromise(import("./featureSources/SceneLayerSnappingSource.js"))}}get test(){}};function H(e){return(e instanceof M||e instanceof R)&&!P(e)}function P({constraint:{start:e,end:t}}){const r=h(e,t),a=m(j(e),j(t));return r<f()||a/r<A}function z(e,t,r,a,n,s,{spatialReference:o}){const i=g(U,t);i[0]+=r,i[1]+=a,i[2]+=n;const c=E(i,o,_,s);return c?C(c,e):1/0}e([p({constructOnly:!0})],G.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],G.prototype,"view",void 0),e([p()],G.prototype,"options",void 0),e([p({readOnly:!0})],G.prototype,"updating",null),e([p()],G.prototype,"_snappingSources",void 0),G=e([d("esri.views.interactive.snapping.FeatureSnappingEngine")],G);const O=S(),U=S(),A=1e-4;export{G as FeatureSnappingEngine};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{destroyHandle as a}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as n}from"../../../core/mapCollectionUtils.js";import{allSettledValues as s,throwIfAborted as i}from"../../../core/promiseUtils.js";import{watch as o,sync as c}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as l}from"../../../core/unitUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{c as S,s as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as f}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as _}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as v}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as j,markAsTarget as F}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as b}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as x,screenDistance as C}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as R}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as M}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as L}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as I}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as G}from"../support/viewUtils.js";let H=class extends t{get updating(){return this._snappingSources.some(e=>null==e?.valid||!0===e.valid&&!0===e.snappingSource?.updating)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=n(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([a(e),o(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(r)}),({rulesEnabled:e,sources:t})=>{for(const r of t)r.attributeRulesEnabled=e},c)])}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,t,r,a){if(!(t&this._domain&&null!=this.options&&this.options.effectiveFeatureEnabled))return[];const n=[],o=this._computeScreenSizeDistanceParameters(e,r);for(const s of this._snappingSources){if(!s?.valid||!s.snappingSource?.layerSource?.enabled||s.layerView?.suspended)continue;const t=s.getFetchCandidatesParameters(e,r,o);for(const e of t)n.push(s.snappingSource.fetchCandidates(e,a).then(e=>e.filter(e=>!this._candidateIsExcluded(s.snappingSource,e,r.excludeFeature))))}const c=(await s(n)).flat();return this._addRightAngleCandidates(c,e,o,r),i(a),x(e,c),c}_addRightAngleCandidates(e,t,r,a){const n=null!=a.vertexHandle?a.vertexHandle.rightSegment?.rightVertex?.pos:null!=a.editGeometryOperations&&"polygon"===a.editGeometryOperations.data.type?a.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null,s=null!=a.vertexHandle?a.vertexHandle.leftSegment?.leftVertex?.pos:null!=a.editGeometryOperations?a.editGeometryOperations.data.parts[0]?.getLastVertex()?.pos:null,{view:i}=this,o=w(n,i,a),c=w(s,i,a),u=e.length;for(let l=0;l<u;l++)this._addRightAngleCandidate(e[l],c,t,r,e),this._addRightAngleCandidate(e[l],o,t,r,e)}_addRightAngleCandidate(e,t,r,a,n){if(null==t||!P(e))return;const s=e.constraint.closestTo(t),i=(s[0]-r[0])/a.x,o=(s[1]-r[1])/a.y,{start:c,end:u}=e.constraint;if(i*i+o*o<=1){const r=m(j(s),j(c))>m(j(s),j(u))?c:u,a=new I({targetPoint:F(s),otherVertex:t,otherVertexType:0,previousVertex:r,constraint:new v(t,s),objectId:e.objectId,isDraped:e.isDraped,domain:1});n.push(a)}}_computeScreenSizeDistanceParameters(e,t){let r=null!=this.options?this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1):0;return null==this.view?{x:r,y:r,z:r,distance:r}:"2d"===this.view.type?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,r,a){const{spatialReference:n}=a;r.renderCoordsHelper.toRenderCoords(e,n,O);const s=r.state.camera.computeScreenPixelSizeAt(O),i=s*r.renderCoordsHelper.unitInMeters,o=i/u(n),c=i/l(n),p=t*o,d=t*c,m=G(e,n,_,r),S=m?E(m,e,o,0,0,r,a):0,g=m?E(m,e,0,o,0,r,a):0,h=m?E(m,e,0,0,c,r,a):0;return{x:0===S?0:p/S,y:0===g?0:p/g,z:0===h?0:d/h,distance:s*t}}_candidateIsExcluded(e,t,r){if(null==r)return!1;const a=this._getCandidateObjectId(t);if(null==a)return!1;const n=e.layerSource.layer;return"graphics"===n.type?r.uid===a:r.sourceLayer===n&&(!(!r.attributes||!("objectIdField"in n))&&r.attributes[n.objectIdField]===a)}_getCandidateObjectId(e){return e instanceof L?e.objectId:null}async _createSourceInfo(e,t){const r=e.layer;r.loaded||(await r.load(),i(t));const{view:a}=this,n=await this._createFeatureSnappingSourceType(e);return i(t),new b(null==n?{}:{snappingSource:n,view:a,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:t}=this;if(null==t||"3d"!==t.type)return null;return new((await this._getSourceModule("scene")).SceneLayerSnappingSource)({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case"feature-layer":case"oriented-imagery":return new((await this._getSourceModule("featureService")).FeatureServiceSnappingSource)({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":if("mesh"===e.layer.geometryType)return null;return new((await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource)({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new((await this._getSourceModule("graphics")).GraphicsSnappingSource)({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new((await this._getSourceModule("notes")).GraphicsSnappingSource)({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const t=this._sourceModules[e];if(null==t.loader){const t=this._loadSourceModule(e),r={module:null,loader:t};this._sourceModules[e]=r;const a=await t,n={module:a,loader:t};return this._sourceModules[e]=n,a}return null==t.module?t.loader:t.module}_loadSourceModule(e){const t=this._updatingHandles;switch(e){case"featureService":return t.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return t.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":case"notes":return t.addPromise(import("./featureSources/GraphicsSnappingSource.js"));case"scene":return t.addPromise(import("./featureSources/SceneLayerSnappingSource.js"))}}get test(){}};function P(e){return(e instanceof M||e instanceof R)&&!z(e)}function z({constraint:{start:e,end:t}}){const r=g(e,t),a=m(j(e),j(t));return r<f()||a/r<A}function E(e,t,r,a,n,s,{spatialReference:i}){const o=S(U,t);o[0]+=r,o[1]+=a,o[2]+=n;const c=G(o,i,_,s);return c?C(c,e):1/0}e([p({constructOnly:!0})],H.prototype,"spatialReference",void 0),e([p({constructOnly:!0})],H.prototype,"view",void 0),e([p()],H.prototype,"options",void 0),e([p({readOnly:!0})],H.prototype,"updating",null),e([p()],H.prototype,"_snappingSources",void 0),H=e([d("esri.views.interactive.snapping.FeatureSnappingEngine")],H);const O=h(),U=h(),A=1e-4;export{H as FeatureSnappingEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as s,createAngle as r}from"../../../core/quantityUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as o}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,markAsTarget as a,fromVec3 as d}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as l}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as p,squaredScreenDistance as h}from"./snappingUtils.js";import{LineSnappingCandidate as c}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as f,pointFromDistanceAlongAzimuth as m}from"../../support/angularMeasurementUtils.js";import{projectPointToLineLike as u}from"../../support/geometry3dUtils.js";class x extends l{constructor(e,t,s){super(e,t),this._geodesicLengthMeasurementUtils=s}snapNewVertex(e,t){const s=t.editGeometryOperations.data.components[0],r=s.edges.length,i=[];if(r<1)return i;const{spatialReference:n}=t,a=g(e,n,o,this.view),{view:d}=this,l=s.edges[r-1];let h=l;do{if(this.edgeExceedsShortLineThreshold(h,t)){const s=p(h,d,t);this._processCandidateProposal(s.left,s.right,e,a,t,i)}h=h.leftVertex.leftEdge}while(h&&h!==l);return i}snapExistingVertex(e,t){const s=[],r=t.vertexHandle,i=r.component;if(i.edges.length<2)return s;const{view:a}=this,{spatialReference:d}=t,l=g(e,d,o,a),h=r.leftEdge,c=r.rightEdge;h&&c&&this.edgeExceedsShortLineThreshold(h,t)&&this.edgeExceedsShortLineThreshold(c,t)&&this._processCandidateProposal(n(h.leftVertex.pos,a,t),n(c.rightVertex.pos,a,t),e,l,t,s);const f=i.edges[0];let m=f;do{if(m!==r.leftEdge&&m!==r.rightEdge&&this.edgeExceedsShortLineThreshold(m,t)){const r=p(m,a,t);this._processCandidateProposal(r.left,r.right,e,l,t,s)}m=m.rightVertex.rightEdge}while(m&&m!==f);return s}_processCandidateProposal(e,t,s,r,n,l){const{spatialReference:p,pointer:f}=n,m=i();E(m,e,t,s,n,this._geodesicLengthMeasurementUtils);const u=a(d(m));h(r,g(u,p,o,this.view))<this.squaredProximityThreshold(f)&&l.push(new c({lineStart:e,lineEnd:t,targetPoint:u,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function E(e,t,s,r,i,o){j(e,t,s,r,i,o)||v(e,r,t,s)}function j(i,o,n,a,{spatialReference:d},l){const p=f(o,n,d,d);if(null==p)return!1;const h=f(n,a,d,d);if(null==h)return!1;const c=l.geodesicDistance(n,a,d);if(null==c)return!1;const g=Math.abs(e.shortestSignedDiff(p,h))>Math.PI/2?t.normalize(p+Math.PI):p;return m(i,n,d,s(c,"meters"),r(g,"radians","geographic"),"geodesic"),i[2]=a[2],!0}function v(e,t,s,r){u(t,{start:s,end:r,type:1},e),e[2]=t[2]}export{x as LineSnapper};
5
+ import{cyclicalPI as e,cyclical2PI as t}from"../../../core/Cyclical.js";import{valueInUnit as s,createAngle as r}from"../../../core/quantityUtils.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as o}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as n,markAsTarget as a,fromVec3 as l}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as h,squaredScreenDistance as c}from"./snappingUtils.js";import{LineSnappingCandidate as d}from"./candidates/LineSnappingCandidate.js";import{vectorToScreenPoint as m}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as g,pointFromDistanceAlongAzimuth as f}from"../../support/angularMeasurementUtils.js";import{projectPointToLineLike as u}from"../../support/geometry3dUtils.js";class x extends p{constructor(e,t,s){super(e,t),this._geodesicLengthMeasurementUtils=s}snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],r=s.segments.length,i=[];if(r<1)return i;const{spatialReference:n}=t,a=m(e,n,o,this.view),{view:l}=this,p=s.segments[r-1];let c=p;do{if(this.edgeExceedsShortLineThreshold(c,t)){const s=h(c,l,t);this._processCandidateProposal(s.left,s.right,e,a,t,i)}c=c.leftVertex.leftSegment}while(c&&c!==p);return i}snapExistingVertex(e,t){const s=[],r=t.vertexHandle,i=r.part;if(i.segments.length<2)return s;const{view:a}=this,{spatialReference:l}=t,p=m(e,l,o,a),c=r.leftSegment,d=r.rightSegment;c&&d&&this.edgeExceedsShortLineThreshold(c,t)&&this.edgeExceedsShortLineThreshold(d,t)&&this._processCandidateProposal(n(c.leftVertex.pos,a,t),n(d.rightVertex.pos,a,t),e,p,t,s);const g=i.segments[0];let f=g;do{if(f!==r.leftSegment&&f!==r.rightSegment&&this.edgeExceedsShortLineThreshold(f,t)){const r=h(f,a,t);this._processCandidateProposal(r.left,r.right,e,p,t,s)}f=f.rightVertex.rightSegment}while(f&&f!==g);return s}_processCandidateProposal(e,t,s,r,n,p){const{spatialReference:h,pointer:g}=n,f=i();S(f,e,t,s,n,this._geodesicLengthMeasurementUtils);const u=a(l(f));c(r,m(u,h,o,this.view))<this.squaredProximityThreshold(g)&&p.push(new d({lineStart:e,lineEnd:t,targetPoint:u,isDraped:"on-the-ground"===n.elevationInfo?.mode}))}}function S(e,t,s,r,i,o){j(e,t,s,r,i,o)||v(e,r,t,s)}function j(i,o,n,a,{spatialReference:l},p){const h=g(o,n,l,l);if(null==h)return!1;const c=g(n,a,l,l);if(null==c)return!1;const d=p.geodesicDistance(n,a,l);if(null==d)return!1;const m=Math.abs(e.shortestSignedDiff(h,c))>Math.PI/2?t.normalize(h+Math.PI):h;return f(i,n,l,s(d,"meters"),r(m,"radians","geographic"),"geodesic"),i[2]=a[2],!0}function v(e,t,s,r){u(t,{start:s,end:r,type:1},e),e[2]=t[2]}export{x as LineSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,markAsTarget as o,fromValues as n}from"../sketch/normalizedPoint.js";import{defaults as l}from"./Settings.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as c,squaredScreenDistance as h}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as d}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as p}from"../support/viewUtils.js";import{projectPointToLine as g}from"../../support/geometry2dUtils.js";class f extends a{snapNewVertex(e,t){const s=t.editGeometryOperations.data.components[0],o=s.edges.length,n=s.vertices.length,l=[];if(o<2)return l;const{view:a}=this,h=p(e,t.spatialReference,r,a),d=i(s.vertices[n-1].pos,a,t),g=i(s.vertices[0].pos,a,t),f=s.edges[o-1];let m=f;do{if(this.edgeExceedsShortLineThreshold(m,t)){const r=c(m,a,t);this._checkEdgeForParallelLines(r,d,e,h,t,l),this._checkEdgeForParallelLines(r,g,e,h,t,l)}m=m.leftVertex.leftEdge}while(m&&m!==f);return l}snapExistingVertex(e,t){const s=[],o=t.vertexHandle,n=o.component;if(n.edges.length<3)return s;const{view:l}=this,a=p(e,t.spatialReference,r,l),h=o.leftEdge,d=o.rightEdge,g=n.vertices[0],f=i(g.pos,l,t),m=n.vertices.length,u=n.vertices[m-1],v=i(u.pos,l,t),x=n.edges[0];let E=x;do{if(E!==h&&E!==d&&this.edgeExceedsShortLineThreshold(E,t)){const r=c(E,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,a,t,s),d&&this._checkEdgeForParallelLines(r,i(d.rightVertex.pos,l,t),e,a,t,s),o===g?this._checkEdgeForParallelLines(r,v,e,a,t,s):o===u&&this._checkEdgeForParallelLines(r,f,e,a,t,s)}E=E.rightVertex.rightEdge}while(E&&E!==x);return s}_checkEdgeForParallelLines(t,i,a,c,f,v){const x=t.left,E=t.right;if(g(u,s(i),s(x),s(E)),e(u,s(i))<l.parallelLineThreshold)return;g(u,s(a),s(x),s(E),s(i));const{spatialReference:L,pointer:P}=f,j=o(n(u[0],u[1],a[2]));if(h(c,p(j,L,r,this.view))<this.squaredProximityThreshold(P)){if(this.isVertical(j,i,f)||this.isVertical(x,E,f))return;if(m(t,v))return;v.push(new d({referenceLine:t,lineStart:i,targetPoint:j,isDraped:"on-the-ground"===f.elevationInfo?.mode}))}}}function m(t,r){const i=t.left,o=t.right;for(const n of r)if(g(u,s(o),s(n.constraint.start),s(n.constraint.end),s(i)),e(u,s(o))<l.parallelLineThreshold)return n.addReferenceLine(t),!0;return!1}const u=t();export{f as ParallelLineSnapper};
5
+ import{squaredDistance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as s,markAsTarget as n,fromValues as o}from"../sketch/normalizedPoint.js";import{defaults as l}from"./Settings.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{editEdgeToSnappingEdge as c,squaredScreenDistance as h}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as p}from"./candidates/ParallelLineSnappingCandidate.js";import{vectorToScreenPoint as g}from"../support/viewUtils.js";import{projectPointToLine as f}from"../../support/geometry2dUtils.js";class m extends a{snapNewVertex(e,t){const s=t.editGeometryOperations.data.parts[0],n=s.segments.length,o=s.vertices.length,l=[];if(n<2)return l;const{view:a}=this,h=g(e,t.spatialReference,r,a),p=i(s.vertices[o-1].pos,a,t),f=i(s.vertices[0].pos,a,t),m=s.segments[n-1];let d=m;do{if(this.edgeExceedsShortLineThreshold(d,t)){const r=c(d,a,t);this._checkEdgeForParallelLines(r,p,e,h,t,l),this._checkEdgeForParallelLines(r,f,e,h,t,l)}d=d.leftVertex.leftSegment}while(d&&d!==m);return l}snapExistingVertex(e,t){const s=[],n=t.vertexHandle,o=n.part;if(o.segments.length<3)return s;const{view:l}=this,a=g(e,t.spatialReference,r,l),h=n.leftSegment,p=n.rightSegment,f=o.vertices[0],m=i(f.pos,l,t),d=o.vertices.length,u=o.vertices[d-1],v=i(u.pos,l,t),x=o.segments[0];let L=x;do{if(L!==h&&L!==p&&this.edgeExceedsShortLineThreshold(L,t)){const r=c(L,l,t);h&&this._checkEdgeForParallelLines(r,i(h.leftVertex.pos,l,t),e,a,t,s),p&&this._checkEdgeForParallelLines(r,i(p.rightVertex.pos,l,t),e,a,t,s),n===f?this._checkEdgeForParallelLines(r,v,e,a,t,s):n===u&&this._checkEdgeForParallelLines(r,m,e,a,t,s)}L=L.rightVertex.rightSegment}while(L&&L!==x);return s}_checkEdgeForParallelLines(t,i,a,c,m,v){const x=t.left,L=t.right;if(f(u,s(i),s(x),s(L)),e(u,s(i))<l.parallelLineThreshold)return;f(u,s(a),s(x),s(L),s(i));const{spatialReference:P,pointer:j}=m,E=n(o(u[0],u[1],a[2]));if(h(c,g(E,P,r,this.view))<this.squaredProximityThreshold(j)){if(this.isVertical(E,i,m)||this.isVertical(x,L,m))return;if(d(t,v))return;v.push(new p({referenceLine:t,lineStart:i,targetPoint:E,isDraped:"on-the-ground"===m.elevationInfo?.mode}))}}}function d(t,r){const i=t.left,n=t.right;for(const o of r)if(f(u,s(n),s(o.constraint.start),s(o.constraint.end),s(i)),e(u,s(n))<l.parallelLineThreshold)return o.addReferenceLine(t),!0;return!1}const u=t();export{m as ParallelLineSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as i}from"../../../core/quantityUtils.js";import{subtract as r,dot as s,squaredLength as n,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as c,d as p,i as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as d}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as m,markAsTarget as u,fromValues as x,fromVec3 as v}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as V}from"./SnappingAlgorithm.js";import{squaredScreenDistance as j}from"./snappingUtils.js";import{RightAngleSnappingCandidate as E}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as S}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as k,pointFromDistanceAlongAzimuth as C}from"../../support/angularMeasurementUtils.js";class _ extends V{constructor(e,t,i){super(e,t),this._geodesicLengthMeasurementUtils=i}snapNewVertex(e,t){const i=t.editGeometryOperations.data.components[0],r=[];if(i.vertices.length<2)return r;const{view:s}=this,n=S(e,t.spatialReference,l,s),o=i.vertices.at(-1);this._checkForSnappingCandidate(1,r,o.leftEdge,o,o.leftEdge.leftVertex,e,n,t);const a=i.vertices[0];return this._checkForSnappingCandidate(2,r,a.rightEdge,a,a.rightEdge.rightVertex,e,n,t),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle;if(r.component.vertices.length<3)return i;const{view:s}=this,n=S(e,t.spatialReference,l,s),o=r.leftEdge,a=r.rightEdge;if(o?.leftVertex.leftEdge){const r=o.leftVertex.leftEdge;this._checkForSnappingCandidate(3,i,r,r.rightVertex,r.leftVertex,e,n,t)}if(a?.rightVertex.rightEdge){const r=a.rightVertex.rightEdge;this._checkForSnappingCandidate(3,i,r,r.leftVertex,r.rightVertex,e,n,t)}return i}_checkForSnappingCandidate(e,t,i,r,s,n,o,a){if(!this.edgeExceedsShortLineThreshold(i,a))return;const c=this.view,p=f(r.pos,c,a),g=f(s.pos,c,a);w(U,g,p,n,a,this._geodesicLengthMeasurementUtils),this._checkForSnappingCandidateAlongProjectedRay(e,t,g,p,U,n,o,a)}_checkForSnappingCandidateAlongProjectedRay(e,t,i,a,p,g,f,V){const{spatialReference:k,pointer:C}=V,_=r(R,m(g),m(a)),w=s(p,_)/n(p),y=o(R,m(a),p,w),F=u(x(y[0],y[1],g[2]));if(j(f,S(F,k,l,this.view))>this.squaredProximityThreshold(C)||this.isVertical(F,a,V)||this.isVertical(a,i,V))return;const U=c(h(),a,p,Math.sign(w));t.push(new E({targetPoint:F,constraint:new d(a,v(U)),previousVertex:i,otherVertex:a,otherVertexType:1,selfSnappingType:e,isDraped:"on-the-ground"===V.elevationInfo?.mode}))}}function w(e,t,i,r,s,n){y(e,t,i,r,s,n)||F(e,t,i)}function y(r,s,n,o,{spatialReference:a},c){const g=k(s,n,a,a);if(null==g)return!1;const l=k(n,o,a,a);if(null==l)return!1;const d=Math.sign(e.shortestSignedDiff(g,l))*Math.PI*.5,f=t(g+d,"radians","geographic"),m=h(),u=c.geodesicDistance(n,o,a);return null!=u&&(C(m,n,a,i(u,"meters"),f,"geodesic"),p(r,m,n),!0)}function F(e,t,i){const s=r(R,m(i),m(t));g(e,s[1],-s[0],0)}const R=a(),U=h();export{_ as RightAngleSnapper};
5
+ import{cyclical2PI as e}from"../../../core/Cyclical.js";import{createAngle as t,valueInUnit as r}from"../../../core/quantityUtils.js";import{subtract as i,dot as n,squaredLength as s,scaleAndAdd as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as c,d as p,i as g}from"../../../chunks/vec32.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as m}from"../sketch/constraints.js";import{fromAnyMapPoint as f,asVec2 as d,markAsTarget as u,fromValues as x,fromVec3 as S}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as v}from"./SnappingAlgorithm.js";import{squaredScreenDistance as V}from"./snappingUtils.js";import{RightAngleSnappingCandidate as j}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as k}from"../support/viewUtils.js";import{radiansGeographicBetweenVec as C,pointFromDistanceAlongAzimuth as _}from"../../support/angularMeasurementUtils.js";class w extends v{constructor(e,t,r){super(e,t),this._geodesicLengthMeasurementUtils=r}snapNewVertex(e,t){const r=t.editGeometryOperations.data.parts[0],i=[];if(r.vertices.length<2)return i;const{view:n}=this,s=k(e,t.spatialReference,l,n),o=r.vertices.at(-1);this._checkForSnappingCandidate(1,i,o.leftSegment,o,o.leftSegment.leftVertex,e,s,t);const a=r.vertices[0];return this._checkForSnappingCandidate(2,i,a.rightSegment,a,a.rightSegment.rightVertex,e,s,t),i}snapExistingVertex(e,t){const r=[],i=t.vertexHandle;if(i.part.vertices.length<3)return r;const{view:n}=this,s=k(e,t.spatialReference,l,n),o=i.leftSegment,a=i.rightSegment;if(o?.leftVertex.leftSegment){const i=o.leftVertex.leftSegment;this._checkForSnappingCandidate(3,r,i,i.rightVertex,i.leftVertex,e,s,t)}if(a?.rightVertex.rightSegment){const i=a.rightVertex.rightSegment;this._checkForSnappingCandidate(3,r,i,i.leftVertex,i.rightVertex,e,s,t)}return r}_checkForSnappingCandidate(e,t,r,i,n,s,o,a){if(!this.edgeExceedsShortLineThreshold(r,a))return;const c=this.view,p=f(i.pos,c,a),g=f(n.pos,c,a);y(M,g,p,s,a,this._geodesicLengthMeasurementUtils),this._checkForSnappingCandidateAlongProjectedRay(e,t,g,p,M,s,o,a)}_checkForSnappingCandidateAlongProjectedRay(e,t,r,a,p,g,f,v){const{spatialReference:C,pointer:_}=v,w=i(U,d(g),d(a)),y=n(p,w)/s(p),F=o(U,d(a),p,y),R=u(x(F[0],F[1],g[2]));if(V(f,k(R,C,l,this.view))>this.squaredProximityThreshold(_)||this.isVertical(R,a,v)||this.isVertical(a,r,v))return;const M=c(h(),a,p,Math.sign(y));t.push(new j({targetPoint:R,constraint:new m(a,S(M)),previousVertex:r,otherVertex:a,otherVertexType:1,selfSnappingType:e,isDraped:"on-the-ground"===v.elevationInfo?.mode}))}}function y(e,t,r,i,n,s){F(e,t,r,i,n,s)||R(e,t,r)}function F(i,n,s,o,{spatialReference:a},c){const g=C(n,s,a,a);if(null==g)return!1;const l=C(s,o,a,a);if(null==l)return!1;const m=Math.sign(e.shortestSignedDiff(g,l))*Math.PI*.5,f=t(g+m,"radians","geographic"),d=h(),u=c.geodesicDistance(s,o,a);return null!=u&&(_(d,s,a,r(u,"meters"),f,"geodesic"),p(i,d,s),!0)}function R(e,t,r){const n=i(U,d(r),d(t));g(e,n[1],-n[0],0)}const U=a(),M=h();export{w as RightAngleSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as o,asVec2 as s,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{squaredScreenDistance as d}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as l}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as m}from"../support/viewUtils.js";import{projectPointToCircle as c}from"../../support/geometry2dUtils.js";class h extends a{snapNewVertex(e,t){const i=t.editGeometryOperations.data.components[0],r=[],s=i.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||s<2)return r;const{view:n}=this,p=i.vertices[0],a=i.vertices[s-1],d=o(p.pos,n,t),l=o(a.pos,n,t);return this._processCandidateProposal(d,l,e,t,r),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle,s=r.component;if(s.edges.length<2)return i;if("polyline"===t.editGeometryOperations.data.type&&(0===r.index||r.index===s.vertices.length-1))return i;const{view:n}=this,p=o(r.leftEdge.leftVertex.pos,n,t),a=o(r.rightEdge.rightVertex.pos,n,t);return this._processCandidateProposal(p,a,e,t,i),i}_processCandidateProposal(i,o,a,h,g){if(!this.exceedsShortLineThreshold(i,o,h))return;const v=e(f,s(i),s(o),.5),x=.5*t(s(i),s(o)),u=c(f,s(a),v,x),j=n(p(u[0],u[1],a[2])),{spatialReference:y,pointer:w}=h,P=m(a,y,r,this.view);if(d(P,m(j,y,r,this.view))<this.squaredProximityThreshold(w)){if(this.isVertical(i,j,h)||this.isVertical(j,o,h))return;g.push(new l({targetPoint:j,point1:i,point2:o,isDraped:"on-the-ground"===h.elevationInfo?.mode}))}}}const f=i();export{h as RightAngleTriangleSnapper};
5
+ import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as s,asVec2 as o,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import{squaredScreenDistance as l}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as m}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToCircle as h}from"../../support/geometry2dUtils.js";class c extends a{snapNewVertex(e,t){const i=t.editGeometryOperations.data.parts[0],r=[],o=i.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||o<2)return r;const{view:n}=this,p=i.vertices[0],a=i.vertices[o-1],l=s(p.pos,n,t),m=s(a.pos,n,t);return this._processCandidateProposal(l,m,e,t,r),r}snapExistingVertex(e,t){const i=[],r=t.vertexHandle,o=r.part;if(o.segments.length<2)return i;if("polyline"===t.editGeometryOperations.data.type&&(0===r.index||r.index===o.vertices.length-1))return i;const{view:n}=this,p=s(r.leftSegment.leftVertex.pos,n,t),a=s(r.rightSegment.rightVertex.pos,n,t);return this._processCandidateProposal(p,a,e,t,i),i}_processCandidateProposal(i,s,a,c,g){if(!this.exceedsShortLineThreshold(i,s,c))return;const v=e(f,o(i),o(s),.5),x=.5*t(o(i),o(s)),u=h(f,o(a),v,x),j=n(p(u[0],u[1],a[2])),{spatialReference:y,pointer:w}=c,P=d(a,y,r,this.view);if(l(P,d(j,y,r,this.view))<this.squaredProximityThreshold(w)){if(this.isVertical(i,j,c)||this.isVertical(j,s,c))return;g.push(new m({targetPoint:j,point1:i,point2:s,isDraped:"on-the-ground"===c.elevationInfo?.mode}))}}}const f=i();export{c as RightAngleTriangleSnapper};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{abortMaybe as n,removeMaybe as e}from"../../../core/maybe.js";import{ignoreAbortErrors as t,debounce as o}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as l}from"../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as a}from"../../../support/elevationInfoUtils.js";import{EventPipeline as s}from"../dragEventPipeline.js";import{SnappingContext as u}from"./SnappingContext.js";import{ImmediateTask as c,TaskPriority as p}from"../../support/Scheduler.js";function f({predicate:o=()=>!0,snappingManager:i,snappingContext:l,updatingHandles:u,useZ:c=!0}){const p=new s;if(null==i)return{snappingStep:[y,p],cancelSnapping:y};let f,Z=null,j=null,z=null;const T=()=>{Z=n(Z),i.doneSnapping(),j?.frameTask.remove(),j=null,f=e(f),z=null},k=d(i,c,p);let w=null,I=null,U=null;return{snappingStep:[n=>{if(!o(n))return n;const{action:e}=n;if("start"===e){const{info:e}=n,t=m(i.view);if(j=g(l,n,t),j.context.selfSnappingZ=null,!c&&null!=e){const n=S(l.coordinateHelper,e.handle.component);null!=n&&(j.context.selfSnappingZ={value:n,elevationInfo:l.elevationInfo??a})}}if(null!=j){const{context:o,originalScenePos:l,originalPos:a}=j,{mapEnd:s,mapStart:p,scenePoints:d}=n,m=x(a,v(s,p)),g=v(p,a),S={...n,action:"update"},y=j.context,T=P(l,d),C=i.update({point:m,scenePoint:T,context:o});if(U=C,h(s,C,g,c),w=m,I=T,"end"!==e){const{frameTask:n}=j;null==Z&&(Z=new AbortController),z=e=>{u.addPromise(t(k({frameTask:n,event:S,context:y,point:m,scenePoint:T,delta:g,getLastState:()=>({point:w,scenePoint:I,updatePoint:e.forceUpdate?null:U})},Z.signal)))},z({forceUpdate:!1}),null==f&&(f=r(()=>i.options.effectiveEnabled,()=>z?.({forceUpdate:!0})))}}return"end"===e&&T(),n},p],cancelSnapping:n=>(T(),n)}}function d(n,e,t){return o(async({frameTask:o,point:r,scenePoint:l,context:a,event:s,delta:u,getLastState:c},p)=>{const f=await o.schedule(()=>n.snap({point:r,scenePoint:l,context:a,signal:p}),p);if(f.valid){let l=await o.schedule(()=>f.apply(),p);const d=c();null!=d.point&&r!==d.point&&(l=n.update({point:d.point,scenePoint:d.scenePoint,context:a})),null!=d.updatePoint&&i(l,d.updatePoint)||(h(s.mapEnd,l,u,e),t.execute(s))}})}function m(n){return"3d"===n.type?n.resourceController.scheduler.registerTask(p.SNAPPING):c}function g(n,e,t){return{context:new u({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:null!=e.info?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:null!=e.snapOrigin?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:null!=e.scenePoints?e.scenePoints.sceneStart:null,frameTask:t}}function x(n,[e,t,o]){const r=l(n);return r.x+=e,r.y+=t,r.hasZ&&(r.z+=o),r}function P(n,e){return null==n||null==e?null:x(n,v(e.sceneEnd,e.sceneStart))}function v(n,e){const t=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,t]}function h(n,e,[t,o,r],i){n.x=e.x+t,n.y=e.y+o,i&&n.hasZ&&e.hasZ&&(n.z=e.z+r)}function S(n,e){if(!n.hasZ())return null;const t=e.vertices;let o=null;for(const r of t){const e=n.getZ(r.pos);if(null!=o&&null!=e&&Math.abs(e-o)>1e-6)return null;null==o&&(o=e)}return o}function y(n){return n}export{f as createSnapDragEventPipelineStep};
5
+ import{abortMaybe as n,removeMaybe as e}from"../../../core/maybe.js";import{ignoreAbortErrors as t,debounce as o}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{pointEquals as i}from"../../../layers/graphics/dehydratedFeatureComparison.js";import{clonePoint as a}from"../../../layers/graphics/hydratedFeatures.js";import{absoluteHeightElevationInfo as l}from"../../../support/elevationInfoUtils.js";import{EventPipeline as s}from"../dragEventPipeline.js";import{SnappingContext as u}from"./SnappingContext.js";import{ImmediateTask as p,TaskPriority as c}from"../../support/Scheduler.js";function f({predicate:o=()=>!0,snappingManager:i,snappingContext:a,updatingHandles:u,useZ:p=!0}){const c=new s;if(null==i)return{snappingStep:[y,c],cancelSnapping:y};let f,Z=null,j=null,z=null;const T=()=>{Z=n(Z),i.doneSnapping(),j?.frameTask.remove(),j=null,f=e(f),z=null},k=d(i,p,c);let w=null,I=null,U=null;return{snappingStep:[n=>{if(!o(n))return n;const{action:e}=n;if("start"===e){const{info:e}=n,t=m(i.view);if(j=g(a,n,t),j.context.selfSnappingZ=null,!p&&null!=e){const n=S(a.coordinateHelper,e.handle.part);null!=n&&(j.context.selfSnappingZ={value:n,elevationInfo:a.elevationInfo??l})}}if(null!=j){const{context:o,originalScenePos:a,originalPos:l}=j,{mapEnd:s,mapStart:c,scenePoints:d}=n,m=x(l,v(s,c)),g=v(c,l),S={...n,action:"update"},y=j.context,T=P(a,d),C=i.update({point:m,scenePoint:T,context:o});if(U=C,h(s,C,g,p),w=m,I=T,"end"!==e){const{frameTask:n}=j;null==Z&&(Z=new AbortController),z=e=>{u.addPromise(t(k({frameTask:n,event:S,context:y,point:m,scenePoint:T,delta:g,getLastState:()=>({point:w,scenePoint:I,updatePoint:e.forceUpdate?null:U})},Z.signal)))},z({forceUpdate:!1}),null==f&&(f=r(()=>i.options.effectiveEnabled,()=>z?.({forceUpdate:!0})))}}return"end"===e&&T(),n},c],cancelSnapping:n=>(T(),n)}}function d(n,e,t){return o(async({frameTask:o,point:r,scenePoint:a,context:l,event:s,delta:u,getLastState:p},c)=>{const f=await o.schedule(()=>n.snap({point:r,scenePoint:a,context:l,signal:c}),c);if(f.valid){let a=await o.schedule(()=>f.apply(),c);const d=p();null!=d.point&&r!==d.point&&(a=n.update({point:d.point,scenePoint:d.scenePoint,context:l})),null!=d.updatePoint&&i(a,d.updatePoint)||(h(s.mapEnd,a,u,e),t.execute(s))}})}function m(n){return"3d"===n.type?n.resourceController.scheduler.registerTask(c.SNAPPING):p}function g(n,e,t){return{context:new u({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:null!=e.info?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:null!=e.snapOrigin?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:null!=e.scenePoints?e.scenePoints.sceneStart:null,frameTask:t}}function x(n,[e,t,o]){const r=a(n);return r.x+=e,r.y+=t,r.hasZ&&(r.z+=o),r}function P(n,e){return null==n||null==e?null:x(n,v(e.sceneEnd,e.sceneStart))}function v(n,e){const t=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,t]}function h(n,e,[t,o,r],i){n.x=e.x+t,n.y=e.y+o,i&&n.hasZ&&e.hasZ&&(n.z=e.z+r)}function S(n,e){if(!n.hasZ())return null;const t=e.vertices;let o=null;for(const r of t){const e=n.getZ(r.pos);if(null!=o&&null!=e&&Math.abs(e-o)>1e-6)return null;null==o&&(o=e)}return o}function y(n){return n}export{f as createSnapDragEventPipelineStep};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{debounce as a,throwIfAborted as l}from"../../../core/promiseUtils.js";import{on as n}from"../../../core/reactiveUtils.js";import{sqlAnd as p}from"../../../core/sql.js";import{getMetersPerUnitForSR as c}from"../../../core/unitUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import y from"../../../geometry/Extent.js";import{getResolutionForScale as m}from"../../../geometry/support/scaleUtils.js";import{collectFields as d}from"../../../layers/support/fieldUtils.js";import{getLayerFloorFilterClause as f}from"../../../layers/support/floorFilterUtils.js";import{calculateTolerance as g}from"../../../renderers/support/clickToleranceUtils.js";import{identify as b}from"../../../rest/identify.js";import w from"../../../rest/support/IdentifyParameters.js";import{loadArcade as v}from"../../../support/loadArcade.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{getRequiredFields as j,getFetchPopupTemplate as S}from"./popupUtils.js";let F=null;function _(e,t){return"tile"===t.type||"map-image"===t.type}let P=class extends r{constructor(e){super(e),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=a(async e=>{this.destroyed||this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch(()=>{}))})}initialize(){const e=e=>{for(const t of e){const{sourceLayer:e}=t;null!=e&&"geometryType"in e&&"point"===e.geometryType&&t.visible&&(t.visible=!1,this.highlightGraphicUpdated?.({graphic:t,property:"visible",oldValue:!0,newValue:!1}))}this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e).catch(()=>{})),this.updateHighlightedFeatures(this._highlightGeometriesResolution)};this.addHandles([n(()=>this.highlightGraphics,"change",t=>e(t.added),{onListenerAdd:t=>e(t)})])}async fetchPopupFeaturesAtLocation(e,t){const{layerView:{layer:r,view:{scale:i}}}=this;if(!e)throw new s("fetchPopupFeatures:invalid-area","Nothing to fetch without area",{layer:r});const o=G(r.sublayers,i,t);if(!o.length)return[];const a=await U(r,o);if(!((r.capabilities?.operations?.supportsIdentify??!0)&&r.version>=10.5)&&!a)throw new s("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:r});return a?this._fetchPopupFeaturesUsingQueries(e,o,t):this._fetchPopupFeaturesUsingIdentify(e,o,t)}clearHighlights(){this.highlightGraphics?.removeAll()}async _updateHighlightedFeaturesSymbols(e){for(const t of e)this._updateSymbology(t)}_updateSymbology(e){if("point"===e.geometry?.type)return this._updatePointSymbology(e)}_setGraphicSymbol(e,t){if(!t)return;const r=e.symbol;e.symbol=t,this.highlightGraphicUpdated?.({graphic:e,property:"symbol",oldValue:r,newValue:t})}_updatePointSymbology(e){const r=e.sourceLayer&&"renderer"in e.sourceLayer&&e.sourceLayer.renderer,{highlightGraphicUpdated:i,highlightGraphics:s,layerView:{view:o}}=this,a=e=>{e.visible||(e.visible=!0,i?.({graphic:e,property:"visible",oldValue:!1,newValue:!0}))};r&&"getSymbolAsync"in r?r.getSymbolAsync(e).then(async i=>{i||=new x;let l=null;const n="visualVariables"in r?r.visualVariables?.find(e=>"size"===e.type):void 0;n&&(F||(F=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSize),l=F(n,e,{view:o.type,scale:o.scale,shape:"simple-marker"===i.type?i.style:null})),l||="width"in i&&"height"in i&&null!=i.width&&null!=i.height?Math.max(i.width,i.height):"size"in i?i.size:16,s?.includes(e)&&(this._setGraphicSymbol(e,new x({style:"square",size:l,color:new t([255,255,255,1/255]),xoffset:"xoffset"in i?i.xoffset:0,yoffset:"yoffset"in i?i.yoffset:0})),a(e))}):a(e)}async _updateHighlightedFeaturesGeometries(e){const{layerView:{layer:t,view:r},highlightGraphics:i,highlightGraphicUpdated:s}=this;if(this._highlightGeometriesResolution=e,!s||!i?.length||!t.capabilities.operations.supportsQuery)return;const a=this._getTargetResolution(e),l=new Map;for(const c of i)if(!this._featuresResolutions.has(c)||this._featuresResolutions.get(c)>a){const e=c.sourceLayer;o(l,e,()=>new Map).set(c.getObjectId(),c)}const n=Array.from(l,([e,t])=>{const i=e.createQuery();return i.objectIds=[...t.keys()],i.outFields=[e.objectIdField],i.returnGeometry=!0,i.maxAllowableOffset=a,i.outSpatialReference=r.spatialReference,e.queryFeatures(i)}),p=await Promise.all(n);if(!this.destroyed)for(const{features:o}of p)for(const e of o){const t=e.sourceLayer,r=l.get(t).get(e.getObjectId());if(r&&i.includes(r)){const t=r.geometry;r.geometry=e.geometry,s({graphic:r,property:"geometry",oldValue:t,newValue:r.geometry}),this._featuresResolutions.set(r,a)}}}_getTargetResolution(e){const t=e*c(this.layerView.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t,r){const i=await this._createIdentifyParameters(e,t,r);if(null==i)return[];const{results:s}=await b(this.layerView.layer.parsedUrl,i,r);return s.map(e=>e.feature)}async _createIdentifyParameters(e,t,r){const{floors:i,layer:s,timeExtent:o,view:{spatialReference:a,scale:l}}=this.layerView;if(!t.length)return null;await Promise.all(t.map(({sublayer:e})=>e.load(r).catch(()=>{})));const n=Math.min(has("mapservice-popup-identify-max-tolerance"),s.allSublayers.reduce((e,t)=>t.renderer?g({renderer:t.renderer,pointerType:r?.pointerType}):e,2)),p=this.createFetchPopupFeaturesQueryGeometry(e,n),c=m(l,a),u=Math.round(p.width/c),h=new y({xmin:p.center.x-c*u,ymin:p.center.y-c*u,xmax:p.center.x+c*u,ymax:p.center.y+c*u,spatialReference:p.spatialReference});return new w({floors:i,gdbVersion:"gdbVersion"in s?s.gdbVersion:void 0,geometry:e,height:u,layerOption:"popup",mapExtent:h,returnGeometry:!0,spatialReference:a,sublayers:s.sublayers,timeExtent:o,tolerance:n,width:u})}async _fetchPopupFeaturesUsingQueries(e,t,r){const{layerView:{floors:s,timeExtent:o}}=this,a=t.map(async({sublayer:t,popupTemplate:i})=>{if(await t.load(r).catch(()=>{}),t.capabilities&&!t.capabilities.operations.supportsQuery)return[];const a=t.createQuery(),n=g({renderer:t.renderer,pointerType:r?.pointerType}),c=this.createFetchPopupFeaturesQueryGeometry(e,n),u=new Set,[h]=await Promise.all([j(t,i),t.renderer?.collectRequiredFields(u,t.fieldsIndex)]);l(r),d(u,t.fieldsIndex,h);const y=Array.from(u).sort();a.geometry=c,a.outFields=y,a.timeExtent=o;const m=f(s,t);if(a.where=p(a.where,m),t.capabilities?.query.supportsOrderBy&&t.orderBy?.[0]){const e=t.orderBy[0],r=!e.valueExpression&&e.field,i="ascending"===e.order?"asc":"desc";r&&(a.orderByFields=[`${r} ${i}`])}const b=this._getTargetResolution(c.width/n),w=await V(i);l(r);const v="point"===t.geometryType||w&&w.arcadeUtils.hasGeometryOperations(i);v||(a.maxAllowableOffset=b);let{features:x}=await t.queryFeatures(a,r);const S=v?0:b;x=await R(t,x,r);for(const e of x)this._featuresResolutions.set(e,S);return x});return(await Promise.allSettled(a)).reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).filter(i)}};function G(e,t,r){const i=[];if(!e)return i;const s=e=>{const o=0===e.minScale||t<=e.minScale,a=0===e.maxScale||t>=e.maxScale;if(e.visible&&o&&a)if(e.sublayers)e.sublayers.forEach(s);else if(e.popupEnabled){const t=S(e,{...r,defaultPopupTemplateEnabled:!1});null!=t&&i.unshift({sublayer:e,popupTemplate:t})}};return e.map(s),i}function V(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type)?v():Promise.resolve()}async function U(e,t){if(e.capabilities?.operations?.supportsQuery)return!0;try{return await Promise.any(t.map(({sublayer:e})=>e.load().then(()=>e.capabilities.operations.supportsQuery)))}catch{return!1}}async function R(e,t,r){const i=e.renderer;return i&&"defaultSymbol"in i&&!i.defaultSymbol&&(t=i.valueExpression?await Promise.all(t.map(e=>i.getSymbolAsync(e,r).then(t=>t?e:null))).then(e=>e.filter(e=>null!=e)):t.filter(e=>null!=i.getSymbol(e))),t}e([u({constructOnly:!0})],P.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),e([u({constructOnly:!0})],P.prototype,"layerView",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphics",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphicUpdated",void 0),e([u({constructOnly:!0})],P.prototype,"updatingHandles",void 0),P=e([h("esri.views.layers.support.MapServiceLayerViewHelper")],P);export{P as MapServiceLayerViewHelper,G as collectPopupProviders,_ as isMapServiceLayerView};
5
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Error.js";import has from"../../../core/has.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{debounce as a,throwIfAborted as l}from"../../../core/promiseUtils.js";import{on as n}from"../../../core/reactiveUtils.js";import{sqlAnd as p}from"../../../core/sql.js";import{getMetersPerUnitForSR as c}from"../../../core/unitUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import y from"../../../geometry/Extent.js";import{getResolutionForScale as m}from"../../../geometry/support/scaleUtils.js";import{collectFields as d}from"../../../layers/support/fieldUtils.js";import{getLayerFloorFilterClause as f}from"../../../layers/support/floorFilterUtils.js";import{calculateTolerance as g}from"../../../renderers/support/clickToleranceUtils.js";import{identify as b}from"../../../rest/identify.js";import w from"../../../rest/support/IdentifyParameters.js";import{loadArcade as v}from"../../../support/loadArcade.js";import x from"../../../symbols/SimpleMarkerSymbol.js";import{getRequiredFields as j,getFetchPopupTemplate as S}from"./popupUtils.js";let F=null;function _(e,t){return"tile"===t.type||"map-image"===t.type}let P=class extends r{constructor(e){super(e),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=a(async e=>{this.destroyed||await this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch(()=>{}))})}initialize(){const e=e=>{for(const t of e){const{sourceLayer:e}=t;null!=e&&"geometryType"in e&&"point"===e.geometryType&&t.visible&&(t.visible=!1,this.highlightGraphicUpdated?.({graphic:t,property:"visible",oldValue:!0,newValue:!1}))}this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e).catch(()=>{})),this.updateHighlightedFeatures(this._highlightGeometriesResolution)};this.addHandles([n(()=>this.highlightGraphics,"change",t=>e(t.added),{onListenerAdd:t=>e(t)})])}async fetchPopupFeaturesAtLocation(e,t){const{layerView:{layer:r,view:{scale:i}}}=this;if(!e)throw new s("fetchPopupFeatures:invalid-area","Nothing to fetch without area",{layer:r});const o=G(r.sublayers,i,t);if(!o.length)return[];const a=await U(r,o);if(!((r.capabilities?.operations?.supportsIdentify??!0)&&r.version>=10.5)&&!a)throw new s("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:r});return a?this._fetchPopupFeaturesUsingQueries(e,o,t):this._fetchPopupFeaturesUsingIdentify(e,o,t)}clearHighlights(){this.highlightGraphics?.removeAll()}async _updateHighlightedFeaturesSymbols(e){for(const t of e)this._updateSymbology(t)}_updateSymbology(e){if("point"===e.geometry?.type)return this._updatePointSymbology(e)}_setGraphicSymbol(e,t){if(!t)return;const r=e.symbol;e.symbol=t,this.highlightGraphicUpdated?.({graphic:e,property:"symbol",oldValue:r,newValue:t})}_updatePointSymbology(e){const r=e.sourceLayer&&"renderer"in e.sourceLayer&&e.sourceLayer.renderer,{highlightGraphicUpdated:i,highlightGraphics:s,layerView:{view:o}}=this,a=e=>{e.visible||(e.visible=!0,i?.({graphic:e,property:"visible",oldValue:!1,newValue:!0}))};r&&"getSymbolAsync"in r?r.getSymbolAsync(e).then(async i=>{i||=new x;let l=null;const n="visualVariables"in r?r.visualVariables?.find(e=>"size"===e.type):void 0;n&&(F||(F=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSize),l=F(n,e,{view:o.type,scale:o.scale,shape:"simple-marker"===i.type?i.style:null})),l||="width"in i&&"height"in i&&null!=i.width&&null!=i.height?Math.max(i.width,i.height):"size"in i?i.size:16,s?.includes(e)&&(this._setGraphicSymbol(e,new x({style:"square",size:l,color:new t([255,255,255,1/255]),xoffset:"xoffset"in i?i.xoffset:0,yoffset:"yoffset"in i?i.yoffset:0})),a(e))}):a(e)}async _updateHighlightedFeaturesGeometries(e){const{layerView:{layer:t,view:r},highlightGraphics:i,highlightGraphicUpdated:s}=this;if(this._highlightGeometriesResolution=e,!s||!i?.length||!t.capabilities.operations.supportsQuery)return;const a=this._getTargetResolution(e),l=new Map;for(const c of i)if(!this._featuresResolutions.has(c)||this._featuresResolutions.get(c)>a){const e=c.sourceLayer;o(l,e,()=>new Map).set(c.getObjectId(),c)}const n=Array.from(l,([e,t])=>{const i=e.createQuery();return i.objectIds=[...t.keys()],i.outFields=[e.objectIdField],i.returnGeometry=!0,i.maxAllowableOffset=a,i.outSpatialReference=r.spatialReference,e.queryFeatures(i)}),p=await Promise.all(n);if(!this.destroyed)for(const{features:o}of p)for(const e of o){const t=e.sourceLayer,r=l.get(t).get(e.getObjectId());if(r&&i.includes(r)){const t=r.geometry;r.geometry=e.geometry,s({graphic:r,property:"geometry",oldValue:t,newValue:r.geometry}),this._featuresResolutions.set(r,a)}}}_getTargetResolution(e){const t=e*c(this.layerView.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t,r){const i=await this._createIdentifyParameters(e,t,r);if(null==i)return[];const{results:s}=await b(this.layerView.layer.parsedUrl,i,r);return s.map(e=>e.feature)}async _createIdentifyParameters(e,t,r){const{floors:i,layer:s,timeExtent:o,view:{spatialReference:a,scale:l}}=this.layerView;if(!t.length)return null;await Promise.all(t.map(({sublayer:e})=>e.load(r).catch(()=>{})));const n=Math.min(has("mapservice-popup-identify-max-tolerance"),s.allSublayers.reduce((e,t)=>t.renderer?g({renderer:t.renderer,pointerType:r?.pointerType}):e,2)),p=this.createFetchPopupFeaturesQueryGeometry(e,n),c=m(l,a),u=Math.round(p.width/c),h=new y({xmin:p.center.x-c*u,ymin:p.center.y-c*u,xmax:p.center.x+c*u,ymax:p.center.y+c*u,spatialReference:p.spatialReference});return new w({floors:i,gdbVersion:"gdbVersion"in s?s.gdbVersion:void 0,geometry:e,height:u,layerOption:"popup",mapExtent:h,returnGeometry:!0,spatialReference:a,sublayers:s.sublayers,timeExtent:o,tolerance:n,width:u})}async _fetchPopupFeaturesUsingQueries(e,t,r){const{layerView:{floors:s,timeExtent:o}}=this,a=t.map(async({sublayer:t,popupTemplate:i})=>{if(await t.load(r).catch(()=>{}),t.capabilities&&!t.capabilities.operations.supportsQuery)return[];const a=t.createQuery(),n=g({renderer:t.renderer,pointerType:r?.pointerType}),c=this.createFetchPopupFeaturesQueryGeometry(e,n),u=new Set,[h]=await Promise.all([j(t,i),t.renderer?.collectRequiredFields(u,t.fieldsIndex)]);l(r),d(u,t.fieldsIndex,h);const y=Array.from(u).sort();a.geometry=c,a.outFields=y,a.timeExtent=o;const m=f(s,t);if(a.where=p(a.where,m),t.capabilities?.query.supportsOrderBy&&t.orderBy?.[0]){const e=t.orderBy[0],r=!e.valueExpression&&e.field,i="ascending"===e.order?"asc":"desc";r&&(a.orderByFields=[`${r} ${i}`])}const b=this._getTargetResolution(c.width/n),w=await V(i);l(r);const v="point"===t.geometryType||w&&w.arcadeUtils.hasGeometryOperations(i);v||(a.maxAllowableOffset=b);let{features:x}=await t.queryFeatures(a,r);const S=v?0:b;x=await R(t,x,r);for(const e of x)this._featuresResolutions.set(e,S);return x});return(await Promise.allSettled(a)).reduce((e,t)=>"fulfilled"===t.status?[...e,...t.value]:e,[]).filter(i)}};function G(e,t,r){const i=[];if(!e)return i;const s=e=>{const o=0===e.minScale||t<=e.minScale,a=0===e.maxScale||t>=e.maxScale;if(e.visible&&o&&a)if(e.sublayers)e.sublayers.forEach(s);else if(e.popupEnabled){const t=S(e,{...r,defaultPopupTemplateEnabled:!1});null!=t&&i.unshift({sublayer:e,popupTemplate:t})}};return e.map(s),i}function V(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some(e=>"expression"===e.type)?v():Promise.resolve()}async function U(e,t){if(e.capabilities?.operations?.supportsQuery)return!0;try{return await Promise.any(t.map(({sublayer:e})=>e.load().then(()=>e.capabilities.operations.supportsQuery)))}catch{return!1}}async function R(e,t,r){const i=e.renderer;return i&&"defaultSymbol"in i&&!i.defaultSymbol&&(t=i.valueExpression?await Promise.all(t.map(e=>i.getSymbolAsync(e,r).then(t=>t?e:null))).then(e=>e.filter(e=>null!=e)):t.filter(e=>null!=i.getSymbol(e))),t}e([u({constructOnly:!0})],P.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),e([u({constructOnly:!0})],P.prototype,"layerView",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphics",void 0),e([u({constructOnly:!0})],P.prototype,"highlightGraphicUpdated",void 0),e([u({constructOnly:!0})],P.prototype,"updatingHandles",void 0),P=e([h("esri.views.layers.support.MapServiceLayerViewHelper")],P);export{P as MapServiceLayerViewHelper,G as collectPopupProviders,_ as isMapServiceLayerView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import o from"../../Color.js";import s from"../../Graphic.js";import t from"../../core/Accessor.js";import l from"../../core/Collection.js";import{lerp as r}from"../../core/mathUtils.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 n from"../../symbols/PointSymbol3D.js";import m from"../../symbols/SimpleFillSymbol.js";import h from"../../symbols/TextSymbol.js";import p from"../../symbols/TextSymbol3DLayer.js";import c from"../../symbols/callouts/LineCallout3D.js";import y from"../../symbols/callouts/LineCallout3DBorder.js";import b from"../../symbols/support/Symbol3DVerticalOffset.js";const u=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let d=class extends t{constructor(e){super(e),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._symbols=u.map(e=>new m({color:[e[0],e[1],e[2],.6],outline:{color:"black",width:1}})),this._enabled=!0}initialize(){this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.update())}update(){if(!this._enabled)return void this.clear();const e=e=>{if(null!=e.label)return e.label;let o=e.lij.toString();return null!=e.loadPriority&&(o+=` (${e.loadPriority})`),e.measures&&(o+=`[${e.measures.lodLevel}]`),o},t=this.getTiles(),i=new Array,a=new Set((this._labels.size,this._labels.keys()));t.forEach((m,u)=>{const d=m.lij.toString();a.delete(d);const g=m.measures?.lodLevel??m.level,f=m.geometry;if(this.enablePolygons&&!this._polygons.has(d)){const e=m.polygonSymbol??this._symbols[g%this._symbols.length],o=new s({geometry:f,symbol:e});this._polygons.set(d,o),i.push(o)}if(this.enableLabels){const a=e(m),g=u/(t.length-1),w=r(0,200,g),_=r(20,6,g)/.75,j=null!=m.loadPriority&&m.loadPriority>=t.length,v=new o([w,j?0:w,j?0:w]),S="3d"===this.view.type?()=>new n({verticalOffset:new b({screenLength:40/.75}),callout:new c({color:new o("white"),border:new y({color:new o("black")})}),symbolLayers:new l([new p({text:a,halo:{color:"white",size:1/.75},material:{color:v},size:_})])}):()=>new h({text:a,haloColor:"white",haloSize:1/.75,color:v,size:_}),L=this._labels.get(d);if(L){const e=S();null!=L.symbol&&JSON.stringify(e)===JSON.stringify(L.symbol)||(L.symbol=e)}else{const e=new s({geometry:f.extent.center,symbol:S()});this._labels.set(d,e),i.push(e)}}});const m=new Array;a.forEach(e=>{const o=this._polygons.get(e);null!=o&&(m.push(o),this._polygons.delete(e));const s=this._labels.get(e);null!=s&&(m.push(s),this._labels.delete(e))}),this.view.graphics.removeMany(m),this.view.graphics.addMany(i)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};e([i({constructOnly:!0})],d.prototype,"view",void 0),e([i({readOnly:!0})],d.prototype,"updating",void 0),e([i()],d.prototype,"enabled",null),d=e([a("esri.views.support.TileTreeDebugger")],d);export{d as TileTreeDebugger};
5
+ import{__decorate as e}from"tslib";import o from"../../Color.js";import s from"../../Graphic.js";import t from"../../core/Accessor.js";import l from"../../core/Collection.js";import{lerp as r}from"../../core/mathUtils.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 n}from"../../core/accessorSupport/decorators/subclass.js";import a from"../../symbols/PointSymbol3D.js";import m from"../../symbols/SimpleFillSymbol.js";import h from"../../symbols/TextSymbol.js";import p from"../../symbols/TextSymbol3DLayer.js";import c from"../../symbols/callouts/LineCallout3D.js";import y from"../../symbols/callouts/LineCallout3DBorder.js";import b from"../../symbols/support/Symbol3DVerticalOffset.js";const u=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let d=class extends t{constructor(e){super(e),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._symbols=u.map(e=>new m({color:[e[0],e[1],e[2],.6],outline:{color:"black",width:1}})),this._enabled=!0}initialize(){this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.update())}update(){if(!this._enabled)return void this.clear();const e=e=>{if(null!=e.label)return e.label;let o=e.lij.toString();return null!=e.loadPriority&&(o+=` (${e.loadPriority})`),e.measures&&(o+=`[${e.measures.lodLevel}]`),o},t=this.getTiles(),i=new Array,n=new Set(this._labels.size>0?this._labels.keys():this._polygons.keys());t.forEach((m,u)=>{const d=m.lij.toString();n.delete(d);const g=m.measures?.lodLevel??m.level,f=m.geometry;if(this.enablePolygons&&!this._polygons.has(d)){const e=m.polygonSymbol??this._symbols[g%this._symbols.length],o=new s({geometry:f,symbol:e});this._polygons.set(d,o),i.push(o)}if(this.enableLabels){const n=e(m),g=u/(t.length-1),w=r(0,200,g),_=r(20,6,g)/.75,j=null!=m.loadPriority&&m.loadPriority>=t.length,v=new o([w,j?0:w,j?0:w]),S="3d"===this.view.type?()=>new a({verticalOffset:new b({screenLength:40/.75}),callout:new c({color:new o("white"),border:new y({color:new o("black")})}),symbolLayers:new l([new p({text:n,halo:{color:"white",size:1/.75},material:{color:v},size:_})])}):()=>new h({text:n,haloColor:"white",haloSize:1/.75,color:v,size:_}),L=this._labels.get(d);if(L){const e=S();null!=L.symbol&&JSON.stringify(e)===JSON.stringify(L.symbol)||(L.symbol=e)}else{const e=new s({geometry:f.extent.center,symbol:S()});this._labels.set(d,e),i.push(e)}}});const m=new Array;n.forEach(e=>{const o=this._polygons.get(e);null!=o&&(m.push(o),this._polygons.delete(e));const s=this._labels.get(e);null!=s&&(m.push(s),this._labels.delete(e))}),this.view.graphics.removeMany(m),this.view.graphics.addMany(i)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};e([i({constructOnly:!0})],d.prototype,"view",void 0),e([i({readOnly:!0})],d.prototype,"updating",void 0),e([i()],d.prototype,"enabled",null),d=e([n("esri.views.support.TileTreeDebugger")],d);export{d as TileTreeDebugger};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{isArrayLike as t}from"../../core/arrayUtils.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{isUint8Array as s,isUint16Array as i,isUint32Array as r}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{ResourceType as a,DataType as u}from"./enums.js";const f=()=>e.getLogger("esri.views.webgl.BufferObject"),h=null,c=!!has("esri-tests-disable-gpu-memory-measurements");class o{static createIndex(t,e,s){return new o(t,34963,e,s)}static createVertex(t,e,s){return new o(t,34962,e,s)}static createUniform(t,e,s){return new o(t,35345,e,s)}static createPixelPack(t,e=35041,s){const i=new o(t,35051,e);return s&&i.setSize(s),i}static createPixelUnpack(t,e=35040,s){return new o(t,35052,e,s)}static createTransformFeedback(t,e=35044,s){const i=new o(t,35982,e);return i.setSize(s),i}constructor(t,e,s,i){this._context=t,this.bufferType=e,this.usage=s,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(a.BufferObject,this),this._glName=this._context.gl.createBuffer(),n(this._context.gl),i&&this.setData(i)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get sizeBytes(){if(34963===this.bufferType){if(this._indexType===u.UNSIGNED_INT)return 4*this._size;if(this._indexType===u.UNSIGNED_SHORT)return 2*this._size}return this._size}get usedMemory(){return c?0:this.sizeBytes}get _isVAOAware(){return 34963===this.bufferType||34962===this.bufferType}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(a.BufferObject,this),this._context=null}else this._glName&&f().warn("Leaked WebGL buffer object")}setSize(t,e=null){if(34963===this.bufferType&&null!=e)switch(this._indexType=e,e){case u.UNSIGNED_SHORT:t*=2;break;case u.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;34963===this.bufferType&&(s(t)?this._indexType=u.UNSIGNED_BYTE:i(t)?(e/=2,this._indexType=u.UNSIGNED_SHORT):r(t)&&(e/=4,this._indexType=u.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,e=null){this._size=t;const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;null!=e?i.bufferData(this.bufferType,e,this.usage):i.bufferData(this.bufferType,t,this.usage),n(i),this._isVAOAware&&this._context.bindVAO(s)}setSubData(t,e,s,i){if(!t)return;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:a}=this._context;a.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,s,i-s),n(a),this._isVAOAware&&this._context.bindVAO(r)}getSubData(t,e=0,s,i){if(s<0||i<0)return;const r=_(t)?t.BYTES_PER_ELEMENT:1;if(r*((s??0)+(i??0))>t.byteLength)return;e+r*(i??0)>this.usedMemory&&f().warn("Potential problem getting subdata: requested data exceeds buffer size!");const n=this._context.gl;35982===this.bufferType?(this._context.bindBuffer(this,35982),n.getBufferSubData(35982,e,t,s,i),this._context.unbindBuffer(35982)):(this._context.bindBuffer(this,36662),n.getBufferSubData(36662,e,t,s,i),this._context.unbindBuffer(36662))}async getSubDataAsync(t,e=0,s,i){await this._context.clientWaitAsync(),this.getSubData(t,e,s,i)}}function _(e){return t(e)}export{o as BufferObject,h as tracer};
5
+ import{isArrayLike as t}from"../../core/arrayUtils.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{isUint8Array as s,isUint16Array as i,isUint32Array as r}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{ResourceType as u,DataType as a}from"./enums.js";const f=()=>e.getLogger("esri.views.webgl.BufferObject"),h=null,c=!!has("esri-tests-disable-gpu-memory-measurements");class o{static createIndex(t,e,s){return new o(t,34963,e,s)}static createUniform(t,e,s){return new o(t,35345,e,s)}static createPixelPack(t,e=35041,s){const i=new o(t,35051,e);return s&&i.setSize(s),i}static createPixelUnpack(t,e=35040,s){return new o(t,35052,e,s)}static createTransformFeedback(t,e=35044,s){const i=new o(t,35982,e);return i.setSize(s),i}constructor(t,e,s,i){this._context=t,this.bufferType=e,this.usage=s,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(u.BufferObject,this),this._glName=this._context.gl.createBuffer(),n(this._context.gl),i&&this.setData(i)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get sizeBytes(){if(34963===this.bufferType){if(this._indexType===a.UNSIGNED_INT)return 4*this._size;if(this._indexType===a.UNSIGNED_SHORT)return 2*this._size}return this._size}get usedMemory(){return c?0:this.sizeBytes}get _isVAOAware(){return 34963===this.bufferType||34962===this.bufferType}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(u.BufferObject,this),this._context=null}else this._glName&&f().warn("Leaked WebGL buffer object")}setSize(t,e=null){if(34963===this.bufferType&&null!=e)switch(this._indexType=e,e){case a.UNSIGNED_SHORT:t*=2;break;case a.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;34963===this.bufferType&&(s(t)?this._indexType=a.UNSIGNED_BYTE:i(t)?(e/=2,this._indexType=a.UNSIGNED_SHORT):r(t)&&(e/=4,this._indexType=a.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,e=null){this._size=t;const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;null!=e?i.bufferData(this.bufferType,e,this.usage):i.bufferData(this.bufferType,t,this.usage),n(i),this._isVAOAware&&this._context.bindVAO(s)}setSubData(t,e,s,i){if(!t)return;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:u}=this._context;u.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,s,i-s),n(u),this._isVAOAware&&this._context.bindVAO(r)}getSubData(t,e=0,s,i){if(s<0||i<0)return;const r=_(t)?t.BYTES_PER_ELEMENT:1;if(r*((s??0)+(i??0))>t.byteLength)return;e+r*(i??0)>this.usedMemory&&f().warn("Potential problem getting subdata: requested data exceeds buffer size!");const n=this._context.gl;35982===this.bufferType?(this._context.bindBuffer(this,35982),n.getBufferSubData(35982,e,t,s,i),this._context.unbindBuffer(35982)):(this._context.bindBuffer(this,36662),n.getBufferSubData(36662,e,t,s,i),this._context.unbindBuffer(36662))}async getSubDataAsync(t,e=0,s,i){await this._context.clientWaitAsync(),this.getSubData(t,e,s,i)}}function _(e){return t(e)}export{o as BufferObject,h as tracer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t}from"./enums.js";function R(c,a,r,t,R=0){const _=c.gl;c.bindBuffer(r);for(const n of t){const r=a.get(n.name);if(null==r){console.warn(`There is no location for vertex attribute '${n.name}' defined.`);continue}const t=R*n.stride;if(n.count<=4)_.vertexAttribPointer(r,n.count,n.type,n.normalized,n.stride,n.offset+t),_.enableVertexAttribArray(r),n.divisor>0&&_.vertexAttribDivisor(r,n.divisor);else if(9===n.count)for(let e=0;e<3;e++)_.vertexAttribPointer(r+e,3,n.type,n.normalized,n.stride,n.offset+12*e+t),_.enableVertexAttribArray(r+e),n.divisor>0&&_.vertexAttribDivisor(r+e,n.divisor);else if(16===n.count)for(let e=0;e<4;e++)_.vertexAttribPointer(r+e,4,n.type,n.normalized,n.stride,n.offset+16*e+t),_.enableVertexAttribArray(r+e),n.divisor>0&&_.vertexAttribDivisor(r+e,n.divisor);else console.error("Unsupported vertex attribute element count: "+n.count);if(e()){const e=s(c.gl);e&&console.error(`Unable to bind vertex attribute "${n.name}" with baseInstanceOffset ${t}:`,e,n)}}}function _(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.R8:case a.R8I:case a.R8UI:case a.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.RGBA4:case a.R16F:case a.R16I:case a.R16UI:case a.RG8:case a.RG8I:case a.RG8UI:case a.RG8_SNORM:case a.RGB565:case a.RGB5_A1:case t.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.RGB8:case a.RGB8I:case a.RGB8UI:case a.RGB8_SNORM:case a.SRGB8:case t.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.RGBA8:case a.R32F:case a.R11F_G11F_B10F:case a.RG16F:case a.R32I:case a.R32UI:case a.RG16I:case a.RG16UI:case a.RGBA8I:case a.RGBA8UI:case a.RGBA8_SNORM:case a.SRGB8_ALPHA8:case a.RGB9_E5:case a.RGB10_A2UI:case a.RGB10_A2:case t.DEPTH_COMPONENT32F:case r.DEPTH24_STENCIL8:return 4;case r.DEPTH32F_STENCIL8:return 5;case a.RGB16F:case a.RGB16I:case a.RGB16UI:return 6;case a.RG32F:case a.RG32I:case a.RG32UI:case a.RGBA16F:case a.RGBA16I:case a.RGBA16UI:return 8;case a.RGB32F:case a.RGB32I:case a.RGB32UI:return 12;case a.RGBA32F:case a.RGBA32I:case a.RGBA32UI:return 16;case c.COMPRESSED_RGB_S3TC_DXT1_EXT:case c.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case c.COMPRESSED_RGBA_S3TC_DXT3_EXT:case c.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case c.COMPRESSED_R11_EAC:case c.COMPRESSED_SIGNED_R11_EAC:case c.COMPRESSED_RGB8_ETC2:case c.COMPRESSED_SRGB8_ETC2:case c.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case c.COMPRESSED_RG11_EAC:case c.COMPRESSED_SIGNED_RG11_EAC:case c.COMPRESSED_RGBA8_ETC2_EAC:case c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}export{R as bindVertexBufferLayout,_ as getBytesPerElementFormat};
5
+ import"../../core/has.js";import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t}from"./enums.js";function R(c,a,r,t=0){const R=c.gl;c.bindBuffer(r);for(const _ of r.layout){const r=a.get(_.name);if(null==r){console.warn(`There is no location for vertex attribute '${_.name}' defined.`);continue}const n=t*_.stride;if(_.count<=4)R.vertexAttribPointer(r,_.count,_.type,_.normalized,_.stride,_.offset+n),R.enableVertexAttribArray(r),_.divisor>0&&R.vertexAttribDivisor(r,_.divisor);else if(9===_.count)for(let e=0;e<3;e++)R.vertexAttribPointer(r+e,3,_.type,_.normalized,_.stride,_.offset+12*e+n),R.enableVertexAttribArray(r+e),_.divisor>0&&R.vertexAttribDivisor(r+e,_.divisor);else if(16===_.count)for(let e=0;e<4;e++)R.vertexAttribPointer(r+e,4,_.type,_.normalized,_.stride,_.offset+16*e+n),R.enableVertexAttribArray(r+e),_.divisor>0&&R.vertexAttribDivisor(r+e,_.divisor);else console.error("Unsupported vertex attribute element count: "+_.count);if(e()){const e=s(c.gl);e&&console.error(`Unable to bind vertex attribute "${_.name}" with baseInstanceOffset ${n}:`,e,_)}}}function _(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.R8:case a.R8I:case a.R8UI:case a.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.RGBA4:case a.R16F:case a.R16I:case a.R16UI:case a.RG8:case a.RG8I:case a.RG8UI:case a.RG8_SNORM:case a.RGB565:case a.RGB5_A1:case t.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.RGB8:case a.RGB8I:case a.RGB8UI:case a.RGB8_SNORM:case a.SRGB8:case t.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.RGBA8:case a.R32F:case a.R11F_G11F_B10F:case a.RG16F:case a.R32I:case a.R32UI:case a.RG16I:case a.RG16UI:case a.RGBA8I:case a.RGBA8UI:case a.RGBA8_SNORM:case a.SRGB8_ALPHA8:case a.RGB9_E5:case a.RGB10_A2UI:case a.RGB10_A2:case t.DEPTH_COMPONENT32F:case r.DEPTH24_STENCIL8:return 4;case r.DEPTH32F_STENCIL8:return 5;case a.RGB16F:case a.RGB16I:case a.RGB16UI:return 6;case a.RG32F:case a.RG32I:case a.RG32UI:case a.RGBA16F:case a.RGBA16I:case a.RGBA16UI:return 8;case a.RGB32F:case a.RGB32I:case a.RGB32UI:return 12;case a.RGBA32F:case a.RGBA32I:case a.RGBA32UI:return 16;case c.COMPRESSED_RGB_S3TC_DXT1_EXT:case c.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case c.COMPRESSED_RGBA_S3TC_DXT3_EXT:case c.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case c.COMPRESSED_R11_EAC:case c.COMPRESSED_SIGNED_R11_EAC:case c.COMPRESSED_RGB8_ETC2:case c.COMPRESSED_SRGB8_ETC2:case c.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case c.COMPRESSED_RG11_EAC:case c.COMPRESSED_SIGNED_RG11_EAC:case c.COMPRESSED_RGBA8_ETC2_EAC:case c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}export{R as bindVertexBufferLayout,_ as getBytesPerElementFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let u=class{constructor(t,r,s){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.buffer?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.buffer.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,{buffer:t})=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}get cachedMemory(){return this.usedMemory}dispose(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._buffers.forEach(({buffer:e})=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach(({buffer:t,layout:r})=>n(this._context,e,t,r)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}};export{u as VertexArrayObject};
5
+ import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let u=class{constructor(t,r,s){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,t)=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}get cachedMemory(){return this.usedMemory}dispose(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach(t=>n(this._context,e,t)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}};export{u as VertexArrayObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,s){this.layout=t,this.buffer=s}}export{t as VertexBuffer};
5
+ import{BufferObject as t}from"./BufferObject.js";class r extends t{constructor(t,r,s,e=35044){super(t,34962,e,s),this.layout=r}}export{r as VertexBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BufferObject as r}from"./BufferObject.js";import{PixelType as e,SizedPixelFormat as t,PrimitiveType as o}from"./enums.js";import{FramebufferObject as i}from"./FramebufferObject.js";import{makePipelineState as n,destinationTimesOneMinusSourceAlpha as s}from"./renderState.js";import{TextureDescriptor as a}from"./TextureDescriptor.js";import{VertexArrayObject as p}from"./VertexArrayObject.js";import{Pos2usLocations as c,Pos2us as f}from"./VertexAttributeLayouts.js";import{VertexBuffer as m}from"./VertexBuffer.js";import{WebGLDriverTestModule as l}from"./WebGLDriverTestModule.js";class u extends l{constructor(r){if(super(),this._rctx=r,!r.gl)return;if(!(r.capabilities.colorBufferFloat?.textureFloat&&r.capabilities.colorBufferFloat?.floatBlend))return;const e="\n precision highp float;\n attribute vec2 position;\n\n void main() {\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ";this._program=r.programCache.acquire(e,t,c)}_test(c){const l=this._rctx,u=new a(1);u.wrapMode=33071,u.dataType=e.FLOAT,u.internalFormat=t.RGBA32F,u.samplingMode=9728;const b=new i(l,u),d=r.createVertex(l,35044,new Uint16Array([0,0,1,0,0,1,1,1])),g=new p(l,new m(f,d));l.gl.getError(),l.useProgram(c);const j=l.getBoundFramebufferObject(),{x:w,y:x,width:A,height:h}=l.getViewport();l.bindFramebuffer(b),l.setViewport(0,0,1,1),l.bindVAO(g),l.drawArrays(o.TRIANGLE_STRIP,0,4);const F=n({blending:s});l.setPipelineState(F),l.drawArrays(o.TRIANGLE_STRIP,0,4);const _=l.gl.getError();return l.setViewport(w,x,A,h),l.bindFramebuffer(j),g.dispose(),b.dispose(),_!==l.gl.INVALID_OPERATION||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}}export{u as FloatBufferBlend};
5
+ import{PixelType as r,SizedPixelFormat as e,PrimitiveType as t}from"./enums.js";import{FramebufferObject as o}from"./FramebufferObject.js";import{makePipelineState as i,destinationTimesOneMinusSourceAlpha as n}from"./renderState.js";import{TextureDescriptor as s}from"./TextureDescriptor.js";import{VertexArrayObject as a}from"./VertexArrayObject.js";import{Pos2usLocations as p,Pos2us as c}from"./VertexAttributeLayouts.js";import{VertexBuffer as f}from"./VertexBuffer.js";import{WebGLDriverTestModule as l}from"./WebGLDriverTestModule.js";class m extends l{constructor(r){if(super(),this._rctx=r,!r.gl)return;if(!(r.capabilities.colorBufferFloat?.textureFloat&&r.capabilities.colorBufferFloat?.floatBlend))return;const e="\n precision highp float;\n attribute vec2 position;\n\n void main() {\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ";this._program=r.programCache.acquire(e,t,p)}_test(p){const l=this._rctx,m=new s(1);m.wrapMode=33071,m.dataType=r.FLOAT,m.internalFormat=e.RGBA32F,m.samplingMode=9728;const u=new o(l,m),b=new f(l,c,new Uint16Array([0,0,1,0,0,1,1,1])),d=new a(l,b);l.gl.getError(),l.useProgram(p);const g=l.getBoundFramebufferObject(),{x:w,y:A,width:j,height:x}=l.getViewport();l.bindFramebuffer(u),l.setViewport(0,0,1,1),l.bindVAO(d),l.drawArrays(t.TRIANGLE_STRIP,0,4);const h=i({blending:n});l.setPipelineState(h),l.drawArrays(t.TRIANGLE_STRIP,0,4);const F=l.gl.getError();return l.setViewport(w,A,j,x),l.bindFramebuffer(g),d.dispose(),u.dispose(),F!==l.gl.INVALID_OPERATION||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}}export{m as FloatBufferBlend};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{BufferObject as e}from"./BufferObject.js";import{PrimitiveType as r,PixelType as t}from"./enums.js";import{FramebufferObject as i}from"./FramebufferObject.js";import{Texture as o}from"./Texture.js";import{TextureDescriptor as n}from"./TextureDescriptor.js";import{VertexArrayObject as s}from"./VertexArrayObject.js";import{Pos2usLocations as a,Pos2us as m}from"./VertexAttributeLayouts.js";import{VertexBuffer as p}from"./VertexBuffer.js";import{WebGLDriverTestModule as u}from"./WebGLDriverTestModule.js";class c extends u{constructor(e){super(),this._rctx=e;const r="\n precision highp float;\n\n attribute vec2 position;\n varying vec2 v_uv;\n\n void main() {\n v_uv = position;\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n varying vec2 v_uv;\n\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ";this._program=e.programCache.acquire(r,t,a)}dispose(){super.dispose()}_test(a){const u=this._rctx;if(!u.gl)return a.dispose(),!0;const c=new n(1);c.wrapMode=33071,c.samplingMode=9728;const f=new i(u,c),g=e.createVertex(u,35044,new Uint16Array([0,0,1,0,0,1,1,1])),l=new s(u,new p(m,g)),v=new n;v.samplingMode=9729,v.wrapMode=33071;const w=new o(u,v,d);u.useProgram(a),u.bindTexture(w,0),a.setUniform1i("u_texture",0);const x=u.getBoundFramebufferObject(),{x:h,y:b,width:_,height:j}=u.getViewport();u.bindFramebuffer(f),u.setViewport(0,0,1,1),u.setClearColor(0,0,0,0),u.setBlendingEnabled(!1),u.clear(16384),u.bindVAO(l),u.drawArrays(r.TRIANGLE_STRIP,0,4);const y=new Uint8Array(4);return f.readPixels(0,0,1,1,6408,t.UNSIGNED_BYTE,y),l.dispose(),f.dispose(),w.dispose(),u.setViewport(h,b,_,j),u.bindFramebuffer(x),255!==y[0]}}const d=new Image;d.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",d.width=5,d.height=5,d.decode();export{c as SVGPremultipliedAlpha};
5
+ import{PrimitiveType as e,PixelType as r}from"./enums.js";import{FramebufferObject as t}from"./FramebufferObject.js";import{Texture as i}from"./Texture.js";import{TextureDescriptor as o}from"./TextureDescriptor.js";import{VertexArrayObject as n}from"./VertexArrayObject.js";import{Pos2usLocations as s,Pos2us as a}from"./VertexAttributeLayouts.js";import{VertexBuffer as p}from"./VertexBuffer.js";import{WebGLDriverTestModule as m}from"./WebGLDriverTestModule.js";class u extends m{constructor(e){super(),this._rctx=e;const r="\n precision highp float;\n\n attribute vec2 position;\n varying vec2 v_uv;\n\n void main() {\n v_uv = position;\n gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n }\n ",t="\n precision highp float;\n\n varying vec2 v_uv;\n\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ";this._program=e.programCache.acquire(r,t,s)}dispose(){super.dispose()}_test(s){const m=this._rctx;if(!m.gl)return s.dispose(),!0;const u=new o(1);u.wrapMode=33071,u.samplingMode=9728;const d=new t(m,u),g=new p(m,a,new Uint16Array([0,0,1,0,0,1,1,1])),f=new n(m,g),l=new o;l.samplingMode=9729,l.wrapMode=33071;const v=new i(m,l,c);m.useProgram(s),m.bindTexture(v,0),s.setUniform1i("u_texture",0);const w=m.getBoundFramebufferObject(),{x,y:h,width:b,height:_}=m.getViewport();m.bindFramebuffer(d),m.setViewport(0,0,1,1),m.setClearColor(0,0,0,0),m.setBlendingEnabled(!1),m.clear(16384),m.bindVAO(f),m.drawArrays(e.TRIANGLE_STRIP,0,4);const j=new Uint8Array(4);return d.readPixels(0,0,1,1,6408,r.UNSIGNED_BYTE,j),f.dispose(),d.dispose(),v.dispose(),m.setViewport(x,h,b,_),m.bindFramebuffer(w),255!==j[0]}}const c=new Image;c.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",c.width=5,c.height=5,c.decode();export{u as SVGPremultipliedAlpha};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import o from"../../core/Logger.js";import{abortMaybe as a}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{on as l,watch as u,sync as h,whenOnce as m}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import y from"../../geometry/SpatialReference.js";import{system as v}from"../../time/constants.js";import{createReactiveGraphic as g}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as F}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as _}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as x}from"./expressions/ExpressionsModel.js";import w from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as b}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as I,isFieldInput as M}from"./inputs/support/inputUtils.js";import A from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as E}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as k}from"./templates/support/createBatchFormTemplate.js";let T=class extends i{constructor(e){super(e),this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCountWithComplexForms=50,this.maximumFeatureCount=2e3,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this._arcadeExecutorProvider=new F,this._activeFormInputsByElementId=new Map,this._emptyForm=new w({inputs:[]}),this._emptyFormTemplate=new A({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new p,this._updatingHandles=new f,this._layerTemplateMap=new p,this._layerContingentValuesMap=new p,this._workingFeatures=new s,this._expressionsManager=new _({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:v}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([l(()=>this.features,"after-changes",()=>this._prepare(),{sync:!0}),u(()=>[this.features,this.map,this.timeZone,this.editType],()=>{this._prepare()},h),u(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),h)]),this._prepare()}destroy(){this._prepareTask=a(this._prepareTask),this._workingFeatures.destroyAll(),this._expressionsManager&&this._expressionsManager.abort(),this._reactiveGraphicLookup=new p,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=t.sourceLayer??t.layer;e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(I(e)){const t=e.inputs.find(e=>!e.valid);if(t)return{input:t,groupInput:e}}if(M(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new r("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new r("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await m(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?b(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}async _prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=a(this._prepareTask),this._updateWorkingFeatures(),a(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new _({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??y.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{n(t);const s=new Map;for(const t of e){const e=await E(t);if(e){const s=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(t,new Set(s))}else this._layerContingentValuesMap.set(t,new Set);const r=await k(t,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone});this._layerTemplateMap.set(t,r);const i=r.getExpressionExecutorsForLayer(t);if(this._expressionsManager.layerExpressionsModelMap.set(t,new x({preserveFieldValuesWhenHidden:r.preserveFieldValuesWhenHidden,executorMap:i})),!this._hasAsyncArcadeExpressions)for(const t of i.keys()){const e=i.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of r.elements){const{elementId:e}=t;s.has(e)?s.get(e).foldIn(t):s.set(e,t.clone())}}if(this.hasTooManyComplexFeatures)throw new r("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new r("too-many-features","There are too many features to load into the form.");const i=new A({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=b(i,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw o.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.addPromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new p,0!==e.length){this._workingFeatures.addMany(e.map(g));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}};e([d()],T.prototype,"_effectiveTimeZone",null),e([d({readOnly:!0})],T.prototype,"activeFeature",null),e([d()],T.prototype,"activeFeatureIndex",void 0),e([d({readOnly:!0})],T.prototype,"activeForm",null),e([d()],T.prototype,"disabled",void 0),e([d()],T.prototype,"calculating",null),e([d()],T.prototype,"editType",void 0),e([d()],T.prototype,"features",void 0),e([d()],T.prototype,"expressionEvaluationFailed",null),e([d()],T.prototype,"hasNonActiveInvalidFeatures",null),e([d()],T.prototype,"hasAsyncArcadeExpressions",null),e([d()],T.prototype,"_hasAsyncArcadeExpressions",void 0),e([d()],T.prototype,"invalidFeatures",null),e([d()],T.prototype,"hasVisibleInputs",null),e([d()],T.prototype,"hasLayersWithContingentValues",null),e([d()],T.prototype,"maximumFeatureCountWithComplexForms",void 0),e([d()],T.prototype,"maximumFeatureCount",void 0),e([d()],T.prototype,"visibleInputs",null),e([d()],T.prototype,"map",void 0),e([d()],T.prototype,"noVisibleElementsReason",null),e([d()],T.prototype,"readOnly",void 0),e([d()],T.prototype,"spatialReference",void 0),e([d()],T.prototype,"submitHasBeenAttempted",void 0),e([d()],T.prototype,"timeZone",void 0),e([d()],T.prototype,"updating",null),e([d()],T.prototype,"valid",null),e([d()],T.prototype,"layers",null),e([d()],T.prototype,"mode",null),e([d()],T.prototype,"sharedForm",void 0),e([d()],T.prototype,"sharedFormTemplate",void 0),e([d()],T.prototype,"userHasChangedValues",void 0),e([d()],T.prototype,"_arcadeExecutorProvider",void 0),e([d()],T.prototype,"_prepareTask",void 0),e([d()],T.prototype,"_reactiveGraphicLookup",void 0),e([d()],T.prototype,"_layerTemplateMap",void 0),e([d()],T.prototype,"_layerContingentValuesMap",void 0),e([d()],T.prototype,"_workingFeatures",void 0),e([d()],T.prototype,"_expressionsManager",void 0),T=e([c("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],T);const C=T;export{C as default};
5
+ import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{on as l,watch as u,sync as h,whenOnce as m}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import y from"../../geometry/SpatialReference.js";import{system as v}from"../../time/constants.js";import{createReactiveGraphic as g}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as F}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as _}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as x}from"./expressions/ExpressionsModel.js";import w from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as b}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as I,isFieldInput as M}from"./inputs/support/inputUtils.js";import A from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as E}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as k}from"./templates/support/createBatchFormTemplate.js";let T=class extends i{constructor(e){super(e),this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCountWithComplexForms=50,this.maximumFeatureCount=2e3,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this._arcadeExecutorProvider=new F,this._activeFormInputsByElementId=new Map,this._emptyForm=new w({inputs:[]}),this._emptyFormTemplate=new A({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new p,this._updatingHandles=new f,this._layerTemplateMap=new p,this._layerContingentValuesMap=new p,this._workingFeatures=new s,this._expressionsManager=new _({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:v}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([l(()=>this.features,"after-changes",()=>this._prepare(),{sync:!0}),u(()=>[this.features,this.map,this.timeZone,this.editType],()=>{this._prepare()},h),u(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),h)]),this._prepare()}destroy(){this._prepareTask=o(this._prepareTask),this._workingFeatures.destroyAll(),this._expressionsManager&&this._expressionsManager.abort(),this._reactiveGraphicLookup=new p,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=t.sourceLayer??t.layer;e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(I(e)){const t=e.inputs.find(e=>!e.valid);if(t)return{input:t,groupInput:e}}if(M(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new r("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new r("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await m(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?b(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}async _prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=o(this._prepareTask),this._updateWorkingFeatures(),o(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new _({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??y.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{n(t);const s=new Map;for(const t of e){const e=await E(t);if(e){const s=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(t,new Set(s))}else this._layerContingentValuesMap.set(t,new Set);const r=await k(t,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone});this._layerTemplateMap.set(t,r);const i=r.getExpressionExecutorsForLayer(t);if(this._expressionsManager.layerExpressionsModelMap.set(t,new x({preserveFieldValuesWhenHidden:r.preserveFieldValuesWhenHidden,executorMap:i})),!this._hasAsyncArcadeExpressions)for(const t of i.keys()){const e=i.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of r.elements){const{elementId:e}=t;s.has(e)?s.get(e).foldIn(t):s.set(e,t.clone())}}if(this.hasTooManyComplexFeatures)throw new r("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new r("too-many-features","There are too many features to load into the form.");const i=new A({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=b(i,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.addPromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new p,0!==e.length){this._workingFeatures.addMany(e.map(g));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}};e([d()],T.prototype,"_effectiveTimeZone",null),e([d({readOnly:!0})],T.prototype,"activeFeature",null),e([d()],T.prototype,"activeFeatureIndex",void 0),e([d({readOnly:!0})],T.prototype,"activeForm",null),e([d()],T.prototype,"disabled",void 0),e([d()],T.prototype,"calculating",null),e([d()],T.prototype,"editType",void 0),e([d()],T.prototype,"features",void 0),e([d()],T.prototype,"expressionEvaluationFailed",null),e([d()],T.prototype,"hasNonActiveInvalidFeatures",null),e([d()],T.prototype,"hasAsyncArcadeExpressions",null),e([d()],T.prototype,"_hasAsyncArcadeExpressions",void 0),e([d()],T.prototype,"invalidFeatures",null),e([d()],T.prototype,"hasVisibleInputs",null),e([d()],T.prototype,"hasLayersWithContingentValues",null),e([d()],T.prototype,"maximumFeatureCountWithComplexForms",void 0),e([d()],T.prototype,"maximumFeatureCount",void 0),e([d()],T.prototype,"visibleInputs",null),e([d()],T.prototype,"map",void 0),e([d()],T.prototype,"noVisibleElementsReason",null),e([d()],T.prototype,"readOnly",void 0),e([d()],T.prototype,"spatialReference",void 0),e([d()],T.prototype,"submitHasBeenAttempted",void 0),e([d()],T.prototype,"timeZone",void 0),e([d()],T.prototype,"updating",null),e([d()],T.prototype,"valid",null),e([d()],T.prototype,"layers",null),e([d()],T.prototype,"mode",null),e([d()],T.prototype,"sharedForm",void 0),e([d()],T.prototype,"sharedFormTemplate",void 0),e([d()],T.prototype,"userHasChangedValues",void 0),e([d()],T.prototype,"_arcadeExecutorProvider",void 0),e([d()],T.prototype,"_prepareTask",void 0),e([d()],T.prototype,"_reactiveGraphicLookup",void 0),e([d()],T.prototype,"_layerTemplateMap",void 0),e([d()],T.prototype,"_layerContingentValuesMap",void 0),e([d()],T.prototype,"_workingFeatures",void 0),e([d()],T.prototype,"_expressionsManager",void 0),T=e([c("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],T);const C=T;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.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../core/Error.js";import{makeHandle as i,abortHandle as o}from"../../core/handleUtils.js";import{isAborted as s}from"../../core/promiseUtils.js";import{watch as r}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as n}from"../../layers/support/layerUtils.js";import{createFeatureServices as d}from"../../rest/featureService/utils.js";import c from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as u}from"../../views/support/HighlightDefaults.js";import p from"./AddAssociationWorkflowData.js";import w from"./Workflow.js";import{fetchFullFeatures as h}from"./workflowUtils.js";import y from"../FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js";import{getFeatureTitle as m}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";var A;const f={exit:Symbol()};let g=class extends w{static{A=this}constructor(t){super(t),this._utilityNetworkAssociationAddAssociationViewModel=new y,this._highlightHelper=null,this.sourceFeatureItem=null,this.type="add-association"}initialize(){const{data:t}=this,{view:e}=t.viewModel;e&&(this._highlightHelper=new c({view:e,highlightName:u}),this.addHandles(i(()=>this._highlightHelper?.removeAll())));const s=new AbortController;this.addHandles(o(s)),this._updatingHandles.addPromise(this._setup(s))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get utilityNetworkAssociationAddAssociationViewModel(){return this._utilityNetworkAssociationAddAssociationViewModel}get hasPendingEdits(){return!!this._utilityNetworkAssociationAddAssociationViewModel.selectedFeature}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get reliesOnOwnerAdminPrivileges(){return this.editorItem.capabilities.create.reliesOnOwnerAdminPrivileges}async enter(){this._addHandles()}exit(){this.removeHandles(f.exit)}async start(){return await super.start(),null}async _setup(t){const{data:i}=this,{feature:o}=i;try{const[e]=await h([o],o.sourceLayer,i.viewModel.view.spatialReference,t.signal);if(s(t))return;const r=e.sourceLayer&&"getFeatureTitle"in e.sourceLayer?await e.sourceLayer.getFeatureTitle(e):m(e);if(s(t))return;this.sourceFeatureItem={feature:o,label:r},this._initializeUtilityNetworkAssociationAddAssociationViewModel()}catch(r){this.cancel({force:!0,error:new e("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:r}})})}}_initializeUtilityNetworkAssociationAddAssociationViewModel(){const{viewModel:{view:t},utilityNetwork:e,associationType:i}=this.data,o=this._utilityNetworkAssociationAddAssociationViewModel;o.graphic=this.sourceFeatureItem.feature,o.map=t?.map,o.utilityNetwork=e,o.layer=this.layer,o.associationType=i,o.highlightHelper=this._highlightHelper,e.networkSystemLayers.loadAssociationsTable()}_addHandles(){const t=this._utilityNetworkAssociationAddAssociationViewModel;this.addHandles([r(()=>t.selectedLayer,t=>{t&&this.go("add-association-select-feature")}),r(()=>t.selectedFeature,t=>{t&&this.go("add-association-create-association")})],f.exit)}static async create(t){const e=new A({data:await p.create(t),onCommit:this._onCommitFactory(t.applyEditsFeatureService)});return e._set("steps",this._createWorkflowSteps(e)),e}static _createWorkflowSteps(t){return[{id:"add-association-select-layer",async setUp(){const{utilityNetworkAssociationAddAssociationViewModel:e}=t.data.viewModel;e&&(e.selectedLayer=null,e.selectedFeature=null,e.association=null)},async tearDown(){}},{id:"add-association-select-feature",async setUp(){const{utilityNetworkAssociationAddAssociationViewModel:e}=t.data.viewModel;e&&(e.selectedFeature=null,e.association=null)},async tearDown(){}},{id:"add-association-create-association",async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=t=>async i=>{const{feature:o,utilityNetwork:s,associationInput:r}=i,{utilityNetworkAssociationAddAssociationViewModel:a}=i.viewModel,{association:l}=a;await s.networkSystemLayers.loadAssociationsTable();const c=s?.generateAddAssociations([l]);if(!c)throw new e("editor:failed-to-add-association","Could not create payload needed to add association");const u=o.sourceLayer,p=n(u)&&u.parent?u.parent:u,w=d([p]),h=w.values().next().value?.featureService;if(!h)throw new e("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(h?.load());const y=s?.gdbVersion??void 0;await t(h,[c],{gdbVersion:y}),await r.refresh()}}};t([a()],g.prototype,"_utilityNetworkAssociationAddAssociationViewModel",void 0),t([a()],g.prototype,"_featureFormViewModel",void 0),t([a()],g.prototype,"editorItem",null),t([a()],g.prototype,"featureFormViewModel",null),t([a()],g.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),t([a()],g.prototype,"sourceFeatureItem",void 0),t([a()],g.prototype,"hasPendingEdits",null),t([a()],g.prototype,"layer",null),t([a()],g.prototype,"parent",null),t([a()],g.prototype,"parentLayer",null),t([a()],g.prototype,"reliesOnOwnerAdminPrivileges",null),g=A=t([l("esri.widgets.Editor.AddAssociationWorkflow")],g);export{g as AddAssociationWorkflow};
5
+ import{__decorate as t}from"tslib";import e from"../../core/Error.js";import{makeHandle as i,abortHandle as o}from"../../core/handleUtils.js";import{isAborted as s}from"../../core/promiseUtils.js";import{watch as r}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as n}from"../../layers/support/layerUtils.js";import{createFeatureServices as d}from"../../rest/featureService/utils.js";import c from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as u}from"../../views/support/HighlightDefaults.js";import p from"./AddAssociationWorkflowData.js";import w from"./Workflow.js";import{fetchFullFeatures as h}from"./workflowUtils.js";import y from"../FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js";import{getFeatureTitle as m}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";var A;const f={exit:Symbol()};let g=class extends w{static{A=this}constructor(t){super(t),this._utilityNetworkAssociationAddAssociationViewModel=new y,this._highlightHelper=null,this.sourceFeatureItem=null,this.type="add-association"}initialize(){const{data:t}=this,{view:e}=t.viewModel;e&&(this._highlightHelper=new c({view:e,highlightName:u}),this.addHandles(i(()=>this._highlightHelper?.removeAll())));const s=new AbortController;this.addHandles(o(s)),this._updatingHandles.addPromise(this._setup(s))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get utilityNetworkAssociationAddAssociationViewModel(){return this._utilityNetworkAssociationAddAssociationViewModel}get hasPendingEdits(){return!!this._utilityNetworkAssociationAddAssociationViewModel.selectedFeature}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get reliesOnOwnerAdminPrivileges(){return this.editorItem.capabilities.create.reliesOnOwnerAdminPrivileges}async enter(){this._addHandles()}exit(){this.removeHandles(f.exit)}async start(){return await super.start(),null}async _setup(t){const{data:i}=this,{feature:o}=i;try{const[e]=await h([o],o.sourceLayer,i.viewModel.view.spatialReference,t.signal);if(s(t))return;const r=e.sourceLayer&&"getFeatureTitle"in e.sourceLayer?await e.sourceLayer.getFeatureTitle(e):m(e);if(s(t))return;this.sourceFeatureItem={feature:o,label:r},this._initializeUtilityNetworkAssociationAddAssociationViewModel()}catch(r){await this.cancel({force:!0,error:new e("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:r}})})}}_initializeUtilityNetworkAssociationAddAssociationViewModel(){const{viewModel:{view:t},utilityNetwork:e,associationType:i}=this.data,o=this._utilityNetworkAssociationAddAssociationViewModel;o.graphic=this.sourceFeatureItem.feature,o.map=t?.map,o.utilityNetwork=e,o.layer=this.layer,o.associationType=i,o.highlightHelper=this._highlightHelper,e.networkSystemLayers.loadAssociationsTable()}_addHandles(){const t=this._utilityNetworkAssociationAddAssociationViewModel;this.addHandles([r(()=>t.selectedLayer,t=>{t&&this.go("add-association-select-feature")}),r(()=>t.selectedFeature,t=>{t&&this.go("add-association-create-association")})],f.exit)}static async create(t){const e=new A({data:await p.create(t),onCommit:this._onCommitFactory(t.applyEditsFeatureService)});return e._set("steps",this._createWorkflowSteps(e)),e}static _createWorkflowSteps(t){return[{id:"add-association-select-layer",async setUp(){const{utilityNetworkAssociationAddAssociationViewModel:e}=t.data.viewModel;e&&(e.selectedLayer=null,e.selectedFeature=null,e.association=null)},async tearDown(){}},{id:"add-association-select-feature",async setUp(){const{utilityNetworkAssociationAddAssociationViewModel:e}=t.data.viewModel;e&&(e.selectedFeature=null,e.association=null)},async tearDown(){}},{id:"add-association-create-association",async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=t=>async i=>{const{feature:o,utilityNetwork:s,associationInput:r}=i,{utilityNetworkAssociationAddAssociationViewModel:a}=i.viewModel,{association:l}=a;await s.networkSystemLayers.loadAssociationsTable();const c=s?.generateAddAssociations([l]);if(!c)throw new e("editor:failed-to-add-association","Could not create payload needed to add association");const u=o.sourceLayer,p=n(u)&&u.parent?u.parent:u,w=d([p]),h=w.values().next().value?.featureService;if(!h)throw new e("editor:failed-to-delete-association","Could not retrieve feature service needed to delete association");await(h?.load());const y=s?.gdbVersion??void 0;await t(h,[c],{gdbVersion:y}),await r.refresh()}}};t([a()],g.prototype,"_utilityNetworkAssociationAddAssociationViewModel",void 0),t([a()],g.prototype,"_featureFormViewModel",void 0),t([a()],g.prototype,"editorItem",null),t([a()],g.prototype,"featureFormViewModel",null),t([a()],g.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),t([a()],g.prototype,"sourceFeatureItem",void 0),t([a()],g.prototype,"hasPendingEdits",null),t([a()],g.prototype,"layer",null),t([a()],g.prototype,"parent",null),t([a()],g.prototype,"parentLayer",null),t([a()],g.prototype,"reliesOnOwnerAdminPrivileges",null),g=A=t([l("esri.widgets.Editor.AddAssociationWorkflow")],g);export{g as AddAssociationWorkflow};