@arcgis/core 4.34.0-next.7 → 4.34.0-next.9

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 (363) hide show
  1. package/Map.js +1 -1
  2. package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
  3. package/applications/ExperienceBuilder/sketchUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{feaf79b69d2e2a1f2aa2.js → 06877ea5b9df7de89aff.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{44db659fd4e711f8e22f.js → 076f830d6d0337dfce9d.js} +1 -1
  7. package/assets/esri/core/workers/chunks/09907c9ff597df9bc954.js +1 -0
  8. package/assets/esri/core/workers/chunks/0dbb350ce651bc236ec8.js +1 -0
  9. package/assets/esri/core/workers/chunks/0ed4ec00ef16aa58a33d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{0624ae07d3af8d5f1ac8.js → 15b3eb60f86954783fab.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b845586219f284a215b2.js → 1db026cc25338dbc208e.js} +1 -1
  12. package/assets/esri/core/workers/chunks/21de4516bf5c9630edfd.js +1 -0
  13. package/assets/esri/core/workers/chunks/2254989ca3ff3960f2fe.js +1 -0
  14. package/assets/esri/core/workers/chunks/248a198f97871a8d6dd6.js +1 -0
  15. package/assets/esri/core/workers/chunks/2dbd18df5c691c8d0a61.js +1 -0
  16. package/assets/esri/core/workers/chunks/2e1ceff3f88a6c78dfa2.js +1 -0
  17. package/assets/esri/core/workers/chunks/{847e88e1d6da1e74cdc8.js → 2ecc1057d53e0b4a60b7.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3025e420e13e2bc8c0a1.js +1 -0
  19. package/assets/esri/core/workers/chunks/32537e2b014bc3d82f5c.js +346 -0
  20. package/assets/esri/core/workers/chunks/34f55bb89ddf26b10260.js +1 -0
  21. package/assets/esri/core/workers/chunks/355ab428a04ee9fcf888.js +1 -0
  22. package/assets/esri/core/workers/chunks/{28e31ac00dc95a1318e9.js → 3916879b9ca8c6979011.js} +1 -1
  23. package/assets/esri/core/workers/chunks/3a74654fa539f78ceb86.js +1 -0
  24. package/assets/esri/core/workers/chunks/3bec10a4f01757590c1c.js +1 -0
  25. package/assets/esri/core/workers/chunks/{a4c108e913d2dc0edc7b.js → 4088f4c25a09932a3eb1.js} +1 -1
  26. package/assets/esri/core/workers/chunks/427318722815bef1496b.js +1 -0
  27. package/assets/esri/core/workers/chunks/4c3bd6cc0badb78c7112.js +1 -0
  28. package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +1 -0
  29. package/assets/esri/core/workers/chunks/5222523fff30d07f88de.js +1 -0
  30. package/assets/esri/core/workers/chunks/{412eef58cb0d24826375.js → 52c34d6ecd9d45a33e69.js} +1 -1
  31. package/assets/esri/core/workers/chunks/539541dec5fcf3b657aa.js +1 -0
  32. package/assets/esri/core/workers/chunks/53e8c061f36516c3c3e4.js +1 -0
  33. package/assets/esri/core/workers/chunks/{ca76950d81ab4ebb65e1.js → 58f403f956b7b3467344.js} +1 -1
  34. package/assets/esri/core/workers/chunks/5a01bd7a9ee24be7bac4.js +1 -0
  35. package/assets/esri/core/workers/chunks/5bfcb3d87380e7f85b08.js +1 -0
  36. package/assets/esri/core/workers/chunks/5d3246b8fc50f9d9e2c4.js +1 -0
  37. package/assets/esri/core/workers/chunks/{4dd0a5f327fa5fc7249d.js → 5ef1095842e21090f1f4.js} +1 -1
  38. package/assets/esri/core/workers/chunks/614bc3f05873b37af091.js +1 -0
  39. package/assets/esri/core/workers/chunks/6194636638b0439fccd8.js +1 -0
  40. package/assets/esri/core/workers/chunks/66e4cb2479bed1384ed5.js +1 -0
  41. package/assets/esri/core/workers/chunks/6b0ae9ccdd1acef5b5b4.js +1 -0
  42. package/assets/esri/core/workers/chunks/7112b092d98172b7db8b.js +1 -0
  43. package/assets/esri/core/workers/chunks/72ea996b03932c0f004f.js +1 -0
  44. package/assets/esri/core/workers/chunks/74d18c22fa1c178bd9df.js +1 -0
  45. package/assets/esri/core/workers/chunks/766e08d0c56b2b31b63b.js +1 -0
  46. package/assets/esri/core/workers/chunks/77dbb1d5d5e1a6ced932.js +1 -0
  47. package/assets/esri/core/workers/chunks/{bd7b54db7fd278b15500.js → 7a2189614f2dad49ffcd.js} +1 -1
  48. package/assets/esri/core/workers/chunks/7ae88c141a5d85e5bb88.js +1 -0
  49. package/assets/esri/core/workers/chunks/7aef81778155be373d3e.js +1 -0
  50. package/assets/esri/core/workers/chunks/7e1906d35a764f7f10b0.js +1 -0
  51. package/assets/esri/core/workers/chunks/80777a9db53bee2ad8a8.js +1 -0
  52. package/assets/esri/core/workers/chunks/8249b5de5c15461a6787.js +1 -0
  53. package/assets/esri/core/workers/chunks/8385c13ac10e595374cb.js +1 -0
  54. package/assets/esri/core/workers/chunks/83db8bd42f94f97c7cf1.js +1 -0
  55. package/assets/esri/core/workers/chunks/87623ebe32c6ae9cb223.js +1 -0
  56. package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +1 -0
  57. package/assets/esri/core/workers/chunks/8b86c75426c55b29ebed.js +1 -0
  58. package/assets/esri/core/workers/chunks/8c4b26d86483646c70d2.js +1 -0
  59. package/assets/esri/core/workers/chunks/9cb242dfc3765b590f51.js +1 -0
  60. package/assets/esri/core/workers/chunks/9ddb0b07be31c3747238.js +1 -0
  61. package/assets/esri/core/workers/chunks/9f0f1472f36b42c507d1.js +1 -0
  62. package/assets/esri/core/workers/chunks/{f840e1655c4f6b6630be.js → 9f964467f7353039dd9c.js} +19 -19
  63. package/assets/esri/core/workers/chunks/9fe62638dc7dce466612.js +1 -0
  64. package/assets/esri/core/workers/chunks/a2e9141ff4efd13413a1.js +66 -0
  65. package/assets/esri/core/workers/chunks/adf6982e2d8102669cdf.js +1 -0
  66. package/assets/esri/core/workers/chunks/{d9b2263e0a9f9068ab62.js → b6c3a2d93a59df9a1418.js} +1 -1
  67. package/assets/esri/core/workers/chunks/b763292829aa4d3fab60.js +1 -0
  68. package/assets/esri/core/workers/chunks/ba015f4f72714820a12f.js +1 -0
  69. package/assets/esri/core/workers/chunks/bbbd58b02a3ee8fe595e.js +1 -0
  70. package/assets/esri/core/workers/chunks/c3d95f7f4370486eed2c.js +1 -0
  71. package/assets/esri/core/workers/chunks/c3df693d1bce8f189fa2.js +1 -0
  72. package/assets/esri/core/workers/chunks/{6993a59cbb78bc26f029.js → c45a314ace9725aa250e.js} +1 -1
  73. package/assets/esri/core/workers/chunks/c96fed4889712f5a9135.js +1 -0
  74. package/assets/esri/core/workers/chunks/c9fbada1e84981784f6c.js +1 -0
  75. package/assets/esri/core/workers/chunks/cefcecbeef4f0a46f58c.js +1 -0
  76. package/assets/esri/core/workers/chunks/d2317b87aa2ac3ad97a6.js +1 -0
  77. package/assets/esri/core/workers/chunks/{0bbb38f59f37c51c72f0.js → d45a4e5806a80b69ceec.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{7a23dc625a812a562c21.js → d5f770302dc686e55ba7.js} +1 -1
  79. package/assets/esri/core/workers/chunks/dc14507cfc052faa5890.js +1 -0
  80. package/assets/esri/core/workers/chunks/e7a440476cd1eb4c6547.js +1 -0
  81. package/assets/esri/core/workers/chunks/ede9738ac20e7dd5ce63.js +1 -0
  82. package/assets/esri/core/workers/chunks/eec034d88db320880133.js +1 -0
  83. package/assets/esri/core/workers/chunks/f1e87720b425d7fb348a.js +1 -0
  84. package/assets/esri/core/workers/chunks/f2863c501d62dece5fdd.js +1 -0
  85. package/assets/esri/core/workers/chunks/f5741d09fd4e1809f580.js +1 -0
  86. package/assets/esri/core/workers/chunks/f9e1b73976027e17cd03.js +1 -0
  87. package/assets/esri/core/workers/chunks/fd207a40faf882d3b2a3.js +1 -0
  88. package/assets/esri/core/workers/chunks/fe3832107278244dc04d.js +1 -0
  89. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  104. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  105. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  106. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  107. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  108. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  109. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  110. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  111. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  112. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  113. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  114. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  115. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  116. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  117. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  118. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  119. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  120. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  121. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  122. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  123. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  124. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  125. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  126. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  127. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  128. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  129. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  130. package/chunks/aiServices.js +1 -1
  131. package/config.js +1 -1
  132. package/core/workers/Connection.js +1 -1
  133. package/core/workers/RemoteClient.js +1 -1
  134. package/core/workers/WorkerHandle.js +1 -1
  135. package/effects/FocusArea.d.ts +4 -0
  136. package/effects/FocusArea.js +1 -1
  137. package/effects/FocusAreaOutline.d.ts +4 -0
  138. package/effects/FocusAreaOutline.js +1 -1
  139. package/effects/FocusAreas.d.ts +4 -0
  140. package/effects/FocusAreas.js +1 -1
  141. package/geometry.js +1 -1
  142. package/interfaces.d.ts +319 -43
  143. package/kernel.js +1 -1
  144. package/layers/BuildingSceneLayer.js +1 -1
  145. package/layers/GroupLayer.js +1 -1
  146. package/layers/ImageryLayer.js +1 -1
  147. package/layers/ImageryTileLayer.js +1 -1
  148. package/layers/VideoLayer.js +1 -1
  149. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  150. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  151. package/layers/graphics/editingSupport.js +1 -1
  152. package/layers/mixins/ImageryTileMixin.js +1 -1
  153. package/layers/mixins/operationalLayerModuleMap.js +1 -1
  154. package/layers/mixins/operationalLayers.js +1 -1
  155. package/layers/support/BuildingSummaryStatistics.js +1 -1
  156. package/layers/support/PromiseQueue.js +1 -1
  157. package/layers/support/TelemetryDisplay.js +1 -1
  158. package/layers/support/TitleCreator.js +1 -1
  159. package/layers/support/arcgisLayers.js +1 -1
  160. package/layers/support/featurePopupQueryUtils.js +5 -0
  161. package/layers/support/fieldUtils.js +1 -1
  162. package/layers/support/layersCreator.js +1 -1
  163. package/layers/support/multiLayerServiceUtils.js +5 -0
  164. package/networks/CircuitManager.js +1 -1
  165. package/networks/UnitIdentifierManager.js +1 -1
  166. package/networks/UtilityNetwork.js +1 -1
  167. package/networks/support/UNTraceConfiguration.js +1 -1
  168. package/networks/support/typeUtils.js +1 -1
  169. package/package.json +1 -1
  170. package/portal/PortalItem.js +1 -1
  171. package/portal/support/layersLoader.js +1 -1
  172. package/portal/support/portalLayers.js +1 -1
  173. package/rasterRenderers.js +1 -1
  174. package/renderers.js +1 -1
  175. package/rest/featureService/FeatureService.js +1 -1
  176. package/rest/locator/locationToAddress.js +1 -1
  177. package/rest/networks/circuits/queryCircuits.js +1 -1
  178. package/rest/networks/circuits/support/QueryCircuitsParameters.js +1 -1
  179. package/rest/networks/support/CircuitTraceResult.js +5 -0
  180. package/rest/networks/support/TraceResult.js +1 -1
  181. package/rest/networks/unitIdentifiers/support/{QueryUnitIdentifiersParamters.js → QueryUnitIdentifiersParameters.js} +1 -1
  182. package/rest/support/LocationToAddressParameters.js +1 -1
  183. package/rest/support/geocodeEnums.js +5 -0
  184. package/support/revision.js +1 -1
  185. package/symbols/cim/animationUtils.js +1 -1
  186. package/symbols/cim/cimAnalyzer.js +1 -1
  187. package/symbols/cim/defaultCIMValues.js +1 -1
  188. package/symbols/cim/effects/EffectEnclosingPolygon.js +1 -1
  189. package/symbols/cim/utils.js +1 -1
  190. package/symbols/support/cimSymbolUtils.js +1 -1
  191. package/symbols/support/previewCIMSymbol.js +1 -1
  192. package/symbols.js +1 -1
  193. package/views/2d/engine/webgl/animations/infos.js +1 -1
  194. package/views/2d/engine/webgl/animations/instructions.js +1 -1
  195. package/views/2d/engine/webgl/animations/utils.js +1 -1
  196. package/views/2d/engine/webgl/shaderGraph/techniques/GraphicInstanceStore.js +1 -1
  197. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js +1 -1
  198. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueType.js +1 -1
  199. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedPolyShader.js +5 -0
  200. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +5 -0
  201. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +5 -0
  202. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +5 -0
  203. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  204. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
  205. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +5 -0
  206. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  207. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechniques.js +5 -0
  208. package/views/2d/engine/webgl/shaderGraph/techniques/animated/ComputedAnimatedParams.js +5 -0
  209. package/views/2d/engine/webgl/shaderGraph/techniques/animated/attributes.js +5 -0
  210. package/views/2d/engine/webgl/shaderGraph/techniques/animated/enums.js +1 -1
  211. package/views/2d/engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js +1 -1
  212. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  213. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  214. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js +1 -1
  215. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
  216. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  217. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  218. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/utils.js +1 -1
  219. package/views/2d/layers/MediaLayerView2D.js +1 -1
  220. package/views/2d/layers/TileLayerView2D.js +1 -1
  221. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  222. package/views/2d/layers/features/schema/processor/symbols/utils.js +1 -1
  223. package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
  224. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  225. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  226. package/views/3d/layers/I3SMeshView3D.js +1 -1
  227. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  228. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  229. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  230. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  231. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  232. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  233. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  234. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  235. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  236. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  237. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  238. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  239. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  240. package/views/3d/terrain/OverlayRenderer.js +1 -1
  241. package/views/3d/terrain/TerrainRenderer.js +1 -1
  242. package/views/3d/terrain/TerrainSurface.js +1 -1
  243. package/views/3d/terrain/TileRenderer.js +1 -1
  244. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  245. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  246. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
  247. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  248. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  249. package/views/SelectionManager.js +1 -1
  250. package/views/VideoView.js +1 -1
  251. package/views/draw/support/GraphicMover.js +1 -1
  252. package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
  253. package/views/layers/FeatureLayerView.js +1 -1
  254. package/views/layers/ImageryLayerView.js +1 -1
  255. package/views/layers/ImageryTileLayerView.js +1 -1
  256. package/views/layers/PointCloudLayerView.js +1 -1
  257. package/views/support/TextureCompressionTracker.js +5 -0
  258. package/views/webgl/Texture.js +1 -1
  259. package/webdoc/support/writeUtils.js +1 -1
  260. package/webmap/utils.js +1 -1
  261. package/widgets/Attachments.js +1 -1
  262. package/widgets/BatchAttributeForm.js +1 -1
  263. package/widgets/Directions/DirectionsVisibleElements.js +1 -1
  264. package/widgets/Directions.js +1 -1
  265. package/widgets/Editor/AddAssociationWorkflowData.js +1 -1
  266. package/widgets/Editor/EditorViewModel.js +1 -1
  267. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  268. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  269. package/widgets/Editor/UpdateRecordWorkflowData.js +1 -1
  270. package/widgets/Editor/workflowUtils.js +1 -1
  271. package/widgets/Expand.js +1 -1
  272. package/widgets/Feature/support/featureUtils.js +1 -1
  273. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  274. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  275. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  276. package/widgets/FeatureForm.js +1 -1
  277. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  278. package/widgets/Features/FeaturesViewModel.js +1 -1
  279. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  280. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  281. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  282. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  283. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  284. package/widgets/OrientedImageryViewer/videoViewerUtils.js +5 -0
  285. package/widgets/OrientedImageryViewer.js +1 -1
  286. package/widgets/Search/LocatorSearchSource.js +1 -1
  287. package/widgets/Search/SearchSource.js +1 -1
  288. package/widgets/Search/SearchViewModel.js +1 -1
  289. package/widgets/Search/support/locatorUtils.js +1 -1
  290. package/widgets/Sketch.js +1 -1
  291. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  292. package/widgets/support/SelectionToolbar.js +1 -1
  293. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  294. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  295. package/assets/esri/core/workers/chunks/003ddb190a5cc56f7925.js +0 -1
  296. package/assets/esri/core/workers/chunks/03db109e9b695528c35d.js +0 -1
  297. package/assets/esri/core/workers/chunks/09da6b3085fc84cd69d5.js +0 -1
  298. package/assets/esri/core/workers/chunks/0a770f283eb77c8dc97a.js +0 -1
  299. package/assets/esri/core/workers/chunks/0b70b2ee62904318a12c.js +0 -1
  300. package/assets/esri/core/workers/chunks/0c2dccec20c0994366fe.js +0 -1
  301. package/assets/esri/core/workers/chunks/0d78fc2c2bc1152f84db.js +0 -1
  302. package/assets/esri/core/workers/chunks/0fb5de3f8a4d69b2d514.js +0 -1
  303. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +0 -1
  304. package/assets/esri/core/workers/chunks/1d7f2abfccc54659d6f2.js +0 -1
  305. package/assets/esri/core/workers/chunks/1f9c6fbcd4d0eae1e574.js +0 -1
  306. package/assets/esri/core/workers/chunks/22e53cb1c8c575fa4d46.js +0 -1
  307. package/assets/esri/core/workers/chunks/2cf82d3645c75d311e99.js +0 -1
  308. package/assets/esri/core/workers/chunks/2d90806faa4269828948.js +0 -1
  309. package/assets/esri/core/workers/chunks/377a7f0f7d304ff9fe5b.js +0 -1
  310. package/assets/esri/core/workers/chunks/3bf1cf6c3cba172e2f6d.js +0 -1
  311. package/assets/esri/core/workers/chunks/3d7eedb787c1e3b9fbfc.js +0 -1
  312. package/assets/esri/core/workers/chunks/3fe7be535affae31de7e.js +0 -1
  313. package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +0 -1
  314. package/assets/esri/core/workers/chunks/41cbba9b286cf5558a9c.js +0 -1
  315. package/assets/esri/core/workers/chunks/42bb9bb6fe44a47d9b81.js +0 -1
  316. package/assets/esri/core/workers/chunks/465f2db4ab8aa9c9f907.js +0 -1
  317. package/assets/esri/core/workers/chunks/4ca0738ed38c15b68a77.js +0 -1
  318. package/assets/esri/core/workers/chunks/515e3295495d0958db7e.js +0 -1
  319. package/assets/esri/core/workers/chunks/51ba7345c31e6eb79060.js +0 -1
  320. package/assets/esri/core/workers/chunks/5200be8bce60fa831026.js +0 -1
  321. package/assets/esri/core/workers/chunks/52a57106a41b8c9483d7.js +0 -1
  322. package/assets/esri/core/workers/chunks/536d7986ebb710a8a452.js +0 -1
  323. package/assets/esri/core/workers/chunks/5617532299f73d186968.js +0 -1
  324. package/assets/esri/core/workers/chunks/56d2a20c1b143697aa19.js +0 -1
  325. package/assets/esri/core/workers/chunks/5890740d5a761b038560.js +0 -1
  326. package/assets/esri/core/workers/chunks/5dbd8d81d94cfda5bb32.js +0 -1
  327. package/assets/esri/core/workers/chunks/5e1f7fe6bbc5754efee1.js +0 -1
  328. package/assets/esri/core/workers/chunks/61f9747c960d959b571b.js +0 -346
  329. package/assets/esri/core/workers/chunks/74182421ba425720dc7f.js +0 -1
  330. package/assets/esri/core/workers/chunks/74c0db9e3a62e9839b23.js +0 -1
  331. package/assets/esri/core/workers/chunks/7b12607633bbdc318936.js +0 -1
  332. package/assets/esri/core/workers/chunks/86023cc5ccbc7ac43479.js +0 -1
  333. package/assets/esri/core/workers/chunks/87eca6de502d18d8b7eb.js +0 -1
  334. package/assets/esri/core/workers/chunks/8aa8f9986b966ccb64e2.js +0 -1
  335. package/assets/esri/core/workers/chunks/8d14e957219364a81d5f.js +0 -66
  336. package/assets/esri/core/workers/chunks/937b653b10e8704b38bf.js +0 -1
  337. package/assets/esri/core/workers/chunks/98ef17d15517368d2383.js +0 -1
  338. package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +0 -1
  339. package/assets/esri/core/workers/chunks/a0c35521e677459f6fa3.js +0 -1
  340. package/assets/esri/core/workers/chunks/a32dcd5bc4680374d30c.js +0 -1
  341. package/assets/esri/core/workers/chunks/aaa6d45316a7d3466d0f.js +0 -1
  342. package/assets/esri/core/workers/chunks/ae733c963d61065faa54.js +0 -1
  343. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +0 -1
  344. package/assets/esri/core/workers/chunks/bf9b6b74654d303a6dae.js +0 -1
  345. package/assets/esri/core/workers/chunks/c6580fdcdc33153008b0.js +0 -1
  346. package/assets/esri/core/workers/chunks/c779335f5d5455c77a62.js +0 -1
  347. package/assets/esri/core/workers/chunks/c77cfd8790877393353a.js +0 -1
  348. package/assets/esri/core/workers/chunks/c9ab067b07d1eab974d1.js +0 -1
  349. package/assets/esri/core/workers/chunks/d3c0d7799c92c6f0e7d3.js +0 -1
  350. package/assets/esri/core/workers/chunks/d52f5214a0330ed2e05e.js +0 -1
  351. package/assets/esri/core/workers/chunks/dbe10c20df7e0e563a0b.js +0 -1
  352. package/assets/esri/core/workers/chunks/df7ca2fe12e22ccfde17.js +0 -1
  353. package/assets/esri/core/workers/chunks/df933eac03dc63064723.js +0 -1
  354. package/assets/esri/core/workers/chunks/e89345c7af9d3d4d8452.js +0 -1
  355. package/assets/esri/core/workers/chunks/ee6240636d04d7d37b7b.js +0 -1
  356. package/assets/esri/core/workers/chunks/ef7955a2509be0f03ca2.js +0 -1
  357. package/assets/esri/core/workers/chunks/f1c6df5cf2ccb6ac47a1.js +0 -1
  358. package/assets/esri/core/workers/chunks/f3d97a4c4f433adbdab5.js +0 -1
  359. package/assets/esri/core/workers/chunks/fc0a3db3d6d26c763fb9.js +0 -1
  360. package/assets/esri/core/workers/chunks/fd4c020297badcb81947.js +0 -1
  361. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerTechnique.js +0 -5
  362. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedShader.js +0 -5
  363. package/views/support/TextureCompressionHandle.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import p from"../../../core/PooledArray.js";import{throwIfAborted as u,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{i as S,c as w}from"../../../chunks/vec32.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/SpatialReference.js";import{getProjector as M}from"../../../geometry/projection/projectors.js";import{projectPointToVector as D}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as x}from"../../../geometry/projection/projectVectorToVector.js";import{create as U,equals as R,intersection as j,intersectsSphere as I,empty as A,expand as V}from"../../../geometry/support/aaBoundingRect.js";import{create as B,copy as k}from"../../../geometry/support/frustum.js";import{isPlateCarree as N}from"../../../geometry/support/spatialReferenceUtils.js";import{e as O,c as G,a as F}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{debugFlags as H}from"../support/debugFlags.js";import{ElevationRange as $}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Q}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as z}from"../support/extentUtils.js";import{ClientType as X}from"../support/index.js";import{updatingProgress as Y}from"../support/updatingProperties.js";import{ElevationBounds as K}from"./ElevationBounds.js";import{ElevationData as J,sampleElevation as Z}from"./ElevationData.js";import{create as ee}from"./ExtentHelper.js";import{TextureUpdate as te}from"./interfaces.js";import{LayerClass as ie,LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{RenderOrder as ne}from"./RenderOrder.js";import{ScaleRangeQueries as le}from"./ScaleRangeQueries.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{SplitLimits as he}from"./SplitLimits.js";import{maxRootTiles as de,tooManyRootTilesAfterChangeError as pe,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as ce,maxMemoryLodBias as ge}from"./TerrainConst.js";import{TerrainRenderer as _e}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,isVectorTileLayerView as ye,neighborEdgeIndices as Te,internalAssert as ve,oppositeEdge as Ee,isSurfaceLayerView as Se,isGroupLayerView as we,isMapTileLayerView as Ce,isBlendableLayerView as be,isElevationLayerView as Le,releaseTerrainData as Pe,enableTerrainInternalChecks as Me,oppositeCorner as De,enableWaterproofTests as xe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Re,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Ie,lijEquals as Ae}from"./Tile.js";import{printAllocations as Ve}from"./TilePerLayerInfo.js";import{TileUpdate as Be}from"./TileUpdate.js";import{IteratorPreorder as ke,IteratorPostorder as Ne,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Fe}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{TransparencyMode as We}from"./TransparencyMode.js";import{UpsampleInfo as He}from"./UpsampleInfo.js";import{isCompositeBlendMode as $e,blendModeFromString as Qe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as ze}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as Xe}from"../webgl-engine/lib/basicInterfaces.js";import{hasLayerBasedScaleVisibility as Ye}from"../../support/layerViewUtils.js";import{RenderState as Ke}from"../../support/RenderState.js";import{ImmediateTask as Je,TaskPriority as Ze,noBudget as et}from"../../support/Scheduler.js";import{TextureCompressionHandle as tt}from"../../support/TextureCompressionHandle.js";import{Yield as it}from"../../support/Yield.js";var rt;let st=class extends(a.EventedMixin(i)){static{rt=this}get allTiles(){return this._allTiles}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.compressionHandle=new tt,this._iteratorPool=new d(ke,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ne,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=C(),this._eyePosSurfaceSR=C(),this._splitLimits=new he,this._frustum=B(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new b,this._frameTask=Je,this._allTiles=new p,this._upsampleInfoPool=new d(He),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=U(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=P.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new K(1/0,-1/0),this.rootTileElevationBounds=new K(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1;const t=e.view;this.overlayManager=new se({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ae,this._ellipsoid=L(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.compressionHandle,t.resourceController.memoryController),Ye||(this._scaleRangeQueries=new le)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h(((e,t)=>i.newCache(e,t)),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new q(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_((()=>r.renderer.isEmpty),(()=>this._evaluateTransparency())),_((()=>this.renderer.visible),(e=>this.suspended=!e)),_((()=>this.heading),(e=>{this._renderer.updateHeading(e),this._updateTileTextures(te.FADING)})),_((()=>({heading:e.camera?.heading,state:e.state?.mode})),(({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(t===Ke.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?te.UNFADED:te.IMMEDIATE)}),m),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?te.UNFADED:te.IMMEDIATE)),m),_((()=>this.backgroundColor),((e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))}),f),_((()=>this.snapLevel),(()=>this._viewChanged=!0),f),_((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>this._allTilesSorted=!1))})),_((()=>H.TERRAIN_TILE_TREE_SHOW_TILES),(t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&H.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))})):t||(this._treeDebugger=o(this._treeDebugger))}),y)]);const{spatialReference:a}=e;this._extentHelper=ee(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(X.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(X.BASEMAP);const d=t.scheduler;this._frameTask=d.registerTask(Ze.TERRAIN_SURFACE,this),this.addHandles([_((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),y),_((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),f),_((()=>this.extent),(()=>this._updateRootTiles()),y),e.on("resize",(()=>this._viewChangeUpdate())),_((()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),m),_((()=>e.qualitySettings?.fadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),y),_((()=>e.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._renderer.pbrMode=e?ze.Simplified:ze.Disabled),y),_((()=>e.qualitySettings?.tiledSurface.elevationLevelDelta),(()=>this._updateAllTileGeometries())),_((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),f)]),this.addHandles(e.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}destroy(){this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),Ie.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroy(),this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Ve()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const i=U(),r=z(t,i,e)?i:null,s=this._get("extent");return R(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=j(this.groundExtent,this._userClippingExtent,U()),t=this._get("extent");return R(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.running||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.compressionHandle.compressing)}get running(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return null!=this._rootTiles}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===We.Opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length)return null;if(0===s[0].layerInfo[ie.ELEVATION].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=M(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=S(nt,e,t,i);a(l,0,l,0);return pt(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[ie.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,pt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getScale(e){if(!this.tilingScheme)return null;if(!D(e,nt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(nt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;nt[0]>t[2]&&(i+=1),nt[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=M(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,lt);const r=F(lt);i(r,0,r,0);const s=new $,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!I(i.extent,lt))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new $(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!D(e,F(lt),this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;lt[3]=t;let i=null;const r=e=>{if(e&&I(e.extent,lt)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?We.Invisible:We.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?We.Opaque:We.Transparent;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??P.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&N(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(rt._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=ot;let s=t.rootTilesInExtent(e,i,5*de);if(null!=this._rootTiles){if(s.length>de)return void n.getLogger(this).warn(pe);const e=this._rootTiles.map((e=>e.lij)),t=r(e,s,Ae);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ae(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(n.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map((e=>this._newRootTile(e))));R(i,this._rootTilesExtent)||(this._rootTilesExtent=U(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter((e=>e.loaded&&e.intersectsClippingArea));e.sort(Oe),e.forEach((e=>this._renderer.updateTileGeometryState(e))),e.forEach((e=>e.renderData.updateNeighborData())),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Oe);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e))),e.forEach((e=>this._pendingTilesForElevationUpdateEvent.add(e)))}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===Be.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(Be.SPLIT),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution")}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new K(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach((({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)}));const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new K(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=k(this._splitLimits.frustum??B(),t.frustum):this._splitLimits.frustum=null,k(this._frustum,e.frustum),w(this._eyePosRenderSR,t.eye),x(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor((e=>{this._layerViews[ie.MAP].some(ye)&&e.setPendingUpdate(Be.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Be.TEXTURE_FADING)?Be.TEXTURE_FADING:!!e.resetPendingUpdate(Be.TEXTURE_NOFADING)&&Be.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=ht.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>V(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),ht.spatialReference=this.spatialReference,this.emit("elevation-change",ht),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Me&&this._checkTileInvariant(),!e.hasProgressed)return it}_checkTileInvariant(){const e=new Map;this._allTiles.forAll((t=>e.set(t,new Set))),this._allTiles.forAll((t=>{if(fe(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce(((t,i)=>t+(e(i)?0:1)),0);if(fe(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(Be.MERGE)){fe(!t.hasPendingUpdate(Be.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)fe(e.leaf||e.hasPendingUpdate(Be.MERGE),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ce;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ce} (edge[${i}])`),fe(r,`tile level delta [${t.level}] vs [${e.level}] > ${ce}`))}fe(t.level-e.level<=ce,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ce,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(Te[i],s);if(null!=a){if(t.leaf&&t.level>=ce){let i=a;for(;t.level-i.level<ce;)i=i.parent;const s=[r,t.lij[1]>>ce,t.lij[2]>>ce];if(!Ae(s,i.lij)){const r=e.get(i);fe(!r.has(t),"Cannot already have neighbor"),r.add(t)}}fe(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),fe(t.level-a.level<=ce,`Tile level delta [${t.level}] vs [${a.level}] > ${ce}`)}}})),this._allTiles.forAll((t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);fe(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)}))}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new ut(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll((e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0}));const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(Be.MERGE),o=l?Be.MERGE:e.shouldSplit(r,s,i),h=o===Be.SPLIT;e.leaf?ct(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(Be.SPLIT),e.leaf||e.setPendingUpdate(Be.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT)):(e.resetPendingUpdate(Be.SPLIT)&&e.updateAgentSuspension(),o===Be.ELEVATION&&e.updateAgents(ie.ELEVATION),e.leaf||(e.setPendingUpdate(Be.MERGE),e.resetPendingUpdate(Be.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Fe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e){ve(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter((e=>e.loaded&&e.intersectsClippingArea));if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ve(r.loaded),ve(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=je[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(De(t),(e=>e.loaded)))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(Ee(Te[t]),(t=>!(!t.loaded||!t.intersectsClippingArea)&&(ve(e.has(t)||Oe(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Me&&xe&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some((s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(Be.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(Be.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(Be.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(Be.SPLIT)){let t=!0;const i=s.level;if(i>=ce){const e=e=>e.leaf||i-e.level<ce;for(let r=0;r<4;++r){const a=s.findNeighborTile(Te[r],e);null!=a&&i-a.level===ce&&(t=!1,Me&&(ve(a.leaf),ve(a.hasPendingUpdate(Be.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(Be.SPLIT)}return e.done}));if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some((t=>(t.resetPendingUpdate(Be.GEOMETRY)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done))),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done)))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(Xe.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?_t(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(rt._tileMemcacheKey,e),this.notifyChange("demResolution")}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){fe(e.leaf,"Tile that is already split should not be split again!"),fe(e.rendered,"Tile marked to split is not rendered"),_t(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),e.updateAgentSuspension(),fe(e.rendered,"parent should be rendered"),t.forEach((e=>this._loadTile(e))),t.forEach((e=>this._pendingTilesToUpdate.add(e))),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach((e=>ct(e,e.hasPendingUpdate(Be.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){dt.spatialReference=this.spatialReference,dt.extent=e.extent,dt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",dt)}createTile(e,t,i,r){fe(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(Be.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Ke.IDLE}_mergeTile(e){fe(!e.hasPendingUpdate(Be.SPLIT),"_mergeTile sanity check"),fe(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),fe(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ct(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=et){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Se(e)||we(e))if(this._basemapLayerViewHandles.has(e.uid)&&!we(e)){const i=this._layerClassFromLayerView(e),s=this._getLayerIdxByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Ce(e)&&!W(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||we(e))&&$e(Qe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Le(e)?ie.ELEVATION:ie.MAP}_registerTiledLayerView(e){const t=[];if((be(e)||we(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(te.UNFADED)}))),!we(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(te.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)})))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===ie.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ie.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ie.MAP),e===te.IMMEDIATE?this.renderer.updateTileTexture(t,Be.TEXTURE_NOFADING):t.updateRenderData(ie.MAP,e)})),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Xe.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,u(r),c(t)||this._dataMissing(e,i,s),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=t===ie.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ce(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer ${ie.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,ie.ELEVATION,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then((e=>this._frameTask.schedule((()=>r(e)))),s).finally((()=>--this._asyncWorkItems))}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[ie.ELEVATION].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",ie.ELEVATION,e.lij.toString());const s=new J(e.lij,e.extent,i);e.dataArrived(r,ie.ELEVATION,s);const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Pe(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer ${ie.MAP}/${t.uid} error ${r}`),this._dataMissing(e,ie.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),g(i)?Pe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));return t.fetchTile(e.lij,i).then(a,n).finally((()=>--this._asyncWorkItems))}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(ie.MAP,t.uid);if(null==r)return Pe(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,ie.MAP,i)}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i){const r=this._getLayerIdxByUID(t,i.uid);null!=r?e.dataMissing(r,t):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce(((e,t)=>e+t.usedMemory),0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return null!=r&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!xe)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Re(e)}};e([v()],st.prototype,"_renderer",void 0),e([v({constructOnly:!0})],st.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],st.prototype,"view",void 0),e([v({constructOnly:!0})],st.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],st.prototype,"compressionHandle",void 0),e([v()],st.prototype,"_hasPendingUpdates",void 0),e([v()],st.prototype,"_asyncWorkItems",void 0),e([v()],st.prototype,"_allTilesDirty",void 0),e([v()],st.prototype,"_allTilesSorted",void 0),e([v()],st.prototype,"_viewChanged",void 0),e([v({type:Number})],st.prototype,"heading",void 0),e([v()],st.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],st.prototype,"_watchUpdatingTracking",void 0),e([v()],st.prototype,"_frameTask",void 0),e([v()],st.prototype,"demResolution",null),e([v({readOnly:!0})],st.prototype,"snapLevel",null),e([v({readOnly:!0})],st.prototype,"lodSnappingEnabled",null),e([v()],st.prototype,"_userClippingExtent",null),e([v()],st.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],st.prototype,"extent",null),e([v({readOnly:!0})],st.prototype,"groundExtent",null),e([v({readOnly:!0})],st.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],st.prototype,"updating",null),e([v({readOnly:!0})],st.prototype,"running",null),e([v(Y)],st.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],st.prototype,"updatingProgressValue",null),e([v()],st.prototype,"_maxNumUpdating",void 0),e([v()],st.prototype,"baseOpacity",null),e([v()],st.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],st.prototype,"viewingMode",null),e([v()],st.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],st.prototype,"ready",null),e([v({value:ne.FRONT_TO_BACK})],st.prototype,"renderOrder",null),e([v({readOnly:!0})],st.prototype,"rootTiles",null),e([v()],st.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],st.prototype,"spatialReference",null),e([v({type:t})],st.prototype,"backgroundColor",null),e([v({value:!1})],st.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],st.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],st.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],st.prototype,"tilingSchemeLogic",void 0),e([v()],st.prototype,"wireframe",null),e([v({value:!1})],st.prototype,"suspended",null),e([v()],st.prototype,"fadeDuration",null),e([v()],st.prototype,"visibleElevationBounds",void 0),e([v()],st.prototype,"rootTileElevationBounds",void 0),e([v()],st.prototype,"_layerViewsDirty",void 0),e([v()],st.prototype,"renderPatchBorders",null),e([v()],st.prototype,"visualizeNormals",null),e([v()],st.prototype,"renderingDisabled",null),st=rt=e([E("esri.views.3d.terrain.TerrainSurface")],st);const at=st,nt=C(),lt=G(),ot=U();new p;const ht=new Q("ground"),dt={spatialReference:null,extent:null,scale:0};function pt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return Z(t,i,s)}return null}class ut{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function ct(e,t){!e.leaf||e.level<ce||ft(e,(e=>{t&&gt(e);const i=mt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=mt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function gt(e){if(e.hasPendingUpdate(Be.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(Be.MERGE);)t=t.parent;e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT),e.level<ce||ft(e,(e=>{gt(e)}))}function _t(e){e.level<ce||ft(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,mt(t));)t=t.parent}}))}function mt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ft(e,t){if(e.level<ce)return;const i=e.level-ce,r=e.lij[1]>>ce,s=e.lij[2]>>ce,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(Te[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{at as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import a from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import p from"../../../core/PooledArray.js";import{throwIfAborted as u,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{i as S,c as w}from"../../../chunks/vec32.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/SpatialReference.js";import{getProjector as M}from"../../../geometry/projection/projectors.js";import{projectPointToVector as x}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as U,equals as R,intersection as j,intersectsSphere as I,empty as A,expand as V}from"../../../geometry/support/aaBoundingRect.js";import{create as B,copy as k}from"../../../geometry/support/frustum.js";import{isPlateCarree as N}from"../../../geometry/support/spatialReferenceUtils.js";import{e as O,c as G,a as F}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{debugFlags as $}from"../support/debugFlags.js";import{ElevationRange as H}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Q}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as z}from"../support/extentUtils.js";import{ClientType as X}from"../support/index.js";import{updatingProgress as Y}from"../support/updatingProperties.js";import{ElevationBounds as K}from"./ElevationBounds.js";import{ElevationData as J,sampleElevation as Z}from"./ElevationData.js";import{create as ee}from"./ExtentHelper.js";import{TextureUpdate as te}from"./interfaces.js";import{LayerClass as ie,LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{RenderOrder as ne}from"./RenderOrder.js";import{ScaleRangeQueries as le}from"./ScaleRangeQueries.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{SplitLimits as he}from"./SplitLimits.js";import{maxRootTiles as de,tooManyRootTilesAfterChangeError as pe,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as ce,maxMemoryLodBias as ge}from"./TerrainConst.js";import{TerrainRenderer as _e}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as fe,isVectorTileLayerView as ye,neighborEdgeIndices as Te,internalAssert as ve,oppositeEdge as Ee,isSurfaceLayerView as Se,isGroupLayerView as we,isMapTileLayerView as Ce,isBlendableLayerView as be,isElevationLayerView as Le,releaseTerrainData as Pe,enableTerrainInternalChecks as Me,oppositeCorner as xe,enableWaterproofTests as De,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Re,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Ie,lijEquals as Ae}from"./Tile.js";import{printAllocations as Ve}from"./TilePerLayerInfo.js";import{TileUpdate as Be}from"./TileUpdate.js";import{IteratorPreorder as ke,IteratorPostorder as Ne,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Fe}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{TransparencyMode as We}from"./TransparencyMode.js";import{UpsampleInfo as $e}from"./UpsampleInfo.js";import{isCompositeBlendMode as He,blendModeFromString as Qe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as ze}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as Xe}from"../webgl-engine/lib/basicInterfaces.js";import{hasLayerBasedScaleVisibility as Ye}from"../../support/layerViewUtils.js";import{RenderState as Ke}from"../../support/RenderState.js";import{ImmediateTask as Je,TaskPriority as Ze,noBudget as et}from"../../support/Scheduler.js";import{TextureCompressionTracker as tt}from"../../support/TextureCompressionTracker.js";import{Yield as it}from"../../support/Yield.js";var rt;let st=class extends(a.EventedMixin(i)){static{rt=this}get allTiles(){return this._allTiles}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new tt,this._iteratorPool=new d(ke,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Ne,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new me,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=C(),this._eyePosSurfaceSR=C(),this._splitLimits=new he,this._frustum=B(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new b,this._frameTask=Je,this._allTiles=new p,this._upsampleInfoPool=new d($e),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=U(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=P.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new K(1/0,-1/0),this.rootTileElevationBounds=new K(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1;const t=e.view;this.overlayManager=new se({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ae,this._ellipsoid=L(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),Ye||(this._scaleRangeQueries=new le)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h(((e,t)=>i.newCache(e,t)),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new q(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([_((()=>r.renderer.isEmpty),(()=>this._evaluateTransparency())),_((()=>this.renderer.visible),(e=>this.suspended=!e)),_((()=>this.heading),(e=>{this._renderer.updateHeading(e),this._updateTileTextures(te.FADING)})),_((()=>({heading:e.camera?.heading,state:e.state?.mode})),(({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(t===Ke.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?te.UNFADED:te.IMMEDIATE)}),m),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?te.UNFADED:te.IMMEDIATE)),m),_((()=>this.backgroundColor),((e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))}),f),_((()=>this.snapLevel),(()=>this._viewChanged=!0),f),_((()=>this.view.pointsOfInterest),(e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add((()=>e.focus.renderLocation),(()=>this._allTilesSorted=!1))})),_((()=>$.TERRAIN_TILE_TREE_SHOW_TILES),(t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&$.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))})):t||(this._treeDebugger=o(this._treeDebugger))}),y)]);const{spatialReference:a}=e;this._extentHelper=ee(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(X.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(X.BASEMAP);const d=t.scheduler;this._frameTask=d.registerTask(Ze.TERRAIN_SURFACE,this),this.addHandles([_((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),y),_((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),f),_((()=>this.extent),(()=>this._updateRootTiles()),y),e.on("resize",(()=>this._viewChangeUpdate())),_((()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]}),(()=>this._viewChangeUpdate()),m),_((()=>e.qualitySettings?.fadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),y),_((()=>e.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._renderer.pbrMode=e?ze.Simplified:ze.Disabled),y),_((()=>e.qualitySettings?.tiledSurface.elevationLevelDelta),(()=>this._updateAllTileGeometries())),_((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),f)]),this.addHandles(e.allLayerViews.on("after-changes",(()=>this._layerViewsDirty=!0))),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}destroy(){this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),Ie.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroy(),this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Ve()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const i=U(),r=z(t,i,e)?i:null,s=this._get("extent");return R(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=j(this.groundExtent,this._userClippingExtent,U()),t=this._get("extent");return R(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.running||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get running(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return null!=this._rootTiles}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===We.Opaque}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length)return null;if(0===s[0].layerInfo[ie.ELEVATION].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=M(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=S(nt,e,t,i);a(l,0,l,0);return pt(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[ie.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,pt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getScale(e){if(!this.tilingScheme)return null;if(!x(e,nt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(nt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;nt[0]>t[2]&&(i+=1),nt[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=M(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,lt);const r=F(lt);i(r,0,r,0);const s=new H,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!I(i.extent,lt))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new H(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!x(e,F(lt),this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;lt[3]=t;let i=null;const r=e=>{if(e&&I(e.extent,lt)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?We.Invisible:We.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?We.Opaque:We.Transparent;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;fe(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??P.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&N(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(rt._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const i=ot;let s=t.rootTilesInExtent(e,i,5*de);if(null!=this._rootTiles){if(s.length>de)return void n.getLogger(this).warn(pe);const e=this._rootTiles.map((e=>e.lij)),t=r(e,s,Ae);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ae(t,e.lij)))>-1)||(this._purgeTile(e),!1)));t.added.forEach((t=>e.push(this._newRootTile(t)))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(n.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map((e=>this._newRootTile(e))));R(i,this._rootTilesExtent)||(this._rootTilesExtent=U(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter((e=>e.loaded&&e.intersectsClippingArea));e.sort(Oe),e.forEach((e=>this._renderer.updateTileGeometryState(e))),e.forEach((e=>e.renderData.updateNeighborData())),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Oe);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e))),e.forEach((e=>this._pendingTilesForElevationUpdateEvent.add(e)))}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===Be.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(Be.SPLIT),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution")}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(Be.GEOMETRY)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new K(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach((({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)}));const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new K(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=k(this._splitLimits.frustum??B(),t.frustum):this._splitLimits.frustum=null,k(this._frustum,e.frustum),w(this._eyePosRenderSR,t.eye),D(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor((e=>{this._layerViews[ie.MAP].some(ye)&&e.setPendingUpdate(Be.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Be.TEXTURE_FADING)?Be.TEXTURE_FADING:!!e.resetPendingUpdate(Be.TEXTURE_NOFADING)&&Be.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=ht.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>V(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),ht.spatialReference=this.spatialReference,this.emit("elevation-change",ht),this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Me&&this._checkTileInvariant(),!e.hasProgressed)return it}_checkTileInvariant(){const e=new Map;this._allTiles.forAll((t=>e.set(t,new Set))),this._allTiles.forAll((t=>{if(fe(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce(((t,i)=>t+(e(i)?0:1)),0);if(fe(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(Be.MERGE)){fe(!t.hasPendingUpdate(Be.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)fe(e.leaf||e.hasPendingUpdate(Be.MERGE),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ce;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ce} (edge[${i}])`),fe(r,`tile level delta [${t.level}] vs [${e.level}] > ${ce}`))}fe(t.level-e.level<=ce,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ce,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(Te[i],s);if(null!=a){if(t.leaf&&t.level>=ce){let i=a;for(;t.level-i.level<ce;)i=i.parent;const s=[r,t.lij[1]>>ce,t.lij[2]>>ce];if(!Ae(s,i.lij)){const r=e.get(i);fe(!r.has(t),"Cannot already have neighbor"),r.add(t)}}fe(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),fe(t.level-a.level<=ce,`Tile level delta [${t.level}] vs [${a.level}] > ${ce}`)}}})),this._allTiles.forAll((t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);fe(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)}))}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new ut(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll((e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0}));const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(Be.MERGE),o=l?Be.MERGE:e.shouldSplit(r,s,i),h=o===Be.SPLIT;e.leaf?ct(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(Be.SPLIT),e.leaf||e.setPendingUpdate(Be.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT)):(e.resetPendingUpdate(Be.SPLIT)&&e.updateAgentSuspension(),o===Be.ELEVATION&&e.updateAgents(ie.ELEVATION),e.leaf||(e.setPendingUpdate(Be.MERGE),e.resetPendingUpdate(Be.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Fe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e){ve(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter((e=>e.loaded&&e.intersectsClippingArea));if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ve(r.loaded),ve(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=je[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(xe(t),(e=>e.loaded)))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(Ee(Te[t]),(t=>!(!t.loaded||!t.intersectsClippingArea)&&(ve(e.has(t)||Oe(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Me&&De&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some((s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(Be.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(Be.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(Be.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(Be.SPLIT)){let t=!0;const i=s.level;if(i>=ce){const e=e=>e.leaf||i-e.level<ce;for(let r=0;r<4;++r){const a=s.findNeighborTile(Te[r],e);null!=a&&i-a.level===ce&&(t=!1,Me&&(ve(a.leaf),ve(a.hasPendingUpdate(Be.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(Be.SPLIT)}return e.done}));if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some((t=>(t.resetPendingUpdate(Be.GEOMETRY)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done))),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some((t=>(this._updateTileTexture(t,e),e.done)))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(Xe.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(this._rootTiles.forEach((e=>this._purgeTile(e))),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?_t(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(rt._tileMemcacheKey,e),this.notifyChange("demResolution")}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){fe(e.leaf,"Tile that is already split should not be split again!"),fe(e.rendered,"Tile marked to split is not rendered"),_t(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),e.updateAgentSuspension(),fe(e.rendered,"parent should be rendered"),t.forEach((e=>this._loadTile(e))),t.forEach((e=>this._pendingTilesToUpdate.add(e))),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach((e=>ct(e,e.hasPendingUpdate(Be.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){dt.spatialReference=this.spatialReference,dt.extent=e.extent,dt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",dt)}createTile(e,t,i,r){fe(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(Be.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Ke.IDLE}_mergeTile(e){fe(!e.hasPendingUpdate(Be.SPLIT),"_mergeTile sanity check"),fe(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),fe(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ct(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=et){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Se(e)||we(e))if(this._basemapLayerViewHandles.has(e.uid)&&!we(e)){const i=this._layerClassFromLayerView(e),s=this._getLayerIdxByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach(((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)})),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Ce(e)&&!W(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||we(e))&&He(Qe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Le(e)?ie.ELEVATION:ie.MAP}_registerTiledLayerView(e){const t=[];if((be(e)||we(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(te.UNFADED)}))),!we(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(te.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)})))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach((e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===ie.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),e===ie.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll((t=>{t.updateAgents(ie.MAP),e===te.IMMEDIATE?this.renderer.updateTileTexture(t,Be.TEXTURE_NOFADING):t.updateRenderData(ie.MAP,e)})),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll((i=>i.removeLayerAgent(e,t))),this._allTiles.forAll((i=>i.invalidateLayerData(e,t)))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=Xe.UPDATE){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||ye(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then((()=>--this._asyncWorkItems)).catch((t=>{throw--this._asyncWorkItems,u(r),c(t)||this._dataMissing(e,i,s),t})).then((()=>this._frameTask.schedule((()=>this._requestTileData(e,i,s,r)),r.signal))))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=t===ie.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ce(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer ${ie.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,ie.ELEVATION,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then((e=>this._frameTask.schedule((()=>r(e)))),s).finally((()=>--this._asyncWorkItems))}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[ie.ELEVATION].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",ie.ELEVATION,e.lij.toString());const s=new J(e.lij,e.extent,i);e.dataArrived(r,ie.ELEVATION,s);const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Pe(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer ${ie.MAP}/${t.uid} error ${r}`),this._dataMissing(e,ie.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),g(i)?Pe(r):this._mapTileDataArrived(e,t,r)}),i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule((()=>r(e,t)));return t.fetchTile(e.lij,i).then(a,n).finally((()=>--this._asyncWorkItems))}_mapTileDataArrived(e,t,i){const r=this._getLayerIdxByUID(ie.MAP,t.uid);if(null==r)return Pe(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,ie.MAP,i)}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i){const r=this._getLayerIdxByUID(t,i.uid);null!=r?e.dataMissing(r,t):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll((t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))})),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce(((e,t)=>e+t.usedMemory),0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this._getLayerIdxByUID(i,e.uid);return null!=r&&this._allTiles.forAll((e=>t+=e.getUsedMemoryForLayer(i,r))),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!De)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Re(e)}};e([v()],st.prototype,"_renderer",void 0),e([v({constructOnly:!0})],st.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],st.prototype,"view",void 0),e([v({constructOnly:!0})],st.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],st.prototype,"terrainTextureCompressionTracker",void 0),e([v()],st.prototype,"_hasPendingUpdates",void 0),e([v()],st.prototype,"_asyncWorkItems",void 0),e([v()],st.prototype,"_allTilesDirty",void 0),e([v()],st.prototype,"_allTilesSorted",void 0),e([v()],st.prototype,"_viewChanged",void 0),e([v({type:Number})],st.prototype,"heading",void 0),e([v()],st.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],st.prototype,"_watchUpdatingTracking",void 0),e([v()],st.prototype,"_frameTask",void 0),e([v()],st.prototype,"demResolution",null),e([v({readOnly:!0})],st.prototype,"snapLevel",null),e([v({readOnly:!0})],st.prototype,"lodSnappingEnabled",null),e([v()],st.prototype,"_userClippingExtent",null),e([v()],st.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],st.prototype,"extent",null),e([v({readOnly:!0})],st.prototype,"groundExtent",null),e([v({readOnly:!0})],st.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],st.prototype,"updating",null),e([v({readOnly:!0})],st.prototype,"running",null),e([v(Y)],st.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],st.prototype,"updatingProgressValue",null),e([v()],st.prototype,"_maxNumUpdating",void 0),e([v()],st.prototype,"baseOpacity",null),e([v()],st.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],st.prototype,"viewingMode",null),e([v()],st.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],st.prototype,"ready",null),e([v({value:ne.FRONT_TO_BACK})],st.prototype,"renderOrder",null),e([v({readOnly:!0})],st.prototype,"rootTiles",null),e([v()],st.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],st.prototype,"spatialReference",null),e([v({type:t})],st.prototype,"backgroundColor",null),e([v({value:!1})],st.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],st.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],st.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],st.prototype,"tilingSchemeLogic",void 0),e([v()],st.prototype,"wireframe",null),e([v({value:!1})],st.prototype,"suspended",null),e([v()],st.prototype,"fadeDuration",null),e([v()],st.prototype,"visibleElevationBounds",void 0),e([v()],st.prototype,"rootTileElevationBounds",void 0),e([v()],st.prototype,"_layerViewsDirty",void 0),e([v()],st.prototype,"renderPatchBorders",null),e([v()],st.prototype,"visualizeNormals",null),e([v()],st.prototype,"renderingDisabled",null),st=rt=e([E("esri.views.3d.terrain.TerrainSurface")],st);const at=st,nt=C(),lt=G(),ot=U();new p;const ht=new Q("ground"),dt={spatialReference:null,extent:null,scale:0};function pt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return Z(t,i,s)}return null}class ut{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function ct(e,t){!e.leaf||e.level<ce||ft(e,(e=>{t&&gt(e);const i=mt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=mt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function gt(e){if(e.hasPendingUpdate(Be.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(Be.MERGE);)t=t.parent;e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT),e.level<ce||ft(e,(e=>{gt(e)}))}function _t(e){e.level<ce||ft(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,mt(t));)t=t.parent}}))}function mt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ft(e,t){if(e.level<ce)return;const i=e.level-ce,r=e.lij[1]>>ce,s=e.lij[2]>>ce,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(Te[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{at as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as o}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as a,isGroupLayer as n,isReferenceLayer as u}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as c}from"../support/flowUtils.js";import{BlendLayersPassParameters as l}from"./BlendLayersTechnique.js";import{TextureUpdate as p}from"./interfaces.js";import{LayerClass as d}from"./LayerClass.js";import{NeighborIndex as m}from"./NeighborIndex.js";import{isImageWithType as h}from"./TerrainData.js";import{isBlendableLayerView as f,isVectorTileLayerView as _,isVectorTileRenderInfo as T,isImageryTileRenderInfo as x,isImageSourceRenderInfo as y,isTextureTileRenderInfo as b,isVectorTilePerLayerInfo as g}from"./terrainUtils.js";import{ActivationTime as I}from"./TextureFader.js";import{TextureReference as w}from"./TextureReference.js";import{TileCompositor as A}from"./TileCompositor.js";import{TileRenderInfo as P}from"./TileRenderInfo.js";import{TileTexture as k,getCacheKey as E}from"./TileTexture.js";import{TileUpdate as O}from"./TileUpdate.js";import{fallsWithinLayerView as j}from"./tileUtils.js";import{blendModeFromString as M}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as C}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as L}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as R}from"../../support/TextureCompressionWorkerHandle.js";import{TextureSamplingMode as N,TextureWrapMode as D,PixelFormat as B}from"../../webgl/enums.js";import{Texture as U}from"../../webgl/Texture.js";import{TextureDescriptor as S}from"../../webgl/TextureDescriptor.js";class G{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}class F{constructor(e,t,r,s,o){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionHandle=o,this._passParameters=new l,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new A(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,l=this.tileSize,m=!1,h=!1;const T=r.view.state.contentPixelRatio;let x=!1;V.clear(),X.length=0;const y=e.layerInfo[d.MAP];let b=0,g=null;for(;b<y.length;b++){const t=r.layerViewByIndex(b,d.MAP),p=t.layer,I=!j(e,t),w=p.opacity,A=t.fullOpacity;if(h=h||a(p),c(t))continue;if(f(t)){let e="normal"!==t.layer.blendMode;if(n(p.parent)){const t=p.parent.uid;null!=t&&""!==t&&(e=q(p.parent)||e)}e&&(x=e,m=!1)}if((I||0===w)&&!x){y[b].pendingUpdates&=~(O.TEXTURE_NOFADING&O.TEXTURE_FADING);continue}++i;const P=_(t),k=H(e,b,P);if(k){if(y[b].pendingUpdates&=~(O.TEXTURE_NOFADING&O.TEXTURE_FADING),n(p.parent)){const e=p.parent.uid;null!=e&&""!==e&&z(p.parent,b)}P?l=Math.max(l,this.tileSize*T):1===s&&1===A&&(t.isOpaque||this._dataToTexture(k,u(p))&&k.sourceLayerInfo.data.descriptor.isOpaque)&&(m=!0),++o,null===g&&(g=b)}}const I=l/this.tileSize;0!==o&&null!==g?1===o&&!x&&this._useLayerTexture(e,g)||this._composeLayers(e,t,b-1,h,l,I,!m||x,V,x):this._useBackgroundTexture(e,i,t!==p.FADING)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundTexture&&this._drawBackgroundTexture(this._backgroundTexture))}_ensureBackgroundTexture(){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._backgroundTexture)),this._backgroundTexture}_drawBackgroundTexture(e){this._compositor.bind(this.tileSize),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,r){const s=e.renderData,o=!r&&null!=s.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?I.Delayed:I.Immediate,i=this._ensureBackgroundTexture();s.setTextureReference(new w(i,p.FADING,J,e.surface.baseOpacity,0,1),o)}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,d.MAP),s=a(r.layer),o=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,c=r.fullOpacity,l=H(e,t,!1);return!!this._dataToTexture(l,u(r.layer))&&(e.renderData.setTextureReference(new w(l.sourceLayerInfo.data,p.FADING,i(l.offset[0],l.offset[1],l.scale,l.scale),o,n,c)),!0)}_composeLayers(e,t,r,s,i,n,c,l,p){this._compositor.ensureBuffer(i);const m=e.surface.baseOpacity;let h=!1,y=N.LINEAR_MIPMAP_LINEAR,b=!1,g=0;for(let w=r;w>=0;w--){const t=e.surface.layerViewByIndex(w,d.MAP),r=t.layer,I=_(t),A=H(e,w,I),P=r.opacity,k=!j(e,t);if(!A||(0===P||k)&&!p)continue;const E=!a(r)&&!h;E&&(h=!0);let O=!1;l.forEach((e=>{e.start===w&&(e.output=s?C.Composite:c&&E?this.backgroundIsGrid?C.GridComposite:C.ColorComposite:C.Composite,e.baseOpacity=E?m:1,X.push(e),this._compositor.openGroup(i),O=!0)}));const L=0===g,R=O?C.GroupBackgroundComposite:c&&L?this.backgroundIsGrid?C.GridComposite:C.ColorComposite:C.Composite,D=M[f(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=E&&!O&&m<1?m:1,this._passParameters.opacity=P,T(A)?b=this._compositor.drawVectorData(this._passParameters,R,i,D,A,n,this.tileSize,b):x(A)?(this._compositor.drawRasterData(this._passParameters,R,i,D,A),v(A)&&(y=N.NEAREST)):this._dataToTexture(A,u(r))&&(this._passParameters.texture=A.sourceLayerInfo.data.texture,this._passParameters.offset=A.offset,this._passParameters.scale=A.scale,this._compositor.drawImageData(this._passParameters,R,i,D));X.length>0&&X[X.length-1].end===w;){const e=X.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,i,M[e.blendMode])}g++}const I=e.renderData,A=p||h&&m<1,P=I.ensureTexture(i,A,t,(()=>this._buildTexture(i,A,y)));this._compositor.copyFBOToTexture(P),this._compositor.unbind(),I.setTextureReference(new w(P,t,J,h?1:m,0,1))}_dataToTexture(e,t){if(y(e)){const r=e.sourceLayerInfo,s=1===e.scale&&!t;r.data=this._buildTexture(r.data,!0,s,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return b(e)}_buildTexture(e,t,r=N.LINEAR_MIPMAP_LINEAR,s=()=>{}){if(null==e)return null;const o=new S;o.wrapMode=D.CLAMP_TO_EDGE,o.samplingMode="boolean"==typeof r?N.LINEAR_MIPMAP_LINEAR:r,o.maxAnisotropy=this._maxAnisotropy,o.preMultiplyAlpha=!0,o.flipped=!0,o.hasMipmap=!0,t||(o.pixelFormat=B.RGB);const i=this._rctx,a="boolean"==typeof r&&r;let n;if("number"==typeof e)o.width=o.height=e,n=this._buildTileTexture(o);else if(h(e))o.isOpaque=e.isOpaque,o.isOpaque&&(o.pixelFormat=B.RGB),o.width=e.element.width,o.height=e.element.height,n=this._buildTileTexture(o,a,s,e.element);else try{o.width=e.width,o.height=e.height,n=this._buildTileTexture(o,a,s,e)}catch(c){n=new k(L(i)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const u=i.bindTexture(n.texture,U.TEXTURE_UNIT_FOR_UPDATES);return n.generateMipmap(),i.bindTexture(u,U.TEXTURE_UNIT_FOR_UPDATES),n}_buildTileTexture(e,t=!1,r=()=>{},s){const o=this._cache.pop(E(e,!1))??this._cache.pop(E(e,!0));if(t&&=R(s,e),o)return o.retain(),t?o.texture.enableCompression(this._compressionHandle,r):o.texture.disableCompression(),o.texture.setData(s),o;e.compressionHandle=t?this._compressionHandle:null,e.compressionCallback=r;const i=new U(this._rctx,e,s);return new k(i,this._cache)}get test(){}}function H(e,t,o){W.layerIndex=t,W.vtlNeighborInfos.clear();const i=e.layerInfo[d.MAP][t];if(r(W.offset,0,0),W.tile=e,W.scale=1,W.sourceLod=e.lij,W.sourceLayerInfo=i,W.isVTLBackground=o,i.data)return o&&e.forEachLoadedNeighbor(((r,s)=>{if(r.level!==e.level)return;const o=r.layerInfo[d.MAP][t];if(!g(o)||i.data===o.data)return;const a=W.vtlNeighborInfos.pushNew();a.offset=K[s],a.sourceLod=r.lij,a.sourceLayerInfo=o})),W;const a=i.upsampleInfo,n=a?.tile?.layerInfo[d.MAP][t];return n&&a.tile?(W.tile=a.tile,s(W.offset,a.offset),W.scale=a.scale,W.sourceLod=a.tile.lij,W.sourceLayerInfo=n,W):o?W:null}function v(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function q(e){let t="normal"!==e.blendMode;return n(e.parent)&&(t=q(e.parent)||t),t}function z(e,t){n(e.parent)&&z(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=V.get(r);s?s.start=t:V.set(r,new G(t,t,e.blendMode,e.opacity,C.Composite,1))}}const V=new Map,X=new Array,W=new P,J=i(0,0,1,1),K=new Array;K[m.NORTH]=[0,-1],K[m.NORTH_EAST]=[-1,-1],K[m.EAST]=[-1,0],K[m.SOUTH_EAST]=[-1,1],K[m.SOUTH]=[0,1],K[m.SOUTH_WEST]=[1,1],K[m.WEST]=[1,0],K[m.NORTH_WEST]=[1,-1];export{G as GroupInfo,F as TileRenderer};
5
+ import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as r,copy as s}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as o}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as a,isGroupLayer as n,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as u}from"../support/flowUtils.js";import{BlendLayersPassParameters as l}from"./BlendLayersTechnique.js";import{TextureUpdate as p}from"./interfaces.js";import{LayerClass as m}from"./LayerClass.js";import{NeighborIndex as d}from"./NeighborIndex.js";import{isImageWithType as h}from"./TerrainData.js";import{isBlendableLayerView as f,isVectorTileLayerView as _,isVectorTileRenderInfo as T,isImageryTileRenderInfo as x,isImageSourceRenderInfo as b,isTextureTileRenderInfo as y,isVectorTilePerLayerInfo as g}from"./terrainUtils.js";import{ActivationTime as I}from"./TextureFader.js";import{TextureReference as w}from"./TextureReference.js";import{TileCompositor as k}from"./TileCompositor.js";import{TileRenderInfo as A}from"./TileRenderInfo.js";import{TileTexture as P,getCacheKey as E}from"./TileTexture.js";import{TileUpdate as O}from"./TileUpdate.js";import{fallsWithinLayerView as j}from"./tileUtils.js";import{blendModeFromString as C}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as M}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as L}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as R}from"../../support/TextureCompressionWorkerHandle.js";import{TextureSamplingMode as N,TextureWrapMode as D,PixelFormat as B}from"../../webgl/enums.js";import{Texture as U}from"../../webgl/Texture.js";import{TextureDescriptor as S}from"../../webgl/TextureDescriptor.js";class G{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}class F{constructor(e,t,r,s,o){this._rctx=e,this.tileSize=t,this._techniques=r,this._cache=s,this._compressionTracker=o,this._passParameters=new l,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new k(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._backgroundTexture=t(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,l=this.tileSize,d=!1,h=!1;const T=r.view.state.contentPixelRatio;let x=!1;V.clear(),X.length=0;const b=e.layerInfo[m.MAP];let y=0,g=null;for(;y<b.length;y++){const t=r.layerViewByIndex(y,m.MAP),p=t.layer,I=!j(e,t),w=p.opacity,k=t.fullOpacity;if(h=h||a(p),u(t))continue;if(f(t)){let e="normal"!==t.layer.blendMode;if(n(p.parent)){const t=p.parent.uid;null!=t&&""!==t&&(e=q(p.parent)||e)}e&&(x=e,d=!1)}if((I||0===w)&&!x){b[y].pendingUpdates&=~(O.TEXTURE_NOFADING&O.TEXTURE_FADING);continue}++i;const A=_(t),P=v(e,y,A);if(P){if(b[y].pendingUpdates&=~(O.TEXTURE_NOFADING&O.TEXTURE_FADING),n(p.parent)){const e=p.parent.uid;null!=e&&""!==e&&z(p.parent,y)}A?l=Math.max(l,this.tileSize*T):1===s&&1===k&&(t.isOpaque||this._dataToTexture(P,c(p))&&P.sourceLayerInfo.data.descriptor.isOpaque)&&(d=!0),++o,null===g&&(g=y)}}const I=l/this.tileSize;0!==o&&null!==g?1===o&&!x&&this._useLayerTexture(e,g)||this._composeLayers(e,t,y-1,h,l,I,!d||x,V,x):this._useBackgroundTexture(e,i,t!==p.FADING)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundTexture&&this._drawBackgroundTexture(this._backgroundTexture))}_ensureBackgroundTexture(){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._backgroundTexture)),this._backgroundTexture}_drawBackgroundTexture(e){this._compositor.bind(this.tileSize),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,r){const s=e.renderData,o=!r&&null!=s.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?I.Delayed:I.Immediate,i=this._ensureBackgroundTexture();s.setTextureReference(new w(i,p.FADING,J,e.surface.baseOpacity,0,1),o)}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,m.MAP),s=a(r.layer),o=s?e.surface.baseOpacity:1,n=s?1:e.surface.baseOpacity,u=r.fullOpacity,l=v(e,t,!1);return!!this._dataToTexture(l,c(r.layer))&&(e.renderData.setTextureReference(new w(l.sourceLayerInfo.data,p.FADING,i(l.offset[0],l.offset[1],l.scale,l.scale),o,n,u)),!0)}_composeLayers(e,t,r,s,i,n,u,l,p){this._compositor.ensureBuffer(i);const d=e.surface.baseOpacity;let h=!1,b=N.LINEAR_MIPMAP_LINEAR,y=!1,g=0;for(let w=r;w>=0;w--){const t=e.surface.layerViewByIndex(w,m.MAP),r=t.layer,I=_(t),k=v(e,w,I),A=r.opacity,P=!j(e,t);if(!k||(0===A||P)&&!p)continue;const E=!a(r)&&!h;E&&(h=!0);let O=!1;l.forEach((e=>{e.start===w&&(e.output=s?M.Composite:u&&E?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=E?d:1,X.push(e),this._compositor.openGroup(i),O=!0)}));const L=0===g,R=O?M.GroupBackgroundComposite:u&&L?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,D=C[f(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=E&&!O&&d<1?d:1,this._passParameters.opacity=A,T(k)?y=this._compositor.drawVectorData(this._passParameters,R,i,D,k,n,this.tileSize,y):x(k)?(this._compositor.drawRasterData(this._passParameters,R,i,D,k),H(k)&&(b=N.NEAREST)):this._dataToTexture(k,c(r))&&(this._passParameters.texture=k.sourceLayerInfo.data.texture,this._passParameters.offset=k.offset,this._passParameters.scale=k.scale,this._compositor.drawImageData(this._passParameters,R,i,D));X.length>0&&X[X.length-1].end===w;){const e=X.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,i,C[e.blendMode])}g++}const I=e.renderData,k=p||h&&d<1,A=I.ensureTexture(i,k,t,(()=>this._buildTexture(i,k,b)));this._compositor.copyFBOToTexture(A),this._compositor.unbind(),I.setTextureReference(new w(A,t,J,h?1:d,0,1))}_dataToTexture(e,t){if(b(e)){const r=e.sourceLayerInfo,s=1===e.scale&&!t;r.data=this._buildTexture(r.data,!0,s,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return y(e)}_buildTexture(e,t,r=N.LINEAR_MIPMAP_LINEAR,s=()=>{}){if(null==e)return null;const o=new S;o.wrapMode=D.CLAMP_TO_EDGE,o.samplingMode="boolean"==typeof r?N.LINEAR_MIPMAP_LINEAR:r,o.maxAnisotropy=this._maxAnisotropy,o.preMultiplyAlpha=!0,o.flipped=!0,o.hasMipmap=!0,t||(o.pixelFormat=B.RGB);const i=this._rctx,a="boolean"==typeof r&&r;let n;if("number"==typeof e)o.width=o.height=e,n=this._buildTileTexture(o);else if(h(e))o.isOpaque=e.isOpaque,o.isOpaque&&(o.pixelFormat=B.RGB),o.width=e.element.width,o.height=e.element.height,n=this._buildTileTexture(o,a,s,e.element);else try{o.width=e.width,o.height=e.height,n=this._buildTileTexture(o,a,s,e)}catch(u){n=new P(L(i)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const c=i.bindTexture(n.texture,U.TEXTURE_UNIT_FOR_UPDATES);return n.generateMipmap(),i.bindTexture(c,U.TEXTURE_UNIT_FOR_UPDATES),n}_buildTileTexture(e,t=!1,r=()=>{},s){const o=this._cache.pop(E(e,!1))??this._cache.pop(E(e,!0));if(t&&=R(s,e),o)return o.retain(),t?o.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:r}):o.texture.disableCompression(),o.texture.setData(s),o;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:r}:void 0;const i=new U(this._rctx,e,s);return new P(i,this._cache)}get test(){}}function v(e,t,o){W.layerIndex=t,W.vtlNeighborInfos.clear();const i=e.layerInfo[m.MAP][t];if(r(W.offset,0,0),W.tile=e,W.scale=1,W.sourceLod=e.lij,W.sourceLayerInfo=i,W.isVTLBackground=o,i.data)return o&&e.forEachLoadedNeighbor(((r,s)=>{if(r.level!==e.level)return;const o=r.layerInfo[m.MAP][t];if(!g(o)||i.data===o.data)return;const a=W.vtlNeighborInfos.pushNew();a.offset=K[s],a.sourceLod=r.lij,a.sourceLayerInfo=o})),W;const a=i.upsampleInfo,n=a?.tile?.layerInfo[m.MAP][t];return n&&a.tile?(W.tile=a.tile,s(W.offset,a.offset),W.scale=a.scale,W.sourceLod=a.tile.lij,W.sourceLayerInfo=n,W):o?W:null}function H(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function q(e){let t="normal"!==e.blendMode;return n(e.parent)&&(t=q(e.parent)||t),t}function z(e,t){n(e.parent)&&z(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=V.get(r);s?s.start=t:V.set(r,new G(t,t,e.blendMode,e.opacity,M.Composite,1))}}const V=new Map,X=new Array,W=new A,J=i(0,0,1,1),K=new Array;K[d.NORTH]=[0,-1],K[d.NORTH_EAST]=[-1,-1],K[d.EAST]=[-1,0],K[d.SOUTH_EAST]=[-1,1],K[d.SOUTH]=[0,1],K[d.SOUTH_WEST]=[1,1],K[d.WEST]=[1,0],K[d.NORTH_WEST]=[1,-1];export{G as GroupInfo,F as TileRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderPass as e,RenderPassSorting as s}from"./RenderPass.js";import{RenderPassIdentifier as i}from"./RenderPassIdentifier.js";import{ShaderOutput as r}from"../shaderLibrary/ShaderOutput.js";import{VertexNormalPassParameters as n,VertexNormalDrawParameters as a}from"../shaderLibrary/attributes/VertexNormal.glsl.js";class o{constructor(t){const i=t.renderContext.rctx,r=t.techniques;this.opaque=new e(i,r),this.transparent=new e(i,r,s.BackToFront),this.integratedMesh=new e(i,r),this.occludedGround=new e(i,r),this.shadowMap=new e(i,r),this.highlight=new e(i,r),this.highlightIntegratedMesh=new e(i,r),this.highlightShadowMap=new e(i,r),this.viewshedShadowMap=new e(i,r),this.defaultShadowMap=new e(i,r)}}class h extends n{constructor(){super(...arguments),this.slicePlaneLocalOrigin=t(),this.origin=this.slicePlaneLocalOrigin}}class c extends a{}class d extends h{constructor(){super(...arguments),this.identifier=i.Material,this.output=r.Color,this.transparent=!1}}class l extends h{constructor(){super(...arguments),this.identifier=i.ShadowMap}}class p extends h{constructor(){super(...arguments),this.identifier=i.Highlight}}class u extends h{constructor(){super(...arguments),this.identifier=i.ViewshedShadowMap}}export{o as AllRenderPasses,c as DrawParameters,p as HighlightPassParameters,d as MaterialPassParameters,h as PassParameters,l as ShadowMapPassParameters,u as ViewshedShadowMapPassParameters};
5
+ import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderPass as e,RenderPassSorting as s}from"./RenderPass.js";import{RenderPassIdentifier as i}from"./RenderPassIdentifier.js";import{ShaderOutput as r}from"../shaderLibrary/ShaderOutput.js";import{VertexNormalPassParameters as n,VertexNormalDrawParameters as o}from"../shaderLibrary/attributes/VertexNormal.glsl.js";class a{constructor(t){const i=t.renderContext.rctx,r=t.techniques;this.opaque=new e(i,r),this.transparent=new e(i,r,s.BackToFront),this.integratedMesh=new e(i,r),this.occludedGround=new e(i,r),this.shadowMap=new e(i,r),this.highlight=new e(i,r),this.highlightIntegratedMesh=new e(i,r),this.highlightShadowMap=new e(i,r),this.viewshedShadowMap=new e(i,r),this.defaultShadowMap=new e(i,r)}}class h extends n{constructor(){super(...arguments),this.slicePlaneLocalOrigin=t(),this.origin=this.slicePlaneLocalOrigin}}class c extends o{}class d extends h{constructor(){super(...arguments),this.identifier=i.Material,this.output=r.Color,this.transparent=!1,this.occludedGround=!1}}class l extends h{constructor(){super(...arguments),this.identifier=i.ShadowMap}}class u extends h{constructor(){super(...arguments),this.identifier=i.Highlight}}class p extends h{constructor(){super(...arguments),this.identifier=i.ViewshedShadowMap}}export{a as AllRenderPasses,c as DrawParameters,u as HighlightPassParameters,d as MaterialPassParameters,h as PassParameters,l as ShadowMapPassParameters,p as ViewshedShadowMapPassParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{i as h,c as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as l,HighlightPassParameters as u,ViewshedShadowMapPassParameters as d,AllRenderPasses as p}from"./AllRenderPasses.js";import{RenderPassIdentifier as _}from"./RenderPassIdentifier.js";import{ShaderOutput as P}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as g}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as w}from"../../effects/RenderPlugin.js";import{DepthRange as f}from"../../lib/DepthRange.js";import{RenderSlot as E}from"../../lib/RenderSlot.js";let R=class extends w{constructor(){super({}),this.produces=new Map([[E.OPAQUE_MATERIAL,s=>this._produces(s,E.OPAQUE_MATERIAL)],[E.TRANSPARENT_MATERIAL,s=>this._produces(s,E.TRANSPARENT_MATERIAL)],[E.INTEGRATED_MESH,s=>this._produces(s,E.INTEGRATED_MESH)],[E.OCCLUDED_GROUND,s=>this._produces(s,E.OCCLUDED_GROUND)]]),this._materialPassParameters=new c,this._shadowPassParameters=new l,this._highlightPassParameters=new u,this._viewshedPassParameters=new d,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new p(s)}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,(s=>s.count>0))}prepareRender(s){const{_systems:e,_passes:t}=this;if(0!==e.size&&null!=t){for(const s of Object.values(t))s.prepareSubmit();e.forEach((e=>e.submit(t,s.bind)));for(const s of Object.values(t))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=s.output===P.Shadow||s.output===P.ShadowHighlight||s.output===P.ShadowExcludeHighlight?this._shadowPassParameters:s.output===P.ViewshedShadow?this._viewshedPassParameters:s.output===P.Highlight?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot===E.TRANSPARENT_MATERIAL),this._materialPassParameters.output=s.output,this._invoke(s.output,s.bind.slot,((e,t)=>e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,((t,r)=>t.dispatch(r,s.bind,e)))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case E.OPAQUE_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.opaque,this._materialPassParameters);case P.Highlight:return t(this._passes.highlight,this._highlightPassParameters);case P.Shadow:return t(this._passes.shadowMap,this._shadowPassParameters);case P.ShadowHighlight:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case P.ShadowExcludeHighlight:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case P.ViewshedShadow:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case E.TRANSPARENT_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.transparent,this._materialPassParameters)}break;case E.INTEGRATED_MESH:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.integratedMesh,this._materialPassParameters);case P.Highlight:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case E.OCCLUDED_GROUND:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new f;return this._systems.forEach((t=>e.union(t.queryDepthRange(s)))),e}get hasEmissions(){let s=!1;return this._systems.forEach((e=>s=e.hasEmissions||s)),s}_updateParameters(s,e,i){const m=s.viewInverseTransposeMatrix;h(A,m[3],m[7],m[11]),j.set(A),n(e.transformWorldFromViewTH,j.high),n(e.transformWorldFromViewTL,j.low),n(e.slicePlaneLocalOrigin,A),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),o(e.transformProjFromView,s.projectionMatrix),e.identifier===_.Material&&(this._materialPassParameters.transparent=i,r(b,e.transformViewFromCameraRelativeRS),a(e.transformNormalViewFromGlobal,b))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}};R=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],R);const A=m(),b=i(),j=new g;export{R as RenderPassManager};
5
+ import{_ as s}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{i as h,c as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as l,HighlightPassParameters as u,ViewshedShadowMapPassParameters as d,AllRenderPasses as p}from"./AllRenderPasses.js";import{RenderPassIdentifier as _}from"./RenderPassIdentifier.js";import{ShaderOutput as P}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as g}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as w}from"../../effects/RenderPlugin.js";import{DepthRange as f}from"../../lib/DepthRange.js";import{RenderSlot as E}from"../../lib/RenderSlot.js";let R=class extends w{constructor(){super({}),this.produces=new Map([[E.OPAQUE_MATERIAL,s=>this._produces(s,E.OPAQUE_MATERIAL)],[E.TRANSPARENT_MATERIAL,s=>this._produces(s,E.TRANSPARENT_MATERIAL)],[E.INTEGRATED_MESH,s=>this._produces(s,E.INTEGRATED_MESH)],[E.OCCLUDED_GROUND,s=>this._produces(s,E.OCCLUDED_GROUND)]]),this._materialPassParameters=new c,this._shadowPassParameters=new l,this._highlightPassParameters=new u,this._viewshedPassParameters=new d,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new p(s)}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,(s=>s.count>0))}prepareRender(s){const{_systems:e,_passes:t}=this;if(0!==e.size&&null!=t){for(const s of Object.values(t))s.prepareSubmit();e.forEach((e=>e.submit(t,s.bind)));for(const s of Object.values(t))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=s.output===P.Shadow||s.output===P.ShadowHighlight||s.output===P.ShadowExcludeHighlight?this._shadowPassParameters:s.output===P.ViewshedShadow?this._viewshedPassParameters:s.output===P.Highlight?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot),this._materialPassParameters.output=s.output,this._invoke(s.output,s.bind.slot,((e,t)=>e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,((t,r)=>t.dispatch(r,s.bind,e)))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case E.OPAQUE_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.opaque,this._materialPassParameters);case P.Highlight:return t(this._passes.highlight,this._highlightPassParameters);case P.Shadow:return t(this._passes.shadowMap,this._shadowPassParameters);case P.ShadowHighlight:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case P.ShadowExcludeHighlight:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case P.ViewshedShadow:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case E.TRANSPARENT_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.transparent,this._materialPassParameters)}break;case E.INTEGRATED_MESH:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.integratedMesh,this._materialPassParameters);case P.Highlight:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case E.OCCLUDED_GROUND:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new f;return this._systems.forEach((t=>e.union(t.queryDepthRange(s)))),e}get hasEmissions(){let s=!1;return this._systems.forEach((e=>s=e.hasEmissions||s)),s}_updateParameters(s,e,i){const m=s.viewInverseTransposeMatrix,c=i===E.TRANSPARENT_MATERIAL,l=i===E.OCCLUDED_GROUND;h(A,m[3],m[7],m[11]),j.set(A),n(e.transformWorldFromViewTH,j.high),n(e.transformWorldFromViewTL,j.low),n(e.slicePlaneLocalOrigin,A),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),o(e.transformProjFromView,s.projectionMatrix),e.identifier===_.Material&&(this._materialPassParameters.transparent=c,this._materialPassParameters.occludedGround=l,r(b,e.transformViewFromCameraRelativeRS),a(e.transformNormalViewFromGlobal,b))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}};R=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],R);const A=m(),b=i(),j=new g;export{R as RenderPassManager};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as s}from"../ShaderOutput.js";import{addMainLightDirection as d,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as f}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as g}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",((e,o)=>V(e,o))),new x("overlayTexScale",((e,o)=>I(e,o)))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",((e,o)=>b(e,o)))),T(e,o)}function O(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",(e=>e.overlayOpacity))),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",((e,o)=>o.overlay?.getTexture(e.overlayContent)))),T(e,o)}function T(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:s}=o,x=s===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as d}from"../ShaderOutput.js";import{addMainLightDirection as s,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as f}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as g}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",((e,o)=>V(e,o))),new x("overlayTexScale",((e,o)=>I(e,o)))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",((e,o)=>b(e,o)))),T(e,o)}function O(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",(e=>e.overlayOpacity))),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",((e,o)=>o.overlay?.getTexture(e.overlayContent)))),T(e,o)}function T(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:d}=o,x=d===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
6
6
  vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
7
7
  }`),a.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
8
8
  return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
@@ -38,10 +38,10 @@ vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoor
38
38
  bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
39
39
  bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
40
40
  return mix(color1 * float(isValid1), color0, float(isValid0));
41
- }`)),r&&(d(a),v(a),a.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
41
+ }`)),r&&(s(a),v(a),a.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
42
42
  float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
43
43
  vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
44
44
  vec3 v = vposEyeDir;
45
45
  vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
46
46
  return vec4(final, colorInput.w);
47
- }`))}function b(e,o){return e.identifier===i.Material&&s(e.output)?o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends g{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,O as OverlayTerrain,b as getIMColorTexture};
47
+ }`))}function b(e,o){return e.identifier===i.Material&&d(e.output)?e.occludedGround?o.overlay?.getTexture(l.Occluded):o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends g{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,O as OverlayTerrain,b as getIMColorTexture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{generateUID as m}from"../../../../core/uid.js";import{isBlobProtocol as h,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as d}from"../../../../layers/support/videoUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as c}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as u}from"./basicInterfaces.js";import{createTextureKTX2 as g,createTextureBasis as T,estimateMemoryKTX2 as E,estimateMemoryBasis as x}from"./BasisUtil.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as y}from"./textureUtils.js";import{assert as A}from"./Util.js";import{TextureWrapMode as D,TextureSamplingMode as F,PixelFormat as I}from"../../../webgl/enums.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class C{constructor(e,r){this._data=e,this.id=m(),this.events=new t,this._parameters={...N,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(h(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=e.paused;if(e.src=e.src,t&&e.autoplay){const t=[];d(e,(e=>t.push(e))).then((()=>{e.play()})).finally((()=>t.forEach((e=>e.remove()))))}}}_startPreloadImageElement(e){p(e.src)||h(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new w;return t.wrapMode=this._parameters.wrap??D.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?F.LINEAR_MIPMAP_LINEAR:F.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||L(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new M(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===u.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===u.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===u.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===u.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>g(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>T(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){A(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?I.LUMINANCE:3===this._parameters.components?I.RGB:I.RGBA,r.pixelFormat!==I.RGB&&r.pixelFormat!==I.RGBA||(r.compressionHandle=this._parameters.compressionHandle,r.compressionCallback=this._parameters.compressionCallback),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new M(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return i(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await c(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((i=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,(()=>p(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=y(r,e.parameters));const s=P(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?I.RGB:I.RGBA,i.width=s.width,i.height=s.height,i.compressionHandle=this._parameters.compressionHandle,i.compressionCallback=this._parameters.compressionCallback,this._glTexture=new M(e,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function L(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===u.KTX2_ENCODING?E(e,!!t.mipmap):t.encoding===u.BASIS_ENCODING?x(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?P(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function P(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const N={wrap:{s:D.REPEAT,t:D.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{C as Texture};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import t from"../../../../core/Evented.js";import{disposeMaybe as r,removeMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as i,onAbort as a,createAbortError as o}from"../../../../core/promiseUtils.js";import{isUint8Array as n,isArrayBuffer as l}from"../../../../core/typedArrayUtil.js";import{generateUID as m}from"../../../../core/uid.js";import{isBlobProtocol as h,isDataProtocol as p}from"../../../../core/urlUtils.js";import{whenVideoPlayable as d}from"../../../../layers/support/videoUtils.js";import{requestImage as _}from"../../../../support/requestImageUtils.js";import{loadImageAsync as u}from"../../../../support/requestUtils.js";import{TextureEncodingMimeType as c}from"./basicInterfaces.js";import{createTextureKTX2 as g,createTextureBasis as T,estimateMemoryKTX2 as E,estimateMemoryBasis as x}from"./BasisUtil.js";import{createDDSTexture as f}from"./DDSUtil.js";import{ensureImageMaxSize as y}from"./textureUtils.js";import{assert as A}from"./Util.js";import{TextureWrapMode as D,TextureSamplingMode as F,PixelFormat as I}from"../../../webgl/enums.js";import{Texture as M}from"../../../webgl/Texture.js";import{TextureDescriptor as w}from"../../../webgl/TextureDescriptor.js";class L{constructor(e,r){this._data=e,this.id=m(),this.events=new t,this._parameters={...N,...r},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(h(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];d(e,(e=>t.push(e))).then((()=>{e.play()})).finally((()=>t.forEach((e=>e.remove()))))}}_startPreloadImageElement(e){p(e.src)||h(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new w;return t.wrapMode=this._parameters.wrap??D.REPEAT,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?F.LINEAR_MIPMAP_LINEAR:F.LINEAR,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||C(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new M(e,this._createDescriptor(e),null),this._glTexture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):n(t)&&this._parameters.encoding===c.DDS_ENCODING?this._loadFromDDSData(e,t):l(t)&&this._parameters.encoding===c.DDS_ENCODING?this._loadFromDDSData(e,new Uint8Array(t)):(l(t)||n(t))&&this._parameters.encoding===c.KTX2_ENCODING?this._loadFromKTX2(e,t):(l(t)||n(t))&&this._parameters.encoding===c.BASIS_ENCODING?this._loadFromBasis(e,t):n(t)?this._loadFromPixelData(e,t):l(t)?this._loadFromPixelData(e,new Uint8Array(t)):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=f(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>g(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>T(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){A(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this._parameters.components?I.LUMINANCE:3===this._parameters.components?I.RGB:I.RGBA,r.pixelFormat!==I.RGB&&r.pixelFormat!==I.RGBA||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new M(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync((async r=>{const s=await _(t,{signal:r});return i(r),this._loadFromImage(e,s)}))}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync((async r=>{const s=await u(t,t.src,!1,r);return i(r),this._loadFromImage(e,s)}))}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(t,r){return this._loadAsync((i=>new Promise(((n,l)=>{const m=()=>{r.removeEventListener("loadeddata",h),r.removeEventListener("error",p),s(d)},h=()=>{r.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(m(),n(this._loadFromImage(t,r)))},p=t=>{m(),l(t||new e("texture:load-error","Failed to load video"))};r.addEventListener("loadeddata",h),r.addEventListener("error",p);const d=a(i,(()=>p(o())))}))))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=y(r,e.parameters));const s=P(r);this._parameters.width=s.width,this._parameters.height=s.height;const i=this._createDescriptor(e);return i.pixelFormat=3===this._parameters.components?I.RGB:I.RGBA,i.width=s.width,i.height=s.height,i.compress=this._parameters.compressionOptions,this._glTexture=new M(e,i,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const s=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(s,s),r}unload(){if(this._glTexture=r(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function C(e,t){if(null==e)return 0;if(l(e)||n(e))return t.encoding===c.KTX2_ENCODING?E(e,!!t.mipmap):t.encoding===c.BASIS_ENCODING?x(e,!!t.mipmap):e.byteLength;const{width:r,height:s}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?P(e):t;return(t.mipmap?4/3:1)*r*s*(t.components||4)||0}function P(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const N={wrap:{s:D.REPEAT,t:D.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};export{L as Texture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,e as n,g as o,f as l,c,l as p,j as h,t as f}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as T}from"../../../../geometry/support/float16.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{distance2 as E,fromPoints as _,create as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{fromPoints as g,create as S,signedDistance as O,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as F}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as x}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as J}from"./internal/bufferWriterUtils.js";import{LineMarkerAnchor as z}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as H}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as G,RibbonLineTechnique as k}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Z,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";var Y;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Y||(Y={}));class q extends D{constructor(e){super(e,Q),this._configuration=new Z,this.vertexAttributeLocations=G,this.produces=new Map([[w.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[w.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){super.getConfiguration(e,t,this._configuration),this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===w.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===F.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get(B.SIZE);let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get(B.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const c=s[0],p=s[1],h=(l/2+4)*r;let f=Number.MAX_VALUE,m=0;const u=e.get(B.POSITION).data,T=ee(this.parameters,e)?u.length-2:u.length-5;for(let d=0;d<T;d+=3){const e=u[d],r=u[d+1],i=(d+3)%u.length,s=c-e,a=p-r,n=u[i]-e,o=u[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,T=o*l-a,E=h*h+T*T;E<f&&(f=E,m=d/3)}f<h*h&&a(n.distance,n.normal,m)}intersect(r,f,m,u,T,A){const{options:S,camera:v,rayBegin:P,rayEnd:N}=m;if(!S.selectionMode||!r.visible||!v)return;if(!M(f))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const L=r.attributes,b=L.get(B.POSITION).data;let C=this.parameters.width;if(this.parameters.vvSize){const e=L.get(B.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(C*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else L.has(B.SIZE)&&(C*=L.get(B.SIZE).data[0]);const U=ne;i(U,m.point);const y=C*v.pixelRatio/2+4*v.pixelRatio;s(de[0],U[0]-y,U[1]+y,0),s(de[1],U[0]+y,U[1]+y,0),s(de[2],U[0]+y,U[1]-y,0),s(de[3],U[0]-y,U[1]-y,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(de[e],Ee[e]))return;g(v.eye,Ee[0],Ee[1],_e),g(v.eye,Ee[1],Ee[2],Ae),g(v.eye,Ee[2],Ee[3],Re),g(v.eye,Ee[3],Ee[0],ge);let j=Number.MAX_VALUE,D=0;const F=ee(this.parameters,L)?b.length-2:b.length-5;for(let e=0;e<F;e+=3){re[0]=b[e]+f[12],re[1]=b[e+1]+f[13],re[2]=b[e+2]+f[14];const t=(e+3)%b.length;if(ie[0]=b[t]+f[12],ie[1]=b[t+1]+f[13],ie[2]=b[t+2]+f[14],O(_e,re)<0&&O(_e,ie)<0||O(Ae,re)<0&&O(Ae,ie)<0||O(Re,re)<0&&O(Re,ie)<0||O(ge,re)<0&&O(ge,ie)<0)continue;if(v.projectToRenderScreen(re,oe),v.projectToRenderScreen(ie,le),oe[2]<0&&le[2]>0){a(se,re,ie);const e=v.frustum,t=-O(e[d.NEAR],re)/n(se,I(e[d.NEAR]));o(se,se,t),l(re,re,se),v.projectToRenderScreen(re,oe)}else if(oe[2]>0&&le[2]<0){a(se,ie,re);const e=v.frustum,t=-O(e[d.NEAR],ie)/n(se,I(e[d.NEAR]));o(se,se,t),l(ie,ie,se),v.projectToRenderScreen(ie,le)}else if(oe[2]<0&&le[2]<0)continue;oe[2]=0,le[2]=0;const r=E(_(oe,le,he),U);r<j&&(j=r,c(ce,re),c(pe,ie),D=e/3)}if(j<y*y){let e=Number.MAX_VALUE;if(R(_(ce,pe,he),_(P,N,fe),ae)){a(ae,ae,P);const t=p(ae);o(ae,ae,1/t),e=t/h(P,N)}A(e,ae,D)}}get _layout(){const e=v().vec3f(B.POSITION).vec4f16(B.PREVIOUSDELTA).vec4f16(B.NEXTDELTA).f32(B.U0).vec2f16(B.LINEPARAMETERS);return this.parameters.vvSize?e.f32(B.SIZEFEATUREATTRIBUTE):e.f16(B.SIZE),this.parameters.vvColor?e.f16(B.COLORFEATUREATTRIBUTE):e.vec4u8(B.COLOR,{glNormalized:!0}),this.parameters.vvOpacity&&e.f16(B.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(B.OLIDCOLOR),e}createBufferWriter(){return new K(this._layout,this.parameters)}createGLMaterial(e){return new X(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class X extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(k,e)}}class Q extends x{constructor(){super(...arguments),this.width=0,this.color=u,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class K{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=H+r}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(B.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=r.get(B.POSITION),l=o.indices,p=o.data.length/3,m=r.get(B.DISTANCETOSTART)?.data;l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=this.vertexBufferLayout.fields.has(B.SIZEFEATUREATTRIBUTE),d=(u?r.get(B.SIZEFEATUREATTRIBUTE)?.data[0]:r.get(B.SIZE)?.data[0])??1;let E=[1,1,1,1],_=0;const A=this.vertexBufferLayout.fields.has(B.COLORFEATUREATTRIBUTE);A?_=r.get(B.COLORFEATUREATTRIBUTE).data[0]:r.has(B.COLOR)&&(E=r.get(B.COLOR).data);const R=this.vertexBufferLayout.fields.has(B.OPACITYFEATUREATTRIBUTE),g=R?r.get(B.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),O=T(a.buffer),I=new Uint8Array(a.buffer),v=this.vertexBufferLayout.stride/4;let P=n*v;const N=P;let L=0;const b=m?(e,t,r)=>L=m[r]:(e,t,r)=>L+=h(e,t),C=S.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,U=4/C,j=(e,t,r,s,a,n,o)=>{S[P++]=t[0],S[P++]=t[1],S[P++]=t[2],J(e,t,O,P*C),P+=U,J(r,t,O,P*C),P+=U,S[P++]=o;let l=P*C;if(O[l++]=s,O[l++]=a,u?(P=Math.ceil(l/C),S[P]=d,l+=C):O[l++]=d,A)O[l++]=_;else{const e=Math.min(4*n,E.length-4),t=l/C*4;l+=C,I[t]=255*E[e],I[t+1]=255*E[e+1],I[t+2]=255*E[e+2],I[t+3]=255*E[e+3]}R&&(O[l++]=g);let c=l/C*4;y()&&i&&(I[c++]=i[0],I[c++]=i[1],I[c++]=i[2],I[c++]=i[3]),P=Math.ceil(.25*c)};P+=v,s(ue,o.data[0],o.data[1],o.data[2]),e&&f(ue,ue,e);const D=this._isClosed(r);if(D){const t=o.data.length-3;s(me,o.data[t],o.data[t+1],o.data[t+2]),e&&f(me,me,e)}else s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),j(ue,ue,Te,1,Y.LEFT_CAP_START,0,0),j(ue,ue,Te,1,Y.RIGHT_CAP_START,0,0),c(me,ue),c(ue,Te);const F=D?0:1,w=D?p:p-1;for(let h=F;h<w;h++){const t=(h+1)%p*3;s(Te,o.data[t],o.data[t+1],o.data[t+2]),e&&f(Te,Te,e),b(me,ue,h),j(me,ue,Te,0,Y.LEFT_JOIN_END,h,L),j(me,ue,Te,0,Y.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);j(me,ue,Te,t,Y.LEFT_JOIN_END,h,L),j(me,ue,Te,t,Y.RIGHT_JOIN_END,h,L)}j(me,ue,Te,1,Y.LEFT_JOIN_START,h,L),j(me,ue,Te,1,Y.RIGHT_JOIN_START,h,L),c(me,ue),c(ue,Te)}D?(s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),L=b(me,ue,w),j(me,ue,Te,0,Y.LEFT_JOIN_END,F,L),j(me,ue,Te,0,Y.RIGHT_JOIN_END,F,L)):(L=b(me,ue,w),j(me,ue,ue,0,Y.LEFT_CAP_END,w,L),j(me,ue,ue,0,Y.RIGHT_CAP_END,w,L)),$(S,N+v,S,N,v);return P=$(S,P-v,S,P,v),this._parameters.wireframe&&this._addWireframeVertices(a,N,P,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=$(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function $(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function ee(e,t){if(!e.isClosed)return!1;return t.get(B.POSITION).indices.length>2}function te(e){return e.anchor===z.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const re=m(),ie=m(),se=m(),ae=m(),ne=m(),oe=r(),le=r(),ce=m(),pe=m(),he=A(),fe=A(),me=m(),ue=m(),Te=m(),de=[r(),r(),r(),r()],Ee=[m(),m(),m(),m()],_e=S(),Ae=S(),Re=S(),ge=S();export{Q as Parameters,q as RibbonLineMaterial};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{i as s,d as a,e as n,g as o,f as l,c,l as p,j as h,t as f}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as T}from"../../../../geometry/support/float16.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{distance2 as E,fromPoints as _,create as A,closestLineSegmentPoint as R}from"../../../../geometry/support/lineSegment.js";import{fromPoints as g,create as S,signedDistance as O,getNormal as I}from"../../../../geometry/support/plane.js";import{newLayout as v}from"../../support/buffer/InterleavedLayout.js";import{isHighlightOrOID as P,isColorOrColorEmission as N,isDepth as L,isColorEmissionHighlightOIDOrDepth as b,is2DGeometryOutput as C,ShaderOutput as U}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as y}from"../effects/geometry/olidUtils.js";import j from"../lib/GLMaterial.js";import{Material as D,RenderOccludedFlag as F}from"../lib/Material.js";import{RenderSlot as w}from"../lib/RenderSlot.js";import{isTranslationMatrix as M}from"../lib/Util.js";import{VertexAttribute as B}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as x}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as J}from"./internal/bufferWriterUtils.js";import{LineMarkerAnchor as z}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as H}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as G,RibbonLineTechnique as k}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Z,CapType as V}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as W}from"../../../../webscene/support/AlphaCutoff.js";var Y;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(Y||(Y={}));class q extends D{constructor(e){super(e,Q),this._configuration=new Z,this.vertexAttributeLocations=G,this.produces=new Map([[w.OPAQUE_MATERIAL,e=>P(e)||N(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.OPAQUE_MATERIAL_WITHOUT_NORMALS,e=>L(e)],[w.OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_OCCLUDER_MATERIAL,e=>b(e)&&this.parameters.renderOccluded===F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL,e=>N(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>N(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==F.OccludeAndTransparentStencil],[w.DRAPED_MATERIAL,e=>C(e)]])}getConfiguration(e,t){super.getConfiguration(e,t,this._configuration),this._configuration.oitPass=t.oitPass,this._configuration.draped=t.slot===w.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==U.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=this.parameters.renderOccluded===F.OccludeAndTransparentStencil,this._configuration.terrainDepthTest=t.terrainDepthTest&&N(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration}get visible(){return this.parameters.color[3]>=W||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>W}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get(B.SIZE);let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get(B.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const c=s[0],p=s[1],h=(l/2+4)*r;let f=Number.MAX_VALUE,m=0;const u=e.get(B.POSITION).data,T=ee(this.parameters,e)?u.length-2:u.length-5;for(let d=0;d<T;d+=3){const e=u[d],r=u[d+1],i=(d+3)%u.length,s=c-e,a=p-r,n=u[i]-e,o=u[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,T=o*l-a,E=h*h+T*T;E<f&&(f=E,m=d/3)}f<h*h&&a(n.distance,n.normal,m)}intersect(r,f,m,u,T,A){const{options:S,camera:v,rayBegin:P,rayEnd:N}=m;if(!S.selectionMode||!r.visible||!v)return;if(!M(f))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const L=r.attributes,b=L.get(B.POSITION).data;let C=this.parameters.width;if(this.parameters.vvSize){const e=L.get(B.SIZEFEATUREATTRIBUTE).data[0];Number.isNaN(e)||(C*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else L.has(B.SIZE)&&(C*=L.get(B.SIZE).data[0]);const U=ne;i(U,m.point);const y=C*v.pixelRatio/2+4*v.pixelRatio;s(de[0],U[0]-y,U[1]+y,0),s(de[1],U[0]+y,U[1]+y,0),s(de[2],U[0]+y,U[1]-y,0),s(de[3],U[0]-y,U[1]-y,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(de[e],Ee[e]))return;g(v.eye,Ee[0],Ee[1],_e),g(v.eye,Ee[1],Ee[2],Ae),g(v.eye,Ee[2],Ee[3],Re),g(v.eye,Ee[3],Ee[0],ge);let j=Number.MAX_VALUE,D=0;const F=ee(this.parameters,L)?b.length-2:b.length-5;for(let e=0;e<F;e+=3){re[0]=b[e]+f[12],re[1]=b[e+1]+f[13],re[2]=b[e+2]+f[14];const t=(e+3)%b.length;if(ie[0]=b[t]+f[12],ie[1]=b[t+1]+f[13],ie[2]=b[t+2]+f[14],O(_e,re)<0&&O(_e,ie)<0||O(Ae,re)<0&&O(Ae,ie)<0||O(Re,re)<0&&O(Re,ie)<0||O(ge,re)<0&&O(ge,ie)<0)continue;if(v.projectToRenderScreen(re,oe),v.projectToRenderScreen(ie,le),oe[2]<0&&le[2]>0){a(se,re,ie);const e=v.frustum,t=-O(e[d.NEAR],re)/n(se,I(e[d.NEAR]));o(se,se,t),l(re,re,se),v.projectToRenderScreen(re,oe)}else if(oe[2]>0&&le[2]<0){a(se,ie,re);const e=v.frustum,t=-O(e[d.NEAR],ie)/n(se,I(e[d.NEAR]));o(se,se,t),l(ie,ie,se),v.projectToRenderScreen(ie,le)}else if(oe[2]<0&&le[2]<0)continue;oe[2]=0,le[2]=0;const r=E(_(oe,le,he),U);r<j&&(j=r,c(ce,re),c(pe,ie),D=e/3)}if(j<y*y){let e=Number.MAX_VALUE;if(R(_(ce,pe,he),_(P,N,fe),ae)){a(ae,ae,P);const t=p(ae);o(ae,ae,1/t),e=t/h(P,N)}A(e,ae,D)}}get _layout(){const e=v().vec3f(B.POSITION).vec4f16(B.PREVIOUSDELTA).vec4f16(B.NEXTDELTA).f32(B.U0).vec2f16(B.LINEPARAMETERS);return this.parameters.vvSize&&e.f32(B.SIZEFEATUREATTRIBUTE),this.parameters.vvColor?e.f16(B.COLORFEATUREATTRIBUTE):e.vec4u8(B.COLOR,{glNormalized:!0}),this.parameters.vvSize||e.f16(B.SIZE),this.parameters.vvOpacity&&e.f16(B.OPACITYFEATUREATTRIBUTE),y()&&e.vec4u8(B.OLIDCOLOR),e}createBufferWriter(){return new K(this._layout,this.parameters)}createGLMaterial(e){return new X(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class X extends j{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(k,e)}}class Q extends x{constructor(){super(...arguments),this.width=0,this.color=u,this.join="miter",this.cap=V.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1}get transparent(){return this.color[3]<1||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}}class K{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=H+r}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.get(B.POSITION).indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a,n){const o=r.get(B.POSITION),l=o.indices,p=o.data.length/3,m=r.get(B.DISTANCETOSTART)?.data;l&&l.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const u=this.vertexBufferLayout.fields.has(B.SIZEFEATUREATTRIBUTE),d=(u?r.get(B.SIZEFEATUREATTRIBUTE)?.data[0]:r.get(B.SIZE)?.data[0])??1;let E=[1,1,1,1],_=0;const A=this.vertexBufferLayout.fields.has(B.COLORFEATUREATTRIBUTE);A?_=r.get(B.COLORFEATUREATTRIBUTE).data[0]:r.has(B.COLOR)&&(E=r.get(B.COLOR).data);const R=this.vertexBufferLayout.fields.has(B.OPACITYFEATUREATTRIBUTE),g=R?r.get(B.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(a.buffer),O=T(a.buffer),I=new Uint8Array(a.buffer),v=this.vertexBufferLayout.stride/4;let P=n*v;const N=P;let L=0;const b=m?(e,t,r)=>L=m[r]:(e,t,r)=>L+=h(e,t),C=S.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,U=4/C,j=(e,t,r,s,a,n,o)=>{S[P++]=t[0],S[P++]=t[1],S[P++]=t[2],J(e,t,O,P*C),P+=U,J(r,t,O,P*C),P+=U,S[P++]=o;let l=P*C;if(O[l++]=s,O[l++]=a,u&&(P=Math.ceil(l/C),S[P]=d,l+=C),A)O[l++]=_;else{const e=Math.min(4*n,E.length-4),t=l/C*4;l+=C,I[t]=255*E[e],I[t+1]=255*E[e+1],I[t+2]=255*E[e+2],I[t+3]=255*E[e+3]}u||(O[l++]=d),R&&(O[l++]=g);let c=l/C*4;y()&&i&&(I[c++]=i[0],I[c++]=i[1],I[c++]=i[2],I[c++]=i[3]),P=Math.ceil(.25*c)};P+=v,s(ue,o.data[0],o.data[1],o.data[2]),e&&f(ue,ue,e);const D=this._isClosed(r);if(D){const t=o.data.length-3;s(me,o.data[t],o.data[t+1],o.data[t+2]),e&&f(me,me,e)}else s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),j(ue,ue,Te,1,Y.LEFT_CAP_START,0,0),j(ue,ue,Te,1,Y.RIGHT_CAP_START,0,0),c(me,ue),c(ue,Te);const F=D?0:1,w=D?p:p-1;for(let h=F;h<w;h++){const t=(h+1)%p*3;s(Te,o.data[t],o.data[t+1],o.data[t+2]),e&&f(Te,Te,e),b(me,ue,h),j(me,ue,Te,0,Y.LEFT_JOIN_END,h,L),j(me,ue,Te,0,Y.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);j(me,ue,Te,t,Y.LEFT_JOIN_END,h,L),j(me,ue,Te,t,Y.RIGHT_JOIN_END,h,L)}j(me,ue,Te,1,Y.LEFT_JOIN_START,h,L),j(me,ue,Te,1,Y.RIGHT_JOIN_START,h,L),c(me,ue),c(ue,Te)}D?(s(Te,o.data[3],o.data[4],o.data[5]),e&&f(Te,Te,e),L=b(me,ue,w),j(me,ue,Te,0,Y.LEFT_JOIN_END,F,L),j(me,ue,Te,0,Y.RIGHT_JOIN_END,F,L)):(L=b(me,ue,w),j(me,ue,ue,0,Y.LEFT_CAP_END,w,L),j(me,ue,ue,0,Y.RIGHT_CAP_END,w,L)),$(S,N+v,S,N,v);return P=$(S,P-v,S,P,v),this._parameters.wireframe&&this._addWireframeVertices(a,N,P,v),null}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=$(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function $(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function ee(e,t){if(!e.isClosed)return!1;return t.get(B.POSITION).indices.length>2}function te(e){return e.anchor===z.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const re=m(),ie=m(),se=m(),ae=m(),ne=m(),oe=r(),le=r(),ce=m(),pe=m(),he=A(),fe=A(),me=m(),ue=m(),Te=m(),de=[r(),r(),r(),r()],Ee=[m(),m(),m(),m()],_e=S(),Ae=S(),Re=S(),ge=S();export{Q as Parameters,q as RibbonLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import r from"../core/Logger.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as c}from"../core/maybe.js";import a from"../core/ReactiveMap.js";import{watch as h,on as u,initial as d}from"../core/reactiveUtils.js";import{symmetricDifference as f}from"../core/SetUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _,isSubtypeGroupLayer as v}from"../layers/support/layerUtils.js";import w from"../rest/support/Query.js";import{isSelectableLayer as S}from"./support/selectionUtils.js";let j=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new a,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([h((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),d),u((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this._layerEditHandles.drain(c)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):v(t)?t.sublayers?.forEach(s):S(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return r.getLogger(this).warn("Cannot query layer views without a view."),[];const n=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return n.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=y(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(H(r,n,t));if(M(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(H(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const t=l(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=f(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=y(n)?n.parent:n;if(null!=r&&E(r)){if(M(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(c);for(const e of this.sources){const t=y(e)?e.parent:e;if(null!=t&&S(t)&&"on"in t&&t.on){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!C(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([p({readOnly:!0,nonNullable:!0})],j.prototype,"selections",null),e([p({readOnly:!0,nonNullable:!0})],j.prototype,"count",null),e([p()],j.prototype,"view",void 0),e([p({readOnly:!0,nonNullable:!0})],j.prototype,"hasSelection",null),e([p()],j.prototype,"showHighlight",void 0),e([p()],j.prototype,"sources",null),e([p()],j.prototype,"highlightName",void 0),j=e([g("esri.views.SelectionManager")],j);const M=e=>y(e)?!0===e.parent?.isTable:e.isTable,b=e=>void 0!==e.layer,E=e=>void 0!==e?.when,C=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},H=async(e,t,s={})=>{let o;if(b(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=j;export{L as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import i from"../core/Evented.js";import n from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h,initial as u}from"../core/reactiveUtils.js";import{symmetricDifference as d}from"../core/SetUtils.js";import{property as f}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as g,isSubtypeGroupLayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _}from"../layers/support/layerUtils.js";import v from"../rest/support/Query.js";import{isSelectableLayer as w}from"./support/selectionUtils.js";let S=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new s,this._trashCan=[],this._layerEditHandles=new s,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),u),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):y(t)?t.sublayers?.forEach(s):w(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return n.getLogger(this).warn("Cannot query layer views without a view."),[];const r=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return r.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=g(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(F(r,n,t));if(b(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(F(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=d(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=g(n)?n.parent:n;if(null!=r&&E(r)){if(b(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);const e=new Set(this.sources.map((e=>g(e)?e.parent:e)));for(const t of e)w(t)&&"on"in t&&t.on&&this._layerEditHandles.push(t.on("edits",(e=>this._onLayerEdit(e,t))))}_onLayerEdit(e,t){if(y(t))this._onParentLayerEdit(e,t);else if(e.deletedFeatures.length&&this._selectionMap.has(t)){const s=[];e.deletedFeatures.forEach((({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)})),this.removeFromSelection(t,s)}}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:o,updatedFeatures:i}=e;if(o?.updateFeatures?.forEach((e=>{const s=e.getObjectId()??e.attributes[t.objectIdField];if(null==s)return;if(i.find((e=>e.objectId===s))?.error)return;const o=t.findSublayerForFeature(e);if(!w(o))return;const n=t.sublayers.find((e=>!(!w(e)||!this.getSelection(e)?.includes(s))));w(n)&&n!==o&&(this.removeFromSelection(n,[s]),this.appendToSelection(o,[s]))})),s.length){const e=[];s.forEach((({error:t,objectId:s})=>{null!=s&&null==t&&e.push(s)})),t.sublayers.forEach((t=>{w(t)&&this._selectionMap.has(t)&&this.removeFromSelection(t,e)}))}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([f({readOnly:!0,nonNullable:!0})],S.prototype,"selections",null),e([f({readOnly:!0,nonNullable:!0})],S.prototype,"count",null),e([f()],S.prototype,"view",void 0),e([f({readOnly:!0,nonNullable:!0})],S.prototype,"hasSelection",null),e([f()],S.prototype,"showHighlight",void 0),e([f()],S.prototype,"sources",null),e([f()],S.prototype,"highlightName",void 0),S=e([p("esri.views.SelectionManager")],S);const b=e=>g(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,E=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},F=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=S;export{L as default};