@arcgis/core 4.23.0-next.20220126 → 4.23.0-next.20220127

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 (247) hide show
  1. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/02fbc76dfdc20e628c61.js +1 -0
  4. package/assets/esri/core/workers/chunks/0317f37b6c8705b363fd.js +1 -0
  5. package/assets/esri/core/workers/chunks/0453fad5cb819797b4f6.js +1 -0
  6. package/assets/esri/core/workers/chunks/{97ec9eef0048760fa260.js → 0d02c6ad1f4688bfa374.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0d684f16f37d5dc385dd.js +1 -0
  8. package/assets/esri/core/workers/chunks/0e17691520d890d34efb.js +1 -0
  9. package/assets/esri/core/workers/chunks/12c0cabb6c59e65d8546.js +1 -0
  10. package/assets/esri/core/workers/chunks/16b6d0f8378582c051c3.js +1 -0
  11. package/assets/esri/core/workers/chunks/{b313ab14a643273e7d09.js → 1877ab1b6a115dbba1c5.js} +1 -1
  12. package/assets/esri/core/workers/chunks/1b2a961f776a0b57e57a.js +1 -0
  13. package/assets/esri/core/workers/chunks/1b3fd66577b19aa5f2b6.js +1 -0
  14. package/assets/esri/core/workers/chunks/1f8c6a179e39fd4c5e6f.js +1 -0
  15. package/assets/esri/core/workers/chunks/2076fcbae63f1bfb7143.js +1 -0
  16. package/assets/esri/core/workers/chunks/281b89dbf5574fc642ae.js +1 -0
  17. package/assets/esri/core/workers/chunks/2c8fe9bc988c3c5760a5.js +1 -0
  18. package/assets/esri/core/workers/chunks/322d917e8cb398816a93.js +1 -0
  19. package/assets/esri/core/workers/chunks/34b59d7099904dcb28b5.js +1 -0
  20. package/assets/esri/core/workers/chunks/{e6165e17fbb07bfc40a1.js → 391e96192d1ec4e55ce2.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{23b15e7c2f96d260e16c.js → 392b6382e06652dd4c80.js} +1 -1
  22. package/assets/esri/core/workers/chunks/3aa73119b055e05bbbeb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{c959e0d1cf7dce0421b9.js → 48fa8aed6c24877b44c4.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{438f0b5ae5c53ae4f06a.js → 4954fd86b48cc68b737c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/4ba6de8aa7e2960bad49.js +1 -0
  26. package/assets/esri/core/workers/chunks/52ea678ba1da0e349919.js +1 -0
  27. package/assets/esri/core/workers/chunks/56274b37ff74ca0d68a6.js +1 -0
  28. package/assets/esri/core/workers/chunks/{b9c177524b3e7de1ffd1.js → 5790d171072b3c7d108f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{5dfe1f8d520025e2118b.js → 57b349d1dbc0bed75b79.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{b2ebe4f6d100e15b512d.js → 5948923e07bd1662c24a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{97a28641b3b2fd31bea2.js → 5bcb3240b3c005e5fe72.js} +1 -1
  32. package/assets/esri/core/workers/chunks/5dbe555a5a662ff3d9ce.js +1 -0
  33. package/assets/esri/core/workers/chunks/5ec98f4ddac707d0fbd1.js +1 -0
  34. package/assets/esri/core/workers/chunks/5ee497d5d7b0e580526a.js +1 -0
  35. package/assets/esri/core/workers/chunks/5f1dcb6556820cd0aa31.js +1 -0
  36. package/assets/esri/core/workers/chunks/64b7e8d812ea8fcf269e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{b0b036ad3ad3cd956747.js → 69fd99b7c76e9992ccf3.js} +1 -1
  38. package/assets/esri/core/workers/chunks/6e6a3c5866e8d8820457.js +1 -0
  39. package/assets/esri/core/workers/chunks/75d812955a473d0e8960.js +1 -0
  40. package/assets/esri/core/workers/chunks/{cc146c57bbdac8029fd8.js → 7a5f5acfbd4ca1a5c1f3.js} +1 -1
  41. package/assets/esri/core/workers/chunks/8001b0e514bfffe9d7f8.js +1 -0
  42. package/assets/esri/core/workers/chunks/83b8fec1650e061aaa56.js +1 -0
  43. package/assets/esri/core/workers/chunks/83d00afae4406ec78bc9.js +1 -0
  44. package/assets/esri/core/workers/chunks/842db82733635dbf25cb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{434b16731c6a81f868ef.js → 85b1f36790df95b17659.js} +1 -1
  46. package/assets/esri/core/workers/chunks/89820b200ee44e678af5.js +1 -0
  47. package/assets/esri/core/workers/chunks/{94b8dbf859df71858d1c.js → 929c9b7cdab7c4ca3d87.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{010a71c2aa1b7681e191.js → 9d11f84e6c893b9d0019.js} +1 -1
  49. package/assets/esri/core/workers/chunks/a1930e4f035bc9aa1ae5.js +1 -0
  50. package/assets/esri/core/workers/chunks/a8692bffb76444c34760.js +1 -0
  51. package/assets/esri/core/workers/chunks/{f760a3e030b0f358a92a.js → aeaa1667c2d9f1b3366b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{a8b13fb804bb775e4967.js → b62e3dccd9f662c0afeb.js} +1 -1
  53. package/assets/esri/core/workers/chunks/b97953694f42bfec1b3c.js +1 -0
  54. package/assets/esri/core/workers/chunks/b9e9cb354822c6d995a4.js +1 -0
  55. package/assets/esri/core/workers/chunks/ba762bcfd74af0bb8218.js +1 -0
  56. package/assets/esri/core/workers/chunks/{e4b84ca8ddfd48dd79b1.js → bac9fc90e6756e211160.js} +1 -1
  57. package/assets/esri/core/workers/chunks/bf97a933ea3b220115e1.js +1 -0
  58. package/assets/esri/core/workers/chunks/bfedd6ebff817c9b31c0.js +1 -0
  59. package/assets/esri/core/workers/chunks/c093dff4592832ac0973.js +1 -0
  60. package/assets/esri/core/workers/chunks/c1135cb02ec46c491459.js +1 -0
  61. package/assets/esri/core/workers/chunks/{e4e2036373166c1d5cf5.js → c2253a9f29c1aabb2b75.js} +1 -1
  62. package/assets/esri/core/workers/chunks/c9cbf8135e95f0f42cd9.js +1 -0
  63. package/assets/esri/core/workers/chunks/d04fca5d46cca02500b7.js +1 -0
  64. package/assets/esri/core/workers/chunks/d07440469fe7d181c4fd.js +1 -0
  65. package/assets/esri/core/workers/chunks/d08efbc349dd9f999497.js +1 -0
  66. package/assets/esri/core/workers/chunks/d835b2a683fcd8aeeed8.js +1 -0
  67. package/assets/esri/core/workers/chunks/dbf192b4ce7e608610f6.js +1 -0
  68. package/assets/esri/core/workers/chunks/dd13772a5e2eccc6a2bc.js +1 -0
  69. package/assets/esri/core/workers/chunks/dedc333a61081772ca7b.js +1 -0
  70. package/assets/esri/core/workers/chunks/{22b09e276c9b9f22f0f8.js → dee9929d95e9fe26929c.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{6f50a9647f026a8d4729.js → e0c8d61c7a85ce15499a.js} +1 -1
  72. package/assets/esri/core/workers/chunks/e12d91ef44d6f879a02a.js +1 -0
  73. package/assets/esri/core/workers/chunks/{0ce1dc14280d6f188468.js → e4896cf85fb2da8a9cc7.js} +1 -1
  74. package/assets/esri/core/workers/chunks/e657ba0cab29f05d02da.js +1 -0
  75. package/assets/esri/core/workers/chunks/e8741bf421f80213f1d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/e8e775758b79c5a084c8.js +1 -0
  77. package/assets/esri/core/workers/chunks/e93dfdede0532a89ffa5.js +1 -0
  78. package/assets/esri/core/workers/chunks/ea595b0df5050eda2a13.js +1 -0
  79. package/assets/esri/core/workers/chunks/{1305ef8717da6e902a55.js → ec10151a2a95e95a0bb5.js} +1 -1
  80. package/assets/esri/core/workers/chunks/eccba071ced2d922bb85.js +1 -0
  81. package/assets/esri/core/workers/chunks/f2124f4d0f2b8a91f0ea.js +1 -0
  82. package/assets/esri/core/workers/chunks/f9ff3eaf4eb324429fbd.js +1 -0
  83. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  84. package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
  85. package/assets/esri/themes/dark/main.css +1 -1
  86. package/assets/esri/themes/dark-blue/main.css +1 -1
  87. package/assets/esri/themes/dark-green/main.css +1 -1
  88. package/assets/esri/themes/dark-purple/main.css +1 -1
  89. package/assets/esri/themes/dark-red/main.css +1 -1
  90. package/assets/esri/themes/light/main.css +1 -1
  91. package/assets/esri/themes/light/view.css +1 -1
  92. package/assets/esri/themes/light-blue/main.css +1 -1
  93. package/assets/esri/themes/light-green/main.css +1 -1
  94. package/assets/esri/themes/light-purple/main.css +1 -1
  95. package/assets/esri/themes/light-red/main.css +1 -1
  96. package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
  97. package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
  98. package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
  99. package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
  100. package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
  101. package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
  102. package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
  103. package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
  104. package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
  105. package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
  106. package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
  109. package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
  110. package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
  111. package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
  112. package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
  113. package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
  114. package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
  115. package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
  116. package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
  117. package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
  118. package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
  119. package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
  120. package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
  121. package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
  122. package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
  123. package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
  124. package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
  125. package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
  126. package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
  127. package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
  128. package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
  129. package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
  130. package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
  131. package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
  132. package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
  133. package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
  134. package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
  135. package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
  136. package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
  137. package/chunks/Precipitation.glsl.js +91 -0
  138. package/chunks/vxlLayer.js +1 -1
  139. package/core/clock.js +1 -1
  140. package/core/jsonMap.js +1 -1
  141. package/core/promiseUtils.js +1 -1
  142. package/core/reactiveUtils.js +1 -1
  143. package/form/ExpressionInfo.js +1 -1
  144. package/interfaces.d.ts +28 -28
  145. package/package.json +1 -1
  146. package/rest/print.js +1 -1
  147. package/support/arcadeOnDemand.js +1 -1
  148. package/support/featureFlags.js +1 -1
  149. package/support/revision.js +1 -1
  150. package/views/2d/MapViewConstraints.js +1 -1
  151. package/views/2d/viewpointUtils.js +1 -1
  152. package/views/3d/environment/CloudsPresets.js +1 -1
  153. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  154. package/views/3d/environment/Precipitation.glsl.js +5 -0
  155. package/views/3d/environment/Precipitation.js +5 -0
  156. package/views/3d/environment/PrecipitationTechnique.js +5 -0
  157. package/views/3d/environment/RainyWeather.js +1 -1
  158. package/views/3d/environment/SnowyWeather.js +5 -0
  159. package/views/3d/environment/weather.js +1 -1
  160. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  161. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  162. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  163. package/views/3d/layers/GraphicsView3D.js +1 -1
  164. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  165. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  166. package/views/3d/support/sunUtils.js +1 -1
  167. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  168. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  169. package/views/MapView.js +1 -1
  170. package/views/View.js +1 -1
  171. package/views/input/recognizers/DoubleTapDrag.js +1 -1
  172. package/views/input/recognizers/ImmediateDoubleClick.js +1 -1
  173. package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
  174. package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
  175. package/views/support/DefaultsFromMap.js +1 -1
  176. package/views/support/projectionUtils.js +5 -0
  177. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  178. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  179. package/widgets/BasemapGallery/support/BasemapGalleryItem.js +1 -1
  180. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  181. package/widgets/BasemapGallery.js +1 -1
  182. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  183. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  184. package/widgets/Slice/SliceViewModel.js +1 -1
  185. package/widgets/Weather/WeatherViewModel.js +1 -1
  186. package/widgets/Weather/css.js +1 -1
  187. package/widgets/Weather/enums.js +5 -0
  188. package/widgets/Weather.js +1 -1
  189. package/widgets/support/InteractiveToolViewModel.js +1 -1
  190. package/assets/esri/core/workers/chunks/00c5bb5eecb0e89266df.js +0 -1
  191. package/assets/esri/core/workers/chunks/021a37e2b191298e80b7.js +0 -1
  192. package/assets/esri/core/workers/chunks/1370c92c40fd6271553c.js +0 -1
  193. package/assets/esri/core/workers/chunks/14bef72154b3a19561a7.js +0 -1
  194. package/assets/esri/core/workers/chunks/18668dc45eb9e35530df.js +0 -1
  195. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +0 -1
  196. package/assets/esri/core/workers/chunks/1fbcc8424452d0256bd6.js +0 -1
  197. package/assets/esri/core/workers/chunks/208a7e24e19fc5633dd7.js +0 -1
  198. package/assets/esri/core/workers/chunks/25a3e9bc0b4c7e0d3165.js +0 -1
  199. package/assets/esri/core/workers/chunks/2792ca40f1e92849247c.js +0 -1
  200. package/assets/esri/core/workers/chunks/2a96f1bba9ce6883e5e0.js +0 -1
  201. package/assets/esri/core/workers/chunks/3231ee3e090bb4cac3fc.js +0 -1
  202. package/assets/esri/core/workers/chunks/36a3f6fb4d1d18fcb642.js +0 -1
  203. package/assets/esri/core/workers/chunks/36e250278b5622ccf068.js +0 -1
  204. package/assets/esri/core/workers/chunks/395ba088d4864588ff66.js +0 -1
  205. package/assets/esri/core/workers/chunks/3aa4194dc5497c57647f.js +0 -1
  206. package/assets/esri/core/workers/chunks/3cc77692b2eee27b9c9e.js +0 -1
  207. package/assets/esri/core/workers/chunks/40a1e713f63ec77110c0.js +0 -1
  208. package/assets/esri/core/workers/chunks/4385a268c2a64281d1c1.js +0 -1
  209. package/assets/esri/core/workers/chunks/46b4bb66a54bbd8e2e57.js +0 -1
  210. package/assets/esri/core/workers/chunks/4bfbf5a34c9207fdcf44.js +0 -1
  211. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +0 -1
  212. package/assets/esri/core/workers/chunks/5d4863a92b03bebc1b54.js +0 -1
  213. package/assets/esri/core/workers/chunks/5d991b74d958005c26c4.js +0 -1
  214. package/assets/esri/core/workers/chunks/634b5ccd7a3ac67f855d.js +0 -1
  215. package/assets/esri/core/workers/chunks/662d13f68cf3ec92439b.js +0 -1
  216. package/assets/esri/core/workers/chunks/7bc5cc5dbf1b7b70ddac.js +0 -1
  217. package/assets/esri/core/workers/chunks/7d661129a0d8c466eeec.js +0 -1
  218. package/assets/esri/core/workers/chunks/8070972c0efb78523b68.js +0 -1
  219. package/assets/esri/core/workers/chunks/85e27fd949475f9a6bbc.js +0 -1
  220. package/assets/esri/core/workers/chunks/8b6ab6202a40fe622833.js +0 -1
  221. package/assets/esri/core/workers/chunks/96ab518eb6ba11333dee.js +0 -1
  222. package/assets/esri/core/workers/chunks/98986e6601b0366376b4.js +0 -1
  223. package/assets/esri/core/workers/chunks/9cdcf9309d6feda70185.js +0 -1
  224. package/assets/esri/core/workers/chunks/aa861b8eae6c85f3dad4.js +0 -1
  225. package/assets/esri/core/workers/chunks/aace7e1fef256bb961c9.js +0 -1
  226. package/assets/esri/core/workers/chunks/ad081d8e49e7f90c3c26.js +0 -1
  227. package/assets/esri/core/workers/chunks/af5694b4d278cf1db2d9.js +0 -1
  228. package/assets/esri/core/workers/chunks/afbb4f802ca5774f0326.js +0 -1
  229. package/assets/esri/core/workers/chunks/b2c5f92e3d7606297ca9.js +0 -1
  230. package/assets/esri/core/workers/chunks/b8316c6469a543029bc6.js +0 -1
  231. package/assets/esri/core/workers/chunks/ba615f118a3a8970ef25.js +0 -1
  232. package/assets/esri/core/workers/chunks/ba6654a885be4b7a43f0.js +0 -1
  233. package/assets/esri/core/workers/chunks/bf0a65b4be31959f921d.js +0 -1
  234. package/assets/esri/core/workers/chunks/c11474b702dfb94e8e87.js +0 -1
  235. package/assets/esri/core/workers/chunks/c890c7fca27170e3341f.js +0 -1
  236. package/assets/esri/core/workers/chunks/c976785f2391c77d8a30.js +0 -1
  237. package/assets/esri/core/workers/chunks/ca2f5faa01d99c21ec14.js +0 -1
  238. package/assets/esri/core/workers/chunks/cef4af64860ebbfc1c47.js +0 -1
  239. package/assets/esri/core/workers/chunks/cfbffa429d88e7709c3f.js +0 -1
  240. package/assets/esri/core/workers/chunks/d24c4fbc567486b1188f.js +0 -1
  241. package/assets/esri/core/workers/chunks/e4f93c55eaefab4192b5.js +0 -1
  242. package/assets/esri/core/workers/chunks/ec89466f76d0ba22525e.js +0 -1
  243. package/assets/esri/core/workers/chunks/ee45618c45806ab654cb.js +0 -1
  244. package/assets/esri/core/workers/chunks/f467c8f1fce22f6f599c.js +0 -1
  245. package/assets/esri/core/workers/chunks/f4baa5ea2e42b1317941.js +0 -1
  246. package/assets/esri/core/workers/chunks/face43cf5abcd2f5bd9d.js +0 -1
  247. package/assets/esri/core/workers/chunks/ffaf091c6023225cf5aa.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{someMap as s}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as i,isSome as a,isNone as h,unwrap as o}from"../../../../core/maybe.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as l}from"../../../../core/watchUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{v as c,j as m,a as u,m as g}from"../../../../chunks/mat4.js";import{I as f,c as T}from"../../../../chunks/mat4f64.js";import{a as R}from"../../../../chunks/vec2f64.js";import{MAXIMUM_ANIMATION_LOAD as E,MINIMUM_IDLE_ANIMATION_MS as A}from"../../support/animationUtils.js";import C from"../../support/debugFlags.js";import{RenderPassManager as P}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as x}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AntiAliasingMode as b,TransparencyPassType as w,Decorations as S,RenderRequestType as H,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as O,union as L}from"./depthRange.js";import{depthRangeFromScene as I}from"./depthRangeUtils.js";import{createEmptyDepthTexture as y}from"./glUtil3D.js";import N from"./HighlightHelper.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as j}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderPass as G}from"./RenderPass.js";import{RenderPluginManager as F}from"./RenderPluginManager.js";import{RenderSlot as V}from"./RenderSlot.js";import{ShadowAccumulator as B}from"./ShadowAccumulator.js";import{ShadowHighlightHelper as k}from"./ShadowHighlightHelper.js";import W from"./ShadowMap.js";import Q from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as X}from"./SSAOHelper.js";import{EdgeView as K}from"./edgeRendering/EdgeView.js";import{Transparency as Y}from"./edgeRendering/interfaces.js";import{SceneLighting as J}from"../lighting/SceneLighting.js";import{MergedRenderer as Z}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as $}from"../shaders/CompositingTechnique.js";import{HighlightShadowMapSlot as ee,DefaultSnapshotSlot as re}from"../shaders/ShadowHighlightTechnique.js";import{RendererPerformanceInfo as te,Statistics as se}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ie,PixelType as ae}from"../../../webgl/enums.js";import{startMeasurement as he}from"../../../webgl/Measurement.js";const oe=.9;let de=class extends r{constructor(e,r,s,n,i,a,h,o,_){super({}),this._materialRepository=e,this._shaderTechniqueRepository=s,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=_,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasOccludees=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new te,this._antialiasing=b.SMAA,this._oitEnabled=!1,this._multipassTerrain=!0,this._opaqueTerrain=!0,this._lighting=new J,this._hasAnimations=!1,this._animationTimestep=d(0),this._handles=new t,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,s),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new U(this._rctx,this._compositingHelper),this._sliceHelper=new Q,this._shadowMap=new W(this._rctx,_.viewingMode,2),this._ssaoHelper=new X(s,this._rctx,(()=>this._requestRender())),this._highlightHelper=new N(s,this._rctx),this._shadowHighlightHelper=new k(this._rctx,_.viewingMode),this._shadowAccumulator=new B(this._rctx,s,_,((e,r)=>{this.renderPassManager.shadowCastingEnabled=!0,this._renderPlugins.prepareRender(e,r),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled}),((e,r,t,s)=>{e.start(t,r,s),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL,e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t)}),(()=>this._requestRender())),this._bindParameters={slot:null,camera:null,inverseViewport:R(),shadowMap:this._shadowMap,shadowMappingEnabled:this._shadowMap.enabled,ssaoHelper:this._ssaoHelper,ssaoEnabled:this._ssaoHelper.enabled,origin:null,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:this._sliceHelper.plane,highlightDepthTexture:null,hasOccludees:!1,linearDepthTexture:null,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,multipassGeometryEnabled:!1,cullAboveGround:!1,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1,lighting:this._lighting,highlightColorTexture:null,cloudsCompositionParams:null},this._renderContext=new j(this._rctx,this._offscreenRendering,this._lighting,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderContext.multipassTerrainParams={camera:null,multipassTerrainEnabled:!1,cullAboveGround:!1,terrainLinearDepthTexture:null},this._renderContext.multipassGeometryParams={multipassGeometryEnabled:!1,geometryLinearDepthTexture:null},this._renderContext.ssrParams={camera:null,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1},this._renderPlugins=new F({renderContext:this._renderContext,shaderTechniqueRep:s,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new P(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l(C,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Y.TRANSPARENT):()=>{},this._requestRender()})),l(this._stage,"camera",(()=>this._requestRender()),!0)])}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=i(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlightHelper.dispose(),this._shadowHighlightHelper.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing===b.SMAA&&this._smaaPass.updating||a(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return h(this._edgeView)&&(this._edgeView=new K({rctx:this._rctx,renderSR:this._stage.renderSR,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(this._edgeView.watch("updating",(()=>this._requestRender()),!0)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return null===this._bindParameters.reprojectionMatrix||c(this._bindParameters.reprojectionMatrix,f)}set _reprojectionMatrix(e){c(this._bindParameters.reprojectionMatrix,e)||(this._bindParameters.reprojectionMatrix=e,this.notifyChange("isCameraFinal"))}get hasShadowsEnabled(){var e;return!(null==(e=this._shadowMap)||!e.enabled)}setRenderParameters(e){const{renderPassManager:r,_shadowMap:t,_ssaoHelper:s}=this;void 0!==e.screenSpaceReflectionsEnabled&&r.screenSpaceReflectionsEnabled!==e.screenSpaceReflectionsEnabled&&(r.screenSpaceReflectionsEnabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0===e.shadowMap||t.enabled===e.shadowMap&&r.shadowCastingEnabled===e.shadowMap||(t.enabled=e.shadowMap,r.shadowCastingEnabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),void 0!==e.ssao&&s.enabled!==e.ssao&&(s.enabled=e.ssao,this._requestRender()),e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender());const n=e.antialiasingEnabled?b.SMAA:b.NONE;void 0!==e.antialiasingEnabled&&this._antialiasing!==n&&(this._antialiasing=n,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=o(e.slicePlane),this._requestRender()),void 0!==e.waterReflectionEnabled&&this._waterReflectionEnabled!==e.waterReflectionEnabled&&(this._waterReflectionEnabled=e.waterReflectionEnabled,this._requestRender()),void 0!==e.opaqueTerrain&&this._opaqueTerrain!==e.opaqueTerrain&&(this._opaqueTerrain=e.opaqueTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:n}=e;if(0===r.length&&0===t.length&&0===n.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const i=q(e);let a=!1;i.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new Z(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=s(this._materialRenderers,(e=>e.hasHighlights)),this._hasOccludees=s(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=s(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=s(this._materialRenderers,(e=>e.requiresSlot(V.TRANSPARENT_MATERIAL,G.MATERIAL))),this._hasHUDElements=s(this._materialRenderers,(e=>e.requiresSlot(V.LINE_CALLOUTS_HUD_DEPTH,G.MATERIAL)||e.requiresSlot(V.HUD_MATERIAL,G.MATERIAL)||e.requiresSlot(V.LABEL_MATERIAL,G.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._lighting.groundLightingFactor=r,this._lighting.globalFactor=t,this._lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.lighting=this._lighting,this._renderContext.hasOccludees=this._hasOccludees,this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=w.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const i=this._sliceHelper.plane;s===S.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this.needsShadowCast&&(this.renderPassManager.shadowCastingEnabled=!0),this._renderPlugins.prepareRender(r,t),this.performanceInfo.advance(se.Prepare);const o=this._computeDepthRange(r);this._renderShadowMap(e,r,this._lighting.lightingMainDirection,o),this.performanceInfo.advance(se.Shadowmap),n.initializeFrame(r),this._ensureBindParameters(r),this._renderLinearDepth(),this.performanceInfo.advance(se.Lineardepth),this._accumulateShadows(o,r,t),this._renderNormal(),this.performanceInfo.advance(se.Normals),this._ensureBindParametersSSR(),this._ensureBindParametersCloudsReflections(),this._ssaoHelper.computeSSAO(r,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(se.SSAO),this._renderContext.pass=G.MATERIAL,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.Opaque);const d=this._multipassTerrain&&!this._opaqueTerrain;this._renderTerrainLinearDepth(d),this._setMultipassFlags(d),this._setTerrainCulling(d),this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderGeometryLinearDepth(d);const _=this._renderHUDVisibility();d||this._renderInternalSlot(V.LINE_CALLOUTS),this.performanceInfo.advance(se.Hudvisibility),this._renderEdges(Y.TRANSPARENT,d),this.performanceInfo.advance(se.TransparentEdges),this._renderSlot(V.VOXEL),this._renderTransparentTerrain(),!this._opaqueTerrain&&_&&(d?this._renderLineCallouts(x.OCCLUDED):n.compositeTransparentTerrainOntoHUDVisibility(),this._renderHUD(x.OCCLUDED,n.framebuffer),this.performanceInfo.advance(se.HudOccluded)),this.performanceInfo.advance(se.TransparentTerrain),this._setTerrainCulling(!1),this._opaqueTerrain||(n.compositeTransparentTerrainOntoMain(),d&&(this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderEdges(Y.TRANSPARENT),this.performanceInfo.advance(se.TransparentEdges))),d&&this._renderLineCallouts(x.NOTOCCLUDED),this._setMultipassFlags(!1),this._shadowAccumulator.render(),n.renderToTargets((()=>{this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(V.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(se.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(V.LASERLINES_CONTRAST_CONTROL)),$.PremultipliedAlpha),this.performanceInfo.advance(se.Laserline),this._renderOccluded(),this.performanceInfo.advance(se.Occluded);const p=s===S.ON&&this._magnifierHelper.enabled,c=p&&h(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(c);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(this._antialiasing,m)&&a(m)&&this._compositingHelper.composite(m,$.None),this.performanceInfo.advance(se.Antialiasing),this._renderHUD(x.NOTOCCLUDED,c),this.performanceInfo.advance(se.HudNotoccluded),this._renderHighlights(c,this._bindParameters),this.performanceInfo.advance(se.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),c!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._offscreenRendering.tmpColorTexture,$.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._renderContext.camera),this._sliceHelper.plane=i,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=d(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/E;this._animationTimestep=d(Math.max(this._animationTimestep*oe+e*(1-oe),A))}}readDepthPixels(e,r,t,s,n,i){const a=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e),this._renderContext.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)}a.readPixels(r,t,s,n,ie.RGBA,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassFlags(e){this._renderContext.multipassTerrainParams.multipassTerrainEnabled=this._bindParameters.multipassTerrainEnabled=e,this._renderContext.multipassGeometryParams.multipassGeometryEnabled=this._bindParameters.multipassGeometryEnabled=e}_setTerrainCulling(e){this._renderContext.multipassTerrainParams.cullAboveGround=this._bindParameters.cullAboveGround=e}_renderSlot(e){this._renderContext.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;a(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),$.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&(n.start(r,t,s),this.needsShadowHighlight?(this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee))),n.clear(),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,re),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this.needsShadowHighlight||this.needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._renderContext.ssrParams.linearDepthTexture=this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._renderContext.multipassTerrainParams.terrainLinearDepthTexture=this._bindParameters.terrainLinearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(G.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._renderContext.multipassGeometryParams.geometryLinearDepthTexture=this._bindParameters.geometryLinearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this.needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get needsDepthRange(){return this._shadowMap.enabled||this.needsShadowCast}_computeDepthRange(e){if(!this.needsDepthRange)return O;const r=I(e,this._content,this._stage.layers);return L(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(V.INTEGRATED_MESH),this._renderSlot(V.OPAQUE_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL),this._renderSlot(V.OPAQUE_PLUGIN),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(V.TRANSPARENT_MATERIAL),this._renderSlot(V.TRANSPARENT_PLUGIN)}_renderTransparentTerrain(){this._renderSlot(V.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(V.OCCLUSION_PIXELS)}),this._multipassTerrain&&!this._opaqueTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(V.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(V.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._offscreenRendering.hudColorTexture,$.PremultipliedAlpha)):e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(x.OCCLUDED)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(V.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(V.HUD_MATERIAL),this._renderInternalSlot(V.LABEL_MATERIAL)}get needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlightHelper.isVisible&&this.needsHighlight}_renderHighlights(e,r){if(!this.needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlightHelper,s=t.profilingCallback&&he(this._renderContext.rctx);this._renderContext.highlightDepthTexture=r.highlightDepthTexture;const n=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(x.BOTH)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=n.colorTexture,this.needsShadowHighlight&&this._shadowHighlightHelper.render(r,e),t.render(this._renderContext.camera,n,e),a(s)&&t.profilingCallback&&s.stop((e=>{t.profilingCallback&&t.profilingCallback(e)}))}get needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this.needsShadowCast&&(this._shadowAccumulator.setAccumulationDependencies(this._offscreenRendering.linearDepthTexture,e,r,t),this._shadowAccumulator.accumulateFixedSamples(),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._renderContext.transparencyPassType=t,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_ALPHA,t(w.Alpha),this._renderContext.pass=G.MATERIAL,t(w.Color),t(w.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(r),this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===v.OccludeAndTransparentStencil&&(e|=t.renderOccluded,pe.push(t))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(t))};0!==pe.length&&(this._renderInternalSlot(V.OCCLUDER_MATERIAL,pe),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(V.TRANSPARENT_OCCLUDER_MATERIAL,pe)),!1,!1),pe.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===v.OccludeAndTransparent||t.renderOccluded===v.Transparent||t.renderOccluded===v.Opaque)&&(e|=t.renderOccluded,_e.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>v.Occlude&&this._renderSlot(V.OCCLUDED_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=G.MATERIAL,t(.5,v.OccludeAndTransparent,(()=>n(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>n(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>n(v.Opaque)),!0,D.OutlineVisualElementMask),_e.length=0}_renderAntiAliasing(e,r){if(e===b.SMAA){if(this._smaaPass.enable((()=>this._requestRender()))&&a(r))return this._smaaPass.render(r),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e){this._renderContext.camera=e,this._bindParameters.camera=this._renderContext.camera,this._bindParameters.inverseViewport[0]=1/this._renderContext.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/this._renderContext.camera.fullViewport[3]}_ensureBindParameters(e){var r;this._ensureCameraBindParameters(e);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.shadowMap=this._renderContext.shadowMap,this._bindParameters.shadowMappingEnabled=this._renderContext.shadowMap.enabled,this._bindParameters.ssaoHelper=this._renderContext.ssaoHelper,this._bindParameters.ssaoEnabled=this._renderContext.ssaoHelper.enabled,this._bindParameters.slicePlane=this._renderContext.sliceHelper.plane,this._bindParameters.hasOccludees=this._renderContext.hasOccludees,this._renderContext.multipassTerrainParams.camera=this._renderContext.camera,this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.highlightDepthTexture=null!=(r=t.depthTexture)?r:this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._renderContext.camera)?this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=f:(m(ce,this._renderContext.lastFrameCamera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),m(ue,this._renderContext.camera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),u(ue,ue),u(me,this._renderContext.camera.projectionMatrix),g(ge,ue,me),g(ge,ce,ge),g(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=ge),this._renderContext.ssrParams.camera=this._renderContext.camera,this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=null,this._renderContext.ssrParams.ssrEnabled=this._bindParameters.ssrEnabled=this.hasWaterReflection}_ensureBindParametersCloudsReflections(){this._bindParameters.cloudsCompositionParams=this._renderContext.cloudsCompositionParams}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,a(r)?r.forEach((r=>{if(!r.shouldRender(this._renderContext))return;const s=this._materialRenderers.get(r);a(s)&&(t=s.render(e,this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((r,s)=>{s.shouldRender(this._renderContext)&&(t=r.render(e,this._renderContext.pass,this._bindParameters)||t)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=y(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){var e,r,t,s,n,i,a,h,o,d;return{offscreen:null!=(e=null==(r=this._offscreenRendering)?void 0:r.gpuMemoryUsage)?e:0,highlights:(null!=(t=null==(s=this._highlightHelper)?void 0:s.gpuMemoryUsage)?t:0)+(null!=(n=null==(i=this._shadowHighlightHelper)?void 0:i.gpuMemoryUsage)?n:0),shadows:null!=(a=null==(h=this._shadowMap)?void 0:h.gpuMemoryUsage)?a:0,ssao:null!=(o=null==(d=this._ssaoHelper)?void 0:d.gpuMemoryUsage)?o:0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlightHelper,lighting:this._lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{var t;switch(r){case le.Color:return e._offscreenRendering.colorTexture;case le.LinearDepth:return e._offscreenRendering.linearDepthTexture;case le.Normals:return e._offscreenRendering.normalTexture;case le.ShadowMap:return null==(t=e._shadowMap)?void 0:t.test.depthTexture;case le.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case le.Highlight:return e._offscreenRendering.highlightTexture}}}}};var le;e([_()],de.prototype,"_shadowAccumulator",void 0),e([_()],de.prototype,"_smaaPass",void 0),e([_()],de.prototype,"_antialiasing",void 0),e([_()],de.prototype,"_edgeView",void 0),e([_()],de.prototype,"updating",null),e([_()],de.prototype,"isCameraFinal",null),de=e([p("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=[],pe=[],ce=T(),me=T(),ue=T(),ge=T();export{le as FramebufferId,de as Renderer};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{someMap as s}from"../../../../core/MapUtils.js";import{destroyMaybe as n,disposeMaybe as i,isSome as a,isNone as h,unwrap as o}from"../../../../core/maybe.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as l}from"../../../../core/watchUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{v as c,j as m,a as u,m as g}from"../../../../chunks/mat4.js";import{I as f,c as T}from"../../../../chunks/mat4f64.js";import{a as R}from"../../../../chunks/vec2f64.js";import{MAXIMUM_ANIMATION_LOAD as E,MINIMUM_IDLE_ANIMATION_MS as A}from"../../support/animationUtils.js";import P from"../../support/debugFlags.js";import{RenderPassManager as C}from"../core/renderPasses/RenderPassManager.js";import{HUDTransparentRenderStyle as x}from"../core/shaderLibrary/hud/HUDUniforms.js";import{AntiAliasingMode as b,TransparencyPassType as w,Decorations as S,RenderRequestType as H,StencilBits as D}from"./basicInterfaces.js";import{BoundingInfo as M}from"./BoundingInfo.js";import{ZERO as O,union as L}from"./depthRange.js";import{depthRangeFromScene as I}from"./depthRangeUtils.js";import{createEmptyDepthTexture as y}from"./glUtil3D.js";import N from"./HighlightHelper.js";import{RenderOccludedFlag as v}from"./Material.js";import{OffscreenRendering as U}from"./OffscreenRendering.js";import{RenderContext as j}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as q}from"./rendererUtils.js";import{RenderPass as G}from"./RenderPass.js";import{RenderPluginManager as F}from"./RenderPluginManager.js";import{RenderSlot as V}from"./RenderSlot.js";import{ShadowAccumulator as B}from"./ShadowAccumulator.js";import{ShadowHighlightHelper as k}from"./ShadowHighlightHelper.js";import W from"./ShadowMap.js";import Q from"./SliceHelper.js";import{SmaaRenderPass as z}from"./SmaaRenderPass.js";import{SSAOHelper as X}from"./SSAOHelper.js";import{EdgeView as K}from"./edgeRendering/EdgeView.js";import{Transparency as Y}from"./edgeRendering/interfaces.js";import{SceneLighting as J}from"../lighting/SceneLighting.js";import{MergedRenderer as Z}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as $}from"../shaders/CompositingTechnique.js";import{HighlightShadowMapSlot as ee,DefaultSnapshotSlot as re}from"../shaders/ShadowHighlightTechnique.js";import{RendererPerformanceInfo as te,Statistics as se}from"../statistics/RendererPerformanceInfo.js";import{ClearBufferBit as ne,PixelFormat as ie,PixelType as ae}from"../../../webgl/enums.js";import{startMeasurement as he}from"../../../webgl/Measurement.js";const oe=.9;let de=class extends r{constructor(e,r,s,n,i,a,h,o,_){super({}),this._materialRepository=e,this._shaderTechniqueRepository=s,this._rctx=n,this._compositingHelper=i,this._magnifierHelper=a,this._requestRender=h,this._stage=_,this._materialRenderers=new Map,this._needsTransparentPass=!1,this._hasHUDElements=!1,this._hasHighlights=!1,this._hasOccludees=!1,this._hasWater=!1,this._hasOverlayWater=!1,this._content=new Map,this._isRendering=!1,this._fallbackDepthStencilTexture=null,this.performanceInfo=new te,this._antialiasing=b.SMAA,this._oitEnabled=!1,this._multipassTerrain=!0,this._opaqueTerrain=!0,this._lighting=new J,this._hasAnimations=!1,this._animationTimestep=d(0),this._handles=new t,this._renderHiddenTransparentEdges=()=>{},this._oitUsed=!1,this._smaaPass=new z(this._rctx,s),this._oitEnabled=this._hasOITSupport,this._requestRender(),this._offscreenRendering=new U(this._rctx,this._compositingHelper),this._sliceHelper=new Q,this._shadowMap=new W(this._rctx,_.viewingMode,2),this._ssaoHelper=new X(s,this._rctx,(()=>this._requestRender())),this._highlightHelper=new N(s,this._rctx),this._shadowHighlightHelper=new k(this._rctx,_.viewingMode),this._shadowAccumulator=new B(this._rctx,s,_,((e,r)=>{this.renderPassManager.shadowCastingEnabled=!0,this._renderPlugins.prepareRender(e,r),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled}),((e,r,t,s)=>{e.start(t,r,s),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL,e),t.setGLViewport(this._rctx),this._ensureCameraBindParameters(t)}),(()=>this._requestRender())),this._bindParameters={slot:null,camera:null,inverseViewport:R(),shadowMap:this._shadowMap,shadowMappingEnabled:this._shadowMap.enabled,ssaoHelper:this._ssaoHelper,ssaoEnabled:this._ssaoHelper.enabled,origin:null,screenToWorldRatio:null,screenToPCSRatio:null,slicePlane:this._sliceHelper.plane,highlightDepthTexture:null,hasOccludees:!1,linearDepthTexture:null,terrainLinearDepthTexture:null,geometryLinearDepthTexture:null,multipassTerrainEnabled:!1,multipassGeometryEnabled:!1,cullAboveGround:!1,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1,lighting:this._lighting,highlightColorTexture:null,cloudsCompositionParams:null},this._renderContext=new j(this._rctx,this._offscreenRendering,this._lighting,this._shadowMap,this._ssaoHelper,this._sliceHelper),this._renderContext.multipassTerrainParams={camera:null,multipassTerrainEnabled:!1,cullAboveGround:!1,terrainLinearDepthTexture:null},this._renderContext.multipassGeometryParams={multipassGeometryEnabled:!1,geometryLinearDepthTexture:null},this._renderContext.ssrParams={camera:null,linearDepthTexture:null,lastFrameColorTexture:null,reprojectionMatrix:f,ssrEnabled:!1},this._renderPlugins=new F({renderContext:this._renderContext,shaderTechniqueRep:s,textureRep:r,materialRep:this._materialRepository,requestRender:this._requestRender,schedule:o}),this.renderPassManager=new C(this._rctx,this._shaderTechniqueRepository),this._renderPlugins.add(this.renderPassManager.slots(),this.renderPassManager),this._handles.add([l(P,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(Y.TRANSPARENT):()=>{},this._requestRender()})),l(this._stage,"camera",(()=>this._requestRender()),!0)])}get hasWater(){return this._hasWater||this._hasOverlayWater}get hasWaterReflection(){return this.hasWater&&this._waterReflectionEnabled}normalizeCtorArgs(){return{}}dispose(){this._handles.destroy(),this._smaaPass.dispose(),this._materialRenderers.forEach((e=>e.dispose())),this._materialRenderers.clear(),this._edgeView=n(this._edgeView),this._offscreenRendering.dispose(),this._fallbackDepthStencilTexture=i(this._fallbackDepthStencilTexture),this._shadowMap.enabled=!1,this._shadowMap.dispose(),this._ssaoHelper.enabled=!1,this._ssaoHelper.dispose(),this._highlightHelper.dispose(),this._shadowHighlightHelper.dispose(),this._shadowAccumulator.dispose(),M.prune(),this._content.clear()}disposeOffscreenBuffers(){this._offscreenRendering.dispose(),this._shadowMap.dispose(),this._smaaPass.disable(),this._ssaoHelper.disposeOffscreenBuffers()}get updating(){return this._antialiasing===b.SMAA&&this._smaaPass.updating||a(this._edgeView)&&this._edgeView.updating||this._shadowAccumulator.running||!this.isCameraFinal}ensureEdgeView(){return h(this._edgeView)&&(this._edgeView=new K({rctx:this._rctx,renderSR:this._stage.renderSR,techniqueRepository:this._shaderTechniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:e=>this._stage.resourceController.schedule(e)}),this._handles.add(this._edgeView.watch("updating",(()=>this._requestRender()),!0)),this._requestRender()),this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return null===this._bindParameters.reprojectionMatrix||c(this._bindParameters.reprojectionMatrix,f)}set _reprojectionMatrix(e){c(this._bindParameters.reprojectionMatrix,e)||(this._bindParameters.reprojectionMatrix=e,this.notifyChange("isCameraFinal"))}get hasShadowsEnabled(){var e;return!(null==(e=this._shadowMap)||!e.enabled)}setRenderParameters(e){const{renderPassManager:r,_shadowMap:t,_ssaoHelper:s}=this;void 0!==e.screenSpaceReflectionsEnabled&&r.screenSpaceReflectionsEnabled!==e.screenSpaceReflectionsEnabled&&(r.screenSpaceReflectionsEnabled=e.screenSpaceReflectionsEnabled,this._requestRender()),void 0===e.shadowMap||t.enabled===e.shadowMap&&r.shadowCastingEnabled===e.shadowMap||(t.enabled=e.shadowMap,r.shadowCastingEnabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&t.maxCascades!==e.shadowMapMaxCascades&&(t.maxCascades=e.shadowMapMaxCascades,this._requestRender()),void 0!==e.ssao&&s.enabled!==e.ssao&&(s.enabled=e.ssao,this._requestRender()),e.background&&this._offscreenRendering.background!==e.background&&(this._offscreenRendering.background=e.background,this._requestRender());const n=e.antialiasingEnabled?b.SMAA:b.NONE;void 0!==e.antialiasingEnabled&&this._antialiasing!==n&&(this._antialiasing=n,this._requestRender()),void 0!==e.highQualityTransparency&&this._multipassTerrain!==e.highQualityTransparency&&(this._multipassTerrain=e.highQualityTransparency,this._oitEnabled=e.highQualityTransparency&&this._hasOITSupport,this._requestRender()),void 0!==e.defaultHighlightOptions&&(this._highlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._shadowHighlightHelper.setDefaultOptions(e.defaultHighlightOptions),this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=o(e.slicePlane),this._requestRender()),void 0!==e.waterReflectionEnabled&&this._waterReflectionEnabled!==e.waterReflectionEnabled&&(this._waterReflectionEnabled=e.waterReflectionEnabled,this._requestRender()),void 0!==e.opaqueTerrain&&this._opaqueTerrain!==e.opaqueTerrain&&(this._opaqueTerrain=e.opaqueTerrain,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlendWorking}modify(e){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:t,updates:n}=e;if(0===r.length&&0===t.length&&0===n.length)return;t.forAll((({id:e})=>this._content.delete(e))),r.forAll((e=>this._content.set(e.id,e)));const i=q(e);let a=!1;i.forEach(((e,r)=>{let t=this._materialRenderers.get(r);if(!t){if(!(e.adds.length>0))return;t=new Z(this._rctx,this._materialRepository,r),this._materialRenderers.set(r,t)}t.modify(e),t.isEmpty&&(a=!0)})),a&&this._materialRenderers.forEach(((e,r)=>{e.isEmpty&&(this._materialRenderers.delete(r),e.dispose())})),this._hasHighlights=s(this._materialRenderers,(e=>e.hasHighlights)),this._hasOccludees=s(this._materialRenderers,(e=>e.hasOccludees)),this._hasWater=s(this._materialRenderers,(e=>e.hasWater)),this._needsTransparentPass=s(this._materialRenderers,(e=>e.requiresSlot(V.TRANSPARENT_MATERIAL,G.MATERIAL))),this._hasHUDElements=s(this._materialRenderers,(e=>e.requiresSlot(V.LINE_CALLOUTS_HUD_DEPTH,G.MATERIAL)||e.requiresSlot(V.HUD_MATERIAL,G.MATERIAL)||e.requiresSlot(V.LABEL_MATERIAL,G.MATERIAL))),this._requestRender()}updateAnimation(e){return this._hasAnimations=!1,this._materialRenderers.forEach((r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations)),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations}get animationTimestep(){return this._animationTimestep}updateLightSources(e,r,t){this._lighting.groundLightingFactor=r,this._lighting.globalFactor=t,this._lighting.set(e)}render(e,r,t,s){this._isRendering=!0,this.performanceInfo.prerender(this._rctx),this._bindParameters.lighting=this._lighting,this._renderContext.hasOccludees=this._hasOccludees,this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=w.NONE;const n=this._offscreenRendering;n.needLastFrameColorTexture=this.hasWaterReflection,n.advanceCurrentRenderTarget();const i=this._sliceHelper.plane;s===S.OFF&&(this._sliceHelper.plane=null),this._rctx.bindFramebuffer(e),r.setGLViewport(this._rctx),this.needsShadowCast&&(this.renderPassManager.shadowCastingEnabled=!0),this._renderPlugins.prepareRender(r,t),this.performanceInfo.advance(se.Prepare);const o=this._computeDepthRange(r);this._renderShadowMap(e,r,this._lighting.lightingMainDirection,o),this.performanceInfo.advance(se.Shadowmap),n.initializeFrame(r),this._ensureBindParameters(r),this._renderLinearDepth(),this.performanceInfo.advance(se.Lineardepth),this._accumulateShadows(o,r,t),this._renderNormal(),this.performanceInfo.advance(se.Normals),this._ensureBindParametersSSR(),this._ensureBindParametersCloudsReflections(),this._ssaoHelper.computeSSAO(r,n.linearDepthTexture,n.normalTexture),this.performanceInfo.advance(se.SSAO),this._renderContext.pass=G.MATERIAL,n.bindFramebuffer(),this._renderOpaqueGeometry(),this.performanceInfo.advance(se.Opaque);const d=this._multipassTerrain&&!this._opaqueTerrain;this._renderTerrainLinearDepth(d),this._setMultipassFlags(d),this._setTerrainCulling(d),this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),this._renderHiddenTransparentEdges();const l=this._needsTransparentPass||this._renderPlugins.needsTransparentPass;l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderGeometryLinearDepth(d);const _=this._renderHUDVisibility();d||this._renderInternalSlot(V.LINE_CALLOUTS),this.performanceInfo.advance(se.Hudvisibility),this._renderEdges(Y.TRANSPARENT,d),this.performanceInfo.advance(se.TransparentEdges),this._renderSlot(V.VOXEL),this._renderTransparentTerrain(),!this._opaqueTerrain&&_&&(d?this._renderLineCallouts(x.OCCLUDED):n.compositeTransparentTerrainOntoHUDVisibility(),this._renderHUD(x.OCCLUDED,n.framebuffer),this.performanceInfo.advance(se.HudOccluded)),this.performanceInfo.advance(se.TransparentTerrain),this._setTerrainCulling(!1),this._opaqueTerrain||(n.compositeTransparentTerrainOntoMain(),d&&(this._renderEdges(Y.OPAQUE),this.performanceInfo.advance(se.OpaqueEdges),l&&(this._oitEnabled?this._renderOrderIndependentTransparency((()=>this._renderTransparentGeometry()),!1):this._renderTransparentGeometry()),this.performanceInfo.advance(se.Transparent),this._renderEdges(Y.TRANSPARENT),this.performanceInfo.advance(se.TransparentEdges))),d&&this._renderLineCallouts(x.NOTOCCLUDED),this._setMultipassFlags(!1),this._shadowAccumulator.render(),n.renderToTargets((()=>{this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_TRANSPARENT),this._renderSlot(V.LASERLINES)}),n.currentColorTarget,n.mainDepth),this.performanceInfo.advance(se.Atmosphere),this._renderPlugins.needsLaserlineWithContrastControl&&n.renderTmpAndCompositeToMain((()=>this._renderSlot(V.LASERLINES_CONTRAST_CONTROL)),$.PremultipliedAlpha),this.performanceInfo.advance(se.Laserline),this._renderOccluded(),this.performanceInfo.advance(se.Occluded);const p=s===S.ON&&this._magnifierHelper.enabled,c=p&&h(e)?this._offscreenRendering.getFramebuffer(this._offscreenRendering.tmpColor,this._offscreenRendering.tmpDepth):e;this._rctx.bindFramebuffer(c);const m=this._offscreenRendering.colorTexture;!this._renderAntiAliasing(this._antialiasing,m)&&a(m)&&this._compositingHelper.composite(m,$.None),this.performanceInfo.advance(se.Antialiasing),this._renderHUD(x.NOTOCCLUDED,c),this.performanceInfo.advance(se.HudNotoccluded),this._renderHighlights(c,this._bindParameters),this.performanceInfo.advance(se.Highlights),p&&this._magnifierHelper.render(this._rctx,this._bindParameters),c!==e&&(this._rctx.bindFramebuffer(e),this._compositingHelper.composite(this._offscreenRendering.tmpColorTexture,$.None)),this._disposeOITBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._renderContext.camera),this._sliceHelper.plane=i,this._isRendering=!1,this.onPostRender&&this.onPostRender(),this.performanceInfo.postrender()}finish(e){if(this._hasAnimations||(this._animationTimestep=d(0)),e===H.BACKGROUND){this._rctx.gl.getError();const e=this.performanceInfo.elapsedTime/E;this._animationTimestep=d(Math.max(this._animationTimestep*oe+e*(1-oe),A))}}readDepthPixels(e,r,t,s,n,i){const a=this._offscreenRendering.bindTarget(this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth);if(!this._needsLinearDepth){this._ensureBindParameters(e),this._renderContext.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const r=ne.COLOR_BUFFER_BIT|ne.DEPTH_BUFFER_BIT|ne.STENCIL_BUFFER_BIT;this._rctx.clearSafe(r),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)}a.readPixels(r,t,s,n,ie.RGBA,ae.UNSIGNED_BYTE,i)}readAccumulatedShadow(e,r){return this._shadowAccumulator.readAccumulatedShadow(e,r)}_setMultipassFlags(e){this._renderContext.multipassTerrainParams.multipassTerrainEnabled=this._bindParameters.multipassTerrainEnabled=e,this._renderContext.multipassGeometryParams.multipassGeometryEnabled=this._bindParameters.multipassGeometryEnabled=e}_setTerrainCulling(e){this._renderContext.multipassTerrainParams.cullAboveGround=this._bindParameters.cullAboveGround=e}_renderSlot(e){this._renderContext.slot=e,this._renderPlugins.render()}_renderEdges(e,r=!1){const t=this._edgeView;a(t)&&t.shouldRender()&&this._offscreenRendering.renderTmpAndCompositeToMain((()=>t.render(this._bindParameters,e)),$.Alpha,r)}_renderShadowMap(e,r,t,s){const n=this._shadowMap;n.enabled&&(n.start(r,t,s),this.needsShadowHighlight?(this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT,this._shadowMap,(e=>n.takeCascadeSnapshotTo(e,ee))),n.clear(),this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_DEFAULT,this._shadowMap,(e=>{n.takeCascadeSnapshotTo(e,re),this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT)}))):this._renderShadowCascades(G.MATERIAL_DEPTH_SHADOWMAP_ALL),n.finish(e),r.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap,t=(e=>{})){for(const s of r.getCascades())s.camera.setGLViewport(this._rctx),this._ensureCameraBindParameters(s.camera),this._renderGeometryAndTransparentTerrainPass(e),t(s)}get _needsLinearDepth(){return this._ssaoHelper.enabled||this._renderPlugins.needsLinearDepth||this._hasWater&&this._waterReflectionEnabled||this.needsShadowHighlight||this.needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?this._offscreenRendering.renderToTargets((()=>this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_DEPTH)),this._offscreenRendering.linearDepth,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.linearDepth),this._renderContext.ssrParams.linearDepthTexture=this._bindParameters.linearDepthTexture=this._offscreenRendering.linearDepthTexture}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_DEPTH,this._offscreenRendering.renderToTargets((()=>this._renderTransparentTerrain()),this._offscreenRendering.terrainLinearDepth,this._offscreenRendering.tmpDepth,[-1e10,-1e10,-1e10,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.terrainLinearDepth);this._renderContext.multipassTerrainParams.terrainLinearDepthTexture=this._bindParameters.terrainLinearDepthTexture=this._offscreenRendering.terrainLinearDepthTexture}_renderGeometryLinearDepth(e){if(e){const e=this._renderContext.pass;this._offscreenRendering.renderToTargets((()=>this._renderGeometryPass(G.MATERIAL_DEPTH)),this._offscreenRendering.geometryLinearDepth,this._offscreenRendering.tmpDepth,[1,1,1,1],!0,!0),this._renderContext.pass=e}else this._offscreenRendering.disposeTarget(this._offscreenRendering.geometryLinearDepth);this._renderContext.multipassGeometryParams.geometryLinearDepthTexture=this._bindParameters.geometryLinearDepthTexture=this._offscreenRendering.geometryLinearDepthTexture}get needsNormal(){return this._ssaoHelper.enabled}_renderNormal(){this.needsNormal?this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_NORMAL)}),this._offscreenRendering.normal,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0):this._offscreenRendering.disposeTarget(this._offscreenRendering.normal)}get needsDepthRange(){return this._shadowMap.enabled||this.needsShadowCast}_computeDepthRange(e){if(!this.needsDepthRange)return O;const r=I(e,this._content,this._stage.layers);return L(r,this.renderPlugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderGeometryAndTransparentTerrainPass(e){this._renderContext.pass=e,this._renderGeometryPass(e),this._renderTransparentTerrain()}_renderGeometryPass(e){this._renderContext.pass=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderOpaqueGeometry(){this._renderSlot(V.INTEGRATED_MESH),this._renderSlot(V.OPAQUE_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL),this._renderSlot(V.OPAQUE_PLUGIN),this._renderSlot(V.POSTPROCESSING_ENVIRONMENT_OPAQUE)}_renderTransparentGeometry(){this._renderInternalSlot(V.TRANSPARENT_MATERIAL),this._renderSlot(V.TRANSPARENT_PLUGIN)}_renderTransparentTerrain(){this._renderSlot(V.TRANSPARENT_TERRAIN)}_renderHUDVisibility(){let e=!1;return this._renderContext.offscreenRenderingHelper&&this._renderContext.offscreenRenderingHelper.renderHUDVisibility((()=>{this._bindParameters.hudVisibilityTexture=this._renderContext.offscreenRenderingHelper.hudVisibilityTexture,e=this._renderInternalSlot(V.OCCLUSION_PIXELS)}),this._multipassTerrain&&!this._opaqueTerrain),e}_renderLineCallouts(e){this._bindParameters.renderTransparentlyOccludedHUD=e,e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderInternalSlot(V.LINE_CALLOUTS)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderInternalSlot(V.LINE_CALLOUTS)}_renderHUD(e,r){this._hasHUDElements&&(this._oitEnabled?(this._renderOrderIndependentTransparency((()=>this._renderHUDElements(e)),!0),this._rctx.bindFramebuffer(r),this._compositingHelper.composite(this._offscreenRendering.hudColorTexture,$.PremultipliedAlpha)):e===x.OCCLUDED?this._offscreenRendering.renderToTargets((()=>this._renderHUDElements(x.OCCLUDED)),this._offscreenRendering.currentColorTarget,this._offscreenRendering.tmpDepth,void 0,!0,!0):this._renderHUDElements(e))}_renderHUDElements(e){this._bindParameters.renderTransparentlyOccludedHUD=e,this._renderInternalSlot(V.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(V.HUD_MATERIAL),this._renderInternalSlot(V.LABEL_MATERIAL)}get needsHighlight(){return this._hasHighlights||this._renderPlugins.needsHighlight}get needsShadowHighlight(){return this._shadowMap.enabled&&this._shadowHighlightHelper.isVisible&&this.needsHighlight}_renderHighlights(e,r){if(!this.needsHighlight)return void this._offscreenRendering.disposeTarget(this._offscreenRendering.highlight);const t=this._highlightHelper,s=t.profilingCallback&&he(this._renderContext.rctx);this._renderContext.highlightDepthTexture=r.highlightDepthTexture;const n=this._offscreenRendering.renderToTargets((()=>{this._renderGeometryAndTransparentTerrainPass(G.MATERIAL_HIGHLIGHT),this._rctx.clearSafe(ne.DEPTH_BUFFER_BIT),this._renderHUDElements(x.BOTH)}),this._offscreenRendering.highlight,this._offscreenRendering.tmpDepth,[0,0,0,0],!0,!0);this._bindParameters.highlightColorTexture=n.colorTexture,this.needsShadowHighlight&&this._shadowHighlightHelper.render(r,e),t.render(this._renderContext.camera,n,e),a(s)&&t.profilingCallback&&s.stop((e=>{t.profilingCallback&&t.profilingCallback(e)}))}get needsShadowCast(){return this._shadowAccumulator.isAccumulating}_accumulateShadows(e,r,t){this.needsShadowCast&&(this._shadowAccumulator.setAccumulationDependencies(this._offscreenRendering.linearDepthTexture,e,r,t),this._shadowAccumulator.accumulateFixedSamples(),this.renderPassManager.shadowCastingEnabled=this._shadowMap.enabled)}_renderOrderIndependentTransparency(e,r){const t=t=>{this._renderContext.transparencyPassType=t,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._offscreenRendering.renderOITPass((()=>e()),t,r)},s=this._renderContext.pass;this._renderContext.pass=G.MATERIAL_ALPHA,t(w.Alpha),this._renderContext.pass=G.MATERIAL,t(w.Color),t(w.FrontFace),this._offscreenRendering.compositeTransparentOntoOpaque(r),this._renderContext.transparencyPassType=w.NONE,this._bindParameters.transparencyPassType=this._renderContext.transparencyPassType,this._renderContext.pass=s,this._oitUsed=!0}_disposeOITBuffers(){this._oitUsed||(this._offscreenRendering.disposeTarget(this._offscreenRendering.alphaFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.colorFloatTarget),this._offscreenRendering.disposeTarget(this._offscreenRendering.frontFaceTarget)),this._oitUsed=!1}_renderOccluded(){let e=0;this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&t.renderOccluded===v.OccludeAndTransparentStencil&&(e|=t.renderOccluded,pe.push(t))}));const r=this._offscreenRendering,t=(t,s,n,i,a)=>{0!=(e&s)&&(r.renderToTargets(n,r.tmpColor,r.mainDepth,[0,0,0,0],i,a),r.compositeOccludedOntoMain(t))};0!==pe.length&&(this._renderInternalSlot(V.OCCLUDER_MATERIAL,pe),t(.5,v.OccludeAndTransparentStencil,(()=>this._renderInternalSlot(V.TRANSPARENT_OCCLUDER_MATERIAL,pe)),!1,!1),pe.length=0),this._materialRenderers.forEach(((r,t)=>{t&&t.isVisible()&&(t.renderOccluded===v.OccludeAndTransparent||t.renderOccluded===v.Transparent||t.renderOccluded===v.Opaque)&&(e|=t.renderOccluded,_e.push(t))}));const s=this._renderPlugins.renderOccludedFlags;if(e|=s,!e)return;const n=e=>{this._renderContext.renderOccludedMask=e,s>v.Occlude&&this._renderSlot(V.OCCLUDED_TERRAIN),this._renderInternalSlot(V.OPAQUE_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_MATERIAL,_e),this._renderInternalSlot(V.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,_e),this._renderContext.resetRenderOccludedMask()};this._renderContext.pass=G.MATERIAL,t(.5,v.OccludeAndTransparent,(()=>n(v.OccludeAndTransparent)),!0,D.OutlineVisualElementMask),t(.5,v.Transparent,(()=>n(v.Transparent)),!0,D.OutlineVisualElementMask),t(1,v.Opaque,(()=>n(v.Opaque)),!0,D.OutlineVisualElementMask),_e.length=0}_renderAntiAliasing(e,r){if(e===b.SMAA){if(this._smaaPass.enable((()=>this._requestRender()))&&a(r))return this._smaaPass.render(r),!0}else this._smaaPass.disable();return!1}_ensureCameraBindParameters(e){this._renderContext.camera=e,this._bindParameters.camera=this._renderContext.camera,this._bindParameters.inverseViewport[0]=1/this._renderContext.camera.fullViewport[2],this._bindParameters.inverseViewport[1]=1/this._renderContext.camera.fullViewport[3]}_ensureBindParameters(e){var r;this._ensureCameraBindParameters(e);const t=this._renderContext.offscreenRenderingHelper;this._bindParameters.shadowMap=this._renderContext.shadowMap,this._bindParameters.shadowMappingEnabled=this._renderContext.shadowMap.enabled,this._bindParameters.ssaoHelper=this._renderContext.ssaoHelper,this._bindParameters.ssaoEnabled=this._renderContext.ssaoHelper.enabled,this._bindParameters.slicePlane=this._renderContext.sliceHelper.plane,this._bindParameters.hasOccludees=this._renderContext.hasOccludees,this._renderContext.multipassTerrainParams.camera=this._renderContext.camera,this._bindParameters.hudVisibilityTexture=t.hudVisibilityTexture,this._bindParameters.highlightDepthTexture=null!=(r=t.depthTexture)?r:this._getFallbackDepthTexture()}_ensureBindParametersSSR(){this.hasWaterReflection?(this._renderContext.lastFrameCamera.equals(this._renderContext.camera)?this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=f:(m(ce,this._renderContext.lastFrameCamera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),m(ue,this._renderContext.camera.viewMatrix,this._bindParameters.origin?this._bindParameters.origin:[0,0,0]),u(ue,ue),u(me,this._renderContext.camera.projectionMatrix),g(ge,ue,me),g(ge,ce,ge),g(ge,this._renderContext.lastFrameCamera.projectionMatrix,ge),this._renderContext.ssrParams.reprojectionMatrix=this._reprojectionMatrix=ge),this._renderContext.ssrParams.camera=this._renderContext.camera,this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=this._offscreenRendering.lastFrameColorTexture):this._renderContext.ssrParams.lastFrameColorTexture=this._bindParameters.lastFrameColorTexture=null,this._renderContext.ssrParams.ssrEnabled=this._bindParameters.ssrEnabled=this.hasWaterReflection}_ensureBindParametersCloudsReflections(){this._bindParameters.cloudsCompositionParams=this._renderContext.cloudsCompositionParams}_renderInternalSlot(e,r){let t=!1;return this._bindParameters.slot=e,a(r)?r.forEach((r=>{if(!r.shouldRender(this._renderContext))return;const s=this._materialRenderers.get(r);a(s)&&(t=s.render(e,this._renderContext.pass,this._bindParameters)||t)})):this._materialRenderers.forEach(((r,s)=>{s.shouldRender(this._renderContext)&&(t=r.render(e,this._renderContext.pass,this._bindParameters)||t)})),t}_getFallbackDepthTexture(){return this._fallbackDepthStencilTexture||(this._fallbackDepthStencilTexture=y(this._rctx)),this._fallbackDepthStencilTexture}get gpuMemoryUsage(){var e,r,t,s,n,i,a,h,o,d;return{offscreen:null!=(e=null==(r=this._offscreenRendering)?void 0:r.gpuMemoryUsage)?e:0,highlights:(null!=(t=null==(s=this._highlightHelper)?void 0:s.gpuMemoryUsage)?t:0)+(null!=(n=null==(i=this._shadowHighlightHelper)?void 0:i.gpuMemoryUsage)?n:0),shadows:null!=(a=null==(h=this._shadowMap)?void 0:h.gpuMemoryUsage)?a:0,ssao:null!=(o=null==(d=this._ssaoHelper)?void 0:d.gpuMemoryUsage)?o:0}}get test(){const e=this;return{offscreen:this._offscreenRendering,shadowMap:this._shadowMap,ssao:this._ssaoHelper,highlight:this._highlightHelper,lighting:this._lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,getFramebufferTexture:r=>{var t;switch(r){case le.Color:return e._offscreenRendering.colorTexture;case le.LinearDepth:return e._offscreenRendering.linearDepthTexture;case le.Normals:return e._offscreenRendering.normalTexture;case le.ShadowMap:return null==(t=e._shadowMap)?void 0:t.test.depthTexture;case le.HudVisibility:return e._offscreenRendering.hudVisibilityTexture;case le.Highlight:return e._offscreenRendering.highlightTexture}}}}};var le;e([_()],de.prototype,"_shadowAccumulator",void 0),e([_()],de.prototype,"_smaaPass",void 0),e([_()],de.prototype,"_antialiasing",void 0),e([_()],de.prototype,"_edgeView",void 0),e([_()],de.prototype,"updating",null),e([_()],de.prototype,"isCameraFinal",null),de=e([p("esri.views.3d.webgl-engine.lib.Renderer")],de),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.Normals=2]="Normals",e[e.ShadowMap=3]="ShadowMap",e[e.HudVisibility=4]="HudVisibility",e[e.Highlight=5]="Highlight"}(le||(le={}));const _e=[],pe=[],ce=T(),me=T(),ue=T(),ge=T();export{le as FramebufferId,de as Renderer};
package/views/MapView.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import n from"../core/CollectionFlattener.js";import r from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as h,isNone as p,unwrap as d}from"../core/maybe.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{watch as c,whenOnce as m,sync as g,syncAndInitial as y}from"../core/reactiveUtils.js";import{createScreenPoint as w}from"../core/screenUtils.js";import{initialize as f}from"../core/workers/workers.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import V from"../geometry/Extent.js";import T from"../geometry/Point.js";import{canProject as b,project as S}from"../geometry/support/webMercatorUtils.js";import M from"../layers/support/TileInfo.js";import{BreakpointsOwner as x}from"./BreakpointsOwner.js";import{DOMContainer as O}from"./DOMContainer.js";import{PopupView as R}from"./PopupView.js";import j from"./View.js";import z from"./ViewAnimation.js";import k from"./2d/AnimationManager.js";import L from"./2d/FrameTask.js";import{layerView2DImporter as E}from"./2d/layerViewModuleImportUtils.js";import C from"./2d/MapViewConstraints.js";import G from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import I from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as N,setExtent as P,rotateTo as q,scaleTo as D,copy as U,createAsync as A,extentToScale as W,resize as $}from"./2d/viewpointUtils.js";import F from"./2d/input/MapViewInputManager.js";import H from"./2d/layers/features/support/TileStore.js";import J from"./2d/support/HighlightOptions.js";import{Timeline as B}from"./2d/support/Timeline.js";import Q from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as Z,getFormatAndQuality as K}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as X,createScreenPointFromSupportedEvent as Y}from"./support/screenUtils.js";import{check as tt}from"./support/WebGLRequirements.js";import et from"./ui/2d/DefaultUI2D.js";import it from"../webmap/background/ColorBackground.js";const st=l.getLogger("esri.views.MapView");let nt,rt,at,ot,lt,ht;async function pt(){const[,{GraphicsView2D:t,GraphicContainer:e,LabelManager:i,MapViewNavigation:s,MagnifierView2D:n,Stage:r}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);rt=t,at=e,ot=i,lt=s,ht=n,nt=r}const dt=160;function ut(t){return t&&"esri.Viewpoint"===t.declaredClass}let ct=class extends(x(O(R(j)))){constructor(t){super(t),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new n({getCollections:()=>{var t,e;return[null==(t=this.basemapView)?void 0:t.baseLayerViews,this.layerViews,null==(e=this.basemapView)?void 0:e.referenceLayerViews]},getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new L(this),this.floors=new s,this.highlightOptions=new J,this.inputManager=new F({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!0,this.timeline=new B,this.type="2d",this.ui=new et,this.constraints=new C,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([c((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(dt)}),g),this.on("resize",(t=>this._resizeHandler(t))),c((()=>{var t;return null==(t=this.animationManager)?void 0:t.animation}),(t=>{this.animation=t}))]),f()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new H(this.featuresTilingScheme)}get initialExtentRequired(){var t;const{scale:e,constraints:i,spatialReference:s}=this,n=this._normalizeInput(this.center,s),r=this._normalizeInput(this.viewpoint,s),a=this._normalizeInput(this.extent,s);let o=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&null!=(t=this.map.initialViewProperties)&&t.viewpoint)&&(!a&&(null!=i&&i.effectiveLODs||(o=-1),(!n||0===e&&-1===o)&&(!r||!h(r.targetGeometry)||"extent"!==r.targetGeometry.type&&!r.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1}}}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t),this.frameTask.animationInProgress=!0;const i=()=>{t===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};t.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(t){void 0===t?this._clearOverride("background"):this._override("background",t)}get center(){if(!this.ready)return this._get("center");const{center:t,spatialReference:e}=this.state.paddedViewState;return new T({x:t[0],y:t[1],spatialReference:e})}set center(t){if(null==t)return;if(!this._normalizeInput(t,this.spatialReference))return void st.error("#center",`incompatible spatialReference ${JSON.stringify(t.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`);if(!this.ready)return this._set("center",t),void this.notifyChange("initialExtentRequired");const e=this.viewpoint;N(e,e,t),this.viewpoint=e}set constraints(t){const e=this._get("constraints");e&&(this.handles.remove("map-view-constraints"),e.destroy()),this._set("constraints",t),t&&(t.view=this,this.ready&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint)),this.handles.add(t.on("update",(()=>{this.ready&&this.state&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint))})),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(t){if(null==t)return;const e=this._normalizeInput(t,this.spatialReference);if(!e)return void st.error("#center",`incompatible spatialReference ${JSON.stringify(t.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`);if(!e.width||!e.height)return void st.error("#extent","invalid extent size");if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");const i=this.viewpoint;P(i,i,e,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(t){this.ready?(this.state.padding=t,this._set("padding",this.state.padding)):this._set("padding",t)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(t){if(isNaN(t))return;if(!this.ready)return void this._set("rotation",t);const e=this.viewpoint;q(e,e,t),this.viewpoint=e}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(t){if(!t||isNaN(t))return;if(!this.ready){this._set("scale",t),this._set("zoom",-1);const e=this._get("extent");return e&&(this._set("extent",null),this._set("center",e.center)),void this.notifyChange("initialExtentRequired")}const e=this.viewpoint;D(e,e,t),this.viewpoint=e}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((t=>!t.destroyed&&!("layerViews"in t)&&!0===t.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const t=this.state.paddedViewState;return t&&t.viewpoint.clone()}set viewpoint(t){if(null==t)return;const e=this._normalizeInput(t,this.spatialReference);if(!e)return void(!t.scale||isNaN(t.scale)?st.error("#viewpoint",`invalid scale value of ${t.scale}`):p(t.targetGeometry)?st.error("#viewpoint","geometry not defined"):st.error("#viewpoint",`incompatible spatialReference ${JSON.stringify(t.targetGeometry.spatialReference)} with view's spatialReference ${JSON.stringify(this.spatialReference)}`));if(!this.ready)return this._set("viewpoint",e),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");const s=new i({targetGeometry:new T,scale:0,rotation:0});U(s,e),this.constraints.constrain(s,this.state.paddedViewState.viewpoint),this.state.viewpoint=s,this.frameTask.requestFrame(),this._set("viewpoint",s)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(t){if(null==t)return;if(!this.ready){this.notifyChange("initialExtentRequired"),this._set("zoom",t),this._set("scale",0);const e=this._get("extent");e&&(this._set("extent",null),this._set("center",e.center))}if(!this.constraints.effectiveLODs)return;const e=this.viewpoint;D(e,e,this.constraints.zoomToScale(t)),this.viewpoint=e,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(t,e){if(t)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),e).then((()=>{const i={animate:!0,...e},s=A(t,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));st.error("#goTo()","target cannot be null or undefined")}async hitTest(t,e){const i=X(t)?Y(this,t):t;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,n=!1,r=null,a=null;null!=e&&e.include?wt(e.include,yt(this,(t=>s.add(t)),(t=>{r||(r=new Set),r.add(t)}),(t=>s.add(t)),(()=>n=!0))):(n=!0,s=new Set(this.allLayerViews)),null!=e&&e.exclude&&wt(e.exclude,yt(this,(t=>s.delete(t)),(t=>{a||(a=new Set),a.add(t)})));const o=this.allLayerViews.filter((t=>!t.suspended&&s.has(t))).reverse(),l=this.toMap(i);let p=(await Promise.all([n?this.graphicsView.hitTest(l):null,...o.map((t=>t.hitTest(l,i)))])).filter(h).flat();return r&&(p=p.filter((t=>r.has(gt(t))))),a&&(p=p.filter((t=>!a.has(gt(t))))),{screenPoint:i,results:p.map((t=>({mapPoint:l,graphic:t})))}}takeScreenshot(t){t=t||{};const e=this.supersampleScreenshotsEnabled?Math.min(4,Z(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;t.layers?(i=[],t.layers.forEach((t=>{const e=this.allLayerViews.find((e=>e.layer.id===t.id));e&&"container"in e&&e.container&&i.push(e.container)}))):i=this._stage.children;const{format:s,quality:n}=K(t.format,t.quality),r=Q(t,e,this.size,this.padding,s,n,i,t.rotation);return this._stage.takeScreenshot(r)}toMap(t){if(!this.ready)return null;const e=X(t)?Y(this,t):t,i=[0,0],[s,n]=this.state.toMap(i,[e.x,e.y]),r=this.spatialReference;return new T({x:s,y:n,spatialReference:r})}toScreen(t){if(!this.ready)return null;const e=this._normalizeInput(t,this.spatialReference),i=[e.x,e.y];return this.state.toScreen(i,i),w(i[0],i[1])}on(t,e,i,s){const n=this.inputManager&&this.viewEvents.on(t,e,i,s);return n||super.on(t,e)}hasEventListener(t){return super.hasEventListener(t)||this.viewEvents.hasHandler(t)}whenLayerView(t){return super.whenLayerView(t)}graphicChanged(t){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(t)}}whenReady(){return new Promise((t=>{this.ready?t(this):this._resolveWhenReady.push(t)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var t,e,i;return this.map&&"initialViewProperties"in this.map&&(null==(t=this.map)||null==(e=t.initialViewProperties)?void 0:e.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}getSpatialReferenceSupport({layer:t}){return t||this._get("ready")||null!==this._getDefaultViewpoint()?{}:null}hasLayerViewModule(t){return E.hasLayerViewModule(t)}importLayerView(t){return E.importLayerView(t)}pixelSizeAt(){return this.ready?this.state.resolution:(st.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(t){return this.hitTest(t).then((e=>({...e,mapPoint:this.toMap(t)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let t=tt(this.type);return a("safari")&&a("safari")<9&&(t=new r("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),h(t)?(st.warn("#validate()",t.message),Promise.reject(t)):pt()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new z),this.animation}_cancellableGoTo(t,e,i){const s=()=>t===this._gotoTask,n=i.then((()=>{s()&&(this.animation=null)})).catch((t=>{throw s()&&(this.animation=null,e.done||(e.stop(),this.frameTask.animationInProgress=!1)),t})),r=new Promise((t=>t(n)));return e.when().catch((()=>{s()&&r.cancel&&r.cancel()})),r}_gotoImmediate(t,e){const i=this._gotoTask,s=this.animation,n=t.then((t=>{if(u(e),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=t,s.finish()}));return this._cancellableGoTo(i,s,n)}_flipStationary(t){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const t=performance.now()-this._lastStationaryEventTimestamp;t<dt&&(this._stationaryTimer=this._flipStationary(t))}),t)),this._stationaryTimer}_getDefaultViewpoint(){var t,e,s,n;const{constraints:r,spatialReference:a}=this,o=this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties,l={zoom:this._get("zoom"),scale:this._get("scale"),center:this._normalizeInput(this._get("center"),a),extent:this._normalizeInput(this._get("extent"),a),rotation:this._get("rotation"),viewpoint:this._normalizeInput(this._get("viewpoint"),a),spatialReference:this._userSpatialReference};r.effectiveLODs?-1!==l.zoom&&(l.scale=r.zoomToScale(l.zoom)):l.zoom=-1;let p=null,u=null,c=0;const m=l.viewpoint&&l.viewpoint.rotation,g=l.viewpoint&&l.viewpoint.targetGeometry;h(g)&&("extent"===g.type?p=g:"point"===g.type&&(u=g,c=l.viewpoint.scale));const y=this._normalizeInput(null==(t=d(null==o||null==(e=o.viewpoint)?void 0:e.targetGeometry))?void 0:t.extent,a),w=this._normalizeInput(this.initialExtent,a),f=l.extent||p||y||w,v=l.center||u||f&&f.center,_=null==o||null==(s=o.viewpoint)?void 0:s.scale,V=l.scale||c||_||f&&W(f,this.size),T=null==o||null==(n=o.viewpoint)?void 0:n.rotation,b=l.rotation||m||T||0;return v&&V?new i({targetGeometry:v,scale:V,rotation:b}):null}_gotoAnimated(t,e){const i=this._gotoTask,s=this.animation,n=t.then((t=>{if(u(e),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");return s.update(t),this.animationManager.animate(s,this.viewpoint,e),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,n)}_normalizeInput(t,e){const i=t&&t.targetGeometry||t;return e?i?e.equals(i.spatialReference)?t:b(i,e)?ut(t)?(t.targetGeometry=S(i,e),t):S(i,e):null:null:t}_resizeHandler(t){const e=this.state;if(!e)return;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();e.size=[t.width,t.height],$(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){this.timeline.begin("MapView Startup");const t=this._getDefaultViewpoint();this.constraints.view=this,this.constraints.fit(t),this._set("animationManager",new k({view:this})),this._set("state",new G({padding:this._get("padding"),size:this.size,viewpoint:t})),this._set("featuresTilingScheme",new I(M.create({spatialReference:this.spatialReference,size:512,numLODs:36}))),this._set("ready",!0),this.frameTask&&this.frameTask.start(),this.graphics.owner=this;const e={disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},i=new nt(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:e,renderingOptions:this.renderingOptions,timeline:this.timeline}),s=new rt({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new at(this.featuresTilingScheme)}),n=new lt({view:this,animationManager:this.animationManager}),r=new ot({view:this});this._magnifierView=new ht,this._magnifierView.magnifier=this.magnifier,this._stage=i,this.frameTask.graphicsView=s,this._set("graphicsView",s),this._set("mapViewNavigation",n),this._set("labelManager",r),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("post-render",(()=>this._set("rendering",i.renderRequested))),i.on("will-render",(()=>this._set("rendering",i.renderRequested))),i.on("webgl-error",(t=>this.fatalError=t.error)),c((()=>this.stationary),(t=>i.stationary=t),y),c((()=>this.state.id),(()=>i.state=this.state),y),c((()=>this.background),(t=>{i.background=t,this._magnifierView.background=t}),y),c((()=>this.magnifier),(t=>this._magnifierView.magnifier=t),y),c((()=>this.renderingOptions),(t=>i.renderingOptions=t),y),c((()=>this.highlightOptions),(t=>i.highlightOptions=t),y)],"map-view"),i.state=this.state,this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((t=>t(this))),this.timeline.end("MapView Startup")}_teardown(){this.handles.remove("map-view"),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy();this.graphicsView.destroy(),this.mapViewNavigation.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._set("ready",!1),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null);const{center:[t,e],spatialReference:i,rotation:s,scale:n}=this.state.paddedViewState,r=new T({x:t,y:e,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",r),this._set("zoom",-1),this._set("rotation",s),this._set("scale",n),this._set("spatialReference",i),this.constraints.view=null,this.animationManager.destroy(),this._set("animationManager",null),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((t=>{this._stage.addChild(t.container)}));const t=this.graphicsView;this._stage.addChild(t.container),this._stage.addChild(this._magnifierView)}};t([v({readOnly:!0})],ct.prototype,"animationManager",void 0),t([v({constructOnly:!0})],ct.prototype,"deactivatedWebGLExtensions",void 0),t([v({constructOnly:!0})],ct.prototype,"debugWebGLExtensions",void 0),t([v({readOnly:!0})],ct.prototype,"featuresTilingScheme",void 0),t([v({readOnly:!0})],ct.prototype,"fullOpacity",void 0),t([v({readOnly:!0})],ct.prototype,"graphicsTileStore",null),t([v()],ct.prototype,"graphicsView",void 0),t([v({readOnly:!0})],ct.prototype,"state",void 0),t([v()],ct.prototype,"initialExtentRequired",null),t([v()],ct.prototype,"labelManager",void 0),t([v({readOnly:!0})],ct.prototype,"resourceManager",null),t([v({readOnly:!0})],ct.prototype,"textureManager",null),t([v({readOnly:!0})],ct.prototype,"mapViewNavigation",void 0),t([v({constructOnly:!0})],ct.prototype,"renderCanvas",void 0),t([v()],ct.prototype,"renderingOptions",void 0),t([v({readOnly:!0})],ct.prototype,"rendering",void 0),t([v({constructOnly:!0})],ct.prototype,"supersampleScreenshotsEnabled",void 0),t([v({readOnly:!0})],ct.prototype,"supportsGround",void 0),t([v()],ct.prototype,"_stationaryTimer",void 0),t([v()],ct.prototype,"_defaultsFromMapSettings",null),t([v()],ct.prototype,"animation",null),t([v({type:it})],ct.prototype,"background",null),t([v({value:null,type:T,dependsOn:["state.id","ready"]})],ct.prototype,"center",null),t([v({type:C})],ct.prototype,"constraints",null),t([v({value:null,type:V,dependsOn:["state.id","ready"]})],ct.prototype,"extent",null),t([v()],ct.prototype,"floors",void 0),t([v({type:J})],ct.prototype,"highlightOptions",void 0),t([v({readOnly:!0})],ct.prototype,"inputManager",void 0),t([v()],ct.prototype,"map",void 0),t([v({value:{top:0,right:0,bottom:0,left:0},cast:t=>({top:0,right:0,bottom:0,left:0,...t})})],ct.prototype,"padding",null),t([v()],ct.prototype,"resizeAlign",void 0),t([v({readOnly:!0,dependsOn:["state.id"]})],ct.prototype,"resolution",null),t([v({value:0,type:Number,dependsOn:["state.id","ready"]})],ct.prototype,"rotation",null),t([v({value:0,type:Number,dependsOn:["state.id","ready"]})],ct.prototype,"scale",null),t([v({constructOnly:!0})],ct.prototype,"spatialReferenceLocked",void 0),t([v()],ct.prototype,"stationary",null),t([v({type:B,readOnly:!0})],ct.prototype,"timeline",void 0),t([v({readOnly:!0})],ct.prototype,"type",void 0),t([v({readOnly:!0})],ct.prototype,"updating",null),t([v({value:null,type:i,dependsOn:["state.id","ready"]})],ct.prototype,"viewpoint",null),t([v({value:-1,dependsOn:["state.id"]})],ct.prototype,"zoom",null),t([v({type:Boolean})],ct.prototype,"navigating",null),t([v({type:et})],ct.prototype,"ui",void 0),ct=t([_("esri.views.MapView")],ct);const mt=ct;function gt(t){const e=t.getObjectId();var i,s,n,r;return e?`${null!=(i=null!=(s=null==(n=t.layer)?void 0:n.uid)?s:null==(r=t.sourceLayer)?void 0:r.uid)?i:"MapView"}/${e}`:`"MapView/${t.uid}`}function yt(t,i,s,n,r){return a=>{if(a instanceof e){if(a.layer===t)null==r||r();else{const e=t.allLayerViews.find((t=>t.layer===a.layer));e&&(null==n||n(e))}s(gt(a))}else{const e=t.allLayerViews.find((t=>t.layer===a));e&&i(e)}}}function wt(t,e){if(t)if(o(t))for(const i of t)if(o(i))for(const t of i)e(t);else e(i);else e(t)}export{mt as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import e from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import n from"../core/CollectionFlattener.js";import r from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as h,unwrap as p,isNone as d}from"../core/maybe.js";import{throwIfAborted as c}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as y}from"../core/reactiveUtils.js";import{createScreenPoint as w}from"../core/screenUtils.js";import{initialize as f}from"../core/workers/workers.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import V from"../geometry/Extent.js";import T from"../geometry/Point.js";import{load as b,canProjectWithoutEngine as j,project as S,isLoaded as M}from"../geometry/projection.js";import x from"../layers/support/TileInfo.js";import{BreakpointsOwner as O}from"./BreakpointsOwner.js";import{DOMContainer as R}from"./DOMContainer.js";import{PopupView as k}from"./PopupView.js";import L from"./View.js";import z from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import P from"./2d/FrameTask.js";import{layerView2DImporter as C}from"./2d/layerViewModuleImportUtils.js";import G from"./2d/MapViewConstraints.js";import q from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import N from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as D,setExtent as U,rotateTo as I,scaleTo as A,copy as W,create as F,extentToScale as H,resize as $}from"./2d/viewpointUtils.js";import B from"./2d/input/MapViewInputManager.js";import Q from"./2d/layers/features/support/TileStore.js";import Z from"./2d/support/HighlightOptions.js";import{Timeline as K}from"./2d/support/Timeline.js";import J from"./support/createScreenshotPlan.js";import{getMaximumResolutionScale as X,getFormatAndQuality as Y}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as tt,createScreenPointFromSupportedEvent as et}from"./support/screenUtils.js";import{check as it}from"./support/WebGLRequirements.js";import st from"./ui/2d/DefaultUI2D.js";import nt from"../webmap/background/ColorBackground.js";const rt=l.getLogger("esri.views.MapView");let at,ot,lt,ht,pt,dt;async function ct(){const[,{GraphicsView2D:t,GraphicContainer:e,LabelManager:i,MapViewNavigation:s,MagnifierView2D:n,Stage:r}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);ot=t,lt=e,ht=i,pt=s,dt=n,at=r}const ut=160;function mt(t){return t&&"esri.Viewpoint"===t.declaredClass}let gt=class extends(O(R(k(L)))){constructor(t){super(t),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new n({getCollections:()=>{var t,e;return[null==(t=this.basemapView)?void 0:t.baseLayerViews,this.layerViews,null==(e=this.basemapView)?void 0:e.referenceLayerViews]},getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new P(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new Z,this.inputManager=new B({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!0,this.timeline=new K,this.type="2d",this.ui=new st,this.constraints=new G,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(ut)}),g),this.on("resize",(t=>this._resizeHandler(t))),u((()=>{var t;return null==(t=this.animationManager)?void 0:t.animation}),(t=>{this.animation=t}))]),f()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new Q(this.featuresTilingScheme)}get initialExtentRequired(){var t;const{scale:e,constraints:i,center:s,viewpoint:n,extent:r}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&null!=(t=this.map.initialViewProperties)&&t.viewpoint)&&(!r&&(null!=i&&i.effectiveLODs||(a=-1),(!s||0===e&&-1===a)&&(!n||!h(n.targetGeometry)||"extent"!==n.targetGeometry.type&&!n.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!M()||(this._pePromise||(this._pePromise=b().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const t=this._getDefaultViewpoint();if(!t)return!1;const e=this.spatialReference,i=p(t.targetGeometry);return!!j(i.spatialReference,e)||this._projectionEngineLoaded}set animation(t){const e=this._get("animation");if(t===e)return;if(e&&e.stop(),!t||t.isFulfilled())return void this._set("animation",null);this._set("animation",t),this.frameTask.animationInProgress=!0;const i=()=>{t===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};t.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(t){void 0===t?this._clearOverride("background"):this._override("background",t)}get center(){if(!this.ready)return this._get("center");const{center:t,spatialReference:e}=this.state.paddedViewState;return new T({x:t[0],y:t[1],spatialReference:e})}set center(t){if(null==t)return;if(!this.ready)return this._set("center",t),void this.notifyChange("initialExtentRequired");let e;try{e=this._project(t,this.spatialReference)}catch(s){rt.error(new r("mapview:invalid-center","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;D(i,i,e),this.viewpoint=i}set constraints(t){const e=this._get("constraints");e&&(this.handles.remove("map-view-constraints"),e.destroy()),this._set("constraints",t),t&&(t.view=this,this.ready&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>t.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=t.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(t){if(null==t)return;if(!t.width||!t.height)return void rt.error(new r("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",t),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let e;try{e=this._project(t,this.spatialReference)}catch(s){rt.error(new r("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;U(i,i,e,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(t){this.ready?(this.state.padding=t,this._set("padding",this.state.padding)):this._set("padding",t)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(t){if(isNaN(t))return;if(!this.ready)return void this._set("rotation",t);const e=this.viewpoint;I(e,e,t),this.viewpoint=e}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(t){if(!t||isNaN(t))return;if(!this.ready){this._set("scale",t),this._set("zoom",-1);const e=this._get("extent");return e&&(this._set("extent",null),this._set("center",e.center)),void this.notifyChange("initialExtentRequired")}const e=this.viewpoint;A(e,e,t),this.viewpoint=e}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((t=>!t.destroyed&&!("layerViews"in t)&&!0===t.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const t=this.state.paddedViewState;return t&&t.viewpoint.clone()}set viewpoint(t){if(null==t)return;if(!this.ready)return this._set("viewpoint",t),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let e,s;try{e=this._project(t,this.spatialReference),!t.scale||isNaN(t.scale)?s=new r("mapview:invalid-viewpoint",`invalid scale value of ${t.scale}`):d(t.targetGeometry)&&(s=new r("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new r("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void rt.error(s);const n=new i({targetGeometry:new T,scale:0,rotation:0});W(n,e),this.constraints.constrain(n,this.state.paddedViewState.viewpoint),this.state.viewpoint=n,this.frameTask.requestFrame(),this._set("viewpoint",n)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(t){if(null==t)return;if(!this.ready){this.notifyChange("initialExtentRequired"),this._set("zoom",t),this._set("scale",0);const e=this._get("extent");e&&(this._set("extent",null),this._set("center",e.center))}if(!this.constraints.effectiveLODs)return;const e=this.viewpoint;A(e,e,this.constraints.zoomToScale(t)),this.viewpoint=e,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(t,e){if(t)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),e).then((()=>{const i={animate:!0,...e},s=F(t,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));rt.error("#goTo()","target cannot be null or undefined")}async hitTest(t,e){const i=tt(t)?et(this,t):t;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,n=!1,r=null,a=null;null!=e&&e.include?vt(e.include,ft(this,(t=>s.add(t)),(t=>{r||(r=new Set),r.add(t)}),(t=>s.add(t)),(()=>n=!0))):(n=!0,s=new Set(this.allLayerViews)),null!=e&&e.exclude&&vt(e.exclude,ft(this,(t=>s.delete(t)),(t=>{a||(a=new Set),a.add(t)})));const o=this.allLayerViews.filter((t=>!t.suspended&&s.has(t))).reverse(),l=this.toMap(i);let p=(await Promise.all([n?this.graphicsView.hitTest(l):null,...o.map((t=>t.hitTest(l,i)))])).filter(h).flat();return r&&(p=p.filter((t=>r.has(wt(t))))),a&&(p=p.filter((t=>!a.has(wt(t))))),{screenPoint:i,results:p.map((t=>({mapPoint:l,graphic:t})))}}takeScreenshot(t){t=t||{};const e=this.supersampleScreenshotsEnabled?Math.min(4,X(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;t.layers?(i=[],t.layers.forEach((t=>{const e=this.allLayerViews.find((e=>e.layer.id===t.id));e&&"container"in e&&e.container&&i.push(e.container)}))):i=this._stage.children;const{format:s,quality:n}=Y(t.format,t.quality),r=J(t,e,this.size,this.padding,s,n,i,t.rotation);return this._stage.takeScreenshot(r)}toMap(t){if(!this.ready)return null;const e=tt(t)?et(this,t):t,i=[0,0],[s,n]=this.state.toMap(i,[e.x,e.y]),r=this.spatialReference;return new T({x:s,y:n,spatialReference:r})}toScreen(t){if(!this.ready)return null;const e=this._project(t,this.spatialReference),i=[e.x,e.y];return this.state.toScreen(i,i),w(i[0],i[1])}on(t,e,i,s){const n=this.inputManager&&this.viewEvents.on(t,e,i,s);return n||super.on(t,e)}hasEventListener(t){return super.hasEventListener(t)||this.viewEvents.hasHandler(t)}whenLayerView(t){return super.whenLayerView(t)}graphicChanged(t){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(t)}}whenReady(){return new Promise((t=>{this.ready?t(this):this._resolveWhenReady.push(t)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var t,e,i;return this.map&&"initialViewProperties"in this.map&&(null==(t=this.map)||null==(e=t.initialViewProperties)?void 0:e.spatialReference)||(null==(i=this.defaultsFromMap)?void 0:i.spatialReference)||null}hasLayerViewModule(t){return C.hasLayerViewModule(t)}importLayerView(t){return C.importLayerView(t)}pixelSizeAt(){return this.ready?this.state.resolution:(rt.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(t){return this.hitTest(t).then((e=>({...e,mapPoint:this.toMap(t)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let t=it(this.type);return a("safari")&&a("safari")<9&&(t=new r("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),h(t)?(rt.warn("#validate()",t.message),Promise.reject(t)):ct()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new z),this.animation}_cancellableGoTo(t,e,i){const s=()=>t===this._gotoTask,n=i.then((()=>{s()&&(this.animation=null)})).catch((t=>{throw s()&&(this.animation=null,e.done||(e.stop(),this.frameTask.animationInProgress=!1)),t})),r=new Promise((t=>t(n)));return e.when().catch((()=>{s()&&r.cancel&&r.cancel()})),r}_gotoImmediate(t,e){const i=this._gotoTask,s=this.animation,n=t.then((t=>{if(c(e),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=t,s.finish()}));return this._cancellableGoTo(i,s,n)}_flipStationary(t){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const t=performance.now()-this._lastStationaryEventTimestamp;t<ut&&(this._stationaryTimer=this._flipStationary(t))}),t)),this._stationaryTimer}_getDefaultViewpoint(){var t,e,s,n;const{constraints:r,initialExtent:a,map:o}=this;if(!r)return null;const l=o&&"initialViewProperties"in o&&o.initialViewProperties,d={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};r.effectiveLODs?-1!==d.zoom&&(d.scale=r.zoomToScale(d.zoom)):d.zoom=-1;let c=null,u=null,m=0;const g=d.viewpoint&&d.viewpoint.rotation,y=d.viewpoint&&d.viewpoint.targetGeometry;h(y)&&("extent"===y.type?c=y:"point"===y.type&&(u=y,m=d.viewpoint.scale));const w=d.extent||c||(null==(t=p(null==l||null==(e=l.viewpoint)?void 0:e.targetGeometry))?void 0:t.extent)||a,f=d.center||u||(null==w?void 0:w.center),v=d.scale||m||(null==l||null==(s=l.viewpoint)?void 0:s.scale)||w&&H(w,this.size),_=d.rotation||g||(null==l||null==(n=l.viewpoint)?void 0:n.rotation)||0;return f&&v?new i({targetGeometry:f,scale:v,rotation:_}):null}_gotoAnimated(t,e){const i=this._gotoTask,s=this.animation,n=t.then((t=>{if(c(e),i!==this._gotoTask)throw new r("view:goto-interrupted","Goto was interrupted");return s.update(t),this.animationManager.animate(s,this.viewpoint,e),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,n)}_project(t,e){const i=t&&t.targetGeometry||t;return e?i?e.equals(i.spatialReference)?t:mt(t)?(t.targetGeometry=S(i,e),t):S(i,e):null:t}_resizeHandler(t){if(!this.ready)return;const e=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();e.size=[t.width,t.height],$(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){this.timeline.begin("MapView Startup");const t=this._getDefaultViewpoint();t.targetGeometry=S(t.targetGeometry,this.spatialReference),this.constraints.view=this,this.constraints.fit(t),this._set("animationManager",new E({view:this})),this._set("state",new q({padding:this._get("padding"),size:this.size,viewpoint:t})),this._set("featuresTilingScheme",new N(x.create({spatialReference:this.spatialReference,size:512,numLODs:36}))),this._set("ready",!0),this.frameTask&&this.frameTask.start(),this.graphics.owner=this;const e={disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},i=new at(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:e,renderingOptions:this.renderingOptions,timeline:this.timeline}),s=new ot({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new lt(this.featuresTilingScheme)}),n=new pt({view:this,animationManager:this.animationManager}),r=new ht({view:this});this._magnifierView=new dt,this._magnifierView.magnifier=this.magnifier,this._stage=i,this.frameTask.graphicsView=s,this._set("graphicsView",s),this._set("mapViewNavigation",n),this._set("labelManager",r),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("post-render",(()=>this._set("rendering",i.renderRequested))),i.on("will-render",(()=>this._set("rendering",i.renderRequested))),i.on("webgl-error",(t=>this.fatalError=t.error)),u((()=>this.stationary),(t=>i.stationary=t),y),u((()=>this.state.id),(()=>i.state=this.state),y),u((()=>this.background),(t=>{i.background=t,this._magnifierView.background=t}),y),u((()=>this.magnifier),(t=>this._magnifierView.magnifier=t),y),u((()=>this.renderingOptions),(t=>i.renderingOptions=t),y),u((()=>this.highlightOptions),(t=>i.highlightOptions=t),y)],"map-view"),i.state=this.state,this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((t=>t(this))),this.timeline.end("MapView Startup")}_teardown(){this.handles.remove("map-view"),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy();this.graphicsView.destroy(),this.mapViewNavigation.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._set("ready",!1),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null);const{center:[t,e],spatialReference:i,rotation:s,scale:n}=this.state.paddedViewState,r=new T({x:t,y:e,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",r),this._set("zoom",-1),this._set("rotation",s),this._set("scale",n),this._set("spatialReference",i),this.constraints.view=null,this.animationManager.destroy(),this._set("animationManager",null),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((t=>{this._stage.addChild(t.container)}));const t=this.graphicsView;this._stage.addChild(t.container),this._stage.addChild(this._magnifierView)}};t([v({readOnly:!0})],gt.prototype,"animationManager",void 0),t([v({constructOnly:!0})],gt.prototype,"deactivatedWebGLExtensions",void 0),t([v({constructOnly:!0})],gt.prototype,"debugWebGLExtensions",void 0),t([v({readOnly:!0})],gt.prototype,"featuresTilingScheme",void 0),t([v({readOnly:!0})],gt.prototype,"fullOpacity",void 0),t([v({readOnly:!0})],gt.prototype,"graphicsTileStore",null),t([v()],gt.prototype,"graphicsView",void 0),t([v({readOnly:!0})],gt.prototype,"state",void 0),t([v()],gt.prototype,"initialExtentRequired",null),t([v()],gt.prototype,"labelManager",void 0),t([v({readOnly:!0})],gt.prototype,"resourceManager",null),t([v({readOnly:!0})],gt.prototype,"textureManager",null),t([v({readOnly:!0})],gt.prototype,"mapViewNavigation",void 0),t([v({constructOnly:!0})],gt.prototype,"renderCanvas",void 0),t([v()],gt.prototype,"renderingOptions",void 0),t([v({readOnly:!0})],gt.prototype,"rendering",void 0),t([v({constructOnly:!0})],gt.prototype,"supersampleScreenshotsEnabled",void 0),t([v({readOnly:!0})],gt.prototype,"supportsGround",void 0),t([v()],gt.prototype,"_stationaryTimer",void 0),t([v()],gt.prototype,"_defaultsFromMapSettings",null),t([v()],gt.prototype,"_pePromise",void 0),t([v({readOnly:!0})],gt.prototype,"typeSpecificPreconditionsReady",null),t([v()],gt.prototype,"animation",null),t([v({type:nt})],gt.prototype,"background",null),t([v({value:null,type:T,dependsOn:["state.id","ready"]})],gt.prototype,"center",null),t([v({type:G})],gt.prototype,"constraints",null),t([v({value:null,type:V,dependsOn:["state.id","ready"]})],gt.prototype,"extent",null),t([v()],gt.prototype,"floors",void 0),t([v({type:Z})],gt.prototype,"highlightOptions",void 0),t([v({readOnly:!0})],gt.prototype,"inputManager",void 0),t([v()],gt.prototype,"map",void 0),t([v({value:{top:0,right:0,bottom:0,left:0},cast:t=>({top:0,right:0,bottom:0,left:0,...t})})],gt.prototype,"padding",null),t([v()],gt.prototype,"resizeAlign",void 0),t([v({readOnly:!0,dependsOn:["state.id"]})],gt.prototype,"resolution",null),t([v({value:0,type:Number,dependsOn:["state.id","ready"]})],gt.prototype,"rotation",null),t([v({value:0,type:Number,dependsOn:["state.id","ready"]})],gt.prototype,"scale",null),t([v({constructOnly:!0})],gt.prototype,"spatialReferenceLocked",void 0),t([v()],gt.prototype,"stationary",null),t([v({type:K,readOnly:!0})],gt.prototype,"timeline",void 0),t([v({readOnly:!0})],gt.prototype,"type",void 0),t([v({readOnly:!0})],gt.prototype,"updating",null),t([v({value:null,type:i,dependsOn:["state.id","ready"]})],gt.prototype,"viewpoint",null),t([v({value:-1,dependsOn:["state.id"]})],gt.prototype,"zoom",null),t([v({type:Boolean})],gt.prototype,"navigating",null),t([v({type:st})],gt.prototype,"ui",void 0),gt=t([_("esri.views.MapView")],gt);const yt=gt;function wt(t){const e=t.getObjectId();var i,s,n,r;return e?`${null!=(i=null!=(s=null==(n=t.layer)?void 0:n.uid)?s:null==(r=t.sourceLayer)?void 0:r.uid)?i:"MapView"}/${e}`:`"MapView/${t.uid}`}function ft(t,i,s,n,r){return a=>{if(a instanceof e){if(a.layer===t)null==r||r();else{const e=t.allLayerViews.find((t=>t.layer===a.layer));e&&(null==n||n(e))}s(wt(a))}else{const e=t.allLayerViews.find((t=>t.layer===a));e&&i(e)}}}function vt(t,e){if(t)if(o(t))for(const i of t)if(o(i))for(const t of i)e(t);else e(i);else e(t)}export{yt as default};
package/views/View.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{makeHandle as p}from"../core/handleUtils.js";import d from"../core/Loadable.js";import h from"../core/Logger.js";import{isSome as y,destroyMaybe as u,abortMaybe as c}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{createTask as f,after as g}from"../core/promiseUtils.js";import{watch as w}from"../core/reactiveUtils.js";import{whenOnce as v,whenFalseOnce as M}from"../core/watchUtils.js";import{aliasOf as V}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import j from"../geometry/Extent.js";import F from"../geometry/HeightModelInfo.js";import O from"../geometry/SpatialReference.js";import{AnalysesCollection as L}from"../support/AnalysesCollection.js";import{GraphicsCollection as E}from"../support/GraphicsCollection.js";import{BasemapView as b}from"./BasemapView.js";import C from"./LayerViewManager.js";import x from"./Magnifier.js";import I from"./ToolViewManager.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import T from"./navigation/Navigation.js";import k from"./support/DefaultsFromMap.js";var z;const P=h.getLogger("esri.views.View");let U=z=class extends(l(n.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new s({getCollections:()=>{var e,t,i;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,null==(t=this.groundView)?void 0:t.layerViews,this.layerViews,null==(i=this.basemapView)?void 0:i.referenceLayerViews]},getChildrenFunction:e=>e.layerViews}),this.groundView=null,this.animation=null,this.basemapView=null,this.fatalError=null,this.extent=null,this.graphics=new E,this.analyses=new L,this.navigating=!1,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,this.magnifier=new x,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new T,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(this.watch("preconditionsReady",(e=>{var t,i;(e?(this._currentSpatialReference=this.spatialReference,z.views.add(this)):(this._currentSpatialReference=null,z.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready)?(null==(t=this.layerViewManager)||t.clear(),null==(i=this.toolViewManager)||i.detach(),y(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(y(this.analysisViewManager)&&this.analysisViewManager.attach(),this._startup(),this.toolViewManager.attach())}),!0))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,v(this,"ready"))))),this.basemapView=new b({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new I({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([w((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),w((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),w((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([w((()=>{var e;return null==(e=this.defaultsFromMap)?void 0:e.ready}),(t=>{var i;const r=(null==(i=this.map)?void 0:i.allLayers.length)>0;if(t&&!this.spatialReference&&r){if(y(e))return;const t=p((()=>e=c(e)));e=f((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}P.warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){if(this.destroyed)return;this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=u(this.graphics),this.analyses=u(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.toolViewManager=u(this.toolViewManager),this.layerViewManager=u(this.layerViewManager),this.basemapView=u(this.basemapView),this.invalidate(),this._emitter.clear(),this.handles.removeAll();const e=this.map;this.map=null,null==e||e.destroy()}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return P.error("#toMap()","Not implemented on this instance of View"),null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new k({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get preconditionsReady(){var e;return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this.typeSpecificPreconditionsReady||!this._validateSpatialReference(this.spatialReference)||!(this._currentSpatialReference||null!=(e=this.defaultsFromMap)&&e.ready))}set map(e){var t;e!==this._get("map")&&(null!=(t=e)&&t.destroyed&&(P.warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.initialized&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){var e,t;let i=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return i&&null!=(e=this.defaultsFromMap)&&null!=(t=e.required)&&t.heightModelInfo&&(i=i.clone(),i.vcsWkid=this.defaultsFromMap.vcsWkid,i.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),i}set spatialReference(e){this._userSpatialReference=e,this._set("spatialReference",e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get initialExtent(){var e;return null==(e=this.defaultsFromMap)?void 0:e.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return y(e)?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager.whenLayerView(e)}getDefaultSpatialReference(){var e;return null==(e=this.defaultsFromMap)?void 0:e.spatialReference}getDefaultHeightModelInfo(){var e,t,i;return null!=(e=null!=(t=this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)?t:null==(i=this.defaultsFromMap)?void 0:i.heightModelInfo)?e:null}importLayerView(e){throw new o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{}}_validateSpatialReference(e){return y(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&P.warn("#when()",'Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use watchUtils.whenOnce(view, "ready").then(...) instead.'),super.when(e,t)}forceReadyCycle(){this.ready&&(M(this,"preconditionsReady",(()=>this._readyCycleForced=!1)),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};U.views=new a,e([R()],U.prototype,"_userSpatialReference",void 0),e([V("toolViewManager.activeTool")],U.prototype,"activeTool",void 0),e([R({readOnly:!0})],U.prototype,"allLayerViews",void 0),e([R()],U.prototype,"groundView",void 0),e([R()],U.prototype,"animation",void 0),e([R()],U.prototype,"basemapView",void 0),e([R({readOnly:!0})],U.prototype,"_defaultsFromMapSettings",null),e([R()],U.prototype,"defaultsFromMap",null),e([R()],U.prototype,"fatalError",void 0),e([R({type:j})],U.prototype,"extent",void 0),e([R(S(E,"graphics"))],U.prototype,"graphics",void 0),e([R(S(L,"analyses"))],U.prototype,"analyses",void 0),e([R({readOnly:!0,type:F})],U.prototype,"heightModelInfo",null),e([R({readOnly:!0})],U.prototype,"interacting",null),e([R({readOnly:!0})],U.prototype,"navigating",void 0),e([R({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],U.prototype,"preconditionsReady",null),e([R({readOnly:!0})],U.prototype,"typeSpecificPreconditionsReady",void 0),e([R({type:a,readOnly:!0})],U.prototype,"layerViews",void 0),e([R({type:x})],U.prototype,"magnifier",void 0),e([R({value:null,type:t})],U.prototype,"map",null),e([R()],U.prototype,"padding",void 0),e([R({readOnly:!0})],U.prototype,"ready",void 0),e([R({type:O})],U.prototype,"spatialReference",null),e([R()],U.prototype,"spatialReferenceWarningDelay",void 0),e([R()],U.prototype,"stationary",null),e([R({readOnly:!0})],U.prototype,"supportsGround",void 0),e([R({type:i})],U.prototype,"timeExtent",void 0),e([V("toolViewManager.tools")],U.prototype,"tools",void 0),e([R()],U.prototype,"toolViewManager",void 0),e([R({readOnly:!0})],U.prototype,"type",void 0),e([R({type:Number})],U.prototype,"scale",void 0),e([R({readOnly:!0})],U.prototype,"updating",void 0),e([R({readOnly:!0})],U.prototype,"initialExtentRequired",void 0),e([R({readOnly:!0})],U.prototype,"initialExtent",null),e([R()],U.prototype,"cursor",null),e([R({readOnly:!0})],U.prototype,"input",void 0),e([R({type:T,nonNullable:!0})],U.prototype,"navigation",void 0),e([R()],U.prototype,"layerViewManager",void 0),e([R()],U.prototype,"analysisViewManager",void 0),e([R()],U.prototype,"width",void 0),e([R()],U.prototype,"height",void 0),e([R({readOnly:!0})],U.prototype,"resizing",void 0),e([R({value:null,readOnly:!0})],U.prototype,"size",null),e([R({readOnly:!0})],U.prototype,"suspended",void 0),e([R({readOnly:!0})],U.prototype,"viewEvents",void 0),e([R({readOnly:!0})],U.prototype,"persistableViewModels",void 0),e([R()],U.prototype,"_isValid",void 0),e([R()],U.prototype,"_readyCycleForced",void 0),e([R()],U.prototype,"_currentSpatialReference",void 0),U=z=e([_("esri.views.View")],U);const W=U;export{W as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{makeHandle as p}from"../core/handleUtils.js";import d from"../core/Loadable.js";import h from"../core/Logger.js";import{isSome as y,destroyMaybe as u,abortMaybe as c}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{createTask as f,after as g}from"../core/promiseUtils.js";import{watch as w}from"../core/reactiveUtils.js";import{whenOnce as v,whenFalseOnce as M}from"../core/watchUtils.js";import{aliasOf as V}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import j from"../geometry/Extent.js";import F from"../geometry/HeightModelInfo.js";import O from"../geometry/SpatialReference.js";import{AnalysesCollection as L}from"../support/AnalysesCollection.js";import{GraphicsCollection as E}from"../support/GraphicsCollection.js";import{BasemapView as b}from"./BasemapView.js";import C from"./LayerViewManager.js";import x from"./Magnifier.js";import I from"./ToolViewManager.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import T from"./navigation/Navigation.js";import k from"./support/DefaultsFromMap.js";var z;const P=h.getLogger("esri.views.View");let U=z=class extends(l(n.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new s({getCollections:()=>{var e,t,i;return[null==(e=this.basemapView)?void 0:e.baseLayerViews,null==(t=this.groundView)?void 0:t.layerViews,this.layerViews,null==(i=this.basemapView)?void 0:i.referenceLayerViews]},getChildrenFunction:e=>e.layerViews}),this.groundView=null,this.animation=null,this.basemapView=null,this.fatalError=null,this.extent=null,this.graphics=new E,this.analyses=new L,this.navigating=!1,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,this.magnifier=new x,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new T,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(this.watch("preconditionsReady",(e=>{var t,i;(e?(this._currentSpatialReference=this.spatialReference,z.views.add(this)):(this._currentSpatialReference=null,z.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready)?(null==(t=this.layerViewManager)||t.clear(),null==(i=this.toolViewManager)||i.detach(),y(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(y(this.analysisViewManager)&&this.analysisViewManager.attach(),this._startup(),this.toolViewManager.attach())}),!0))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,v(this,"ready"))))),this.basemapView=new b({view:this}),this.layerViewManager=new C({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new I({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([w((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),w((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),w((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([w((()=>{var e;return null==(e=this.defaultsFromMap)?void 0:e.ready}),(t=>{var i;const r=(null==(i=this.map)?void 0:i.allLayers.length)>0;if(t&&!this.spatialReference&&r){if(y(e))return;const t=p((()=>e=c(e)));e=f((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}P.warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){if(this.destroyed)return;this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=u(this.graphics),this.analyses=u(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.toolViewManager=u(this.toolViewManager),this.layerViewManager=u(this.layerViewManager),this.basemapView=u(this.basemapView),this.invalidate(),this._emitter.clear(),this.handles.removeAll();const e=this.map;this.map=null,null==e||e.destroy()}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return P.error("#toMap()","Not implemented on this instance of View"),null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new k({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get preconditionsReady(){var e;return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!(this._currentSpatialReference||null!=(e=this.defaultsFromMap)&&e.ready)||!this.typeSpecificPreconditionsReady)}set map(e){var t;e!==this._get("map")&&(null!=(t=e)&&t.destroyed&&(P.warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.initialized&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){var e,t;let i=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return i&&null!=(e=this.defaultsFromMap)&&null!=(t=e.required)&&t.heightModelInfo&&(i=i.clone(),i.vcsWkid=this.defaultsFromMap.vcsWkid,i.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),i}set spatialReference(e){this._userSpatialReference=e,this._set("spatialReference",e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get initialExtent(){var e;return null==(e=this.defaultsFromMap)?void 0:e.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return y(e)?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager.whenLayerView(e)}getDefaultSpatialReference(){var e;return null==(e=this.defaultsFromMap)?void 0:e.spatialReference}getDefaultHeightModelInfo(){var e,t,i;return null!=(e=null!=(t=this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)?t:null==(i=this.defaultsFromMap)?void 0:i.heightModelInfo)?e:null}importLayerView(e){throw new o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{}}_validateSpatialReference(e){return y(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&P.warn("#when()",'Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use watchUtils.whenOnce(view, "ready").then(...) instead.'),super.when(e,t)}forceReadyCycle(){this.ready&&(M(this,"preconditionsReady",(()=>this._readyCycleForced=!1)),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};U.views=new a,e([R()],U.prototype,"_userSpatialReference",void 0),e([V("toolViewManager.activeTool")],U.prototype,"activeTool",void 0),e([R({readOnly:!0})],U.prototype,"allLayerViews",void 0),e([R()],U.prototype,"groundView",void 0),e([R()],U.prototype,"animation",void 0),e([R()],U.prototype,"basemapView",void 0),e([R({readOnly:!0})],U.prototype,"_defaultsFromMapSettings",null),e([R()],U.prototype,"defaultsFromMap",null),e([R()],U.prototype,"fatalError",void 0),e([R({type:j})],U.prototype,"extent",void 0),e([R(S(E,"graphics"))],U.prototype,"graphics",void 0),e([R(S(L,"analyses"))],U.prototype,"analyses",void 0),e([R({readOnly:!0,type:F})],U.prototype,"heightModelInfo",null),e([R({readOnly:!0})],U.prototype,"interacting",null),e([R({readOnly:!0})],U.prototype,"navigating",void 0),e([R({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],U.prototype,"preconditionsReady",null),e([R({readOnly:!0})],U.prototype,"typeSpecificPreconditionsReady",void 0),e([R({type:a,readOnly:!0})],U.prototype,"layerViews",void 0),e([R({type:x})],U.prototype,"magnifier",void 0),e([R({value:null,type:t})],U.prototype,"map",null),e([R()],U.prototype,"padding",void 0),e([R({readOnly:!0})],U.prototype,"ready",void 0),e([R({type:O})],U.prototype,"spatialReference",null),e([R()],U.prototype,"spatialReferenceWarningDelay",void 0),e([R()],U.prototype,"stationary",null),e([R({readOnly:!0})],U.prototype,"supportsGround",void 0),e([R({type:i})],U.prototype,"timeExtent",void 0),e([V("toolViewManager.tools")],U.prototype,"tools",void 0),e([R()],U.prototype,"toolViewManager",void 0),e([R({readOnly:!0})],U.prototype,"type",void 0),e([R({type:Number})],U.prototype,"scale",void 0),e([R({readOnly:!0})],U.prototype,"updating",void 0),e([R({readOnly:!0})],U.prototype,"initialExtentRequired",void 0),e([R({readOnly:!0})],U.prototype,"initialExtent",null),e([R()],U.prototype,"cursor",null),e([R({readOnly:!0})],U.prototype,"input",void 0),e([R({type:T,nonNullable:!0})],U.prototype,"navigation",void 0),e([R()],U.prototype,"layerViewManager",void 0),e([R()],U.prototype,"analysisViewManager",void 0),e([R()],U.prototype,"width",void 0),e([R()],U.prototype,"height",void 0),e([R({readOnly:!0})],U.prototype,"resizing",void 0),e([R({value:null,readOnly:!0})],U.prototype,"size",null),e([R({readOnly:!0})],U.prototype,"suspended",void 0),e([R({readOnly:!0})],U.prototype,"viewEvents",void 0),e([R({readOnly:!0})],U.prototype,"persistableViewModels",void 0),e([R()],U.prototype,"_isValid",void 0),e([R()],U.prototype,"_readyCycleForced",void 0),e([R()],U.prototype,"_currentSpatialReference",void 0),U=z=e([_("esri.views.View")],U);const W=U;export{W as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/clock.js";import{someMap as e}from"../../../core/MapUtils.js";import{createScreenPoint as i}from"../../../core/screenUtils.js";import{DragEventSeparator as a}from"../DragEventSeparator.js";import{InputHandler as o}from"../InputHandler.js";import{DefaultParameters as r}from"./SingleAndDoubleClick.js";import{manhattanDistance as n}from"./support.js";class s extends o{constructor(e=r.maximumDoubleClickDelay,o=r.maximumDoubleClickDistance,n=r.maximumDoubleTouchDelay,s=r.maximumDoubleTouchDistance,u=t){super(!1),this.maximumDoubleClickDelay=e,this.maximumDoubleClickDistance=o,this.maximumDoubleTouchDelay=n,this.maximumDoubleTouchDistance=s,this._clock=u,this._doubleTapDragReady=!1,this._doubleTapDragActive=!1,this._dragStartCenter=i(0,0),this._pointerState=new Map,this._doubleTapDrag=this.registerOutgoing("double-tap-drag"),this._dragEventSeparator=new a({start:(t,e)=>this._dragStart(t,e),update:(t,e)=>this._dragUpdate(e),end:(t,e)=>this._dragEnd(e)}),this.registerIncoming("drag",(t=>this._dragEventSeparator.handle(t))),this.registerIncoming("pointer-down",(t=>this._handlePointerDown(t))),this.registerIncoming("pointer-up",(()=>this._handlePointerUp()))}onUninstall(){this._pointerState.forEach((t=>{null!=t.doubleTapTimeout&&(t.doubleTapTimeout.remove(),t.doubleTapTimeout=null)}))}get hasPendingInputs(){return e(this._pointerState,(t=>null!=t.doubleTapTimeout))}_clearPointerDown(t){const e=this._pointerState.get(t);e&&(e.doubleTapTimeout.remove(),e.doubleTapTimeout=null,this._pointerState.delete(t),this.refreshHasPendingInputs())}_createDoubleTapDragData(t,e,i){const{button:a,buttons:o,pointer:r,pointers:n,pointerType:s,timestamp:u}=i;return{action:t,delta:e,button:a,buttons:o,pointer:r,pointers:n,pointerType:s,timestamp:u}}_dragStart(t,e){if(!this._doubleTapDragReady||1!==t)return;this._doubleTapDragReady=!1,this._doubleTapDragActive=!0;const{data:a,modifiers:o}=e,{center:r}=a;this._dragStartCenter=r;const n=this._createDoubleTapDragData("begin",i(0,0),a);this._doubleTapDrag.emit(n,void 0,o),e.stopPropagation()}_dragUpdate(t){if(!this._doubleTapDragActive)return;const{data:e,modifiers:a}=t,{center:o}=e,r=i(o.x-this._dragStartCenter.x,o.y-this._dragStartCenter.y),n=this._createDoubleTapDragData("update",r,e);this._doubleTapDrag.emit(n,void 0,a),t.stopPropagation()}_dragEnd(t){if(!this._doubleTapDragActive)return;const{data:e,modifiers:a}=t,{center:o}=e,r=i(o.x-this._dragStartCenter.x,o.y-this._dragStartCenter.y),n=this._createDoubleTapDragData("end",r,e);this._doubleTapDrag.emit(n,void 0,a),this._doubleTapDragActive=!1,t.stopPropagation()}_handlePointerDown(t){const{data:e}=t,i=this._pointerId(e),a=this._pointerState.get(i),{pointerType:o}=e.native;if(a){const r="touch"===o?this.maximumDoubleTouchDistance:this.maximumDoubleClickDistance;this._clearPointerDown(i),n(a.event.data,e)>r?this._storePointerDown(t):this._doubleTapDragReady=!0}else this._storePointerDown(t)}_handlePointerUp(){this._doubleTapDragReady=!1}_pointerId(t){const{native:e}=t,{pointerId:i,button:a,pointerType:o}=e;return"mouse"===o?`${i}:${a}`:`${o}`}_storePointerDown(t){const{data:e}=t,{pointerType:i}=e.native,a=this._pointerId(e),o="touch"===i?this.maximumDoubleTouchDelay:this.maximumDoubleClickDelay,r=this._clock.setTimeout((()=>this._clearPointerDown(a)),o);this._pointerState.set(a,{event:t,doubleTapTimeout:r}),this.refreshHasPendingInputs()}}export{s as DoubleTapDrag};
5
+ import{clock as t}from"../../../core/clock.js";import{someMap as e}from"../../../core/MapUtils.js";import{createScreenPoint as i}from"../../../core/screenUtils.js";import{DragEventSeparator as a}from"../DragEventSeparator.js";import{InputHandler as o}from"../InputHandler.js";import{DefaultParameters as r}from"./SingleAndDoubleClick.js";import{manhattanDistance as n}from"./support.js";class s extends o{constructor(e=r.maximumDoubleClickDelay,o=r.maximumDoubleClickDistance,n=r.maximumDoubleTouchDelay,s=r.maximumDoubleTouchDistance,u=t){super(!1),this.maximumDoubleClickDelay=e,this.maximumDoubleClickDistance=o,this.maximumDoubleTouchDelay=n,this.maximumDoubleTouchDistance=s,this._clock=u,this._doubleTapDragReady=!1,this._doubleTapDragActive=!1,this._dragStartCenter=i(0,0),this._pointerState=new Map,this._doubleTapDrag=this.registerOutgoing("double-tap-drag"),this._dragEventSeparator=new a({start:(t,e)=>this._dragStart(t,e),update:(t,e)=>this._dragUpdate(e),end:(t,e)=>this._dragEnd(e)}),this.registerIncoming("drag",(t=>this._dragEventSeparator.handle(t))),this.registerIncoming("pointer-down",(t=>this._handlePointerDown(t))),this.registerIncoming("pointer-up",(()=>this._handlePointerUp()))}onUninstall(){this._pointerState.forEach((t=>{null!=t.doubleTapTimeout&&(t.doubleTapTimeout.remove(),t.doubleTapTimeout=null)}))}get hasPendingInputs(){return e(this._pointerState,(t=>null!=t.doubleTapTimeout))}_clearPointerDown(t){const e=this._pointerState.get(t);e&&(e.doubleTapTimeout.remove(),e.doubleTapTimeout=null,this._pointerState.delete(t),this.refreshHasPendingInputs())}_createDoubleTapDragData(t,e,i){const{button:a,buttons:o,pointer:r,pointers:n,pointerType:s,timestamp:u}=i;return{action:t,delta:e,button:a,buttons:o,pointer:r,pointers:n,pointerType:s,timestamp:u}}_dragStart(t,e){if(!this._doubleTapDragReady||1!==t)return;this._doubleTapDragReady=!1,this._doubleTapDragActive=!0;const{data:a,modifiers:o}=e,{center:r}=a;this._dragStartCenter=r;const n=this._createDoubleTapDragData("begin",i(0,0),a);this._doubleTapDrag.emit(n,void 0,o),e.stopPropagation()}_dragUpdate(t){if(!this._doubleTapDragActive)return;const{data:e,modifiers:a}=t,{center:o}=e,r=i(o.x-this._dragStartCenter.x,o.y-this._dragStartCenter.y),n=this._createDoubleTapDragData("update",r,e);this._doubleTapDrag.emit(n,void 0,a),t.stopPropagation()}_dragEnd(t){if(!this._doubleTapDragActive)return;const{data:e,modifiers:a}=t,{center:o}=e,r=i(o.x-this._dragStartCenter.x,o.y-this._dragStartCenter.y),n=this._createDoubleTapDragData("end",r,e);this._doubleTapDrag.emit(n,void 0,a),this._doubleTapDragActive=!1,t.stopPropagation()}_handlePointerDown(t){const{data:e}=t,i=this._pointerId(e),a=this._pointerState.get(i),{pointerType:o}=e.native;if(a){const r="touch"===o?this.maximumDoubleTouchDistance:this.maximumDoubleClickDistance;this._clearPointerDown(i),n(a.event.data,e)>r?this._storePointerDown(t):this._doubleTapDragReady=!0}else this._storePointerDown(t)}_handlePointerUp(){this._doubleTapDragReady=!1}_pointerId(t){const{native:e}=t,{pointerId:i,button:a,pointerType:o}=e;return"mouse"===o?`${i}:${a}`:`${o}`}_storePointerDown(t){const{data:e}=t,{pointerType:i}=e.native,a=this._pointerId(e),o="touch"===i?this.maximumDoubleTouchDelay:this.maximumDoubleClickDelay,r=this._clock.setTimeout((()=>this._clearPointerDown(a)),o);this._pointerState.set(a,{event:t,doubleTapTimeout:r}),this.refreshHasPendingInputs()}}export{s as DoubleTapDrag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/clock.js";import{InputHandler as e}from"../InputHandler.js";import{DefaultParameters as i}from"./SingleAndDoubleClick.js";import{manhattanDistance as o}from"./support.js";class n extends e{constructor(e=i.maximumDoubleClickDelay,o=i.maximumDoubleClickDistance,n=i.maximumDoubleTouchDelay,a=i.maximumDoubleTouchDistance,s=t){super(!1),this.maximumDoubleClickDelay=e,this.maximumDoubleClickDistance=o,this.maximumDoubleTouchDelay=n,this.maximumDoubleTouchDistance=a,this._clock=s,this._pointerState=new Map,this._immediateDoubleClick=this.registerOutgoing("immediate-double-click"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",(t=>{this._handlePointerLoss(t,"pointer-up")})),this.registerIncoming("pointer-capture-lost",(t=>{this._handlePointerLoss(t,"pointer-capture-lost")})),this.registerIncoming("pointer-cancel",(t=>{this._handlePointerLoss(t,"pointer-cancel")}))}onUninstall(){this._pointerState.forEach((t=>{t.immediateDoubleClick&&t.immediateDoubleClick.timeoutHandle.remove()})),super.onUninstall()}_handlePointerDown(t){const e=t.data,i=this._pointerId(e);if(!this._pointerState.has(i)){const t={downButton:e.native.button,immediateDoubleClick:null};this._pointerState.set(i,t),this.startCapturingPointer(e.native)}}_handlePointerLoss(t,e){const i=t.data,n=this._pointerId(i),a=this._pointerState.get(n);if(a&&"pointer-up"===e&&a.downButton===i.native.button){const e=a.immediateDoubleClick;if(e){e.timeoutHandle.remove();const n="touch"===t.data.native.pointerType?this.maximumDoubleTouchDistance:this.maximumDoubleClickDistance;o(e,t.data)>n?this._startImmediateDoubleClick(t,a):(this._immediateDoubleClick.emit(t.data,void 0,e.modifiers),this._removeState(i))}else this._startImmediateDoubleClick(t,a)}}_startImmediateDoubleClick(t,e){const i="touch"===t.data.native.pointerType?this.maximumDoubleTouchDelay:this.maximumDoubleClickDelay;e.immediateDoubleClick={x:t.data.x,y:t.data.y,modifiers:t.modifiers,timeoutHandle:this._clock.setTimeout((()=>this._removeState(t.data)),i)}}_pointerId(t){const e=t.native;return"mouse"===e.pointerType?`${e.pointerId}:${e.button}`:`${e.pointerType}`}_removeState(t){const e=this._pointerId(t);this._pointerState.delete(e),this.stopCapturingPointer(t.native),this.refreshHasPendingInputs()}}export{n as ImmediateDoubleClick};
5
+ import{clock as t}from"../../../core/clock.js";import{InputHandler as e}from"../InputHandler.js";import{DefaultParameters as i}from"./SingleAndDoubleClick.js";import{manhattanDistance as o}from"./support.js";class n extends e{constructor(e=i.maximumDoubleClickDelay,o=i.maximumDoubleClickDistance,n=i.maximumDoubleTouchDelay,a=i.maximumDoubleTouchDistance,s=t){super(!1),this.maximumDoubleClickDelay=e,this.maximumDoubleClickDistance=o,this.maximumDoubleTouchDelay=n,this.maximumDoubleTouchDistance=a,this._clock=s,this._pointerState=new Map,this._immediateDoubleClick=this.registerOutgoing("immediate-double-click"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",(t=>{this._handlePointerLoss(t,"pointer-up")})),this.registerIncoming("pointer-capture-lost",(t=>{this._handlePointerLoss(t,"pointer-capture-lost")})),this.registerIncoming("pointer-cancel",(t=>{this._handlePointerLoss(t,"pointer-cancel")}))}onUninstall(){this._pointerState.forEach((t=>{t.immediateDoubleClick&&t.immediateDoubleClick.timeoutHandle.remove()})),super.onUninstall()}_handlePointerDown(t){const e=t.data,i=this._pointerId(e);if(!this._pointerState.has(i)){const t={downButton:e.native.button,immediateDoubleClick:null};this._pointerState.set(i,t),this.startCapturingPointer(e.native)}}_handlePointerLoss(t,e){const i=t.data,n=this._pointerId(i),a=this._pointerState.get(n);if(a&&"pointer-up"===e&&a.downButton===i.native.button){const e=a.immediateDoubleClick;if(e){e.timeoutHandle.remove();const n="touch"===t.data.native.pointerType?this.maximumDoubleTouchDistance:this.maximumDoubleClickDistance;o(e,t.data)>n?this._startImmediateDoubleClick(t,a):(this._immediateDoubleClick.emit(t.data,void 0,e.modifiers),this._removeState(i))}else this._startImmediateDoubleClick(t,a)}}_startImmediateDoubleClick(t,e){const i="touch"===t.data.native.pointerType?this.maximumDoubleTouchDelay:this.maximumDoubleClickDelay;e.immediateDoubleClick={x:t.data.x,y:t.data.y,modifiers:t.modifiers,timeoutHandle:this._clock.setTimeout((()=>this._removeState(t.data)),i)}}_pointerId(t){const e=t.native;return"mouse"===e.pointerType?`${e.pointerId}:${e.button}`:`${e.pointerType}`}_removeState(t){const e=this._pointerId(t);this._pointerState.delete(e),this.stopCapturingPointer(t.native),this.refreshHasPendingInputs()}}export{n as ImmediateDoubleClick};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/clock.js";import{InputHandler as e}from"../InputHandler.js";import{euclideanDistance as i}from"./support.js";const n={maximumClickDelay:300,movementUntilMouseDrag:1.5,movementUntilPenDrag:6,movementUntilTouchDrag:6,holdDelay:500};class o extends e{constructor(e=n.maximumClickDelay,i=n.movementUntilMouseDrag,o=n.movementUntilPenDrag,r=n.movementUntilTouchDrag,s=n.holdDelay,a=t){super(!1),this.maximumClickDelay=e,this.movementUntilMouseDrag=i,this.movementUntilPenDrag=o,this.movementUntilTouchDrag=r,this.holdDelay=s,this._clock=a,this._pointerState=new Map,this._pointerDrag=this.registerOutgoing("pointer-drag"),this._immediateClick=this.registerOutgoing("immediate-click"),this._pointerHold=this.registerOutgoing("hold"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",(t=>{this._handlePointerLoss(t,"pointer-up")})),this.registerIncoming("pointer-capture-lost",(t=>{this._handlePointerLoss(t,"pointer-capture-lost")})),this.registerIncoming("pointer-cancel",(t=>{this._handlePointerLoss(t,"pointer-cancel")})),this._moveHandle=this.registerIncoming("pointer-move",this._handlePointerMove.bind(this)),this._moveHandle.pause()}onUninstall(){this._pointerState.forEach((t=>{null!=t.holdTimeout&&(t.holdTimeout.remove(),t.holdTimeout=null)})),super.onUninstall()}_handlePointerDown(t){const e=t.data,i=e.native.pointerId;let n=null;0===this._pointerState.size&&(n=this._clock.setTimeout((()=>{const e=this._pointerState.get(i);if(e){if(!e.isDragging){const i=e.previousEvent;this._pointerHold.emit(i,void 0,t.modifiers),e.holdEmitted=!0}e.holdTimeout=null}}),this.holdDelay));const o={startEvent:e,previousEvent:e,startTimestamp:t.timestamp,isDragging:!1,downButton:e.native.button,holdTimeout:n,modifiers:new Set};this._pointerState.set(i,o),this.startCapturingPointer(e.native),this._moveHandle.resume(),this._pointerState.size>1&&this._startDragging(t)}_createPointerDragData(t,e,i){return{action:t,startEvent:e.startEvent,previousEvent:e.previousEvent,currentEvent:i}}_handlePointerMove(t){const e=t.data,n=e.native.pointerId,o=this._pointerState.get(n);if(o){if(o.isDragging)this._pointerDrag.emit(this._createPointerDragData("update",o,e),void 0,o.modifiers);else{i(e,o.startEvent)>this._getDragThreshold(e.native.pointerType)&&this._startDragging(t)}o.previousEvent=e}}_getDragThreshold(t){switch(t){case"touch":return this.movementUntilTouchDrag;case"pen":return this.movementUntilPenDrag;default:return this.movementUntilMouseDrag}}_startDragging(t){const e=t.data,i=e.native.pointerId;this._pointerState.forEach((n=>{null!=n.holdTimeout&&(n.holdTimeout.remove(),n.holdTimeout=null),n.isDragging||(n.modifiers=t.modifiers,n.isDragging=!0,i===n.startEvent.native.pointerId?this._pointerDrag.emit(this._createPointerDragData("start",n,e)):this._pointerDrag.emit(this._createPointerDragData("start",n,n.previousEvent),t.timestamp))}))}_handlePointerLoss(t,e){const i=t.data,n=i.native.pointerId,o=this._pointerState.get(n);if(o){if(null!=o.holdTimeout&&(o.holdTimeout.remove(),o.holdTimeout=null),o.isDragging)this._pointerDrag.emit(this._createPointerDragData("end",o,"pointer-up"===e?i:o.previousEvent),void 0,o.modifiers);else if("pointer-up"===e&&o.downButton===i.native.button){t.timestamp-o.startTimestamp<=this.maximumClickDelay&&!o.holdEmitted&&this._immediateClick.emit(i)}this._pointerState.delete(n),this.stopCapturingPointer(i.native),0===this._pointerState.size&&this._moveHandle.pause()}}}export{n as DefaultParameters,o as PointerClickHoldAndDrag};
5
+ import{clock as t}from"../../../core/clock.js";import{InputHandler as e}from"../InputHandler.js";import{euclideanDistance as i}from"./support.js";const n={maximumClickDelay:300,movementUntilMouseDrag:1.5,movementUntilPenDrag:6,movementUntilTouchDrag:6,holdDelay:500};class o extends e{constructor(e=n.maximumClickDelay,i=n.movementUntilMouseDrag,o=n.movementUntilPenDrag,r=n.movementUntilTouchDrag,s=n.holdDelay,a=t){super(!1),this.maximumClickDelay=e,this.movementUntilMouseDrag=i,this.movementUntilPenDrag=o,this.movementUntilTouchDrag=r,this.holdDelay=s,this._clock=a,this._pointerState=new Map,this._pointerDrag=this.registerOutgoing("pointer-drag"),this._immediateClick=this.registerOutgoing("immediate-click"),this._pointerHold=this.registerOutgoing("hold"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",(t=>{this._handlePointerLoss(t,"pointer-up")})),this.registerIncoming("pointer-capture-lost",(t=>{this._handlePointerLoss(t,"pointer-capture-lost")})),this.registerIncoming("pointer-cancel",(t=>{this._handlePointerLoss(t,"pointer-cancel")})),this._moveHandle=this.registerIncoming("pointer-move",this._handlePointerMove.bind(this)),this._moveHandle.pause()}onUninstall(){this._pointerState.forEach((t=>{null!=t.holdTimeout&&(t.holdTimeout.remove(),t.holdTimeout=null)})),super.onUninstall()}_handlePointerDown(t){const e=t.data,i=e.native.pointerId;let n=null;0===this._pointerState.size&&(n=this._clock.setTimeout((()=>{const e=this._pointerState.get(i);if(e){if(!e.isDragging){const i=e.previousEvent;this._pointerHold.emit(i,void 0,t.modifiers),e.holdEmitted=!0}e.holdTimeout=null}}),this.holdDelay));const o={startEvent:e,previousEvent:e,startTimestamp:t.timestamp,isDragging:!1,downButton:e.native.button,holdTimeout:n,modifiers:new Set};this._pointerState.set(i,o),this.startCapturingPointer(e.native),this._moveHandle.resume(),this._pointerState.size>1&&this._startDragging(t)}_createPointerDragData(t,e,i){return{action:t,startEvent:e.startEvent,previousEvent:e.previousEvent,currentEvent:i}}_handlePointerMove(t){const e=t.data,n=e.native.pointerId,o=this._pointerState.get(n);if(o){if(o.isDragging)this._pointerDrag.emit(this._createPointerDragData("update",o,e),void 0,o.modifiers);else{i(e,o.startEvent)>this._getDragThreshold(e.native.pointerType)&&this._startDragging(t)}o.previousEvent=e}}_getDragThreshold(t){switch(t){case"touch":return this.movementUntilTouchDrag;case"pen":return this.movementUntilPenDrag;default:return this.movementUntilMouseDrag}}_startDragging(t){const e=t.data,i=e.native.pointerId;this._pointerState.forEach((n=>{null!=n.holdTimeout&&(n.holdTimeout.remove(),n.holdTimeout=null),n.isDragging||(n.modifiers=t.modifiers,n.isDragging=!0,i===n.startEvent.native.pointerId?this._pointerDrag.emit(this._createPointerDragData("start",n,e)):this._pointerDrag.emit(this._createPointerDragData("start",n,n.previousEvent),t.timestamp))}))}_handlePointerLoss(t,e){const i=t.data,n=i.native.pointerId,o=this._pointerState.get(n);if(o){if(null!=o.holdTimeout&&(o.holdTimeout.remove(),o.holdTimeout=null),o.isDragging)this._pointerDrag.emit(this._createPointerDragData("end",o,"pointer-up"===e?i:o.previousEvent),void 0,o.modifiers);else if("pointer-up"===e&&o.downButton===i.native.button){t.timestamp-o.startTimestamp<=this.maximumClickDelay&&!o.holdEmitted&&this._immediateClick.emit(i)}this._pointerState.delete(n),this.stopCapturingPointer(i.native),0===this._pointerState.size&&this._moveHandle.pause()}}}export{n as DefaultParameters,o as PointerClickHoldAndDrag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/clock.js";import{someMap as t}from"../../../core/MapUtils.js";import{removeMaybe as i}from"../../../core/maybe.js";import{InputHandler as o}from"../InputHandler.js";import{manhattanDistance as l}from"./support.js";const s={maximumDoubleClickDelay:250,maximumDoubleClickDistance:10,maximumDoubleTouchDelay:350,maximumDoubleTouchDistance:35};class a extends o{constructor(t=s.maximumDoubleClickDelay,i=s.maximumDoubleClickDistance,o=s.maximumDoubleTouchDelay,l=s.maximumDoubleTouchDistance,a=e){super(!1),this.maximumDoubleClickDelay=t,this.maximumDoubleClickDistance=i,this.maximumDoubleTouchDelay=o,this.maximumDoubleTouchDistance=l,this._clock=a,this._pointerState=new Map,this._click=this.registerOutgoing("click"),this._doubleClick=this.registerOutgoing("double-click"),this.registerIncoming("immediate-click",this._handleImmediateClick.bind(this)),this.registerIncoming("pointer-drag",this._handlePointerDrag.bind(this)),this.registerIncoming("drag",this._handleDrag.bind(this))}onUninstall(){this._pointerState.forEach((e=>e.doubleClickTimeout=i(e.doubleClickTimeout)))}get hasPendingInputs(){return t(this._pointerState,(e=>null!=e.doubleClickTimeout))}_pointerId(e){const t=e.native;return"mouse"===t.pointerType?`${t.pointerId}:${t.button}`:`${t.pointerType}`}_handleImmediateClick(e){const t=e.data,i=this._pointerId(t),o=this._pointerState.get(i);if(o){const s="touch"===t.native.pointerType?this.maximumDoubleTouchDistance:this.maximumDoubleClickDistance;l(o.event.data,t)>s?(this._clearDoubleClickTimeout(i,!0),this._startClick(e)):(this._clearDoubleClickTimeout(i,!1),this._doubleClick.emit(o.event.data,void 0,o.event.modifiers))}else this._startClick(e)}_startClick(e){const t=this._pointerId(e.data),i="touch"===e.data.native.pointerType?this.maximumDoubleTouchDelay:this.maximumDoubleClickDelay;this._pointerState.set(t,{event:e,doubleClickTimeout:this._clock.setTimeout((()=>this._doubleClickTimeoutExceeded(t)),i)}),this.refreshHasPendingInputs()}_handlePointerDrag(e){const t=this._pointerId(e.data.currentEvent);this._clearDoubleClickTimeout(t,!0)}_handleDrag(e){const t=this._pointerId(e.data.pointer);this._clearDoubleClickTimeout(t,!0)}_clearDoubleClickTimeout(e,t){const i=this._pointerState.get(e);i&&(i.doubleClickTimeout.remove(),i.doubleClickTimeout=null,t&&this._doubleClickTimeoutExceeded(e),this._pointerState.delete(e),this.refreshHasPendingInputs())}_doubleClickTimeoutExceeded(e){const t=this._pointerState.get(e);this._click.emit(t.event.data,void 0,t.event.modifiers),t.doubleClickTimeout=null,this._pointerState.delete(e),this.refreshHasPendingInputs()}}export{s as DefaultParameters,a as SingleAndDoubleClick};
5
+ import{clock as e}from"../../../core/clock.js";import{someMap as t}from"../../../core/MapUtils.js";import{removeMaybe as i}from"../../../core/maybe.js";import{InputHandler as o}from"../InputHandler.js";import{manhattanDistance as l}from"./support.js";const s={maximumDoubleClickDelay:250,maximumDoubleClickDistance:10,maximumDoubleTouchDelay:350,maximumDoubleTouchDistance:35};class a extends o{constructor(t=s.maximumDoubleClickDelay,i=s.maximumDoubleClickDistance,o=s.maximumDoubleTouchDelay,l=s.maximumDoubleTouchDistance,a=e){super(!1),this.maximumDoubleClickDelay=t,this.maximumDoubleClickDistance=i,this.maximumDoubleTouchDelay=o,this.maximumDoubleTouchDistance=l,this._clock=a,this._pointerState=new Map,this._click=this.registerOutgoing("click"),this._doubleClick=this.registerOutgoing("double-click"),this.registerIncoming("immediate-click",this._handleImmediateClick.bind(this)),this.registerIncoming("pointer-drag",this._handlePointerDrag.bind(this)),this.registerIncoming("drag",this._handleDrag.bind(this))}onUninstall(){this._pointerState.forEach((e=>e.doubleClickTimeout=i(e.doubleClickTimeout)))}get hasPendingInputs(){return t(this._pointerState,(e=>null!=e.doubleClickTimeout))}_pointerId(e){const t=e.native;return"mouse"===t.pointerType?`${t.pointerId}:${t.button}`:`${t.pointerType}`}_handleImmediateClick(e){const t=e.data,i=this._pointerId(t),o=this._pointerState.get(i);if(o){const s="touch"===t.native.pointerType?this.maximumDoubleTouchDistance:this.maximumDoubleClickDistance;l(o.event.data,t)>s?(this._clearDoubleClickTimeout(i,!0),this._startClick(e)):(this._clearDoubleClickTimeout(i,!1),this._doubleClick.emit(o.event.data,void 0,o.event.modifiers))}else this._startClick(e)}_startClick(e){const t=this._pointerId(e.data),i="touch"===e.data.native.pointerType?this.maximumDoubleTouchDelay:this.maximumDoubleClickDelay;this._pointerState.set(t,{event:e,doubleClickTimeout:this._clock.setTimeout((()=>this._doubleClickTimeoutExceeded(t)),i)}),this.refreshHasPendingInputs()}_handlePointerDrag(e){const t=this._pointerId(e.data.currentEvent);this._clearDoubleClickTimeout(t,!0)}_handleDrag(e){const t=this._pointerId(e.data.pointer);this._clearDoubleClickTimeout(t,!0)}_clearDoubleClickTimeout(e,t){const i=this._pointerState.get(e);i&&(i.doubleClickTimeout.remove(),i.doubleClickTimeout=null,t&&this._doubleClickTimeoutExceeded(e),this._pointerState.delete(e),this.refreshHasPendingInputs())}_doubleClickTimeoutExceeded(e){const t=this._pointerState.get(e);this._click.emit(t.event.data,void 0,t.event.modifiers),t.doubleClickTimeout=null,this._pointerState.delete(e),this.refreshHasPendingInputs()}}export{s as DefaultParameters,a as SingleAndDoubleClick};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import a from"../../core/Handles.js";import i from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as s,isSome as l,unwrap as r,isNone as o}from"../../core/maybe.js";import{createTask as p,whenOrAbort as d,isAborted as u}from"../../core/promiseUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{project as h,canProjectWithoutEngine as g,isLoaded as y}from"../../geometry/projection.js";import{mayHaveHeightModelInfo as _,deriveHeightModelInfoFromLayer as k}from"../../geometry/support/heightModelInfoUtils.js";import{stringFromViewingMode as v,ViewingMode as R}from"../ViewingMode.js";const m=10,x=i.getLogger("esri.views.support.DefaultsFromMap");x.level="info";let T=class extends t{constructor(e){super(e),this._handles=new a,this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.priorityCollection=null,this.logDebugInformation=!1,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._handles=n(this._handles),this._projectExtentTask.task&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=s(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return l(this.userSpatialReference)?this.userSpatialReference:r(this._spatialReferenceTask.spatialReference)}get extent(){return r(this._extentTask.extent)}get heightModelInfo(){return r(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return r(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return r(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return o(this.userSpatialReference)||this.userSpatialReference.equals(r(this._spatialReferenceTask.spatialReference))?r(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return r(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const n=null==(e=this.map)?void 0:e.call(this),s=[];return l(this.priorityCollection)&&s.push(this.priorityCollection),s.push({parent:null==n?void 0:n.basemap,layers:null==n||null==(t=n.basemap)?void 0:t.baseLayers},{layers:null==n?void 0:n.layers},{parent:null==n?void 0:n.ground,layers:null==n||null==(a=n.ground)?void 0:a.layers},{parent:null==n?void 0:n.basemap,layers:null==n||null==(i=n.basemap)?void 0:i.referenceLayers}),s}get _allLayers(){var e,t;const a=this._collectLayers(this.mapCollections);return this._debug("Collected",null!=(e=null==(t=a.layers)?void 0:t.length)?e:0,"layers, updating",a.updating),a}get _spatialReferenceTask(){var e,t;if(this.suspended)return null!=(t=this._get("_spatialReferenceTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers,n={candidates:null};for(const l of a)if(this._processSpatialReferenceCandidates(l,n),n.candidates&&1===n.candidates.length)break;if(1!==(null==(e=n.candidates)?void 0:e.length)&&i)return{updating:!0};const s=this._pickSpatialReferenceCandidate(n.candidates);return this._debug("Finished spatial reference",l(s)?`${s.spatialReference.wkid}:${l(s.viewingMode)?v(s.viewingMode):"global/local"}`:"none available"),{spatialReference:l(s)?s.spatialReference:null,viewingMode:l(s)?s.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,i,n,s,l,r;if(!this.required.tileInfo)return null!=(r=this._get("_tileInfoTask"))?r:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(i=a.call(this))||null==(n=i.basemap)?void 0:n.baseLayers},{layers:null==(s=this.map)||null==(l=s.call(this))?void 0:l.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers;for(const o of a){var n,s;if(this._debug("Considering",null!=(n=null!=(s=o.title)?s:o.id)?n:o.declaredClass,"for height model info"),_(o)){const e=k(o);var l,r;if(e)return this._debug("Derived height model info",e),{heightModelInfo:e,vcsWkid:null==(l=o.spatialReference)?void 0:l.vcsWkid,latestVcsWkid:null==(r=o.spatialReference)?void 0:r.latestVcsWkid,updating:!1}}this._debug("Layer does not support height models")}return this._debug("No height model info found,","updating",i),{updating:i}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const n of t.layers){const e="fullExtents"in n&&n.fullExtents||(l(n.fullExtent)?[n.fullExtent]:[]),t=e.find((e=>e.spatialReference.equals(this.spatialReference)));if(t)return{candidates:[{extent:t,layer:n}],updating:!1};if(this._getSupportedSpatialReferences(n).length>0)for(const a of e)i.push({extent:a,layer:n})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(o(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{candidate:a,requiresGeometryService:i}=this._pickExtentCandidate(e),n=this.spatialReference;if(a.extent.equals(this._projectExtentTask.input)&&n.equals(this._projectExtentTask.spatialReference))return{extent:this._projectExtentTask.output,updating:l(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished};if(l(this._projectExtentTask.task)&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=s(this._projectExtentTask.task)),!i){this._projectExtentTask={input:null,output:null,task:null,spatialReference:null};try{return{extent:h(a.extent,n),updating:!1}}catch{return{updating:!1}}}return this._debug("Starting project extent task for",a.extent),this._projectExtentTask={input:a.extent.clone(),output:null,spatialReference:n.clone(),task:p((async e=>{try{const t=await d(import("../../portal/support/geometryServiceUtils.js"),e),i=await t.projectGeometry(a.extent,n,a.layer.portalItem,e);this._debug("Project extent task finished",i),this._projectExtentTask={...this._projectExtentTask,task:null,output:i}}catch(t){if(u(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0}}_processSpatialReferenceCandidates(e,t){var a;const i=this._getSupportedSpatialReferences(e);if(0!==i.length)if(this._debug("Spatial reference candidates from",null!=(a=e.title)?a:e.id,":",i.map((e=>`${e.spatialReference.wkid}:${l(e.viewingMode)?v(e.viewingMode):"global/local"}`)).join(", ")),t.candidates){const e=[],a=(e,t)=>o(e.viewingMode)?t.viewingMode:(o(t.viewingMode)||e.viewingMode===t.viewingMode)&&e.viewingMode;for(const n of t.candidates)for(const t of i){if(!n.spatialReference.equals(t.spatialReference))continue;const i=a(n,t);if(!1!==i){e.push({spatialReference:n.spatialReference,viewingMode:i});break}}e.length>0&&(t.candidates=e)}else t.candidates=i}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return!e||e.length<1?l(t)?{spatialReference:t,viewingMode:null}:null:(l(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))&&(e=e.filter((({spatialReference:e})=>e.equals(t)))),e.length>1&&e.some((({viewingMode:e})=>e!==R.Local))&&(e=e.filter((({viewingMode:e})=>e!==R.Local))),e[0])}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(l(t)){const e=l(t.constraints)?t.constraints:[{spatialReference:i}];for(const{spatialReference:t,viewingMode:i}of e)(o(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:i})}}return a}_pickExtentCandidate(e){const t=this.spatialReference,a=e.find((({extent:e})=>g(e.spatialReference,t)||y()));return l(a)?{candidate:a,requiresGeometryService:!1}:{candidate:e[0],requiresGeometryService:!0}}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const i of e)if(this._collectCollection(i,a),a.preloading===m)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const n of e.layers){switch(this._loadMaybe(n)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":var a,i;if(!t.updating)this._debug("Considering layer",null!=(a=null!=(i=n.title)?i:n.id)?a:n.declaredClass),t.layers.push(n);"layers"in n&&this._collectCollection({layers:n.layers},t)}if(t.preloading===m)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(this._debug("Triggering load",null!=(t=null!=(a=e.title)?a:e.id)?t:e.declaredClass),e.load(),"loading"):e.loadStatus:"loaded";var t,a}_debug(...e){this.logDebugInformation&&x.info(...e)}};e([c()],T.prototype,"required",void 0),e([c({constructOnly:!0})],T.prototype,"map",void 0),e([c({constructOnly:!0})],T.prototype,"getSpatialReferenceSupport",void 0),e([c()],T.prototype,"defaultSpatialReference",void 0),e([c()],T.prototype,"userSpatialReference",void 0),e([c()],T.prototype,"priorityCollection",void 0),e([c()],T.prototype,"logDebugInformation",void 0),e([c()],T.prototype,"suspended",void 0),e([c({readOnly:!0})],T.prototype,"ready",null),e([c({readOnly:!0})],T.prototype,"heightModelInfoReady",null),e([c({readOnly:!0})],T.prototype,"spatialReference",null),e([c({readOnly:!0})],T.prototype,"extent",null),e([c({readOnly:!0})],T.prototype,"heightModelInfo",null),e([c({readOnly:!0})],T.prototype,"vcsWkid",null),e([c({readOnly:!0})],T.prototype,"latestVcsWkid",null),e([c({readOnly:!0})],T.prototype,"viewingMode",null),e([c({readOnly:!0})],T.prototype,"tileInfo",null),e([c({readOnly:!0})],T.prototype,"mapCollections",null),e([c({readOnly:!0})],T.prototype,"_allLayers",null),e([c({readOnly:!0})],T.prototype,"_spatialReferenceTask",null),e([c({readOnly:!0})],T.prototype,"_tileInfoTask",null),e([c({readOnly:!0})],T.prototype,"_heightModelInfoTask",null),e([c({readOnly:!0})],T.prototype,"_extentCandidatesTask",null),e([c()],T.prototype,"_extentTask",null),e([c()],T.prototype,"_projectExtentTask",void 0),T=e([f("esri.views.support.DefaultsFromMap")],T);const M=T;export{M as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import a from"../../core/Logger.js";import{abortMaybe as i,isSome as n,unwrap as s,isNone as l}from"../../core/maybe.js";import{createTask as r,isAborted as o}from"../../core/promiseUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{mayHaveHeightModelInfo as u,deriveHeightModelInfoFromLayer as c}from"../../geometry/support/heightModelInfoUtils.js";import{stringFromViewingMode as f,ViewingMode as h}from"../ViewingMode.js";import{projectWithEngineOrService as g}from"./projectionUtils.js";const y=a.getLogger("esri.views.support.DefaultsFromMap");y.level="info";let _=class extends t{constructor(e){super(e),this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.logDebugInformation=!1,this.requiresExtentInSpatialReference=!0,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=i(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return n(this.userSpatialReference)?this.userSpatialReference:s(this._spatialReferenceTask.spatialReference)}get extent(){return s(this._extentTask.extent)}get heightModelInfo(){return s(this._heightModelInfoTask.heightModelInfo)}get vcsWkid(){return s(this._heightModelInfoTask.vcsWkid)}get latestVcsWkid(){return s(this._heightModelInfoTask.latestVcsWkid)}get viewingMode(){return l(this.userSpatialReference)||this.userSpatialReference.equals(s(this._spatialReferenceTask.spatialReference))?s(this._spatialReferenceTask.viewingMode):null}get tileInfo(){return s(this._tileInfoTask.tileInfo)}get mapCollections(){var e,t,a,i;const s=null==(e=this.map)?void 0:e.call(this),l=[];return n(this.priorityCollection)&&l.push(this.priorityCollection),l.push({parent:null==s?void 0:s.basemap,layers:null==s||null==(t=s.basemap)?void 0:t.baseLayers},{layers:null==s?void 0:s.layers},{parent:null==s?void 0:s.ground,layers:null==s||null==(a=s.ground)?void 0:a.layers},{parent:null==s?void 0:s.basemap,layers:null==s||null==(i=s.basemap)?void 0:i.referenceLayers}),l}get _allLayers(){var e,t;const a=this._collectLayers(this.mapCollections);return this._debug("Collected",null!=(e=null==(t=a.layers)?void 0:t.length)?e:0,"layers, updating",a.updating),a}get _spatialReferenceTask(){var e,t;if(this.suspended)return null!=(t=this._get("_spatialReferenceTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers,s={candidates:null};for(const n of a)if(this._processSpatialReferenceCandidates(n,s),s.candidates&&1===s.candidates.length)break;if(1!==(null==(e=s.candidates)?void 0:e.length)&&i)return{updating:!0};const l=this._pickSpatialReferenceCandidate(s.candidates);return this._debug("Finished spatial reference",n(l)?`${l.spatialReference.wkid}:${n(l.viewingMode)?f(l.viewingMode):"global/local"}`:"none available"),{spatialReference:n(l)?l.spatialReference:null,viewingMode:n(l)?l.viewingMode:null,updating:!1}}get _tileInfoTask(){var e,t,a,i,n,s,l,r;if(!this.required.tileInfo)return null!=(r=this._get("_tileInfoTask"))?r:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:o,updating:p}=this._collectLayers([{parent:null==(e=this.map)||null==(t=e.call(this))?void 0:t.basemap,layers:null==(a=this.map)||null==(i=a.call(this))||null==(n=i.basemap)?void 0:n.baseLayers},{layers:null==(s=this.map)||null==(l=s.call(this))?void 0:l.layers}]);if(o&&o.length>0&&"tileInfo"in o[0]){const e=o[0].tileInfo;return{tileInfo:e&&e.spatialReference.equals(this.spatialReference)?e:null,updating:!1}}return{updating:p}}get _heightModelInfoTask(){var e,t;if(!this.required.heightModelInfo||this.suspended&&null!=(e=this._get("_heightModelInfoTask"))&&e.heightModelInfo)return null!=(t=this._get("_heightModelInfoTask"))?t:{updating:!1};const{layers:a,updating:i}=this._allLayers;for(const o of a){var n,s;if(this._debug("Considering",null!=(n=null!=(s=o.title)?s:o.id)?n:o.declaredClass,"for height model info"),u(o)){const e=c(o);var l,r;if(e)return this._debug("Derived height model info",e),{heightModelInfo:e,vcsWkid:null==(l=o.spatialReference)?void 0:l.vcsWkid,latestVcsWkid:null==(r=o.spatialReference)?void 0:r.latestVcsWkid,updating:!1}}this._debug("Layer does not support height models")}return this._debug("No height model info found,","updating",i),{updating:i}}get _extentCandidatesTask(){var e;if(this.suspended||!this.required.extent)return null!=(e=this._get("_extentCandidatesTask"))?e:{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const t=this._allLayers,a=t.updating,i=[];for(const l of t.layers){var s;const e="fullExtents"in l&&l.fullExtents||(n(l.fullExtent)?[l.fullExtent]:[]),t=this.requiresExtentInSpatialReference?null:e[0],a=null!=(s=e.find((e=>e.spatialReference.equals(this.spatialReference))))?s:t;if(a)return{candidates:[{extent:a,layer:l}],updating:!1};if(this._getSupportedSpatialReferences(l).length>0)for(const n of e)i.push({extent:n,layer:l})}return{candidates:i,updating:a}}get _extentTask(){const{candidates:e,updating:t}=this._extentCandidatesTask;if(t)return{updating:t};if(l(e)||0===e.length)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const a=this._pickExtentCandidate(e),s=this.spatialReference;return a.extent.equals(this._projectExtentTask.input)&&s.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:n(this._projectExtentTask.task)&&!this._projectExtentTask.task.finished}:(n(this._projectExtentTask.task)&&(this._debug("Aborting project extent task"),this._projectExtentTask.task=i(this._projectExtentTask.task)),this._debug("Starting project extent task for",a.extent),this._projectExtentTask={input:a.extent.clone(),output:null,spatialReference:s.clone(),task:r((async e=>{try{const t=await g(a.extent,s,a.layer.portalItem,e);this._debug("Project extent task finished",t),this._projectExtentTask={...this._projectExtentTask,task:null,output:t}}catch(t){if(o(e))return;this._projectExtentTask={...this._projectExtentTask,task:null}}}))},{updating:!0})}_processSpatialReferenceCandidates(e,t){var a;const i=this._getSupportedSpatialReferences(e);if(0!==i.length)if(this._debug("Spatial reference candidates from",null!=(a=e.title)?a:e.id,":",i.map((e=>`${e.spatialReference.wkid}:${n(e.viewingMode)?f(e.viewingMode):"global/local"}`)).join(", ")),t.candidates){const e=[],a=(e,t)=>l(e.viewingMode)?t.viewingMode:(l(t.viewingMode)||e.viewingMode===t.viewingMode)&&e.viewingMode;for(const n of t.candidates)for(const t of i){if(!n.spatialReference.equals(t.spatialReference))continue;const i=a(n,t);if(!1!==i){e.push({spatialReference:n.spatialReference,viewingMode:i});break}}e.length>0&&(t.candidates=e)}else t.candidates=i}_pickSpatialReferenceCandidate(e){const t=this.defaultSpatialReference;return!e||e.length<1?n(t)?{spatialReference:t,viewingMode:null}:null:(n(t)&&e.length>1&&e.some((({spatialReference:e})=>e.equals(t)))&&(e=e.filter((({spatialReference:e})=>e.equals(t)))),e.length>1&&e.some((({viewingMode:e})=>e!==h.Local))&&(e=e.filter((({viewingMode:e})=>e!==h.Local))),e[0])}_getSupportedSpatialReferences(e){const t="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(0===t.length)return[];const a=[];for(const i of t){const t=this.getSpatialReferenceSupport({spatialReference:i,layer:e});if(n(t)){const e=n(t.constraints)?t.constraints:[{spatialReference:i}];for(const{spatialReference:t,viewingMode:i}of e)(!this.requiresExtentInSpatialReference||l(this.userSpatialReference)||t.equals(this.userSpatialReference))&&a.push({spatialReference:t,viewingMode:i})}}return a}_pickExtentCandidate(e){const t=this.spatialReference;return e.find((({extent:e})=>t.equals(e.spatialReference)))||e[0]}_collectLayers(e){var t;if("loaded"!==this._loadMaybe(null==(t=this.map)?void 0:t.call(this)))return{layers:[],updating:!0};const a={layers:[],preloading:-1,updating:!1};for(const i of e)if(this._collectCollection(i,a),a.preloading===this.sourcePreloadCount)break;return{layers:a.layers,updating:a.updating}}_collectCollection(e,t){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return t.updating=!0,void++t.preloading;case"failed":return}for(const n of e.layers){switch(this._loadMaybe(n)){case"failed":continue;case"loading":t.updating=!0,++t.preloading;break;case"loaded":var a,i;if(!t.updating)this._debug("Considering layer",null!=(a=null!=(i=n.title)?i:n.id)?a:n.declaredClass),t.layers.push(n);"layers"in n&&this._collectCollection({layers:n.layers},t)}if(t.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e?"not-loaded"===e.loadStatus?(this._debug("Triggering load",null!=(t=null!=(a=e.title)?a:e.id)?t:e.declaredClass),e.load(),"loading"):e.loadStatus:"loaded";var t,a}_debug(...e){this.logDebugInformation&&y.info(...e)}};e([p()],_.prototype,"required",void 0),e([p({constructOnly:!0})],_.prototype,"map",void 0),e([p({constructOnly:!0})],_.prototype,"getSpatialReferenceSupport",void 0),e([p()],_.prototype,"defaultSpatialReference",void 0),e([p()],_.prototype,"userSpatialReference",void 0),e([p()],_.prototype,"sourcePreloadCount",void 0),e([p()],_.prototype,"priorityCollection",void 0),e([p()],_.prototype,"logDebugInformation",void 0),e([p()],_.prototype,"requiresExtentInSpatialReference",void 0),e([p()],_.prototype,"suspended",void 0),e([p({readOnly:!0})],_.prototype,"ready",null),e([p({readOnly:!0})],_.prototype,"heightModelInfoReady",null),e([p({readOnly:!0})],_.prototype,"spatialReference",null),e([p({readOnly:!0})],_.prototype,"extent",null),e([p({readOnly:!0})],_.prototype,"heightModelInfo",null),e([p({readOnly:!0})],_.prototype,"vcsWkid",null),e([p({readOnly:!0})],_.prototype,"latestVcsWkid",null),e([p({readOnly:!0})],_.prototype,"viewingMode",null),e([p({readOnly:!0})],_.prototype,"tileInfo",null),e([p({readOnly:!0})],_.prototype,"mapCollections",null),e([p({readOnly:!0})],_.prototype,"_allLayers",null),e([p({readOnly:!0})],_.prototype,"_spatialReferenceTask",null),e([p({readOnly:!0})],_.prototype,"_tileInfoTask",null),e([p({readOnly:!0})],_.prototype,"_heightModelInfoTask",null),e([p({readOnly:!0})],_.prototype,"_extentCandidatesTask",null),e([p()],_.prototype,"_extentTask",null),e([p()],_.prototype,"_projectExtentTask",void 0),_=e([d("esri.views.support.DefaultsFromMap")],_);const k=_;export{k as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
+ */
5
+ import{throwIfAborted as r}from"../../core/promiseUtils.js";import{i as e}from"../../chunks/pe.js";import{canProjectWithoutEngine as t,project as o,load as i}from"../../geometry/projection.js";let n,s=null;async function p(e){s||(s=import("../../portal/support/geometryServiceUtils.js").then((r=>n=r))),await s,r(e)}async function c(r,s,m,a){if(!r)return null;const l=r.spatialReference;return e()||t(l,s)?o(r,s):n?n.projectGeometry(r,s,m,a):(await Promise.race([p(a),i(a)]),c(r,s,m,a))}export{c as projectWithEngineOrService};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/AreaMeasurement.js";import s from"../../core/Logger.js";import{isNone as i,isSome as r,unwrap as n}from"../../core/maybe.js";import{measurementAreaUnits as o}from"../../core/unitUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as u}from"../../properties/defaultUnit.js";import p from"../../views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js";import{InteractiveAnalysisViewModel as d}from"../support/InteractiveAnalysisViewModel.js";const c=s.getLogger("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel");let h=class extends d{constructor(e){super(e),this.logger=c,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views.",this._userUnitOptions=null,this._userUnit=null,this.ready=!1}initialize(){this.analysis.unit=this.unit}get state(){return this.disabled?"disabled":i(this.tool)?"ready":this.tool.state}get measurement(){if(i(this.tool)||this.disabled||this.tool.destroyed||"pending"===this.tool.toolState)return null;const e=this.tool.measurementView;if("pending"===e.state||"destroyed"===e.state)return null;const t=e.analysisVisualization,s=t.viewData,r=s.measurementData,n=s.validMeasurement,o="euclidean"===s.mode,a=0===(o?r.intersectingSegments:r.geodesicIntersectingSegments).size,l=a?n?"available":"unavailable":"invalid";return{mode:o?"euclidean":"geodesic",area:{text:a&&n?t.areaLabel:null,state:l},perimeterLength:{text:a&&n?t.perimeterLengthLabel:null,state:l}}}set unitOptions(e){this._userUnitOptions=e,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(e){this._userUnit=e?this._findSelectableUnit(e,this._userUnit):null,this.analysis.unit=this._userUnit}get unit(){return r(this._userUnit)?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}start(){return this.clear(),this.createTool()}clear(){this.removeTool(),this.analysis.geometry=null}constructAnalysis(){return new t}constructTool(){return new p({view:n(this.view),analysis:this.analysis,visible:this.visible})}_findSelectableUnit(e,t){const s=this.unitOptions;return-1!==s.indexOf(e)?e:r(t)?this._findSelectableUnit(t):s[0]}_filteredOrAllUnits(e){if(i(e))return o.slice();const t=e.filter((e=>-1!==o.indexOf(e)));return 0===t.length?o.slice():t}async onConnectToAnalysisView(){r(this.view)&&this.view.ready&&(this.ready=!0)}onDisconnectFromAnalysisView(){this.ready=!1}};e([a()],h.prototype,"_userUnit",void 0),e([a()],h.prototype,"ready",void 0),e([a({readOnly:!0})],h.prototype,"state",null),e([a({readOnly:!0})],h.prototype,"measurement",null),e([a(u)],h.prototype,"defaultUnit",void 0),e([a()],h.prototype,"unitOptions",null),e([a()],h.prototype,"unit",null),h=e([l("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],h);const m=h;export{m as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/AreaMeasurement.js";import s from"../../core/Logger.js";import{isNone as i,isSome as r,unwrap as n}from"../../core/maybe.js";import{measurementAreaUnits as o}from"../../core/unitUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as u}from"../../properties/defaultUnit.js";import p from"../../views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js";import{InteractiveAnalysisViewModel as d}from"../support/InteractiveAnalysisViewModel.js";const h=s.getLogger("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel");let c=class extends d{constructor(e){super(e),this.analysisView=null,this.logger=h,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views.",this._userUnitOptions=null,this._userUnit=null}initialize(){this.analysis.unit=this.unit}get state(){return this.disabled?"disabled":i(this.tool)?"ready":this.tool.state}get measurement(){if(i(this.tool)||this.disabled||this.tool.destroyed||"pending"===this.tool.toolState)return null;const e=this.tool.measurementView;if("pending"===e.state||"destroyed"===e.state)return null;const t=e.analysisVisualization,s=t.viewData,r=s.measurementData,n=s.validMeasurement,o="euclidean"===s.mode,a=0===(o?r.intersectingSegments:r.geodesicIntersectingSegments).size,l=a?n?"available":"unavailable":"invalid";return{mode:o?"euclidean":"geodesic",area:{text:a&&n?t.areaLabel:null,state:l},perimeterLength:{text:a&&n?t.perimeterLengthLabel:null,state:l}}}set unitOptions(e){this._userUnitOptions=e,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(e){this._userUnit=e?this._findSelectableUnit(e,this._userUnit):null,this.analysis.unit=this._userUnit}get unit(){return r(this._userUnit)?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}get ready(){return r(this.analysisView)}start(){return this.clear(),this.createTool()}clear(){this.removeTool(),this.analysis.geometry=null}constructAnalysis(){return new t}constructTool(){return new p({view:n(this.view),analysis:this.analysis,visible:this.visible})}_findSelectableUnit(e,t){const s=this.unitOptions;return-1!==s.indexOf(e)?e:r(t)?this._findSelectableUnit(t):s[0]}_filteredOrAllUnits(e){if(i(e))return o.slice();const t=e.filter((e=>-1!==o.indexOf(e)));return 0===t.length?o.slice():t}async onConnectToAnalysisView(e){r(this.view)&&this.view.ready&&(this.analysisView=e)}onDisconnectFromAnalysisView(){this.analysisView=null}};e([a({readOnly:!0})],c.prototype,"state",null),e([a({readOnly:!0})],c.prototype,"measurement",null),e([a()],c.prototype,"unitOptions",null),e([a()],c.prototype,"unit",null),e([a()],c.prototype,"analysisView",void 0),e([a()],c.prototype,"ready",null),e([a(u)],c.prototype,"defaultUnit",void 0),e([a()],c.prototype,"_userUnit",void 0),c=e([l("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],c);const m=c;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Collection.js";import s from"../../core/Handles.js";import o from"../../core/Loadable.js";import{watch as i,on as r}from"../../core/watchUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{contentEquals as n}from"../../support/basemapUtils.js";import{default3DCompatibility as l,default2DCompatibility as m}from"./support/basemapCompatibilityUtils.js";import u from"./support/BasemapGalleryItem.js";import h from"./support/LocalBasemapsSource.js";import d from"./support/PortalBasemapsSource.js";const y=e.ofType(u);function b(t){return t&&"esri.portal.Portal"===t.declaredClass}function f(t){return t&&!(t instanceof d)&&(!!t.portal||!!t.query)}function v(t){return t&&"basemaps"in t&&"state"in t&&"refresh"in t}let w=class extends o{constructor(t){super(t),this._handles=new s,this.activeBasemap=null,this.items=new y,this.source=new d,this.view=null}initialize(){const t=()=>this._recreateItems();this._handles.add([i(this,["compatibilityFunction","state"],(()=>this._updateItems())),r(this,"source.basemaps","change",t,t)])}destroy(){this._handles.destroy(),this._handles=null}get compatibilityFunction(){if(void 0===this._get("compatibilityFunction")){return"3d"===this.get("view.type")?l:m}return this._get("compatibilityFunction")}set compatibilityFunction(t){this._set("compatibilityFunction",t)}castSource(t){return Array.isArray(t)||e.isCollection(t)?new h({basemaps:t}):b(t)?new d({portal:t}):f(t)?new d(t):v(t)?t:null}get state(){return this.get("view.ready")&&this.source?"ready":"disabled"}basemapEquals(t,e){return n(t,e)}refresh(){this._recreateItems()}load(t){return this.addResolvingPromise(o.isLoadable(this.source)?this.source.load(t):Promise.resolve()),Promise.resolve(this)}_recreateItems(){const t=this.get("source.basemaps"),{view:e,compatibilityFunction:s}=this;this.items.removeAll().forEach((t=>t.destroy())),this.items.addMany(t.map((t=>new u({basemap:t,compatibilityFunction:s,view:e}))))}_updateItems(){this.items.forEach((t=>{t.compatibilityFunction=this.compatibilityFunction,t.view=this.view}))}};t([a({aliasOf:"view.map.basemap"})],w.prototype,"activeBasemap",void 0),t([a()],w.prototype,"compatibilityFunction",null),t([a({readOnly:!0,type:y})],w.prototype,"items",void 0),t([a()],w.prototype,"source",void 0),t([p("source")],w.prototype,"castSource",null),t([a({readOnly:!0})],w.prototype,"state",null),t([a()],w.prototype,"view",void 0),w=t([c("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],w);const j=w;export{j as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import s from"../../core/Loadable.js";import{isSome as r}from"../../core/maybe.js";import{watch as a,on as o}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as c}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{i as l,l as m}from"../../chunks/pe.js";import{canProjectWithoutEngine as u}from"../../geometry/projection.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import{contentEquals as v}from"../../support/basemapUtils.js";import{default3DCompatibility as d,default2DCompatibility as f}from"./support/basemapCompatibilityUtils.js";import y from"./support/BasemapGalleryItem.js";import b from"./support/LocalBasemapsSource.js";import w from"./support/PortalBasemapsSource.js";const j=t.ofType(y);function _(e){return e&&"esri.portal.Portal"===e.declaredClass}function B(e){return e&&!(e instanceof w)&&(!!e.portal||!!e.query)}function g(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let F=class extends(i(s)){constructor(e){super(e),this.items=new j,this.source=new w,this.view=null}initialize(){const e=()=>this._recreateItems();this.handles.add([a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),o((()=>{var e;return null==(e=this.source)?void 0:e.basemaps}),"change",e,{onListenerAdd:e})])}get activeBasemap(){var e,t,i;return null!=(e=null==(t=this.view)||null==(i=t.map)?void 0:i.basemap)?e:null}set activeBasemap(e){if(!this.view.map)return;if(!e)return this.view.map.basemap=e,void this._clearOverride("activeBasemap");const{spatialReference:t}=this.items.find((t=>t.basemap===e));if("spatialReferenceLocked"in this.view&&!this.view.spatialReferenceLocked){const i=this.view.spatialReference;if(r(t)&&!h(i,t)&&!u(this.view.spatialReference,t)&&!l())return this._override("activeBasemap",e),void m().then((()=>{this._get("activeBasemap")===e&&(this.view.map.basemap=e,this.view.spatialReference=t,this._clearOverride("activeBasemap"))}),(()=>{}));this.view.map.basemap=e,this._clearOverride("activeBasemap"),r(t)&&!h(this.view.spatialReference,t)&&(this.view.spatialReference=t)}else this.view.map.basemap=e,this._clearOverride("activeBasemap")}get compatibilityFunction(){if(void 0===this._get("compatibilityFunction")){var e;return"3d"===(null==(e=this.view)?void 0:e.type)?d:f}return this._get("compatibilityFunction")}set compatibilityFunction(e){this._set("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||t.isCollection(e)?new b({basemaps:e}):_(e)?new w({portal:e}):B(e)?new w(e):g(e)?e:null}get state(){var e;return null!=(e=this.view)&&e.ready&&this.source?"ready":"disabled"}basemapEquals(e,t){return v(e,t)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(s.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_recreateItems(){var e;const t=null==(e=this.source)?void 0:e.basemaps,{view:i,compatibilityFunction:s}=this;this.items.removeAll().forEach((e=>e.destroy())),t&&this.items.addMany(t.map((e=>new y({basemap:e,compatibilityFunction:s,view:i}))))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([p()],F.prototype,"activeBasemap",null),e([p()],F.prototype,"compatibilityFunction",null),e([p({readOnly:!0,type:j})],F.prototype,"items",void 0),e([p()],F.prototype,"source",void 0),e([c("source")],F.prototype,"castSource",null),e([p({readOnly:!0})],F.prototype,"state",null),e([p()],F.prototype,"view",void 0),F=e([n("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],F);const R=F;export{R as default};