@arcgis/core 5.2.0-next.87 → 5.2.0-next.88

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 (632) hide show
  1. package/arcade/Dictionary.js +1 -1
  2. package/arcade/Feature.js +1 -1
  3. package/arcade/ImmutablePointArray.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/containerUtils.js +1 -1
  8. package/arcade/debug.js +1 -1
  9. package/arcade/deepClone.js +1 -1
  10. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  11. package/arcade/featureset/support/FeatureSet.js +1 -1
  12. package/arcade/functions/centroid.js +1 -1
  13. package/arcade/functions/date.js +1 -1
  14. package/arcade/functions/feature.js +1 -1
  15. package/arcade/functions/featuresetbase.js +1 -1
  16. package/arcade/functions/featuresetgeom.js +1 -1
  17. package/arcade/functions/featuresetstats.js +1 -1
  18. package/arcade/functions/featuresetstring.js +1 -1
  19. package/arcade/functions/fieldStats.js +1 -1
  20. package/arcade/functions/geomasync.js +1 -1
  21. package/arcade/functions/geometry.js +1 -1
  22. package/arcade/functions/geomsync.js +1 -1
  23. package/arcade/functions/knowledgegraph.js +1 -1
  24. package/arcade/functions/maths.js +1 -1
  25. package/arcade/functions/stats.js +1 -1
  26. package/arcade/functions/string.js +1 -1
  27. package/arcade/functions/track.js +1 -1
  28. package/arcade/geometry/adapters/accessor.js +2 -0
  29. package/arcade/geometry/adapters/dehydrated.js +2 -0
  30. package/arcade/geometry/adapters/gx.js +2 -0
  31. package/arcade/geometry/adapters/json.js +2 -0
  32. package/arcade/geometry/adapters/optimized.js +2 -0
  33. package/arcade/geometry/adapters/tuple.js +2 -0
  34. package/arcade/geometry/adapters/utils.js +2 -0
  35. package/arcade/geometry/arrayOfPointsConversions.js +2 -0
  36. package/arcade/geometry/constructors.js +1 -1
  37. package/arcade/geometry/functions.js +1 -1
  38. package/arcade/geometry/isSelfIntersecting.js +2 -0
  39. package/arcade/geometry/nearestCoordinate.js +2 -0
  40. package/arcade/geometry/nearestVertex.js +1 -1
  41. package/arcade/geometry/operators.js +1 -1
  42. package/arcade/geometry/operatorsWorker.js +1 -1
  43. package/arcade/geometry/rotate.js +1 -1
  44. package/arcade/geometry.js +2 -0
  45. package/arcade/languageUtils.js +1 -1
  46. package/arcade.js +1 -1
  47. package/arcgisGlobal.d.ts +1 -0
  48. package/assets/esri/core/workers/RemoteClient.js +1 -1
  49. package/assets/esri/core/workers/chunks/{0b8c9657975388f1e4c8.js → 00181785a180e934bf7c.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{01e648b258efa6408070.js → 0336f4f8498a22347720.js} +1 -1
  51. package/assets/esri/core/workers/chunks/0439d4f4dfd6e78be97e.js +1 -0
  52. package/assets/esri/core/workers/chunks/05393b23ab24126d4236.js +1 -0
  53. package/assets/esri/core/workers/chunks/08263c07d92c48806834.js +1 -0
  54. package/assets/esri/core/workers/chunks/09e01fd1c199be0c8e03.js +1 -0
  55. package/assets/esri/core/workers/chunks/{12d6d73ca1fa55640a4f.js → 0b4a7209b99227a842ad.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{073224c6ac77dc9e97af.js → 0b7860a3f18d252b774a.js} +1 -1
  57. package/assets/esri/core/workers/chunks/0d95f72e1c07ab867d21.js +1 -0
  58. package/assets/esri/core/workers/chunks/0dbbac7a2378728571a7.js +1 -0
  59. package/assets/esri/core/workers/chunks/0f15468ffefd3e9a17b8.js +29 -0
  60. package/assets/esri/core/workers/chunks/13e92f6a9573a2818fb7.js +1 -0
  61. package/assets/esri/core/workers/chunks/19aa4072764937743bd8.js +1 -0
  62. package/assets/esri/core/workers/chunks/19e93d4d37018e3ee849.js +1 -0
  63. package/assets/esri/core/workers/chunks/{911f3a1b8dd4bc5c9782.js → 1bf5c0a4bc5a960a3fa2.js} +1 -1
  64. package/assets/esri/core/workers/chunks/1c378d489c5402888f76.js +1 -0
  65. package/assets/esri/core/workers/chunks/1d1e8d8b1fcf2d9f3dfc.js +1 -0
  66. package/assets/esri/core/workers/chunks/{e5c8f9fef88ca33624e9.js → 1e087fb13b7b0a5d6fec.js} +1 -1
  67. package/assets/esri/core/workers/chunks/1e192ac0533a5c0b5a7a.js +1 -0
  68. package/assets/esri/core/workers/chunks/1f9d6180a96d557838e9.js +1 -0
  69. package/assets/esri/core/workers/chunks/1fe077f57a087c0e9119.js +1 -0
  70. package/assets/esri/core/workers/chunks/212222b64039d436b9a6.js +1 -0
  71. package/assets/esri/core/workers/chunks/22c94f9a69b2157f8dbd.js +1 -0
  72. package/assets/esri/core/workers/chunks/25a2e02677a74834c8b5.js +1 -0
  73. package/assets/esri/core/workers/chunks/26ecc841396e5e719b6a.js +1 -0
  74. package/assets/esri/core/workers/chunks/{fcf7299e2ee904ab9882.js → 2724900f7992a79fc442.js} +1 -1
  75. package/assets/esri/core/workers/chunks/27c0bed59626c7f64125.js +1 -0
  76. package/assets/esri/core/workers/chunks/2bc3e7f394386fa75447.js +1 -0
  77. package/assets/esri/core/workers/chunks/2c9783e3b44986e86797.js +1 -0
  78. package/assets/esri/core/workers/chunks/2ceb07b125c84b51f02a.js +1 -0
  79. package/assets/esri/core/workers/chunks/2cf2f2842c19be84ab4d.js +1 -0
  80. package/assets/esri/core/workers/chunks/2d07d5a9ec67c39ef10c.js +1 -0
  81. package/assets/esri/core/workers/chunks/{a7c715648a07ed70b122.js → 2ec44ebc48beeba11201.js} +1 -1
  82. package/assets/esri/core/workers/chunks/2f2d699b072472fa710e.js +1 -0
  83. package/assets/esri/core/workers/chunks/2f3bbc1f7d4abbbeec2f.js +1 -0
  84. package/assets/esri/core/workers/chunks/304a36e862947fdb05c0.js +1 -0
  85. package/assets/esri/core/workers/chunks/30af0f7c4cfa541c9efd.js +1 -0
  86. package/assets/esri/core/workers/chunks/32f11b4aeae1ef00e466.js +1 -0
  87. package/assets/esri/core/workers/chunks/35d3e60d15294f268992.js +1 -0
  88. package/assets/esri/core/workers/chunks/37a2be4380796f14fe4e.js +1 -0
  89. package/assets/esri/core/workers/chunks/37adb55d9f83faad1712.js +1 -0
  90. package/assets/esri/core/workers/chunks/3869dca884d7ca6488f5.js +1 -0
  91. package/assets/esri/core/workers/chunks/3a9c6f58a1a065c14017.js +1 -0
  92. package/assets/esri/core/workers/chunks/3b552afffaa78bf4fe18.js +1 -0
  93. package/assets/esri/core/workers/chunks/{fe06cc2f90b2d551e4c1.js → 3bbd2d4a19c3b7ad82e4.js} +1 -1
  94. package/assets/esri/core/workers/chunks/3de07326da4c47cd2aab.js +1 -0
  95. package/assets/esri/core/workers/chunks/3f5234120d3a14186c1c.js +1 -0
  96. package/assets/esri/core/workers/chunks/{dbd6bbd3e834ff9d220e.js → 41cf6163758d28fb1968.js} +1 -1
  97. package/assets/esri/core/workers/chunks/466bb1b69aabaeabad6a.js +1 -0
  98. package/assets/esri/core/workers/chunks/47e60b2acec18ef37b6c.js +1 -0
  99. package/assets/esri/core/workers/chunks/4849849fc8330d05a8e6.js +1 -0
  100. package/assets/esri/core/workers/chunks/497c5a9c95e9a89ac217.js +1 -0
  101. package/assets/esri/core/workers/chunks/49d36e54644dc2966128.js +1 -0
  102. package/assets/esri/core/workers/chunks/4aefe6fd4d725a107758.js +1 -0
  103. package/assets/esri/core/workers/chunks/4b6f433022a6822706cb.js +1 -0
  104. package/assets/esri/core/workers/chunks/4d4ebb4e4d83c1123b63.js +1 -0
  105. package/assets/esri/core/workers/chunks/4ee99e654dad6f09abee.js +1 -0
  106. package/assets/esri/core/workers/chunks/4f0804429d8989aa4c51.js +1 -0
  107. package/assets/esri/core/workers/chunks/50525b617ef78086d3c7.js +1 -0
  108. package/assets/esri/core/workers/chunks/5235b9c21ac4156c2375.js +1 -0
  109. package/assets/esri/core/workers/chunks/52422500ca3d6cf2e596.js +1 -0
  110. package/assets/esri/core/workers/chunks/527b87fddf33bb5d519e.js +1 -0
  111. package/assets/esri/core/workers/chunks/55572cefc752b755cf0a.js +1 -0
  112. package/assets/esri/core/workers/chunks/{a4bae2396fae48b57047.js → 595edbc1e9bba47d5676.js} +1 -1
  113. package/assets/esri/core/workers/chunks/59cf23cc8f91b5bea31a.js +1 -0
  114. package/assets/esri/core/workers/chunks/5af16937904c06fb06f6.js +1 -0
  115. package/assets/esri/core/workers/chunks/5d7a5aa608ed6192b016.js +1 -0
  116. package/assets/esri/core/workers/chunks/5d9c92c4e60a4696fdad.js +1 -0
  117. package/assets/esri/core/workers/chunks/5ed7bc9e6cb7cdee92e2.js +1 -0
  118. package/assets/esri/core/workers/chunks/{272c8ccdbd3dcc14e99b.js → 5ed89c862eee1345e3af.js} +1 -1
  119. package/assets/esri/core/workers/chunks/5fbd7d8d8896a224fff3.js +1 -0
  120. package/assets/esri/core/workers/chunks/64ce2d060ae7cdd412cf.js +1 -0
  121. package/assets/esri/core/workers/chunks/65f4ca7201e7267bfc81.js +1 -0
  122. package/assets/esri/core/workers/chunks/67efdd296007a809586c.js +1 -0
  123. package/assets/esri/core/workers/chunks/691434d4c6a38e63d819.js +1 -0
  124. package/assets/esri/core/workers/chunks/{ba67aaa08e4f11e1140a.js → 696cb3bf167327d5b0b9.js} +1 -1
  125. package/assets/esri/core/workers/chunks/69700ed16727ed0c4e3a.js +1 -0
  126. package/assets/esri/core/workers/chunks/6a2d890640b2cd6c5ccb.js +1 -0
  127. package/assets/esri/core/workers/chunks/6a4f007f87d9f2a6fbc4.js +1 -0
  128. package/assets/esri/core/workers/chunks/{7343a44a2382a1d68497.js → 6b9dbf43c0659e55c539.js} +1 -1
  129. package/assets/esri/core/workers/chunks/6de5c6af62776e1b9776.js +1 -0
  130. package/assets/esri/core/workers/chunks/70dc25f721c0ac5f3660.js +1 -0
  131. package/assets/esri/core/workers/chunks/71308dca3fd05687e7bd.js +1 -0
  132. package/assets/esri/core/workers/chunks/75bddfe2be64379db8fd.js +1 -0
  133. package/assets/esri/core/workers/chunks/78085f804969c9282700.js +1 -0
  134. package/assets/esri/core/workers/chunks/7aa9b61ca9b66f30449f.js +1 -0
  135. package/assets/esri/core/workers/chunks/7c1f989ee3d13dfe7ebd.js +1 -0
  136. package/assets/esri/core/workers/chunks/7c56446184abcd14678b.js +1 -0
  137. package/assets/esri/core/workers/chunks/7ce9c84f90e9dd1deb38.js +1 -0
  138. package/assets/esri/core/workers/chunks/7f55a150e4da02786311.js +1 -0
  139. package/assets/esri/core/workers/chunks/7fc3231768ce79e375ae.js +1 -0
  140. package/assets/esri/core/workers/chunks/7febb434f2de2436435f.js +1 -0
  141. package/assets/esri/core/workers/chunks/847b02d188ece9b563ad.js +1 -0
  142. package/assets/esri/core/workers/chunks/903c7bd079888f65fef1.js +1 -0
  143. package/assets/esri/core/workers/chunks/{bdafd4f03585351cecc3.js → 909a85cb6e0e9a3c8567.js} +1 -1
  144. package/assets/esri/core/workers/chunks/9226205850e35b7fc610.js +1 -0
  145. package/assets/esri/core/workers/chunks/922c24b9bb68f4201b03.js +1 -0
  146. package/assets/esri/core/workers/chunks/9474c913e53f69679197.js +1 -0
  147. package/assets/esri/core/workers/chunks/94ddfe165ac25aef8229.js +1 -0
  148. package/assets/esri/core/workers/chunks/{75a2c43311f5f9058f62.js → 94f62ff81cc6fb83e73f.js} +1 -1
  149. package/assets/esri/core/workers/chunks/95ccac3734ac70387b03.js +1 -0
  150. package/assets/esri/core/workers/chunks/97c7dfd29ad4c2966cb4.js +1 -0
  151. package/assets/esri/core/workers/chunks/{1354b8442c2c501238f1.js → 986c5024f22bbfc49aba.js} +1 -1
  152. package/assets/esri/core/workers/chunks/9b81bd62a2c72f592db1.js +1 -0
  153. package/assets/esri/core/workers/chunks/{62596065747abce1964d.js → 9b8e33985310f281f084.js} +1 -1
  154. package/assets/esri/core/workers/chunks/9e2b3754a76e0dd4a94a.js +1 -0
  155. package/assets/esri/core/workers/chunks/9eb3e6800f5034f1593f.js +1 -0
  156. package/assets/esri/core/workers/chunks/a0300fac6a06e7d89a52.js +1 -0
  157. package/assets/esri/core/workers/chunks/a03e7333e3328036f478.js +1 -0
  158. package/assets/esri/core/workers/chunks/a0565137027c83108953.js +1 -0
  159. package/assets/esri/core/workers/chunks/a3b403f8acb90af19adb.js +1 -0
  160. package/assets/esri/core/workers/chunks/a4596f028758649da099.js +1 -0
  161. package/assets/esri/core/workers/chunks/a46ac0be9aabc4cfedc7.js +1 -0
  162. package/assets/esri/core/workers/chunks/a4a22149077c7780481c.js +1 -0
  163. package/assets/esri/core/workers/chunks/a6ab627e965fe7e5bd52.js +1 -0
  164. package/assets/esri/core/workers/chunks/a7954ad55a241af9064f.js +1 -0
  165. package/assets/esri/core/workers/chunks/a8b878c12cb1a6ea012b.js +1 -0
  166. package/assets/esri/core/workers/chunks/{ec0803cfa5051c4d300d.js → aa0ef4493a7e9bed159f.js} +1 -1
  167. package/assets/esri/core/workers/chunks/aa8ab28e0c1ae3b55ac0.js +1 -0
  168. package/assets/esri/core/workers/chunks/ab9927a32350063cb5f0.js +1 -0
  169. package/assets/esri/core/workers/chunks/adc2620cbe735532004d.js +1 -0
  170. package/assets/esri/core/workers/chunks/add834f867900a7091d2.js +1 -0
  171. package/assets/esri/core/workers/chunks/{bbf4c2ee4d56bb0f1a81.js → afa6b74d9ca9ed0154af.js} +1 -1
  172. package/assets/esri/core/workers/chunks/b0e25ccb5a1e57a82628.js +1 -0
  173. package/assets/esri/core/workers/chunks/b17a9853250ab626d58d.js +1 -0
  174. package/assets/esri/core/workers/chunks/b19cff0e43fab2632660.js +1 -0
  175. package/assets/esri/core/workers/chunks/b2e2234fdf8e05bc3312.js +1 -0
  176. package/assets/esri/core/workers/chunks/b6063d1755def00d4889.js +1 -0
  177. package/assets/esri/core/workers/chunks/{39c0a3eb6a870953d530.js → b6f67302d0d5d57add66.js} +1 -1
  178. package/assets/esri/core/workers/chunks/bb56ab53c5a10c9518a6.js +1 -0
  179. package/assets/esri/core/workers/chunks/bd2602195e265f8fdb15.js +1 -0
  180. package/assets/esri/core/workers/chunks/{f762f0f6c83748d8e328.js → bee411f08e2a9499f8f5.js} +1 -1
  181. package/assets/esri/core/workers/chunks/bf357afbabaa8dec4d75.js +1 -0
  182. package/assets/esri/core/workers/chunks/bf7875fda48b15271a10.js +1 -0
  183. package/assets/esri/core/workers/chunks/bfa59005a9b191d18546.js +1 -0
  184. package/assets/esri/core/workers/chunks/bfb8fc6b940bd5510e29.js +1 -0
  185. package/assets/esri/core/workers/chunks/{b311658b8a223efe35d6.js → c0e073a77484b0dfd383.js} +1 -1
  186. package/assets/esri/core/workers/chunks/c13aa45ccd5efb662f88.js +1 -0
  187. package/assets/esri/core/workers/chunks/c176df477bbbbc9c6922.js +1 -0
  188. package/assets/esri/core/workers/chunks/c35553d07ad169910742.js +1 -0
  189. package/assets/esri/core/workers/chunks/c4f582dec07895d3bb93.js +1 -0
  190. package/assets/esri/core/workers/chunks/c4fef90cf08bbe4f0bb5.js +1 -0
  191. package/assets/esri/core/workers/chunks/c5c2fed38e0ccf84f1fa.js +1 -0
  192. package/assets/esri/core/workers/chunks/c80277a313205853a857.js +1 -0
  193. package/assets/esri/core/workers/chunks/c91042f8bf886056a29c.js +1 -0
  194. package/assets/esri/core/workers/chunks/ca204c110438f7315790.js +1 -0
  195. package/assets/esri/core/workers/chunks/ca36d85a47179d95f2fc.js +1 -0
  196. package/assets/esri/core/workers/chunks/cb6fb04fe5c8d90d4196.js +1 -0
  197. package/assets/esri/core/workers/chunks/ccaeabc3be07f3c96f50.js +1 -0
  198. package/assets/esri/core/workers/chunks/{85f459297b0214141d43.js → cd02a6078443b8f63927.js} +1 -1
  199. package/assets/esri/core/workers/chunks/{e64ccdb8328eb6514e59.js → cd8b3c2fc27c239f9954.js} +1 -1
  200. package/assets/esri/core/workers/chunks/{3a36c132ceddef3d15c8.js → cdbcc4cd9145dd93db49.js} +1 -1
  201. package/assets/esri/core/workers/chunks/{e90feee1756a2209f93f.js → ce9fe1a89b474f9e7ee7.js} +1 -1
  202. package/assets/esri/core/workers/chunks/d04a01dc1b4947478264.js +1 -0
  203. package/assets/esri/core/workers/chunks/d0cf9ff48f051adbd455.js +1 -0
  204. package/assets/esri/core/workers/chunks/d119671a32a050517cca.js +1 -0
  205. package/assets/esri/core/workers/chunks/d26be8313526ecea9c68.js +1 -0
  206. package/assets/esri/core/workers/chunks/d270b49c037085503016.js +1 -0
  207. package/assets/esri/core/workers/chunks/{f5eee6e548bb24b5a003.js → d30a7fc8dab4ebb8893b.js} +1 -1
  208. package/assets/esri/core/workers/chunks/d344c3fd9f6b113bbcd7.js +1 -0
  209. package/assets/esri/core/workers/chunks/d36bbda9b7261534568f.js +1 -0
  210. package/assets/esri/core/workers/chunks/d4b0012ae1d3b8a9ba01.js +1 -0
  211. package/assets/esri/core/workers/chunks/d6b87134e0d120c68d2f.js +1 -0
  212. package/assets/esri/core/workers/chunks/d6f7aa280f1bd201d4ef.js +1 -0
  213. package/assets/esri/core/workers/chunks/da9aacdb0b4a04f42fb8.js +1 -0
  214. package/assets/esri/core/workers/chunks/daf7b647bd960d8bad56.js +1 -0
  215. package/assets/esri/core/workers/chunks/{10ac92dcd3738ec23dfb.js → db04c1bad40d068306ba.js} +1 -1
  216. package/assets/esri/core/workers/chunks/{3427f0c026301bcf7272.js → db180f8d25471cfa48af.js} +1 -1
  217. package/assets/esri/core/workers/chunks/db4c9a9103e979292948.js +1 -0
  218. package/assets/esri/core/workers/chunks/dceaa6b68eee090073b1.js +1 -0
  219. package/assets/esri/core/workers/chunks/ddf284648a73b6993737.js +1 -0
  220. package/assets/esri/core/workers/chunks/dfbe0efe453587ec5eb2.js +1 -0
  221. package/assets/esri/core/workers/chunks/e1682e94cc714197ebb4.js +1 -0
  222. package/assets/esri/core/workers/chunks/e2576c37cf13dc421f69.js +1 -0
  223. package/assets/esri/core/workers/chunks/e32a14770e036fce79d9.js +1 -0
  224. package/assets/esri/core/workers/chunks/e370a3337b3c90240e73.js +1 -0
  225. package/assets/esri/core/workers/chunks/e39bccc000c768120a32.js +1 -0
  226. package/assets/esri/core/workers/chunks/e40e08029325f43452d0.js +1 -0
  227. package/assets/esri/core/workers/chunks/{0d7d54e74b5639a0be6e.js → e707534a700a2de687ca.js} +1 -1
  228. package/assets/esri/core/workers/chunks/e823c9ccb7bc348d8824.js +1 -0
  229. package/assets/esri/core/workers/chunks/e88eee4c2fc4229c2a8b.js +1 -0
  230. package/assets/esri/core/workers/chunks/e9f29019aa78f07ace66.js +1 -0
  231. package/assets/esri/core/workers/chunks/ea75c23c44452f45a949.js +1 -0
  232. package/assets/esri/core/workers/chunks/ea91c57a0b31f3f65ee5.js +1 -0
  233. package/assets/esri/core/workers/chunks/eacf216dcd6397c7bd7f.js +1 -0
  234. package/assets/esri/core/workers/chunks/ee77999df3785468b2b6.js +1 -0
  235. package/assets/esri/core/workers/chunks/ef851a2cff76fd211c07.js +1 -0
  236. package/assets/esri/core/workers/chunks/eff359210893239ecec3.js +1 -0
  237. package/assets/esri/core/workers/chunks/f106cc7f559856f69b9f.js +1 -0
  238. package/assets/esri/core/workers/chunks/f210cd8afb86b6eaf7a2.js +1 -0
  239. package/assets/esri/core/workers/chunks/f247f3c5148fa0237a7c.js +1 -0
  240. package/assets/esri/core/workers/chunks/f250a7aa571889c5ad4b.js +1 -0
  241. package/assets/esri/core/workers/chunks/{a26dc2647a15b830390e.js → f253875feb11883deb84.js} +1 -1
  242. package/assets/esri/core/workers/chunks/f31330d628d7e741bf5b.js +1 -0
  243. package/assets/esri/core/workers/chunks/f3d57c5b9dffd12e45b4.js +1 -0
  244. package/assets/esri/core/workers/chunks/f43ae1c2f89e1c4396cc.js +1 -0
  245. package/assets/esri/core/workers/chunks/f60ed579981913d44675.js +1 -0
  246. package/assets/esri/core/workers/chunks/{147d1e7e2852a4197e5f.js → f665fb4c5633e0a459d8.js} +1 -1
  247. package/assets/esri/core/workers/chunks/f66e597e524b26e61cd3.js +1 -0
  248. package/assets/esri/core/workers/chunks/{bec140a69cfdb0519680.js → f74c7cbe4bd12f73ae90.js} +1 -1
  249. package/assets/esri/core/workers/chunks/{e6f6b38eda34708d61c5.js → f7f2102b16d201e5f531.js} +1 -1
  250. package/assets/esri/core/workers/chunks/f82ae237452b97cfc024.js +1 -0
  251. package/assets/esri/core/workers/chunks/f8f7b86bbd62106bc3d4.js +1 -0
  252. package/assets/esri/core/workers/chunks/f9a4387f850d85c44ca5.js +1 -0
  253. package/assets/esri/core/workers/chunks/fbc7576ed12964059da6.js +1 -0
  254. package/assets/esri/core/workers/chunks/fc4a5996fc03f6c32030.js +1 -0
  255. package/assets/esri/core/workers/chunks/fdd0e6d9927d3c43b0d3.js +1 -0
  256. package/assets/esri/core/workers/chunks/fddcb8be714ad18ad0c8.js +1 -0
  257. package/assets/esri/core/workers/chunks/{baa46edd87e97f922128.js → ffe749d790320dddfa74.js} +1 -1
  258. package/chunks/Bufferer-CclWhXVb.js +1 -1
  259. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  260. package/chunks/Envelope.js +1 -1
  261. package/chunks/GeodeticDistanceCalculator-zRp89-dW.js +1 -1
  262. package/chunks/GeodeticUtils.js +1 -1
  263. package/chunks/GeographicTransformation.js +1 -1
  264. package/chunks/Geometry.js +1 -1
  265. package/chunks/GlowComposite.glsl.js +9 -7
  266. package/chunks/MultiPathImpl.js +1 -1
  267. package/chunks/OperatorCentroid2D.js +1 -1
  268. package/chunks/OperatorContains.js +2 -0
  269. package/chunks/OperatorCrosses.js +1 -1
  270. package/chunks/OperatorCut.js +1 -1
  271. package/chunks/OperatorDisjoint.js +2 -0
  272. package/chunks/OperatorDistance.js +2 -0
  273. package/chunks/OperatorEquals.js +2 -0
  274. package/chunks/OperatorGeodesicBuffer.js +1 -1
  275. package/chunks/OperatorGeodeticArea.js +1 -1
  276. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  277. package/chunks/OperatorGeodeticLength.js +1 -1
  278. package/chunks/OperatorGraphicBuffer.js +1 -1
  279. package/chunks/OperatorIntegrate.js +1 -1
  280. package/chunks/OperatorIntersects.js +1 -1
  281. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  282. package/chunks/OperatorOverlaps.js +1 -1
  283. package/chunks/OperatorProximity.js +1 -1
  284. package/chunks/OperatorProximityGeodesic.js +1 -1
  285. package/chunks/OperatorRelate.js +2 -0
  286. package/chunks/OperatorShapePreservingLength.js +1 -1
  287. package/chunks/OperatorShapePreservingProject.js +1 -1
  288. package/chunks/OperatorSimplifyOGC.js +1 -1
  289. package/chunks/OperatorTouches.js +1 -1
  290. package/chunks/OperatorWithin.js +1 -1
  291. package/chunks/Point2D.js +1 -1
  292. package/chunks/ProjectionTransformation.js +1 -1
  293. package/chunks/SideCalculator2D-DX0718xq.js +1 -1
  294. package/chunks/UnitFactory.js +1 -1
  295. package/chunks/aiServices.js +1 -1
  296. package/chunks/array.js +1 -1
  297. package/chunks/languageUtils.js +1 -1
  298. package/config.js +1 -1
  299. package/core/sql/TimeOnly.js +1 -1
  300. package/core/units.js +1 -1
  301. package/editing/sharedTemplates/executor/builders/bufferLineToPolygon.js +1 -1
  302. package/editing/sharedTemplates/executor/builders/bufferPointToPolygon.js +1 -1
  303. package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
  304. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  305. package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
  306. package/form/elements/inputs/inputUtils.js +1 -1
  307. package/geometry/operators/areaOperator.js +1 -1
  308. package/geometry/operators/bufferOperator.js +1 -1
  309. package/geometry/operators/centroidOperator.js +1 -1
  310. package/geometry/operators/clipOperator.js +1 -1
  311. package/geometry/operators/containsOperator.js +1 -1
  312. package/geometry/operators/convexHullOperator.js +1 -1
  313. package/geometry/operators/crossesOperator.js +1 -1
  314. package/geometry/operators/cutOperator.js +1 -1
  315. package/geometry/operators/densifyOperator.js +1 -1
  316. package/geometry/operators/differenceOperator.js +1 -1
  317. package/geometry/operators/disjointOperator.js +1 -1
  318. package/geometry/operators/distanceOperator.js +1 -1
  319. package/geometry/operators/equalsOperator.js +1 -1
  320. package/geometry/operators/generalizeOperator.js +1 -1
  321. package/geometry/operators/geodesicBufferOperator.js +1 -1
  322. package/geometry/operators/geodeticAreaOperator.js +1 -1
  323. package/geometry/operators/geodeticDensifyOperator.js +1 -1
  324. package/geometry/operators/geodeticDistanceOperator.js +1 -1
  325. package/geometry/operators/geodeticLengthOperator.js +1 -1
  326. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  327. package/geometry/operators/gx/operatorBuffer.js +1 -1
  328. package/geometry/operators/gx/operatorDifference.js +1 -1
  329. package/geometry/operators/gx/operatorIntersection.js +1 -1
  330. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  331. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  332. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  333. package/geometry/operators/gx/operatorSimplify.js +1 -1
  334. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  335. package/geometry/operators/gx/operatorUnion.js +1 -1
  336. package/geometry/operators/intersectionOperator.js +1 -1
  337. package/geometry/operators/intersectsOperator.js +1 -1
  338. package/geometry/operators/json/containsOperator.js +1 -1
  339. package/geometry/operators/json/crossesOperator.js +1 -1
  340. package/geometry/operators/json/disjointOperator.js +1 -1
  341. package/geometry/operators/json/intersectsOperator.js +1 -1
  342. package/geometry/operators/json/overlapsOperator.js +1 -1
  343. package/geometry/operators/json/touchesOperator.js +1 -1
  344. package/geometry/operators/json/unionOperator.js +1 -1
  345. package/geometry/operators/json/withinOperator.js +1 -1
  346. package/geometry/operators/labelPointOperator.js +1 -1
  347. package/geometry/operators/lengthOperator.js +1 -1
  348. package/geometry/operators/multiPartToSinglePartOperator.js +1 -1
  349. package/geometry/operators/offsetOperator.js +1 -1
  350. package/geometry/operators/overlapsOperator.js +1 -1
  351. package/geometry/operators/proximityOperator.js +1 -1
  352. package/geometry/operators/relateOperator.js +1 -1
  353. package/geometry/operators/reshapeOperator.js +1 -1
  354. package/geometry/operators/simplifyOGCOperator.js +1 -1
  355. package/geometry/operators/simplifyOperator.js +1 -1
  356. package/geometry/operators/support/apiConverter.js +1 -1
  357. package/geometry/operators/support/jsonConverter.js +1 -1
  358. package/geometry/operators/support/projectionTransformation.js +1 -1
  359. package/geometry/operators/symmetricDifferenceOperator.js +1 -1
  360. package/geometry/operators/touchesOperator.js +1 -1
  361. package/geometry/operators/unionOperator.js +1 -1
  362. package/geometry/operators/withinOperator.js +1 -1
  363. package/geometry/support/curves/circleUtils.js +1 -1
  364. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  365. package/geometry/support/webMercatorUtils.js +1 -1
  366. package/kernel.js +1 -1
  367. package/layers/VectorTileLayer.js +1 -1
  368. package/layers/graphics/hydratedFeatures.js +1 -1
  369. package/layers/mixins/DataSeriesLayer.js +1 -1
  370. package/layers/support/csvUtils.js +1 -1
  371. package/layers/support/fieldUtils.js +1 -1
  372. package/layers/video/VideoController.js +1 -1
  373. package/package.json +3 -3
  374. package/support/ArcadeExpression.js +1 -1
  375. package/support/arcadeUtils.js +1 -1
  376. package/support/loadArcade.js +1 -1
  377. package/support/revision.js +1 -1
  378. package/support/tests/serviceMockDependencies.js +1 -1
  379. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  380. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementController.js +1 -1
  381. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  382. package/views/2d/layers/support/RouteLayerWaypointVisualization.js +1 -1
  383. package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
  384. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  385. package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
  386. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  387. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +1 -1
  388. package/views/3d/input/SceneInputManager.js +1 -1
  389. package/views/3d/input/handlers/RopePullNavigation.js +2 -0
  390. package/views/3d/layers/TiledLayerView3D.js +1 -1
  391. package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
  392. package/views/3d/layers/i3s/I3SNode.js +1 -1
  393. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  394. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  395. package/views/3d/state/controllers/RopePullController.js +2 -0
  396. package/views/3d/state/utils/ropePullUtils.js +1 -1
  397. package/views/3d/support/ElevationAgnosticVisibility.js +1 -1
  398. package/views/3d/support/sphericalTileUtils.js +1 -1
  399. package/views/3d/terrain/PlanarPatch.js +1 -1
  400. package/views/3d/terrain/SphericalPatch.js +1 -1
  401. package/views/3d/terrain/Tile.js +1 -1
  402. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  403. package/views/SelectionManager.js +1 -1
  404. package/views/draw/DrawTool.js +1 -1
  405. package/views/draw/support/createUtils.js +1 -1
  406. package/views/support/GeometryWorker.js +1 -1
  407. package/views/support/selectionUtils.js +1 -1
  408. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  409. package/widgets/BatchAttributeForm/expressions/ArcadeExecutorProvider.js +1 -1
  410. package/widgets/BatchAttributeForm/templates/FieldElementTemplate.js +1 -1
  411. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  412. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  413. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  414. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  415. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  416. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  417. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  418. package/widgets/OrientedImageryViewer/support/panConstraint.js +1 -1
  419. package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
  420. package/widgets/OrientedImageryViewer/videoViewerUtils.js +1 -1
  421. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  422. package/widgets/support/SelectionList/selectionListUtils.d.ts +58 -0
  423. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  424. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  425. package/arcade/kernel.js +0 -2
  426. package/assets/esri/core/workers/chunks/01b7babaefe6500fd6eb.js +0 -1
  427. package/assets/esri/core/workers/chunks/06e109e92de7fa0956e3.js +0 -1
  428. package/assets/esri/core/workers/chunks/0775d1e3034d5e7ef7bc.js +0 -1
  429. package/assets/esri/core/workers/chunks/0993e51d3a9701ed2198.js +0 -1
  430. package/assets/esri/core/workers/chunks/09a0a1e794ddff65aa08.js +0 -1
  431. package/assets/esri/core/workers/chunks/0e57d33bd202d0972207.js +0 -1
  432. package/assets/esri/core/workers/chunks/114ba901fd319ce87dc6.js +0 -1
  433. package/assets/esri/core/workers/chunks/151bac9e519a3b821baf.js +0 -1
  434. package/assets/esri/core/workers/chunks/156f85ac1885464f0072.js +0 -1
  435. package/assets/esri/core/workers/chunks/180eebd8b7badc2840c9.js +0 -1
  436. package/assets/esri/core/workers/chunks/19cb8963d5ec2246357b.js +0 -1
  437. package/assets/esri/core/workers/chunks/19d4ecee1c161ac0f33c.js +0 -1
  438. package/assets/esri/core/workers/chunks/19ece9f5313f53384cac.js +0 -1
  439. package/assets/esri/core/workers/chunks/1d770e8f0fe57d937daa.js +0 -1
  440. package/assets/esri/core/workers/chunks/1dd22b8df6a52277c64b.js +0 -1
  441. package/assets/esri/core/workers/chunks/1ede298ab815e9ad625c.js +0 -1
  442. package/assets/esri/core/workers/chunks/208bc524bd1e0d3aab79.js +0 -1
  443. package/assets/esri/core/workers/chunks/20a4ae83542c7d39cf0f.js +0 -1
  444. package/assets/esri/core/workers/chunks/21071ab3d7b2771406ae.js +0 -1
  445. package/assets/esri/core/workers/chunks/21bfa89363104f041101.js +0 -1
  446. package/assets/esri/core/workers/chunks/21d0a4d6639d32278f11.js +0 -1
  447. package/assets/esri/core/workers/chunks/22a75fdc6ba60213a870.js +0 -1
  448. package/assets/esri/core/workers/chunks/22e004ed97e06536ecef.js +0 -1
  449. package/assets/esri/core/workers/chunks/23942712a3f6290e0fdb.js +0 -1
  450. package/assets/esri/core/workers/chunks/242287de82586d42f0a4.js +0 -1
  451. package/assets/esri/core/workers/chunks/25cb5086eaa412f6820b.js +0 -1
  452. package/assets/esri/core/workers/chunks/26c8ed0aef59ed6d5267.js +0 -1
  453. package/assets/esri/core/workers/chunks/2742d62fceaf0736aef0.js +0 -1
  454. package/assets/esri/core/workers/chunks/276eba546dc8774076ee.js +0 -1
  455. package/assets/esri/core/workers/chunks/28e02b213da9e682d3dc.js +0 -29
  456. package/assets/esri/core/workers/chunks/2d8195231cb16247f198.js +0 -1
  457. package/assets/esri/core/workers/chunks/2db1227ecd421728630d.js +0 -1
  458. package/assets/esri/core/workers/chunks/2ddc9c9ff6ec243d85e2.js +0 -1
  459. package/assets/esri/core/workers/chunks/2e712154ebb895d96ba1.js +0 -1
  460. package/assets/esri/core/workers/chunks/2f2df51d4976ae65edae.js +0 -1
  461. package/assets/esri/core/workers/chunks/32d31fd4cffdf5a80acb.js +0 -1
  462. package/assets/esri/core/workers/chunks/33aaa5a49e396a0aca47.js +0 -1
  463. package/assets/esri/core/workers/chunks/35622088727e120c93b9.js +0 -1
  464. package/assets/esri/core/workers/chunks/3714cc26f446c4d9cc2c.js +0 -1
  465. package/assets/esri/core/workers/chunks/3722d40d161d60370936.js +0 -1
  466. package/assets/esri/core/workers/chunks/3ac4cfeb1af12a9dc27d.js +0 -1
  467. package/assets/esri/core/workers/chunks/3b009c05eaec5a7048a8.js +0 -1
  468. package/assets/esri/core/workers/chunks/3b376318df4ff8519370.js +0 -1
  469. package/assets/esri/core/workers/chunks/3bf37fd3280f4891c76b.js +0 -1
  470. package/assets/esri/core/workers/chunks/3d18a10a1ecfabe92db3.js +0 -1
  471. package/assets/esri/core/workers/chunks/3de20165796fa4f76728.js +0 -1
  472. package/assets/esri/core/workers/chunks/3fbd4c7e25440c4713f2.js +0 -1
  473. package/assets/esri/core/workers/chunks/407dba2be21255eb47fc.js +0 -1
  474. package/assets/esri/core/workers/chunks/44b1a4e8a65221ad3808.js +0 -1
  475. package/assets/esri/core/workers/chunks/48b31b8534e7bfe42976.js +0 -1
  476. package/assets/esri/core/workers/chunks/48f6af09436723f2d861.js +0 -1
  477. package/assets/esri/core/workers/chunks/49e37f653b81f9e4f7cc.js +0 -1
  478. package/assets/esri/core/workers/chunks/4b4221a869b3f0d517fa.js +0 -1
  479. package/assets/esri/core/workers/chunks/4b86bcde5992eb752ab0.js +0 -1
  480. package/assets/esri/core/workers/chunks/4b9095e2bd060efd47c4.js +0 -1
  481. package/assets/esri/core/workers/chunks/5084de4d0d4961b63ab7.js +0 -1
  482. package/assets/esri/core/workers/chunks/51a8a47aac1d8d22ba9d.js +0 -1
  483. package/assets/esri/core/workers/chunks/5324e4feb78203204c0c.js +0 -1
  484. package/assets/esri/core/workers/chunks/5536cee0dfc183584a9b.js +0 -1
  485. package/assets/esri/core/workers/chunks/58d10928959ae1e2e8d9.js +0 -1
  486. package/assets/esri/core/workers/chunks/597a8e3d9e458298fdd3.js +0 -1
  487. package/assets/esri/core/workers/chunks/5a006ff759fad9fc25cb.js +0 -1
  488. package/assets/esri/core/workers/chunks/60be6de19c5659091d8f.js +0 -1
  489. package/assets/esri/core/workers/chunks/61a38237e163b39520e5.js +0 -1
  490. package/assets/esri/core/workers/chunks/61fcdba6f2097378dce5.js +0 -1
  491. package/assets/esri/core/workers/chunks/6561c01c67db1f4c546e.js +0 -1
  492. package/assets/esri/core/workers/chunks/65eff0ae773505495f21.js +0 -1
  493. package/assets/esri/core/workers/chunks/67452ba9e87962b9e01e.js +0 -1
  494. package/assets/esri/core/workers/chunks/68195277046861ed39a7.js +0 -1
  495. package/assets/esri/core/workers/chunks/68705692335d57522030.js +0 -1
  496. package/assets/esri/core/workers/chunks/6a2a4da3a1cd64ff576f.js +0 -1
  497. package/assets/esri/core/workers/chunks/6af1680771fd8ae8c7dc.js +0 -1
  498. package/assets/esri/core/workers/chunks/6c367de583e0e657ca3a.js +0 -1
  499. package/assets/esri/core/workers/chunks/6d2021a0f0c9a3c6a0e6.js +0 -1
  500. package/assets/esri/core/workers/chunks/6db4a4f9a9ce7cc738d0.js +0 -1
  501. package/assets/esri/core/workers/chunks/6f2a9259240769c7cd6e.js +0 -1
  502. package/assets/esri/core/workers/chunks/724260e36efea90585f4.js +0 -1
  503. package/assets/esri/core/workers/chunks/74ae1222787389d5fcaa.js +0 -1
  504. package/assets/esri/core/workers/chunks/74bfaa98da6c5d375f05.js +0 -1
  505. package/assets/esri/core/workers/chunks/7a68a16f7fea712b9fd6.js +0 -1
  506. package/assets/esri/core/workers/chunks/7b2174b19d06c16715f0.js +0 -1
  507. package/assets/esri/core/workers/chunks/7d8e59ad438fb34b476d.js +0 -1
  508. package/assets/esri/core/workers/chunks/7eb94fc75926bc739233.js +0 -1
  509. package/assets/esri/core/workers/chunks/80795118467fb31ea4ed.js +0 -1
  510. package/assets/esri/core/workers/chunks/820c530b8765ecb1f36e.js +0 -1
  511. package/assets/esri/core/workers/chunks/830daaca32352da6eebe.js +0 -1
  512. package/assets/esri/core/workers/chunks/852649460d664b0a1a1d.js +0 -1
  513. package/assets/esri/core/workers/chunks/85c538bf1209f0da1f8e.js +0 -1
  514. package/assets/esri/core/workers/chunks/8c2921081ca3e7fd0385.js +0 -1
  515. package/assets/esri/core/workers/chunks/8db3fd97e8eccd3ba1db.js +0 -1
  516. package/assets/esri/core/workers/chunks/8e225dd0319672103561.js +0 -1
  517. package/assets/esri/core/workers/chunks/8e79a84e224d05204e7d.js +0 -1
  518. package/assets/esri/core/workers/chunks/8e9aff66a2d4e2cc102b.js +0 -1
  519. package/assets/esri/core/workers/chunks/917318f8e186f466dc52.js +0 -1
  520. package/assets/esri/core/workers/chunks/9267f6a65c2245696eac.js +0 -1
  521. package/assets/esri/core/workers/chunks/958e161634b5bfd50625.js +0 -1
  522. package/assets/esri/core/workers/chunks/9658b46a7111cda53b0d.js +0 -1
  523. package/assets/esri/core/workers/chunks/974bcaf2a059b8cfb153.js +0 -1
  524. package/assets/esri/core/workers/chunks/99881d0a6c2490a16268.js +0 -1
  525. package/assets/esri/core/workers/chunks/99980c944acb8ff88d6a.js +0 -1
  526. package/assets/esri/core/workers/chunks/9c227785f4454d3966ea.js +0 -1
  527. package/assets/esri/core/workers/chunks/9d61d9136f3d00aab530.js +0 -1
  528. package/assets/esri/core/workers/chunks/9df2685583393a87df2d.js +0 -1
  529. package/assets/esri/core/workers/chunks/9e840a71906c4deef776.js +0 -1
  530. package/assets/esri/core/workers/chunks/9ee6e8a6b9bfda758c21.js +0 -1
  531. package/assets/esri/core/workers/chunks/a03f4605bde69bfb6d41.js +0 -1
  532. package/assets/esri/core/workers/chunks/a327843cee2057ee76c0.js +0 -1
  533. package/assets/esri/core/workers/chunks/a557347fb313df6fcc79.js +0 -1
  534. package/assets/esri/core/workers/chunks/a8da0728a12fc46dca23.js +0 -1
  535. package/assets/esri/core/workers/chunks/a9ea28e0f22cfe3ccf92.js +0 -1
  536. package/assets/esri/core/workers/chunks/aae92f23b38ae22dd8bf.js +0 -1
  537. package/assets/esri/core/workers/chunks/ad3714da9c90d7471385.js +0 -1
  538. package/assets/esri/core/workers/chunks/b047f9e9ba26037657ed.js +0 -1
  539. package/assets/esri/core/workers/chunks/b1323800119bd5c1759b.js +0 -1
  540. package/assets/esri/core/workers/chunks/b18c35f25da18a3219d7.js +0 -1
  541. package/assets/esri/core/workers/chunks/b1f68ee65cce457d7b5b.js +0 -1
  542. package/assets/esri/core/workers/chunks/b2d6fd436981c890152f.js +0 -1
  543. package/assets/esri/core/workers/chunks/b3c518ca8679fbe16ece.js +0 -1
  544. package/assets/esri/core/workers/chunks/b4b4fe06364bea9b0750.js +0 -1
  545. package/assets/esri/core/workers/chunks/b61b7005edd9ced925e9.js +0 -1
  546. package/assets/esri/core/workers/chunks/b661aae7e3ce955a783e.js +0 -1
  547. package/assets/esri/core/workers/chunks/b66ebe53bd879aa9de57.js +0 -1
  548. package/assets/esri/core/workers/chunks/b8ca80134abfcc692244.js +0 -1
  549. package/assets/esri/core/workers/chunks/bbdf10d76d852072c878.js +0 -1
  550. package/assets/esri/core/workers/chunks/bbeb61d9302323bae9fb.js +0 -1
  551. package/assets/esri/core/workers/chunks/bbfd2b4af8e498b61af9.js +0 -1
  552. package/assets/esri/core/workers/chunks/bddd5aa7a14cd45ff91c.js +0 -1
  553. package/assets/esri/core/workers/chunks/be31c2cb97f664a54306.js +0 -1
  554. package/assets/esri/core/workers/chunks/be4319827db91aa71bf5.js +0 -1
  555. package/assets/esri/core/workers/chunks/bef32acf368b4d5aba37.js +0 -1
  556. package/assets/esri/core/workers/chunks/c1568bcd3f04014152e1.js +0 -1
  557. package/assets/esri/core/workers/chunks/c1a7c475ce0c59ffa75a.js +0 -1
  558. package/assets/esri/core/workers/chunks/c229a4eedda468c914a9.js +0 -1
  559. package/assets/esri/core/workers/chunks/c2b2942456f1b10d0e96.js +0 -1
  560. package/assets/esri/core/workers/chunks/c308d8f419ba63c583e6.js +0 -1
  561. package/assets/esri/core/workers/chunks/c5dc2743c7116d0bc0d8.js +0 -1
  562. package/assets/esri/core/workers/chunks/c68cc3b9c170b8de22dc.js +0 -1
  563. package/assets/esri/core/workers/chunks/c6ef0636073e28350c91.js +0 -1
  564. package/assets/esri/core/workers/chunks/c71368cd64f240da1743.js +0 -1
  565. package/assets/esri/core/workers/chunks/cb2f27e5d465124b9868.js +0 -1
  566. package/assets/esri/core/workers/chunks/cee2f7f3b3f84688e49d.js +0 -1
  567. package/assets/esri/core/workers/chunks/d0942860a53b02371e94.js +0 -1
  568. package/assets/esri/core/workers/chunks/d13eeff678972a245d5d.js +0 -1
  569. package/assets/esri/core/workers/chunks/d3d7b4cd28a0dc2720d4.js +0 -1
  570. package/assets/esri/core/workers/chunks/d3ea7ac6fe71c95faa75.js +0 -1
  571. package/assets/esri/core/workers/chunks/d41e4498aaf4970f48b0.js +0 -1
  572. package/assets/esri/core/workers/chunks/d56603e1d0031f3c5f3b.js +0 -1
  573. package/assets/esri/core/workers/chunks/d7c8725ffb175cec5f8a.js +0 -1
  574. package/assets/esri/core/workers/chunks/d96fa373dcb621c2a869.js +0 -1
  575. package/assets/esri/core/workers/chunks/da233362b06b6db375f1.js +0 -1
  576. package/assets/esri/core/workers/chunks/dbc8f15a6be835f4897d.js +0 -1
  577. package/assets/esri/core/workers/chunks/e00d0036974aaec7d876.js +0 -1
  578. package/assets/esri/core/workers/chunks/e0c75ae3a211a8da10f7.js +0 -1
  579. package/assets/esri/core/workers/chunks/e474106292834633e7d4.js +0 -1
  580. package/assets/esri/core/workers/chunks/e557043f90c051e93925.js +0 -1
  581. package/assets/esri/core/workers/chunks/e5cbed6f19c743915c8e.js +0 -1
  582. package/assets/esri/core/workers/chunks/e5ecd93bd32e99bc99d1.js +0 -1
  583. package/assets/esri/core/workers/chunks/eb8c4f194bb66a27d418.js +0 -1
  584. package/assets/esri/core/workers/chunks/ebd8c77df5df63bd3efe.js +0 -1
  585. package/assets/esri/core/workers/chunks/f14347f5d63f5d102617.js +0 -1
  586. package/assets/esri/core/workers/chunks/f3c0280b6c87f2383a60.js +0 -1
  587. package/assets/esri/core/workers/chunks/f42c4dcb8f413ca1c6fd.js +0 -1
  588. package/assets/esri/core/workers/chunks/f5773321487ec248fa3b.js +0 -1
  589. package/assets/esri/core/workers/chunks/f76911f71540b058a881.js +0 -1
  590. package/assets/esri/core/workers/chunks/f988d5a6dcc15fe34797.js +0 -1
  591. package/assets/esri/core/workers/chunks/fa29b5064d6626cfc019.js +0 -1
  592. package/assets/esri/core/workers/chunks/fa882d0f4a9826533421.js +0 -1
  593. package/assets/esri/core/workers/chunks/fb2d43608006f588e3cb.js +0 -1
  594. package/assets/esri/core/workers/chunks/fbd02e8277fe2252ecd2.js +0 -1
  595. package/assets/esri/core/workers/chunks/fc1aeea22f8c9d63864a.js +0 -1
  596. package/assets/esri/core/workers/chunks/fc3c03cfa3d6bf3b37dc.js +0 -1
  597. package/assets/esri/core/workers/chunks/ff07d351553deb70b889.js +0 -1
  598. package/assets/esri/core/workers/chunks/ffee66699f5d26569baf.js +0 -1
  599. package/chunks/OperatorDefinitions.js +0 -2
  600. package/chunks/areaOperator.js +0 -2
  601. package/chunks/bufferOperator.js +0 -2
  602. package/chunks/centroidOperator.js +0 -2
  603. package/chunks/clipOperator.js +0 -2
  604. package/chunks/containsOperator.js +0 -2
  605. package/chunks/convexHullOperator.js +0 -2
  606. package/chunks/crossesOperator.js +0 -2
  607. package/chunks/cutOperator.js +0 -2
  608. package/chunks/densifyOperator.js +0 -2
  609. package/chunks/differenceOperator.js +0 -2
  610. package/chunks/disjointOperator.js +0 -2
  611. package/chunks/distanceOperator.js +0 -2
  612. package/chunks/equalsOperator.js +0 -2
  613. package/chunks/generalizeOperator.js +0 -2
  614. package/chunks/geodesicBufferOperator.js +0 -2
  615. package/chunks/geodeticAreaOperator.js +0 -2
  616. package/chunks/geodeticDensifyOperator.js +0 -2
  617. package/chunks/geodeticDistanceOperator.js +0 -2
  618. package/chunks/geodeticLengthOperator.js +0 -2
  619. package/chunks/intersectionOperator.js +0 -2
  620. package/chunks/intersectsOperator.js +0 -2
  621. package/chunks/labelPointOperator.js +0 -2
  622. package/chunks/lengthOperator.js +0 -2
  623. package/chunks/multiPartToSinglePartOperator.js +0 -2
  624. package/chunks/offsetOperator.js +0 -2
  625. package/chunks/overlapsOperator.js +0 -2
  626. package/chunks/proximityOperator.js +0 -2
  627. package/chunks/relateOperator.js +0 -2
  628. package/chunks/simplifyOperator.js +0 -2
  629. package/chunks/symmetricDifferenceOperator.js +0 -2
  630. package/chunks/touchesOperator.js +0 -2
  631. package/chunks/unionOperator.js +0 -2
  632. package/chunks/withinOperator.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Sphere as e}from"../../../../geometry/support/sphere.js";import{ElevationRange as s}from"../../support/ElevationRange.js";class i extends s{constructor(s,i){super(NaN,NaN),this.id=s,this.serviceMbsInIndexSR=i,this._serviceMbsInRenderSRElevationAdjusted=new e(0,0,0,-1),this._serviceMbsInRenderSR=new e(0,0,0,-1),this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsInRenderSR}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e.clone(),this._mbsConeInRenderSR}invalidateServiceBVsInRenderSR(){this._serviceMbsInRenderSRElevationAdjusted.invalidate(),this._serviceMbsInRenderSR.invalidate(),this._mbsConeInRenderSR=null,this.serviceObbInRenderSR?.invalidate()}shareServiceBVsInRenderSRWith(e){this.serviceObbInRenderSR=e.serviceObbInRenderSR,this._serviceMbsInRenderSRElevationAdjusted=e._serviceMbsInRenderSRElevationAdjusted,this._serviceMbsInRenderSR=e._serviceMbsInRenderSR,this._mbsConeInRenderSR=e._mbsConeInRenderSR}}class t extends i{constructor(e,s,i,t,n,d,a,R,o,h){super(e,i),this.index=s,this.childCount=t,this.level=n,this.resources=d,this.version=a,this.lodMetric=R,this.maxError=o,this.numFeatures=h,this.failed=!1,this.cacheState=0,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=4,this.elevationAgnosticBoundingVolume=new r}invalidateServiceBVsInRenderSR(){super.invalidateServiceBVsInRenderSR(),this.elevationAgnosticBoundingVolume.invalidate()}}class n{constructor(e,s,i,t){this.nodeHasLOD=e,this.isChosen=s,this.lodLevel=i,this.version=t}}class r{constructor(){this._data=[0,0,0,r.invalidRadius]}static{this.invalidRadius=-2}invalidate(){this._data[3]=r.invalidRadius}get valid(){return this._data[3]!==r.invalidRadius}get radius(){return this._data[3]}getAxis(e){return e[0]=this._data[0],e[1]=this._data[1],e[2]=this._data[2],e}set(e,s){this._data[0]=e[0],this._data[1]=e[1],this._data[2]=e[2],this._data[3]=s}}export{r as ElevationAgnosticBoundingVolume,t as Node,i as NodeBoundingData,n as NodeTraversalState};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as s}from"../../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as i,sphereIntersectsInfiniteVerticalCylinderConservative as t,finiteVerticalCylinderIntersectsFrustumConservative as n}from"../../support/ElevationAgnosticVisibility.js";import{ElevationRange as r}from"../../support/ElevationRange.js";class d extends r{constructor(e,i){super(NaN,NaN),this.id=e,this.serviceMbsInIndexSR=i,this._serviceMbsInRenderSRElevationAdjusted=new s(0,0,0,-1),this._serviceMbsInRenderSR=new s(0,0,0,-1),this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsInRenderSR}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e.clone(),this._mbsConeInRenderSR}invalidateServiceBVsInRenderSR(){this._serviceMbsInRenderSRElevationAdjusted.invalidate(),this._serviceMbsInRenderSR.invalidate(),this._mbsConeInRenderSR=null,this.serviceObbInRenderSR?.invalidate()}shareServiceBVsInRenderSRWith(e){this.serviceObbInRenderSR=e.serviceObbInRenderSR,this._serviceMbsInRenderSRElevationAdjusted=e._serviceMbsInRenderSRElevationAdjusted,this._serviceMbsInRenderSR=e._serviceMbsInRenderSR,this._mbsConeInRenderSR=e._mbsConeInRenderSR}}class a extends d{constructor(e,s,i,t,n,r,d,a,o,h){super(e,i),this.index=s,this.childCount=t,this.level=n,this.resources=r,this.version=d,this.lodMetric=a,this.maxError=o,this.numFeatures=h,this.failed=!1,this.cacheState=0,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=4,this.elevationAgnosticBoundingVolume=new R}invalidateServiceBVsInRenderSR(){super.invalidateServiceBVsInRenderSR(),this.elevationAgnosticBoundingVolume.invalidate()}}class o{constructor(e,s,i,t){this.nodeHasLOD=e,this.isChosen=s,this.lodLevel=i,this.version=t}}class R{constructor(){this._data=[0,0,0,R.invalidRadius]}static{this.invalidRadius=-2}invalidate(){this._data[3]=R.invalidRadius}get valid(){return this._data[3]!==R.invalidRadius}get radius(){return this._data[3]}getAxis(e){return e[0]=this._data[0],e[1]=this._data[1],e[2]=this._data[2],e}set(e,s){this._data[0]=e[0],this._data[1]=e[1],this._data[2]=e[2],this._data[3]=s}intersectsFrustumConservative(e,s,r){if(!this.valid)return!0;const d=this.getAxis(h),{center:a,radius:o}=e.boundingSphere,R=o+r;return 1===s?this.radius>c||i(d,this.radius,a,R):t(d,this.radius,a,R)&&n(d,this.radius,a[2]-R,a[2]+R,e.planes)}}const h=e(),c=.9;export{R as ElevationAgnosticBoundingVolume,a as Node,d as NodeBoundingData,o as NodeTraversalState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{normalize as e,sub as t,dot as i,scaleAndAdd as n,length as s,set as r,equals as o,subtract as a,len as c,sqrDist as l,copy as u,scale as d,dist as h,distance as m,squaredLength as p,squaredDistance as _,add as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as R}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as g}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as C}from"../../../../geometry/projection/projectors.js";import{create as M,fromMatrix as b,intersectsSphere as x,createPoints as I}from"../../../../geometry/support/frustum.js";import{signedDistance as D,getNormal as P}from"../../../../geometry/support/plane.js";import{isPlateCarree as E}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as A}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as F}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as O}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as V,extractExpressionInfo as w}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as j}from"./I3SUtil.js";import{SweptSphereCylindricalVolume as L,SphereGlobal as B,SweptSphereConicalVolume as y}from"./SweptSphereVolume.js";import{Obb as T,computeOffsetObb as U}from"../../support/orientedBoundingBox.js";const H=1e5;class G{get _frustumMbsCenter(){return this._frustumMbs.center}get _frustumMbsRadius(){return this._frustumMbs.radius}get _frustumPlanes(){return this._frustum}constructor(e,t,i,n,s,r,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=s,this._elevationProvider=r,this._viewingMode=o,this._options=c,this._frustum=M(),this._frustumMbs=new A,this._viewDirection=v(),this._useFrustumCulling=!1,this._poi=v(),this._cameraPOIDirection=v(),this._elevationContext=null,this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this.updateCamera(i,n);const l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=R(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||E(l)),this._indexSREllipsoidRadius=S(this._indexSR).radius,this._indexSRSphericalPCPF=R(e),this._projectorIndexSRToIndexSRSphericalPCPF=C(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=O.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(V(w(e,!1)))):this._elevationContext=null}updateCamera(s,r){if(this._useFrustumCulling=r,e(this._viewDirection,s.viewForward),r){b(s.viewMatrix,s.projectionMatrix,this._frustum,W);{const e=s.eye,r=q;t(r,W[4],e);const o=.5*i(r,r)/i(this._viewDirection,r),a=this._frustumMbs,c=a.center;n(c,e,this._viewDirection,o);const l=1+o;a.radius=l}}this._screenSizeFactor=1/(s.perScreenPixelRatio/2),this._camPos=s.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const n=e.serviceMbsInIndexSR;if(!n)return;const s="relative-to-scene"===this._elevationContext.mode?"scene":"ground",r=this._elevationProvider;if(r.getSphereElevationRange){const e=r.getSphereElevationRange(n,this._indexSR,s);if(e)return void i.expandElevationRange(e)}const[o,a,c]=n.center,l=r.getElevation(o,a,c,this._indexSR,s);l&&i.expandElevationRangeValues(l,l);const u=t?null:r.getRootElevationRange?.();u&&i.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){const{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e;if(!i?.isValid)return t;const n=ne;return g(i,this._indexSR,n,this._renderSR),e.updateServiceMbsInRenderSR(n)}calculateServiceMbsInRenderSRElevationAdjusted(e){const{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e,n=this.calculateServiceMbsInRenderSR(e);if(!n.isValid||!i?.isValid)return t;const s=ne;s.copyFrom(n);const{_elevationContext:r}=this;if(r){const{minElevation:t}=e,{_renderCoordsHelper:n}=this,o=i.center;let a=0;if(Number.isFinite(t)){let i=0,c=0;const{maxElevation:l}=e,u=o[2];switch(r.mode){case"relative-to-ground":case"relative-to-scene":i=r.geometryZWithOffset(u,n)+t-u,c=l-t;break;case"on-the-ground":i=t-u,c=l-t}a=i+.5*c,s.radius+=.5*c}else s.radius<H&&(a=F(o,this._elevationProvider,r,n)-o[2]);a&&ce(s,a,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(s)}_isGlobalMbsContainingPlanetCenter(e){return 1===this._viewingMode&&s(e.center)<=e.radius}calculateMbsConeInRenderSR(e){const{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:i,maxElevation:n}=e;if(!(Number.isFinite(i)&&i<n))return null;const s=this.calculateServiceMbsInRenderSR(e);if(!s.isValid)return null;const r=this._elevationContext;if("relative-to-ground"===r?.mode||"relative-to-scene"===r?.mode){const t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;const s=t.center[2],o=r.geometryZWithOffset(s,this._renderCoordsHelper);if(2===this._viewingMode)i+=o,n+=o;else{const e=o-s;i+=e,n+=e}}const o=this._renderCoordsHelper.referenceEllipsoid.radius,a=2===this._viewingMode?new L(s,i,n):this._isGlobalMbsContainingPlanetCenter(s)?new B(s,o+i,o+n):new y(s,o+i,o+n);return e.updateMbsConeInRenderSR(a)}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:i,serviceObbInIndexSR:n}=e;if(null==n||!i||!n.isValid||this._isECEFOBBInLocalMode&&(n.halfSizeX>t||n.halfSizeY>t||n.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new T,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const s=i.radius;let o=0,a=0;const c=n.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(u.mode){case"relative-to-ground":case"relative-to-scene":o=u.geometryZWithOffset(c,l)+t-c,a=i-t;break;case"on-the-ground":o=t-c,a=i-t}}else if(u&&s<H){const e=r(J,n.centerX,n.centerY,c);o=F(e,this._elevationProvider,u,l)-c}const d=a>0,h=d?Y:t;return n.transform(h,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&U(h,0,a,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;if(!t)return null;const i=.2;return 2===this._viewingMode&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>i*this._indexSREllipsoidRadius?null:(t.transform(Y,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),Y)}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){o(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(a(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const n=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),s=t.elevationAgnosticBoundingVolume;let r,o=-1;if(n){const t=J;n.getCenter(t),e(t,t),r=t,n.getCorners(K);for(const n of K){e(n,n);const r=i(n,t);if(r<=0)return void s.invalidate();const a=Math.sqrt(Math.max(0,1-r*r));o=Math.max(o,a)}}else{const i=t.serviceMbsInRenderSR;if(!i.isValid)return void s.invalidate();const{center:n,radius:a}=i,l=c(n);if(l<a)return void s.invalidate();o=a/l,r=e(ie,n)}s.set(r,o+fe)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(J);e[2]=0;let n=0;const s=Q;i.getCorners(K);for(const t of K){t[2]=0;const e=l(s,t);n=Math.max(n,e)}t.set(e,Math.sqrt(n))}else{const i=e.serviceMbsInRenderSR;if(i.isValid){const e=u(J,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;const t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustum):x(this._frustum,this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||(1===this._viewingMode?this._isConeVisibleInFrustum(e):this._isCylinderVisibleInFrustum(e)))}_isConeVisibleInFrustum(s){if(!this._isConeVisibleInFrustumMbs(s)||!s.valid)return!1;const r=s.radius;if(r>pe)return!0;const o=this._frustumPlanes,a=this._frustumMbsCenter,c=s.getAxis(ie),l=i(c,a),u=this._frustumMbsRadius,h=l-u,m=l+u;if(h<=0)return!0;const p=d(Z,c,h),_=d(k,c,m),f=r/Math.sqrt(1-r*r);for(const v of o){const s=P(v),r=e(X,s),o=i(r,c);if(Math.abs(1-o)<_e)continue;const a=$;d(a,c,o),t(a,a,r),e(a,a);const l=ee;n(l,p,a,h*f);if(D(v,l)<=0)continue;n(l,_,a,m*f);if(D(v,l)<=0)continue;return!1}return!0}_isConeVisibleInFrustumMbs(e){const t=e.radius;if(t>pe)return!0;const n=this._frustumMbsRadius,s=this._frustumMbsCenter,r=c(s);if(r<=n)return!0;const o=e.getAxis(ie),a=i(o,s);{const e=d(N,o,a);if(h(e,s)<n)return!0}const l=a/r;if(a<=0){return-l<n}const u=Math.sqrt(1-l*l);if(u<t)return!0;const m=n/r;return u*Math.sqrt(1-m*m)-m*l<t}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const n=this._frustumMbsRadius,s=this._frustumMbsCenter,r=this._frustumPlanes,o=K;if(t.getCorners(o),1===this._viewingMode){const t=e.getAxis(ie),a=i(t,s),c=a-n,l=a+n;if(c<=0)return!0;for(const e of r){let n=!0;for(const s of o){const r=i(s,t),o=te;if(d(o,s,c/r),D(e,o)<=0){n=!1;break}const a=te;if(d(a,s,l/r),D(e,a)<=0){n=!1;break}}if(n)return!1}}else{const e=s[2]-n,t=s[2]+n;for(const i of r){let n=!0;const s=P(i),r=s[0],a=s[1],c=s[2],l=i[3];for(const i of o){const s=r*i[0]+a*i[1]+l;if(s+c*e<=0||s+c*t<=0){n=!1;break}}if(n)return!1}}return!0}_isCylinderVisibleInFrustum(e){const t=this._frustumMbsCenter,i=this._frustumMbsRadius,n=u(N,t);n[2]=0;const s=e.radius,r=e.getAxis(ie);return h(n,r)<=s+i}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.intersectsFrustumConservativeApproximation(this._frustum)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==j(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return i<0?le:t/i*this._screenSizeFactor}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){const t=this.calculateMbsConeInRenderSR(e);if(null==t)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);const i=t.calculateSurfaceDistanceFromPoint(this._camPos),n=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(n),i}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=m(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(i),i}_calculateAngleDependentLoDForSphere(e,n){const r=t(Q,e,this._camPos),o=s(e),a=s(r);if(0===o||0===a)return 1;const c=(Math.abs(i(e,r))/o+n)/a;return Math.min(1,c)}calcAngleDependentLoD(e){const t=this.calculateMbsConeInRenderSR(e);if(null==t){const{center:t,radius:i}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,i)}const{center:n,radius:r}=this.calculateServiceMbsInRenderSR(e);if(2===this._viewingMode)u(se,n),se[2]=t.lowerCenterHeight,u(re,n),re[2]=t.upperCenterHeight;else{const e=s(n);if(0===e)return 1;d(se,n,t.lowerCenterHeight/e),d(re,n,t.upperCenterHeight/e)}const o=this._calculateAngleDependentLoDForSphere(se,r),a=this._calculateAngleDependentLoDForSphere(re,r);if(2===this._viewingMode)u(oe,n),oe[2]=Math.max(t.lowerCenterHeight,Math.min(t.upperCenterHeight,this._camPos[2]));else{const e=s(n);if(0===e)return Math.max(o,a);const r=Math.max(t.lowerCenterHeight,Math.min(t.upperCenterHeight,i(this._camPos,n)/e));d(oe,n,r/e)}return Math.max(o,a,this._calculateAngleDependentLoDForSphere(oe,r))}hasLOD(e){return 0!==e.lodMetric}_getDistanceToSurfaceGlobeMode(e,t){const n=s(t.center),r=s(e)-n;d(se,e,i(e,t.center)/p(e));const o=_(t.center,se),c=t.radius;if(o<=c*c)return Math.abs(r);const l=d(se,t.center,1/n),u=d(re,l,n-c*c/(2*n)),h=a(oe,e,u),v=a(oe,h,d(ae,l,i(l,h))),S=f(oe,u,d(oe,v,c/s(v)));let R=m(e,S);if(r>=de){const t=a(re,e,S);let n=i(t,l)/s(t);n<he&&(n=me),R/=n}return R}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):z(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,t){t.calculateClosestCenterToPoint(this._camPos,ae);const n=s(ae);if(0===n)return e;if(s(this._camPos)-n<de)return e;const r=a(oe,this._camPos,ae),o=s(r);if(0===o)return e;const c=i(r,ae)/(o*n);return e/(c<he?me:c)}calculateScreenSpaceRelativeSphere(e){const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=this._getDistanceToSurface(this._camPos,t),n=i+t.radius;return this._updateMinMaxDistanceToCenter(n),2*i/this._screenSizeFactor}calculateScreenSpaceRelativeCone(e){const t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);const i=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(i,e):i)/this._screenSizeFactor}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 2:{const i=this.calculateMbsConeInRenderSR(e),n=i?this.calculateScreenSpaceRelativeCone(i):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=n}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<ue;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),n=t.center,s=i(n,this._cameraPOIDirection),r=s*s,o=p(n)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return m(this._camPos,this._poi)}}function z(e,t){const i=e[0]-t.center[0],n=e[1]-t.center[1],s=e[2]-t.center[2],r=i*i+n*n,o=t.radius;if(r<=o*o)return Math.abs(s);const a=Math.sqrt(r)-o;return Math.sqrt(s*s+a*a)}const W=I(),q=v(),N=v(),Z=v(),k=v(),X=v(),Y=new T,J=v(),K=[v(),v(),v(),v(),v(),v(),v(),v()],Q=v(),$=v(),ee=v(),te=v(),ie=v(),ne=new A,se=v(),re=v(),oe=v(),ae=v();function ce(e,t,i){if(2===i)e.center[2]+=t;else{const i=s(e.center);if(0===i)return void(e.radius+=Math.abs(t));d(e.center,e.center,1+t/i)}}const le=.5*Number.MAX_VALUE,ue=10,de=2e5,he=.08,me=1e-4,pe=.9,_e=.01,fe=.001;export{G as default};
2
+ import{normalize as e,length as t,set as i,equals as n,subtract as r,dot as s,len as o,sqrDist as a,copy as c,scale as l,sub as u,scaleAndAdd as d,distance as h,squaredLength as m,squaredDistance as p,add as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as S}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingSphere as g}from"../../../../geometry/projection/projectBoundingSphere.js";import{getProjector as R}from"../../../../geometry/projection/projectors.js";import{intersectsSphere as C}from"../../../../geometry/support/frustum.js";import{signedDistance as b,getNormal as M}from"../../../../geometry/support/plane.js";import{isPlateCarree as x}from"../../../../geometry/support/spatialReferenceUtils.js";import{Sphere as I}from"../../../../geometry/support/sphere.js";import{evaluateElevationAlignmentAtPoint as D}from"../graphics/elevationAlignmentUtils.js";import{ElevationContext as P}from"../graphics/ElevationContext.js";import{createContextWithoutExpressionSupport as E,extractExpressionInfo as A}from"../graphics/featureExpressionInfoUtils.js";import{intersectBoundingRectWithMbs as F}from"./I3SUtil.js";import{SweptSphereCylindricalVolume as O,SphereGlobal as V,SweptSphereConicalVolume as j}from"./SweptSphereVolume.js";import{Frustum as w}from"../../state/Frustum.js";import{Obb as L,computeOffsetObb as B}from"../../support/orientedBoundingBox.js";const T=1e5,y=1;class U{get _frustumPlanes(){return this._frustum.planes}constructor(e,t,i,n,r,s,o,a,c={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=s,this._viewingMode=o,this._options=c,this._viewDirection=f(),this._useFrustumCulling=!1,this._poi=f(),this._cameraPOIDirection=f(),this._elevationContext=null,this.minCenterDistance=1/0,this.maxCenterDistance=0,this.maxLodLevel=2,this._screenspaceErrorBias=c.screenspaceErrorBias||1,this._progressiveLoadFactor=c.progressiveLoadFactor||1,this._frustum=new w(t),this.updateCamera(i,n);const l=this._renderCoordsHelper.spatialReference;this._renderSR=l,this._renderSRSphericalPCPF=S(l),this._isGlobalMode=l===this._renderSRSphericalPCPF,this.updateElevationInfo(a),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(l.isWebMercator||x(l)),this._indexSREllipsoidRadius=v(this._indexSR).radius,this._indexSRSphericalPCPF=S(e),this._projectorIndexSRToIndexSRSphericalPCPF=R(this._indexSR,this._indexSRSphericalPCPF)}updateElevationInfo(e){null!=e?(this._elevationContext=P.fromElevationInfo(e),this._elevationContext.setFeatureExpressionInfoContext(E(A(e,!1)))):this._elevationContext=null}updateCamera(t,i){this._useFrustumCulling=i,e(this._viewDirection,t.viewForward),i&&this._frustum.update(t),this._screenSizeFactor=1/(t.perScreenPixelRatio/2),this._camPos=t.eye,this._updateCameraPOIDirection(),this.minCenterDistance=1/0,this.maxCenterDistance=0}setPointOfInterest(e){this._poi=e,this._updateCameraPOIDirection()}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,i){if(null==this._elevationContext)return;const n=e.serviceMbsInIndexSR;if(!n)return;const r="relative-to-scene"===this._elevationContext.mode?"scene":"ground",s=this._elevationProvider;if(s.getSphereElevationRange){const e=s.getSphereElevationRange(n,this._indexSR,r);if(e)return void i.expandElevationRange(e)}const[o,a,c]=n.center,l=s.getElevation(o,a,c,this._indexSR,r);l&&i.expandElevationRangeValues(l,l);const u=t?null:s.getRootElevationRange?.();u&&i.expandElevationRange(u)}calculateServiceMbsInRenderSR(e){const{serviceMbsInRenderSR:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e;if(!i?.isValid)return t;const n=Q;return g(i,this._indexSR,n,this._renderSR),e.updateServiceMbsInRenderSR(n)}calculateServiceMbsInRenderSRElevationAdjusted(e){const{serviceMbsInRenderSRElevationAdjusted:t}=e;if(t.isValid)return t;const{serviceMbsInIndexSR:i}=e,n=this.calculateServiceMbsInRenderSR(e);if(!n.isValid||!i?.isValid)return t;const r=Q;r.copyFrom(n);const{_elevationContext:s}=this;if(s){const{minElevation:t}=e,{_renderCoordsHelper:n}=this,o=i.center;let a=0;if(Number.isFinite(t)){let i=0,c=0;const{maxElevation:l}=e,u=o[2];switch(s.mode){case"relative-to-ground":case"relative-to-scene":i=s.geometryZWithOffset(u,n)+t-u,c=l-t;break;case"on-the-ground":i=t-u,c=l-t}a=i+.5*c,r.radius+=.5*c}else r.radius<T&&(a=D(o,this._elevationProvider,s,n)-o[2]);a&&ne(r,a,this._viewingMode)}return e.updateServiceMbsInRenderSRElevationAdjusted(r)}_isGlobalMbsContainingPlanetCenter(e){return 1===this._viewingMode&&t(e.center)<=e.radius}calculateMbsConeInRenderSR(e){const{mbsConeInRenderSR:t}=e;if(t)return t;if(!e.elevationRangeValid)return null;let{minElevation:i,maxElevation:n}=e;if(!(Number.isFinite(i)&&i<n))return null;const r=this.calculateServiceMbsInRenderSR(e);if(!r.isValid)return null;const s=this._elevationContext;if("relative-to-ground"===s?.mode||"relative-to-scene"===s?.mode){const t=e.serviceMbsInIndexSR;if(!t?.isValid)return null;const r=t.center[2],o=s.geometryZWithOffset(r,this._renderCoordsHelper);if(2===this._viewingMode)i+=o,n+=o;else{const e=o-r;i+=e,n+=e}}const o=this._renderCoordsHelper.referenceEllipsoid.radius,a=2===this._viewingMode?new O(r,i,n):this._isGlobalMbsContainingPlanetCenter(r)?new V(r,o+i,o+n):new j(r,o+i,o+n);return e.updateMbsConeInRenderSR(a)}getAndUpdateVisibilityObbInRenderSR(e){{const t=e.visibilityObbInRenderSR;if(t)return t}const t=.01*this._indexSREllipsoidRadius,{serviceMbsInIndexSR:n,serviceObbInIndexSR:r}=e;if(null==r||!n||!r.isValid||this._isECEFOBBInLocalMode&&(r.halfSizeX>t||r.halfSizeY>t||r.halfSizeZ>t))return null;{let t=e.serviceObbInRenderSR;if(null==t)t=new L,e.serviceObbInRenderSR=t;else if(t.isValid)return t;const s=n.radius;let o=0,a=0;const c=r.centerZ,l=this._renderCoordsHelper,u=this._elevationContext;if(u&&e.elevationRangeValid){const{minElevation:t,maxElevation:i}=e;switch(u.mode){case"relative-to-ground":case"relative-to-scene":o=u.geometryZWithOffset(c,l)+t-c,a=i-t;break;case"on-the-ground":o=t-c,a=i-t}}else if(u&&s<T){const e=i(q,r.centerX,r.centerY,c);o=D(e,this._elevationProvider,u,l)-c}const d=a>0,h=d?N:t;return r.transform(h,this._indexSR,this._renderSR,o,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),d&&B(h,0,a,this._viewingMode,t),t}}getNodeObbInRenderSRIndependentOfElevationOffset(e){{const t=e.visibilityObbInRenderSR??e.serviceObbInRenderSR??null;if(t?.isValid)return t}const t=e.serviceObbInIndexSR;if(!t)return null;const i=.2;return 2===this._viewingMode&&Math.max(t.halfSizeX,t.halfSizeY,t.halfSizeZ)>i*this._indexSREllipsoidRadius?null:(t.transform(N,this._indexSR,this._renderSR,void 0,this._renderSRSphericalPCPF,this._indexSRSphericalPCPF,this._projectorIndexSRToIndexSRSphericalPCPF),N)}ensureElevationAgnosticBoundingVolume(e){return!e.elevationAgnosticBoundingVolume.valid&&e.level>0&&(1===this._viewingMode?this._updateElevationAgnosticBoundingVolumeGlobal(e):this._updateElevationAgnosticBoundingVolumeLocal(e)),e.elevationAgnosticBoundingVolume}_updateCameraPOIDirection(){n(this._poi,this._camPos)?this._cameraPOIDirection=this._viewDirection:(r(this._cameraPOIDirection,this._camPos,this._poi),e(this._cameraPOIDirection,this._cameraPOIDirection))}_updateElevationAgnosticBoundingVolumeGlobal(t){const i=this.getNodeObbInRenderSRIndependentOfElevationOffset(t),n=t.elevationAgnosticBoundingVolume;let r,a=-1;if(i){const t=q;i.getCenter(t),e(t,t),r=t,i.getCorners(Z);for(const i of Z){e(i,i);const r=s(i,t);if(r<=0)return void n.invalidate();const o=Math.sqrt(Math.max(0,1-r*r));a=Math.max(a,o)}}else{const i=t.serviceMbsInRenderSR;if(!i.isValid)return void n.invalidate();const{center:s,radius:c}=i,l=o(s);if(l<c)return void n.invalidate();a=c/l,r=e(K,s)}n.set(r,a+de)}_updateElevationAgnosticBoundingVolumeLocal(e){const t=e.elevationAgnosticBoundingVolume,i=this.getNodeObbInRenderSRIndependentOfElevationOffset(e);if(i){const e=i.getCenter(q);e[2]=0;let n=0;const r=k;i.getCorners(Z);for(const t of Z){t[2]=0;const e=a(r,t);n=Math.max(n,e)}t.set(e,Math.sqrt(n))}else{const i=e.serviceMbsInRenderSR;if(i.isValid){const e=c(q,i.center);e[2]=0,t.set(e,i.radius)}}}isNodeVisible(e){if(!this._isMBSinClippingArea(this.calculateServiceMbsInRenderSR(e)))return!1;if(!this._useFrustumCulling)return!0;const t=this.getAndUpdateVisibilityObbInRenderSR(e);return t?t.intersectsFrustumConservativeApproximation(this._frustumPlanes):C(this._frustum.planes,this.calculateServiceMbsInRenderSRElevationAdjusted(e))}isElevationAgnosticBoundingVolumeVisible(e){return!this._useFrustumCulling||(!e.valid||!!e.intersectsFrustumConservative(this._frustum,this._viewingMode,y)&&(1!==this._viewingMode||this._isConeVisibleInFrustum(e)))}_isConeVisibleInFrustum(t){const i=t.radius;if(i>le)return!0;const n=this._frustumPlanes,{center:r,radius:o}=this._frustum.boundingSphere,a=t.getAxis(K),c=s(a,r),h=o+y,m=c-h,p=c+h;if(m<=0)return!0;const _=l(G,a,m),f=l(z,a,p),v=i/Math.sqrt(1-i*i);for(const S of n){const t=M(S),i=e(W,t),n=s(i,a);if(Math.abs(1-n)<ue)continue;const r=X;l(r,a,n),u(r,r,i),e(r,r);const o=Y;d(o,_,r,m*v);if(b(S,o)<=0)continue;d(o,f,r,p*v);if(b(S,o)<=0)continue;return!1}return!0}isObbVisibleIndependentOfElevation(e,t){if(!this._useFrustumCulling)return!0;if(!e.valid)return!0;const{center:i,radius:n}=this._frustum.boundingSphere,r=n+y,o=this._frustumPlanes,a=Z;if(t.getCorners(a),1===this._viewingMode){const t=e.getAxis(K),n=s(t,i),c=n-r,u=n+r;if(c<=0)return!0;for(const e of o){let i=!0;for(const n of a){const r=s(n,t),o=J;if(l(o,n,c/r),b(e,o)<=0){i=!1;break}const a=J;if(l(a,n,u/r),b(e,a)<=0){i=!1;break}}if(i)return!1}}else{const e=i[2]-r,t=i[2]+r;for(const i of o){let n=!0;const r=M(i),s=r[0],o=r[1],c=r[2],l=i[3];for(const i of a){const r=s*i[0]+o*i[1]+l;if(r+c*e<=0||r+c*t<=0){n=!1;break}}if(n)return!1}}return!0}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObbInRenderSR;return t?.intersectsFrustumConservativeApproximation(this._frustumPlanes)??this.isNodeVisible(e)}_isMBSinClippingArea(e){return null==this._clippingArea||0!==F(this._clippingArea,e)}_screenSpaceDiameterMbs(e,t){const i=this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e);return i<0?re:t/i*this._screenSizeFactor}calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e){const t=this.calculateMbsConeInRenderSR(e);if(null==t)return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e);const i=t.calculateSurfaceDistanceFromPoint(this._camPos),n=t.calculateCenterDistanceFromPoint(this._camPos);return this._updateMinMaxDistanceToCenter(n),i}calcCameraDistanceToSurfaceAndUpdateMinmaxWithSphere(e){return this.calcCameraDistanceToCenterAndUpdateMinmax(e)-this.calculateServiceMbsInRenderSRElevationAdjusted(e).radius}calcCameraDistanceToCenterAndUpdateMinmax(e){const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=h(t.center,this._camPos);return this._updateMinMaxDistanceToCenter(i),i}_calculateAngleDependentLoDForSphere(e,i){const n=u(k,e,this._camPos),r=t(e),o=t(n);if(0===r||0===o)return 1;const a=(Math.abs(s(e,n))/r+i)/o;return Math.min(1,a)}calcAngleDependentLoD(e){const i=this.calculateMbsConeInRenderSR(e);if(null==i){const{center:t,radius:i}=this.calculateServiceMbsInRenderSRElevationAdjusted(e);return this._calculateAngleDependentLoDForSphere(t,i)}const{center:n,radius:r}=this.calculateServiceMbsInRenderSR(e);if(2===this._viewingMode)c($,n),$[2]=i.lowerCenterHeight,c(ee,n),ee[2]=i.upperCenterHeight;else{const e=t(n);if(0===e)return 1;l($,n,i.lowerCenterHeight/e),l(ee,n,i.upperCenterHeight/e)}const o=this._calculateAngleDependentLoDForSphere($,r),a=this._calculateAngleDependentLoDForSphere(ee,r);if(2===this._viewingMode)c(te,n),te[2]=Math.max(i.lowerCenterHeight,Math.min(i.upperCenterHeight,this._camPos[2]));else{const e=t(n);if(0===e)return Math.max(o,a);const r=Math.max(i.lowerCenterHeight,Math.min(i.upperCenterHeight,s(this._camPos,n)/e));l(te,n,r/e)}return Math.max(o,a,this._calculateAngleDependentLoDForSphere(te,r))}hasLOD(e){return 0!==e.lodMetric}_getDistanceToSurfaceGlobeMode(e,i){const n=t(i.center),o=t(e)-n;l($,e,s(e,i.center)/m(e));const a=p(i.center,$),c=i.radius;if(a<=c*c)return Math.abs(o);const u=l($,i.center,1/n),d=l(ee,u,n-c*c/(2*n)),f=r(te,e,d),v=r(te,f,l(ie,u,s(u,f))),S=_(te,d,l(te,v,c/t(v)));let g=h(e,S);if(o>=oe){const i=r(ee,e,S);let n=s(i,u)/t(i);n<ae&&(n=ce),g/=n}return g}_getDistanceToSurface(e,t){return this._isGlobalMode?this._getDistanceToSurfaceGlobeMode(e,t):H(e,t)}_applyGlobalFlatAngleCorrectionToConeDistance(e,i){i.calculateClosestCenterToPoint(this._camPos,ie);const n=t(ie);if(0===n)return e;if(t(this._camPos)-n<oe)return e;const o=r(te,this._camPos,ie),a=t(o);if(0===a)return e;const c=s(o,ie)/(a*n);return e/(c<ae?ce:c)}calculateScreenSpaceRelativeSphere(e){const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=this._getDistanceToSurface(this._camPos,t),n=i+t.radius;return this._updateMinMaxDistanceToCenter(n),2*i/this._screenSizeFactor}calculateScreenSpaceRelativeCone(e){const t=e.calculateCenterDistanceFromPoint(this._camPos);this._updateMinMaxDistanceToCenter(t);const i=e.calculateSurfaceDistanceFromPoint(this._camPos);return 2*(this._isGlobalMode?this._applyGlobalFlatAngleCorrectionToConeDistance(i,e):i)/this._screenSizeFactor}_updateMinMaxDistanceToCenter(e){e>0?(this.minCenterDistance=Math.min(this.minCenterDistance,e),this.maxCenterDistance=Math.max(this.maxCenterDistance,e)):(this.minCenterDistance=0,this.maxCenterDistance=Math.max(this.maxCenterDistance,-e))}getLodLevel(e){if(0===e.lodMetric)return 0;if(0===e.childCount)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,i=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,i)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case 1:{let i=this._screenSpaceDiameterMbs(e,(e.serviceMbsInIndexSR?.radius??0)*t);return this._options.angleDependentLoD&&(i*=this.calcAngleDependentLoD(e)),i<e.maxError}case 2:{const i=this.calculateMbsConeInRenderSR(e),n=i?this.calculateScreenSpaceRelativeCone(i):this.calculateScreenSpaceRelativeSphere(e);return e.maxError*t<=n}case 3:return this._screenSpaceDiameterMbs(e,e.maxError)*t<se;case 4:return this.calcCameraDistanceToSurfaceAndUpdateMinmaxWithCenterDistance(e)>e.maxError*t}return!1}distToCameraPOIRay(e){if(null==e)return 0;const t=this.calculateServiceMbsInRenderSRElevationAdjusted(e),i=t.center,n=s(i,this._cameraPOIDirection),r=n*n,o=m(i)-r;return Math.sqrt(o)-t.radius}distCameraToPOI(){return h(this._camPos,this._poi)}}function H(e,t){const i=e[0]-t.center[0],n=e[1]-t.center[1],r=e[2]-t.center[2],s=i*i+n*n,o=t.radius;if(s<=o*o)return Math.abs(r);const a=Math.sqrt(s)-o;return Math.sqrt(r*r+a*a)}const G=f(),z=f(),W=f(),N=new L,q=f(),Z=[f(),f(),f(),f(),f(),f(),f(),f()],k=f(),X=f(),Y=f(),J=f(),K=f(),Q=new I,$=f(),ee=f(),te=f(),ie=f();function ne(e,i,n){if(2===n)e.center[2]+=i;else{const n=t(e.center);if(0===n)return void(e.radius+=Math.abs(i));l(e.center,e.center,1+i/n)}}const re=.5*Number.MAX_VALUE,se=10,oe=2e5,ae=.08,ce=1e-4,le=.9,ue=.01,de=.001;export{U as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{normalize as t,copy as r,set as e,dist as s,sub as i,dot as o,scaleAndAdd as n,scale as u,cross as c,len as f,direction as a,crossAndNormalize as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as l,freeze as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as _}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as g}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as b}from"../../../../geometry/projection/projectVec3Array.js";import{isAnyVertexInPolyhedron as S,edgeIntersectsPolyhedron as j}from"../../../../geometry/support/convexPolyhedron.js";import{isConvexHullOutsideOfFrustum as v,edgeIntersectsFrustum as F}from"../../../../geometry/support/frustum.js";import{fromValues as R,signedDistance as M}from"../../../../geometry/support/plane.js";import{Frustum as y}from"../../state/Frustum.js";import{sphereIntersectsInfiniteRadialConeConservative as G}from"../../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as B,computeSmallestSphericalTileCone as x,getSphericalTilePole as V}from"../../support/sphericalTileUtils.js";class w{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=m(),this._cameraEye=m(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=m(),this._frustumBoundingSphereRadius=0,this._frustum=new y(t),this._renderSR=t.spatialReference;const e=_(this._renderSR);this._renderSREllipsoidRadius=d(e).radius}setup(e){this._aboveGround=e.aboveGround,this._frustum.update(e),t(this._cameraForward,e.viewForward),r(this._cameraEye,e.eye),this._cameraFovY=e.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const t=this._frustum.boundingSphere;r(this._frustumBoundingSphereCenter,t.center),this._frustumBoundingSphereRadius=t.radius+bt}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(P[0]=u[0],P[1]=u[1],P[2]=0,P[3]=u[2],P[4]=u[3],P[5]=0,!g(P,r,0,P,c,0))return!1;e(T[0],P[0],P[1],0),e(T[1],P[3],P[1],0),e(T[2],P[3],P[4],0),e(T[3],P[0],P[4],0),e(Y,.5*(P[0]+P[3]),.5*(P[1]+P[4]),.5*(P[2]+P[5]));const f=dt,a=.5*s(T[0],T[2]),h=this._frustum,m=this._frustumBoundingSphereRadius,l=this._frustumBoundingSphereCenter,p=H;i(p,l,Y);const d=o(f,p),_=A;n(_,Y,f,d);if(s(_,l)>a+m)return!1;const b=this._cameraForward,R=o(b,dt),M=this._cameraFovY,y=this._cameraEye;if(Math.abs(R)<Math.abs(Math.cos(.5*M))){let t=!0;const r=e(_t,b[0],b[1],0),s=o(y,r);for(let e=0;e<4;++e){const i=T[e];if(o(i,r)-s>0){t=!1;break}}if(t)return!1}{const t=T[0],r=T[2];if(t[0]<=y[0]&&y[0]<=r[0]&&t[1]<=y[1]&&y[1]<=r[1])return!0}const G=C,B=this.opaqueGround&&this._aboveGround,x=this.opaqueGround&&!this._aboveGround,V=Math.min(x?ct:1/0,d+m),w=Math.max(B?-ct:-1/0,d-m);for(let e=0;e<4;++e)n(G[e],T[e],f,V),n(G[e+4],T[e],f,w);if(v(h.planes,G,8))return!1;if(S(h.planes,G,8))return!0;for(let e=0;e<4;++e){const t=G[e],r=G[e+4];if(F(h.planes,t,r))return!0;const s=G[(e+1)%4];if(F(h.planes,t,s))return!0;const i=G[4+(e+1)%4];if(F(h.planes,r,i))return!0}if(gt[0][3]=+T[0][0],gt[1][3]=-T[2][0],gt[2][3]=+T[0][1],gt[3][3]=-T[2][1],gt[4][3]=+w,gt[5][3]=-V,S(gt,h.points))return!0;for(let e=0;e<4;++e){const t=y,r=h.points[e+4];if(j(gt,t,r))return!0;const s=h.points[4+(e+1)%4];if(j(gt,r,s))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<I)return!0;const n=r.spatialReference,m=r.extent;if(!m||!n)return!0;const l=this.opaqueGround&&this._aboveGround,p=this.opaqueGround&&!this._aboveGround,d=T,_=.5*(m[0]+m[2]);if(e(d[0],m[0],m[1],0),e(d[1],m[2],m[1],0),e(d[2],m[2],m[3],0),e(d[3],m[0],m[3],0),e(d[4],_,m[1],0),e(d[5],_,m[3],0),!b(d,n,0,d,this._renderSR,0,6))return!1;const g=this._renderSREllipsoidRadius;B(d,g);const S=Y,j=this._frustumBoundingSphereRadius,F=this._frustumBoundingSphereCenter,R=this._frustum,y=R.planes,w=U,E=x(d[0],d[1],d[2],d[3],w);u(S,w,g);const C=Math.sqrt(1-E*E),P=R.origin,A=R.points;let H=!1;if(l){H=!0;const r=t(ft,P);for(let e=0;e<4;++e){const s=A[4+e],n=i(ht,s,P);t(n,n);const u=c(mt,r,n);t(u,u);const f=c(lt,n,u);t(f,f);if(o(P,f)>g){H=!1;break}}if(H){if(o(P,w)<g*C-ct)return!1}if(o(r,w)<-E)return!1;{const r=t(at,R.direction);if(o(r,w)>pt)return!1}}if(E>.9)return!0;let Q=!1;const it=o(w,F),ot=f(F);if(ot<=j&&!y.some(t=>M(t,L)>0)){if(!l)return!0;Q=!0}if(!Q&&it<=0){if(-it>j)return!1}if(!Q&&ot>j&&!G(w,E,F,j))return!1;if(!H){if(d.some(t=>R.intersectsPoint(t)))return!0;if(R.intersectsPoint(S))return!0}const nt=W;i(nt,F,L);const dt=o(nt,w),_t=k;u(_t,w,dt);const gt=s(_t,F),bt=V(r.lij,n.isWGS84),St=1===bt||3===bt,jt=2===bt||3===bt,vt=jt?rt:St?$:X,Ft=jt?et:St?tt:Z;if(!Q){const t=d,r=st,e=J,s=K,i=L;for(const n of vt){const c=t[n],f=t[(n+1)%4];if(a(e,f,c),a(s,i,c),h(r,s,e),o(r,w)>0&&u(r,r,-1),q(r,A,1))return!1}}let Rt=null;if(!l&&dt<1.01*j){const t=2.5*j;if(gt>C*t+j)return!1;const r=D,s=t/C;for(let e=0;e<4;++e)u(r[e],d[e],s/g);e(r[4],0,0,0),Rt=r}else{const t=(p?g+ct:dt+j)/C,r=l?g-ct:(dt-j)/C,e=z;for(let s=0;s<4;++s){const i=d[s];u(e[s],i,r/g),u(e[s+4],i,t/g)}Rt=e}if(v(y,Rt,Rt.length))return!1;const Mt=R.lines,yt=N,Gt=O;for(const e of Mt){t(Gt,e.direction);for(const r of Ft){const e=Rt[r];if(t(yt,e),ut(Gt,yt,Rt,A))return!1;const s=(r+1)%4;if(l){const r=Rt[s];if(i(yt,r,e),t(yt,yt),ut(Gt,yt,Rt,A))return!1}if(p){const e=Rt[4+r],o=Rt[4+s];if(i(yt,o,e),t(yt,yt),ut(Gt,yt,Rt,A))return!1}}}return!0}}const I=2,E=4;function q(t,r,e){for(const s of r)if(o(s,t)<e)return!1;return!0}const C=[m(),m(),m(),m(),m(),m(),m(),m()],P=[0,0,0,0,0,0],T=[m(),m(),m(),m(),m(),m()],Y=m(),U=m(),k=m(),A=m(),H=m(),L=p(0,0,0),W=m(),z=[m(),m(),m(),m(),m(),m(),m(),m()],D=[m(),m(),m(),m(),m()],J=m(),K=m(),N=m(),O=m(),Q=m(),X=[0,1,2,3],Z=[0,1,2,3],$=[0,1,3],tt=[0,1,3],rt=[1,2,3],et=[1,2,3],st=m();function it(t,r,e){let s=1/0,i=-1/0;for(const n of e){const t=o(r,n);s=Math.min(s,t),i=Math.max(i,t)}t[0]=s,t[1]=i}function ot(t,r,e,s){let i=1/0,n=-1/0;for(const u of s){const s=o(e,u);if(i=Math.min(i,s),n=Math.max(n,s),i<=r&&n>=t)return!1}return!0}const nt=[0,0];function ut(t,r,e,s){const i=e.length,o=s.length;if(0===i||0===o)return!0;const n=Q;h(n,t,r);const u=o<i,c=u?e:s,f=nt;return it(f,n,u?s:e),ot(f[0],f[1],n,c)}const ct=430,ft=m(),at=m(),ht=m(),mt=m(),lt=m(),pt=Math.cos(.25*Math.PI),dt=l(0,0,1),_t=m(),gt=[R(-1,0,0,1),R(1,0,0,-1),R(0,-1,0,1),R(0,1,0,-1),R(0,0,-1,1),R(0,0,1,-1)],bt=1;export{w as FeatureTileVisibility3D,E as maxLODLevelDelta,I as minTileLOD};
2
+ import{normalize as t,copy as r,set as e,dist as o,sub as s,dot as i,scaleAndAdd as n,scale as c,cross as u,len as a,direction as f,crossAndNormalize as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h,fromValues as m,freeze as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as _}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as b}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{isAnyVertexInPolyhedron as j,edgeIntersectsPolyhedron as v}from"../../../../geometry/support/convexPolyhedron.js";import{isConvexHullOutsideOfFrustum as M,edgeIntersectsFrustum as y}from"../../../../geometry/support/frustum.js";import{fromValues as F,signedDistance as G}from"../../../../geometry/support/plane.js";import{Frustum as R}from"../../state/Frustum.js";import{sphereIntersectsInfiniteRadialConeConservative as x}from"../../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as V,computeSmallestSphericalTileCone as w,getSphericalTilePole as I}from"../../support/sphericalTileUtils.js";class S{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustum=new R(t),this._renderSR=t.spatialReference;const e=_(this._renderSR);this._renderSREllipsoidRadius=d(e).radius}setup(e){this._aboveGround=e.aboveGround,this._frustum.update(e),t(this._cameraForward,e.viewForward),r(this._cameraEye,e.eye),this._cameraFovY=e.fovY}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,c=t.extent,u=this._renderSR;if(!c)return!0;if(Y[0]=c[0],Y[1]=c[1],Y[2]=0,Y[3]=c[2],Y[4]=c[3],Y[5]=0,!b(Y,r,0,Y,u,0))return!1;e(U[0],Y[0],Y[1],0),e(U[1],Y[3],Y[1],0),e(U[2],Y[3],Y[4],0),e(U[3],Y[0],Y[4],0),e(k,.5*(Y[0]+Y[3]),.5*(Y[1]+Y[4]),.5*(Y[2]+Y[5]));const a=dt,f=.5*o(U[0],U[2]),l=this._frustum,{center:h,radius:m}=l.boundingSphere,p=m+gt,d=L;s(d,h,k);const _=i(a,d),g=H;n(g,k,a,_);if(o(g,h)>f+p)return!1;const F=this._cameraForward,G=i(F,dt),R=this._cameraFovY,x=this._cameraEye;if(Math.abs(G)<Math.abs(Math.cos(.5*R))){let t=!0;const r=e(_t,F[0],F[1],0),o=i(x,r);for(let e=0;e<4;++e){const s=U[e];if(i(s,r)-o>0){t=!1;break}}if(t)return!1}{const t=U[0],r=U[2];if(t[0]<=x[0]&&x[0]<=r[0]&&t[1]<=x[1]&&x[1]<=r[1])return!0}const V=T,w=this.opaqueGround&&this._aboveGround,I=this.opaqueGround&&!this._aboveGround,S=Math.min(I?ut:1/0,_+p),E=Math.max(w?-ut:-1/0,_-p);for(let e=0;e<4;++e)n(V[e],U[e],a,S),n(V[e+4],U[e],a,E);if(M(l.planes,V,8))return!1;if(j(l.planes,V,8))return!0;for(let e=0;e<4;++e){const t=V[e],r=V[e+4];if(y(l.planes,t,r))return!0;const o=V[(e+1)%4];if(y(l.planes,t,o))return!0;const s=V[4+(e+1)%4];if(y(l.planes,r,s))return!0}if(bt[0][3]=+U[0][0],bt[1][3]=-U[2][0],bt[2][3]=+U[0][1],bt[3][3]=-U[2][1],bt[4][3]=+E,bt[5][3]=-S,j(bt,l.points))return!0;for(let e=0;e<4;++e){const t=x,r=l.points[e+4];if(v(bt,t,r))return!0;const o=l.points[4+(e+1)%4];if(v(bt,r,o))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<E)return!0;const n=r.spatialReference,h=r.extent;if(!h||!n)return!0;const m=this.opaqueGround&&this._aboveGround,p=this.opaqueGround&&!this._aboveGround,d=U,_=.5*(h[0]+h[2]);if(e(d[0],h[0],h[1],0),e(d[1],h[2],h[1],0),e(d[2],h[2],h[3],0),e(d[3],h[0],h[3],0),e(d[4],_,h[1],0),e(d[5],_,h[3],0),!g(d,n,0,d,this._renderSR,0,6))return!1;const b=this._renderSREllipsoidRadius;V(d,b);const j=k,v=this._frustum,{center:y,radius:F}=v.boundingSphere,R=F+gt,S=v.planes,q=A,T=w(d[0],d[1],d[2],d[3],q);c(j,q,b);const Y=Math.sqrt(1-T*T),H=v.origin,L=v.points;let W=!1;if(m){W=!0;const r=t(at,H);for(let e=0;e<4;++e){const o=L[4+e],n=s(lt,o,H);t(n,n);const c=u(ht,r,n);t(c,c);const a=u(mt,n,c);t(a,a);if(i(H,a)>b){W=!1;break}}if(W){if(i(H,q)<b*Y-ut)return!1}if(i(r,q)<-T)return!1;{const r=t(ft,v.direction);if(i(r,q)>pt)return!1}}if(T>.9)return!0;let st=!1;if(a(y)<=R&&!S.some(t=>G(t,B)>0)){if(!m)return!0;st=!0}if(!st&&!x(q,T,y,R))return!1;if(!W){if(d.some(t=>v.intersectsPoint(t)))return!0;if(v.intersectsPoint(j))return!0}const it=z;s(it,y,B);const nt=i(it,q),dt=C;c(dt,q,nt);const _t=o(dt,y),bt=I(r.lij,n),jt=1===bt||3===bt,vt=2===bt||3===bt,Mt=vt?rt:jt?$:X,yt=vt?et:jt?tt:Z;if(!st){const t=d,r=ot,e=K,o=N,s=B;for(const n of Mt){const u=t[n],a=t[(n+1)%4];if(f(e,a,u),f(o,s,u),l(r,o,e),i(r,q)>0&&c(r,r,-1),P(r,L,1))return!1}}let Ft=null;if(!m&&nt<1.01*R){const t=2.5*R;if(_t>Y*t+R)return!1;const r=J,o=t/Y;for(let e=0;e<4;++e)c(r[e],d[e],o/b);e(r[4],0,0,0),Ft=r}else{const t=(p?b+ut:nt+R)/Y,r=m?b-ut:(nt-R)/Y,e=D;for(let o=0;o<4;++o){const s=d[o];c(e[o],s,r/b),c(e[o+4],s,t/b)}Ft=e}if(M(v.planes,Ft,Ft.length))return!1;const Gt=v.lines,Rt=O,xt=Q;for(const e of Gt){t(xt,e.direction);for(const r of yt){const e=Ft[r];if(t(Rt,e),ct(xt,Rt,Ft,L))return!1;const o=(r+1)%4;if(m){const r=Ft[o];if(s(Rt,r,e),t(Rt,Rt),ct(xt,Rt,Ft,L))return!1}if(p){const e=Ft[4+r],i=Ft[4+o];if(s(Rt,i,e),t(Rt,Rt),ct(xt,Rt,Ft,L))return!1}}}return!0}}const E=2,q=4;function P(t,r,e){for(const o of r)if(i(o,t)<e)return!1;return!0}const T=[h(),h(),h(),h(),h(),h(),h(),h()],Y=[0,0,0,0,0,0],U=[h(),h(),h(),h(),h(),h()],k=h(),A=h(),C=h(),H=h(),L=h(),B=p(0,0,0),z=h(),D=[h(),h(),h(),h(),h(),h(),h(),h()],J=[h(),h(),h(),h(),h()],K=h(),N=h(),O=h(),Q=h(),W=h(),X=[0,1,2,3],Z=[0,1,2,3],$=[0,1,3],tt=[0,1,3],rt=[1,2,3],et=[1,2,3],ot=h();function st(t,r,e){let o=1/0,s=-1/0;for(const n of e){const t=i(r,n);o=Math.min(o,t),s=Math.max(s,t)}t[0]=o,t[1]=s}function it(t,r,e,o){let s=1/0,n=-1/0;for(const c of o){const o=i(e,c);if(s=Math.min(s,o),n=Math.max(n,o),s<=r&&n>=t)return!1}return!0}const nt=[0,0];function ct(t,r,e,o){const s=e.length,i=o.length;if(0===s||0===i)return!0;const n=W;l(n,t,r);const c=i<s,u=c?e:o,a=nt;return st(a,n,c?o:e),it(a[0],a[1],n,u)}const ut=430,at=h(),ft=h(),lt=h(),ht=h(),mt=h(),pt=Math.cos(.25*Math.PI),dt=m(0,0,1),_t=h(),bt=[F(-1,0,0,1),F(1,0,0,-1),F(0,-1,0,1),F(0,1,0,-1),F(0,0,-1,1),F(0,0,1,-1)],gt=1;export{S as FeatureTileVisibility3D,q as maxLODLevelDelta,E as minTileLOD};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as o,distance as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{scaleAndAdd as n,dot as a,crossAndNormalize as h,scale as l,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as m,fromPositionAndNormal as d}from"../../../../geometry/support/plane.js";import{Sphere as u}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as P,applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as C}from"../../camera/constraintUtils/ConstraintOptions.js";import{InteractiveController as f}from"./InteractiveController.js";import{ropePullMaxElevation as v,findSphereHorizonY as S,computeHorizonPaddingLimits as z,findPlaneHorizonY as w,findGlobalModeRopePullGrabLocation as b,findLocalModeRopePullGrabLocation as j,ropePullYSpeedMultiplier as y,ropePullXSpeedMultiplier as R}from"../utils/ropePullUtils.js";import T from"../../webgl/RenderCamera.js";let H=class extends f{constructor(t){super(t),this._validState=!0,this._adjustedScenePoint=c(),this._referenceSphere=new u,this._referencePlane=m(),this._tmp3d=c(),this._screenPointArray=i(),this._forwardRopeComponent=c(),this._sidewaysRopeComponent=c(),this._ropeTranslation=c(),this._beginScreenPoint=i(),this._screenPickPoint=i(),this._horizonY=null,this._horizonPadding=null,this._ropeBeginScreenPoint=i(),this._ropeScreenHeight=1,this._ropePlane=m(),this._ropePullOverHorizonVelocityAdjustment=1,this._pointerCount=0,this._beginCamera=new T,this._constraintOptions=new C(15,0,0,this._beginCamera)}get isGlobalMode(){return 1===this.view.state.viewingMode}begin(t){this.running&&(this._pointerCount=t.pointers.size,e(t.center,this._screenPickPoint),Math.abs(this._screenPickPoint[0]-this.view.width/2)<.1&&(this._screenPickPoint[0]+=1),o(this._beginScreenPoint,this._screenPickPoint),this.startCamera.relativeElevation>v?this._validState=!1:(this._initClampValues(),this._prepareRopePullMode(),this._beginCamera.copyFrom(this.startCamera)))}update(t){this.running&&this._validState&&(this.currentCamera.copyFrom(this.startCamera),this._panningRopePull(t),this.commitCamera())}end(t){return t.pointers.size===this._pointerCount&&this.update(t),this.finishController(),null}_initClampValues(){this.isGlobalMode?this._globalInitClampValues():this._localInitClampValues()}_globalInitClampValues(){this._referenceSphere.radius=_(this.view.spatialReference).radius,this._horizonY=S(this.startCamera,this._referenceSphere,this._screenPickPoint),this._horizonPadding=null!=this._horizonY?z(this.startCamera,this._horizonY):null}_localInitClampValues(){const t=c();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,t);const i=c();n(i,this.startCamera.eye,t,-this.startCamera.relativeElevation),d(i,t,this._referencePlane),this._horizonY=w(this.startCamera,this._referencePlane),this._horizonPadding=z(this.startCamera,this._horizonY)}_prepareRopePullMode(){if(!this._horizonY||!this._horizonPadding)return;this._ropeBeginScreenPoint=this._screenPickPoint,this._ropeScreenHeight=this.startCamera.fullHeight/this.startCamera.pixelRatio;if(!(this.isGlobalMode?b({view:this.view,originalScreenPoint:this._ropeBeginScreenPoint,horizonY:this._horizonY,horizonPadding:this._horizonPadding,outRopeTranslation:this._ropeTranslation,outGrabLocation:this._adjustedScenePoint}):j({view:this.view,originalScreenPoint:this._ropeBeginScreenPoint,horizonY:this._horizonY,horizonPadding:this._horizonPadding,outRopeTranslation:this._ropeTranslation,outGrabLocation:this._adjustedScenePoint})))return void(this._validState=!1);const t=c();this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,t);const i=this.startCamera.viewRight,e=a(this._ropeTranslation,i),r=h(c(),t,i),o=a(this._ropeTranslation,r);l(this._forwardRopeComponent,r,o),l(this._sidewaysRopeComponent,i,e),d(this._adjustedScenePoint,t,this._ropePlane);const s=this._ropeScreenHeight-this._beginScreenPoint[1],n=this._ropeScreenHeight-this._horizonPadding[0];this._ropePullOverHorizonVelocityAdjustment=Math.max(s/n,1)}_panningRopePull(t){if(!this._horizonY||!this._horizonPadding)return;const i=e(t.center,this._screenPointArray),r=this.startCamera.fullWidth/this.startCamera.pixelRatio*.5,o=(this._ropeScreenHeight-i[1])/(this._ropeScreenHeight-this._beginScreenPoint[1]),a=1-o,h=(i[0]-r)/(this._beginScreenPoint[0]-r),c=a*y*this._ropePullOverHorizonVelocityAdjustment,_=(a*R+o*((1-h)*R))*this._ropePullOverHorizonVelocityAdjustment;l(this._ropeTranslation,this._forwardRopeComponent,c),n(this._ropeTranslation,this._ropeTranslation,this._sidewaysRopeComponent,_),this.currentCamera.eye=p(this._tmp3d,this.startCamera.eye,this._ropeTranslation),this.currentCamera.center=p(this._tmp3d,this.startCamera.center,this._ropeTranslation),this._constraintOptions.interactionType=6,this._constraintOptions.interactionFactor=P(s(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this._ropeTranslation,g(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}};H=t([r("esri.views.3d.state.controllers.RopePullController")],H);export{H as RopePullController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as t,distance as n,scaleAndAdd as o,add as r,normalize as i,cross as s,crossAndNormalize as a,subtract as c,dot as u,scale as l,length as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{create as f,fromPositionAndNormal as h,projectVector as S,distance as g,projectPoint as j}from"../../../../geometry/support/plane.js";import{create as P}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as v}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as y,sphereOrPlanePointFromScreenPoint as I,intersectPlaneFromScreenPoint as b}from"./navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";import{Intersector as M}from"../../webgl-engine/lib/Intersector.js";const k=90,x=1.5,R=x,A=x,T=1e4,F=.1,G=12,q=p(),O=p(),H=e(),N=p(),U=f(),Y=p(),C=p(),D=p(),V=p(),E=p(),L=p(),W=p(),_=p(),B=p(),J=p(),K=e(),Q=P(),X=new w,Z=p(),$=f(),ee=p();function te(e,t){return S(t,e.viewForward,q),r(O,e.eye,q),e.projectToScreen(O,H),H[1]}function ne(e,t,m){const p=e.eye;if(n(t.center,p)<t.radius)return i(E,p),s(L,E,e.viewRight),r(O,p,L),e.projectToScreen(O,K),K[1];const d=e.up;z(e,m,Q);const f=t.radius;if(a(N,d,Q.direction),h(p,N,U),g(U,t.center)>f)return null;j(U,t.center,Y);const S=n(t.center,Y),P=Math.sqrt(f**2-S**2);c(C,p,Y),i(D,C),a(V,N,D);const w=u(C,D),v=u(C,V),y=Math.sqrt(w**2+v**2),I=P**2/y**2,b=P/y**2*Math.sqrt(y**2-P**2),M=I*w,k=b*-v,x=I*v,R=b*w,A=M-k,T=x+R,F=x-R;r(W,Y,o(W,l(W,D,M+k),V,T)),r(_,Y,o(_,l(_,D,A),V,F)),c(B,W,p),i(B,B),c(J,_,p),i(J,J);return u(e.viewForward,B)>=u(e.viewForward,J)?e.projectToScreen(W,K):e.projectToScreen(_,K),K[1]}function oe(e,t,n=!0){return n?e<t:e<=t}function re(e,t,n=!0){return n?e>t:e>=t}function ie(e,t,n){return t?e>n:e<n}function se(e,t){const n=e.fullHeight/e.pixelRatio,o=Math.max(t,n-t);return Math.max(G,F*o)}function ae(e,t){return[ce(e,t),ue(e,t)]}function ce(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+se(e,t))}function ue(e,t){return Math.max(0,t-se(e,t))}function le(e,t,n){const o={translation:e,location:t};return n&&(o.normal=n),o}function me(e){const{view:o,originalScreenPoint:r,horizonY:s,horizonPadding:a,outRopeTranslation:c,outGrabLocation:u,outGrabNormal:l,intersectionOptions:m,depthSearchSize:p}=e,f=o.state.camera,h=le(c,u,l);X.radius=d(o.spatialReference).radius;const S=y(o,f,r,X.radius,1,m);if(null==S.scenePickPoint)return!1;const g=S.hasGeometryIntersection;t(Z,S.scenePickPoint),t(h.location,Z);const j=S.sphere;h.normal&&S.normal&&t(h.normal,S.normal);const P=fe(r,s,a,g),w=n(Z,f.eye);if(P.wasAdjusted){Se({view:o,screenAdjustment:P,intersector:he(o),fallbackCheck:(e,t,n)=>{const o=I(j,f,e,t);return o&&n&&i(n,t),o},output:h,intersectionOptions:m})}return je({view:o,screenPoint:P.adjustedScreenPoint,camera:f,initialRopeDistance:w,depthSearchSize:p??k,output:h}),!0}function pe(e){const{view:r,originalScreenPoint:s,horizonY:a,horizonPadding:c,outRopeTranslation:u,outGrabLocation:l,outGrabNormal:m,intersectionOptions:p,depthSearchSize:d}=e,f=r.sceneIntersectionHelper,S=r.state.camera,g=he(r),j=le(u,l,m);f.intersectIntersectorScreen(s,g,p);const P=g.results.min.getIntersectionPoint(Z),w=P?n(Z,S.eye):Number.POSITIVE_INFINITY;P&&(t(j.location,Z),j.normal&&t(j.normal,g.results.min.normal)),r.renderCoordsHelper.worldUpAtPosition(S.eye,E),o(ee,S.eye,E,-S.relativeElevation),h(ee,E,$);const v=fe(s,a,c,P);if(v.wasAdjusted){Se({view:r,screenAdjustment:v,intersector:g,fallbackCheck:(e,t,n)=>{const o=b($,S,e,t);return o&&n&&i(n,E),o},output:j,intersectionOptions:p})}return je({view:r,screenPoint:v.adjustedScreenPoint,camera:S,initialRopeDistance:w,depthSearchSize:d??k,output:j}),!0}function de(e,t,n,o){return!o&&oe(e,t)||o&&ie(e,!1,n[0])?n[0]:!o&&re(e,t,!1)?n[1]:null}function fe(t,n,o,r){const i=de(t[1],n,o,r);return{originalScreenPoint:t,adjustedScreenPoint:e(t[0],i??t[1]),horizonY:n,horizonPadding:o,wasAdjusted:null!==i}}function he(e){const t=new M(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function Se(e){const{view:n,screenAdjustment:o,fallbackCheck:r,intersector:i,output:s,intersectionOptions:a}=e,c=n.sceneIntersectionHelper;c.intersectIntersectorScreen(o.adjustedScreenPoint,i,{...a,requiresGroundFeedback:!0});let u=i.results.min.getIntersectionPoint(s.location);if(u)return void(s.normal&&t(s.normal,i.results.min.normal));const l=ge(o);c.intersectIntersectorScreen(l,i,{...a,requiresGroundFeedback:!0}),u=i.results.min.getIntersectionPoint(s.location),u?s.normal&&t(s.normal,i.results.min.normal):(u=r(o.adjustedScreenPoint,s.location,s.normal),u||r(l,s.location,s.normal))}function ge(t){const{originalScreenPoint:n,adjustedScreenPoint:o,horizonY:r,horizonPadding:i}=t,s=re(o[1],r)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return e(o[0],s)}function je(e){const{view:t,screenPoint:n,camera:o,initialRopeDistance:s,depthSearchSize:a,output:u}=e,p=a>0?t.stage.renderView.getMinimalDepthForArea(v(t),n[0],n[1],o,a):null;c(u.translation,u.location,o.eye);let d=Math.min(m(u.translation),s);p&&p<=d&&(d=p),i(u.translation,u.translation),l(u.translation,u.translation,d),r(u.location,u.translation,o.eye)}export{se as computeHorizonPadding,ae as computeHorizonPaddingLimits,me as findGlobalModeRopePullGrabLocation,pe as findLocalModeRopePullGrabLocation,te as findPlaneHorizonY,ne as findSphereHorizonY,oe as isAboveHorizon,re as isBelowHorizon,T as ropePullMaxElevation,A as ropePullXSpeedMultiplier,R as ropePullYSpeedMultiplier,ie as shouldClampScreenY};
2
+ import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{distance as t,normalize as n,cross as o,add as r,crossAndNormalize as i,subtract as s,dot as a,scaleAndAdd as c,scale as u,copy as l,length as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../../../geometry/ellipsoidUtils.js";import{create as f,fromPositionAndNormal as h,distance as S,projectPoint as g,projectVector as j}from"../../../../geometry/support/plane.js";import{create as P}from"../../../../geometry/support/ray.js";import{Sphere as w}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as v}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as y,sphereOrPlanePointFromScreenPoint as I,intersectPlaneFromScreenPoint as b}from"./navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";import{Intersector as M}from"../../webgl-engine/lib/Intersector.js";const k=90,x=1.5,R=x,A=x,T=1e4,F=.1,G=12,q=p(),O=p(),H=e(),N=p(),U=f(),Y=p(),C=p(),D=p(),V=p(),E=p(),L=p(),W=p(),_=p(),B=p(),J=p(),K=e(),Q=P(),X=new w,Z=p(),$=f(),ee=p();function te(e,t){return j(t,e.viewForward,q),r(O,e.eye,q),e.projectToScreen(O,H),H[1]}function ne(e,l,m){const p=e.eye;if(t(l.center,p)<l.radius)return n(E,p),o(L,E,e.viewRight),r(O,p,L),e.projectToScreen(O,K),K[1];const d=e.up;z(e,m,Q);const f=l.radius;if(i(N,d,Q.direction),h(p,N,U),S(U,l.center)>f)return null;g(U,l.center,Y);const j=t(l.center,Y),P=Math.sqrt(f**2-j**2);s(C,p,Y),n(D,C),i(V,N,D);const w=a(C,D),v=a(C,V),y=Math.sqrt(w**2+v**2),I=P**2/y**2,b=P/y**2*Math.sqrt(y**2-P**2),M=I*w,k=b*-v,x=I*v,R=b*w,A=M-k,T=x+R,F=x-R;r(W,Y,c(W,u(W,D,M+k),V,T)),r(_,Y,c(_,u(_,D,A),V,F)),s(B,W,p),n(B,B),s(J,_,p),n(J,J);return a(e.viewForward,B)>=a(e.viewForward,J)?e.projectToScreen(W,K):e.projectToScreen(_,K),K[1]}function oe(e,t,n=!0){return n?e<t:e<=t}function re(e,t,n=!0){return n?e>t:e>=t}function ie(e,t,n){return t?e>n:e<n}function se(e,t){const n=e.fullHeight/e.pixelRatio,o=Math.max(t,n-t);return Math.max(G,F*o)}function ae(e,t){return[ce(e,t),ue(e,t)]}function ce(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+se(e,t))}function ue(e,t){return Math.max(0,t-se(e,t))}function le(e,t,n){const o={translation:e,location:t};return n&&(o.normal=n),o}function me(e){const{view:o,originalScreenPoint:r,horizonY:i,horizonPadding:s,outRopeTranslation:a,outGrabLocation:c,outGrabNormal:u,intersectionOptions:m,depthSearchSize:p}=e,f=o.state.camera,h=le(a,c,u);X.radius=d(o.spatialReference).radius;const S=y(o,f,r,X.radius,1,m);if(null==S.scenePickPoint)return!1;const g=S.hasGeometryIntersection;l(Z,S.scenePickPoint),l(h.location,Z);const j=S.sphere;h.normal&&S.normal&&l(h.normal,S.normal);const P=fe(r,i,s,g),w=t(Z,f.eye);if(P.wasAdjusted){Se({view:o,screenAdjustment:P,intersector:he(o),fallbackCheck:(e,t,o)=>{const r=I(j,f,e,t);return r&&o&&n(o,t),r},output:h,intersectionOptions:m})}return je({view:o,screenPoint:P.adjustedScreenPoint,camera:f,initialRopeDistance:w,depthSearchSize:p??k,output:h}),!0}function pe(e){const{view:o,originalScreenPoint:r,horizonY:i,horizonPadding:s,outRopeTranslation:a,outGrabLocation:u,outGrabNormal:m,intersectionOptions:p,depthSearchSize:d}=e,f=o.sceneIntersectionHelper,S=o.state.camera,g=he(o),j=le(a,u,m);f.intersectIntersectorScreen(r,g,p);const P=g.results.min.getIntersectionPoint(Z),w=P?t(Z,S.eye):Number.POSITIVE_INFINITY;P&&(l(j.location,Z),j.normal&&l(j.normal,g.results.min.normal)),o.renderCoordsHelper.worldUpAtPosition(S.eye,E),c(ee,S.eye,E,-S.relativeElevation),h(ee,E,$);const v=fe(r,i,s,P);if(v.wasAdjusted){Se({view:o,screenAdjustment:v,intersector:g,fallbackCheck:(e,t,o)=>{const r=b($,S,e,t);return r&&o&&n(o,E),r},output:j,intersectionOptions:p})}return je({view:o,screenPoint:v.adjustedScreenPoint,camera:S,initialRopeDistance:w,depthSearchSize:d??k,output:j}),!0}function de(e,t,n,o){return!o&&oe(e,t)||o&&ie(e,!1,n[0])?n[0]:!o&&re(e,t,!1)?n[1]:null}function fe(t,n,o,r){const i=de(t[1],n,o,r);return{originalScreenPoint:t,adjustedScreenPoint:e(t[0],i??t[1]),horizonY:n,horizonPadding:o,wasAdjusted:null!==i}}function he(e){const t=new M(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function Se(e){const{view:t,screenAdjustment:n,fallbackCheck:o,intersector:r,output:i,intersectionOptions:s}=e,a=t.sceneIntersectionHelper;a.intersectIntersectorScreen(n.adjustedScreenPoint,r,{...s,requiresGroundFeedback:!0});let c=r.results.min.getIntersectionPoint(i.location);if(c)return void(i.normal&&l(i.normal,r.results.min.normal));const u=ge(n);a.intersectIntersectorScreen(u,r,{...s,requiresGroundFeedback:!0}),c=r.results.min.getIntersectionPoint(i.location),c?i.normal&&l(i.normal,r.results.min.normal):(c=o(n.adjustedScreenPoint,i.location,i.normal),c||o(u,i.location,i.normal))}function ge(t){const{originalScreenPoint:n,adjustedScreenPoint:o,horizonY:r,horizonPadding:i}=t,s=re(o[1],r)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return e(o[0],s)}function je(e){const{view:t,screenPoint:o,camera:i,initialRopeDistance:a,depthSearchSize:c,output:l}=e,p=c>0?t.stage.renderView.getMinimalDepthForArea(v(t),o[0],o[1],i,c):null;s(l.translation,l.location,i.eye);let d=Math.min(m(l.translation),a);p&&p<=d&&(d=p),n(l.translation,l.translation),u(l.translation,l.translation,d),r(l.location,l.translation,i.eye)}export{se as computeHorizonPadding,ae as computeHorizonPaddingLimits,me as findGlobalModeRopePullGrabLocation,pe as findLocalModeRopePullGrabLocation,te as findPlaneHorizonY,ne as findSphereHorizonY,oe as isAboveHorizon,re as isBelowHorizon,T as ropePullMaxElevation,A as ropePullXSpeedMultiplier,R as ropePullYSpeedMultiplier,ie as shouldClampScreenY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../core/mathUtils.js";import{length as r,dot as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";function s(s,i,n,c){const e=r(n);if(e<=c)return!0;const m=o(s,n);if(m<=0)return-m<=c;const a=t(m/e,-1,1),f=Math.sqrt(1-a*a),h=t(c/e,0,1);return f*Math.sqrt(1-h*h)-h*a<=i}export{s as sphereIntersectsInfiniteRadialConeConservative};
2
+ import{clamp as t}from"../../../core/mathUtils.js";import{length as r,dot as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";function n(t,r,o,n){const c=o[0]-t[0],s=o[1]-t[1],i=r+n;return c*c+s*s<=i*i}function c(t,r,o,n,c){for(const s of c){const c=s[0],i=s[1],e=s[2],f=e>0?o:n;if(c*t[0]+i*t[1]+e*f+s[3]-Math.hypot(c,i)*r>0)return!1}return!0}function s(n,c,s,i){const e=r(s);if(e<=i)return!0;const f=o(n,s);if(f<=0)return-f<=i;const u=t(f/e,-1,1),m=Math.sqrt(1-u*u),a=t(i/e,0,1);return m*Math.sqrt(1-a*a)-a*u<=c}export{c as finiteVerticalCylinderIntersectsFrustumConservative,s as sphereIntersectsInfiniteRadialConeConservative,n as sphereIntersectsInfiniteVerticalCylinderConservative};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{crossAndNormalize as t,cross as o,scaleTo as n,add as c,sub as r,len as s,dot as e,negate as i,normalize as f}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{freeze as m,create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";function a(t,o){if(!o)return 0;const n=t[2]===2**t[0]-1,c=0===t[2];return n?c?3:1:c?2:0}function l(c,r){const s=c[0][2]>0,e=c[3][2]<0;if(!s&&!e)return;const i=v;t(i,b,c[0]);const f=M;if(t(f,b,c[1]),s){const s=N,e=c[4],m=q;t(m,e,b),t(s,m,e);const u=c[0];o(u,i,s),n(u,r);const a=c[1];o(a,f,s),n(a,r)}else{const s=N,e=c[5],m=q;t(m,e,b),t(s,e,m);const u=c[3];o(u,s,i),n(u,r);const a=c[2];o(a,s,f),n(a,r)}}function x(t,n,m,u,a){c(h,t,n),c(p,m,u),o(g,h,p),r(j,u,t),o(a,g,j),s(a)<=Number.EPSILON&&(c(a,t,n),c(a,a,m),c(a,a,u)),e(a,h)<0&&i(a,a),f(a,a);const l=e(a,t)/s(t);return Math.sqrt(Math.max(0,1-l*l))}const b=m(0,0,1),h=u(),p=u(),g=u(),j=u(),v=u(),M=u(),N=u(),q=u();export{x as computeSmallestSphericalTileCone,l as correctSphericalTileCornersForLatitude,a as getSphericalTilePole};
2
+ import{crossAndNormalize as t,cross as o,scaleTo as n,add as r,sub as c,len as s,dot as e,negate as i,normalize as f}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{freeze as m,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";function u(t,o){if(!o.isWGS84&&!o.isWebMercator)return 0;const n=t[0],r=t[1],c=r===2**n-1;return 0===r?c?3:1:c?2:0}function l(r,c){const s=r[0][2]>0,e=r[3][2]<0;if(!s&&!e)return;const i=j;t(i,x,r[0]);const f=v;if(t(f,x,r[1]),s){const s=N,e=r[4],m=S;t(m,e,x),t(s,m,e);const a=r[0];o(a,i,s),n(a,c);const u=r[1];o(u,f,s),n(u,c)}else{const s=N,e=r[5],m=S;t(m,e,x),t(s,e,m);const a=r[3];o(a,s,i),n(a,c);const u=r[2];o(u,s,f),n(u,c)}}function b(t,n,m,a,u){r(h,t,n),r(p,m,a),o(M,h,p),c(g,a,t),o(u,M,g),s(u)<=Number.EPSILON&&(r(u,t,n),r(u,u,m),r(u,u,a)),e(u,h)<0&&i(u,u),f(u,u);const l=e(u,t)/s(t);return Math.sqrt(Math.max(0,1-l*l))}const x=m(0,0,1),h=a(),p=a(),M=a(),g=a(),j=a(),v=a(),N=a(),S=a();export{b as computeSmallestSphericalTileCone,l as correctSphericalTileCornersForLatitude,u as getSphericalTilePole};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromValues as e,create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import r from"../../../geometry/SpatialReference.js";import{projectVectorToVector as i}from"../../../geometry/projection/projectVectorToVector.js";import{wrap as o}from"../../../geometry/support/aaBoundingBox.js";import{create as s}from"../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as n}from"../../../geometry/support/spatialReferenceUtils.js";import{createPlanarGlobePatch as a,updateEdgesAndCornersPlanar as u,updateEdgeElevationsAndResolutionsPlanar as l}from"./PatchGeometryFactory.js";import{Tile as h}from"./Tile.js";import{intersectAabbInvDirBefore as d}from"../webgl-engine/lib/RayIntersections.js";class m extends h{constructor(e,t,r,i,o){super(),this._horizontalScaleFactor=1,this._extentInRenderSR=s(),this._baseUsedMemory=900,this._subtreeGeometryElevationBoundMin=0,this._subtreeGeometryElevationBoundMax=0,this.init(e,t,r,i,o)}init(t,o,s,a,u){super.init(t,o,s,a,u);const l=u.view.renderSpatialReference,h=u.spatialReference,d=null!=l&&n(l)&&null!=h&&h.isGeographic?this.ellipsoid.radius*Math.PI/180:1;this._horizontalScaleFactor=d;const{isWebMercatorOnPlateCarree:m}=u,c=this._extentInRenderSR,p=this.extent;if(m){const t=e(p[0],p[1],0);i(t,r.WebMercator,t,r.PlateCarree);const o=e(p[2],p[3],0);i(o,r.WebMercator,o,r.PlateCarree),c[0]=t[0],c[1]=t[1],c[2]=o[0],c[3]=o[1]}else for(let e=0;e<4;++e)c[e]=p[e]*d;this.centerAtSeaLevel[0]=.5*(c[0]+c[2]),this.centerAtSeaLevel[1]=.5*(c[1]+c[3]),this.centerAtSeaLevel[2]=0,this._edgeLen=Math.max(c[2]-c[0],c[3]-c[1]),this._edgeLen2=this._edgeLen*this._edgeLen,this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateCenter();const e=this._extentInRenderSR,t=.5*(e[2]-e[0]),r=.5*(e[3]-e[1]),i=Math.sqrt(t*t+r*r),o=.5*(this.elevationBoundsMax-this.elevationBoundsMin),s=Math.max(i,o);this._center[1].radius=s}_calculateFrustumVisibility(e){const t=this._aabb(),r=t[0],i=t[1],o=t[2],s=t[3],n=t[4],a=t[5];let u=!0;for(let l=0;l<6;l++){const t=e[l],h=t[0],d=t[1],m=t[2],c=t[3];if(h*(h>0?r:s)+d*(d>0?i:n)+m*(m>0?o:a)+c>=0)return 2;u=u&&h*(h<0?r:s)+d*(d<0?i:n)+m*(m<0?o:a)+c<=0}return u?0:1}_aabb(){const e=this._extentInRenderSR;return o(e[0],e[1],Math.min(this.elevationBoundsMin,this._subtreeGeometryElevationBoundMin),e[2],e[3],Math.max(this.elevationBoundsMax,this._subtreeGeometryElevationBoundMax))}intersectsRay(e,t,r,i){return c[0]=1/t[0],c[1]=1/t[1],c[2]=1/t[2],d(this._aabb(),e,c,r,i)}createGeometry(){a(this.renderData),this._updateSubtreeGeometryElevationsBounds(),this.setMemoryDirty()}_updateSubtreeGeometryElevationsBounds(){const e=this._subtreeGeometryElevationBoundMin,t=this._subtreeGeometryElevationBoundMax,r=this.renderData;let i=e,o=t;if(r){const e=r.geometry.boundingBox;i=e[2],o=e[5]}else if(!this.leaf){i=1/0,o=-1/0;for(const e of this.children){const t=e;i=Math.min(i,t._subtreeGeometryElevationBoundMin),o=Math.max(o,t._subtreeGeometryElevationBoundMax)}}if(i!==this._subtreeGeometryElevationBoundMin||o!==this._subtreeGeometryElevationBoundMax){this._subtreeGeometryElevationBoundMin=i,this._subtreeGeometryElevationBoundMax=o,this.updateVisibility();const e=this.parent;e?._updateSubtreeGeometryElevationsBounds()}}get minimumVerticesPerSide(){return this.level<9?3:2}updateEdgeElevations(){u(this.renderData),this._updateSubtreeGeometryElevationsBounds()}updateEdgeElevationsAndResolutions(){l(this.renderData),this._updateSubtreeGeometryElevationsBounds()}get horizontalScale(){return this._horizontalScaleFactor}}const c=t();export{m as PlanarPatch};
2
+ import{fromValues as e,create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/SpatialReference.js";import{projectVectorToVector as r}from"../../../geometry/projection/projectVectorToVector.js";import{wrap as s}from"../../../geometry/support/aaBoundingBox.js";import{create as o}from"../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as n}from"../../../geometry/support/spatialReferenceUtils.js";import{sphereIntersectsInfiniteVerticalCylinderConservative as a}from"../support/ElevationAgnosticVisibility.js";import{createPlanarGlobePatch as u,updateEdgesAndCornersPlanar as l,updateEdgeElevationsAndResolutionsPlanar as h}from"./PatchGeometryFactory.js";import{Tile as d}from"./Tile.js";import{intersectAabbInvDirBefore as c}from"../webgl-engine/lib/RayIntersections.js";class m extends d{constructor(e,t,i,r,s){super(),this._horizontalScaleFactor=1,this._extentInRenderSR=o(),this._baseRadius=0,this._baseUsedMemory=900,this._subtreeGeometryElevationBoundMin=0,this._subtreeGeometryElevationBoundMax=0,this.init(e,t,i,r,s)}init(t,s,o,a,u){super.init(t,s,o,a,u);const l=u.view.renderSpatialReference,h=u.spatialReference,d=null!=l&&n(l)&&null!=h&&h.isGeographic?this.ellipsoid.radius*Math.PI/180:1;this._horizontalScaleFactor=d;const{isWebMercatorOnPlateCarree:c}=u,m=this._extentInRenderSR,p=this.extent;if(c){const t=e(p[0],p[1],0);r(t,i.WebMercator,t,i.PlateCarree);const s=e(p[2],p[3],0);r(s,i.WebMercator,s,i.PlateCarree),m[0]=t[0],m[1]=t[1],m[2]=s[0],m[3]=s[1]}else for(let e=0;e<4;++e)m[e]=p[e]*d;this.centerAtSeaLevel[0]=.5*(m[0]+m[2]),this.centerAtSeaLevel[1]=.5*(m[1]+m[3]),this.centerAtSeaLevel[2]=0,this._edgeLen=Math.max(m[2]-m[0],m[3]-m[1]),this._edgeLen2=this._edgeLen*this._edgeLen,this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateCenter();const e=this._extentInRenderSR,t=.5*(e[2]-e[0]),i=.5*(e[3]-e[1]),r=Math.sqrt(t*t+i*i);this._baseRadius=r;const s=.5*(this.elevationBoundsMax-this.elevationBoundsMin),o=Math.max(r,s);this._center[1].radius=o}_calculateTileFrustumVisibility(e,t){if(null!=t&&!a(this.centerAtSeaLevel,this._baseRadius,t.center,t.radius))return 2;const i=this._aabb(),r=e,s=i[0],o=i[1],n=i[2],u=i[3],l=i[4],h=i[5];let d=!0;for(let a=0;a<6;a++){const e=r[a],t=e[0],i=e[1],c=e[2],m=e[3];if(t*(t>0?s:u)+i*(i>0?o:l)+c*(c>0?n:h)+m>=0)return 2;d=d&&t*(t<0?s:u)+i*(i<0?o:l)+c*(c<0?n:h)+m<=0}return d?0:1}_aabb(){const e=this._extentInRenderSR;return s(e[0],e[1],Math.min(this.elevationBoundsMin,this._subtreeGeometryElevationBoundMin),e[2],e[3],Math.max(this.elevationBoundsMax,this._subtreeGeometryElevationBoundMax))}intersectsRay(e,t,i,r){return p[0]=1/t[0],p[1]=1/t[1],p[2]=1/t[2],c(this._aabb(),e,p,i,r)}createGeometry(){u(this.renderData),this._updateSubtreeGeometryElevationsBounds(),this.setMemoryDirty()}_updateSubtreeGeometryElevationsBounds(){const e=this._subtreeGeometryElevationBoundMin,t=this._subtreeGeometryElevationBoundMax,i=this.renderData;let r=e,s=t;if(i){const e=i.geometry.boundingBox;r=e[2],s=e[5]}else if(!this.leaf){r=1/0,s=-1/0;for(const e of this.children){const t=e;r=Math.min(r,t._subtreeGeometryElevationBoundMin),s=Math.max(s,t._subtreeGeometryElevationBoundMax)}}if(r!==this._subtreeGeometryElevationBoundMin||s!==this._subtreeGeometryElevationBoundMax){this._subtreeGeometryElevationBoundMin=r,this._subtreeGeometryElevationBoundMax=s,this.updateVisibility();const e=this.parent;e?._updateSubtreeGeometryElevationsBounds()}}get minimumVerticesPerSide(){return this.level<9?3:2}updateEdgeElevations(){l(this.renderData),this._updateSubtreeGeometryElevationsBounds()}updateEdgeElevationsAndResolutions(){h(this.renderData),this._updateSubtreeGeometryElevationsBounds()}get horizontalScale(){return this._horizontalScaleFactor}}const p=t();export{m as PlanarPatch};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{lerp as t}from"../../../core/mathUtils.js";import{normalize as e,set as i,add as s,scale as n,len as o,cross as r,dot as l,dist as a,sub as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as p}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as f,numPlanes as m}from"../../../geometry/support/frustum.js";import{Sphere as g}from"../../../geometry/support/sphere.js";import{createSphericalGlobePatch as x,updateEdgesAndCornersSpherical as $,updateEdgeElevationsAndResolutionsSpherical as v}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as M,internalAssert as _,almostEquals as b}from"./terrainUtils.js";import{Tile as j}from"./Tile.js";import{compareTilesByLij as y}from"./tileUtils.js";class B extends j{constructor(t,e,i,s,n){super(),this._convexHull=new Array(24),this._boundingSphere=new g,this._baseUsedMemory=1816,this.init(t,e,i,s,n)}init(i,s,n,o,r){super.init(i,s,n,o,r);const l=this.ellipsoid.radius,a=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(a,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-a)*Math.cos(m)*l,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=l-Math.sqrt(l*l-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])t[1].center=u,i(t[0],0,0,0),i(t[2],0,0,0),t[1].radius=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[1],i=this.convexHull;let s=0;const n=e.center;for(let t=0;t<8;++t)s=Math.max(s,V(n,i,3*t));t[1].radius=Math.sqrt(s)}}_calculateFrustumVisibility(t){if(!f(t,this._boundingSphere))return 2;if(this.lij[0]<10)return 1;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let n=0;n<m;n++){const o=4===n,r=t[n],l=r[0],a=r[1],h=r[2],u=r[3]-(o?i:0);let c=!1;for(let t=0;t<8;++t){const i=3*t;if(l*e[i]+a*e[i+1]+h*e[i+2]+u<0){if(c=!0,!s)break}else s=!1}if(!c)return 2}return s?0:1}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){x(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),M&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=this.elevationBoundsMin,i=this.elevationBoundsMax,r=this.ellipsoid.radius,l=i;if(0===this.level)t.center=u,t.radius=r+l;else{const l=this.extentInRadians,a=.5*(l[0]+l[2]),h=l[1],u=l[3];T(I,a,h,r),T(C,a,u,r),s(t.center,I,C);const c=r+.5*(e+i);n(t.center,t.center,c/o(t.center));const d=this.convexHull;let p=0;const f=(t,e)=>{const i=t[0]-d[3*e],s=t[1]-d[3*e+1],n=t[2]-d[3*e+2];return Math.sqrt(i*i+s*s+n*n)};for(let e=0;e<8;++e){const i=f(t.center,e);p=Math.max(p,i)}const m=p;t.radius=m+2}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const a=this.elevationBoundsMin,u=this.elevationBoundsMax,d=this._getPatchType(),p=this.surface.isWebMercator,f=p&&1===d,m=p&&2===d,g=m||f,x=Math.PI/2,$=t[0],v=t[2],M=m?-x:t[1],j=f?x:t[3],y=.5*($+v),B=a,S=i+(g?Math.min(0,B-1):B),V=(t,e,i)=>T(t,e,i,S),R=c(),I=c(),C=c(),L=c();V(R,$,M),V(I,$,j),V(C,v,j),V(L,v,M);const P=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};P(R,0),P(I,1),P(C,2),P(L,3);const F=u,A=i+(g?Math.max(0,F+1):F),k=c(),w=c(),D=c();T(w,y,j,S),T(D,y,M,S),s(k,w,D),e(k,k);const E=c(),U=c(),q=(t,i)=>{h(U,t,i),e(U,U);const o=-l(t,E)/l(U,E);_(o>=0),n(U,U,o),s(t,t,U)};if(2**this.lij[0]>2*this.lij[1]){const t=D,i=c();r(i,H,t),e(i,i),r(E,t,i),e(E,E),_(b(l(E,t)/o(t),0)),q(R,I),q(L,C),P(R,0),P(L,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=w,i=c();r(i,H,t),e(i,i),r(E,i,t),e(E,E),q(I,R),q(C,L),P(I,1),P(C,2)}const N=(t,e)=>{const i=A/l(e,k);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};N(4,R),N(5,I),N(6,C),N(7,L)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?3:1:i?2:0}intersectsRay(t,e,i,s){const n=this._boundingSphere,o=n.radius+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],l=n.center[0]-t[0],a=n.center[1]-t[1],h=n.center[2]-t[2],u=(l*e[0]+a*e[1]+h*e[2])/r,c=e[0]*u-l,d=e[1]*u-a,p=e[2]*u-h;return c*c+d*d+p*p<o*o}get minimumVerticesPerSide(){return this.level<S.length?S[this.level]+1:2}updateEdgeElevations(){$(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){v(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!M)return;if(this.level<=2)return;const t=this._boundingSphere,i=t.radius,n=t.center,u=c(),d=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=d+f,x=1,$=0,v=this._center[1];v.center;const j=v.radius,B=this.convexHull,S=(t,e)=>{for(let i=0;i<3;++i)t[i]=B[3*e+i]};{const t=c(),i=c(),s=c(),n=c(),o=c(),a=(a,u,c,d)=>{S(i,a),S(s,u),S(n,c),h(i,i,s),h(n,n,s),r(t,i,n),e(t,t);const p=l(t,s);S(o,d);const f=l(t,o),m=Math.abs(f-p);_(b(m,0),`Non coplanar ${a},${u},${c},${d} diff = ${m}`)};a(0,1,2,3),a(4,5,6,7),a(0,1,4,5),a(1,2,5,6),a(2,3,6,7),a(3,0,7,4)}const V=p(24),H=(t,e,i)=>{const s=4*t;for(let n=0;n<3;++n)V[s+n]=e[n];V[s+3]=i},I=c(),C=c(),L=c(),P=c(),F=(t,i,s,n)=>{S(I,i),S(C,s),S(L,n),h(I,I,C),e(I,I),h(L,L,C),e(L,L),r(P,I,L),e(P,P);const o=l(P,C);H(t,P,o)};F(0,0,1,2),F(1,1,0,4),F(2,1,5,2),F(3,3,2,6),F(4,4,0,3),F(5,4,6,5);const A=(t,e,i,s)=>{const n=4*t;return V[n]*e+V[n+1]*i+V[n+2]*s-V[n+3]},k=(t,e,i,s)=>A(t,e,i,s)>=-1,w=(t,e)=>k(t,e[0],e[1],e[2]),D=2**this.lij[0]>2*this.lij[1],E=(t,e,s)=>Math.sqrt(R(t,e,s,n[0],n[1],n[2]))<i,U=t=>E(t[0],t[1],t[2]),q=(t,e)=>E(t[e],t[e+1],t[e+2]),N=this.extentInRadians,G=.5*(N[0]+N[2]),z=N[1],O=N[3],W=c(),J=c();T(W,G,O,g),T(J,G,z,g);const K=D?"Upper":"Lower";let Q=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,s=k(e,B[i],B[i+1],B[i+2]);Q&&=s,_(s,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}_(w(e,J),`Tile[${this.lij}] (${K}) bottom mid outside of plane ${e}`),_(w(e,W),`Tile[${this.lij}] (${K}) top mid outside of plane ${e}`)}_(Q,"Not all convex hull points are inside convex hull polyhedron"),_(U(J),`Tile[${this.lij}] (${K}) bottom mid outside of bounding sphere`),_(U(W),`Tile[${this.lij}] (${K}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=q(B,3*e);_(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;k(e,B[i],B[i+1],B[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:X}=this,Y=Math.max(X[2]-X[0],X[3]-X[1]),Z=Math.round(Y*d),{renderData:tt}=this;if(!tt)return;const{geometry:et,geometryState:it,localOrigin:st}=tt,nt=et.vertexAttributes?.position;if(!nt)return;const ot=c(),rt=et.numVerticesPerSide-2,{indices:lt,indexCount:at,edgeVerticesStartIndex:ht,poleVerticesStartIndex:ut}=et;if(!lt)return;const ct=new Set;for(let e=0;e<at;++e){const t=lt[e];if(ct.has(t))continue;ct.add(t);const r=t<ut,l=t>=ht;let h=!1,c=-1;if(l){let e=ht;for(let i=0;i<4;++i){const s=it.edgeResolutions[i];if(t===e||t===e+s-1){h=!0;break}if(e+=s,t<e){c=i;break}}}const p=l?it.edgePeerNeighbors[c]:null,g=l&&p&&y(this,p)>0;nt.getVec(t,u),s(ot,u,st);const v=o(ot)-d;let M=0,_=!1;const b=f-v,B=v-m,S=b>x,V=B>x,R=S||V,T=()=>{const e=r?"internal":l&&!h?"edge":h?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(S?"(below)":V?"(above)":"")+(g?"(Neighbor)":"")},H=a(ot,n);if(H>=i+$){const t=H-i;R||(console.error(`${T()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${$}] h=${v.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),_=!0)}for(let e=0;e<6;++e)if(!k(e,ot[0],ot[1],ot[2])){const s=A(e,ot[0],ot[1],ot[2]),n=t%rt,o=(t-n)/rt;0===e&&b||5===e&&B||(console.error(`${T()} (${n},${o})|${rt}] is out of the bounding trapezoid plane ${e} h=${Math.round(v)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(s)} radii = ${Math.round(i)}/${Math.round(j)}} : maxL = ${Z}`),++M)}if(_||M>0)break}}get convexHull(){return this._convexHull}}const S=[128,64,64,32,16,8,8,4];function V(t,e,i){return R(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function R(t,e,i,s,n,o){const r=s-t,l=n-e,a=o-i;return r*r+l*l+a*a}const T=(t,e,i,s)=>{const n=Math.cos(e),o=Math.sin(e),r=Math.cos(i),l=Math.sin(i);t[0]=s*r*n,t[1]=s*r*o,t[2]=s*l},H=[0,0,1],I=c(),C=c();export{B as SphericalPatch};
2
+ import{lerp as t}from"../../../core/mathUtils.js";import{normalize as e,set as i,add as n,scale as s,len as o,dist as r,dot as l,sub as a,cross as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h,ZEROS as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as p}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as f,numPlanes as m}from"../../../geometry/support/frustum.js";import{Sphere as g}from"../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as x}from"../support/ElevationAgnosticVisibility.js";import{correctSphericalTileCornersForLatitude as $,computeSmallestSphericalTileCone as v,getSphericalTilePole as _}from"../support/sphericalTileUtils.js";import{createSphericalGlobePatch as b,updateEdgesAndCornersSpherical as M,updateEdgeElevationsAndResolutionsSpherical as j}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as y,internalAssert as B,almostEquals as S}from"./terrainUtils.js";import{Tile as C}from"./Tile.js";import{compareTilesByLij as T}from"./tileUtils.js";class A extends C{constructor(t,e,i,n,s){super(),this._convexHull=new Array(24),this._boundingConeAxis=h(),this._boundingConeHalfAngleSin=1,this._boundingSphere=new g,this._baseUsedMemory=1816,this.init(t,e,i,n,s)}init(i,n,s,o,r){super.init(i,n,s,o,r);const l=this.ellipsoid.radius,a=this.extentInRadians[0],u=this.extentInRadians[1],h=this.extentInRadians[2],c=this.extentInRadians[3],p=t(u,c,.5),f=t(a,h,.5),m=0===i?0:Math.min(Math.abs(u),Math.abs(c));this._edgeLen=(h-a)*Math.cos(m)*l,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=l-Math.sqrt(l*l-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])t[1].center=c,i(t[0],0,0,0),i(t[2],0,0,0),t[1].radius=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[1],i=this.convexHull;let n=0;const s=e.center;for(let t=0;t<8;++t)n=Math.max(n,V(s,i,3*t));t[1].radius=Math.sqrt(n)}}_calculateTileFrustumVisibility(t,e){if(!f(t,this._boundingSphere))return 2;if(this.lij[0]<10)return 1;if(null!=e&&0===this._getPatchType()&&!x(this._boundingConeAxis,this._boundingConeHalfAngleSin,e.center,e.radius))return 2;const i=this.convexHull,n=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<m;o++){const e=4===o,r=t[o],l=r[0],a=r[1],u=r[2],h=r[3]-(e?n:0);let c=!1;for(let t=0;t<8;++t){const e=3*t;if(l*i[e]+a*i[e+1]+u*i[e+2]+h<0){if(c=!0,!s)break}else s=!1}if(!c)return 2}return s?0:1}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){b(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),y&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=this.elevationBoundsMin,i=this.elevationBoundsMax,r=this.ellipsoid.radius,l=i;if(0===this.level)t.center=c,t.radius=r+l;else{const l=this.extentInRadians,a=.5*(l[0]+l[2]),u=l[1],h=l[3];I(L,a,u,r),I(F,a,h,r),n(t.center,L,F);const c=r+.5*(e+i);s(t.center,t.center,c/o(t.center));const d=this.convexHull;let p=0;const f=(t,e)=>{const i=t[0]-d[3*e],n=t[1]-d[3*e+1],s=t[2]-d[3*e+2];return Math.sqrt(i*i+n*n+s*s)};for(let e=0;e<8;++e){const i=f(t.center,e);p=Math.max(p,i)}const m=p;t.radius=m+2}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const s=this.elevationBoundsMin,o=this.elevationBoundsMax,r=this._getPatchType(),a=this.surface.isWebMercator,u=a&&1===r,c=a&&2===r,d=c||u,p=Math.PI/2,f=t[0],m=t[2],g=c?-p:t[1],x=u?p:t[3],_=.5*(f+m),b=s,M=i+(d?Math.min(0,b-1):b),j=(t,e,i)=>I(t,e,i,M),y=h(),B=h(),S=h(),C=h();j(y,f,g),j(B,f,x),j(S,m,x),j(C,m,g);const T=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};T(y,0),T(B,1),T(S,2),T(C,3);const A=o,H=i+(d?Math.max(0,A+1):A),V=h(),R=h(),L=h();I(R,_,x,M),I(L,_,g,M),n(V,R,L),e(V,V);const F=P;F[0]=y,F[1]=C,F[2]=S,F[3]=B,F[4]=L,F[5]=R,$(F,M),this._boundingConeHalfAngleSin=v(y,C,S,B,this._boundingConeAxis),T(y,0),T(B,1),T(S,2),T(C,3);const E=(t,e)=>{const i=H/l(e,V);for(let n=0;n<3;++n)this._convexHull[3*t+n]=e[n]*i};E(4,y),E(5,B),E(6,S),E(7,C)}_getPatchType(){const t=_(this.lij,this.spatialReference),e=2===t||3===t;return 1===t||3===t?e?3:1:e?2:0}intersectsRay(t,e,i,n){const s=this._boundingSphere,o=s.radius+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],l=s.center[0]-t[0],a=s.center[1]-t[1],u=s.center[2]-t[2],h=(l*e[0]+a*e[1]+u*e[2])/r,c=e[0]*h-l,d=e[1]*h-a,p=e[2]*h-u;return c*c+d*d+p*p<o*o}get minimumVerticesPerSide(){return this.level<H.length?H[this.level]+1:2}updateEdgeElevations(){M(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){j(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!y)return;if(this.level<=2)return;const t=this._boundingSphere,i=t.radius,s=t.center,c=h(),d=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=d+f,x=1,$=0,v=this._center[1];v.center;const _=v.radius,b=this.convexHull,M=(t,e)=>{for(let i=0;i<3;++i)t[i]=b[3*e+i]};{const t=h(),i=h(),n=h(),s=h(),o=h(),r=(r,h,c,d)=>{M(i,r),M(n,h),M(s,c),a(i,i,n),a(s,s,n),u(t,i,s),e(t,t);const p=l(t,n);M(o,d);const f=l(t,o),m=Math.abs(f-p);B(S(m,0),`Non coplanar ${r},${h},${c},${d} diff = ${m}`)};r(0,1,2,3),r(4,5,6,7),r(0,1,4,5),r(1,2,5,6),r(2,3,6,7),r(3,0,7,4)}const j=p(24),C=(t,e,i)=>{const n=4*t;for(let s=0;s<3;++s)j[n+s]=e[s];j[n+3]=i},A=h(),H=h(),V=h(),P=h(),L=(t,i,n,s)=>{M(A,i),M(H,n),M(V,s),a(A,A,H),e(A,A),a(V,V,H),e(V,V),u(P,A,V),e(P,P);const o=l(P,H);C(t,P,o)};L(0,0,1,2),L(1,1,0,4),L(2,1,5,2),L(3,3,2,6),L(4,4,0,3),L(5,4,6,5);const F=(t,e,i,n)=>{const s=4*t;return j[s]*e+j[s+1]*i+j[s+2]*n-j[s+3]},E=(t,e,i,n)=>F(t,e,i,n)>=-1,k=(t,e)=>E(t,e[0],e[1],e[2]),w=2**this.lij[0]>2*this.lij[1],D=(t,e,n)=>Math.sqrt(R(t,e,n,s[0],s[1],s[2]))<i,U=t=>D(t[0],t[1],t[2]),q=(t,e)=>D(t[e],t[e+1],t[e+2]),N=this.extentInRadians,G=.5*(N[0]+N[2]),z=N[1],O=N[3],W=h(),J=h();I(W,G,O,g),I(J,G,z,g);const K=w?"Upper":"Lower";let Q=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,n=E(e,b[i],b[i+1],b[i+2]);Q&&=n,B(n,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}B(k(e,J),`Tile[${this.lij}] (${K}) bottom mid outside of plane ${e}`),B(k(e,W),`Tile[${this.lij}] (${K}) top mid outside of plane ${e}`)}B(Q,"Not all convex hull points are inside convex hull polyhedron"),B(U(J),`Tile[${this.lij}] (${K}) bottom mid outside of bounding sphere`),B(U(W),`Tile[${this.lij}] (${K}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=q(b,3*e);B(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;E(e,b[i],b[i+1],b[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:X}=this,Y=Math.max(X[2]-X[0],X[3]-X[1]),Z=Math.round(Y*d),{renderData:tt}=this;if(!tt)return;const{geometry:et,geometryState:it,localOrigin:nt}=tt,st=et.vertexAttributes?.position;if(!st)return;const ot=h(),rt=et.numVerticesPerSide-2,{indices:lt,indexCount:at,edgeVerticesStartIndex:ut,poleVerticesStartIndex:ht}=et;if(!lt)return;const ct=new Set;for(let e=0;e<at;++e){const t=lt[e];if(ct.has(t))continue;ct.add(t);const l=t<ht,a=t>=ut;let u=!1,h=-1;if(a){let e=ut;for(let i=0;i<4;++i){const n=it.edgeResolutions[i];if(t===e||t===e+n-1){u=!0;break}if(e+=n,t<e){h=i;break}}}const p=a?it.edgePeerNeighbors[h]:null,g=a&&p&&T(this,p)>0;st.getVec(t,c),n(ot,c,nt);const v=o(ot)-d;let b=0,M=!1;const j=f-v,y=v-m,B=j>x,S=y>x,C=B||S,A=()=>{const e=l?"internal":a&&!u?"edge":u?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(B?"(below)":S?"(above)":"")+(g?"(Neighbor)":"")},H=r(ot,s);if(H>=i+$){const t=H-i;C||(console.error(`${A()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${$}] h=${v.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),M=!0)}for(let e=0;e<6;++e)if(!E(e,ot[0],ot[1],ot[2])){const n=F(e,ot[0],ot[1],ot[2]),s=t%rt,o=(t-s)/rt;0===e&&j||5===e&&y||(console.error(`${A()} (${s},${o})|${rt}] is out of the bounding trapezoid plane ${e} h=${Math.round(v)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(n)} radii = ${Math.round(i)}/${Math.round(_)}} : maxL = ${Z}`),++b)}if(M||b>0)break}}get convexHull(){return this._convexHull}}const H=[128,64,64,32,16,8,8,4];function V(t,e,i){return R(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function R(t,e,i,n,s,o){const r=n-t,l=s-e,a=o-i;return r*r+l*l+a*a}const I=(t,e,i,n)=>{const s=Math.cos(e),o=Math.sin(e),r=Math.cos(i),l=Math.sin(i);t[0]=n*r*s,t[1]=n*r*o,t[2]=n*l},P=[null,null,null,null,null,null],L=h(),F=h();export{A as SphericalPatch};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{toConst as e}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{subtract as n,squaredLength as r,dot as a,scale as l,add as o,length as h,copy as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,unitZ as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f,rectangleContainsRectangleCyclicalAware as _,rectanglesIntersectCyclicalAware as m,width as y,height as v}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{isGroupLayer as A}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as x}from"../support/flowUtils.js";import{ElevationBounds as D}from"./ElevationBounds.js";import{ElevationTileAgent as b,isElevationTileAgent as L}from"./ElevationTileAgent.js";import{LayerClasses as S}from"./LayerClass.js";import{MapDataCacheItem as j}from"./MapDataCacheItem.js";import{MapTileAgent as I,isMapTileAgent as U}from"./MapTileAgent.js";import{maxPatchTesselation as T}from"./TerrainConst.js";import{isVectorTile as C,isTileTexture as B,isRasterTile as w,isCreateBitmapResult as E}from"./TerrainData.js";import{weakAssert as P,isBlendableLayerView as R,oppositeCorner as q,internalAssert as V,enableTerrainInternalChecks as O,neighborEdgeIndices as N,oppositeEdge as G,neighborCornerIndices as k,almostEquals as F,enableWaterproofTests as z,isNorth as W,isSouth as J,isWest as $,isEast as H,isWestCorner as X,isNorthCorner as Y}from"./terrainUtils.js";import{tileAgentDone as Q}from"./TileAgent.js";import{TilePerLayerInfo as K}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as Z}from"./tileUtils.js";const ee=.1;class te{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this._lastElevationSourceUpdateRequestSignature=null,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=d(),this._center=[d(),new M,d()],this.up=c(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=d(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return null==this._surface}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}_setPendingUpdateForDescendants(){const e=this._children;if(e[0])for(const t of e)t.renderData&&(t.setPendingUpdate(16),t.setMemoryDirty()),t._setPendingUpdateForDescendants()}static prune(){ne.prune(0),re.prune(0),K.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}checkVisibility(e){if(this._dirty)return null;const t=this._calculateVisibility(e);if(this._frustumVisibility!==t||this._visible!==(2!==t&&this._intersectsClippingArea))throw new Error(`Assertion failed: waterproof.visibility-cache-mismatch: Tile[${this.lij}]`);return t}computeVisibility(){this._dirty=!1;const e=this.parent?.frustumVisibility??1;this._frustumVisibility=this._calculateVisibility(e);const t=2!==this._frustumVisibility&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}_calculateVisibility(e){const t=this.parent;return 0===e?0:null!=t&&2===e&&this._elevationBoundsMin>=t._elevationBoundsMin&&this._elevationBoundsMax<=t._elevationBoundsMax?2:this._calculateFrustumVisibility(this.surface.frustum)}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,this._lastElevationSourceUpdateRequestSignature=null,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.clearChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of S){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=K.acquire(this._surface.upsampleInfoPool),0===r&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,T)}dispose(){P(!this.renderData,"tile.renderData was not unloaded"),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new j(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),null==this._surface?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(C(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(const{data:e}of this.layerInfo[1])C(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(const e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?1===e?this._cached?0:this.getTerrainDataMemory(i.data):0===e?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return B(e)?e.texture.usedMemory:w(e)?e.memoryUsage:C(e)?e.usedMemoryPerReference:E(e)?this._cpuImageMemorySize:0}updateScreenDepth(e){const[t,i,s]=this._center[1].center,n=e,r=n[2]*t+n[6]*i+n[10]*s+n[14];this.screenDepth=r<0?0:r/(n[3]*t+n[7]*i+n[11]*s+n[15])}shouldSplit(e,t,i){if(!this.visible)return 0;if(e.frustum&&(!this._intersectsClippingArea||2===this._calculateFrustumVisibility(e.frustum)))return 0;const s=this.level;n(ce,this._center[1].center,t);let u=r(ce),d=ce,c=this._center[1].center;n(ge,this._center[0],t);const g=r(ge);g<u&&(u=g,d=ge,c=this._center[0]),n(pe,this._center[2],t);const p=r(pe);if(p<u&&(u=p,d=pe,c=this._center[2]),this._edgeLen2>u&&s<e.maxLod)return 1;const f=Math.sqrt(u),_=e.fovX*f*2,m=this._edgeLen/_,y=()=>{if(s<e.maxLod)return this.elevationLevel=s,0;const t=s+Math.ceil(-Math.log2(e.relativeWidthLimit/m));return t!==this.elevationLevel?(this.elevationLevel=t,2):0},v=null!=i?i-s:1/0;if(v<=.5)return y();const M=a(this.up,ce),A=this._elevationBoundsMax-this._elevationBoundsMin,x=A/this.edgeLen;if(e.aboveGround&&M>0&&x<.001){if(M/f-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return y()}const D=null!=i?3-Math.min(v,2):1;if(m*D<e.relativeWidthLimit||s>=e.maxLod)return y();if(s<7)return 1;l(fe,this.up,M),n(fe,fe,d);const b=r(fe);if(b<=this.radius*this.radius)return 1;l(fe,fe,this.radius/Math.sqrt(b)),o(fe,fe,c),n(fe,t,fe);const L=Math.min(1,(Math.abs(a(fe,this.up))+.5*A+this._curvatureHeight)/h(fe)),S=ee/e.angledSplitBias,j=e.fovY*f*2;return L*(this._edgeLen/j*D)<S*e.relativeHeightLimit?y():1}needsElevationSourceUpdate(){const e=this.renderData?.geometryState.samplerDataSourceLevels;if(null==e)return!1;const t=Math.max(this.elevationLevel-this.elevationLevelDelta,0);return e.some(e=>e>t)&&this._lastElevationSourceUpdateRequestSignature!==this._elevationSourceUpdateRequestSignature(e)}markElevationSourceUpdateRequested(){const e=this.renderData?.geometryState.samplerDataSourceLevels;this._lastElevationSourceUpdateRequestSignature=null!=e?this._elevationSourceUpdateRequestSignature(e):null}_elevationSourceUpdateRequestSignature(e){return`${Math.max(this.elevationLevel-this.elevationLevelDelta,0)}:${e.join(",")}`}createChildren(){const e=this._children,t=this.lij[0]+1,i=2*this.lij[1],s=2*this.lij[2];return e[0]=this.surface.createTile(t,i,s,this),e[1]=this.surface.createTile(t,i,s+1,this),e[2]=this.surface.createTile(t,i+1,s,this),e[3]=this.surface.createTile(t,i+1,s+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}get hasGeometryState(){return null!=this.renderData?.geometryState}load(){this.refMapData();for(const e of S)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(const e of S){const t=this.layerInfo[e];for(const e of t)e.loadingAgent&&e.loadingAgent!==Q&&(se(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){const e=this.layerInfo[1];for(const t of e)t.loadingAgent&&t.loadingAgent!==Q&&(se(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._withinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._withinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._withinClippingArea,n=!(i||t||this._withinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of S){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==Q&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(1)||0!==e&&!this._loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,1===e||4===e?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e);const i=C(n.data);return s.dataArrived(this,i),!0}if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,{signal:n.requestAbort.signal});if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get leaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return r(n(fe,this._center[1].center,e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);P(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=C(i),n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll(e=>e.dataArrived(this,s)),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){const i=this.layerInfo[t][e];i.dataMissing=!0,i.waitingAgents.forAll(e=>e.dataMissing()),i.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor(i=>i.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(0===e?16:32),this.setPendingUpdate(0===e?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(const e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData()}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[0];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.minElevation),s=Math.max(s,a.elevationBounds.maxElevation),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;l(fe,this.up,i),o(s[1].center,this.centerAtSeaLevel,fe),l(fe,this.up,e),o(s[0],this.centerAtSeaLevel,fe),l(fe,this.up,t),o(s[2],this.centerAtSeaLevel,fe)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[0][e],s=this.elevationLevelDelta,n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,0);if(!Z(this,a))return;const l=ae;let o=!1;const h=i.data;if(h&&h.level<=n){const e=i.data;l.minElevation=e.samplerData.data.minValue,l.maxElevation=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,o=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[0][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.minElevation!==1/0&&(l.level=i.level,o=!0))}o&&(null==i.elevationBounds&&(i.elevationBounds=new D),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==Q&&(se(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:K.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===Q&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of S){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==Q&&(i.loadingAgent.setSuspension(t),i.loadingAgent===Q&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==Q&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=Q,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||A(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(R(e)&&"normal"!==e?.layer?.blendMode||A(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);let n=!1;for(let r=e;r<i.length;++r){const a=i[r],l=this._surface.layerViewByIndex(r,t);let o=!1;n&&!x(l)||(a.loadingAgent?Z(this,l)?(a.loadingAgent!==Q&&a.loadingAgent.setSuspension(s),a.loadingAgent!==Q&&(o=a.loadingAgent.update())):a.dispose():Z(this,l)&&(a.loadingAgent=ie(this,r,t,s),o=a.loadingAgent.startLoading(),o?a.loadingAgent===Q&&this.setPendingUpdate(8):(se(a.loadingAgent),a.loadingAgent=Q)),a.loadingAgent===Q&&this.updateRenderData(t,0),!l.destroyed&&!this._hasBlendModes(e,i.length,t)&&o&&l.isOpaque&&(n||=!0))}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,s=Math.max(this.level-e,this.elevationLevelDelta-i),n=t(1+(this._maxTesselation>>s),2,this._maxTesselation+1),r=this.minimumVerticesPerSide;return Math.max(n,r)}_findLIJ(e,t){if(!e)return null;const{rootTiles:i}=this.surface;if(null!=i)for(const s of i)if(le(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.leaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this._getNeighborLIJ(i,e);return s?oe(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=1===e?1:7===e?0:5===e?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(q(e),t)||null}forAllSubtreeOnSide(e,t){const i=0===e?[0,1]:1===e?[1]:2===e?[1,3]:3===e?[3]:4===e?[2,3]:5===e?[2]:6===e?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach(e=>s(n[e]))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(V(!O||i>=0),0===i)return 0;const s=2**i,n=!(1&~e),r=n?0:1,a=t.lij[r+1]*s,l=this._lij[r+1],o=l-a,h=n?s-1-o:o;return O&&(V(a<=l&&l<a+s),V(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.loaded;N.forEach(t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(G(t),i=>!!i.loaded&&(e(i,t),!0))}),k.forEach(t=>{const s=this.findNeighborTile(t,i)?.findCorner(q(t),e=>e.loaded);V(!s||he(this,s,t)),s?.loaded&&e(s,t)})}_getNeighborLIJ(e,t){const i=W(t)?-1:J(t)?1:0,s=$(t)?-1:H(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this._wrapLIJ(n):n[2]<0?null:n}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(null==e)return!1;if(0===this.level&&0===e.level){if(this._eastEnd&&e._westEnd&&2===t)return!0;if(this._westEnd&&e._eastEnd&&6===t)return!0}const i=Math.max(1e-6*(this.extent[2]-this.extent[0]),1);switch(t){case 0:return F(this.extent[3],e.extent[1],i);case 4:return F(this.extent[1],e.extent[3],i);case 2:return F(this.extent[2],e.extent[0],i)||F(this.extent[2],-e.extent[0],i);case 6:return F(this.extent[0],e.extent[2],i)||F(this.extent[0],-e.extent[2],i)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return 0===this._lij[2]}checkGeometryWaterproofness(){z&&(V(this.loaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,{rootTilesExtent:i}=this._surface,s=.25*(t[2]-t[0]);if(W(e)&&t[3]+s>=i[3])return!1;if(J(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&$(e)&&t[0]-s<=i[0])&&!(!n&&H(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;u(this._lastPOI,e);const i=this._center[1].center,s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}updateOverlayParameters(e){const{renderData:t}=this;if(!t)return;const{overlays:i,longitudeCyclical:s}=e,n=t.overlay;if(0===i.length)this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n);else{const[e,t]=i,r=this.extent;_(e.extent,r,s)||m(r,e.extent,s)||m(r,t.extent,s)?(this._setOverlayData(i,s,r,0,n),this._setOverlayData(i,s,r,1,n)):(this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n))}}_setOverlayData(e,t,i,s,n){const r=e[s].extent,a=y(r),l=v(r);let o=i[0];if(t){o=t.minimalMonotonic(r[0],o);const e=t.minimalMonotonic(r[0],i[2]);o>e&&(o=e-(i[2]-i[0]))}if(0===a||0===l)return void n.setOffsetAndScale(s,0,0,1,1);const h=y(i)/a,u=v(i)/l,d=(o-r[0])/a,c=(i[1]-r[1])/l;n.setOffsetAndScale(s,d,c,h,u)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function ie(e,t,i,s){const n=0===i?re.acquire():ne.acquire();return n.init(e,t,i,s),n}function se(e){e.dispose(),L(e)?re.release(e):U(e)&&ne.release(e)}const ne=new s(()=>new I),re=new s(()=>new b),ae=new D;function le(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function oe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function he(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?ue(e,t,i):ue(t,e,q(i)))}function ue(e,t,i){V(e.level>=t.level);const s=X(i),n=Y(i),r=e.extent,a=t.extent,l=[s?r[0]:r[2],n?r[3]:r[1]],o=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),u=F(l[0],o[0],h)||e.surface.isGlobal&&F(l[0],-o[0],h),d=F(l[1],o[1],h);if(u&&d)return!0;if(e.level===t.level)return V(!1),!1;if(!u&&!d)return V(!1),!1;const c=u?de(a[1],a[3],r[1],r[3],h):de(a[0],a[2],r[0],r[2],h);return V(c),c}function de(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}const ce=d(),ge=d(),pe=d(),fe=d();export{te as Tile,he as isCornerNeighbor,oe as lijEquals};
2
+ import{toConst as e}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{subtract as n,squaredLength as r,dot as a,scale as l,add as o,length as h,copy as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,unitZ as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f,rectangleContainsRectangleCyclicalAware as _,rectanglesIntersectCyclicalAware as m,width as y,height as v}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{isGroupLayer as A}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as x}from"../support/flowUtils.js";import{ElevationBounds as D}from"./ElevationBounds.js";import{ElevationTileAgent as b,isElevationTileAgent as L}from"./ElevationTileAgent.js";import{LayerClasses as S}from"./LayerClass.js";import{MapDataCacheItem as j}from"./MapDataCacheItem.js";import{MapTileAgent as T,isMapTileAgent as I}from"./MapTileAgent.js";import{maxPatchTesselation as U}from"./TerrainConst.js";import{isVectorTile as B,isTileTexture as C,isRasterTile as w,isCreateBitmapResult as E}from"./TerrainData.js";import{weakAssert as P,isBlendableLayerView as R,oppositeCorner as q,internalAssert as O,enableTerrainInternalChecks as V,neighborEdgeIndices as N,oppositeEdge as G,neighborCornerIndices as k,almostEquals as F,enableWaterproofTests as z,isNorth as W,isSouth as J,isWest as $,isEast as H,isWestCorner as X,isNorthCorner as Y}from"./terrainUtils.js";import{tileAgentDone as Q}from"./TileAgent.js";import{TilePerLayerInfo as K}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as Z}from"./tileUtils.js";const ee=.1;class te{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this._lastElevationSourceUpdateRequestSignature=null,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=d(),this._center=[d(),new M,d()],this.up=c(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=d(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return null==this._surface}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}_setPendingUpdateForDescendants(){const e=this._children;if(e[0])for(const t of e)t.renderData&&(t.setPendingUpdate(16),t.setMemoryDirty()),t._setPendingUpdateForDescendants()}static prune(){ne.prune(0),re.prune(0),K.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}checkVisibility(e){if(this._dirty)return null;const t=this._calculateVisibility(e);if(this._frustumVisibility!==t||this._visible!==(2!==t&&this._intersectsClippingArea))throw new Error(`Assertion failed: waterproof.visibility-cache-mismatch: Tile[${this.lij}]`);return t}computeVisibility(){this._dirty=!1;const e=this.parent?.frustumVisibility??1;this._frustumVisibility=this._calculateVisibility(e);const t=2!==this._frustumVisibility&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}_calculateVisibility(e){const t=this.parent;return 0===e?0:null!=t&&2===e&&this._elevationBoundsMin>=t._elevationBoundsMin&&this._elevationBoundsMax<=t._elevationBoundsMax?2:this._calculateTileFrustumVisibility(this.surface.frustum,this._surface.view.frustum.boundingSphere)}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,this._lastElevationSourceUpdateRequestSignature=null,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.clearChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of S){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=K.acquire(this._surface.upsampleInfoPool),0===r&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,U)}dispose(){P(!this.renderData,"tile.renderData was not unloaded"),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new j(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),null==this._surface?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(B(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(const{data:e}of this.layerInfo[1])B(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(const e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?1===e?this._cached?0:this.getTerrainDataMemory(i.data):0===e?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return C(e)?e.texture.usedMemory:w(e)?e.memoryUsage:B(e)?e.usedMemoryPerReference:E(e)?this._cpuImageMemorySize:0}updateScreenDepth(e){const[t,i,s]=this._center[1].center,n=e,r=n[2]*t+n[6]*i+n[10]*s+n[14];this.screenDepth=r<0?0:r/(n[3]*t+n[7]*i+n[11]*s+n[15])}shouldSplit(e,t,i){if(!this.visible)return 0;if(e.frustum&&(!this._intersectsClippingArea||2===this._calculateTileFrustumVisibility(e.frustum)))return 0;const s=this.level;n(ce,this._center[1].center,t);const u=r(ce),d=this._closestCenterOnElevationRange(t,ge),c=n(pe,d,t),g=Math.min(u,r(c));if(this._edgeLen2>g&&s<e.maxLod)return 1;const p=Math.sqrt(g),f=e.fovX*p*2,_=this._edgeLen/f,m=()=>{if(s<e.maxLod)return this.elevationLevel=s,0;const t=s+Math.ceil(-Math.log2(e.relativeWidthLimit/_));return t!==this.elevationLevel?(this.elevationLevel=t,2):0},y=null!=i?i-s:1/0;if(y<=.5)return m();const v=a(this.up,ce),M=this._elevationBoundsMax-this._elevationBoundsMin,A=M/this.edgeLen;if(e.aboveGround&&v>0&&A<.001){if(v/p-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-A>0)return m()}const x=null!=i?3-Math.min(y,2):1;if(_*x<e.relativeWidthLimit||s>=e.maxLod)return m();if(s<7)return 1;l(fe,this.up,v),n(fe,fe,c);const D=r(fe);if(D<=this.radius*this.radius)return 1;l(fe,fe,this.radius/Math.sqrt(D)),o(fe,fe,d),n(fe,t,fe);const b=Math.min(1,(Math.abs(a(fe,this.up))+.5*M+this._curvatureHeight)/h(fe)),L=ee/e.angledSplitBias,S=e.fovY*p*2;return b*(this._edgeLen/S*x)<L*e.relativeHeightLimit?m():1}needsElevationSourceUpdate(){const e=this.renderData?.geometryState.samplerDataSourceLevels;if(null==e)return!1;const t=Math.max(this.elevationLevel-this.elevationLevelDelta,0);return e.some(e=>e>t)&&this._lastElevationSourceUpdateRequestSignature!==this._elevationSourceUpdateRequestSignature(e)}markElevationSourceUpdateRequested(){const e=this.renderData?.geometryState.samplerDataSourceLevels;this._lastElevationSourceUpdateRequestSignature=null!=e?this._elevationSourceUpdateRequestSignature(e):null}_elevationSourceUpdateRequestSignature(e){return`${Math.max(this.elevationLevel-this.elevationLevelDelta,0)}:${e.join(",")}`}createChildren(){const e=this._children,t=this.lij[0]+1,i=2*this.lij[1],s=2*this.lij[2];return e[0]=this.surface.createTile(t,i,s,this),e[1]=this.surface.createTile(t,i,s+1,this),e[2]=this.surface.createTile(t,i+1,s,this),e[3]=this.surface.createTile(t,i+1,s+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}get hasGeometryState(){return null!=this.renderData?.geometryState}load(){this.refMapData();for(const e of S)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(const e of S){const t=this.layerInfo[e];for(const e of t)e.loadingAgent&&e.loadingAgent!==Q&&(se(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){const e=this.layerInfo[1];for(const t of e)t.loadingAgent&&t.loadingAgent!==Q&&(se(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._withinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._withinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._withinClippingArea,n=!(i||t||this._withinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of S){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==Q&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(1)||0!==e&&!this._loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,1===e||4===e?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e);const i=B(n.data);return s.dataArrived(this,i),!0}if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,{signal:n.requestAbort.signal});if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get leaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return r(n(fe,this._center[1].center,e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);P(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=B(i),n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll(e=>e.dataArrived(this,s)),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){const i=this.layerInfo[t][e];i.dataMissing=!0,i.waitingAgents.forAll(e=>e.dataMissing()),i.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor(i=>i.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(0===e?16:32),this.setPendingUpdate(0===e?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(const e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData()}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[0];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.minElevation),s=Math.max(s,a.elevationBounds.maxElevation),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;l(fe,this.up,i),o(s[1].center,this.centerAtSeaLevel,fe),l(fe,this.up,e),o(s[0],this.centerAtSeaLevel,fe),l(fe,this.up,t),o(s[2],this.centerAtSeaLevel,fe)}_closestCenterOnElevationRange(e,t){if(1===this._surface.viewingMode){if(0===this.level)return u(t,this._center[1].center);const i=a(this.up,e),s=Math.max(this.ellipsoid.radius+this._elevationBoundsMin,Math.min(this.ellipsoid.radius+this._elevationBoundsMax,i));return l(t,this.up,s)}const i=Math.max(this._elevationBoundsMin,Math.min(this._elevationBoundsMax,e[2]));return t[0]=this.centerAtSeaLevel[0],t[1]=this.centerAtSeaLevel[1],t[2]=i,t}findElevationBoundsForLayer(e,t){const i=this.layerInfo[0][e],s=this.elevationLevelDelta,n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,0);if(!Z(this,a))return;const l=ae;let o=!1;const h=i.data;if(h&&h.level<=n){const e=i.data;l.minElevation=e.samplerData.data.minValue,l.maxElevation=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,o=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[0][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.minElevation!==1/0&&(l.level=i.level,o=!0))}o&&(null==i.elevationBounds&&(i.elevationBounds=new D),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==Q&&(se(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:K.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===Q&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of S){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==Q&&(i.loadingAgent.setSuspension(t),i.loadingAgent===Q&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==Q&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=Q,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||A(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(R(e)&&"normal"!==e?.layer?.blendMode||A(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);let n=!1;for(let r=e;r<i.length;++r){const a=i[r],l=this._surface.layerViewByIndex(r,t);let o=!1;n&&!x(l)||(a.loadingAgent?Z(this,l)?(a.loadingAgent!==Q&&a.loadingAgent.setSuspension(s),a.loadingAgent!==Q&&(o=a.loadingAgent.update())):a.dispose():Z(this,l)&&(a.loadingAgent=ie(this,r,t,s),o=a.loadingAgent.startLoading(),o?a.loadingAgent===Q&&this.setPendingUpdate(8):(se(a.loadingAgent),a.loadingAgent=Q)),a.loadingAgent===Q&&this.updateRenderData(t,0),!l.destroyed&&!this._hasBlendModes(e,i.length,t)&&o&&l.isOpaque&&(n||=!0))}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,s=Math.max(this.level-e,this.elevationLevelDelta-i),n=t(1+(this._maxTesselation>>s),2,this._maxTesselation+1),r=this.minimumVerticesPerSide;return Math.max(n,r)}_findLIJ(e,t){if(!e)return null;const{rootTiles:i}=this.surface;if(null!=i)for(const s of i)if(le(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.leaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this._getNeighborLIJ(i,e);return s?oe(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=1===e?1:7===e?0:5===e?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(q(e),t)||null}forAllSubtreeOnSide(e,t){const i=0===e?[0,1]:1===e?[1]:2===e?[1,3]:3===e?[3]:4===e?[2,3]:5===e?[2]:6===e?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach(e=>s(n[e]))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(O(!V||i>=0),0===i)return 0;const s=2**i,n=!(1&~e),r=n?0:1,a=t.lij[r+1]*s,l=this._lij[r+1],o=l-a,h=n?s-1-o:o;return V&&(O(a<=l&&l<a+s),O(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.loaded;N.forEach(t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(G(t),i=>!!i.loaded&&(e(i,t),!0))}),k.forEach(t=>{const s=this.findNeighborTile(t,i)?.findCorner(q(t),e=>e.loaded);O(!s||he(this,s,t)),s?.loaded&&e(s,t)})}_getNeighborLIJ(e,t){const i=W(t)?-1:J(t)?1:0,s=$(t)?-1:H(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this._wrapLIJ(n):n[2]<0?null:n}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(null==e)return!1;if(0===this.level&&0===e.level){if(this._eastEnd&&e._westEnd&&2===t)return!0;if(this._westEnd&&e._eastEnd&&6===t)return!0}const i=Math.max(1e-6*(this.extent[2]-this.extent[0]),1);switch(t){case 0:return F(this.extent[3],e.extent[1],i);case 4:return F(this.extent[1],e.extent[3],i);case 2:return F(this.extent[2],e.extent[0],i)||F(this.extent[2],-e.extent[0],i);case 6:return F(this.extent[0],e.extent[2],i)||F(this.extent[0],-e.extent[2],i)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return 0===this._lij[2]}checkGeometryWaterproofness(){z&&(O(this.loaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,{rootTilesExtent:i}=this._surface,s=.25*(t[2]-t[0]);if(W(e)&&t[3]+s>=i[3])return!1;if(J(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&$(e)&&t[0]-s<=i[0])&&!(!n&&H(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;u(this._lastPOI,e);const i=this._center[1].center,s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}updateOverlayParameters(e){const{renderData:t}=this;if(!t)return;const{overlays:i,longitudeCyclical:s}=e,n=t.overlay;if(0===i.length)this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n);else{const[e,t]=i,r=this.extent;_(e.extent,r,s)||m(r,e.extent,s)||m(r,t.extent,s)?(this._setOverlayData(i,s,r,0,n),this._setOverlayData(i,s,r,1,n)):(this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n))}}_setOverlayData(e,t,i,s,n){const r=e[s].extent,a=y(r),l=v(r);let o=i[0];if(t){o=t.minimalMonotonic(r[0],o);const e=t.minimalMonotonic(r[0],i[2]);o>e&&(o=e-(i[2]-i[0]))}if(0===a||0===l)return void n.setOffsetAndScale(s,0,0,1,1);const h=y(i)/a,u=v(i)/l,d=(o-r[0])/a,c=(i[1]-r[1])/l;n.setOffsetAndScale(s,d,c,h,u)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function ie(e,t,i,s){const n=0===i?re.acquire():ne.acquire();return n.init(e,t,i,s),n}function se(e){e.dispose(),L(e)?re.release(e):I(e)&&ne.release(e)}const ne=new s(()=>new T),re=new s(()=>new b),ae=new D;function le(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function oe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function he(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?ue(e,t,i):ue(t,e,q(i)))}function ue(e,t,i){O(e.level>=t.level);const s=X(i),n=Y(i),r=e.extent,a=t.extent,l=[s?r[0]:r[2],n?r[3]:r[1]],o=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),u=F(l[0],o[0],h)||e.surface.isGlobal&&F(l[0],-o[0],h),d=F(l[1],o[1],h);if(u&&d)return!0;if(e.level===t.level)return O(!1),!1;if(!u&&!d)return O(!1),!1;const c=u?de(a[1],a[3],r[1],r[3],h):de(a[0],a[2],r[0],r[2],h);return O(c),c}function de(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}const ce=d(),ge=d(),pe=d(),fe=d();export{te as Tile,he as isCornerNeighbor,oe as lijEquals};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{removeUnordered as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{sort as t}from"../../../../core/heapSort.js";import{isPromiseLike as r,createAbortError as s}from"../../../../core/promiseUtils.js";import{signal as n}from"../../../../core/signal.js";import{getEmissions as o}from"./emissive/emissions.js";import{DepthRange as i}from"../lib/DepthRange.js";class h{constructor(e){this.context=e,this._renderPlugins=new Array,this._slots=new Array,this._version=n(0);for(let t=0;t<20;++t)this._slots[t]=[]}destroy(){this._renderPlugins.forEach(e=>e.destroy()),this._renderPlugins.length=0}get plugins(){return this._renderPlugins}add(e,t){const n=()=>{if(t?.aborted)throw e.uninitializeRenderContext(),s();this._renderPlugins.push(e),e.produces.forEach((t,r)=>this._slots[r].push(e)),this.context.requestRender(),this._version.value++},o=e.initializeRenderContext(this.context,t);if(r(o))return o.then(n);n()}remove(t){e(this._renderPlugins,t),t.uninitializeRenderContext();for(let e=0;e<this._slots.length;++e)this._slots[e]=this._slots[e].filter(e=>e!==t);this.context.requestRender(),this._version.value++}sortTestsTransparentOrderedSlots(e){if("test"!==process.env.NODE_ENV)return;if(this._renderPlugins.some(e=>0!==e.testsTransparentRenderOrder))for(const r of e){const e=this._slots[r];t(e,0,e.length,(e,t)=>(e.testsTransparentRenderOrder??0)-(t.testsTransparentRenderOrder??0))}}prepareRender(){this._renderPlugins.forEach(e=>e.prepareRender?.(this.context.renderContext))}updateAnimation(e){let t=!1;return this._renderPlugins.forEach(r=>t=r.updateAnimation?.(e)||t),t}precompile(...e){++this.context.techniques.precompiling;const t=this.context.renderContext.bind.slot;for(const r of e)this.context.renderContext.bind.slot=r,this._forEachRender(()=>{});this.context.renderContext.bind.slot=t,--this.context.techniques.precompiling}render(...e){for(const t of e)this.context.renderContext.bind.slot=t,this._forEachRender((e,t)=>e.render(this.context.renderContext,t))}_forEachRender(e){const t=this.context.renderContext.bind.slot,r=this.context.renderContext.output;this._slots[t].forEach(s=>{const n=s.produces.get(t);if(!n?.(r)||s.isDecoration&&!this.context.renderContext.bind.decorations)return;const o=s.acquireTechniques(this.context.renderContext);o&&e(s,o)})}queryDepthRange(e){return this._renderPlugins.reduce((t,r)=>t.union(r.queryDepthRange?.(e)),new i)}get updating(){return this._version.value>=0&&this._renderPlugins.some(e=>e.readyToRun)}produces(e,...t){return t.some(t=>this._slots[t].some(r=>{const s=r.produces.get(t);return!!s&&s(e)}))}hasHighlight(e){return d.some(t=>this._slots[t].some(t=>t.hasHighlight(e)))}get hasDecorations(){return this._renderPlugins.some(e=>e.isDecoration)}get hasOccludees(){return this._renderPlugins.some(e=>e.hasOccludees)}get emissions(){return o(this._renderPlugins)}get renderOccludedFlags(){return this._renderPlugins.reduce((e,t)=>e|(t.renderOccludedFlags??0),0)}get usedMemory(){return this._renderPlugins.reduce((e,t)=>t.material?e:e+(t.usedMemory??0),0)}get test(){}}const d=[2,4,18,12,13,14];export{h as RenderPluginManager};
2
+ import{removeUnordered as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{isPromiseLike as t,createAbortError as r}from"../../../../core/promiseUtils.js";import{signal as s}from"../../../../core/signal.js";import{getEmissions as n}from"./emissive/emissions.js";import{DepthRange as i}from"../lib/DepthRange.js";class o{constructor(e){this.context=e,this._renderPlugins=new Array,this._slots=new Array,this._version=s(0);for(let t=0;t<20;++t)this._slots[t]=[]}destroy(){this._renderPlugins.forEach(e=>e.destroy()),this._renderPlugins.length=0}get plugins(){return this._renderPlugins}add(e,s){const n=()=>{if(s?.aborted)throw e.uninitializeRenderContext(),r();this._renderPlugins.push(e),e.produces.forEach((t,r)=>this._slots[r].push(e)),this.context.requestRender(),this._version.value++},i=e.initializeRenderContext(this.context,s);if(t(i))return i.then(n);n()}remove(t){e(this._renderPlugins,t),t.uninitializeRenderContext();for(let e=0;e<this._slots.length;++e)this._slots[e]=this._slots[e].filter(e=>e!==t);this.context.requestRender(),this._version.value++}sortTestsTransparentOrderedSlots(e){if("test"!==process.env.NODE_ENV)return;if(this._renderPlugins.some(e=>0!==e.testsTransparentRenderOrder))for(const t of e){this._slots[t].sort((e,t)=>(e.testsTransparentRenderOrder??0)-(t.testsTransparentRenderOrder??0))}}prepareRender(){this._renderPlugins.forEach(e=>e.prepareRender?.(this.context.renderContext))}updateAnimation(e){let t=!1;return this._renderPlugins.forEach(r=>t=r.updateAnimation?.(e)||t),t}precompile(...e){++this.context.techniques.precompiling;const t=this.context.renderContext.bind.slot;for(const r of e)this.context.renderContext.bind.slot=r,this._forEachRender(()=>{});this.context.renderContext.bind.slot=t,--this.context.techniques.precompiling}render(...e){for(const t of e)this.context.renderContext.bind.slot=t,this._forEachRender((e,t)=>e.render(this.context.renderContext,t))}_forEachRender(e){const t=this.context.renderContext.bind.slot,r=this.context.renderContext.output;this._slots[t].forEach(s=>{const n=s.produces.get(t);if(!n?.(r)||s.isDecoration&&!this.context.renderContext.bind.decorations)return;const i=s.acquireTechniques(this.context.renderContext);i&&e(s,i)})}queryDepthRange(e){return this._renderPlugins.reduce((t,r)=>t.union(r.queryDepthRange?.(e)),new i)}get updating(){return this._version.value>=0&&this._renderPlugins.some(e=>e.readyToRun)}produces(e,...t){return t.some(t=>this._slots[t].some(r=>{const s=r.produces.get(t);return!!s&&s(e)}))}hasHighlight(e){return d.some(t=>this._slots[t].some(t=>t.hasHighlight(e)))}get hasDecorations(){return this._renderPlugins.some(e=>e.isDecoration)}get hasOccludees(){return this._renderPlugins.some(e=>e.hasOccludees)}get emissions(){return n(this._renderPlugins)}get renderOccludedFlags(){return this._renderPlugins.reduce((e,t)=>e|(t.renderOccludedFlags??0),0)}get usedMemory(){return this._renderPlugins.reduce((e,t)=>t.material?e:e+(t.usedMemory??0),0)}get test(){}}const d=[2,4,18,12,13,14];export{o as RenderPluginManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t,difference as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{deprecatedProperty as n,deprecatedFunction as r}from"../core/deprecate.js";import{EventedAccessor as a}from"../core/Evented.js";import{makeHandle as l}from"../core/handleUtils.js";import c from"../core/Logger.js";import{getOrCreateMapValue as h}from"../core/MapUtils.js";import{destroyMaybe as d}from"../core/maybe.js";import p from"../core/ReactiveMap.js";import{watch as u,initial as g,on as f}from"../core/reactiveUtils.js";import{addMany as m,symmetricDifference as y}from"../core/SetUtils.js";import{property as _,subclass as w}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as v}from"../core/support/UpdatingHandles.js";import{getGraphicLayer as S}from"../graphic/graphicOriginUtils.js";import{isSubtypeSublayer as M,isSubtypeGroupLayer as E,isKnowledgeGraphLayer as b,isMapImageLayer as j}from"../layers/support/layerUtils.js";import H from"../rest/support/Query.js";import{isGraphic as L}from"../support/graphicInstanceUtils.js";import{isSelectableLayerWithObjectIds as V,isSelectableLayerViewWithObjectIds as U,isSelectableLayer as C,isSelectableLayerView as I,isTableLayer as F,isSelectableLayerViewWithHighlights as z,isSelectableLayerWithGraphics as O,isSelectableLayerBaseWithEditing as T}from"./support/selectionUtils.js";let A=class extends a{constructor(e){super(e),this._layerEditHandles=new i,this._selectionMap=new p,this._sources=new i,this._trashCan=[],this._updatingHandles=new v,this._vizTaskId=0,this.highlightEnabled=!0,this.highlightName="default",this.layerViewMap=new WeakMap,this.view=null}initialize(){this.addHandles([u(()=>[this.view,this.highlightEnabled],()=>{this._refreshVisualization()}),u(()=>this.view,e=>{e?.when().then(()=>this.syncSources()).catch(()=>{})},g),f(()=>this.sources,"change",e=>{const t=this._selectionMap,s=[];for(const i of e.removed){const e=t.get(i);e&&(t.delete(i),e.highlightHandle?.remove(),s.push({layer:i,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),s.length&&this._onSelectionChange(s)},{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.destroyAll(),this._updatingHandles.destroy(),d(this._layerEditHandles),d(this._sources)}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get selections(){return Array.from(this._selectionMap.entries()).map(e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}})}get showHighlight(){return this.highlightEnabled}set showHighlight(e){n(c.getLogger(this),"showHighlight",{replacement:"highlightEnabled"}),this.highlightEnabled=e}get sources(){return this._sources}set sources(e){o(e,this._sources)}get updating(){return this._updatingHandles.updating}add(e,t){const s=new Set;m(s,this._selectionMap.get(e)?.selection);for(const i of t)s.add(N(e,i));this._setSelection(e,Array.from(s))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}getSelection(e){return this._selectionMap.get(e)?.selection}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{b(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):j(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):E(t)?t.sublayers?.forEach(s):C(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,s={},i="layerView"){const{view:o,selections:n}=this;if(!o&&"layerView"===i)return c.getLogger(this).warn("Cannot query layer views without a view."),[];const r=n.map(async t=>{const{layer:n,selection:r}=t;if(r.length&&V(n)&&(!e||e.includes(n))){if(o&&"layerView"===i&&!n.isTable){const e=await this._findLayerView(n);if(U(e))return P(e,r,s)}return P(n,r,s)}}).filter(t);return(await Promise.all(r)).filter(t)}updateSelection(e){const t=new Map;for(const[s,n]of this._selectionMap)t.set(s,new Set(n.selection));let i=!1;const o=e.current.concat(e.added);for(const s of o){const e=S(s);if(C(e)&&this.sources.includes(e)){const o=h(t,e,()=>new Set),n=N(e,s);null!=n&&(o.add(n),i=!0)}}for(const s of e.removed){const e=S(s);if(C(e)&&this.sources.includes(e)){const o=t.get(e),n=N(e,s);n&&o&&(o.delete(n),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,r]of t){const t=e.get(n),a=Array.from(r);void 0!==t&&i.push(t),e.set(n,{selection:a}),o.push({layer:n,selection:a,...s(void 0!==t?t.selection:[],a)})}this._onSelectionChange(o)}}setSelection(e,t){r(c.getLogger(this),"SelectionManager.setSelection is deprecated. Use SelectionManager.replace instead.",{replacement:"SelectionManager.replace",warnOnce:!0}),this.replace(e,t)}appendToSelection(e,t){r(c.getLogger(this),"SelectionManager.appendToSelection is deprecated. Use SelectionManager.add instead.",{replacement:"SelectionManager.add",warnOnce:!0}),this.add(e,t)}remove(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[],o=new Set(t.map(t=>N(e,t)));for(const n of s.selection)o.has(n)||i.push(n);this._setSelection(e,i)}replace(e,t){this._setSelection(e,t.map(t=>N(e,t)))}removeFromSelection(e,t){r(c.getLogger(this),"SelectionManager.removeFromSelection is deprecated. Use SelectionManager.remove instead.",{replacement:"SelectionManager.remove",warnOnce:!0}),this.remove(e,t)}toggle(e,t){const s=this._selectionMap.get(e),i=t.map(t=>N(e,t));if(!s||0===s.selection.length)return void this._setSelection(e,i);const o=new Set(s.selection),n=new Set(i),r=y(o,n);this._setSelection(e,Array.from(r))}toggleInSelection(e,t){r(c.getLogger(this),"SelectionManager.toggleInSelection is deprecated. Use SelectionManager.toggle instead.",{replacement:"SelectionManager.toggle",warnOnce:!0}),this.toggle(e,t)}async _findLayerView(e){const t=this.layerViewMap.get(e);if(t||!this.view)return t;const s=M(e)&&e.parent?e.parent:e,i=await this.view.whenLayerView(s).catch(()=>{});return I(i)?(this.layerViewMap.set(e,i),i.addHandles(l(()=>this.layerViewMap.delete(e))),i):void 0}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}async _refreshVisualization(){await this._updatingHandles.addPromise(this._updateVisualization())}async _updateVisualization(){for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{_selectionMap:e,highlightName:t,sources:s}=this,i=this.view&&this.highlightEnabled,o=this._vizTaskId;for(const n of s){const s=e.get(n);if(s?.highlightHandle?.remove(),i&&s?.selection.length&&!F(n)){const e=await this._findLayerView(n);if(z(e)&&o===this._vizTaskId){const i=s.selection;s.highlightHandle=e.highlight(i,{name:t})}}}}_refreshListeners(){this._layerEditHandles.destroyAll();const e=new Set(this.sources.map(e=>M(e)?e.parent:e));for(const t of e)C(t)&&(O(t)?this._layerEditHandles.push(t.graphics.on("change",e=>this._onGraphicsLayerEdit(t,e))):T(t)&&this._layerEditHandles.push(t.on("edits",e=>this._onLayerEdit(t,e))))}_onLayerEdit(e,t){if(E(e))this._onParentLayerEdit(e,t);else if(t.deletedFeatures.length&&this._selectionMap.has(e)){const s=[];t.deletedFeatures.forEach(({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)}),this.remove(e,s)}}_onGraphicsLayerEdit(e,t){const{removed:s}=t;s.length&&this._selectionMap.has(e)&&this.remove(e,s)}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:i,updatedFeatures:o}=t;if(i?.updateFeatures?.forEach(t=>{const s=t.getObjectId()??t.attributes[e.objectIdField];if(null==s)return;if(o.find(e=>e.objectId===s)?.error)return;const i=e.findSublayerForFeature(t);if(!C(i))return;const n=e.sublayers.find(e=>!(!C(e)||!this.getSelection(e)?.includes(s)));C(n)&&n!==i&&(this.remove(n,[s]),this.add(i,[s]))}),s.length){const t=[];s.forEach(({error:e,objectId:s})=>{null!=s&&null==e&&t.push(s)}),e.sublayers.forEach(e=>{C(e)&&this._selectionMap.has(e)&&this.remove(e,t)})}}_setSelection(e,t){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(!i||!k(i,{selection:t})){i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...t]});const o=i?s(i.selection,t):{};this._onSelectionChange([{layer:e,selection:[...t],...o}])}}};e([_()],A.prototype,"_layerEditHandles",void 0),e([_()],A.prototype,"_selectionMap",void 0),e([_()],A.prototype,"_sources",void 0),e([_()],A.prototype,"_updatingHandles",void 0),e([_({readOnly:!0,nonNullable:!0})],A.prototype,"count",null),e([_({readOnly:!0,nonNullable:!0})],A.prototype,"hasSelection",null),e([_()],A.prototype,"highlightEnabled",void 0),e([_()],A.prototype,"highlightName",void 0),e([_()],A.prototype,"layerViewMap",void 0),e([_({readOnly:!0,nonNullable:!0})],A.prototype,"selections",null),e([_()],A.prototype,"showHighlight",null),e([_()],A.prototype,"sources",null),e([_()],A.prototype,"updating",null),e([_()],A.prototype,"view",void 0),A=e([w("esri.views.SelectionManager")],A);const N=(e,t)=>{if(V(e)&&L(t)){const e=t.getObjectId();if(null!=e)return e}return t},k=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},P=async(e,t,s={})=>e.queryFeatures(new H({...s,objectIds:t})).then(t=>({data:t,layer:I(e)?e.layer:e})),q=A;export{q as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t,difference as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{deprecatedProperty as n,deprecatedFunction as r}from"../core/deprecate.js";import{EventedAccessor as a}from"../core/Evented.js";import{makeHandle as l}from"../core/handleUtils.js";import c from"../core/Logger.js";import{getOrCreateMapValue as h}from"../core/MapUtils.js";import{destroyMaybe as d}from"../core/maybe.js";import p from"../core/ReactiveMap.js";import{watch as u,initial as g,on as f}from"../core/reactiveUtils.js";import{addMany as m,symmetricDifference as y}from"../core/SetUtils.js";import{property as _,subclass as w}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as v}from"../core/support/UpdatingHandles.js";import{getGraphicLayer as S}from"../graphic/graphicOriginUtils.js";import{isSubtypeSublayer as M,isSubtypeGroupLayer as E,isKnowledgeGraphLayer as b,isMapImageLayer as j}from"../layers/support/layerUtils.js";import H from"../rest/support/Query.js";import{isGraphic as L}from"../support/graphicInstanceUtils.js";import{isSelectableLayerWithObjectIds as V,isSelectableLayerViewWithObjectIds as U,isSelectableLayer as C,isSelectableLayerView as I,isTableLayer as F,isSelectableLayerViewWithHighlights as z,isSelectableLayerWithGraphics as O,isSelectableLayerBaseWithEditing as T}from"./support/selectionUtils.js";let A=class extends a{constructor(e){super(e),this._layerEditHandles=new i,this._selectionMap=new p,this._sources=new i,this._trashCan=[],this._updatingHandles=new v,this._vizTaskId=0,this.highlightEnabled=!0,this.highlightName="default",this.layerViewMap=new WeakMap,this.view=null}initialize(){this.addHandles([u(()=>[this.view,this.highlightEnabled],()=>{this._refreshVisualization()}),u(()=>this.view,e=>{e?.when().then(()=>this.syncSources()).catch(()=>{})},g),f(()=>this.sources,"change",e=>{const t=this._selectionMap,s=[];for(const i of e.removed){const e=t.get(i);e&&(t.delete(i),e.highlightHandle?.remove(),s.push({layer:i,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),s.length&&this._onSelectionChange(s)},{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.destroyAll(),this._updatingHandles.destroy(),d(this._layerEditHandles),d(this._sources)}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get selections(){return Array.from(this._selectionMap.entries()).map(e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}})}get showHighlight(){return this.highlightEnabled}set showHighlight(e){n(c.getLogger(this),"showHighlight",{replacement:"highlightEnabled"}),this.highlightEnabled=e}get sources(){return this._sources}set sources(e){o(e,this._sources)}get updating(){return this._updatingHandles.updating}add(e,t){const s=new Set;m(s,this._selectionMap.get(e)?.selection);for(const i of t)s.add(N(e,i));this._setSelection(e,Array.from(s))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}getSelection(e){return this._selectionMap.get(e)?.selection}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{b(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):j(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):E(t)?t.sublayers?.forEach(s):C(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,s={},i="layerView"){const{view:o,selections:n}=this;if(!o&&"layerView"===i)return c.getLogger(this).warn("Cannot query layer views without a view."),[];const r=n.map(async t=>{const{layer:n,selection:r}=t;if(r.length&&V(n)&&(!e||e.includes(n))){if(o&&"layerView"===i&&!n.isTable){const e=await this._findLayerView(n);if(U(e))return P(e,r,s)}return P(n,r,s)}}).filter(t);return(await Promise.all(r)).filter(t)}updateSelection(e){const t=new Map;for(const[s,n]of this._selectionMap)t.set(s,new Set(n.selection));let i=!1;const o=e.current.concat(e.added);for(const s of o){const e=S(s);if(C(e)&&this.sources.includes(e)){const o=h(t,e,()=>new Set),n=N(e,s);null!=n&&(o.add(n),i=!0)}}for(const s of e.removed){const e=S(s);if(C(e)&&this.sources.includes(e)){const o=t.get(e),n=N(e,s);n&&o&&(o.delete(n),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,r]of t){const t=e.get(n),a=Array.from(r);void 0!==t&&i.push(t),e.set(n,{selection:a}),o.push({layer:n,selection:a,...s(void 0!==t?t.selection:[],a)})}this._onSelectionChange(o)}}setSelection(e,t){r(c.getLogger(this),"SelectionManager.setSelection is deprecated. Use SelectionManager.replace instead.",{replacement:"SelectionManager.replace",warnOnce:!0}),this.replace(e,t)}appendToSelection(e,t){r(c.getLogger(this),"SelectionManager.appendToSelection is deprecated. Use SelectionManager.add instead.",{replacement:"SelectionManager.add",warnOnce:!0}),this.add(e,t)}remove(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[],o=new Set(t.map(t=>N(e,t)));for(const n of s.selection)o.has(n)||i.push(n);this._setSelection(e,i)}replace(e,t){this._setSelection(e,t.map(t=>N(e,t)))}removeFromSelection(e,t){r(c.getLogger(this),"SelectionManager.removeFromSelection is deprecated. Use SelectionManager.remove instead.",{replacement:"SelectionManager.remove",warnOnce:!0}),this.remove(e,t)}toggle(e,t){const s=this._selectionMap.get(e),i=t.map(t=>N(e,t));if(!s||0===s.selection.length)return void this._setSelection(e,i);const o=new Set(s.selection),n=new Set(i),r=y(o,n);this._setSelection(e,Array.from(r))}toggleInSelection(e,t){r(c.getLogger(this),"SelectionManager.toggleInSelection is deprecated. Use SelectionManager.toggle instead.",{replacement:"SelectionManager.toggle",warnOnce:!0}),this.toggle(e,t)}async _findLayerView(e){const t=this.layerViewMap.get(e);if(t||!this.view)return t;const s=M(e)&&e.parent?e.parent:e,i=await this.view.whenLayerView(s).catch(()=>{});return I(i)?(this.layerViewMap.set(e,i),i.addHandles(l(()=>this.layerViewMap.delete(e))),i):void 0}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}async _refreshVisualization(){await this._updatingHandles.addPromise(this._updateVisualization())}async _updateVisualization(){for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{_selectionMap:e,highlightName:t,sources:s,view:i}=this,o=i&&this.highlightEnabled,n=this._vizTaskId;for(const r of s){const s=e.get(r);if(s?.highlightHandle?.remove(),o&&s?.selection.length&&!F(r,i)){const e=await this._findLayerView(r);if(z(e)&&n===this._vizTaskId){const i=s.selection;s.highlightHandle=e.highlight(i,{name:t})}}}}_refreshListeners(){this._layerEditHandles.destroyAll();const e=new Set(this.sources.map(e=>M(e)?e.parent:e));for(const t of e)C(t)&&(O(t)?this._layerEditHandles.push(t.graphics.on("change",e=>this._onGraphicsLayerEdit(t,e))):T(t)&&this._layerEditHandles.push(t.on("edits",e=>this._onLayerEdit(t,e))))}_onLayerEdit(e,t){if(E(e))this._onParentLayerEdit(e,t);else if(t.deletedFeatures.length&&this._selectionMap.has(e)){const s=[];t.deletedFeatures.forEach(({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)}),this.remove(e,s)}}_onGraphicsLayerEdit(e,t){const{removed:s}=t;s.length&&this._selectionMap.has(e)&&this.remove(e,s)}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:i,updatedFeatures:o}=t;if(i?.updateFeatures?.forEach(t=>{const s=t.getObjectId()??t.attributes[e.objectIdField];if(null==s)return;if(o.find(e=>e.objectId===s)?.error)return;const i=e.findSublayerForFeature(t);if(!C(i))return;const n=e.sublayers.find(e=>!(!C(e)||!this.getSelection(e)?.includes(s)));C(n)&&n!==i&&(this.remove(n,[s]),this.add(i,[s]))}),s.length){const t=[];s.forEach(({error:e,objectId:s})=>{null!=s&&null==e&&t.push(s)}),e.sublayers.forEach(e=>{C(e)&&this._selectionMap.has(e)&&this.remove(e,t)})}}_setSelection(e,t){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(!i||!k(i,{selection:t})){i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...t]});const o=i?s(i.selection,t):{};this._onSelectionChange([{layer:e,selection:[...t],...o}])}}};e([_()],A.prototype,"_layerEditHandles",void 0),e([_()],A.prototype,"_selectionMap",void 0),e([_()],A.prototype,"_sources",void 0),e([_()],A.prototype,"_updatingHandles",void 0),e([_({readOnly:!0,nonNullable:!0})],A.prototype,"count",null),e([_({readOnly:!0,nonNullable:!0})],A.prototype,"hasSelection",null),e([_()],A.prototype,"highlightEnabled",void 0),e([_()],A.prototype,"highlightName",void 0),e([_()],A.prototype,"layerViewMap",void 0),e([_({readOnly:!0,nonNullable:!0})],A.prototype,"selections",null),e([_()],A.prototype,"showHighlight",null),e([_()],A.prototype,"sources",null),e([_()],A.prototype,"updating",null),e([_()],A.prototype,"view",void 0),A=e([w("esri.views.SelectionManager")],A);const N=(e,t)=>{if(V(e)&&L(t)){const e=t.getObjectId();if(null!=e)return e}return t},k=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},P=async(e,t,s={})=>e.queryFeatures(new H({...s,objectIds:t})).then(t=>({data:t,layer:I(e)?e.layer:e})),q=A;export{q as default};