@arcgis/core 5.1.0-next.30 → 5.1.0-next.32

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 (284) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{dcdddbc02b7d7febc56d.js → 005fe95c3329cfe74219.js} +1 -1
  3. package/assets/esri/core/workers/chunks/00947268b6de12329146.js +1 -0
  4. package/assets/esri/core/workers/chunks/{2563ce0f18eb84a9971a.js → 0337138d3702a1a52ce0.js} +1 -1
  5. package/assets/esri/core/workers/chunks/0554f310066937098099.js +1 -0
  6. package/assets/esri/core/workers/chunks/087403b53f15eb4d375c.js +1 -0
  7. package/assets/esri/core/workers/chunks/0d156e14fc34d0600fd5.js +1 -0
  8. package/assets/esri/core/workers/chunks/{eb4934d3a3b82316c7c6.js → 0d196cf72cd8bef8d91d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{764d080f77dec5e7a02c.js → 0e7d3f3479fcb366cc6f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/0efe90bd43ab29dab8ae.js +1 -0
  11. package/assets/esri/core/workers/chunks/122ff8d0d428f31fc5d1.js +1 -0
  12. package/assets/esri/core/workers/chunks/{37d943d3f2c40468438c.js → 144acac9bb1aa78f1170.js} +1 -1
  13. package/assets/esri/core/workers/chunks/14e05d37e10ebba8cf10.js +1 -0
  14. package/assets/esri/core/workers/chunks/19722dfef06028ab399b.js +1 -0
  15. package/assets/esri/core/workers/chunks/1ff40e6057916e8482b3.js +1 -0
  16. package/assets/esri/core/workers/chunks/209d8ee81cc3ebb18b27.js +1 -0
  17. package/assets/esri/core/workers/chunks/22aeab5c363645c04806.js +1 -0
  18. package/assets/esri/core/workers/chunks/283ce37403c5e7a76e95.js +1 -0
  19. package/assets/esri/core/workers/chunks/29687aae97dc01f33fa6.js +1 -0
  20. package/assets/esri/core/workers/chunks/2d6165796af522858e56.js +1 -0
  21. package/assets/esri/core/workers/chunks/2f0e850ebea0ffd2708f.js +1 -0
  22. package/assets/esri/core/workers/chunks/34cdcee6d0ea595d7aed.js +1 -0
  23. package/assets/esri/core/workers/chunks/34f2e9d7466abc0919e7.js +1 -0
  24. package/assets/esri/core/workers/chunks/36f91b5c4345a179b8b1.js +1 -0
  25. package/assets/esri/core/workers/chunks/380bb57bccc266d6442a.js +1 -0
  26. package/assets/esri/core/workers/chunks/3b86e8eb553122d3b68d.js +1 -0
  27. package/assets/esri/core/workers/chunks/3b9de873f87f0feeb20b.js +1 -0
  28. package/assets/esri/core/workers/chunks/{f0bb986dce9cf75c890c.js → 3c597d8ef898627b8f93.js} +1 -1
  29. package/assets/esri/core/workers/chunks/3ca7f5cedf3cb747c0cf.js +1 -0
  30. package/assets/esri/core/workers/chunks/3d18b8c1c759c7240721.js +1 -0
  31. package/assets/esri/core/workers/chunks/3dcb4ee8b862689a141b.js +1 -0
  32. package/assets/esri/core/workers/chunks/{c814abf3e67d9eadbc6b.js → 414a802b6365688d31cb.js} +1 -1
  33. package/assets/esri/core/workers/chunks/446bc8461403ed1ac7b2.js +1 -0
  34. package/assets/esri/core/workers/chunks/4bfc6f8c2d13ca4d2082.js +1 -0
  35. package/assets/esri/core/workers/chunks/4ceba469398ef55de8ea.js +1 -0
  36. package/assets/esri/core/workers/chunks/54c1d31e1efab765ee7a.js +1 -0
  37. package/assets/esri/core/workers/chunks/{84073653ff50e5d3c47a.js → 55165b6b49b87c1aff8f.js} +24 -13
  38. package/assets/esri/core/workers/chunks/582d45a41e29005f6c63.js +1 -0
  39. package/assets/esri/core/workers/chunks/586bc903e2c285649bf2.js +1 -0
  40. package/assets/esri/core/workers/chunks/{aa3bdfd00f666c6cc521.js → 5b12865ac53d984d8149.js} +1 -1
  41. package/assets/esri/core/workers/chunks/5e5b358e603b13b4d7d7.js +1 -0
  42. package/assets/esri/core/workers/chunks/5f3b25b30acd7a07f5c0.js +1 -0
  43. package/assets/esri/core/workers/chunks/620965d2e1a9ccf81d43.js +1 -0
  44. package/assets/esri/core/workers/chunks/623bfacf4b9c9a5387cc.js +1 -0
  45. package/assets/esri/core/workers/chunks/63722607fbf8d411188d.js +1 -0
  46. package/assets/esri/core/workers/chunks/64870f555fefa85a5c59.js +1 -0
  47. package/assets/esri/core/workers/chunks/{0df585420c9cec6a7265.js → 666db81085bc97831b18.js} +1 -1
  48. package/assets/esri/core/workers/chunks/67de5225b2c66c9c7bc9.js +1 -0
  49. package/assets/esri/core/workers/chunks/696f645349249f26090c.js +1 -0
  50. package/assets/esri/core/workers/chunks/{57e375d8a8db9fa57193.js → 6e8cfe69617876ee0dac.js} +1 -1
  51. package/assets/esri/core/workers/chunks/6f3f7f785241edacdb8b.js +1 -0
  52. package/assets/esri/core/workers/chunks/{ee6f7c5d3c2f187645ff.js → 7411ca5e1876aaa0228e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{94563b007647a9c4ad76.js → 75cde632887a95ea20f2.js} +1 -1
  54. package/assets/esri/core/workers/chunks/776a7179d32fe62a37e3.js +1 -0
  55. package/assets/esri/core/workers/chunks/7ddb11a127b9458e9eac.js +1 -0
  56. package/assets/esri/core/workers/chunks/7ebd836b98d14c7d3ecf.js +1 -0
  57. package/assets/esri/core/workers/chunks/80f0810527743833b4b7.js +1 -0
  58. package/assets/esri/core/workers/chunks/828998d33a48be161782.js +1 -0
  59. package/assets/esri/core/workers/chunks/8bd24534ed185afcb124.js +1 -0
  60. package/assets/esri/core/workers/chunks/8d4ddaace906dd09de2c.js +1 -0
  61. package/assets/esri/core/workers/chunks/8e10e4c25869af9da5ba.js +1 -0
  62. package/assets/esri/core/workers/chunks/8eed5b6cac937099102c.js +1 -0
  63. package/assets/esri/core/workers/chunks/{71be4833a260714d3b2c.js → 917474f9dd2039b82e9d.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{c3a0b38abf0a12a466fa.js → 965b8fa54d0cfafd4a70.js} +1 -1
  65. package/assets/esri/core/workers/chunks/9813f25192ea27084754.js +1 -0
  66. package/assets/esri/core/workers/chunks/9a3e5053e95db36f26dc.js +1 -0
  67. package/assets/esri/core/workers/chunks/9cc1b44c5a325a840307.js +1 -0
  68. package/assets/esri/core/workers/chunks/9cd548ea00b641d8e65d.js +1 -0
  69. package/assets/esri/core/workers/chunks/a2d045217a42ecc36308.js +1 -0
  70. package/assets/esri/core/workers/chunks/{9417c32ad50970ffb61a.js → a3b29eca5807978fb2a3.js} +1 -1
  71. package/assets/esri/core/workers/chunks/a52a8254577840a23aba.js +1 -0
  72. package/assets/esri/core/workers/chunks/{1cbe564cfc9eb0723827.js → aa367ca7f8326fd67881.js} +1 -1
  73. package/assets/esri/core/workers/chunks/ad9194335902c687bb96.js +1 -0
  74. package/assets/esri/core/workers/chunks/ae72c530d52a6d4461be.js +1 -0
  75. package/assets/esri/core/workers/chunks/af601eb8c938c0720406.js +1 -0
  76. package/assets/esri/core/workers/chunks/b2cf19a28aa5c32a99e3.js +1 -0
  77. package/assets/esri/core/workers/chunks/b2f497339493926d4c9e.js +1 -0
  78. package/assets/esri/core/workers/chunks/b7a3a7f7fb747f9689d7.js +1 -0
  79. package/assets/esri/core/workers/chunks/b81780e5e7cd9a1a010a.js +1 -0
  80. package/assets/esri/core/workers/chunks/b98366d8a5bc6cc2b219.js +1 -0
  81. package/assets/esri/core/workers/chunks/bb7e0334f438daa665da.js +1 -0
  82. package/assets/esri/core/workers/chunks/{5690b49f355a5e2083a9.js → c17c3453d014dc73fe0b.js} +1 -1
  83. package/assets/esri/core/workers/chunks/c1be9c4e59925a897a91.js +1 -0
  84. package/assets/esri/core/workers/chunks/{0389ebb63510dd7024de.js → c24ce19ab8580364c703.js} +2 -2
  85. package/assets/esri/core/workers/chunks/c2882a9e67124b7c18be.js +1 -0
  86. package/assets/esri/core/workers/chunks/c6112dcd6b36e256d7b5.js +1 -0
  87. package/assets/esri/core/workers/chunks/c8ae8d1b456ace0b383b.js +1 -0
  88. package/assets/esri/core/workers/chunks/{3a018c78859b5edec4fd.js → ca700e9e1bced9f99899.js} +1 -1
  89. package/assets/esri/core/workers/chunks/cc8e6d1eb90221103023.js +1 -0
  90. package/assets/esri/core/workers/chunks/d0d836502321e7a80e61.js +1 -0
  91. package/assets/esri/core/workers/chunks/d2fa8bd3f4cd3cf6b436.js +1 -0
  92. package/assets/esri/core/workers/chunks/d4b97ca16d79809ed6f2.js +1 -0
  93. package/assets/esri/core/workers/chunks/e00000468fb8ec2b3d43.js +1 -0
  94. package/assets/esri/core/workers/chunks/e0d6292aaa3f8a796de3.js +1 -0
  95. package/assets/esri/core/workers/chunks/ee582bbe7365b678ec54.js +1 -0
  96. package/assets/esri/core/workers/chunks/f4053e4e2d6e678db48a.js +1 -0
  97. package/assets/esri/core/workers/chunks/f5dbda08d7fd4bed1c62.js +1 -0
  98. package/assets/esri/core/workers/chunks/{a7dbd38bc216713044fc.js → fe21b2d31fbf83224e6b.js} +1 -1
  99. package/assets/esri/core/workers/chunks/ff8de370abf661768380.js +1 -0
  100. package/assets/esri/themes/base/widgets/_FeatureTable.scss +2 -0
  101. package/assets/esri/themes/base/widgets/_Grid.scss +14 -0
  102. package/assets/esri/themes/dark/main.css +1 -1
  103. package/assets/esri/themes/light/main.css +1 -1
  104. package/assets/esri/themes/light/view.css +1 -1
  105. package/chunks/HUDMaterial.glsl.js +34 -45
  106. package/chunks/LineCallout.glsl.js +10 -14
  107. package/config.js +1 -1
  108. package/core/timeUtils.js +1 -1
  109. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  110. package/kernel.js +1 -1
  111. package/layers/VoxelWasmPerSceneView.js +1 -1
  112. package/package.json +2 -2
  113. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  114. package/support/actions/ActionBase.d.ts +8 -0
  115. package/support/actions/ActionBase.js +1 -1
  116. package/support/actions/ActionButton.js +1 -1
  117. package/support/actions/ActionToggle.js +1 -1
  118. package/support/basemapDefinitions.js +1 -1
  119. package/support/revision.js +1 -1
  120. package/symbols/CIMSymbol.d.ts +3 -3
  121. package/symbols/ExtrudeSymbol3DLayer.d.ts +1 -1
  122. package/symbols/FillSymbol.d.ts +1 -1
  123. package/symbols/FillSymbol3DLayer.d.ts +1 -1
  124. package/symbols/IconSymbol3DLayer.d.ts +1 -1
  125. package/symbols/LabelSymbol3D.d.ts +1 -1
  126. package/symbols/LineSymbol.d.ts +1 -1
  127. package/symbols/LineSymbol3D.d.ts +1 -1
  128. package/symbols/LineSymbol3DLayer.d.ts +1 -1
  129. package/symbols/LineSymbolMarker.d.ts +1 -1
  130. package/symbols/MarkerSymbol.d.ts +1 -1
  131. package/symbols/MeshSymbol3D.d.ts +1 -1
  132. package/symbols/ObjectSymbol3DLayer.d.ts +1 -1
  133. package/symbols/PathSymbol3DLayer.d.ts +1 -1
  134. package/symbols/PictureFillSymbol.d.ts +1 -1
  135. package/symbols/PictureMarkerSymbol.d.ts +1 -1
  136. package/symbols/PointSymbol3D.d.ts +1 -1
  137. package/symbols/PolygonSymbol3D.d.ts +1 -1
  138. package/symbols/SimpleFillSymbol.d.ts +1 -1
  139. package/symbols/SimpleLineSymbol.d.ts +1 -1
  140. package/symbols/SimpleMarkerSymbol.d.ts +1 -1
  141. package/symbols/Symbol.d.ts +1 -1
  142. package/symbols/Symbol3D.d.ts +1 -1
  143. package/symbols/Symbol3DLayer.d.ts +1 -1
  144. package/symbols/TextSymbol.d.ts +1 -1
  145. package/symbols/TextSymbol3DLayer.d.ts +1 -1
  146. package/symbols/WebStyleSymbol.d.ts +1 -1
  147. package/time/TimeExtent.js +1 -1
  148. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  149. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
  150. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  151. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  152. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  153. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  154. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  155. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  156. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  159. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  160. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  161. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  162. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  163. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  164. package/views/3d/webgl/RenderNode.js +1 -1
  165. package/views/3d/webgl-engine/collections/Component/ComponentDrawParameters.js +1 -1
  166. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  167. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  168. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  169. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  170. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +13 -3
  171. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +27 -9
  172. package/views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js +7 -6
  173. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  174. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  175. package/views/3d/webgl-engine/effects/highlight/HighlightApplyTechnique.js +1 -1
  176. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +1 -1
  177. package/views/3d/webgl-engine/effects/highlight/HighlightDownsampleTechnique.js +1 -1
  178. package/views/3d/webgl-engine/effects/highlight/HighlightToSingleTechnique.js +1 -1
  179. package/views/3d/webgl-engine/effects/ssao/SSAOBlurTechnique.js +1 -1
  180. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  181. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  182. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  183. package/views/3d/webgl-engine/effects/transparency/OITDimTechnique.js +1 -1
  184. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  185. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  186. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  187. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  188. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  189. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  190. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  191. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  192. package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
  193. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  194. package/views/3d/webgl.js +1 -1
  195. package/views/VideoView.js +1 -1
  196. package/views/draw/DrawTool.js +1 -1
  197. package/views/webgl/RenderingContext.js +1 -1
  198. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  199. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  200. package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +3 -3
  201. package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
  202. package/widgets/Popup/actions.js +1 -1
  203. package/widgets/Sketch/SketchViewModel.js +1 -1
  204. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  205. package/widgets/TimeSlider.js +1 -1
  206. package/assets/esri/core/workers/chunks/011b31df019b3ce2277e.js +0 -1
  207. package/assets/esri/core/workers/chunks/018859b79f9ce7528ac7.js +0 -1
  208. package/assets/esri/core/workers/chunks/05e5b9082c0a396df7e5.js +0 -1
  209. package/assets/esri/core/workers/chunks/0711c856144cd8700e7e.js +0 -1
  210. package/assets/esri/core/workers/chunks/0ca9953afaea7c7e11e0.js +0 -1
  211. package/assets/esri/core/workers/chunks/1482262d0788ee65ddf7.js +0 -1
  212. package/assets/esri/core/workers/chunks/15d7c9f5a55985ed00b4.js +0 -1
  213. package/assets/esri/core/workers/chunks/16b9ac49d13057b3aff5.js +0 -1
  214. package/assets/esri/core/workers/chunks/172137cc98be03de1436.js +0 -1
  215. package/assets/esri/core/workers/chunks/179b3385c24ad8a05e1d.js +0 -1
  216. package/assets/esri/core/workers/chunks/18a40606e4c39f244ecd.js +0 -1
  217. package/assets/esri/core/workers/chunks/19cb4720e92ac3c0478c.js +0 -1
  218. package/assets/esri/core/workers/chunks/1d697642fb2a6332b7f9.js +0 -1
  219. package/assets/esri/core/workers/chunks/2003dae2d7f6d52ea643.js +0 -1
  220. package/assets/esri/core/workers/chunks/209acb3ad16c99bb506c.js +0 -1
  221. package/assets/esri/core/workers/chunks/23079a2e584fca0bdb66.js +0 -1
  222. package/assets/esri/core/workers/chunks/2e06baf6469820697f17.js +0 -1
  223. package/assets/esri/core/workers/chunks/2ecfd6edab796194bf88.js +0 -1
  224. package/assets/esri/core/workers/chunks/2f3aeaa25a76ab94b8e5.js +0 -1
  225. package/assets/esri/core/workers/chunks/33de1d899a4fa9ab6ab1.js +0 -1
  226. package/assets/esri/core/workers/chunks/359d3ba9d6e3b1de05d1.js +0 -1
  227. package/assets/esri/core/workers/chunks/36fd18a05ba503e6f3b5.js +0 -1
  228. package/assets/esri/core/workers/chunks/38d5dd4d457428244302.js +0 -1
  229. package/assets/esri/core/workers/chunks/3a8f2f6ac3c3e7e71c00.js +0 -1
  230. package/assets/esri/core/workers/chunks/3ad1edf199e7159f3cc2.js +0 -1
  231. package/assets/esri/core/workers/chunks/452d71789a1b77cff48d.js +0 -1
  232. package/assets/esri/core/workers/chunks/48a56b19bf825f05cc6e.js +0 -1
  233. package/assets/esri/core/workers/chunks/48e66b78274b82478bae.js +0 -1
  234. package/assets/esri/core/workers/chunks/48fb1520cb8c5ce248d9.js +0 -1
  235. package/assets/esri/core/workers/chunks/4e9b3b4b3dcce94c99a5.js +0 -1
  236. package/assets/esri/core/workers/chunks/5028de543cc1b8e60e65.js +0 -1
  237. package/assets/esri/core/workers/chunks/544bfa97837770a8792f.js +0 -1
  238. package/assets/esri/core/workers/chunks/55d4483b1862077e3732.js +0 -1
  239. package/assets/esri/core/workers/chunks/561484ab6ed564e4b90f.js +0 -1
  240. package/assets/esri/core/workers/chunks/592f6bf0283152481f21.js +0 -1
  241. package/assets/esri/core/workers/chunks/5b70ee8122262de5bbdf.js +0 -1
  242. package/assets/esri/core/workers/chunks/6138a528c3820af81bc6.js +0 -1
  243. package/assets/esri/core/workers/chunks/72cd450b24fdfcef6547.js +0 -1
  244. package/assets/esri/core/workers/chunks/75fd96fd9557ac1f8e10.js +0 -1
  245. package/assets/esri/core/workers/chunks/777b0e07f72c42470d36.js +0 -1
  246. package/assets/esri/core/workers/chunks/7b297a2f712361bfae2e.js +0 -1
  247. package/assets/esri/core/workers/chunks/7d274a077bdfa8c485e8.js +0 -1
  248. package/assets/esri/core/workers/chunks/7dd1e93469d0b1d652bc.js +0 -1
  249. package/assets/esri/core/workers/chunks/835a929e37811d0f82cb.js +0 -1
  250. package/assets/esri/core/workers/chunks/843c505148ed728d3c30.js +0 -1
  251. package/assets/esri/core/workers/chunks/8dcc8df5925f66e45b8c.js +0 -1
  252. package/assets/esri/core/workers/chunks/8eae33c4d8932b7a6bc1.js +0 -1
  253. package/assets/esri/core/workers/chunks/91e56959b2fddf1a9743.js +0 -1
  254. package/assets/esri/core/workers/chunks/925980d26d71987ac80c.js +0 -1
  255. package/assets/esri/core/workers/chunks/9bd5c56f879eb935d906.js +0 -1
  256. package/assets/esri/core/workers/chunks/aa9c11f25d95372998a3.js +0 -1
  257. package/assets/esri/core/workers/chunks/aec33bdb355bd04f28ae.js +0 -1
  258. package/assets/esri/core/workers/chunks/af618a1c55c15e17189b.js +0 -1
  259. package/assets/esri/core/workers/chunks/b35ea099334c867bde02.js +0 -1
  260. package/assets/esri/core/workers/chunks/b4254fcb2051c873f2ba.js +0 -1
  261. package/assets/esri/core/workers/chunks/b730131e52f9220db031.js +0 -1
  262. package/assets/esri/core/workers/chunks/b81824d62be92ab595f7.js +0 -1
  263. package/assets/esri/core/workers/chunks/b9d68a5dcb50999d3a90.js +0 -1
  264. package/assets/esri/core/workers/chunks/bae7376b554cac4a8f96.js +0 -1
  265. package/assets/esri/core/workers/chunks/bcd701892ee120e13a18.js +0 -1
  266. package/assets/esri/core/workers/chunks/c1c006c86cf31f934684.js +0 -1
  267. package/assets/esri/core/workers/chunks/cb6a7ca4ba2cf0b5ced7.js +0 -1
  268. package/assets/esri/core/workers/chunks/d70678598f4080adfb39.js +0 -1
  269. package/assets/esri/core/workers/chunks/d72d5031887373d35610.js +0 -1
  270. package/assets/esri/core/workers/chunks/d8896c57a414f2450190.js +0 -1
  271. package/assets/esri/core/workers/chunks/da780342f16e65b55ac8.js +0 -1
  272. package/assets/esri/core/workers/chunks/db005d9419bb718b3962.js +0 -1
  273. package/assets/esri/core/workers/chunks/e063cce778944fe97dd3.js +0 -1
  274. package/assets/esri/core/workers/chunks/e2bdb0e87422e222646e.js +0 -1
  275. package/assets/esri/core/workers/chunks/e4faccd48060349b8da1.js +0 -1
  276. package/assets/esri/core/workers/chunks/ea245d3a6fd601fffd88.js +0 -1
  277. package/assets/esri/core/workers/chunks/efb2a8879011d2d77a81.js +0 -1
  278. package/assets/esri/core/workers/chunks/f6c9742691ccdaed44a2.js +0 -1
  279. package/assets/esri/core/workers/chunks/f82a95c46f0d579d5bf5.js +0 -1
  280. package/assets/esri/core/workers/chunks/fd9ef90e2ebb7fed62b1.js +0 -1
  281. package/assets/esri/core/workers/chunks/feac196493ccd087de35.js +0 -1
  282. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +0 -19
  283. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js +0 -9
  284. /package/assets/esri/core/workers/chunks/{0389ebb63510dd7024de.js.LICENSE.txt → c24ce19ab8580364c703.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as u,transformMat4 as f,normalize as p,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as P,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as j}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as U}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as N,writeBufferFloat as G,writeBufferVec3 as q,writeBufferZeros as X,writeBufferVec4 as Y,writeOlidColor as k}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as J}from"./internal/MaterialUtil.js";import{c as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends L{constructor(e,t,i=!1){super(e,Ve),this.produces=new Map([[14,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[15,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[16,e=>M(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.useVisibilityPixel],[20,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ee(t,i)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.useVisibilityPixel=this.parameters.useVisibilityPixel,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,this._configuration.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,this._configuration.hasVertexColor=this.parameters.hasVertexColor,this._configuration.hasVertexSize=this.parameters.hasVertexSize,this._configuration.hasVertexRotation=this.parameters.hasVertexRotation,this._configuration.hasVertexUVi=this.parameters.hasVertexUVi,this._configuration.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,w(e)&&(this._configuration.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasOcclusionTexture=this._configuration.transparentOccluded&&0!==t.oitPass,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:h},point:O,camera:z}=s,{parameters:_}=this;if(!l||!c||h&&_.isLabel||!e.visible||!O||!z)return;const P=e.attributes.get("featureAttribute"),C=null==P?null:V(P.data,xe),{scaleX:j,scaleY:D}=Ce(C,_,z.pixelRatio),R=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),w=e.attributes.get("rotation"),F=e.attributes.get("centerOffset"),T=this.parameters.size;E(R.size>=3);const U=K(_),L="screen"===this.parameters.centerOffsetUnits;for(let V=0;V<R.data.length/R.size;V++){const e=V*R.size;if(u(le,R.data[e],R.data[e+1],R.data[e+2]),f(le,le,t),f(le,le,z.viewMatrix),F){const e=V*F.size;u(be,F.data[e],F.data[e+1],F.data[e+2])}else u(be,0,0,0);if(!L&&(le[0]+=be[0],le[1]+=be[1],0!==be[2])){const e=be[2];p(be,le),m(le,le,d(be,be,e))}const a=V*M.size;u(ce,M.data[a],M.data[a+1],M.data[a+2]),g(ce,ce,i(de,t));const{normal:n,cosAngle:l}=ae(ce,z,Se),c=De(this.parameters,le,l,z,oe);if(b(le,le,n,c),z.applyProjection(le,he),he[0]>-1){if(L&&(be[0]||be[1])&&(he[0]+=be[0]*z.pixelRatio,0!==be[1]&&(he[1]+=oe.alignmentEvaluator.apply(be[1])*z.pixelRatio),z.unapplyProjection(he,le)),he[0]+=this.parameters.screenOffset[0]*z.pixelRatio,he[1]+=this.parameters.screenOffset[1]*z.pixelRatio,he[0]=Math.floor(he[0]),he[1]=Math.floor(he[1]),ye[0]=T[0],ye[1]=T[1],null!=A){const e=V*A.size;ye[0]*=A.data[e],ye[1]*=A.data[e+1]}oe.evaluator.applyVec2(ye,ye);const e=Oe*z.pixelRatio;let t=0;if(_.textureIsSignedDistanceField){t=Math.min(_.outlineSize,.5*ye[0])*z.pixelRatio/2}ye[0]*=j,ye[1]*=D;const i=_.rotation+(null!=w?w.data[V*w.size]:0);if(ne(O,he[0],he[1],ye,e,t,i,_,U)){const e=s.ray;if(f(fe,le,r(ge,z.viewMatrix)),he[0]=O[0],he[1]=O[1],z.unprojectFromRenderScreen(he,le)){const t=y();v(t,e.direction);const i=1/x(t);d(t,t,i);o(S(e.origin,le)*i,t,-1,fe)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=K(l),h=l.size,u=e.attributes.get("featureAttribute"),f=null==u?null:V(u.data,xe),{scaleX:p,scaleY:m}=Ce(f,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let g=0;g<a.data.length/a.size;g++){const t=g*a.size,u=a.data[t],f=a.data[t+1];if(ye[0]=h[0],ye[1]=h[1],null!=n){const e=g*n.size;ye[0]*=n.data[e],ye[1]*=n.data[e+1]}let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*ye[0])*e.screenToWorldRatio/2}ye[0]*=p,ye[1]*=m;const v=l.rotation+(null!=o?o.data[g*o.size]:0);ne(i,u,f,ye,d,b,v,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Pe(this.parameters)}applyShaderOffsets(e,t,s,r,a,n,o,l){g(ue,s,i(de,r));const c=ae(ue,o,Se),h=je(x(t),o),u=De(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,u+h),b(e,e,ue,u+h);const f=n+u;this._applyPolygonOffsetView(t,c,f,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,i,s,r,a){return this._applyCenterOffsetNDC(e,t,s,r),null!=a&&v(a,r),this._applyPolygonOffsetNDC(r,i,s,r),r}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(i.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&v(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ce,i),O(i,i,d(ce,ce,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&v(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=j()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends U{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,i){return f(i.normal,e,t.viewInverseTransposeMatrix),i.cosAngle=z(i.normal,_e),i}function ne(e,i,s,r,a,l,c,h,u){let f=i-a-r[0]*u[0],p=f+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=h.distanceFieldBoundingBox;return h.textureIsSignedDistanceField&&null!=g&&(f+=r[0]*g[0],m+=r[1]*g[1],p-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),f-=l,p+=l,m-=l,d+=l),n(me,i,s),o(pe,e,me,t(c)),pe[0]>f&&pe[0]<p&&pe[1]>m&&pe[1]<d}const oe=new B,le=y(),ce=y(),he=C(),ue=y(),fe=y(),pe=h(),me=h(),de=s(),ge=a(),be=y(),ve=y(),xe=C(),Se={normal:y(),cosAngle:0},Oe=1,ze=2,ye=c(0,0),_e=_(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=P,this.size=l,this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=P,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.useVisibilityPixel=!0,this.occludedVisibilityMode="hidden",this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Pe{constructor(e){this.baseInstanceLayout=Q,this.layout=Z(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:u,groundDistance:f,featureAttribute:p,uvi:m}=r;I(i.get("position"),e,n,a),W(i.get("normal"),t,o,a);const d=i.get("position").indices.length;if(m){const e=i.get("uvi")?.data;if(e&&e.length>=4){const[t,i,s,r]=e;for(let e=0;e<d;++e){const n=a+e;m.setValues(n,t,i,s,r)}}}if(l&&H(i.get("color"),4,l,a),c&&N(i.get("size"),c,a),h&&G(i.get("rotation"),h,a),u&&(i.get("centerOffset")?q(i.get("centerOffset"),u,a):X(u,a,d)),i.get("groundDistance")?G(i.get("groundDistance"),f,a):X(f,a,d),p&&(i.get("featureAttribute")?Y(i.get("featureAttribute"),p,a):X(p,a,d)),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);k(s,i,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:i}=t;N(e.get("uv0"),i,0)}}function Ce(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(R(ve,t,e),{scaleX:ve[0]*i,scaleY:ve[1]*i})}function je(e,t){const i=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*i}function De(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=x(t);return r.update(i,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=J(s,a,e.verticalOffset,i,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ie as HUDMaterial,Ve as Parameters};
2
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as u,transformMat4 as f,normalize as p,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as P,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as j}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as U}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as N,writeBufferFloat as G,writeBufferVec3 as q,writeBufferZeros as X,writeBufferVec4 as Y,writeOlidColor as k}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as J}from"./internal/MaterialUtil.js";import{c as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends L{constructor(e,t,i=!1){super(e,Ve),this.produces=new Map([[14,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[15,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[16,e=>M(e)&&this.parameters.drawAsLabel],[20,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ee(t,i)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,this._configuration.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,this._configuration.depthTestEnabled=this.parameters.depthEnabled,this._configuration.hasVertexColor=this.parameters.hasVertexColor,this._configuration.hasVertexSize=this.parameters.hasVertexSize,this._configuration.hasVertexRotation=this.parameters.hasVertexRotation,this._configuration.hasVertexUVi=this.parameters.hasVertexUVi,this._configuration.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,w(e)&&(this._configuration.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasOcclusionTexture=this._configuration.transparentOccluded&&0!==t.oitPass,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:h},point:O,camera:z}=s,{parameters:y}=this;if(!l||!c||h&&y.isLabel||!e.visible||!O||!z)return;const P=e.attributes.get("featureAttribute"),C=null==P?null:V(P.data,xe),{scaleX:j,scaleY:D}=Ce(C,y,z.pixelRatio),R=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),w=e.attributes.get("rotation"),F=e.attributes.get("centerOffset"),T=this.parameters.size;E(R.size>=3);const U=K(y),L="screen"===this.parameters.centerOffsetUnits;for(let V=0;V<R.data.length/R.size;V++){const e=V*R.size;if(u(le,R.data[e],R.data[e+1],R.data[e+2]),f(le,le,t),f(le,le,z.viewMatrix),F){const e=V*F.size;u(be,F.data[e],F.data[e+1],F.data[e+2])}else u(be,0,0,0);if(!L&&(le[0]+=be[0],le[1]+=be[1],0!==be[2])){const e=be[2];p(be,le),m(le,le,d(be,be,e))}const a=V*M.size;u(ce,M.data[a],M.data[a+1],M.data[a+2]),g(ce,ce,i(de,t));const{normal:n,cosAngle:l}=ae(ce,z,Se),c=De(this.parameters,le,l,z,oe);if(b(le,le,n,c),z.applyProjection(le,he),he[0]>-1){if(L&&(be[0]||be[1])&&(he[0]+=be[0]*z.pixelRatio,0!==be[1]&&(he[1]+=oe.alignmentEvaluator.apply(be[1])*z.pixelRatio),z.unapplyProjection(he,le)),he[0]+=this.parameters.screenOffset[0]*z.pixelRatio,he[1]+=this.parameters.screenOffset[1]*z.pixelRatio,he[0]=Math.floor(he[0]),he[1]=Math.floor(he[1]),_e[0]=T[0],_e[1]=T[1],null!=A){const e=V*A.size;_e[0]*=A.data[e],_e[1]*=A.data[e+1]}oe.evaluator.applyVec2(_e,_e);const e=Oe*z.pixelRatio;let t=0;if(y.textureIsSignedDistanceField){t=Math.min(y.outlineSize,.5*_e[0])*z.pixelRatio/2}_e[0]*=j,_e[1]*=D;const i=y.rotation+(null!=w?w.data[V*w.size]:0);if(ne(O,he[0],he[1],_e,e,t,i,y,U)){const e=s.ray;if(f(fe,le,r(ge,z.viewMatrix)),he[0]=O[0],he[1]=O[1],z.unprojectFromRenderScreen(he,le)){const t=_();v(t,e.direction);const i=1/x(t);d(t,t,i);o(S(e.origin,le)*i,t,-1,fe)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=K(l),h=l.size,u=e.attributes.get("featureAttribute"),f=null==u?null:V(u.data,xe),{scaleX:p,scaleY:m}=Ce(f,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let g=0;g<a.data.length/a.size;g++){const t=g*a.size,u=a.data[t],f=a.data[t+1];if(_e[0]=h[0],_e[1]=h[1],null!=n){const e=g*n.size;_e[0]*=n.data[e],_e[1]*=n.data[e+1]}let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*_e[0])*e.screenToWorldRatio/2}_e[0]*=p,_e[1]*=m;const v=l.rotation+(null!=o?o.data[g*o.size]:0);ne(i,u,f,_e,d,b,v,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Pe(this.parameters)}applyShaderOffsets(e,t,s,r,a,n,o,l){g(ue,s,i(de,r));const c=ae(ue,o,Se),h=je(x(t),o),u=De(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,u+h),b(e,e,ue,u+h);const f=n+u;this._applyPolygonOffsetView(t,c,f,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,i,s,r,a){return this._applyCenterOffsetNDC(e,t,s,r),null!=a&&v(a,r),this._applyPolygonOffsetNDC(r,i,s,r),r}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(i.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&v(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ce,i),O(i,i,d(ce,ce,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&v(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=j()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends U{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,i){return f(i.normal,e,t.viewInverseTransposeMatrix),i.cosAngle=z(i.normal,ye),i}function ne(e,i,s,r,a,l,c,h,u){let f=i-a-r[0]*u[0],p=f+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=h.distanceFieldBoundingBox;return h.textureIsSignedDistanceField&&null!=g&&(f+=r[0]*g[0],m+=r[1]*g[1],p-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),f-=l,p+=l,m-=l,d+=l),n(me,i,s),o(pe,e,me,t(c)),pe[0]>f&&pe[0]<p&&pe[1]>m&&pe[1]<d}const oe=new B,le=_(),ce=_(),he=C(),ue=_(),fe=_(),pe=h(),me=h(),de=s(),ge=a(),be=_(),ve=_(),xe=C(),Se={normal:_(),cosAngle:0},Oe=1,ze=2,_e=c(0,0),ye=y(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=P,this.size=l,this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=P,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occludedVisibilityMode="hidden",this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Pe{constructor(e){this.baseInstanceLayout=Q,this.layout=Z(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:u,groundDistance:f,featureAttribute:p,uvi:m}=r;I(i.get("position"),e,n,a),W(i.get("normal"),t,o,a);const d=i.get("position").indices.length;if(m){const e=i.get("uvi")?.data;if(e&&e.length>=4){const[t,i,s,r]=e;for(let e=0;e<d;++e){const n=a+e;m.setValues(n,t,i,s,r)}}}if(l&&H(i.get("color"),4,l,a),c&&N(i.get("size"),c,a),h&&G(i.get("rotation"),h,a),u&&(i.get("centerOffset")?q(i.get("centerOffset"),u,a):X(u,a,d)),i.get("groundDistance")?G(i.get("groundDistance"),f,a):X(f,a,d),p&&(i.get("featureAttribute")?Y(i.get("featureAttribute"),p,a):X(p,a,d)),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);k(s,i,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:i}=t;N(e.get("uv0"),i,0)}}function Ce(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(R(ve,t,e),{scaleX:ve[0]*i,scaleY:ve[1]*i})}function je(e,t){const i=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*i}function De(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=x(t);return r.update(i,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=J(s,a,e.verticalOffset,i,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ie as HUDMaterial,Ve as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import r from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as l,writeBufferVec3 as u,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as g}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as m}from"../../../../webscene/support/AlphaCutoff.js";class d extends s{constructor(e,t){super(e,O),this.intersectDraped=void 0,this.produces=new Map([[17,e=>i(e)],[18,e=>i(e)]]),this._configuration=new g(t),this._uniqueMaterialIdentifier=b(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.useVisibilityPixel=this.parameters.useVisibilityPixel,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=18===t.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=m||(this.parameters.borderColor?.[3]??0)>=m}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new P}validateParameters(e){this._uniqueMaterialIdentifier=b(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function b({renderOccluded:t,isDecoration:i,horizontalScreenOffset:r,color:s,size:n,useVisibilityPixel:a,shaderPolygonOffset:o,hudDepthAlignStart:l,centerOffsetUnits:u,hasSlicePlane:c,screenSizePerspective:h,verticalOffset:f,borderColor:p}){return e`${t}:${i}:${r}:[${s}]:${n}:${a}:${o}:${l}:${u}:${c}:${null!=h}:{${f?.screenLength}:${f?.minWorldLength}:${f?.maxWorldLength}}:[${p}]`}class S extends r{beginSlot(e){return this.getTechnique(h,e)}}class O extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.useVisibilityPixel=!1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class P{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:i}=t;a(e.get("uv0"),i,0)}write(e,t,i,r,s,n){return o(i.get("position"),e,s.position,n),l(i.get("normal"),t,s.normal,n),u(i.get("centerOffset"),s.centerOffset,n),c(i.get("groundDistance"),s.groundDistance,n),null}}export{d as LineCalloutMaterial,O as Parameters,b as uniqueMaterialIdentifier};
2
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as g}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as m}from"../../../../webscene/support/AlphaCutoff.js";class d extends s{constructor(e,t){super(e,$),this.intersectDraped=void 0,this.produces=new Map([[17,e=>r(e)],[18,e=>r(e)]]),this._configuration=new g(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=18===t.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=m||(this.parameters.borderColor?.[3]??0)>=m}intersect(){}createGLMaterial(e){return new O(e)}createBufferWriter(){return new _}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class _{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s,n){return o(r.get("position"),e,s.position,n),c(r.get("normal"),t,s.normal,n),l(r.get("centerOffset"),s.centerOffset,n),u(r.get("groundDistance"),s.groundDistance,n),null}}export{d as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import"../core/shaderLibrary/hud/HUDVisibility.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/output/ReadDepth.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/focusArea/FocusAreaColorNode.js";import"./alphaCutoff.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,c as calculateAnchorPosition}from"../../../../chunks/HUDMaterial.glsl.js";
2
+ import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/output/ReadDepth.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/focusArea/FocusAreaColorNode.js";import"./alphaCutoff.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,c as calculateAnchorPosition}from"../../../../chunks/HUDMaterial.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{newLayout as o}from"../../support/buffer/InterleavedLayout.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as a}from"../effects/geometry/olidUtils.js";import{blending as l}from"../lib/OrderIndependentTransparency.js";import{H as c}from"../../../../chunks/HUDMaterial.glsl.js";import{PrimitiveType as u}from"../../../webgl/enums.js";import{makePipelineState as f,defaultColorWrite as p,defaultDepthWrite as m}from"../../../webgl/renderState.js";let d=class extends n{constructor(e,r){super(e,r,t(g).concat(t(v(r)))),this.shader=new i(c,()=>import("./HUDMaterial.glsl.js")),this.ignoreUnused=!0,this.primitiveType=r.occlusionPass?u.POINTS:u.TRIANGLE_STRIP}initializePipeline(e){const{oitPass:r,hasPolygonOffset:t,draped:o,output:i,depthTestEnabled:n,occlusionPass:a}=e,c=n&&!o&&!(1===r)&&!a&&!(8===i);return f({blending:s(i)?l(r,!0):null,depthTest:n&&!o?{func:515}:null,depthWrite:c?m:null,colorWrite:p,polygonOffset:t?h:null})}};d=e([r("esri.views.3d.webgl-engine.shaders.HUDMaterialTechnique")],d);const h={factor:0,units:-4},g=o().vec2u8("uv0",{glNormalized:!0});function v(e){let r=o().vec3f("position").vec3f("normal").f32("groundDistance");return e.hasVertexCenterOffset&&(r=r.vec3f("centerOffset")),e.hasVertexColor&&(r=r.vec4u8("color",{glNormalized:!0})),e.hasVertexSize&&(r=r.vec2f("size")),e.hasVertexRotation&&(r=r.f32("rotation")),(e.hasVVColor||e.hasVVSize)&&(r=r.vec4f("featureAttribute")),e.hasVertexUVi&&(r=r.vec4i16("uvi")),a()?r.vec4u8("olidColor"):r}export{d as HUDMaterialTechnique,g as baseLayout,v as getInstanceLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{newLayout as o}from"../../support/buffer/InterleavedLayout.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as a}from"../effects/geometry/olidUtils.js";import{blending as l}from"../lib/OrderIndependentTransparency.js";import{H as c}from"../../../../chunks/HUDMaterial.glsl.js";import{PrimitiveType as f}from"../../../webgl/enums.js";import{makePipelineState as u,defaultColorWrite as p,defaultDepthWrite as m}from"../../../webgl/renderState.js";let d=class extends n{constructor(e,r){super(e,r,t(g).concat(t(v(r)))),this.shader=new i(c,()=>import("./HUDMaterial.glsl.js")),this.ignoreUnused=!0,this.primitiveType=f.TRIANGLE_STRIP}initializePipeline(e){const{oitPass:r,hasPolygonOffset:t,draped:o,output:i,depthTestEnabled:n}=e,a=n&&!o&&!(1===r)&&!(8===i);return u({blending:s(i)?l(r,!0):null,depthTest:n&&!o?{func:515}:null,depthWrite:a?m:null,colorWrite:p,polygonOffset:t?h:null})}};d=e([r("esri.views.3d.webgl-engine.shaders.HUDMaterialTechnique")],d);const h={factor:0,units:-4},g=o().vec2u8("uv0",{glNormalized:!0});function v(e){let r=o().vec3f("position").vec3f("normal").f32("groundDistance");return e.hasVertexCenterOffset&&(r=r.vec3f("centerOffset")),e.hasVertexColor&&(r=r.vec4u8("color",{glNormalized:!0})),e.hasVertexSize&&(r=r.vec2f("size")),e.hasVertexRotation&&(r=r.f32("rotation")),(e.hasVVColor||e.hasVVSize)&&(r=r.vec4f("featureAttribute")),e.hasVertexUVi&&(r=r.vec4i16("uvi")),a()?r.vec4u8("olidColor"):r}export{d as HUDMaterialTechnique,g as baseLayout,v as getInstanceLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/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,t){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.useVisibilityPixel=!0,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hasRotation=!1,this.debugDrawLabelBorder=!1,this.hasPolygonOffset=!1,this.depthTestEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.occludedFragmentFade=!1,this.hasOcclusionTexture=!1,this.hasFocusAreaStyle=!1,this.hasVertexColor=!0,this.hasVertexSize=!0,this.hasVertexRotation=!0,this.hasVertexUVi=!0,this.hasVertexCenterOffset=!0,this.olidColorInstanced=!1,this.textureCoordinateType=0,this.emissionSource=0,this.discardInvisibleFragments=!0,this.hasVVInstancing=!1,this.snowCover=!1,this.transparentOccluded=t}}e([t()],i.prototype,"transparentOccluded",void 0),e([t()],i.prototype,"screenCenterOffsetUnitsEnabled",void 0),e([t()],i.prototype,"useVisibilityPixel",void 0),e([t()],i.prototype,"signedDistanceFieldEnabled",void 0),e([t()],i.prototype,"sampleSignedDistanceFieldTexelCenter",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVerticalOffset",void 0),e([t()],i.prototype,"hasScreenSizePerspective",void 0),e([t()],i.prototype,"hasRotation",void 0),e([t()],i.prototype,"debugDrawLabelBorder",void 0),e([t()],i.prototype,"hasPolygonOffset",void 0),e([t()],i.prototype,"depthTestEnabled",void 0),e([t()],i.prototype,"pixelSnappingEnabled",void 0),e([t()],i.prototype,"draped",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"occlusionPass",void 0),e([t()],i.prototype,"occludedFragmentFade",void 0),e([t()],i.prototype,"hasOcclusionTexture",void 0),e([t()],i.prototype,"hasFocusAreaStyle",void 0),e([t()],i.prototype,"hasVertexColor",void 0),e([t()],i.prototype,"hasVertexSize",void 0),e([t()],i.prototype,"hasVertexRotation",void 0),e([t()],i.prototype,"hasVertexUVi",void 0),e([t()],i.prototype,"hasVertexCenterOffset",void 0);export{i as HUDMaterialTechniqueConfiguration};
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,t){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hasRotation=!1,this.debugDrawLabelBorder=!1,this.hasPolygonOffset=!1,this.depthTestEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occludedFragmentFade=!1,this.hasOcclusionTexture=!1,this.hasFocusAreaStyle=!1,this.hasVertexColor=!0,this.hasVertexSize=!0,this.hasVertexRotation=!0,this.hasVertexUVi=!0,this.hasVertexCenterOffset=!0,this.olidColorInstanced=!1,this.textureCoordinateType=0,this.emissionSource=0,this.discardInvisibleFragments=!0,this.hasVVInstancing=!1,this.snowCover=!1,this.transparentOccluded=t}}e([t()],i.prototype,"transparentOccluded",void 0),e([t()],i.prototype,"screenCenterOffsetUnitsEnabled",void 0),e([t()],i.prototype,"signedDistanceFieldEnabled",void 0),e([t()],i.prototype,"sampleSignedDistanceFieldTexelCenter",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVerticalOffset",void 0),e([t()],i.prototype,"hasScreenSizePerspective",void 0),e([t()],i.prototype,"hasRotation",void 0),e([t()],i.prototype,"debugDrawLabelBorder",void 0),e([t()],i.prototype,"hasPolygonOffset",void 0),e([t()],i.prototype,"depthTestEnabled",void 0),e([t()],i.prototype,"pixelSnappingEnabled",void 0),e([t()],i.prototype,"draped",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"occludedFragmentFade",void 0),e([t()],i.prototype,"hasOcclusionTexture",void 0),e([t()],i.prototype,"hasFocusAreaStyle",void 0),e([t()],i.prototype,"hasVertexColor",void 0),e([t()],i.prototype,"hasVertexSize",void 0),e([t()],i.prototype,"hasVertexRotation",void 0),e([t()],i.prototype,"hasVertexUVi",void 0),e([t()],i.prototype,"hasVertexCenterOffset",void 0);export{i as HUDMaterialTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/hud/HUDVisibility.glsl.js";import"../core/shaderLibrary/shading/MultipassGeometryTest.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../chunks/LineCallout.glsl.js";
2
+ import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/shading/MultipassGeometryTest.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderModules/Float2BindUniform.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build}from"../../../../chunks/LineCallout.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as i}from"../materials/DefaultTechniqueConfiguration.js";class s extends i{constructor(e){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.useVisibilityPixel=!0,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hudDepth=!1,this.hudDepthAlignStart=!1,this.terrainDepthTest=!1,this.writeDepth=!1,this.draped=!1,this.discardInvisibleFragments=!0,this.oitPremultipliedAlpha=!0,this.snowCover=!1,this.emissionSource=0,this.textureCoordinateType=0,this.hasVertexCenterOffset=!0}}e([t()],s.prototype,"screenCenterOffsetUnitsEnabled",void 0),e([t()],s.prototype,"useVisibilityPixel",void 0),e([t()],s.prototype,"hasVerticalOffset",void 0),e([t()],s.prototype,"hasScreenSizePerspective",void 0),e([t()],s.prototype,"hudDepth",void 0),e([t()],s.prototype,"hudDepthAlignStart",void 0),e([t()],s.prototype,"terrainDepthTest",void 0);export{s as LineCalloutTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as i}from"../materials/DefaultTechniqueConfiguration.js";class r extends i{constructor(e){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hudDepth=!1,this.hudDepthAlignStart=!1,this.terrainDepthTest=!1,this.writeDepth=!1,this.draped=!1,this.discardInvisibleFragments=!0,this.oitPremultipliedAlpha=!0,this.snowCover=!1,this.emissionSource=0,this.textureCoordinateType=0,this.hasVertexCenterOffset=!0}}e([t()],r.prototype,"screenCenterOffsetUnitsEnabled",void 0),e([t()],r.prototype,"hasVerticalOffset",void 0),e([t()],r.prototype,"hasScreenSizePerspective",void 0),e([t()],r.prototype,"hudDepth",void 0),e([t()],r.prototype,"hudDepthAlignStart",void 0),e([t()],r.prototype,"terrainDepthTest",void 0);export{r as LineCalloutTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{disposeMaybe as t}from"../../../../core/maybe.js";import{recordPerformance as e}from"../../../../core/performance.js";import r from"../../../../core/PerformanceSampler.js";import{Milliseconds as i}from"../../../../core/time.js";import{RenderNodeOutput as s,InternalRenderCategory as a}from"../../webgl.js";import{createElapsedTimerPool as m}from"../../../webgl/TimerPool.js";const o={OVERLAY:"overlay",PREPARE:"prepare",SHADOW_MAP:"shadow map",DEPTH:"depth",ACCUMULATED_SHADOWS:"accumulated shadows",APPLY_ACCUMULATED_SHADOWS:"apply accumulated shadows",OBJECT_AND_LAYER_ID_COLOR:"object/layer id color",NORMALS:"normals",SSAO:"SSAO",HIGHLIGHTS:"highlights",OPAQUE_EDGES:"opaque edges",VOXEL:"voxel",TRANSPARENT:"transparent",TRANSPARENT_EDGES:"transparent edges",HUD_VISIBILITY:"HUD visibility",TRANSPARENT_TERRAIN:"transparent terrain",TRANSPARENT_MATERIAL_WITHOUT_DEPTH:"transparent material without depth",OPAQUE_ENVIRONMENT:"opaque environment",TRANSPARENT_ENVIRONMENT:"transparent environment",OCCLUDED:"occluded",HUD:"HUD",HUD_OCCLUDED:"HUD occluded",FINISH:"finish",FOCUS_AREA_MASK:"focus area mask"},l=Object.values(s).concat(Object.values(a)).concat(Object.values(o)),p="Total";class T{constructor(t){this._rctx=t,this._startTimeStampCPU=i(0),this._lastTimeStampCPU=i(0),this._totalCPUTime=new r(p),this._cpuTimeSamplers=new Map(l.map(t=>[t,new r(t)])),this._enableGPUTimer=0,this._totalGPUTime=new r("GPU"),this._gpuTimeSamplers=new Map(l.map(t=>[t,new r(t)])),this._totalTime=i(0),this._totalFrameCount=0}get totalCPUTimeSampler(){return this._totalCPUTime}get cpuTimeSamplers(){return Array.from(this._cpuTimeSamplers.values())}get totalGPUTimeSampler(){return this._totalGPUTime}get gpuTimeSamplers(){return Array.from(this._gpuTimeSamplers.values())}get gpuSamplingEnabled(){return null!=this._gpuTimerPool}get totalTime(){return this._totalTime}get totalFrameCount(){return this._totalFrameCount}get elapsedTime(){return i(performance.now()-this._startTimeStampCPU)}enableGPUPerformanceInfo(){if(null==this._gpuTimerPool){const t=[...l,p];this._gpuTimerPool=m(this._rctx,t)}if(null==this._gpuTimerPool)return{hasGPUTimerSupport:!1,remove:()=>{}};++this._enableGPUTimer;let e=!1;return{hasGPUTimerSupport:!0,remove:()=>{e||(e=!0,--this._enableGPUTimer,0===this._enableGPUTimer&&(this._gpuTimerPool=t(this._gpuTimerPool)))}}}startFrame(){this._startTimeStampCPU=this._lastTimeStampCPU=i(performance.now()),this._gpuTimerPool&&(this._gpuTimeSamplers.forEach(t=>t.push(0)),this._gpuTimerPool.start())}advance(t){const r=i(performance.now());if(this._cpuTimeSamplers.get(t).push(r-this._lastTimeStampCPU),e(t,this._lastTimeStampCPU,r,"Maps SDK","Scheduling"),this._lastTimeStampCPU=r,this._gpuTimerPool){const e=this._gpuTimerPool.stop(t);this._gpuTimeSamplers.get(t).set(e),this._gpuTimerPool.start()}}finishFrame(){if(this._gpuTimerPool){const t=this._gpuTimerPool.stop(o.FINISH);this._gpuTimeSamplers.get(o.FINISH).set(t),this._rctx.gl.flush()}const t=i(performance.now()-this._startTimeStampCPU);this._totalTime=i(this._totalTime+t),this._totalCPUTime.push(t),this._gpuTimerPool&&this._totalGPUTime.push(this.gpuTimeSamplers.reduce((t,e)=>t+(e.last||0),0)),++this._totalFrameCount}}export{l as PerformanceCategories,o as PerformanceCategory,T as RendererPerformanceInfo};
2
+ import{disposeMaybe as t}from"../../../../core/maybe.js";import{recordPerformance as e}from"../../../../core/performance.js";import r from"../../../../core/PerformanceSampler.js";import{Milliseconds as i}from"../../../../core/time.js";import{RenderNodeOutput as a,InternalRenderCategory as s}from"../../webgl.js";import{createElapsedTimerPool as m}from"../../../webgl/TimerPool.js";const o={OVERLAY:"overlay",PREPARE:"prepare",SHADOW_MAP:"shadow map",DEPTH:"depth",ACCUMULATED_SHADOWS:"accumulated shadows",APPLY_ACCUMULATED_SHADOWS:"apply accumulated shadows",OBJECT_AND_LAYER_ID_COLOR:"object/layer id color",NORMALS:"normals",SSAO:"SSAO",HIGHLIGHTS:"highlights",OPAQUE_EDGES:"opaque edges",TRANSPARENT:"transparent",TRANSPARENT_EDGES:"transparent edges",TRANSPARENT_TERRAIN:"transparent terrain",TRANSPARENT_MATERIAL_WITHOUT_DEPTH:"transparent material without depth",OPAQUE_ENVIRONMENT:"opaque environment",TRANSPARENT_ENVIRONMENT:"transparent environment",OCCLUDED:"occluded",HUD:"HUD",HUD_OCCLUDED:"HUD occluded",FINISH:"finish",FOCUS_AREA_MASK:"focus area mask"},p=Object.values(a).concat(Object.values(s)).concat(Object.values(o)),l="Total";class T{constructor(t){this._rctx=t,this._startTimeStampCPU=i(0),this._lastTimeStampCPU=i(0),this._totalCPUTime=new r(l),this._cpuTimeSamplers=new Map(p.map(t=>[t,new r(t)])),this._enableGPUTimer=0,this._totalGPUTime=new r("GPU"),this._gpuTimeSamplers=new Map(p.map(t=>[t,new r(t)])),this._totalTime=i(0),this._totalFrameCount=0}get totalCPUTimeSampler(){return this._totalCPUTime}get cpuTimeSamplers(){return Array.from(this._cpuTimeSamplers.values())}get totalGPUTimeSampler(){return this._totalGPUTime}get gpuTimeSamplers(){return Array.from(this._gpuTimeSamplers.values())}get gpuSamplingEnabled(){return null!=this._gpuTimerPool}get totalTime(){return this._totalTime}get totalFrameCount(){return this._totalFrameCount}get elapsedTime(){return i(performance.now()-this._startTimeStampCPU)}enableGPUPerformanceInfo(){if(null==this._gpuTimerPool){const t=[...p,l];this._gpuTimerPool=m(this._rctx,t)}if(null==this._gpuTimerPool)return{hasGPUTimerSupport:!1,remove:()=>{}};++this._enableGPUTimer;let e=!1;return{hasGPUTimerSupport:!0,remove:()=>{e||(e=!0,--this._enableGPUTimer,0===this._enableGPUTimer&&(this._gpuTimerPool=t(this._gpuTimerPool)))}}}startFrame(){this._startTimeStampCPU=this._lastTimeStampCPU=i(performance.now()),this._gpuTimerPool&&(this._gpuTimeSamplers.forEach(t=>t.push(0)),this._gpuTimerPool.start())}advance(t){const r=i(performance.now());if(this._cpuTimeSamplers.get(t).push(r-this._lastTimeStampCPU),e(t,this._lastTimeStampCPU,r,"Maps SDK","Scheduling"),this._lastTimeStampCPU=r,this._gpuTimerPool){const e=this._gpuTimerPool.stop(t);this._gpuTimeSamplers.get(t).set(e),this._gpuTimerPool.start()}}finishFrame(){if(this._gpuTimerPool){const t=this._gpuTimerPool.stop(o.FINISH);this._gpuTimeSamplers.get(o.FINISH).set(t),this._rctx.gl.flush()}const t=i(performance.now()-this._startTimeStampCPU);this._totalTime=i(this._totalTime+t),this._totalCPUTime.push(t),this._gpuTimerPool&&this._totalGPUTime.push(this.gpuTimeSamplers.reduce((t,e)=>t+(e.last||0),0)),++this._totalFrameCount}}export{p as PerformanceCategories,o as PerformanceCategory,T as RendererPerformanceInfo};
package/views/3d/webgl.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as p}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as f}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as u}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as R,viewModeDependentUtil as A}from"./support/viewingModeUtils.js";const d={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},E=[d.FINAL,d.COMPOSITE,d.OPAQUE,d.TRANSPARENT],T={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_DEPTH:"cutfill-depth",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GAUSSIAN_SPLAT:"gaussian-splat",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserline-color",MAGNIFIER:"magnifier-color",OCCLUDED:"occluded-color",OPAQUE_ENVIRONMENT:"opaque-environment-color",OPAQUE_TERRAIN:"opaque-terrain-color",SSAO:"ssao",TRANSPARENT_ENVIRONMENT:"transparent-environment-color",VIEWSHED:"viewshed-color"},O=Array.from(Object.values(T)).concat(E);function g(o,e,r,t,i,n,c){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,c)?i:null}function j(o,e,r,t,i,n,c){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,c)?t:null}function N(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function S(r,t,i){const n=r.renderSpatialReference,c=R(r,t.eye,t.viewForward,t.up,C);let s=r.spatialReference;return f(t.eye,n,I,s)||(s=a.WGS84,f(t.eye,n,I,s)),null==i?i=new o(new l(I,s),c.heading,c.tilt,e(t.fov)):(i.position.x=I[0],i.position.y=I[1],i.position.z=I[2],i.position.spatialReference=s,i.heading=c.heading,i.tilt=c.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function y(o,e){if(!e)return null;const t=o.renderSpatialReference,l=A(o).headingTiltToDirectionUp,a=c();if(!p(e.position,a,t))return null;const s=l(a,e.heading,e.tilt);i(s.direction,s.direction,o.state.camera.distance),n(s.direction,s.direction,a);const m=u(o,a,s.direction,s.up);return m.fov=r(e.fov),m.row=e.layout.row,m.rows=e.layout.rows,m.column=e.layout.column,m.columns=e.layout.columns,m}const I=c(),C={heading:0,tilt:0};export{O as AllInternalRenderNodeOutputs,E as AllRenderNodeOutputs,T as InternalRenderCategory,d as RenderNodeOutput,S as fromRenderCamera,j as fromRenderCoordinates,N as renderCoordinateTransformAt,y as toRenderCamera,g as toRenderCoordinates};
2
+ import o from"../../Camera.js";import{rad2deg as e,deg2rad as r}from"../../core/mathUtils.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as i,add as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as s}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as m}from"../../geometry/projection/projectBuffer.js";import{projectPointToVector as p}from"../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as f}from"../../geometry/projection/projectVectorToVector.js";import{cameraOnContentAlongViewDirection as u}from"./camera/intersectionUtils.js";import{directionToHeadingTilt as R,viewModeDependentUtil as d}from"./support/viewingModeUtils.js";const A={OPAQUE:"opaque-color",TRANSPARENT:"transparent-color",COMPOSITE:"composite-color",FINAL:"final-color"},E=[A.FINAL,A.COMPOSITE,A.OPAQUE,A.TRANSPARENT],T={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_DEPTH:"cutfill-depth",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",PRE_TRANSPARENT:"pre-transparent-color",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserline-color",MAGNIFIER:"magnifier-color",OCCLUDED:"occluded-color",OPAQUE_ENVIRONMENT:"opaque-environment-color",SSAO:"ssao",TRANSPARENT_ENVIRONMENT:"transparent-environment-color",VIEWSHED:"viewshed-color"},j=Array.from(Object.values(T)).concat(E);function O(o,e,r,t,i,n,c){return t=t||o.spatialReference,m(e,t,r,i,o.renderCoordsHelper.spatialReference,n,c)?i:null}function g(o,e,r,t,i,n,c){return n=n||o.spatialReference,m(e,o.renderCoordsHelper.spatialReference,r,t,n,i,c)?t:null}function N(o,e,r,i){return i||(i=t()),r=r||o.spatialReference,s(r,e,i,o.renderCoordsHelper.spatialReference)?i:null}function y(r,t,i){const n=r.renderSpatialReference,c=R(r,t.eye,t.viewForward,t.up,C);let s=r.spatialReference;return f(t.eye,n,I,s)||(s=a.WGS84,f(t.eye,n,I,s)),null==i?i=new o(new l(I,s),c.heading,c.tilt,e(t.fov)):(i.position.x=I[0],i.position.y=I[1],i.position.z=I[2],i.position.spatialReference=s,i.heading=c.heading,i.tilt=c.tilt,i.fov=e(t.fov)),i.layout.row=t.row,i.layout.rows=t.rows,i.layout.column=t.column,i.layout.columns=t.columns,i}function S(o,e){if(!e)return null;const t=o.renderSpatialReference,l=d(o).headingTiltToDirectionUp,a=c();if(!p(e.position,a,t))return null;const s=l(a,e.heading,e.tilt);i(s.direction,s.direction,o.state.camera.distance),n(s.direction,s.direction,a);const m=u(o,a,s.direction,s.up);return m.fov=r(e.fov),m.row=e.layout.row,m.rows=e.layout.rows,m.column=e.layout.column,m.columns=e.layout.columns,m}const I=c(),C={heading:0,tilt:0};export{j as AllInternalRenderNodeOutputs,E as AllRenderNodeOutputs,T as InternalRenderCategory,A as RenderNodeOutput,y as fromRenderCamera,g as fromRenderCoordinates,N as renderCoordinateTransformAt,S as toRenderCamera,O as toRenderCoordinates};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,whenOnce as l,syncAndInitial as p,when as m}from"../core/reactiveUtils.js";import{property as h,cast as d,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import y from"../geometry/Point.js";import u from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import _ from"../layers/support/TileInfo.js";import M from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as C}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as V}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import E from"./2d/MapViewConstraints.js";import"../core/RandomLCG.js";import"../core/Logger.js";import"../core/has.js";import"../core/scheduling.js";import"../core/mathUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../core/floatRGBA.js";import"../symbols/Font.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../geometry/Polygon.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as G}from"./2d/engine/Container.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/enums.js";import"./webgl/Program.js";import"./webgl/Util.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/checkWebGLError.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as P}from"./2d/engine/ManagedCanvas.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import D from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import O from"./navigation/Navigation.js";import T from"./ui/DefaultUI.js";import L from"./ui/video/DefaultUIVideo.js";const W=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,k=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let B=class extends(V(C(S(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.layer=null,this.map=null,this.navigation=new O,this.ready=!1,this.spatialReference=new u({wkid:0}),this.stateManager=new R({constraints:new E({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new L,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.layer,()=>{this._forceReadyCycle(),this.addResolvingPromise(l(()=>this.ready))}),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},p)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},p)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,l(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new P(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new D({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.teardown(),this.frameTask?.stop(),this.stationaryManager?.clear()}_getViewpoint(){return new i({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,p),n(()=>this.state.id,()=>e.state=this.state,p),n(()=>this.renderingOptions,t=>e.renderingOptions=t,p)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new M({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new G,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(k).has(e.type),width:this.size[0],height:this.size[1],map:t}),l(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},p),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new y(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},p)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=_.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(m(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}};e([h()],B.prototype,"_overlayContainer",void 0),e([h()],B.prototype,"_isValid",void 0),e([h()],B.prototype,"_readyCycleForced",void 0),e([h()],B.prototype,"_effectsContainer",void 0),e([h()],B.prototype,"constraintsInfo",null),e([h()],B.prototype,"operationalDataVisible",void 0),e([h()],B.prototype,"layer",void 0),e([h()],B.prototype,"map",void 0),e([h({type:O,nonNullable:!0})],B.prototype,"navigation",void 0),e([h({readOnly:!0})],B.prototype,"preconditionsReady",null),e([h({readOnly:!0})],B.prototype,"ready",void 0),e([h({readOnly:!0})],B.prototype,"rendering",null),e([h()],B.prototype,"scale",null),e([h()],B.prototype,"spatialReference",void 0),e([h()],B.prototype,"stateManager",void 0),e([h()],B.prototype,"type",void 0),e([h(),d(e=>e instanceof T?e:g(L,e))],B.prototype,"ui",void 0),e([h({readOnly:!0})],B.prototype,"videoSize",null),e([h({readOnly:!0})],B.prototype,"view2dType",void 0),B=e([c("esri.views.VideoView")],B);const H=B;export{H as default};
2
+ import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,syncAndInitial as l,whenOnce as p,when as m}from"../core/reactiveUtils.js";import{property as h,cast as d,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import y from"../geometry/Point.js";import u from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import _ from"../layers/support/TileInfo.js";import M from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as C}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as V}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import E from"./2d/MapViewConstraints.js";import"../core/RandomLCG.js";import"../core/Logger.js";import"../core/has.js";import"../core/scheduling.js";import"../core/mathUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../core/floatRGBA.js";import"../symbols/Font.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtMeasuredUnits.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/dimensions/effects/LinearDimensionArrowEffect.js";import"../symbols/dimensions/effects/LinearDimensionExtensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLeaderLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionLineEffect.js";import"../symbols/dimensions/effects/LinearDimensionPointEffect.js";import"../symbols/dimensions/effects/LinearDimensionTextEffect.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../geometry/Polygon.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as G}from"./2d/engine/Container.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/enums.js";import"./webgl/Program.js";import"./webgl/Util.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/checkWebGLError.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as P}from"./2d/engine/ManagedCanvas.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import D from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import O from"./navigation/Navigation.js";import T from"./ui/DefaultUI.js";import L from"./ui/video/DefaultUIVideo.js";const W=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,k=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let B=class extends(V(C(S(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new O,this.ready=!1,this.spatialReference=new u({wkid:0}),this.stateManager=new R({constraints:new E({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new L,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},l)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get layer(){return this._get("layer")}set layer(e){e!==this._get("layer")&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(p(()=>this.ready))),this._set("layer",e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new P(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new D({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager?.teardown(),this.frameTask?.stop(),this.stationaryManager?.clear()}_getViewpoint(){return new i({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,l),n(()=>this.state.id,()=>e.state=this.state,l),n(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new M({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new G,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(k).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new y(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=_.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(m(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}};e([h()],B.prototype,"_overlayContainer",void 0),e([h()],B.prototype,"_isValid",void 0),e([h()],B.prototype,"_readyCycleForced",void 0),e([h()],B.prototype,"_effectsContainer",void 0),e([h()],B.prototype,"constraintsInfo",null),e([h()],B.prototype,"operationalDataVisible",void 0),e([h()],B.prototype,"layer",null),e([h()],B.prototype,"map",void 0),e([h({type:O,nonNullable:!0})],B.prototype,"navigation",void 0),e([h({readOnly:!0})],B.prototype,"preconditionsReady",null),e([h({readOnly:!0})],B.prototype,"ready",void 0),e([h({readOnly:!0})],B.prototype,"rendering",null),e([h()],B.prototype,"scale",null),e([h()],B.prototype,"spatialReference",void 0),e([h()],B.prototype,"stateManager",void 0),e([h()],B.prototype,"type",void 0),e([h(),d(e=>e instanceof T?e:g(L,e))],B.prototype,"ui",void 0),e([h({readOnly:!0})],B.prototype,"videoSize",null),e([h({readOnly:!0})],B.prototype,"view2dType",void 0),B=e([c("esri.views.VideoView")],B);const H=B;export{H as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{disposable as a}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{destroyMaybe as o}from"../../core/maybe.js";import{when as s,initial as l,on as d,sync as p,watch as c}from"../../core/reactiveUtils.js";import{screenPointEqual as g,createScreenPoint as u}from"../../core/screenUtils.js";import{diff as h}from"../../core/accessorSupport/diffUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as y}from"../../core/support/UpdatingHandles.js";import f from"../../geometry/Polygon.js";import{i as M,e as _}from"../../chunks/simplifyOperator.js";import{isExtent as w}from"../../geometry/support/jsonTypeUtils.js";import{isPolygon as C}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as H}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as P}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getMaxDeviationInPixels as S,getMinSegmentsPerCurve as x}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as b}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as j,markHandled as T,getPointerType as G}from"./support/drawToolUtils.js";import{PluginContext as k}from"./support/PluginContext.js";import{viewEventToCommand as I}from"./support/input/drawToolInput.js";import{EditSessionManager as O}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as A}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as U}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as V}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as E}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as D}from"./support/managers/SurfaceManager.js";import{TooltipManager as R}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as L}from"../input/InputManager.js";import{createCoordinateHelper as Z}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as F}from"../interactive/InteractiveToolBase.js";import{KeyBindings as B,mediaKeys as z,sketchKeys as q,advancedSketchKeys as K,tooltipKeys as N}from"../interactive/keybindings.js";import{isInputModeAvailable as $}from"../interactive/tooltip/tooltipCommonUtils.js";const J=Symbol();let Q=class extends F{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._snappingVisualizer=null,this._updatingHandles=new y,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new V,this.globalStateManager=new A({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new O({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new E({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null}initialize(){const{view:e}=this;this.interactiveHandleManager=new U({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new R({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(s(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(b(e,t).then(e=>this._snappingVisualizer=e))},l)),this.addHandles([s(()=>this.view,e=>{this.surfaceManager?.destroy(),this.surfaceManager=new D({spatialReference:this.coordinateHelper.spatialReference,excludedGraphicsLayer:null,defaultZ:this.defaultZ,hasZ:this.hasZ,view:e,elevationInfo:this.elevationInfo,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},l),s(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),d(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},p),d(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},p),d(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=o(this.surfaceManager),this.interactiveHandleManager=o(this.interactiveHandleManager),this.tooltipManager=o(this.tooltipManager)}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:a,view:n}=this;return t&&i&&n?{defaultZ:e,directionOptions:a,editGeometryOperations:t,sketchOptions:i,view:n,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,a=e?.spatialReference,n=e.resolution;if(!(i&&a&&n&&Number.isFinite(n)))return null;const r=a.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(n))*S()*r,minSegmentsPerCurve:x()}}get test(){return{densificationParameters:this._densificationParameters}}get updating(){return this._updatingHandles.updating||this.lifecycleManager.updating}get coordinateHelper(){return Z(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&C(e))try{const t=this._densificationParameters,i=H(e)&&t?new f({...P(e,t)}):e;if(!M(i))return _(i)}catch(t){return e}return e}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){return this.lastScreenPosition?this.view.toMap(this.lastScreenPosition):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:a,interactiveHandleManager:n,_snappingVisualizer:r,defaultZ:o,hasZ:s,globalStateManager:{drawAtFixedElevation:l},view:d}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:n,snappingManager:a,snappingVisualizer:r,pointerType:"mouse",hasZ:s,defaultZ:o,view:d,drawAtFixedElevation:l}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;e&&t.complete(e),0===t.pluginStack.length&&(this._finalizeAndSimplifyGeometryResult(),this.emit("complete",{geometry:this.finalGeometry,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null))}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}replaceLeaf(e){const t=this.lifecycleManager;t.updating?n.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._guardCommand({action:"undo"},()=>this.editSessionManager.undo())}redo(){this._guardCommand({action:"redo"},()=>this.editSessionManager.redo())}executeCommand(e){return this._handleCommand(e)}addPromise(e){return this._updatingHandles.addPromise(e)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.addHandles([c(()=>this.unprocessedGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?j(e):null})},l),c(()=>this.simplifiedGeometryPreview,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},l),s(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:g}),c(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this.emit("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},p),this._keybindings.register(e,L.TOOL),c(()=>e.viewpoint,(e,t)=>{e&&t&&h(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],J)}onDeactivate(){super.onDeactivate(),this.removeHandles(J),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=I(e);t&&this._handleCommand(t)}async _handleCommand(e){if(this.lifecycleManager.updating)n.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{T(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(T(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&T(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&$(t.info)&&(await t.enterInputMode(),T(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&T(e):T(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(T(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:G(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions())}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&T(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:G(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=G(e.originalEvent),i=this._updateLastScreenPosition(e),a=this.interactiveHandleManager?.findHandleByManipulator(i);"touch"===t&&a&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const n=this.interactiveHandleManager?.findHandleDragging(),r=this.interactiveHandleManager?.capturingHandle,o=n??r??a;o&&!a&&T(e),"capture-when-engaged"===o?.captureMode||"capture-always"===o?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(o.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{o&&"touch"===G(e.originalEvent)&&"grabbable-object"!==o.captureMode&&"capture-when-engaged"!==o.defaultCaptureMode&&"primary"===o.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(o.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{o&&"touch"===G(e.originalEvent)&&"grabbable-object"!==o.captureMode&&"capture-when-engaged"!==o.defaultCaptureMode&&!o.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(o?.moveTo(i,{...this.movementCommandContext,pointerType:G(e.originalEvent)})):"grabbable-object"===o?.captureMode&&(this.interactiveHandleManager?.releaseHandle(r),await this._updatingHandles.addPromise(o.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t);this.editable&&i&&(this._before(e)||(T(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:G(e.originalEvent)}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new B,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(z.preserveAspectRatio,"constraint-aspect"),t(q.center,"constraint-center"),i(K.toggleFollowManipulator,"toggle-manipulator-follow"),i(q.undo,"undo"),i(q.redo,"redo"),i(q.complete,"complete"),i(q.vertexAdd,"vertex-add"),i({key:N.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const r=this.editGeometryOperations;e(i,r?a(r.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=u(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=r(this._pluginContexts,e,()=>new k({drawTool:this,plugin:e,session:t}));return i.session=t,i}_finalizeAndSimplifyGeometryResult(){const e=this.unprocessedGeometry;try{const t=e?_(e):e;t&&!w(t)?this.finalGeometry=t:this.finalGeometry=e}catch(t){n.getLogger(this).error("draw-tool:complete","geometry simplification failed",t)}}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}};i([m()],Q.prototype,"_snappingVisualizer",void 0),i([m()],Q.prototype,"_tooltipDependencies",null),i([m()],Q.prototype,"_editSessionManagerContext",null),i([m()],Q.prototype,"_densificationParameters",null),i([m({constructOnly:!0,nonNullable:!0})],Q.prototype,"view",void 0),i([m()],Q.prototype,"automaticManipulatorSelection",void 0),i([m()],Q.prototype,"updating",null),i([m()],Q.prototype,"coordinateHelper",null),i([m()],Q.prototype,"editGeometry",null),i([m()],Q.prototype,"editGeometryOperations",null),i([m()],Q.prototype,"unprocessedGeometry",null),i([m()],Q.prototype,"finalGeometry",void 0),i([m()],Q.prototype,"simplifiedGeometryPreview",null),i([m()],Q.prototype,"snappingManager",void 0),i([m()],Q.prototype,"sketchOptions",void 0),i([m()],Q.prototype,"elevationInfo",void 0),i([m()],Q.prototype,"hasZ",void 0),i([m()],Q.prototype,"defaultZ",void 0),i([m()],Q.prototype,"directionOptions",void 0),i([m()],Q.prototype,"canUndo",null),i([m()],Q.prototype,"canRedo",null),i([m()],Q.prototype,"pluginStack",null),i([m()],Q.prototype,"mostDownstreamPlugin",null),i([m()],Q.prototype,"mostUpstreamPlugin",null),i([m()],Q.prototype,"lastScreenPosition",void 0),i([m()],Q.prototype,"positionOfLastUserInput",null),i([m()],Q.prototype,"tooltipManager",void 0),i([m()],Q.prototype,"measurementManager",void 0),i([m()],Q.prototype,"globalStateManager",void 0),i([m()],Q.prototype,"editSessionManager",void 0),i([m()],Q.prototype,"lifecycleManager",void 0),i([m()],Q.prototype,"surfaceManager",void 0),i([m()],Q.prototype,"interactiveHandleManager",void 0),i([m()],Q.prototype,"renderer",void 0),i([m()],Q.prototype,"movementCommandContext",null),i([m()],Q.prototype,"tooltip",null),i([m()],Q.prototype,"activeTooltipInfo",null),i([m()],Q.prototype,"helpMessageKey",null),Q=i([v("esri.views.draw.DrawTool")],Q);export{Q as DrawTool};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as i}from"tslib";import{disposable as a}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{destroyMaybe as o}from"../../core/maybe.js";import{when as s,initial as d,on as l,sync as p,watch as c}from"../../core/reactiveUtils.js";import{screenPointEqual as u,createScreenPoint as h}from"../../core/screenUtils.js";import{diff as g}from"../../core/accessorSupport/diffUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as y}from"../../core/support/UpdatingHandles.js";import f from"../../geometry/Polygon.js";import{i as M,e as _}from"../../chunks/simplifyOperator.js";import{isExtent as w}from"../../geometry/support/jsonTypeUtils.js";import{isPolygon as b}from"../../geometry/support/typeUtils.js";import{isCurvedGeometry as C}from"../../geometry/support/curves/curveUtils.js";import{densifyCurvedGeometry as H}from"../../geometry/support/curves/densifyCurvedGeometry.js";import{getMaxDeviationInPixels as P,getMinSegmentsPerCurve as S}from"../2d/layers/graphics/densificationConstants.js";import{createSnappingVisualizer as x}from"./support/createSnappingVisualizer.js";import{multipointFromGeometry as k,markHandled as j,getPointerType as E}from"./support/drawToolUtils.js";import{PluginContext as T}from"./support/PluginContext.js";import{viewEventToCommand as G}from"./support/input/drawToolInput.js";import{EditSessionManager as O}from"./support/managers/EditSessionManager.js";import{GlobalStateManager as V}from"./support/managers/GlobalStateManager.js";import{InteractiveHandleManager as I}from"./support/managers/InteractiveHandleManager.js";import{MeasurementManager as A}from"./support/managers/MeasurementManager.js";import{PluginLifecycleManager as U}from"./support/managers/PluginLifecycleManager.js";import{SurfaceManager as R}from"./support/managers/SurfaceManager.js";import{TooltipManager as F}from"./support/managers/TooltipManager.js";import{ViewEventPriorities as D}from"../input/InputManager.js";import{createCoordinateHelper as L}from"../interactive/coordinateHelper.js";import{InteractiveToolBase as Z}from"../interactive/InteractiveToolBase.js";import{KeyBindings as q,mediaKeys as B,sketchKeys as z,advancedSketchKeys as K,tooltipKeys as Q}from"../interactive/keybindings.js";import{isInputModeAvailable as N}from"../interactive/tooltip/tooltipCommonUtils.js";const W=Symbol();let $=class extends Z{constructor(e){super(e),this._shapeVisualId=Symbol(),this._vertexVisualId=Symbol(),this._pluginContexts=new Map,this._queuedFeedbackEvents=[],this._flushingQueuedFeedbackEvents=!1,this._snappingVisualizer=null,this._updatingHandles=new y,this._keybindings=this._makeKeyBindings(),this._pendingBeginRequest=null,this.type="draw-2.0",this.automaticManipulatorSelection=!0,this.snappingManager=null,this.sketchOptions=null,this.elevationInfo=null,this.hasZ=!1,this.defaultZ=0,this.lastScreenPosition=null,this.measurementManager=new A,this.globalStateManager=new V({getPluginStack:()=>this.pluginStack}),this.editSessionManager=new O({getContext:()=>this._editSessionManagerContext}),this.lifecycleManager=new U({getContext:this._getContextForPlugin.bind(this),editSessionManager:this.editSessionManager,afterAttach:this._afterAttach.bind(this),afterDetach:this._afterDetach.bind(this),beforeResume:this._beforeResume.bind(this)}),this.surfaceManager=null,this.interactiveHandleManager=null,this.renderer=null,this.enableVertexVisuals=!0}initialize(){const{view:e}=this;this.interactiveHandleManager=new I({view:e,renderer:this.renderer}),this._override("manipulators",this.interactiveHandleManager.manipulators),this.tooltipManager=new F({getDependencies:()=>this._tooltipDependencies,getLastScreenPosition:()=>this.lastScreenPosition}),this.addHandles(s(()=>this.renderer,t=>{t.addOrUpdateVisual(this._shapeVisualId,{role:"outputGeometry"}),t.addOrUpdateVisual(this._vertexVisualId,{role:"vertex"}),this._updatingHandles.addPromise(x(e,t).then(e=>this._snappingVisualizer=e))},d)),this.addHandles([s(()=>this.view,e=>{this.surfaceManager?.destroy(),this.surfaceManager=new R({spatialReference:this.coordinateHelper.spatialReference,excludedGraphicsLayer:null,defaultZ:this.defaultZ,hasZ:this.hasZ,view:e,elevationInfo:this.elevationInfo,getContext:()=>({drawAtFixedElevation:this.globalStateManager.drawAtFixedElevation,elevationConstraint:this.tooltipManager?.elevationConstraint,constraintsEnabled:this.tooltipManager?.constraintsEnabled??!1})})},d),s(()=>this.sketchOptions?.tooltips.effectiveEnabled,()=>this.measurementManager.preloadMeasurementUtils(),{once:!0,initial:!0}),l(()=>this.editSessionManager,"cancelPlugin",({plugin:e})=>{this._suspendPlugin(e)},p),l(()=>this.editSessionManager,"restartPlugin",({restartInfo:e})=>{this._resumePlugin(e)},p),c(()=>this.lifecycleManager.updating,e=>{e||this._emitQueuedFeedbackEvents()},p),l(()=>this.editGeometryOperations,["vertex-add","vertex-update","vertex-remove"],e=>{const t=e.vertices.map(e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)})),i=t.map(e=>e.coordinates);switch(e.type){case"vertex-add":this._emitWhenReady(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this._emitWhenReady(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this._emitWhenReady(e.type,{...e,removed:i,vertices:t})}})])}destroy(){this.active&&this.onDeactivate(),this.editSessionManager.destroy(),this.lifecycleManager.destroy(),this.measurementManager.destroy(),this.globalStateManager.destroy();for(const e of this._pluginContexts.values())e.destroy();this._pluginContexts.clear(),this.surfaceManager=o(this.surfaceManager),this.interactiveHandleManager=o(this.interactiveHandleManager),this.tooltipManager=o(this.tooltipManager)}get _tooltipDependencies(){const{defaultZ:e,editGeometryOperations:t,sketchOptions:i,directionOptions:a,view:n}=this;return t&&i&&n?{defaultZ:e,directionOptions:a,editGeometryOperations:t,sketchOptions:i,view:n,getActiveHandle:()=>this.interactiveHandleManager?.focusedHandle,getAllHandles:()=>this.interactiveHandleManager?.allhandles,getHelpMessageKey:()=>this.helpMessageKey,notifyTooltipsChanged:()=>{const{interactiveHandleManager:e,movementCommandContext:t}=this;e&&t&&e.reapplyPositions(t)}}:null}get _editSessionManagerContext(){const{coordinateHelper:e,view:t}=this;if(!t)return null;return{coordinateHelper:e,viewingMode:"3d"===t.type&&"global"===t.viewingMode?1:2}}get _densificationParameters(){const{view:e,coordinateHelper:t}=this,i=t.spatialReference,a=e?.spatialReference,n=e.resolution;if(!(i&&a&&n&&Number.isFinite(n)))return null;const r=a.metersPerUnit/i.metersPerUnit;return{maxDeviation:2**Math.round(Math.log2(n))*P()*r,minSegmentsPerCurve:S()}}get test(){return{densificationParameters:this._densificationParameters}}get updating(){return this._updatingHandles.updating||this.lifecycleManager.updating}get coordinateHelper(){return L(this.hasZ,!1,this.view.spatialReference)}get editGeometry(){return this.editGeometryOperations?.data}get editGeometryOperations(){return this.editSessionManager.editGeometryOperations}get unprocessedGeometry(){return this.editSessionManager.outputGeometry}get simplifiedGeometryPreview(){const e=this.editSessionManager.outputGeometry;if(e&&b(e))try{const t=this._densificationParameters,i=C(e)&&t?new f({...H(e,t)}):e;if(!M(i))return _(i)}catch(t){return e}return e}get canUndo(){return this.editSessionManager.canUndo}get canRedo(){return this.editSessionManager.canRedo}get pluginStack(){return this.lifecycleManager.pluginStack}get mostDownstreamPlugin(){return this.pluginStack.at(-1)}get mostUpstreamPlugin(){return this.pluginStack.at(0)}get positionOfLastUserInput(){return this.lastScreenPosition?this.view.toMap(this.lastScreenPosition):this.view.center}get movementCommandContext(){const{editGeometryOperations:e,tooltipManager:t,surfaceManager:i,snappingManager:a,interactiveHandleManager:n,_snappingVisualizer:r,defaultZ:o,hasZ:s,globalStateManager:{drawAtFixedElevation:d},view:l}=this;return{tooltipManager:t,editGeometryOperations:e,surfaceManager:i,interactiveHandleManager:n,snappingManager:a,snappingVisualizer:r,pointerType:"mouse",hasZ:s,defaultZ:o,view:l,drawAtFixedElevation:d}}get tooltip(){return this.tooltipManager?.tooltip}get activeTooltipInfo(){return this.tooltipManager?.tooltipInfo}get helpMessageKey(){return this.pluginStack.items.findLast(e=>e.helpMessageKey)?.helpMessageKey??"noTool"}begin(e){this.active?(this.lifecycleManager.begin(e),this._pendingBeginRequest=null):this._pendingBeginRequest=e}complete(e){const t=this.lifecycleManager;e&&t.complete(e),0===t.pluginStack.length&&(this._finalizeAndSimplifyGeometryResult(),this.emit("complete",{geometry:this.finalGeometry,aborted:!1,type:"complete",vertices:[]}),this.view?.activeTool===this&&(this.view.activeTool=null))}cancelFirstUserLeafPlugin(){const e=this.pluginStack.toArray().findLast(e=>!0!==e.configuration?.hidden);e&&this.lifecycleManager.cancel(e)}replaceLeaf(e){const t=this.lifecycleManager;t.updating?n.getLogger(this).info("Ignoring command; arrived while updating:","replaceLeaf"):t.replaceLeaf(e)}finishPart(){const e=this.mostUpstreamPlugin,t=e?.configuration;if(this.editGeometryOperations&&t&&t.kind?.includes("multipart")){const e=this.pluginStack.at(1);e&&this.complete(e)}}undo(){this._guardCommand({action:"undo"},()=>this.editSessionManager.undo())}redo(){this._guardCommand({action:"redo"},()=>this.editSessionManager.redo())}executeCommand(e){return this._handleCommand(e)}addPromise(e){return this._updatingHandles.addPromise(e)}getGeometryIfCompleted(){const e=this.lifecycleManager.gatherCompletablePlugins();return this.editSessionManager?.generatePreviewGeometryForPlugins(e)}onActivate(){super.onActivate();const{view:e}=this;this.lastScreenPosition=e?.inputManager.latestPointerInfo?.location,this.renderer?.activate(),this._pendingBeginRequest&&(this.begin(this._pendingBeginRequest),this._pendingBeginRequest=null),this.enableVertexVisuals&&this.addHandles(c(()=>this.unprocessedGeometry,e=>{this.renderer?.addOrUpdateVisual(this._vertexVisualId,{geometry:e?k(e):null})},d)),this.addHandles([c(()=>this.simplifiedGeometryPreview,e=>{this.renderer?.addOrUpdateVisual(this._shapeVisualId,{geometry:e})},d),s(()=>this.interactiveHandleManager?.capturingHandle?.screenPosition,e=>this.lastScreenPosition=e,{initial:!0,equals:u}),c(()=>this.interactiveHandleManager?.capturingHandle?.outputMapPosition,(e,t)=>{const i=this.interactiveHandleManager?.capturingHandle?.editSession?.endVertex;e&&t&&i&&this._emitWhenReady("cursor-update",{updated:i.pos,type:"vertex-update",operation:"apply",vertices:[{componentIndex:i.part.index,vertexIndex:i.index,coordinates:i.pos}]})},p),this._keybindings.register(e,D.TOOL),c(()=>e.viewpoint,(e,t)=>{e&&t&&g(e,t)&&this._handleCommand({action:"viewpoint-moved"})})],W)}onDeactivate(){super.onDeactivate(),this.removeHandles(W),this.renderer?.deactivate(),this.snappingManager?.doneSnapping(),this.lifecycleManager.cancelAll(),this._pendingBeginRequest=null}onInputEvent(e){const t=G(e);t&&this._handleCommand(t)}_emitWhenReady(e,t){if(this.destroyed)return;const i=()=>{this.emit(e,t)};this.lifecycleManager.updating||this._flushingQueuedFeedbackEvents?this._queuedFeedbackEvents.push(i):i()}_emitQueuedFeedbackEvents(){if(!(this.destroyed||this._flushingQueuedFeedbackEvents||this.lifecycleManager.updating||0===this._queuedFeedbackEvents.length)){this._flushingQueuedFeedbackEvents=!0;try{for(;!this.destroyed&&!this.lifecycleManager.updating&&this._queuedFeedbackEvents.length>0;)this._queuedFeedbackEvents.shift()?.()}finally{this._flushingQueuedFeedbackEvents=!1}}}async _handleCommand(e){if(this.lifecycleManager.updating)n.getLogger(this).info("Ignoring command; arrived while updating:",e.action);else switch(e.action){case"view-drag":return await this._handleViewDragCommand(e);case"vertex-add":return this._guardCommand(e,()=>{j(e),this._commitNext()});case"vertex-add-and-finish-part":return this._handleVertexAddAndFinishPartCommand(e);case"cancel":return this._guardCommand(e,()=>this.cancel());case"complete":return this._guardCommand(e,()=>{this.mostUpstreamPlugin&&(j(e),this.complete(this.mostUpstreamPlugin))});case"finish-part":return this._guardCommand(e,()=>this.finishPart());case"undo":return this._guardCommand(e,()=>this.editSessionManager.undo());case"redo":return this._guardCommand(e,()=>this.editSessionManager.redo());case"next-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("forward"));case"previous-manipulator":return this._guardCommand(e,()=>this.interactiveHandleManager?.cycleManipulator("backward"));case"toggle-manipulator-follow":this.interactiveHandleManager?.toggleFollow()&&j(e);break;case"viewpoint-moved":return await this._handleViewpointMovedCommand(e);case"manipulator-move-to":return await this._handleManipulatorMoveToCommand(e);case"manipulator-drag-to":return await this._handleManipulatorDragToCommand(e);case"vertex-add-at-point":return await this._handleVertexAddAtPointCommand(e);case"show-tooltip":return this._guardCommand(e,async()=>{const t=this.tooltipManager?.tooltip;t&&N(t.info)&&(await t.enterInputMode(),j(e))});case"constraint-center":this.globalStateManager.setCentered(e.enabled);break;case"constraint-aspect":this.globalStateManager.setPreserveAspectRatio(e.enabled)}}async _handleViewDragCommand(e){if(!this.editable)return;const t=e.originalEvent,i=this.interactiveHandleManager?.capturingHandle;(!t||!("pointerType"in t)||"touch"!==t.pointerType||"capture-always"!==i?.captureMode&&"capture-when-engaged"!==i?.captureMode)&&"capture-when-engaged"!==this.interactiveHandleManager?.capturingHandle?.captureMode?this._before(e)&&j(e):j(e)}_handleVertexAddAndFinishPartCommand(e){this._before(e)||(j(e),this._commitNext(),this.finishPart())}async _handleViewpointMovedCommand(e){this.editable&&(await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(null,{...this.movementCommandContext,pointerType:E(e.originalEvent)})),this.interactiveHandleManager?.updateAllScreenPositions())}async _handleManipulatorMoveToCommand(e){if(!this.editable)return;const t=this._updateLastScreenPosition(e);this.interactiveHandleManager?.capturingHandle&&j(e),await this._updatingHandles.addPromise(this.interactiveHandleManager?.capturingHandle?.moveTo(t,{...this.movementCommandContext,pointerType:E(e.originalEvent)}))}async _handleManipulatorDragToCommand(e){if(!this.editable)return;const t=E(e.originalEvent),i=this._updateLastScreenPosition(e),a=this.interactiveHandleManager?.findHandleByManipulator(i);"touch"===t&&a&&"start"===e.state&&this.interactiveHandleManager?.releaseHandle();const n=this.interactiveHandleManager?.findHandleDragging(),r=this.interactiveHandleManager?.capturingHandle,o=n??r??a;o&&!a&&j(e),"capture-when-engaged"===o?.captureMode||"capture-always"===o?.captureMode&&"touch"===t?"end"===e.state?await this._updatingHandles.addPromise(o.noteDragEnd(i,{...this.movementCommandContext,pointerType:t}).then(()=>{o&&"touch"===E(e.originalEvent)&&"grabbable-object"!==o.captureMode&&"capture-when-engaged"!==o.defaultCaptureMode&&"primary"===o.role&&(1===this.interactiveHandleManager?.handleCount?this._handleCommand({action:"vertex-add"}):this.interactiveHandleManager?.releaseHandle())})):"start"===e.state?await this._updatingHandles.addPromise(o.noteDragStart(i,{...this.movementCommandContext,pointerType:t}).then(()=>{o&&"touch"===E(e.originalEvent)&&"grabbable-object"!==o.captureMode&&"capture-when-engaged"!==o.defaultCaptureMode&&!o.editSession?.lastPointAddedBySession&&this._handleCommand({action:"vertex-add"})})):await this._updatingHandles.addPromise(o?.moveTo(i,{...this.movementCommandContext,pointerType:E(e.originalEvent)})):"grabbable-object"===o?.captureMode&&(this.interactiveHandleManager?.releaseHandle(r),await this._updatingHandles.addPromise(o.moveTo(i,{...this.movementCommandContext,pointerType:t})))}async _handleVertexAddAtPointCommand(e){const t=this._updateLastScreenPosition(e),i=this.interactiveHandleManager?.capturingHandle??this.interactiveHandleManager?.findHandleByManipulator(t);this.editable&&i&&(this._before(e)||(j(e),await this._updatingHandles.addPromise(i.moveTo(t,{...this.movementCommandContext,skipSnapping:!0,pointerType:E(e.originalEvent)}).finally(()=>this._commitNext()))))}_makeKeyBindings(){const e=new q,t=(t,i)=>{e.addToggle(t,e=>this._handleCommand({action:i,originalEvent:e,enabled:"key-down"===e.type}))},i=(t,i)=>{e.add(t,e=>this._handleCommand({action:i,originalEvent:e}))};return t(B.preserveAspectRatio,"constraint-aspect"),t(z.center,"constraint-center"),i(K.toggleFollowManipulator,"toggle-manipulator-follow"),i(z.undo,"undo"),i(z.redo,"redo"),i(z.complete,"complete"),i(z.vertexAdd,"vertex-add"),i({key:Q.enterInputMode,continuePropagation:!0,repeats:!0},"show-tooltip"),e}_afterAttach(){}_afterDetach(e){this.interactiveHandleManager?.unregisterCustomConstraint(e),this.interactiveHandleManager?.unregisterHandle(e),this.tooltipManager?.unregisterPluginFields(e),this.globalStateManager.clearPluginOverrides(e);const t=this._pluginContexts.get(e);t&&(t.destroy(),this._pluginContexts.delete(e))}_beforeResume(e,t){this.interactiveHandleManager?.replaceEditSessions(e,t)}_commitNext(){const i={stack:[],error:void 0,hasError:!1};try{const t=this.mostDownstreamPlugin;if(!t)return;this.tooltipManager?.storeConstraintSnapshot();let n=!1;const r=this.editGeometryOperations;e(i,r?a(r.on("vertex-add",()=>n=!0)):null,!1);t.completeStep?t.completeStep():this.complete(t),n&&this.tooltipManager?.unlockOnVertexPlacement()}catch(n){i.error=n,i.hasError=!0}finally{t(i)}}_suspendPlugin(e){this.lifecycleManager.suspend(e),this.measurementManager.suspendPlugin(e)}_resumePlugin(e){this.lifecycleManager.resume(e)}_updateLastScreenPosition(e){const t=h(e.x,e.y);return this.lastScreenPosition=t,t}_getContextForPlugin(e,t){const i=r(this._pluginContexts,e,()=>new T({drawTool:this,plugin:e,session:t}));return i.session=t,i}_finalizeAndSimplifyGeometryResult(){const e=this.unprocessedGeometry;try{const t=e?_(e):e;t&&!w(t)?this.finalGeometry=t:this.finalGeometry=e}catch(t){n.getLogger(this).error("draw-tool:complete","geometry simplification failed",t)}}_before(e){if(!this.hasEventListener(`before-${e.action}`))return!1;const t=new CustomEvent(`before-${e.action}`,{detail:e,cancelable:!0});return this.emit(`before-${e.action}`,t),t.defaultPrevented}_guardCommand(e,t,i){return this._before(e)?i?.():t()}};i([m()],$.prototype,"_snappingVisualizer",void 0),i([m()],$.prototype,"_tooltipDependencies",null),i([m()],$.prototype,"_editSessionManagerContext",null),i([m()],$.prototype,"_densificationParameters",null),i([m({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),i([m()],$.prototype,"automaticManipulatorSelection",void 0),i([m()],$.prototype,"updating",null),i([m()],$.prototype,"coordinateHelper",null),i([m()],$.prototype,"editGeometry",null),i([m()],$.prototype,"editGeometryOperations",null),i([m()],$.prototype,"unprocessedGeometry",null),i([m()],$.prototype,"finalGeometry",void 0),i([m()],$.prototype,"simplifiedGeometryPreview",null),i([m()],$.prototype,"snappingManager",void 0),i([m()],$.prototype,"sketchOptions",void 0),i([m()],$.prototype,"elevationInfo",void 0),i([m()],$.prototype,"hasZ",void 0),i([m()],$.prototype,"defaultZ",void 0),i([m()],$.prototype,"directionOptions",void 0),i([m()],$.prototype,"canUndo",null),i([m()],$.prototype,"canRedo",null),i([m()],$.prototype,"pluginStack",null),i([m()],$.prototype,"mostDownstreamPlugin",null),i([m()],$.prototype,"mostUpstreamPlugin",null),i([m()],$.prototype,"lastScreenPosition",void 0),i([m()],$.prototype,"positionOfLastUserInput",null),i([m()],$.prototype,"tooltipManager",void 0),i([m()],$.prototype,"measurementManager",void 0),i([m()],$.prototype,"globalStateManager",void 0),i([m()],$.prototype,"editSessionManager",void 0),i([m()],$.prototype,"lifecycleManager",void 0),i([m()],$.prototype,"surfaceManager",void 0),i([m()],$.prototype,"interactiveHandleManager",void 0),i([m()],$.prototype,"renderer",void 0),i([m()],$.prototype,"movementCommandContext",null),i([m()],$.prototype,"tooltip",null),i([m()],$.prototype,"activeTooltipInfo",null),i([m()],$.prototype,"helpMessageKey",null),i([m({constructOnly:!0})],$.prototype,"enableVertexVisuals",void 0),$=i([v("esri.views.draw.DrawTool")],$);export{$ as DrawTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{Milliseconds as i}from"../../core/time.js";import{webglDebugEnabled as a,checkWebGLError as r,getErrorMessage as n,webglValidateShadersEnabled as l}from"./checkWebGLError.js";import{ContextState as h}from"./ContextState.js";import{baseTextureUnit as f,DrawBufferBack as o,DrawBufferNone as u,ResourceType as c,ColorAttachment0 as d,PrimitiveType as _}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as p}from"./ProgramCache.js";import{StateTracker as m}from"./renderState.js";import B from"./Texture.js";import{WebGLDriverTest as F}from"./WebGLDriverTest.js";import{Capabilities as T}from"./capabilities/Capabilities.js";const x=()=>t.getLogger("esri.views.webgl.RenderingContext");let k=class{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._programCache=new p(this),this._transformFeedbackRequestInfo=null,this._state=new h,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(t){this._options=t,this._capabilities=new T(this.gl,t),this._parameters=new g(this.gl,this._capabilities,t),B.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new h,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new m({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),e(this._driverTest),this._driverTest=new F(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=e(this._driverTest),this._programCache=e(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null,a()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(f+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e)??[];if(i?.length===t.length&&i.every((e,s)=>e===t[s]))return i;if(t.length>this.parameters.maxDrawBuffers)return x().error(`Setting more active draw buffers (${t.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),i;if(s){if(t.length>1)return x().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${t.length}.`),i;if(t[0]!==o&&t[0]!==u)return x().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${t[0]}`),i}else if(t.includes(o))return x().error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers."),i;return this.gl.drawBuffers(t),r(this.gl),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),i}clear(t,e=255){t&&(16384&t&&this.setColorMask(!0,!0,!0,!0),256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t))}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=E(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),r(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),r(this.gl)}drawElements(t,e,s,i){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=E(t,e)),this.gl.drawElements(t,e,s,i),a()){const a=n(this.gl);if(a){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:i},o=n?.size??0,u=i+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";x().error(`drawElements: ${a}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,a){this.gl.drawElementsInstanced(t,e,s,i,a),r(this.gl)}logInfo(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){if(this._state.program!==t){if(t&&null==t.glName&&l())throw new Error("Attempting to use disposed or invalid Program");this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null)}}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&x().error(`Input texture unit (${e}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})\n `);const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){const s=C(t);if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(null==t)return this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,void this.setDrawBuffers(s);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t,this.setDrawBuffers(s)}else this.setDrawBuffers(s)}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._state.drawFramebuffer=t??null,this.setDrawBuffers(C(t))))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=w(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=w(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=w(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=w(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=w(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=w(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=w(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=w(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return x().error(`Uniform buffer binding point (${e}) is out of range (0...${this.parameters.maxUniformBufferBindings})\n `),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):x().error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,i){null!=e?(a()&&(i??e.byteLength)>this._parameters.maxUniformBlockSize&&x().error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==i?this.bindBufferRange(35345,t,e.buffer,s,i):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=w(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=w(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=w(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=w(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=w(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=w(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=w(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=i(10)){const{gl:e}=this,a=e.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(c.Sync,a),e.flush();do{await s(t),r=e.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(c.Sync,a),e.deleteSync(a),37149===r)throw new Error("Client wait failed")}getBoundFramebufferObject(t=36160){return 36008===t?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.getBoundFramebufferObject();try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(d)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[o])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[d])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(f+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(f+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function w(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function E(t,e){switch(t){case _.POINTS:return 2*e;case _.TRIANGLES:return e/3;case _.TRIANGLE_STRIP:case _.TRIANGLE_FAN:return e-2;default:return 0}}function C(t){return t?t.colorAttachments.length>0?t.colorAttachments:[u]:[o]}export{k as RenderingContext,C as getFramebufferDrawBuffers};
2
+ import has from"../../core/has.js";import t from"../../core/Logger.js";import{disposeMaybe as e}from"../../core/maybe.js";import{after as s}from"../../core/promiseUtils.js";import{Milliseconds as i}from"../../core/time.js";import{webglDebugEnabled as a,checkWebGLError as r,getErrorMessage as n,webglValidateShadersEnabled as l}from"./checkWebGLError.js";import{ContextState as h}from"./ContextState.js";import{DrawBufferNone as f,DrawBufferBack as o,baseTextureUnit as u,ResourceType as c,ColorAttachment0 as d,PrimitiveType as _}from"./enums.js";import{InstanceCounter as b}from"./InstanceCounter.js";import{Parameters as g}from"./Parameters.js";import{ProgramCache as p}from"./ProgramCache.js";import{StateTracker as m}from"./renderState.js";import B from"./Texture.js";import{WebGLDriverTest as F}from"./WebGLDriverTest.js";import{Capabilities as T}from"./capabilities/Capabilities.js";const x=()=>t.getLogger("esri.views.webgl.RenderingContext");let k=class{constructor(t,e){this.gl=t,this.instanceCounter=new b,this._programCache=new p(this),this._transformFeedbackRequestInfo=null,this._state=new h,this._numOfDrawCalls=0,this._numOfTriangles=0,this._options=e,this.configure(e)}configure(t){this._options=t,this._capabilities=new T(this.gl,t),this._parameters=new g(this.gl,this._capabilities,t),B.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const s=this.gl.getParameter(this.gl.VIEWPORT);this._state=new h,this._state.viewport={x:s[0],y:s[1],width:s[2],height:s[3]},this._stateTracker=new m({setBlending:t=>{if(t){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(t.opRgb,t.opAlpha),this.setBlendFunctionSeparate(t.srcRgb,t.dstRgb,t.srcAlpha,t.dstAlpha);const e=t.color;this.setBlendColor(e.r,e.g,e.b,e.a)}else this.setBlendingEnabled(!1)},setCulling:t=>{t?(this.setFaceCullingEnabled(!0),this.setCullFace(t.face),this.setFrontFace(t.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:t=>{t?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(t.factor,t.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:t=>{t?(this.setDepthTestEnabled(!0),this.setDepthFunction(t.func)):this.setDepthTestEnabled(!1)},setStencilTest:t=>{if(t){this.setStencilTestEnabled(!0);const e=t.function;this.setStencilFunction(e.func,e.ref,e.mask);const s=t.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:t=>{t?(this.setDepthWriteEnabled(!0),this.setDepthRange(t.zNear,t.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:t=>{t?this.setColorMask(t.r,t.g,t.b,t.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:t=>{t?this.setStencilWriteMask(t.mask):this.setStencilWriteMask(0)}}),this.enforceState(),e(this._driverTest),this._driverTest=new F(this)}updateOptions(t){this._options={...this._options,...t},this._parameters=new g(this.gl,this._capabilities,this._options)}dispose(){this._driverTest=e(this._driverTest),this._programCache=e(this._programCache),this.bindVAO(null),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663),this._state.textureUnitMap.length=0,this._state=null,this._capabilities=null,this._stateTracker=null,a()&&this.instanceCounter.resourceInformation&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}get programCache(){return this._programCache}setPipelineState(t){this._stateTracker.setPipeline(t)}getPipelineState(){return this._stateTracker.getPipelineState()}setBlendingEnabled(t){this._state.blend!==t&&(!0===t?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=t,this._stateTracker.invalidateBlending())}externalProgramUpdate(){this._state.program?.stop(),this._state.program=null}externalTextureUnitUpdate(t,e){for(let s=0;s<t.length;++s)this._state.textureUnitMap[t[s]]=null;e>=0&&(this._state.activeTexture=e)}externalVertexArrayObjectUpdate(){this.gl.bindVertexArray(null),this._state.vertexArrayObject=null,this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(t,e,s,i){t===this._state.blendColor.r&&e===this._state.blendColor.g&&s===this._state.blendColor.b&&i===this._state.blendColor.a||(this.gl.blendColor(t,e,s,i),this._state.blendColor.r=t,this._state.blendColor.g=e,this._state.blendColor.b=s,this._state.blendColor.a=i,this._stateTracker.invalidateBlending())}setBlendFunction(t,e){t===this._state.blendFunction.srcRGB&&e===this._state.blendFunction.dstRGB||(this.gl.blendFunc(t,e),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=t,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=e,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(t,e,s,i){this._state.blendFunction.srcRGB===t&&this._state.blendFunction.srcAlpha===s&&this._state.blendFunction.dstRGB===e&&this._state.blendFunction.dstAlpha===i||(this.gl.blendFuncSeparate(t,e,s,i),this._state.blendFunction.srcRGB=t,this._state.blendFunction.srcAlpha=s,this._state.blendFunction.dstRGB=e,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendEquation(t){this._state.blendEquation.mode!==t&&(this.gl.blendEquation(t),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=t,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(t,e){this._state.blendEquation.mode===t&&this._state.blendEquation.modeAlpha===e||(this.gl.blendEquationSeparate(t,e),this._state.blendEquation.mode=t,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setColorMask(t,e,s,i){this._state.colorMask.r===t&&this._state.colorMask.g===e&&this._state.colorMask.b===s&&this._state.colorMask.a===i||(this.gl.colorMask(t,e,s,i),this._state.colorMask.r=t,this._state.colorMask.g=e,this._state.colorMask.b=s,this._state.colorMask.a=i,this._stateTracker.invalidateColorWrite())}setClearColor(t,e,s,i){this._state.clearColor.r===t&&this._state.clearColor.g===e&&this._state.clearColor.b===s&&this._state.clearColor.a===i||(this.gl.clearColor(t,e,s,i),this._state.clearColor.r=t,this._state.clearColor.g=e,this._state.clearColor.b=s,this._state.clearColor.a=i)}setFaceCullingEnabled(t){this._state.faceCulling!==t&&(!0===t?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=t,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(t){this._state.polygonOffsetFill!==t&&(!0===t?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=t,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(t,e){this._state.polygonOffset[0]===t&&this._state.polygonOffset[1]===e||(this._state.polygonOffset[0]=t,this._state.polygonOffset[1]=e,this.gl.polygonOffset(t,e),this._stateTracker.invalidatePolygonOffset())}setCullFace(t){this._state.cullFace!==t&&(this.gl.cullFace(t),this._state.cullFace=t,this._stateTracker.invalidateCulling())}setFrontFace(t){this._state.frontFace!==t&&(this.gl.frontFace(t),this._state.frontFace=t,this._stateTracker.invalidateCulling())}setScissorTestEnabled(t){this._state.scissorTest!==t&&(!0===t?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=t)}setScissorRect(t,e,s,i){this._state.scissorRect.x===t&&this._state.scissorRect.y===e&&this._state.scissorRect.width===s&&this._state.scissorRect.height===i||(this.gl.scissor(t,e,s,i),this._state.scissorRect.x=t,this._state.scissorRect.y=e,this._state.scissorRect.width=s,this._state.scissorRect.height=i)}setDepthTestEnabled(t){this._state.depthTest!==t&&(!0===t?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=t,this._stateTracker.invalidateDepthTest())}setClearDepth(t){this._state.clearDepth!==t&&(this.gl.clearDepth(t),this._state.clearDepth=t)}setDepthFunction(t){this._state.depthFunction!==t&&(this.gl.depthFunc(t),this._state.depthFunction=t,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(t){this._state.depthWrite!==t&&(this.gl.depthMask(t),this._state.depthWrite=t,this._stateTracker.invalidateDepthWrite())}setDepthRange(t,e){this._state.depthRange.zNear===t&&this._state.depthRange.zFar===e||(this.gl.depthRange(t,e),this._state.depthRange.zNear=t,this._state.depthRange.zFar=e,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(t){this._state.stencilTest!==t&&(!0===t?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=t,this._stateTracker.invalidateStencilTest())}setClearStencil(t){t!==this._state.clearStencil&&(this.gl.clearStencil(t),this._state.clearStencil=t)}setStencilFunction(t,e,s){this._state.stencilFunction.func===t&&this._state.stencilFunction.ref===e&&this._state.stencilFunction.mask===s||(this.gl.stencilFunc(t,e,s),this._state.stencilFunction.face=1032,this._state.stencilFunction.func=t,this._state.stencilFunction.ref=e,this._state.stencilFunction.mask=s,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(t,e,s,i){this._state.stencilFunction.face===t&&this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===s&&this._state.stencilFunction.mask===i||(this.gl.stencilFuncSeparate(t,e,s,i),this._state.stencilFunction.face=t,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=s,this._state.stencilFunction.mask=i,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(t){this._state.stencilWriteMask!==t&&(this.gl.stencilMask(t),this._state.stencilWriteMask=t,this._stateTracker.invalidateStencilWrite())}setStencilOp(t,e,s){1032===this._state.stencilOperation.face&&this._state.stencilOperation.fail===t&&this._state.stencilOperation.zFail===e&&this._state.stencilOperation.zPass===s||(this.gl.stencilOp(t,e,s),this._state.stencilOperation.face=1032,this._state.stencilOperation.fail=t,this._state.stencilOperation.zFail=e,this._state.stencilOperation.zPass=s,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(t,e,s,i){this._state.stencilOperation.face===t&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===s&&this._state.stencilOperation.zPass===i||(this.gl.stencilOpSeparate(t,e,s,i),this._state.stencilOperation.face=t,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=s,this._state.stencilOperation.zPass=i,this._stateTracker.invalidateStencilTest())}setActiveTexture(t,e=!1){const s=this._state.activeTexture;return t>=0&&(e||t!==this._state.activeTexture)&&(this.gl.activeTexture(u+t),this._state.activeTexture=t),s}setDrawBuffers(t){const{drawFramebuffer:e}=this._state,s=null===e,i=s?this._state.drawBuffers.defaultFramebuffer:this._state.drawBuffers.fbos.get(e)??[];if(i?.length===t.length&&i.every((e,s)=>e===t[s]))return i;if(t.length>this.parameters.maxDrawBuffers)return x().error(`Setting more active draw buffers (${t.length}) than GL.MAX_DRAW_BUFFERS allows ( ${this.parameters.maxDrawBuffers}).`),i;if(s){if(t.length>1)return x().error(`The default framebuffer can only have 1 active draw buffer but was requested with ${t.length}.`),i;if(t[0]!==o&&t[0]!==f)return x().error(`The default framebuffer can only use the constants GL.BACK or GL.NONE as draw buffers but got ${t[0]}`),i}else if(t.includes(o))return x().error("A framebuffer object can only use the constants GL.COLOR_ATTACHMENTx or GL.NONE as draw buffers."),i;return this.gl.drawBuffers(t),r(this.gl),s?this._state.drawBuffers.defaultFramebuffer=t:this._state.drawBuffers.fbos.set(e,t),i}clear(t,e=255){t&&(16384&t&&this.setColorMask(!0,!0,!0,!0),256&t&&this.setDepthWriteEnabled(!0),1024&t&&this.setStencilWriteMask(e),this.gl.clear(t))}clearFramebuffer(t,e=!1,s=!1){let i=0;if(t){const e=1e-13,s=Math.max(e,t[3]);this.setClearColor(t[0],t[1],t[2],s),i|=16384}e&&(i|=256),!1===s?s=0:(!0===s&&(s=255),i|=1024),i&&this.clear(i,s)}clearBuffer(t,e,s=6144,i=void 0){this.gl.clearBufferfv(s,t,e,i)}clearBufferInteger(t,e,s=6144,i=void 0){this.gl.clearBufferiv(s,t,e,i)}clearBufferUnsignedInteger(t,e,s=6144,i=void 0){this.gl.clearBufferuiv(s,t,e,i)}drawArrays(t,e,s){if(this._transformFeedbackRequestInfo){if(t!==this._transformFeedbackRequestInfo.primitiveType)throw new Error("DrawArrays called during transform feedback, but primitiveType does not match that of the current transform feedback request");if(null==this._state.program?.hasTransformFeedbackVaryings)throw new Error("DrawArrays called during transform feedback, but the shader program was not linked with a transform feedback varying")}if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=E(t,s),has("enable-feature:webgl-debug:textureReadWrite"))){const t=this._state.textureUnitMap;for(let e=0;e<t.length;e++){const s=t[e];if(null!=s&&s===this._state.drawFramebuffer?.colorTexture)throw new Error(`Detected readWrite. Texture already bound at index ${e}`)}}this.gl.drawArrays(t,e,s),r(this.gl)}drawArraysInstanced(t,e,s,i){this.gl.drawArraysInstanced(t,e,s,i),r(this.gl)}drawElements(t,e,s,i){if(this._transformFeedbackRequestInfo)throw new Error("Cannot called drawElements during a transform feedback request");if(a()&&(this._numOfDrawCalls++,this._numOfTriangles+=E(t,e)),this.gl.drawElements(t,e,s,i),a()){const a=n(this.gl);if(a){const r=this.getBoundVAO(),n=r?.indexBuffer,l=r?.buffers,h={indexBuffer:n,vertexBuffers:l},f={mode:t,count:e,type:s,offset:i},o=n?.size??0,u=i+e,c=o<u?`. Buffer is too small. Attempted to draw index ${u} of ${o}`:"";x().error(`drawElements: ${a}${c}`,{args:f,vao:h})}}}drawElementsInstanced(t,e,s,i,a){this.gl.drawElementsInstanced(t,e,s,i,a),r(this.gl)}logInfo(){a()&&console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`)}resetInfo(){a()&&(this._numOfDrawCalls=0,this._numOfTriangles=0)}get capabilities(){return this._capabilities}setViewport(t,e,s,i){s=Math.max(Math.round(s),1),i=Math.max(Math.round(i),1);const a=this._state.viewport;a.x===t&&a.y===e&&a.width===s&&a.height===i||(a.x=t,a.y=e,a.width=s,a.height=i,this.gl.viewport(t,e,s,i))}setViewport4fv(t){this.setViewport(t[0],t[1],t[2],t[3])}restoreViewport({x:t,y:e,width:s,height:i}){this.setViewport(t,e,s,i)}getViewport(){const t=this._state.viewport;return{x:t.x,y:t.y,width:t.width,height:t.height}}useProgram(t){if(this._state.program!==t){if(t&&null==t.glName&&l())throw new Error("Attempting to use disposed or invalid Program");this._state.program?.stop(),this._state.program=t,this.gl.useProgram(t?.glName??null)}}bindTexture(t,e,s=!1){(e>=this.parameters.maxTextureImageUnits||e<0)&&x().error(`Input texture unit (${e}) is out of range of available units (0...${this.parameters.maxTextureImageUnits})\n `);const i=this._state.textureUnitMap[e];return null==t?.glName?(null!=i&&(this.setActiveTexture(e,s),this.gl.bindTexture(i.descriptor.target,null)),this._state.textureUnitMap[e]=null,i):s||i!==t?(this.setActiveTexture(e,s),this.gl.bindTexture(t.descriptor.target,t.glName),t.applyChanges(),this._state.textureUnitMap[e]=t,i):(t.isDirty&&(this.setActiveTexture(e,s),t.applyChanges()),i)}unbindTexture(t){if(null!=t)for(let e=0;e<this.parameters.maxTextureImageUnits;e++)this._state.textureUnitMap[e]===t&&(this.bindTexture(null,e),this._state.textureUnitMap[e]=null)}bindFramebuffer(t,e=!1){const s=C(t);if(e||this._state.readFramebuffer!==t||this._state.drawFramebuffer!==t){if(null==t)return this.gl.bindFramebuffer(36160,null),this._state.readFramebuffer=this._state.drawFramebuffer=null,void this.setDrawBuffers(s);t.initializeAndBind(36160),this._state.readFramebuffer=t,this._state.drawFramebuffer=t,this.setDrawBuffers(s)}else this.setDrawBuffers(s)}bindFramebufferSeparate(t,e,s=!1){const i=36008===e,a=i?this._state.readFramebuffer:this._state.drawFramebuffer;(s||a!==t)&&(null==t?this.gl.bindFramebuffer(e,null):t.initializeAndBind(e),i?this._state.readFramebuffer=t??null:(this._state.drawFramebuffer=t??null,this.setDrawBuffers(C(t))))}blitFramebuffer(t,e,s=16384,i=9728,a=0,r=0,n=t.width,l=t.height,h=0,f=0,o=e.width,u=e.height){this.bindFramebufferSeparate(t,36008,!0),this.bindFramebufferSeparate(e,36009,!0),this.gl.blitFramebuffer(a,r,n,l,h,f,o,u,s,i)}bindBuffer(t,e){if(t)switch(e??=t.bufferType,e){case 34962:this._state.vertexBuffer=w(this.gl,t,e,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=w(this.gl,t,e,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=w(this.gl,t,e,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=w(this.gl,t,e,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=w(this.gl,t,e,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=w(this.gl,t,e,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=w(this.gl,t,e,this._state.copyWriteBuffer);break;case 35982:this._state.transformFeedbackBuffer=w(this.gl,t,e,this._state.transformFeedbackBuffer)}}bindRenderbuffer(t){const e=this.gl;t||(e.bindRenderbuffer(e.RENDERBUFFER,null),this._state.renderbuffer=null),this._state.renderbuffer!==t&&(e.bindRenderbuffer(e.RENDERBUFFER,t.glName),this._state.renderbuffer=t)}_getBufferBinding(t,e){if(e>=this.parameters.maxUniformBufferBindings||e<0)return x().error(`Uniform buffer binding point (${e}) is out of range (0...${this.parameters.maxUniformBufferBindings})\n `),null;const s=35345===t?this._state.uniformBufferBindingPoints:this._state.transformBufferBindingPoints;let i=s[e];return null==i&&(i={buffer:null,offset:0,size:0},s[e]=i),i}bindBufferBase(t,e,s){const i=this._getBufferBinding(t,e);null!=i&&(i.buffer===s&&0===i.offset&&0===i.size||(this.gl.bindBufferBase(t,e,s?s.glName:null),i.buffer=s,i.offset=0,i.size=0))}bindBufferRange(t,e,s,i,a){const r=this._getBufferBinding(t,e);null!=r&&(r.buffer===s&&r.offset===i&&r.size===a||(i%this._parameters.uniformBufferOffsetAlignment===0?(this.gl.bindBufferRange(t,e,s.glName,i,a),r.buffer=s,r.offset=i,r.size=a):x().error("Uniform buffer binding offset is not a multiple of the context offset alignment")))}bindUBO(t,e,s,i){null!=e?(a()&&(i??e.byteLength)>this._parameters.maxUniformBlockSize&&x().error("Attempting to bind more data than the maximum uniform block size"),e.initialize(),void 0!==s&&void 0!==i?this.bindBufferRange(35345,t,e.buffer,s,i):this.bindBufferBase(35345,t,e.buffer)):this.bindBufferBase(35345,t,null)}unbindUBO(t){for(let e=0,s=this._state.uniformBufferBindingPoints.length;e<s;e++){const s=this._state.uniformBufferBindingPoints[e];null!=s&&s.buffer===t.buffer&&this.bindBufferBase(35345,e,null)}}unbindBuffer(t){switch(t){case 34962:this._state.vertexBuffer=w(this.gl,null,t,this._state.vertexBuffer);break;case 34963:this._state.indexBuffer=w(this.gl,null,t,this._state.indexBuffer);break;case 35345:this._state.uniformBuffer=w(this.gl,null,t,this._state.uniformBuffer);break;case 35051:this._state.pixelPackBuffer=w(this.gl,null,t,this._state.pixelPackBuffer);break;case 35052:this._state.pixelUnpackBuffer=w(this.gl,null,t,this._state.pixelUnpackBuffer);break;case 36662:this._state.copyReadBuffer=w(this.gl,null,t,this._state.copyReadBuffer);break;case 36663:this._state.copyWriteBuffer=w(this.gl,null,t,this._state.copyWriteBuffer)}}bindVAO(t,e){if(null==t)return this._state.vertexArrayObject?.unbind(),void(this._state.vertexArrayObject=null);this._state.vertexArrayObject!==t&&(t.bind(e),this._state.vertexArrayObject=t)}bindTransformFeedback(t){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,t.glName)}beginTransformFeedback(t,e){if(this._transformFeedbackRequestInfo)throw new Error("Already in a transform feedback request");const{gl:s}=this;s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,t.glName),s.beginTransformFeedback(e),this._transformFeedbackRequestInfo={primitiveType:e}}endTransformFeedback(){if(!this._transformFeedbackRequestInfo)throw new Error("Not in a transform feedback request");const{gl:t}=this;t.endTransformFeedback(),t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),this._transformFeedbackRequestInfo=null}async clientWaitAsync(t=i(10)){const{gl:e}=this,a=e.fenceSync(37143,0);if(!a)throw new Error("Client wait failed, could not create sync object");let r;this.instanceCounter.increment(c.Sync,a),e.flush();do{await s(t),r=e.clientWaitSync(a,0,0)}while(37147===r);if(this.instanceCounter.decrement(c.Sync,a),e.deleteSync(a),37149===r)throw new Error("Client wait failed")}getBoundFramebufferObject(t=36160){return 36008===t?this._state.readFramebuffer:this._state.drawFramebuffer}temporaryBindFramebufferObject(t,e,s=!1){const i=this.getBoundFramebufferObject();try{this.bindFramebuffer(t,s),e()}finally{this.bindFramebuffer(i,s)}}getBoundVAO(){return this._state.vertexArrayObject}resetState(){this.useProgram(null),this.bindVAO(null),this.bindFramebuffer(null,!0),this.unbindBuffer(34962),this.unbindBuffer(34963),this.unbindBuffer(35345),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(35051),this.unbindBuffer(35052),this.unbindBuffer(36662),this.unbindBuffer(36663);for(let t=0;t<this.parameters.maxTextureImageUnits;++t)this.bindTexture(null,t);this.setBlendingEnabled(!1),this.setBlendFunction(1,0),this.setBlendEquation(32774),this.setBlendColor(0,0,0,0),this.setFaceCullingEnabled(!1),this.setCullFace(1029),this.setFrontFace(2305),this.setPolygonOffsetFillEnabled(!1),this.setPolygonOffset(0,0),this.setScissorTestEnabled(!1),this.setScissorRect(0,0,this.gl.canvas.width,this.gl.canvas.height),this.setDepthTestEnabled(!1),this.setDepthFunction(513),this.setDepthRange(0,1),this.setStencilTestEnabled(!1),this.setStencilFunction(519,0,0),this.setStencilOp(7680,7680,7680),this.setClearColor(0,0,0,0),this.setClearDepth(1),this.setClearStencil(0),this.setColorMask(!0,!0,!0,!0),this.setStencilWriteMask(4294967295),this.setDepthWriteEnabled(!0),this.setViewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}enforceState(){const{gl:t}=this;t.bindVertexArray(null);for(let s=0;s<this.parameters.maxVertexAttributes;s++)t.disableVertexAttribArray(s);this._state.vertexBuffer?t.bindBuffer(this._state.vertexBuffer.bufferType,this._state.vertexBuffer.glName):t.bindBuffer(34962,null),this._state.indexBuffer?t.bindBuffer(this._state.indexBuffer.bufferType,this._state.indexBuffer.glName):t.bindBuffer(34963,null),this._state.uniformBuffer?t.bindBuffer(this._state.uniformBuffer.bufferType,this._state.uniformBuffer.glName):t.bindBuffer(35345,null);for(let s=0;s<this._parameters.maxUniformBufferBindings;s++){const e=this._state.uniformBufferBindingPoints[s];if(null!=e){const{buffer:i,offset:a,size:r}=e;null!==i?0===a&&0===r?t.bindBufferBase(35345,s,i.glName):t.bindBufferRange(35345,s,i.glName,a,r):t.bindBufferBase(35345,s,null)}}if(this._state.pixelPackBuffer?t.bindBuffer(this._state.pixelPackBuffer.bufferType,this._state.pixelPackBuffer.glName):t.bindBuffer(35051,null),this._state.pixelUnpackBuffer?t.bindBuffer(this._state.pixelUnpackBuffer.bufferType,this._state.pixelUnpackBuffer.glName):t.bindBuffer(35052,null),this._state.copyReadBuffer?t.bindBuffer(this._state.copyReadBuffer.bufferType,this._state.copyReadBuffer.glName):t.bindBuffer(36662,null),this._state.copyWriteBuffer?t.bindBuffer(this._state.copyWriteBuffer.bufferType,this._state.copyWriteBuffer.glName):t.bindBuffer(36663,null),t.bindFramebuffer(36008,null),t.readBuffer(t.BACK),this._state.readFramebuffer&&(t.bindFramebuffer(36008,this._state.readFramebuffer.glName),t.readBuffer(d)),t.bindFramebuffer(36009,this._state.drawFramebuffer?.glName??null),null===this._state.drawFramebuffer){const e=this._state.drawBuffers.defaultFramebuffer;t.drawBuffers(e??[o])}else{const e=this._state.drawBuffers.fbos.get(this._state.drawFramebuffer);t.drawBuffers(e??[d])}if(this._state.vertexArrayObject){const t=this._state.vertexArrayObject;this._state.vertexArrayObject&&(this._state.vertexArrayObject.unbind(),this._state.vertexArrayObject=null),this.bindVAO(t)}t.useProgram(this._state.program?.glName??null),t.blendColor(this._state.blendColor.r,this._state.blendColor.g,this._state.blendColor.b,this._state.blendColor.a),t.bindRenderbuffer(t.RENDERBUFFER,this._state.renderbuffer?.glName??null),!0===this._state.blend?t.enable(this.gl.BLEND):t.disable(this.gl.BLEND),t.blendEquationSeparate(this._state.blendEquation.mode,this._state.blendEquation.modeAlpha),t.blendFuncSeparate(this._state.blendFunction.srcRGB,this._state.blendFunction.dstRGB,this._state.blendFunction.srcAlpha,this._state.blendFunction.dstAlpha),t.clearColor(this._state.clearColor.r,this._state.clearColor.g,this._state.clearColor.b,this._state.clearColor.a),t.clearDepth(this._state.clearDepth),t.clearStencil(this._state.clearStencil),t.colorMask(this._state.colorMask.r,this._state.colorMask.g,this._state.colorMask.b,this._state.colorMask.a),t.cullFace(this._state.cullFace),t.depthFunc(this._state.depthFunction),t.depthRange(this._state.depthRange.zNear,this._state.depthRange.zFar),!0===this._state.depthTest?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),t.depthMask(this._state.depthWrite),t.frontFace(this._state.frontFace),t.lineWidth(1),!0===this._state.faceCulling?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),t.polygonOffset(this._state.polygonOffset[0],this._state.polygonOffset[1]),!0===this._state.polygonOffsetFill?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),t.scissor(this._state.scissorRect.x,this._state.scissorRect.y,this._state.scissorRect.width,this._state.scissorRect.height),!0===this._state.scissorTest?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),t.stencilFunc(this._state.stencilFunction.func,this._state.stencilFunction.ref,this._state.stencilFunction.mask),t.stencilOpSeparate(this._state.stencilOperation.face,this._state.stencilOperation.fail,this._state.stencilOperation.zFail,this._state.stencilOperation.zPass),!0===this._state.stencilTest?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),t.stencilMask(this._state.stencilWriteMask);for(let s=0;s<this.parameters.maxTextureImageUnits;s++){t.activeTexture(u+s),t.bindTexture(3553,null),t.bindTexture(34067,null),t.bindTexture(32879,null),t.bindTexture(35866,null);const e=this._state.textureUnitMap[s];null!=e&&t.bindTexture(e.descriptor.target,e.glName)}t.activeTexture(u+this._state.activeTexture);const e=this._state.viewport;t.viewport(e.x,e.y,e.width,e.height),this.resetInfo()}};function w(t,e,s,i){return e?i!==e&&t.bindBuffer(s,e.glName):t.bindBuffer(s,null),e}function E(t,e){switch(t){case _.POINTS:return 2*e;case _.TRIANGLES:return e/3;case _.TRIANGLE_STRIP:case _.TRIANGLE_FAN:return e-2;default:return 0}}function C(t){return t?t.colorAttachments.length>0?t.colorAttachments:[f]:[o]}export{k as RenderingContext,C as getFramebufferDrawBuffers};