@arcgis/core 6.0.0-next.27 → 6.0.0-next.29

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 (421) hide show
  1. package/Map.d.ts +6 -0
  2. package/analysis/AreaMeasurementAnalysis.d.ts +4 -2
  3. package/analysis/DirectLineMeasurementAnalysis.d.ts +8 -4
  4. package/arcgisGlobal.d.ts +0 -2
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/131185d26343a997495e.js +1 -0
  7. package/assets/esri/core/workers/chunks/144bad0c2415c345736a.js +1 -0
  8. package/assets/esri/core/workers/chunks/176d0a06ebff5a29dedf.js +1 -0
  9. package/assets/esri/core/workers/chunks/{b0ca81a07cff25df19d2.js → 176d75e76318bfc25a53.js} +1 -1
  10. package/assets/esri/core/workers/chunks/18776a130d96879a68b1.js +1 -0
  11. package/assets/esri/core/workers/chunks/{e35641a3a4da8cfbcf54.js → 189321d88026bd7e6d3e.js} +1 -1
  12. package/assets/esri/core/workers/chunks/18e7fa4d3e0b1a084cc6.js +1 -0
  13. package/assets/esri/core/workers/chunks/{1168bc5c9f0a7e1f63a2.js → 1989410a618865f02dec.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{2c0cb214fedb29487eef.js → 199a7f97916679e0257c.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1c406ab2bf99ac563316.js +1 -0
  16. package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +1 -0
  17. package/assets/esri/core/workers/chunks/{42d44c7d532df5ee70e9.js → 1deca3de77b1a9a07da4.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{45f826554499c38968c6.js → 1ee4df0fd61440cb5f02.js} +1 -1
  19. package/assets/esri/core/workers/chunks/22e73501e1435a896826.js +1 -0
  20. package/assets/esri/core/workers/chunks/25657f70c5f04a4ed978.js +1 -0
  21. package/assets/esri/core/workers/chunks/276a0b549acf048e8673.js +1 -0
  22. package/assets/esri/core/workers/chunks/{56e903ccef66cbe18f92.js → 2cd60fd062d954322c1f.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{ad96132bc89671e595f3.js → 2d3e0e4442dbc6ec6def.js} +1 -1
  24. package/assets/esri/core/workers/chunks/2de4296590bf9f9e9add.js +1 -0
  25. package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +1 -0
  26. package/assets/esri/core/workers/chunks/{0363d29fc665d169ebc4.js → 3105336a05f38a95ebea.js} +1 -1
  27. package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +1 -0
  28. package/assets/esri/core/workers/chunks/3aafdb905c697bc9b1ad.js +1 -0
  29. package/assets/esri/core/workers/chunks/40c2674dae73f0942751.js +1 -0
  30. package/assets/esri/core/workers/chunks/418addce122dbb8897b4.js +1 -0
  31. package/assets/esri/core/workers/chunks/4419732baf3459a80e6d.js +1 -0
  32. package/assets/esri/core/workers/chunks/4976f5567fc7f1b63d10.js +1 -0
  33. package/assets/esri/core/workers/chunks/4e17665dd9048c300d87.js +1 -0
  34. package/assets/esri/core/workers/chunks/5396b6e99a0546a25d19.js +1 -0
  35. package/assets/esri/core/workers/chunks/53c7510df09b71ab5646.js +1 -0
  36. package/assets/esri/core/workers/chunks/561c48cb4d49b150765b.js +1 -0
  37. package/assets/esri/core/workers/chunks/{d90a3bfd45b5ed4092e0.js → 590fe0f56bc4c33a50e7.js} +1 -1
  38. package/assets/esri/core/workers/chunks/5bb6c255bdc8aa9ba23e.js +1 -0
  39. package/assets/esri/core/workers/chunks/5f1cb79aec9c4a9b7ddc.js +29 -0
  40. package/assets/esri/core/workers/chunks/{23a4806b4cdf7cc32e4d.js → 5f787809b74eed7b9a91.js} +1 -1
  41. package/assets/esri/core/workers/chunks/636e9c4ac1f9ae98f9d1.js +1 -0
  42. package/assets/esri/core/workers/chunks/654f5441227579d2b6b4.js +1 -0
  43. package/assets/esri/core/workers/chunks/692f0093c444fcc752b5.js +1 -0
  44. package/assets/esri/core/workers/chunks/69627b2634da64dd885f.js +1 -0
  45. package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +1 -0
  46. package/assets/esri/core/workers/chunks/7030a4d0714a35995a58.js +1 -0
  47. package/assets/esri/core/workers/chunks/72d20d3957d612f86431.js +1 -0
  48. package/assets/esri/core/workers/chunks/7862abd24fb5c3b12e6b.js +1 -0
  49. package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +1 -0
  50. package/assets/esri/core/workers/chunks/{ab1660f5f8a5268c2fac.js → 84038dd85005fea413eb.js} +1 -1
  51. package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +1 -0
  52. package/assets/esri/core/workers/chunks/{8ac2098ecdc40ad41055.js → 8502274806ea52308822.js} +1 -1
  53. package/assets/esri/core/workers/chunks/865cebc5c982c040ab6f.js +1 -0
  54. package/assets/esri/core/workers/chunks/{76196c414e48834f7b92.js → 8f008eedb11685ee2048.js} +1 -1
  55. package/assets/esri/core/workers/chunks/90d797ab82d4a68ba32f.js +1 -0
  56. package/assets/esri/core/workers/chunks/9184c947cdefe06bf551.js +1 -0
  57. package/assets/esri/core/workers/chunks/9976eaa81085c0d17e14.js +1 -0
  58. package/assets/esri/core/workers/chunks/{177f353ce72133e2eeed.js → 9c2436464b7dfd666678.js} +1 -1
  59. package/assets/esri/core/workers/chunks/a125650edbed802e419a.js +1 -0
  60. package/assets/esri/core/workers/chunks/{23fd4de56de352f63e2d.js → a2196a49f89d57a0a1c7.js} +1 -1
  61. package/assets/esri/core/workers/chunks/ad21757d78e372fa2ed6.js +1 -0
  62. package/assets/esri/core/workers/chunks/b01688ccc29d33bfc82d.js +1 -0
  63. package/assets/esri/core/workers/chunks/b5eff28cf482d920b9ea.js +1 -0
  64. package/assets/esri/core/workers/chunks/{04ecf15524ff3838c01c.js → ba4520ddcb6a49988da6.js} +1 -1
  65. package/assets/esri/core/workers/chunks/be55771758e4bcef0976.js +1 -0
  66. package/assets/esri/core/workers/chunks/bead830a677690eeb6fb.js +1 -0
  67. package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +1 -0
  68. package/assets/esri/core/workers/chunks/c1cf3edce15f09648eb4.js +1 -0
  69. package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +1 -0
  70. package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +1 -0
  71. package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +1 -0
  72. package/assets/esri/core/workers/chunks/c9feffb9884cfed52c4b.js +1 -0
  73. package/assets/esri/core/workers/chunks/cc97e4fd0dacad970a23.js +1 -0
  74. package/assets/esri/core/workers/chunks/ce324dde6d7daea33638.js +1 -0
  75. package/assets/esri/core/workers/chunks/d1d6154b4af1c9cc497b.js +1 -0
  76. package/assets/esri/core/workers/chunks/d3c3fb079ad97970f834.js +1 -0
  77. package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +1 -0
  78. package/assets/esri/core/workers/chunks/dc2f93453dfa40f623ab.js +1 -0
  79. package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +1 -0
  80. package/assets/esri/core/workers/chunks/dd30b02c5978c1c5f511.js +1 -0
  81. package/assets/esri/core/workers/chunks/de3f140058aa0b907b65.js +1 -0
  82. package/assets/esri/core/workers/chunks/df375d1b0dab5ecbd1be.js +1 -0
  83. package/assets/esri/core/workers/chunks/{ef2c3febcceedc44b3ac.js → dfd4782b11d6fdca0492.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{48cc58890fddbcf69cef.js → e121d15b883184ee83e7.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{67e06d606c7fd2064adf.js → e2c6cd8dac01e129ccfe.js} +1 -1
  86. package/assets/esri/core/workers/chunks/e3b212f8af448ec29eef.js +1 -0
  87. package/assets/esri/core/workers/chunks/e4042e43f0081fe49f7b.js +1 -0
  88. package/assets/esri/core/workers/chunks/e480e7d5f40049a2053b.js +1 -0
  89. package/assets/esri/core/workers/chunks/eaab787a5f2445be5e5a.js +1 -0
  90. package/assets/esri/core/workers/chunks/edd36a1fc80b1d29907e.js +1 -0
  91. package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +1 -0
  92. package/assets/esri/core/workers/chunks/f07fb9b3fa30d7ee1681.js +1 -0
  93. package/assets/esri/core/workers/chunks/f09bc86cd52224febfcb.js +1 -0
  94. package/assets/esri/core/workers/chunks/{037c67ef5c4398d5954d.js → f2dab9fcd90ce38ae3d1.js} +1 -1
  95. package/assets/esri/core/workers/chunks/f39c700f3db7db52b522.js +1 -0
  96. package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +1 -0
  97. package/assets/esri/core/workers/chunks/f3dc0bc0e00635855a7a.js +1 -0
  98. package/assets/esri/core/workers/chunks/f45064066e1ab041a0b2.js +1 -0
  99. package/assets/esri/core/workers/chunks/f7398cfd8bbd041bd635.js +1 -0
  100. package/assets/esri/core/workers/chunks/f9dc38761b314d33890f.js +1 -0
  101. package/assets/esri/core/workers/chunks/fe6dcb21570395e46ce8.js +1 -0
  102. package/assets/esri/core/workers/chunks/{00580a68835aac653038.js → fefdd10bdd5a4c8d8ed0.js} +45 -48
  103. package/assets/esri/core/workers/chunks/ffe49d9e7df081bef4a5.js +1 -0
  104. package/assets/esri/themes/base/_core.scss +0 -2
  105. package/assets/esri/themes/dark/main.css +1 -1
  106. package/assets/esri/themes/light/main.css +1 -1
  107. package/assets/esri/themes/light/view.css +1 -1
  108. package/chunks/BlendLayers.glsl.js +1 -1
  109. package/chunks/Component.glsl.js +51 -54
  110. package/chunks/EmissionComposite.glsl.js +1 -1
  111. package/chunks/Fog.glsl.js +1 -1
  112. package/chunks/GaussianSplat.glsl.js +65 -21
  113. package/chunks/GaussianSplatDepth.glsl.js +53 -4
  114. package/chunks/GaussianSplatShadow.glsl.js +83 -19
  115. package/chunks/GlobalIllumination.glsl.js +2 -17
  116. package/chunks/LineMarker.glsl.js +32 -31
  117. package/chunks/OITAddEmission.glsl.js +1 -1
  118. package/chunks/RasterColorizer.glsl.js +1 -1
  119. package/chunks/RibbonLine.glsl.js +34 -34
  120. package/chunks/Terrain.glsl.js +3 -4
  121. package/chunks/Water.glsl.js +22 -23
  122. package/config.d.ts +12 -9
  123. package/config.js +1 -1
  124. package/form/FormTemplate.d.ts +1 -1
  125. package/form/elements/AttachmentElement.d.ts +2 -0
  126. package/form/elements/FieldElement.d.ts +2 -2
  127. package/form/elements/FieldElement.js +1 -1
  128. package/form/elements/RelationshipElement.d.ts +1 -1
  129. package/form/elements/TextElement.d.ts +2 -2
  130. package/form/elements/UtilityNetworkAssociationsElement.d.ts +1 -1
  131. package/form/elements/inputs/DynamicChoiceInput.d.ts +2 -2
  132. package/form/elements/inputs/inputUtils.js +1 -1
  133. package/form/elements/inputs/types.d.ts +19 -0
  134. package/form/elements/inputs.d.ts +3 -2
  135. package/form/elements/inputs.js +1 -1
  136. package/geometry/operators/containsOperator.d.ts +1 -1
  137. package/geometry/operators/densifyOperator.d.ts +1 -1
  138. package/geometry/operators/differenceOperator.d.ts +6 -4
  139. package/geometry/operators/distanceOperator.d.ts +1 -1
  140. package/geometry/operators/geodesicProximityOperator.d.ts +8 -8
  141. package/geometry/operators/graphicBufferOperator.d.ts +6 -6
  142. package/geometry/operators/integrateOperator.d.ts +2 -2
  143. package/geometry/operators/intersectsOperator.d.ts +3 -3
  144. package/geometry/operators/linesToPolygonsOperator.d.ts +2 -2
  145. package/geometry/operators/locateBetweenOperator.d.ts +2 -2
  146. package/geometry/operators/minimumBoundingCircleOperator.d.ts +1 -1
  147. package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
  148. package/geometry/operators/polygonSlicerOperator.d.ts +2 -2
  149. package/geometry/operators/projectOperator.d.ts +2 -2
  150. package/geometry/operators/proximityOperator.d.ts +15 -15
  151. package/geometry/operators/shapePreservingProjectOperator.d.ts +2 -2
  152. package/geometry/operators/simplifyOperator.d.ts +2 -2
  153. package/geometry/operators/support/GeographicTransformationStep.d.ts +3 -3
  154. package/geometry/operators/support/Transformation.d.ts +8 -8
  155. package/geometry/operators/support/geographicTransformationUtils.d.ts +3 -3
  156. package/geometry/operators/symmetricDifferenceOperator.d.ts +2 -2
  157. package/geometry/operators/withinOperator.d.ts +3 -3
  158. package/interfaces.d.ts +0 -14
  159. package/kernel.js +1 -1
  160. package/layers/GeospatialPDFLayer.d.ts +2 -2
  161. package/layers/ParquetLayer.d.ts +1 -1
  162. package/layers/VideoLayer.d.ts +5 -5
  163. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  164. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  165. package/layers/orientedImagery/transformations/rotationUtils.js +2 -0
  166. package/layers/orientedImagery/transformations/utils.js +1 -1
  167. package/layers/save/parquetLayerUtils.js +1 -1
  168. package/layers/support/vectorTileLayerLoader.js +1 -1
  169. package/package.json +2 -2
  170. package/popup/FeaturesModel.js +1 -1
  171. package/popup/support/featureUtils.js +1 -1
  172. package/rest/featureService/FeatureService.d.ts +0 -5
  173. package/rest/networks/support/TraceLocation.d.ts +2 -1
  174. package/rest/networks/support/TraceResult.d.ts +0 -4
  175. package/rest/support/OutDistance.d.ts +0 -1
  176. package/smartMapping/statistics/histogramForTimeSeries.js +1 -1
  177. package/smartMapping/statistics/summaryStatisticsForTimeSeries.js +1 -1
  178. package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
  179. package/support/BasemapStyle.d.ts +2 -2
  180. package/symbols/cim/types.d.ts +7 -9
  181. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  182. package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSource.js +1 -1
  183. package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
  184. package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +2 -0
  185. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  186. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  187. package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
  188. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  189. package/views/2d/layers/features/FeatureContainer.js +1 -1
  190. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  191. package/views/2d/layers/support/visualVariableSimpleUtils.js +1 -1
  192. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  193. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  194. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  195. package/views/3d/analysis/support/projectionUtils.js +1 -1
  196. package/views/3d/environment/SunLighting.d.ts +15 -2
  197. package/views/3d/environment/VirtualLighting.d.ts +15 -2
  198. package/views/3d/input/SceneInputManager.js +1 -1
  199. package/views/3d/input/handlers/ground/GroundMouseWheelMove.js +2 -0
  200. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  201. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  202. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  203. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  204. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  205. package/views/3d/navigation/Navigation3D.js +1 -1
  206. package/views/3d/state/controllers/GroundMouseWheelController.js +2 -0
  207. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  208. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  209. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  210. package/views/3d/support/ResourceController.js +1 -1
  211. package/views/3d/terrain/BlendLayers.glsl.js +1 -1
  212. package/views/3d/terrain/RasterColorizer.glsl.js +1 -1
  213. package/views/3d/terrain/TerrainRenderer.js +1 -1
  214. package/views/3d/terrain/TerrainSurface.js +1 -1
  215. package/views/3d/terrain/TileAgent.js +1 -1
  216. package/views/3d/terrain/TileCompositor.js +1 -1
  217. package/views/3d/terrain/TileRenderer.js +1 -1
  218. package/views/3d/webgl-engine/Stage.js +1 -1
  219. package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
  220. package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +23 -26
  221. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +18 -21
  222. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTangent.glsl.js +7 -8
  223. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +5 -5
  224. package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +10 -12
  225. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +22 -25
  226. package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +3 -5
  227. package/views/3d/webgl-engine/core/shaderLibrary/shading/forwardLocalUp.glsl.js +6 -0
  228. package/views/3d/webgl-engine/core/shaderLibrary/shading/getLocalUp.glsl.js +4 -0
  229. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +1 -1
  230. package/views/3d/webgl-engine/core/shaderLibrary/terrain/{TileBackground.glsl.js → blendLayers.glsl.js} +10 -11
  231. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
  232. package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
  233. package/views/3d/webgl-engine/effects/RenderPluginContext.js +2 -0
  234. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  235. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  236. package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +3 -3
  237. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  238. package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +1 -1
  239. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  240. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  241. package/views/3d/webgl-engine/lib/edgeRendering/EdgeUtil.glsl.js +30 -35
  242. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  243. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  244. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +1 -1
  245. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  246. package/views/3d/webgl-engine/shaders/GaussianSplatDepth.glsl.js +1 -1
  247. package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +70 -108
  248. package/views/3d/webgl-engine/shaders/GaussianSplatShadow.glsl.js +1 -1
  249. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  250. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  251. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  252. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  253. package/views/VideoView.d.ts +10 -0
  254. package/views/VideoView.js +1 -1
  255. package/views/draw/DrawOperation.js +1 -1
  256. package/views/draw/DrawScreenTool.js +1 -1
  257. package/views/input/types.d.ts +2 -4
  258. package/views/interactive/options/LabelOptions.d.ts +5 -5
  259. package/views/interactive/options/SnappingOptions.d.ts +2 -2
  260. package/views/layers/LayerView.d.ts +10 -2
  261. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +2 -3
  262. package/widgets/Editor/EditorViewModel.d.ts +10 -12
  263. package/widgets/Editor/VisibleElements.d.ts +4 -0
  264. package/widgets/Editor.d.ts +2 -0
  265. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  266. package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
  267. package/widgets/FeatureTable.js +1 -1
  268. package/widgets/Features/FeaturesViewModel.js +1 -1
  269. package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
  270. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  271. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  272. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  273. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  274. package/widgets/OrientedImageryViewer/imageMeasurementWorkerUtils.js +2 -0
  275. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  276. package/widgets/OrientedImageryViewer/support/NonPanoramicMedia.js +1 -1
  277. package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
  278. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  279. package/widgets/PanoramicViewer/utils.js +1 -1
  280. package/widgets/Search/LayerSearchSource.d.ts +1 -1
  281. package/widgets/Sketch/VisibleElements.d.ts +4 -0
  282. package/widgets/Sketch.d.ts +2 -0
  283. package/widgets/support/iconUtils.js +1 -1
  284. package/assets/esri/core/workers/chunks/010f57ec7fdbedf78d02.js +0 -1
  285. package/assets/esri/core/workers/chunks/0487e1d7a7cecf7c1c25.js +0 -1
  286. package/assets/esri/core/workers/chunks/09300e74e5b014ce6269.js +0 -1
  287. package/assets/esri/core/workers/chunks/0bd04bcd4b2710838d48.js +0 -1
  288. package/assets/esri/core/workers/chunks/0d9c4c6c571ce26d356b.js +0 -1
  289. package/assets/esri/core/workers/chunks/112ed86f812e4400a7e0.js +0 -1
  290. package/assets/esri/core/workers/chunks/151e5799ede763a03ee2.js +0 -1
  291. package/assets/esri/core/workers/chunks/173f89c55a5c79ff065b.js +0 -1
  292. package/assets/esri/core/workers/chunks/2447d2e2a4a3ab8fcf94.js +0 -1
  293. package/assets/esri/core/workers/chunks/2a36fe3f3f257a779a1b.js +0 -1
  294. package/assets/esri/core/workers/chunks/2a97268000c6d03ef720.js +0 -1
  295. package/assets/esri/core/workers/chunks/2cf8172be83b10b11bdc.js +0 -1
  296. package/assets/esri/core/workers/chunks/2df37a9a95ceebb87a5f.js +0 -1
  297. package/assets/esri/core/workers/chunks/2e00c155e447e4930442.js +0 -1
  298. package/assets/esri/core/workers/chunks/2f91fd61019d2a37476d.js +0 -1
  299. package/assets/esri/core/workers/chunks/30af63b3b750142faadb.js +0 -1
  300. package/assets/esri/core/workers/chunks/3a47fc97c400fca2c736.js +0 -1
  301. package/assets/esri/core/workers/chunks/3cd04d23b73beaf79650.js +0 -1
  302. package/assets/esri/core/workers/chunks/426b4eb500fdfe9df325.js +0 -1
  303. package/assets/esri/core/workers/chunks/45367aa8e5c5d574de94.js +0 -1
  304. package/assets/esri/core/workers/chunks/47c97640ec525676918b.js +0 -1
  305. package/assets/esri/core/workers/chunks/47d074136a7f8e551a9a.js +0 -1
  306. package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +0 -1
  307. package/assets/esri/core/workers/chunks/4cb751dc8d00bdaeb04c.js +0 -1
  308. package/assets/esri/core/workers/chunks/518ab22f80c3300bcfff.js +0 -1
  309. package/assets/esri/core/workers/chunks/53ff68d4f9e365fc15cd.js +0 -1
  310. package/assets/esri/core/workers/chunks/58609bf94f72bc4f1952.js +0 -1
  311. package/assets/esri/core/workers/chunks/586a929bc037e23857af.js +0 -1
  312. package/assets/esri/core/workers/chunks/5c7780f804d789cb37f5.js +0 -1
  313. package/assets/esri/core/workers/chunks/5d76f4d97beee494bbbf.js +0 -1
  314. package/assets/esri/core/workers/chunks/603fdbbe9534c614928f.js +0 -1
  315. package/assets/esri/core/workers/chunks/611e3cdf67283c11576f.js +0 -1
  316. package/assets/esri/core/workers/chunks/6431480ba0fa8c8d487f.js +0 -1
  317. package/assets/esri/core/workers/chunks/652faf4359ac072c5dde.js +0 -1
  318. package/assets/esri/core/workers/chunks/65c98f3449044fa4fd79.js +0 -1
  319. package/assets/esri/core/workers/chunks/6b9961261241fdce0e94.js +0 -1
  320. package/assets/esri/core/workers/chunks/6dfe96b056bec30068df.js +0 -1
  321. package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +0 -1
  322. package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +0 -1
  323. package/assets/esri/core/workers/chunks/7159d9c36869cd82599e.js +0 -29
  324. package/assets/esri/core/workers/chunks/7393f63043a1da3d05a6.js +0 -1
  325. package/assets/esri/core/workers/chunks/7449568eb2305bf2d650.js +0 -1
  326. package/assets/esri/core/workers/chunks/75d551a449bba61ce238.js +0 -1
  327. package/assets/esri/core/workers/chunks/7748c2886d0122b40eeb.js +0 -1
  328. package/assets/esri/core/workers/chunks/78643f116677950ea29a.js +0 -1
  329. package/assets/esri/core/workers/chunks/78fbe330f16bdbdb886e.js +0 -1
  330. package/assets/esri/core/workers/chunks/7e0f04a5038e2a4f6e4b.js +0 -1
  331. package/assets/esri/core/workers/chunks/7f16ae01ccd9b6114d1c.js +0 -1
  332. package/assets/esri/core/workers/chunks/90153b5230b3a4985c14.js +0 -1
  333. package/assets/esri/core/workers/chunks/9189dfe19a2a2ccd5173.js +0 -1
  334. package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +0 -1
  335. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +0 -1
  336. package/assets/esri/core/workers/chunks/99f51d5d9da6e9bfc430.js +0 -1
  337. package/assets/esri/core/workers/chunks/9aebe876b1a2fb075f9c.js +0 -1
  338. package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +0 -1
  339. package/assets/esri/core/workers/chunks/9dd1fc56eb1ea6eb705e.js +0 -1
  340. package/assets/esri/core/workers/chunks/9dd48e75b4e8d9811d81.js +0 -1
  341. package/assets/esri/core/workers/chunks/a163c6005aba3378edaa.js +0 -1
  342. package/assets/esri/core/workers/chunks/a8286febe371dc186aaa.js +0 -1
  343. package/assets/esri/core/workers/chunks/acb265a22be5e12f38e5.js +0 -1
  344. package/assets/esri/core/workers/chunks/b12acf1f694f82e00df9.js +0 -1
  345. package/assets/esri/core/workers/chunks/b83cef2d3f528726d492.js +0 -1
  346. package/assets/esri/core/workers/chunks/b9596d862da1ec342cd3.js +0 -1
  347. package/assets/esri/core/workers/chunks/bc1fcc9c897461e68e29.js +0 -1
  348. package/assets/esri/core/workers/chunks/bdc221d94300c225665a.js +0 -1
  349. package/assets/esri/core/workers/chunks/be97a629e2ae4d13ceb3.js +0 -1
  350. package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +0 -1
  351. package/assets/esri/core/workers/chunks/c2318c014e97ba519be8.js +0 -1
  352. package/assets/esri/core/workers/chunks/c29091fe157564cffcf7.js +0 -1
  353. package/assets/esri/core/workers/chunks/c62237c344e341619341.js +0 -1
  354. package/assets/esri/core/workers/chunks/c8eae00b0ec87d8b2ff3.js +0 -1
  355. package/assets/esri/core/workers/chunks/cdb5c26fed7d9a97db49.js +0 -1
  356. package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +0 -1
  357. package/assets/esri/core/workers/chunks/cea0db3ee326f60610eb.js +0 -1
  358. package/assets/esri/core/workers/chunks/d7f2f1708d2a2668676c.js +0 -1
  359. package/assets/esri/core/workers/chunks/daf9b691817e83a11f3c.js +0 -1
  360. package/assets/esri/core/workers/chunks/db41490bd39d863305bf.js +0 -1
  361. package/assets/esri/core/workers/chunks/ddc95cdac6c06fc4794c.js +0 -1
  362. package/assets/esri/core/workers/chunks/df26ec0b508cf4716e0a.js +0 -1
  363. package/assets/esri/core/workers/chunks/e11159e3dc3353b27c57.js +0 -1
  364. package/assets/esri/core/workers/chunks/e4a57a0a9629faafd6c6.js +0 -1
  365. package/assets/esri/core/workers/chunks/ebc1a2ef3aed8aa29424.js +0 -1
  366. package/assets/esri/core/workers/chunks/ec1c4d66142b6efb0e8b.js +0 -1
  367. package/assets/esri/core/workers/chunks/ef12fa3574d4cbf8b084.js +0 -1
  368. package/assets/esri/core/workers/chunks/f2d56f5c15d5977e1d19.js +0 -1
  369. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +0 -1
  370. package/assets/esri/core/workers/chunks/f905f1a1aa4c123cbe83.js +0 -1
  371. package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +0 -1
  372. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +0 -129
  373. package/assets/esri/widgets/VideoPlayer/t9n/messages.ar.json +0 -1
  374. package/assets/esri/widgets/VideoPlayer/t9n/messages.bg.json +0 -1
  375. package/assets/esri/widgets/VideoPlayer/t9n/messages.bs.json +0 -1
  376. package/assets/esri/widgets/VideoPlayer/t9n/messages.ca.json +0 -1
  377. package/assets/esri/widgets/VideoPlayer/t9n/messages.cs.json +0 -1
  378. package/assets/esri/widgets/VideoPlayer/t9n/messages.da.json +0 -1
  379. package/assets/esri/widgets/VideoPlayer/t9n/messages.de.json +0 -1
  380. package/assets/esri/widgets/VideoPlayer/t9n/messages.el.json +0 -1
  381. package/assets/esri/widgets/VideoPlayer/t9n/messages.en.json +0 -1
  382. package/assets/esri/widgets/VideoPlayer/t9n/messages.es.json +0 -1
  383. package/assets/esri/widgets/VideoPlayer/t9n/messages.et.json +0 -1
  384. package/assets/esri/widgets/VideoPlayer/t9n/messages.fi.json +0 -1
  385. package/assets/esri/widgets/VideoPlayer/t9n/messages.fr.json +0 -1
  386. package/assets/esri/widgets/VideoPlayer/t9n/messages.he.json +0 -1
  387. package/assets/esri/widgets/VideoPlayer/t9n/messages.hr.json +0 -1
  388. package/assets/esri/widgets/VideoPlayer/t9n/messages.hu.json +0 -1
  389. package/assets/esri/widgets/VideoPlayer/t9n/messages.id.json +0 -1
  390. package/assets/esri/widgets/VideoPlayer/t9n/messages.it.json +0 -1
  391. package/assets/esri/widgets/VideoPlayer/t9n/messages.ja.json +0 -1
  392. package/assets/esri/widgets/VideoPlayer/t9n/messages.ko.json +0 -1
  393. package/assets/esri/widgets/VideoPlayer/t9n/messages.lt.json +0 -1
  394. package/assets/esri/widgets/VideoPlayer/t9n/messages.lv.json +0 -1
  395. package/assets/esri/widgets/VideoPlayer/t9n/messages.nl.json +0 -1
  396. package/assets/esri/widgets/VideoPlayer/t9n/messages.no.json +0 -1
  397. package/assets/esri/widgets/VideoPlayer/t9n/messages.pl.json +0 -1
  398. package/assets/esri/widgets/VideoPlayer/t9n/messages.pt-BR.json +0 -1
  399. package/assets/esri/widgets/VideoPlayer/t9n/messages.pt-PT.json +0 -1
  400. package/assets/esri/widgets/VideoPlayer/t9n/messages.ro.json +0 -1
  401. package/assets/esri/widgets/VideoPlayer/t9n/messages.ru.json +0 -1
  402. package/assets/esri/widgets/VideoPlayer/t9n/messages.sk.json +0 -1
  403. package/assets/esri/widgets/VideoPlayer/t9n/messages.sl.json +0 -1
  404. package/assets/esri/widgets/VideoPlayer/t9n/messages.sr.json +0 -1
  405. package/assets/esri/widgets/VideoPlayer/t9n/messages.sv.json +0 -1
  406. package/assets/esri/widgets/VideoPlayer/t9n/messages.th.json +0 -1
  407. package/assets/esri/widgets/VideoPlayer/t9n/messages.tr.json +0 -1
  408. package/assets/esri/widgets/VideoPlayer/t9n/messages.uk.json +0 -1
  409. package/assets/esri/widgets/VideoPlayer/t9n/messages.vi.json +0 -1
  410. package/assets/esri/widgets/VideoPlayer/t9n/messages.zh-CN.json +0 -1
  411. package/assets/esri/widgets/VideoPlayer/t9n/messages.zh-HK.json +0 -1
  412. package/assets/esri/widgets/VideoPlayer/t9n/messages.zh-TW.json +0 -1
  413. package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +0 -232
  414. package/widgets/VideoPlayer/VideoPlayerViewModel.js +0 -2
  415. package/widgets/VideoPlayer/components/MetadataSection.js +0 -2
  416. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +0 -2
  417. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +0 -2
  418. package/widgets/VideoPlayer/components/SettingsButton.js +0 -2
  419. package/widgets/VideoPlayer/css.js +0 -2
  420. package/widgets/VideoPlayer.d.ts +0 -119
  421. package/widgets/VideoPlayer.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{generateUID as p}from"../../../../core/uid.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as g}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as _,equals as v,clone as y,expand as b,toExtent as x,width as S,height as C}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as w,DehydratedFeatureClass as T,hasVertices as E,computeAABR as ee}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as te,transferGeometryKey as ne,identicalTransferGeometry as re,completeDehydratedFeatureFromTransfer as ie}from"../../../../layers/graphics/transferFeatures.js";import D from"../../../../rest/support/QuantizationParameters.js";import O from"../../../../rest/support/Query.js";import{isGraphic as k}from"../../../../support/graphicInstanceUtils.js";import{FeatureMemory as A}from"./FeatureMemory.js";import{MultiFeatureReference as j,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new A(te),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?j:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchAttributes(){this._featureTiles.forEach(e=>{let t=e.isFetched||e.needsAttributesFetching;this._cancelFetchTile(e),e.features?.length&&t?e.requestAttributes():this._resetFetchTile(e)}),this.context.memoryCache?.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}hasMissingAttributes(e){return this._featureTiles.values().some(t=>t?.missingAttributes?.values().some(t=>e.some(e=>t.has(e))))}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(w(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?w(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(w(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=ne(e.geometry,n,t),a=this._memory.findGeometry(i,t=>re(e.geometry,n,t));a?e.geometry=a:ie(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=se;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>oe)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),v(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=w(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution;this._featureTiles.forEach(n=>{if(n.displayingFeatures!=null&&e!==n&&L(e.descriptor.lij,n.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&n.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=y(e.descriptor.extent),b(e.extentIncludingBorrowedFeatures,n.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let r of n.displayingFeatures){e.displayingFeatures.push(r),this._memory.ref(r);let n=this._displayingFeatureReferences.get(w(r,this._objectIdField));n.ref(this._memory,n.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(8):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){if(e.fetchFailed=!1,e.needsAttributesFetching&&e.features?.length)return this._fetchTileAttributes(e,t);let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,8;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>O.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=O.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?9:8,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchTileAttributes(e,t){let n=e.features,r=new Set(this.context.requiredFields),i=new Set;for(let t of e.missingAttributes?.values()??[])i=i.union(t.intersection(r));let a=this.context.availableFields.filter(t=>!e.availableFields?.has(t)||i.has(t));if(!a.length)return e.attributeRefetchCompletionStatus;a.includes(this._objectIdField)||a.push(this._objectIdField);let s=new Set(n.map(e=>w(e,this._objectIdField))),c=new Map,l=Math.ceil(n.length/(1-e.emptyFeatureRatio)),u=new Set(e.availableFields),d=e.missingAttributes==null?void 0:new Map(Array.from(e.missingAttributes,([e,t])=>[e,new Set(t)])),f=this._queryFeaturePages(e,()=>l,t,{returnGeometry:!1,outFields:a});for await(let e of f){for(let t of e.features){let e=w(t,this._objectIdField);if(s.delete(e)){c.set(e,t);let n=d?.get(e);for(let e of a)Object.hasOwn(t.attributes,e)&&n?.delete(e);n?.size===0&&d?.delete(e)}}for(let{name:t}of e.fields??[])u.add(t);if(d=J(d,e.missingAttributes?.filter(({objectId:e})=>c.has(e))),!s.size)break}return s.size?(e.requestRefetch(),e.startFetch(),this._fetchTile(e,t)):(await this._frameTask.schedule(()=>{o(t);let r=n.map(e=>{let t={...e.attributes,...c.get(w(e,this._objectIdField)).attributes};if(k(e)){let n=e.cloneShallow();return n.attributes=t,n}let n=new T(p(),e.geometry,t);return n.objectId=w(e,this._objectIdField),n.centroid=e.centroid,n}),i=Math.round(n.length*e.emptyFeatureRatio/(1-e.emptyFeatureRatio));e.setFeatures(r,i,u,d),this._setDirty()},t),o(t),e.attributeRefetchCompletionStatus)}async _fetchPagedTile(e,t){let n=0,r,i=this._maximumFeaturesForTile(e),a=null,s,c=this._queryFeaturePages(e,()=>(e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${i} features`,i),t),l=!1;for await(let u of c){let{features:c,fields:d,missingAttributes:f}=u;if(l=!!u.exceededTransferLimit,await this._frameTask.schedule(()=>{n+=this._removeEmptyFeatures(c,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!l,r=r?.concat(c)??c,a=q(a,d),s=J(s,f),e.setFeatures(r,n,a,s),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),i=this._maximumFeaturesForTile(e)-(r?.length??0),i<=0)break}return l?8:9}async*_queryFeaturePages(e,t,n,r={}){let i=this._createQuery(e,r.returnGeometry);i.returnGeometry||(i.returnCentroid=!1),r.outFields&&(i.outFields=r.outFields);let a=this._getMaxRecordCount(e),s=0;for(;;){o(n);let r=this._setPagingParameters(i,s,t(),a),c=await this._queryFeatures(i,e.fetchingResolution,n);o(n);let l=c.features.length>0;if(yield c,!r||!c.exceededTransferLimit||!l)return;s+=i.num}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e,t){let n=this.context.createQuery();if(t!==void 0&&(n.returnGeometry=t),n.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(n.geometry=x(e.descriptor.extent,this.context.tilingScheme.spatialReference)),n.returnGeometry&&this._setResolutionParams(n,e),n.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(n.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),n.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(n.where=f(n.where,this.context.effectiveDisplayFilter.where));return n}_setPagingParameters(e,t,n,r){let i=n>0&&this.context.capabilities.supportsMaxRecordCountFactor;return i&&(e.maxRecordCountFactor=Math.ceil(n/r)),this.context.capabilities.supportsPagination?(e.start=t,e.num=i?Math.min(e.maxRecordCountFactor*r,n):Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new D({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+g());n(e,({geometry:e})=>!e||!E(e)?!1:(ee(e,Q),S(Q)>r||C(Q)>r))}else n(e,({geometry:e})=>E(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let s=!1;t.then(t=>{o(n.signal),e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(8)),a(t)?s=!0:i(t)}).then(()=>{s||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=w(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=w(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ae,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([m({constructOnly:!0})],B.prototype,`features`,void 0),e([m({constructOnly:!0})],B.prototype,`context`,void 0),e([m()],B.prototype,`tileDescriptors`,void 0),e([m({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([m({value:1})],B.prototype,`memoryFactor`,null),e([m({value:1})],B.prototype,`lodFactor`,null),e([m()],B.prototype,`useTileCount`,null),e([m({readOnly:!0})],B.prototype,`updating`,null),e([m({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([m({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([m({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([m({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([m()],B.prototype,`usedMemory`,null),e([m()],B.prototype,`usedMemoryPerFeature`,null),e([m({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([m({readOnly:!0})],B.prototype,`totalVertices`,null),e([m({readOnly:!0})],B.prototype,`totalFeatures`,null),e([m({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([m({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([m()],B.prototype,`filterExtent`,null),e([m()],B.prototype,`_dirty`,void 0),e([m()],B.prototype,`_suspended`,void 0),e([m()],B.prototype,`_pendingEdits`,void 0),e([m()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([m()],B.prototype,`_paused`,null),e([m()],B.prototype,`snappingComplexityExceeded`,void 0),e([m()],B.prototype,`_isFetching`,void 0),B=e([h(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=_(),Z=_(),Q=_(),$=6e5,ae=200,oe=.95,se=10;export{B as FeatureTileFetcher3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as n}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import s from"../../../../core/ReactiveMap.js";import{on as c,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as u}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as f}from"../../../../core/sql.js";import{generateUID as p}from"../../../../core/uid.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{getEpsilon as g}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as _,equals as v,clone as y,expand as b,toExtent as x,width as S,height as C}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as w,DehydratedFeatureClass as T,hasVertices as E,computeAABR as ee}from"../../../../layers/graphics/dehydratedFeatures.js";import{geometryKey as te,transferGeometryKey as ne,identicalTransferGeometry as re,completeDehydratedFeatureFromTransfer as ie}from"../../../../layers/graphics/transferFeatures.js";import D from"../../../../rest/support/QuantizationParameters.js";import O from"../../../../rest/support/Query.js";import{isGraphic as k}from"../../../../support/graphicInstanceUtils.js";import{FeatureMemory as A}from"./FeatureMemory.js";import{MultiFeatureReference as j,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as N,FeatureTile as P}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as F,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as L}from"../../terrain/tileUtils.js";import{ImmediateTask as R,TaskPriority as z}from"../../../support/Scheduler.js";let B=class extends t{set maximumNumberOfFeatures(e){e||=1/0;let t=this._get(`maximumNumberOfFeatures`);e===t||e<1||(this._set(`maximumNumberOfFeatures`,e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set(`memoryFactor`,e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set(`lodFactor`,e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&this.context.query.queryFeatureCount!=null}set useTileCount(e){this._useTileCount=e,this.notifyChange(`useTileCount`)}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get usedMemory(){return this._memory.usedMemory}get usedMemoryPerFeature(){return this._memory.usedMemoryPerFeature}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(let e of this._featureTiles.values())if(!this.hasFullGeometries&&e.emptyFeatureRatio!==0||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){return!this._supportsResolution||this.tileDescriptors?.some(V)||!this.context.capabilities.supportsQuantization&&this.context.geometryType!==`polyline`}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference)){r.getLogger(this).error(`#filterExtent=`,`extent needs to be in the same spatial reference as the tiling scheme`);return}let t=this._get(`filterExtent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`filterExtent`,n),this._reclip(n,t)}_updateTileZQuantization(e){if(this.context.viewingMode===1){let t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:[],removes:[]},adds:[],removes:[]},this._featureTiles=new s,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._memory=new A(te),this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this.snappingComplexityExceeded=!0,this._isFetching=!1;let t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??R,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?j:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([c(()=>this.tileDescriptors,`change`,()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetchAttributes(){this._featureTiles.forEach(e=>{let t=e.isFetched||e.needsAttributesFetching;this._cancelFetchTile(e),e.features?.length&&t?e.requestAttributes():this._resetFetchTile(e)}),this.context.memoryCache?.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){let e=this._featureTiles.get(F);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(let t of this._featureTiles.values()){let n=t.missingAttributes?.get(e);if(n!=null)return n}}hasMissingAttributes(e){return this._featureTiles.values().some(t=>t?.missingAttributes?.values().some(t=>e.some(e=>t.has(e))))}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(n=>{t.availableFields?.has(n)||e.delete(n)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());let t=this._pendingEdits;t.count++;let n=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e&&(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e))).then(e=>(--t.count===0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=n,this._updated(),n}_applyEditsDeleteFeatures(e){if(e.length===0)return;let t=this.context.globalIdField,n=t&&this.availableFields.has(t),i=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:o})=>{(!e||e<0)&&t&&o&&(n||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(o,a,t)),e!=null&&e>=0&&i.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;let t=e.features.filter(e=>!i.has(w(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,n){if(e==null)return null;let r=this.features.find(t=>t.attributes?.[n]===e);return r?w(r,t):null}async _applyEditsAddUpdateFeatures(e,t,n){let{objectIdField:i,globalIdField:a}=this.context,o=a&&this.availableFields.has(a),s=new Set,c=new Set;for(let t of e){let e=t.objectId;e!=null&&s.add(e)}for(let{objectId:e,globalId:n}of t){let t=e;(t==null||t<0)&&a&&(o||r.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),t=this._objectIdFromGlobalId(n,i,a)),t!=null&&t>=0&&(s.add(t),c.add(t))}if(s.size===0)return;let l=[];this._featureTiles.forEach(e=>{let t=this._applyEditsAddUpdateTile(e,s,c,n);l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,n,r){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;let i=this._createQuery(e);i.resultType=void 0,i.cacheHint=!1,i.objectIds=Array.from(t);let a=await this.context.query.queryFeaturesDehydrated(i,{signal:r,timeout:$}),o=null;if(n.size>0){let t=e.features.filter(e=>!n.has(w(e,this._objectIdField)));t.length!==e.features.length&&(o=t)}if(a.features.length>0){o||=e.features.slice();for(let e of a.features)o.push(e)}o&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,o.length)),this._applyEditsTileUpdated(),e.setFeatures(o,0,q(e.availableFields,a.fields),J(e.missingAttributes,a.missingAttributes),void 0,!1),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t,n){return this.context.query.queryFeaturesDehydrated(e,{signal:n,timeout:$,completeFeatureFromTransfer:(e,n,r)=>{let i=ne(e.geometry,n,t),a=this._memory.findGeometry(i,t=>re(e.geometry,n,t));a?e.geometry=a:ie(e,n,r)}})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){let t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;let n=this._featureTilesArray;if(this._markTilesNotAlive(n),!e.run(()=>this._addTiles(n,e))||!e.run(()=>this._filterExtentTiles(n,e))||!e.run(()=>this._removeTiles(n,e))||e.done){this._setDirty();return}let r=this._sortTiles(n);e.run(()=>this._showTiles(r,e))&&e.run(()=>this._fetchTiles(r,e))&&e.run(()=>this._updateMemoryEstimates(r,e))||this._setDirty(),this._updated(),this.updating||(this._updateMaximumNumberOfFeaturesExceeded(),this._updateSnappingComplexityExceeded(r))}_updateSnappingComplexityExceeded(e){let t=se;for(let n of e){if(V(n)||t<=0)break;if(!H(n)&&(t--,n.sampledDensityEstimate>oe)){this.snappingComplexityExceeded=!0;return}}this.snappingComplexityExceeded=this._featureTiles.size===0}_markTilesNotAlive(e){for(let t of e)t.alive=!1}_addTiles(e,t){return this._suspended||!this.tileDescriptors?!1:(this.tileDescriptors.forEach(n=>{let r=this._featureTiles.get(n.id);r?r.alive=!0:t.done||(e.push(this._addTile(n)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(let n of e){if(t.done)break;n.alive&&(n.filtered=!n.intersects(this.filterExtent),n.filtered&&(this._clearTile(n),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let n=e.length-1;n>=0&&!t.done;n--){let r=e[n];r.alive||(this._removeTile(r),n!==e.length-1&&(e[n]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){let n=this._updateRatio(e),r=e=>{let t=this._fullRatio<1?n(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();let{numFeatures:r,fetchingResolution:i,descriptor:a,isFetched:o}=e;return this._supportsResolution&&r>0&&i!==a.resolution&&o&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(let n of e)if(!t.run(()=>r(n))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let n=!1;for(let r of e){if(!r.needsFetch)continue;let e=this.context.memoryCache==null?null:this.context.memoryCache.pop(r.id);if(e?.resolution===r.displayingResolution)r.cache=e,r.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(r)){let e=new AbortController,i=this._fetchTileCount(r,e.signal);this._handleRequest(r,i,e,()=>r.resetFetching(),()=>r.numFeatures=N),n=!0,t.madeProgress()}if(t.done)return!0}}if(n)return t.hasProgressed;for(let n of e){if(!n.needsFetch)continue;let e=new AbortController,i=this._fetchTile(n,e.signal);if(this._handleRequest(n,i,e,e=>n.fetchDone(e),e=>{n.fetchFailed=!0,this.context.logFetchError(r.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;let n=[];this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,X),r.intersectionIncludingBorrowed(e,Z),v(X,Z)||n.push(r))}),this._refreshDisplayingFeatures(n),this._updated()}_refreshDisplayingFeatures(e){let t=new Set,n=this._changes.updates;for(let r of e)if(r.displayingFeatures!=null)for(let e of r.displayingFeatures){let r=w(e,this._objectIdField);if(t.has(r))continue;t.add(r);let i=this._displayingFeatureReferences.get(r).feature;n.removes.push(i),n.adds.push(i)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set(`dataUpdating`,!1),this.updating){let t=0,n=0,r=0,i=0,a=0,o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++n,e.isFetching&&e.hasPreciseFeatureCount){let t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),n=e.displayingFeatures==null?0:e.displayingFeatures.length*o;a+=t-n}e.needsFetch?++i:e.numFeatures>0&&(++r,t+=e.numFeatures)}),i+=e;let s=0,c=0;t?(c=t,s=Math.min(i*t/r,t)):(c=n,s=i),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set(`updatingTotal`,c),this._set(`updatingRemaining`,s),this._set(`expectedFeatureDiff`,a)}else this._set(`updatingTotal`,0),this._set(`updatingRemaining`,0),this._set(`expectedFeatureDiff`,0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(let{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e){this._set(`maximumNumberOfFeaturesExceeded`,!0);return}this._set(`maximumNumberOfFeaturesExceeded`,!1)}_updateRatio(e){let t=W(e),n=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0])),r=0,i=0;for(let t of e){let e=t.numFeatures;r+=e,i+=e*n(t)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/r),this._farRatio=this.maximumNumberOfFeatures/i,this._scheduleUpdated(),n}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;let t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){let t=new P(e,this._memory);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){let t=e.displayingResolution,n=new Set;this._featureTiles.forEach(r=>{if(r.displayingFeatures!=null&&e!==r&&L(e.descriptor.lij,r.descriptor.lij)){e.displayingFeatures??=[],e.descriptor.extent&&r.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=y(e.descriptor.extent),b(e.extentIncludingBorrowedFeatures,r.descriptor.extent,e.extentIncludingBorrowedFeatures));for(let i of r.displayingFeatures){let r=w(i,this._objectIdField);if(n.has(r))continue;n.add(r),e.displayingFeatures.push(i),this._memory.ref(i);let a=this._displayingFeatureReferences.get(r);a.ref(this._memory,a.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(8):e.requestFetch()}_cancelFetchTile(e){let t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t}),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){if(e.fetchFailed=!1,e.needsAttributesFetching&&e.features?.length)return this._fetchTileAttributes(e,t);let n=this._maximumFeaturesForTile(e);if(n<=0)return e.hasPreciseFeatureCount&&e.numFeatures===0||(e.fetchFailed=!0),G(e),e.fetchInformation.value=`Empty tile`,8;let r=this._getMaxRecordCount(e),i=Math.ceil(n/r);if(e.fetchingResolution=e.descriptor.resolution,U(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=n&&i>O.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);let a=this._createQuery(e);if(a.maxRecordCountFactor=i,e.isRefetching&&e.features&&e.features.length>0){let t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${n} features`;let{features:s,exceededTransferLimit:c,fields:l,missingAttributes:u}=await this._queryFeatures(a,e.fetchingResolution,t),d=c||a.maxRecordCountFactor>=O.MAX_MAX_RECORD_COUNT_FACTOR||n===this._totalFeaturesForTile(e)?9:8,f=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!c;let t=this._removeEmptyFeatures(s,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${s.length}/${n} features`,e.setFeatures(s,t,K(l),J(void 0,u)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>n?1:d},t);return o(t),this._invalidateCounts(),f}async _fetchTileAttributes(e,t){let n=e.features,r=new Set(this.context.requiredFields),i=new Set;for(let t of e.missingAttributes?.values()??[])i=i.union(t.intersection(r));let a=this.context.availableFields.filter(t=>!e.availableFields?.has(t)||i.has(t));if(!a.length)return e.attributeRefetchCompletionStatus;a.includes(this._objectIdField)||a.push(this._objectIdField);let s=new Set(n.map(e=>w(e,this._objectIdField))),c=new Map,l=Math.ceil(n.length/(1-e.emptyFeatureRatio)),u=new Set(e.availableFields),d=e.missingAttributes==null?void 0:new Map(Array.from(e.missingAttributes,([e,t])=>[e,new Set(t)])),f=this._queryFeaturePages(e,()=>l,t,{returnGeometry:!1,outFields:a});for await(let e of f){for(let t of e.features){let e=w(t,this._objectIdField);if(s.delete(e)){c.set(e,t);let n=d?.get(e);for(let e of a)Object.hasOwn(t.attributes,e)&&n?.delete(e);n?.size===0&&d?.delete(e)}}for(let{name:t}of e.fields??[])u.add(t);if(d=J(d,e.missingAttributes?.filter(({objectId:e})=>c.has(e))),!s.size)break}return s.size?(e.requestRefetch(),e.startFetch(),this._fetchTile(e,t)):(await this._frameTask.schedule(()=>{o(t);let r=n.map(e=>{let t={...e.attributes,...c.get(w(e,this._objectIdField)).attributes};if(k(e)){let n=e.cloneShallow();return n.attributes=t,n}let n=new T(p(),e.geometry,t);return n.objectId=w(e,this._objectIdField),n.centroid=e.centroid,n}),i=Math.round(n.length*e.emptyFeatureRatio/(1-e.emptyFeatureRatio));e.setFeatures(r,i,u,d),this._setDirty()},t),o(t),e.attributeRefetchCompletionStatus)}async _fetchPagedTile(e,t){let n=0,r,i=this._maximumFeaturesForTile(e),a=null,s,c=this._queryFeaturePages(e,()=>(e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${i} features`,i),t),l=!1;for await(let u of c){let{features:c,fields:d,missingAttributes:f}=u;if(l=!!u.exceededTransferLimit,await this._frameTask.schedule(()=>{n+=this._removeEmptyFeatures(c,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!l,r=r?.concat(c)??c,a=q(a,d),s=J(s,f),e.setFeatures(r,n,a,s),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),o(t),i=this._maximumFeaturesForTile(e)-(r?.length??0),i<=0)break}return l?8:9}async*_queryFeaturePages(e,t,n,r={}){let i=this._createQuery(e,r.returnGeometry);i.returnGeometry||(i.returnCentroid=!1),r.outFields&&(i.outFields=r.outFields);let a=this._getMaxRecordCount(e),s=0;for(;;){o(n);let r=this._setPagingParameters(i,s,t(),a),c=await this._queryFeatures(i,e.fetchingResolution,n);o(n);let l=c.features.length>0;if(yield c,!r||!c.exceededTransferLimit||!l)return;s+=i.num}}_createFeatureCountQuery(e){let t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e,t){let n=this.context.createQuery();if(t!==void 0&&(n.returnGeometry=t),n.resultType=this._resultType(e),!U(e)&&e.descriptor.extent&&this.context.tilingScheme&&(n.geometry=x(e.descriptor.extent,this.context.tilingScheme.spatialReference)),n.returnGeometry&&this._setResolutionParams(n,e),n.resultType!==`tile`&&this.context.capabilities.supportsCacheHint&&(n.cacheHint=!0),H(e)){let{highlightIds:e}=this.context;e&&e.length>Y&&r.getLogger(this).warn(`highlight-too-many-features`,`highlight is limited to ${Y} features on large layers configured with a display filter to avoid performance issues`),n.objectIds=e?.slice(0,Y)}else!V(e)&&this.context.effectiveDisplayFilter&&(n.where=f(n.where,this.context.effectiveDisplayFilter.where));return n}_setPagingParameters(e,t,n,r){let i=n>0&&this.context.capabilities.supportsMaxRecordCountFactor;return i&&(e.maxRecordCountFactor=Math.ceil(n/r)),this.context.capabilities.supportsPagination?(e.start=t,e.num=i?Math.min(e.maxRecordCountFactor*r,n):Math.min(r),!0):!1}_getEffectiveTileResolution(e){if(U(e)||!this._supportsResolution)return null;let t=this.context.viewingMode===1&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!==`point`}_setResolutionParams(e,t){let n=this._getEffectiveTileResolution(t);n!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new D({mode:`view`,originPosition:`upper-left`,tolerance:n,extent:this.context.fullExtent}):this.context.geometryType===`polyline`&&(e.maxAllowableOffset=n))}_removeEmptyFeatures(e,t){let r=e.length;if(t&&this._supportsResolution){let r=t*(1+g());n(e,({geometry:e})=>!e||!E(e)?!1:(ee(e,Q),S(Q)>r||C(Q)>r))}else n(e,({geometry:e})=>E(e));return r-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!V(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case`tile`:if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case`standard`:if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Y}_resultType(e){if(this.context.capabilities.supportsResultType)return V(e)?`standard`:`tile`}get _reduceMode(){let e=this.context.geometryType;return e===`polygon`||e===`polyline`?0:1}_handleRequest(e,t,n,r,i){e.startFetch(),e.requestController=n;let s=!1;t.then(t=>{o(n.signal),e.requestController=null,r(t)}).catch(t=>{e.requestController===n&&(e.requestController=null,e.fetchDone(8)),a(t)?s=!0:i(t)}).then(()=>{s||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles(`scheduleUpdated`)||this.addHandles(u(()=>{this.removeHandles(`scheduleUpdated`),this._updated()}),`scheduleUpdated`)}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;let t=e.features;if(e.featureLimit===0||!t){let t=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}let n=e.fetchingResolution,{adds:r,updates:i}=this._changes,a=Math.min(e.featureLimit,t.length);for(let e=0;e<a;++e){let a=t[e],o=w(a,this._objectIdField),s=this._displayingFeatureReferences.get(o);if(this._memory.ref(a),s){let{oldVersion:e,newVersion:t}=s.ref(this._memory,a,n);e!==t&&(e&&i.removes.push(e),t&&i.adds.push(t))}else this._displayingFeatureReferences.set(o,new this.FeatureReferenceClass(a,n,this._memory)),r.push(a);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(e.displayingFeatures==null)return;let{updates:t,removes:n}=this._changes;for(let r of e.displayingFeatures){this._memory.unref(r);let i=w(r,this._objectIdField),a=this._displayingFeatureReferences.get(i);if(!a)continue;let{oldVersion:o,newVersion:s}=a.unref(this._memory,e.displayingResolution);this._numDisplayingFeatureReferences--,o!==s&&(s==null?(this._displayingFeatureReferences.delete(i),o&&n.push(o)):(t.adds.push(s),o&&t.removes.push(o)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get(`dataUpdating`)||this._set(`dataUpdating`,!0)}_applyChanges(){let e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);let t=this._changes.adds,n=this._changes.removes,r=Math.min(t.length,n.length),i=0;for(;i<r;){let e=Math.min(i+ae,r);this._notifyDataUpdating(),this.features.addMany(t.slice(i,e)),this.features.removeMany(n.slice(i,e)),i=e}t.length>r&&(this._notifyDataUpdating(),this.features.addMany(i===0?t:t.slice(i))),n.length>r&&(this._notifyDataUpdating(),this.features.removeMany(i===0?n:n.slice(i))),t.length=0,n.length=0}_clearTile(e){this._hideTile(e),e.features&&this.context.memoryCache!=null&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange(`totalVertices`),this.notifyChange(`totalFeatures`)}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return this._featureTiles.values().reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){let t=this._totalFeaturesForTile(e),n=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*n/(1-e.emptyFeatureRatio)),t)}get test(){}};e([m({constructOnly:!0})],B.prototype,`features`,void 0),e([m({constructOnly:!0})],B.prototype,`context`,void 0),e([m()],B.prototype,`tileDescriptors`,void 0),e([m({value:1/0})],B.prototype,`maximumNumberOfFeatures`,null),e([m({value:1})],B.prototype,`memoryFactor`,null),e([m({value:1})],B.prototype,`lodFactor`,null),e([m()],B.prototype,`useTileCount`,null),e([m({readOnly:!0})],B.prototype,`updating`,null),e([m({readOnly:!0})],B.prototype,`dataUpdating`,void 0),e([m({readOnly:!0})],B.prototype,`updatingTotal`,void 0),e([m({readOnly:!0})],B.prototype,`updatingRemaining`,void 0),e([m({readOnly:!0})],B.prototype,`expectedFeatureDiff`,void 0),e([m()],B.prototype,`usedMemory`,null),e([m()],B.prototype,`usedMemoryPerFeature`,null),e([m({readOnly:!0})],B.prototype,`maximumNumberOfFeaturesExceeded`,void 0),e([m({readOnly:!0})],B.prototype,`totalVertices`,null),e([m({readOnly:!0})],B.prototype,`totalFeatures`,null),e([m({readOnly:!0})],B.prototype,`showsAllFeatures`,null),e([m({readOnly:!0})],B.prototype,`hasFullGeometries`,null),e([m()],B.prototype,`filterExtent`,null),e([m()],B.prototype,`_dirty`,void 0),e([m()],B.prototype,`_suspended`,void 0),e([m()],B.prototype,`_pendingEdits`,void 0),e([m()],B.prototype,`_applyEditsTilesUpdated`,void 0),e([m()],B.prototype,`_paused`,null),e([m()],B.prototype,`snappingComplexityExceeded`,void 0),e([m()],B.prototype,`_isFetching`,void 0),B=e([h(`esri.views.3d.layers.support.FeatureTileFetcher3D`)],B);function V(e){return e.id===I}function H(e){return e.id===F}function U(e){return V(e)||H(e)}function W(e){let t=0;for(let n of e)n.features&&n.features.length>0&&n.alive&&(t=Math.max(t,n.descriptor.lij[0]));return t}function G(e){e.setFeatures([],0,null,void 0)}function K(e){return e==null?new Set:new Set(e.map(e=>e.name))}function q(e,t){if(e==null||t==null)return K(t);let n=new Set;for(let{name:r}of t)e.has(r)&&n.add(r);return n}function J(e,t){if(!t?.length)return e;e??=new Map;let n=()=>new Set;for(let{objectId:r,attribute:a}of t)i(e,r,n).add(a);return e}const Y=2e3,X=_(),Z=_(),Q=_(),$=6e5,ae=200,oe=.95,se=10;export{B as FeatureTileFetcher3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{ignoreAbortErrors as t}from"../../../core/promiseUtils.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{DefaultNavigationMode3D as a}from"./modes/DefaultNavigationMode3D.js";import{groundNavigationAdvance as o}from"../state/utils/groundNavigationUtils.js";import s from"../../navigation/Navigation.js";let c=class extends s{constructor(e){super(e),this.mode=new a,this.addHandles([n(()=>this.mode,(e,t)=>{t?.detach(),e.attach(this.view)},{sync:!0,initial:!0})])}get isInPlacementMode(){let{activeTool:e}=this.view;return e?`isGroundNavigationPlacementTool`in e:!1}zoom(e){switch(this.mode.type){case`default`:return t(this.view.goTo({zoomFactor:e?2:.5}));case`ground`:return t(o(this.view,e?5:-5));default:this.mode}throw Error(`Unknown navigation mode while calling navigation3D.zoom: ${this.mode}`)}};e([r({constructOnly:!0})],c.prototype,`view`,void 0),e([r()],c.prototype,`mode`,void 0),e([r()],c.prototype,`isInPlacementMode`,null),c=e([i(`esri.views.3d.navigation.Navigation3D`)],c);export{c as Navigation3D};
2
+ import{__decorate as e}from"tslib";import{ignoreAbortErrors as t}from"../../../core/promiseUtils.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{DefaultNavigationMode3D as a}from"./modes/DefaultNavigationMode3D.js";import{groundNavigationAdvance as o}from"../state/utils/groundNavigationUtils.js";import s from"../../navigation/Navigation.js";let c=class extends s{constructor(e){super(e),this.mode=new a,this.addHandles([n(()=>this.mode,(e,t)=>{t?.detach(),e.attach(this.view)},{sync:!0,initial:!0})])}get isInPlacementMode(){let{activeTool:e}=this.view;return e?`isGroundNavigationPlacementTool`in e:!1}zoom(e){switch(this.mode.type){case`default`:return t(this.view.goTo({zoomFactor:e?2:.5}));case`ground`:return t(o(this.view,this.view.state.camera.viewForward,e?5:-5));default:this.mode}throw Error(`Unknown navigation mode while calling navigation3D.zoom: ${this.mode}`)}};e([r({constructOnly:!0})],c.prototype,`view`,void 0),e([r()],c.prototype,`mode`,void 0),e([r()],c.prototype,`isInPlacementMode`,null),c=e([i(`esri.views.3d.navigation.Navigation3D`)],c);export{c as Navigation3D};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{Milliseconds as t,millisecondsFromSeconds as n}from"../../../../core/time.js";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{set as i,scaleAndAdd as a,length as o,scale as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{CameraController as l}from"./CameraController.js";import{advanceGroundNavigationCamera as u}from"../utils/groundNavigationUtils.js";import{OffsetCorrectionController as d}from"../utils/OffsetCorrectionController.js";let f=class extends l{constructor(){super(...arguments),this._remainingMovement=c(),this._direction=c(),this._timeSinceLastInput=t(0)}initialize(){this._offsetCorrectionController=new d(this.view)}get canStop(){return!0}get isInteractive(){return!0}onControllerStart(){this.state=2}onControllerEnd(){i(this._remainingMovement,0,0,0)}addMovement(e,n){a(this._remainingMovement,this._remainingMovement,e,n),this._timeSinceLastInput=t(0)}stepController(e,r){if(!this.running||e<=0)return;if(this._timeSinceLastInput=t(this._timeSinceLastInput+n(e)),this._timeSinceLastInput>=200&&this._offsetCorrectionController.reset(),this.view.navigation.mode.type!==`ground`){this.finishController();return}let i=o(this._remainingMovement),a=i<=1e-5||!this.view.state.animationsEnabled,c=a?1:-Math.expm1(-(e/.08));i>0&&(s(this._direction,this._remainingMovement,1/i),u({view:this.view,camera:r,forwardDirection:this._direction,forwardDistance:i*c,detectCollisions:!1}),s(this._remainingMovement,this._remainingMovement,1-c));let l=this._offsetCorrectionController.smoothlyCorrectGroundElevation({camera:r,deltaTime:e});a&&l<=.01&&this.finishController()}};f=e([r(`esri.views.3d.state.controllers.GroundMouseWheelController`)],f);export{f as GroundMouseWheelController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{distance as r,add as i,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../ViewAnimation.js";import{Animation as c}from"../../animation/pointToPoint/Animation.js";import{AnimationController as l}from"./AnimationController.js";import{searchAreaSize as u}from"../utils/navigationUtils.js";import d from"../../webgl/RenderCamera.js";import{Intersector as f}from"../../webgl-engine/lib/Intersector.js";import{EasingFunctions as p}from"../../../animation/easing.js";let m=class extends l{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.type=`point-to-point`,this.mode=`interaction`,this._target=null}initialize(){this.animation=new c(this.view.state.viewingMode),this.viewAnimation=this.mode===`interaction`?null:new s}get isInteractive(){return this.mode===`interaction`}begin(e,t){this._target=e.clone(),this.stepController=(e,t)=>{this.animation.step(e,t),this.animation.finished&&this.finishController()};let n=this.animationSettings(t);h.copyFrom(this.view.state.camera);let o=this.view.stage.renderView.getMinimalDepthForArea(null,h.fullWidth/h.pixelRatio*.5,h.fullHeight/h.pixelRatio*.5,h,u),s=new f(this.view.state.viewingMode),c;this._intersectionHelper.intersectRay(h.ray,s,g)&&(c=r(h.eye,g));let l=o!=null&&c!=null?Math.min(o,c):o??c;i(g,h.eye,a(g,h.viewForward,l??0)),h.center=g,this.animation.update(h,e,n),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(e){this.stepController&&(this.animation.currentTime/this.animation.time>=1&&this._target?e.copyFrom(this._target):this.animation.cameraAt(this.animation.currentTime/this.animation.time,e),this.animation.currentTime=this.animation.time),super.onControllerEnd(e),this.stepController=void 0}animationSettings(e={}){return{apex:e.liftOffDisabled?void 0:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...e,easing:typeof e.easing==`string`?p[e.easing]:e.easing}}};e([t({constructOnly:!0})],m.prototype,`mode`,void 0),e([t({readOnly:!0})],m.prototype,`isInteractive`,null),m=e([n(`esri.views.3d.state.controllers.PointToPointAnimationController`)],m);let h=new d;const g=o();function _(){h=new d}function v(e){return e!=null&&`type`in e&&e.type===`point-to-point`}export{m as PointToPointAnimationController,_ as cleanupPointToPointAnimationController,v as isPointToPointAnimationController};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{distance as r,add as i,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../ViewAnimation.js";import{Animation as c}from"../../animation/pointToPoint/Animation.js";import{AnimationController as l}from"./AnimationController.js";import{searchAreaSize as u}from"../utils/navigationUtils.js";import d from"../../webgl/RenderCamera.js";import{Intersector as f}from"../../webgl-engine/lib/Intersector.js";import{EasingFunctions as p}from"../../../animation/easing.js";let m=class extends l{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.type=`point-to-point`,this.mode=`interaction`,this._target=null}initialize(){this.animation=new c(this.view.state.viewingMode),this.viewAnimation=this.mode===`interaction`?null:new s}get isInteractive(){return this.mode===`interaction`}begin(e,t){this._target=e.clone(),this.stepController=(e,t)=>{this.animation.step(e,t),this.animation.finished&&this.finishController()};let n=this.animationSettings(t);h.copyFrom(this.view.state.camera);let o=this.view.stage.renderView.getMinimalDepthForArea(null,h.fullWidth/h.pixelRatio*.5,h.fullHeight/h.pixelRatio*.5,h,u),s=new f(this.view.state.viewingMode),c;this._intersectionHelper.intersectRay(h.ray,s,g)&&(c=r(h.eye,g));let l=o!=null&&c!=null?Math.min(o,c):o??c;l!=null&&(i(g,h.eye,a(g,h.viewForward,l)),h.center=g),this.animation.update(h,e,n),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(e){this.stepController&&(this.animation.currentTime/this.animation.time>=1&&this._target?e.copyFrom(this._target):this.animation.cameraAt(this.animation.currentTime/this.animation.time,e),this.animation.currentTime=this.animation.time),super.onControllerEnd(e),this.stepController=void 0}animationSettings(e={}){return{apex:e.liftOffDisabled?void 0:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...e,easing:typeof e.easing==`string`?p[e.easing]:e.easing}}};e([t({constructOnly:!0})],m.prototype,`mode`,void 0),e([t({readOnly:!0})],m.prototype,`isInteractive`,null),m=e([n(`esri.views.3d.state.controllers.PointToPointAnimationController`)],m);let h=new d;const g=o();function _(){h=new d}function v(e){return e!=null&&`type`in e&&e.type===`point-to-point`}export{m as PointToPointAnimationController,_ as cleanupPointToPointAnimationController,v as isPointToPointAnimationController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e}from"../../../../core/mathUtils.js";import{dot as t,distance as n,subtract as r,scale as i,add as a,copy as o,normalize as s,cross as c,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../geometry/support/ray.js";import{applyConstraintsAndUpdateCenterRenderCamera as p}from"../../camera/constraintUtils.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";const h=.5,g=new Set([0,2,8]),_=new Set(g).add(7);class v{constructor(e){this._view=e,this._tmpRay=f(),this._tmpWorldUp=u(),this._tmpScaledUp=u(),this._tmpCorrectionOffset=u(),this._tmpUpdatedCameraPos=u(),this._tmpCenterDiff=u(),this._tmpMovementDelta=u(),this._tmpPerpendicularMovementDelta=u(),this._tmpGroundIntersections=[u(),u(),u()],this._tmpGroundIntersectionHits=[!1,!1,!1],this._tmpRayOrigins=[u(),u(),u()],this._tmpRayDirection=u(),this._previousCameraPosition=null,this._intersector=new m(this._view.state.viewingMode),this._intersector.options.invisibleTerrain=!0}smoothlyCorrectGroundElevation(e){let{camera:n,deltaTime:r,constraintOptions:i,navigationModeOverride:a}=e,o=this._prepareMode(a);if(!o||!r)return 0;let s=this._view.renderCoordsHelper.worldUpAtPosition(n.eye,this._tmpWorldUp),c=this._prepareCameraAndPreviousIterationPosition(n,s,this._previousCameraPosition),l=this._prepareRays(n,s,c),u=this._intersectRays(o,s,l);if(!u.hasIntersection){let e=this._adjustCameraElevation(n,s,0,i);return this._previousCameraPosition=d(e),0}let f=this._filterRayResults(s,c,u),p=this._getSmoothedElevationCorrection(o,f,n,s,c,r),m=this._adjustCameraElevation(n,s,p,i);return this._previousCameraPosition=d(m),Math.abs(f-t(m,s))}immediatelyCorrectGroundElevation(e){let{camera:i,constraintOptions:a,navigationModeOverride:o,correctionLimit:s}=e,c=this._prepareMode(o);if(!c)return;let l=this._view.renderCoordsHelper.worldUpAtPosition(i.eye,this._tmpWorldUp),u=this._prepareRays(i,l),d=this._intersectRays(c,l,u),f=d.intersections[0];!d.hasIntersection||n(i.eye,f)>(s??1/0)?this._adjustCameraElevation(i,l,0,a):this._adjustCameraElevation(i,l,t(l,r(this._tmpCorrectionOffset,f,i.eye)),a)}_prepareMode(e){let t=e??this._view.navigation.mode;return t.type!==`ground`||!t.offset?null:t}_prepareCameraAndPreviousIterationPosition(e,n,r){if(r){let o=t(n,e.eye),s=t(n,r);return i(this._tmpCorrectionOffset,n,s-o),e.eye=a(this._tmpUpdatedCameraPos,e.eye,this._tmpCorrectionOffset),e.center=a(this._tmpUpdatedCameraPos,e.center,this._tmpCorrectionOffset),r}return e.eye}_prepareRays(e,t,n){let r=i(this._tmpRayDirection,t,-1e5);if(o(this._tmpRayOrigins[0],e.eye),!n)return{origins:this._tmpRayOrigins,direction:r,count:1};let{forwardMovementDirection:a,rightMovementDirection:s}=this._getMovementDirections(e.eye,n,t);return this._getLeftRayOrigin(e.eye,a,s,this._tmpRayOrigins[1]),this._getRightRayOrigin(e.eye,a,s,this._tmpRayOrigins[2]),{origins:this._tmpRayOrigins,direction:r,count:this._tmpRayOrigins.length}}_getMovementDirections(e,n,a){let o=r(this._tmpMovementDelta,e,n);return r(o,o,i(this._tmpScaledUp,a,t(a,o))),s(o,o),{forwardMovementDirection:o,rightMovementDirection:c(this._tmpPerpendicularMovementDelta,o,a)}}_getLeftRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,-.5),r}_getRightRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,h),r}_intersectRays(e,t,r){let i=e.offset,a=this._view.sceneIntersectionHelper,s=y(e,this._view.groundView.baseOpacity===0);o(this._tmpRay.direction,r.direction);for(let e=0;e<r.count;e++)o(this._tmpRay.origin,r.origins[e]),this._tmpGroundIntersectionHits[e]=a.intersectRay(this._tmpRay,this._intersector,this._tmpGroundIntersections[e],s),this._tmpGroundIntersectionHits[e]&&n(this._tmpGroundIntersections[e],this._tmpRay.origin)>1e5&&(this._tmpGroundIntersectionHits[e]=!1),this._tmpGroundIntersectionHits[e]&&l(this._tmpGroundIntersections[e],this._tmpGroundIntersections[e],t,i);let c=this._tmpGroundIntersectionHits.some((e,t)=>t<r.count&&e);return{intersections:this._tmpGroundIntersections,hits:this._tmpGroundIntersectionHits,count:r.count,hasIntersection:c}}_filterRayResults(e,n,r){let i=t(n,e),a=null;for(let n=0;n<r.count;n++){if(!r.hits[n])continue;let o=r.intersections[n],s=t(o,e);(a==null||Math.abs(s-i)<Math.abs(a-i))&&(a=s)}return a}_getSmoothedElevationCorrection(r,i,a,o,s,c){let l=n(a.eye,s)/c,u=1+Math.max(0,(l-5)*.03),d=(u*1e-5)**c,f=t(s,o)*d+i*(1-d),p=t(a.eye,o),m=u*5*c*(r.offset??0),h=f-p;return e(h,-m,m)}_adjustCameraElevation(e,t,n,i){return n!==0&&(l(this._tmpUpdatedCameraPos,e.eye,t,n),r(this._tmpCenterDiff,e.center,e.eye),e.eye=this._tmpUpdatedCameraPos,e.center=a(this._tmpUpdatedCameraPos,this._tmpUpdatedCameraPos,this._tmpCenterDiff)),p(this._view,e,i),e.eye}}function y(e,t){return b(e.include)?{include:e.include,exclude:e.exclude}:{exclude:e.exclude,objectFilter:e=>!!e.lastValidElevationBB,allowedIntersectorTypes:t?g:_}}function b(e){return e!=null&&e.size>0}export{v as OffsetCorrectionController};
2
+ import{clamp as e}from"../../../../core/mathUtils.js";import{dot as t,distance as n,subtract as r,scale as i,add as a,copy as o,normalize as s,cross as c,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as f}from"../../../../geometry/support/ray.js";import{applyConstraintsAndUpdateCenterRenderCamera as p}from"../../camera/constraintUtils.js";import{Intersector as m}from"../../webgl-engine/lib/Intersector.js";const h=.5,g=new Set([0,2,8]),_=new Set(g).add(7);class v{constructor(e){this._view=e,this._tmpRay=f(),this._tmpWorldUp=u(),this._tmpScaledUp=u(),this._tmpCorrectionOffset=u(),this._tmpUpdatedCameraPos=u(),this._tmpCenterDiff=u(),this._tmpMovementDelta=u(),this._tmpPerpendicularMovementDelta=u(),this._tmpGroundIntersections=[u(),u(),u()],this._tmpGroundIntersectionHits=[!1,!1,!1],this._tmpRayOrigins=[u(),u(),u()],this._tmpRayDirection=u(),this._previousCameraPosition=null,this._intersector=new m(this._view.state.viewingMode),this._intersector.options.invisibleTerrain=!0}smoothlyCorrectGroundElevation(e){let{camera:n,deltaTime:r,constraintOptions:i,navigationModeOverride:a}=e,o=this._prepareMode(a);if(!o||!r)return 0;let s=this._view.renderCoordsHelper.worldUpAtPosition(n.eye,this._tmpWorldUp),c=this._prepareCameraAndPreviousIterationPosition(n,s,this._previousCameraPosition),l=this._prepareRays(n,s,c),u=this._intersectRays(o,s,l);if(!u.hasIntersection){let e=this._adjustCameraElevation(n,s,0,i);return this._previousCameraPosition=d(e),0}let f=this._filterRayResults(s,c,u),p=this._getSmoothedElevationCorrection(o,f,n,s,c,r),m=this._adjustCameraElevation(n,s,p,i);return this._previousCameraPosition=d(m),Math.abs(f-t(m,s))}immediatelyCorrectGroundElevation(e){let{camera:i,constraintOptions:a,navigationModeOverride:o,correctionLimit:s}=e,c=this._prepareMode(o);if(!c)return;let l=this._view.renderCoordsHelper.worldUpAtPosition(i.eye,this._tmpWorldUp),u=this._prepareRays(i,l),d=this._intersectRays(c,l,u),f=d.intersections[0];!d.hasIntersection||n(i.eye,f)>(s??1/0)?this._adjustCameraElevation(i,l,0,a):this._adjustCameraElevation(i,l,t(l,r(this._tmpCorrectionOffset,f,i.eye)),a)}_prepareMode(e){let t=e??this._view.navigation.mode;return t.type!==`ground`||!t.offset?null:t}_prepareCameraAndPreviousIterationPosition(e,n,r){if(r){let o=t(n,e.eye),s=t(n,r);return i(this._tmpCorrectionOffset,n,s-o),e.eye=a(this._tmpUpdatedCameraPos,e.eye,this._tmpCorrectionOffset),e.center=a(this._tmpUpdatedCameraPos,e.center,this._tmpCorrectionOffset),r}return e.eye}_prepareRays(e,t,n){let r=i(this._tmpRayDirection,t,-1e5);if(o(this._tmpRayOrigins[0],e.eye),!n)return{origins:this._tmpRayOrigins,direction:r,count:1};let{forwardMovementDirection:a,rightMovementDirection:s}=this._getMovementDirections(e.eye,n,t);return this._getLeftRayOrigin(e.eye,a,s,this._tmpRayOrigins[1]),this._getRightRayOrigin(e.eye,a,s,this._tmpRayOrigins[2]),{origins:this._tmpRayOrigins,direction:r,count:this._tmpRayOrigins.length}}_getMovementDirections(e,n,a){let o=r(this._tmpMovementDelta,e,n);return r(o,o,i(this._tmpScaledUp,a,t(a,o))),s(o,o),{forwardMovementDirection:o,rightMovementDirection:c(this._tmpPerpendicularMovementDelta,o,a)}}_getLeftRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,-.5),r}_getRightRayOrigin(e,t,n,r){return l(r,e,t,h),l(r,r,n,h),r}_intersectRays(e,t,r){let i=e.offset,a=this._view.sceneIntersectionHelper,s=y(e,this._view.groundView.baseOpacity===0);o(this._tmpRay.direction,r.direction);for(let e=0;e<r.count;e++)o(this._tmpRay.origin,r.origins[e]),this._tmpGroundIntersectionHits[e]=a.intersectRay(this._tmpRay,this._intersector,this._tmpGroundIntersections[e],s),this._tmpGroundIntersectionHits[e]&&n(this._tmpGroundIntersections[e],this._tmpRay.origin)>1e5&&(this._tmpGroundIntersectionHits[e]=!1),this._tmpGroundIntersectionHits[e]&&l(this._tmpGroundIntersections[e],this._tmpGroundIntersections[e],t,i);let c=this._tmpGroundIntersectionHits.some((e,t)=>t<r.count&&e);return{intersections:this._tmpGroundIntersections,hits:this._tmpGroundIntersectionHits,count:r.count,hasIntersection:c}}_filterRayResults(e,n,r){let i=t(n,e),a=null;for(let n=0;n<r.count;n++){if(!r.hits[n])continue;let o=r.intersections[n],s=t(o,e);(a==null||Math.abs(s-i)<Math.abs(a-i))&&(a=s)}return a}_getSmoothedElevationCorrection(r,i,a,o,s,c){let l=n(a.eye,s)/c,u=1+Math.max(0,(l-5)*.03),d=(u*1e-5)**c,f=t(s,o)*d+i*(1-d),p=t(a.eye,o),m=u*5*c*(r.offset??0),h=f-p;return e(h,-m,m)}_adjustCameraElevation(e,t,n,i){return n!==0&&(l(this._tmpUpdatedCameraPos,e.eye,t,n),r(this._tmpCenterDiff,e.center,e.eye),e.eye=this._tmpUpdatedCameraPos,e.center=a(this._tmpUpdatedCameraPos,this._tmpUpdatedCameraPos,this._tmpCenterDiff)),p(this._view,e,i),e.eye}reset(){this._previousCameraPosition=null}}function y(e,t){return b(e.include)?{include:e.include,exclude:e.exclude}:{exclude:e.exclude,objectFilter:e=>!!e.lastValidElevationBB,allowedIntersectorTypes:t?g:_}}function b(e){return e!=null&&e.size>0}export{v as OffsetCorrectionController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as r,cross as i,add as a,crossAndNormalize as o,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as d,length as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as m}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as h}from"../../../../geometry/support/lineSegment.js";import{create as g,fromPositionAndNormal as _,distance as v,projectPoint as y,projectVector as b,intersectLineSegment as x}from"../../../../geometry/support/plane.js";import{create as S}from"../../../../geometry/support/ray.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as w}from"../../webgl.js";import{getVoxelWasm as T}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ee}from"./OffsetCorrectionController.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import ne from"../../webgl/RenderCamera.js";import{Intersector as A}from"../../webgl-engine/lib/Intersector.js";const j=1.5,M={xSpeedMultiplier:j,ySpeedMultiplier:j,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},N=p(),P=p(),re=t(),F=p(),I=g(),L=p(),R=p(),z=p(),B=p(),V=p(),ie=p(),H=p(),U=p(),W=p(),G=p(),K=t(),q=S(),J=new C,Y=p(),ae=g(),X=p(),oe=p();function se(e,t){return b(t,e.viewForward,N),a(P,e.eye,N),e.projectToScreen(P,re),re[1]}function ce(e,t,d){let f=e.eye;if(n(t.center,f)<t.radius)return r(V,f),i(ie,V,e.viewRight),a(P,f,ie),e.projectToScreen(P,K),K[1];let p=e.up;te(e,d,q);let m=t.radius;if(o(F,p,q.direction),_(f,F,I),v(I,t.center)>m)return null;y(I,t.center,L);let h=n(t.center,L),g=Math.sqrt(m**2-h**2);s(R,f,L),r(z,R),o(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),C=Math.sqrt(S**2-g**2),w=g**2/S**2,T=g/S**2*C,E=w*b,D=T*-x,O=w*x,k=T*b,ee=E+D,ne=E-D,A=O+k,j=O-k;return a(H,L,l(H,u(H,z,ee),B,A)),a(U,L,l(U,u(U,z,ne),B,j)),s(W,H,f),r(W,W),s(G,U,f),r(G,G),c(e.viewForward,W)>=c(e.viewForward,G)?e.projectToScreen(H,K):e.projectToScreen(U,K),K[1]}function le(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function ue(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(M.minimumHorizonPadding,M.relativeHorizonPadding*r)}function de(e,t){return[fe(e,t),pe(e,t)]}function fe(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function pe(e,t){return Math.max(0,t-Q(e,t))}function me(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function he(e){let{view:t}=e;return t.viewingMode===`global`?ge(e):_e(e)}function ge(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:f}=e,p=t.state.camera,h=me(s,c,l);J.radius=m(t.spatialReference).radius;let g=E(t,p,i,J.radius,1,u);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;d(Y,g.scenePickPoint),d(h.location,Y);let v=g.sphere;h.normal&&g.normal&&d(h.normal,g.normal);let y=ye(i,a,o,_),b=_?n(Y,p.eye):1/0;return y.wasAdjusted&&be({view:t,screenAdjustment:y,intersector:$(t),fallbackCheck:(e,t,n)=>{let i=D(v,p,e,t);return i&&n&&r(n,t),i},output:h,intersectionOptions:u}),Se({view:t,screenPoint:y.adjustedScreenPoint,camera:p,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function _e(e){let{view:t,originalScreenPoint:i,horizonY:a,horizonPadding:o,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:f,depthSearchSize:p}=e,m=t.sceneIntersectionHelper,h=t.state.camera,g=$(t),v=me(s,c,u);m.intersectIntersectorScreen(i,g,f);let y=g.results.min.getIntersectionPoint(Y),b=y?n(Y,h.eye):1/0;y&&(d(v.location,Y),v.normal&&d(v.normal,g.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),_(X,V,ae);let x=ye(i,a,o,y);return x.wasAdjusted&&be({view:t,screenAdjustment:x,intersector:g,fallbackCheck:(e,t,n)=>{let i=O(ae,h,e,t);return i&&n&&r(n,V),i},output:v,intersectionOptions:f}),Se({view:t,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function ve(e,t,n,r){return!r&&le(e,t)||r&&ue(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ye(e,n,r,i){let a=ve(e[1],n,r,i);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],a??e[1]),horizonY:n,horizonPadding:r,wasAdjusted:a!==null}}function $(e){let t=new A(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function be(e){let{view:t,screenAdjustment:n,fallbackCheck:r,intersector:i,output:a,intersectionOptions:o}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,i,{...o,requiresGroundFeedback:!0});let c=i.results.min.getIntersectionPoint(a.location);if(c){a.normal&&d(a.normal,i.results.min.normal);return}let l=xe(n);s.intersectIntersectorScreen(l,i,{...o,requiresGroundFeedback:!0}),c=i.results.min.getIntersectionPoint(a.location),c?a.normal&&d(a.normal,i.results.min.normal):(c=r(n.adjustedScreenPoint,a.location,a.normal),c||r(l,a.location,a.normal))}function xe(e){let{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:i,horizonPadding:a}=e,o=Z(r[1],i)?Math.min(a[1],n[1]):Math.max(a[0],n[1]);return t(r[0],o)}function Se(e){Ce(e),we(e)}function Ce(e){let{view:t,camera:n,output:r}=e,{offset:i}=t.navigation.mode;if(!i)return;let{translation:a,location:o}=r;t.renderCoordsHelper.worldUpAtPosition(n.eye,V),l(X,n.eye,V,-i),_(X,V,I),x(I,h(n.eye,s(N,o,n.eye)),X)&&(d(o,X),s(a,o,n.eye))}function we(e){let{view:t,screenPoint:n,camera:i,initialDistance:o,depthSearchSize:c,output:l}=e,d=c>0?t.stage.renderView.getMinimalDepthForArea(T(t),n[0],n[1],i,c):null;s(l.translation,l.location,i.eye);let p=Math.min(f(l.translation),o);d&&d<=p&&(p=d),r(l.translation,l.translation),u(l.translation,l.translation,p),a(l.location,l.translation,i.eye)}async function Te(t,r){let i=t.navigation.mode;if(i.type!==`ground`){e.getLogger(`esri`).warn(`Can only advance while in ground navigation mode!`);return}let{camera:c}=t.state;t.renderCoordsHelper.worldUpAtPosition(c.eye,V);let l=t.sceneIntersectionHelper,p=$(t),m=o(N,V,c.viewRight);d(q.origin,c.eye),u(q.direction,m,r);let h=l.intersectRay(q,p,Y,{include:i.include,exclude:i.exclude}),g=new ne().copyFrom(c),_=s(oe,c.center,c.eye);return!h||n(Y,c.eye)>r?g.eye=a(N,q.origin,q.direction):(s(N,Y,c.eye),f(N)>2&&(Ee(N,N,.25,2),g.eye=a(N,c.eye,N))),g.center=a(N,g.eye,_),new ee(t).immediatelyCorrectGroundElevation({camera:g,correctionLimit:100}),t.goTo(w(t,g),{duration:500,liftOffDisabled:!0})}function Ee(e,t,n,r){let i=f(e),a=Math.min(n,Math.max(i-r,0)/i);u(t,e,a)}export{Q as computeHorizonPadding,de as computeHorizonPaddingLimits,he as findGroundNavigationGrabLocation,se as findPlaneHorizonY,ce as findSphereHorizonY,Te as groundNavigationAdvance,M as groundNavigationConstants,le as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,ue as shouldClampScreenY};
2
+ import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{crossAndNormalize as t,copy as n,scale as r,subtract as i,add as a,distance as o,normalize as s,cross as c,dot as l,scaleAndAdd as u,length as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as m}from"../../../../geometry/support/lineSegment.js";import{create as h,fromPositionAndNormal as g,distance as _,projectPoint as v,projectVector as y,intersectLineSegment as b}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as ee}from"../../webgl.js";import{getVoxelWasm as C}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as w,sphereOrPlanePointFromScreenPoint as T,intersectPlaneFromScreenPoint as E,searchAreaSize as D}from"./navigationUtils.js";import{OffsetCorrectionController as O}from"./OffsetCorrectionController.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import ne from"../../webgl/RenderCamera.js";import{Intersector as re}from"../../webgl-engine/lib/Intersector.js";const k=1.5,A={xSpeedMultiplier:k,ySpeedMultiplier:k,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},j=f(),M=f(),N=e(),P=f(),F=h(),I=f(),L=f(),R=f(),z=f(),B=f(),ie=f(),V=f(),H=f(),U=f(),W=f(),G=e(),K=x(),q=new S,J=f(),Y=h(),X=f(),ae=f();function oe(e,t){return y(t,e.viewForward,j),a(M,e.eye,j),e.projectToScreen(M,N),N[1]}function se(e,n,d){let f=e.eye;if(o(n.center,f)<n.radius)return s(B,f),c(ie,B,e.viewRight),a(M,f,ie),e.projectToScreen(M,G),G[1];let p=e.up;te(e,d,K);let m=n.radius;if(t(P,p,K.direction),g(f,P,F),_(F,n.center)>m)return null;v(F,n.center,I);let h=o(n.center,I),y=Math.sqrt(m**2-h**2);i(L,f,I),s(R,L),t(z,P,R);let b=l(L,R),x=l(L,z),S=Math.sqrt(b**2+x**2),ee=Math.sqrt(S**2-y**2),C=y**2/S**2,w=y/S**2*ee,T=C*b,E=w*-x,D=C*x,O=w*b,ne=T+E,re=T-E,k=D+O,A=D-O;return a(V,I,u(V,r(V,R,ne),z,k)),a(H,I,u(H,r(H,R,re),z,A)),i(U,V,f),s(U,U),i(W,H,f),s(W,W),l(e.viewForward,U)>=l(e.viewForward,W)?e.projectToScreen(V,G):e.projectToScreen(H,G),G[1]}function ce(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(A.minimumHorizonPadding,A.relativeHorizonPadding*r)}function ue(e,t){return[de(e,t),fe(e,t)]}function de(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function fe(e,t){return Math.max(0,t-Q(e,t))}function pe(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function me(e){let{view:t}=e;return t.viewingMode===`global`?he(e):ge(e)}function he(e){let{view:t,originalScreenPoint:r,horizonY:i,horizonPadding:a,outTranslation:c,outGrabLocation:l,outGrabNormal:u,intersectionOptions:d,depthSearchSize:f}=e,m=t.state.camera,h=pe(c,l,u);q.radius=p(t.spatialReference).radius;let g=w(t,m,r,q.radius,1,d);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;n(J,g.scenePickPoint),n(h.location,J);let v=g.sphere;h.normal&&g.normal&&n(h.normal,g.normal);let y=ve(r,i,a,_),b=_?o(J,m.eye):1/0;return y.wasAdjusted&&ye({view:t,screenAdjustment:y,intersector:$(t),fallbackCheck:(e,t,n)=>{let r=T(v,m,e,t);return r&&n&&s(n,t),r},output:h,intersectionOptions:d}),xe({view:t,screenPoint:y.adjustedScreenPoint,camera:m,initialDistance:b,depthSearchSize:f??D,output:h}),!0}function ge(e){let{view:t,originalScreenPoint:r,horizonY:i,horizonPadding:a,outTranslation:c,outGrabLocation:l,outGrabNormal:d,intersectionOptions:f,depthSearchSize:p}=e,m=t.sceneIntersectionHelper,h=t.state.camera,_=$(t),v=pe(c,l,d);m.intersectIntersectorScreen(r,_,f);let y=_.results.min.getIntersectionPoint(J),b=y?o(J,h.eye):1/0;y&&(n(v.location,J),v.normal&&n(v.normal,_.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(h.eye,B),u(X,h.eye,B,-h.relativeElevation),g(X,B,Y);let x=ve(r,i,a,y);return x.wasAdjusted&&ye({view:t,screenAdjustment:x,intersector:_,fallbackCheck:(e,t,n)=>{let r=E(Y,h,e,t);return r&&n&&s(n,B),r},output:v,intersectionOptions:f}),xe({view:t,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??D,output:v}),!0}function _e(e,t,n,r){return!r&&ce(e,t)||r&&le(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ve(t,n,r,i){let a=_e(t[1],n,r,i);return{originalScreenPoint:t,adjustedScreenPoint:e(t[0],a??t[1]),horizonY:n,horizonPadding:r,wasAdjusted:a!==null}}function $(e){let t=new re(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function ye(e){let{view:t,screenAdjustment:r,fallbackCheck:i,intersector:a,output:o,intersectionOptions:s}=e,c=t.sceneIntersectionHelper;c.intersectIntersectorScreen(r.adjustedScreenPoint,a,{...s,requiresGroundFeedback:!0});let l=a.results.min.getIntersectionPoint(o.location);if(l){o.normal&&n(o.normal,a.results.min.normal);return}let u=be(r);c.intersectIntersectorScreen(u,a,{...s,requiresGroundFeedback:!0}),l=a.results.min.getIntersectionPoint(o.location),l?o.normal&&n(o.normal,a.results.min.normal):(l=i(r.adjustedScreenPoint,o.location,o.normal),l||i(u,o.location,o.normal))}function be(t){let{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:i,horizonPadding:a}=t,o=Z(r[1],i)?Math.min(a[1],n[1]):Math.max(a[0],n[1]);return e(r[0],o)}function xe(e){Se(e),Ce(e)}function Se(e){let{view:t,camera:r,output:a}=e,{offset:o}=t.navigation.mode;if(!o)return;let{translation:s,location:c}=a;t.renderCoordsHelper.worldUpAtPosition(r.eye,B),u(X,r.eye,B,-o),g(X,B,F),b(F,m(r.eye,i(j,c,r.eye)),X)&&(n(c,X),i(s,c,r.eye))}function Ce(e){let{view:t,screenPoint:n,camera:o,initialDistance:c,depthSearchSize:l,output:u}=e,f=l>0?t.stage.renderView.getMinimalDepthForArea(C(t),n[0],n[1],o,l):null;i(u.translation,u.location,o.eye);let p=Math.min(d(u.translation),c);f&&f<=p&&(p=f),s(u.translation,u.translation),r(u.translation,u.translation,p),a(u.location,u.translation,o.eye)}async function we(e,t,n,r,i){let a=new ne().copyFrom(e.state.camera);if(Te({view:e,camera:a,forwardDirection:t,forwardDistance:n,detectCollisions:!0}))return r?r.smoothlyCorrectGroundElevation({camera:a,deltaTime:i}):new O(e).immediatelyCorrectGroundElevation({camera:a,correctionLimit:100}),e.goTo(ee(e,a),{duration:500,liftOffDisabled:!0})}function Te(e){let{view:s,camera:c,forwardDirection:l,forwardDistance:u,detectCollisions:f}=e,p=s.navigation.mode;if(p.type!==`ground`)return!1;s.renderCoordsHelper.worldUpAtPosition(c.eye,B);let m=s.sceneIntersectionHelper,h=$(s),g=t(j,B,t(j,l,B));n(K.origin,c.eye),r(K.direction,g,u);let _=m.intersectRay(K,h,J,{include:p.include,exclude:p.exclude}),v=i(ae,c.center,c.eye);return!f||!_||o(J,c.eye)>Math.abs(u)?c.eye=a(j,K.origin,K.direction):(i(j,J,c.eye),d(j)>2&&(Ee(j,j,.25,2),c.eye=a(j,c.eye,j))),c.center=a(j,c.eye,v),!0}function Ee(e,t,n,i){let a=d(e),o=Math.min(n,Math.max(a-i,0)/a);r(t,e,o)}export{Te as advanceGroundNavigationCamera,Q as computeHorizonPadding,ue as computeHorizonPaddingLimits,me as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,se as findSphereHorizonY,we as groundNavigationAdvance,A as groundNavigationConstants,ce as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,le as shouldClampScreenY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{makeHandle as n}from"../../../core/handleUtils.js";import{removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{secondsFromMilliseconds as c}from"../../../core/time.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{newMemoryController as d}from"./MemoryController.js";import{ImmediateTask as f,newScheduler as p,TaskPriority as m}from"../../support/Scheduler.js";let h=class extends t{constructor(){super(...arguments),this.updating=!1}};e([l({readOnly:!0})],h.prototype,`updating`,void 0),h=e([u(`esri.views.3d.support.ResourceController.ResourceControllerMain`)],h);function g(e){return new v({view:e})}function _(e,t){return!t||e!==2?e:1}let v=class extends h{constructor(){super(...arguments),this._immediateTask=f,this._normalTask=f,this._updatingObjects=s([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=p(),this._memoryController=d(this.view),this.addHandles([a(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=o({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(m.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(m.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=r(this._frameTask),this._memoryController=i(this._memoryController),this._scheduler=i(this._scheduler),this.view=null}get updating(){return!!this._memoryController?.updating||!!this._immediateTask?.updating||!!this._normalTask?.updating||this._updatingObjects?.value.some(e=>e.updating)}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}addUpdatingObject(e){let t=this._updatingObjects;return t.value=[...t.value,e],n(()=>{t.value=t.value.filter(t=>t!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(c(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this.view.state&&(this._scheduler.state=_(this.view.state.mode,this.view.state.fading),this.view.state.fading=!1),this._scheduler.frame(e))}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}};e([l()],v.prototype,`view`,void 0),e([l()],v.prototype,`_scheduler`,void 0),e([l()],v.prototype,`_memoryController`,void 0),e([l()],v.prototype,`_immediateTask`,void 0),e([l()],v.prototype,`_normalTask`,void 0),e([l({readOnly:!0})],v.prototype,`updating`,null),v=e([u(`esri.views.3d.support.ResourceController`)],v);export{_ as applyFadingToSchedulerState,g as newResourceController};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{makeHandle as n}from"../../../core/handleUtils.js";import{removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{addFrameTask as o}from"../../../core/scheduling.js";import{signal as s}from"../../../core/signal.js";import{secondsFromMilliseconds as c}from"../../../core/time.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{debugFlags as d}from"./debugFlags.js";import{newMemoryController as f}from"./MemoryController.js";import{ImmediateTask as p,newScheduler as m,TaskPriority as h}from"../../support/Scheduler.js";let g=class extends t{constructor(){super(...arguments),this.updating=!1}};e([l({readOnly:!0})],g.prototype,`updating`,void 0),g=e([u(`esri.views.3d.support.ResourceController.ResourceControllerMain`)],g);function _(e){return new y({view:e})}function v(e,t){return!t||e!==2?e:1}let y=class extends g{constructor(){super(...arguments),this._immediateTask=p,this._normalTask=p,this._updatingObjects=s([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=m(),this._memoryController=f(this.view),this.addHandles([a(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=o({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(h.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(h.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=r(this._frameTask),this._memoryController=i(this._memoryController),this._scheduler=i(this._scheduler),this.view=null}get updating(){let e=!!this._memoryController?.updating||!!this._immediateTask?.updating||!!this._normalTask?.updating||this._updatingObjects?.value.some(e=>e.updating);return e&&d.UPDATING&&console.log(` ResourceController:`,!!this._memoryController?.updating,!!this._immediateTask?.updating,!!this._normalTask?.updating,this._updatingObjects?.value.some(e=>e.updating)),e}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}addUpdatingObject(e){let t=this._updatingObjects;return t.value=[...t.value,e],n(()=>{t.value=t.value.filter(t=>t!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(c(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this.view.state&&(this._scheduler.state=v(this.view.state.mode,this.view.state.fading),this.view.state.fading=!1),this._scheduler.frame(e))}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}};e([l()],y.prototype,`view`,void 0),e([l()],y.prototype,`_scheduler`,void 0),e([l()],y.prototype,`_memoryController`,void 0),e([l()],y.prototype,`_immediateTask`,void 0),e([l()],y.prototype,`_normalTask`,void 0),e([l({readOnly:!0})],y.prototype,`updating`,null),y=e([u(`esri.views.3d.support.ResourceController`)],y);export{v as applyFadingToSchedulerState,_ as newResourceController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/BlendLayers.glsl.js";
2
+ import"../webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/blendLayers.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{b as build}from"../../../chunks/BlendLayers.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js";import"../webgl-engine/core/shaderLibrary/raster/Common.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderModules/BooleanPassUniform.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/FloatsPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/IntegerPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{a as ColorizerHillshadeUniforms,b as ColorizerStretchUniforms,C as ColorizerUniforms,c as build}from"../../../chunks/RasterColorizer.glsl.js";
2
+ import"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js";import"../webgl-engine/core/shaderLibrary/raster/Common.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/blendLayers.glsl.js";import"../webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js";import"../webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import"../webgl-engine/core/shaderModules/BooleanPassUniform.js";import"../webgl-engine/core/shaderModules/Float2PassUniform.js";import"../webgl-engine/core/shaderModules/Float3PassUniform.js";import"../webgl-engine/core/shaderModules/FloatPassUniform.js";import"../webgl-engine/core/shaderModules/FloatsPassUniform.js";import"../webgl-engine/core/shaderModules/glsl.js";import"../webgl-engine/core/shaderModules/IntegerPassUniform.js";import"../webgl-engine/core/shaderModules/Texture2DPassUniform.js";import"../../webgl/ShaderBuilder.js";export{a as ColorizerHillshadeUniforms,b as ColorizerStretchUniforms,C as ColorizerUniforms,c as build}from"../../../chunks/RasterColorizer.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as n}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as i,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{subtract as c,set as l,dot as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as m,ZEROS as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as _}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as y}from"./OverlayRenderer.js";import{PatchRenderData as b}from"./PatchRenderData.js";import{TerrainAttributesCache as x}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{IteratorPreorder as w,fallsWithinLayerView as T,sortTiles as E,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as A}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as j}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as M,MeshIntersectionOptions as N,intersectTriangles as P}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as F}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as I,getVerticalOffsetTerrain as L}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as R}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as z}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as U}from"../../webgl/enums.js";const W=g();let G=class extends k{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return this._view.stage.viewingMode===1}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,i,a,o){super({}),this._surface=e,this._overlayRenderer=t,this._allTiles=i,this._compressionTracker=a,this.type=7,this.isGround=!0,this._passParameters=new B,this._drawParameters=new R,this._renderDataPool=new r(()=>new b),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new w,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=[],this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>this._desiredSlot===1],[7,()=>this._desiredSlot===7],[9,()=>this._produces()&&this.renderOccludedFlags===y]]),this._tileSize=256,this._configuration=new H(e.isGlobal),this._tileTextureCache=new n((e,t)=>o.newCache(e,t),`TileTexture`),this.tileGeometryCache=new x(o)}normalizeCtorArgs(){return{}}initialize(){this.addHandles(i(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),a))}destroy(){this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set(`renderingDisabled`,!!e),this.setDirty()}set visible(e){this._set(`visible`,!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange(`renderPatchBorders`))}get layerViewUid(){return I}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){let{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;let n=m(e.lij[2]&1?.5:0,e.lij[1]&1?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,n)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;let{layerInfo:n,surface:r}=t;for(let i=0;i<n[1].length;i++){let n=r.layerViewByIndex(i,1);if(T(e,n)!==T(t,n))return!1}return!0}updateTileTexture(e,t){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,t===32?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(let t of e.layerInfo[0])t.pendingUpdates&=-9;e.resetPendingUpdate(8);let t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){let t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){let t=Math.max(0,Math.floor((e.level-3)/7)*7);if(this._isGlobal&&t===0)return d;for(;e.parent&&e.level>t;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get(`wireframe`)!==e&&(this._set(`wireframe`,e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._surface,this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,n,r){let i=this._rootTiles;if(!i||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==0)return;let a=K,o=q;c(a,r,n),l(o,1/a[0],1/a[1],1/a[2]);let s=e.results.min,d=e.results.max,f=e.results.ground,p=e.options.store===0,m=!!e.results.ground.target,h=L(e.verticalOffset),g=e.tolerance,y,b=p&&s.distance!=null?s.distance:1/0,x=e.options,S=x.normalRequired||!x.backfacesTerrain,C=new N(g,!1,S),w=i=>{let l=i.renderData;if(!l?.vao)return;let m=l.geometry;_(W,m.boundingBox);let w=l.localOrigin;if(h!=null&&(h.localOrigin=w,h.applyToAabb(W)),J[0]=n[0]-w[0],J[1]=n[1]-w[1],J[2]=n[2]-w[2],!M(W,J,o,g,b))return;let T=(e,t,n,r)=>{e.set(this.type,i,t,n,r),b=p&&s.renderDistance!=null?s.renderDistance:1/0},E=(i,o,c)=>{(!S||c!=null)&&o>=0&&(x.backfacesTerrain||u(c,a)<0)&&(x.invisibleTerrain||!x.selectionMode||t==null||t(n,r,o))&&((f.renderDistance==null||o<f.renderDistance)&&T(f,i,o,c),x.isFiltered||(x.store===2&&(y==null?(y=new j(e.ray),T(y,i,o,c),e.results.all.push(y)):o<y.renderDistance&&T(y,i,o,c)),(s.renderDistance==null||o<s.renderDistance)&&T(s,i,o,c),x.store!==0&&(d.renderDistance==null||o>d.renderDistance)&&T(d,i,o,c)))},D=Y;c(D,r,w);let{indices:O,indexCount:k}=m,N=m.vertexAttributes,I=N.getField(`position`,v),L=new A(I.typedBuffer,3,N.stride/4),R=k/3;!h&&R>200?(l.intersectionData??=new F(O,R,L),l.intersectionData.intersectRay(J,D,C,E)):P(J,D,0,R,(e,t)=>I.getVec(O[t],e),h,C,E)},T=this._tileIterator;T.reset(i);let E=e.options.invisibleTerrain;for(let e=T.next();e;e=T.next())(e.visible||E&&e.intersectsClippingArea)&&(h!=null||e.intersectsRay(n,a,g,b))&&(!m||!this._useStencilForTile(e))?w(e):T.skipSubtree()}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(let t of this._visiblePatchesByOrigin.values())for(let n of t)n.renderData?.textureReference!=null&&e.queriesForTile(n);e.process(),t.madeProgress()}}get _view(){return this._surface.view}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){let{shadowMap:t,viewshedEnabled:n,cutFillComputationEnabled:r,slot:i,hasEmission:a,useFloatBlend:o}=e.bind,s=!!has(`enable-feature:terrain-shadows`)&&t.enabled;if(s!==this._castShadows&&(this._castShadows=s,this._patchesByOriginDirty=!0),this._inViewshed!==n&&(this._inViewshed=n,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),this.transparency===3)return null;if(i===9){if((e.renderOccludedMask&y)===0)return null}else if(i!==this._desiredSlot)return null;let c=this._configuration;switch(c.receiveGlobalIllumination=c.screenSpaceReflections=c.cloudReflections=c.receiveShadows=c.hasShadowHighlights=c.receiveAmbientOcclusion=c.renderOccluded=c.hasHighlightMixTexture=!1,c.hasEmission=a,c.overlayMode=this._overlayRenderer.mode,c.useFloatBlend=o.value,e.output){case 0:case 1:case 2:{let n=e.bind;c.screenSpaceReflections=n.hasScreenSpaceReflections,c.cloudReflections=n.clouds.data!=null;let r=i===9;return c.receiveShadows=t.ready&&!r,c.hasShadowHighlights=z(c,e.bind),c.renderOccluded=r,c.receiveAmbientOcclusion=!r&&n.ssao!=null,c.receiveGlobalIllumination=!r&&n.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return c.hasHighlightMixTexture=e.bind.highlightMixTexture!=null,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=O(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{let n=e.bind.highlight?.name;n&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(n)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;let t=this._tileRenderer,n;if(e!=null){let t=e.toUnitRGBA();n=f(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(n),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:t.backgroundColor==null?0:1,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){let e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(let n of e)E(n,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange(`visibleTiles`),this._patchSortingDirty=!1}}_rebuildPatchGroups(){let e=this._rootTiles;if(e!=null){e[0]?.surface.checkAllTilesWaterproofness(`render-patch-groups`),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(let t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){let t=this._tileIterator;for(t.resetOne(e);!t.done;){let e=t.next(),n=e.renderData;if(!n){this._numTilesCulled++;continue}let r=n.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let i=this._visiblePatchesByOrigin.get(r);i||(i=[],this._visiblePatchesByOrigin.set(r,i)),i.push(e),t.skipSubtree()}}_useStencilForTile(e){for(let t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,n){let{rctx:r,bind:i}=e;r.bindTechnique(t,i,this._passParameters);let a=this._stencilEnabledLayerExtents.length>0;n.forEach(n=>{this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters);for(let r=0;r<n.length;r++)this._renderPatch(e,t,n[r],U.TRIANGLES,a,this._passParameters.overlayContent===null)}),r.bindVAO(null)}_renderMaterialPass(e,t){let{rctx:n,bind:r}=e,i=n.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;let a=r.slot===9;a&&(i.bindTexture(`tex`,n.emptyTexture),i.setUniform3fv(`textureOpacities`,d),i.setUniform4fv(`texOffsetAndScale`,h));let o=this._tileRenderer?.backgroundColor==null?d:this._tileRenderer.backgroundColor;this._configuration.tileBlendInput===1&&i.setUniform3fv(`backgroundColor`,o);let s=this._stencilEnabledLayerExtents.length>0,c=this.wireframe?U.LINES:U.TRIANGLES;this._configuration.textureFadingEnabled&&i.bindTexture(`texNext`,n.emptyTexture);for(let n of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(let r of n){let n=r.renderData,o=n.textureReference;if(o!=null){if(!a){i.setUniform4fv(`texOffsetAndScale`,o.offsetAndScale),i.bindTexture(`tex`,o.texture.texture);let e=n.textureFadeFactor,t=e<1?n.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(i.setUniform1f(`fadeFactor`,e),i.setUniform4fv(`nextTexOffsetAndScale`,t.offsetAndScale),i.setUniform3fv(`nextTexOpacities`,t.opacities),i.bindTexture(`texNext`,t.texture.texture)):i.setUniform1f(`fadeFactor`,1),n.textureIsFading&&this.setNeedsRender(2),i.setUniform3fv(`textureOpacities`,o.opacities)}this._renderPatch(e,t,r,c,s),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}n.bindVAO(null)}_renderPatch(e,t,n,r,i,a=!1){let o=n.renderData,s=o.vao,c=s?.indexBuffer;if(!s||c==null){S&&console.error(`Rendered tile with no indices: `,n.lij,` : `,o);return}let l=t.program;!a&&!this._overlayRenderer.isEmpty&&this._bindOverlayPatchData(l,o.overlay);let{rctx:u,bind:d}=e;i&&(this._passParameters.useStencil=this._useStencilForTile(n),u.setPipelineState(t.getPipeline(d,this._passParameters)));let f=o.geometry.indexCount;u.bindVAO(s),l.assertCompatibleVertexAttributeLocations(s),u.drawElements(r,f,c.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv(`overlayTexOffset`,t.offsets),e.setUniform4fv(`overlayTexScale`,t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],G.prototype,`visibleTiles`,null),e([o({readOnly:!0})],G.prototype,`_isGlobal`,null),e([o()],G.prototype,`renderOccludedFlags`,null),e([o({value:!1})],G.prototype,`renderingDisabled`,null),e([o({value:!0})],G.prototype,`visible`,null),e([o()],G.prototype,`renderPatchBorders`,null),e([o()],G.prototype,`wireframe`,null),G=e([s(`esri.views.3d.terrain.TerrainRenderer`)],G);const K=p(),q=p(),J=p(),Y=p();export{G as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as n}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as i,sync as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import{subtract as c,set as l,dot as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as m,ZEROS as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as _}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as v}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as y}from"./OverlayRenderer.js";import{PatchRenderData as b}from"./PatchRenderData.js";import{TerrainAttributesCache as x}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as C}from"./TileRenderer.js";import{IteratorPreorder as w,fallsWithinLayerView as T,sortTiles as E,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as A}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as j}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as M,MeshIntersectionOptions as N,intersectTriangles as P}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as F}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as I,getVerticalOffsetTerrain as L}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as R}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as z}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as B}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as U}from"../../webgl/enums.js";const W=g();let G=class extends k{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return this._view.stage.viewingMode===1}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,i,a,o){super({}),this._surface=e,this._overlayRenderer=t,this._allTiles=i,this._compressionTracker=a,this.type=7,this.isGround=!0,this._passParameters=new B,this._drawParameters=new R,this._renderDataPool=new r(()=>new b),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new w,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=[],this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>this._desiredSlot===1],[7,()=>this._desiredSlot===7],[9,()=>this._produces()&&this.renderOccludedFlags===y]]),this._tileSize=256,this._configuration=new H(e.isGlobal),this._tileTextureCache=new n((e,t)=>o.newCache(e,t),`TileTexture`),this.tileGeometryCache=new x(o)}normalizeCtorArgs(){return{}}initialize(){this.addHandles(i(()=>this._overlayRenderer.renderOccludedFlags,()=>this.requestRender(),a))}destroy(){this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set(`renderingDisabled`,!!e),this.setDirty()}set visible(e){this._set(`visible`,!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.requestRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.requestRender(),this.notifyChange(`renderPatchBorders`))}get layerViewUid(){return I}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.requestRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.requestRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.requestRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){let{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;let n=m(e.lij[2]&1?.5:0,e.lij[1]&1?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,n)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;let{layerInfo:n,surface:r}=t;for(let i=0;i<n[1].length;i++){let n=r.layerViewByIndex(i,1);if(T(e,n)!==T(t,n))return!1}return!0}updateTileTexture(e,t){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,t===32?0:2),this.requestRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(let t of e.layerInfo[0])t.pendingUpdates&=-9;e.resetPendingUpdate(8);let t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){let t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){let t=Math.max(0,Math.floor((e.level-3)/7)*7);if(this._isGlobal&&t===0)return d;for(;e.parent&&e.level>t;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get(`wireframe`)!==e&&(this._set(`wireframe`,e),this.requestRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}requestRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new C(this._surface,this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,n,r){let i=this._rootTiles;if(!i||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==0)return;let a=K,o=q;c(a,r,n),l(o,1/a[0],1/a[1],1/a[2]);let s=e.results.min,d=e.results.max,f=e.results.ground,p=e.options.store===0,m=!!e.results.ground.target,h=L(e.verticalOffset),g=e.tolerance,y,b=p&&s.distance!=null?s.distance:1/0,x=e.options,S=x.normalRequired||!x.backfacesTerrain,C=new N(g,!1,S),w=i=>{let l=i.renderData;if(!l?.vao)return;let m=l.geometry;_(W,m.boundingBox);let w=l.localOrigin;if(h!=null&&(h.localOrigin=w,h.applyToAabb(W)),J[0]=n[0]-w[0],J[1]=n[1]-w[1],J[2]=n[2]-w[2],!M(W,J,o,g,b))return;let T=(e,t,n,r)=>{e.set(this.type,i,t,n,r),b=p&&s.renderDistance!=null?s.renderDistance:1/0},E=(i,o,c)=>{(!S||c!=null)&&o>=0&&(x.backfacesTerrain||u(c,a)<0)&&(x.invisibleTerrain||!x.selectionMode||t==null||t(n,r,o))&&((f.renderDistance==null||o<f.renderDistance)&&T(f,i,o,c),x.isFiltered||(x.store===2&&(y==null?(y=new j(e.ray),T(y,i,o,c),e.results.all.push(y)):o<y.renderDistance&&T(y,i,o,c)),(s.renderDistance==null||o<s.renderDistance)&&T(s,i,o,c),x.store!==0&&(d.renderDistance==null||o>d.renderDistance)&&T(d,i,o,c)))},D=Y;c(D,r,w);let{indices:O,indexCount:k}=m,N=m.vertexAttributes,I=N.getField(`position`,v),L=new A(I.typedBuffer,3,N.stride/4),R=k/3;!h&&R>200?(l.intersectionData??=new F(O,R,L),l.intersectionData.intersectRay(J,D,C,E)):P(J,D,0,R,(e,t)=>I.getVec(O[t],e),h,C,E)},T=this._tileIterator;T.reset(i);let E=e.options.invisibleTerrain;for(let e=T.next();e;e=T.next())(e.visible||E&&e.intersectsClippingArea)&&(h!=null||e.intersectsRay(n,a,g,b))&&(!m||!this._useStencilForTile(e))?w(e):T.skipSubtree()}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(let t of this._visiblePatchesByOrigin.values())for(let n of t)n.renderData?.textureReference!=null&&e.queriesForTile(n);e.process(),t.madeProgress()}}get _view(){return this._surface.view}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){let{shadowMap:t,viewshedEnabled:n,cutFillComputationEnabled:r,slot:i,hasEmission:a,useFloatBlend:o}=e.bind,s=!!has(`enable-feature:terrain-shadows`)&&t.enabled;if(s!==this._castShadows&&(this._castShadows=s,this._patchesByOriginDirty=!0),this._inViewshed!==n&&(this._inViewshed=n,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),this.transparency===3)return null;if(i===9){if((e.renderOccludedMask&y)===0)return null}else if(i!==this._desiredSlot)return null;let c=this._configuration;switch(c.receiveGlobalIllumination=c.screenSpaceReflections=c.cloudReflections=c.receiveShadows=c.hasShadowHighlights=c.receiveAmbientOcclusion=c.renderOccluded=c.hasHighlightMixTexture=!1,c.hasEmission=a,c.overlayMode=this._overlayRenderer.mode,c.useFloatBlend=o.value,e.output){case 0:case 1:case 2:{let n=e.bind;c.screenSpaceReflections=n.hasScreenSpaceReflections,c.cloudReflections=n.clouds.data!=null;let r=i===9;return c.receiveShadows=t.ready&&!r,c.hasShadowHighlights=z(c,e.bind),c.renderOccluded=r,c.receiveAmbientOcclusion=!r&&n.ssao!=null,c.receiveGlobalIllumination=!r&&n.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return c.hasHighlightMixTexture=e.bind.highlightMixTexture!=null,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=O(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{let n=e.bind.highlight?.name;n&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(n)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;let t=this._tileRenderer,n;if(e!=null){let t=e.toUnitRGBA();n=f(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(n),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:t.backgroundColor==null?0:1,this.requestRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){let e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(let n of e)E(n,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange(`visibleTiles`),this._patchSortingDirty=!1}}_rebuildPatchGroups(){let e=this._rootTiles;if(e!=null){e[0]?.surface.checkAllTilesWaterproofness(`render-patch-groups`),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(let t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){let t=this._tileIterator;for(t.resetOne(e);!t.done;){let e=t.next(),n=e.renderData;if(!n){this._numTilesCulled++;continue}let r=n.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let i=this._visiblePatchesByOrigin.get(r);i||(i=[],this._visiblePatchesByOrigin.set(r,i)),i.push(e),t.skipSubtree()}}_useStencilForTile(e){for(let t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,n){let{rctx:r,bind:i}=e;r.bindTechnique(t,i,this._passParameters);let a=this._stencilEnabledLayerExtents.length>0;n.forEach(n=>{this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters);for(let r=0;r<n.length;r++)this._renderPatch(e,t,n[r],U.TRIANGLES,a,this._passParameters.overlayContent===null)}),r.bindVAO(null)}_renderMaterialPass(e,t){let{rctx:n,bind:r}=e,i=n.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;let a=r.slot===9;a&&(i.bindTexture(`tex`,n.emptyTexture),i.setUniform3fv(`textureOpacities`,d),i.setUniform4fv(`texOffsetAndScale`,h));let o=this._tileRenderer?.backgroundColor==null?d:this._tileRenderer.backgroundColor;this._configuration.tileBlendInput===1&&i.setUniform3fv(`backgroundColor`,o);let s=this._stencilEnabledLayerExtents.length>0,c=this.wireframe?U.LINES:U.TRIANGLES;this._configuration.textureFadingEnabled&&i.bindTexture(`texNext`,n.emptyTexture);for(let n of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=n[0].renderData.localOrigin,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(let r of n){let n=r.renderData,o=n.textureReference;if(o!=null){if(!a){i.setUniform4fv(`texOffsetAndScale`,o.offsetAndScale),i.bindTexture(`tex`,o.texture.texture);let e=n.textureFadeFactor,t=e<1?n.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(i.setUniform1f(`fadeFactor`,e),i.setUniform4fv(`nextTexOffsetAndScale`,t.offsetAndScale),i.setUniform3fv(`nextTexOpacities`,t.opacities),i.bindTexture(`texNext`,t.texture.texture)):i.setUniform1f(`fadeFactor`,1),n.textureIsFading&&this.requestRender(2),i.setUniform3fv(`textureOpacities`,o.opacities)}this._renderPatch(e,t,r,c,s),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}n.bindVAO(null)}_renderPatch(e,t,n,r,i,a=!1){let o=n.renderData,s=o.vao,c=s?.indexBuffer;if(!s||c==null){S&&console.error(`Rendered tile with no indices: `,n.lij,` : `,o);return}let l=t.program;!a&&!this._overlayRenderer.isEmpty&&this._bindOverlayPatchData(l,o.overlay);let{rctx:u,bind:d}=e;i&&(this._passParameters.useStencil=this._useStencilForTile(n),u.setPipelineState(t.getPipeline(d,this._passParameters)));let f=o.geometry.indexCount;u.bindVAO(s),l.assertCompatibleVertexAttributeLocations(s),u.drawElements(r,f,c.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv(`overlayTexOffset`,t.offsets),e.setUniform4fv(`overlayTexScale`,t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],G.prototype,`visibleTiles`,null),e([o({readOnly:!0})],G.prototype,`_isGlobal`,null),e([o()],G.prototype,`renderOccludedFlags`,null),e([o({value:!1})],G.prototype,`renderingDisabled`,null),e([o({value:!0})],G.prototype,`visible`,null),e([o()],G.prototype,`renderPatchBorders`,null),e([o()],G.prototype,`wireframe`,null),G=e([s(`esri.views.3d.terrain.TerrainRenderer`)],G);const K=p(),q=p(),J=p(),Y=p();export{G as TerrainRenderer};