@arcgis/core 5.0.0-next.4 → 5.0.0-next.6

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 (435) hide show
  1. package/Map.js +1 -1
  2. package/analysis/ElevationProfileAnalysis.js +1 -1
  3. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  4. package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +4 -0
  5. package/applications/KnowledgeStudio/generalSdkInternalAccess.js +5 -0
  6. package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -0
  7. package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
  8. package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +2 -0
  9. package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
  10. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  11. package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/020c8913d8e35d63080b.js +1 -0
  14. package/assets/esri/core/workers/chunks/02e69f0c63d97661da60.js +1 -0
  15. package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +1 -0
  16. package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +1 -0
  17. package/assets/esri/core/workers/chunks/{388482cea4b9fdeaf06e.js → 0f30a9514571c7be9978.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{929ece362604dc301229.js → 17acde0245ecd956306c.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{14ace5dc4b8984212a57.js → 17d5f8dba6ebb1184506.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{651b9144abb1895cc510.js → 1e848d9da1c61a27cf18.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{8cea114168d849c38b1b.js → 20278683bddc8c2d8136.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{00aa85ae6419aad183ea.js → 22d6b8102e75bdef204c.js} +1 -1
  23. package/assets/esri/core/workers/chunks/279366e6b743f9680603.js +1 -0
  24. package/assets/esri/core/workers/chunks/285762ff92d5388b6024.js +1 -0
  25. package/assets/esri/core/workers/chunks/{4f01be74dd26e639330f.js → 2f24017e72d41c259faa.js} +1 -1
  26. package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
  27. package/assets/esri/core/workers/chunks/{3d65b8a2fbe1df050a25.js → 377a66034e7c1bad5599.js} +1 -1
  28. package/assets/esri/core/workers/chunks/37f2ef14399546e697e6.js +1 -0
  29. package/assets/esri/core/workers/chunks/{0f9bb3187306f89e3d63.js → 398f356b11fd33bd3831.js} +1 -1
  30. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
  31. package/assets/esri/core/workers/chunks/{f7c99e9c8d19352af38d.js → 3ac7562ea90f91a9f30c.js} +1 -1
  32. package/assets/esri/core/workers/chunks/3f3d492f1093b7832aab.js +1 -0
  33. package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +1 -0
  34. package/assets/esri/core/workers/chunks/464d42bebb365287808d.js +1 -0
  35. package/assets/esri/core/workers/chunks/4c5a7249a311070d8f43.js +1 -0
  36. package/assets/esri/core/workers/chunks/{d570c75a425aa29672c8.js → 4d599008e1ea42321b37.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{c0feec6e2f0e45900ae0.js → 53bd8996e8812f1ad7b2.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{9a723d739ac44b45432c.js → 557960763695abee4a83.js} +1 -1
  39. package/assets/esri/core/workers/chunks/5bd36dbf46c25bd961c8.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b7a17927e14f502006b4.js → 5ea0c62016d56990787b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{2ea6985da4eb0107bb9d.js → 5fc7b61f467f1d60a284.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{a87521ebe632bf783ef4.js → 62a49cfd9a2508950e9f.js} +1 -1
  43. package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
  44. package/assets/esri/core/workers/chunks/{ec13053af1999701464a.js → 6826fe54562dcdc054d7.js} +1 -1
  45. package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +1 -0
  46. package/assets/esri/core/workers/chunks/{8215015f11221a354273.js → 6d049182bec34a22abcd.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{309c5f69ea06f3081d83.js → 73487b9d85e726e9c012.js} +1 -1
  48. package/assets/esri/core/workers/chunks/7413e582bc2b16af6a0f.js +1 -0
  49. package/assets/esri/core/workers/chunks/{3d22fe2f2c40abbc246e.js → 7461124454bfb4fb6474.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{147ad5fdd02f46b6da24.js → 7544316a75dbd981aea6.js} +1 -1
  51. package/assets/esri/core/workers/chunks/75bf27271a31e26e1b21.js +1 -0
  52. package/assets/esri/core/workers/chunks/{630efe10c871425b6a95.js → 76ae1702fecc7ad7017c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{de1f75c907152df7e788.js → 794748fd1edc29a621cd.js} +1 -1
  54. package/assets/esri/core/workers/chunks/79dbfa2b9b332ca0002f.js +1 -0
  55. package/assets/esri/core/workers/chunks/7a23ab84e1144f081c92.js +1 -0
  56. package/assets/esri/core/workers/chunks/7aaaebbabee27690283c.js +1 -0
  57. package/assets/esri/core/workers/chunks/7c4a63aeead2505d6f02.js +1 -0
  58. package/assets/esri/core/workers/chunks/{2a5f331c0f18d8574b4e.js → 811d4c46c75cf6a63e78.js} +1 -1
  59. package/assets/esri/core/workers/chunks/8372f142c4d7a65c7954.js +1 -0
  60. package/assets/esri/core/workers/chunks/{d84373a6ec94dcfec8c2.js → 88074189fa10c335370b.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{dc31865edea480f0ebba.js → 8833c3d168951be4bf20.js} +1 -1
  62. package/assets/esri/core/workers/chunks/883ffaa69b3e6eb158bf.js +1 -0
  63. package/assets/esri/core/workers/chunks/{85622fe99f4d08afe875.js → 8a314b3790313e6dc5db.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{b0b2670596d6d8c32b5e.js → 8c056eac35d05d9524b7.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{0086a09441627842d34a.js → 8f3503b2fb6cd38757b9.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{1a713dcc9971e1935401.js → 8f56f298e7c1a283f407.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{dabc5a38a472c9719df9.js → 8ffd4710d168c2fcfd96.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{b2add7338258ca7c24dd.js → 90250e9239c173aace88.js} +1 -1
  69. package/assets/esri/core/workers/chunks/90b2b43b8b54c9a1ec35.js +1 -0
  70. package/assets/esri/core/workers/chunks/90f8b4bda28af43ea019.js +1 -0
  71. package/assets/esri/core/workers/chunks/{89027f6800e17fab8973.js → 9486032af3e934d85582.js} +1 -1
  72. package/assets/esri/core/workers/chunks/95c594a87b732f5c4979.js +1 -0
  73. package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +1 -0
  74. package/assets/esri/core/workers/chunks/99859dce1925b406ccd0.js +1 -0
  75. package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +1 -0
  76. package/assets/esri/core/workers/chunks/9e8dceef4c961f56940d.js +1 -0
  77. package/assets/esri/core/workers/chunks/9fac5a12e878cd745354.js +1 -0
  78. package/assets/esri/core/workers/chunks/a06bac9b8f9e18874de8.js +316 -0
  79. package/assets/esri/core/workers/chunks/a091623bbfb3d771c8d8.js +1 -0
  80. package/assets/esri/core/workers/chunks/{01642fe19e81bfa33eb5.js → a395373e3173e6458a56.js} +1 -1
  81. package/assets/esri/core/workers/chunks/a3991ae8caa713d4ddcd.js +1 -0
  82. package/assets/esri/core/workers/chunks/{135e270b4f03c4270870.js → a4db5c9a90107e097df8.js} +1 -1
  83. package/assets/esri/core/workers/chunks/a712cdff78fc826acd8c.js +1 -0
  84. package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js.LICENSE.txt +1 -1
  85. package/assets/esri/core/workers/chunks/aa54b6f2aba6952af149.js +1 -0
  86. package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
  87. package/assets/esri/core/workers/chunks/ac26e3e77df4302f47a2.js +1 -0
  88. package/assets/esri/core/workers/chunks/af5fc5d6c1d072a27df1.js +1 -0
  89. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js → b017bac40dc8328013e3.js} +2 -2
  90. package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js.LICENSE.txt → b017bac40dc8328013e3.js.LICENSE.txt} +1 -1
  91. package/assets/esri/core/workers/chunks/{bc3bcf88b252760e2574.js → b3028b1ff75eafd0c358.js} +1 -1
  92. package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
  93. package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +2 -0
  94. package/assets/esri/core/workers/chunks/{24921d31efa8d222ad2d.js.LICENSE.txt → b96eb0ea506379182d62.js.LICENSE.txt} +1 -1
  95. package/assets/esri/core/workers/chunks/{b5863afafd3a7d2d5c05.js → bb5484b5eeacc9ad2ceb.js} +3 -3
  96. package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
  97. package/assets/esri/core/workers/chunks/bb7976e2f883b544add6.js +1 -0
  98. package/assets/esri/core/workers/chunks/{5875a51b97ee9bd438a0.js → bc241c7735e4efba734a.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{56916e56c20465428dd4.js → be3b874f86f627f4fa98.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{0eaa4dccba0d844b9da3.js → c3ddcf9148dd2640c402.js} +1 -1
  101. package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +1 -0
  102. package/assets/esri/core/workers/chunks/c4e4da69969499a89a2c.js +1 -0
  103. package/assets/esri/core/workers/chunks/c8733cd621105afab2ac.js +1 -0
  104. package/assets/esri/core/workers/chunks/ccc0da0e01f023c8aa1f.js +1 -0
  105. package/assets/esri/core/workers/chunks/cd1930f08e1fc8b30b14.js +1 -0
  106. package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
  107. package/assets/esri/core/workers/chunks/d048e4926e78458afa3e.js +1 -0
  108. package/assets/esri/core/workers/chunks/d1fe816b6990918c13c7.js +1 -0
  109. package/assets/esri/core/workers/chunks/d305a21666b1ed5bf33d.js +1 -0
  110. package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
  111. package/assets/esri/core/workers/chunks/d40f57f9fc47f9a9f97c.js +1 -0
  112. package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
  113. package/assets/esri/core/workers/chunks/d97fadbc69e055d183a0.js +1 -0
  114. package/assets/esri/core/workers/chunks/dedc4583b5f32a278124.js +1 -0
  115. package/assets/esri/core/workers/chunks/e31192ae920e3e19b6aa.js +1 -0
  116. package/assets/esri/core/workers/chunks/{e5bcc44f3dc6fc90835a.js → e5a06ce0ef6a9a90e100.js} +1 -1
  117. package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +1 -0
  118. package/assets/esri/core/workers/chunks/f0e0a63962784acb4ba1.js +1 -0
  119. package/assets/esri/core/workers/chunks/{039ec0fbe3b4b398b8c6.js → f26dc1d83beed63b6045.js} +1 -1
  120. package/assets/esri/core/workers/chunks/{fa5c87889c2f0bef896b.js → f35aaa04cca676c2d3f8.js} +1 -1
  121. package/assets/esri/core/workers/chunks/f4d0ae6be1b3984228d0.js +1 -0
  122. package/assets/esri/core/workers/chunks/{7c5c272612198db83851.js → f5e47eea8720ba84665b.js} +1 -1
  123. package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
  124. package/assets/esri/core/workers/chunks/{fa4411e0a5ac3fcba365.js → f65c0102af17390a50ac.js} +1 -1
  125. package/assets/esri/core/workers/chunks/f6c11c8ac687de3ef1ab.js +1 -0
  126. package/assets/esri/core/workers/chunks/f6c8beb60f6d29945a2e.js +1 -0
  127. package/assets/esri/core/workers/chunks/f746e3f7ebff2bbdf333.js +1 -0
  128. package/assets/esri/core/workers/chunks/f9324e88c359c03f35aa.js +1 -0
  129. package/assets/esri/core/workers/chunks/{cfa3164e7fa1884dc2b9.js → facb3886714222772ab2.js} +1 -1
  130. package/assets/esri/core/workers/chunks/fd2efd1d1cf9d95a87e6.js +1 -0
  131. package/assets/esri/core/workers/chunks/{fe3f95fda29e4844b153.js → fe77ae6cf232a7a3298e.js} +1 -1
  132. package/assets/esri/core/workers/chunks/{2ce4a0fe4fae63c43a81.js → ff35a077ac6776469805.js} +1 -1
  133. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  134. package/assets/esri/themes/base/widgets/_Directions.scss +17 -18
  135. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +14 -4
  136. package/assets/esri/themes/dark/main.css +1 -1
  137. package/assets/esri/themes/light/main.css +1 -1
  138. package/assets/esri/themes/light/view.css +1 -1
  139. package/chunks/ComponentShader.glsl.js +72 -39
  140. package/chunks/OITBlend.glsl.js +3 -3
  141. package/chunks/bundle.js +1 -1
  142. package/config.js +1 -1
  143. package/core/Identifiable.js +1 -1
  144. package/core/MultiOriginJSONSupport.js +1 -1
  145. package/core/NumericIdentifiable.js +5 -0
  146. package/core/QueueProcessor.js +1 -1
  147. package/core/WriteableMultiOriginJSONMixin.js +5 -0
  148. package/core/has.js +1 -1
  149. package/core/performance.js +5 -0
  150. package/core/sanitizerUtils.js +1 -1
  151. package/core/scheduling.js +1 -1
  152. package/core/workers/Connection.js +1 -1
  153. package/core/workers/WorkerHandle.js +1 -1
  154. package/core/workers/utils.js +1 -1
  155. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  156. package/geohash/GeohashCell.js +1 -1
  157. package/geohash/geohashUtils.js +1 -1
  158. package/geometry/GeometryCursor.js +1 -1
  159. package/geometry/geometryCursorCollectUtils.js +1 -1
  160. package/geometry/libtess.js +1 -1
  161. package/geometry/support/jsonUtils.js +1 -1
  162. package/geometry/support/normalizeUtilsSync.js +1 -1
  163. package/geometry/support/triangulationUtils.js +1 -1
  164. package/interfaces.d.ts +444 -349
  165. package/intl/date.js +1 -1
  166. package/intl.d.ts +2 -0
  167. package/intl.js +1 -1
  168. package/kernel.js +1 -1
  169. package/layers/FeatureLayer.js +1 -1
  170. package/layers/graphics/OptimizedFeature.js +1 -1
  171. package/layers/graphics/OptimizedGeometry.js +1 -1
  172. package/layers/graphics/centroid.js +1 -1
  173. package/layers/graphics/contains.js +1 -1
  174. package/layers/graphics/data/AttributesBuilder.js +1 -1
  175. package/layers/graphics/data/FeatureStore.js +1 -1
  176. package/layers/graphics/data/QueryEngine.js +1 -1
  177. package/layers/graphics/data/QueryEngineResult.js +1 -1
  178. package/layers/graphics/data/geometryUtils.js +1 -1
  179. package/layers/graphics/data/spatialQuerySupport.js +1 -1
  180. package/layers/graphics/featureConversionUtils.js +1 -1
  181. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  182. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  183. package/layers/graphics/sources/geojson/geojson.js +1 -1
  184. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  185. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  186. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  187. package/layers/knowledgeGraph/layerUtils.js +1 -1
  188. package/layers/mixins/ArcGISImageService.js +1 -1
  189. package/layers/mixins/ImageryTileMixin.js +1 -1
  190. package/layers/support/MediaElementBase.js +1 -1
  191. package/layers/support/PixelBlock.js +1 -1
  192. package/layers/support/RasterInfo.js +1 -1
  193. package/layers/support/RasterJobHandler.js +1 -1
  194. package/layers/support/RasterSensorInfo.js +1 -1
  195. package/layers/support/RasterStorageInfo.js +1 -1
  196. package/layers/support/RasterWorker.js +1 -1
  197. package/layers/support/TitleCreator.js +1 -1
  198. package/layers/support/arcgisLayerUrl.js +1 -1
  199. package/layers/support/capabilities.js +1 -1
  200. package/layers/support/fieldUtils.js +1 -1
  201. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  202. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  203. package/layers/support/rasterFieldUtils.js +1 -1
  204. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  205. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  206. package/package.json +5 -5
  207. package/request.js +1 -1
  208. package/rest/print.js +1 -1
  209. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  210. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  211. package/rest/query/operations/query.js +1 -1
  212. package/rest/query/operations/queryZScale.js +1 -1
  213. package/rest/versionManagement/getVersionInfos.js +1 -1
  214. package/smartMapping/statistics/histogram.js +1 -1
  215. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  216. package/smartMapping/support/utils.js +1 -1
  217. package/support/basemapDefinitions.js +1 -1
  218. package/support/elevationInfoUtils.js +1 -1
  219. package/support/requestImageUtils.js +1 -1
  220. package/support/revision.js +1 -1
  221. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  222. package/undoredo/support/Services.js +1 -1
  223. package/views/2d/GoToManager.js +1 -1
  224. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  225. package/views/2d/constraints/GeometryConstraint.js +1 -1
  226. package/views/2d/constraints/RotationConstraint.js +1 -1
  227. package/views/2d/constraints/ZoomConstraint.js +1 -1
  228. package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
  229. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  230. package/views/2d/engine/webgl/Mesh2D.js +1 -1
  231. package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
  232. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  233. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  234. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  235. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  236. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  237. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  238. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  239. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  240. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  241. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  242. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  243. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  244. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  245. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  246. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  247. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  248. package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
  249. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  250. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  251. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  252. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  253. package/views/2d/layers/features/support/GraphicsReader.js +1 -1
  254. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  255. package/views/3d/FocusAreasView.js +1 -1
  256. package/views/3d/GroundView3D.js +1 -1
  257. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  258. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  259. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  260. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  261. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  262. package/views/3d/layers/FlowSubView3D.js +1 -1
  263. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  264. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  265. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  266. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  267. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  268. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  269. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  270. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  271. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  272. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  273. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  274. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  275. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  276. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  277. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  278. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  279. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  280. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  281. package/views/3d/layers/support/lyr3dTypeConversions.js +1 -1
  282. package/views/3d/state/ViewStateManager.js +1 -1
  283. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  284. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  285. package/views/3d/state/controllers/RotateController.js +1 -1
  286. package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
  287. package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
  288. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  289. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  290. package/views/3d/state/utils/navigationUtils.js +1 -1
  291. package/views/3d/support/DisplayQualityProfile.js +1 -1
  292. package/views/3d/support/QualitySettings.js +1 -1
  293. package/views/3d/support/StreamDataLoader.js +1 -1
  294. package/views/3d/support/engineContent/line.js +1 -1
  295. package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
  296. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  297. package/views/3d/support/flow/FlowWorker.js +1 -1
  298. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  299. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  300. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  301. package/views/3d/support/flow/constants.js +1 -1
  302. package/views/3d/support/hitTest.js +1 -1
  303. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  304. package/views/3d/terrain/OverlayRenderer.js +1 -1
  305. package/views/3d/terrain/Tile.js +1 -1
  306. package/views/3d/terrain/TileOverlayData.js +1 -1
  307. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  308. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  309. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  310. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  312. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +7 -7
  313. package/views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js +5 -0
  314. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConstructionContext.js +1 -1
  315. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  316. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  317. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  318. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  319. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +4 -4
  320. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  321. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  322. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  323. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  324. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  325. package/views/analysis/ElevationProfile/constants.js +1 -1
  326. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  327. package/views/draw/support/Reshape.js +1 -1
  328. package/views/draw/support/reshapeUtils.js +1 -1
  329. package/views/interactive/dragEventPipeline.js +1 -1
  330. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  331. package/views/support/Scheduler.js +1 -1
  332. package/views/webgl/ShaderBuilder.js +1 -1
  333. package/views/webgl/Texture.js +1 -1
  334. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  335. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  336. package/widgets/BatchAttributeForm.js +1 -1
  337. package/widgets/Directions/css.js +1 -1
  338. package/widgets/Directions.js +1 -1
  339. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  340. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  341. package/widgets/Editor/EditorViewModel.js +1 -1
  342. package/widgets/Editor/Edits.js +1 -1
  343. package/widgets/Editor/MergeFeaturesWorkflow.d.ts +4 -0
  344. package/widgets/Editor/MergeFeaturesWorkflow.js +5 -0
  345. package/widgets/Editor/MergeFeaturesWorkflowData.d.ts +4 -0
  346. package/widgets/Editor/MergeFeaturesWorkflowData.js +5 -0
  347. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  348. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  349. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  350. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  351. package/widgets/Editor/components/UploadDetails.js +1 -1
  352. package/widgets/Editor/support/EditorItem.js +1 -1
  353. package/widgets/Editor/support/mergeFeaturesUtils.js +5 -0
  354. package/widgets/Editor/workflowUtils.js +1 -1
  355. package/widgets/Editor.js +1 -1
  356. package/widgets/Feature/FeatureExpression.js +1 -1
  357. package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
  358. package/widgets/Feature/FeatureFields.js +1 -1
  359. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  360. package/widgets/Feature/FeatureMedia.js +1 -1
  361. package/widgets/Feature/FeatureViewModel.js +1 -1
  362. package/widgets/Feature/support/featureUtils.js +1 -1
  363. package/widgets/Feature.js +1 -1
  364. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  365. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  366. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  367. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  368. package/widgets/Print.js +1 -1
  369. package/widgets/Search/LayerSearchSource.js +1 -1
  370. package/widgets/UtilityNetworkTrace.js +1 -1
  371. package/widgets/support/ColorPicker.js +1 -1
  372. package/widgets/support/SelectionList/LayerItem.js +1 -1
  373. package/widgets/support/jsxWidgetSupport.js +1 -1
  374. package/assets/esri/core/workers/chunks/0429c1a3690f20647c9f.js +0 -1
  375. package/assets/esri/core/workers/chunks/065f2bbcaeef1f13fd48.js +0 -1
  376. package/assets/esri/core/workers/chunks/0731e588afd1f561ec3b.js +0 -1
  377. package/assets/esri/core/workers/chunks/188272af9a6470ccfe31.js +0 -1
  378. package/assets/esri/core/workers/chunks/18da83afbc324fef9fd8.js +0 -316
  379. package/assets/esri/core/workers/chunks/1a9f544f20f643161a36.js +0 -1
  380. package/assets/esri/core/workers/chunks/1cfcadaa98ac528fea37.js +0 -1
  381. package/assets/esri/core/workers/chunks/1db0bf570a04687b3130.js +0 -1
  382. package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +0 -2
  383. package/assets/esri/core/workers/chunks/2a900a632a1231deb713.js +0 -1
  384. package/assets/esri/core/workers/chunks/31c6e951b99315e8e68a.js +0 -1
  385. package/assets/esri/core/workers/chunks/35491fbdd287470d40a4.js +0 -1
  386. package/assets/esri/core/workers/chunks/36247c6f6fc2891df2cf.js +0 -1
  387. package/assets/esri/core/workers/chunks/3d53307efbc3f07d7bf2.js +0 -1
  388. package/assets/esri/core/workers/chunks/40b81d1c2d53cf598b8e.js +0 -1
  389. package/assets/esri/core/workers/chunks/42a72e1d963e4636323b.js +0 -1
  390. package/assets/esri/core/workers/chunks/456161a323be7d640c61.js +0 -1
  391. package/assets/esri/core/workers/chunks/500d09d2191127371081.js +0 -1
  392. package/assets/esri/core/workers/chunks/50864c1924030e62497d.js +0 -1
  393. package/assets/esri/core/workers/chunks/5707713c2f27588b9194.js +0 -1
  394. package/assets/esri/core/workers/chunks/5713f96bade5ebb54c81.js +0 -1
  395. package/assets/esri/core/workers/chunks/5718cf135e105e1e026b.js +0 -1
  396. package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +0 -1
  397. package/assets/esri/core/workers/chunks/5d1d909354c90cb8eb60.js +0 -1
  398. package/assets/esri/core/workers/chunks/5ea03f53d4d64d9e7cae.js +0 -1
  399. package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +0 -1
  400. package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +0 -1
  401. package/assets/esri/core/workers/chunks/64ee8d2acae2d6fce608.js +0 -1
  402. package/assets/esri/core/workers/chunks/6fcacfcb3d83515c37c9.js +0 -1
  403. package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +0 -1
  404. package/assets/esri/core/workers/chunks/7421f9575487cdc9e28e.js +0 -1
  405. package/assets/esri/core/workers/chunks/77a11d7d53325d108ed8.js +0 -1
  406. package/assets/esri/core/workers/chunks/7a05b1f6163112bc9db2.js +0 -1
  407. package/assets/esri/core/workers/chunks/7d9882ddfa6495f72baa.js +0 -1
  408. package/assets/esri/core/workers/chunks/7fffad8ff6878fa1fd56.js +0 -1
  409. package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +0 -1
  410. package/assets/esri/core/workers/chunks/8b16aa50d879b92a5375.js +0 -1
  411. package/assets/esri/core/workers/chunks/8bc64fc7c4b9eb8fca4d.js +0 -1
  412. package/assets/esri/core/workers/chunks/8bfa19c24be0e3f3fd74.js +0 -1
  413. package/assets/esri/core/workers/chunks/8eefa133c36a004c054c.js +0 -1
  414. package/assets/esri/core/workers/chunks/9834bc11586a2d8d6f35.js +0 -1
  415. package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +0 -1
  416. package/assets/esri/core/workers/chunks/a5f25104938ab33e7a85.js +0 -1
  417. package/assets/esri/core/workers/chunks/a7bd294996e6c8b8354a.js +0 -1
  418. package/assets/esri/core/workers/chunks/abf4f018c692c18c3320.js +0 -1
  419. package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +0 -1
  420. package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +0 -1
  421. package/assets/esri/core/workers/chunks/b62807c6fcfb70a87cd4.js +0 -1
  422. package/assets/esri/core/workers/chunks/b8339c1d60847a9eed3e.js +0 -1
  423. package/assets/esri/core/workers/chunks/bc6619307f312f9241bf.js +0 -1
  424. package/assets/esri/core/workers/chunks/bfc1e8aec7aace3ff30e.js +0 -1
  425. package/assets/esri/core/workers/chunks/c362fbbafec91c44eeb2.js +0 -1
  426. package/assets/esri/core/workers/chunks/c368a8e8d2f1535af446.js +0 -1
  427. package/assets/esri/core/workers/chunks/c941d15190fc08523d0d.js +0 -1
  428. package/assets/esri/core/workers/chunks/cc70a4a915b0b2ccb2a0.js +0 -1
  429. package/assets/esri/core/workers/chunks/d121045cddbe55c2ecb2.js +0 -1
  430. package/assets/esri/core/workers/chunks/d2120a623b1bd91b9ed9.js +0 -1
  431. package/assets/esri/core/workers/chunks/d78c2833cdc4730a88a3.js +0 -1
  432. package/assets/esri/core/workers/chunks/df438b62702007267798.js +0 -1
  433. package/assets/esri/core/workers/chunks/f4eb090bcc3eca64306a.js +0 -1
  434. package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +0 -1
  435. package/assets/esri/core/workers/chunks/f839b86bee15deaf84e4.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../request.js";import s from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import{removeMaybe as n,abortMaybe as i,destroyMaybe as u}from"../../../core/maybe.js";import{createResolver as l,createAbortError as h,onAbort as d,throwIfAborted as c,isAbortError as m}from"../../../core/promiseUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{AsyncWorkerQueue as g,BaseTask as f}from"./AsyncWorkerQueue.js";import{ImageWithType as k}from"./ImageWithType.js";import{isImageWithType as b}from"../terrain/TerrainData.js";import{assert as y}from"../webgl-engine/lib/Util.js";import{TaskPriority as T}from"../../support/Scheduler.js";let L=class extends s{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,t,s){this._loadQueue=new g((e,t)=>this._startLoading(e,t),(e,t)=>this._doneLoadingCB(e,t),e,t),s&&(this._frameTask=s.registerTask(T.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=n(this._frameTask),this._tasks.forEach(e=>i(e.abortController)),this._loadQueue=u(this._loadQueue),this._onLoadQueue.length=0,this._onLoadQueue=null,this._doneQueue.length=0,this._doneQueue=null,this._tasks.forEach(e=>e.destroy()),this._tasks.clear(),this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,t,s,r={}){const o=l();return o.__signal=null!=r?r.signal:null,this._createOrUpdateTask(e,t,s,r,o),o.promise}_createTask(e,t,s,r,o,a){const n=new j(e,t,s,r,o);return this._updateTask(n,a),this._tasks.set(o,n),1===this._tasks.size&&this._set("updating",!0),this._loadQueue.push(n),n}_cancelRequest(e,t){const s=this._tasks.get(e);s&&(r(s.resolvers,t),t.reject(h()),0===s.resolvers.length&&(2===s.status&&this._loadQueue.cancel(s),s.status=4,this._removeTask(s)))}_updateTask(e,t){e.resolvers.push(t)}_createOrUpdateTask(e,t,s,r,o){const a=v(r?.uid||e,t,s);let n=this._tasks.get(a);n?this._updateTask(n,o):(n=this._createTask(e,r,t,s,a,o),n.abortHandle=d(r,()=>this._cancelRequest(a,o)))}_doneLoadingCB(e,t){this._loadQueue&&(y(2===e.status),e.status=3,this._frameTask?this._doneQueue.push({task:e,err:t}):this._doneLoading(e,t))}get readyToRun(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const t=this._onLoadQueue.shift();c(t.task.abortController),t.task.abortController=null,t.callback(t.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const t=this._doneQueue.shift();3!==t.task.status&&(t.err=t.err||h()),this._doneLoading(t.task,t.err),e.madeProgress()}}_doneLoading(e,t){if(t&&!m(t)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let s=b(e.result)||e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const r of e.resolvers)if(t)m(t)?r.reject(t):r.reject(new o("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${t}`,{url:e.url,error:t}));else{--s;const t=s>0?a(e.result):e.result;r.resolve(t)}this._removeTask(e)}_removeTask(e){this._tasks.delete(e.key),e.destroy(),0===this._tasks.size&&this._set("updating",!1)}_startLoading(e,s){if(4===e.status)return!1;let r,o;switch(e.startTime=performance.now(),e.status=2,e.docType){case 1:o="array-buffer",r=0;break;case 2:o="image";break;case 3:o="array-buffer";break;default:o="json"}e.abortController=new AbortController;const a=e.abortController.signal;e.request=t(e.url,{...e.options,responseType:o,timeout:r,signal:a});const n=t=>{e.duration=performance.now()-e.startTime,e.size=t instanceof ArrayBuffer?t.byteLength:e.size||0,e.result=t,this._frameTask?this._onLoadQueue.push({callback:s,task:e}):(e.abortController=null,s(e))},i=t=>{2===e.status&&s(e,t)};return 3!==e.docType?(e.request.then(e=>n(e.data),i),!0):(e.request.then(s=>{const u=s.data,l=Q(u);if(o="image",e.size=u.byteLength,"unknown"===l)return e.request=t(e.url,{responseType:o,timeout:r,signal:a}),void e.request.then(e=>n(e.data),i);const h=new Blob([u],{type:l}),d=window.URL.createObjectURL(h);e.request=t(d,{responseType:o,timeout:r,signal:a}),e.request.then(e=>n(new k(e.data,l)),i).finally(()=>window.URL.revokeObjectURL(d))},i),!0)}get test(){}};e([p({readOnly:!0})],L.prototype,"updating",void 0),L=e([_("esri.views.3d.support.StreamDataLoader")],L);const w={numRetries:0};function Q(e){if(e.byteLength<2)return"unknown";const t=new Uint8Array(e,0,e.byteLength);return 137===t[0]&&80===t[1]?"image/png":71===t[0]&&73===t[1]?"image/gif":66===t[0]&&77===t[1]?"image/bmp":255===t[0]&&216===t[1]?"image/jpeg":"unknown"}class j extends f{constructor(e,t,s,r,o){super(r),this.url=e,this.options=t,this.docType=s,this.key=o,this.abortHandle=null,this.result=null,this.status=1,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=w.numRetries}destroy(){this.result=null,this.request=null,this.abortController?.abort(),this.abortController=null,this.resolvers.length=0,this.options=null,this.abortHandle=n(this.abortHandle)}}function v(e,t,s){return`${e}:${t}:${s}`}export{L as StreamDataLoader,w as test};
5
+ import{__decorate as e}from"tslib";import t from"../../../request.js";import s from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import{neverReached as o}from"../../../core/compilerUtils.js";import a from"../../../core/Error.js";import"../../../core/has.js";import{clone as n}from"../../../core/lang.js";import{removeMaybe as i,abortMaybe as u,destroyMaybe as l}from"../../../core/maybe.js";import{createResolver as h,createAbortError as d,onAbort as c,throwIfAborted as m,isAbortError as p}from"../../../core/promiseUtils.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import{AsyncWorkerQueue as f,BaseTask as k}from"./AsyncWorkerQueue.js";import{ImageWithType as b}from"./ImageWithType.js";import{isImageWithType as y}from"../terrain/TerrainData.js";import{assert as T}from"../webgl-engine/lib/Util.js";import{TaskPriority as L}from"../../support/Scheduler.js";let j=class extends s{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,t,s){this._loadQueue=new f((e,t)=>this._startLoading(e,t),(e,t)=>this._doneLoadingCB(e,t),e,t),s&&(this._frameTask=s.registerTask(L.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=i(this._frameTask),this._tasks.forEach(e=>u(e.abortController)),this._loadQueue=l(this._loadQueue),this._onLoadQueue.length=0,this._onLoadQueue=null,this._doneQueue.length=0,this._doneQueue=null,this._tasks.forEach(e=>e.destroy()),this._tasks.clear(),this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,t,s,r={}){const o=h();return o.__signal=null!=r?r.signal:null,this._createOrUpdateTask(e,t,s,r,o),o.promise}_createTask(e,t,s,r,o,a){const n=new v(e,t,s,r,o);return this._updateTask(n,a),this._tasks.set(o,n),1===this._tasks.size&&this._set("updating",!0),this._loadQueue.push(n),n}_cancelRequest(e,t){const s=this._tasks.get(e);s&&(r(s.resolvers,t),t.reject(d()),0===s.resolvers.length&&(2===s.status&&this._loadQueue.cancel(s),s.status=4,this._removeTask(s)))}_updateTask(e,t){e.resolvers.push(t)}_createOrUpdateTask(e,t,s,r,o){const a=q(r?.uid||e,t,s);let n=this._tasks.get(a);n?this._updateTask(n,o):(n=this._createTask(e,r,t,s,a,o),n.abortHandle=c(r,()=>this._cancelRequest(a,o)))}_doneLoadingCB(e,t){this._loadQueue&&(T(2===e.status),e.status=3,this._frameTask?this._doneQueue.push({task:e,err:t}):this._doneLoading(e,t))}get readyToRun(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const t=this._onLoadQueue.shift();m(t.task.abortController),t.task.abortController=null,t.callback(t.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const t=this._doneQueue.shift();3!==t.task.status&&(t.err=t.err||d()),this._doneLoading(t.task,t.err),e.madeProgress()}}_doneLoading(e,t){if(t&&!p(t)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let s=y(e.result)||e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const r of e.resolvers)if(t)p(t)?r.reject(t):r.reject(new a("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${t}`,{url:e.url,error:t}));else{--s;const t=s>0?n(e.result):e.result;r.resolve(t)}this._removeTask(e)}_removeTask(e){this._tasks.delete(e.key),e.destroy(),0===this._tasks.size&&this._set("updating",!1)}_startLoading(e,s){if(4===e.status)return!1;let r;e.startTime=performance.now(),e.status=2;let a="json";switch(e.docType){case 1:a="array-buffer",r=0;break;case 2:a="image";break;case 3:a="array-buffer";break;case 0:a="json";break;default:o(e.docType)}e.abortController=new AbortController;const n=e.abortController.signal;e.request=t(e.url,{...e.options,responseType:a,timeout:r,signal:n});const i=t=>{e.duration=performance.now()-e.startTime,e.size=t instanceof ArrayBuffer?t.byteLength:e.size||0,e.result=t,this._frameTask?this._onLoadQueue.push({callback:s,task:e}):(e.abortController=null,s(e))},u=t=>{2===e.status&&s(e,t)};return 3!==e.docType?(e.request.then(e=>i(e.data),u),!0):(e.request.then(s=>{const o=s.data,l=Q(o);if(a="image",e.size=o.byteLength,"unknown"===l)return e.request=t(e.url,{responseType:a,timeout:r,signal:n}),void e.request.then(e=>i(e.data),u);const h=new Blob([o],{type:l}),d=window.URL.createObjectURL(h);e.request=t(d,{responseType:a,timeout:r,signal:n}),e.request.then(e=>i(new b(e.data,l)),u).finally(()=>window.URL.revokeObjectURL(d))},u),!0)}get test(){}};e([_({readOnly:!0})],j.prototype,"updating",void 0),j=e([g("esri.views.3d.support.StreamDataLoader")],j);const w={numRetries:0};function Q(e){if(e.byteLength<2)return"unknown";const t=new Uint8Array(e,0,e.byteLength);return 137===t[0]&&80===t[1]?"image/png":71===t[0]&&73===t[1]?"image/gif":66===t[0]&&77===t[1]?"image/bmp":255===t[0]&&216===t[1]?"image/jpeg":"unknown"}class v extends k{constructor(e,t,s,r,o){super(r),this.url=e,this.options=t,this.docType=s,this.key=o,this.abortHandle=null,this.result=null,this.status=1,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=w.numRetries}destroy(){this.result=null,this.request=null,this.abortController?.abort(),this.abortController=null,this.resolvers.length=0,this.options=null,this.abortHandle=i(this.abortHandle)}}function q(e,t,s){return`${e}:${t}:${s}`}export{j as StreamDataLoader,w as test};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";function f(t,e,r=null){const o=[],n=e.mapPositions,i=m(e,o),a=i.data,u=i.indices.length,s=l(u);return h(e,o,s),y(e,o,s),g(e,o,s),b(e,o,i.indices,s),w(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),d(e,o,a),new p(t,o,n,2,r)}function m(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=j(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let c=0;c<i-1;c++)a[s++]=c,a[s++]=c+1;const l=new c(u,a,3,n);return e.push(["position",l]),l}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new c(n??o,r,4)])}function g(t,e,r){t.attributeData.normal&&e.push(["normal",new c(t.attributeData.normal,r,3)])}function b(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new c([n],o,1,!0)]):e.push(["colorFeatureAttribute",new c(n,r,1,!0)]))}function y(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new c([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new c(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new c(o,i,z,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new c([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new c(n,r,1,!0)]))}function d(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,p);const f=s.length/3,m=u(f+1);let h=A,g=v,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new c(m,o[0][1].indices,1,!0)])}function j(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const A=r(),v=r(),z=4;function S(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function E(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=S(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?x(o.timeStamps,o.streamlineType):void 0;a[e].attributeData.timeStamps=n}),a}function I(t,e=0,r=.01){const o=s(t.length);o[0]=0;for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[i]=o[i-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function x(t,e){const r=s(t.length*z),o=t[0],n=t[t.length-1];for(let i=0;i<t.length;i++)r[i*z]=t[i],r[i*z+1]=o,r[i*z+2]=n,r[i*z+3]=e;return r}export{E as animatedLineStripsToParameters,f as createGeometry,I as getLinearTimeStamps,S as lineStripsToParameters,z as numTimeStampValuesPerVertex,x as timeStampsToAttribute};
5
+ import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";function f(t,e,r=null){const o=[],n=e.mapPositions,i=m(e,o),a=i.data,u=i.indices.length,s=l(u);return h(e,o,s),y(e,o,s),g(e,o,s),b(e,o,i.indices,s),w(e,o,i.indices,s),D(e,o),F(e,o,i.indices,s),d(e,o,a),new p(t,o,n,2,r)}function m(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=j(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let c=0;c<i-1;c++)a[s++]=c,a[s++]=c+1;const l=new c(u,a,3,n);return e.push(["position",l]),l}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new c(n??o,r,4)])}function g(t,e,r){t.attributeData.normal&&e.push(["normal",new c(t.attributeData.normal,r,3)])}function b(t,e,r,o){const n=t.attributeData.colorFeature;null!=n&&("number"==typeof n?e.push(["colorFeatureAttribute",new c([n],o,1,!0)]):e.push(["colorFeatureAttribute",new c(n,r,1,!0)]))}function y(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r,o){const n=t.attributeData.sizeFeature;null!=n&&("number"==typeof n?e.push(["sizeFeatureAttribute",new c([n],o,1,!0)]):e.push(["sizeFeatureAttribute",new c(n,r,1,!0)]))}function D(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let u=0;u<n-1;u++)i[a++]=u,i[a++]=u+1;e.push(["timeStamps",new c(o,i,z,!0)])}function F(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&("number"==typeof n?e.push(["opacityFeatureAttribute",new c([n],o,1,!0)]):e.push(["opacityFeatureAttribute",new c(n,r,1,!0)]))}function d(r,o,s){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const l=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<l.length;t+=3)i(s,t,l,t,p);const f=s.length/3,m=u(f+1);let h=A,g=v,b=0,y=0;t(h,l[y++],l[y++]),y++,m[0]=0;for(let n=1;n<f+1;++n)n===f&&(y=0),t(g,l[y++],l[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new c(m,o[0][1].indices,1,!0)])}function j(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const A=r(),v=r(),z=4;function S(t,e,r,o,n){if(null==t||0===t.length)return[];const i=[];return t.forEach((t,u)=>{const s=t.length,l=a(3*s);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const c={attributeData:{position:l,normal:e,colorFeature:r?.[u],opacityFeature:o?.[u],sizeFeature:n?.[u]},removeDuplicateStartEnd:!1};i.push(c)}),i}function E(t,e,r,o,n,i){if(null==t||0===t.length)return[];const a=S(t,e,o,n,i);return t.forEach((t,e)=>{const o=r?.[e],n=null!=o?x(o.timeStamps,o.streamlineType):void 0;a[e].attributeData.timeStamps=n}),a}function I(t,e=0,r=.01){const o=s(t.length);o[0]=0;for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[i]=o[i-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function x(t,e){const r=s(t.length*z),o=t[0],n=t[t.length-1];for(let i=0;i<t.length;i++)r[i*z]=t[i],r[i*z+1]=o,r[i*z+2]=n,r[i*z+3]=e+.5;return r}export{E as animatedLineStripsToParameters,f as createGeometry,I as getLinearTimeStamps,S as lineStripsToParameters,z as numTimeStampValuesPerVertex,x as timeStampsToAttribute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as s}from"../../../2d/engine/flow/dataUtils.js";import r from"../../layers/FlowSubView3D.js";let i=class extends r{constructor(t){super(t)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad())}async fetchDataAndGenerateStreamlines(t,e){const{needsMagnitude:r,workerHandle:i}=this,o=this.getSimulationSettings(t),{size:n,extent:a,timeExtent:l}=t;if(null==o||null==i)return;const d=await s(this.layer,a,n[0],n[1],l,e);if(null==d)return null;const u={simulationSettings:o,flowExtentInfo:t.flowExtentInfo,flowData:d,needsMagnitude:r,startPositions:this.startPositions(t)},{streamlines:m}=await i.generateStreamlines(u,e);return m}};i=t([e("esri.views.3d.support.flow.FlowSubViewExtent3D")],i);export{i as default};
5
+ import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as s}from"../../../2d/engine/flow/dataUtils.js";import o from"../../layers/FlowSubView3D.js";let i=class extends o{constructor(e){super(e)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad()),this.updatingHandles.add(()=>this.elevationInfo.mode,e=>this._updatePopupDrapeSource(e),{initial:!0})}_updatePopupDrapeSource(e){if("on-the-ground"===e)return void this.removeHandles(a);if(this.hasHandles(a))return;const r={destroyed:!1,drapeSourceType:2,updatePolicy:0,layer:this.layer},s=this.layerView.view.overlayManager;s.registerGeometryDrapeSource(r),this.addHandles(t(()=>s.unregisterDrapeSource(r)),a)}async fetchDataAndGenerateStreamlines(e,t){const{needsMagnitude:r,workerHandle:o}=this,i=this.getSimulationSettings(e),{size:a,extent:n,timeExtent:l}=e;if(null==i||null==o)return;const d=await s(this.layer,n,a[0],a[1],l,t);if(null==d)return null;const u={simulationSettings:i,flowExtentInfo:e.flowExtentInfo,flowData:d,needsMagnitude:r,startPositions:this.startPositions(e)},{streamlines:p}=await o.generateStreamlines(u,t);return p}};i=e([r("esri.views.3d.support.flow.FlowSubViewExtent3D")],i);const a=Symbol("popupDrapeSource");export{i 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{watch as e,sync as r}from"../../../../core/reactiveUtils.js";import{throttle as s}from"../../../../core/throttle.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as l}from"../../../2d/engine/flow/dataUtils.js";import n from"../../layers/FlowSubView3D.js";import{tilesWaitingTime as d}from"./constants.js";import{tileToKey as u,FlowDataTile as h}from"./loadUtils.js";import{isRasterTile as g}from"../../terrain/TerrainData.js";let c=class extends n{constructor(t){super(t),this._resetTileData=!0,this._throttledTriggerLoad=null,this._throttling=!1}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:t,layerIndex:e,layerClass:r})=>{const{renderedTiles:s}=this;null!=s&&e===this._layerIndex&&1===r&&this._updateFlowDataTile(t)}),e(()=>this.renderedTiles,t=>{const e=this.frameTask.scheduleGenerator(e=>this._updateFlowDataTiles(t,e));this.updatingHandles.addPromise(e)},r)]),this._throttledTriggerLoad=s(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,d,this),this.addHandles(this._throttledTriggerLoad)}async*_updateFlowDataTiles(t,e){const r=f();for(const s of t??[]){const t=this._flowDataTiles?.get(u(s)),i=null==t||"delete"===t?this._getFlowDataCopy(s):t;null!=i&&r.set(u(s),i),e.madeProgress(),e.done&&(e=yield)}this._flowDataTiles=r,this._resetTileData=!0,this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get readyToLoad(){return super.readyToLoad&&null!=this._flowDataTiles}triggerLoad(){const t=this._numberLoadedTiles===this.renderedTiles?.size,{_throttledTriggerLoad:e}=this;t?(e.hasPendingUpdates()||e(),e.forceUpdate()):e()}async fetchDataAndGenerateStreamlines(t,e){const{_flowDataTiles:r,needsMagnitude:s,workerHandle:i}=this,o=this.getSimulationSettings(t);if(null==o||null==i||null==r)return;const a=this._resetTileData;this._resetTileData=!1;const l=f();r.forEach((t,e)=>{"delete"===t?(l.set(e,"delete"),r.delete(e)):(a||"on-worker"!==t)&&(l.set(e,t),r.set(e,"on-worker"))});const n={simulationSettings:o,flowExtentInfo:t.flowExtentInfo,flowDataTiles:l,pixelSize:this.surface.tilingScheme.pixelSize,reset:a,needsMagnitude:s,startPositions:this.startPositions(t)},{streamlines:d}=await i.generateTiledStreamlines(n,e);return d}getUpdating(){return super.getUpdating()||this._throttling}_getFlowDataCopy(t){const{_layerIndex:e}=this,r=null==t.surface;if(null==e||r)return null;const s=t.getLayerInfo(e,1);if(null==s)return null;if(!t.visible&&null==s.requestAbort)return s.requestAbort=new AbortController,this.surface.requestTileData(t,e,1,s.requestAbort),null;if(s.dataMissing||!t.hasLayerData(e,1))return null;const{data:i}=s;if(!g(i))return null;const o=l(this.layer.serviceRasterInfo.dataType,i.source),n=new Uint8Array(o.width*o.height);for(let a=0;a<n.length;a++)n[a]=o.mask[a];return new h(o.data,n,o.width,o.height,t.lij,a(t.extent))}_updateFlowDataTile(t){const e=this.renderedTiles?.has(t)?this._getFlowDataCopy(t)??"delete":"delete";this._setTileData(t,e)&&this.triggerLoad()}_setTileData(t,e){const{_flowDataTiles:r}=this;if(null==r)return!1;const s=u(t);return(null!=r.get(s)||"delete"!==e)&&(r.set(s,e),!0)}get _numberLoadedTiles(){let t=0;for(const e of this._flowDataTiles?.values()??[])"delete"!==e&&t++;return t}get test(){return{...super.test,loadedTiles:this._flowDataTiles??f()}}};function f(){return new Map}t([i()],c.prototype,"_throttling",void 0),c=t([o("esri.views.3d.support.flow.FlowSubViewTiles3D")],c);export{c as default};
5
+ import{__decorate as e}from"tslib";import{watch as t,sync as s}from"../../../../core/reactiveUtils.js";import{throttle as r}from"../../../../core/throttle.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as o}from"../../../2d/engine/flow/dataUtils.js";import n from"../../layers/FlowSubView3D.js";import{tilesWaitingTime as d}from"./constants.js";import{tileToKey as h,FlowDataTile as u}from"./loadUtils.js";import{isRasterTile as g}from"../../terrain/TerrainData.js";let c=class extends n{constructor(e){super(e),this._resetTileData=!0,this._throttledTriggerLoad=null,this._throttling=!1}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:e,layerIndex:t,layerClass:s})=>{null!=this.renderedTiles&&this.loadByTileTreesAllowed&&t===this._layerIndex&&1===s&&this._updateFlowDataTile(e)}),t(()=>this.renderedTiles,e=>{const t=this.frameTask.scheduleGenerator(t=>this._updateFlowDataTiles(e,t));this.updatingHandles.addPromise(t)},s)]),this._throttledTriggerLoad=r(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,d,this),this.addHandles(this._throttledTriggerLoad)}async*_updateFlowDataTiles(e,t){const s=f();for(const r of e??[]){const e=this._flowDataTiles?.get(h(r)),i=null==e||"delete"===e||"waiting"===e?this._getFlowDataCopy(r):e;null!=i&&s.set(h(r),i),t.madeProgress(),t.done&&(t=yield)}this._flowDataTiles=s,this._resetTileData=!0,this.triggerLoad()}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get loadByTileTreesAllowed(){return super.loadByTileTreesAllowed||!this._allTilesLoaded}doRefresh(){const{_flowDataTiles:e}=this;null!=e&&(e.forEach((t,s)=>{e.set(s,"waiting")}),super.doRefresh())}triggerLoad(){const{_throttledTriggerLoad:e}=this;this._allTilesLoaded?(e.hasPendingUpdates()||e(),e.forceUpdate()):e()}async fetchDataAndGenerateStreamlines(e,t){const{_flowDataTiles:s,needsMagnitude:r,workerHandle:i}=this,l=this.getSimulationSettings(e);if(null==l||null==i||null==s)return;const a=this._resetTileData;this._resetTileData=!1;const o=f();s.forEach((e,t)=>{"delete"===e?(o.set(t,"delete"),s.delete(t)):(a||"on-worker"!==e&&"waiting"!==e)&&(o.set(t,e),s.set(t,"on-worker"))});const n={simulationSettings:l,flowExtentInfo:e.flowExtentInfo,flowDataTiles:o,pixelSize:this.surface.tilingScheme.pixelSize,reset:a,needsMagnitude:r,startPositions:this.startPositions(e)},{streamlines:d}=await i.generateTiledStreamlines(n,t);return d}getUpdating(){return super.getUpdating()||this._throttling}_getFlowDataCopy(e){const{_layerIndex:t}=this,s=null==e.surface;if(null==t||s)return null;const r=e.getLayerInfo(t,1);if(null==r)return null;if(!e.visible&&null==r.requestAbort)return r.requestAbort=new AbortController,this.surface.requestTileData(e,t,1,r.requestAbort),null;if(r.dataMissing||!e.hasLayerData(t,1))return null;const{data:i}=r;if(!g(i))return null;const l=o(this.layer.serviceRasterInfo.dataType,i.source),n=new Uint8Array(l.width*l.height);for(let a=0;a<n.length;a++)n[a]=l.mask[a];return new u(l.data,n,l.width,l.height,e.lij,a(e.extent))}_updateFlowDataTile(e){const t=this.renderedTiles?.has(e)?this._getFlowDataCopy(e)??"delete":"delete";this._setTileData(e,t)&&this.triggerLoad()}_setTileData(e,t){const{_flowDataTiles:s}=this;if(null==s)return!1;const r=h(e);return(null!=s.get(r)||"delete"!==t)&&(s.set(r,t),!0)}get _allTilesLoaded(){let e=0;for(const t of this._flowDataTiles?.values()??[])"delete"!==t&&"waiting"!==t&&e++;return e===this.renderedTiles?.size}get test(){return{...super.test,loadedTiles:this._flowDataTiles??f()}}};function f(){return new Map}e([i()],c.prototype,"_throttling",void 0),c=e([l("esri.views.3d.support.flow.FlowSubViewTiles3D")],c);export{c 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{createFlowFieldFromData as s,traceFlowPaths as r}from"../../../2d/engine/flow/dataUtils.js";import{createFlowFieldFromDataTiled as o,valuesPerFlowVertex as i}from"./loadUtils.js";let a=class{constructor(){this._tileData=new Map}async generateStreamlines(t){const{flowData:e,flowExtentInfo:r,needsMagnitude:o,simulationSettings:i,startPositions:a}=t,n=l(s(i,e),i,r.modelSize,o,a);return{result:{streamlines:n},transferList:n?.map(t=>t.vertices.buffer)}}async generateTiledStreamlines(t){const{flowDataTiles:e,flowExtentInfo:s,needsMagnitude:r,reset:i,pixelSize:a,simulationSettings:n,startPositions:c}=t;this._updateTileData(e,i);const f=l(o(n,this._tileData,s,a),n,s.modelSize,r,c);return{result:{streamlines:f},transferList:f?.map(t=>t.vertices.buffer)??[]}}_updateTileData(t,e){e&&this._tileData.forEach((e,s)=>{null==t.get(s)&&this._tileData.delete(s)}),t.forEach((t,e)=>{"delete"===t?this._tileData.delete(e):"on-worker"!==t&&this._tileData.set(e,t)})}};a=t([e("esri.views.3d.support.flow.FlowWorker")],a);const n=a;function l(t,e,s,o,a){if(null==t)return;const n=r(e,t,s[0],s[1],{positions:a}),l=[],c=i(o);for(const{vertices:r,stage:i}of n){const t=new Float32Array(r.length*c);for(let e=0;e<r.length;e++)t[e*c]=r[e].x,t[e*c+1]=r[e].y,t[e*c+2]=r[e].t,o&&(t[e*c+3]=r[e].speed);l.push({vertices:t,stage:i,hasMagnitude:o})}return l}export{n as default};
5
+ import{__decorate as t}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{createFlowFieldFromData as s,traceFlowPaths as r}from"../../../2d/engine/flow/dataUtils.js";import{createFlowFieldFromDataTiled as o,valuesPerFlowVertex as i}from"./loadUtils.js";let a=class{constructor(){this._tileData=new Map}async generateStreamlines(t){const{flowData:e,flowExtentInfo:r,needsMagnitude:o,simulationSettings:i,startPositions:a}=t,n=l(s(i,e),i,r.modelSize,o,a);return{result:{streamlines:n},transferList:n?.map(t=>t.vertices.buffer)}}async generateTiledStreamlines(t){const{flowDataTiles:e,flowExtentInfo:s,needsMagnitude:r,reset:i,pixelSize:a,simulationSettings:n,startPositions:c}=t;this._updateTileData(e,i);const f=l(o(n,this._tileData,s,a),n,s.modelSize,r,c);return{result:{streamlines:f},transferList:f?.map(t=>t.vertices.buffer)??[]}}_updateTileData(t,e){e&&this._tileData.forEach((e,s)=>{null==t.get(s)&&this._tileData.delete(s)}),t.forEach((t,e)=>{"delete"===t?this._tileData.delete(e):"on-worker"!==t&&"waiting"!==t&&this._tileData.set(e,t)})}};a=t([e("esri.views.3d.support.flow.FlowWorker")],a);const n=a;function l(t,e,s,o,a){if(null==t)return;const n=r(e,t,s[0],s[1],{positions:a}),l=[],c=i(o);for(const{vertices:r,stage:i}of n){const t=new Float32Array(r.length*c);for(let e=0;e<r.length;e++)t[e*c]=r[e].x,t[e*c+1]=r[e].y,t[e*c+2]=r[e].t,o&&(t[e*c+3]=r[e].speed);l.push({vertices:t,stage:i,hasMagnitude:o})}return l}export{n 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{Seconds as t}from"../../../../core/time.js";import{FlowQuery3D as e}from"./FlowQuery3D.js";class i{constructor(t,e,i,s){this._query=t,this.streamlines=e,this._material=i,this.geometries=s,this._startTime=0,this._endTime=1/0,this.startTime=this._query.time}get startTime(){return this._startTime}set startTime(i){this._query.time!==i&&(this._query=new e(this._query.extent,this._query.timeExtent,this._query.size,this._query.pixelRatio,t(i))),this._startTime=i,this.setMaterialParameters({startTime:i})}get endTime(){return this._endTime}set endTime(t){this._endTime=t,this.setMaterialParameters({endTime:t})}get query(){return this._query}setMaterialParameters(t){this._material.setParameters(t)}}export{i as StreamlineResources3D};
5
+ import"../../../../core/has.js";import{Seconds as e}from"../../../../core/time.js";import{FlowQuery3D as t}from"./FlowQuery3D.js";class i{constructor(e,t,i,r){this._query=e,this.streamlines=t,this._material=i,this.geometries=r,this._startTime=0,this._endTime=1/0,this.startTime=this._query.time}get startTime(){return this._startTime}set startTime(i){this._query.time!==i&&(this._query=new t(this._query.extent,this._query.timeExtent,this._query.size,this._query.pixelRatio,e(i))),this._startTime=i,this.setMaterialParameters({startTime:i})}get endTime(){return this._endTime}set endTime(e){this._endTime=e,this.setMaterialParameters({endTime:e})}get query(){return this._query}hasFadedOut(e){return this.endTime+this._material.parameters.fadeOutTime<e}setMaterialParameters(e){this._material.setParameters(e)}get test(){return null}}export{i as StreamlineResources3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{destroyMaybe as e}from"../../../../core/maybe.js";import{StreamlineResources3D as r}from"./StreamlineResources3D.js";import{RenderGeometry as t}from"../../webgl-engine/lib/RenderGeometry.js";class a extends r{constructor(e,r,t,a,s){super(e,r,t,a),this._overlayManager=s,this._drapeRenderer=null,this.drapeSourceType=2,this.updatePolicy=0,this.renderGroup=0}get attached(){return null!=this._drapeRenderer}get destroyed(){return this.attached}async attach(){const{geometries:e}=this;null!=e&&(this.detach(),this._drapeRenderer=this._overlayManager.registerGeometryDrapeSource(this),this._drapeRenderer.addGeometries(e.map(e=>new t(e)),0))}detach(){this.attached&&(this._overlayManager.unregisterDrapeSource(this),this._drapeRenderer=e(this._drapeRenderer))}}export{a as StreamlineResources3DOverlay};
5
+ import{removeMaybe as e,destroyMaybe as r}from"../../../../core/maybe.js";import{streamlinGeometryBatchSize as t}from"./constants.js";import{StreamlineResources3D as s}from"./StreamlineResources3D.js";import{RenderGeometry as i}from"../../webgl-engine/lib/RenderGeometry.js";import{TaskPriority as a}from"../../../support/Scheduler.js";class h extends s{constructor(e,r,t,s,i){super(e,r,t,s),this._layerView=i,this._drapeRenderer=null,this.drapeSourceType=2,this.updatePolicy=0,this.renderGroup=0,this._frameTask=null,this._renderGeometries=[]}get _view(){return this._layerView.view}get layer(){return this._layerView.layer}get fullOpacity(){return this._layerView.fullOpacity}get attached(){return null!=this._drapeRenderer}get destroyed(){return this.attached}async attach(){const{geometries:e}=this;null!=e&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(a.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(r=>this._addGeometryToOverlay(e,r)))}async*_addGeometryToOverlay(e,r){this._drapeRenderer=this._view.overlayManager.registerGeometryDrapeSource(this);for(let s=0;s<e.length;s+=t){const a=e.slice(s,s+t).map(e=>new i(e));this._drapeRenderer.addGeometries(a,0),this._renderGeometries.push(...a),this._drapeRenderer.commitChanges(),r.madeProgress(),r.done&&(r=yield)}}detach(){this._frameTask=e(this._frameTask),this._drapeRenderer&&(this._drapeRenderer.removeGeometries(this._renderGeometries,2),this._drapeRenderer.commitChanges(),this._renderGeometries.length=0),this.attached&&this._view.overlayManager.unregisterDrapeSource(this),this._drapeRenderer=r(this._drapeRenderer)}}export{h as StreamlineResources3DOverlay};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{streamlinGeometryBatchSize as e}from"./constants.js";import{StreamlineResources3D as t}from"./StreamlineResources3D.js";import{Object3D as s}from"../../webgl-engine/lib/Object3D.js";import{WebGLLayer as r}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as i}from"../../../support/Scheduler.js";class o extends t{constructor(e,t,s,r,o){super(e,t,s,r),this._view=o,this._objects3D=[],this._engineLayer=null,this._frameTask=o.resourceController.scheduler.registerTask(i.FLOW_GENERATOR)}get attached(){return null!=this._engineLayer}async attach(){const{geometries:e}=this;null!=e&&(this.detach(),await this._frameTask.scheduleGenerator(t=>this._addGeometryToLayer(e,t)))}detach(){this.attached&&(this._engineLayer?.removeMany(this._objects3D),this._objects3D.forEach(e=>e.dispose()),this._objects3D=[],this._engineLayer=null)}async*_addGeometryToLayer(t,i){const{stage:o}=this._view,a=new r(o,{pickable:!1,updatePolicy:1});for(let r=0;r<t.length;r+=e){const o=new s({geometries:t.slice(r,r+e),castShadow:!1});a.add(o),this._objects3D.push(o),a.commit(),i.madeProgress(),i.done&&(i=yield)}this._engineLayer=a}}export{o as StreamlineResources3DShape};
5
+ import{removeMaybe as e}from"../../../../core/maybe.js";import{streamlinGeometryBatchSize as t}from"./constants.js";import{StreamlineResources3D as s}from"./StreamlineResources3D.js";import{Object3D as r}from"../../webgl-engine/lib/Object3D.js";import{WebGLLayer as i}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as a}from"../../../support/Scheduler.js";class o extends s{constructor(e,t,s,r,i){super(e,t,s,r),this._view=i,this._objects3D=[],this._engineLayer=null,this._frameTask=null}get attached(){return null!=this._engineLayer}async attach(){const{geometries:e}=this;null!=e&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(a.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(t=>this._addGeometryToLayer(e,t)))}detach(){this.attached&&(this._engineLayer?.removeMany(this._objects3D),this._objects3D.forEach(e=>e.dispose()),this._objects3D=[],this._engineLayer=null,this._frameTask=e(this._frameTask))}async*_addGeometryToLayer(e,s){const{stage:a}=this._view,o=new i(a,{pickable:!1,updatePolicy:1});for(let i=0;i<e.length;i+=t){const a=new r({geometries:e.slice(i,i+t),castShadow:!1});o.add(a),this._objects3D.push(a),o.commit(),s.madeProgress(),s.done&&(s=yield)}this._engineLayer=o}}export{o as StreamlineResources3DShape};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const e=.1,o=1,t=1,c=1e3,n=3,p=1,r=1.1,s=501;export{e as averageLoadingTimeSmoothingFactor,p as defaultTransitionDuration,t as fadeInTime,o as fadeOutTime,s as streamlinGeometryBatchSize,r as thresholdForLoadingAllTiles,c as tilesWaitingTime,n as transitionDurationFactor};
5
+ const e=.1,o=1,t=1,c=1e3,n=!1,p=3,r=1,s=1.1,x=501;export{e as averageLoadingTimeSmoothingFactor,r as defaultTransitionDuration,t as fadeInTime,o as fadeOutTime,n as seamlessTransitionEnabled,x as streamlinGeometryBatchSize,s as thresholdForLoadingAllTiles,c as tilesWaitingTime,p as transitionDurationFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as i,createScreenPointArray as t}from"../../../core/screenUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{Intersector as p}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as m}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as f,toOwner as g}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as y}from"../webgl-engine/lib/verticalOffsetUtils.js";async function h(e,n,i,r){const s=i?x(e,i):r,l=t(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const o=new p(e.state.viewingMode);o.options.selectionMode=!0,o.options.store=2,e.sceneIntersectionHelper.intersectIntersectorScreen(l,o,s);const c=await b(e,o.results.all,s.graphics),d=o.results.ground,f=g(d,e),y=null!=f&&"type"in f&&a(f)?f:null,h={screenPoint:n,results:c,ground:{mapPoint:U(e,d),distance:m(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=o),h}function w(e,n,t,r){const s=t?x(e,t):r,l=!(!s.graphics?.include&&!s.graphics?.exclude),o=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=i(n);s.enableDraped=s.include&&!s.include.has(y)||s.exclude?.has(y);const a=e.sceneIntersectionHelper,u=new p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=l||o?2:0,u.options.excludeLabels=t?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),l||o){for(const n of u.results.all){const i=f(n,e);if(null==i)return U(e,n);if(l&&("graphic"!==i.type||E(s.graphics,i.graphic)))return U(e,n);if(o&&("media"!==i.type||S(s.mediaElements,i.element)))return U(e,n)}return null}return U(e,u.results.min)}async function b(e,n,i){const t=new Array;let r,s=null;const l={defer(e){r=e()}};for(let o=0;o<n.length;o++){const c=n[o],u=g(c,e);if(null!=u&&(u===e.map.ground||"type"in u&&a(u)))break;const d=f(c,e,l)??await r;if(r=null,null==d)continue;if("graphic"===d.type){if(null==s&&o!==n.length-1&&(s=new Set),null!=s){const e=j(d.graphic);if(s.has(e))continue;s.add(e)}if(!E(i,d.graphic))continue}const p=U(e,c),m=c.distanceInRenderSpace;if("media"===d.type){const e=d.element.toSource(p);t.push({...d,mapPoint:p,distance:m,sourcePoint:e})}else t.push({...d,mapPoint:p,distance:m})}return t}function U(e,n,i){return n.getIntersectionPoint(C)?(i=V(e,C,i),7===n.intersector&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function j(e){const n=e.getObjectId()??e.attributes?.[c];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${e.uid}`}function E(e,n){return S(e,j(n))}function S(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let t=e.spatialReference||l.WGS84;return o(n,e.renderSpatialReference,C,t)?n=C:(t=l.WGS84,o(n,e.renderSpatialReference,C,t)&&(n=C)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=t):i=new s(n,t),i}function x(e,n){const i=I(e,n.include,0),t=I(e,n.exclude,1);return{include:i.layerViewUids,exclude:t.layerViewUids,graphics:{include:i.graphicUids,exclude:t.graphicUids},mediaElements:{include:i.mediaElements,exclude:t.mediaElements}}}function I(i,t,r,s=new R){if(!t)return s;if(t instanceof e)M(s,j(t)),0===r&&(null!=i.graphicsView&&t.layer===i?P(s,i.graphicsView.uid):t.layer&&T(s,i,t.layer.uid));else if("layer"in t&&"element"in t)L(s,t.element),0===r&&T(s,i,t.layer.uid);else if(n(t))for(const e of t)e===i.graphics&&null!=i.graphicsView?P(s,i.graphicsView.uid):e===i.map.ground?P(s,y):I(i,e,r,s);else"layer"in t&&v(s,i,t),"uid"in t&&T(s,i,t.uid);return s}class R{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function T(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i);t&&P(e,t.uid)}function P(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function v(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i.layer.uid);if(!t)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(t.uid);!0!==r&&(r?r.add(i.id):e.layerViewUids.set(t.uid,new Set([i.id])))}function M(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function L(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const C=r();export{V as computeMapPointFromVec3d,x as externalToInternalIntersectOptions,h as hitTest,U as intersectResultToMapPoint,w as toMap};
5
+ import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as i,createScreenPointArray as t}from"../../../core/screenUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../../geometry/Point.js";import l from"../../../geometry/SpatialReference.js";import{projectVectorToVector as o}from"../../../geometry/projection/projectVectorToVector.js";import{fallbackObjectIDAttribute as c}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as a}from"../../../layers/support/layerUtils.js";import{debugFlags as u}from"./debugFlags.js";import{getElevationAtPoint as d}from"./ElevationProvider.js";import{Intersector as p}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as m}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as f,toOwner as g}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as y}from"../webgl-engine/lib/verticalOffsetUtils.js";async function h(e,n,i,r){const s=i?x(e,i):r,l=t(n.x,n.y);s.requiresGroundFeedback=!0,s.enableDraped=!0;const o=new p(e.state.viewingMode);o.options.selectionMode=!0,o.options.store=2,e.sceneIntersectionHelper.intersectIntersectorScreen(l,o,s);const c=await b(e,o.results.all,s.graphics),d=o.results.ground,f=g(d,e),y=null!=f&&"type"in f&&a(f)?f:null,h={screenPoint:n,results:c,ground:{mapPoint:U(e,d),distance:m(d)?d.distanceInRenderSpace:0,layer:y}};return u.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=o),h}function w(e,n,t,r){const s=t?x(e,t):r,l=!(!s.graphics?.include&&!s.graphics?.exclude),o=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),c=i(n);s.enableDraped=s.include&&!s.include.has(y)||s.exclude?.has(y);const a=e.sceneIntersectionHelper,u=new p(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=l||o?2:0,u.options.excludeLabels=t?.excludeLabels??!1,a.intersectIntersectorScreen(c,u,s),l||o){for(const n of u.results.all){const i=f(n,e);if(null==i)return U(e,n);if(l&&("graphic"!==i.type||E(s.graphics,i.graphic)))return U(e,n);if(o&&("media"!==i.type||S(s.mediaElements,i.element)))return U(e,n)}return null}return U(e,u.results.min)}async function b(e,n,i){const t=new Array;let r,s=null;const l={defer(e){r=e()}};for(let o=0;o<n.length;o++){const c=n[o],u=g(c,e);if(null!=u&&(u===e.map.ground||"type"in u&&a(u)))break;const d=f(c,e,l)??await r;if(r=null,null==d)continue;if("graphic"===d.type){if(null==s&&o!==n.length-1&&(s=new Set),null!=s){const e=j(d.graphic);if(s.has(e))continue;s.add(e)}if(!E(i,d.graphic))continue}const p=U(e,c),m=c.distanceInRenderSpace;if("media"===d.type){const e=d.element.toSource(p);t.push({...d,mapPoint:p,distance:m,sourcePoint:e})}else t.push({...d,mapPoint:p,distance:m})}return t}function U(e,n,i){return n.getIntersectionPoint(C)?(i=V(e,C,i),7===n.intersector&&e.basemapTerrain&&(i.z=d(e.basemapTerrain,i)??0),i):null}function j(e){const n=e.getObjectId()??e.attributes?.[c];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${e.uid}`}function E(e,n){return S(e,j(n))}function S(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function V(e,n,i){let t=e.spatialReference||l.WGS84;return o(n,e.renderSpatialReference,C,t)?n=C:(t=l.WGS84,o(n,e.renderSpatialReference,C,t)&&(n=C)),i?(i.x=n[0],i.y=n[1],i.z=n[2],i.spatialReference=t):i=new s(n,t),i}function x(e,n){const i=I(e,n.include,0),t=I(e,n.exclude,1);return{include:i.layerViewUids,exclude:t.layerViewUids,graphics:{include:i.graphicUids,exclude:t.graphicUids},mediaElements:{include:i.mediaElements,exclude:t.mediaElements}}}function I(i,t,r,s=new R){if(!t)return s;if(t instanceof e)M(s,j(t)),0===r&&(null!=i.graphicsView&&t.layer===i?P(s,i.graphicsView.uid):t.layer&&T(s,i,t.layer.uid));else if("layer"in t&&"element"in t)L(s,t.element),0===r&&T(s,i,t.layer.uid);else if(n(t))for(const e of t)e===i.graphics&&null!=i.graphicsView?P(s,i.graphicsView.uid):e===i.map.ground?P(s,y):I(i,e,r,s);else"layer"in t&&v(s,i,t),"uid"in t&&T(s,i,t.uid);return s}class R{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function T(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i);t&&P(e,t.uid)}function P(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function v(e,n,i){const t=n.allLayerViews.find(e=>e.layer.uid===i.layer.uid);if(!t)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(t.uid);!0!==r&&(r?r.add(i.id):e.layerViewUids.set(t.uid,new Set([i.id])))}function M(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function L(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const C=r();export{V as computeMapPointFromVec3d,x as externalToInternalIntersectOptions,h as hitTest,U as intersectResultToMapPoint,E as testGraphicUidFilter,w as toMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{projectBuffer as o}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as t,doubleSubArray as n}from"../../../../geometry/support/DoubleArray.js";import{ringsToTriangulationInfo as s}from"../../../../geometry/support/triangulationUtils.js";import{applyPerVertexElevationAlignment as i}from"../../layers/graphics/elevationAlignmentUtils.js";import{drapedZ as e}from"../../terrain/OverlayRenderer.js";function r(o,n,e,r){const p=s(o.rings,!!o.hasZ&&"on-the-ground"!==r.mode,1,o.spatialReference),u=t(p.position.length),a=i(p.position,o.spatialReference,0,u,0,p.position,0,p.position.length/3,n,e,r),h=null!=a;return new f(p.position,u,l(p.polygons,p.position,u),c(p.outlines,p.position,u),h,a)}function p(t,n){const i=s(t.rings,!1,1),r=o(i.position,t.spatialReference,0,i.position,n,0);for(let o=2;o<i.position.length;o+=3)i.position[o]=e;return{position:i.position,polygons:l(i.polygons,i.position),outlines:c(i.outlines,i.position),projectionSuccess:r}}function c(o,t,s=null){return o.filter(({count:o})=>o>1).map(({index:o,count:i})=>{const e=3*o,r=3*i;return null!=s?new a(o,i,n(t,e,r),n(s,e,r)):new u(o,i,n(t,e,r))})}function l(o,t,s=null){const i=new Array;for(const{index:e,count:r,holeIndices:p,pathLengths:c}of o){if(r<=1)continue;const o=3*e,l=3*r,u=p.map(o=>o-e),a=null!=s?new h(e,r,n(t,3*e,3*r),n(s,o,l),u,c):new m(e,r,n(t,3*e,3*r),u,c);i.push(a)}return i}class u{constructor(o,t,n){this.index=o,this.count=t,this.position=n}}class a extends u{constructor(o,t,n,s){super(o,t,n),this.mapPositions=s}}class h extends a{constructor(o,t,n,s,i,e){super(o,t,n,s),this.holeIndices=i,this.pathLengths=e}}class m extends u{constructor(o,t,n,s,i){super(o,t,n),this.holeIndices=s,this.pathLengths=i}}class f{constructor(o,t,n,s,i,e){this.position=o,this.mapPositions=t,this.polygons=n,this.outlines=s,this.projectionSuccess=i,this.sampledElevation=e}}export{f as PolygonRenderInfo,h as PolygonVertexData,m as PolygonVertexDataDraped,r as geometryToRenderInfo,p as geometryToRenderInfoDraped};
5
+ import{projectBuffer as t}from"../../../../geometry/projection/projectBuffer.js";import{newDoubleArray as o,doubleSubArray as s}from"../../../../geometry/support/DoubleArray.js";import{ringsToTriangulationInfo as n}from"../../../../geometry/support/triangulationUtils.js";import{applyPerVertexElevationAlignment as i}from"../../layers/graphics/elevationAlignmentUtils.js";import{drapedZ as e}from"../../terrain/OverlayRenderer.js";function r(t,s,e,r){const p=n(t.rings,!!t.hasZ&&"on-the-ground"!==r.mode,1,t.spatialReference),u=o(p.position.length),h=i(p.position,t.spatialReference,0,u,0,p.position,0,p.position.length/3,s,e,r),a=null!=h;return new g(p.position,u,l(p.polygons,p.position,u),c(p.outlines,p.position,u),a,h)}function p(o,s){const i=n(o.rings,!1,1),r=t(i.position,o.spatialReference,0,i.position,s,0);for(let t=2;t<i.position.length;t+=3)i.position[t]=e;const p=l(i.polygons,i.position),u=c(i.outlines,i.position);return new f(i.position,p,u,r)}function c(t,o,n=null){return t.filter(({count:t})=>t>1).map(({index:t,count:i})=>{const e=3*t,r=3*i;return null!=n?new h(t,i,s(o,e,r),s(n,e,r)):new u(t,i,s(o,e,r))})}function l(t,o,n=null){const i=new Array;for(const{index:e,count:r,holeIndices:p,pathLengths:c}of t){if(r<=1)continue;const t=3*e,l=3*r,u=p.map(t=>t-e),h=null!=n?new a(e,r,s(o,3*e,3*r),s(n,t,l),u,c):new m(e,r,s(o,3*e,3*r),u,c);i.push(h)}return i}class u{constructor(t,o,s){this.index=t,this.count=o,this.position=s}}class h extends u{constructor(t,o,s,n){super(t,o,s),this.mapPositions=n}}class a extends h{constructor(t,o,s,n,i,e){super(t,o,s,n),this.holeIndices=i,this.pathLengths=e}}class m extends u{constructor(t,o,s,n,i){super(t,o,s),this.holeIndices=n,this.pathLengths=i}}class f{constructor(t,o,s,n){this.position=t,this.polygons=o,this.outlines=s,this.projectionSuccess=n}}class g{constructor(t,o,s,n,i,e){this.position=t,this.mapPositions=o,this.polygons=s,this.outlines=n,this.projectionSuccess=i,this.sampledElevation=e}}export{g as PolygonRenderInfo,f as PolygonRenderInfoDraped,a as PolygonVertexData,m as PolygonVertexDataDraped,r as polygonToRenderInfo,p as polygonToRenderInfoDraped};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{EventEmitter as r}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as _}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{j as g}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as y}from"../support/debugFlags.js";import{Overlay as f}from"./Overlay.js";import{OverlayRenderTargets as R}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{T as x}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as T}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as w,renderHighlightBuffer as S}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as b}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as O}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as D}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as P}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as j}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as E}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as M}from"../webgl-engine/lighting/Lightsources.js";import{O as F}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as W}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as q,noBudget as V}from"../../support/Scheduler.js";import{Texture as A}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let k=class extends T{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new F,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new x,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[18,e=>9!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new P(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this._spatialReference,e=>this._localOriginFactory=new O(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>w(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,d),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},d),e.resourceController.scheduler.registerTask(q.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:l}=this;l.near=1,l.far=1e4,l.relativeElevation=null,n.slot=18,n.mainDepth=null,n.camera=l,n.oitPass=0,n.updateLighting([new M(m())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new b(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(W)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=l(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=l(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new R(this._stage.renderer.fboCache),this._overlays=[new f,new f]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=t(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(V,e=>1===e.updatePolicy)}get isEmpty(){return!y.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??0,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._renderContext.output=e,r.slot=3===e?19:18,9===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||3===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:d}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,d.screenToWorldRatio=this._screenToWorldRatio,d.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,d.slot=3===n?19:18,4===r.content&&(h.renderOccludedMask=H),!this.renders(r.content))return h.renderOccludedMask=D,!1;const{resolution:l}=t,c=0===e,u=c?0:l;if(o.setViewport(u,0,l,l),this._bindTargetFBO(r),c)if(9!==r.output)o.setClearColor(0,0,0,0),o.clear(16384);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(y.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==r.content&&2!==r.content){this._techniques.precompile(j,U);const r=this._techniques.get(j,U);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,I[e]),o.bindTechnique(r,d,this._passParameters),o.screen.draw()}if(9===r.output){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),S(o,t,{width:s,height:s},d,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=D,!0}get allSourcesOccluders(){return s(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(W);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new L(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),_(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new A(this._rctx,i,t)}get test(){}};e([c()],k.prototype,"hasHighlights",void 0),e([c()],k.prototype,"renderOccludedFlags",void 0),e([c()],k.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],k.prototype,"parent",void 0),e([c({readOnly:!0})],k.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([c()],k.prototype,"isEmpty",null),k=e([u("esri.views.3d.terrain.OverlayRenderer")],k);class L{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const I=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,U=new E;U.hasAlpha=!0;export{k as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
5
+ import{__decorate as e}from"tslib";import{unique as r}from"../../../core/arrayUtils.js";import{EventEmitter as t}from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as s,everyMap as i}from"../../../core/MapUtils.js";import{disposeMaybe as n}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as a,on as h,syncAndInitial as d,initial as l}from"../../../core/reactiveUtils.js";import{someSet as c}from"../../../core/SetUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as _,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{j as m}from"../../../chunks/vec32.js";import{ones as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{debugFlags as f}from"../support/debugFlags.js";import{Overlay as R}from"./Overlay.js";import{OverlayRenderTargets as v}from"./OverlayRenderTargets.js";import x from"../webgl/RenderCamera.js";import{T}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as w}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as S,renderHighlightBuffer as b}from"../webgl-engine/effects/highlight/Highlight.js";import{GLMaterialRepository as O}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as D}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderContext as C,defaultRenderOccludedMask as P}from"../webgl-engine/lib/RenderContext.js";import{ShadowMap as j}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as E}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as M}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{AmbientLight as F}from"../webgl-engine/lighting/Lightsources.js";import{O as W}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as q}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as V,noBudget as A}from"../../support/Scheduler.js";import{Texture as k}from"../../webgl/Texture.js";import{TextureDescriptor as G}from"../../webgl/TextureDescriptor.js";let I=class extends w{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new W,this.hasHighlights=!1,this.renderOccludedFlags=1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new T,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new x,this.events=new t,this.longitudeCyclical=null,this.produces=new Map([[18,e=>9!==e||this.hasHighlights],[19,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1,this._hasDrapedFlowSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new C(this._rctx,new j(t,e.state.viewingMode),i),this.addHandles([a(()=>s.updating,()=>this.events.emit("content-changed"),d),a(()=>this._spatialReference,e=>this._localOriginFactory=new D(e),d),h(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),a(()=>S(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),a(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(V.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:o}=this;o.near=1,o.far=1e4,o.relativeElevation=null,n.slot=18,n.mainDepth=null,n.camera=o,n.oitPass=0,n.updateLighting([new F(y())],0,0,0)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=n(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get _spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new O(this._view.stage.renderView.textures,this._techniques,()=>{this._onMaterialOrContentChanged(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(q)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||s(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),r(this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e))}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(a(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&c(e,e=>1===e.drapeTargetType)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=c(e,e=>1===e.drapeSourceType),this._hasDrapedRasterSource=c(e,e=>0===e.drapeSourceType),this._hasDrapedFlowSource=c(e,e=>2===e.drapeSourceType)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=this._hasDrapedFlowSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new v(this._stage.renderer.fboCache),this._overlays=[new R,new R]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(1),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return 1===e&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){const r=this._useOverlayColorInsteadOfColorNoRasterImage(e);return this._renderTargets?.getTexture(r?0:e)}get readyToRun(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_onMaterialOrContentChanged(){this.renderOccludedFlags=s(this._renderers,e=>e.hasOccluders)?H:1}_processDrapeSources(e,r){let t=!1;for(const[s,i]of this._renderers){if(e.done)break;(s.destroyed||r(s))&&(i.commitChanges()&&(t=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,t=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),t&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this._onMaterialOrContentChanged(),this.hasHighlights=s(this._renderers,e=>e.hasHighlights),this.events.emit("content-changed"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return s(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(A,e=>1===e.updatePolicy)}get isEmpty(){return!f.OVERLAY_DRAW_DEBUG_TEXTURE&&i(this._renderers,e=>e.isEmpty)}get hasWater(){const e=s(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}renders(e){if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==e&&2!==e)return!0;if(!this._overlays)return!1;const r=this._overlays[0];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??0,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?0:this.hasWater&&this.renders(3)?2:this._renderTargets?.getTexture(0)?1:0}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(0),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(1===t.content&&!this._needsColorWithoutRasterImage)continue;const{output:e}=t;this._renderContext.output=e,r.slot=3===e?19:18,9===e&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null);const s=this._renderContext.renderOccludedMask;4===t.content&&(this._renderContext.renderOccludedMask=H),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{1===t.content&&0===e.drapeSourceType||4===t.content&&r.hasOnlyOccluders||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=s,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccluders;for(const s of this._renderTargets.targets){if(!(0===s.content&&this._hasDrapedFlowSource)&&!s.handleRenderRequest(r)||1===s.content&&!this._needsColorWithoutRasterImage||4===s.content&&t)continue;const e=this._drawTarget(0,s),i=this._drawTarget(1,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||3===n&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:d}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,d.screenToWorldRatio=this._screenToWorldRatio,d.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,d.slot=3===n?19:18,4===r.content&&(h.renderOccludedMask=H),!this.renders(r.content))return h.renderOccludedMask=P,!1;const{resolution:l}=t,c=0===e,u=c?0:l;if(o.setViewport(u,0,l,l),this._bindTargetFBO(r),c)if(9!==r.output)o.setClearColor(0,0,0,0),o.clear(16384);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(f.OVERLAY_DRAW_DEBUG_TEXTURE&&4!==r.content&&2!==r.content){this._techniques.precompile(E,z);const r=this._techniques.get(E,z);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,U[e]),o.bindTechnique(r,d,this._passParameters),o.screen.draw()}if(9===r.output){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),b(o,t,{width:s,height:s},d,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=P,!0}get allSourcesOccluders(){return i(this._renderers,e=>e.hasOnlyOccluders)}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(1===r.content&&0===i.drapeSourceType)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&0===r.output&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(q);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(16384),s}get _resolution(){return this._overlays?.[0].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers.map(e=>e.uid),r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer?.uid),n=i>=0,o=s.renderGroup??(n?0:1),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new L(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],_(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(m(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new G(e);i.samplingMode=9728,this._passParameters.texture=new k(this._rctx,i,t)}get test(){}};e([u()],I.prototype,"hasHighlights",void 0),e([u()],I.prototype,"renderOccludedFlags",void 0),e([u()],I.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([u({constructOnly:!0})],I.prototype,"parent",void 0),e([u({readOnly:!0})],I.prototype,"_techniques",null),e([u({type:Boolean,readOnly:!0})],I.prototype,"updating",null),e([u()],I.prototype,"isEmpty",null),I=e([p("esri.views.3d.terrain.OverlayRenderer")],I);class L{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const U=[[1,.5,.5],[.5,.5,1]],B=-2,H=4,z=new M;z.hasAlpha=!0;export{I as OverlayRenderer,B as drapedZ,H as overlayRenderOccludedFlag};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{toConst as e}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{e as n,m as r,f as a,h as l,g as o,b as h,d}from"../../../chunks/vec32.js";import{create as u,unitZ as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f,rectangleContainsRectangleCyclicalAware as _,rectanglesIntersectCyclicalAware as m,width as y,height as v}from"../../../geometry/support/aaBoundingRect.js";import{c as M,a as A,n as x,o as D}from"../../../chunks/sphere.js";import{isGroupLayer as b}from"../../../layers/support/layerUtils.js";import{ElevationBounds as L}from"./ElevationBounds.js";import{ElevationTileAgent as I,isElevationTileAgent as j}from"./ElevationTileAgent.js";import{LayerClasses as T}from"./LayerClass.js";import{MapDataCacheItem as C}from"./MapDataCacheItem.js";import{MapTileAgent as B,isMapTileAgent as U}from"./MapTileAgent.js";import{maxPatchTesselation as S}from"./TerrainConst.js";import{isVectorTile as w,isTileTexture as P,isRasterTile as E,isImageWithType as O}from"./TerrainData.js";import{weakAssert as R,isBlendableLayerView as q,oppositeCorner as V,internalAssert as N,enableTerrainInternalChecks as k,neighborEdgeIndices as G,oppositeEdge as z,neighborCornerIndices as F,almostEquals as W,enableWaterproofTests as H,isNorth as J,isSouth as X,isWest as Y,isEast as $,isWestCorner as Q,isNorthCorner as K}from"./terrainUtils.js";import{tileAgentDone as Z}from"./TileAgent.js";import{TilePerLayerInfo as ee}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as te}from"./tileUtils.js";const ie=.1;class se{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=u(),this._center=[u(),M(),u()],this.up=c(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=u(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}static prune(){ae.prune(0),le.prune(0),ee.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1][3]}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,t=e?.frustumVisibility??1;this._frustumVisibility=0===t?0:2===t?2:this._calculateFrustumVisibility(this.surface.frustum);const i=2!==this._frustumVisibility&&this._intersectsClippingArea;i!==this._visible&&(this._visible=i,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1][3]=0,this.elevationLevel=e,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.clearChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of T){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=ee.acquire(this._surface.upsampleInfoPool),0===r&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,S)}dispose(){R(!this.renderData,"tile.renderData was not unloaded"),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new C(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),null==this._surface?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(w(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(const{data:e}of this.layerInfo[1])w(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(const e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?1===e?this._cached?0:this.getTerrainDataMemory(i.data):0===e?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return P(e)?e.texture.usedMemory:E(e)?e.memoryUsage:w(e)?e.usedMemoryPerReference:O(e)||e instanceof HTMLImageElement?this._cpuImageMemorySize:0}updateScreenDepth(e){const t=this._center[1],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,i){if(!this.visible)return 0;if(e.frustum&&(!this._intersectsClippingArea||2===this._calculateFrustumVisibility(e.frustum)))return 0;const s=this.level;n(pe,A(this._center[1]),t);let d=r(pe),c=pe,g=x(this._center[1],u());n(fe,this._center[0],t);const p=r(fe);p<d&&(d=p,c=fe,g=this._center[0]),n(_e,this._center[2],t);const f=r(_e);if(f<d&&(d=f,c=_e,g=this._center[2]),this._edgeLen2>d&&s<e.maxLod)return 1;const _=Math.sqrt(d),m=e.fovX*_*2,y=this._edgeLen/m,v=()=>{if(s<e.maxLod)return this.elevationLevel=s,0;const t=s+Math.ceil(-Math.log2(e.relativeWidthLimit/y));return t!==this.elevationLevel?(this.elevationLevel=t,2):0},M=null!=i?i-s:1/0;if(M<=.5)return v();const D=a(this.up,pe),b=this._elevationBoundsMax-this._elevationBoundsMin,L=b/this.edgeLen;if(e.aboveGround&&D>0&&L<.001){if(D/_-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-L>0)return 0}const I=null!=i?3-Math.min(M,2):1;if(y*I<e.relativeWidthLimit||s>=e.maxLod)return v();if(s<7)return 1;l(me,this.up,D),n(me,me,c);const j=r(me);if(j<=this.radius*this.radius)return 1;l(me,me,this.radius/Math.sqrt(j)),o(me,me,g),n(me,t,me);const T=Math.min(1,(Math.abs(a(me,this.up))+.5*b+this._curvatureHeight)/h(me)),C=ie/e.angledSplitBias,B=e.fovY*_*2;return T*(this._edgeLen/B*I)<C*e.relativeHeightLimit?0:1}createChildren(){const e=this._children,t=this.lij[0]+1,i=2*this.lij[1],s=2*this.lij[2];return e[0]=this.surface.createTile(t,i,s,this),e[1]=this.surface.createTile(t,i,s+1,this),e[2]=this.surface.createTile(t,i+1,s,this),e[3]=this.surface.createTile(t,i+1,s+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of T)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(const e of T){const t=this.layerInfo[e];for(const e of t)e.loadingAgent&&e.loadingAgent!==Z&&(re(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){const e=this.layerInfo[1];for(const t of e)t.loadingAgent&&t.loadingAgent!==Z&&(re(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._withinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._withinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._withinClippingArea,n=!(i||t||this._withinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of T){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==Z&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(1)||0!==e&&!this._loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,1===e||4===e?this._surface.setTileTreeDirty():this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e);const i=w(n.data);return s.dataArrived(this,i),!0}if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get leaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return r(n(me,A(this._center[1]),e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);R(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=w(i),n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll(e=>e.dataArrived(this,s)),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){const i=this.layerInfo[t][e];i.dataMissing=!0,i.waitingAgents.forAll(e=>e.dataMissing()),i.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor(i=>i.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(0===e?16:32),this.setPendingUpdate(0===e?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(const e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[0];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.min),s=Math.max(s,a.elevationBounds.max),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty())}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;l(me,this.up,i),D(s[1],o(ye,this.centerAtSeaLevel,me)),l(me,this.up,e),o(s[0],this.centerAtSeaLevel,me),l(me,this.up,t),o(s[2],this.centerAtSeaLevel,me)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[0][e],s=this.elevationLevelDelta,n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>=t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,0);if(!te(this,a))return;const l=oe;let o=!1;const h=i.data;if(h&&h.level<=n){const e=i.data;l.min=e.samplerData.data.minValue,l.max=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,o=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[0][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.min!==1/0&&(l.level=i.level,o=!0))}o&&(null==i.elevationBounds&&(i.elevationBounds=new L),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==Z&&(re(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:ee.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===Z&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of T){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==Z&&(i.loadingAgent.setSuspension(t),i.loadingAgent===Z&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==Z&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=Z,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||b(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(q(e)&&"normal"!==e?.layer?.blendMode||b(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n],a=this._surface.layerViewByIndex(n,t);let l=!1;if(r.loadingAgent?te(this,a)?(r.loadingAgent!==Z&&r.loadingAgent.setSuspension(s),r.loadingAgent!==Z&&(l=r.loadingAgent.update())):r.dispose():te(this,a)&&(r.loadingAgent=ne(this,n,t,s),l=r.loadingAgent.startLoading(),l?r.loadingAgent===Z&&this.setPendingUpdate(8):(re(r.loadingAgent),r.loadingAgent=Z)),r.loadingAgent===Z&&this.updateRenderData(t,0),!a.destroyed&&!this._hasBlendModes(e,i.length,t)&&l&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,s=Math.max(this.level-e,this.elevationLevelDelta-i),n=t(1+(this._maxTesselation>>s),2,this._maxTesselation+1),r=this.minimumVerticesPerSide;return Math.max(n,r)}_findLIJ(e,t){if(!e)return null;const i=this.surface.rootTiles;if(null!=i)for(const s of i)if(he(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.leaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this._getNeighborLIJ(i,e);return s?de(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=1===e?1:7===e?0:5===e?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(V(e),t)||null}forAllSubtreeOnSide(e,t){const i=0===e?[0,1]:1===e?[1]:2===e?[1,3]:3===e?[3]:4===e?[2,3]:5===e?[2]:6===e?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach(e=>s(n[e]))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(N(!k||i>=0),0===i)return 0;const s=2**i,n=!(1&~e),r=n?0:1,a=t.lij[r+1]*s,l=this._lij[r+1],o=l-a,h=n?s-1-o:o;return k&&(N(a<=l&&l<a+s),N(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.loaded;G.forEach(t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(z(t),i=>!!i.loaded&&(e(i,t),!0))}),F.forEach(t=>{const s=this.findNeighborTile(t,i)?.findCorner(V(t),e=>e.loaded);N(!s||ue(this,s,t)),s?.loaded&&e(s,t)})}_getNeighborLIJ(e,t){const i=J(t)?-1:X(t)?1:0,s=Y(t)?-1:$(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this._wrapLIJ(n):n[2]<0?null:n}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(null==e)return!1;if(0===this.level&&0===e.level){if(this._eastEnd&&e._westEnd&&2===t)return!0;if(this._westEnd&&e._eastEnd&&6===t)return!0}const i=Math.max(1e-6*(this.extent[2]-this.extent[0]),1);switch(t){case 0:return W(this.extent[3],e.extent[1],i);case 4:return W(this.extent[1],e.extent[3],i);case 2:return W(this.extent[2],e.extent[0],i)||W(this.extent[2],-e.extent[0],i);case 6:return W(this.extent[0],e.extent[2],i)||W(this.extent[0],-e.extent[2],i)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return 0===this._lij[2]}checkGeometryWaterproofness(){H&&(N(this.loaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(J(e)&&t[3]+s>=i[3])return!1;if(X(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&Y(e)&&t[0]-s<=i[0])&&!(!n&&$(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;d(this._lastPOI,e);const i=this._center[1],s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}updateOverlayParameters(e){const{renderData:t}=this;if(!t)return;const{overlays:i,longitudeCyclical:s}=e,n=t.overlay;if(0===i.length)this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n);else{const[e,t]=i,r=this.extent;_(e.extent,r,s)||m(r,e.extent,s)||m(r,t.extent,s)?(this._setOverlayData(i,s,r,0,n),this._setOverlayData(i,s,r,1,n)):(this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n))}}_setOverlayData(e,t,i,s,n){const r=e[s].extent,a=y(r),l=v(r);let o=i[0];if(t){o=t.minimalMonotonic(r[0],o);const e=t.minimalMonotonic(r[0],i[2]);o>e&&(o=e-(i[2]-i[0]))}n.setScale(s,y(i)/a,v(i)/l),n.setOffset(s,(o-r[0])/a,(i[1]-r[1])/l)}_clearTileOverlayData(e,t){t.setScale(e,-1,-1),t.setOffset(e,-1,-1)}}function ne(e,t,i,s){const n=0===i?le.acquire():ae.acquire();return n.init(e,t,i,s),n}function re(e){e.dispose(),j(e)?le.release(e):U(e)&&ae.release(e)}const ae=new s(()=>new B),le=new s(()=>new I),oe=new L;function he(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function de(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ue(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?ce(e,t,i):ce(t,e,V(i)))}function ce(e,t,i){N(e.level>=t.level);const s=Q(i),n=K(i),r=e.extent,a=t.extent,l=[s?r[0]:r[2],n?r[3]:r[1]],o=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),d=W(l[0],o[0],h)||e.surface.isGlobal&&W(l[0],-o[0],h),u=W(l[1],o[1],h);if(d&&u)return!0;if(e.level===t.level)return N(!1),!1;if(!d&&!u)return N(!1),!1;const c=d?ge(a[1],a[3],r[1],r[3],h):ge(a[0],a[2],r[0],r[2],h);return N(c),c}function ge(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}const pe=u(),fe=u(),_e=u(),me=u(),ye=u();export{se as Tile,ue as isCornerNeighbor,de as lijEquals};
5
+ import{toConst as e}from"../../../core/compilerUtils.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{e as n,m as r,f as a,h as l,g as o,b as h,d}from"../../../chunks/vec32.js";import{create as u,unitZ as c}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import{create as p,equals as f,rectangleContainsRectangleCyclicalAware as _,rectanglesIntersectCyclicalAware as m,width as y,height as v}from"../../../geometry/support/aaBoundingRect.js";import{c as M,a as A,n as x,o as D}from"../../../chunks/sphere.js";import{isGroupLayer as b}from"../../../layers/support/layerUtils.js";import{ElevationBounds as L}from"./ElevationBounds.js";import{ElevationTileAgent as I,isElevationTileAgent as j}from"./ElevationTileAgent.js";import{LayerClasses as T}from"./LayerClass.js";import{MapDataCacheItem as C}from"./MapDataCacheItem.js";import{MapTileAgent as B,isMapTileAgent as U}from"./MapTileAgent.js";import{maxPatchTesselation as S}from"./TerrainConst.js";import{isVectorTile as w,isTileTexture as P,isRasterTile as E,isImageWithType as O}from"./TerrainData.js";import{weakAssert as R,isBlendableLayerView as q,oppositeCorner as V,internalAssert as N,enableTerrainInternalChecks as k,neighborEdgeIndices as G,oppositeEdge as z,neighborCornerIndices as F,almostEquals as W,enableWaterproofTests as H,isNorth as J,isSouth as X,isWest as Y,isEast as $,isWestCorner as Q,isNorthCorner as K}from"./terrainUtils.js";import{tileAgentDone as Z}from"./TileAgent.js";import{TilePerLayerInfo as ee}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as te}from"./tileUtils.js";const ie=.1;class se{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this.extent=p(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=p(),this.centerAtSeaLevel=u(),this._center=[u(),M(),u()],this.up=c(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=u(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}static prune(){ae.prune(0),le.prune(0),ee.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1][3]}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,t=e?.frustumVisibility??1;this._frustumVisibility=0===t?0:2===t?2:this._calculateFrustumVisibility(this.surface.frustum);const i=2!==this._frustumVisibility&&this._intersectsClippingArea;i!==this._visible&&(this._visible=i,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,i,s,n){this._lij[0]=e,this._lij[1]=t,this._lij[2]=i,this.ellipsoid=g(n.tilingScheme.spatialReference),n.tilingScheme.getExtent(e,t,i,this.extent),n.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,n.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1][3]=0,this.elevationLevel=e,s&&!Number.isNaN(s.elevationBoundsMin)?(this._elevationBoundsMin=s.elevationBoundsMin,this._elevationBoundsMax=s.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=s,this.clearChildren(),this._surface=n,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(const r of T){const e=n.numLayers(r),t=this.layerInfo[r];for(const i of t)i.release();t.length=e;for(let i=0;i<e;i++)t[i]=ee.acquire(this._surface.upsampleInfoPool),0===r&&this.findElevationBoundsForLayer(i,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(n.tilingScheme.pixelSize,S)}dispose(){R(!this.renderData,"tile.renderData was not unloaded"),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new C(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),null==this._surface?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){const e=4,t=this._surface.tilingScheme.pixelSize;return t*t*e}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(w(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(const{data:e}of this.layerInfo[1])w(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(const e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){const i=this.layerInfo[e][t];return i?.data?1===e?this._cached?0:this.getTerrainDataMemory(i.data):0===e?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return P(e)?e.texture.usedMemory:E(e)?e.memoryUsage:w(e)?e.usedMemoryPerReference:O(e)||e instanceof HTMLImageElement?this._cpuImageMemorySize:0}updateScreenDepth(e){const t=this._center[1],i=e,s=t[0],n=t[1],r=t[2],a=i[2]*s+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*s+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,i){if(!this.visible)return 0;if(e.frustum&&(!this._intersectsClippingArea||2===this._calculateFrustumVisibility(e.frustum)))return 0;const s=this.level;n(pe,A(this._center[1]),t);let d=r(pe),c=pe,g=x(this._center[1],u());n(fe,this._center[0],t);const p=r(fe);p<d&&(d=p,c=fe,g=this._center[0]),n(_e,this._center[2],t);const f=r(_e);if(f<d&&(d=f,c=_e,g=this._center[2]),this._edgeLen2>d&&s<e.maxLod)return 1;const _=Math.sqrt(d),m=e.fovX*_*2,y=this._edgeLen/m,v=()=>{if(s<e.maxLod)return this.elevationLevel=s,0;const t=s+Math.ceil(-Math.log2(e.relativeWidthLimit/y));return t!==this.elevationLevel?(this.elevationLevel=t,2):0},M=null!=i?i-s:1/0;if(M<=.5)return v();const D=a(this.up,pe),b=this._elevationBoundsMax-this._elevationBoundsMin,L=b/this.edgeLen;if(e.aboveGround&&D>0&&L<.001){if(D/_-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-L>0)return 0}const I=null!=i?3-Math.min(M,2):1;if(y*I<e.relativeWidthLimit||s>=e.maxLod)return v();if(s<7)return 1;l(me,this.up,D),n(me,me,c);const j=r(me);if(j<=this.radius*this.radius)return 1;l(me,me,this.radius/Math.sqrt(j)),o(me,me,g),n(me,t,me);const T=Math.min(1,(Math.abs(a(me,this.up))+.5*b+this._curvatureHeight)/h(me)),C=ie/e.angledSplitBias,B=e.fovY*_*2;return T*(this._edgeLen/B*I)<C*e.relativeHeightLimit?0:1}createChildren(){const e=this._children,t=this.lij[0]+1,i=2*this.lij[1],s=2*this.lij[2];return e[0]=this.surface.createTile(t,i,s,this),e[1]=this.surface.createTile(t,i,s+1,this),e[2]=this.surface.createTile(t,i+1,s,this),e[3]=this.surface.createTile(t,i+1,s+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}load(){this.refMapData();for(const e of T)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(const e of T){const t=this.layerInfo[e];for(const e of t)e.loadingAgent&&e.loadingAgent!==Z&&(re(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){const e=this.layerInfo[1];for(const t of e)t.loadingAgent&&t.loadingAgent!==Z&&(re(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(f(e,this._clippingArea))return!1;const t=this._intersectsClippingArea,i=this._withinClippingArea;null!=e?(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)):(this._intersectsClippingArea=!0,this._withinClippingArea=!0),this._clippingArea=e,this.updateVisibility();const s=i&&this._withinClippingArea,n=!(i||t||this._withinClippingArea||this._intersectsClippingArea);return!this.renderData||s||n||this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty()}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){const i=this.layerInfo[t][e];return!(!i?.data||i.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(const e of T){const t=this.layerInfo[e];for(const e of t)if(e.loadingAgent&&e.loadingAgent!==Z&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return!!this.hasPendingUpdate(1)||0!==e&&!this._loadable}get hasPendingUpdates(){return 0!==this._pendingUpdates}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){const t=this._pendingUpdates;return this._pendingUpdates|=e,1===e||4===e?this._surface.setTileTreeDirty():this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return!!this.hasPendingUpdate(e)&&(this._pendingUpdates&=~e,!0)}requestLayerData(e,t,s){const n=this.layerInfo[t][e];if(n.waitingAgents.has(s))return console.warn("agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e),!0;if(n.waitingAgents.push(s),n.data&&!n.dataInvalidated){console.warn("agent requested existing data (tile %s, agent tile %s, layer: %d/%d)",this._lij.toString(),s.tile.lij.toString(),t,e);const i=w(n.data);return s.dataArrived(this,i),!0}if(n.requestPromise)return!0;i(n.requestAbort),n.requestAbort=new AbortController;const r=this._surface.requestTileData(this,e,t,n.requestAbort);if(!r)return n.requestAbort=null,!1;const a=()=>{n.requestPromise===r&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=r,r.then(a,a),!0}get leaf(){return null==this._children[0]}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const t=this._children;if(!t[0])return null;return t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e)}distanceToSquared(e){return r(n(me,A(this._center[1]),e))}containsPoint(e){const t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){const i=this.extent;return e>=i[0]&&t>=i[1]&&e<=i[2]&&t<=i[3]}unrequestLayerData(e,t,i){const s=this.layerInfo[t][e],n=s.waitingAgents,r=null!=n.removeUnordered(i);R(r,"agent has not requested this piece of map data"),n.length<1&&(s.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,i){const s=w(i),n=this.layerInfo[t][e];n.data=i,n.dataInvalidated=!1,n.waitingAgents.forAll(e=>e.dataArrived(this,s)),n.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){const i=this.layerInfo[t][e];i.dataMissing=!0,i.waitingAgents.forAll(e=>e.dataMissing()),i.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,i){switch(i&&this.forEachLoadedNeighbor(i=>i.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(0===e?16:32),this.setPendingUpdate(0===e?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(const e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData(),this.restartAgents(t)}computeElevationBounds(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax;let i=1/0,s=-1/0;const n=this.layerInfo[0];let r=!0;for(const a of n)null!=a.elevationBounds&&(i=Math.min(i,a.elevationBounds.min),s=Math.max(s,a.elevationBounds.max),a.elevationBounds.hasNoDataValues||(r=!1));r&&(i=Math.min(i,0),s=Math.max(s,0)),e===i&&t===s||(this._elevationBoundsMin=i,this._elevationBoundsMax=s,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty())}_updateCenter(){const e=this._elevationBoundsMin,t=this._elevationBoundsMax,i=.5*(e+t),s=this._center;l(me,this.up,i),D(s[1],o(ye,this.centerAtSeaLevel,me)),l(me,this.up,e),o(s[0],this.centerAtSeaLevel,me),l(me,this.up,t),o(s[2],this.centerAtSeaLevel,me)}findElevationBoundsForLayer(e,t){const i=this.layerInfo[0][e],s=this.elevationLevelDelta,n=Math.max(this.elevationLevel-s,0),r=i.elevationBounds;if(null!=r&&r.level>=t&&r.level<=n)return;const a=this._surface.layerViewByIndex(e,0);if(!te(this,a))return;const l=oe;let o=!1;const h=i.data;if(h&&h.level<=n){const e=i.data;l.min=e.samplerData.data.minValue,l.max=e.samplerData.data.maxValue,l.hasNoDataValues=e.samplerData.data.hasNoDataValues,l.level=this.level,o=!0}else{let t,i,r=0;for(let a=this._parent;a&&(!i||r<s)&&(r=this.elevationLevel-a.level,t=i||t,i=a.layerInfo[0][e].data,!(!i&&t&&a.level<=n));a=a.parent);i=i||t,i&&(i.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],l),l.min!==1/0&&(l.level=i.level,o=!0))}o&&(null==i.elevationBounds&&(i.elevationBounds=new L),i.elevationBounds.copyFrom(l))}modifyLayers(e,t,i){const s=this.layerInfo[i];for(const a of s)a.loadingAgent&&a.loadingAgent!==Z&&(re(a.loadingAgent),a.loadingAgent=null),a.waitingAgents.clear();for(let a=0;a<s.length;++a)void 0===e[a]&&s[a].release();const n=new Array(...s),r=t.length;s.length=r;for(let a=0;a<r;a++){const e=t[a];s[a]=e>-1?n[e]:ee.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){const t=this.layerInfo[e];for(const e of t)e.loadingAgent===Z&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of T){const t=this._isSuspended(e);for(const i of this.layerInfo[e])i.loadingAgent&&i.loadingAgent!==Z&&(i.loadingAgent.setSuspension(t),i.loadingAgent===Z&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){const i=this.layerInfo[t][e];i.loadingAgent&&i.loadingAgent!==Z&&i.loadingAgent.dispose(),i.loadingAgent=null}agentDone(e,t){const i=this.layerInfo[t][e];i.loadingAgent=Z,i.data||null!=i.upsampleInfo||this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return"normal"!==e.blendMode||b(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,i){for(let s=e;s<t;++s){const e=this._surface.layerViewByIndex(s,i);if(q(e)&&"normal"!==e?.layer?.blendMode||b(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){const i=this.layerInfo[t];if(0===i.length)return;const s=this._isSuspended(t);for(let n=e;n<i.length;++n){const r=i[n],a=this._surface.layerViewByIndex(n,t);let l=!1;if(r.loadingAgent?te(this,a)?(r.loadingAgent!==Z&&r.loadingAgent.setSuspension(s),r.loadingAgent!==Z&&(l=r.loadingAgent.update())):r.dispose():te(this,a)&&(r.loadingAgent=ne(this,n,t,s),l=r.loadingAgent.startLoading(),l?r.loadingAgent===Z&&this.setPendingUpdate(8):(re(r.loadingAgent),r.loadingAgent=Z)),r.loadingAgent===Z&&this.updateRenderData(t,0),!a.destroyed&&!this._hasBlendModes(e,i.length,t)&&l&&a.isOpaque)return}}_isWithinExtent(e){const t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){const t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,s=Math.max(this.level-e,this.elevationLevelDelta-i),n=t(1+(this._maxTesselation>>s),2,this._maxTesselation+1),r=this.minimumVerticesPerSide;return Math.max(n,r)}_findLIJ(e,t){if(!e)return null;const i=this.surface.rootTiles;if(null!=i)for(const s of i)if(he(s,e)){let i=s,n=e[0]-i.level-1;for(;n>=0&&!i.leaf&&!t(i);){const t=e[1]>>n&1,s=e[2]>>n&1;i=i.children[2*t+s],n--}return t(i)?i:null}return null}findNeighborTile(e,t){const i=this._lij,s=this._getNeighborLIJ(i,e);return s?de(i,s)?t(this)?this:null:this._findLIJ(s,t):null}findCorner(e,t){const i=1===e?1:7===e?0:5===e?2:3;let s=this;for(;s.children[0]&&(!t||!t(s));)s=s.children[i];return s}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(V(e),t)||null}forAllSubtreeOnSide(e,t){const i=0===e?[0,1]:1===e?[1]:2===e?[1,3]:3===e?[3]:4===e?[2,3]:5===e?[2]:6===e?[0,2]:[0],s=e=>{const n=e.children;!t(e)&&n[0]&&i.forEach(e=>s(n[e]))};s(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;const i=this.level-t.level;if(N(!k||i>=0),0===i)return 0;const s=2**i,n=!(1&~e),r=n?0:1,a=t.lij[r+1]*s,l=this._lij[r+1],o=l-a,h=n?s-1-o:o;return k&&(N(a<=l&&l<a+s),N(0<=h&&h<s)),h}forEachLoadedNeighbor(e){const t=this.level,i=e=>e.level===t||e.loaded;G.forEach(t=>{const s=this.findNeighborTile(t,i);null!=s&&s!==this&&s.forAllSubtreeOnSide(z(t),i=>!!i.loaded&&(e(i,t),!0))}),F.forEach(t=>{const s=this.findNeighborTile(t,i)?.findCorner(V(t),e=>e.loaded);N(!s||ue(this,s,t)),s?.loaded&&e(s,t)})}_getNeighborLIJ(e,t){const i=J(t)?-1:X(t)?1:0,s=Y(t)?-1:$(t)?1:0,n=[e[0],e[1]+i,e[2]+s];return n[1]<0?null:this.surface.isGlobal?this._wrapLIJ(n):n[2]<0?null:n}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(null==e)return!1;if(0===this.level&&0===e.level){if(this._eastEnd&&e._westEnd&&2===t)return!0;if(this._westEnd&&e._eastEnd&&6===t)return!0}const i=Math.max(1e-6*(this.extent[2]-this.extent[0]),1);switch(t){case 0:return W(this.extent[3],e.extent[1],i);case 4:return W(this.extent[1],e.extent[3],i);case 2:return W(this.extent[2],e.extent[0],i)||W(this.extent[2],-e.extent[0],i);case 6:return W(this.extent[0],e.extent[2],i)||W(this.extent[0],-e.extent[2],i)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return 0===this._lij[2]}checkGeometryWaterproofness(){H&&(N(this.loaded),this.renderData?.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const t=this.extent,i=this.surface.rootTilesExtent,s=.25*(t[2]-t[0]);if(J(e)&&t[3]+s>=i[3])return!1;if(X(e)&&t[1]-s<=i[1])return!1;const n=this.surface.isGlobal;return!(!n&&Y(e)&&t[0]-s<=i[0])&&!(!n&&$(e)&&t[2]+s>=i[2])}updateDistanceToPOI(e){const t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;d(this._lastPOI,e);const i=this._center[1],s=e[0]-i[0],n=e[1]-i[1],r=e[2]-i[2];this.distanceToPOI=s*s+n*n+r*r}updateOverlayParameters(e){const{renderData:t}=this;if(!t)return;const{overlays:i,longitudeCyclical:s}=e,n=t.overlay;if(0===i.length)this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n);else{const[e,t]=i,r=this.extent;_(e.extent,r,s)||m(r,e.extent,s)||m(r,t.extent,s)?(this._setOverlayData(i,s,r,0,n),this._setOverlayData(i,s,r,1,n)):(this._clearTileOverlayData(0,n),this._clearTileOverlayData(1,n))}}_setOverlayData(e,t,i,s,n){const r=e[s].extent,a=y(r),l=v(r);let o=i[0];if(t){o=t.minimalMonotonic(r[0],o);const e=t.minimalMonotonic(r[0],i[2]);o>e&&(o=e-(i[2]-i[0]))}if(0===a||0===l)return void n.setOffsetAndScale(s,0,0,1,1);const h=y(i)/a,d=v(i)/l,u=(o-r[0])/a,c=(i[1]-r[1])/l;n.setOffsetAndScale(s,u,c,h,d)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function ne(e,t,i,s){const n=0===i?le.acquire():ae.acquire();return n.init(e,t,i,s),n}function re(e){e.dispose(),j(e)?le.release(e):U(e)&&ae.release(e)}const ae=new s(()=>new B),le=new s(()=>new I),oe=new L;function he(e,t){const i=e.lij,s=t[0]-i[0];return!(s<0)&&(t[1]>>s===i[1]&&t[2]>>s===i[2])}function de(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function ue(e,t,i){return null!=e&&null!=t&&t!==e&&(e.level>=t.level?ce(e,t,i):ce(t,e,V(i)))}function ce(e,t,i){N(e.level>=t.level);const s=Q(i),n=K(i),r=e.extent,a=t.extent,l=[s?r[0]:r[2],n?r[3]:r[1]],o=[s?a[2]:a[0],n?a[1]:a[3]],h=1e-5*(r[2]-r[0]),d=W(l[0],o[0],h)||e.surface.isGlobal&&W(l[0],-o[0],h),u=W(l[1],o[1],h);if(d&&u)return!0;if(e.level===t.level)return N(!1),!1;if(!d&&!u)return N(!1),!1;const c=d?ge(a[1],a[3],r[1],r[3],h):ge(a[0],a[2],r[0],r[2],h);return N(c),c}function ge(e,t,i,s,n){return e-n<=i&&i<=s&&s<=t+n}const pe=u(),fe=u(),_e=u(),me=u(),ye=u();export{se as Tile,ue as isCornerNeighbor,de as lijEquals};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as s}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";class t{constructor(){this._scales=s(-1,-1,-1,-1),this._offsets=s(-1,-1,-1,-1)}clear(){this._scales[0]=this._scales[1]=this._scales[2]=this._scales[3]=-1,this._offsets[0]=this._offsets[1]=this._offsets[2]=this._offsets[3]=-1}setScale(s,t,e){this._scales[2*s]=t,this._scales[2*s+1]=e}setOffset(s,t,e){this._offsets[2*s]=t,this._offsets[2*s+1]=e}get scales(){return this._scales}get offsets(){return this._offsets}}export{t as default};
5
+ import{fromValues as s}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";class t{constructor(){this._scales=s(-1,-1,-1,-1),this._offsets=s(-1,-1,-1,-1)}clear(){this._scales[0]=this._scales[1]=this._scales[2]=this._scales[3]=-1,this._offsets[0]=this._offsets[1]=this._offsets[2]=this._offsets[3]=-1}setOffsetAndScale(s,t,e,f,i){this._offsets[2*s]=t,this._offsets[2*s+1]=e,this._scales[2*s]=f,this._scales[2*s+1]=i}get scales(){return this._scales}get offsets(){return this._offsets}}export{t 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{destroyMaybe as t}from"../../../../../core/maybe.js";import{j as o,o as e,g as r}from"../../../../../chunks/vec32.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../../geometry/support/aaBoundingBox.js";class a{constructor(t,o,e,r,s,i){this.transform=t,this.toMapSpace=o,this.obb=e,this.componentData=r,this.renderable=s,this.intersectionGeometry=i,this.visible=!1,this.offsetObb=null,this._aabbInWorldCoordinates=null}destroy(){this.intersectionGeometry=t(this.intersectionGeometry),this.renderable=t(this.renderable),this.componentData=t(this.componentData)}get aabbInWorldCoordinates(){let t=this._aabbInWorldCoordinates;return t||(t=this._computeAabbInWorldCoordinates(),this._aabbInWorldCoordinates=t),t}_computeAabbInWorldCoordinates(){const t=i(),{positions:a}=this.intersectionGeometry;if(Math.floor(a.length/3)>0){const{rotationScale:i,position:n}=this.transform;let h=1/0,m=1/0,c=1/0,l=-1/0,b=-1/0,d=-1/0;const p=s();for(let t=0;t<a.length;t+=3)o(p,a[t+0],a[t+1],a[t+2]),e(p,p,i),r(p,p,n),h=Math.min(h,p[0]),m=Math.min(m,p[1]),c=Math.min(c,p[2]),l=Math.max(l,p[0]),b=Math.max(b,p[1]),d=Math.max(d,p[2]);t[0]=h,t[1]=m,t[2]=c,t[3]=l,t[4]=b,t[5]=d}return t}}export{a as ComponentObject};
5
+ import{destroyMaybe as t}from"../../../../../core/maybe.js";import{j as o,o as e,g as r}from"../../../../../chunks/vec32.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as i}from"../../../../../geometry/support/aaBoundingBox.js";class a{constructor(t,o,e,r,s){this.transform=t,this.obb=o,this.componentData=e,this.renderable=r,this.intersectionGeometry=s,this.visible=!1,this.offsetObb=null,this._aabbInWorldCoordinates=null}destroy(){this.intersectionGeometry=t(this.intersectionGeometry),this.renderable=t(this.renderable),this.componentData=t(this.componentData)}get aabbInWorldCoordinates(){let t=this._aabbInWorldCoordinates;return t||(t=this._computeAabbInWorldCoordinates(),this._aabbInWorldCoordinates=t),t}_computeAabbInWorldCoordinates(){const t=i(),{positions:a}=this.intersectionGeometry;if(Math.floor(a.length/3)>0){const{rotationScale:i,position:n}=this.transform;let h=1/0,m=1/0,l=1/0,c=-1/0,b=-1/0,d=-1/0;const p=s();for(let t=0;t<a.length;t+=3)o(p,a[t+0],a[t+1],a[t+2]),e(p,p,i),r(p,p,n),h=Math.min(h,p[0]),m=Math.min(m,p[1]),l=Math.min(l,p[2]),c=Math.max(c,p[0]),b=Math.max(b,p[1]),d=Math.max(d,p[2]);t[0]=h,t[1]=m,t[2]=l,t[3]=c,t[4]=b,t[5]=d}return t}}export{a as ComponentObject};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../core/Logger.js";import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import i from"../../../../../core/PooledArray.js";import{isTypedArray as o}from"../../../../../core/typedArrayUtil.js";import{s as n}from"../../../../../chunks/vec32.js";import{clone as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as a}from"../../../../../geometry/support/Indices.js";import{c}from"../../../../../chunks/vec3.js";import{c as l}from"../../../../../chunks/vec33.js";import{encodeSymbolColor as m}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as h}from"../../../support/orientedBoundingBox.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{ComponentData as p}from"./ComponentData.js";import{ComponentObject as g}from"./ComponentObject.js";import{IntersectionGeometry as d}from"./IntersectionGeometry.js";import{Renderable as u}from"./Renderable.js";import{RenderGeometry as b}from"./RenderGeometry.js";import{RenderSubmitSystem as v}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as y}from"./SourceGeometry.js";import{UniformComponentParameters as _}from"./UniformComponentParameters.js";import{ComponentParametersVarying as M,ComponentParametersUniform as C,ComponentMaterial as j}from"./Material/ComponentMaterial.js";import{indexGlLayout as w}from"./Material/ComponentTechnique.js";import{getComponentFieldCount as O,encodeElevationOffset as x,encodeEmissiveStrength as D}from"./Material/shader/ComponentData.glsl.js";import{olidEnabled as R}from"../../effects/geometry/olidUtils.js";import{getVisibility as S,updatePickabilityWithCount as A}from"../../lib/ComponentUtils.js";import{assert as P}from"../../lib/Util.js";import{VertexArrayObject as B}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as E}from"../../lib/verticalOffsetUtils.js";import{BufferManager as H}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as U}from"../../../../webgl/BufferObject.js";import{PrimitiveType as V}from"../../../../webgl/enums.js";import{VertexBuffer as I}from"../../../../webgl/VertexBuffer.js";const N=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class k{constructor(e,t){this._renderManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new i,this._hidden=new i,this._renderSubmit=new v(this),this._renderManager.register(this._renderSubmit),this._componentBufferManager=new H(e.rctx,O())}destroy(){P(0===this._hidden.length&&0===this._visible.length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy()}createObject(e){const{geometry:t}=e,i=new p(this._componentBufferManager,a(t.componentOffsets)),o=this._createRenderable(e,i),n=new d(this._viewingMode,t.positionData,i,e.elevationAlignable),r=new g(e.transform,e.toMapSpace,e.obb.clone(),i,o,n);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll(e=>e.renderable.meta.cameraDepthSquared=n(t,e.obb.center))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const i=e.renderable.material;t(i),i.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,i=t.componentData.visibility.componentCount;return{visible:i,invisible:t.componentData.count-i}}setComponentData(e,t){const i=e,{renderable:o,componentData:n}=i,r=o.material,s=n.materialDataBuffer,a=n.materialDataIndices,c=new _,l=s.textureBuffer,f=new Uint8Array(4),p=new Uint32Array(f.buffer);let g=0,d=0,u=0,b=0,v=0,y=n.verticalOffsets,j=1/0,w=-1/0,O=!1,P=!1,B=!1,E=0;for(let h=0;h<n.count;h++){t(h,c),g+=+(c.externalColor[3]<1),d+=+(3===c.externalColorMixMode&&1===c.externalColor[3]),b+=+(c.emissiveStrength>0),v+=+(1===c.emissiveSource),P||=1!==c.emissiveStrength,u+=+c.castShadows,m(c.externalColor,c.externalColorMixMode,f),f[2]=254&f[2]|+c.castShadows,l.setData(a[h],0,f[0],f[1],f[2],f[3]),O||=h>0&&E!==p[0],E=p[0],B||=0!==c.elevationOffset,B&&null==y&&(y=new Array(h).fill(0)),null!=y&&(y[h]=c.elevationOffset),j=Math.min(j,c.elevationOffset),w=Math.max(w,c.elevationOffset),x(c.elevationOffset,f),l.setData(a[h],1,f[0],f[1],f[2],f[3]),D(c.emissiveStrength,f),l.setData(a[h],2,f[0],f[1],f[2],0===c.emissiveSource?0:255);const e=c.olidColor;null!=e&&l.setData(a[h],3,e[0],e[1],e[2],e[3]),c.pickable!==S(n.pickability,h)&&A(n,h,c.pickable)}n.verticalOffsets=B?y:null,i.offsetObb=B?h(i.obb,j,w,this._viewingMode,i.offsetObb??i.obb.clone()):null,O||B||R()||(P||v>0)&&b>0?(r.componentParameters=new M,r.componentParameters.castShadows=G(u,n.count),r.componentParameters.transparent=G(g,n.count),r.componentParameters.opaqueOverride=G(d,n.count),r.componentParameters.emissiveOverride=G(b,n.count),r.componentParameters.emissiveSourceOverride=G(v,n.count),r.componentParameters.texture=l,l.updateTexture()):(r.componentParameters=new C,r.componentParameters.castShadows=c.castShadows?0:2,r.componentParameters.externalColor=c.externalColor,r.componentParameters.externalColorMixMode=c.externalColorMixMode,r.componentParameters.emissiveStrength=c.emissiveStrength,r.componentParameters.emissiveSource=c.emissiveSource),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,i,o=!1){e.intersectionGeometry.getComponentAabb(t,i);const n=e,r=n.componentData.verticalOffsets;if(o||null==r)return i;const s=r[t];if(2===this._viewingMode||0===s)return i[2]+=s,i[5]+=s,i;const a=E(s);return a.localOrigin=n.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,o){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||o.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const n=e,r=n.componentData,s=r.count,a=r.verticalOffsets,c=n.intersectionGeometry,l=2===this._viewingMode,m=c.getComponentAabbs(),h=L;let f=1/0,p=-1/0;for(let g=0;g<s;g++){const e=6*g,r=a?.[g]??0;let s=1/0,c=-1/0;if(l)s=m[e+2]+r+t,c=m[e+5]+r+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==r){const e=E(r);e.localOrigin=n.transform.position,e.applyToAabb(h)}const s=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),c=t+h[5]+i;o.expandElevationRangeValues(t+h[2],Math.sqrt(s*s+a*a+c*c)-i)}o.expandElevationRangeValues(s,c),f=Math.min(f,s),p=Math.max(p,c)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=f,this._elevationRangeCacheMax=p}intersect(e,t,i,o,n,r){const s=e,{transform:a,componentData:c,intersectionGeometry:l}=s;return null!=o&&(o.localOrigin=a.position),l.intersect(t,i,o,c.verticalOffsets,a,n,r)}addEdges(e,t,i,o,n){const r=e,{indices:s,positions:a}=r.intersectionGeometry,c=r.componentData.offsets;return t.addComponentObject(r,a,s,c,i,o,n)}async extractEdgeInformation(e,t,i){const o=e,n=o.componentData.visibility;if(n.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:a}=o.intersectionGeometry,m=o.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),f=h.createBuffer(a.length/3);l(f.position.typedBuffer,a,f.position.typedBufferStride,3),c(f.position,f.position,o.transform.rotationScale),this._setComponentIndices(f.componentIndex,s,m);const p=f.count,g=this._computeVisibilityIndices(s,n,m,p);return{origin:r(o.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:g,indicesLength:g.length,skipDeduplicate:!0,data:f,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let o=0;for(let n=0;n<i.length-1;n++){const r=i[n],s=i[n+1];for(let i=r;i<s;i++){const n=t?t[i]:i;e.set(n,o)}o++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange((e,t)=>(r+=i[t]-i[e],!0));const s=o(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(r):new Uint32Array(r):new Array(r);let a=0;return t.forEachComponentRange((t,o)=>{const n=i[t],r=i[o];for(let i=n;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addComponentHighlight(e,i,o){const n=e.componentData,r=t(n.componentHighlights,o,()=>new Uint32Array(n.count+1));{const e=this._activeHighlightOptions.get(o)??0;this._activeHighlightOptions.set(o,e+1)}0===r[i]++&&(n.markHighlightsDirty(),this._notifyDirty()),r[n.count]++}removeComponentHighlight(e,t,i){const{componentData:o}=e,n=o.componentHighlights.get(i);if(void 0===n)return void N().warn("Removing non-existing highlight.");const r=n[t];if(0===r)return void N().warn("Removing non-existing highlight.");this._removeActiveHighlight(i);const s=n[o.count];if(r>1)return n[t]=r-1,void(n[o.count]=s-1);n[t]=0,1===s?o.componentHighlights.delete(i):n[o.count]=s-1,o.markHighlightsDirty(),this._notifyDirty()}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)N().warn("Removing non-existing highlight.");else{const o=i-t;o<0&&N().warn("Removing non-existing highlight."),o<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,o)}}clearHighlights(e){const{componentData:t}=e,{componentHighlights:i}=t;if(i.size>0){for(const e of i)this._removeActiveHighlight(e[0],e[1][t.count]);i.clear(),t.markHighlightsDirty(),this._notifyDirty()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t){const i=this._renderManager.rctx,o=e.geometry,n=o.vertices.layoutParameters,r=f(y(n)),s=new I(i,r,o.vertices.data),a=o.indices?U.createIndex(i,35044,o.indices):null,c=new Uint16Array(o.vertices.count);for(let f=0;f<t.count;f++){const e=t.offsets[f],i=t.offsets[f+1],n=t.materialDataIndices[f];if(null!=o.indices)for(let t=e;t<i;t++){c[o.indices[t]]=n}else for(let t=e;t<i;t++)c[t]=n}const l=new I(i,w,c.buffer),m=new j(e.transform,e.toMapSpace),h=new B(i,new Map([["geometry",s],["componentIndices",l]]),a),p=new b(h,V.TRIANGLES,n,null!=a),g={cameraDepthSquared:.5,gpuMemoryEstimate:s.usedMemory+l.usedMemory+(null!=a?a.usedMemory:0)};return new u(m,p,g)}_notifyDirty(){this._renderManager.notifyDirty()}}function G(e,t){return e===t?0:0===e?2:1}const L=s();export{k as ComponentObjectCollection};
5
+ import e from"../../../../../core/Logger.js";import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import i from"../../../../../core/PooledArray.js";import{isTypedArray as o}from"../../../../../core/typedArrayUtil.js";import{s as n}from"../../../../../chunks/vec32.js";import{clone as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as a}from"../../../../../geometry/support/Indices.js";import{c as l}from"../../../../../chunks/vec3.js";import{c}from"../../../../../chunks/vec33.js";import{encodeSymbolColor as m}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as h}from"../../../support/orientedBoundingBox.js";import{glLayout as f}from"../../../support/buffer/glUtil.js";import{ComponentData as p}from"./ComponentData.js";import{ComponentObject as g}from"./ComponentObject.js";import{IntersectionGeometry as d}from"./IntersectionGeometry.js";import{Renderable as u}from"./Renderable.js";import{RenderGeometry as b}from"./RenderGeometry.js";import{RenderSubmitSystem as v}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as y}from"./SourceGeometry.js";import{UniformComponentParameters as _}from"./UniformComponentParameters.js";import{ComponentParametersVarying as C,ComponentParametersUniform as M,ComponentMaterial as j}from"./Material/ComponentMaterial.js";import{indexGlLayout as w}from"./Material/ComponentTechnique.js";import{getComponentFieldCount as O,encodeElevationOffset as x,encodeEmissiveStrength as D}from"./Material/shader/ComponentData.glsl.js";import{olidEnabled as R}from"../../effects/geometry/olidUtils.js";import{getVisibility as S,updatePickabilityWithCount as A}from"../../lib/ComponentUtils.js";import{assert as P}from"../../lib/Util.js";import{VertexArrayObject as B}from"../../lib/VertexArrayObject.js";import{getVerticalOffsetI3S as E}from"../../lib/verticalOffsetUtils.js";import{BufferManager as H}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as U}from"../../../../webgl/BufferObject.js";import{PrimitiveType as V}from"../../../../webgl/enums.js";import{VertexBuffer as I}from"../../../../webgl/VertexBuffer.js";const N=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class k{constructor(e,t){this._renderManager=e,this._viewingMode=t,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._activeHighlightOptions=new Map,this._visible=new i,this._hidden=new i,this._renderSubmit=new v(this),this._renderManager.register(this._renderSubmit),this._componentBufferManager=new H(e.rctx,O())}destroy(){P(0===this._hidden.length&&0===this._visible.length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy(),this._componentBufferManager=null,this._visible.forAll(e=>e.destroy()),this._visible.prune(),this._hidden.forAll(e=>e.destroy()),this._hidden.prune(),this._renderSubmit.destroy()}createObject(e){const{geometry:t}=e,i=new p(this._componentBufferManager,a(t.componentOffsets)),o=this._createRenderable(e,i),n=new d(this._viewingMode,t.positionData,i,e.elevationAlignable),r=new g(e.transform,e.obb.clone(),i,o,n);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const i=e;t!==i.visible&&(t?(this._hidden.removeUnordered(i),this._visible.push(i)):(this._visible.removeUnordered(i),this._hidden.push(i)),i.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll(e=>e.renderable.meta.cameraDepthSquared=n(t,e.obb.center))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const i=e.renderable.material;t(i),i.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const i=e;i.componentData.visibility.reset(t),i.componentData.markVisibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.componentData.visibility.forEachComponent(t)}getComponentCount(e){const t=e,i=t.componentData.visibility.componentCount;return{visible:i,invisible:t.componentData.count-i}}setComponentData(e,t){const i=e,{renderable:o,componentData:n}=i,r=o.material,s=n.materialDataBuffer,a=n.materialDataIndices,l=new _,c=s.textureBuffer,f=new Uint8Array(4),p=new Uint32Array(f.buffer);let g=0,d=0,u=0,b=0,v=0,y=n.verticalOffsets,j=1/0,w=-1/0,O=!1,P=!1,B=!1,E=0;for(let h=0;h<n.count;h++){t(h,l),g+=+(l.externalColor[3]<1),d+=+(3===l.externalColorMixMode&&1===l.externalColor[3]),b+=+(l.emissiveStrength>0),v+=+(1===l.emissiveSource),P||=1!==l.emissiveStrength,u+=+l.castShadows,m(l.externalColor,l.externalColorMixMode,f),f[2]=254&f[2]|+l.castShadows,c.setData(a[h],0,f[0],f[1],f[2],f[3]),O||=h>0&&E!==p[0],E=p[0],B||=0!==l.elevationOffset,B&&null==y&&(y=new Array(h).fill(0)),null!=y&&(y[h]=l.elevationOffset),j=Math.min(j,l.elevationOffset),w=Math.max(w,l.elevationOffset),x(l.elevationOffset,f),c.setData(a[h],1,f[0],f[1],f[2],f[3]),D(l.emissiveStrength,f),c.setData(a[h],2,f[0],f[1],f[2],0===l.emissiveSource?0:255);const e=l.olidColor;null!=e&&c.setData(a[h],3,e[0],e[1],e[2],e[3]),l.pickable!==S(n.pickability,h)&&A(n,h,l.pickable)}n.verticalOffsets=B?y:null,i.offsetObb=B?h(i.obb,j,w,this._viewingMode,i.offsetObb??i.obb.clone()):null,O||B||R()||(P||v>0)&&b>0?(r.componentParameters=new C,r.componentParameters.castShadows=G(u,n.count),r.componentParameters.transparent=G(g,n.count),r.componentParameters.opaqueOverride=G(d,n.count),r.componentParameters.emissiveOverride=G(b,n.count),r.componentParameters.emissiveSourceOverride=G(v,n.count),r.componentParameters.texture=c,c.updateTexture()):(r.componentParameters=new M,r.componentParameters.castShadows=l.castShadows?0:2,r.componentParameters.externalColor=l.externalColor,r.componentParameters.externalColorMixMode=l.externalColorMixMode,r.componentParameters.emissiveStrength=l.emissiveStrength,r.componentParameters.emissiveSource=l.emissiveSource),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,i,o=!1){e.intersectionGeometry.getComponentAabb(t,i);const n=e,r=n.componentData.verticalOffsets;if(o||null==r)return i;const s=r[t];if(2===this._viewingMode||0===s)return i[2]+=s,i[5]+=s,i;const a=E(s);return a.localOrigin=n.transform.position,a.applyToAabb(i)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,i){return e.intersectionGeometry.getComponentPositions(t,i)}expandRangeWithComponentObjectElevationRange(e,t,i,o){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||o.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const n=e,r=n.componentData,s=r.count,a=r.verticalOffsets,l=n.intersectionGeometry,c=2===this._viewingMode,m=l.getComponentAabbs(),h=L;let f=1/0,p=-1/0;for(let g=0;g<s;g++){const e=6*g,r=a?.[g]??0;let s=1/0,l=-1/0;if(c)s=m[e+2]+r+t,l=m[e+5]+r+t;else{if(h[0]=m[e],h[1]=m[e+1],h[2]=m[e+2],h[3]=m[e+3],h[4]=m[e+4],h[5]=m[e+5],0!==r){const e=E(r);e.localOrigin=n.transform.position,e.applyToAabb(h)}const s=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),l=t+h[5]+i;o.expandElevationRangeValues(t+h[2],Math.sqrt(s*s+a*a+l*l)-i)}o.expandElevationRangeValues(s,l),f=Math.min(f,s),p=Math.max(p,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=f,this._elevationRangeCacheMax=p}intersect(e,t,i,o,n,r){const s=e,{transform:a,componentData:l,intersectionGeometry:c}=s;return null!=o&&(o.localOrigin=a.position),c.intersect(t,i,o,l.verticalOffsets,a,n,r)}addEdges(e,t,i,o,n){const r=e,{indices:s,positions:a}=r.intersectionGeometry,l=r.componentData.offsets;return t.addComponentObject(r,a,s,l,i,o,n)}async extractEdgeInformation(e,t,i){const o=e,n=o.componentData.visibility;if(n.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:a}=o.intersectionGeometry,m=o.componentData.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),f=h.createBuffer(a.length/3);c(f.position.typedBuffer,a,f.position.typedBufferStride,3),l(f.position,f.position,o.transform.rotationScale),this._setComponentIndices(f.componentIndex,s,m);const p=f.count,g=this._computeVisibilityIndices(s,n,m,p);return{origin:r(o.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:g,indicesLength:g.length,skipDeduplicate:!0,data:f,writerSettings:{reducedPrecision:!1,variants:0}},i)}}_setComponentIndices(e,t,i){let o=0;for(let n=0;n<i.length-1;n++){const r=i[n],s=i[n+1];for(let i=r;i<s;i++){const n=t?t[i]:i;e.set(n,o)}o++}}_computeVisibilityIndices(e,t,i,n){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange((e,t)=>(r+=i[t]-i[e],!0));const s=o(e)?2===e?.BYTES_PER_ELEMENT||n<=65536?new Uint16Array(r):new Uint32Array(r):new Array(r);let a=0;return t.forEachComponentRange((t,o)=>{const n=i[t],r=i[o];for(let i=n;i<r;i++)s[a++]=e?e[i]:i;return!0}),s}addComponentHighlight(e,i,o){const n=e.componentData,r=t(n.componentHighlights,o,()=>new Uint32Array(n.count+1));{const e=this._activeHighlightOptions.get(o)??0;this._activeHighlightOptions.set(o,e+1)}0===r[i]++&&(n.markHighlightsDirty(),this._notifyDirty()),r[n.count]++}removeComponentHighlight(e,t,i){const{componentData:o}=e,n=o.componentHighlights.get(i);if(void 0===n)return void N().warn("Removing non-existing highlight.");const r=n[t];if(0===r)return void N().warn("Removing non-existing highlight.");this._removeActiveHighlight(i);const s=n[o.count];if(r>1)return n[t]=r-1,void(n[o.count]=s-1);n[t]=0,1===s?o.componentHighlights.delete(i):n[o.count]=s-1,o.markHighlightsDirty(),this._notifyDirty()}_removeActiveHighlight(e,t=1){const i=this._activeHighlightOptions.get(e);if(void 0===i)N().warn("Removing non-existing highlight.");else{const o=i-t;o<0&&N().warn("Removing non-existing highlight."),o<=0?this._activeHighlightOptions.delete(e):this._activeHighlightOptions.set(e,o)}}clearHighlights(e){const{componentData:t}=e,{componentHighlights:i}=t;if(i.size>0){for(const e of i)this._removeActiveHighlight(e[0],e[1][t.count]);i.clear(),t.markHighlightsDirty(),this._notifyDirty()}}hasHighlight(e){return this._activeHighlightOptions.has(e)}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t){const i=this._renderManager.rctx,o=e.geometry,n=o.vertices.layoutParameters,r=f(y(n)),s=new I(i,r,o.vertices.data),a=o.indices?U.createIndex(i,35044,o.indices):null,l=new Uint16Array(o.vertices.count);for(let f=0;f<t.count;f++){const e=t.offsets[f],i=t.offsets[f+1],n=t.materialDataIndices[f];if(null!=o.indices)for(let t=e;t<i;t++){l[o.indices[t]]=n}else for(let t=e;t<i;t++)l[t]=n}const c=new I(i,w,l.buffer),m=new j(e.transform,e.toMapSpace,e.obb.radius<T),h=new B(i,new Map([["geometry",s],["componentIndices",c]]),a),p=new b(h,V.TRIANGLES,n,null!=a),g={cameraDepthSquared:.5,gpuMemoryEstimate:s.usedMemory+c.usedMemory+(null!=a?a.usedMemory:0)};return new u(m,p,g)}_notifyDirty(){this._renderManager.notifyDirty()}}function G(e,t){return e===t?0:0===e?2:1}const L=s(),T=5e4;export{k as ComponentObjectCollection};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{invert as t,transpose as s}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as o,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as p}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{TwoVectorPosition as x}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as f}from"../../../materials/pbrUtils.js";import{defaultHighlightName as M}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as b}from"../../../../../../webscene/support/AlphaCutoff.js";class y extends v{constructor(e,o){super(),this.toMapSpace=o,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.sphereDepthInterpolate=!1,this.mrrFactors=f,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=0,this.commonMaterialParameters=new T,this.componentParameters=new S,this.objectOpacity=1,this.textureAlphaCutoff=b,this.alphaDiscardMode=1,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=1,this.hasOccludees=!1;const i=new x(e.position),l=r(e.rotationScale);t(l,l),s(l,l),this.transformNormalGlobalFromModel=l,this.transformWorldFromModelTL=i.low,this.transformWorldFromModelTH=i.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!o(this.emissiveBaseColor,l)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,s,r){const o=new p(e.context.spherical);o.renderOccluded=9===s.slot,o.hasVertexColors=r.hasVertexColors,o.hasNormals=r.hasNormals,o.textureCoordinateType=r.textureCoordinateType,o.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,o.hasOcclusionTexture=null!=this.occlusionTexture,o.hasNormalTexture=null!=this.normalTexture,o.sphereDepthInterpolate=this.sphereDepthInterpolate&&1===e.viewingMode,o.oitPass=0===t.identifier&&null!=s.oitPass?s.oitPass:0,o.terrainDepthTest=0===t.identifier&&s.terrainDepthTest,o.cullAboveTerrain=0===t.identifier&&s.cullAboveTerrain,o.ellipsoidMode=this.ellipsoidMode,o.componentData=this.componentParameters.type,o.cullFace=this.commonMaterialParameters.cullFace,o.doubleSidedMode=this.commonMaterialParameters.doubleSided?1:0,o.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();o.blendingEnabled=1===i||2===i,o.alphaDiscardMode=this.alphaDiscardMode,o.integratedMeshMode=this.isIntegratedMesh?P(s)?C(s)?3:2:1:0,o.hasPolygonOffset=this.polygonOffsetEnabled,o.pbrMode=3===o.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?r.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,l=2===this.componentParameters.emissiveSourceOverride,n=null!=this.emissionTexture;if(o.emissionSource=this.hasEmissions?this._hasEmissiveBase&&1===o.pbrMode?l?n?4:2:a?n?5:7:6:a?7:6:0,o.shadeNormals=r.shadeNormals,o.normalType=o.hasNormals?1:2,o.hasSlicePlane=null!=s.slicePlane&&this.commonMaterialParameters.hasSlicePlane,o.receiveAmbientOcclusion=o.hasOccludees=o.receiveShadows=o.screenSpaceReflections=o.cloudReflections=o.hasHighlightMixTexture=!1,1===t.identifier)o.output=4,o.vertexDiscardMode=0;else if(3===t.identifier)o.output=7,o.vertexDiscardMode=0;else if(2===t.identifier)o.output=9,o.vertexDiscardMode=0,o.hasHighlightMixTexture=null!=s.highlightMixTexture;else{switch(o.vertexDiscardMode=2===i?t.transparent?2:1:0,o.output=t.output,t.output){case 0:case 1:o.receiveAmbientOcclusion=r.applySSAO&&null!=s.ssao?.getTexture(),o.hasOccludees=s.hasOccludees,o.receiveShadows=s.shadowMap.ready,o.screenSpaceReflections=null!=s.ssr.lastFrameColor,o.cloudReflections=null!=s.clouds.data?.cubeMap?.colorTexture;break;case 10:o.olidColor=!0}o.snowCover=s.snowCover>0}const h=e.get(c,o);return this._setClean(),h}submit(e,t,s){if(this.objectOpacity<=0)return;const{componentData:r,renderable:o}=s,{geometry:i}=o,a=o.meta.cameraDepthSquared;r.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=r;switch(this._computeWhichMaterialPass()){case 0:e.opaque.submitDraw(this,i,l,a);break;case 1:e.transparent.submitDraw(this,i,l,a);break;case 2:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case 3:e.integratedMesh.submitDraw(this,i,l,a),D(t)&&e.occludedGround.submitDraw(this,i,l,a),O(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a);break;case 4:e.transparentIntegratedMesh.submitDraw(this,i,l,a)}if(2!==this.componentParameters.castShadows){if(null!=n)for(const t of n)t[0]===M&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,i,h,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,i,u[1],a,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh&&this.objectOpacity>=1)return 3;if(this.isIntegratedMesh&&this.objectOpacity<1)return 4;if(this.objectOpacity<1)return 1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}}e([d({vectorOps:n})],y.prototype,"baseColor",void 0),e([d()],y.prototype,"usePBR",void 0),e([d()],y.prototype,"hasParametersFromSource",void 0),e([d()],y.prototype,"sphereDepthInterpolate",void 0),e([d({vectorOps:i})],y.prototype,"mrrFactors",void 0),e([d({dispose:!0})],y.prototype,"baseColorTexture",void 0),e([d({dispose:!0})],y.prototype,"metallicRoughnessTexture",void 0),e([d({dispose:!0})],y.prototype,"normalTexture",void 0),e([d({dispose:!0})],y.prototype,"occlusionTexture",void 0),e([d({dispose:!0})],y.prototype,"emissionTexture",void 0),e([d({vectorOps:i})],y.prototype,"emissiveBaseColor",void 0),e([d()],y.prototype,"emissiveStrength",void 0),e([m()],y.prototype,"commonMaterialParameters",void 0),e([m()],y.prototype,"componentParameters",void 0),e([d()],y.prototype,"objectOpacity",void 0),e([d()],y.prototype,"textureAlphaCutoff",void 0),e([d()],y.prototype,"alphaDiscardMode",void 0),e([d()],y.prototype,"isIntegratedMesh",void 0),e([d()],y.prototype,"polygonOffsetEnabled",void 0),e([d()],y.prototype,"ellipsoidMode",void 0),e([d()],y.prototype,"hasOccludees",void 0);class T extends g{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=2,this.hasSlicePlane=!0}}e([d()],T.prototype,"doubleSided",void 0),e([d()],T.prototype,"cullFace",void 0),e([d()],T.prototype,"hasSlicePlane",void 0);class S extends g{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=1,this.emissiveStrength=0,this.emissiveSource=0,this.castShadows=0}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}get visible(){return this.externalColor[3]>0?0:2}get type(){return 0}}e([d({vectorOps:n})],S.prototype,"externalColor",void 0),e([d()],S.prototype,"externalColorMixMode",void 0),e([d()],S.prototype,"emissiveStrength",void 0),e([d()],S.prototype,"emissiveSource",void 0),e([d()],S.prototype,"castShadows",void 0);class w extends g{constructor(){super(...arguments),this.texture=null,this.transparent=2,this.opaqueOverride=2,this.emissiveOverride=2,this.emissiveSourceOverride=2,this.castShadows=2}get type(){return 1}}function O(e){return null!=e.overlay?.getTexture(2)}function C(e){return null!=e.overlay?.getTexture(3)}function P(e){return null!=e.overlay?.getTexture(1)}function D(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([d()],w.prototype,"texture",void 0),e([d()],w.prototype,"transparent",void 0),e([d()],w.prototype,"opaqueOverride",void 0),e([d()],w.prototype,"emissiveOverride",void 0),e([d()],w.prototype,"emissiveSourceOverride",void 0),e([d()],w.prototype,"castShadows",void 0);export{T as CommonMaterialParameters,y as ComponentMaterial,S as ComponentParametersUniform,w as ComponentParametersVarying};
5
+ import{__decorate as e}from"tslib";import{invert as t,transpose as s}from"../../../../../../core/libs/gl-matrix-2/math/mat3.js";import{clone as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as o,I as i}from"../../../../../../chunks/vec32.js";import{freeze as a,ZEROS as l}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{v as n}from"../../../../../../chunks/vec42.js";import{freeze as h,fromValues as u}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ComponentTechnique as c}from"./ComponentTechnique.js";import{ComponentTechniqueConfiguration as p}from"./ComponentTechniqueConfiguration.js";import{parameter as d,parameterBlock as m,MaterialBase as v,MaterialParameterBlock as g}from"../../../core/material/MaterialBase.js";import{TwoVectorPosition as x}from"../../../core/util/TwoVectorPosition.js";import{advancedMRRFactors as f}from"../../../materials/pbrUtils.js";import{defaultHighlightName as M}from"../../../../../support/HighlightDefaults.js";import{alphaCutoff as b}from"../../../../../../webscene/support/AlphaCutoff.js";class y extends v{constructor(e,o,i){super(),this.toMapSpace=o,this.useENUForGlobalOverlayUV=i,this.baseColor=h(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.sphereDepthInterpolate=!1,this.mrrFactors=f,this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.normalTexture=null,this.occlusionTexture=null,this.emissionTexture=null,this.emissiveBaseColor=a(0,0,0),this.emissiveStrength=0,this.commonMaterialParameters=new T,this.componentParameters=new S,this.objectOpacity=1,this.textureAlphaCutoff=b,this.alphaDiscardMode=1,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=1,this.hasOccludees=!1;const l=new x(e.position),n=r(e.rotationScale);t(n,n),s(n,n),this.transformNormalGlobalFromModel=n,this.transformWorldFromModelTL=l.low,this.transformWorldFromModelTH=l.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get _hasEmissiveBase(){return null!=this.emissionTexture||!o(this.emissiveBaseColor,l)}get _hasEmissiveStrength(){return 2!==this.componentParameters.emissiveOverride}get hasEmissions(){return this._hasEmissiveStrength&&(this._hasEmissiveBase||2!==this.componentParameters.emissiveSourceOverride)}get texture(){return this.baseColorTexture?.glTexture}get textureMetallicRoughness(){return this.metallicRoughnessTexture?.glTexture}get textureEmissive(){return this.emissionTexture?.glTexture}get textureOcclusion(){return this.occlusionTexture?.glTexture}get textureNormal(){return this.normalTexture?.glTexture}acquireTechnique(e,t,s,r){const o=new p(e.context.spherical,e.context.sphericalSR);o.renderOccluded=9===s.slot,o.hasVertexColors=r.hasVertexColors,o.hasNormals=r.hasNormals,o.textureCoordinateType=r.textureCoordinateType,o.hasMetallicRoughnessTexture=null!=this.metallicRoughnessTexture,o.hasOcclusionTexture=null!=this.occlusionTexture,o.hasNormalTexture=null!=this.normalTexture,o.sphereDepthInterpolate=this.sphereDepthInterpolate&&1===e.viewingMode,o.oitPass=0===t.identifier&&null!=s.oitPass?s.oitPass:0,o.terrainDepthTest=0===t.identifier&&s.terrainDepthTest,o.cullAboveTerrain=0===t.identifier&&s.cullAboveTerrain,o.ellipsoidMode=this.ellipsoidMode,o.componentData=this.componentParameters.type,o.cullFace=this.commonMaterialParameters.cullFace,o.doubleSidedMode=this.commonMaterialParameters.doubleSided?1:0,o.hasColorTexture=null!=this.baseColorTexture;const i=this._computeWhichMaterialPass();o.blendingEnabled=1===i||2===i,o.alphaDiscardMode=this.alphaDiscardMode,o.integratedMeshMode=this.isIntegratedMesh?P(s)?C(s)?3:2:1:0,o.hasPolygonOffset=this.polygonOffsetEnabled,o.pbrMode=3===o.integratedMeshMode?4:this.usePBR?this.hasParametersFromSource?r.shadeNormals&&this.isIntegratedMesh?0:2:1:0;const a=1===this.componentParameters.emissiveSourceOverride,l=2===this.componentParameters.emissiveSourceOverride,n=null!=this.emissionTexture;if(o.emissionSource=this.hasEmissions?this._hasEmissiveBase&&1===o.pbrMode?l?n?4:2:a?n?5:7:6:a?7:6:0,o.shadeNormals=r.shadeNormals,o.normalType=o.hasNormals?1:2,o.hasSlicePlane=null!=s.slicePlane&&this.commonMaterialParameters.hasSlicePlane,o.receiveAmbientOcclusion=o.hasOccludees=o.receiveShadows=o.screenSpaceReflections=o.cloudReflections=o.hasHighlightMixTexture=!1,1===t.identifier)o.output=4,o.vertexDiscardMode=0;else if(3===t.identifier)o.output=7,o.vertexDiscardMode=0;else if(2===t.identifier)o.output=9,o.vertexDiscardMode=0,o.hasHighlightMixTexture=null!=s.highlightMixTexture;else{switch(o.vertexDiscardMode=2===i?t.transparent?2:1:0,o.output=t.output,t.output){case 0:case 1:o.receiveAmbientOcclusion=r.applySSAO&&null!=s.ssao?.getTexture(),o.hasOccludees=s.hasOccludees,o.receiveShadows=s.shadowMap.ready,o.screenSpaceReflections=null!=s.ssr.lastFrameColor,o.cloudReflections=null!=s.clouds.data?.cubeMap?.colorTexture;break;case 10:o.olidColor=!0}o.snowCover=s.snowCover>0}const h=e.get(c,o);return this._setClean(),h}submit(e,t,s){if(this.objectOpacity<=0)return;const{componentData:r,renderable:o}=s,{geometry:i}=o,a=o.meta.cameraDepthSquared;r.updateHighlights(t.highlights);const{geometryRanges:l,highlightRangesMap:n,shadowmapRanges:h}=r;switch(this._computeWhichMaterialPass()){case 0:e.opaque.submitDraw(this,i,l,a);break;case 1:e.transparent.submitDraw(this,i,l,a);break;case 2:e.opaque.submitDraw(this,i,l,a),e.transparent.submitDraw(this,i,l,a);break;case 3:e.integratedMesh.submitDraw(this,i,l,a),D(t)&&e.occludedGround.submitDraw(this,i,l,a),O(t)&&e.highlightIntegratedMesh.submitDraw(this,i,l,a);break;case 4:e.transparentIntegratedMesh.submitDraw(this,i,l,a)}if(2!==this.componentParameters.castShadows){if(null!=n)for(const t of n)t[0]===M&&e.highlightShadowMap.submitDraw(this,i,t[1],a,t[0]);null!=h&&e.defaultShadowMap.submitDraw(this,i,h,a),e.shadowMap.submitDraw(this,i,l,a)}if(null!=n)for(const u of n)e.highlight.submitDraw(this,i,u[1],a,u[0]);t.viewshedEnabled&&e.viewshedShadowMap.submitDraw(this,i,l,a)}_computeWhichMaterialPass(){if(this.isIntegratedMesh&&this.objectOpacity>=1)return 3;if(this.isIntegratedMesh&&this.objectOpacity<1)return 4;if(this.objectOpacity<1)return 1;if(0===this.componentParameters.opaqueOverride)return 0;if(this.baseColor[3]<1||0===this.alphaDiscardMode||3===this.alphaDiscardMode)return 1;switch(this.componentParameters.transparent){case 2:return 0;case 0:return 1;case 1:return 2}}}e([d({vectorOps:n})],y.prototype,"baseColor",void 0),e([d()],y.prototype,"usePBR",void 0),e([d()],y.prototype,"hasParametersFromSource",void 0),e([d()],y.prototype,"sphereDepthInterpolate",void 0),e([d({vectorOps:i})],y.prototype,"mrrFactors",void 0),e([d({dispose:!0})],y.prototype,"baseColorTexture",void 0),e([d({dispose:!0})],y.prototype,"metallicRoughnessTexture",void 0),e([d({dispose:!0})],y.prototype,"normalTexture",void 0),e([d({dispose:!0})],y.prototype,"occlusionTexture",void 0),e([d({dispose:!0})],y.prototype,"emissionTexture",void 0),e([d({vectorOps:i})],y.prototype,"emissiveBaseColor",void 0),e([d()],y.prototype,"emissiveStrength",void 0),e([m()],y.prototype,"commonMaterialParameters",void 0),e([m()],y.prototype,"componentParameters",void 0),e([d()],y.prototype,"objectOpacity",void 0),e([d()],y.prototype,"textureAlphaCutoff",void 0),e([d()],y.prototype,"alphaDiscardMode",void 0),e([d()],y.prototype,"isIntegratedMesh",void 0),e([d()],y.prototype,"polygonOffsetEnabled",void 0),e([d()],y.prototype,"ellipsoidMode",void 0),e([d()],y.prototype,"hasOccludees",void 0);class T extends g{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=2,this.hasSlicePlane=!0}}e([d()],T.prototype,"doubleSided",void 0),e([d()],T.prototype,"cullFace",void 0),e([d()],T.prototype,"hasSlicePlane",void 0);class S extends g{constructor(){super(...arguments),this.externalColor=u(1,1,1,1),this.externalColorMixMode=1,this.emissiveStrength=0,this.emissiveSource=0,this.castShadows=0}get transparent(){return this.externalColor[3]<1?0:2}get opaqueOverride(){return 3===this.externalColorMixMode&&1===this.externalColor[3]?0:2}get emissiveOverride(){return this.emissiveStrength>0?0:2}get emissiveSourceOverride(){return 1===this.emissiveSource?0:2}get visible(){return this.externalColor[3]>0?0:2}get type(){return 0}}e([d({vectorOps:n})],S.prototype,"externalColor",void 0),e([d()],S.prototype,"externalColorMixMode",void 0),e([d()],S.prototype,"emissiveStrength",void 0),e([d()],S.prototype,"emissiveSource",void 0),e([d()],S.prototype,"castShadows",void 0);class w extends g{constructor(){super(...arguments),this.texture=null,this.transparent=2,this.opaqueOverride=2,this.emissiveOverride=2,this.emissiveSourceOverride=2,this.castShadows=2}get type(){return 1}}function O(e){return null!=e.overlay?.getTexture(2)}function C(e){return null!=e.overlay?.getTexture(3)}function P(e){return null!=e.overlay?.getTexture(1)}function D(e){return null!=e.overlay?.getTexture(e.overlay?.allSourcesOccluders?1:4)}e([d()],w.prototype,"texture",void 0),e([d()],w.prototype,"transparent",void 0),e([d()],w.prototype,"opaqueOverride",void 0),e([d()],w.prototype,"emissiveOverride",void 0),e([d()],w.prototype,"emissiveSourceOverride",void 0),e([d()],w.prototype,"castShadows",void 0);export{T as CommonMaterialParameters,y as ComponentMaterial,S as ComponentParametersUniform,w as ComponentParametersVarying};