@arcgis/core 4.34.0-next.12 → 4.34.0-next.13

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 (623) hide show
  1. package/applications/Components/stringUtils.d.ts +6 -0
  2. package/applications/Components/stringUtils.js +5 -0
  3. package/arcade/Dictionary.js +1 -1
  4. package/arcade/Feature.js +1 -1
  5. package/arcade/arcadeAsyncRuntime.js +1 -1
  6. package/arcade/arcadeCompiler.js +1 -1
  7. package/arcade/arcadeRuntime.js +1 -1
  8. package/arcade/containerUtils.js +1 -1
  9. package/arcade/deepClone.js +1 -1
  10. package/arcade/featureSetUtils.js +1 -1
  11. package/arcade/featureset/actions/Adapted.js +1 -1
  12. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  13. package/arcade/functions/convertdirection.js +1 -1
  14. package/arcade/functions/date.js +1 -1
  15. package/arcade/functions/feature.js +1 -1
  16. package/arcade/functions/featuresetbase.js +1 -1
  17. package/arcade/functions/featuresetgeom.js +1 -1
  18. package/arcade/functions/featuresetstats.js +1 -1
  19. package/arcade/functions/featuresetstring.js +1 -1
  20. package/arcade/functions/fieldStats.js +1 -1
  21. package/arcade/functions/geomasync.js +1 -1
  22. package/arcade/functions/geometry.js +1 -1
  23. package/arcade/functions/geomsync.js +1 -1
  24. package/arcade/functions/knowledgegraph.js +1 -1
  25. package/arcade/functions/maths.js +1 -1
  26. package/arcade/functions/stats.js +1 -1
  27. package/arcade/functions/string.js +1 -1
  28. package/arcade/geometry/constructors.js +1 -1
  29. package/arcade/geometry/functions.js +1 -1
  30. package/arcade/languageUtils.js +1 -1
  31. package/arcade.js +1 -1
  32. package/assets/esri/core/workers/RemoteClient.js +1 -1
  33. package/assets/esri/core/workers/chunks/0229c573fa8a2fff2d8b.js.LICENSE.txt +1 -1
  34. package/assets/esri/core/workers/chunks/{9f964467f7353039dd9c.js → 0b21651eb93efe9ce089.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{e0ae33206f519b159b49.js → 0eeb0dce918e4827309a.js} +1 -1
  36. package/assets/esri/core/workers/chunks/0ff6f15d46d7ddf6fe4d.js +1 -0
  37. package/assets/esri/core/workers/chunks/{e385a27fd1ac2123a05f.js → 178260e8a263f2f1584f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{28b1819bf744ce957dfd.js → 17fcdaeb42e932712096.js} +2 -2
  39. package/assets/esri/core/workers/chunks/{28b1819bf744ce957dfd.js.LICENSE.txt → 17fcdaeb42e932712096.js.LICENSE.txt} +1 -1
  40. package/assets/esri/core/workers/chunks/{3ae2e9f469020f777d9f.js → 183a7dec68c8ba6eb3d6.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{52c34d6ecd9d45a33e69.js → 275a724c18bd15591e3c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/29fb64826bb1351aca8d.js.LICENSE.txt +1 -1
  43. package/assets/esri/core/workers/chunks/{0039dee1337160366112.js → 3145218abe59b5e99ff8.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{dea3e131bbd48cc48e1a.js → 369978472cc9ee6a00b5.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{539541dec5fcf3b657aa.js → 3f58da371633967a61ca.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{d0372bac0c5f4fbed468.js → 3f59a73f9a758095976f.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{f48eb59b94ba8b7d4d72.js → 4079e307a0fce4516aa4.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{a2e9141ff4efd13413a1.js → 4a805e7a57d25c4b595f.js} +2 -2
  49. package/assets/esri/core/workers/chunks/53ff5b7691ba1444358e.js +1 -0
  50. package/assets/esri/core/workers/chunks/54f981fe0f8851767be9.js.LICENSE.txt +1 -1
  51. package/assets/esri/core/workers/chunks/{a6fb75929e456f87f804.js → 58b2dc0ec977af7413b0.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{92a5dccb328229a9336b.js → 58f92100b1b2343111c6.js} +1 -1
  53. package/assets/esri/core/workers/chunks/5cc5f32b474ee723e192.js +1 -0
  54. package/assets/esri/core/workers/chunks/5dcc8fa321f0a7c49f36.js +1 -0
  55. package/assets/esri/core/workers/chunks/64f5f27e7c5649d79cbc.js +1 -0
  56. package/assets/esri/core/workers/chunks/64fc44f99486c7ffe6fa.js +1 -0
  57. package/assets/esri/core/workers/chunks/658e82c9b722852e02d0.js +1 -0
  58. package/assets/esri/core/workers/chunks/{6b0ae9ccdd1acef5b5b4.js → 679d7baea233faf3fdbc.js} +1 -1
  59. package/assets/esri/core/workers/chunks/73ddb356121add556994.js.LICENSE.txt +1 -1
  60. package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
  61. package/assets/esri/core/workers/chunks/8b93cd4132934b0d7d39.js +1 -0
  62. package/assets/esri/core/workers/chunks/97b69fec3e87f11210ba.js +1 -0
  63. package/assets/esri/core/workers/chunks/{fda48126f67e80034404.js → 998819aade3898f52414.js} +1 -1
  64. package/assets/esri/core/workers/chunks/9a87c367ee5ba44f3081.js +1 -0
  65. package/assets/esri/core/workers/chunks/{427318722815bef1496b.js → a08ce98672ab94d19613.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{6d90887dc605261dd7b3.js → a250a5c6e055e33bd25c.js} +1 -1
  67. package/assets/esri/core/workers/chunks/aad9a693813b47a51530.js.LICENSE.txt +1 -1
  68. package/assets/esri/core/workers/chunks/b72137c63b7f2a525d9e.js +1 -0
  69. package/assets/esri/core/workers/chunks/b8c8acf75e09014d8346.js +1 -0
  70. package/assets/esri/core/workers/chunks/c2264451d12f1fbaad22.js +1 -0
  71. package/assets/esri/core/workers/chunks/c6c86cbe65a58c3093ae.js +1 -0
  72. package/assets/esri/core/workers/chunks/{562800b0af52a38a311b.js → cf25f487fe4eb1579aee.js} +1 -1
  73. package/assets/esri/core/workers/chunks/e717832326d1b1f817d3.js +1 -0
  74. package/assets/esri/core/workers/chunks/{bd2dcc55ac3418421ee5.js → f20ba89ac21f05b7020c.js} +1 -1
  75. package/assets/esri/core/workers/chunks/f3b51aa0a1a8fc3b231c.js.LICENSE.txt +1 -1
  76. package/assets/esri/core/workers/chunks/{a41f9b6deff08196566e.js → fa894be8cfb6ed485df9.js} +1 -1
  77. package/assets/esri/core/workers/chunks/fe3703ec198cbfebec30.js +1 -0
  78. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +7 -1
  79. package/assets/esri/themes/base/widgets/_TimeSlider.scss +1 -0
  80. package/assets/esri/themes/dark/main.css +1 -1
  81. package/assets/esri/themes/light/main.css +1 -1
  82. package/assets/esri/themes/light/view.css +1 -1
  83. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  84. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  85. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  86. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  87. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  88. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  89. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  90. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  91. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  92. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  93. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  94. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  95. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  96. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  97. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  98. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  99. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  100. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  101. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  102. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  103. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  104. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  105. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  106. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  107. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  108. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  109. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  110. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  111. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  112. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  113. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  114. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  115. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  116. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  117. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  118. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  119. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  120. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  121. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  122. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  123. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  124. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  125. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  126. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  127. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  128. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  129. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  130. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  131. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  132. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  133. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  134. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  135. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  136. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  137. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  138. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  139. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  140. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  141. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  142. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  143. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  144. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  145. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  146. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  147. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  148. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  149. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  150. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  151. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  152. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  153. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  154. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  155. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  156. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  157. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  158. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  159. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  160. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  161. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  162. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  163. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  164. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  165. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  166. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  167. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  168. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  169. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  170. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  171. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  172. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  173. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  174. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  175. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  176. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  177. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  178. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  179. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  180. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  181. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  182. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  183. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  184. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  185. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  186. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  187. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  188. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  189. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  190. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  191. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  192. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  193. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  194. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  195. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  196. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  197. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  198. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  199. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  200. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
  201. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
  202. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
  203. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
  204. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
  205. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
  206. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
  207. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
  208. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
  209. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
  210. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
  211. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
  212. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
  213. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
  214. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
  215. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
  216. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
  217. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
  218. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
  219. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
  220. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
  221. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
  222. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_no.json +1 -1
  223. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
  224. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
  225. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
  226. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
  227. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
  228. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
  229. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
  230. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
  231. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
  232. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
  233. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
  234. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
  235. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
  236. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
  237. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
  238. package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
  239. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  240. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  241. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  242. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  243. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  244. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  245. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  246. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  247. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  248. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  249. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  250. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  251. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  252. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  253. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  254. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  255. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  256. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  257. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  258. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  259. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  260. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  261. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  262. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  263. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  264. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  265. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  266. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  267. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  268. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  269. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  270. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  271. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  272. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  273. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  274. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  275. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  276. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  277. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  278. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  279. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  280. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  281. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  282. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  283. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  284. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  285. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  286. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  287. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  288. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  289. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  290. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  291. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  292. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  293. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  294. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  295. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  296. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  297. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  298. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  299. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  300. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  301. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  302. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  303. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  304. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  305. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  306. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  307. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  308. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  309. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  310. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  311. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  312. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  313. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  314. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  315. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  316. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  317. package/assets/esri/widgets/Search/t9n/Search_ar.json +1 -1
  318. package/assets/esri/widgets/Search/t9n/Search_bg.json +1 -1
  319. package/assets/esri/widgets/Search/t9n/Search_bs.json +1 -1
  320. package/assets/esri/widgets/Search/t9n/Search_ca.json +1 -1
  321. package/assets/esri/widgets/Search/t9n/Search_cs.json +1 -1
  322. package/assets/esri/widgets/Search/t9n/Search_da.json +1 -1
  323. package/assets/esri/widgets/Search/t9n/Search_de.json +1 -1
  324. package/assets/esri/widgets/Search/t9n/Search_el.json +1 -1
  325. package/assets/esri/widgets/Search/t9n/Search_es.json +1 -1
  326. package/assets/esri/widgets/Search/t9n/Search_et.json +1 -1
  327. package/assets/esri/widgets/Search/t9n/Search_fi.json +1 -1
  328. package/assets/esri/widgets/Search/t9n/Search_fr.json +1 -1
  329. package/assets/esri/widgets/Search/t9n/Search_he.json +1 -1
  330. package/assets/esri/widgets/Search/t9n/Search_hr.json +1 -1
  331. package/assets/esri/widgets/Search/t9n/Search_hu.json +1 -1
  332. package/assets/esri/widgets/Search/t9n/Search_id.json +1 -1
  333. package/assets/esri/widgets/Search/t9n/Search_it.json +1 -1
  334. package/assets/esri/widgets/Search/t9n/Search_ja.json +1 -1
  335. package/assets/esri/widgets/Search/t9n/Search_ko.json +1 -1
  336. package/assets/esri/widgets/Search/t9n/Search_lt.json +1 -1
  337. package/assets/esri/widgets/Search/t9n/Search_lv.json +1 -1
  338. package/assets/esri/widgets/Search/t9n/Search_nl.json +1 -1
  339. package/assets/esri/widgets/Search/t9n/Search_no.json +1 -1
  340. package/assets/esri/widgets/Search/t9n/Search_pl.json +1 -1
  341. package/assets/esri/widgets/Search/t9n/Search_pt-BR.json +1 -1
  342. package/assets/esri/widgets/Search/t9n/Search_pt-PT.json +1 -1
  343. package/assets/esri/widgets/Search/t9n/Search_ro.json +1 -1
  344. package/assets/esri/widgets/Search/t9n/Search_ru.json +1 -1
  345. package/assets/esri/widgets/Search/t9n/Search_sk.json +1 -1
  346. package/assets/esri/widgets/Search/t9n/Search_sl.json +1 -1
  347. package/assets/esri/widgets/Search/t9n/Search_sr.json +1 -1
  348. package/assets/esri/widgets/Search/t9n/Search_sv.json +1 -1
  349. package/assets/esri/widgets/Search/t9n/Search_th.json +1 -1
  350. package/assets/esri/widgets/Search/t9n/Search_tr.json +1 -1
  351. package/assets/esri/widgets/Search/t9n/Search_uk.json +1 -1
  352. package/assets/esri/widgets/Search/t9n/Search_vi.json +1 -1
  353. package/assets/esri/widgets/Search/t9n/Search_zh-CN.json +1 -1
  354. package/assets/esri/widgets/Search/t9n/Search_zh-HK.json +1 -1
  355. package/assets/esri/widgets/Search/t9n/Search_zh-TW.json +1 -1
  356. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ar.json +1 -1
  357. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_bg.json +1 -1
  358. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_bs.json +1 -1
  359. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ca.json +1 -1
  360. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_cs.json +1 -1
  361. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_da.json +1 -1
  362. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_de.json +1 -1
  363. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_el.json +1 -1
  364. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_es.json +1 -1
  365. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_et.json +1 -1
  366. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_fi.json +1 -1
  367. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_fr.json +1 -1
  368. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_he.json +1 -1
  369. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_hr.json +1 -1
  370. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_hu.json +1 -1
  371. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_id.json +1 -1
  372. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_it.json +1 -1
  373. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ja.json +1 -1
  374. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ko.json +1 -1
  375. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_lt.json +1 -1
  376. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_lv.json +1 -1
  377. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_nl.json +1 -1
  378. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_no.json +1 -1
  379. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_pl.json +1 -1
  380. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_pt-BR.json +1 -1
  381. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_pt-PT.json +1 -1
  382. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ro.json +1 -1
  383. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_ru.json +1 -1
  384. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sk.json +1 -1
  385. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sl.json +1 -1
  386. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sr.json +1 -1
  387. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_sv.json +1 -1
  388. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_th.json +1 -1
  389. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_tr.json +1 -1
  390. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_uk.json +1 -1
  391. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_vi.json +1 -1
  392. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_zh-CN.json +1 -1
  393. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_zh-HK.json +1 -1
  394. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast_zh-TW.json +1 -1
  395. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ar.json +1 -1
  396. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bg.json +1 -1
  397. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bs.json +1 -1
  398. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ca.json +1 -1
  399. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_cs.json +1 -1
  400. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_da.json +1 -1
  401. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_de.json +1 -1
  402. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_el.json +1 -1
  403. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_es.json +1 -1
  404. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_et.json +1 -1
  405. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fi.json +1 -1
  406. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fr.json +1 -1
  407. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_he.json +1 -1
  408. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hr.json +1 -1
  409. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hu.json +1 -1
  410. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_id.json +1 -1
  411. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_it.json +1 -1
  412. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ja.json +1 -1
  413. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ko.json +1 -1
  414. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lt.json +1 -1
  415. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lv.json +1 -1
  416. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_nl.json +1 -1
  417. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_no.json +1 -1
  418. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pl.json +1 -1
  419. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-BR.json +1 -1
  420. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-PT.json +1 -1
  421. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ro.json +1 -1
  422. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ru.json +1 -1
  423. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sk.json +1 -1
  424. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sl.json +1 -1
  425. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sr.json +1 -1
  426. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sv.json +1 -1
  427. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_th.json +1 -1
  428. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_tr.json +1 -1
  429. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_uk.json +1 -1
  430. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_vi.json +1 -1
  431. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-CN.json +1 -1
  432. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-HK.json +1 -1
  433. package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-TW.json +1 -1
  434. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ar.json +1 -1
  435. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bg.json +1 -1
  436. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bs.json +1 -1
  437. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ca.json +1 -1
  438. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_cs.json +1 -1
  439. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_da.json +1 -1
  440. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_de.json +1 -1
  441. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_el.json +1 -1
  442. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_es.json +1 -1
  443. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_et.json +1 -1
  444. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fi.json +1 -1
  445. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fr.json +1 -1
  446. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_he.json +1 -1
  447. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hr.json +1 -1
  448. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hu.json +1 -1
  449. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_id.json +1 -1
  450. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_it.json +1 -1
  451. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ja.json +1 -1
  452. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ko.json +1 -1
  453. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lt.json +1 -1
  454. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lv.json +1 -1
  455. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_nl.json +1 -1
  456. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_no.json +1 -1
  457. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pl.json +1 -1
  458. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-BR.json +1 -1
  459. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-PT.json +1 -1
  460. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ro.json +1 -1
  461. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ru.json +1 -1
  462. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sk.json +1 -1
  463. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sl.json +1 -1
  464. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sr.json +1 -1
  465. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sv.json +1 -1
  466. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_th.json +1 -1
  467. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_tr.json +1 -1
  468. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_uk.json +1 -1
  469. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_vi.json +1 -1
  470. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-CN.json +1 -1
  471. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-HK.json +1 -1
  472. package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-TW.json +1 -1
  473. package/chunks/PointRenderer.glsl.js +2 -2
  474. package/chunks/aiServices.js +1 -1
  475. package/chunks/array.js +1 -1
  476. package/chunks/languageUtils.js +1 -1
  477. package/config.js +1 -1
  478. package/core/urlUtils.js +1 -1
  479. package/geometry/support/MeshTexture.js +1 -1
  480. package/geometry/support/coordsUtils.js +1 -1
  481. package/interfaces.d.ts +340 -94
  482. package/kernel.js +1 -1
  483. package/layers/CatalogLayer.js +1 -1
  484. package/layers/FeatureLayer.js +1 -1
  485. package/layers/VideoLayer.js +1 -1
  486. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  487. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  488. package/layers/mixins/ArcGISImageService.js +1 -1
  489. package/layers/mixins/FeatureLayerBase.js +1 -1
  490. package/layers/support/PlaybackInfo.d.ts +4 -0
  491. package/layers/support/arcgisLayers.js +1 -1
  492. package/layers/support/fetchService.js +1 -1
  493. package/layers/support/layerUtils.js +1 -1
  494. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  495. package/networks/CircuitManager.js +1 -1
  496. package/networks/UnitIdentifierManager.js +1 -1
  497. package/package.json +2 -2
  498. package/portal/support/layersLoader.js +1 -1
  499. package/portal/support/loadUtils.js +1 -1
  500. package/portal/support/portalLayers.js +1 -1
  501. package/renderers/support/rendererConversion.js +1 -1
  502. package/rest/networks/circuits/alterCircuit.js +1 -1
  503. package/rest/networks/circuits/createCircuit.js +1 -1
  504. package/rest/networks/circuits/deleteCircuits.js +1 -1
  505. package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
  506. package/rest/networks/circuits/support/EditCircuitsResult.js +5 -0
  507. package/rest/networks/circuits/support/ExportCircuitsResult.js +1 -1
  508. package/rest/networks/circuits/support/VerifyCircuitsResult.js +1 -1
  509. package/rest/networks/support/utils.js +5 -0
  510. package/rest/networks/unitIdentifiers/insertGap.js +1 -1
  511. package/rest/networks/unitIdentifiers/reset.js +1 -1
  512. package/rest/networks/unitIdentifiers/resize.js +1 -1
  513. package/rest/networks/unitIdentifiers/support/EditUnitIdentifiersResult.js +5 -0
  514. package/support/arcadeUtils.js +1 -1
  515. package/support/popupUtils.js +1 -1
  516. package/support/revision.js +1 -1
  517. package/symbols/support/symbolConversion.js +1 -1
  518. package/views/2d/engine/flow/dataUtils.js +1 -1
  519. package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
  520. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  521. package/views/3d/FocusAreasView.js +1 -1
  522. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  523. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  524. package/views/3d/layers/FlowSubView3D.js +1 -1
  525. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  526. package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
  527. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  528. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  529. package/views/3d/layers/RouteLayerView3D.js +1 -1
  530. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  531. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  532. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  533. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  534. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  535. package/views/3d/layers/graphics/Labeler.js +1 -1
  536. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  537. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  538. package/views/3d/state/controllers/RotateController.js +1 -1
  539. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  540. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  541. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  542. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  543. package/views/3d/state/utils/navigationUtils.js +1 -1
  544. package/views/3d/support/DisplayQualityProfile.js +1 -1
  545. package/views/3d/support/QualitySettings.js +1 -1
  546. package/views/3d/support/flow/FlowSubViewExtent3D.js +5 -0
  547. package/views/3d/support/flow/FlowSubViewTiles3D.js +5 -0
  548. package/views/3d/support/flow/loadUtils.js +1 -1
  549. package/views/3d/support/sunUtils.js +1 -1
  550. package/views/3d/terrain/OverlayManager.js +1 -1
  551. package/views/3d/terrain/TerrainSurface.js +1 -1
  552. package/views/3d/terrain/TileRenderer.js +1 -1
  553. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  554. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  555. package/views/3d/webgl-engine/lib/textureUtils.js +1 -1
  556. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  557. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  558. package/views/ToolViewManager.js +1 -1
  559. package/views/View2D.js +1 -1
  560. package/views/Viewport2DMixin.js +1 -1
  561. package/views/support/layerViewUtils.js +1 -1
  562. package/views/ui/UI.js +1 -1
  563. package/views/webgl/FramebufferObject.js +1 -1
  564. package/views/webgl/Parameters.js +1 -1
  565. package/widgets/BasemapLayerList.js +1 -1
  566. package/widgets/CatalogLayerList.js +1 -1
  567. package/widgets/Editor/EditorViewModel.js +1 -1
  568. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  569. package/widgets/Editor/UpdateWorkflow.js +1 -1
  570. package/widgets/Editor/UpdateWorkflowData.js +1 -1
  571. package/widgets/Editor/workflowUtils.js +1 -1
  572. package/widgets/Editor.js +1 -1
  573. package/widgets/Expand.js +1 -1
  574. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  575. package/widgets/Feature/FeatureViewModel.js +1 -1
  576. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  577. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  578. package/widgets/FeatureForm/FieldInput.js +1 -1
  579. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  580. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  581. package/widgets/LayerList/LayerListItem.js +1 -1
  582. package/widgets/LayerList.js +1 -1
  583. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  584. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  585. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  586. package/widgets/OrientedImageryViewer.js +1 -1
  587. package/widgets/Print.js +1 -1
  588. package/widgets/Search.js +1 -1
  589. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  590. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  591. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  592. package/widgets/Sketch.js +1 -1
  593. package/widgets/TableList.js +1 -1
  594. package/widgets/TimeSlider.js +1 -1
  595. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  596. package/widgets/support/SelectionList/FeatureItem.js +1 -1
  597. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  598. package/widgets/support/SelectionList/LayerItem.js +1 -1
  599. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  600. package/widgets/support/SelectionList/selectionListUtils.js +1 -1
  601. package/widgets/support/SelectionList.js +1 -1
  602. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  603. package/widgets/support/SelectionToolbar.js +1 -1
  604. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  605. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  606. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  607. package/assets/esri/core/workers/chunks/2dc54925d473a959119c.js +0 -1
  608. package/assets/esri/core/workers/chunks/464c15b2779f9b803a06.js +0 -1
  609. package/assets/esri/core/workers/chunks/543b8dc8baa21b99147b.js +0 -1
  610. package/assets/esri/core/workers/chunks/5d3246b8fc50f9d9e2c4.js +0 -1
  611. package/assets/esri/core/workers/chunks/5d50a8d0427eab0a2514.js +0 -1
  612. package/assets/esri/core/workers/chunks/7a2189614f2dad49ffcd.js +0 -1
  613. package/assets/esri/core/workers/chunks/91d484960df25ec9554b.js +0 -1
  614. package/assets/esri/core/workers/chunks/9cd55043f3d789f41815.js +0 -1
  615. package/assets/esri/core/workers/chunks/b09539a4b491a90a6bbe.js +0 -1
  616. package/assets/esri/core/workers/chunks/b6c3a2d93a59df9a1418.js +0 -1
  617. package/assets/esri/core/workers/chunks/c45a314ace9725aa250e.js +0 -1
  618. package/assets/esri/core/workers/chunks/c6fa79ce324122e08dbb.js +0 -1
  619. package/assets/esri/core/workers/chunks/cbbbaccc0d3683e1c0fe.js +0 -1
  620. package/assets/esri/core/workers/chunks/e7a440476cd1eb4c6547.js +0 -1
  621. package/assets/esri/core/workers/chunks/e9993d4f2bfdc434fbcc.js +0 -1
  622. package/assets/esri/core/workers/chunks/eb23ce385b0d18959c7c.js +0 -1
  623. package/views/3d/support/flow/StreamlinesStyle3D.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 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};
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{toConst as a}from"../../../core/compilerUtils.js";import n from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as h}from"../../../core/maybe.js";import{MemCachePool as d}from"../../../core/MemCachePool.js";import p from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as c,isAbortError as g,isAborted as m}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as f,sync as T,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../core/unitUtils.js";import{property as E}from"../../../core/accessorSupport/decorators/property.js";import{subclass as S}from"../../../core/accessorSupport/decorators/subclass.js";import{i as w,c as C}from"../../../chunks/vec32.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as P}from"../../../geometry/ellipsoidUtils.js";import M from"../../../geometry/SpatialReference.js";import{getProjector as x}from"../../../geometry/projection/projectors.js";import{projectPointToVector as D}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as U}from"../../../geometry/projection/projectVectorToVector.js";import{create as R,equals as I,intersection as j,intersectsSphere as A,empty as V,expand as B}from"../../../geometry/support/aaBoundingRect.js";import{create as k,copy as N}from"../../../geometry/support/frustum.js";import{isPlateCarree as O}from"../../../geometry/support/spatialReferenceUtils.js";import{e as G,c as F,a as q}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as W}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as $}from"../../../layers/support/layerUtils.js";import{debugFlags as H}from"../support/debugFlags.js";import{ElevationRange as Q}from"../support/ElevationRange.js";import{ElevationUpdateEvent as z}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as X}from"../support/extentUtils.js";import{ClientType as Y}from"../support/index.js";import{updatingProgress as K}from"../support/updatingProperties.js";import{ElevationBounds as J}from"./ElevationBounds.js";import{ElevationData as Z,sampleElevation as ee}from"./ElevationData.js";import{create as te}from"./ExtentHelper.js";import{TextureUpdate as ie}from"./interfaces.js";import{LayerClass as re,LayerClasses as se}from"./LayerClass.js";import{OverlayManager as ae}from"./OverlayManager.js";import{PlanarPatch as ne}from"./PlanarPatch.js";import{RenderOrder as le}from"./RenderOrder.js";import{ScaleRangeQueries as oe}from"./ScaleRangeQueries.js";import{SphericalPatch as he}from"./SphericalPatch.js";import{SplitLimits as de}from"./SplitLimits.js";import{maxRootTiles as pe,tooManyRootTilesAfterChangeError as ue,tooManyRootTilesForLayerError as ce,maxTileNeighborLevelDelta as ge,maxMemoryLodBias as me}from"./TerrainConst.js";import{TerrainRenderer as _e}from"./TerrainRenderer.js";import fe from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as Te,isVectorTileLayerView as ye,neighborEdgeIndices as ve,internalAssert as Ee,oppositeEdge as Se,isSurfaceLayerView as we,isGroupLayerView as Ce,isMapTileLayerView as be,isBlendableLayerView as Le,isElevationLayerView as Pe,releaseTerrainData as Me,enableTerrainInternalChecks as xe,oppositeCorner as De,enableWaterproofTests as Ue,enableInternalTerrainChecks as Re,enableTerrainWaterproofChecks as Ie,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Ae,lijEquals as Ve}from"./Tile.js";import{printAllocations as Be}from"./TilePerLayerInfo.js";import{TileUpdate as ke}from"./TileUpdate.js";import{IteratorPreorder as Ne,IteratorPostorder as Oe,compareTilesByLij as Ge,hasLoadableSiblings as Fe,sortTilesByPOI as qe}from"./tileUtils.js";import{TilingSchemeLogic as We}from"./TilingSchemeLogic.js";import{TransparencyMode as $e}from"./TransparencyMode.js";import{UpsampleInfo as He}from"./UpsampleInfo.js";import{isCompositeBlendMode as Qe,blendModeFromString as ze}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as Xe}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as Ye}from"../webgl-engine/lib/basicInterfaces.js";import{hasLayerBasedScaleVisibility as Ke}from"../../support/layerViewUtils.js";import{RenderState as Je}from"../../support/RenderState.js";import{ImmediateTask as Ze,TaskPriority as et,noBudget as tt}from"../../support/Scheduler.js";import{TextureCompressionTracker as it}from"../../support/TextureCompressionTracker.js";import{Yield as rt}from"../../support/Yield.js";var st;let at=class extends(n.EventedMixin(i)){static{st=this}get allTiles(){return a(this._allTiles)}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=v(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 it,this._iteratorPool=new p(Ne,(e=>e.remove=()=>this._iteratorPool.release(e))),this._postorderIterator=new Oe,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new fe,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=b(),this._eyePosSurfaceSR=b(),this._splitLimits=new de,this._frustum=k(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new L,this._frameTask=Ze,this._allTiles=new u,this._upsampleInfoPool=new p(He),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=R(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=M.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new J(1/0,-1/0),this.rootTileElevationBounds=new J(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 ae({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?he:ne,this._ellipsoid=P(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),Ke()||(this._scaleRangeQueries=new oe)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new d(((e,t)=>i.newCache(e,t)),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",(e=>e.unloadMapData())),this._elevationQueryCache=new W(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(ie.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===Je.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?ie.UNFADED:ie.IMMEDIATE)}),f),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?ie.UNFADED:ie.IMMEDIATE)),f),_((()=>this.backgroundColor),((e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))}),T),_((()=>this.snapLevel),(()=>this._viewChanged=!0),T),_((()=>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=h(this._treeDebugger))}),y)]);const{spatialReference:a}=e;this._extentHelper=te(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 We({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(Y.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(Y.BASEMAP);const o=t.scheduler;this._frameTask=o.registerTask(et.TERRAIN_SURFACE,this),this.addHandles([_((()=>this._extentHelper.stencilEnabledExtents),(e=>this._renderer.setStencilEnabledLayerExtents(e)),y),_((()=>this.tilingSchemeLogic.tilingScheme),(()=>this._updateTilingScheme()),T),_((()=>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()),f),_((()=>e.qualitySettings?.fadeDuration),(e=>this._renderer.textureFadingEnabled=e>0),y),_((()=>e.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._renderer.pbrMode=e?Xe.Simplified:Xe.Disabled),y),_((()=>e.qualitySettings?.tiledSurface.elevationLevelDelta),(()=>this._updateAllTileGeometries())),_((()=>this._userClippingExtent),(()=>this._updateClippingExtent()),T)]),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",h(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",h(this.overlayManager)),this._tileCache=h(this._tileCache),Ae.prune(),this._treeDebugger=h(this._treeDebugger),this._renderer.destroy(),this._iteratorPool=h(this._iteratorPool),this._upsampleMapCache=h(this._upsampleMapCache),this._elevationQueryCache=h(this._elevationQueryCache),this._set("view",null),this._extentHelper=h(this._extentHelper),this._upsampleInfoPool=h(this._upsampleInfoPool),Be()}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=R(),r=X(t,i,e)?i:null,s=this._get("extent");return I(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=j(this.groundExtent,this._userClippingExtent,R()),t=this._get("extent");return I(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===$e.Opaque}get invisible(){return this._renderer.transparency===$e.Invisible}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[re.ELEVATION].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=x(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=w(lt,e,t,i);a(n,0,n,0);return ut(s,n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[re.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,ut(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!D(e,lt,this.spatialReference))return l.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(lt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;lt[0]>t[2]&&(i+=1),lt[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=x(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;G(e,ot);const r=q(ot);i(r,0,r,0);const s=new Q,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,!A(i.extent,ot))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 Q(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,q(ot),this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;ot[3]=t;let i=null;const r=e=>{if(e&&A(e.extent,ot)){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?$e.Invisible:$e.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?$e.Opaque:$e.Transparent;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;Te(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??M.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&O(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(st._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=ht;let s=t.rootTilesInExtent(e,i,5*pe);if(null!=this._rootTiles){if(s.length>pe)return void l.getLogger(this).warn(ue);const e=this._rootTiles.map((e=>e.lij)),t=r(e,s,Ve);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ve(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>pe&&(l.getLogger(this).warn(ce),s=t.rootTilesInExtent(e,i,pe)),this._setRootTiles(s.map((e=>this._newRootTile(e))));I(i,this._rootTilesExtent)||(this._rootTilesExtent=R(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(Ge),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(Ge);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)===ke.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(ke.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"),this.emit("tiles-changed",{allTiles:this.allTiles})}_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(ke.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Fe(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(ke.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 J(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 J(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=N(this._splitLimits.frustum??k(),t.frustum):this._splitLimits.frustum=null,N(this._frustum,e.frustum),C(this._eyePosRenderSR,t.eye),U(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[re.MAP].some(ye)&&e.setPendingUpdate(ke.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(ke.TEXTURE_FADING)?ke.TEXTURE_FADING:!!e.resetPendingUpdate(ke.TEXTURE_NOFADING)&&ke.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=dt.extent;V(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>B(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),dt.spatialReference=this.spatialReference,this.emit("elevation-change",dt),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"),xe&&this._checkTileInvariant(),!e.hasProgressed)return rt}_checkTileInvariant(){const e=new Map;this._allTiles.forAll((t=>e.set(t,new Set))),this._allTiles.forAll((t=>{if(Te(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(Te(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(ke.MERGE)){Te(!t.hasPendingUpdate(ke.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)Te(e.leaf||e.hasPendingUpdate(ke.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<=ge;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ge} (edge[${i}])`),Te(r,`tile level delta [${t.level}] vs [${e.level}] > ${ge}`))}Te(t.level-e.level<=ge,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ge,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(ve[i],s);if(null!=a){if(t.leaf&&t.level>=ge){let i=a;for(;t.level-i.level<ge;)i=i.parent;const s=[r,t.lij[1]>>ge,t.lij[2]>>ge];if(!Ve(s,i.lij)){const r=e.get(i);Te(!r.has(t),"Cannot already have neighbor"),r.add(t)}}Te(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),Te(t.level-a.level<=ge,`Tile level delta [${t.level}] vs [${a.level}] > ${ge}`)}}})),this._allTiles.forAll((t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);Te(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 ct(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(ke.MERGE),o=l?ke.MERGE:e.shouldSplit(r,s,i),h=o===ke.SPLIT;e.leaf?gt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(ke.SPLIT),e.leaf||e.setPendingUpdate(ke.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(ke.MERGE),e.leaf&&e.setPendingUpdate(ke.SPLIT)):(e.resetPendingUpdate(ke.SPLIT)&&e.updateAgentSuspension(),o===ke.ELEVATION&&e.updateAgents(re.ELEVATION),e.leaf||(e.setPendingUpdate(ke.MERGE),e.resetPendingUpdate(ke.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(qe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),e.madeProgress())}_markTileToUpdate(e){Ee(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(Ge);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Ee(r.loaded),Ee(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(Se(ve[t]),(t=>!(!t.loaded||!t.intersectsClippingArea)&&(Ee(e.has(t)||Ge(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,xe&&Ue&&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(ke.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(ke.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(ke.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(ke.SPLIT)){let t=!0;const i=s.level;if(i>=ge){const e=e=>e.leaf||i-e.level<ge;for(let r=0;r<4;++r){const a=s.findNeighborTile(ve[r],e);null!=a&&i-a.level===ge&&(t=!1,xe&&(Ee(a.leaf),Ee(a.hasPendingUpdate(ke.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(ke.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(ke.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(Ye.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*me}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(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.emit("tiles-changed",{allTiles:this.allTiles}),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(st._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){Te(e.leaf,"Tile that is already split should not be split again!"),Te(e.rendered,"Tile marked to split is not rendered"),_t(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),Te(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=>gt(e,e.hasPendingUpdate(ke.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){pt.spatialReference=this.spatialReference,pt.extent=e.extent,pt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",pt)}createTile(e,t,i,r){Te(!!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(ke.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Je.IDLE}_mergeTile(e){Te(!e.hasPendingUpdate(ke.SPLIT),"_mergeTile sanity check"),Te(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),Te(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),gt(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=tt){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),we(e)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(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(be(e)&&!$(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Le(e)||Ce(e))&&Qe(ze[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Pe(e)?re.ELEVATION:re.MAP}_registerTiledLayerView(e){const t=[];if((Le(e)||Ce(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ie.UNFADED)}))),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(ie.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this.getLayerIndexByUID(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||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===re.MAP){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)}));for(const r of se){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===re.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(re.MAP),e===ie.IMMEDIATE?this.renderer.updateTileTexture(t,ke.TEXTURE_NOFADING):t.updateRenderData(re.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=Ye.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,c(r),g(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===re.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Pe(i)?this._requestElevationTileData(e,i,r):Promise.reject():be(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!m(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{g(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer ${re.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,re.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[re.ELEVATION].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",re.ELEVATION,e.lij.toString());const s=new Z(e.lij,e.extent,i);e.dataArrived(r,re.ELEVATION,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:re.ELEVATION});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Me(s),m(i)||(console.error(`Tile ${e.lij.toString()} layer ${re.MAP}/${t.uid} error ${r}`),this._dataMissing(e,re.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),m(i)?Me(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.getLayerIndexByUID(re.MAP,t.uid);if(null==r)return Me(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,re.MAP,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:re.MAP})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.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.getLayerIndexByUID(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(!Ue)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){Re(e)}enableWaterproofnessChecks(e){Ie(e)}};e([E()],at.prototype,"_renderer",void 0),e([E({constructOnly:!0})],at.prototype,"_scaleRangeQueries",void 0),e([E({constructOnly:!0})],at.prototype,"view",void 0),e([E({constructOnly:!0})],at.prototype,"overlayManager",void 0),e([E({constructOnly:!0})],at.prototype,"terrainTextureCompressionTracker",void 0),e([E()],at.prototype,"_hasPendingUpdates",void 0),e([E()],at.prototype,"_asyncWorkItems",void 0),e([E()],at.prototype,"_allTilesDirty",void 0),e([E()],at.prototype,"_allTilesSorted",void 0),e([E()],at.prototype,"_viewChanged",void 0),e([E({type:Number})],at.prototype,"heading",void 0),e([E()],at.prototype,"_splitLimits",void 0),e([E({readOnly:!0})],at.prototype,"_watchUpdatingTracking",void 0),e([E()],at.prototype,"_frameTask",void 0),e([E()],at.prototype,"demResolution",null),e([E({readOnly:!0})],at.prototype,"snapLevel",null),e([E({readOnly:!0})],at.prototype,"lodSnappingEnabled",null),e([E()],at.prototype,"_userClippingExtent",null),e([E()],at.prototype,"_rootTilesExtent",void 0),e([E({readOnly:!0})],at.prototype,"extent",null),e([E({readOnly:!0})],at.prototype,"groundExtent",null),e([E({readOnly:!0})],at.prototype,"_tilingSchemeExtent",null),e([E({readOnly:!0})],at.prototype,"updating",null),e([E({readOnly:!0})],at.prototype,"running",null),e([E(K)],at.prototype,"updatingProgress",void 0),e([E({readOnly:!0})],at.prototype,"updatingProgressValue",null),e([E()],at.prototype,"_maxNumUpdating",void 0),e([E()],at.prototype,"baseOpacity",null),e([E()],at.prototype,"hasCompositeBlendMode",void 0),e([E({readOnly:!0})],at.prototype,"viewingMode",null),e([E()],at.prototype,"maxTextureScale",void 0),e([E({readOnly:!0})],at.prototype,"ready",null),e([E({value:le.FRONT_TO_BACK})],at.prototype,"renderOrder",null),e([E({readOnly:!0})],at.prototype,"rootTiles",null),e([E()],at.prototype,"_rootTiles",void 0),e([E({readOnly:!0})],at.prototype,"spatialReference",null),e([E({type:t})],at.prototype,"backgroundColor",null),e([E({value:!1})],at.prototype,"slicePlaneEnabled",null),e([E({readOnly:!0})],at.prototype,"tilingScheme",void 0),e([E({readOnly:!0})],at.prototype,"tilingSchemeLocked",null),e([E({readOnly:!0})],at.prototype,"tilingSchemeLogic",void 0),e([E()],at.prototype,"wireframe",null),e([E({value:!1})],at.prototype,"suspended",null),e([E()],at.prototype,"fadeDuration",null),e([E()],at.prototype,"visibleElevationBounds",void 0),e([E()],at.prototype,"rootTileElevationBounds",void 0),e([E()],at.prototype,"_layerViewsDirty",void 0),e([E()],at.prototype,"renderPatchBorders",null),e([E()],at.prototype,"visualizeNormals",null),e([E()],at.prototype,"renderingDisabled",null),at=st=e([S("esri.views.3d.terrain.TerrainSurface")],at);const nt=at,lt=b(),ot=F(),ht=R();new u;const dt=new z("ground"),pt={spatialReference:null,extent:null,scale:0};function ut(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 ee(t,i,s)}return null}class ct{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 gt(e,t){!e.leaf||e.level<ge||Tt(e,(e=>{t&&mt(e);const i=ft(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ft(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function mt(e){if(e.hasPendingUpdate(ke.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(ke.MERGE);)t=t.parent;e.resetPendingUpdate(ke.MERGE),e.leaf&&e.setPendingUpdate(ke.SPLIT),e.level<ge||Tt(e,(e=>{mt(e)}))}function _t(e){e.level<ge||Tt(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ft(t));)t=t.parent}}))}function ft(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function Tt(e,t){if(e.level<ge)return;const i=e.level-ge,r=e.lij[1]>>ge,s=e.lij[2]>>ge,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(ve[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{nt 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 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};
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,l,p,d){this._compositor.ensureBuffer(i);const h=e.surface.baseOpacity;let b=!1,y=N.LINEAR_MIPMAP_LINEAR,g=!1,I=0;for(let w=r;w>=0;w--){const t=e.surface.layerViewByIndex(w,m.MAP),r=t.layer,k=_(t),A=v(e,w,k),P=r.opacity,E=!j(e,t);if(!A||(0===P||E)&&!d)continue;if(u(t))continue;const O=!a(r)&&!b;O&&(b=!0);let L=!1;p.forEach((e=>{e.start===w&&(e.output=s?M.Composite:l&&O?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,e.baseOpacity=O?h:1,X.push(e),this._compositor.openGroup(i),L=!0)}));const R=0===I,D=L?M.GroupBackgroundComposite:l&&R?this.backgroundIsGrid?M.GridComposite:M.ColorComposite:M.Composite,B=C[f(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=O&&!L&&h<1?h:1,this._passParameters.opacity=P,T(A)?g=this._compositor.drawVectorData(this._passParameters,D,i,B,A,n,this.tileSize,g):x(A)?(this._compositor.drawRasterData(this._passParameters,D,i,B,A),H(A)&&(y=N.NEAREST)):this._dataToTexture(A,c(r))&&(this._passParameters.texture=A.sourceLayerInfo.data.texture,this._passParameters.offset=A.offset,this._passParameters.scale=A.scale,this._compositor.drawImageData(this._passParameters,D,i,B));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])}I++}const k=e.renderData,A=d||b&&h<1,P=k.ensureTexture(i,A,t,(()=>this._buildTexture(i,A,y)));this._compositor.copyFBOToTexture(P),this._compositor.unbind(),k.setTextureReference(new w(P,t,J,b?1:h,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{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as w,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as H}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as y}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as _e}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as pe}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as me,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Te}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Pe}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Ie,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=m($.infinite),this._state=m(Pe.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=m(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new me(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(this._renderContext),this._plugins=new Q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),u),_((()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):I;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),c),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),c),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,Z.prune(),Ae.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=le(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(_e.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(_e.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.DRAPED_MATERIAL,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(_e.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(_e.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(_e.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ve(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,R)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&0!==(this.plugins.renderOccludedFlags&se.OccludeAndTransparentStencil)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(G.Color,pe.INTEGRATED_MESH)&&this._plugins.produces(G.Color,pe.OCCLUDED_GROUND)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,pe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=de.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Te(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=re,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,c=e===Pe.IDLE?r:i,m=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,c,m),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/p,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,_=l?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=_,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const u=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(t),s.setGLViewport(this._rctx);const p=this._framebuffer,c=p.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a),this._ensureBindParametersSSR(t),this._precompileShaders(m,g,_),this._renderContext.output=_,p.bind(),this._bindParameters.mainDepth=p.depth.attachment,this._renderOpaque(m),this._renderTransparent(g,m,_),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),p.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),p.update((e=>this._renderNodes(N.VIEWSHED,e))),p.update((e=>this._renderNodes(N.LASERLINES,e))),p.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),p.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(s,this._bindParameters.lighting.mainLight.direction,f);const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;p.update((e=>this._renderNodes(D.COMPOSITE,e))),this._shadowMap.disposeOffscreenBuffers();const A=!(r!==de.Default||d||o&&!i),T=this._pluginInput.get(D.COMPOSITE),E=A?M:this.fboCache.acquire(T.fbo.width,T.fbo.height,N.ANTIALIASING),R=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(T,E,!1);let P;this._pluginInput.set(N.ANTIALIASING,R),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,R,_),P=this._renderNodes(N.HIGHLIGHTS,R)):(P=this._renderNodes(N.HIGHLIGHTS,R),this._renderHUD(V.NotOccluded,P,_));const S=this._renderNodes(N.MAGNIFIER,P);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(p.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),p.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Te(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(pe.OCCLUSION_PIXELS),this._plugins.precompile(pe.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Se.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(e){this._bindParameters.overlay=this.overlay?.render(e),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),s.moveSnapshot(ge.Highlight),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<H)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=y,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._shadowAccumulator.active&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",U.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(pe.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(pe.OCCLUDED_GROUND),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(pe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ye)}_precompileOpaqueGeometry(){this._plugins.precompile(...xe)}_renderOpaqueGeometry(){this._plugins.render(...xe)}_renderTransparentGeometry(){this._plugins.render(...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,pe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(pe.TRANSPARENT_TERRAIN);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,I),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,pe.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",U.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(pe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(pe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(pe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Ne.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,pe.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>k?U.RG8UINT:U.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(V.Both)}_renderShadowAccumulation(e,t,r){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.Both){const i=e===Ne.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,U.RGBA16FLOAT),_=t===G.ColorEmission;_&&l.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ie,U.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,C),n(),l.detachDepth(),h.oitPass=ae.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),a?u.acquireDepth(v.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(I,!!a),n(),u.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...xe);if(t){this._plugins.render(pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN);const e=this._framebuffer;e.update((e=>this._renderNodes(N.OPAQUE_TERRAIN,e))),e.bind(),this._plugins.render(pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS)}const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(pe.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(pe.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new W(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=R:(T(Ge,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Fe),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=R,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(J.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Ne;e([f({readOnly:!0})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const He=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL],ye=[pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[pe.LINE_CALLOUTS_HUD_DEPTH,pe.HUD_MATERIAL,pe.LABEL_MATERIAL],Ue=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_TERRAIN,pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN],Fe=P(),Ge=P(),qe=P();function Ve(e){return t=>e.immediate.schedule(t)}export{De as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as i}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as s,lerp as a}from"../../../../core/mathUtils.js";import{removeMaybe as n,abortMaybe as h,destroyMaybe as o,releaseMaybe as d}from"../../../../core/maybe.js";import{throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as _,syncAndInitial as u,initial as p,sync as c}from"../../../../core/reactiveUtils.js";import{signal as m}from"../../../../core/signal.js";import{Milliseconds as g}from"../../../../core/time.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as A,invert as T,multiply as E}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as R,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as S}from"../../../../chunks/vec42.js";import{ZEROS as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{fromValues as w,ZEROS as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as O}from"../../../../geometry/support/Indices.js";import{RenderCategory as D,InternalRenderCategory as N}from"../../webgl.js";import{innerAtmosphereFadeStart as H}from"../../environment/atmosphereUtils.js";import{minNearDistanceInMeters as y}from"../../state/NearFarHeuristic.js";import{debugFlags as x}from"../../support/debugFlags.js";import{FBOCache as L,defaultWebGLFBO as M}from"../core/FBOCache.js";import{DepthFormat as v,ColorFormat as U}from"../core/FBOCacheFormats.js";import{RenderPassManager as F}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as G,isColorOrColorEmission as q}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as V}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{distanceFadeEnd as j}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as B}from"../effects/RenderNodes.js";import{RenderPluginManager as Q}from"../effects/RenderPluginManager.js";import{Blit as W}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as k,renderHighlightBuffer as z}from"../effects/highlight/Highlight.js";import{OITBlend as Y}from"../effects/transparency/OITBlend.js";import{AnimationTimer as X}from"./AnimationTimer.js";import{AnimationTimeStep as K}from"./AnimationTimeStep.js";import{RenderRequestType as J}from"./basicInterfaces.js";import{BoundingInfo as Z}from"./BoundingInfo.js";import{DepthRange as $}from"./DepthRange.js";import{depthRangeFromScene as ee,DepthRangeMode as te}from"./depthRangeUtils.js";import{hudFragmentOpacityParameters as re}from"./hudFragmentOpacityParameters.js";import{MainFramebuffer as ie}from"./MainFramebuffer.js";import{RenderOccludedFlag as se}from"./Material.js";import{OITPass as ae}from"./OITPass.js";import{RenderContext as ne,defaultRenderOccludedMask as he}from"./RenderContext.js";import{RendererBase as oe}from"./RendererBase.js";import{RendererTarget as de}from"./rendererUtils.js";import{setupFeatureDefaults as le,RenderFeature as _e}from"./RenderFeature.js";import{RenderPluginInput as ue}from"./RenderPluginInput.js";import{RenderSlot as pe}from"./RenderSlot.js";import{ShadowAccumulator as ce}from"./ShadowAccumulator.js";import{ShadowMap as me,SnapshotSlot as ge}from"./ShadowMap.js";import fe from"./SliceHelper.js";import{Transparency as be}from"./edgeRendering/interfaces.js";import{MergedRenderer as Ae}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as Te}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Ee,PerformanceCategory as Re}from"../statistics/RendererPerformanceInfo.js";import{RenderState as Pe}from"../../../support/RenderState.js";import{PixelFormat as Se,PixelType as Ce,FramebufferBit as we,ColorAttachment1 as Ie,ColorAttachment2 as Oe}from"../../../webgl/enums.js";let De=class extends oe{constructor(e,t,r,s,a,n){super({stage:e}),this._techniques=r,this._rctx=s,this._compositingHelper=a,this._requestRender=n,this._pluginsHas={hudElements:!1,water:!1},this.renderPassManager=new F,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new fe,this._blit=null,this._oitblend=null,this.sceneDepthRange=m($.infinite),this._state=m(Pe.IDLE),this._highQualityTransparencyEnabled=!0,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new K,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=m(0),this._lastFrameTime=g(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new ue,this._releaseNormals=e=>{e.some((({name:e})=>"normals"===e))&&this._pluginInput.release("normals")},this._debugNeedsDepth=!1,this.fboCache=new L(s),this._renderStateFeatures=m(le(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._framebuffer=new ie(this.fboCache),this.performanceInfo=new Ee(this._rctx),this._shadowMap=new me(this.fboCache,e.viewingMode),this._shadowAccumulator=new ce(this.fboCache,r,e,(e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t}),((t,r,i)=>{const s=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,r,i,!0,s),this._renderShadowCascades(G.Shadow,t.shadowMap),t.shadowMap.finish(),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)}),n),this._renderContext=new ne(this._rctx,this._shadowMap,r),this._nodes=new B(this._renderContext),this._plugins=new Q({renderContext:this._renderContext,techniques:r,materials:t,requestRender:n,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this._plugins.add(this.renderPassManager),this.addHandles([_((()=>e.view.state.camera),(()=>n()),u),_((()=>x.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(be.TRANSPARENT):()=>{},n()}),p),_((()=>e.view.environment.background?.color),(e=>{const t=e?i(e):I;S(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),n()}),u),_((()=>e.view.state.camera.relativeElevation),(e=>this._inGlobeView=(e??1/0)>=j),u),_((()=>this._bindParameters.clouds.fadeFactor),(()=>this._bindParameters.fadeLighting()),c),_((()=>this._bindParameters.clouds.data?.state),(()=>n()),c),_((()=>e.view.state.highlights),(e=>{this._bindParameters.highlights=e,n()}),p)])}destroy(){this._gpuTimerHandle=n(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=h(this._loadEdgeViewTask),this._edgeView=o(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),this._blit=null,this._oitblend=null,Z.prune(),Ae.prune(),O()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _framebufferSize(){return this._framebuffer.size}updateRenderFeatures(e=null,t=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=le(t,e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,r){this._renderStateFeatures.mutate((i=>i.set(t,e,r))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(_e.HighQualityTransparency)}get hasReflections(){return this._pluginsHas.water&&(this._ssrEnabled||this.isFeatureEnabled(_e.WaterReflection))}get _hasHighlights(){return this._plugins.produces(G.Highlight,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.DRAPED_MATERIAL,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(G.Highlight,pe.HUD_MATERIAL,pe.LABEL_MATERIAL)}get hasSSAO(){return(this.stage.view.qualitySettings.ambientOcclusion||this.isFeatureEnabled(_e.SSAO))&&!this._inGlobeView}get hasSMAA(){return this.stage.view.qualitySettings.antialiasingEnabled||this.isFeatureEnabled(_e.Antialiasing)}get fullResolutionAtmosphere(){return this.stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(_e.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=d(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.depth=d(this._bindParameters.depth),this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=r((async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");l(e);const r=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Ve(this.stage.view.resourceController)});return this.addHandles(_((()=>r.updating),(()=>this._requestRender()),c)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(r))),this._edgeViewCallbacks.length=0,r}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&A(this._bindParameters.ssr.reprojectionMatrix,R)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:t,_bindParameters:r}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){if(null!=e.environment.weather){const t=e.environment.weather;this._bindParameters.weather=t,this._bindParameters.snowCover=!!e.weatherVisible&&null!=t&&"snowy"===t.type&&"enabled"===t.snowCover}const t="virtual"!==e.environment.lighting.type;r.enableFillLights!==t&&(r.enableFillLights=t,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.shadowCast&&this._shadowAccumulator.setOptions(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&0!==(this.plugins.renderOccludedFlags&se.OccludeAndTransparentStencil)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(G.Color,pe.INTEGRATED_MESH)&&this._plugins.produces(G.Color,pe.OCCLUDED_GROUND)}updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(G.Color,...ve),has.water=this._plugins.produces(G.Normal,pe.DRAPED_WATER),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new X(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?n(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,r=de.Default,i=!1){try{return this._isRendering=!0,this._render(e,t,r,i)}catch(s){console.error(`Exception during rendering: ${s}`)}finally{this._isRendering=!1}return new Te(this._pluginInput.get(D.FINAL),null)}_updateHUDOccludedFragmentOpacity(e,t){const{idleOpacity:r,navigatingOpacity:i,maxDelta:n,tiltFadeStart:h,tiltFadeEnd:o,altitudeStart:d,altitudeEnd:l}=re,_=this.stage.view,u=_.stateManager.camera,p=_.qualitySettings.fadeDuration,c=e===Pe.IDLE?r:i,m=s((u.tilt-h)/(o-h),0,1),g=s(((u.position.z??0)-d)/(l-d),0,1),f=a(a(1,c,m),1,g),b=this._bindParameters.hudOccludedFragmentOpacity;if(p<=0||b===f||0===this._lastFrameTime||this._lastFrameTime>t)return this._bindParameters.hudOccludedFragmentOpacity=f,void(this._lastFrameTime=t);const A=t-this._lastFrameTime;this._lastFrameTime=t;const T=Math.max(1-r,Math.abs(r-i)),E=Math.min(T*A/p,n);E>=Math.abs(f-b)?this._bindParameters.hudOccludedFragmentOpacity=f:(this._bindParameters.hudOccludedFragmentOpacity=b+Math.sign(f-b)*E,this._requestRender())}_render(e,t,r=de.Default,i){this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r===de.Default,this._disposeBindBuffers();const{camera:s,contentCamera:a,mode:n,alignPixelEnabled:h}=e;this._state.value=n;const o=this._nodes.produces("magnifier-color"),d=this._nodes.produces(D.FINAL),l=this._nodes.require("emissive",N.TRANSPARENT_ENVIRONMENT,D.COMPOSITE,D.FINAL)>0&&this._plugins.hasEmissions,_=l?G.ColorEmission:G.Color;this._renderContext.time=t,this._renderContext.output=_,this._bindParameters.oitPass=ae.NONE,this._bindParameters.alignPixelEnabled=h,this._bindParameters.decorations=!i,this._bindParameters.mainDepth=null;const u=!i||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(N.VIEWSHED),this._renderOverlay(),s.setGLViewport(this._rctx);const p=this._framebuffer,c=p.initialize(s.fullWidth,s.fullHeight,this._backgroundColor,l);this.hasReflections?(c?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=c):c?.release(),this._ensureBindParametersCamera(s,a),this._updateHUDOccludedFragmentOpacity(n,t),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!i;const m=this._highQualityTransparency&&this._hasTransparentTerrain,g=this._plugins.produces(G.Color,...Le);this._precompilePrepasses(),this.performanceInfo.advance(Re.PREPARE);const f=this._computeShadowDepthRange(s);this._renderShadowMap(s,this._bindParameters.lighting.mainLight.direction,f),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(f,s,a,r===de.Screenshot),this._ensureBindParametersSSR(t),this._precompileShaders(m,g,_),this._renderContext.output=_,p.bind(),this._bindParameters.mainDepth=p.depth.attachment,this._renderOpaque(m),this._renderTransparent(g,m,_),this._shadowMap.disposeMainBuffer(),this._pluginInput.set(N.FOCUSAREA,this._renderFocusAreaGeometry()),p.update((e=>this._renderNodes(N.TRANSPARENT_ENVIRONMENT,e))),p.update((e=>this._renderNodes(N.VIEWSHED,e))),p.update((e=>this._renderNodes(N.LASERLINES,e))),p.update((e=>this._renderNodes(N.FOCUSAREA_COLOR,e))),this._pluginInput.release(N.FOCUSAREA),p.update((e=>this._renderNodes(N.OCCLUDED,e))),this._pluginInput.set("highlights",this._renderHighlightPrepass()),this._renderHighlightShadowMap(s,this._bindParameters.lighting.mainLight.direction,f);const b=r===de.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;p.update((e=>this._renderNodes(D.COMPOSITE,e))),this._shadowMap.disposeOffscreenBuffers();const A=!(r!==de.Default||d||o&&!i),T=this._pluginInput.get(D.COMPOSITE),E=A?M:this.fboCache.acquire(T.fbo.width,T.fbo.height,N.ANTIALIASING),R=this._nodes.produces(N.ANTIALIASING)?this._renderNodes(N.ANTIALIASING,E):this._blitFBO(T,E,!1);let P;this._pluginInput.set(N.ANTIALIASING,R),this._hasHUDHighlights?(this._renderHUD(V.NotOccluded,R,_),P=this._renderNodes(N.HIGHLIGHTS,R)):(P=this._renderNodes(N.HIGHLIGHTS,R),this._renderHUD(V.NotOccluded,P,_));const S=this._renderNodes(N.MAGNIFIER,P);return o&&!i&&r===de.Default&&!d&&this._blitFBO(S),d?(S.attachDepth(p.depth),this._blitFBO(this._renderNodes(D.FINAL,S)),S.detachDepth()):this._pluginInput.set(D.FINAL,S),this._pluginInput.release("highlights"),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),p.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),r!==de.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),new Te(this._pluginInput.get(D.FINAL),b)}_precompileShaders(e,t,r){++this._plugins.context.techniques.precompiling,this._renderContext.output=r,this._precompileOpaqueGeometry(),this._nodes.precompile(N.OPAQUE_ENVIRONMENT),this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,this._renderContext.output=G.Depth,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),e&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._renderContext.output=r,this._plugins.precompile(pe.TRANSPARENT_TERRAIN),t&&(this._precompileTransparentGeometry(),this._hasTransparentTerrain&&(this._bindParameters.cullAboveTerrain=!1,this._precompileTransparentGeometry(),this._bindParameters.cullAboveTerrain=e)),this._nodes.precompile(N.FOCUSAREA),this._needsHUDVisibility&&this._plugins.precompile(pe.OCCLUSION_PIXELS),this._plugins.precompile(pe.LINE_CALLOUTS),this._precompileHUD(V.Occluded),this._bindParameters.terrainDepthTest=!1,this._bindParameters.cullAboveTerrain=!1,this._nodes.precompile(N.VIEWSHED,N.LASERLINES,N.FOCUSAREA_COLOR,N.OCCLUDED,N.ANTIALIASING,N.HIGHLIGHTS);const i=this._bindParameters;i.highlightMixTexture=i.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(V.NotOccluded),this._hasHighlights&&(i.highlights.forEach(((e,t)=>{i.highlightLevel=t,this._precompileAllGeometry(G.Highlight)})),i.highlightLevel=null),i.highlightMixTexture=null,this._nodes.precompile(D.COMPOSITE,N.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(N.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(Re.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._renderContext.output;++this._techniques.precompiling;const t=this._framebufferSize;let r=this.fboCache.acquire(t.width,t.height,"olid");return r.acquireDepth(v.DEPTH24_STENCIL8),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(Re.OBJECT_AND_LAYER_ID_COLOR),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,r=e===J.BACKGROUND;if(r||t){const e=r?this.performanceInfo.elapsedTime:0;let i=0;t?i=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const s=Math.max(e,i);this._animationTimestep.frame(s,r)}}readMainDepth(e,t){const{mainDepth:r,camera:i}=this._bindParameters;if(!r)return;const s=this.fboCache.acquire(this._framebufferSize.width,this._framebufferSize.height,"linear-depth");this._rctx.bindFramebuffer(s.fbo),i.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(I),this._compositingHelper.blitDepthToLinearDepth(this._bindParameters,r),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),s.fbo?.readPixels(e[0],e[1],e[2],e[3],Se.RGBA,Ce.UNSIGNED_BYTE,t),s.release()}readHUDVisibility(e,t,r,i,s){this._bindParameters.hudVisibility?.fbo?.readPixels(e,t,r,i,Se.RGBA,Ce.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_renderEdges(e){const t=this._edgeView;if(!t?.shouldRender())return;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"edges"),s=()=>t.render(this._bindParameters,e),a=this._bindParameters.geometryDepth;this.renderToTargets(s,i,a??this._framebuffer.depth,I),this._framebuffer.bind(),this._compositingHelper.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===be.OPAQUE?Re.OPAQUE_EDGES:Re.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(),this._bindParameters.overlay&&this.performanceInfo.advance(Re.OVERLAY)}_renderShadowMap(e,t,r){if(!this.shadowsEnabled)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(G.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ge.ExcludeHighlight),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(G.Shadow),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_renderHighlightShadowMap(e,t,r){if(!this.shadowsEnabled||!this._needsShadowHighlight)return;const{contentCamera:i}=this._bindParameters,s=this._shadowMap;s.start(e,t,r,this.isFeatureEnabled(_e.HighResolutionShadows),this.stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(G.ShadowHighlight,this._shadowMap),s.moveSnapshot(ge.Highlight),s.finish(),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,i),this.performanceInfo.advance(Re.SHADOW_MAP)}_precompileShadowCascades(e){for(const t of this._shadowMap.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){t.bindFbo();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e)}get _needsDepth(){return this._plugins.consumes(G.Depth)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(N.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(we.STENCIL),this._renderGeometryWithoutNormals(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(Re.DEPTH)):(e.detachDepth(),this._bindParameters.depth=d(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(!this._needsDepth)return void(this._bindParameters.depth=d(this._bindParameters.depth));const e=this._framebufferSize,t=this.fboCache.acquire(e.width,e.height,"depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this.renderAllGeometry(G.Depth),d(this._bindParameters.depth),this._bindParameters.depth=t.obtainDepthTexture(),t.release(),this.performanceInfo.advance(Re.DEPTH)}_renderTerrainDepth(e){if(this._bindParameters.terrainDepthTest=e,this._bindParameters.cullAboveTerrain=e,!e)return void(this._bindParameters.terrainDepth=d(this._bindParameters.terrainDepth));const t=this._renderContext.output;this._renderContext.output=G.Depth;const r=this._framebufferSize,i=this.fboCache.acquire(r.width,r.height,"terrain depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(i.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderTransparentTerrain(),d(this._bindParameters.terrainDepth),this._bindParameters.terrainDepth=i.obtainDepthTexture(),this._renderContext.output=t,i.release()}_renderGeometryDepth(e){if(!e)return void(this._bindParameters.geometryDepth=d(this._bindParameters.geometryDepth));const t=this._renderContext.output,{width:r,height:i}=this._framebufferSize,s=this.fboCache.acquire(r,i,"geometry depth",v.DEPTH24_STENCIL8);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(we.DEPTH|we.STENCIL),this._renderOpaqueAndTransparentGeometry(G.Depth),this._renderContext.output=t,d(this._bindParameters.geometryDepth),this._bindParameters.geometryDepth=s.obtainDepthTexture(),s.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return $.zero;const t=ee(e,this._plugins.plugins,this.stage.layers,te.SHADOW_CASTERS);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=$.infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<H)return void(this.sceneDepthRange.value=$.infinite);const t=e.clone();t.near=y,t.far=1e10;const r=ee(t,this._plugins.plugins,this.stage.layers,te.FULL_SCENE);r.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.far===r.far&&this.sceneDepthRange.value.near===r.near||(this.sceneDepthRange.value=r)}get _normalsRequired(){const e=this._nodes.require("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED,N.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(G.Normal),this._needsDepth&&this._precompileAllGeometry(G.Depth),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(G.ShadowHighlight),this._precompileShadowCascades(G.ShadowExcludeHighlight),this._precompileShadowCascades(G.ShadowHighlight)):this._precompileShadowCascades(G.Shadow)),this._shadowAccumulator.active&&this._precompileAllGeometry(G.Shadow)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"normals",U.RGBA8UNORM);r.acquireDepth(v.DEPTH24_STENCIL8),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(I,!0,!0),this._renderGeometryWithNormals(G.Normal);const i=this._nodes.optional("normals",D.FINAL,D.COMPOSITE,D.OPAQUE,D.TRANSPARENT,N.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(Re.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(!this.hasSSAO||!e)return;const t=this._nodes.produce(N.SSAO,this._pluginInput);return this._bindParameters.ssao=t,t&&this.performanceInfo.advance(Re.SSAO),t}_precompileAllGeometry(e){const t=this._renderContext.output;this._renderContext.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(pe.TRANSPARENT_TERRAIN),this._renderContext.output=t}renderAllGeometry(e){this._renderContext.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentTerrain()}precompileSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const r of t)this._renderContext.renderOccludedMask=r,this.precompileSlots(e,...Me);this._renderContext.renderOccludedMask=he}renderSlots(e,...t){for(const r of t)this._bindParameters.slot=r,e.forAll((e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)}))}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>se.Occlude&&this._plugins.render(pe.OCCLUDED_GROUND),this.renderSlots(e,...Me),this._renderContext.renderOccludedMask=he}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(pe.HUD_MATERIAL)}precompileViewshedShadowMap(){this._precompileAllGeometry(G.ViewshedShadow)}renderViewshedShadowMap(e){const{camera:t,contentCamera:r}=this._bindParameters,i=this._renderContext.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(G.ViewshedShadow),this._ensureBindParametersCamera(t,r),this._bindParameters.camera.setGLViewport(this._rctx),this._renderContext.output=i}_renderOpaqueAndTransparentGeometry(e){this._renderContext.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithNormals(e){this._renderContext.output=e,this._plugins.render(...He),this._renderTransparentTerrain()}_renderGeometryWithoutNormals(e){this._renderContext.output=e,this._plugins.render(...ye)}_precompileOpaqueGeometry(){this._plugins.precompile(...xe)}_renderOpaqueGeometry(){this._plugins.render(...xe)}_renderTransparentGeometry(){this._plugins.render(...Le)}get _hasTransparentTerrain(){return this._plugins.produces(G.Color,pe.TRANSPARENT_TERRAIN)}_renderTransparentTerrain(){const e=()=>this._plugins.render(pe.TRANSPARENT_TERRAIN);if(!q(this._renderContext.output))return void e();const t=this._framebufferSize,r=this.fboCache.acquire(t.width,t.height,"transparent terrain");return this.renderToTargets(e,r,this._framebuffer.depth,I),r}get _needsHUDVisibility(){return this._plugins.produces(this._renderContext.output,pe.OCCLUSION_PIXELS)}_renderHUDVisibility(){if(!this._needsHUDVisibility)return void(this._bindParameters.hudVisibility=d(this._bindParameters.hudVisibility));const{width:e,height:t}=this._framebufferSize;let r=this._bindParameters.hudVisibility;r?.fbo?.width===e&&r?.fbo?.height===t||(r?.release(),r=this.fboCache.acquire(e,t,"hud visibility",U.RGBA4UNORM),this._bindParameters.hudVisibility=r);const i=this._bindParameters.geometryDepth;r.attachDepth(i||this._framebuffer.depth),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer([0,1,0,1]),this._plugins.render(pe.OCCLUSION_PIXELS),r.detachDepth(),this._framebuffer.bind(),this.performanceInfo.advance(Re.HUD_VISIBILITY)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===V.Occluded){const e=()=>this._plugins.render(pe.LINE_CALLOUTS),t=this._framebufferSize,r=this.fboCache.acquireDepth(v.DEPTH16,t.width,t.height,"line callouts");this.renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(pe.LINE_CALLOUTS)}_precompileHUD(e){if(this._precompileHUDOutput(e),this._hasHighlights){const t=this._renderContext.output;this._renderContext.output=G.Highlight,this._precompileHUDOutput(e),this._renderContext.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...ve),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...ve),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t,r){if(this._pluginsHas.hudElements){if(this._oitEnabled){const i=this._renderOIT(Ne.HUD,r,e);this._rctx.bindFramebuffer(t.fbo),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,i.getTexture()),i.release()}else if(this._renderContext.output=r,e===V.Occluded){const t=()=>this._renderHUDElements(e),r=this._framebufferSize,i=this.fboCache.acquireDepth(v.DEPTH16,r.width,r.height,"hud");this.renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(v.DEPTH16),this._rctx.bindFramebuffer(t.fbo),this._renderHUDElements(e),t.detachDepth();this.performanceInfo.advance(e===V.Occluded?Re.HUD_OCCLUDED:Re.HUD)}}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...ve)}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(G.ShadowHighlight,pe.OPAQUE_MATERIAL)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:r}=this,i=this._framebufferSize,{highlights:s}=r,a=e.acquire(i.width,i.height,"highlights",s.length>k?U.RG8UINT:U.R8UINT);a.acquireDepth(v.DEPTH24_STENCIL8),t.bindFramebuffer(a.fbo);const{gl:n}=t;return n.clearBufferuiv(n.COLOR,0,[0,0,0,0]),this._renderContext.output=G.Highlight,t.bindFramebuffer(a.fbo),z(t,e,i,r,(()=>this._renderHighlightGeometries())),this.performanceInfo.advance(Re.HIGHLIGHTS),a}_renderHighlightGeometries(){this._plugins.render(...Ue),this._rctx.clear(we.DEPTH),this._renderHUDElements(V.Both)}_renderShadowAccumulation(e,t,r,i){this._shadowAccumulator.updateDepthRange(e),this._shadowAccumulator.accumulating&&this._bindParameters.depth&&this._shadowAccumulator.renderAccumulation(this._bindParameters.depth,t,r,i)&&this.performanceInfo.advance(Re.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this._oitEnabled&&q(this._renderContext.output)?(this._bindParameters.oitPass=ae.ColorAlpha,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.FrontFace,this._plugins.precompile(...Le),this._bindParameters.oitPass=ae.NONE):this._plugins.precompile(...Le)}_renderOIT(e,t,r=V.Both){const i=e===Ne.HUD,s=this._framebufferSize,a=i?this.fboCache.acquire(s.width,s.height,"oit hud composite"):null,n=i?()=>this._renderHUDElements(r):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this._renderContext.output;this._renderContext.output=t,h.oitPass=ae.ColorAlpha;const d=a?"oit hud color+alpha":"oit color+alpha",l=this.fboCache.acquire(s.width,s.height,d,U.RGBA16FLOAT),_=t===G.ColorEmission;_&&l.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),l.acquireColor(_?Oe:Ie,U.R16FLOAT),a||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),_&&this._rctx.clearBuffer(1,C),n(),l.detachDepth(),h.oitPass=ae.FrontFace;const u=this.fboCache.acquire(s.width,s.height,a?"oit hud front":"oit front");return _&&u.acquireColor(Ie,U.RGBA16FLOAT,"emissive"),a?u.acquireDepth(v.DEPTH16):u.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(u.fbo),this._rctx.clearFramebuffer(I,!!a),n(),u.detachDepth(),h.oitPass=ae.NONE,a?(this._rctx.bindFramebuffer(a.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(we.COLOR)):this._framebuffer.bind(),this._oitblend??=new Y(this._techniques),this._oitblend.blend(this._rctx,l,u,h,_),a?.detachDepth(),u.release(),l.release(),this._renderContext.output=o,a}_renderOpaque(e){const t=this.plugins.produces(G.Color,...xe);if(t){this._plugins.render(pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN);const e=this._framebuffer;e.update((e=>this._renderNodes(N.OPAQUE_TERRAIN,e))),e.bind(),this._plugins.render(pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS)}const r=this._framebuffer;r.update((e=>this._renderNodes(D.OPAQUE,e,t))),this.fboCache.debugCallback?.(D.OPAQUE,r.color.fbo),r.update((e=>this._renderNodes(N.OPAQUE_ENVIRONMENT,e))),this.fboCache.debugCallback?.(N.OPAQUE_ENVIRONMENT,r.color.fbo),this._renderTerrainDepth(e),this._renderEdges(be.OPAQUE)}_renderTransparent(e,t,r){const i=this._framebuffer;i.bind(),this._renderPlugins(pe.VOXEL,Re.VOXEL),this._renderHiddenTransparentEdges(),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry()),i.update((t=>this._renderNodes(D.TRANSPARENT,t,e))),this.fboCache.debugCallback?.(D.TRANSPARENT,i.color.fbo),this._renderGeometryDepth(t),this._renderHUDVisibility(),t||this._plugins.render(pe.LINE_CALLOUTS),this._renderEdges(be.TRANSPARENT);const s=this._hasTransparentTerrain?this._renderTransparentTerrain():null;s&&(this.performanceInfo.advance(Re.TRANSPARENT_TERRAIN),this._bindParameters.hudVisibility&&(t?this._renderLineCallouts(V.Occluded):(this._rctx.bindFramebuffer(this._bindParameters.hudVisibility?.fbo),this._compositingHelper.compositeHUD(this._bindParameters,s.getTexture())),this._renderHUD(V.Occluded,i.color,r))),this._bindParameters.cullAboveTerrain=!1,s&&(i.bind(),this._compositingHelper.compositePreMultipliedAlpha(this._bindParameters,s.getTexture()),s.release(),t&&(this._renderEdges(be.OPAQUE),e&&(this._oitEnabled?this._renderOIT(Ne.Geometry,r):this._renderTransparentGeometry(),this.performanceInfo.advance(Re.TRANSPARENT)),this._renderEdges(be.TRANSPARENT))),this._bindParameters.ssao=d(this._bindParameters.ssao),t&&this._renderLineCallouts(V.NotOccluded),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(Re.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH),this.performanceInfo.advance(Re.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderPlugins(e,t){this._plugins.produces(this._renderContext.output,e)&&(this._plugins.render(e),this.performanceInfo.advance(t))}_renderNodes(e,t,r=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return r&&this.performanceInfo.advance(e),t;const i=this._nodes.render(t,this._pluginInput,this._releaseNormals);return this.performanceInfo.advance(e),i}_blitFBO(e,t=M,r=!0){return this._blit??=new W(this._techniques),this._blit.blit(this._rctx,e,t,this._bindParameters),this._pluginInput.set(e.name,t),r&&e.release(),t}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=R:(T(Ge,this._bindParameters.camera.viewMatrix),T(Fe,this._bindParameters.camera.projectionMatrix),E(qe,Ge,Fe),E(qe,this._renderContext.lastFrameCamera.viewMatrix,qe),E(qe,this._renderContext.lastFrameCamera.projectionMatrix,qe),this._reprojectionMatrix=qe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=R,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,r,i){this._bindParameters.updateLighting(e,t,r,i),this._requestRender(J.UPDATE)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}renderToTargets(e,t,r,i,s=!1,a=!1){t.attachDepth(r),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(i,s,a),e(),t.detachDepth()}get test(){}};var Ne;e([f({readOnly:!0})],De.prototype,"fullResolutionAtmosphere",null),e([f()],De.prototype,"_edgeView",void 0),e([f()],De.prototype,"updating",null),De=e([b("esri.views.3d.webgl-engine.lib.Renderer")],De),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ne||(Ne={}));const He=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL],ye=[pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],xe=[pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS],Le=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS],Me=[pe.OPAQUE_MATERIAL,pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_DEPTH],ve=[pe.LINE_CALLOUTS_HUD_DEPTH,pe.HUD_MATERIAL,pe.LABEL_MATERIAL],Ue=[pe.TRANSPARENT_MATERIAL,pe.TRANSPARENT_MATERIAL_WITHOUT_NORMALS,pe.OPAQUE_MATERIAL,pe.OPAQUE_MATERIAL_WITHOUT_NORMALS,pe.TRANSPARENT_TERRAIN,pe.INTEGRATED_MESH,pe.OPAQUE_TERRAIN],Fe=P(),Ge=P(),qe=P();function Ve(e){return t=>e.immediate.schedule(t)}export{De as Renderer};
@@ -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"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,syncAndInitial as a,sync as n}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as u}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as m,G as l}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as p}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as d}from"./BindParameters.js";import{DepthRange as f}from"./DepthRange.js";import{createQuadVAO as g}from"./glUtil3D.js";import{ShadowCastRenderer as b,shadowCastDisabledElevationThreshold as v,shadowCastDisableElevationMax as S,shadowCastDisableElevationMin as w}from"./ShadowCastRenderer.js";import{ShadowMap as F}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as R,ShadowCastAccumulateIndex as x}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as C}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{SizedPixelFormat as P,PixelFormat as q,PixelType as D,TextureWrapMode as T,FramebufferBit as E}from"../../../webgl/enums.js";import{FramebufferObject as O}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as M}from"../../../webgl/TextureDescriptor.js";import{vertexCount as B}from"../../../webgl/Util.js";let L=class extends t{updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e)}constructor(e,t,r,i,s,c){super({}),this.fbos=e,this._techniques=t,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=c,this._primarySet=new G(new R(x.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new G(new R(x.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new p,this._depthRange=f.zero,this._previewing=!1,this._cameraForcedForScreenshot=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=e.rctx,this._bindParameters=new d(new F(e,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=g(this._rctx),this._accumulationRenderer=new b(t,this._rctx,this,c);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(j.SHADOW_ACCUMULATOR,this),o((()=>r.renderView),(e=>{this.removeHandles(I),null!=e&&this.addHandles(e.events.on("force-camera-for-screenshot",(()=>this._cameraForcedForScreenshot=!0)),I)}),a),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),n),o((()=>2===this._numActive),(()=>this._numActiveChanged()),n),o((()=>this._depthRange),(()=>this._invalidateAccumulationSets()),n)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(t)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const e of this._accumulationSets())e.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some((e=>e.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==f.zero&&this._opacityFromElevation>v}get _doneAccumulating(){return[...this._accumulationSets()].every((e=>e.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(e){this._accumulationRenderer.opacityFromElevation=e}get _numActive(){return[...this._accumulationSets()].reduce(((e,t)=>e+(t.active?1:0)),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:q.RG,internalFormat:P.RG8}:{pixelFormat:q.RED,internalFormat:P.R8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((e=>e.running))}runTask(e){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let t=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,e)&&(t=!0);t&&this._requestRender()}_runTaskForSet(e,t){let r=!1;for(;!t.done&&!e.doneAccumulating;)this._accumulateShadow(e),t.madeProgress(),r=!0;return r}renderAccumulation(e,t,r){if(this._updateCamera(t),this._bindParameters.contentCamera=r,this._bindParameters.depth=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.accumulating||!this.canAccumulate)return!1;this._previewing||this._cameraForcedForScreenshot?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart();const i=this._accumulateSetsForRenderFrame();return this._cameraForcedForScreenshot=!1,i}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every((e=>0===e.progress)))this._clearFramebuffer();else for(const e of this._accumulationSets())0===e.progress&&this._clearFramebufferForSet(this._fbo,e)}_accumulateSetsForRenderFrame(){let e=!1;for(const t of this._accumulationSets())this._accumulateSetForRenderFrame(t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(e){let t=this._cameraForcedForScreenshot?e.sampleCount:Math.min(U,e.sampleCount);t-=e.progress;for(let r=0;r<t;++r)this._accumulateShadow(e);return t>0}precompile(){this._accumulationRenderer.precompile()}render(e){this._accumulationRenderer.render(e)}setOptions(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),this._accumulationRenderer.setOptions(e)}readAccumulatedShadow(e,t){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||e<0||e>=this._fbo.width||t<0||t>=this._fbo.height?0:(this._fbo.readPixels(e,t,1,1,q.RGBA,D.UNSIGNED_BYTE,k),k[x.PRIMARY]/r)}_numActiveChanged(){if(!this._fbo)return;const e=2===this._numActive,t=this._createFBO();t.resize(this._fbo.width,this._fbo.height),e&&(this._clearFramebuffer(t),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,t),this._fbo.dispose(),this._fbo=t,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:e,internalFormat:t}=this._pixelFormat,r=new M;return r.pixelFormat=e,r.internalFormat=t,r.wrapMode=T.CLAMP_TO_EDGE,new O(this._rctx,r)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fbo){e&&e.width&&e.height&&(this._rctx.bindFramebuffer(e),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(E.COLOR))}_clearFramebufferForSet(e,t){if(!e)return;const r=this._techniques.get(C,t.configuration);this._rctx.bindFramebuffer(e),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,B(this._vao,"geometry"))}_accumulateShadow(e){this._renderToShadowMap(this._bindParameters,e.lightDirections[e.progress++],this._depthRange);const t=this._techniques.get(A,e.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(t,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(t.primitiveType,0,B(this._vao,"geometry"))}_updateCamera(e){const t=this._fbo;if(null==t)return;const r=this._bindParameters.camera;e.equals(r)||r.copyFrom(e),t.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-i(w,S,e.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};e([h()],L.prototype,"_fbo",void 0),e([h()],L.prototype,"_depthRange",void 0),e([h()],L.prototype,"_previewing",void 0),e([h()],L.prototype,"_accumulationRenderer",void 0),e([h()],L.prototype,"_refining",null),e([h()],L.prototype,"active",null),e([h()],L.prototype,"canAccumulate",null),e([h()],L.prototype,"_doneAccumulating",null),e([h()],L.prototype,"_opacityFromElevation",null),e([h()],L.prototype,"_numActive",null),e([h()],L.prototype,"_pixelFormat",null),e([h()],L.prototype,"running",null),L=e([u("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],L);const U=6,I="renderView",k=new Uint8Array(4);class G{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=c(0),this._sampleCount=c(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const t=this._cachedLightDirections,i=Math.min(y,e.length);if(!r(t,0,t.length,e,0,i,l)){t.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)t[r]=m(t[r]??_(),e[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(e){e.precompile(A,this.configuration),e.precompile(C,this.configuration)}}export{L as ShadowAccumulator};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{sliceEquals as r}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{smoothstep as i}from"../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{watch as o,sync as a}from"../../../../core/reactiveUtils.js";import{signal as n}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as u,G as l}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ReadShadowMapPassParameters as _}from"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{BindParameters as p}from"./BindParameters.js";import{DepthRange as d}from"./DepthRange.js";import{createQuadVAO as f}from"./glUtil3D.js";import{ShadowCastRenderer as g,shadowCastDisabledElevationThreshold as b,shadowCastDisableElevationMax as v,shadowCastDisableElevationMin as S}from"./ShadowCastRenderer.js";import{ShadowMap as w}from"./ShadowMap.js";import{S as y}from"../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as A}from"../shaders/ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as F,ShadowCastAccumulateIndex as R}from"../shaders/ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as x}from"../shaders/ShadowCastClearTechnique.js";import{TaskPriority as C}from"../../../support/Scheduler.js";import{SizedPixelFormat as j,PixelFormat as P,PixelType as q,TextureWrapMode as D,FramebufferBit as T}from"../../../webgl/enums.js";import{FramebufferObject as E}from"../../../webgl/FramebufferObject.js";import{TextureDescriptor as O}from"../../../webgl/TextureDescriptor.js";import{vertexCount as M}from"../../../webgl/Util.js";let B=class extends e{updateDepthRange(t){this._depthRange.equals(t)||(this._depthRange=t)}constructor(t,e,r,i,s,n){super({}),this.fbos=t,this._techniques=e,this._stage=r,this._prepareForShadowMapPass=i,this._renderToShadowMap=s,this._requestRender=n,this._primarySet=new I(new F(R.PRIMARY),(()=>this._requestRenderIfEnabled())),this._contextSet=new I(new F(R.CONTEXT),(()=>this._requestRenderIfEnabled())),this._passParameters=new _,this._depthRange=d.zero,this._previewing=!1,this._shadowAccumulatorKey=Symbol("shadowAccumulator"),this._rctx=t.rctx,this._bindParameters=new p(new w(t,r.viewingMode)),this._bindParameters.shadowMap.enabled=!0,this._vao=f(this._rctx),this._accumulationRenderer=new g(e,this._rctx,this,n);const h=this._stage.view.resourceController.scheduler;this.addHandles([h.registerTask(C.SHADOW_ACCUMULATOR,this),o((()=>this._previewing),(()=>this._requestRenderIfEnabled()),a),o((()=>2===this._numActive),(()=>this._numActiveChanged()),a),o((()=>this._depthRange),(()=>this._invalidateAccumulationSets()),a)],this._shadowAccumulatorKey);for(const o of this._accumulationSets())o.precompile(e)}*_accumulationSets(){yield this._primarySet,yield this._contextSet}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=s(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=s(this._fbo),this._vao=s(this._vao);for(const t of this._accumulationSets())t.destroy()}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fbo?.colorTexture}get accumulating(){return this.active&&this._previewing||this._refining}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return null!=this._fbo&&[...this._accumulationSets()].some((t=>t.active))}get canAccumulate(){return null!=this._bindParameters.depth&&this._depthRange!==d.zero&&this._opacityFromElevation>b}get _doneAccumulating(){return[...this._accumulationSets()].every((t=>t.doneAccumulating))}get _opacityFromElevation(){return this._accumulationRenderer.opacityFromElevation}set _opacityFromElevation(t){this._accumulationRenderer.opacityFromElevation=t}get _numActive(){return[...this._accumulationSets()].reduce(((t,e)=>t+(e.active?1:0)),0)}get _pixelFormat(){return 2===this._numActive?{pixelFormat:P.RG,internalFormat:j.RG8}:{pixelFormat:P.RED,internalFormat:j.R8}}get running(){return this._refining&&this.canAccumulate&&[...this._accumulationSets()].some((t=>t.running))}runTask(t){this._clearBuffersOnAccumulationStart(),this._prepareForShadowMapPass(this._bindParameters);let e=!1;for(const r of this._accumulationSets())this._runTaskForSet(r,t)&&(e=!0);e&&this._requestRender()}_runTaskForSet(t,e){let r=!1;for(;!e.done&&!t.doneAccumulating;)this._accumulateShadow(t),e.madeProgress(),r=!0;return r}renderAccumulation(t,e,r,i){return this._updateCamera(e),this._bindParameters.contentCamera=r,this._bindParameters.depth=t,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!(!this.accumulating||!this.canAccumulate)&&(this._previewing||i?(this._clearFramebuffer(),this._reset()):this._clearBuffersOnAccumulationStart(),this._accumulateSetsForRenderFrame(i))}_clearBuffersOnAccumulationStart(){if([...this._accumulationSets()].every((t=>0===t.progress)))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fbo,t)}_accumulateSetsForRenderFrame(t){let e=!1;for(const r of this._accumulationSets())this._accumulateSetForRenderFrame(r,t)&&(e=!0);return e&&this._requestRender(),e}_accumulateSetForRenderFrame(t,e){let r=e?t.sampleCount:Math.min(L,t.sampleCount);r-=t.progress;for(let i=0;i<r;++i)this._accumulateShadow(t);return r>0}precompile(){this._accumulationRenderer.precompile()}render(t){this._accumulationRenderer.render(t)}setOptions(t){void 0!==t.previewing&&(this._previewing=t.previewing),void 0!==t.lightDirections&&(this._primarySet.lightDirections=t.lightDirections),void 0!==t.lightDirectionsContext&&(this._contextSet.lightDirections=t.lightDirectionsContext),!0===t.enabled?this._enable():!1===t.enabled&&this._disable(),this._accumulationRenderer.setOptions(t)}readAccumulatedShadow(t,e){const r=this._primarySet.progress;return!this.active||!this._fbo||r<1||t<0||t>=this._fbo.width||e<0||e>=this._fbo.height?0:(this._fbo.readPixels(t,e,1,1,P.RGBA,q.UNSIGNED_BYTE,U),U[R.PRIMARY]/r)}_numActiveChanged(){if(!this._fbo)return;const t=2===this._numActive,e=this._createFBO();e.resize(this._fbo.width,this._fbo.height),t&&(this._clearFramebuffer(e),this._contextSet.reset()),this._fbo.width&&this._fbo.height&&this._rctx.blitFramebuffer(this._fbo,e),this._fbo.dispose(),this._fbo=e,this._requestRender()}_enable(){this._fbo||(this._fbo=this._createFBO(),this._invalidateAccumulationSets())}_createFBO(){const{pixelFormat:t,internalFormat:e}=this._pixelFormat,r=new O;return r.pixelFormat=t,r.internalFormat=e,r.wrapMode=D.CLAMP_TO_EDGE,new E(this._rctx,r)}_invalidateAccumulationSets(){for(const t of this._accumulationSets())t.reset();this._requestRenderIfEnabled()}_disable(){this._fbo&&(this._fbo=s(this._fbo),this._requestRender())}_reset(){for(const t of this._accumulationSets())t.reset()}_clearFramebuffer(t=this._fbo){t&&t.width&&t.height&&(this._rctx.bindFramebuffer(t),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(T.COLOR))}_clearFramebufferForSet(t,e){if(!t)return;const r=this._techniques.get(x,e.configuration);this._rctx.bindFramebuffer(t),this._rctx.bindTechnique(r,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(r.primitiveType,0,M(this._vao,"geometry"))}_accumulateShadow(t){this._renderToShadowMap(this._bindParameters,t.lightDirections[t.progress++],this._depthRange);const e=this._techniques.get(A,t.configuration);this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._bindParameters,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,M(this._vao,"geometry"))}_updateCamera(t){const e=this._fbo;if(null==e)return;const r=this._bindParameters.camera;t.equals(r)||r.copyFrom(t),e.resize(t.fullWidth,t.fullHeight),this._opacityFromElevation=1-i(S,v,t.relativeElevation)}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){}};t([h()],B.prototype,"_fbo",void 0),t([h()],B.prototype,"_depthRange",void 0),t([h()],B.prototype,"_previewing",void 0),t([h()],B.prototype,"_accumulationRenderer",void 0),t([h()],B.prototype,"_refining",null),t([h()],B.prototype,"active",null),t([h()],B.prototype,"canAccumulate",null),t([h()],B.prototype,"_doneAccumulating",null),t([h()],B.prototype,"_opacityFromElevation",null),t([h()],B.prototype,"_numActive",null),t([h()],B.prototype,"_pixelFormat",null),t([h()],B.prototype,"running",null),B=t([c("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],B);const L=6,U=new Uint8Array(4);class I{constructor(t,e){this.configuration=t,this._notifyChange=e,this._cachedLightDirections=[],this._progress=n(0),this._sampleCount=n(0)}get progress(){return this._progress.value}set progress(t){this._progress.value=t}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(t){const e=this._cachedLightDirections,i=Math.min(y,t.length);if(!r(e,0,e.length,t,0,i,l)){e.length=i,this._sampleCount.value=i;for(let r=0;r<i;++r)e[r]=u(e[r]??m(),t[r]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}precompile(t){t.precompile(A,this.configuration),t.precompile(x,this.configuration)}}export{B as ShadowAccumulator};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/Error.js";const e=16;function n(t,n){return n=Math.floor(n/e)*e,Math.min(Math.round(t/e)*e,n)}function r(t,n){return n=Math.floor(n/e)*e,Math.min(Math.ceil(t/e)*e,n)}function a(t,{maxPreferredTextureSize:e,maxTextureSize:r}){const a=Math.max(t.width,t.height),o=t.width*t.height,i=e*e;if(a<=r&&o<=i)return t;const c=Math.min(Math.sqrt(i/o),r/a);return h(t,n(Math.round(t.width*c),r),n(Math.round(t.height*c),r))}function h(t,e,n){if(t instanceof ImageData)return h(o(t),e,n);const r=document.createElement("canvas");r.width=e,r.height=n;return r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}function o(e){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(null==r)throw new t("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),n}export{n as applyTextureResizeModulo,r as applyTextureResizeModuloCeil,a as ensureImageMaxSize};
5
+ import t from"../../../../core/Error.js";const e=16;function n(t,n){return n=Math.floor(n/e)*e,Math.min(Math.round(t/e)*e,n)}function r(t,n){return n=Math.floor(n/e)*e,Math.min(Math.ceil(t/e)*e,n)}function o(t,e){const[n,r]=a(t,e);return t.width===n&&t.height===r?t:i(t,n,r)}function a({width:t,height:e},{maxPreferredTexturePixels:r,maxTextureSize:o}){const a=Math.max(t,e),i=t*e;if(a<=o&&i<=r)return[t,e];const h=Math.min(Math.sqrt(r/i),o/a);return[n(Math.round(t*h),o),n(Math.round(e*h),o)]}function i(t,e,n){if(t instanceof ImageData)return i(h(t),e,n);const r=document.createElement("canvas");r.width=e,r.height=n;return r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}function h(e){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(null==r)throw new t("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),n}export{n as applyTextureResizeModulo,r as applyTextureResizeModuloCeil,o as ensureImageMaxSize,a as ensureTextureSize};