@arcgis/core 4.24.0-next.20220329 → 4.24.0-next.20220401

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 (456) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/WebMap.js +1 -1
  3. package/WebScene.js +1 -1
  4. package/analysis/LineOfSightAnalysisObserver.js +1 -1
  5. package/analysis/LineOfSightAnalysisTarget.js +1 -1
  6. package/arcade/featureset/actions/Adapted.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  9. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  10. package/arcade/featureset/support/FeatureSet.js +1 -1
  11. package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
  12. package/arcade/featureset/support/shared.js +1 -1
  13. package/arcade/functions/convertdirection.js +1 -1
  14. package/arcade/lib/character.js +1 -1
  15. package/arcade/lib/scanner.js +1 -1
  16. package/arcade/lib/tokenizer.js +1 -1
  17. package/arcade/request.js +1 -1
  18. package/arcade/treeAnalysis.js +1 -1
  19. package/assets/esri/core/workers/RemoteClient.js +1 -1
  20. package/assets/esri/core/workers/chunks/0bfedb1dbdff8205e468.js +1 -0
  21. package/assets/esri/core/workers/chunks/{5e472c89a38d6a42b84d.js → 0e29250c24a3a7b1ce13.js} +1 -1
  22. package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
  23. package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
  24. package/assets/esri/core/workers/chunks/10a119889d1ab13402a3.js +1 -0
  25. package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
  26. package/assets/esri/core/workers/chunks/23ec33a30db201e8b2c3.js +1 -0
  27. package/assets/esri/core/workers/chunks/2530e8ccf6e12787ce76.js +1 -0
  28. package/assets/esri/core/workers/chunks/2d9e97ba5b50aec4dd01.js +1 -0
  29. package/assets/esri/core/workers/chunks/365dc146398420f13f82.js +1 -0
  30. package/assets/esri/core/workers/chunks/3ae2827e8d55d6713d20.js +1 -0
  31. package/assets/esri/core/workers/chunks/3e3eebaa0844742db2f2.js +1 -0
  32. package/assets/esri/core/workers/chunks/3fd5b2d6eccd9098d492.js +1 -0
  33. package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +1 -0
  34. package/assets/esri/core/workers/chunks/411b7777bb5e943c156f.js +1 -0
  35. package/assets/esri/core/workers/chunks/{12ca192a5233bb2875d0.js → 4312902ab6e42fbe119b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{4ef07f50da39f8607c1c.js → 44e95e87bd9e820aeb53.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{4d4c5e535d8b9ceb865a.js → 4810edf605838d07e5c5.js} +1 -1
  38. package/assets/esri/core/workers/chunks/4bce446391176a9d4588.js +1 -0
  39. package/assets/esri/core/workers/chunks/52a0e387073ea264e194.js +1 -0
  40. package/assets/esri/core/workers/chunks/560234694f3e53802aff.js +1 -0
  41. package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
  42. package/assets/esri/core/workers/chunks/5682039666f874836451.js +1 -0
  43. package/assets/esri/core/workers/chunks/6f01905936396fe87865.js +1 -0
  44. package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
  45. package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
  46. package/assets/esri/core/workers/chunks/7745efef7d5119d0b087.js +1 -0
  47. package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
  48. package/assets/esri/core/workers/chunks/{da64dedf9270b64f42b2.js → 79bdb26244ec7b4472fe.js} +1 -1
  49. package/assets/esri/core/workers/chunks/79ec28b3e3c57fe026aa.js +1 -0
  50. package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
  51. package/assets/esri/core/workers/chunks/831dc0187f71e658550c.js +1 -0
  52. package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +1 -0
  53. package/assets/esri/core/workers/chunks/{fb7397da8d4ec2ae4587.js → 87458fbf395338511662.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{1a859be598ad96bb4719.js → 8771296b537f366596c4.js} +18 -18
  55. package/assets/esri/core/workers/chunks/8958cd555f4887526e8b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
  57. package/assets/esri/core/workers/chunks/93067e27eea5844edc6c.js +1 -0
  58. package/assets/esri/core/workers/chunks/{9fbee2d9bf50c4c148c6.js → 9a146c9e9b4bf7fba88f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +1 -0
  60. package/assets/esri/core/workers/chunks/{6c4ce530b493c6f7c430.js → 9df2f9f7c28b31866be8.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{d0620ce99b620621d8bc.js → a0552044e123a3c51ddf.js} +1 -1
  62. package/assets/esri/core/workers/chunks/acc1a4acd57f5657e782.js +1 -0
  63. package/assets/esri/core/workers/chunks/b055ae7c54796751b64c.js +1 -0
  64. package/assets/esri/core/workers/chunks/{acc2cfb116fee7f82ae9.js → b26bd8fde2fc65bb67fb.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{9b45b94c4dbdc8d2c5fd.js → b34ba22c7a5adce8a7a2.js} +1 -1
  66. package/assets/esri/core/workers/chunks/b75665d0bf417c6ef24a.js +1 -0
  67. package/assets/esri/core/workers/chunks/bd50ec30688463b821d1.js +1 -0
  68. package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
  69. package/assets/esri/core/workers/chunks/c4f713959d4115b87c6c.js +1 -0
  70. package/assets/esri/core/workers/chunks/c58aa209492bd94b7aad.js +1 -0
  71. package/assets/esri/core/workers/chunks/{9b117097b7be0efd21d4.js → c59b0b58e24e6a60cf3e.js} +1 -1
  72. package/assets/esri/core/workers/chunks/c7bd5a4d318299388645.js +1 -0
  73. package/assets/esri/core/workers/chunks/c7cee13a962396b23a5e.js +1 -0
  74. package/assets/esri/core/workers/chunks/{3bbff5ea1ea0e955c592.js → cd3679fa86129ebabfdf.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{1a36dc0daffd536ea44d.js → cee7ce362860717713bf.js} +1 -1
  76. package/assets/esri/core/workers/chunks/cf463d6309f14df2f2fa.js +1 -0
  77. package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{fff4200bc61b82dd6193.js → d1d1c45243af614f2e74.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{1e0498dc9836658d9aba.js → d5fd12ea541c1a6b7fce.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{10322d990cda5aedf2f0.js → d6e32ca237ad9309c76a.js} +1 -1
  81. package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
  82. package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
  83. package/assets/esri/core/workers/chunks/{5d5fa2b1fc48a17eb9ab.js → f4fc165420d449e442b8.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{3d6d9906a534ddd8fa37.js → f5ee03f3fca7a75192de.js} +1 -1
  85. package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
  86. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +1 -1
  87. package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
  88. package/assets/esri/themes/base/widgets/_Widget.scss +12 -0
  89. package/assets/esri/themes/dark/main.css +1 -1
  90. package/assets/esri/themes/dark-blue/main.css +1 -1
  91. package/assets/esri/themes/dark-green/main.css +1 -1
  92. package/assets/esri/themes/dark-purple/main.css +1 -1
  93. package/assets/esri/themes/dark-red/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/assets/esri/themes/light-blue/main.css +1 -1
  97. package/assets/esri/themes/light-green/main.css +1 -1
  98. package/assets/esri/themes/light-purple/main.css +1 -1
  99. package/assets/esri/themes/light-red/main.css +1 -1
  100. package/chunks/ComponentShader.glsl.js +25 -25
  101. package/chunks/HighlightApply.glsl.js +36 -0
  102. package/chunks/HighlightBlur.glsl.js +26 -0
  103. package/chunks/HighlightDownsample.glsl.js +12 -0
  104. package/chunks/ImageMaterial.glsl.js +8 -8
  105. package/chunks/LineCallout.glsl.js +1 -1
  106. package/chunks/Pattern.glsl.js +2 -2
  107. package/chunks/SimpleAtmosphere.glsl.js +7 -7
  108. package/chunks/Stars.glsl.js +1 -1
  109. package/chunks/arcade.js +1 -1
  110. package/chunks/color.js +1 -1
  111. package/chunks/languageUtils.js +1 -1
  112. package/chunks/mat3.js +1 -1
  113. package/copyright.txt +2 -2
  114. package/core/AsyncUpdate.js +1 -1
  115. package/core/Evented.js +1 -1
  116. package/core/PooledArray.js +1 -1
  117. package/core/accessorSupport/diffUtils.js +1 -1
  118. package/core/accessorSupport/get.js +1 -1
  119. package/core/accessorSupport/read.js +1 -1
  120. package/core/accessorSupport/set.js +1 -1
  121. package/core/accessorSupport/tracking.js +1 -1
  122. package/core/accessorSupport/utils.js +1 -1
  123. package/core/arrayUtils.js +1 -1
  124. package/core/libs/gl-matrix-2/mat3.js +1 -1
  125. package/core/libs/gl-matrix-2/math/mat3.js +1 -1
  126. package/core/number.js +1 -1
  127. package/core/object.js +1 -1
  128. package/core/string.js +1 -1
  129. package/core/unitUtils.js +1 -1
  130. package/core/watchUtils.js +1 -1
  131. package/core/workers/RemoteClient.js +1 -1
  132. package/exports/csv.js +1 -1
  133. package/geometry/support/heightModelInfoUtils.js +1 -1
  134. package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
  135. package/geometry/support/normalizeUtils.js +1 -1
  136. package/identity/IdentityManagerBase.js +1 -1
  137. package/interfaces.d.ts +155 -20
  138. package/layers/ImageryLayer.js +1 -1
  139. package/layers/MapImageLayer.js +1 -1
  140. package/layers/RouteLayer.js +1 -1
  141. package/layers/SceneLayer.js +1 -1
  142. package/layers/SubtypeGroupLayer.js +1 -1
  143. package/layers/TileLayer.js +1 -1
  144. package/layers/VectorTileLayer.js +1 -1
  145. package/layers/WMSLayer.js +1 -1
  146. package/layers/WMTSLayer.js +1 -1
  147. package/layers/WebTileLayer.js +1 -1
  148. package/layers/graphics/data/AttributesBuilder.js +1 -1
  149. package/layers/graphics/data/QueryEngine.js +1 -1
  150. package/layers/graphics/editingSupport.js +1 -1
  151. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  152. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  153. package/layers/graphics/sources/support/inferenceUtils.js +1 -1
  154. package/layers/mixins/ArcGISCachedService.js +1 -1
  155. package/layers/mixins/ArcGISImageService.js +1 -1
  156. package/layers/ogc/ogcFeatureUtils.js +1 -1
  157. package/layers/support/ExportImageServiceParameters.js +1 -1
  158. package/layers/support/PixelBlock.js +1 -1
  159. package/layers/support/RasterJobHandler.js +1 -1
  160. package/layers/support/SpriteSource.js +1 -1
  161. package/layers/support/Sublayer.js +1 -1
  162. package/layers/support/TilemapCache.js +1 -1
  163. package/layers/support/WMTSSublayer.js +1 -1
  164. package/layers/support/arcgisLayerUrl.js +1 -1
  165. package/layers/support/fieldUtils.js +1 -1
  166. package/layers/support/kmlUtils.js +1 -1
  167. package/layers/support/layerUtils.js +1 -1
  168. package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
  169. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  170. package/layers/support/rasterDatasets/RasterFactory.js +1 -1
  171. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  172. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  173. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  174. package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
  175. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  176. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  177. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  178. package/layers/support/vectorTileLayerLoader.js +1 -1
  179. package/layers/support/wmsUtils.js +1 -1
  180. package/layers/support/wmtsUtils.js +1 -1
  181. package/libs/i3s/I3SModule.js +1 -1
  182. package/libs/vxl/VxlModule.js +1 -1
  183. package/package.json +1 -1
  184. package/portal/Portal.js +1 -1
  185. package/portal/PortalItem.js +1 -1
  186. package/portal/schemas/definitions.js +1 -1
  187. package/portal/support/layersLoader.js +1 -1
  188. package/portal/support/portalItemUtils.js +1 -1
  189. package/portal/support/portalLayers.js +1 -1
  190. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  191. package/renderers/support/DictionaryLoader.js +1 -1
  192. package/renderers/support/RasterSymbolizer.js +1 -1
  193. package/renderers/support/numberUtils.js +1 -1
  194. package/renderers/support/rasterRendererHelper.js +1 -1
  195. package/renderers/support/utils.js +1 -1
  196. package/request.js +1 -1
  197. package/rest/imageService.js +1 -1
  198. package/rest/operations/find.js +1 -1
  199. package/rest/query/operations/query.js +1 -1
  200. package/rest/query/operations/queryRelatedRecords.js +1 -1
  201. package/rest/query/operations/queryTopFeatures.js +1 -1
  202. package/rest/support/DirectionLine.js +1 -1
  203. package/rest/support/DirectionPoint.js +1 -1
  204. package/rest/support/PointBarrier.js +1 -1
  205. package/rest/support/PolygonBarrier.js +1 -1
  206. package/rest/support/PolylineBarrier.js +1 -1
  207. package/rest/support/RouteInfo.js +1 -1
  208. package/rest/support/Stop.js +1 -1
  209. package/smartMapping/labels/clusters.js +1 -1
  210. package/smartMapping/popup/dotDensity.js +1 -1
  211. package/smartMapping/popup/support/clusterUtils.js +1 -1
  212. package/smartMapping/popup/support/utils.js +1 -1
  213. package/smartMapping/raster/support/utils.js +1 -1
  214. package/smartMapping/renderers/color.js +1 -1
  215. package/smartMapping/renderers/location.js +1 -1
  216. package/smartMapping/renderers/predominance.js +1 -1
  217. package/smartMapping/renderers/relationship.js +1 -1
  218. package/smartMapping/renderers/size.js +1 -1
  219. package/smartMapping/renderers/support/utils.js +1 -1
  220. package/smartMapping/renderers/type.js +1 -1
  221. package/smartMapping/renderers/univariateColorSize.js +1 -1
  222. package/smartMapping/statistics/summaryStatisticsForAge.js +1 -1
  223. package/smartMapping/statistics/support/ageUtils.js +1 -1
  224. package/smartMapping/statistics/support/utils.js +1 -1
  225. package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
  226. package/smartMapping/support/adapters/support/utils.js +1 -1
  227. package/smartMapping/support/utils.js +1 -1
  228. package/smartMapping/symbology/support/Theme.js +1 -1
  229. package/smartMapping/symbology/support/colorRamps.js +1 -1
  230. package/smartMapping/symbology/support/symbologyUtils.js +1 -1
  231. package/smartMapping/symbology/support/utils.js +1 -1
  232. package/statistics/utils.js +1 -1
  233. package/support/basemapDefinitions.js +1 -1
  234. package/support/basemapUtils.js +1 -1
  235. package/support/elevationInfoUtils.js +1 -1
  236. package/support/popupUtils.js +1 -1
  237. package/support/revision.js +1 -1
  238. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  239. package/symbols/cim/cimAnalyzer.js +1 -1
  240. package/symbols/cim/utils.js +1 -1
  241. package/symbols/support/previewSymbol3D.js +1 -1
  242. package/symbols/support/renderUtils.js +1 -1
  243. package/symbols/support/symbolLayerUtils.js +1 -1
  244. package/views/2d/engine/Bitmap.js +1 -1
  245. package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
  246. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  247. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  248. package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
  249. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  250. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  251. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  252. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  253. package/views/2d/engine/webgl/Profiler.js +1 -1
  254. package/views/2d/engine/webgl/Utils.js +1 -1
  255. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  256. package/views/2d/engine/webgl/definitions.js +1 -1
  257. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  258. package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
  259. package/views/2d/engine/webgl/mesh/templates/WGLTemplateStore.js +1 -1
  260. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  261. package/views/2d/engine/webgl/util/Lock.js +1 -1
  262. package/views/2d/layers/RouteLayerView2D.js +1 -1
  263. package/views/2d/layers/features/schemaUtils.js +1 -1
  264. package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
  265. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  266. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  267. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  268. package/views/2d/layers/support/webStyleUtils.js +1 -1
  269. package/views/2d/support/Timeline.js +1 -1
  270. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  271. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  272. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  273. package/views/3d/analysis/Slice/SliceController.js +1 -1
  274. package/views/3d/environment/PanoramicAtmosphere.js +1 -1
  275. package/views/3d/environment/SceneViewAtmosphere.js +1 -1
  276. package/views/3d/environment/StarsTechnique.js +1 -1
  277. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  278. package/views/3d/glTF/loader.js +1 -1
  279. package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
  280. package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
  281. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  282. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  283. package/views/3d/layers/I3SMeshView3D.js +1 -1
  284. package/views/3d/layers/ImageryLayerView3D.js +1 -1
  285. package/views/3d/layers/LayerView3D.js +1 -1
  286. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  287. package/views/3d/layers/RouteLayerView3D.js +1 -1
  288. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  289. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  290. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  291. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  292. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  293. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  294. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  295. package/views/3d/layers/i3s/IDBMockCache.js +5 -0
  296. package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
  297. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  298. package/views/3d/state/ViewStateManager.js +1 -1
  299. package/views/3d/state/controllers/RotateController.js +1 -1
  300. package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
  301. package/views/3d/state/controllers/global/ZoomController.js +1 -1
  302. package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
  303. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  304. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  305. package/views/3d/support/HighlightOptions.js +1 -1
  306. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  307. package/views/3d/support/debugFlags.js +1 -1
  308. package/views/3d/support/orientedBoundingBox.js +1 -1
  309. package/views/3d/terrain/TerrainSurface.js +1 -1
  310. package/views/3d/webgl-engine/Stage.js +1 -1
  311. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  312. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  313. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
  314. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +5 -5
  315. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  316. package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
  317. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  318. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  319. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  320. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderParameters.js +1 -1
  321. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  322. package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
  323. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  324. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  325. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  326. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  327. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +5 -0
  328. package/views/3d/webgl-engine/shaders/HighlightApplyTechnique.js +5 -0
  329. package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +5 -0
  330. package/views/3d/webgl-engine/shaders/HighlightBlurTechnique.js +5 -0
  331. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +5 -0
  332. package/views/3d/webgl-engine/shaders/HighlightDownsampleTechnique.js +5 -0
  333. package/views/3d/webgl-engine/shaders/HighlightOptions.js +4 -0
  334. package/views/3d/webgl-engine/shaders/HighlightPassParameters.js +5 -0
  335. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  336. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  337. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  338. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  339. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +5 -7
  340. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +14 -14
  341. package/views/SceneView.js +1 -1
  342. package/views/draw/support/GraphicMover.js +1 -1
  343. package/views/input/InputHandler.js +1 -1
  344. package/views/input/InputManager.js +1 -1
  345. package/views/layers/ImageryTileLayerView.js +1 -1
  346. package/views/layers/MapImageLayerView.js +1 -1
  347. package/views/layers/TileLayerView.js +1 -1
  348. package/views/layers/support/popupUtils.js +1 -1
  349. package/views/support/DefaultsFromMap.js +1 -1
  350. package/views/support/Scheduler.js +1 -1
  351. package/views/support/screenshotUtils.js +1 -1
  352. package/views/ui/DefaultUI.js +1 -1
  353. package/views/webgl/ShaderTranspiler.js +1 -1
  354. package/webscene/Slide.js +1 -1
  355. package/webscene/spec-certification/spec.js +1 -1
  356. package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
  357. package/widgets/Attachments/support/attachmentUtils.js +1 -1
  358. package/widgets/Attachments.js +1 -1
  359. package/widgets/Attribution.js +1 -1
  360. package/widgets/BasemapLayerList.js +1 -1
  361. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  362. package/widgets/Bookmarks.js +1 -1
  363. package/widgets/BuildingExplorer/support/filterUtils.js +1 -1
  364. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  365. package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
  366. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  367. package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
  368. package/widgets/Directions/DirectionsViewModel.js +1 -1
  369. package/widgets/Directions.js +1 -1
  370. package/widgets/Editor/EditorViewModel.js +1 -1
  371. package/widgets/Editor/workflowUtils.js +1 -1
  372. package/widgets/Editor.js +1 -1
  373. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  374. package/widgets/Feature/FeatureMedia.js +1 -1
  375. package/widgets/Feature/support/featureUtils.js +1 -1
  376. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  377. package/widgets/FeatureForm/InputField.js +1 -1
  378. package/widgets/FeatureForm.js +1 -1
  379. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  380. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  381. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  382. package/widgets/FeatureTemplates.js +1 -1
  383. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  384. package/widgets/LayerList/ListItemPanel.js +1 -1
  385. package/widgets/LayerList.js +1 -1
  386. package/widgets/Legend/LegendViewModel.js +1 -1
  387. package/widgets/Legend/styles/Card.js +1 -1
  388. package/widgets/Legend/styles/Classic.js +1 -1
  389. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  390. package/widgets/Legend/support/colorRampUtils.js +1 -1
  391. package/widgets/Legend/support/relationshipRampUtils.js +1 -1
  392. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  393. package/widgets/Popup/PopupViewModel.js +1 -1
  394. package/widgets/Popup/actionUtils.js +1 -1
  395. package/widgets/Print/PrintViewModel.js +1 -1
  396. package/widgets/Print.js +1 -1
  397. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  398. package/widgets/Search/SearchViewModel.js +1 -1
  399. package/widgets/Search/support/layerSearchUtils.js +1 -1
  400. package/widgets/Slider.js +1 -1
  401. package/widgets/Swipe.js +1 -1
  402. package/widgets/TableList.js +1 -1
  403. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  404. package/widgets/TimeSlider.js +1 -1
  405. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  406. package/widgets/support/DatePicker.js +1 -1
  407. package/widgets/support/Popover.js +1 -1
  408. package/widgets/support/SnappingControls.js +1 -1
  409. package/widgets/support/TimePicker.js +1 -1
  410. package/widgets/support/timeWidgetUtils.js +1 -1
  411. package/assets/esri/core/workers/chunks/083a5d10f8e243641cb9.js +0 -1
  412. package/assets/esri/core/workers/chunks/0872812ce4d0ec8faf8f.js +0 -1
  413. package/assets/esri/core/workers/chunks/0bc26899780c33637746.js +0 -1
  414. package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
  415. package/assets/esri/core/workers/chunks/11a2f9708938eac98815.js +0 -1
  416. package/assets/esri/core/workers/chunks/11a45709b703be84caaf.js +0 -1
  417. package/assets/esri/core/workers/chunks/1c1294ff1ebbd8f774f7.js +0 -1
  418. package/assets/esri/core/workers/chunks/1c915cc9a9d5729b6f17.js +0 -1
  419. package/assets/esri/core/workers/chunks/31786756b3d44540f8c0.js +0 -1
  420. package/assets/esri/core/workers/chunks/36a6f34fe40785beff5d.js +0 -1
  421. package/assets/esri/core/workers/chunks/373c16f8b8093d001064.js +0 -1
  422. package/assets/esri/core/workers/chunks/382a331a592abb61267f.js +0 -1
  423. package/assets/esri/core/workers/chunks/3bf106fe34e3992032c4.js +0 -1
  424. package/assets/esri/core/workers/chunks/3dcec610f1c1497d87bc.js +0 -1
  425. package/assets/esri/core/workers/chunks/46495e726d8739260d44.js +0 -1
  426. package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
  427. package/assets/esri/core/workers/chunks/4b6719377a95ac10fa43.js +0 -1
  428. package/assets/esri/core/workers/chunks/4d2ef57ff3a5cfc1313f.js +0 -1
  429. package/assets/esri/core/workers/chunks/4fd2b8153d62592210a2.js +0 -1
  430. package/assets/esri/core/workers/chunks/56e6a1079269e2964b02.js +0 -1
  431. package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
  432. package/assets/esri/core/workers/chunks/604637e1c3937b376a0d.js +0 -1
  433. package/assets/esri/core/workers/chunks/60f83257e361f87fa6fd.js +0 -1
  434. package/assets/esri/core/workers/chunks/6d3f80be6fceb2c18b5d.js +0 -1
  435. package/assets/esri/core/workers/chunks/6f827a32646bab0a8777.js +0 -1
  436. package/assets/esri/core/workers/chunks/70bd2ab42e3801ef5974.js +0 -1
  437. package/assets/esri/core/workers/chunks/746222184b361b50d6ba.js +0 -1
  438. package/assets/esri/core/workers/chunks/7fb72b2d11e8d840f982.js +0 -1
  439. package/assets/esri/core/workers/chunks/85bb6a1a7704fcdcbec2.js +0 -1
  440. package/assets/esri/core/workers/chunks/8b4c76cebb100e6c06f8.js +0 -1
  441. package/assets/esri/core/workers/chunks/9586a6b320edb1922926.js +0 -1
  442. package/assets/esri/core/workers/chunks/99638697ffda9022ce92.js +0 -1
  443. package/assets/esri/core/workers/chunks/a9da1cb118ca62a9581d.js +0 -1
  444. package/assets/esri/core/workers/chunks/aaa41a5013eef713c032.js +0 -1
  445. package/assets/esri/core/workers/chunks/ac321f939dd488ff6ce4.js +0 -1
  446. package/assets/esri/core/workers/chunks/add6027a96398ecf69de.js +0 -1
  447. package/assets/esri/core/workers/chunks/b75206b46ba81606087c.js +0 -1
  448. package/assets/esri/core/workers/chunks/bf8456828e38a768eba3.js +0 -1
  449. package/assets/esri/core/workers/chunks/c0720d0d8adcba6738d4.js +0 -1
  450. package/assets/esri/core/workers/chunks/c5bb712d5cf8c05a4e13.js +0 -1
  451. package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.js +0 -1
  452. package/assets/esri/core/workers/chunks/d8b1f00075983d769985.js +0 -1
  453. package/chunks/Highlight.glsl.js +0 -88
  454. package/views/3d/webgl-engine/shaders/Highlight.glsl.js +0 -5
  455. package/views/3d/webgl-engine/shaders/HighlightTechnique.js +0 -5
  456. package/views/3d/webgl-engine/shaders/HighlightTechniqueConfiguration.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../../core/clock.js";import a from"../../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,isSome as r,isNone as l,removeMaybe as o}from"../../../../../core/maybe.js";import{watch as h,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../../../core/scheduling.js";import{createScreenPoint as c,screenPointObjectToArray as d,createScreenPointArray as _}from"../../../../../core/screenUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{d as P,u as w,m as g}from"../../../../../chunks/mat4.js";import{e as m,l as f,c as M,g as V,a as D,m as T,n as b,s as k}from"../../../../../chunks/vec3.js";import{a as E,c as S}from"../../../../../chunks/vec3f64.js";import{c as H,a as x,n as I,f as R}from"../../../../../chunks/boundedPlane.js";import{signedDistance as j,create as O,intersectRay as C,normal as z}from"../../../../../geometry/support/plane.js";import{create as G}from"../../../../../geometry/support/ray.js";import{sv3d as U,sm4d as L,sv2d as K}from"../../../../../geometry/support/vectorStacks.js";import{calculateInputRotationTransform as B}from"../../manipulatorUtils.js";import{PLANE_PREVIEW_OUTLINE_WIDTH as A,forceVerticalModifier as F,forceHorizontalModifier as N,PREVIEW_FADE_DURATION_SECONDS as q,POINTER_MOVE_TIMER_MS as Z,PLANE_OUTLINE_COLOR as J,PLANE_BACKGROUND_COLOR as Q,PREVIEW_FADE_DOT_THRESHOLD as W,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,createRotateManipulator as $,createResizeManipulator as tt,createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as yt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as Pt,getTiltRotateTexture as wt}from"./images/Factory.js";import{screenToRenderPlane as gt}from"../../editingTools/dragEventPipeline3D.js";import{fromScreen as mt}from"../../../support/geometryUtils/ray.js";import{newIntersector as ft}from"../../../webgl-engine/lib/Intersector.js";import{StoreResults as Mt}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as Vt}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as Dt}from"../../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as Tt}from"../../../../support/screenUtils.js";let bt=class extends Dt{constructor(t){super(t),this.clock=i,this._previewPlaneOpacity=1,this.analysisView=null,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this.disableEngineLayers=!1,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=H(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=c(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=ft(t.view.state.viewingMode),this._intersector.options.store=Mt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this.analysisViewData=this.analysisView,this.rotateHeadingImage=Pt(this.view.toolViewManager.textures),this.rotateTiltImage=wt(this.view.toolViewManager.textures);const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(r(this.analysisViewData.plane)&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(e=>{this._onShiftGrab(e),t(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=$(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=$(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=tt(this.view,e);return a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=A,this._handles.add(this.analysisViewData.watch("plane",(()=>this._updateManipulators()),!0));const e=h((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),p);this._handles.add([e,h((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this.rotateHeadingImage=s(this.rotateHeadingImage),this.rotateTiltImage=s(this.rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":r(this._creatingPointerId)?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisView.showGrid=r(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return r(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.analysis.visible=t,this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisView&&(this.analysisView.editable=this.editable)}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&r(e)&&"shift"===e.type){const i=Tt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Tt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&r(this.analysisViewData.plane)){const e=Tt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Tt(t),a=H();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(x(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=kt(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Tt(t)).then((t=>{if(t.results.length){const e=t.results[0],i=e&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===F||t.key===N)&&(this._activeKeyModifiers[t.key]=!0,r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==F&&t.key!==N||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);x(this.analysisViewData.plane,this._startPlane),this.inputState=kt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"shift"!==a.type)return;const s=r(this.analysisViewData.plane)?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=.001,a=Math.min((1-Math.abs(m(I(this.analysisViewData.plane),e.ray.direction)/f(e.ray.direction)))/i,1),s=-j(this._startPlane.plane,e.renderEnd),n=-j(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(l(this.analysisViewData.plane))return;const e=M(U.get(),this._startPlane.origin),i=M(U.get(),I(this._startPlane));V(i,i,-t.depth),D(i,i,e);const a=R(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,H());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,O()),i=this._calculatePickRay(t.screenPoint),a=S();C(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,O()),i=this._calculatePickRay(t.screenPoint),a=S();C(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?x(this.analysisViewData.plane,H()):null;e.next(gt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=z(t.rotatePlane),a=B(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(l(this.analysisViewData.plane))return;const e=P(L.get(),t.rotateAngle,t.rotateAxis),i=T(U.get(),this._startPlane.basis1,e),a=T(U.get(),this._startPlane.basis2,e),s=R(this.analysisViewData.plane.origin,i,a,H());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||l(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),a=U.get();C(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:E(a)})}_createResizeDragPipeline(t){return Vt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"resize"!==a.type||l(this.analysisViewData.plane))return;const s=x(this.analysisViewData.plane,H());e.next(gt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(l(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!r(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,l(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=r(i)?i:H();if(i=r(i)?x(i,St):null,this._pickPlane(t,!0,e,a)){const t=W;let e=!1;r(i)&&(e=m(i.plane,a.plane)<t||m(b(U.get(),i.basis1),b(U.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}r(this._previewPlane)&&l(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=u({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*q),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):l(this._previewPlane)&&r(this._frameTask)?this._removeFrameTask():r(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=o(this._frameTask)}_calculatePickRay(t){const e=G(),i=d(t,Ht);return mt(this.view.state.camera,i,e),b(e.direction,e.direction),e}_pickMinResult(t){const e=d(t,K.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=U.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(U.get()),l=this.view.state.camera;m(r,l.viewForward)>0&&V(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*X,p=V(U.get(),r,h);D(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[F]?ot.VERTICAL:i[N]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=o(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),Z)}_updateManipulators(){if(this.disableEngineLayers)return;let t=null,e=!1;if(r(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!r(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,L.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=k(U.get(),f(t.basis1),f(t.basis2),1),s=w(L.get(),a),n=g(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[J[0],J[1],J[2],J[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[Q[0],Q[1],Q[2],Q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane}}};function kt(t,e,i,a){const s=yt(i,I(a),t.direction,O()),n=S();return C(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}t([v()],bt.prototype,"clock",void 0),t([v({constructOnly:!0})],bt.prototype,"view",void 0),t([v({constructOnly:!0})],bt.prototype,"analysisView",void 0),t([v()],bt.prototype,"analysisViewData",void 0),t([v({readOnly:!0})],bt.prototype,"state",null),t([v({readOnly:!0})],bt.prototype,"cursor",null),t([v()],bt.prototype,"analysis",null),t([v({readOnly:!0})],bt.prototype,"layersMode",void 0),t([v({value:null})],bt.prototype,"inputState",null),t([v()],bt.prototype,"_isPlacingSlicePlane",null),t([v()],bt.prototype,"_creatingPointerId",null),bt=t([y("esri.views.3d.interactive.analysisTools.slice.SliceTool")],bt);const St=H(),Ht=_(),xt=bt;export{xt as default};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../../core/clock.js";import a from"../../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,isSome as r,isNone as l,removeMaybe as o}from"../../../../../core/maybe.js";import{watch as h,syncAndInitial as p}from"../../../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../../../core/scheduling.js";import{createScreenPoint as c,screenPointObjectToArray as d,createScreenPointArray as _}from"../../../../../core/screenUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{d as P,u as m,m as w}from"../../../../../chunks/mat4.js";import{e as g,l as f,c as M,g as T,a as V,m as D,n as b,s as k}from"../../../../../chunks/vec3.js";import{a as E,c as S}from"../../../../../chunks/vec3f64.js";import{c as H,a as x,n as I,f as R}from"../../../../../chunks/boundedPlane.js";import{signedDistance as j,create as O,intersectRay as C,normal as z}from"../../../../../geometry/support/plane.js";import{create as G}from"../../../../../geometry/support/ray.js";import{sv3d as U,sm4d as L,sv2d as K}from"../../../../../geometry/support/vectorStacks.js";import{calculateInputRotationTransform as B}from"../../manipulatorUtils.js";import{POINTER_MOVE_TIMER_MS as A,PLANE_PREVIEW_OUTLINE_WIDTH as F,forceVerticalModifier as N,forceHorizontalModifier as q,PREVIEW_FADE_DURATION_SECONDS as Z,PLANE_OUTLINE_COLOR as J,PLANE_BACKGROUND_COLOR as Q,PREVIEW_FADE_DOT_THRESHOLD as W,INITIAL_DEPTH_OFFSET_FRAC as X}from"./sliceToolConfig.js";import{createShiftManipulator as Y,createRotateManipulator as $,createResizeManipulator as tt,createGridVisualElement as et,createOutlineVisualElement as it,planeToShape as at,createRotatePlane as st,RotationAxis as nt,resizePlane as rt,calculatePlaneHalfSize as lt,SliceOrientation as ot,createPlane as ht,DidPointerMoveRecentlyFlag as pt,calculateBoundedPlaneTranslateRotate as ut,updateShiftRestartHandle as ct,updateRotateHeadingHandle as dt,updateRotateTiltHandle as _t,updateResizeHandle as vt,createShiftPlane as yt}from"./sliceToolUtils.js";import{getRotateHeadingTexture as Pt,getTiltRotateTexture as mt}from"./images/Factory.js";import{screenToRenderPlane as wt}from"../../editingTools/dragEventPipeline3D.js";import{fromScreen as gt}from"../../../support/geometryUtils/ray.js";import{newIntersector as ft}from"../../../webgl-engine/lib/Intersector.js";import{StoreResults as Mt}from"../../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as Tt}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as Vt}from"../../../../interactive/InteractiveToolBase.js";import{createScreenPointFromEvent as Dt}from"../../../../support/screenUtils.js";let bt=class extends Vt{constructor(t){super(t),this.clock=i,this._previewPlaneOpacity=1,this.analysisView=null,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this.disableEngineLayers=!1,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=A,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=H(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=c(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=ft(t.view.state.viewingMode),this._intersector.options.store=Mt.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");this.analysisViewData=this.analysisView,this.rotateHeadingImage=Pt(this.view.toolViewManager.textures),this.rotateTiltImage=mt(this.view.toolViewManager.textures);const t=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(r(this.analysisViewData.plane)&&x(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=Y(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(e=>{this._onShiftGrab(e),t(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=$(this.view,this.rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(e=>{this._onRotateHeadingGrab(e),t(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=$(this.view,this.rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(e=>{this._onRotateTiltGrab(e),t(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((e,i)=>{const a=tt(this.view,e);return a.events.on("grab-changed",(e=>{this._onResizeGrab(e,i),t(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=et(this.view),this._previewPlaneOutlineVisualElement=it(this.view),this._previewPlaneOutlineVisualElement.width=F,this._handles.add(this.analysisViewData.watch("plane",(()=>this._updateManipulators()),!0));const e=h((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),p);this._handles.add([e,h((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this.rotateHeadingImage=s(this.rotateHeadingImage),this.rotateTiltImage=s(this.rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":r(this._creatingPointerId)?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisView.showGrid=r(t)&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return r(this.inputState)&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){l(this.analysisViewData.plane)||(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this.analysis.visible=t,this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisView&&(this.analysisView.editable=this.editable)}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&r(e)&&"shift"===e.type){const i=Dt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Dt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&r(this.analysisViewData.plane)){const e=Dt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),x(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Dt(t),a=H();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(x(a,this._startPlane),this.analysis.shape=at(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=kt(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Dt(t)).then((t=>{if(t.results.length){const e=t.results[0],i=e&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===N||t.key===q)&&(this._activeKeyModifiers[t.key]=!0,r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==N&&t.key!==q||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],r(this._previewPlane)&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=this._calculatePickRay(t.screenPoint);x(this.analysisViewData.plane,this._startPlane),this.inputState=kt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"shift"!==a.type)return;const s=r(this.analysisViewData.plane)?x(this.analysisViewData.plane,H()):null;e.next(wt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=.001,a=Math.min((1-Math.abs(g(I(this.analysisViewData.plane),e.ray.direction)/f(e.ray.direction)))/i,1),s=-j(this._startPlane.plane,e.renderEnd),n=-j(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(l(this.analysisViewData.plane))return;const e=M(U.get(),this._startPlane.origin),i=M(U.get(),I(this._startPlane));T(i,i,-t.depth),V(i,i,e);const a=R(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,H());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.HEADING,O()),i=this._calculatePickRay(t.screenPoint),a=S();C(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?x(this.analysisViewData.plane,H()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||l(this.analysisViewData.plane))return;const e=st(this.analysisViewData.plane,this.view.renderCoordsHelper,nt.TILT,O()),i=this._calculatePickRay(t.screenPoint),a=S();C(e,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"rotate"!==a.type)return;const s=r(this.analysisViewData.plane)?x(this.analysisViewData.plane,H()):null;e.next(wt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{r(s)&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(l(this.analysisViewData.plane))return null;const i=z(t.rotatePlane),a=B(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(l(this.analysisViewData.plane))return;const e=P(L.get(),t.rotateAngle,t.rotateAxis),i=D(U.get(),this._startPlane.basis1,e),a=D(U.get(),this._startPlane.basis2,e),s=R(this.analysisViewData.plane.origin,i,a,H());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||l(this.analysisViewData.plane))return;const i=this._calculatePickRay(t.screenPoint),a=U.get();C(this.analysisViewData.plane.plane,i,a)&&(x(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:E(a)})}_createResizeDragPipeline(t){return Tt(t,((t,e,i)=>{const a=this.inputState;if(l(a)||"resize"!==a.type||l(this.analysisViewData.plane))return;const s=x(this.analysisViewData.plane,H());e.next(wt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(l(this.analysisViewData.plane))return;const i=this._resizeHandles[t.activeHandleIdx],a=rt(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,x(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(!r(e))throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,l(t))return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=r(i)?i:H();if(i=r(i)?x(i,St):null,this._pickPlane(t,!0,e,a)){const t=W;let e=!1;r(i)&&(e=g(i.plane,a.plane)<t||g(b(U.get(),i.basis1),b(U.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}r(this._previewPlane)&&l(this._frameTask)&&0===this._previewPlaneOpacity?this._frameTask=u({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*Z),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):l(this._previewPlane)&&r(this._frameTask)?this._removeFrameTask():r(this._previewPlane)&&this._updateManipulators()}_removeFrameTask(){this._frameTask=o(this._frameTask)}_calculatePickRay(t){const e=G(),i=d(t,Ht);return gt(this.view.state.camera,i,e),b(e.direction,e.direction),e}_pickMinResult(t){const e=d(t,K.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=U.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(U.get()),l=this.view.state.camera;g(r,l.viewForward)>0&&T(r,r,-1);const o=lt(n,l),h=(e?1:-1)*o*X,p=T(U.get(),r,h);V(p,p,n);const u=this.analysis.tiltEnabled?ot.TILTED:ot.HORIZONTAL_OR_VERTICAL,c=i[N]?ot.VERTICAL:i[q]?ot.HORIZONTAL:u;return ht(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=o(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=pt,this.rotateHeadingManipulator.state|=pt,this.rotateTiltManipulator.state|=pt,this._prevPointerMoveTimeout=this.clock.setTimeout((()=>{this.shiftManipulator.state&=~pt,this.rotateHeadingManipulator.state&=~pt,this.rotateTiltManipulator.state&=~pt}),this._pointerMoveTimerMs)}_updateManipulators(){if(this.disableEngineLayers)return;let t=null,e=!1;if(r(this.analysisViewData.plane))t=this.analysisViewData.plane,e=!1;else{if(!r(this._previewPlane))return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ut(t,L.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),ct(this.shiftManipulator,i,t,this.view.state.camera),dt(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),_t(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>vt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=k(U.get(),f(t.basis1),f(t.basis2),1),s=m(L.get(),a),n=w(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[J[0],J[1],J[2],J[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[Q[0],Q[1],Q[2],Q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function kt(t,e,i,a){const s=yt(i,I(a),t.direction,O()),n=S();return C(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}t([v()],bt.prototype,"clock",void 0),t([v({constructOnly:!0})],bt.prototype,"view",void 0),t([v({constructOnly:!0})],bt.prototype,"analysisView",void 0),t([v()],bt.prototype,"analysisViewData",void 0),t([v({readOnly:!0})],bt.prototype,"state",null),t([v({readOnly:!0})],bt.prototype,"cursor",null),t([v()],bt.prototype,"analysis",null),t([v({readOnly:!0})],bt.prototype,"layersMode",void 0),t([v({value:null})],bt.prototype,"inputState",null),t([v()],bt.prototype,"_isPlacingSlicePlane",null),t([v()],bt.prototype,"_creatingPointerId",null),bt=t([y("esri.views.3d.interactive.analysisTools.slice.SliceTool")],bt);const St=H(),Ht=_(),xt=bt;export{xt as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{applySome as s,isSome as l,isNone as o}from"../../../core/maybe.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as h,populateMissingFields as c}from"../../../layers/support/fieldUtils.js";import f from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as m}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as F}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{applyFilterMode as b}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as w}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as v}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as E}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as _}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as x}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as S,getIndexCrs as j}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as I}from"./support/DefinitionExpressionSceneLayerView.js";import Q from"../../layers/BuildingComponentSublayerView.js";import{getRequiredFields as q,getFetchPopupTemplate as R}from"../../layers/support/popupUtils.js";import{TaskPriority as L}from"../../support/Scheduler.js";const O=i.getLogger("esri.views.3d.layers.BuildingComponentSublayerView3D");let V=class extends(I(F(m(Q)))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.lodFactor=1,this.progressiveLoadFactor=1,this._queryEngine=null}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}initialize(){this.updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this.updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,s(this.viewFilter,(({parsedWhereClause:e,parsedGeometry:r,sortedObjectIds:t})=>[e,r,t]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=d.create(e,this.sublayer.fieldsIndex)}catch(l){return O.error("Failed to parse filterExpression: "+l),null}if(!t.isStandardized)return O.error("filterExpression is using non standard function"),null;const i=[],s=t.fieldNames;return S(s,this.sublayer.fields,{missingFields:i}),i.length>0?(O.error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[t,r]})).filter((e=>null!=e))}get filter(){return l(this.viewFilter)?this.viewFilter.filter:null}set filter(e){!o(e)&&v.checkSupport(e)?l(this.viewFilter)?this.viewFilter.filter=e:this.viewFilter=new v({filter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError)}):this.viewFilter=null}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return b(t,l)}catch(i){this.logError(i)}return b(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),[]))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...h(r,i),...t]}return y(r,t)}_createLayerGraphic(e){const t=new r(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)return Promise.reject(t);if(o(r)||!r.clientGraphics||0===r.clientGraphics.length)return[];const i=[],s=[],n=l(this.sublayer.associatedLayer)?await this.sublayer.associatedLayer.load():this.sublayer,a=h(this.sublayer.fieldsIndex,await q(n,R(this.sublayer,r))),u=new Set;for(const l of r.clientGraphics)c(a,l,u)?s.push(l):i.push(l);return 0===s.length?Promise.resolve(i):(l(this.sublayer.associatedLayer)&&await this.sublayer.associatedLayer.load().catch((()=>O.warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(s,Array.from(u)).catch((()=>s)).then((e=>i.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?R(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),l(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return l(this.filter)?this.filter.createQuery(e):new f(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),null==r?void 0:r.signal).then((e=>{if(null==e||!e.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),null==r?void 0:r.signal)}_ensureQueryEngine(){return o(this._queryEngine)&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=w(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new E({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new x({featureAdapter:new _({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e({id:r,index:t,meta:i})),r,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:j(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():f.from(e))}};e([a({aliasOf:"sublayer"})],V.prototype,"i3slayer",void 0),e([a()],V.prototype,"layerView",void 0),e([a()],V.prototype,"suspended",void 0),e([a({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.3dObject.lodFactor"})],V.prototype,"lodFactor",void 0),e([a({readOnly:!0})],V.prototype,"parsedFilterExpressions",null),e([a({type:p})],V.prototype,"filter",null),e([a()],V.prototype,"viewFilter",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"filterExpressionFields",null),e([a({type:[String],readOnly:!0})],V.prototype,"requiredFields",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"availableFields",null),V=e([u("esri.views.3d.layers.BuildingComponentSublayerView3D")],V);const A=V;export{A as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import t from"../../../core/Error.js";import i from"../../../core/Logger.js";import{applySome as s,isSome as l,isNone as o}from"../../../core/maybe.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import"../../../layers/buildingSublayers/BuildingComponentSublayer.js";import p from"../../../layers/support/FeatureFilter.js";import{fixFields as y,unpackFieldNames as h,populateMissingFields as c}from"../../../layers/support/fieldUtils.js";import f from"../../../rest/support/Query.js";import{BuildingSublayerView3DMixin as m}from"./BuildingSublayerView3D.js";import{I3SMeshView3D as F}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{applyFilterMode as b}from"./i3s/BuildingFilterUtil.js";import{createGetFeatureExtent as w}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as v}from"./i3s/I3SMeshViewFilter.js";import{I3SQueryEngine as E}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as _}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as x}from"./i3s/I3SQueryFeatureStore.js";import{findFieldsCaseInsensitive as S,getIndexCrs as j}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as I}from"./support/DefinitionExpressionSceneLayerView.js";import Q from"../../layers/BuildingComponentSublayerView.js";import{getRequiredFields as q,getFetchPopupTemplate as R}from"../../layers/support/popupUtils.js";import{TaskPriority as L}from"../../support/Scheduler.js";const O=i.getLogger("esri.views.3d.layers.BuildingComponentSublayerView3D");let V=class extends(I(F(m(Q)))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.lodFactor=1,this.progressiveLoadFactor=1,this._queryEngine=null}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}initialize(){this.updatingHandles.add((()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields]),(()=>this._updateRequiredFields())),this.updatingHandles.add((()=>this.sublayer.renderer),(e=>this._rendererChange(e)),n),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,s(this.viewFilter,(({parsedWhereClause:e,parsedGeometry:r,sortedObjectIds:t})=>[e,r,t]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>this.parsedFilterExpressions),(()=>this._updateSymbologyOverride()),n),this.addResolvingPromise(this._updateRequiredFields())}get parsedFilterExpressions(){return"Overview"===this.sublayer.modelName?[]:this.layerView.filterExpressions.map((([e,r])=>{let t;try{t=d.create(e,this.sublayer.fieldsIndex)}catch(l){return O.error("Failed to parse filterExpression: "+l),null}if(!t.isStandardized)return O.error("filterExpression is using non standard function"),null;const i=[],s=t.fieldNames;return S(s,this.sublayer.fields,{missingFields:i}),i.length>0?(O.error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[t,r]})).filter((e=>null!=e))}get filter(){return l(this.viewFilter)?this.viewFilter.filter:null}set filter(e){!o(e)&&v.checkSupport(e)?l(this.viewFilter)?this.viewFilter.filter=e:this.viewFilter=new v({filter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,r)=>this.addSqlFilter(e,r,this.logError)}):this.viewFilter=null}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride(((r,t)=>{for(const[s,l]of e)try{if(s.testFeature(r))return b(t,l)}catch(i){this.logError(i)}return b(t,null)}),this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return y(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce(((e,[r])=>e.concat(r.fieldNames)),[]))}get availableFields(){const e=this.sublayer,r=e.fieldsIndex;let t=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];t=[...h(r,i),...t]}return y(r,t)}_createLayerGraphic(e){const t=new r(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,r){const t=this._validateFetchPopupFeatures(r);if(t)throw t;if(o(r)||!r.clientGraphics||0===r.clientGraphics.length)return[];const i=[],s=[],n=l(this.sublayer.associatedLayer)?await this.sublayer.associatedLayer.load():this.sublayer,a=h(this.sublayer.fieldsIndex,await q(n,R(this.sublayer,r))),u=new Set;for(const l of r.clientGraphics)c(a,l,u)?s.push(l):i.push(l);return 0===s.length?i:(l(this.sublayer.associatedLayer)&&await this.sublayer.associatedLayer.load().catch((()=>O.warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes."))),this.whenGraphicAttributes(s,Array.from(u)).catch((()=>s)).then((e=>i.concat(e))))}async _updateRequiredFields(){const e=y(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:r}=this,{popupEnabled:i}=r;return i?R(r,e)?void 0:new t("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:r}):new t("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:r})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),l(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return l(this.filter)?this.filter.createQuery(e):new f(e)}queryExtent(e,r){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatureCount(e,r){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),null==r?void 0:r.signal)}queryFeatures(e,r){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),null==r?void 0:r.signal).then((e=>{if(null==e||!e.features)return e;const r=this.sublayer,t=r.layer;for(const i of e.features)i.layer=t,i.sourceLayer=r;return e}))}queryObjectIds(e,r){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),null==r?void 0:r.signal)}_ensureQueryEngine(){return o(this._queryEngine)&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=w(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new E({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new x({featureAdapter:new _({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(e,r)=>this._forAllFeatures(((r,t,i)=>e({id:r,index:t,meta:i})),r,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:j(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():f.from(e))}};e([a({aliasOf:"sublayer"})],V.prototype,"i3slayer",void 0),e([a()],V.prototype,"layerView",void 0),e([a()],V.prototype,"suspended",void 0),e([a({readOnly:!0,aliasOf:"view.qualitySettings.sceneService.3dObject.lodFactor"})],V.prototype,"lodFactor",void 0),e([a({readOnly:!0})],V.prototype,"parsedFilterExpressions",null),e([a({type:p})],V.prototype,"filter",null),e([a()],V.prototype,"viewFilter",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"filterExpressionFields",null),e([a({type:[String],readOnly:!0})],V.prototype,"requiredFields",void 0),e([a({type:[String],readOnly:!0})],V.prototype,"availableFields",null),V=e([u("esri.views.3d.layers.BuildingComponentSublayerView3D")],V);const A=V;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,get as s,isNone as i}from"../../../core/maybe.js";import{initial as o,whenOnce as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as u}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import c from"../../../rest/support/Query.js";import{DrapeSourceType as h}from"./interfaces.js";import d from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as y}from"./graphics/QueryEngine.js";import{HeatmapFeatureProcessor as m}from"./support/HeatmapFeatureProcessor.js";import{toViewIfLocal as g}from"./support/projectExtentUtils.js";import{UpdatePolicy as f}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as v}from"../../support/Scheduler.js";const E=E=>{let b=class extends E{constructor(){super(...arguments),this.controller=null,this.updatePolicy=f.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=h.Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),o),this.addResolvingPromise((async()=>{const e=await g(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e)),this.queryEngine=new y({layerView:this,priority:v.FEATURE_QUERY_ENGINE}),this.notifyChange("updating"))}destroy(){this._destroyPendingController(),this.controller=t(this.controller),this._set("processor",t(this.processor)),this.queryEngine=t(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=t(this.pendingController)}get legendEnabled(){var e;return this.canResume()&&(null==(e=this.processor)?void 0:e.legendEnabled)}get graphics3DProcessor(){var e;return"graphics-3d"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}get heatmapProcessor(){var e;return"heatmap"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}getGraphicFromGraphicUid(e){var r;let t=null;return null==(r=this.loadedGraphics)||r.forEach((r=>{r.uid===e&&(t=p(r,this.layer))})),t}whenGraphicBounds(e,r){var t;return null==(t=this.processor)?void 0:t.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}queryFeatures(e,r){return this.queryEngine.executeQuery(this._ensureQuery(e),s(r,"signal"))}queryObjectIds(e,r){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),s(r,"signal"))}queryFeatureCount(e,r){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),s(r,"signal"))}queryExtent(e,r){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),s(r,"signal"))}_ensureQuery(e){return i(e)?this.createQuery():c.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,r,t;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(r=this.view)&&null!=(t=r.basemapTerrain)&&t.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(r){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await n((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready})),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":return Promise.reject(new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType}))}}_recreateProcessor(e){var r,t;const s="heatmap"===(null==e?void 0:e.type),i="heatmap"===(null==(r=this.processor)?void 0:r.type),o=this.processor;if(o&&s===i)return;const n=s?new m({owner:this}):new d({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",n),null==o||o.destroy(),null==(t=this.queryEngine)||t.clear(),this.addResolvingPromise(n.setup())}_getResourceInfo(){var e,r;const t=this.controller instanceof u?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==t?void 0:t.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(r=null==t?void 0:t.serviceDataCount)?r:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([l()],b.prototype,"loadedGraphics",void 0),e([l()],b.prototype,"suspended",void 0),e([l({readOnly:!0})],b.prototype,"legendEnabled",null),e([l()],b.prototype,"updating",void 0),e([l()],b.prototype,"controller",void 0),e([l()],b.prototype,"processor",void 0),e([l({readOnly:!0})],b.prototype,"updatePolicy",void 0),e([l({readOnly:!0})],b.prototype,"suspendResumeExtentMode",void 0),e([l({type:Boolean})],b.prototype,"slicePlaneEnabled",void 0),e([l({readOnly:!0})],b.prototype,"suspendInfo",void 0),e([l()],b.prototype,"graphics3DProcessor",null),e([l()],b.prototype,"heatmapProcessor",null),b=e([a("esri.views.3d.layers.FeatureLikeLayerView3D")],b),b};export{E as FeatureLikeLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{destroyMaybe as t,get as s,isNone as i}from"../../../core/maybe.js";import{initial as o,whenOnce as n}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{hydrateGraphic as p}from"../../../layers/graphics/hydratedFeatures.js";import{FeatureTileController3D as u}from"../../../layers/graphics/controllers/FeatureTileController3D.js";import c from"../../../rest/support/Query.js";import{DrapeSourceType as h}from"./interfaces.js";import d from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as y}from"./graphics/QueryEngine.js";import{HeatmapFeatureProcessor as m}from"./support/HeatmapFeatureProcessor.js";import{toViewIfLocal as g}from"./support/projectExtentUtils.js";import{UpdatePolicy as f}from"../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as v}from"../../support/Scheduler.js";const E=E=>{let b=class extends E{constructor(){super(...arguments),this.controller=null,this.updatePolicy=f.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.drapeSourceType=h.Features,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.clippingExtent=null,this.supportsHeightUnitConversion=!0,this.pendingController=null,this.queryEngine=null}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new r("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.updatingHandles.add((()=>this.layer.renderer),(e=>this._recreateProcessor(e)),o),this.addResolvingPromise((async()=>{const e=await g(this);this.fullExtentInLocalViewSpatialReference=e,await this._initializeController()})()),this.updatingHandles.add((()=>this.updatePolicy),(e=>this.processor.preferredUpdatePolicy=e)),this.queryEngine=new y({layerView:this,priority:v.FEATURE_QUERY_ENGINE}),this.notifyChange("updating"))}destroy(){this._destroyPendingController(),this.controller=t(this.controller),this._set("processor",t(this.processor)),this.queryEngine=t(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this.pendingController=t(this.pendingController)}get legendEnabled(){var e;return this.canResume()&&(null==(e=this.processor)?void 0:e.legendEnabled)}get graphics3DProcessor(){var e;return"graphics-3d"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}get heatmapProcessor(){var e;return"heatmap"===(null==(e=this.processor)?void 0:e.type)?this.processor:null}getGraphicFromGraphicUid(e){var r;let t=null;return null==(r=this.loadedGraphics)||r.forEach((r=>{r.uid===e&&(t=p(r,this.layer))})),t}whenGraphicBounds(e,r){var t;return null==(t=this.processor)?void 0:t.whenGraphicBounds(e,r)}computeAttachmentOrigin(e,r){var t;return null==(t=this.processor)?void 0:t.computeAttachmentOrigin(e,r)}queryFeatures(e,r){return this.queryEngine.executeQuery(this._ensureQuery(e),s(r,"signal"))}queryObjectIds(e,r){return this.queryEngine.executeQueryForIds(this._ensureQuery(e),s(r,"signal"))}queryFeatureCount(e,r){return this.queryEngine.executeQueryForCount(this._ensureQuery(e),s(r,"signal"))}queryExtent(e,r){return this.queryEngine.executeQueryForExtent(this._ensureQuery(e),s(r,"signal"))}_ensureQuery(e){return i(e)?this.createQuery():c.from(e)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}maskOccludee(e){return this.processor.maskOccludee(e)}canResume(){var e;return super.canResume()&&!(null!=(e=this.processor)&&e.scaleVisibilitySuspended)}getSuspendInfo(){const e=super.getSuspendInfo();return this.processor?{...e,...this.processor.suspendInfo}:e}isUpdating(){var e,r,t;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&(null==(e=this.controller)||!e.updating)&&null!=(r=this.view)&&null!=(t=r.basemapTerrain)&&t.ready&&!this.processor.updating)}async _initializeController(){const e=this.createController();this.pendingController=e,await e.when(),this._setControllerWhenInitialized(e)}async _setControllerWhenInitialized(e){try{await this.when()}catch(r){}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await n((()=>{var e,r;return null==(e=this.view)||null==(r=e.basemapTerrain)?void 0:r.ready})),this.beforeSetController(e),this.pendingController=null,this.controller=e,this.loadedGraphics=e.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new r("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}_recreateProcessor(e){var r,t;const s="heatmap"===(null==e?void 0:e.type),i="heatmap"===(null==(r=this.processor)?void 0:r.type),o=this.processor;if(o&&s===i)return;const n=s?new m({owner:this}):new d({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentVisibilityEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this._set("processor",n),null==o||o.destroy(),null==(t=this.queryEngine)||t.clear(),this.addResolvingPromise(n.setup())}_getResourceInfo(){var e,r;const t=this.controller instanceof u?this.controller:null;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:null!=(e=null==t?void 0:t.maximumNumberOfFeatures)?e:-1,totalNumberOfFeatures:null!=(r=null==t?void 0:t.serviceDataCount)?r:-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return e([l()],b.prototype,"loadedGraphics",void 0),e([l()],b.prototype,"suspended",void 0),e([l({readOnly:!0})],b.prototype,"legendEnabled",null),e([l()],b.prototype,"updating",void 0),e([l()],b.prototype,"controller",void 0),e([l()],b.prototype,"processor",void 0),e([l({readOnly:!0})],b.prototype,"updatePolicy",void 0),e([l({readOnly:!0})],b.prototype,"suspendResumeExtentMode",void 0),e([l({type:Boolean})],b.prototype,"slicePlaneEnabled",void 0),e([l({readOnly:!0})],b.prototype,"suspendInfo",void 0),e([l()],b.prototype,"graphics3DProcessor",null),e([l()],b.prototype,"heatmapProcessor",null),b=e([a("esri.views.3d.layers.FeatureLikeLayerView3D")],b),b};export{E as FeatureLikeLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as m}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f,watch as y}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as I}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as v}from"../../../core/unitUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as j}from"../../../chunks/mat4.js";import{b as E,c as w}from"../../../chunks/mat4f64.js";import{m as N,c as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as P,localLinearScaleFactors as A,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as me}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as _e,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as ye}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as be,selectEncoding as Ie,defaultMaterial as ve,createTexture as Me,configureMaterial as Ce}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as xe,NodeState as Oe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Se,getLocalOrigin as je}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ee,checkSceneLayerValid as we,checkSceneLayerCompatibleWithView as Ne,getCacheKeySuffix as De,whenGraphicAttributes as Re,computeVisibilityObb as Te,filterInPlace as Fe,getCachedAttributeValue as Pe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Ve,addWraparound as Ue,getSymbolInfo as He,transparentEdgeMaterial as Ge,getClipRect as Le}from"./i3s/I3SUtil.js";import{IDBCache as Be}from"./i3s/IDBCache.js";import{attributeLookup as ke}from"./support/attributeUtils.js";import{ColorMixModeEnum as qe}from"./support/symbolColorUtils.js";import ze from"../support/debugFlags.js";import{toBoundingRect as Ke}from"../support/extentUtils.js";import{create as We,clone as $e}from"../support/orientedBoundingBox.js";import{updatingProgress as Xe}from"../support/updatingProperties.js";import{glLayout as Ye}from"../support/buffer/glUtil.js";import{State as Qe}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as Ze}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as et}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as tt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const it=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),st=[1,1,1,1];class rt extends ge{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ot;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ot||(ot={}));const at=19,nt=100*s.MEGABYTES,lt=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new Be("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new _e(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ee(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=v(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return be(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new me(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),we(this.i3slayer),Ne(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new ye({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([y((()=>ze.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&ze.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||ze.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))}),f),y((()=>ze.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),f)]),this._cacheKeySuffix=De(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>it.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=oe().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==xe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ze.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&et()}_getVertexBufferLayout(e,t){const i={hasTexture:pt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ye(Je(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=ke(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ke(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Re(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${at}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=bt(s.transformedGeometry,s.textureData),s.textureData.every(yt)&&It(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>it.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return ft(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Se(e.mbs,this.elevationOffset,l,d);e.geometryObb=We([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:bt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&It(e,m)){const t=h(m.textureData)?m.textureData.map((e=>yt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>it.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Te(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=je(o,a,n),u=Se(o,a,n,d),m=P(n,l),_=P(l,d);if(c(m)||c(_))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:m,vertexToRenderProjector:_};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=$e(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Qe.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(a.featureIds,r.attributeInfo,i);const d=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&d.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await et(),e.memory=0;const{componentOffsets:u,geometries:_,featureIds:g}=a,p=this._collection,f=_[0],{layout:y,indices:b,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,y),N=u||new Uint32Array([0,b?b.length:I.byteLength/y[0].stride]),D={vertices:{data:I,count:I.byteLength/y[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:N},T=f.transformation?E(f.transformation):w();S(T,l,T);const F=j(R(),T),P=x(O(),T),U=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,G=R(),L=[1,1,1];A(F,U,L,H)||it.errorOnce("Unsupported coordinate system for IM overlay"),V(F,U,G,H);const B=p.createObject({toMapSpace:[G[0],G[1],L[0],L[1]],geometry:D,obb:m(e.geometryObb),transform:{position:F,rotationScale:P}}),k=C.geometryParams.textureCoordinates===Ze.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(B,C.material,d,k);e.memory+=this._memEstimateGeometryAdded(B),e.memory+=q.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!C.material.hasParametersFromSource,W="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,$=new rt(e,g,B,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);r.meta=$,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(h(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(B,Qe.Visible),h(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){it.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ct(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:ve(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=pt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Me(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ce(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Ze.Atlas:Ze.Default:Ze.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=Ke(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=Ke(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Fe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Pe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,gt,this.view.renderSpatialReference),Ae(t,gt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,dt),B(dt,ht),q(i,ht)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ve.INSIDE)return;if(r===Ve.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ct,i,t.objectHandle);Fe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Ct(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Qe.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Oe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ue(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ue(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ue(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:it.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&it.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<ot.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<ot.CastShadows),i.pickable=0!=(t[s+4]&1<<ot.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=He(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:mt,castShadows:!0,pickable:!0,colorMixMode:qe.Multiply,edgeMaterial:null},u=this.fullOpacity,m=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let _=null,g=tt.OPAQUE,p=Ge,f=0;for(let y=0;y<e.featureIds.length;y++){if(null!=o&&(i[o]=e.featureIds[y]),a)for(let e=0;e<n.length;e++)i[n[e]]=Pe(l[e],y);const r=this._getSymbolInfo(s,t);let u=null,b=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=mt,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(b=e.a))}this._opacityVariable&&(b=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(b)?de(u,b,e.color,e.alpha,st,mt):de(u,b,null,null,st,mt)}if(c(u)&&(u=mt,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?tt.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===qe.Replace)?tt.OPAQUE:tt.TRANSPARENT;d.edgeMaterial===_&&t===g||(p={...d.edgeMaterial,opacity:m,objectTransparency:t},_=d.edgeMaterial,g=t),e.cachedEdgeMaterials[y]=p}else e.cachedEdgeMaterials[y]=Ge;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<ot.CastShadows|+d.pickable<<ot.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Ct(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ge)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ge:(s=s||t!==Ge,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Ct(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ve.OUTSIDE)return re.CONTINUE;if(i===Ve.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Le(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Pe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>ke(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Mt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),re.CONTINUE)),null,se.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(c(this._edgeView)||!e.cachedEdgeMaterials)return;Ct(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=vt(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==xe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M(Xe)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},dt=H(),ht=k(),ct=k(),ut=We(),mt=[0,0,0,0],_t=new t([0,0,0,0]),gt=[0,0,0,0];function pt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function ft(e){return"geometryData"in e}function yt(e){return h(e)&&I(e.data)}function bt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&I(s.data)&&(i+=s.data.byteLength);return i}function It(e,t){return t.byteSize>nt?(it.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function vt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=ut,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Mt={remove(){},pause(){},resume(){}};function Ct(e,t){e.forEach((e=>e.opacity=t))}export{lt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as m}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f,watch as b}from"../../../core/reactiveUtils.js";import{schedule as y}from"../../../core/scheduling.js";import{isArrayBuffer as I}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as v}from"../../../core/unitUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as j}from"../../../chunks/mat4.js";import{b as E,c as w}from"../../../chunks/mat4f64.js";import{m as N,c as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as P,localLinearScaleFactors as A,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as me}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as _e,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,defaultMaterial as ve,createTexture as Me,configureMaterial as Ce}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as xe,NodeState as Oe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Se,getLocalOrigin as je}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ee,checkSceneLayerValid as we,checkSceneLayerCompatibleWithView as Ne,getCacheKeySuffix as De,whenGraphicAttributes as Re,computeVisibilityObb as Te,filterInPlace as Fe,getCachedAttributeValue as Pe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Ve,addWraparound as Ue,getSymbolInfo as He,transparentEdgeMaterial as Ge,getClipRect as Le}from"./i3s/I3SUtil.js";import{IDBCache as Be}from"./i3s/IDBCache.js";import{IDBMockCache as ke}from"./i3s/IDBMockCache.js";import{attributeLookup as qe}from"./support/attributeUtils.js";import{ColorMixModeEnum as ze}from"./support/symbolColorUtils.js";import Ke from"../support/debugFlags.js";import{toBoundingRect as We}from"../support/extentUtils.js";import{create as $e,clone as Xe}from"../support/orientedBoundingBox.js";import{updatingProgress as Ye}from"../support/updatingProperties.js";import{glLayout as Qe}from"../support/buffer/glUtil.js";import{State as Je}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Ze}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as et}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as tt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as it}from"../webgl-engine/lib/edgeRendering/interfaces.js";const st=a.getLogger("esri.views.3d.layers.SceneLayerView3D"),rt=[1,1,1,1];class ot extends ge{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var at;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(at||(at={}));const nt=19,lt=100*s.MEGABYTES,dt=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=o("enable-feature:idb-mock-cache")?new ke:new Be("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new _e(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ee(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=v(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new me(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),we(this.i3slayer),Ne(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([b((()=>Ke.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Ke.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Ke.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))}),f),b((()=>Ke.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),f)]),this._cacheKeySuffix=De(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>st.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=oe().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==xe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Ke.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&tt()}_getVertexBufferLayout(e,t){const i={hasTexture:ft(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Qe(Ze(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=qe(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=qe(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Re(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${nt}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=It(s.transformedGeometry,s.textureData),s.textureData.every(yt)&&vt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>st.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return bt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Se(e.mbs,this.elevationOffset,l,d);e.geometryObb=$e([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:It(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&vt(e,m)){const t=h(m.textureData)?m.textureData.map((e=>yt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>st.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Te(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=je(o,a,n),u=Se(o,a,n,d),m=P(n,l),_=P(l,d);if(c(m)||c(_))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:m,vertexToRenderProjector:_};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=Xe(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Je.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(a.featureIds,r.attributeInfo,i);const d=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&d.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await tt(),e.memory=0;const{componentOffsets:u,geometries:_,featureIds:g}=a,p=this._collection,f=_[0],{layout:b,indices:y,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,b),N=u||new Uint32Array([0,y?y.length:I.byteLength/b[0].stride]),D={vertices:{data:I,count:I.byteLength/b[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:y,componentOffsets:N},T=f.transformation?E(f.transformation):w();S(T,l,T);const F=j(R(),T),P=x(O(),T),U=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,G=R(),L=[1,1,1];A(F,U,L,H)||st.errorOnce("Unsupported coordinate system for IM overlay"),V(F,U,G,H);const B=p.createObject({toMapSpace:[G[0],G[1],L[0],L[1]],geometry:D,obb:m(e.geometryObb),transform:{position:F,rotationScale:P}}),k=C.geometryParams.textureCoordinates===et.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(B,C.material,d,k);e.memory+=this._memEstimateGeometryAdded(B),e.memory+=q.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!C.material.hasParametersFromSource,W="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,$=new ot(e,g,B,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);r.meta=$,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(h(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(B,Je.Visible),h(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){st.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&xt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:ve(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=ft(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Me(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ce(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?et.Atlas:et.Default:et.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=We(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=We(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Fe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Pe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,pt,this.view.renderSpatialReference),Ae(t,pt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,ht),B(ht,ct),q(i,ct)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ve.INSIDE)return;if(r===Ve.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ut,i,t.objectHandle);Fe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){xt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Je.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Oe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ue(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ue(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ue(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:st.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&st.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<at.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<at.CastShadows),i.pickable=0!=(t[s+4]&1<<at.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=He(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:_t,castShadows:!0,pickable:!0,colorMixMode:ze.Multiply,edgeMaterial:null},u=this.fullOpacity,m=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let _=null,g=it.OPAQUE,p=Ge,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Pe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:gt,arcade:this._arcade});e&&(u=_t,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,rt,_t):de(u,y,null,null,rt,_t)}if(c(u)&&(u=_t,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:ze.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?it.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===ze.Replace)?it.OPAQUE:it.TRANSPARENT;d.edgeMaterial===_&&t===g||(p={...d.edgeMaterial,opacity:m,objectTransparency:t},_=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Ge;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<at.CastShadows|+d.pickable<<at.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||xt(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ge)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ge:(s=s||t!==Ge,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),xt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ve.OUTSIDE)return re.CONTINUE;if(i===Ve.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Le(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Pe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>qe(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Ct}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=y((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),re.CONTINUE)),null,se.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(c(this._edgeView)||!e.cachedEdgeMaterials)return;xt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=Mt(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==xe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M(Ye)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("esri.views.3d.layers.I3SMeshView3D")],s),s},ht=H(),ct=k(),ut=k(),mt=$e(),_t=[0,0,0,0],gt=new t([0,0,0,0]),pt=[0,0,0,0];function ft(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function bt(e){return"geometryData"in e}function yt(e){return h(e)&&I(e.data)}function It(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&I(s.data)&&(i+=s.data.byteLength);return i}function vt(e,t){return t.byteSize>lt?(st.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Mt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=mt,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Ct={remove(){},pause(){},resume(){}};function xt(e,t){e.forEach((e=>e.opacity=t))}export{dt as I3SMeshView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as t}from"../../../core/maybe.js";import{debounce as a}from"../../../core/promiseUtils.js";import{when as i}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/set.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./DynamicLayerView3D.js";import o from"../../layers/ImageryLayerView.js";let n=class extends(o(s)){constructor(){super(...arguments),this.type="imagery-3d",this.redrawDebounced=a((async e=>{this.redraw(((e,t)=>this._redrawImage(e,t)),e)}),2e3)}initialize(){this.handles.add([i((()=>this.view.basemapTerrain.ready),(()=>this._initializeMaximumDataResolution()),{once:!0,initial:!0}),this.layer.on("redraw",(()=>this.updatingHandles.addPromise(this.redrawDebounced())))]),this.updatingHandles.add((()=>{var e,t;return null==(e=this.layer)||null==(t=e.exportImageServiceParameters)?void 0:t.version}),(()=>{this.updatingHandles.addPromise(this.refreshDebounced())})),this.updatingHandles.add((()=>this.timeExtent),(()=>this.updatingHandles.addPromise(this.refreshDebounced())))}_initializeMaximumDataResolution(){const e=this.view.basemapTerrain.spatialReference,t=this.layer.fullExtent;!t||e.equals(t.spatialReference),this.maximumDataResolution={x:this.layer.pixelSizeX,y:this.layer.pixelSizeY}}getFetchOptions(){return{timeExtent:this.timeExtent}}async processResult(e,t,a){t.imageElement?e.image=t.imageElement:(e.image=document.createElement("canvas"),e.pixelData=t.pixelData,await this._redrawImage(e,a))}async _redrawImage(e,a){if(!(e.image instanceof HTMLCanvasElement)||t(e.pixelData))return Promise.reject();const i=e.image,r=i.getContext("2d"),s=await this.layer.applyRenderer(e.pixelData,{signal:a}),o=this.layer.applyFilter(s).pixelBlock;if(t(o))return Promise.reject();i.width=o.width,i.height=o.height;const n=r.createImageData(o.width,o.height);n.data.set(o.getAsRGBA()),r.putImageData(n,0,0)}};n=e([r("esri.views.3d.layers.ImageryLayerView3D")],n);const m=n;export{m as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as t}from"../../../core/maybe.js";import{debounce as a}from"../../../core/promiseUtils.js";import{when as i}from"../../../core/reactiveUtils.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/set.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import s from"./DynamicLayerView3D.js";import o from"../../layers/ImageryLayerView.js";let n=class extends(o(s)){constructor(){super(...arguments),this.type="imagery-3d",this.redrawDebounced=a((async e=>{this.redraw(((e,t)=>this._redrawImage(e,t)),e)}),2e3)}initialize(){this.handles.add([i((()=>this.view.basemapTerrain.ready),(()=>this._initializeMaximumDataResolution()),{once:!0,initial:!0}),this.layer.on("redraw",(()=>this.updatingHandles.addPromise(this.redrawDebounced())))]),this.updatingHandles.add((()=>{var e,t;return null==(e=this.layer)||null==(t=e.exportImageServiceParameters)?void 0:t.version}),(()=>{this.updatingHandles.addPromise(this.refreshDebounced())})),this.updatingHandles.add((()=>this.timeExtent),(()=>this.updatingHandles.addPromise(this.refreshDebounced())))}_initializeMaximumDataResolution(){const e=this.view.basemapTerrain.spatialReference,t=this.layer.fullExtent;!t||e.equals(t.spatialReference),this.maximumDataResolution={x:this.layer.pixelSizeX,y:this.layer.pixelSizeY}}getFetchOptions(){return{timeExtent:this.timeExtent}}async processResult(e,t,a){t.imageElement?e.image=t.imageElement:(e.image=document.createElement("canvas"),e.pixelData=t.pixelData,await this._redrawImage(e,a))}async _redrawImage(e,a){if(!(e.image instanceof HTMLCanvasElement)||t(e.pixelData))throw new Error;const i=e.image,r=i.getContext("2d"),s=await this.layer.applyRenderer(e.pixelData,{signal:a}),o=this.layer.applyFilter(s).pixelBlock;if(t(o))throw new Error;i.width=o.width,i.height=o.height;const n=r.createImageData(o.width,o.height);n.data.set(o.getAsRGBA()),r.putImageData(n,0,0)}};n=e([r("esri.views.3d.layers.ImageryLayerView3D")],n);const m=n;export{m as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{mayHaveHeightModelInfo as a,rejectLayerError as l}from"../../../geometry/support/heightModelInfoUtils.js";const n=n=>{let c=class extends n{constructor(){super(...arguments),this.slicePlaneEnabled=!1,this.supportsHeightUnitConversion=!1}postscript(e){super.postscript(e),a(this.layer)&&this.addResolvingPromise(this._validateHeightModelInfo())}async _validateHeightModelInfo(){const e=new AbortController,o=e.signal;this.handles.add(s((()=>e.abort()))),await r((()=>{var e;return null==(e=this.view.defaultsFromMap)?void 0:e.heightModelInfoReady}),o),t(o);const i=l(this.layer,this.view.heightModelInfo,this.supportsHeightUnitConversion);if(i)throw i}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return super.canResume()&&(!e||!e.minScale||!e.maxScale||e.minScale>=e.maxScale)}getSuspendInfo(){const e=super.getSuspendInfo(),s=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return s&&s.minScale&&s.maxScale&&s.minScale<s.maxScale&&(e.outsideScaleRange=!0),e}};return e([o()],c.prototype,"view",void 0),e([o()],c.prototype,"slicePlaneEnabled",void 0),c=e([i("esri.views.3d.layers.LayerView3D")],c),c};export{n as LayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import{whenOnce as r}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{supportsHeightModelInfo as a,rejectLayerError as l}from"../../../geometry/support/heightModelInfoUtils.js";const n=n=>{let c=class extends n{constructor(){super(...arguments),this.slicePlaneEnabled=!1,this.supportsHeightUnitConversion=!1}postscript(e){super.postscript(e),a(this.layer)&&this.addResolvingPromise(this._validateHeightModelInfo())}async _validateHeightModelInfo(){const e=new AbortController,o=e.signal;this.handles.add(s((()=>e.abort()))),await r((()=>{var e;return null==(e=this.view.defaultsFromMap)?void 0:e.heightModelInfoReady}),o),t(o);const i=l(this.layer,this.view.heightModelInfo,this.supportsHeightUnitConversion);if(i)throw i}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return super.canResume()&&(!e||!e.minScale||!e.maxScale||e.minScale>=e.maxScale)}getSuspendInfo(){const e=super.getSuspendInfo(),s=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return s&&s.minScale&&s.maxScale&&s.minScale<s.maxScale&&(e.outsideScaleRange=!0),e}};return e([o()],c.prototype,"view",void 0),e([o()],c.prototype,"slicePlaneEnabled",void 0),c=e([i("esri.views.3d.layers.LayerView3D")],c),c};export{n as LayerView3D};