@arcgis/core 5.1.0-next.43 → 5.1.0-next.44

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 (150) hide show
  1. package/arcade/featureset/actions/Adapted.js +1 -1
  2. package/arcade/featureset/actions/AttributeFilter.js +1 -1
  3. package/arcade/featureset/actions/OrderBy.js +1 -1
  4. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  5. package/arcade/featureset/actions/Top.js +1 -1
  6. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  9. package/arcade/featureset/support/FeatureSet.js +1 -1
  10. package/arcade/featureset/support/OrderbyClause.js +1 -1
  11. package/assets/esri/core/workers/RemoteClient.js +1 -1
  12. package/assets/esri/core/workers/chunks/{0836964a65f76da35b5c.js → 1a3f874700f86b750390.js} +23 -23
  13. package/assets/esri/core/workers/chunks/25e4568a3ff76f48ac5e.js +1 -0
  14. package/assets/esri/core/workers/chunks/{b6e63d8ce3c9ac9762f4.js → 2cd0934163cb627ce251.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{8f12a559dbf284c21e2f.js → 3c7ee71f0d8582e6d78f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{9a9b1250be3e20499d75.js → 4140d4c8b6b122fc2cd4.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{eff198e0c21c9767ffaa.js → 45cf181c1945e6c77a4b.js} +1 -1
  18. package/assets/esri/core/workers/chunks/5f2e246ffcbdedea4de5.js +1 -0
  19. package/assets/esri/core/workers/chunks/5f81f9e586b3ba0c34d4.js +1 -0
  20. package/assets/esri/core/workers/chunks/64da1ad9df9094ef5c12.js +1 -0
  21. package/assets/esri/core/workers/chunks/{093aa05fbde548bf9040.js → 6cc5c37d6bdaf5483bd4.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{73a008b48e29eb6f2064.js → 848c6989a6a222c7a1d8.js} +2 -2
  23. package/assets/esri/core/workers/chunks/{dbedd246f4b584583f95.js → 9aa1ad8b436b5b0dd5f5.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{c1cae45a159a5373ac00.js → a4a2e7bc3369434c5cfa.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b5ced451d331ca1ffb68.js +1 -0
  26. package/assets/esri/core/workers/chunks/{80bfb5e5d613d2c412bf.js → c0cc4ca138db47052845.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{7132420980f77b6a871b.js → c9f5d72b86ecb2a30587.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{93846f8b77fc802069a7.js → df5788d42787ee8bf523.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{b15a02bdcd78a1a51bd6.js → e72ca52d930afb5650af.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{f835eea9f617556c7276.js → fb69a0bb025b7a5ec588.js} +1 -1
  31. package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
  32. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
  33. package/chunks/ComponentShader.glsl.js +11 -11
  34. package/chunks/DefaultMaterial.glsl.js +1 -1
  35. package/chunks/HUDMaterial.glsl.js +28 -36
  36. package/chunks/ImageMaterial.glsl.js +1 -1
  37. package/chunks/Path.glsl.js +7 -7
  38. package/chunks/Pattern.glsl.js +1 -1
  39. package/chunks/RibbonLine.glsl.js +2 -2
  40. package/chunks/ShadowHighlight.glsl.js +1 -1
  41. package/chunks/Terrain.glsl.js +5 -5
  42. package/chunks/Water.glsl.js +5 -5
  43. package/config.js +1 -1
  44. package/core/arrayUtils.js +1 -1
  45. package/kernel.js +1 -1
  46. package/layers/SceneLayer.d.ts +16 -10
  47. package/layers/graphics/data/QueryEngineResult.js +1 -1
  48. package/layers/support/Sublayer.d.ts +6 -0
  49. package/layers/support/Sublayer.js +1 -1
  50. package/package.json +3 -3
  51. package/support/revision.js +1 -1
  52. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  53. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  54. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  55. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  56. package/views/2d/engine/webgl/TextureManager.js +1 -1
  57. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  58. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  59. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  60. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  61. package/views/3d/environment/EnvironmentManager.js +1 -1
  62. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  63. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  64. package/views/3d/support/MemoryController.js +1 -1
  65. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  66. package/views/3d/terrain/OverlayRenderer.js +1 -1
  67. package/views/3d/terrain/TerrainRenderer.js +1 -1
  68. package/views/3d/terrain/TileCompositor.js +1 -1
  69. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
  70. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  71. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  72. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  73. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  74. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  75. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  76. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  77. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
  78. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
  79. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  80. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
  81. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -2
  82. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  83. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
  84. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
  85. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  86. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  87. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  88. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  89. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  90. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  91. package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
  92. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  93. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  94. package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
  95. package/views/3d/webgl-engine/lib/Material.js +1 -1
  96. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  97. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  98. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  99. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  100. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  101. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  102. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  103. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  104. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  106. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  107. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  108. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  109. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  110. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  111. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  112. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  113. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  114. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  115. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  116. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  117. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  118. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  119. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  121. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  122. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  123. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  124. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  125. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  126. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  127. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  128. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  129. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  130. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  131. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  132. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  133. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
  134. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  135. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  136. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  137. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  138. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  139. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  140. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  141. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  142. package/assets/esri/core/workers/chunks/04981ae9d7728208ffce.js +0 -1
  143. package/assets/esri/core/workers/chunks/23af269e88f9ac101ffb.js +0 -1
  144. package/assets/esri/core/workers/chunks/42b556d56013350c9d80.js +0 -1
  145. package/assets/esri/core/workers/chunks/80a1ccabd4257cc61e0d.js +0 -1
  146. package/assets/esri/core/workers/chunks/ea356a5b90ea44b5cbe1.js +0 -1
  147. package/views/2d/engine/vectorTiles/GlyphMosaic.js +0 -2
  148. package/views/2d/engine/vectorTiles/GlyphSource.js +0 -2
  149. package/views/2d/engine/vectorTiles/RectangleBinPack.js +0 -2
  150. /package/assets/esri/core/workers/chunks/{73a008b48e29eb6f2064.js.LICENSE.txt → 848c6989a6a222c7a1d8.js.LICENSE.txt} +0 -0
@@ -1,11 +1,11 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{addNearFar as e}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import{isColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as a}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{ObjectAndLayerIdColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{PathVertexPosition as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{OutputDepth as l}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as s}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientOcclusion as d}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as t,addAmbientBoostFactor as c,addLightingGlobalFactor as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as g}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{Normals as v}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js";import{NormalUtils as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PhysicallyBasedRenderingParameters as w}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapDraw as u}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as h}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as f,addViewNormal as y,addCameraPosition as L}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3PassUniform as j}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatPassUniform as P}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as S,If as O}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{SnowCover as C}from"../views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js";import{outputColorHighlightOLID as A}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as D}from"../views/webgl/ShaderBuilder.js";function B(B){const I=new D,{vertex:M,fragment:_,varyings:F}=I;f(M,B),F.add("vpos","vec3",{invariant:!0}),I.include(n,B);const{output:V,spherical:x,pbrMode:z,snowCover:T}=B;switch((i(V)||9===V)&&(I.include(a),I.include(u,B),I.include(r,B),I.include(b,B),F.add("vnormal","vec3"),F.add("vcolor","vec4"),M.main.add(S`vpos = calculateVPos();
2
+ import{addNearFar as e}from"../views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js";import{isColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as a}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{ObjectAndLayerIdColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{PathVertexPosition as n}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js";import{OutputDepth as l}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{OutputHighlight as s}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientOcclusion as d}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as t,addAmbientBoostFactor as c,addLightingGlobalFactor as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{addMainLightIntensity as g}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{Normals as v}from"../views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js";import{NormalUtils as p}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PhysicallyBasedRenderingParameters as w}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{ReadShadowMapDraw as u}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as b}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as h}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as f,addViewNormal as y,addCameraPosition as L}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float3PassUniform as j}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatPassUniform as P}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as S,If as O}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{SnowCover as C}from"../views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js";import{outputColorHighlightOLID as A}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as D}from"../views/webgl/ShaderBuilder.js";function B(B){const I=new D,{vertex:M,fragment:_,varyings:F}=I;f(M,B),F.add("vpos","vec3",{invariant:!0}),I.include(n,B);const{output:V,spherical:x,pbrMode:z,snowCover:T}=B;switch((i(V)||11===V)&&(I.include(a),I.include(u,B),I.include(r,B),I.include(b,B),F.add("vnormal","vec3"),F.add("vcolor","vec4"),M.main.add(S`vpos = calculateVPos();
3
3
  vnormal = normalize(localNormal());
4
4
  forwardViewPosDepth((view * vec4(vpos, 1.0)).xyz);
5
5
  gl_Position = transformPosition(proj, view, vpos);
6
6
  forwardObjectAndLayerIdColor();
7
7
  vcolor = getColor();
8
- forwardLinearDepthToReadShadowMap();`)),V){case 0:I.include(w,B),_.include(t,B),_.include(d,B),I.include(v,B),_.include(o,B),I.include(A,B),L(_,B),c(_),m(_),_.uniforms.add(M.uniforms.get("localOrigin"),new j("ambient",e=>e.ambient),new j("diffuse",e=>e.diffuse),new P("opacity",e=>e.opacity)),_.include(h),_.include(C,B),g(_),_.main.add(S`
8
+ forwardLinearDepthToReadShadowMap();`)),V){case 0:case 1:case 2:I.include(w,B),_.include(t,B),_.include(d,B),I.include(v,B),_.include(o,B),I.include(A,B),L(_,B),c(_),m(_),_.uniforms.add(M.uniforms.get("localOrigin"),new j("ambient",e=>e.ambient),new j("diffuse",e=>e.diffuse),new P("opacity",e=>e.opacity)),_.include(h),_.include(C,B),g(_),_.main.add(S`
9
9
  discardBySlice(vpos);
10
10
  discardByTerrainDepth();
11
11
 
@@ -32,15 +32,15 @@ forwardLinearDepthToReadShadowMap();`)),V){case 0:I.include(w,B),_.include(t,B),
32
32
 
33
33
  vec3 shadedColor = ${2===z?"evaluateSceneLightingPBR(normal, albedo, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, additionalAmbientIrradiance);":"evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight);"}
34
34
  vec4 finalColor = vec4(shadedColor, combinedOpacity);
35
- outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${O(T,", snow")});`);break;case 1:I.include(a),M.main.add(S`vpos = calculateVPos();
36
- gl_Position = transformPosition(proj, view, vpos);`),I.fragment.include(o,B),_.main.add(S`discardBySlice(vpos);`);break;case 3:case 4:case 5:case 6:I.include(a),e(I),F.add("depth","float"),M.main.add(S`vpos = calculateVPos();
35
+ outputColorHighlightOLID(applySlice(finalColor, vpos), albedo ${O(T,", snow")});`);break;case 3:I.include(a),M.main.add(S`vpos = calculateVPos();
36
+ gl_Position = transformPosition(proj, view, vpos);`),I.fragment.include(o,B),_.main.add(S`discardBySlice(vpos);`);break;case 5:case 6:case 7:case 8:I.include(a),e(I),F.add("depth","float"),M.main.add(S`vpos = calculateVPos();
37
37
  gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth);`),I.fragment.include(o,B),I.include(l,B),_.main.add(S`discardBySlice(vpos);
38
- outputDepth(depth);`);break;case 9:I.fragment.include(o,B),_.main.add(S`discardBySlice(vpos);
39
- outputObjectAndLayerIdColor();`);break;case 2:I.include(a),I.include(p,B),y(M),F.add("vnormal","vec3"),M.main.add(S`vpos = calculateVPos();
38
+ outputDepth(depth);`);break;case 11:I.fragment.include(o,B),_.main.add(S`discardBySlice(vpos);
39
+ outputObjectAndLayerIdColor();`);break;case 4:I.include(a),I.include(p,B),y(M),F.add("vnormal","vec3"),M.main.add(S`vpos = calculateVPos();
40
40
  vnormal = normalize((viewNormal * vec4(localNormal(), 1.0)).xyz);
41
41
  gl_Position = transformPosition(proj, view, vpos);`),I.fragment.include(o,B),_.main.add(S`discardBySlice(vpos);
42
42
  vec3 normal = normalize(vnormal);
43
43
  if (gl_FrontFacing == false) normal = -normal;
44
- fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case 8:I.include(a),I.include(p,B),F.add("vnormal","vec3"),M.main.add(S`vpos = calculateVPos();
44
+ fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case 10:I.include(a),I.include(p,B),F.add("vnormal","vec3"),M.main.add(S`vpos = calculateVPos();
45
45
  gl_Position = transformPosition(proj, view, vpos);`),I.fragment.include(o,B),I.include(s,B),_.main.add(S`discardBySlice(vpos);
46
46
  calculateOcclusionAndOutputHighlight();`)}return I}const I=Object.freeze(Object.defineProperty({__proto__:null,build:B},Symbol.toStringTag,{value:"Module"}));export{I as P,B as b};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as o}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{ObjectAndLayerIdColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{VertexColor as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{terrainDepthTest as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{VisualVariables as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{ColorConversion as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as n,addCameraPosition as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as s}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{glsl as v,If as p}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOLID as u}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as m}from"../views/3d/webgl-engine/shaders/PatternTextureBuffer.glsl.js";import{ShaderBuilder as f}from"../views/webgl/ShaderBuilder.js";const g=.70710678118,w=g,h=.08715574274,b=10,x=1;function y(y){const j=m(y),C=null!=j,T=new f;C&&T.include(j.TextureBackedBufferModule,y);const{vertex:V,fragment:P,attributes:$,varyings:R}=T,A=8===y.output;n(V,y),T.include(o);let L="";C?(y.hasVVColor&&(L=j.getTextureAttribute("colorFeatureAttribute")),y.hasVertexColors?(T.varyings.add("vColor","vec4"),T.vertex.code.add(v`void forwardVertexColor() { vColor = ${j.getTextureAttribute("color")}; }`)):T.vertex.code.add(v`void forwardVertexColor() {}`),$.add("textureElementIndex","uint")):(T.include(t,y),y.hasVVColor&&($.add("colorFeatureAttribute","float"),L="colorFeatureAttribute")),T.include(i,y),T.include(r,y),T.fragment.include(e,y),T.include(u,y),T.include(a,y),y.draped&&V.uniforms.add(new s("worldToScreenRatio",e=>1/e.screenToPCSRatio)),$.add("position","vec3"),$.add("uvMapSpace","vec4"),y.hasVertexColors||R.add("vColor","vec4"),R.add("vpos","vec3",{invariant:!0}),R.add("vuv","vec2"),V.uniforms.add(new d("uColor",e=>e.color));const D=3===y.style||4===y.style||5===y.style;return D&&V.code.add(v`
2
+ import{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as o}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{ObjectAndLayerIdColor as r}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{VertexColor as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js";import{terrainDepthTest as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{VisualVariables as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js";import{ColorConversion as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as n,addCameraPosition as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as s}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{glsl as v,If as p}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOLID as u}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as m}from"../views/3d/webgl-engine/shaders/PatternTextureBuffer.glsl.js";import{ShaderBuilder as f}from"../views/webgl/ShaderBuilder.js";const g=.70710678118,w=g,h=.08715574274,b=10,x=1;function y(y){const j=m(y),C=null!=j,T=new f;C&&T.include(j.TextureBackedBufferModule,y);const{vertex:V,fragment:P,attributes:$,varyings:R}=T,A=10===y.output;n(V,y),T.include(o);let L="";C?(y.hasVVColor&&(L=j.getTextureAttribute("colorFeatureAttribute")),y.hasVertexColors?(T.varyings.add("vColor","vec4"),T.vertex.code.add(v`void forwardVertexColor() { vColor = ${j.getTextureAttribute("color")}; }`)):T.vertex.code.add(v`void forwardVertexColor() {}`),$.add("textureElementIndex","uint")):(T.include(t,y),y.hasVVColor&&($.add("colorFeatureAttribute","float"),L="colorFeatureAttribute")),T.include(i,y),T.include(r,y),T.fragment.include(e,y),T.include(u,y),T.include(a,y),y.draped&&V.uniforms.add(new s("worldToScreenRatio",e=>1/e.screenToPCSRatio)),$.add("position","vec3"),$.add("uvMapSpace","vec4"),y.hasVertexColors||R.add("vColor","vec4"),R.add("vpos","vec3",{invariant:!0}),R.add("vuv","vec2"),V.uniforms.add(new d("uColor",e=>e.color));const D=3===y.style||4===y.style||5===y.style;return D&&V.code.add(v`
3
3
  const mat2 rotate45 = mat2(${v.float(g)}, ${v.float(-w)},
4
4
  ${v.float(w)}, ${v.float(g)});
5
5
  `),!y.draped&&C&&(c(V,y),V.uniforms.add(new s("worldToScreenPerDistanceRatio",e=>1/e.camera.perScreenPixelRatio)),V.code.add(v`vec3 projectPointToLineSegment(vec3 center, vec3 halfVector, vec3 point) {
@@ -253,7 +253,7 @@ lineDistanceNorm
253
253
  float stippleRadius = length(stipplePosition * lineWidth);
254
254
  float stippleCapSDF = (stippleRadius - lineWidth) * 0.5;
255
255
  float stippleCoverage = clamp(0.5 - stippleCapSDF, 0.0, 1.0);
256
- float stippleAlpha = step(alphaCutoff, stippleCoverage);`):A.main.add(D`float stippleAlpha = getStippleAlpha(lineWidth);`),9!==E&&A.main.add(D`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),C.include(c),A.uniforms.add(new h("intrinsicColor",e=>e.color)).main.add(D`vec4 color = intrinsicColor * vColor;
256
+ float stippleAlpha = step(alphaCutoff, stippleCoverage);`):A.main.add(D`float stippleAlpha = getStippleAlpha(lineWidth);`),11!==E&&A.main.add(D`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),C.include(c),A.uniforms.add(new h("intrinsicColor",e=>e.color)).main.add(D`vec4 color = intrinsicColor * vColor;
257
257
  color.a = noPerspectiveRead(color.a);`),k&&A.uniforms.add(new h("innerColor",e=>e.innerColor??e.color),new S("innerWidth",(e,i)=>e.innerWidth*i.camera.pixelRatio)).main.add(D`float distToInner = abs(lineDistance) - innerWidth;
258
258
  float innerAA = clamp(0.5 - distToInner, 0.0, 1.0);
259
259
  float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a);
@@ -263,7 +263,7 @@ float feather = (value - featherStartDistance) / (lineWidth - featherStartDistan
263
263
  finalColor.a *= 1.0 - clamp(feather, 0.0, 1.0);`),I&&A.main.add(D`
264
264
  finalColor = animate(finalColor);
265
265
 
266
- ${x(9!==E,D`
266
+ ${x(11!==E,D`
267
267
  if (finalColor.a <= alphaCutoff) {
268
268
  discard;
269
269
  }`)}
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{normalize as e,transformMat4 as i}from"../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{NormalFromDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js";import{ScreenSpacePass as t}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{calculateUVZShadowFromDepthPass as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import{ShadowmapFiltering as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js";import{Float3BindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{Float4PassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as n}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DShadowBindUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Texture2DShadowBindUniform.js";import{Texture2DUintPassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{ShaderBuilder as w}from"../views/webgl/ShaderBuilder.js";const m=.025;function p(){const o=new w;o.include(a),o.include(l),o.include(t),o.include(r);const p=o.fragment;return p.uniforms.add(new c("shadowMapExcludingHighlight",({shadowMap:e})=>e.getOutput(5)),new c("shadowMapHighlight",({shadowMap:e})=>e.getOutput(4)),new s("depthMap",e=>e.depth?.attachment),new u("highlightTexture",e=>e.highlightTexture),new d("uColor",e=>e.shadowColor),new g("opacity",e=>e.shadowOpacity),new g("occludedOpacity",e=>e.occludedShadowOpacity),new g("terminationFactor",e=>e.opacityElevation*e.dayNightTerminator),new h("lightingMainDirectionView",({lighting:o,camera:r})=>e(f,i(f,o.mainLight.direction,r.viewInverseTransposeMatrix)))),p.main.add(n`
2
+ import{normalize as e,transformMat4 as i}from"../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{NormalFromDepth as r}from"../views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js";import{ScreenSpacePass as t}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{calculateUVZShadowFromDepthPass as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import{ShadowmapFiltering as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js";import{Float3BindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js";import{Float4PassUniform as d}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as n}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DBindUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js";import{Texture2DShadowBindUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Texture2DShadowBindUniform.js";import{Texture2DUintPassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Texture2DUintPassUniform.js";import{ShaderBuilder as w}from"../views/webgl/ShaderBuilder.js";const m=.025;function p(){const o=new w;o.include(a),o.include(l),o.include(t),o.include(r);const p=o.fragment;return p.uniforms.add(new c("shadowMapExcludingHighlight",({shadowMap:e})=>e.getOutput(7)),new c("shadowMapHighlight",({shadowMap:e})=>e.getOutput(6)),new s("depthMap",e=>e.depth?.attachment),new u("highlightTexture",e=>e.highlightTexture),new d("uColor",e=>e.shadowColor),new g("opacity",e=>e.shadowOpacity),new g("occludedOpacity",e=>e.occludedShadowOpacity),new g("terminationFactor",e=>e.opacityElevation*e.dayNightTerminator),new h("lightingMainDirectionView",({lighting:o,camera:r})=>e(f,i(f,o.mainLight.direction,r.viewInverseTransposeMatrix)))),p.main.add(n`
3
3
  ivec2 highlightTextureSize = textureSize(highlightTexture, 0);
4
4
  ivec2 highlightIUV = ivec2(uv * vec2(highlightTextureSize));
5
5
  uvec2 highlightInfo = texelFetch(highlightTexture, highlightIUV, 0).rg;
@@ -4,7 +4,7 @@ float z = 1.0 - abs(normalCompressed.x) - abs(normalCompressed.y);
4
4
  vec3 n = vec3(normalCompressed + vec2(normalCompressed.x >= 0.0 ? 1.0 : -1.0,
5
5
  normalCompressed.y >= 0.0 ? 1.0 : -1.0) * min(z, 0.0), z);
6
6
  return normalize(n);
7
- }`)};T(N,o),a.include(s),W.include(F);const{output:E,overlayMode:I,tileBorders:q,transparencyMode:R,overlayEnabled:G}=o,J=2===R||3===R,K=0!==o.pbrMode,Q=G&&J;switch(E){case 0:{a.include(x,o),W.include(w,o),G&&a.include(L,o);const l=2===I;l&&a.include(m,o),H.add("vnormal","vec3"),H.add("vpos","vec3",{invariant:!0}),H.add("vup","vec3"),U(),N.main.add(z`
7
+ }`)};T(N,o),a.include(s),W.include(F);const{output:E,overlayMode:I,tileBorders:q,transparencyMode:R,overlayEnabled:G}=o,J=2===R||3===R,K=0!==o.pbrMode,Q=G&&J;switch(E){case 0:case 1:case 2:{a.include(x,o),W.include(w,o),G&&a.include(L,o);const l=2===I;l&&a.include(m,o),H.add("vnormal","vec3"),H.add("vpos","vec3",{invariant:!0}),H.add("vup","vec3"),U(),N.main.add(z`
8
8
  vpos = position;
9
9
  vec3 positionWorld = position + localOrigin;
10
10
  gl_Position = transformPosition(proj, view, vpos);
@@ -61,9 +61,9 @@ return normalize(n);
61
61
  vec2 edgeFactors = smoothstep(vec2(0.0), 1.5 * dVuv, min(vuv0, 1.0 - vuv0));
62
62
  float edgeFactor = 1.0 - min(edgeFactors.x, edgeFactors.y);
63
63
  finalColor = mix(finalColor, vec4(1.0, 0.0, 0.0, 1.0), edgeFactor);`)}
64
- outputColorHighlightOLID(applySlice(finalColor, vpos), finalColor.rgb);`)}break;case 1:Q&&a.include(L,o),N.main.add(z`
64
+ outputColorHighlightOLID(applySlice(finalColor, vpos), finalColor.rgb);`)}break;case 3:Q&&a.include(L,o),N.main.add(z`
65
65
  ${D(Q,"setOverlayVTC(uv0);")}
66
- gl_Position = transformPosition(proj, view, position);`),W.main.add(`${D(Q,"if (getCombinedOverlayColor().a < alphaCutoff) discard;")}`);break;case 3:case 4:case 5:case 6:case 7:a.include(g,o),l(a),t(a),N.main.add(z`gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);`),W.main.add(z`outputDepth(linearDepth);`);break;case 2:Q&&a.include(L,o),H.add("vnormal","vec3"),M(N),U(),N.main.add(z`
66
+ gl_Position = transformPosition(proj, view, position);`),W.main.add(`${D(Q,"if (getCombinedOverlayColor().a < alphaCutoff) discard;")}`);break;case 5:case 6:case 7:case 8:case 9:a.include(g,o),l(a),t(a),N.main.add(z`gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);`),W.main.add(z`outputDepth(linearDepth);`);break;case 4:Q&&a.include(L,o),H.add("vnormal","vec3"),M(N),U(),N.main.add(z`
67
67
  ${D(Q,"setOverlayVTC(uv0);")}
68
68
  gl_Position = transformPosition(proj, view, position);
69
69
  vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz);`),W.main.add(z`
@@ -72,10 +72,10 @@ return normalize(n);
72
72
  if (gl_FrontFacing == false) {
73
73
  normal = -normal;
74
74
  }
75
- fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case 8:G&&(a.include(L,o),a.include(u,o)),N.main.add(z`
75
+ fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);`);break;case 10:G&&(a.include(L,o),a.include(u,o)),N.main.add(z`
76
76
  ${D(G,"setOverlayVTC(uv0);")}
77
77
  gl_Position = transformPosition(proj, view, position);`),a.include(v,o),W.main.add(z`
78
78
  ${D(G,z`
79
79
  calculateOcclusionAndOutputHighlight(getAllOverlayHighlightValuesEncoded());`,"calculateOcclusionAndOutputHighlight();")}
80
- `);break;case 9:if(G)a.include(L,o),N.main.add(z`gl_Position = transformPosition(proj, view, position);
80
+ `);break;case 11:if(G)a.include(L,o),N.main.add(z`gl_Position = transformPosition(proj, view, position);
81
81
  setOverlayVTC(uv0);`),W.main.add(z`fragColor = getOverlayColorTexel();`);else{const e=0===R;N.main.add(z`${D(e,"gl_Position = transformPosition(proj, view, position);")}`),W.main.add(z`fragColor = vec4(0.0);`)}}return a}const k=o(),B=a(),H=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:N,build:W},Symbol.toStringTag,{value:"Module"}));export{N as T,H as a,W as b};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isColor as e}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as r}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as o}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{ObjectAndLayerIdColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{OutputHighlight as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientLighting as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import{addMainLightDirection as n,addMainLightIntensity as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{ReadShadowMapDraw as d}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as g}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{WaterColor as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js";import{WaterDistortion as v}from"../views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js";import{ColorConversion as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as p,addCameraPosition as w}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as h}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOLID as b}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as y}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as j}from"../webscene/support/AlphaCutoff.js";function L(L){const C=new y,{vertex:P,fragment:x,varyings:S}=C,{output:O,draped:D,receiveShadows:M}=L;p(P,L),C.include(o),C.attributes.add("position","vec3"),C.attributes.add("uv0","vec2");const _=new u("waterColor",e=>e.color);if(S.add("vpos","vec3",{invariant:!0}),P.uniforms.add(_),e(O)){if(D)return P.main.add(h`
2
+ import{isColor as e}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SliceDraw as r}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{Transform as o}from"../views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js";import{ObjectAndLayerIdColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{OutputHighlight as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{EvaluateAmbientLighting as t}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js";import{addMainLightDirection as n,addMainLightIntensity as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js";import{NormalUtils as l}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{ReadShadowMapDraw as d}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{terrainDepthTest as g}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{WaterColor as c}from"../views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js";import{WaterDistortion as m}from"../views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js";import{ColorConversion as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{addProjViewLocalOrigin as p,addCameraPosition as w}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as h}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{outputColorHighlightOLID as b}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{ShaderBuilder as y}from"../views/webgl/ShaderBuilder.js";import{alphaCutoff as j}from"../webscene/support/AlphaCutoff.js";function L(L){const C=new y,{vertex:P,fragment:x,varyings:S}=C,{output:O,draped:D,receiveShadows:M}=L;p(P,L),C.include(o),C.attributes.add("position","vec3"),C.attributes.add("uv0","vec2");const _=new u("waterColor",e=>e.color);if(S.add("vpos","vec3",{invariant:!0}),P.uniforms.add(_),e(O)){if(D)return P.main.add(h`
3
3
  if (waterColor.a < ${h.float(j)}) {
4
4
  // Discard this vertex
5
5
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
@@ -22,7 +22,7 @@ import{isColor as e}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutpu
22
22
  forwardViewPosDepth((view * vec4(vpos, 1.0)).xyz);
23
23
 
24
24
  gl_Position = transformPosition(proj, view, vpos);
25
- forwardLinearDepthToReadShadowMap();`)}switch(C.include(d,L),C.include(g,L),O){case 0:x.include(t,{pbrMode:0}),C.include(v),C.include(m,L),x.include(r,L),C.include(b,L),x.include(c),w(x,L),n(x),s(x),x.uniforms.add(_,new f("timeElapsed",({timeElapsed:e})=>e),P.uniforms.get("view"),P.uniforms.get("localOrigin")).main.add(h`
25
+ forwardLinearDepthToReadShadowMap();`)}switch(C.include(d,L),C.include(g,L),O){case 0:case 1:case 2:x.include(t,{pbrMode:0}),C.include(m),C.include(c,L),x.include(r,L),C.include(b,L),x.include(v),w(x,L),n(x),s(x),x.uniforms.add(_,new f("timeElapsed",({timeElapsed:e})=>e),P.uniforms.get("view"),P.uniforms.get("localOrigin")).main.add(h`
26
26
  discardBySlice(vpos);
27
27
  discardByTerrainDepth();
28
28
  vec3 localUp = vnormal;
@@ -37,7 +37,7 @@ import{isColor as e}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutpu
37
37
  vec4 final = vec4(getWaterColor(n, v, mainLightDirection, waterColor.rgb, mainLightIntensity, localUp, shadow, tangentNormalFoam.w, vPosView.xyz, vpos + localOrigin), waterColor.w);
38
38
 
39
39
  fragColor = delinearizeGamma(final);
40
- outputColorHighlightOLID(applySlice(fragColor, vpos), final.rgb);`);break;case 2:C.include(l,L),C.include(v,L),x.include(r,L),S.add("vuv","vec2"),P.main.add(h`
40
+ outputColorHighlightOLID(applySlice(fragColor, vpos), final.rgb);`);break;case 4:C.include(l,L),C.include(m,L),x.include(r,L),S.add("vuv","vec2"),P.main.add(h`
41
41
  if (waterColor.a < ${h.float(j)}) {
42
42
  // Discard this vertex
43
43
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
@@ -50,7 +50,7 @@ import{isColor as e}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutpu
50
50
  gl_Position = transformPosition(proj, view, vpos);`),x.uniforms.add(new f("timeElapsed",({timeElapsed:e})=>e)).main.add(h`discardBySlice(vpos);
51
51
  vec4 tangentNormalFoam = getSurfaceNormalAndFoam(vuv, timeElapsed);
52
52
  tangentNormalFoam.xyz = normalize(tangentNormalFoam.xyz);
53
- fragColor = vec4((tangentNormalFoam.xyz + vec3(1.0)) * 0.5, tangentNormalFoam.w);`);break;case 8:C.include(a,L),P.main.add(h`
53
+ fragColor = vec4((tangentNormalFoam.xyz + vec3(1.0)) * 0.5, tangentNormalFoam.w);`);break;case 10:C.include(a,L),P.main.add(h`
54
54
  if (waterColor.a < ${h.float(j)}) {
55
55
  // Discard this vertex
56
56
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
@@ -59,7 +59,7 @@ fragColor = vec4((tangentNormalFoam.xyz + vec3(1.0)) * 0.5, tangentNormalFoam.w)
59
59
 
60
60
  vpos = position;
61
61
  gl_Position = transformPosition(proj, view, vpos);`),x.include(r,L),x.main.add(h`discardBySlice(vpos);
62
- calculateOcclusionAndOutputHighlight();`);break;case 9:C.include(i,L),P.main.add(h`
62
+ calculateOcclusionAndOutputHighlight();`);break;case 11:C.include(i,L),P.main.add(h`
63
63
  if (waterColor.a < ${h.float(j)}) {
64
64
  // Discard this vertex
65
65
  gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.43";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.44";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{toConst as n}from"./compilerUtils.js";import t from"./RandomLCG.js";const e=1.5,r=1/e,l=.5;function u(n,t){if(!t)return n;for(const e of t)n.push(e);return n}function o(n){return n}function f(n,t=o){if(!n||0===n.length)return;let e=n[0],r=t(e);for(let l=1;l<n.length;++l){const u=n[l],o=Number(t(u));o>r&&(r=o,e=u)}return e}function i(n,t=o){return f(n,n=>-t(n))}function c(n,t){return t?n.filter((n,e,r)=>r.findIndex(t.bind(null,n))===e):Array.from(new Set(n))}function s(n,t,e,r,l,u,o){if(null==n&&null==r)return!0;t=Math.max(0,t),l=Math.max(0,l),e=Math.max(0,e<0?(n?.length??0)+e:e),u=Math.max(0,u<0?(r?.length??0)+u:u);const f=e-t;if(null==n||null==r||f!==u-l)return!1;if(o){for(let i=0;i<f;i++)if(!o(n[t+i],r[l+i]))return!1}else for(let i=0;i<f;i++)if(n[t+i]!==r[l+i])return!1;return!0}function h(n,t,e){return s(n,0,n?.length??0,t,0,t?.length??0,e)}function a(){return(n,t)=>{if(null==n&&null==t)return!0;if(null==n||null==t||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}}function g(n,t){let e=n.length!==t.length;e&&(n.length=t.length);for(let r=0;r<t.length;++r)n[r]!==t[r]&&(n[r]=t[r],e=!0);return e}function d(n,t,e){let r,l;return e?(r=t.filter(t=>!n.some(n=>e(n,t))),l=n.filter(n=>!t.some(t=>e(t,n)))):(r=t.filter(t=>!n.includes(t)),l=n.filter(n=>!t.includes(n))),{added:r,removed:l}}function m(n,t,e){return n&&t?e?n.filter(n=>t.findIndex(t=>e(n,t))>-1):n.filter(n=>t.includes(n)):[]}function p(n){return n&&"number"==typeof n.length}function M(n,t){const e=n.length;if(0===e)return[];const r=[];for(let l=0;l<e;l+=t)r.push(n.slice(l,l+t));return r}function x(n,t){void 0===t&&(t=n,n=0);const e=new Array(t-n);for(let r=n;r<t;r++)e[r-n]=r;return e}function w(n,t,e){const r=n.length;let l=0,u=r-1;for(;l<u;){const e=l+Math.floor((u-l)/2);t>n[e]?l=e+1:u=e}const o=n[l];return e?t>=n[r-1]?-1:o===t?l:l-1:o===t?l:-1}class y{constructor(){this.last=0}}const A=new y;function b(n,t,e,r){r=r||A;const l=Math.max(0,r.last-10);for(let o=l;o<e;++o)if(n[o]===t)return r.last=o,o;const u=Math.min(l,e);for(let o=0;o<u;++o)if(n[o]===t)return r.last=o,o;return-1}function S(t,e,r,l){const u=r??t.length,o=b(t,n(e),u,l);if(-1!==o)return t[o]=t[u-1],null==r&&t.pop(),e}const j=new Set;function v(n,t,e=n.length,r=t.length,l,u){if(0===r||0===e)return e;j.clear();for(let f=0;f<r;++f)j.add(t[f]);l=l||A;const o=Math.max(0,l.last-10);for(let f=o;f<e;++f)if(j.has(n[f])&&(u?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;for(let f=0;f<o;++f)if(j.has(n[f])&&(u?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;return j.clear(),e}function z(n,t){let e=0;for(let r=0;r<n.length;++r){const l=n[r];t(l,r)&&(n[e]=l,e++)}return n.length=e,n}function I(n,t,e){const r=n.length;if(t>=r)return n.slice();const l=C(e),u=new Set,o=[];for(;o.length<t;){const t=Math.floor(l()*r);u.has(t)||(u.add(t),o.push(n[t]))}return o}function C(n){return n?(F.seed=n,()=>F.getFloat()):Math.random}const F=new t;function G(n,t){if(!n)return n;const e=C(t);for(let r=n.length-1;r>0;r--){const t=Math.floor(e()*(r+1)),l=n[r];n[r]=n[t],n[t]=l}return n}function L(n,t){const e=n.indexOf(t);return-1!==e?(n.splice(e,1),t):null}function N(n,t){return null!=n}function O(n,...t){for(const e of t)null!=e&&n.push(e);return n.length}function R(n,t){return n.reduce((n,e)=>t(e)?n+1:n,0)}function U(n){return Array.isArray(n)}function k(n,t,e){for(t<n.length&&(n.length=t);n.length<t;)n.push(e())}function q(n,t){return n-t}const B=[];export{y as PositionHint,u as addMany,w as binaryIndexOf,R as countIf,d as difference,B as emptyArray,h as equals,z as filterInPlace,C as getRandomNumberGenerator,b as indexOf,m as intersect,p as isArrayLike,U as isArrayWithReadonly,N as isSome,a as makeArrayEquals,f as max,i as min,q as numericSort,I as pickRandom,O as pushIfSome,x as range,e as reallocGrowthFactor,r as reallocShrinkFactor,l as reallocShrinkThreshold,L as remove,S as removeUnordered,v as removeUnorderedMany,k as resizeFilled,G as shuffle,s as sliceEquals,M as splitIntoChunks,c as unique,g as update};
2
+ import{toConst as n}from"./compilerUtils.js";import t from"./RandomLCG.js";const e=1.5,r=1/e,l=.5;function o(n,t){if(!t)return n;for(const e of t)n.push(e);return n}function u(n){return n}function f(n,t=u){if(!n||0===n.length)return;let e=n[0],r=t(e);for(let l=1;l<n.length;++l){const o=n[l],u=Number(t(o));u>r&&(r=u,e=o)}return e}function i(n,t=u){return f(n,n=>-t(n))}function c(n,t){return t?n.filter((n,e,r)=>r.findIndex(t.bind(null,n))===e):Array.from(new Set(n))}function s(n,t,e,r,l,o,u){if(null==n&&null==r)return!0;t=Math.max(0,t),l=Math.max(0,l),e=Math.max(0,e<0?(n?.length??0)+e:e),o=Math.max(0,o<0?(r?.length??0)+o:o);const f=e-t;if(null==n||null==r||f!==o-l)return!1;if(u){for(let i=0;i<f;i++)if(!u(n[t+i],r[l+i]))return!1}else for(let i=0;i<f;i++)if(n[t+i]!==r[l+i])return!1;return!0}function h(n,t,e){return s(n,0,n?.length??0,t,0,t?.length??0,e)}function a(){return(n,t)=>{if(null==n&&null==t)return!0;if(null==n||null==t||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}}function g(n,t){let e=n.length!==t.length;e&&(n.length=t.length);for(let r=0;r<t.length;++r)n[r]!==t[r]&&(n[r]=t[r],e=!0);return e}function d(n,t,e){let r,l;return e?(r=t.filter(t=>!n.some(n=>e(n,t))),l=n.filter(n=>!t.some(t=>e(t,n)))):(r=t.filter(t=>!n.includes(t)),l=n.filter(n=>!t.includes(n))),{added:r,removed:l}}function m(n,t,e){return n&&t?e?n.filter(n=>t.findIndex(t=>e(n,t))>-1):n.filter(n=>t.includes(n)):[]}function p(n){return n&&"number"==typeof n.length}function M(n,t){const e=n.length;if(0===e)return[];const r=[];for(let l=0;l<e;l+=t)r.push(n.slice(l,l+t));return r}function x(n,t){void 0===t&&(t=n,n=0);const e=new Array(t-n);for(let r=n;r<t;r++)e[r-n]=r;return e}function N(n,t,e){const r=n.length;let l=0,o=r-1;for(;l<o;){const e=l+Math.floor((o-l)/2);t>n[e]?l=e+1:o=e}const u=n[l];return e?t>=n[r-1]?-1:u===t?l:l-1:u===t?l:-1}function w(n,t,e,r){n.length>e&&(n.length=e);const l=n.length;let o=0,u=l;if(l===e){const e=r(n[l-1],t);if(e<=0||Number.isNaN(e))return}for(;o<u;){const e=o+u>>>1,l=r(n[e],t);l<=0||Number.isNaN(l)?o=e+1:u=e}l===e&&n.pop(),n.splice(o,0,t)}class b{constructor(){this.last=0}}const y=new b;function A(n,t,e,r){r=r||y;const l=Math.max(0,r.last-10);for(let u=l;u<e;++u)if(n[u]===t)return r.last=u,u;const o=Math.min(l,e);for(let u=0;u<o;++u)if(n[u]===t)return r.last=u,u;return-1}function S(t,e,r,l){const o=r??t.length,u=A(t,n(e),o,l);if(-1!==u)return t[u]=t[o-1],null==r&&t.pop(),e}const j=new Set;function v(n,t,e=n.length,r=t.length,l,o){if(0===r||0===e)return e;j.clear();for(let f=0;f<r;++f)j.add(t[f]);l=l||y;const u=Math.max(0,l.last-10);for(let f=u;f<e;++f)if(j.has(n[f])&&(o?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;for(let f=0;f<u;++f)if(j.has(n[f])&&(o?.push(n[f]),j.delete(n[f]),n[f]=n[e-1],--e,--f,0===j.size||0===e))return j.clear(),e;return j.clear(),e}function z(n,t){let e=0;for(let r=0;r<n.length;++r){const l=n[r];t(l,r)&&(n[e]=l,e++)}return n.length=e,n}function I(n,t,e){const r=n.length;if(t>=r)return n.slice();const l=C(e),o=new Set,u=[];for(;u.length<t;){const t=Math.floor(l()*r);o.has(t)||(o.add(t),u.push(n[t]))}return u}function C(n){return n?(F.seed=n,()=>F.getFloat()):Math.random}const F=new t;function G(n,t){if(!n)return n;const e=C(t);for(let r=n.length-1;r>0;r--){const t=Math.floor(e()*(r+1)),l=n[r];n[r]=n[t],n[t]=l}return n}function L(n,t){const e=n.indexOf(t);return-1!==e?(n.splice(e,1),t):null}function O(n,t){return null!=n}function R(n,...t){for(const e of t)null!=e&&n.push(e);return n.length}function U(n,t){return n.reduce((n,e)=>t(e)?n+1:n,0)}function k(n){return Array.isArray(n)}function q(n,t,e){for(t<n.length&&(n.length=t);n.length<t;)n.push(e())}function B(n,t){return n-t}const D=[];export{b as PositionHint,o as addMany,N as binaryIndexOf,U as countIf,d as difference,D as emptyArray,h as equals,z as filterInPlace,C as getRandomNumberGenerator,A as indexOf,w as insertSortedStableTopN,m as intersect,p as isArrayLike,k as isArrayWithReadonly,O as isSome,a as makeArrayEquals,f as max,i as min,B as numericSort,I as pickRandom,R as pushIfSome,x as range,e as reallocGrowthFactor,r as reallocShrinkFactor,l as reallocShrinkThreshold,L as remove,S as removeUnordered,v as removeUnorderedMany,q as resizeFilled,G as shuffle,s as sliceEquals,M as splitIntoChunks,c as unique,g as update};
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.1";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.1.0-next.43",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.1";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.1.0-next.44",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -73,15 +73,18 @@ export interface SceneLayerProperties extends LayerProperties, APIKeyMixinProper
73
73
  */
74
74
  attributeTableTemplate?: AttributeTableTemplateProperties | null;
75
75
  /**
76
- * Specifies how features are placed on the vertical axis (z). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/)
76
+ * Specifies how features are placed on the vertical axis (z). See the
77
+ * [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/)
77
78
  * for an example of how this property may be used.
78
79
  *
79
80
  * > [!WARNING]
80
81
  * >
81
- * > The `relative-to-scene` mode does not affect 3D Object [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/). [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) with
82
- * > [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) geometries support all the elevation modes listed in the [ElevationInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/).
83
- * > [ElevationInfo.featureExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/#featureExpressionInfo) is not supported when the elevation info is specified for this class.
84
- * > If the elevation info is not specified, the effective elevation depends on the context and could vary per point.
82
+ * > The `relative-to-scene` mode does not affect 3D Object [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/).
83
+ * > [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) with [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) geometries support all the elevation modes
84
+ * > listed in the [ElevationInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/).
85
+ * > [ElevationInfo.featureExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/#featureExpressionInfo) is not supported when the elevation info is
86
+ * > specified for this class. If the elevation info is not specified, the effective elevation depends on the context
87
+ * > and could vary per point.
85
88
  */
86
89
  elevationInfo?: ElevationInfoProperties | null;
87
90
  /**
@@ -681,15 +684,18 @@ export default class SceneLayer extends SceneLayerSuperclass {
681
684
  */
682
685
  get effectiveCapabilities(): SceneLayerCapabilities;
683
686
  /**
684
- * Specifies how features are placed on the vertical axis (z). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/)
687
+ * Specifies how features are placed on the vertical axis (z). See the
688
+ * [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/)
685
689
  * for an example of how this property may be used.
686
690
  *
687
691
  * > [!WARNING]
688
692
  * >
689
- * > The `relative-to-scene` mode does not affect 3D Object [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/). [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) with
690
- * > [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) geometries support all the elevation modes listed in the [ElevationInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/).
691
- * > [ElevationInfo.featureExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/#featureExpressionInfo) is not supported when the elevation info is specified for this class.
692
- * > If the elevation info is not specified, the effective elevation depends on the context and could vary per point.
693
+ * > The `relative-to-scene` mode does not affect 3D Object [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/).
694
+ * > [SceneLayers](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) with [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) geometries support all the elevation modes
695
+ * > listed in the [ElevationInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/).
696
+ * > [ElevationInfo.featureExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/symbols/support/ElevationInfo/#featureExpressionInfo) is not supported when the elevation info is
697
+ * > specified for this class. If the elevation info is not specified, the effective elevation depends on the context
698
+ * > and could vary per point.
693
699
  */
694
700
  get elevationInfo(): ElevationInfo | null | undefined;
695
701
  set elevationInfo(value: ElevationInfoProperties | null | undefined);
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clone as e}from"../../../core/lang.js";import{polygonCentroid as t,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as i,getGeometryExtent as a}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as n}from"../../../geometry/support/quantizationUtils.js";import{isValid as r,equals as o}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as l}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as u,isCoordinate as c,cloneCurve as m}from"../../../geometry/support/curves/curveUtils.js";import d from"./AttributesBuilder.js";import{cleanFromGeometryEngine as p,getGeometry as f,transformCentroid as h}from"./geometryUtils.js";import{project as y}from"./projectionSupport.js";import{getDateInNumber as g}from"./queryUtils.js";import{SnappingCandidateEdge as x,SnappingCandidateVertex as T}from"./SnappingCandidate.js";import{isDateField as F,isDateOnlyField as I,isTimestampOffsetField as _,isStringField as v,isTimeOnlyField as V}from"../../support/fieldUtils.js";import S from"../../../rest/support/AutoIntervalBinParameters.js";import b from"../../../rest/support/DateBinParameters.js";import{unitsDict as z}from"../../../rest/support/DateBinUtils.js";import R from"../../../rest/support/FixedBoundariesBinParameters.js";import B from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as M,calculateStringStatistics as A,calculateStatistics as w,processSummaryStatisticsResult as N,calculateUniqueValuesCount as D,createUVResult as P,calculateClassBreaks as q,resolveCBResult as j,calculateHistogram as C,getAttributeComparator as O,calculatePercentile as Z,binIndex as G,getBinParams as E}from"../../../statistics/utils.js";import{utc as H}from"../../../time/constants.js";import{DateTime as U}from"luxon";const k="bin";class J{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new d(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const n=new Map,r=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!r.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,this.items,n);s.push(t)}r.set(a,this._calculateUniqueValues(s,this.items,e.returnDistinctValues))}const u=r.get(a);for(const t in u){const{data:i,items:a}=u[t],n=i.join(",");s&&!e.validateItems(a,s)||o.add(n)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;r(this.query.outSR)&&!o(t.spatialReference,this.query.outSR)?e.queryGeometry=p({spatialReference:this.query.outSR,...y(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=p({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,s){const i=this.featureAdapter,a=Y(this.hasZ,this.hasM),{point:n}=e,r="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y;function d(e,t){const s=(e-n.x)/r,i=(t-n.y)/o;return s*s+i*i}const p={candidates:[]},f="esriGeometryPolygon"===this.geometryType,h="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,y=this._getPointCreator(t,this.spatialReference,s),g=new X(null,0),F=new X(null,0),I={x:0,y:0,z:0};for(const l of this.items){const e=i.getObjectId(l),t=i.getGeometryWithCurves?.(l);if(null!=t){v(t,e);continue}const s=i.getGeometry(l);null==s||_(s,e)}return p.candidates.sort((e,t)=>e.distance-t.distance),p;function _(t,s){const{coords:i}=t,r=t.isPoint?L:t.lengths;if(g.coords=i,F.coords=i,e.returnEdge){let e=0;for(let t=0;t<r.length;t++){const i=r[t],o=e;for(let t=0;t<i;t++,e+=a){if(!f&&t===i-1)continue;if(g.coordsIndex=e,F.coordsIndex=t===i-1?o:e+a,!Q(I,n,g,F))continue;const r=d(I.x,I.y);r<=1&&p.candidates.push(new x(s,y(I),Math.sqrt(r),y(g),y(F)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<r.length;t++){const i=r[t],n=e,o=F;o.coordsIndex=n;for(let t=0;t<i;t++,e+=a){if(g.coordsIndex=e,f&&t===i-1&&g.x===o.x&&g.y===o.y)continue;const a=d(g.x,g.y);a<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(a)))}}}else if(h&&"ends"===e.vertexMode){let e=0;const t=[];for(let s=0;s<r.length;s++){t.push(e);const i=r[s];e+=i*a,i>1&&t.push(e-a)}for(const i of t){g.coordsIndex=i;const e=d(g.x,g.y);e<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(e)))}}}function v(t,s){const{candidates:i}=p,a={x:0,y:0,z:0};if(e.returnEdge){const e=[n.x,n.y],r=new X(e,0),o=new X(e,0);for(const{segments:n}of t.parts)for(const{start:t,curve:p}of n){const{curvePoint:n}=l(t,p,e),f=d(...n);if(f>1)continue;[a.x,a.y]=n,r.coords=t,o.coords=u(p);const h=c(p)?null:m(p);i.push(new x(s,y(a),Math.sqrt(f),y(r),y(o),!1,h))}}function r(e){a.x=t.vertexXY[2*e],a.y=t.vertexXY[2*e+1];const n=d(a.x,a.y);n>1||(a.z=t.vertexZ?.[e]??0,i.push(new T(s,y(a),Math.sqrt(n))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)r(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":r(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const s=t.partOffsets[e],i=t.partOffsets[e+1]-1;r(s),i!==s&&r(i)}}}}_getPointCreator(e,t,s){const i=null==s||o(t,s)?e=>e:e=>y(e,t,s),{hasZ:a}=this,n=0;return a&&e?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:n})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,minValue:r,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=F(m)||I(m)||_(m),p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:l,timeZone:u},this.items),f=M({normalizationType:a,normalizationField:i,minValue:r,maxValue:o}),h={value:.5,fieldType:m?.type},y=v(m)?A({values:p,supportsNullCount:f,percentileParams:h,outStatisticTypes:c}):w({values:p,minValue:r,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:h,outStatisticTypes:c});return N(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:n,timeZone:r}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:n,timeZone:r},this.items,!1),l=D(o);return P(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items),f=q(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return j(f,r)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items);return C(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.slice().reverse()){const t=i.split(" "),a=t[0],n=this.fieldsIndex.get(a),r=!!t[1]&&"desc"===t[1].toLowerCase(),o=O(n?.type,r,"case-insensitive");e.sort((e,t)=>{const i=s(e,a,n),r=s(t,a,n);return o(i,r)})}}_createFeatureQueryResponse(e){const{items:t,geometryType:s,hasM:i,hasZ:a,objectIdField:r,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:f,returnM:h}=e,y=null!=m&&t.length>(d||0)+m,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:s,hasM:i&&h,hasZ:a&&f,objectIdFieldName:r,spatialReference:p(u||o),transform:c&&n(c)||null}}_createFeatures(e,t){const s=new d(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:r,quantizationParameters:o,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:p,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,T=i&&g;let F=[],I=0;const _=[...t];if(this._sortFeatures(_,r,(e,t,i)=>s.getFieldValue(e,t,i)),this.geometryType&&(l||u)){const e=n(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const i of _){const a=this.featureAdapter.getGeometry(i),n=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),geometry:f(this.geometryType,a,c,e,x,T)});t&&a&&!n.geometry&&(n.centroid=h(this,this.featureAdapter.getCentroid(i,this),e)),F[I++]=n}else if(!l&&u)for(const i of _)F[I++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:h(this,this.featureAdapter.getCentroid(i,this),e)});else for(const i of _)F[I++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:h(this,this.featureAdapter.getCentroid(i,this),e),geometry:f(this.geometryType,this.featureAdapter.getGeometry(i),c,e,x,T)})}else for(const n of _){const e=s.getAttributes(n);e&&(F[I++]=this._addFeatureJSONMetadata(n,{attributes:e}))}const v=m||0;if(null!=p){const e=v+p;F=F.slice(v,Math.min(F.length,e))}return F}_addFeatureJSONMetadata(e,t){const s=this.featureAdapter.getMetadata?.(e);return void 0!==s&&(t.metadata=s),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,s=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,i=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>s)e=!0;else{const t=Y(this.hasZ,this.hasM),s=this.featureAdapter;e=this.items.reduce((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)},0)/t>i}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,s={attributes:{}}){const i=[],a=new Map,n=new Map,r=new Map,o=new Map,l=new d(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:p,resultRecordCount:f}=e,h=c?.length,y=!!h,g=y?c[0]:null,x=y&&!this.fieldsIndex.get(g);for(const d of u??[]){const{outStatisticFieldName:e,statisticType:u}=d,p=d,f="exceedslimit"!==u?d.onStatisticField:void 0,T="percentile_disc"===u||"percentile_cont"===u,F="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,I=y&&1===h&&(f===g||x)&&"count"===u;if(y){if(!r.has(f)){const e=[];for(const s of c){const i=this._getAttributeValues(l,s,t,a);e.push(i)}r.set(f,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const s=r.get(f);if(!s)continue;const i=Object.keys(s);for(const n of i){const{count:i,data:r,items:u,itemPositions:d}=s[n],h=r.join(",");if(!m||l.validateItems(u,m)){const s=o.get(h)||{attributes:{}};if(F){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(p,u);s.aggregateGeometries[t]=e}else{let n=null;if(I)n=i;else{const e=this._getAttributeValues(l,f,t,a),s=d.map(t=>e[t]);n=T&&"statisticParameters"in p?this._getPercentileValue(p,s):this._getStatisticValue(p,s,null,l.returnDistinctValues)}s.attributes[e]=n}let n=0;c.forEach((e,t)=>s.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++n]=r[t]),o.set(h,s)}}}else if(F){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(p,t);s.aggregateGeometries[i]=e}else{const i=this._getAttributeValues(l,f,t,a);s.attributes[e]=T&&"statisticParameters"in p?this._getPercentileValue(p,i):this._getStatisticValue(p,i,n,l.returnDistinctValues)}const _="min"!==u&&"max"!==u||!v(this.fieldsIndex.get(f))&&!this._isAnyDateField(f)?null:this.fieldsIndex.get(f)?.type;i.push({name:e,alias:e,type:_||"esriFieldTypeDouble"})}const T=y?Array.from(o.values()):[s];return this._sortFeatures(T,p,(e,t)=>e.attributes[t]),f&&(T.length=Math.min(f,T.length)),{fields:i,features:T}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return F(t)||I(t)||_(t)||V(t)}async _getAggregateGeometry(e,n){const{convexHull:r,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,p=n.map(e=>f(d,c.getGeometry(e))),h=r(m,p,!0)[0],y={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=h?i(h):a(o(m,p));y.aggregateGeometries={...e,spatialReference:m},y.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=h?t(h):s(a(o(m,p)));y.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},y.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(y.aggregateGeometries=h,y.outStatisticFieldName=u||"convexHull");return y}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:n}=e;let r=null;r=s?.has(a)?s.get(a):v(this.fieldsIndex.get(a))||this._isAnyDateField(a)?A({values:t,returnDistinct:i}):w({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,r);return r["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:n,orderBy:r}=i,o=this.fieldsIndex.get(s);return Z(t,{value:n,orderBy:r,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s,i){if(i.has(t))return i.get(t);const a=this.fieldsIndex.get(t),n=s.map(s=>e.getFieldValue(s,t,a));return i.set(t,n),n}_calculateUniqueValues(e,t,s){const i={},a=t.length;for(let n=0;n<a;n++){const a=t[n],r=[];for(const t of e)r.push(t[n]);const o=r.join(",");null==i[o]?i[o]={count:1,data:r,items:[a],itemPositions:[n]}:(s||i[o].count++,i[o].items.push(a),i[o].itemPositions.push(n))}return i}async _getDataValues(t,s,i=!0){const a=new d(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:r,timeZone:o}=t;return n?a.getExpressionValues(s,n,{viewingMode:"map",scale:r,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(s,e(t),i)}_calculateHistogramBins(e,t,s){if(null==t.min&&null==t.max)return[];const i=t.intervals,a=t.min??0,n=t.max??0,r=i.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=s[o];if(null!=t&&t>=a&&t<=n){const e=G(i,t);e>-1&&(r[e].count++,r[e].items.push(l))}}return r}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:s,outAlias:i,valueType:a}=t,n=[],r=[{name:i??s,alias:i??s,type:a??"esriFieldTypeString"},{name:k,alias:k,type:"esriFieldTypeInteger"}],o=new d(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[s],(e,t,s)=>o.getFieldValue(e,t,s));const c=this._getAttributeValues(o,s,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(n.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[i??s]:d}}))),a.fields)for(const e of a.fields)r.some(t=>t.name===e.name)||r.push(e)}return{fields:r,features:n}}async _createBinsResponse(e,t){const s=e.bin;switch(t=t??this.items,s.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(S.fromJSON(s),e,t);case"dateBin":return this._createDateBinsResponse(b.fromJSON(s),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(R.fromJSON(s),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(B.fromJSON(s),e,t)}}async _createAutoIntervalBinsResponse(e,t,s){const{field:i,normalizationField:a,numBins:n,normalizationType:r,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),m=E(c,{field:i,normalizationField:a,normalizationType:r,normalizationTotal:o,numBins:n,minValue:g(r?e.normalizationMinValue:l,!1),maxValue:g(r?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,s);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,s){const{field:i,interval:a,start:n,end:r,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),p=V(this.fieldsIndex.get(i)),f=z.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),y=null!=n?g(n,p):h[0],x=null!=r?g(r,p):h[h.length-1],T=[];if(null!=y&&null!=x){const e={zone:t.outTimeReference?.ianaTimeZone??H},s=u?.unit?z.toJSON(u.unit):"milliseconds",i={[s]:u?.value||0},n=U.fromMillis(y,e).minus(i),r=U.fromMillis(x,e).minus(i),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const s=(e.weekday-t+7)%7;return e.minus({days:s}).startOf("day")};if("last"===o){let e="week"===f?((e,t)=>d(e,t).plus({days:7}))(r,m):r;for(;e>n;){const t=e.minus({[f]:a.value});if(t<n){T.unshift([l?t.plus(i).toMillis():n.plus(i).toMillis(),e.plus(i).toMillis()]);break}T.unshift([t.plus(i).toMillis(),e.plus(i).toMillis()]),e=t}}else{let e="first"===o?n:"week"===f?d(n,m):n.startOf(f);for(;e<=r;){const t=e.plus({[f]:a.value});if(t>r){T.push([e.plus(i).toMillis(),l?t.plus(i).toMillis():r.plus(i).toMillis()]);break}T.push([e.plus(i).toMillis(),t.plus(i).toMillis()]),e=t}}}const F=this._calculateHistogramBins(d,{intervals:T,min:y,max:x},s);return this._createFeaturesFromHistogramBins(F,t)}async _createFixedBoundariesBinsResponse(e,t,s){const{field:i}=e,a=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),n=V(this.fieldsIndex.get(i)),r=e.boundaries.map(e=>g(e,n)).sort((e,t)=>e-t),o=[];for(let c=0;c<r.length-1;c++)o.push([r[c],r[c+1]]);const l={intervals:o,min:r.at(0),max:r.at(-1)},u=this._calculateHistogramBins(a,l,s);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,s){const{field:i,interval:a,normalizationType:n,start:r,end:o}=e,l=await this._getDataValues({field:i||e.expression,normalizationField:e.normalizationField,normalizationType:n,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),u=V(this.fieldsIndex.get(i)),c=E(l,{field:i,classificationMethod:"defined-interval",definedInterval:a,minValue:g(n?e.normalizationMinValue:r,u),maxValue:g(n?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,s);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:s,lowerBoundaryAlias:i}=t,a=i||"lowerBoundary",n=s||"upperBoundary",r=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:n,alias:n,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:k,alias:k,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const p of e){const{minValue:e,maxValue:s,items:i}=p,f={attributes:{}};let h;if(f.attributes[a]=m&&d&&null!=e?U.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(f.attributes[n]=m&&d&&null!=s?U.fromMillis(s,{zone:d}).toISO():s),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},i),f.attributes[k]=++c,"flat"===t.bin.jsonStyle?r.push(...h.features.map(({attributes:{EXPR_1:e,...t},...s})=>({...s,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),r.push(f))):(t.bin?.splitBy&&(f.attributes[k]=++c),h=await this._createStatisticsQueryResponse(t,i,f),r.push(f)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&r.reverse(),{fields:o,features:r}}}function Q(e,t,s,i){const a=i.x-s.x,n=i.y-s.y,r=t.x-s.x,o=t.y-s.y,l=a*a+n*n;if(0===l)return!1;const u=r*a+o*n,c=Math.min(1,Math.max(0,u/l));return e.x=s.x+a*c,e.y=s.y+n*c,!0}function Y(e,t){return e?t?4:3:t?3:2}class X{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const L=[1];export{J as QueryEngineResult};
2
+ import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import{polygonCentroid as s,extentCentroid as i}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as u}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as c,isCoordinate as m,cloneCurve as d}from"../../../geometry/support/curves/curveUtils.js";import p from"./AttributesBuilder.js";import{cleanFromGeometryEngine as f,getGeometry as h,transformCentroid as y}from"./geometryUtils.js";import{project as g}from"./projectionSupport.js";import{getDateInNumber as x}from"./queryUtils.js";import{SnappingCandidateEdge as F,SnappingCandidateVertex as T}from"./SnappingCandidate.js";import{isDateField as I,isDateOnlyField as _,isTimestampOffsetField as v,isStringField as V,isTimeOnlyField as S}from"../../support/fieldUtils.js";import b from"../../../rest/support/AutoIntervalBinParameters.js";import R from"../../../rest/support/DateBinParameters.js";import{unitsDict as z}from"../../../rest/support/DateBinUtils.js";import B from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as A,calculateStringStatistics as w,calculateStatistics as N,processSummaryStatisticsResult as D,calculateUniqueValuesCount as P,createUVResult as q,calculateClassBreaks as O,resolveCBResult as j,calculateHistogram as C,calculatePercentile as Z,binIndex as G,getBinParams as E,getAttributeComparator as H}from"../../../statistics/utils.js";import{utc as U}from"../../../time/constants.js";import{DateTime as k}from"luxon";const J="bin";class Q{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasM=s.hasM,this.hasZ=s.hasZ,this.fieldsIndex=s.fieldsIndex,this.objectIdField=s.objectIdField,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new p(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const n=new Map,r=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!r.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,this.items,n);s.push(t)}r.set(a,this._calculateUniqueValues(s,this.items,e.returnDistinctValues))}const u=r.get(a);for(const t in u){const{data:i,items:a}=u[t],n=i.join(",");s&&!e.validateItems(a,s)||o.add(n)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=f({spatialReference:this.query.outSR,...g(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=f({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,s){const i=this.featureAdapter,a=X(this.hasZ,this.hasM),{point:n}=e,r="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y;function l(e,t){const s=(e-n.x)/r,i=(t-n.y)/o;return s*s+i*i}const p={candidates:[]},f="esriGeometryPolygon"===this.geometryType,h="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,y=this._getPointCreator(t,this.spatialReference,s),g=new L(null,0),x=new L(null,0),I={x:0,y:0,z:0};for(const u of this.items){const e=i.getObjectId(u),t=i.getGeometryWithCurves?.(u);if(null!=t){v(t,e);continue}const s=i.getGeometry(u);null==s||_(s,e)}return p.candidates.sort((e,t)=>e.distance-t.distance),p;function _(t,s){const{coords:i}=t,r=t.isPoint?W:t.lengths;if(g.coords=i,x.coords=i,e.returnEdge){let e=0;for(let t=0;t<r.length;t++){const i=r[t],o=e;for(let t=0;t<i;t++,e+=a){if(!f&&t===i-1)continue;if(g.coordsIndex=e,x.coordsIndex=t===i-1?o:e+a,!Y(I,n,g,x))continue;const r=l(I.x,I.y);r<=1&&p.candidates.push(new F(s,y(I),Math.sqrt(r),y(g),y(x)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<r.length;t++){const i=r[t],n=e,o=x;o.coordsIndex=n;for(let t=0;t<i;t++,e+=a){if(g.coordsIndex=e,f&&t===i-1&&g.x===o.x&&g.y===o.y)continue;const a=l(g.x,g.y);a<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(a)))}}}else if(h&&"ends"===e.vertexMode){let e=0;const t=[];for(let s=0;s<r.length;s++){t.push(e);const i=r[s];e+=i*a,i>1&&t.push(e-a)}for(const i of t){g.coordsIndex=i;const e=l(g.x,g.y);e<=1&&p.candidates.push(new T(s,y(g),Math.sqrt(e)))}}}function v(t,s){const{candidates:i}=p,a={x:0,y:0,z:0};if(e.returnEdge){const e=[n.x,n.y],r=new L(e,0),o=new L(e,0);for(const{segments:n}of t.parts)for(const{start:t,curve:p}of n){const{curvePoint:n}=u(t,p,e),f=l(...n);if(f>1)continue;[a.x,a.y]=n,r.coords=t,o.coords=c(p);const h=m(p)?null:d(p);i.push(new F(s,y(a),Math.sqrt(f),y(r),y(o),!1,h))}}function r(e){a.x=t.vertexXY[2*e],a.y=t.vertexXY[2*e+1];const n=l(a.x,a.y);n>1||(a.z=t.vertexZ?.[e]??0,i.push(new T(s,y(a),Math.sqrt(n))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)r(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":r(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const s=t.partOffsets[e],i=t.partOffsets[e+1]-1;r(s),i!==s&&r(i)}}}}_getPointCreator(e,t,s){const i=null==s||l(t,s)?e=>e:e=>g(e,t,s),{hasZ:a}=this,n=0;return a&&e?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:n})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,minValue:r,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=I(m)||_(m)||v(m),p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:l,timeZone:u},this.items),f=A({normalizationType:a,normalizationField:i,minValue:r,maxValue:o}),h={value:.5,fieldType:m?.type},y=V(m)?w({values:p,supportsNullCount:f,percentileParams:h,outStatisticTypes:c}):N({values:p,minValue:r,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:h,outStatisticTypes:c});return D(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:n,timeZone:r}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:n,timeZone:r},this.items,!1),l=P(o);return q(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items),f=O(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return j(f,r)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,p=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:n,scale:m,timeZone:d},this.items);return C(p,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:n}=K(i,this.fieldsIndex);e.sort((e,i)=>t(s(e,a,n),s(i,a,n)))}}_topNFeatures(t,s,i,a){if(t.length>1&&s?.length){const n=s.map(e=>{const{compare:t,fieldOrExpression:s,fieldInfo:i}=K(e,this.fieldsIndex);return(e,n)=>t(a(e,s,i),a(n,s,i))}).reduceRight((e,t)=>(s,i)=>{const a=t(s,i);return 0===a||Number.isNaN(a)?e(s,i):a}),r=[];for(const s of t)e(r,s,i,n);return r}return t.slice(0,i)}_createFeatureQueryResponse(e){const{items:t,geometryType:s,hasM:i,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:p,returnM:h}=e,y=null!=m&&t.length>(d||0)+m,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:s,hasM:i&&h,hasZ:a&&p,objectIdFieldName:n,spatialReference:f(u||o),transform:c&&r(c)||null}}_createFeatures(e,t){const s=new p(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:g=!1}=e,x=a&&f,F=i&&g;let T;const I=m||0,_=null!=d?I+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,n,_,(e,t,i)=>s.getFieldValue(e,t,i)):(T=[...t],this._sortFeatures(T,n,(e,t,i)=>s.getFieldValue(e,t,i))),(I>0||null!=_)&&(T=T.slice(I,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const i of T){const a=this.featureAdapter.getGeometry(i),n=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),geometry:h(this.geometryType,a,c,e,x,F)});t&&a&&!n.geometry&&(n.centroid=y(this,this.featureAdapter.getCentroid(i,this),e)),v[V++]=n}else if(!l&&u)for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:y(this,this.featureAdapter.getCentroid(i,this),e)});else for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:y(this,this.featureAdapter.getCentroid(i,this),e),geometry:h(this.geometryType,this.featureAdapter.getGeometry(i),c,e,x,F)})}else for(const r of T){const e=s.getAttributes(r);e&&(v[V++]=this._addFeatureJSONMetadata(r,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const s=this.featureAdapter.getMetadata?.(e);return void 0!==s&&(t.metadata=s),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,s=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,i=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>s)e=!0;else{const t=X(this.hasZ,this.hasM),s=this.featureAdapter;e=this.items.reduce((e,t)=>{const i=s.getGeometry(t);return e+(null!=i&&i.coords.length||0)},0)/t>i}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,s={attributes:{}}){const i=[],a=new Map,n=new Map,r=new Map,o=new Map,l=new p(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,h=c?.length,y=!!h,g=y?c[0]:null,x=y&&!this.fieldsIndex.get(g);for(const p of u??[]){const{outStatisticFieldName:e,statisticType:u}=p,d=p,f="exceedslimit"!==u?p.onStatisticField:void 0,F="percentile_disc"===u||"percentile_cont"===u,T="EnvelopeAggregate"===u||"CentroidAggregate"===u||"ConvexHullAggregate"===u,I=y&&1===h&&(f===g||x)&&"count"===u;if(y){if(!r.has(f)){const e=[];for(const s of c){const i=this._getAttributeValues(l,s,t,a);e.push(i)}r.set(f,this._calculateUniqueValues(e,t,!T&&l.returnDistinctValues))}const s=r.get(f);if(!s)continue;const i=Object.keys(s);for(const n of i){const{count:i,data:r,items:u,itemPositions:p}=s[n],h=r.join(",");if(!m||l.validateItems(u,m)){const s=o.get(h)||{attributes:{}};if(T){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(d,u);s.aggregateGeometries[t]=e}else{let n=null;if(I)n=i;else{const e=this._getAttributeValues(l,f,t,a),s=p.map(t=>e[t]);n=F&&"statisticParameters"in d?this._getPercentileValue(d,s):this._getStatisticValue(d,s,null,l.returnDistinctValues)}s.attributes[e]=n}let n=0;c.forEach((e,t)=>s.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++n]=r[t]),o.set(h,s)}}}else if(T){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(d,t);s.aggregateGeometries[i]=e}else{const i=this._getAttributeValues(l,f,t,a);s.attributes[e]=F&&"statisticParameters"in d?this._getPercentileValue(d,i):this._getStatisticValue(d,i,n,l.returnDistinctValues)}const _="min"!==u&&"max"!==u||!V(this.fieldsIndex.get(f))&&!this._isAnyDateField(f)?null:this.fieldsIndex.get(f)?.type;i.push({name:e,alias:e,type:_||"esriFieldTypeDouble"})}const F=y?Array.from(o.values()):[s];return this._sortFeatures(F,d,(e,t)=>e.attributes[t]),f&&(F.length=Math.min(f,F.length)),{fields:i,features:F}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return I(t)||_(t)||v(t)||S(t)}async _getAggregateGeometry(e,t){const{convexHull:r,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,p=t.map(e=>h(d,c.getGeometry(e))),f=r(m,p,!0)[0],y={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=f?a(f):n(o(m,p));y.aggregateGeometries={...e,spatialReference:m},y.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=f?s(f):i(n(o(m,p)));y.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},y.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(y.aggregateGeometries=f,y.outStatisticFieldName=u||"convexHull");return y}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:n}=e;let r=null;r=s?.has(a)?s.get(a):V(this.fieldsIndex.get(a))||this._isAnyDateField(a)?w({values:t,returnDistinct:i}):N({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,r);return r["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:n,orderBy:r}=i,o=this.fieldsIndex.get(s);return Z(t,{value:n,orderBy:r,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s,i){if(i.has(t))return i.get(t);const a=this.fieldsIndex.get(t),n=s.map(s=>e.getFieldValue(s,t,a));return i.set(t,n),n}_calculateUniqueValues(e,t,s){const i={},a=t.length;for(let n=0;n<a;n++){const a=t[n],r=[];for(const t of e)r.push(t[n]);const o=r.join(",");null==i[o]?i[o]={count:1,data:r,items:[a],itemPositions:[n]}:(s||i[o].count++,i[o].items.push(a),i[o].itemPositions.push(n))}return i}async _getDataValues(e,s,i=!0){const a=new p(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:r,timeZone:o}=e;return n?a.getExpressionValues(s,n,{viewingMode:"map",scale:r,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(s,t(e),i)}_calculateHistogramBins(e,t,s){if(null==t.min&&null==t.max)return[];const i=t.intervals,a=t.min??0,n=t.max??0,r=i.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=s[o];if(null!=t&&t>=a&&t<=n){const e=G(i,t);e>-1&&(r[e].count++,r[e].items.push(l))}}return r}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:s,outAlias:i,valueType:a}=t,n=[],r=[{name:i??s,alias:i??s,type:a??"esriFieldTypeString"},{name:J,alias:J,type:"esriFieldTypeInteger"}],o=new p(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[s],(e,t,s)=>o.getFieldValue(e,t,s));const c=this._getAttributeValues(o,s,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(n.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[i??s]:d}}))),a.fields)for(const e of a.fields)r.some(t=>t.name===e.name)||r.push(e)}return{fields:r,features:n}}async _createBinsResponse(e,t){const s=e.bin;switch(t=t??this.items,s.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(b.fromJSON(s),e,t);case"dateBin":return this._createDateBinsResponse(R.fromJSON(s),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(B.fromJSON(s),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(M.fromJSON(s),e,t)}}async _createAutoIntervalBinsResponse(e,t,s){const{field:i,normalizationField:a,numBins:n,normalizationType:r,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),m=E(c,{field:i,normalizationField:a,normalizationType:r,normalizationTotal:o,numBins:n,minValue:x(r?e.normalizationMinValue:l,!1),maxValue:x(r?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,s);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,s){const{field:i,interval:a,start:n,end:r,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),p=S(this.fieldsIndex.get(i)),f=z.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),y=null!=n?x(n,p):h[0],g=null!=r?x(r,p):h[h.length-1],F=[];if(null!=y&&null!=g){const e={zone:t.outTimeReference?.ianaTimeZone??U},s=u?.unit?z.toJSON(u.unit):"milliseconds",i={[s]:u?.value||0},n=k.fromMillis(y,e).minus(i),r=k.fromMillis(g,e).minus(i),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const s=(e.weekday-t+7)%7;return e.minus({days:s}).startOf("day")};if("last"===o){let e="week"===f?((e,t)=>d(e,t).plus({days:7}))(r,m):r;for(;e>n;){const t=e.minus({[f]:a.value});if(t<n){F.unshift([l?t.plus(i).toMillis():n.plus(i).toMillis(),e.plus(i).toMillis()]);break}F.unshift([t.plus(i).toMillis(),e.plus(i).toMillis()]),e=t}}else{let e="first"===o?n:"week"===f?d(n,m):n.startOf(f);for(;e<=r;){const t=e.plus({[f]:a.value});if(t>r){F.push([e.plus(i).toMillis(),l?t.plus(i).toMillis():r.plus(i).toMillis()]);break}F.push([e.plus(i).toMillis(),t.plus(i).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:F,min:y,max:g},s);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,s){const{field:i}=e,a=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),n=S(this.fieldsIndex.get(i)),r=e.boundaries.map(e=>x(e,n)).sort((e,t)=>e-t),o=[];for(let c=0;c<r.length-1;c++)o.push([r[c],r[c+1]]);const l={intervals:o,min:r.at(0),max:r.at(-1)},u=this._calculateHistogramBins(a,l,s);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,s){const{field:i,interval:a,normalizationType:n,start:r,end:o}=e,l=await this._getDataValues({field:i||e.expression,normalizationField:e.normalizationField,normalizationType:n,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),u=S(this.fieldsIndex.get(i)),c=E(l,{field:i,classificationMethod:"defined-interval",definedInterval:a,minValue:x(n?e.normalizationMinValue:r,u),maxValue:x(n?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,s);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:s,lowerBoundaryAlias:i}=t,a=i||"lowerBoundary",n=s||"upperBoundary",r=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:n,alias:n,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:J,alias:J,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const p of e){const{minValue:e,maxValue:s,items:i}=p,f={attributes:{}};let h;if(f.attributes[a]=m&&d&&null!=e?k.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(f.attributes[n]=m&&d&&null!=s?k.fromMillis(s,{zone:d}).toISO():s),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},i),f.attributes[J]=++c,"flat"===t.bin.jsonStyle?r.push(...h.features.map(({attributes:{EXPR_1:e,...t},...s})=>({...s,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),r.push(f))):(t.bin?.splitBy&&(f.attributes[J]=++c),h=await this._createStatisticsQueryResponse(t,i,f),r.push(f)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&r.reverse(),{fields:o,features:r}}}function Y(e,t,s,i){const a=i.x-s.x,n=i.y-s.y,r=t.x-s.x,o=t.y-s.y,l=a*a+n*n;if(0===l)return!1;const u=r*a+o*n,c=Math.min(1,Math.max(0,u/l));return e.x=s.x+a*c,e.y=s.y+n*c,!0}function X(e,t){return e?t?4:3:t?3:2}class L{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const W=[1];function K(e,t){const s=e.split(" "),i=s[0],a=t.get(i),n=!!s[1]&&"desc"===s[1].toLowerCase();return{compare:H(a?.type,n,"case-insensitive"),fieldOrExpression:i,fieldInfo:a}}export{Q as QueryEngineResult};
@@ -906,6 +906,12 @@ export default class Sublayer extends SublayerSuperclass {
906
906
  * @see [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/#load)
907
907
  */
908
908
  get types(): FeatureType[] | null | undefined;
909
+ /**
910
+ * This property contains an array of field names that are used to uniquely identify a feature in the layer.
911
+ *
912
+ * @since 5.1
913
+ */
914
+ get uniqueIdFields(): string[] | null | undefined;
909
915
  /**
910
916
  * The URL to the REST endpoint of the sublayer. This allows
911
917
  * you to view the schema of fields and query tables located
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../PopupTemplate.js";import t from"../../request.js";import i from"../../core/Collection.js";import o from"../../core/Error.js";import has from"../../core/has.js";import{IdentifiableMixin as s}from"../../core/Identifiable.js";import{clone as a}from"../../core/lang.js";import{Loadable as l}from"../../core/Loadable.js";import n from"../../core/Logger.js";import{MultiOriginJSONSupportMixin as p}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as y}from"../../core/sql.js";import{objectToQuery as u}from"../../core/urlUtils.js";import{property as d,cast as c,subclass as h}from"../../core/accessorSupport/decorators.js";import{ensureInteger as f,ensureType as m,Integer as b,ensureClass as g}from"../../core/accessorSupport/ensureType.js";import{nameToId as w}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as I}from"../../core/accessorSupport/utils.js";import S from"../../geometry/Extent.js";import v from"../../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as j}from"../../geometry/support/typeUtils.js";import O from"../../graphic/MapImageGraphicOrigin.js";import F from"../../graphic/TileGraphicOrigin.js";import x from"../graphics/sources/support/QueryTask.js";import{readOrderByInfos as L}from"../mixins/OrderedLayer.js";import D from"./EditFieldsInfo.js";import{getFeatureType as P}from"./featureLayerUtils.js";import T from"./FeatureType.js";import q from"./Field.js";import _ from"./FieldsIndex.js";import{fixRendererFields as E}from"./fieldUtils.js";import M from"./LabelClass.js";import{validateLabelingInfo as N}from"./labelingInfo.js";import A from"./LayerFloorInfo.js";import B from"./OrderByInfo.js";import k from"./Relationship.js";import{getFeatureLayerCapabilities as R}from"./serviceCapabilitiesUtils.js";import{webSceneRendererTypes as C,rendererTypes as V}from"../../renderers/support/typeUtils.js";import{parseUrl as Q}from"../../rest/utils.js";import U from"../../rest/layerSources/DynamicDataLayer.js";import J from"../../rest/layerSources/DynamicMapLayer.js";import $ from"../../rest/support/AttachmentQuery.js";import W from"../../rest/support/Query.js";import{createPopupTemplate as G}from"../../support/popupUtils.js";import{isSymbol3D as K}from"../../symbols/support/typeUtils.js";import z from"../../tables/AttributeTableTemplate.js";import{reader as H}from"../../core/accessorSupport/decorators/reader.js";import{writer as X}from"../../core/accessorSupport/decorators/writer.js";var Y;function Z(e){return"esriSMS"===e?.type}function ee(e,r,t){const i=t.minimumWritableOrigin||t.origin;return!!i&&e.originIdOf(r)>=w(i)}function re(e,r,t){const i=ee(this,r,t);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function te(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&(ee(this,r,t)||this._isOverridden(r)))}}function ie(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function oe(e,r,t){return{ignoreOrigin:!0,enabled:!!t?.writeSublayerStructure&&this.originIdOf(r)>2}}function se(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||ee(this,r,t))}}let ae=0;const le=new Set(["layer","parent","loaded","loadStatus","loadError","loadWarnings"]);let ne=class extends(p(s(l))){static{Y=this}constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=void 0,this.editFieldsInfo=null,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.isTable=!1,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.spatialReference=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise(this.reload(e)),this}readCapabilities(e,r){r=r.layerDefinition||r;const{attachment:t,operations:{supportsQuery:i,supportsQueryAttachments:o},query:{supportsFormatPBF:s,supportsOrderBy:a,supportsPagination:l,relativeTimeBinWindow:n},data:{supportsAttachment:p},queryRelated:y}=R(r,this.url);return{attachment:{supportsOrderByFields:t?.supportsOrderByFields??!1,supportsResize:t?.supportsResize??!1,supportsTypeWildcard:t?.supportsTypeWildcard??!1},exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:i,supportsQueryAttachments:o},data:{supportsAttachment:p},query:{relativeTimeBinWindow:n,supportsFormatPBF:s,supportsOrderBy:a,supportsPagination:l},queryRelated:y}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readMaxScaleRange(e,r){return{minScale:(r=r.layerDefinition||r).minScale??0,maxScale:r.maxScale??0}}get fieldsIndex(){return new _(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get graphicOrigin(){if(!this.layer)return null;switch(this.layer.type){case"tile":return new F(this.layer,this);case"map-image":return new O(this.layer,this)}}get id(){const e=this._get("id");return e??ae++}set id(e){this._get("id")!==e&&(!1!==this.layer?.capabilities?.exportMap?.supportsDynamicLayers?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}readIsTable(e,r){return"Table"===r.type}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map(e=>e.write({},i))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers?.forEach(r=>r.layer=e)}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;const t=r.fields?.find(e=>"esriFieldTypeOID"===e.type);return t?.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const{layerDefinition:t}=r;return 1-.01*(t?.transparency??t?.drawingInfo?.transparency??0)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}set orderBy(e){this._setAndNotifyLayer("orderBy",e)}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=f(this.parent.id):r.parentLayerId=-1}get queryTask(){if(!this.layer)return null;const{capabilities:e,fieldsIndex:r,layer:t,url:i}=this,{spatialReference:o}=t,s="gdbVersion"in t?t.gdbVersion:void 0,a=has("featurelayer-pbf")&&e?.query.supportsFormatPBF;return new x({fieldsIndex:r,gdbVersion:s,pbfSupported:a,queryAttachmentsSupported:e?.operations?.supportsQueryAttachments??!1,relativeTimeBinWindow:e?.query?.relativeTimeBinWindow??0,sourceSpatialReference:o,url:i})}set renderer(e){if(E(e,this.fieldsIndex),e)for(const r of e.symbols)if(K(r)){n.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new J({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}get sublayers(){return this._get("sublayers")}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return m(i.ofType(Y),e)}writeSublayers(e,r,t){this.sublayers?.length&&(r[t]=this.sublayers.map(e=>e.id).toArray().reverse())}readTitle(e,r){return r.layerDefinition?.name??r.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find(e=>e.name.toLowerCase()===t);e&&(t=e.name)}return t}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${u(t)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=I(this),r=new Y;return I(r).store=e.clone(le),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return G(this,e)}createQuery(){return new W({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.sublayers)return null;const e=(await import("../FeatureLayer.js")).default,{layer:r,url:t}=this;let i;if(t&&this.originIdOf("url")>2)i=new e({url:t});else{if(!r?.parsedUrl)throw new o("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const t=r.parsedUrl;i=new e({url:t.path}),t&&this.source&&("map-layer"===this.source.type?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return null!=r?.refreshInterval&&(i.refreshInterval=r.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=a(this.floorInfo)),this.originIdOf("labelingInfo")>2&&(i.labelingInfo=a(this.labelingInfo)),this.originIdOf("labelsVisible")>0&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>0&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>0&&(i.visible=this.visible),this.originIdOf("minScale")>0&&(i.minScale=this.minScale),this.originIdOf("maxScale")>0&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>0&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>0&&(i.popupTemplate=a(this.popupTemplate)),this.originIdOf("renderer")>2&&(i.renderer=a(this.renderer)),"data-layer"===this.source?.type&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>0&&(i.title=this.title),"map-image"===r?.type&&r.originIdOf("customParameters")>0&&(i.customParameters=r.customParameters),"tile"===r?.type&&r.originIdOf("customParameters")>0&&(i.customParameters=r.customParameters),i}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){return P(this.types,this.typeIdField,e)}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryAttachments(e,r){await this.load();let t=$.from(e);const i=this.capabilities;if(!i?.data?.supportsAttachment)throw new o("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:s,objectIds:a,globalIds:l,num:n,size:p,start:y,where:u}=t;if(!i?.operations?.supportsQueryAttachments){if(s?.length>0||l?.length>0||p?.length>0||n||y||u)throw new o("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(a?.length||l?.length||u))throw new o("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);return!i?.attachment?.supportsOrderByFields&&t.orderByFields?.length&&(t=t.clone(),t.orderByFields=null),this.queryTask.executeAttachmentQuery(t,r)}async queryFeatureCount(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryFeatureCount:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryFeatureCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(e,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(t?.features){const e=this.graphicOrigin;for(const r of t.features)r.sourceLayer=this,r.origin=e}return t}async queryObjectIds(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryObjectIds:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryObjectIds:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForIds(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeatures(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryRelatedFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryRelatedFeatures:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQuery(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeaturesCount(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryRelatedFeaturesCount:not-supported","this layer doesn't support queries.");if(!this.capabilities.queryRelated.supportsCount)throw new o("queryRelatedFeaturesCount:not-supported","this layer doesn't support query related counts.");if(!this.url)throw new o("queryRelatedFeaturesCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQueryForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}async reload(e){if("not-loaded"===this.loadStatus)return this.load(e).then(()=>{});const{layer:r,url:i}=this;if(!r&&!i)throw new o("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const s=r?await r.fetchSublayerInfo(this,e):(await t(i,{query:{f:"json"},...e})).data;s&&(this.sourceJSON={...this.sourceJSON,...s},this.read({layerDefinition:s},{origin:"service",layer:r,url:Q(i)}))}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=y(e,this.definitionExpression);null!=t&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce((e,r)=>(e[r]=this.originIdOf(r),e),{}),o=Object.keys(i).some(e=>i[e]>2);if(o){const e=r.drawingInfo={};if(i.renderer>2&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>2&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>2)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some(e=>!e.labelPlacement)&&n.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;null!=this.geometryType&&(r=N(this.labelingInfo,j.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=r.filter(e=>e.labelPlacement).map(e=>e.toJSON({origin:"service",layer:this.layer}))}else e.showLabels=!1;i.opacity>2&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return(this.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1)&&this.originIdOf("orderBy")>2&&(r.orderBy=this.orderBy?.map(e=>e.toJSON())??null),r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline?.color?e.color=e.outline.color:e.color=[0,0,0,0])})}_forEachSimpleMarkerSymbols(e,r){if(e){const t=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(const e of t)Z(e.symbol)&&r(e.symbol);"symbol"in e&&Z(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&Z(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,s;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",s="supportsModification";break;case"orderBy":o="supportsSublayerOrderBy",s="supportsModification"}const a=I(this).getDefaultOrigin();if("service"!==a){if(o&&!1===this.layer?.capabilities?.exportMap?.[o])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(s&&!1===this.capabilities?.exportMap[s])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${s}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==a&&i!==r&&t?.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach(e=>{e.parent=null,e.layer=null}),this.removeAllHandles()),e&&(e.forEach(e=>{e.parent=this,e.layer=this.layer}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this,e.layer=this.layer}),e.on("after-remove",({item:e})=>{e.parent=null,e.layer=null}),e.on("before-changes",e=>{(this.layer?.capabilities?.exportMap?.supportsSublayersChanges??1)||(n.getLogger(this).error(new o("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())})]))}_logLockedError(e,r){const{layer:t,declaredClass:i}=this;n.getLogger(i).error(new o("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${t?.id}'`,{reason:r,sublayer:this,layer:t}))}_getLayerDomain(e){return this.fieldsIndex.get(e)?.domain??null}static{this.test={isMapImageLayerOverridePolicy:e=>e===oe||e===ie||e===re,isTileImageLayerOverridePolicy:e=>e===te}}};e([d({type:z,json:{name:"attributeTableInfo",write:{overridePolicy:re},origins:{"web-scene":{write:!1}}}})],ne.prototype,"attributeTableTemplate",void 0),e([d({readOnly:!0})],ne.prototype,"capabilities",void 0),e([H("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],ne.prototype,"readCapabilities",null),e([d()],ne.prototype,"defaultPopupTemplate",null),e([d({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:re}}})],ne.prototype,"definitionExpression",null),e([d({readOnly:!0,type:D,json:{origins:{service:{read:{source:"layerDefinition.editFieldsInfo"}}}}})],ne.prototype,"editFieldsInfo",void 0),e([d({readOnly:!0})],ne.prototype,"effectiveScaleRange",null),e([H("service","maxScaleRange",["minScale","maxScale"])],ne.prototype,"readMaxScaleRange",null),e([d({type:[q],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],ne.prototype,"fields",void 0),e([d({readOnly:!0})],ne.prototype,"fieldsIndex",null),e([d({type:A,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:re},origins:{"web-scene":{read:!1,write:!1}}}})],ne.prototype,"floorInfo",null),e([d({type:S,json:{read:{source:"layerDefinition.extent"}}})],ne.prototype,"fullExtent",void 0),e([d({type:j.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:j.read}}}}})],ne.prototype,"geometryType",void 0),e([d({type:String})],ne.prototype,"globalIdField",void 0),e([H("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],ne.prototype,"readGlobalIdFieldFromService",null),e([d({readOnly:!0})],ne.prototype,"graphicOrigin",null),e([d({type:b,json:{write:{ignoreOrigin:!0}}})],ne.prototype,"id",null),e([d({readOnly:!0})],ne.prototype,"isTable",void 0),e([H("service","isTable",["type"])],ne.prototype,"readIsTable",null),e([d({value:null,type:[M],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:oe}}})],ne.prototype,"labelingInfo",null),e([X("labelingInfo")],ne.prototype,"writeLabelingInfo",null),e([d({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:ie}}})],ne.prototype,"labelsVisible",null),e([d({value:null})],ne.prototype,"layer",null),e([d({type:String,json:{write:{overridePolicy:te}}})],ne.prototype,"layerItemId",void 0),e([d({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:se}}})],ne.prototype,"legendEnabled",void 0),e([d({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],ne.prototype,"listMode",null),e([d({type:Number,value:0,json:{write:{overridePolicy:ie}}})],ne.prototype,"minScale",null),e([H("minScale",["minScale","layerDefinition.minScale"])],ne.prototype,"readMinScale",null),e([d({type:Number,value:0,json:{write:{overridePolicy:ie}}})],ne.prototype,"maxScale",null),e([H("maxScale",["maxScale","layerDefinition.maxScale"])],ne.prototype,"readMaxScale",null),e([d()],ne.prototype,"objectIdField",void 0),e([H("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],ne.prototype,"readObjectIdFieldFromService",null),e([d({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:ie}}})],ne.prototype,"opacity",null),e([H("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],ne.prototype,"readOpacity",null),e([X("opacity")],ne.prototype,"writeOpacity",null),e([d({value:null,type:[B],json:{name:"layerDefinition.orderBy",read:{reader:L},write:{overridePolicy:re},origins:{"web-scene":{read:!1,write:!1}}}})],ne.prototype,"orderBy",null),e([d({json:{type:b,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:ie}}})],ne.prototype,"parent",void 0),e([X("parent")],ne.prototype,"writeParent",null),e([d({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:se,writer(e,r,t){r[t]=!e}}}})],ne.prototype,"popupEnabled",void 0),e([d({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:se}}})],ne.prototype,"popupTemplate",void 0),e([d({readOnly:!0})],ne.prototype,"queryTask",null),e([d({type:[k],readOnly:!0,json:{origins:{service:{read:{source:"layerDefinition.relationships"}}}}})],ne.prototype,"relationships",void 0),e([d({types:V,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:oe},origins:{"web-scene":{types:C,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:oe}}}}})],ne.prototype,"renderer",null),e([d({types:{key:"type",base:null,typeMap:{"data-layer":U,"map-layer":J}},cast(e){if(e){if("mapLayerId"in e)return g(J,e);if("dataSource"in e)return g(U,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:ie}}})],ne.prototype,"source",null),e([d()],ne.prototype,"sourceJSON",void 0),e([d({type:v,json:{origins:{service:{read:{source:"layerDefinition.extent.spatialReference"}}}}})],ne.prototype,"spatialReference",void 0),e([d({value:null,json:{type:[b],write:{target:"subLayerIds",allowNull:!0,overridePolicy:ie}}})],ne.prototype,"sublayers",null),e([c("sublayers")],ne.prototype,"castSublayers",null),e([X("sublayers")],ne.prototype,"writeSublayers",null),e([d({type:String,json:{name:"name",write:{overridePolicy:se}}})],ne.prototype,"title",void 0),e([H("service","title",["name","layerDefinition.name"])],ne.prototype,"readTitle",null),e([d({type:String})],ne.prototype,"typeIdField",void 0),e([d({json:{read:!1},readOnly:!0,value:"sublayer"})],ne.prototype,"type",void 0),e([H("typeIdField",["layerDefinition.typeIdField"])],ne.prototype,"readTypeIdField",null),e([d({type:[T],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],ne.prototype,"types",void 0),e([d({type:String,json:{name:"layerUrl",write:{overridePolicy:te}}})],ne.prototype,"url",null),e([d({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:ie}}})],ne.prototype,"visible",null),e([X("visible")],ne.prototype,"writeVisible",null),ne=Y=e([h("esri.layers.support.Sublayer")],ne);export{ne as default};
2
+ import{__decorate as e}from"tslib";import r from"../../PopupTemplate.js";import t from"../../request.js";import i from"../../core/Collection.js";import o from"../../core/Error.js";import has from"../../core/has.js";import{IdentifiableMixin as s}from"../../core/Identifiable.js";import{clone as a}from"../../core/lang.js";import{Loadable as l}from"../../core/Loadable.js";import n from"../../core/Logger.js";import{MultiOriginJSONSupportMixin as p}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as u}from"../../core/sql.js";import{objectToQuery as y}from"../../core/urlUtils.js";import{property as d,cast as c,subclass as f}from"../../core/accessorSupport/decorators.js";import{ensureInteger as h,ensureType as m,Integer as b,ensureClass as g}from"../../core/accessorSupport/ensureType.js";import{nameToId as I}from"../../core/accessorSupport/PropertyOrigin.js";import{getProperties as w}from"../../core/accessorSupport/utils.js";import S from"../../geometry/Extent.js";import v from"../../geometry/SpatialReference.js";import{featureGeometryTypeKebabDictionary as j}from"../../geometry/support/typeUtils.js";import F from"../../graphic/MapImageGraphicOrigin.js";import O from"../../graphic/TileGraphicOrigin.js";import D from"../graphics/sources/support/QueryTask.js";import{readOrderByInfos as x}from"../mixins/OrderedLayer.js";import q from"./EditFieldsInfo.js";import{getFeatureType as L}from"./featureLayerUtils.js";import P from"./FeatureType.js";import T from"./Field.js";import _ from"./FieldsIndex.js";import{fixRendererFields as E}from"./fieldUtils.js";import M from"./LabelClass.js";import{validateLabelingInfo as N}from"./labelingInfo.js";import A from"./LayerFloorInfo.js";import B from"./OrderByInfo.js";import k from"./Relationship.js";import{getFeatureLayerCapabilities as R}from"./serviceCapabilitiesUtils.js";import{webSceneRendererTypes as C,rendererTypes as V}from"../../renderers/support/typeUtils.js";import{parseUrl as Q}from"../../rest/utils.js";import U from"../../rest/layerSources/DynamicDataLayer.js";import J from"../../rest/layerSources/DynamicMapLayer.js";import $ from"../../rest/support/AttachmentQuery.js";import W from"../../rest/support/Query.js";import{createPopupTemplate as G}from"../../support/popupUtils.js";import{isSymbol3D as K}from"../../symbols/support/typeUtils.js";import H from"../../tables/AttributeTableTemplate.js";import{reader as z}from"../../core/accessorSupport/decorators/reader.js";import{writer as X}from"../../core/accessorSupport/decorators/writer.js";var Y;function Z(e){return"esriSMS"===e?.type}function ee(e,r,t){const i=t.minimumWritableOrigin||t.origin;return!!i&&e.originIdOf(r)>=I(i)}function re(e,r,t){const i=ee(this,r,t);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function te(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&(ee(this,r,t)||this._isOverridden(r)))}}function ie(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function oe(e,r,t){return{ignoreOrigin:!0,enabled:!!t?.writeSublayerStructure&&this.originIdOf(r)>2}}function se(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||ee(this,r,t))}}let ae=0;const le=new Set(["layer","parent","loaded","loadStatus","loadError","loadWarnings"]);let ne=class extends(p(s(l))){static{Y=this}constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=void 0,this.editFieldsInfo=null,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.isTable=!1,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.spatialReference=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this.uniqueIdFields=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise(this.reload(e)),this}readCapabilities(e,r){r=r.layerDefinition||r;const{attachment:t,operations:{supportsQuery:i,supportsQueryAttachments:o},query:{supportsFormatPBF:s,supportsOrderBy:a,supportsPagination:l,relativeTimeBinWindow:n},data:{supportsAttachment:p},queryRelated:u}=R(r,this.url);return{attachment:{supportsOrderByFields:t?.supportsOrderByFields??!1,supportsResize:t?.supportsResize??!1,supportsTypeWildcard:t?.supportsTypeWildcard??!1},exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:i,supportsQueryAttachments:o},data:{supportsAttachment:p},query:{relativeTimeBinWindow:n,supportsFormatPBF:s,supportsOrderBy:a,supportsPagination:l},queryRelated:u}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readMaxScaleRange(e,r){return{minScale:(r=r.layerDefinition||r).minScale??0,maxScale:r.maxScale??0}}get fieldsIndex(){return new _(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get graphicOrigin(){if(!this.layer)return null;switch(this.layer.type){case"tile":return new O(this.layer,this);case"map-image":return new F(this.layer,this)}}get id(){const e=this._get("id");return e??ae++}set id(e){this._get("id")!==e&&(!1!==this.layer?.capabilities?.exportMap?.supportsDynamicLayers?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}readIsTable(e,r){return"Table"===r.type}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map(e=>e.write({},i))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers?.forEach(r=>r.layer=e)}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;const t=r.fields?.find(e=>"esriFieldTypeOID"===e.type);return t?.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const{layerDefinition:t}=r;return 1-.01*(t?.transparency??t?.drawingInfo?.transparency??0)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}set orderBy(e){this._setAndNotifyLayer("orderBy",e)}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=h(this.parent.id):r.parentLayerId=-1}get queryTask(){if(!this.layer)return null;const{capabilities:e,fieldsIndex:r,layer:t,uniqueIdFields:i,url:o}=this,{spatialReference:s}=t,a="gdbVersion"in t?t.gdbVersion:void 0,l=has("featurelayer-pbf")&&e?.query.supportsFormatPBF;return new D({fieldsIndex:r,gdbVersion:a,pbfSupported:l,queryAttachmentsSupported:e?.operations?.supportsQueryAttachments??!1,relativeTimeBinWindow:e?.query?.relativeTimeBinWindow??0,sourceSpatialReference:s,uniqueIdFields:i,url:o})}set renderer(e){if(E(e,this.fieldsIndex),e)for(const r of e.symbols)if(K(r)){n.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new J({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}get sublayers(){return this._get("sublayers")}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return m(i.ofType(Y),e)}writeSublayers(e,r,t){this.sublayers?.length&&(r[t]=this.sublayers.map(e=>e.id).toArray().reverse())}readTitle(e,r){return r.layerDefinition?.name??r.name}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find(e=>e.name.toLowerCase()===t);e&&(t=e.name)}return t}readUniqueIdFields(e,r){return r.layerDefinition?.uniqueIdInfo?.OIDFieldContainsHashValue?r.layerDefinition.uniqueIdInfo.fields:null}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${y(t)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=w(this),r=new Y;return w(r).store=e.clone(le),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return G(this,e)}createQuery(){return new W({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.sublayers)return null;const e=(await import("../FeatureLayer.js")).default,{layer:r,url:t}=this;let i;if(t&&this.originIdOf("url")>2)i=new e({url:t});else{if(!r?.parsedUrl)throw new o("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const t=r.parsedUrl;i=new e({url:t.path}),t&&this.source&&("map-layer"===this.source.type?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return null!=r?.refreshInterval&&(i.refreshInterval=r.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=a(this.floorInfo)),this.originIdOf("labelingInfo")>2&&(i.labelingInfo=a(this.labelingInfo)),this.originIdOf("labelsVisible")>0&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>0&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>0&&(i.visible=this.visible),this.originIdOf("minScale")>0&&(i.minScale=this.minScale),this.originIdOf("maxScale")>0&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>0&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>0&&(i.popupTemplate=a(this.popupTemplate)),this.originIdOf("renderer")>2&&(i.renderer=a(this.renderer)),"data-layer"===this.source?.type&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>0&&(i.title=this.title),"map-image"===r?.type&&r.originIdOf("customParameters")>0&&(i.customParameters=r.customParameters),"tile"===r?.type&&r.originIdOf("customParameters")>0&&(i.customParameters=r.customParameters),i}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){return L(this.types,this.typeIdField,e)}getFieldDomain(e,r){const t=r?.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryAttachments(e,r){await this.load();let t=$.from(e);const i=this.capabilities;if(!i?.data?.supportsAttachment)throw new o("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:s,objectIds:a,globalIds:l,num:n,size:p,start:u,where:y}=t;if(!i?.operations?.supportsQueryAttachments){if(s?.length>0||l?.length>0||p?.length>0||n||u||y)throw new o("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(a?.length||l?.length||y))throw new o("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);return!i?.attachment?.supportsOrderByFields&&t.orderByFields?.length&&(t=t.clone(),t.orderByFields=null),this.queryTask.executeAttachmentQuery(t,r)}async queryFeatureCount(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryFeatureCount:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryFeatureCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(e,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(t?.features){const e=this.graphicOrigin;for(const r of t.features)r.sourceLayer=this,r.origin=e}return t}async queryObjectIds(e=this.createQuery(),r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryObjectIds:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryObjectIds:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeForIds(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeatures(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryRelatedFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new o("queryRelatedFeatures:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQuery(e,{...r,query:{...this.layer?.customParameters,token:t}})}async queryRelatedFeaturesCount(e,r){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new o("queryRelatedFeaturesCount:not-supported","this layer doesn't support queries.");if(!this.capabilities.queryRelated.supportsCount)throw new o("queryRelatedFeaturesCount:not-supported","this layer doesn't support query related counts.");if(!this.url)throw new o("queryRelatedFeaturesCount:not-supported","this layer has no url.");const t=this.layer?.apiKey;return await this.queryTask.executeRelationshipQueryForCount(e,{...r,query:{...this.layer?.customParameters,token:t}})}async reload(e){if("not-loaded"===this.loadStatus)return this.load(e).then(()=>{});const{layer:r,url:i}=this;if(!r&&!i)throw new o("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const s=r?await r.fetchSublayerInfo(this,e):(await t(i,{query:{f:"json"},...e})).data;s&&(this.sourceJSON={...this.sourceJSON,...s},this.read({layerDefinition:s},{origin:"service",layer:r,url:Q(i)}))}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=u(e,this.definitionExpression);null!=t&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce((e,r)=>(e[r]=this.originIdOf(r),e),{}),o=Object.keys(i).some(e=>i[e]>2);if(o){const e=r.drawingInfo={};if(i.renderer>2&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>2&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>2)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some(e=>!e.labelPlacement)&&n.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;null!=this.geometryType&&(r=N(this.labelingInfo,j.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=r.filter(e=>e.labelPlacement).map(e=>e.toJSON({origin:"service",layer:this.layer}))}else e.showLabels=!1;i.opacity>2&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return(this.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1)&&this.originIdOf("orderBy")>2&&(r.orderBy=this.orderBy?.map(e=>e.toJSON())??null),r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline?.color?e.color=e.outline.color:e.color=[0,0,0,0])})}_forEachSimpleMarkerSymbols(e,r){if(e){const t=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(const e of t)Z(e.symbol)&&r(e.symbol);"symbol"in e&&Z(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&Z(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,s;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",s="supportsModification";break;case"orderBy":o="supportsSublayerOrderBy",s="supportsModification"}const a=w(this).getDefaultOrigin();if("service"!==a){if(o&&!1===this.layer?.capabilities?.exportMap?.[o])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(s&&!1===this.capabilities?.exportMap[s])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${s}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==a&&i!==r&&t?.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach(e=>{e.parent=null,e.layer=null}),this.removeAllHandles()),e&&(e.forEach(e=>{e.parent=this,e.layer=this.layer}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this,e.layer=this.layer}),e.on("after-remove",({item:e})=>{e.parent=null,e.layer=null}),e.on("before-changes",e=>{(this.layer?.capabilities?.exportMap?.supportsSublayersChanges??1)||(n.getLogger(this).error(new o("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())})]))}_logLockedError(e,r){const{layer:t,declaredClass:i}=this;n.getLogger(i).error(new o("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${t?.id}'`,{reason:r,sublayer:this,layer:t}))}_getLayerDomain(e){return this.fieldsIndex.get(e)?.domain??null}static{this.test={isMapImageLayerOverridePolicy:e=>e===oe||e===ie||e===re,isTileImageLayerOverridePolicy:e=>e===te}}};e([d({type:H,json:{name:"attributeTableInfo",write:{overridePolicy:re},origins:{"web-scene":{write:!1}}}})],ne.prototype,"attributeTableTemplate",void 0),e([d({readOnly:!0})],ne.prototype,"capabilities",void 0),e([z("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],ne.prototype,"readCapabilities",null),e([d()],ne.prototype,"defaultPopupTemplate",null),e([d({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:re}}})],ne.prototype,"definitionExpression",null),e([d({readOnly:!0,type:q,json:{origins:{service:{read:{source:"layerDefinition.editFieldsInfo"}}}}})],ne.prototype,"editFieldsInfo",void 0),e([d({readOnly:!0})],ne.prototype,"effectiveScaleRange",null),e([z("service","maxScaleRange",["minScale","maxScale"])],ne.prototype,"readMaxScaleRange",null),e([d({type:[T],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],ne.prototype,"fields",void 0),e([d({readOnly:!0})],ne.prototype,"fieldsIndex",null),e([d({type:A,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:re},origins:{"web-scene":{read:!1,write:!1}}}})],ne.prototype,"floorInfo",null),e([d({type:S,json:{read:{source:"layerDefinition.extent"}}})],ne.prototype,"fullExtent",void 0),e([d({type:j.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:j.read}}}}})],ne.prototype,"geometryType",void 0),e([d({type:String})],ne.prototype,"globalIdField",void 0),e([z("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],ne.prototype,"readGlobalIdFieldFromService",null),e([d({readOnly:!0})],ne.prototype,"graphicOrigin",null),e([d({type:b,json:{write:{ignoreOrigin:!0}}})],ne.prototype,"id",null),e([d({readOnly:!0})],ne.prototype,"isTable",void 0),e([z("service","isTable",["type"])],ne.prototype,"readIsTable",null),e([d({value:null,type:[M],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:oe}}})],ne.prototype,"labelingInfo",null),e([X("labelingInfo")],ne.prototype,"writeLabelingInfo",null),e([d({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:ie}}})],ne.prototype,"labelsVisible",null),e([d({value:null})],ne.prototype,"layer",null),e([d({type:String,json:{write:{overridePolicy:te}}})],ne.prototype,"layerItemId",void 0),e([d({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:se}}})],ne.prototype,"legendEnabled",void 0),e([d({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],ne.prototype,"listMode",null),e([d({type:Number,value:0,json:{write:{overridePolicy:ie}}})],ne.prototype,"minScale",null),e([z("minScale",["minScale","layerDefinition.minScale"])],ne.prototype,"readMinScale",null),e([d({type:Number,value:0,json:{write:{overridePolicy:ie}}})],ne.prototype,"maxScale",null),e([z("maxScale",["maxScale","layerDefinition.maxScale"])],ne.prototype,"readMaxScale",null),e([d()],ne.prototype,"objectIdField",void 0),e([z("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],ne.prototype,"readObjectIdFieldFromService",null),e([d({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:ie}}})],ne.prototype,"opacity",null),e([z("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],ne.prototype,"readOpacity",null),e([X("opacity")],ne.prototype,"writeOpacity",null),e([d({value:null,type:[B],json:{name:"layerDefinition.orderBy",read:{reader:x},write:{overridePolicy:re},origins:{"web-scene":{read:!1,write:!1}}}})],ne.prototype,"orderBy",null),e([d({json:{type:b,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:ie}}})],ne.prototype,"parent",void 0),e([X("parent")],ne.prototype,"writeParent",null),e([d({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:se,writer(e,r,t){r[t]=!e}}}})],ne.prototype,"popupEnabled",void 0),e([d({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:se}}})],ne.prototype,"popupTemplate",void 0),e([d({readOnly:!0})],ne.prototype,"queryTask",null),e([d({type:[k],readOnly:!0,json:{origins:{service:{read:{source:"layerDefinition.relationships"}}}}})],ne.prototype,"relationships",void 0),e([d({types:V,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:oe},origins:{"web-scene":{types:C,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:oe}}}}})],ne.prototype,"renderer",null),e([d({types:{key:"type",base:null,typeMap:{"data-layer":U,"map-layer":J}},cast(e){if(e){if("mapLayerId"in e)return g(J,e);if("dataSource"in e)return g(U,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:ie}}})],ne.prototype,"source",null),e([d()],ne.prototype,"sourceJSON",void 0),e([d({type:v,json:{origins:{service:{read:{source:"layerDefinition.extent.spatialReference"}}}}})],ne.prototype,"spatialReference",void 0),e([d({value:null,json:{type:[b],write:{target:"subLayerIds",allowNull:!0,overridePolicy:ie}}})],ne.prototype,"sublayers",null),e([c("sublayers")],ne.prototype,"castSublayers",null),e([X("sublayers")],ne.prototype,"writeSublayers",null),e([d({type:String,json:{name:"name",write:{overridePolicy:se}}})],ne.prototype,"title",void 0),e([z("service","title",["name","layerDefinition.name"])],ne.prototype,"readTitle",null),e([d({type:String})],ne.prototype,"typeIdField",void 0),e([d({json:{read:!1},readOnly:!0,value:"sublayer"})],ne.prototype,"type",void 0),e([z("typeIdField",["layerDefinition.typeIdField"])],ne.prototype,"readTypeIdField",null),e([d({type:[P],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],ne.prototype,"types",void 0),e([d({type:[String],readOnly:!0})],ne.prototype,"uniqueIdFields",void 0),e([z("service","uniqueIdFields",["layerDefinition.uniqueIdInfo.OIDFieldContainsHashValue","layerDefinition.uniqueIdInfo.fields"])],ne.prototype,"readUniqueIdFields",null),e([d({type:String,json:{name:"layerUrl",write:{overridePolicy:te}}})],ne.prototype,"url",null),e([d({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:ie}}})],ne.prototype,"visible",null),e([X("visible")],ne.prototype,"writeVisible",null),ne=Y=e([f("esri.layers.support.Sublayer")],ne);export{ne as default};