@arcgis/core 5.2.0-next.47 → 5.2.0-next.48

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 (187) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +1 -0
  3. package/assets/esri/core/workers/chunks/{2a4868acd546312aa6d8.js → 05f6887805d92da03122.js} +1 -1
  4. package/assets/esri/core/workers/chunks/069b6d8bdb34ee88d437.js +1 -0
  5. package/assets/esri/core/workers/chunks/{68f7eaa3122de7c00adb.js → 0ea374f7b16745b9bbc7.js} +1 -1
  6. package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +1 -0
  7. package/assets/esri/core/workers/chunks/1843a762f7051f61af43.js +1 -0
  8. package/assets/esri/core/workers/chunks/20c363a113dc068de9e0.js +1 -0
  9. package/assets/esri/core/workers/chunks/{f2c8122d31aedc2604ee.js → 24d936d459c538187af6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{4d4710d57c72ec75cccc.js → 26f1fd3f2be5102aae1d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/285a5bd708f0fe1c620c.js +1 -0
  12. package/assets/esri/core/workers/chunks/2e121eac97ae72a8b49a.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7777a79f26a06a6c5240.js → 304a22c580ce103480cb.js} +1 -1
  14. package/assets/esri/core/workers/chunks/327899182a4dace428eb.js +1 -0
  15. package/assets/esri/core/workers/chunks/32ca15d928d51b380068.js +1 -0
  16. package/assets/esri/core/workers/chunks/{383392c63202ac044b6c.js → 33bd9785bd0b6ccef21b.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{0f19bc532be24ca64755.js → 36fe6adf6517d8f80125.js} +1 -1
  18. package/assets/esri/core/workers/chunks/3e1a7e4c674057807e3a.js +1 -0
  19. package/assets/esri/core/workers/chunks/{d36f17d32c654b1ac7fa.js → 3f1a7f8a9ead64bf0b7b.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{cc637aec16918052548e.js → 47af3525396f890f2a6b.js} +1 -1
  21. package/assets/esri/core/workers/chunks/4d9433f127aef76f3449.js +1 -0
  22. package/assets/esri/core/workers/chunks/4e2baa60c5d5197b2271.js +1 -0
  23. package/assets/esri/core/workers/chunks/4ee900e5dbb130fa0c7b.js +1 -0
  24. package/assets/esri/core/workers/chunks/519c0b51b1ba42fb71d7.js +1 -0
  25. package/assets/esri/core/workers/chunks/{c4b13124a9cfc78c42a6.js → 57fa3c0e7892c2eef3ee.js} +1 -1
  26. package/assets/esri/core/workers/chunks/68b615bbd27fadcfcb66.js +1 -0
  27. package/assets/esri/core/workers/chunks/68d898037feb0aee3138.js +1 -0
  28. package/assets/esri/core/workers/chunks/69b9a327f23e052fced7.js +1 -0
  29. package/assets/esri/core/workers/chunks/69d740ab18510156f5d6.js +1 -0
  30. package/assets/esri/core/workers/chunks/6c2b5087a9df65267f4e.js +1 -0
  31. package/assets/esri/core/workers/chunks/6fbcf1b85461c6c6c127.js +1 -0
  32. package/assets/esri/core/workers/chunks/7659391f952d134164cf.js +1 -0
  33. package/assets/esri/core/workers/chunks/7759a489205a874e13bb.js +1 -0
  34. package/assets/esri/core/workers/chunks/78918035144c3c76df71.js +1 -0
  35. package/assets/esri/core/workers/chunks/{2b669473aa2c7cfb63c7.js → 7b0ed52363704cfce129.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{98f575c038da74ced2a6.js → 7d0ff52748fd4eb0334d.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{8f9fb4e8a7d73db41664.js → 851bcc75acac4a2f199b.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{6010b7be978698a642d0.js → 8977c85aecc7e08ab13c.js} +1 -1
  39. package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +1 -0
  40. package/assets/esri/core/workers/chunks/{f2adf1227a795604d3b8.js → 90ae80b797642bff0efa.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{dee4019338a79c1ecd26.js → 9d0a9d465ec3a8ba1ed2.js} +1 -1
  42. package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +1 -0
  43. package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +1 -0
  44. package/assets/esri/core/workers/chunks/{728ea88e7d4733230e1f.js → b30237361d87cf982e41.js} +23 -24
  45. package/assets/esri/core/workers/chunks/{ee58f4bbc0a1f7d03df0.js → b32ede7805c7c6644e4c.js} +1 -1
  46. package/assets/esri/core/workers/chunks/b5d23efa584c74955d5b.js +1 -0
  47. package/assets/esri/core/workers/chunks/b83f2bbd634f57a5e8f9.js +1 -0
  48. package/assets/esri/core/workers/chunks/b8bdacebd4d24ba90f3f.js +1 -0
  49. package/assets/esri/core/workers/chunks/bab71e1b8b93d09d4809.js +1 -0
  50. package/assets/esri/core/workers/chunks/bb8e9b8343b83dd1ba3c.js +1 -0
  51. package/assets/esri/core/workers/chunks/bd8b180c61a80e60568c.js +1 -0
  52. package/assets/esri/core/workers/chunks/be6caade351e89f84251.js +680 -0
  53. package/assets/esri/core/workers/chunks/{8026cc0065f6520c4161.js → bef1990159c0e49e7d27.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{b3cd17daf5a297b96705.js → c3766d98f0a70897647f.js} +1 -1
  55. package/assets/esri/core/workers/chunks/cd1f1a72483b7c80bd9a.js +1 -0
  56. package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js → cdb331b58e22f8c1c988.js} +2 -2
  57. package/assets/esri/core/workers/chunks/{b23d1e10fc4161d1f3eb.js → d021775cf747556660a5.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d49e42f36bc3dc256b9f.js +1 -0
  59. package/assets/esri/core/workers/chunks/{7c2784ebbe17d79f669c.js → de50a19944617cd426b8.js} +1 -1
  60. package/assets/esri/core/workers/chunks/e232459f0b00110e07ac.js +1 -0
  61. package/assets/esri/core/workers/chunks/e7e3ea7af928b49b226c.js +1 -0
  62. package/assets/esri/core/workers/chunks/ee6bb6cd16f99421c76b.js +1 -0
  63. package/assets/esri/core/workers/chunks/fd2ba6f76645ba503cbb.js +1 -0
  64. package/assets/esri/core/workers/chunks/{85cd0cd721b27c497b18.js → fed6c75485601cd3afa1.js} +1 -1
  65. package/assets/esri/core/workers/chunks/ff2c4f648f77850922d5.js +1 -0
  66. package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
  67. package/assets/esri/libs/basisu/basis_transcoder.wasm +0 -0
  68. package/chunks/DefaultMaterial.glsl.js +1 -1
  69. package/chunks/basis_encoder.js +1 -1
  70. package/chunks/basis_transcoder.js +1 -1
  71. package/config.js +1 -1
  72. package/core/has.js +1 -1
  73. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  74. package/core/promiseUtils.js +1 -1
  75. package/core/workers/workerFactory.js +1 -1
  76. package/geometry/Mesh.d.ts +4 -4
  77. package/geometry/support/MeshMaterialMetallicRoughness.d.ts +13 -1
  78. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  79. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  80. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  81. package/geometry/support/meshUtils.d.ts +33 -5
  82. package/geometry/support/plane.js +1 -1
  83. package/kernel.js +1 -1
  84. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  85. package/layers/raster/formats/JpgPlus.js +1 -1
  86. package/layers/raster/formats/RasterCodec.js +1 -1
  87. package/layers/raster/formats/TiffDecoder.js +1 -1
  88. package/layers/raster/formats/Zlib.js +2 -0
  89. package/package.json +2 -2
  90. package/rest/featureService/FeatureService.d.ts +74 -1
  91. package/rest/featureService/FeatureService.js +1 -1
  92. package/support/revision.js +1 -1
  93. package/symbols/ObjectSymbol3DLayer.d.ts +10 -8
  94. package/symbols/support/ObjectSymbol3DLayerResource.d.ts +9 -4
  95. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +1 -1
  96. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  97. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  98. package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
  99. package/views/2d/layers/features/Processor.js +1 -1
  100. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  101. package/views/2d/layers/features/processor/AggregateStrategy.js +2 -0
  102. package/views/2d/layers/features/processor/bins/BinAdapter.js +2 -0
  103. package/views/2d/layers/features/processor/bins/BinLevelState.js +2 -0
  104. package/views/2d/layers/features/processor/bins/BinState.js +2 -0
  105. package/views/2d/layers/features/processor/bins/createBinningStrategy.js +2 -0
  106. package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +2 -0
  107. package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +2 -0
  108. package/views/2d/layers/features/processor/clusters/ClusterSendState.js +2 -0
  109. package/views/2d/layers/features/processor/clusters/createClusterStrategy.js +2 -0
  110. package/views/2d/layers/features/processor/createAggregateStrategy.js +2 -0
  111. package/views/2d/layers/features/processor/tracks/Track.js +2 -0
  112. package/views/2d/layers/features/processor/tracks/TrackAdapter.js +2 -0
  113. package/views/2d/layers/features/processor/tracks/TrackLevelState.js +2 -0
  114. package/views/2d/layers/features/processor/tracks/TrackSendState.js +2 -0
  115. package/views/2d/layers/features/processor/tracks/createTrackStrategy.js +2 -0
  116. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  117. package/views/3d/glTF/LoaderResult.js +1 -1
  118. package/views/3d/glTF/internal/Resource.js +1 -1
  119. package/views/3d/glTF/loader.js +1 -1
  120. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  121. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  122. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  123. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  124. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  125. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +19 -20
  126. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  127. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  128. package/views/3d/webgl-engine/lib/NavigationDepthCacheStore.js +2 -0
  129. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  130. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  131. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  132. package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
  133. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  134. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  135. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  136. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  137. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  138. package/views/PopupView.js +1 -1
  139. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  140. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  141. package/views/support/AnalysisViewManager.js +1 -1
  142. package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +0 -1
  143. package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +0 -1
  144. package/assets/esri/core/workers/chunks/08e18fb12533fc76e49c.js +0 -1
  145. package/assets/esri/core/workers/chunks/176c5eaaa23a479c88e0.js +0 -1
  146. package/assets/esri/core/workers/chunks/1f118d85d8271ad7690b.js +0 -1
  147. package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +0 -1
  148. package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +0 -1
  149. package/assets/esri/core/workers/chunks/354199a41de44902de84.js +0 -1
  150. package/assets/esri/core/workers/chunks/384b619854ef8a3f6e94.js +0 -1
  151. package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +0 -1
  152. package/assets/esri/core/workers/chunks/46d3ddf62fa7a76dd57d.js +0 -1
  153. package/assets/esri/core/workers/chunks/4b24f72b56edc28bb15e.js +0 -1
  154. package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +0 -1
  155. package/assets/esri/core/workers/chunks/57374213084bef59b776.js +0 -1
  156. package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +0 -1
  157. package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +0 -1
  158. package/assets/esri/core/workers/chunks/7cc729b57a6a52c8ac68.js +0 -1
  159. package/assets/esri/core/workers/chunks/804ab5f614efa12a131b.js +0 -1
  160. package/assets/esri/core/workers/chunks/81d55594cee124040565.js +0 -1
  161. package/assets/esri/core/workers/chunks/8d90bef1091204fba0f1.js +0 -1
  162. package/assets/esri/core/workers/chunks/8ec5e470583b75fceae1.js +0 -1
  163. package/assets/esri/core/workers/chunks/9114a575b78a7ea18d0f.js +0 -1
  164. package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +0 -1
  165. package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +0 -1
  166. package/assets/esri/core/workers/chunks/a9c641bcdef161c754bf.js +0 -1
  167. package/assets/esri/core/workers/chunks/ad5c2b0de6713d0a93a4.js +0 -680
  168. package/assets/esri/core/workers/chunks/ae50b2d5e63f62c088d2.js +0 -1
  169. package/assets/esri/core/workers/chunks/aea247138617e12b699b.js +0 -1
  170. package/assets/esri/core/workers/chunks/b03dcf3d55266745f3d1.js +0 -1
  171. package/assets/esri/core/workers/chunks/c01a121ebe571a848452.js +0 -1
  172. package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +0 -1
  173. package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +0 -1
  174. package/assets/esri/core/workers/chunks/d8b67ca02cdc1e8191e3.js +0 -1
  175. package/assets/esri/core/workers/chunks/dadefe369f49e89a2610.js +0 -1
  176. package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +0 -1
  177. package/assets/esri/core/workers/chunks/dfbdc72c7ea137e3841d.js +0 -1
  178. package/assets/esri/core/workers/chunks/e3e966777f18164afcd8.js +0 -1
  179. package/assets/esri/core/workers/chunks/e9c48630757bea465b7e.js +0 -1
  180. package/assets/esri/core/workers/chunks/f8f0de841be17cd05c8f.js +0 -1
  181. package/assets/esri/core/workers/chunks/ff089723a27859fe18d1.js +0 -1
  182. package/chunks/Zlib.js +0 -2
  183. package/views/2d/layers/features/processor/AAggregateStrategy.js +0 -2
  184. package/views/2d/layers/features/processor/BinningStrategy.js +0 -2
  185. package/views/2d/layers/features/processor/ClusterStrategy.js +0 -2
  186. package/views/2d/layers/features/processor/TrackStrategy.js +0 -2
  187. /package/assets/esri/core/workers/chunks/{744f34e379484e63277c.js.LICENSE.txt → cdb331b58e22f8c1c988.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o)=>{f(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;d(v,t+e.transformation[12],e.transformation[13]),e.screenToWorldRatio=this.rendererContext.screenToWorldRatio;const n=e.material.intersectScreenPolygonDraped(e,v,s,r);n&&R(r.distance,n.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function f(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
2
+ import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new f,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||e.screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,G,(t,s,o)=>{_(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(e.visible&&e.material.visible&&e.material.intersectScreenPolygonDraped){d(v,t+e.transformation[12],e.transformation[13]),e.screenToWorldRatio=this.rendererContext.screenToWorldRatio;for(const t of r){const r=e.material.intersectScreenPolygonDraped(e,v,s,t);if(r)return void R(t.distance,r.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}}}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class f{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as s}from"../../../../geometry/support/frustum.js";import{Sphere as o}from"../../../../geometry/support/sphere.js";import{maxScale as f}from"../../support/mathUtils.js";import{DepthRange as h}from"./DepthRange.js";import{assert as c}from"./Util.js";const u=1e4,l=100,d=500,m=500,_=.1;function g(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=u)))return F.compute(e,t,n);const a=new h;return r.forEach(t=>a.union(p(e,t))),a}function p(e,t){if(!t.visible)return;const r=new h,n=t.getSpatialQueryAccelerator();return n?b(r,e,n):w(r,e,t.objects),r}function b(e,t,r){const{eye:n,viewForward:i,frustum:a}=t,s=e=>e.visible,o=r.objectCount;if(o<d)E.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,E,(r,n)=>{M(e,t,r),E.far=e.near,n.setRange(E)},a,s),E.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,E,(r,n)=>{M(e,t,r),E.near=e.far,n.setRange(E)},a,s);else{const n=Math.max(Math.min(o,m),Math.ceil(o*_)),f=r.findClosest(i,1,a,s,n),h=r.findClosest(i,-1,a,s,n);f&&h&&(x(e,t,f.boundingVolumeWorldSpace.bounds),x(e,t,h.boundingVolumeWorldSpace.bounds))}}function w(e,t,r){S.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&S.add(e,t)}),S.empty||(S.sort(),E.set(t.near,Math.min(e.near,t.far)),S.forEachInDepthRange(E,1,(r,n)=>{n<e.near&&M(e,t,r)}),E.set(Math.max(e.far,t.near),t.far),S.forEachInDepthRange(E,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function M(e,r,n){if(!n.visible)return;if(!s(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,a=D;n.geometries.forEach(n=>{t(a,i,n.transformation);const s=f(a);j(e,r,n.boundingInfo,a,s)})}function j(e,t,r,i,a){if(null==r)return;n(A.center,r.center,i);const{eye:o,viewForward:f}=t,h=f[0]*(A.center[0]-o[0])+f[1]*(A.center[1]-o[1])+f[2]*(A.center[2]-o[2]);if(A.radius=r.radius*a,!(h-A.radius>e.near&&h+A.radius<e.far)&&s(t.frustum,A))if(r.radius>l&&r.getChildren())for(const n of r.getChildren())j(e,t,n,i,a);else W.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function x(e,t,r){const n=t.eye,i=t.viewForward,a=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,a-r.radius),e.far=Math.max(e.far,a+r.radius)}class R{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.bounds,a=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(a))return;const s=this._items.pushNew();s.object=e,s.distance=a,s.near=a-i.radius,s.far=a+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class v{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new h(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===r&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t.center[0]+n[6]*t.center[1]+n[10]*t.center[2]+n[14],a=i-t.radius,s=i+t.radius;this._geometries.push(e),this._near.push(-s),this._far.push(-a)})});const i=new h;if(0===this._geometries.length)return i;for(let f=0;f<this._geometries.length;++f)this._near[f]>i.far&&(i.far=this._near[f]),this._near[f]>2&&this._far[f]<i.near&&(i.near=this._far[f]);const a=this._looseRange;a.near=Math.max(.5*i.near,2),a.far=2*i.far;let s=0,o=0;for(let f=0;f<this._geometries.length;++f)this._near[f]<i.near&&(this._near[f]>=a.near?i.near=this._near[f]:this._nearCandidates[s++]=f),this._far[f]>i.far&&(this._far[f]<=a.far?i.far=this._far[f]:this._farCandidates[o++]=f);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let f=0;f<this._nearCandidates.length;++f){const t=this._nearCandidates[f];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:a}=r;this._includeNearBoundingInfoRec(e,n,a,i)}}for(let f=0;f<this._farCandidates.length;++f){const t=this._farCandidates[f];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:a}=r;this._includeFarBoundingInfoRec(e,n,a,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const a=t.center;n(A.center,a,r),A.radius=t.radius*f(r);const{frustum:s}=e;if(this._isOutsideSidePlanes(A,s))return;const o=A.center[0],h=A.center[1],c=A.center[2],u=A.radius,{viewMatrix:d}=e,m=d[2]*o+d[6]*h+d[10]*c+d[14],_=m+u;if(!(-(m-u)<2||-_>=i.near))if(-_>this._looseRange.near)i.near=-_;else{if(u>l){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}W.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const a=t.center;n(A.center,a,r),A.radius=t.radius*f(r);const{frustum:s}=e;if(this._isOutsideSidePlanes(A,s))return;const[o,h,c]=A.center,{viewMatrix:u,viewProjectionMatrix:d}=e,m=u[2]*o+u[6]*h+u[10]*c+u[14]-A.radius;if(!(-m<=i.far))if(-m<this._looseRange.far)i.far=-m;else{if(A.radius>l){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}W.unionDepthRangeWithAABB(i,d,r,t.bbMin,t.bbMax)}}}class C{constructor(){this._modelViewProj=r(),this._clipPosition=[a(),a(),a(),a(),a(),a(),a(),a()]}unionDepthRangeWithAABB(e,r,n,i,a){const s=this._modelViewProj;t(s,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:a[0],n=0===t||1===t||4===t||5===t?i[1]:a[1],o=t<4?i[2]:a[2];e[0]=s[0]*r+s[4]*n+s[8]*o+s[12],e[1]=s[1]*r+s[5]*n+s[9]*o+s[13],e[2]=s[2]*r+s[6]*n+s[10]*o+s[14],e[3]=s[3]*r+s[7]*n+s[11]*o+s[15]}for(let t=0;t<12;++t){const r=B(this._clipPosition[y[t][0]],this._clipPosition[y[t][1]],this._clipPosition[y[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function B(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],a=e[(t+1)%e.length];I(a,i)?(I(r,i)||n.push(P(r,a,i)),n.push(a)):I(r,i)&&n.push(P(r,a,i))}}return n}function I(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void c(!1)}function P(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(a(),e,t,n)}const y=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],A=new o,D=r(),E=new h,S=new R,F=new v,W=new C;export{g as depthRangeFromScene};
2
+ import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4Z as n,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{lerp as a}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as o}from"../../../../geometry/support/frustum.js";import{Sphere as f}from"../../../../geometry/support/sphere.js";import{maxScale as h}from"../../support/mathUtils.js";import{DepthRange as c}from"./DepthRange.js";import{assert as u}from"./Util.js";const l=1e4,d=100,m=500,_=500,g=.1;function p(e,t,r,n){let i=0;if(!t.some(e=>!!e.material&&(i+=e.numGeometries,i>=l)))return W.compute(e,t,n);const a=new c;return r.forEach(t=>a.union(b(e,t))),a}function b(e,t){if(!t.visible)return;const r=new c,n=t.getSpatialQueryAccelerator();return n?w(r,e,n):M(r,e,t.objects),r}function w(e,t,r){const{eye:n,viewForward:i,frustum:a}=t,s=e=>e.visible,o=r.objectCount;if(o<m)S.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,1,S,(r,n)=>{j(e,t,r),S.far=e.near,n.setRange(S)},a,s),S.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,-1,S,(r,n)=>{j(e,t,r),S.near=e.far,n.setRange(S)},a,s);else{const n=Math.max(Math.min(o,_),Math.ceil(o*g)),f=r.findClosest(i,1,a,s,n),h=r.findClosest(i,-1,a,s,n);f&&h&&(R(e,t,f.boundingVolumeWorldSpace.bounds),R(e,t,h.boundingVolumeWorldSpace.bounds))}}function M(e,t,r){F.clear(),r.forEach(e=>{e.visible&&0!==e.geometries.length&&F.add(e,t)}),F.empty||(F.sort(),S.set(t.near,Math.min(e.near,t.far)),F.forEachInDepthRange(S,1,(r,n)=>{n<e.near&&j(e,t,r)}),S.set(Math.max(e.far,t.near),t.far),F.forEachInDepthRange(S,-1,(t,r,n)=>{e.far=Math.max(e.far,n)}))}function j(e,r,n){if(!n.visible)return;if(!o(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,a=E;n.geometries.forEach(n=>{t(a,i,n.transformation);const s=h(a);x(e,r,n.boundingInfo,a,s)})}function x(e,t,r,n,a){if(null==r)return;i(D.center,r.center,n);const{eye:s,viewForward:f}=t,h=f[0]*(D.center[0]-s[0])+f[1]*(D.center[1]-s[1])+f[2]*(D.center[2]-s[2]);if(D.radius=r.radius*a,!(h-D.radius>e.near&&h+D.radius<e.far)&&o(t.frustum,D))if(r.radius>d&&r.getChildren())for(const i of r.getChildren())x(e,t,i,n,a);else N.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,n,r.bbMin,r.bbMax)}function R(e,t,r){const n=t.eye,i=t.viewForward,a=(r.center[0]-n[0])*i[0]+(r.center[1]-n[1])*i[1]+(r.center[2]-n[2])*i[2];e.near=Math.min(e.near,a-r.radius),e.far=Math.max(e.far,a+r.radius)}class v{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e,t){const r=t.eye,n=t.viewForward,i=e.boundingVolumeWorldSpace.bounds,a=(i.center[0]-r[0])*n[0]+(i.center[1]-r[1])*n[1]+(i.center[2]-r[2])*n[2];if(!Number.isFinite(a))return;const s=this._items.pushNew();s.object=e,s.distance=a,s.near=a-i.radius,s.far=a+i.radius}sort(){this._items.sort((e,t)=>e.distance-t.distance)}forEachInDepthRange(e,t,r){if(1===t)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class C{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new c(0,0)}compute(e,t,r){this._reset();const{viewMatrix:i}=e;t.forEach(e=>{e.forEachGeometry(e=>{if(!e.visible||0===r&&!e.castShadow)return;const t=e.boundingSphere,a=n(t.center,i),s=a-t.radius,o=a+t.radius;this._geometries.push(e),this._near.push(-o),this._far.push(-s)})});const a=new c;if(0===this._geometries.length)return a;for(let n=0;n<this._geometries.length;++n)this._near[n]>a.far&&(a.far=this._near[n]),this._near[n]>2&&this._far[n]<a.near&&(a.near=this._far[n]);const s=this._looseRange;s.near=Math.max(.5*a.near,2),s.far=2*a.far;let o=0,f=0;for(let n=0;n<this._geometries.length;++n)this._near[n]<a.near&&(this._near[n]>=s.near?a.near=this._near[n]:this._nearCandidates[o++]=n),this._far[n]>a.far&&(this._far[n]<=s.far?a.far=this._far[n]:this._farCandidates[f++]=n);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return a;this._nearCandidates.sort((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0),this._farCandidates.sort((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0);for(let n=0;n<this._nearCandidates.length;++n){const t=this._nearCandidates[n];if(this._near[t]<a.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeNearBoundingInfoRec(e,n,i,a)}}for(let n=0;n<this._farCandidates.length;++n){const t=this._farCandidates[n];if(this._far[t]>a.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:i}=r;this._includeFarBoundingInfoRec(e,n,i,a)}}return this._reset(),a}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const{center:r,radius:n}=e;return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,a){if(null==t)return;const s=t.center;i(D.center,s,r),D.radius=t.radius*h(r);const{frustum:o}=e;if(this._isOutsideSidePlanes(D,o))return;const f=D.radius,{viewMatrix:c}=e,u=n(D.center,c),l=u+f;if(!(-(u-f)<2||-l>=a.near))if(-l>this._looseRange.near)a.near=-l;else{if(f>d){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,a){if(null==t)return;const s=t.center;i(D.center,s,r),D.radius=t.radius*h(r);const{frustum:o}=e;if(this._isOutsideSidePlanes(D,o))return;const{viewMatrix:f,viewProjectionMatrix:c}=e,u=n(D.center,f)-D.radius;if(!(-u<=a.far))if(-u<this._looseRange.far)a.far=-u;else{if(D.radius>d){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,a);return}}N.unionDepthRangeWithAABB(a,c,r,t.bbMin,t.bbMax)}}}class B{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,a){const s=this._modelViewProj;t(s,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:a[0],n=0===t||1===t||4===t||5===t?i[1]:a[1],o=t<4?i[2]:a[2];e[0]=s[0]*r+s[4]*n+s[8]*o+s[12],e[1]=s[1]*r+s[5]*n+s[9]*o+s[13],e[2]=s[2]*r+s[6]*n+s[10]*o+s[14],e[3]=s[3]*r+s[7]*n+s[11]*o+s[15]}for(let t=0;t<12;++t){const r=I(this._clipPosition[A[t][0]],this._clipPosition[A[t][1]],this._clipPosition[A[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function I(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],a=e[(t+1)%e.length];P(a,i)?(P(r,i)||n.push(y(r,a,i)),n.push(a)):P(r,i)&&n.push(y(r,a,i))}}return n}function P(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void u(!1)}function y(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),a(s(),e,t,n)}const A=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],D=new f,E=r(),S=new c,F=new v,W=new C,N=new B;export{p as depthRangeFromScene};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as i,lerp as s,squaredLength as t,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as l,h as o}from"../../../../chunks/boundedPlane.js";import{clipPolygon as r,clipLineSegment as c,create as a,fromValues as h}from"../../../../geometry/support/plane.js";function u(i){return(t,n,e)=>!o(i,s(d,t,n,e))}class m{constructor(i,s){this.list=i,this.count=s}}class f{constructor(i){this._remainingA=p(),this._remainingB=p(),this._visible=p(),this._lineRemainingA=b(),this._lineRemainingB=b(),this._lineVisible=b(),this._slicedAwayHalfspaces=_(i),this._slicePlane=l(i)}*processTriangle(s,t){let n=new m(this._remainingA,3),e=new m(this._remainingB,0);i(n.list[0],t[0]),i(n.list[1],t[1]),i(n.list[2],t[2]);const l=new m(this._visible,0);for(const i of this._slicedAwayHalfspaces){if(l.count=r(i,n.list,n.count,l.list,!1),l.count>=3&&(s.list=l.list,s.count=l.count,yield s),e.count=r(i,n.list,n.count,e.list,!0),e.count<3)return;[e,n]=[n,e]}}*processLineSegment(s,t,n){let e=this._lineRemainingA,l=this._lineRemainingB;i(e[0],t),i(e[1],n);for(const o of this._slicedAwayHalfspaces){if(c(o,e[0],e[1],this._lineVisible[0],this._lineVisible[1],!1)&&(i(s[0],this._lineVisible[0]),i(s[1],this._lineVisible[1]),yield s),!c(o,e[0],e[1],l[0],l[1],!0))return;[l,e]=[e,l]}}validatePoint(i){return!o(this._slicePlane,i)}}function _(i){const s=[a(i.plane),a(),a(),a(),a()];return g(i.basis1,i.origin,s[1],s[2]),g(i.basis2,i.origin,s[3],s[4]),s}function g(i,s,e,l){const o=t(i),r=n(i,s);h(i[0],i[1],i[2],-r+o,e),h(-i[0],-i[1],-i[2],r+o,l)}function p(){return Array.from({length:12},()=>e())}function b(){return[e(),e()]}const d=e();export{f as SliceScreenPolygonPrimitiveProcessor,u as sliceFilterPredicate};
2
+ import i from"../../../../core/PooledArray.js";import{copy as e,lerp as s,squaredLength as n,dot as t}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as o,h as r}from"../../../../chunks/boundedPlane.js";import{clipLineSegment as a,create as c,clipPolygon as h,fromValues as f}from"../../../../geometry/support/plane.js";function m(i){return(e,n,t)=>!r(i,s(w,e,n,t))}const p=new i({allocator:i=>i??l()}),u=new i({allocator:i=>i??l()});function*g(i,e){let s=e,n=p,t=u;for(const l of i){if(n.length=0,h(l,s,()=>n.pushNew(),!1),n.length>=3&&(yield n),n.length=0,h(l,s,()=>n.pushNew(),!0),n.length<3)return;s=n,[n,t]=[t,n]}}class _{constructor(i){this._lineRemainingA=y(),this._lineRemainingB=y(),this._lineVisible=y(),this._slicedAwayHalfspaces=b(i),this._slicePlane=o(i)}*processTriangle(i){yield*g(this._slicedAwayHalfspaces,i)}*processLineSegment(i,s,n){let t=this._lineRemainingA,l=this._lineRemainingB;e(t[0],s),e(t[1],n);for(const o of this._slicedAwayHalfspaces){if(a(o,t[0],t[1],this._lineVisible[0],this._lineVisible[1],!1)&&(e(i[0],this._lineVisible[0]),e(i[1],this._lineVisible[1]),yield i),!a(o,t[0],t[1],l[0],l[1],!0))return;[l,t]=[t,l]}}validatePoint(i){return!r(this._slicePlane,i)}}function b(i){const e=[c(i.plane),c(),c(),c(),c()];return d(i.basis1,i.origin,e[1],e[2]),d(i.basis2,i.origin,e[3],e[4]),e}function d(i,e,s,l){const o=n(i),r=t(i,e);f(i[0],i[1],i[2],-r+o,s),f(-i[0],-i[1],-i[2],r+o,l)}function y(){return[l(),l()]}const w=l();export{_ as SliceScreenPolygonPrimitiveProcessor,g as clipPolygonAgainstSlicedAwayHalfspaces,b as createSliceExtrusionHalfspacePlanes,m as sliceFilterPredicate};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createRenderScreenPointArray3 as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{copy as r,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{intersects as i,fromValues as s,create as u,containsPoint as f}from"../../../../geometry/support/aaBoundingRect.js";import{distance2 as c,fromPoints as p,create as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?f(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,e=n[1]-r,u=n[0]+r,f=n[1]+r;if(!i(t.bounds,s(o,e,u,f,A)))return!1;if(g(t,n))return!0;const c=r*r;for(const i of t.points){const t=i[0]-n[0],r=i[1]-n[1];if(t*t+r*r<=c)return!0}for(let i=0;i<t.points.length;i++){if(k(n,t.points[i],t.points[(i+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!i(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(f(n,r))return!0;for(let r=0;r<4;r++)if(v(z(C,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const o=t.points[r],e=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(B(o,e,z(C,n,t),z(D,n,(t+1)%4)))return!0}}return!1}function x(t,n,r,o){const e=Math.min(n[0],r[0],o[0]),i=Math.min(n[1],r[1],o[1]),u=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,s(e,i,u,f,A)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const s of t.points)if(h(n,r,o,s,K))return!0;for(let s=0;s<t.points.length;s++){const e=t.points[s],i=t.points[(s+1)%t.points.length];if(B(n,r,e,i)||B(r,o,e,i)||B(o,n,e,i))return!0}return!1}function d(t,n,r,o){const e=Math.min(n[0],r[0])-o,u=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!i(t.bounds,s(e,u,f,c,A)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const i of t.points)if(k(i,n,r)<=p)return!0;for(let i=0;i<t.points.length;i++){const o=t.points[i],e=t.points[(i+1)%t.points.length];if(B(n,r,o,e)||U(n,r,o,e)<=p)return!0}return!1}function b(t,n,o,e,i){r(G,n),r(H,o);const s=t.projectToRenderScreen(G,E),u=t.projectToRenderScreen(H,F);if(null==s||null==u)return!1;const f=R(t,G),c=R(t,H);if(f&&c)return!1;if(f!==c){const n=f?G:H,r=f?s:u;if(!S(t,n,f?H:G))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=s[0],e[1]=s[1],e[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],p(n,r,J),o)}function v(t,n){let r=!1;for(let o=0,e=n.length-1;o<n.length;e=o++){const i=n[o],s=n[e];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function B(t,n,r,o){const e=q(t,n,r),i=q(t,n,o),s=q(r,o,t),u=q(r,o,n);return e!==i&&s!==u||(0===e&&w(t,n,r)||0===i&&w(t,n,o)||0===s&&w(r,o,t)||0===u&&w(r,o,n))}function U(t,n,r,o){return B(t,n,r,o)?0:Math.min(k(t,r,o),k(n,r,o),k(r,t,n),k(o,t,n))}function k(t,n,r){return c(p(o(G,n[0],n[1],0),o(H,r[0],r[1],0),J),o(I,t[0],t[1],0))}function q(t,n,r){const o=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(o)<=K?0:Math.sign(o)}function w(t,n,r){return r[0]>=Math.min(t[0],n[0])-K&&r[0]<=Math.max(t[0],n[0])+K&&r[1]>=Math.min(t[1],n[1])-K&&r[1]<=Math.max(t[1],n[1])+K}function z(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const A=u(),C=n(),D=n(),E=t(),F=t(),G=e(),H=e(),I=e(),J=m(),K=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
2
+ import{createRenderScreenPointArray3 as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{copy as r,set as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i,intersects as s,containsPoint as u,create as f}from"../../../../geometry/support/aaBoundingRect.js";import{distance2 as c,fromPoints as p,create as m}from"../../../../geometry/support/lineSegment.js";import{signedDistance as a,intersectLineSegment as l}from"../../../../geometry/support/plane.js";import{containsPoint2dFromValues as h}from"../../../../geometry/support/triangle.js";function g(t,n){return t.isRectangle?u(t.bounds,n):v(n,t.points)}function M(t,n,r){const o=n[0]-r,e=n[1]-r,u=n[0]+r,f=n[1]+r;if(!s(t.bounds,i(o,e,u,f,A)))return!1;if(g(t,n))return!0;const c=r*r;for(const i of t.points){const t=i[0]-n[0],r=i[1]-n[1];if(t*t+r*r<=c)return!0}for(let i=0;i<t.points.length;i++){if(k(n,t.points[i],t.points[(i+1)%t.points.length])<=c)return!0}return!1}function j(t,n){if(!s(t.bounds,n))return!1;if(t.isRectangle)return!0;for(const r of t.points)if(u(n,r))return!0;for(let r=0;r<4;r++)if(v(z(C,n,r),t.points))return!0;for(let r=0;r<t.points.length;r++){const o=t.points[r],e=r===t.points.length-1?t.points[0]:t.points[r+1];for(let t=0;t<4;t++){if(B(o,e,z(C,n,t),z(D,n,(t+1)%4)))return!0}}return!1}function x(t,n,r,o){const e=Math.min(n[0],r[0],o[0]),s=Math.min(n[1],r[1],o[1]),u=Math.max(n[0],r[0],o[0]),f=Math.max(n[1],r[1],o[1]);if(!j(t,i(e,s,u,f,A)))return!1;if(g(t,n)||g(t,r)||g(t,o))return!0;for(const i of t.points)if(h(n,r,o,i,K))return!0;for(let i=0;i<t.points.length;i++){const e=t.points[i],s=t.points[(i+1)%t.points.length];if(B(n,r,e,s)||B(r,o,e,s)||B(o,n,e,s))return!0}return!1}function d(t,n,r,o){const e=Math.min(n[0],r[0])-o,u=Math.min(n[1],r[1])-o,f=Math.max(n[0],r[0])+o,c=Math.max(n[1],r[1])+o;if(!s(t.bounds,i(e,u,f,c,A)))return!1;if(g(t,n)||g(t,r))return!0;const p=o*o;for(const i of t.points)if(k(i,n,r)<=p)return!0;for(let i=0;i<t.points.length;i++){const o=t.points[i],e=t.points[(i+1)%t.points.length];if(B(n,r,o,e)||U(n,r,o,e)<=p)return!0}return!1}function b(t,n,o,e,i){r(G,n),r(H,o);const s=t.projectToRenderScreen(G,E),u=t.projectToRenderScreen(H,F);if(null==s||null==u)return!1;const f=R(t,G),c=R(t,H);if(f&&c)return!1;if(f!==c){const n=f?G:H,r=f?s:u;if(!S(t,n,f?H:G))return!1;if(!t.projectToRenderScreen(n,r))return!1}return e[0]=s[0],e[1]=s[1],e[2]=0,i[0]=u[0],i[1]=u[1],i[2]=0,!0}function R(t,n){return y(t,n)>0}function y(t,n){return a(t.frustum[4],n)}function S(t,n,r){return T(t,n,r,n)}function T(t,n,r,o){return l(t.frustum[4],p(n,r,J),o)}function v(t,n){let r=!1;for(let o=0,e=n.length-1;o<n.length;e=o++){const i=n[o],s=n[e];if(!(i[1]>t[1]!=s[1]>t[1]))continue;const u=(s[0]-i[0])*(t[1]-i[1])/(s[1]-i[1])+i[0];t[0]<u&&(r=!r)}return r}function B(t,n,r,o){const e=q(t,n,r),i=q(t,n,o),s=q(r,o,t),u=q(r,o,n);return e!==i&&s!==u||(0===e&&w(t,n,r)||0===i&&w(t,n,o)||0===s&&w(r,o,t)||0===u&&w(r,o,n))}function U(t,n,r,o){return B(t,n,r,o)?0:Math.min(k(t,r,o),k(n,r,o),k(r,t,n),k(o,t,n))}function k(t,n,r){return c(p(o(G,n[0],n[1],0),o(H,r[0],r[1],0),J),o(I,t[0],t[1],0))}function q(t,n,r){const o=(n[1]-t[1])*(r[0]-n[0])-(n[0]-t[0])*(r[1]-n[1]);return Math.abs(o)<=K?0:Math.sign(o)}function w(t,n,r){return r[0]>=Math.min(t[0],n[0])-K&&r[0]<=Math.max(t[0],n[0])+K&&r[1]>=Math.min(t[1],n[1])-K&&r[1]<=Math.max(t[1],n[1])+K}function z(t,n,r){return t[0]=0===r||3===r?n[0]:n[2],t[1]=r<2?n[1]:n[3],t}const A=f(),C=n(),D=n(),E=t(),F=t(),G=e(),H=e(),I=e(),J=m(),K=1e-9;export{R as isBehindNearPlane,b as projectWorldLineSegmentToRenderScreen,g as screenPolygonContainsPoint,j as screenPolygonIntersectsBounds,d as screenPolygonIntersectsBufferedSegment,M as screenPolygonIntersectsCircle,x as screenPolygonIntersectsTriangle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,distance as r,squaredDistance as o,set as i,transformMat4 as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as u,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as c,intersectsTransformedAabbFromMinMax as m}from"../../../../geometry/support/frustum.js";import{clipPolygon as f}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as h}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as I}from"./screenPolygonOverlapUtils.js";class b{constructor(t){this.primitiveIndex=t}}class g{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,r,o,i){this.distance=t,this.primitiveIndex=r,e(this.point,o),this.hasNormal=null!=i,null!=i&&e(this.normal,i)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:i}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?i:null)}get valid(){return Number.isFinite(this.distance)}}function y(t,e,r,o,i){if(!t.visible||0!==t.type)return null;const n=new g(4);let s;if(t.boundingInfo)s=j(t.boundingInfo,e,r,o,i);else{const n=t.positionAttribute,l=t.primitivePositionIndices;s=N(e,r,o,0,l.length/3,l,n.data,n.stride,i,null,0)}for(const l of s)n.updateIfCloser(l);return n.valid?n:null}function v(t,e,r,o,i){const n=new g(4);for(const s of x(t,e,r,o,i))n.updateIfCloser(s);return n.valid?n:null}function*N(t,e,r,o,i,n,s,l,u,a=null,c=0){const m=(t,r,o,i)=>{const m=(a?.[i]??i)+c,f=null==a?m:i,p=3*m;return P(t,n,s,l,p+0,u,f,e),P(r,n,s,l,p+1,u,f,e),P(o,n,s,l,p+2,u,f,e),m};return yield*x(t,r,o,i,m)}function*x(t,e,o,i,n){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let u=o;u<i;++u){const t=n(A[0],A[1],A[2],u),o=w;let i;Y.reset();for(const{list:n,count:u}of l.processTriangle(_,A)){const l=f(s.frustum[4],n,u,M,!1);if(!(l<3)){for(let t=0;t<l;t++)s.projectToScreen(M[t],O[t]);T(e,O,l)&&(F(s.eye,M,l,S),null==i&&(i=p(w,A[0],A[1],A[2])),Y.updateIfCloserFromValues(r(s.eye,S),t,S,i?o:null))}}Y.valid&&(yield Y)}}function*j(t,e,r,o,i){let n;if(null!=i?(l(C,t.bbMin),u(C,t.bbMax),i.applyToAabb(C),n=c(o.broadPhaseFrustum,C,r)):n=m(o.broadPhaseFrustum,t.bbMin,t.bbMax,r),!n)return;const{primitiveIndices:s,position:a}=t,f=s?s.length:a.indices.length/3;if(f>h){const n=t.getChildren();if(void 0!==n){for(const t of n)yield*j(t,e,r,o,i);return}}yield*N(e,r,o,0,f,a.indices,a.data,a.stride,i,s,0)}function P(t,e,r,o,s,l,u,a){const c=o*e[s],m=r[c+0],f=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,m,f,p,u):i(t,m,f,p),a&&n(t,t,a)}function T(t,e,r){for(let o=1;o<r-1;o++)if(I(t,e[0],e[o],e[o+1]))return!0;return!1}function F(t,r,i,n){let s=Number.POSITIVE_INFINITY;for(let l=1;l<i-1;l++){d(E,t,r[0],r[l],r[l+1]);const i=o(t,E);i<s&&(s=i,e(n,E))}}const C=a(),V=12,A=[s(),s(),s()],M=Array.from({length:V},()=>s()),O=Array.from({length:V},()=>t()),S=s(),w=s(),E=s(),Y=new g(4),_={list:[],count:0};export{b as DrapedHit,g as Hit,N as forEachTriangleRangeScreenPolygonHit,x as forEachTriangleReaderRangeScreenPolygonHit,y as intersectTriangleGeometryScreenPolygon,v as intersectTriangleReaderRangeScreenPolygon};
2
+ import t from"../../../../core/PooledArray.js";import{createScreenPointArray as e}from"../../../../core/screenUtils.js";import{copy as r,distance as o,squaredDistance as n,set as i,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as u,create as c}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as m,intersectsTransformedAabbFromMinMax as f}from"../../../../geometry/support/frustum.js";import{clipPolygon as p}from"../../../../geometry/support/plane.js";import{normalFromValues as d,closestPointFromValues as h}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{screenPolygonIntersectsTriangle as g}from"./screenPolygonOverlapUtils.js";class b{constructor(t){this.primitiveIndex=t}}class y{constructor(t){this.type=t,this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=l(),this.normal=l()}reset(){this.distance=Number.POSITIVE_INFINITY,this.hasNormal=!1}update(t,e,o,n){this.distance=t,this.primitiveIndex=e,r(this.point,o),this.hasNormal=null!=n,null!=n&&r(this.normal,n)}updateIfCloserFromValues(t,e,r,o){t<this.distance&&this.update(t,e,r,o)}updateIfCloser(t){const{distance:e,primitiveIndex:r,point:o,normal:n}=t;this.updateIfCloserFromValues(e,r,o,t.hasNormal?n:null)}get valid(){return Number.isFinite(this.distance)}}function v(t,e,r,o,n){if(!t.visible||0!==t.type)return null;const i=new y(4);let s;if(t.boundingInfo)s=P(t.boundingInfo,e,r,o,n);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,r,o,0,l.length/3,l,i.data,i.stride,n,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function N(t,e,r,o,n){const i=new y(4);for(const s of x(t,e,r,o,n))i.updateIfCloser(s);return i.valid?i:null}function*j(t,e,r,o,n,i,s,l,a,u=null,c=0){const m=(t,r,o,n)=>{const m=(u?.[n]??n)+c,f=null==u?m:n,p=3*m;return T(t,i,s,l,p+0,a,f,e),T(r,i,s,l,p+1,a,f,e),T(o,i,s,l,p+2,a,f,e),m};return yield*x(t,r,o,n,m)}function*x(t,e,r,n,i){if(null==t.camera)return;const{camera:s,screenPolygonPrimitiveProcessor:l}=t;for(let a=r;a<n;++a){const t=i(A[0],A[1],A[2],a),r=E;let n;_.reset();const u=M;for(const i of l.processTriangle(A))if(u.length=0,p(s.frustum[4],i,()=>u.pushNew(),!1),!(u.length<3)){for(let t=0;t<u.length;t++)s.projectToScreen(u.at(t),O[t]);F(e,O,u.length)&&(C(s.eye,u,S),null==n&&(n=d(E,A[0],A[1],A[2])),_.updateIfCloserFromValues(o(s.eye,S),t,S,n?r:null))}_.valid&&(yield _)}}function*P(t,e,r,o,n){let i;if(null!=n?(a(V,t.bbMin),u(V,t.bbMax),n.applyToAabb(V),i=m(o.broadPhaseFrustum,V,r)):i=f(o.broadPhaseFrustum,t.bbMin,t.bbMax,r),!i)return;const{primitiveIndices:s,position:l}=t,c=s?s.length:l.indices.length/3;if(c>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*P(t,e,r,o,n);return}}yield*j(e,r,o,0,c,l.indices,l.data,l.stride,n,s,0)}function T(t,e,r,o,n,l,a,u){const c=o*e[n],m=r[c+0],f=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,m,f,p,a):i(t,m,f,p),u&&s(t,t,u)}function F(t,e,r){for(let o=1;o<r-1;o++)if(g(t,e[0],e[o],e[o+1]))return!0;return!1}function C(t,e,o){let i=Number.POSITIVE_INFINITY;const s=e.at(0);for(let l=1;l<e.length-1;l++){h(Y,t,s,e.at(l),e.at(l+1));const a=n(t,Y);a<i&&(i=a,r(o,Y))}}const V=c(),w=12,A=[l(),l(),l()],M=new t({allocator:t=>t??l()}),O=Array.from({length:w},()=>e()),S=l(),E=l(),Y=l(),_=new y(4);export{b as DrapedHit,y as Hit,j as forEachTriangleRangeScreenPolygonHit,x as forEachTriangleReaderRangeScreenPolygonHit,v as intersectTriangleGeometryScreenPolygon,N as intersectTriangleReaderRangeScreenPolygon};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{exactEquals as e,subtract as t,add as r,set as s,copy as i,normalize as a,length as o,scale as n,dot as l,transformMat3 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as d,setMax as f,getMax as x}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as g,isColor as T}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as v}from"../lib/GLTextureMaterial.js";import{Material as S}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as M}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as y}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as C,applyPolygonOffsetToHit as P}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as R}from"./internal/MaterialUtil.js";import{getLayout as w,DefaultMaterialPassParameters as j,DefaultMaterialTechnique as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as I}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as _}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as D}from"../../../../webscene/support/AlphaCutoff.js";class B extends S{constructor(e,t){super(e,z),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>g(e)&&!this.transparent],[4,e=>g(e)&&this.transparent]]),this._layout=w(this.parameters),this._configuration=new I(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=D}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,T(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=A(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,r,s,i,a,o){const n=this._getMaterialVerticalOffset(r,s);null!=n&&(i=t(F,i,n),a=t(E,a,n)),o=C(o,this._configuration,i,a),b(e,s,i,a,y(s.verticalOffset),o)}intersectScreenPolygon(e,t,r,s){return P(M(e,r,t,s,this._createScreenPolygonVertexDisplacement(t,r)),this._configuration,r.camera.eye)}createGLMaterial(e){return new N(e)}createBufferWriter(){return new O(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}_createScreenPolygonVertexDisplacement(e,t){const s=this._getMaterialVerticalOffset(e,t);return null==s?null:{applyToVertex:(e,t,r,i)=>(e[0]=t+s[0],e[1]=r+s[1],e[2]=i+s[2],e),applyToAabb:e=>(p(e,r(W,d(e,W),s)),f(e,r(W,x(e,W),s)),e)}}_getMaterialVerticalOffset(e,r){if(null==this.parameters.verticalOffset)return null;const u=r.camera;s(G,e[12],e[13],e[14]);let h=null;switch(r.viewingMode){case 1:h=a(k,G);break;case 2:h=i(k,q)}const m=t(H,G,u.eye),p=o(m),d=n(m,m,1/p);let f=null;this.parameters.screenSizePerspective&&(f=l(h,d));const x=R(u,p,this.parameters.verticalOffset,f??0,this.parameters.screenSizePerspective,null);return n(h,h,x),c(L,h,r.transform.inverseRotation)}}class N extends v{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return s(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?_:V,e)}}class z extends j{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const F=h(),E=h(),q=m(0,0,1),k=h(),G=h(),H=h(),L=h(),W=h();export{N as DefaultGLMaterial,B as DefaultMaterial,z as DefaultMaterialParameters};
2
+ import{exactEquals as e,subtract as t,add as r,set as s,copy as i,normalize as a,length as o,scale as n,dot as l,transformMat3 as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as h,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as p,getMin as d,setMax as f,getMax as x}from"../../../../geometry/support/aaBoundingBox.js";import{is3DGeometryOrShadowLike as g,isColor as T}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as v}from"../lib/GLTextureMaterial.js";import{Material as S}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{intersectTriangleGeometryScreenPolygon as M}from"../lib/screenPolygonTriangleIntersections.js";import{getVerticalOffsetObject3D as y}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as O}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as C,applyPolygonOffsetToHit as P}from"./intersectWithPolygonOffset.js";import{verticalOffsetAtDistance as R}from"./internal/MaterialUtil.js";import{getLayout as w,DefaultMaterialPassParameters as j,DefaultMaterialTechnique as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as I}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as _}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as D}from"../../../../webscene/support/AlphaCutoff.js";class B extends S{constructor(e,t){super(e,z),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,e=>g(e)&&!this.transparent],[4,e=>g(e)&&this.transparent]]),this._layout=w(this.parameters),this._configuration=new I(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=D}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,T(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=A(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.unlit?7:t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,r,s,i,a,o){const n=this._getMaterialVerticalOffset(r,s);null!=n&&(i=t(F,i,n),a=t(E,a,n)),o=C(o,this._configuration,i,a),b(e,s,i,a,y(s.verticalOffset),o)}intersectScreenPolygon(e,t,r,s){return P(M(e,r,t,s,this._createScreenPolygonVertexDisplacement(t,r)),this._configuration,r.camera.eye)}createGLMaterial(e){return new N(e)}createBufferWriter(){return new O(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}_createScreenPolygonVertexDisplacement(e,t){const s=this._getMaterialVerticalOffset(e,t);return null==s?null:{applyToVertex:(e,t,r,i)=>(e[0]=t+s[0],e[1]=r+s[1],e[2]=i+s[2],e),applyToAabb:e=>(p(e,r(W,d(e,W),s)),f(e,r(W,x(e,W),s)),e)}}_getMaterialVerticalOffset(e,r){if(null==this.parameters.verticalOffset)return null;const u=r.camera;s(G,e[12],e[13],e[14]);let h=null;switch(r.viewingMode){case 1:h=a(k,G);break;case 2:h=i(k,q)}const m=t(H,G,u.eye),p=o(m),d=n(m,m,1/p);let f=null;this.parameters.screenSizePerspective&&(f=l(h,d));const x=R(u,p,this.parameters.verticalOffset,f??0,this.parameters.screenSizePerspective,null);return n(h,h,x),c(L,h,r.transform.inverseRotation)}}class N extends v{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return s(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?_:V,e)}}class z extends j{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1,this.unlit=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const F=h(),E=h(),q=m(0,0,1),k=h(),G=h(),H=h(),L=h(),W=h();export{N as DefaultGLMaterial,B as DefaultMaterial,z as DefaultMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(t){super(),this.spherical=t,this.offsetBackfaces=!1,this.cullFace=0,this.pbrMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasPathSize=!1,this.hasPathColor=!1,this.hasPathOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1,this.doubleSidedMode=0,this.renderOccluded=!1}}t([o()],i.prototype,"offsetBackfaces",void 0),t([o({count:3})],i.prototype,"cullFace",void 0),t([o({count:7})],i.prototype,"pbrMode",void 0),t([o({count:8})],i.prototype,"emissionSource",void 0),t([o({count:2})],i.prototype,"upVectorAlignment",void 0),t([o({count:4})],i.prototype,"pathCapType",void 0),t([o({count:2})],i.prototype,"pathProfileType",void 0),t([o()],i.prototype,"receiveShadows",void 0),t([o()],i.prototype,"hasShadowHighlights",void 0),t([o()],i.prototype,"receiveAmbientOcclusion",void 0),t([o()],i.prototype,"hasVVSize",void 0),t([o()],i.prototype,"hasVVColor",void 0),t([o()],i.prototype,"hasVVOpacity",void 0),t([o()],i.prototype,"hasPathSize",void 0),t([o()],i.prototype,"hasPathColor",void 0),t([o()],i.prototype,"hasPathOpacity",void 0),t([o()],i.prototype,"hasOccludees",void 0),t([o()],i.prototype,"snowCover",void 0),t([o()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
2
+ import{__decorate as t}from"tslib";import{parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as e}from"./TriangleTechniqueConfiguration.js";class i extends e{constructor(t){super(),this.spherical=t,this.offsetBackfaces=!1,this.cullFace=0,this.pbrMode=0,this.emissionSource=0,this.upVectorAlignment=0,this.pathCapType=3,this.pathProfileType=0,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.hasPathSize=!1,this.hasPathColor=!1,this.hasPathOpacity=!1,this.hasOccludees=!1,this.snowCover=!1,this.receiveGlobalIllumination=!1,this.supportNaN=!0,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.draped=!1,this.overlayEnabled=!1,this.doubleSidedMode=0,this.renderOccluded=!1}}t([o()],i.prototype,"offsetBackfaces",void 0),t([o({count:3})],i.prototype,"cullFace",void 0),t([o({count:8})],i.prototype,"pbrMode",void 0),t([o({count:8})],i.prototype,"emissionSource",void 0),t([o({count:2})],i.prototype,"upVectorAlignment",void 0),t([o({count:4})],i.prototype,"pathCapType",void 0),t([o({count:2})],i.prototype,"pathProfileType",void 0),t([o()],i.prototype,"receiveShadows",void 0),t([o()],i.prototype,"hasShadowHighlights",void 0),t([o()],i.prototype,"receiveAmbientOcclusion",void 0),t([o()],i.prototype,"hasVVSize",void 0),t([o()],i.prototype,"hasVVColor",void 0),t([o()],i.prototype,"hasVVOpacity",void 0),t([o()],i.prototype,"hasPathSize",void 0),t([o()],i.prototype,"hasPathColor",void 0),t([o()],i.prototype,"hasPathOpacity",void 0),t([o()],i.prototype,"hasOccludees",void 0),t([o()],i.prototype,"snowCover",void 0),t([o()],i.prototype,"receiveGlobalIllumination",void 0);export{i as PathTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"../materials/TriangleTechniqueConfiguration.js";class s extends o{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.receiveGlobalIllumination=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1,this.renderOccluded=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}}e([t({count:4})],s.prototype,"alphaDiscardMode",void 0),e([t({count:3})],s.prototype,"doubleSidedMode",void 0),e([t({count:7})],s.prototype,"pbrMode",void 0),e([t({count:3})],s.prototype,"cullFace",void 0),e([t({count:3})],s.prototype,"normalType",void 0),e([t({count:3})],s.prototype,"customDepthTest",void 0),e([t({count:8})],s.prototype,"emissionSource",void 0),e([t()],s.prototype,"hasVertexColors",void 0),e([t()],s.prototype,"hasSymbolColors",void 0),e([t()],s.prototype,"hasVerticalOffset",void 0),e([t()],s.prototype,"hasColorTexture",void 0),e([t()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([t()],s.prototype,"hasOcclusionTexture",void 0),e([t()],s.prototype,"hasNormalTexture",void 0),e([t()],s.prototype,"hasScreenSizePerspective",void 0),e([t()],s.prototype,"hasVertexTangents",void 0),e([t()],s.prototype,"hasOccludees",void 0),e([t()],s.prototype,"instanced",void 0),e([t()],s.prototype,"instancedDoublePrecision",void 0),e([t()],s.prototype,"hasModelTransformation",void 0),e([t()],s.prototype,"offsetBackfaces",void 0),e([t()],s.prototype,"hasVVSize",void 0),e([t()],s.prototype,"hasVVColor",void 0),e([t()],s.prototype,"receiveShadows",void 0),e([t()],s.prototype,"hasShadowHighlights",void 0),e([t()],s.prototype,"receiveAmbientOcclusion",void 0),e([t()],s.prototype,"receiveGlobalIllumination",void 0),e([t()],s.prototype,"textureAlphaPremultiplied",void 0),e([t()],s.prototype,"instancedFeatureAttribute",void 0),e([t()],s.prototype,"instancedColor",void 0),e([t()],s.prototype,"writeDepth",void 0),e([t()],s.prototype,"snowCover",void 0),e([t()],s.prototype,"hasColorTextureTransform",void 0),e([t()],s.prototype,"hasEmissionTextureTransform",void 0),e([t()],s.prototype,"hasNormalTextureTransform",void 0),e([t()],s.prototype,"hasOcclusionTextureTransform",void 0),e([t()],s.prototype,"hasMetallicRoughnessTextureTransform",void 0);export{s as DefaultMaterialTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"../materials/TriangleTechniqueConfiguration.js";class s extends o{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.receiveAmbientOcclusion=!1,this.receiveGlobalIllumination=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1,this.renderOccluded=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}}e([t({count:4})],s.prototype,"alphaDiscardMode",void 0),e([t({count:3})],s.prototype,"doubleSidedMode",void 0),e([t({count:8})],s.prototype,"pbrMode",void 0),e([t({count:3})],s.prototype,"cullFace",void 0),e([t({count:3})],s.prototype,"normalType",void 0),e([t({count:3})],s.prototype,"customDepthTest",void 0),e([t({count:8})],s.prototype,"emissionSource",void 0),e([t()],s.prototype,"hasVertexColors",void 0),e([t()],s.prototype,"hasSymbolColors",void 0),e([t()],s.prototype,"hasVerticalOffset",void 0),e([t()],s.prototype,"hasColorTexture",void 0),e([t()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([t()],s.prototype,"hasOcclusionTexture",void 0),e([t()],s.prototype,"hasNormalTexture",void 0),e([t()],s.prototype,"hasScreenSizePerspective",void 0),e([t()],s.prototype,"hasVertexTangents",void 0),e([t()],s.prototype,"hasOccludees",void 0),e([t()],s.prototype,"instanced",void 0),e([t()],s.prototype,"instancedDoublePrecision",void 0),e([t()],s.prototype,"hasModelTransformation",void 0),e([t()],s.prototype,"offsetBackfaces",void 0),e([t()],s.prototype,"hasVVSize",void 0),e([t()],s.prototype,"hasVVColor",void 0),e([t()],s.prototype,"receiveShadows",void 0),e([t()],s.prototype,"hasShadowHighlights",void 0),e([t()],s.prototype,"receiveAmbientOcclusion",void 0),e([t()],s.prototype,"receiveGlobalIllumination",void 0),e([t()],s.prototype,"textureAlphaPremultiplied",void 0),e([t()],s.prototype,"instancedFeatureAttribute",void 0),e([t()],s.prototype,"instancedColor",void 0),e([t()],s.prototype,"writeDepth",void 0),e([t()],s.prototype,"snowCover",void 0),e([t()],s.prototype,"hasColorTextureTransform",void 0),e([t()],s.prototype,"hasEmissionTextureTransform",void 0),e([t()],s.prototype,"hasNormalTextureTransform",void 0),e([t()],s.prototype,"hasOcclusionTextureTransform",void 0),e([t()],s.prototype,"hasMetallicRoughnessTextureTransform",void 0);export{s as DefaultMaterialTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.overlayMode=0,this.tileBlendInput=0,this.transparencyMode=0,this.pbrMode=5,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.textureFadingEnabled=!1,this.renderOccluded=!1,this.screenSpaceReflections=!1,this.cloudReflections=!1,this.receiveAmbientOcclusion=!1,this.receiveGlobalIllumination=!1,this.tileBorders=!1,this.normalType=1,this.textureCoordinateType=1,this.emissionSource=0,this.rayMarchMaxReach=1,this.rayMarchMaxSteps=75,this.useProjectedRayLength=!1,this.clampRayToScreen=!0,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!0,this.draped=!1,this.oitPremultipliedAlpha=!0,this.snowCover=!1}get overlayEnabled(){return 0!==this.overlayMode}get hasWater(){return 11!==this.output}}e([t({count:3})],i.prototype,"overlayMode",void 0),e([t({count:3})],i.prototype,"tileBlendInput",void 0),e([t({count:4})],i.prototype,"transparencyMode",void 0),e([t({count:7})],i.prototype,"pbrMode",void 0),e([t()],i.prototype,"receiveShadows",void 0),e([t()],i.prototype,"hasShadowHighlights",void 0),e([t()],i.prototype,"textureFadingEnabled",void 0),e([t()],i.prototype,"renderOccluded",void 0),e([t()],i.prototype,"screenSpaceReflections",void 0),e([t()],i.prototype,"cloudReflections",void 0),e([t()],i.prototype,"receiveAmbientOcclusion",void 0),e([t()],i.prototype,"receiveGlobalIllumination",void 0),e([t()],i.prototype,"tileBorders",void 0);export{i as TerrainTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.overlayMode=0,this.tileBlendInput=0,this.transparencyMode=0,this.pbrMode=5,this.receiveShadows=!1,this.hasShadowHighlights=!1,this.textureFadingEnabled=!1,this.renderOccluded=!1,this.screenSpaceReflections=!1,this.cloudReflections=!1,this.receiveAmbientOcclusion=!1,this.receiveGlobalIllumination=!1,this.tileBorders=!1,this.normalType=1,this.textureCoordinateType=1,this.emissionSource=0,this.rayMarchMaxReach=1,this.rayMarchMaxSteps=75,this.useProjectedRayLength=!1,this.clampRayToScreen=!0,this.useCustomDTRExponentForWater=!1,this.useFillLights=!1,this.hasColorTexture=!0,this.draped=!1,this.oitPremultipliedAlpha=!0,this.snowCover=!1}get overlayEnabled(){return 0!==this.overlayMode}get hasWater(){return 11!==this.output}}e([t({count:3})],i.prototype,"overlayMode",void 0),e([t({count:3})],i.prototype,"tileBlendInput",void 0),e([t({count:4})],i.prototype,"transparencyMode",void 0),e([t({count:8})],i.prototype,"pbrMode",void 0),e([t()],i.prototype,"receiveShadows",void 0),e([t()],i.prototype,"hasShadowHighlights",void 0),e([t()],i.prototype,"textureFadingEnabled",void 0),e([t()],i.prototype,"renderOccluded",void 0),e([t()],i.prototype,"screenSpaceReflections",void 0),e([t()],i.prototype,"cloudReflections",void 0),e([t()],i.prototype,"receiveAmbientOcclusion",void 0),e([t()],i.prototype,"receiveGlobalIllumination",void 0),e([t()],i.prototype,"tileBorders",void 0);export{i as TerrainTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{createTask as p}from"../core/asyncUtils.js";import t from"../core/Error.js";import{generatorFlat as o,generatorFromPromises as s}from"../core/generatorUtils.js";import has from"../core/has.js";import i from"../core/Logger.js";import{allSettledValues as r,throwIfAborted as u,wrapAbortWithTimeout as n}from"../core/promiseUtils.js";import{watch as a,syncAndInitial as h,whenOnce as c}from"../core/reactiveUtils.js";import{property as l,subclass as m}from"../core/accessorSupport/decorators.js";import{addPopup as d,openPopupWithViewClick as f,isPopup as g,isPopupElement as w,openPopupWithOptions as y,closePopup as P}from"./popupAdapter.js";import{ViewEventPriorities as E}from"./input/InputManager.js";const _=_=>{const V=_;let j=class extends V{constructor(...e){super(...e),this._popupSetupTask=null,this.popupEnabled=!0,this.popup={}}initialize(){this.addHandles([a(()=>[this.ui,this.popup,this.popupElement],([e,p,t],o)=>{const[s,i,r]=o??[];d(this,[e,p,t],[s,i,r])},h),this.on("click",e=>{this.popup&&this.popupEnabled&&("mouse"!==e.pointerType||0===e.button)&&f(this,e)},E.WIDGET)]),c(()=>this.ready&&this.popupEnabled&&!this.updating).then(()=>import("../widgets/Popup.js"))}destroy(){this.destroyed||this.closePopup()}get popup(){return this._get("popup")}set popup(e){this._set("popup",e)}async openPopup(e){if(g(this.popup))return this.popup.open(e);if(this.popupElement&&w(this.popupElement)){if(e){const{fetchFeatures:p,title:t,...o}=e;delete e.fetchFeatures,Object.assign(this.popupElement,o),void 0!==t&&(this.popupElement.heading=t)}this.popupElement.open=!0}try{if(await this.setupPopup(),!this.popup)return void i.getLogger(this).error(new t("view:null-popup","Popup is null and can't be opened"));y(this,e)}catch{}}closePopup(){this._popupSetupTask?.abort(),P(this.popup,this.popupElement)}async*fetchPopupFeatures(e,p){await this.when();const t=await this._getPopupHits(e,p),i=this._popupHitsToFeatures(e,t.hits,p);yield*o(s(i,p),p)}async fetchPopupFeaturesLegacy(e,p){await this.when();const t=await this._getPopupHits(e,p),o=this._popupHitsToFeatures(e,t.hits,p);return{pendingFeatures:o,allGraphicsPromise:r(o).then(e=>e.filter(e=>!!e).flat()),location:t.location}}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!g(this.popup))return this._popupSetupTask=p(async e=>{if(!this.popupEnabled||!w(this.popupElement))if(this.dependencies.popup&&"function"==typeof this.dependencies.popup)await this.dependencies.popup(),u(e),customElements.get("arcgis-popup")||i.getLogger(this).error(new t("view:undefined-popup-element","`arcgis-popup` custom element is undefined and can't be opened")),this.popupElement=document.createElement("arcgis-popup");else{const{default:p}=await import("../widgets/Popup.js");if(u(e),!this.popup||g(this.popup))return;const t=this.popup;if("open"in t||"close"in t){const{open:e,close:o,...s}=t;this.popup=new p({...s})}else this.popup=new p(t)}}),this._popupSetupTask.promise}_popupHitsToFeatures(e,p,t){const o=[],s=[];let i=!1;const r=n(t,has("popup-view-fetch-timeout")??F),u=e=>{const p=new v(e);return s.push(p),o.push(p.promise),p},a=e=>{const p=s.at(-1);return p&&p.layerView===e&&!i?p:u(e)};for(const n of p)if("graphic"in n){a(n.layerView).graphics.push(n.graphic),i=!1}else o.push(n.layerView.fetchPopupFeaturesAtTarget(e,n.geometry,r)),i=!0;return s.forEach(e=>e.resolve(r)),o}async _getPopupHits(e,p){const{hits:t,location:o}=await this.popupHitTest(e);u(p);const s=[];for(const i of t)if("graphic"in i){if(this._isValidPopupGraphic(i.graphic,p)){const e=this._isFeaturePatchingLayerView(i.layerView)?i.layerView:void 0;s.push({graphic:i.graphic,layerView:e})}}else s.push({geometry:i.geometry,layerView:i.layerView});return{hits:s,location:o}}_isValidPopupGraphic(e,p){return e&&!!e.getEffectivePopupTemplate(p?.defaultPopupTemplateEnabled)}_isFeaturePatchingLayerView(e){return!e||(!("layer"in e)||!e.suspended)&&"patchFeaturesForPopup"in e}};return e([l()],j.prototype,"popup",null),e([l()],j.prototype,"popupElement",void 0),e([l()],j.prototype,"popupEnabled",void 0),j=e([m("esri.views.PopupView")],j),j};class v{constructor(e){this.layerView=e,this._resolver=Promise.withResolvers(),this.graphics=[]}get promise(){return this._resolver.promise}resolve(e){const{layerView:p,graphics:t,_resolver:o}=this;if(!p)return o.resolve(t),o.promise;let s;return p.patchFeaturesForPopup(t,e).catch(e=>(s=e,null)).then(e=>{e?o.resolve(e):o.reject(s)}),o.promise}}const F=5e3;export{_ as PopupView};
2
+ import{__decorate as e}from"tslib";import{createTask as p}from"../core/asyncUtils.js";import t from"../core/Error.js";import{generatorFlat as o,generatorFromPromises as s}from"../core/generatorUtils.js";import has from"../core/has.js";import i from"../core/Logger.js";import{allSettledValues as r,throwIfAborted as u,wrapAbortWithTimeout as n}from"../core/promiseUtils.js";import{watch as a,syncAndInitial as h,whenOnce as c}from"../core/reactiveUtils.js";import{property as l,subclass as m}from"../core/accessorSupport/decorators.js";import{addPopup as d,openPopupWithViewClick as f,isPopup as g,isPopupElement as w,openPopupWithOptions as y,closePopup as P}from"./popupAdapter.js";import{ViewEventPriorities as E}from"./input/InputManager.js";const _=_=>{const V=_;let j=class extends V{constructor(...e){super(...e),this._popupSetupTask=null,this.popupEnabled=!0,this.popup={}}initialize(){this.addHandles([a(()=>[this.ui,this.popup,this.popupElement],([e,p,t],o)=>{const[s,i,r]=o??[];d(this,[e,p,t],[s,i,r])},h),this.on("click",e=>{this.popup&&this.popupEnabled&&("mouse"!==e.pointerType||0===e.button)&&f(this,e).catch(()=>{})},E.WIDGET)]),c(()=>this.ready&&this.popupEnabled&&!this.updating).then(()=>import("../widgets/Popup.js"))}destroy(){this.destroyed||this.closePopup()}get popup(){return this._get("popup")}set popup(e){this._set("popup",e)}async openPopup(e){if(g(this.popup))return this.popup.open(e);if(this.popupElement&&w(this.popupElement)){if(e){const{fetchFeatures:p,title:t,...o}=e;delete e.fetchFeatures,Object.assign(this.popupElement,o),void 0!==t&&(this.popupElement.heading=t)}this.popupElement.open=!0}try{if(await this.setupPopup(),!this.popup)return void i.getLogger(this).error(new t("view:null-popup","Popup is null and can't be opened"));y(this,e)}catch{}}closePopup(){this._popupSetupTask?.abort(),P(this.popup,this.popupElement)}async*fetchPopupFeatures(e,p){await this.when();const t=await this._getPopupHits(e,p),i=this._popupHitsToFeatures(e,t.hits,p);yield*o(s(i,p),p)}async fetchPopupFeaturesLegacy(e,p){await this.when();const t=await this._getPopupHits(e,p),o=this._popupHitsToFeatures(e,t.hits,p);return{pendingFeatures:o,allGraphicsPromise:r(o).then(e=>e.filter(e=>!!e).flat()),location:t.location}}async setupPopup(){if(this._popupSetupTask?.abort(),this.popup&&!g(this.popup))return this._popupSetupTask=p(async e=>{if(!this.popupEnabled||!w(this.popupElement))if(this.dependencies.popup&&"function"==typeof this.dependencies.popup)await this.dependencies.popup(),u(e),customElements.get("arcgis-popup")||i.getLogger(this).error(new t("view:undefined-popup-element","`arcgis-popup` custom element is undefined and can't be opened")),this.popupElement=document.createElement("arcgis-popup");else{const{default:p}=await import("../widgets/Popup.js");if(u(e),!this.popup||g(this.popup))return;const t=this.popup;if("open"in t||"close"in t){const{open:e,close:o,...s}=t;this.popup=new p({...s})}else this.popup=new p(t)}}),this._popupSetupTask.promise}_popupHitsToFeatures(e,p,t){const o=[],s=[];let i=!1;const r=n(t,has("popup-view-fetch-timeout")??F),u=e=>{const p=new v(e);return s.push(p),o.push(p.promise),p},a=e=>{const p=s.at(-1);return p&&p.layerView===e&&!i?p:u(e)};for(const n of p)if("graphic"in n){a(n.layerView).graphics.push(n.graphic),i=!1}else o.push(n.layerView.fetchPopupFeaturesAtTarget(e,n.geometry,r)),i=!0;return s.forEach(e=>e.resolve(r)),o}async _getPopupHits(e,p){const{hits:t,location:o}=await this.popupHitTest(e);u(p);const s=[];for(const i of t)if("graphic"in i){if(this._isValidPopupGraphic(i.graphic,p)){const e=this._isFeaturePatchingLayerView(i.layerView)?i.layerView:void 0;s.push({graphic:i.graphic,layerView:e})}}else s.push({geometry:i.geometry,layerView:i.layerView});return{hits:s,location:o}}_isValidPopupGraphic(e,p){return e&&!!e.getEffectivePopupTemplate(p?.defaultPopupTemplateEnabled)}_isFeaturePatchingLayerView(e){return!e||(!("layer"in e)||!e.suspended)&&"patchFeaturesForPopup"in e}};return e([l()],j.prototype,"popup",null),e([l()],j.prototype,"popupElement",void 0),e([l()],j.prototype,"popupEnabled",void 0),j=e([m("esri.views.PopupView")],j),j};class v{constructor(e){this.layerView=e,this._resolver=Promise.withResolvers(),this.graphics=[]}get promise(){return this._resolver.promise}resolve(e){const{layerView:p,graphics:t,_resolver:o}=this;if(!p)return o.resolve(t),o.promise;let s;return p.patchFeaturesForPopup(t,e).catch(e=>(s=e,null)).then(e=>{e?o.resolve(e):o.reject(s)}),o.promise}}const F=5e3;export{_ as PopupView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{lerp as t,distance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as i}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as o,asVec2 as s,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/watch.js";import"../../../core/has.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as m}from"../../../core/screenUtils.js";import{RightAngleTriangleSnappingCandidate as c}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as l}from"../support/viewUtils.js";import{projectPointToCircle as g}from"../../support/geometry2dUtils.js";class d extends a{async snapNewVertex(t,e){const r=e.editGeometryOperations.data.parts.at(-1),i=[];if(!r)return i;const s=r.vertices.length;if("polygon"!==e.editGeometryOperations.data.type||s<2)return i;const{view:n}=this,p=r.vertices[0],a=r.vertices[s-1];if(a.leftSegment&&"line"!==a.leftSegment.type||a.rightSegment&&"line"!==a.rightSegment.type)return i;const m=o(p.pos,n,e),c=o(a.pos,n,e);return this._processCandidateProposal(m,c,t,e,i),i}async snapExistingVertex(t,e){const r=[],i=e.vertexHandle,{part:s,rightSegment:n,leftSegment:p}=i;if(s.segments.length<2)return r;if("polyline"===e.editGeometryOperations.data.type&&(0===i.index||i.index===s.vertices.length-1))return r;if("line"!==p?.type||n&&"line"!==n.type)return r;const a=n?.rightVertex??(s.autoClose?s.getFirstVertex():null);if(!a)return r;const{view:m}=this,c=o(p.leftVertex.pos,m,e),l=o(a.pos,m,e);return this._processCandidateProposal(c,l,t,e,r),r}_processCandidateProposal(r,o,a,d,f){if(!this.exceedsShortLineThreshold(r,o,d))return;const u=t(h,s(r),s(o),.5),j=.5*e(s(r),s(o)),y=g(h,s(a),u,j),x=n(p(y[0],y[1],a[2])),{spatialReference:v,pointer:S}=d,w=l(a,v,i,this.view);if(m(w,l(x,v,i,this.view))<this.squaredProximityThreshold(S)){if(this.isVertical(r,x,d)||this.isVertical(x,o,d))return;f.push(new c({targetPoint:x,point1:r,point2:o,isDraped:"on-the-ground"===d.elevationInfo?.mode}))}}}const h=r();export{d as RightAngleTriangleSnapper};
2
+ import{lerp as t,distance as e}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as i}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as o,asVec2 as s,markAsTarget as n,fromValues as p}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as a}from"./SnappingAlgorithm.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as m}from"../../../core/screenUtils.js";import{RightAngleTriangleSnappingCandidate as c}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as l}from"../support/viewUtils.js";import{projectPointToCircle as g}from"../../support/geometry2dUtils.js";class d extends a{async snapNewVertex(t,e){const r=e.editGeometryOperations.data.parts.at(-1),i=[];if(!r)return i;const s=r.vertices.length;if("polygon"!==e.editGeometryOperations.data.type||s<2)return i;const{view:n}=this,p=r.vertices[0],a=r.vertices[s-1];if(a.leftSegment&&"line"!==a.leftSegment.type||a.rightSegment&&"line"!==a.rightSegment.type)return i;const m=o(p.pos,n,e),c=o(a.pos,n,e);return this._processCandidateProposal(m,c,t,e,i),i}async snapExistingVertex(t,e){const r=[],i=e.vertexHandle,{part:s,rightSegment:n,leftSegment:p}=i;if(s.segments.length<2)return r;if("polyline"===e.editGeometryOperations.data.type&&(0===i.index||i.index===s.vertices.length-1))return r;if("line"!==p?.type||n&&"line"!==n.type)return r;const a=n?.rightVertex??(s.autoClose?s.getFirstVertex():null);if(!a)return r;const{view:m}=this,c=o(p.leftVertex.pos,m,e),l=o(a.pos,m,e);return this._processCandidateProposal(c,l,t,e,r),r}_processCandidateProposal(r,o,a,d,f){if(!this.exceedsShortLineThreshold(r,o,d))return;const u=t(h,s(r),s(o),.5),j=.5*e(s(r),s(o)),y=g(h,s(a),u,j),x=n(p(y[0],y[1],a[2])),{spatialReference:v,pointer:S}=d,w=l(a,v,i,this.view);if(m(w,l(x,v,i,this.view))<this.squaredProximityThreshold(S)){if(this.isVertical(r,x,d)||this.isVertical(x,o,d))return;f.push(new c({targetPoint:x,point1:r,point2:o,isDraped:"on-the-ground"===d.elevationInfo?.mode}))}}}const h=r();export{d as RightAngleTriangleSnapper};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{getMetersPerUnitForSR as e}from"../../../core/units.js";import{distance as r}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{absoluteHeightElevationInfo as t}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as s,asVec2 as i}from"../sketch/normalizedPoint.js";import{defaults as o}from"./Settings.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/watch.js";import"../../../core/has.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as h}from"../../../core/screenUtils.js";import{vectorToScreenPoint as n}from"../support/viewUtils.js";class p{constructor(e,r){this.view=e,this.options=r,this.squaredShortLineThreshold=o.shortLineThreshold*o.shortLineThreshold}async snap(e,r){return null!=r.vertexHandle?"vertex"!==r.vertexHandle.type?[]:this.snapExistingVertex(e,r):this.snapNewVertex(e,r)}edgeExceedsShortLineThreshold(e,r){return this.exceedsShortLineThreshold(s(e.leftVertex.pos,this.view,r),s(e.rightVertex.pos,this.view,r),r)}exceedsShortLineThreshold(e,r,{spatialReference:s}){return 0===this.squaredShortLineThreshold||h(n(r,s,t,this.view),n(e,s,t,this.view))>this.squaredShortLineThreshold}isVertical(t,s,{spatialReference:h}){const n=e(h);return r(i(t),i(s))*n<o.verticalLineThresholdMeters}squaredProximityThreshold(e){return"touch"===e?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:r}=this.options,t=e*r;return t*t}}export{p as SnappingAlgorithm};
2
+ import{getMetersPerUnitForSR as e}from"../../../core/units.js";import{distance as r}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{absoluteHeightElevationInfo as t}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as s,asVec2 as i}from"../sketch/normalizedPoint.js";import{defaults as o}from"./Settings.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as h}from"../../../core/screenUtils.js";import{vectorToScreenPoint as n}from"../support/viewUtils.js";class p{constructor(e,r){this.view=e,this.options=r,this.squaredShortLineThreshold=o.shortLineThreshold*o.shortLineThreshold}async snap(e,r){return null!=r.vertexHandle?"vertex"!==r.vertexHandle.type?[]:this.snapExistingVertex(e,r):this.snapNewVertex(e,r)}edgeExceedsShortLineThreshold(e,r){return this.exceedsShortLineThreshold(s(e.leftVertex.pos,this.view,r),s(e.rightVertex.pos,this.view,r),r)}exceedsShortLineThreshold(e,r,{spatialReference:s}){return 0===this.squaredShortLineThreshold||h(n(r,s,t,this.view),n(e,s,t,this.view))>this.squaredShortLineThreshold}isVertical(t,s,{spatialReference:h}){const n=e(h);return r(i(t),i(s))*n<o.verticalLineThresholdMeters}squaredProximityThreshold(e){return"touch"===e?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:r}=this.options,t=e*r;return t*t}}export{p as SnappingAlgorithm};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import s from"../../core/Accessor.js";import{createTask as t}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import n from"../../core/Logger.js";import{removeMaybe as r,destroyMaybe as l,abortMaybe as c}from"../../core/maybe.js";import{createAbortError as h,isAborted as w,onAbort as d}from"../../core/promiseUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";const _=Symbol("analyses-owner-handles");let u=class extends s{constructor(e){super(e),this._allAnalysisViews=new i,this._creatingViewCount=0,this._attachedToViewResolver=v(),this._items=new Map,this._moduleMap=new Map,this._scheduledUpdateHandle=null,this._emitOnView=(e,s)=>this.view.emit(e,s)}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(h("AnalysisViewManager was destroyed")),this._set("view",null)}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(h()),this._attachedToViewResolver=v()}get updating(){return!this.view.ready||0!==this._creatingViewCount||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const s=this._items.get(e);if(null==s||1===s.state.list){throw new a("AnalysisViewManager:no-analysis-view-for-analysis","The analysis does not exist in view.analyses",{analysis:e})}return s.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),_)}_disconnectOwners(){this.removeHandles(_),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const i of e)this._addAnalysis(i);const s=e.on("after-add",e=>this._addAnalysis(e.item)),t=e.on("after-remove",e=>this._removeAnalysis(e.item));return o(()=>{s.remove(),t.remove();for(const s of e)this._removeAnalysis(s)})}_addAnalysis(e){const s=this._items.get(e);if(null==s){const s={state:{view:0,list:0},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,s),s.createAnalysisViewTask=t(t=>this._createAnalysisViewPromise(s,t).then(s=>(this._emitOnView("analysis-view-create",{analysis:e,analysisView:s}),s),s=>{throw this._emitOnView("analysis-view-create-error",{analysis:e,error:s}),s}))}else s.state.list=0}_removeAnalysis(e){const s=this._items.get(e);null!=s?(s.state.list=1,this._scheduleUpdate()):n.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){null==this._scheduledUpdateHandle&&(this._scheduledUpdateHandle=y(()=>this._update()))}_update(){this._scheduledUpdateHandle=r(this._scheduledUpdateHandle),this._items.forEach(e=>{if(1!==e.state.list)return;const{analysis:s,view:t}=e;switch(this._items.delete(s),e.state.view){case 0:e.createAnalysisViewTask=c(e.createAnalysisViewTask);break;case 1:null!=t&&(this._allAnalysisViews.remove(t),e.view=l(t),e.createAnalysisViewTask=null,this._emitOnView("analysis-view-destroy",{analysis:s,analysisView:t}))}})}async _createAnalysisViewPromise(e,s){const{analysis:t}=e;if(this._creatingViewCount+=1,!this._moduleMap.has(t.type))try{this._moduleMap.set(t.type,await this.importAnalysisViewModule(t))}catch(n){throw this._creatingViewCount-=1,new a("AnalysisViewManager:no-analysis-view-for-analysis",`Analysis of type "${t.type}" is not supported`)}if(w(s))throw this._creatingViewCount-=1,h("AnalysisView creation aborted");const i=new(this._moduleMap.get(t.type).default)({analysis:t,view:this.view});let o=!0;d(s,()=>{o&&this._destroyAnalysisView(t,i,e)});try{await i.when()}catch(n){throw o=!1,this._destroyAnalysisView(t,i,e),n}if(w(s))throw h();return o=!1,e.view=i,e.state.view=1,this._allAnalysisViews.add(i),this._creatingViewCount-=1,i}_destroyAnalysisView(e,s,t){s.destroyed||(this._creatingViewCount-=1,s.destroy(),1===t.state.view&&this._emitOnView("analysis-view-destroy",{analysis:e,analysisView:s}))}};e([m()],u.prototype,"updating",null),e([m({constructOnly:!0})],u.prototype,"importAnalysisViewModule",void 0),e([m({constructOnly:!0})],u.prototype,"view",void 0),e([m()],u.prototype,"_allAnalysisViews",void 0),e([m()],u.prototype,"_creatingViewCount",void 0),u=e([p("esri.views.support.AnalysisViewManager")],u);const V=u;function v(){const e=Promise.withResolvers();return e.promise.catch(()=>{}),e}export{V as default};
2
+ import{__decorate as e}from"tslib";import s from"../../core/Accessor.js";import{createTask as t}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import"../../core/has.js";import n from"../../core/Logger.js";import{destroyMaybe as r,abortMaybe as l,removeMaybe as c}from"../../core/maybe.js";import{createAbortError as h,isAborted as d,onAbort as w}from"../../core/promiseUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";const m=Symbol("analyses-owner-handles");let u=class extends s{constructor(e){super(e),this._allAnalysisViews=new i,this._creatingViewCount=0,this._attachedToViewResolver=v(),this._items=new Map,this._moduleMap=new Map,this._scheduledUpdateHandle=null,this._emitOnView=(e,s)=>this.view.emit(e,s)}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(h("AnalysisViewManager was destroyed")),this._set("view",null)}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(h()),this._attachedToViewResolver=v()}get updating(){return!this.view.ready||null!=this._scheduledUpdateHandle||0!==this._creatingViewCount||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const s=this._items.get(e);if(null==s||1===s.state.list){throw new a("AnalysisViewManager:no-analysis-view-for-analysis","The analysis does not exist in view.analyses",{analysis:e})}return s.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),m)}_disconnectOwners(){this.removeHandles(m),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const i of e)this._addAnalysis(i);const s=e.on("after-add",e=>this._addAnalysis(e.item)),t=e.on("after-remove",e=>this._removeAnalysis(e.item));return o(()=>{s.remove(),t.remove();for(const s of e)this._removeAnalysis(s)})}_addAnalysis(e){const s=this._items.get(e);if(null==s){const s={state:{view:0,list:0},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,s),s.createAnalysisViewTask=t(t=>this._createAnalysisViewPromise(s,t).then(s=>(this._emitOnView("analysis-view-create",{analysis:e,analysisView:s}),s),s=>{throw this._emitOnView("analysis-view-create-error",{analysis:e,error:s}),s}))}else s.state.list=0}_removeAnalysis(e){const s=this._items.get(e);null!=s?(s.state.list=1,this._scheduleUpdate()):n.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){null==this._scheduledUpdateHandle&&(this._scheduledUpdateHandle=y(()=>this._update()))}_update(){this._items.forEach(e=>{if(1!==e.state.list)return;const{analysis:s,view:t}=e;switch(this._items.delete(s),e.state.view){case 0:e.createAnalysisViewTask=l(e.createAnalysisViewTask);break;case 1:null!=t&&(this._allAnalysisViews.remove(t),e.view=r(t),e.createAnalysisViewTask=null,this._emitOnView("analysis-view-destroy",{analysis:s,analysisView:t}))}}),this._scheduledUpdateHandle=c(this._scheduledUpdateHandle)}async _createAnalysisViewPromise(e,s){const{analysis:t}=e;if(this._creatingViewCount+=1,!this._moduleMap.has(t.type))try{this._moduleMap.set(t.type,await this.importAnalysisViewModule(t))}catch(n){throw this._creatingViewCount-=1,new a("AnalysisViewManager:no-analysis-view-for-analysis",`Analysis of type "${t.type}" is not supported`)}if(d(s))throw this._creatingViewCount-=1,h("AnalysisView creation aborted");const i=new(this._moduleMap.get(t.type).default)({analysis:t,view:this.view});let o=!0;w(s,()=>{o&&this._destroyAnalysisView(t,i,e)});try{await i.when()}catch(n){throw o=!1,this._destroyAnalysisView(t,i,e),n}if(d(s))throw h();return o=!1,e.view=i,e.state.view=1,this._allAnalysisViews.add(i),this._creatingViewCount-=1,i}_destroyAnalysisView(e,s,t){s.destroyed||(this._creatingViewCount-=1,s.destroy(),1===t.state.view&&this._emitOnView("analysis-view-destroy",{analysis:e,analysisView:s}))}};e([p()],u.prototype,"updating",null),e([p({constructOnly:!0})],u.prototype,"importAnalysisViewModule",void 0),e([p({constructOnly:!0})],u.prototype,"view",void 0),e([p()],u.prototype,"_allAnalysisViews",void 0),e([p()],u.prototype,"_creatingViewCount",void 0),e([p()],u.prototype,"_scheduledUpdateHandle",void 0),u=e([_("esri.views.support.AnalysisViewManager")],u);const V=u;function v(){const e=Promise.withResolvers();return e.promise.catch(()=>{}),e}export{V as default};