@arcgis/core 6.0.0-next.35 → 6.0.0-next.37

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 (188) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0202eb8c2b2865f99981.js → 00311d1b18d5952a014b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/0b21d0e2e5a91c34a108.js +1 -0
  4. package/assets/esri/core/workers/chunks/{f717005e14a7e9141df7.js → 2050c844b5a29b1df28a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +1 -0
  6. package/assets/esri/core/workers/chunks/2f9072563194026e320e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{d9a240a3c6bf85124474.js → 342a97974a78007b25e0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +1 -0
  9. package/assets/esri/core/workers/chunks/{4d18b48d4a282a0f341c.js → 427d929dc7f89b0a1ea9.js} +1 -1
  10. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +1 -0
  11. package/assets/esri/core/workers/chunks/46969f379623810b2eca.js +1 -0
  12. package/assets/esri/core/workers/chunks/592b5db1459c02cf6a0c.js +1 -0
  13. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +1 -0
  14. package/assets/esri/core/workers/chunks/{379db67f78161ebd5468.js → 7023651ed6398dcf8efb.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{90360c0bd053d3e3fd77.js → 7027a0e7bfabb3bb7fc2.js} +1 -1
  16. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +1 -0
  17. package/assets/esri/core/workers/chunks/{40c2674dae73f0942751.js → 7d497df6e13162156342.js} +1 -1
  18. package/assets/esri/core/workers/chunks/8a3dfe997712dc2ddead.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81bcc495e6eaf2cf7474.js → 8f82a0a6747f673a2a7e.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d3369ffed19f4c264dcd.js → 9ab0735e86cf8932bf9d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +1 -0
  23. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +1 -0
  24. package/assets/esri/core/workers/chunks/{796c6195b6bf59dcc9bd.js → b25a05c58b0fd0f6ac60.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +1 -0
  26. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +1 -0
  27. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +1 -0
  28. package/assets/esri/core/workers/chunks/ce0274847ccce6a1ac53.js +1 -0
  29. package/assets/esri/core/workers/chunks/cf2e5f827cea7d7319ce.js +1 -0
  30. package/assets/esri/core/workers/chunks/dae2036faa28dade2119.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e8fb2ba7b7a4f0916325.js → eed4b90494a54f8b337b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +1 -0
  33. package/chunks/Clouds.glsl.js +7 -11
  34. package/chunks/RibbonLine.glsl.js +158 -84
  35. package/config.js +1 -1
  36. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  37. package/kernel.js +1 -1
  38. package/layers/BaseElevationLayer.js +1 -1
  39. package/layers/ElevationLayer.js +1 -1
  40. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  41. package/layers/IntegratedMeshLayer.d.ts +2 -0
  42. package/layers/IntegratedMeshLayer.js +1 -1
  43. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  44. package/layers/support/ElevationQuery.js +1 -1
  45. package/layers/video/VideoController.js +3 -3
  46. package/layers/video/types.d.ts +12 -0
  47. package/package.json +3 -3
  48. package/support/timeUtils.js +1 -1
  49. package/views/2d/engine/Bitmap.js +1 -1
  50. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  51. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  52. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  53. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  54. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  55. package/views/2d/engine/webgl/Overlay.js +1 -1
  56. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  57. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  58. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  59. package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
  60. package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
  61. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  62. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  68. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  69. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  70. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  71. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  72. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  73. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTexture.js +1 -1
  74. package/views/2d/engine/webgl/textureUtils.js +1 -1
  75. package/views/2d/layers/LayerView2D.js +1 -1
  76. package/views/2d/webglDeps.js +1 -1
  77. package/views/3d/GroundView3D.js +1 -1
  78. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  79. package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
  80. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  81. package/views/3d/input/SceneInputManager.js +1 -1
  82. package/views/3d/interactive/Manipulator3D.js +1 -1
  83. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  84. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  85. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  86. package/views/3d/layers/I3SMeshView3D.js +1 -1
  87. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  88. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  89. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  90. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  91. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  92. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  93. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  94. package/views/3d/support/engineContent/line.js +1 -1
  95. package/views/3d/support/engineContent/marker.js +1 -1
  96. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  97. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  98. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  99. package/views/3d/support/flow/geometryUtils.js +1 -1
  100. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  101. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  102. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  103. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  104. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  105. package/views/3d/support/gaussianSplatting/GaussianTileBuilder.js +2 -0
  106. package/views/3d/support/gaussianSplatting/formatConstants.js +2 -0
  107. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  108. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  109. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  110. package/views/3d/terrain/OverlayRenderer.js +1 -1
  111. package/views/3d/terrain/TerrainRenderer.js +1 -1
  112. package/views/3d/terrain/TerrainSurface.js +1 -1
  113. package/views/3d/terrain/TileCompositor.js +1 -1
  114. package/views/3d/terrain/TileRenderer.js +1 -1
  115. package/views/3d/webgl/RenderNode.d.ts +1 -1
  116. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  117. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  118. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  119. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  120. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +15 -11
  121. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  122. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  123. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  124. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  125. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  126. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  127. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  128. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  129. package/views/3d/webgl-engine/lib/AttributeView.js +1 -1
  130. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  131. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  132. package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
  133. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  134. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  135. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  136. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  137. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  138. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  139. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  140. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  141. package/views/3d/webgl-engine/lib/VerticesView.js +2 -0
  142. package/views/3d/webgl-engine/lib/attributeViewUtils.js +1 -1
  143. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  144. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  145. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  146. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  148. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  149. package/views/3d/webgl-engine/materials/internal/lineMarkerBufferUtils.js +2 -0
  150. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +2 -0
  151. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  152. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  153. package/views/draw/DrawTool.js +1 -1
  154. package/views/draw/support/ManagedTooltipField.js +1 -1
  155. package/views/support/TextureCompressionHelper.js +1 -1
  156. package/views/support/imageReprojection.js +1 -1
  157. package/views/webgl/FramebufferObject.js +1 -1
  158. package/views/webgl/RenderingContext.js +1 -1
  159. package/views/webgl/Texture.js +1 -1
  160. package/views/webgl/rasterUtils.js +1 -1
  161. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  162. package/views/webgl/textureUtils.js +1 -1
  163. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  164. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  165. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  166. package/widgets/OrientedImageryViewer.js +2 -2
  167. package/widgets/ScaleRangeSlider/types.d.ts +3 -3
  168. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +0 -1
  169. package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +0 -1
  170. package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +0 -1
  171. package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +0 -1
  172. package/assets/esri/core/workers/chunks/3223f9fbc76ba9ef8d13.js +0 -1
  173. package/assets/esri/core/workers/chunks/3fdcc383bbd9cf0d274c.js +0 -1
  174. package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +0 -1
  175. package/assets/esri/core/workers/chunks/48b8b57f559a53c6c513.js +0 -1
  176. package/assets/esri/core/workers/chunks/4a979fce1c971b614a18.js +0 -1
  177. package/assets/esri/core/workers/chunks/5bd1414220e42cb8ebcf.js +0 -1
  178. package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +0 -1
  179. package/assets/esri/core/workers/chunks/723df53cfa0189837d01.js +0 -1
  180. package/assets/esri/core/workers/chunks/7400b8c454b47ee4fb3c.js +0 -1
  181. package/assets/esri/core/workers/chunks/7af4edc6e87d27b9d467.js +0 -1
  182. package/assets/esri/core/workers/chunks/990e96139b5a1dccb061.js +0 -1
  183. package/assets/esri/core/workers/chunks/a607541959169741a943.js +0 -1
  184. package/assets/esri/core/workers/chunks/aa779896fd9e5c341349.js +0 -1
  185. package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +0 -1
  186. package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +0 -1
  187. package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +0 -1
  188. package/views/3d/webgl-engine/lib/GaussianSplatPrepassDepthRenderer.js +0 -2
@@ -600,7 +600,7 @@ vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0;`),g&&r.code.a
600
600
  normalTextureTransformMatrix[1][0]/scale[0], normalTextureTransformMatrix[1][1]/scale[1], 0.0,
601
601
  0.0, 0.0, 0.0 );
602
602
  rawNormal.xy = (normalRotation * vec3(rawNormal.x, rawNormal.y, 1.0)).xy;`),r.code.add(l.H`return tangentSpace * rawNormal;
603
- }`))}(e,t)}},68785(e,t,r){r.d(t,{n:()=>zt});var i=r(31821),n=r(12791),o=r(32198),a=r(34727),s=r(97768),l=r(36708),c=r(78659),u=r(91429),d=r(37585),h=r(69540);let f=class extends h.Pw{constructor(e){super(e),this.row=0,this.column=0,this.rows=1,this.columns=1}equals(e){return null!=e&&this.row===e.row&&this.rows===e.rows&&this.column===e.column&&this.columns===e.columns}};(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"rows",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"columns",void 0),f=(0,o.Cg)([(0,u.$K)("esri.CameraLayout")],f);const m=f;var p=r(69052),v=r(25482),g=r(78888),x=r(86738),_=r(43937),b=r(36005);let y=class extends((0,h.OU)(v.o)){constructor(...e){super(...e),this.position=new x.A([0,0,0]),this.heading=0,this.tilt=0,this.fov=55,this.layout=new m}normalizeCtorArgs(e,t,r,i){if(e&&"object"==typeof e&&("x"in e||Array.isArray(e))){let n={position:e};return null!=t&&(n.heading=t),null!=r&&(n.tilt=r),null!=i&&(n.fov=i),n}return e}writePosition(e,t,r,i){let n=e.clone();n.x=(0,g.GB)(e.x||0),n.y=(0,g.GB)(e.y||0),n.z=e.hasZ?(0,g.GB)(e.z||0):e.z,t[r]=n.write({},i)}readPosition(e,t){let r=new x.A;return r.read(e,t),r.x=(0,g.GB)(r.x||0),r.y=(0,g.GB)(r.y||0),r.z=r.hasZ?(0,g.GB)(r.z||0):r.z,r}equals(e){return null!=e&&this.tilt===e.tilt&&this.heading===e.heading&&this.fov===e.fov&&this.position.equals(e.position)&&this.layout.equals(e.layout)}};(0,o.Cg)([(0,u.MZ)({type:x.A,json:{write:{isRequired:!0}}})],y.prototype,"position",void 0),(0,o.Cg)([(0,_.K)("position")],y.prototype,"writePosition",null),(0,o.Cg)([(0,b.w)("position")],y.prototype,"readPosition",null),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>p.ie.normalize((0,g.GB)(e)))],y.prototype,"heading",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>(0,a.qE)((0,g.GB)(e),-180,180))],y.prototype,"tilt",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{default:55,write:!0}}),(0,u.wg)(e=>(0,a.qE)((0,g.GB)(e,55),1,170))],y.prototype,"fov",void 0),(0,o.Cg)([(0,u.MZ)({type:m,nonNullable:!0,json:{read:!1,write:!1}})],y.prototype,"layout",void 0),y=(0,o.Cg)([(0,u.$K)("esri.Camera")],y);var w=r(9093),M=r(35522),T=r(51850),S=r(16930),C=(r(48353),r(9762),r(65806)),A=r(27993),E=r(73941),I=(r(19419),r(58083)),O=r(65720),P=r(71351),D=r(69622),R=r(53966),F=r(90629),B=r(48163),N=r(78955),z=r(91829),L=r(44280);function H(e,t,r){e.worldUpAtPosition(t,V),(0,M.Re)(U,r,t);let i=(0,M.Bw)(U);return 0===i?0:(0,a.XM)((0,M.Om)(U,V)/i)}const V=(0,T.vt)(),U=(0,T.vt)();var j;let k=j=class extends D.A{constructor(e){super(e),this._ray=(0,P.vt)(),this._viewport=(0,z.fA)(0,0,1,1),this._padding=(0,z.fA)(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=(0,B.fA)(1,1e3),this._viewDirty=!0,this._viewMatrix=(0,w.vt)(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=(0,w.vt)(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=(0,w.vt)(),this._frustumDirty=!0,this._frustum=(0,O.vt)(),this._fullViewport=(0,z.vt)(),this._fullViewportDirty=!0,this._pixelRatio=1,this.pixelScale=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=(0,T.vt)(),this._up=(0,T.vt)(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin,"eye")}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return(0,M.Re)(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){(0,I.C)(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return(0,I.Qw)((0,w.vt)(),this.viewMatrix)||this._get("inverseViewMatrix")||(0,w.vt)()}get viewForward(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;let e=(0,N.hs)((0,z.vt)(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&(0,N.aI)(e,t)?t:e}get screenPadding(){if(1===this.pixelRatio)return this._padding;let e=(0,N.hs)((0,z.vt)(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&(0,N.aI)(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[3],this._viewport[0]!==e&&(this._viewport[0]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[2],this._viewport[1]!==e&&(this._viewport[1]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(e){this.width=e-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(e){this.height=e-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&=(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){(0,N.t2)(this._padding,e)||(this._viewport[0]+=e[3]-this._padding[3],this._viewport[1]+=e[2]-this._padding[2],this._viewport[2]-=e[1]+e[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=e[0]+e[2]-(this._padding[0]+this._padding[2]),(0,N.C)(this._padding,e),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&=((0,I.lw)(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return(0,I.B8)((0,w.vt)(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||(0,w.vt)()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovX(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovY(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return(0,M.Io)(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&((0,I.B8)(this._viewInverseTransposeMatrix,this.viewMatrix),(0,I.mg)(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){let{near:t,far:r}=this;return 2*t*r/(r+t-e*(r-t))}get renderPixelSizePerDistance(){return Math.tan(this.fovX/2)/(this.width/2)}get screenPixelSizePerDistance(){return this.renderPixelSizePerDistance*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){let e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,n=r/this.rows,o=i/this.columns,a=-i/2+this.column*o,s=a+o,l=-r/2+this.row*n,c=l+n,u=(0,I.$h)((0,w.vt)(),a*(1+2*this._padding[3]/e),s*(1+2*this._padding[1]/e),l*(1+2*this._padding[2]/t),c*(1+2*this._padding[0]/t),this.near,this.far),d=this._get("projectionMatrix");return d&&(0,I.t2)(d,u)?d:u}copyFrom(e){(0,M.C)(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,(0,N.C)(this._viewport,e.viewport),this.notifyChange("_viewport"),(0,N.C)(this._padding,e.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,(0,d.C)(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;let t=e;return this._viewDirty=t._viewDirty,this._viewDirty||((0,I.C)(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||=((0,O.C)(this._frustum,e.frustum),!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:((0,I.C)(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=e.pixelRatio,this.pixelScale=e.pixelScale,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return(new j).copyFrom(this)}equals(e){return(0,M.t2)(this.eye,e.eye)&&(0,M.t2)(this.center,e.center)&&(0,M.t2)(this.up,e.up)&&(0,N.t2)(this._viewport,e.viewport)&&(0,N.t2)(this._padding,e.padding)&&(0,d.t2)(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}equalsView(e){return(0,M.t2)(this.eye,e.eye)&&(0,M.t2)(this.center,e.center)&&(0,M.t2)(this.up,e.up)&&this._fov===e.fov}almostEquals(e){let t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||(0,N.hG)(e.screenPadding,this.screenPadding)>=t||(0,N.hG)(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;(0,M.jb)(Z,e.eye,e.center),(0,M.jb)($,this.eye,this.center);let r=(0,M.Om)(Z,$),i=(0,M.uE)(Z),n=(0,M.uE)($),o=5e-4;return r*r>=.9999999999*i*n&&(0,M.lo)(e.eye,this.eye)<Math.max(i,n)*o*o}computeRenderPixelSizeAt(e){return this.computeRenderPixelSizeAtDistance(this._viewDirectionDistance(e))}computeRenderPixelSizeAtDistance(e){return e*this.renderPixelSizePerDistance}computeScreenPixelSizeAt(e){return this.computeScreenPixelSizeAtDistance(this._viewDirectionDistance(e))}_viewDirectionDistance(e){return Math.abs((0,L.gr)(this.viewForward,(0,M.Re)(Z,e,this.eye)))}computeScreenPixelSizeAtDistance(e){return e*this.screenPixelSizePerDistance}computeDistanceFromRadius(e,t){return e/Math.tan(Math.min(this.fovX,this.fovY)/(2*(t||1)))}getScreenCenter(e=(0,F.gs)()){return e[0]=(this.padding[3]+this.width/2)/this.pixelRatio,e[1]=(this.padding[0]+this.height/2)/this.pixelRatio,e}getRenderCenter(e,t=.5,r=.5){return e[0]=this.padding[3]+this.width*t,e[1]=this.padding[2]+this.height*r,e[2]=.5,e}setGLViewport(e){let t=this.viewport,r=this.padding;e.setViewport(t[0]-r[3],t[1]-r[2],t[2]+r[1]+r[3],t[3]+r[0]+r[2])}applyProjection(e,t){e!==G&&(0,M.C)(G,e),G[3]=1,(0,N.Z0)(G,G,this.projectionMatrix);let r=Math.abs(G[3]);(0,M.hs)(G,G,1/r);let i=this.fullViewport;t[0]=(0,a.Cc)(0,i[0]+i[2],.5+.5*G[0]),t[1]=(0,a.Cc)(0,i[1]+i[3],.5+.5*G[1]),t[2]=.5*(G[2]+1),t[3]=r}unapplyProjection(e,t){let r=this.fullViewport;G[0]=(e[0]/(r[0]+r[2])*2-1)*e[3],G[1]=(e[1]/(r[1]+r[3])*2-1)*e[3],G[2]=(2*e[2]-1)*e[3],G[3]=e[3],null!=this.inverseProjectionMatrix&&((0,N.Z0)(G,G,this.inverseProjectionMatrix),t[0]=G[0],t[1]=G[1],t[2]=G[2])}projectToScreen(e,t){return null==this.projectToRenderScreen(e,q)?null:(this.renderToScreen(q,t),t)}projectToRenderScreen(e,t){if(G[0]=e[0],G[1]=e[1],G[2]=e[2],G[3]=1,(0,N.Z0)(G,G,this.viewProjectionMatrix),0===G[3])return null;let r=G;(0,M.hs)(r,r,1/Math.abs(G[3]));let i=this.fullViewport,n=(0,a.Cc)(0,i[0]+i[2],.5+.5*r[0]),o=(0,a.Cc)(0,i[1]+i[3],.5+.5*r[1]);return"x"in t?(t.x=n,t.y=o):(t[0]=n,t[1]=o,t.length>2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,q),t)}unprojectFromRenderScreen(e,t){if((0,I.lw)(W,this.projectionMatrix,this.viewMatrix),!(0,I.B8)(W,W))return null;let r=this.fullViewport;return G[0]=2*(e[0]-r[0])/r[2]-1,G[1]=2*(e[1]-r[1])/r[3]-1,G[2]=2*e[2]-1,G[3]=1,(0,N.Z0)(G,G,W),0===G[3]?null:(t[0]=G[0]/G[3],t[1]=G[1]/G[3],t[2]=G[2]/G[3],t)}constrainWindowSize(e,t,r,i){let n=e*this.pixelRatio,o=t*this.pixelRatio,a=Math.max(n-r/2,0),s=Math.max(this.fullHeight-o-i/2,0),l=-Math.min(n-r/2,0),c=-Math.min(this.fullHeight-o-i/2,0),u=r-l- -Math.min(this.fullWidth-n-r/2,0),d=i-c- -Math.min(o-i/2,0);return[Math.round(a),Math.round(s),Math.round(u),Math.round(d)]}computeUp(e){1===e?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){let r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){let r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}sphereFrustumCoverage(e,t){let{center:r,eye:i,distance:n,fovY:o}=this,a=Math.abs(Math.PI/2-H(t,r,i));return e.frustumCoverage(a,n,o)}_computeUpGlobal(){(0,M.Re)(Z,this.center,this.eye);let e=(0,M.Bw)(this.center);e<1?(0,M.t2)(this._up,T.Cb)&&((0,M.C)(this._up,T.Cb),this._markViewDirty(),this.notifyChange("_up")):Math.abs((0,M.Om)(Z,this.center))>.9999*(0,M.Bw)(Z)*e||((0,M.$A)($,Z,this.center),(0,M.$A)($,$,Z),(0,M.S8)($,$),(0,M.t2)(this._up,$)||((0,M.C)(this._up,$),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){(0,M.oW)(Z,this.eye,this.center),Math.abs(Z[2])<=.9999&&((0,M.hs)(Z,Z,Z[2]),(0,M.hZ)(Z,-Z[0],-Z[1],1-Z[2]),(0,M.S8)(Z,Z),(0,M.t2)(this._up,Z)||((0,M.C)(this._up,Z),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(e,t,r){"number"==typeof e[0]&&isFinite(e[0])&&"number"==typeof e[1]&&isFinite(e[1])&&"number"==typeof e[2]&&isFinite(e[2])?(0,M.t2)(e,t)||((0,M.C)(t,e),this._markViewDirty(),this.notifyChange(r)):R.A.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&=((0,O.ui)(this.viewMatrix,this.projectionMatrix,this._frustum),!1)}_ensureViewClean(){this._viewDirty&&((0,I.t5)(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};(0,o.Cg)([(0,u.MZ)()],k.prototype,"_viewport",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_padding",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_fov",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_nearFar",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_viewDirty",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_viewMatrix",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"pixelRatio",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_pixelRatio",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"pixelScale",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_rows",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"rows",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_columns",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"columns",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"eye",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"center",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_center",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"up",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_up",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"viewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"inverseViewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"viewForward",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"viewUp",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"viewRight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"nearFar",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"near",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"far",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"viewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"screenViewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"screenPadding",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"x",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"y",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"width",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"height",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fullWidth",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fullHeight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"_aspect",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"padding",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"projectionMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"inverseProjectionMatrix",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fov",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fovX",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fovY",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"viewInverseTransposeMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"_projectionMatrixInternal",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"relativeElevation",void 0),k=j=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl.RenderCamera")],k);const G=(0,z.vt)(),W=(0,w.vt)(),Z=(0,T.vt)(),$=(0,T.vt)(),q=(0,F.r_)();r(49718),r(6867),r(16396),(0,w.vt)(),(0,T.vt)(),(0,T.vt)(),(0,T.vt)();var Y=r(5443),X=r(39829),J=r(95108);function K(e,t,r,i){let n=function(e,t){let r=0===t||2===t?0:1,i=e[t],n=0===t||1===t?1:-1,o=+(0===r);return(e,t,a)=>{if(t[r]<i&&a[r]<i)return 1===n?0:1;if(t[r]>i&&a[r]>i)return+(1===n);let s=(a[o]-t[o])/(a[r]-t[r]),l=t[o]+s*(i-t[r]);return e[r]=i,e[o]=l,(t[r]<i?1:-1)*n>0?2:3}}(r,i);if(e.length=0,t.length){1===n(ee,t[0],t[0])&&Q(e,t[0]);for(let r=0;r<t.length;r++){let i=t[r===t.length-1?0:r+1];switch(n(ee,t[r],i)){case 1:Q(e,i);break;case 3:Q(e,(0,B.o8)(ee));break;case 2:Q(e,(0,B.o8)(ee)),Q(e,i)}}}}function Q(e,t){0!==e.length&&(0,d.aI)(e.at(-1),t)||e.push(t)}const ee=(0,B.vt)();var te=r(11964),re=r(27921);const ie=(0,T.vt)(),ne=(0,T.vt)();function oe(){return{direction:(0,T.vt)(),up:(0,T.vt)()}}function ae(e,t,r,i,n){let o=(0,M.S8)(ie,e),s=(0,M.Om)(o,i),l=s>0;s=Math.abs(s),s>.99&&(s=Math.abs((0,M.Om)(t,i)),s<.99?((0,M.C)(o,t),l&&(0,M.hs)(o,o,-1)):o=null);let c=0;if(o){(0,M.hs)(ne,i,(0,M.Om)(i,o)),(0,M.Re)(o,o,ne);let e=(0,M.Om)(o,n)/((0,M.Bw)(o)*(0,M.Bw)(n));(0,M.$A)(ne,o,n),c=((0,M.Om)(ne,i)>0?1:-1)*(0,a.KJ)((0,a.XM)(e))}let u=(0,a.KJ)((0,a.XM)(-(0,M.Om)(i,e)/(0,M.Bw)(e)));return r?(r.heading=c,r.tilt=u,r):{heading:c,tilt:u}}function se(e,t,r,i){(0,M.Re)(le,r,t),!(0,re.T7)(i,(0,te.LV)(t,le),e)&&e!==r&&(0,M.C)(e,r)}const le=(0,T.vt)(),ce=(0,T.fA)(0,1,0),ue=(0,T.fA)(0,0,1),de=(0,w.vt)(),he=(0,T.vt)(),fe=(0,T.vt)();function me(e,t,r,i=oe()){let{direction:n,up:o}=i;return(0,I.N9)(de,-(0,a.kU)(t)),(0,I.eL)(de,de,(0,a.kU)(r)),(0,M.Z0)(n,ue,de),(0,M.hs)(n,n,-1),(0,M.Z0)(o,ce,de),i}function pe(e,t,r,i,n){let o=t.lines[11].direction,a=(n-r.getAltitude(i))/o[2];(0,M.Ln)(e,i,o,a)}const ve=(0,T.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){return ae(t,r,i,ue,ce)},eyeForCenterWithHeadingTilt:function(e,t,r,i){let n=me(0,r,i),o=(0,T.vt)();return(0,M.hs)(o,n.direction,-t),(0,M.WQ)(o,o,e),{up:n.up,eye:o,heading:r,tilt:i}},eyeTiltToLookAtTilt:function(e){return(0,a.kU)(e)},headingTiltToDirectionUp:me,lookAtTiltToEyeTilt:function(e){return(0,a.KJ)(e)},toArea:function(e,t){let r=e.frustum,{renderCoordsHelper:i}=e,n=i.getAltitude(t),o=e.spatialReference,a=e.state.camera.eye,s=[],l=r.planes[5];for(let e=0;e<4;e++){let t=r.lines[e];i.intersectInfiniteManifold((0,P.LV)(t.origin,t.direction),n,ve)||pe(ve,r,i,t.endpoint,n),se(ve,a,ve,l),s.push((0,B.fA)(ve[0],ve[1]))}return function(e,t,r){let i=e.map(e=>((0,M.hZ)(ve,e[0],e[1],0),t.fromRenderCoords(ve,ve,r),[ve[0],ve[1]]));return i.length<=2?new X.A({spatialReference:r}):(i.push(i[0].slice()),(0,J.$3)(i)||i.reverse(),new X.A({rings:[i],spatialReference:r}))}(function(e,t){let r=[],i=[];return K(r,e,t,0),K(i,r,t,1),K(r,i,t,2),K(i,r,t,3),i}(s,i.extent),i,o)},toExtent:function(e,t,r,i,n){let o=e.renderSpatialReference,a=e.spatialReference??t.spatialReference;return(0,C.g)(t,he,o),(0,C.g)(t,fe,o),he[0]-=r/2,fe[0]+=r/2,he[1]-=i/2,fe[1]+=i/2,(0,A.F)(he,o,he,a),(0,A.F)(fe,o,fe,a),n?(n.xmin=he[0],n.ymin=he[1],n.xmax=fe[0],n.ymax=fe[1],n.spatialReference=a):n=new Y.A(he[0],he[1],fe[0],fe[1],a),n}},Symbol.toStringTag,{value:"Module"}));var ge=r(34304),xe=r(52039),_e=r(28540),be=r(28735);class ye{get planes(){return this.frustum}get points(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(e){this.renderCoordsHelper=e,this.frustum=(0,O.vt)(),this._points=(0,O.Qy)(),this.lines=Array(12),this._origin=(0,T.vt)(),this._direction=(0,T.vt)(),this._boundingSphere=new _e.i,this._altitude=null,this._boundingSphereDirty=!0;for(let e=0;e<12;e++)this.lines[e]={origin:null,direction:(0,T.vt)(),endpoint:null}}update(e){(0,O.ui)(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),(0,M.C)(this._origin,e.eye),(0,M.C)(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}get altitude(){return this._altitude}intersectsSphere(e){return(0,O.m7)(this.frustum,e)}isConvexHullOutsideViewPyramid(e,t){return(0,O.Pi)(this.frustum,e,t)}intersectsRay(e){return(0,O.pw)(this.frustum,e)}intersectsLineSegment(e,t){return(0,O.ST)(this.frustum,e,t)}lineSegmentIntersectsViewPyramid(e,t){return(0,O.LJ)(this.frustum,e,t)}intersectsPoint(e){return(0,O.bU)(this.frustum,e)}_updateLines(){let e=this._points;for(let t=0;t<4;t++){let r=t+4;we(this.lines[t],e[t],e[r]),we(this.lines[t+4],e[t],3===t?e[0]:e[t+1]),we(this.lines[t+8],e[r],3===t?e[4]:e[r+1])}}_updateBoundingSphere(){let{origin:e}=this,t=Te;(0,M.S8)(t,this.direction);let r=Me;(0,M.jb)(r,this.points[4],e);let i=.5*(0,M.Om)(r,r)/(0,M.Om)(t,r),n=this._boundingSphere;n.center=(0,M.Ln)(Se,e,t,i),n.radius=i}static{this.planePointIndices=O.c8}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function we(e,t,r){e.origin=t,e.endpoint=r,(0,M.oW)(e.direction,t,r)}const Me=(0,T.vt)(),Te=(0,T.vt)(),Se=(0,T.vt)();r(86211);const Ce=(0,T.fA)(5802e-9,13558e-9,331e-7),Ae=(0,T.fA)(195e-8,5643e-9,255e-9);(0,T.fA)(Ce[0]+Ae[0],Ce[1]+Ae[1],Ce[2]+Ae[2]);class Ee{constructor(e=1/0,t=-1/0){this.near=e,this.far=t}set(e,t){this.near=e,this.far=t}union(e){return null!=e&&(this.near=Math.min(this.near,e.near),this.far=Math.max(this.far,e.far)),this}within(e){return this.near<=e&&e<=this.far}equals(e){return this.near===e.near&&this.far===e.far}static{this.Zero=new Ee(0,0)}static{this.Infinite=new Ee}}(0,T.vt)(),(0,T.vt)(),new _e.i,(0,P.vt)(),new Y.A({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});var Ie=r(32728);const Oe=(0,T.fA)(0,0,1),Pe=(0,M.S8)((0,T.vt)(),(0,T.fA)(1,1,1)),De=(0,w.vt)(),Re=(0,T.vt)(),Fe=(0,T.vt)();function Be(e,t,r,i=oe()){(0,M.$A)(Re,e,Oe),0===(0,M.Om)(Re,Re)&&(0,M.$A)(Re,e,Pe),(0,I.$0)(De,-(0,a.kU)(t),e),(0,I.e$)(De,De,-(0,a.kU)(r),Re);let{up:n,direction:o}=i;return(0,M.$A)(n,Re,e),(0,M.S8)(n,n),(0,M.Z0)(n,n,De),(0,M.S8)(o,e),(0,M.ze)(o,o),(0,M.Z0)(o,o,De),i}function Ne(e){let t=e[1];e[1]=-e[2],e[2]=t}function ze(e,t){return e.up=Be(t,e.heading,e.tilt).up,e}function Le(e,t){let{renderCoordsHelper:r,state:i}=e;if(1!==i.viewingMode)return 1;let n=r.getAltitude(t),o=r.referenceEllipsoid.radius,s=1+(0,M.Io)(i.camera.eye,t)/(o+n),l=Math.sqrt(s*s-1),{minCurvature:c,maxCurvature:u,minSamples:d,maxSamples:h}=Ve,f=(0,a.qE)((l-c)/(u-c),0,1);return Math.round((0,a.Cc)(d,h,f))}function He(e,t){let r=[],i=[],n=(0,ge.FD)();for(let o=0;o<e.length;o++){let a=e[o],s=o===e.length-1?e[0]:e[o+1],l=(0,te.Cr)(a,s,$e),c=(0,re.vE)(t,l.origin,l.vector,0,We);switch(c){case 2:r.push(a);break;case 3:i.push(a);break;case 0:case 1:{let[e,o,s]=0===c?[1,r,i]:[-1,i,r],l=(0,re.Qj)(t),u=(0,M.Ln)((0,T.vt)(),We,l,e*n),d=(0,M.Ln)((0,T.vt)(),We,l,e*-n);o.push(a),o.push(u),s.push(d)}}}let o=[];return r.length&&o.push(r),i.length&&o.push(i),o}const Ve={minCurvature:(0,a.kU)(5),maxCurvature:(0,a.kU)(50),minSamples:1,maxSamples:6},Ue=(0,T.fA)(1,0,0),je=(0,T.fA)(0,1,0),ke=(0,T.vt)(),Ge=(0,T.vt)(),We=(0,T.vt)(),Ze=new _e.i,$e=(0,te.vt)(),qe=(0,z.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){let n=Re,o=Fe;return(0,M.S8)(n,e),(0,M.$A)(Fe,n,Oe),0===(0,M.Om)(Fe,Fe)&&(0,M.$A)(Fe,n,Pe),(0,M.$A)(o,Fe,n),ae(t,r,i,n,o)},eyeForCenterWithHeadingTilt:function(e,t,r,i){let n={eye:(0,T.vt)(),up:null,tilt:i,heading:r},o=Re;o[0]=e[0],o[1]=e[2],o[2]=-e[1];let s,l=t,c=(0,a.kU)(r),u=(0,a.kU)(i),d=Math.sin(c),h=Math.cos(c),f=Math.sin(u),m=Math.cos(u),p=(0,M.Bw)(o);if(Math.abs(u)<1e-8)s=l+p;else{let e=p/f,t=(0,a.YN)(l/e),r=Math.PI-u-t;s=e*Math.sin(r)}let v=m*l,g=l*l*(f*f),x=h*h*g,_=s-v,b=_*_,y=x*(x+b-o[1]*o[1]);if(y<0)return(0,M.hs)(n.eye,o,s/p),n.tilt=0,ze(n,e);let w,S=Math.sqrt(y),C=o[1]*_,A=x+b;if(w=h>0?-S+C:S+C,Math.abs(A)<1e-8)return p<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=l):(0,M.hs)(n.eye,o,s/p),n.tilt=0,Ne(n.eye),ze(n,e);n.eye[1]=w/A;let E=d*d*g,I=f*l,O=h*I*n.eye[1],P=n.eye[1]*n.eye[1],D=1-P,R=Math.sqrt(D),F=x*P+E-2*O*R*_+D*b;return Math.abs(F)<1e-8?((0,M.hs)(n.eye,o,s/p),n.tilt=0,Ne(n.eye),ze(n,e)):(n.eye[0]=(D*(s*o[0]-v*o[0])-I*R*(o[0]*n.eye[1]*h+o[2]*d))/F,n.eye[2]=(D*(s*o[2]-v*o[2])-I*R*(o[2]*n.eye[1]*h-o[0]*d))/F,(0,M.hs)(n.eye,n.eye,s),Ne(n.eye),ze(n,e))},eyeTiltToLookAtTilt:function(e,t,r){let i=(0,a.kU)(e),n=(0,M.Bw)(t);return(0,a.YN)(r/(n/Math.sin(i)))+i},getCurvatureSamples:Le,headingTiltToDirectionUp:Be,lookAtTiltToEyeTilt:function(e,t,r){let i=(0,M.Bw)(t),n=Math.sqrt(r*r+i*i-2*r*i*Math.cos(Math.PI-e)),o=(0,a.YN)(r/(n/Math.sin(e)));return(0,a.KJ)(e-o)},toArea:function(e,t){let{renderCoordsHelper:r}=e,i=e.state.camera.clone(),n=new ye(r);i.near=2,n.update(i);let o=r.getAltitude(t),s=e.spatialReference,l=i.eye,c=function(e){let{renderCoordsHelper:t,state:r}=e,i=Math.abs(t.getAltitude(r.camera.center));return Ze.radius=t.referenceEllipsoid.radius+i,r.camera.sphereFrustumCoverage(Ze,t)}(e),u=Le(e,t),d=i.aboveGround,h=n.planes[5],f=[],m=(0,re.O_)(T.uY,Ue,(0,re.vt)()),p=(0,re.O_)(T.uY,je,(0,re.vt)());(0,N.hZ)(qe,0,0,0,0);for(let e=0;e<4;e++){let t=1===e&&!d||3===e&&d?1-c:0,i=1===e&&d||3===e&&!d?c:1,s=n.lines[e],v=n.lines[3===e?0:e+1];for(let n=0;n<u;n++){let c=n/u,d=1===e?1-(1-c)**2:3===e?c**2:c,g=0===n?0:(0,a.Cc)(t,i,d),x=(0,M.Cc)(Ge,s.origin,v.origin,g),_=(0,Ie.nu)(s.direction,v.direction,g,ke);r.intersectManifoldClosestSilhouette((0,P.LV)(x,_),o,We),se(We,l,We,h),f.push((0,T.o8)(We)),0!==f.length&&(0,M.lo)(f.at(-1),We);let b=+!!(0,re.BX)(m,We)|((0,re.BX)(p,We)?2:0);qe[b]=1}}f.length>2&&(0,M.lo)(f[0],f.at(-1));let v=function(e,t,r){let i=2*(0,ge.FD)();return e.map(e=>{let n=[],o=!1;for(let a of e)t.fromRenderCoords(a,We,r),Math.abs(a[0])<i&&Math.abs(a[1])<i?(n.push([null,We[1]]),n.push([null,We[1]]),o=!0):n.push([We[0],We[1]]);if(o)for(let e=0;e<n.length;e++){let t=n[e];if(null!=t[0])continue;let r=n[e+1];t[0]=n.at(0===e?-1:e-1)[0],e++,r[0]=n.at(e===n.length-1?0:e+1)[0]}return n.push(n[0]),(0,J.$3)(n)||n.reverse(),n})}((0,N.m3)(qe)>1?function(e,t){let r=[];for(let i of e)r.push(...He(i,t));return r}(He(f,m),p):[f],r,s);return new X.A({rings:v,spatialReference:s})},toExtent:function(e,t,r,i,n){let o,s,l,c,u=t.latitude,d=(0,E.tO)(e.spatialReference).radius,h=t.longitude,f=function(e,t,r){let i=t/r,n=(0,a.kU)(e),o=Math.sin(i/2),s=Math.cos(n),l=2*(0,a.YN)(Math.sqrt(o*o/(s*s)));return(0,a.KJ)(l)}(u,r,d)/2;o=h-f,s=h+f;let m=(0,a.kU)(u),v=(1+Math.sin(m))/(1-Math.sin(m)),g=(v+1)*Math.tan(i/d/2),x=g*g;function _(e){let t=Math.PI/2;return(e=p.uC.normalize(e,-t))>t&&(e=Math.PI-e),e}if(l=1.5*Math.PI-2*Math.atan(.5*(g+Math.sqrt(4*v+x))),c=l+i/d,l=_(l),c=_(c),c<l){let e=c;c=l,l=e}if(l=Math.max((0,a.KJ)(l),-90),c=Math.min((0,a.KJ)(c),90),s=xe.Y_.monotonic(o,s),s-o>180){let e=(s-o-180)/2;o+=e,s-=e}let b=e.spatialReference&&e.spatialReference.isGeographic?e.spatialReference:S.A.WGS84;return n?(n.xmin=o,n.ymin=l,n.xmax=s,n.ymax=c,n.spatialReference=b):n=new Y.A(o,l,s,c,b),e.spatialReference&&e.spatialReference.isWebMercator&&(0,be.Gh)(n,!1,n),n}},Symbol.toStringTag,{value:"Module"}));const Ye="composite-color",Xe=["final-color",Ye,"opaque-color","transparent-color"],Je={ANTIALIASING:"antialiasing",CUTFILL:"cutfill",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA:"focusarea",FOCUSAREA_MASK:"focusarea-mask",GAUSSIAN_SPLAT:"gaussian",GAUSSIAN_SPLAT_DEPTH:"gaussian-depth",GROUND_DEPTH:"ground-depth",HIGHLIGHT:"highlight",LASERLINES:"laserlines",TRANSPARENT_NO_DEPTH:"transparent-no-depth",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_OCCLUSION_QUERY:"opaque-occlusion-query",OPAQUE_ENVIRONMENT:"opaque-environment",TRANSPARENT_ENVIRONMENT:"transparent-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_ACCUMULATION:"shadow-accumulation",SHADOWMAP:"shadowmap",SHADOW_HIGHLIGHT:"shadow-highlight",VOXEL:"voxel",VIEWSHED:"viewshed",OBJECT_AND_LAYER_ID_COLOR:"olid"};Array.from(Object.values(Je)).concat(Xe),(0,T.vt)();var Ke=r(49186),Qe=r(10107),et=r(64108),tt=r(44208),rt=(r(17676),r(94656)),it=r(63907);r(93637),r(4576),"layout.centroid.smooth.case.mat2x2.mat2x3.mat2x4.mat3x2.mat3x3.mat3x4.mat4x2.mat4x3.mat4x4.uint.uvec2.uvec3.uvec4.samplerCubeShadow.sampler2DArray.sampler2DArrayShadow.isampler2D.isampler3D.isamplerCube.isampler2DArray.usampler2D.usampler3D.usamplerCube.usampler2DArray.coherent.restrict.readonly.writeonly.resource.atomic_uint.noperspective.patch.sample.subroutine.common.partition.active.filter.image1D.image2D.image3D.imageCube.iimage1D.iimage2D.iimage3D.iimageCube.uimage1D.uimage2D.uimage3D.uimageCube.image1DArray.image2DArray.iimage1DArray.iimage2DArray.uimage1DArray.uimage2DArray.image1DShadow.image2DShadow.image1DArrayShadow.image2DArrayShadow.imageBuffer.iimageBuffer.uimageBuffer.sampler1DArray.sampler1DArrayShadow.isampler1D.isampler1DArray.usampler1D.usampler1DArray.isampler2DRect.usampler2DRect.samplerBuffer.isamplerBuffer.usamplerBuffer.sampler2DMS.isampler2DMS.usampler2DMS.sampler2DMSArray.isampler2DMSArray.usampler2DMSArray.trunc.round.roundEven.isnan.isinf.floatBitsToInt.floatBitsToUint.intBitsToFloat.uintBitsToFloat.packSnorm2x16.unpackSnorm2x16.packUnorm2x16.unpackUnorm2x16.packHalf2x16.unpackHalf2x16.outerProduct.transpose.determinant.inverse.texture.textureSize.textureProj.textureLod.textureOffset.texelFetch.texelFetchOffset.textureProjOffset.textureLodOffset.textureProjLod.textureProjLodOffset.textureGrad.textureGradOffset.textureProjGrad.textureProjGradOffset".split("."),"precision.highp.mediump.lowp.attribute.const.uniform.varying.break.continue.do.for.while.if.else.in.out.inout.float.int.void.bool.true.false.discard.return.mat2.mat3.mat4.vec2.vec3.vec4.ivec2.ivec3.ivec4.uvec2.uvec3.uvec4.bvec2.bvec3.bvec4.sampler1D.sampler2D.sampler3D.usampler1D.usampler2D.usampler3D.samplerCube.sampler1DShadow.sampler2DShadow.struct.asm.class.union.enum.typedef.template.this.packed.goto.switch.default.inline.noinline.volatile.public.static.extern.external.interface.long.short.double.half.fixed.unsigned.input.output.hvec2.hvec3.hvec4.dvec2.dvec3.dvec4.fvec2.fvec3.fvec4.sampler2DRect.sampler3DRect.sampler2DRectShadow.sizeof.cast.namespace.using".split("."),"<<= >>= ++ -- << >> <= >= == != && || += -= *= /= %= &= ^^ ^= |= ( ) [ ] . ! ~ * / % + - < > & ^ | ? : = , ; { }".split(" "),"abs.acos.all.any.asin.atan.ceil.clamp.cos.cross.dFdx.dFdy.degrees.distance.dot.equal.exp.exp2.faceforward.floor.fract.gl_BackColor.gl_BackLightModelProduct.gl_BackLightProduct.gl_BackMaterial.gl_BackSecondaryColor.gl_ClipPlane.gl_ClipVertex.gl_Color.gl_DepthRange.gl_DepthRangeParameters.gl_EyePlaneQ.gl_EyePlaneR.gl_EyePlaneS.gl_EyePlaneT.gl_Fog.gl_FogCoord.gl_FogFragCoord.gl_FogParameters.gl_FragColor.gl_FragCoord.gl_FragData.gl_FragDepth.gl_FragDepthEXT.gl_FrontColor.gl_FrontFacing.gl_FrontLightModelProduct.gl_FrontLightProduct.gl_FrontMaterial.gl_FrontSecondaryColor.gl_LightModel.gl_LightModelParameters.gl_LightModelProducts.gl_LightProducts.gl_LightSource.gl_LightSourceParameters.gl_MaterialParameters.gl_MaxClipPlanes.gl_MaxCombinedTextureImageUnits.gl_MaxDrawBuffers.gl_MaxFragmentUniformComponents.gl_MaxLights.gl_MaxTextureCoords.gl_MaxTextureImageUnits.gl_MaxTextureUnits.gl_MaxVaryingFloats.gl_MaxVertexAttribs.gl_MaxVertexTextureImageUnits.gl_MaxVertexUniformComponents.gl_ModelViewMatrix.gl_ModelViewMatrixInverse.gl_ModelViewMatrixInverseTranspose.gl_ModelViewMatrixTranspose.gl_ModelViewProjectionMatrix.gl_ModelViewProjectionMatrixInverse.gl_ModelViewProjectionMatrixInverseTranspose.gl_ModelViewProjectionMatrixTranspose.gl_MultiTexCoord0.gl_MultiTexCoord1.gl_MultiTexCoord2.gl_MultiTexCoord3.gl_MultiTexCoord4.gl_MultiTexCoord5.gl_MultiTexCoord6.gl_MultiTexCoord7.gl_Normal.gl_NormalMatrix.gl_NormalScale.gl_ObjectPlaneQ.gl_ObjectPlaneR.gl_ObjectPlaneS.gl_ObjectPlaneT.gl_Point.gl_PointCoord.gl_PointParameters.gl_PointSize.gl_Position.gl_ProjectionMatrix.gl_ProjectionMatrixInverse.gl_ProjectionMatrixInverseTranspose.gl_ProjectionMatrixTranspose.gl_SecondaryColor.gl_TexCoord.gl_TextureEnvColor.gl_TextureMatrix.gl_TextureMatrixInverse.gl_TextureMatrixInverseTranspose.gl_TextureMatrixTranspose.gl_Vertex.greaterThan.greaterThanEqual.inversesqrt.length.lessThan.lessThanEqual.log.log2.matrixCompMult.max.min.mix.mod.normalize.not.notEqual.pow.radians.reflect.refract.sign.sin.smoothstep.sqrt.step.tan.texture2D.texture2DLod.texture2DProj.texture2DProjLod.textureCube.textureCubeLod.texture2DLodEXT.texture2DProjLodEXT.textureCubeLodEXT.texture2DGradEXT.texture2DProjGradEXT.textureCubeGradEXT.textureSize.texelFetch".split("."),new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]),new Map,(0,tt.A)("esri-tests-disable-gpu-memory-measurements"),(0,rt.en)();(0,rt.en)();var nt=r(90644),ot=r(21231),at=r(48852),st=r(42293);const lt=!!(0,tt.A)("esri-tests-disable-gpu-memory-measurements");class ct{constructor(e,t){this._context=e,this._descriptor=t,this.type=2,this._context.instanceCounter.increment(it.vt.Renderbuffer,this);let r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);let{width:i,height:n,internalFormat:o,multisampled:a}=t;a?r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,i,n):r.renderbufferStorage(r.RENDERBUFFER,o,i,n),this._context.bindRenderbuffer(null)}get descriptor(){return this._descriptor}get samples(){let e=this._descriptor.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}get usedMemory(){return lt?0:(e=this._descriptor).width<=0||e.height<=0||null==e.internalFormat?0:e.width*e.height*(0,st.MW)(e.internalFormat);var e}resize(e,t){let r=this._descriptor;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;let i=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height),this._context.bindRenderbuffer(null)}dispose(){this._context&&=(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(it.vt.Renderbuffer,this),null)}}class ut{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(it.vt.FramebufferObject,this),null!=t){let r=function(e,t){return dt(t)||ht(t)?t:ft(t)?new ot.A(e,t):function(e){return 3===mt(e)||null!=e&&"samples"in e}(t)?new ct(e,t):null}(e,t);null!=r&&(this._colorAttachments.set(36064,r),dt(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(36064)}if(null!=r)if(function(e){return dt(e)||ft(e)}(r))this._depthStencilTexture=dt(r)?r:new ot.A(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{let t=ht(r)?r:new ct(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){let e=this._colorAttachments.get(36064);return dt(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){return(this._colorAttachments.get(36064)??this._depthStencilTexture??this._depthStencilBuffer)?.descriptor?.width??0}get height(){return(this._colorAttachments.get(36064)??this._depthStencilTexture??this._depthStencilBuffer)?.descriptor?.height??0}get usedMemory(){return this._colorAttachments.values().reduce((e,t)=>e+t.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebuffer(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){let t=this._colorAttachments.get(e);return t&&dt(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=36064){if(!e)return;this._validateColorAttachmentPoint(t);let{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=36064){let t=this._colorAttachments.get(e);if(!t)return;let r=dt(t);return this._glName&&this._context.temporaryBindFramebuffer(this,()=>{if(r)this._framebufferTexture2D(null,e);else{let t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){let t=this._context.gl;this._context.temporaryBindFramebuffer(this,()=>{e.forEach(e=>{dt(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=36064,r=0){let i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;let{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041!==r&&6402!==r?console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"):34041===r&&i!==it.ld.UNSIGNED_INT_24_8?console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):6402===r&&i!==it.ld.UNSIGNED_INT&&i!==it.ld.UNSIGNED_SHORT?console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,gt(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e)}detachDepthStencilTexture(){let e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebuffer(this,()=>{this._framebufferTexture2D(null,gt(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;let t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);let{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){let e=this._depthStencilBuffer;if(e&&this._glName){let{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);let{gl:i}=t,n=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,n,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){let{_context:t}=this;t.temporaryBindFramebuffer(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,n,o,a){(e<0||t<0||n<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");let s=a.descriptor;3553!==a.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==s?.width||null==s?.height||e+r>this.width||t+i>this.height||n+r>s.width||o+i>s.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");let l=this._context,c=l.bindTexture(a,ot.A.TEXTURE_UNIT_FOR_UPDATES);l.setActiveTexture(ot.A.TEXTURE_UNIT_FOR_UPDATES),l.bindFramebuffer(this),l.gl.copyTexSubImage2D(3553,0,n,o,e,t,r,i),l.bindTexture(c,ot.A.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,n,o,a){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,n,o,a)}async readPixelsAsync(e,t,r,i,n,o,a,s){let{gl:l}=this._context,c=at.g.createPixelPack(this._context,35041,a.byteLength);try{this._context.bindBuffer(c);let u=this._context.boundFramebuffer;try{this._context.bindFramebuffer(this),l.readPixels(e,t,r,i,n,o,0)}finally{this._context.unbindBuffer(35051),this._context.bindFramebuffer(u)}await c.getSubDataAsync(a,void 0,void 0,void 0,s)}finally{c.dispose()}}resize(e,t){if(this.width===e&&this.height===t)return;let r={width:e,height:t};if(pt(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(pt(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),(0,rt.en)())){let{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){let{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){let{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(dt(t)){let i=vt(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(ht(t)){let i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){let r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){let t=gt(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,vt(this._depthStencilTexture),e)}(0,rt.en)()&&t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}_framebufferTexture2D(e,t=36064,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=36064,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){let e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);let t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=(0,s.WD)(this._depthStencilBuffer)}this._depthStencilTexture&&=(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,gt(this._depthStencilTexture.descriptor.pixelFormat))),(0,s.WD)(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),pt(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){pt(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width!==e.width||this.height!==e.height)&&console.error("Attachment size must match framebuffer size!")}_getGLAttachmentPoint(e){switch(e.internalFormat){case it.SB.DEPTH_COMPONENT16:case it.SB.DEPTH_COMPONENT24:case it.SB.DEPTH_COMPONENT32F:return 36096;case it.iE.DEPTH24_STENCIL8:case it.iE.DEPTH32F_STENCIL8:return 33306;case 36168:return 36128;default:return 36064}}_validateColorAttachmentPoint(e){if(-1===ut._MAX_COLOR_ATTACHMENTS){let{gl:e}=this._context;ut._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}let t=e-36064;t+1>ut._MAX_COLOR_ATTACHMENTS&&R.A.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${ut._MAX_COLOR_ATTACHMENTS} color attachments`)}}function dt(e){return 1===mt(e)}function ht(e){return 2===mt(e)}function ft(e){return 0===mt(e)}function mt(e){return null!=e&&"type"in e?e.type:null}function pt(e,t){let r=Math.max(e.width,e.height);if(r>t){R.A.getLogger("esri.views.webgl.FramebufferObject").warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);let i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function vt(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function gt(e){return 6402===e?36096:33306}var xt=r(67171),_t=(r(21818),r(69397),r(85079));const bt=[new(r(74038)._)("position",2,it.pe.UNSIGNED_SHORT,0,4)];(0,_t.Xk)(bt),r(66289);const yt=new Image;yt.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",yt.width=5,yt.height=5,yt.decode();let wt=class extends D.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=Ye,this._dirty=!0}initialize(){this.addHandles([(0,l.wB)(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},l.Vh)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new Ke.A("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view.stage.renderView.renderingContext.gl}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){let e=this._frameBuffer?.getTexture()?.descriptor,t=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return this._bind(t),t}bindRenderTarget(){return this._bind(this._frameBuffer),this._frameBuffer}_bind({fbo:e}){e.initializeAndBind(),this.gl.drawBuffers(function(e){return e?e.colorAttachments.length>0?e.colorAttachments:[0]:[1029]}(e))}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0:this._dirty=!0}}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view.stage.renderer.fboCache}get bindParameters(){return this.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}get requireGeometryDepth(){return!1}queryDepthRange(e){return null}get input(){return this._frameBuffer}};(0,o.Cg)([(0,Qe.MZ)({constructOnly:!0})],wt.prototype,"view",void 0),(0,o.Cg)([(0,Qe.MZ)({constructOnly:!0})],wt.prototype,"consumes",void 0),(0,o.Cg)([(0,Qe.MZ)()],wt.prototype,"produces",void 0),(0,o.Cg)([(0,Qe.MZ)({readOnly:!0})],wt.prototype,"techniques",null),wt=(0,o.Cg)([(0,et.$)("esri.views.3d.webgl.RenderNode")],wt);let Mt=class extends wt{constructor(){super(...arguments),this.consumes={required:["normals"]},this.produces="disabled"}get enabled(){return!this.destroying&&!this.destroyed&&this.produces===Je.AMBIENT_ILLUMINATION}get _belowMaxElevation(){return(this.view.state.camera.relativeElevation??1/0)<5e5}get _useGlobalIllumination(){return this._belowMaxElevation&&this.view.stage.renderer.isFeatureEnabled(11)}get _useSSAO(){return this._belowMaxElevation&&this.view.stage.renderer.isFeatureEnabled(3)}_enable(){this.produces=Je.AMBIENT_ILLUMINATION,this.requestRender(1)}_disable(){this.produces="disabled",this.requestRender(1)}};(0,o.Cg)([(0,u.MZ)()],Mt.prototype,"consumes",void 0),(0,o.Cg)([(0,u.MZ)()],Mt.prototype,"produces",void 0),Mt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.AmbientIllumination")],Mt);var Tt=r(15581),St=r(13840),Ct=r(42958),At=r(95774);let Et=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(At.S,()=>r.e(1285).then(()=>r(91285)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};Et=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],Et);var It=r(65786);class Ot extends It.Y{constructor(){super(...arguments),this.projScale=1}}class Pt extends Ot{constructor(){super(...arguments),this.intensity=1}}class Dt extends It.Y{}class Rt extends Dt{constructor(){super(...arguments),this.blurSize=(0,B.vt)()}}let Ft=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(Tt.S,()=>r.e(6122).then(()=>r(86122)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};Ft=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],Ft);let Bt=class extends Mt{constructor(e){super(e),this._enableTime=(0,c.l5)(0),this._passParameters=new Pt,this._drawParameters=new Rt}initialize(){let e=Uint8Array.from(atob("eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM"),e=>e.charCodeAt(0)),t=new xt.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new ot.A(this.renderingContext,t,e),this.addHandles((0,l.wB)(()=>this._useSSAO,e=>{this._enableTime=(0,c.l5)(0),e?this._enable():this._disable()},l.pc))}destroy(){this._passParameters.noiseTexture=(0,s.WD)(this._passParameters.noiseTexture)}render(e){let t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),i=t?.getTexture(33306);if(!r||!i)return;let n=this.techniques.getCompiled(Ft),o=this.techniques.getCompiled(Et);if(!n||!o)return this._enableTime=(0,c.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,c.l5)(performance.now()));let s=this.renderingContext,l=this.view.qualitySettings.fadeDuration,u=this.bindParameters,h=u.camera,f=h.relativeElevation,m=(0,a.qE)((5e5-f)/2e5,0,1),p=l>0?Math.min(l,performance.now()-this._enableTime)/l:1,v=p*m;this._passParameters.normalTexture=r,this._passParameters.depthTexture=i,this._passParameters.projScale=1/h.computeScreenPixelSizeAtDistance(1),this._passParameters.intensity=4*Nt/(0,Tt.g)(h)**6*v;let g=h.fullViewport[2],x=h.fullViewport[3],_=this.fboCache.acquire(g,x,"ssao input",2);s.bindFramebuffer(_.fbo),s.setViewport(0,0,g,x),s.bindTechnique(n,u,this._passParameters,this._drawParameters),s.screen.draw();let b=Math.round(g/2),y=Math.round(x/2),w=this.fboCache.acquire(b,y,"ssao blur",0);s.bindFramebuffer(w.fbo),this._drawParameters.colorTexture=_.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,0,2/x),s.bindTechnique(o,u,this._passParameters,this._drawParameters),s.setViewport(0,0,b,y),s.screen.draw(),_.release();let M=this.fboCache.acquire(b,y,Je.AMBIENT_ILLUMINATION,0);return s.bindFramebuffer(M.fbo),s.setViewport(0,0,g,x),s.setClearColor(1,1,1,0),s.clear(16384),this._drawParameters.colorTexture=w.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,2/g,0),s.bindTechnique(o,u,this._passParameters,this._drawParameters),s.setViewport(0,0,b,y),s.screen.draw(),s.setViewport4fv(h.fullViewport),w.release(),p<1&&this.requestRender(2),M}};Bt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],Bt);const Nt=.5;function zt(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new n.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(i.H`float evaluateAmbientOcclusionInverse() {
603
+ }`))}(e,t)}},68785(e,t,r){r.d(t,{n:()=>zt});var i=r(31821),n=r(12791),o=r(32198),a=r(34727),s=r(97768),l=r(36708),c=r(78659),u=r(91429),d=r(37585),h=r(69540);let f=class extends h.Pw{constructor(e){super(e),this.row=0,this.column=0,this.rows=1,this.columns=1}equals(e){return null!=e&&this.row===e.row&&this.rows===e.rows&&this.column===e.column&&this.columns===e.columns}};(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"rows",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],f.prototype,"columns",void 0),f=(0,o.Cg)([(0,u.$K)("esri.CameraLayout")],f);const m=f;var p=r(69052),v=r(25482),g=r(78888),x=r(86738),_=r(43937),b=r(36005);let y=class extends((0,h.OU)(v.o)){constructor(...e){super(...e),this.position=new x.A([0,0,0]),this.heading=0,this.tilt=0,this.fov=55,this.layout=new m}normalizeCtorArgs(e,t,r,i){if(e&&"object"==typeof e&&("x"in e||Array.isArray(e))){let n={position:e};return null!=t&&(n.heading=t),null!=r&&(n.tilt=r),null!=i&&(n.fov=i),n}return e}writePosition(e,t,r,i){let n=e.clone();n.x=(0,g.GB)(e.x||0),n.y=(0,g.GB)(e.y||0),n.z=e.hasZ?(0,g.GB)(e.z||0):e.z,t[r]=n.write({},i)}readPosition(e,t){let r=new x.A;return r.read(e,t),r.x=(0,g.GB)(r.x||0),r.y=(0,g.GB)(r.y||0),r.z=r.hasZ?(0,g.GB)(r.z||0):r.z,r}equals(e){return null!=e&&this.tilt===e.tilt&&this.heading===e.heading&&this.fov===e.fov&&this.position.equals(e.position)&&this.layout.equals(e.layout)}};(0,o.Cg)([(0,u.MZ)({type:x.A,json:{write:{isRequired:!0}}})],y.prototype,"position",void 0),(0,o.Cg)([(0,_.K)("position")],y.prototype,"writePosition",null),(0,o.Cg)([(0,b.w)("position")],y.prototype,"readPosition",null),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>p.ie.normalize((0,g.GB)(e)))],y.prototype,"heading",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>(0,a.qE)((0,g.GB)(e),-180,180))],y.prototype,"tilt",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{default:55,write:!0}}),(0,u.wg)(e=>(0,a.qE)((0,g.GB)(e,55),1,170))],y.prototype,"fov",void 0),(0,o.Cg)([(0,u.MZ)({type:m,nonNullable:!0,json:{read:!1,write:!1}})],y.prototype,"layout",void 0),y=(0,o.Cg)([(0,u.$K)("esri.Camera")],y);var w=r(9093),M=r(35522),T=r(51850),S=r(16930),C=(r(48353),r(9762),r(65806)),A=r(27993),E=r(73941),I=(r(19419),r(58083)),O=r(65720),P=r(71351),D=r(69622),R=r(53966),F=r(90629),B=r(48163),N=r(78955),z=r(91829),L=r(44280);function H(e,t,r){e.worldUpAtPosition(t,V),(0,M.Re)(U,r,t);let i=(0,M.Bw)(U);return 0===i?0:(0,a.XM)((0,M.Om)(U,V)/i)}const V=(0,T.vt)(),U=(0,T.vt)();var j;let k=j=class extends D.A{constructor(e){super(e),this._ray=(0,P.vt)(),this._viewport=(0,z.fA)(0,0,1,1),this._padding=(0,z.fA)(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=(0,B.fA)(1,1e3),this._viewDirty=!0,this._viewMatrix=(0,w.vt)(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=(0,w.vt)(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=(0,w.vt)(),this._frustumDirty=!0,this._frustum=(0,O.vt)(),this._fullViewport=(0,z.vt)(),this._fullViewportDirty=!0,this._pixelRatio=1,this.pixelScale=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=(0,T.vt)(),this._up=(0,T.vt)(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin,"eye")}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return(0,M.Re)(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){(0,I.C)(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get inverseViewMatrix(){return(0,I.Qw)((0,w.vt)(),this.viewMatrix)||this._get("inverseViewMatrix")||(0,w.vt)()}get viewForward(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;let e=(0,N.hs)((0,z.vt)(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&(0,N.aI)(e,t)?t:e}get screenPadding(){if(1===this.pixelRatio)return this._padding;let e=(0,N.hs)((0,z.vt)(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&(0,N.aI)(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[3],this._viewport[0]!==e&&(this._viewport[0]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[2],this._viewport[1]!==e&&(this._viewport[1]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(e){this.width=e-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(e){this.height=e-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewportDirty&&=(this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this._viewport[2]+this._padding[1]+this._padding[3],this._fullViewport[3]=this._viewport[3]+this._padding[0]+this._padding[2],!1),this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){(0,N.t2)(this._padding,e)||(this._viewport[0]+=e[3]-this._padding[3],this._viewport[1]+=e[2]-this._padding[2],this._viewport[2]-=e[1]+e[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=e[0]+e[2]-(this._padding[0]+this._padding[2]),(0,N.C)(this._padding,e),this._fullViewportDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&=((0,I.lw)(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return(0,I.B8)((0,w.vt)(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||(0,w.vt)()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovX(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovY(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return(0,M.Io)(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&((0,I.B8)(this._viewInverseTransposeMatrix,this.viewMatrix),(0,I.mg)(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){let{near:t,far:r}=this;return 2*t*r/(r+t-e*(r-t))}get renderPixelSizePerDistance(){return Math.tan(this.fovX/2)/(this.width/2)}get screenPixelSizePerDistance(){return this.renderPixelSizePerDistance*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){let e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,n=r/this.rows,o=i/this.columns,a=-i/2+this.column*o,s=a+o,l=-r/2+this.row*n,c=l+n,u=(0,I.$h)((0,w.vt)(),a*(1+2*this._padding[3]/e),s*(1+2*this._padding[1]/e),l*(1+2*this._padding[2]/t),c*(1+2*this._padding[0]/t),this.near,this.far),d=this._get("projectionMatrix");return d&&(0,I.t2)(d,u)?d:u}copyFrom(e){(0,M.C)(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,(0,N.C)(this._viewport,e.viewport),this.notifyChange("_viewport"),(0,N.C)(this._padding,e.padding),this.notifyChange("_padding"),this._fullViewportDirty=!0,(0,d.C)(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;let t=e;return this._viewDirty=t._viewDirty,this._viewDirty||((0,I.C)(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||=((0,O.C)(this._frustum,e.frustum),!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:((0,I.C)(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this.pixelRatio=e.pixelRatio,this.pixelScale=e.pixelScale,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return(new j).copyFrom(this)}equals(e){return(0,M.t2)(this.eye,e.eye)&&(0,M.t2)(this.center,e.center)&&(0,M.t2)(this.up,e.up)&&(0,N.t2)(this._viewport,e.viewport)&&(0,N.t2)(this._padding,e.padding)&&(0,d.t2)(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}equalsView(e){return(0,M.t2)(this.eye,e.eye)&&(0,M.t2)(this.center,e.center)&&(0,M.t2)(this.up,e.up)&&this._fov===e.fov}almostEquals(e){let t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||(0,N.hG)(e.screenPadding,this.screenPadding)>=t||(0,N.hG)(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;(0,M.jb)(Z,e.eye,e.center),(0,M.jb)($,this.eye,this.center);let r=(0,M.Om)(Z,$),i=(0,M.uE)(Z),n=(0,M.uE)($),o=5e-4;return r*r>=.9999999999*i*n&&(0,M.lo)(e.eye,this.eye)<Math.max(i,n)*o*o}computeRenderPixelSizeAt(e){return this.computeRenderPixelSizeAtDistance(this._viewDirectionDistance(e))}computeRenderPixelSizeAtDistance(e){return e*this.renderPixelSizePerDistance}computeScreenPixelSizeAt(e){return this.computeScreenPixelSizeAtDistance(this._viewDirectionDistance(e))}_viewDirectionDistance(e){return Math.abs((0,L.gr)(this.viewForward,(0,M.Re)(Z,e,this.eye)))}computeScreenPixelSizeAtDistance(e){return e*this.screenPixelSizePerDistance}computeDistanceFromRadius(e,t){return e/Math.tan(Math.min(this.fovX,this.fovY)/(2*(t||1)))}getScreenCenter(e=(0,F.gs)()){return e[0]=(this.padding[3]+this.width/2)/this.pixelRatio,e[1]=(this.padding[0]+this.height/2)/this.pixelRatio,e}getRenderCenter(e,t=.5,r=.5){return e[0]=this.padding[3]+this.width*t,e[1]=this.padding[2]+this.height*r,e[2]=.5,e}setGLViewport(e){let t=this.viewport,r=this.padding;e.setViewport(t[0]-r[3],t[1]-r[2],t[2]+r[1]+r[3],t[3]+r[0]+r[2])}applyProjection(e,t){e!==G&&(0,M.C)(G,e),G[3]=1,(0,N.Z0)(G,G,this.projectionMatrix);let r=Math.abs(G[3]);(0,M.hs)(G,G,1/r);let i=this.fullViewport;t[0]=(0,a.Cc)(0,i[0]+i[2],.5+.5*G[0]),t[1]=(0,a.Cc)(0,i[1]+i[3],.5+.5*G[1]),t[2]=.5*(G[2]+1),t[3]=r}unapplyProjection(e,t){let r=this.fullViewport;G[0]=(e[0]/(r[0]+r[2])*2-1)*e[3],G[1]=(e[1]/(r[1]+r[3])*2-1)*e[3],G[2]=(2*e[2]-1)*e[3],G[3]=e[3],null!=this.inverseProjectionMatrix&&((0,N.Z0)(G,G,this.inverseProjectionMatrix),t[0]=G[0],t[1]=G[1],t[2]=G[2])}projectToScreen(e,t){return null==this.projectToRenderScreen(e,q)?null:(this.renderToScreen(q,t),t)}projectToRenderScreen(e,t){if(G[0]=e[0],G[1]=e[1],G[2]=e[2],G[3]=1,(0,N.Z0)(G,G,this.viewProjectionMatrix),0===G[3])return null;let r=G;(0,M.hs)(r,r,1/Math.abs(G[3]));let i=this.fullViewport,n=(0,a.Cc)(0,i[0]+i[2],.5+.5*r[0]),o=(0,a.Cc)(0,i[1]+i[3],.5+.5*r[1]);return"x"in t?(t.x=n,t.y=o):(t[0]=n,t[1]=o,t.length>2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,q),t)}unprojectFromRenderScreen(e,t){if((0,I.lw)(W,this.projectionMatrix,this.viewMatrix),!(0,I.B8)(W,W))return null;let r=this.fullViewport;return G[0]=2*(e[0]-r[0])/r[2]-1,G[1]=2*(e[1]-r[1])/r[3]-1,G[2]=2*e[2]-1,G[3]=1,(0,N.Z0)(G,G,W),0===G[3]?null:(t[0]=G[0]/G[3],t[1]=G[1]/G[3],t[2]=G[2]/G[3],t)}constrainWindowSize(e,t,r,i){let n=e*this.pixelRatio,o=t*this.pixelRatio,a=Math.max(n-r/2,0),s=Math.max(this.fullHeight-o-i/2,0),l=-Math.min(n-r/2,0),c=-Math.min(this.fullHeight-o-i/2,0),u=r-l- -Math.min(this.fullWidth-n-r/2,0),d=i-c- -Math.min(o-i/2,0);return[Math.round(a),Math.round(s),Math.round(u),Math.round(d)]}computeUp(e){1===e?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){let r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){let r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}sphereFrustumCoverage(e,t){let{center:r,eye:i,distance:n,fovY:o}=this,a=Math.abs(Math.PI/2-H(t,r,i));return e.frustumCoverage(a,n,o)}_computeUpGlobal(){(0,M.Re)(Z,this.center,this.eye);let e=(0,M.Bw)(this.center);e<1?(0,M.t2)(this._up,T.Cb)&&((0,M.C)(this._up,T.Cb),this._markViewDirty(),this.notifyChange("_up")):Math.abs((0,M.Om)(Z,this.center))>.9999*(0,M.Bw)(Z)*e||((0,M.$A)($,Z,this.center),(0,M.$A)($,$,Z),(0,M.S8)($,$),(0,M.t2)(this._up,$)||((0,M.C)(this._up,$),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){(0,M.oW)(Z,this.eye,this.center),Math.abs(Z[2])<=.9999&&((0,M.hs)(Z,Z,Z[2]),(0,M.hZ)(Z,-Z[0],-Z[1],1-Z[2]),(0,M.S8)(Z,Z),(0,M.t2)(this._up,Z)||((0,M.C)(this._up,Z),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(e,t,r){"number"==typeof e[0]&&isFinite(e[0])&&"number"==typeof e[1]&&isFinite(e[1])&&"number"==typeof e[2]&&isFinite(e[2])?(0,M.t2)(e,t)||((0,M.C)(t,e),this._markViewDirty(),this.notifyChange(r)):R.A.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&=((0,O.ui)(this.viewMatrix,this.projectionMatrix,this._frustum),!1)}_ensureViewClean(){this._viewDirty&&((0,I.t5)(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};(0,o.Cg)([(0,u.MZ)()],k.prototype,"_viewport",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_padding",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_fov",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_nearFar",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_viewDirty",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_viewMatrix",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"pixelRatio",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_pixelRatio",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"pixelScale",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_rows",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"rows",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_columns",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"columns",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"eye",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"center",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_center",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"up",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"_up",void 0),(0,o.Cg)([(0,u.MZ)()],k.prototype,"viewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"inverseViewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"viewForward",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"viewUp",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"viewRight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"nearFar",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"near",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"far",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"viewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"screenViewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"screenPadding",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"x",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"y",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"width",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"height",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fullWidth",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fullHeight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"_aspect",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"padding",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"projectionMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"inverseProjectionMatrix",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fov",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fovX",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"fovY",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"viewInverseTransposeMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],k.prototype,"_projectionMatrixInternal",null),(0,o.Cg)([(0,u.MZ)()],k.prototype,"relativeElevation",void 0),k=j=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl.RenderCamera")],k);const G=(0,z.vt)(),W=(0,w.vt)(),Z=(0,T.vt)(),$=(0,T.vt)(),q=(0,F.r_)();r(49718),r(6867),r(16396),(0,w.vt)(),(0,T.vt)(),(0,T.vt)(),(0,T.vt)();var Y=r(5443),X=r(39829),J=r(95108);function K(e,t,r,i){let n=function(e,t){let r=0===t||2===t?0:1,i=e[t],n=0===t||1===t?1:-1,o=+(0===r);return(e,t,a)=>{if(t[r]<i&&a[r]<i)return 1===n?0:1;if(t[r]>i&&a[r]>i)return+(1===n);let s=(a[o]-t[o])/(a[r]-t[r]),l=t[o]+s*(i-t[r]);return e[r]=i,e[o]=l,(t[r]<i?1:-1)*n>0?2:3}}(r,i);if(e.length=0,t.length){1===n(ee,t[0],t[0])&&Q(e,t[0]);for(let r=0;r<t.length;r++){let i=t[r===t.length-1?0:r+1];switch(n(ee,t[r],i)){case 1:Q(e,i);break;case 3:Q(e,(0,B.o8)(ee));break;case 2:Q(e,(0,B.o8)(ee)),Q(e,i)}}}}function Q(e,t){0!==e.length&&(0,d.aI)(e.at(-1),t)||e.push(t)}const ee=(0,B.vt)();var te=r(11964),re=r(27921);const ie=(0,T.vt)(),ne=(0,T.vt)();function oe(){return{direction:(0,T.vt)(),up:(0,T.vt)()}}function ae(e,t,r,i,n){let o=(0,M.S8)(ie,e),s=(0,M.Om)(o,i),l=s>0;s=Math.abs(s),s>.99&&(s=Math.abs((0,M.Om)(t,i)),s<.99?((0,M.C)(o,t),l&&(0,M.hs)(o,o,-1)):o=null);let c=0;if(o){(0,M.hs)(ne,i,(0,M.Om)(i,o)),(0,M.Re)(o,o,ne);let e=(0,M.Om)(o,n)/((0,M.Bw)(o)*(0,M.Bw)(n));(0,M.$A)(ne,o,n),c=((0,M.Om)(ne,i)>0?1:-1)*(0,a.KJ)((0,a.XM)(e))}let u=(0,a.KJ)((0,a.XM)(-(0,M.Om)(i,e)/(0,M.Bw)(e)));return r?(r.heading=c,r.tilt=u,r):{heading:c,tilt:u}}function se(e,t,r,i){(0,M.Re)(le,r,t),!(0,re.T7)(i,(0,te.LV)(t,le),e)&&e!==r&&(0,M.C)(e,r)}const le=(0,T.vt)(),ce=(0,T.fA)(0,1,0),ue=(0,T.fA)(0,0,1),de=(0,w.vt)(),he=(0,T.vt)(),fe=(0,T.vt)();function me(e,t,r,i=oe()){let{direction:n,up:o}=i;return(0,I.N9)(de,-(0,a.kU)(t)),(0,I.eL)(de,de,(0,a.kU)(r)),(0,M.Z0)(n,ue,de),(0,M.hs)(n,n,-1),(0,M.Z0)(o,ce,de),i}function pe(e,t,r,i,n){let o=t.lines[11].direction,a=(n-r.getAltitude(i))/o[2];(0,M.Ln)(e,i,o,a)}const ve=(0,T.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){return ae(t,r,i,ue,ce)},eyeForCenterWithHeadingTilt:function(e,t,r,i){let n=me(0,r,i),o=(0,T.vt)();return(0,M.hs)(o,n.direction,-t),(0,M.WQ)(o,o,e),{up:n.up,eye:o,heading:r,tilt:i}},eyeTiltToLookAtTilt:function(e){return(0,a.kU)(e)},headingTiltToDirectionUp:me,lookAtTiltToEyeTilt:function(e){return(0,a.KJ)(e)},toArea:function(e,t){let r=e.frustum,{renderCoordsHelper:i}=e,n=i.getAltitude(t),o=e.spatialReference,a=e.state.camera.eye,s=[],l=r.planes[5];for(let e=0;e<4;e++){let t=r.lines[e];i.intersectInfiniteManifold((0,P.LV)(t.origin,t.direction),n,ve)||pe(ve,r,i,t.endpoint,n),se(ve,a,ve,l),s.push((0,B.fA)(ve[0],ve[1]))}return function(e,t,r){let i=e.map(e=>((0,M.hZ)(ve,e[0],e[1],0),t.fromRenderCoords(ve,ve,r),[ve[0],ve[1]]));return i.length<=2?new X.A({spatialReference:r}):(i.push(i[0].slice()),(0,J.$3)(i)||i.reverse(),new X.A({rings:[i],spatialReference:r}))}(function(e,t){let r=[],i=[];return K(r,e,t,0),K(i,r,t,1),K(r,i,t,2),K(i,r,t,3),i}(s,i.extent),i,o)},toExtent:function(e,t,r,i,n){let o=e.renderSpatialReference,a=e.spatialReference??t.spatialReference;return(0,C.g)(t,he,o),(0,C.g)(t,fe,o),he[0]-=r/2,fe[0]+=r/2,he[1]-=i/2,fe[1]+=i/2,(0,A.F)(he,o,he,a),(0,A.F)(fe,o,fe,a),n?(n.xmin=he[0],n.ymin=he[1],n.xmax=fe[0],n.ymax=fe[1],n.spatialReference=a):n=new Y.A(he[0],he[1],fe[0],fe[1],a),n}},Symbol.toStringTag,{value:"Module"}));var ge=r(34304),xe=r(52039),_e=r(28540),be=r(28735);class ye{get planes(){return this.frustum}get points(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(e){this.renderCoordsHelper=e,this.frustum=(0,O.vt)(),this._points=(0,O.Qy)(),this.lines=Array(12),this._origin=(0,T.vt)(),this._direction=(0,T.vt)(),this._boundingSphere=new _e.i,this._altitude=null,this._boundingSphereDirty=!0;for(let e=0;e<12;e++)this.lines[e]={origin:null,direction:(0,T.vt)(),endpoint:null}}update(e){(0,O.ui)(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),(0,M.C)(this._origin,e.eye),(0,M.C)(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}get altitude(){return this._altitude}intersectsSphere(e){return(0,O.m7)(this.frustum,e)}isConvexHullOutsideViewPyramid(e,t){return(0,O.Pi)(this.frustum,e,t)}intersectsRay(e){return(0,O.pw)(this.frustum,e)}intersectsLineSegment(e,t){return(0,O.ST)(this.frustum,e,t)}lineSegmentIntersectsViewPyramid(e,t){return(0,O.LJ)(this.frustum,e,t)}intersectsPoint(e){return(0,O.bU)(this.frustum,e)}_updateLines(){let e=this._points;for(let t=0;t<4;t++){let r=t+4;we(this.lines[t],e[t],e[r]),we(this.lines[t+4],e[t],3===t?e[0]:e[t+1]),we(this.lines[t+8],e[r],3===t?e[4]:e[r+1])}}_updateBoundingSphere(){let{origin:e}=this,t=Te;(0,M.S8)(t,this.direction);let r=Me;(0,M.jb)(r,this.points[4],e);let i=.5*(0,M.Om)(r,r)/(0,M.Om)(t,r),n=this._boundingSphere;n.center=(0,M.Ln)(Se,e,t,i),n.radius=i}static{this.planePointIndices=O.c8}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function we(e,t,r){e.origin=t,e.endpoint=r,(0,M.oW)(e.direction,t,r)}const Me=(0,T.vt)(),Te=(0,T.vt)(),Se=(0,T.vt)();r(86211);const Ce=(0,T.fA)(5802e-9,13558e-9,331e-7),Ae=(0,T.fA)(195e-8,5643e-9,255e-9);(0,T.fA)(Ce[0]+Ae[0],Ce[1]+Ae[1],Ce[2]+Ae[2]);class Ee{constructor(e=1/0,t=-1/0){this.near=e,this.far=t}set(e,t){this.near=e,this.far=t}union(e){return null!=e&&(this.near=Math.min(this.near,e.near),this.far=Math.max(this.far,e.far)),this}within(e){return this.near<=e&&e<=this.far}equals(e){return this.near===e.near&&this.far===e.far}static{this.Zero=new Ee(0,0)}static{this.Infinite=new Ee}}(0,T.vt)(),(0,T.vt)(),new _e.i,(0,P.vt)(),new Y.A({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});var Ie=r(32728);const Oe=(0,T.fA)(0,0,1),Pe=(0,M.S8)((0,T.vt)(),(0,T.fA)(1,1,1)),De=(0,w.vt)(),Re=(0,T.vt)(),Fe=(0,T.vt)();function Be(e,t,r,i=oe()){(0,M.$A)(Re,e,Oe),0===(0,M.Om)(Re,Re)&&(0,M.$A)(Re,e,Pe),(0,I.$0)(De,-(0,a.kU)(t),e),(0,I.e$)(De,De,-(0,a.kU)(r),Re);let{up:n,direction:o}=i;return(0,M.$A)(n,Re,e),(0,M.S8)(n,n),(0,M.Z0)(n,n,De),(0,M.S8)(o,e),(0,M.ze)(o,o),(0,M.Z0)(o,o,De),i}function Ne(e){let t=e[1];e[1]=-e[2],e[2]=t}function ze(e,t){return e.up=Be(t,e.heading,e.tilt).up,e}function Le(e,t){let{renderCoordsHelper:r,state:i}=e;if(1!==i.viewingMode)return 1;let n=r.getAltitude(t),o=r.referenceEllipsoid.radius,s=1+(0,M.Io)(i.camera.eye,t)/(o+n),l=Math.sqrt(s*s-1),{minCurvature:c,maxCurvature:u,minSamples:d,maxSamples:h}=Ve,f=(0,a.qE)((l-c)/(u-c),0,1);return Math.round((0,a.Cc)(d,h,f))}function He(e,t){let r=[],i=[],n=(0,ge.FD)();for(let o=0;o<e.length;o++){let a=e[o],s=o===e.length-1?e[0]:e[o+1],l=(0,te.Cr)(a,s,$e),c=(0,re.vE)(t,l.origin,l.vector,0,We);switch(c){case 2:r.push(a);break;case 3:i.push(a);break;case 0:case 1:{let[e,o,s]=0===c?[1,r,i]:[-1,i,r],l=(0,re.Qj)(t),u=(0,M.Ln)((0,T.vt)(),We,l,e*n),d=(0,M.Ln)((0,T.vt)(),We,l,e*-n);o.push(a),o.push(u),s.push(d)}}}let o=[];return r.length&&o.push(r),i.length&&o.push(i),o}const Ve={minCurvature:(0,a.kU)(5),maxCurvature:(0,a.kU)(50),minSamples:1,maxSamples:6},Ue=(0,T.fA)(1,0,0),je=(0,T.fA)(0,1,0),ke=(0,T.vt)(),Ge=(0,T.vt)(),We=(0,T.vt)(),Ze=new _e.i,$e=(0,te.vt)(),qe=(0,z.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){let n=Re,o=Fe;return(0,M.S8)(n,e),(0,M.$A)(Fe,n,Oe),0===(0,M.Om)(Fe,Fe)&&(0,M.$A)(Fe,n,Pe),(0,M.$A)(o,Fe,n),ae(t,r,i,n,o)},eyeForCenterWithHeadingTilt:function(e,t,r,i){let n={eye:(0,T.vt)(),up:null,tilt:i,heading:r},o=Re;o[0]=e[0],o[1]=e[2],o[2]=-e[1];let s,l=t,c=(0,a.kU)(r),u=(0,a.kU)(i),d=Math.sin(c),h=Math.cos(c),f=Math.sin(u),m=Math.cos(u),p=(0,M.Bw)(o);if(Math.abs(u)<1e-8)s=l+p;else{let e=p/f,t=(0,a.YN)(l/e),r=Math.PI-u-t;s=e*Math.sin(r)}let v=m*l,g=l*l*(f*f),x=h*h*g,_=s-v,b=_*_,y=x*(x+b-o[1]*o[1]);if(y<0)return(0,M.hs)(n.eye,o,s/p),n.tilt=0,ze(n,e);let w,S=Math.sqrt(y),C=o[1]*_,A=x+b;if(w=h>0?-S+C:S+C,Math.abs(A)<1e-8)return p<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=l):(0,M.hs)(n.eye,o,s/p),n.tilt=0,Ne(n.eye),ze(n,e);n.eye[1]=w/A;let E=d*d*g,I=f*l,O=h*I*n.eye[1],P=n.eye[1]*n.eye[1],D=1-P,R=Math.sqrt(D),F=x*P+E-2*O*R*_+D*b;return Math.abs(F)<1e-8?((0,M.hs)(n.eye,o,s/p),n.tilt=0,Ne(n.eye),ze(n,e)):(n.eye[0]=(D*(s*o[0]-v*o[0])-I*R*(o[0]*n.eye[1]*h+o[2]*d))/F,n.eye[2]=(D*(s*o[2]-v*o[2])-I*R*(o[2]*n.eye[1]*h-o[0]*d))/F,(0,M.hs)(n.eye,n.eye,s),Ne(n.eye),ze(n,e))},eyeTiltToLookAtTilt:function(e,t,r){let i=(0,a.kU)(e),n=(0,M.Bw)(t);return(0,a.YN)(r/(n/Math.sin(i)))+i},getCurvatureSamples:Le,headingTiltToDirectionUp:Be,lookAtTiltToEyeTilt:function(e,t,r){let i=(0,M.Bw)(t),n=Math.sqrt(r*r+i*i-2*r*i*Math.cos(Math.PI-e)),o=(0,a.YN)(r/(n/Math.sin(e)));return(0,a.KJ)(e-o)},toArea:function(e,t){let{renderCoordsHelper:r}=e,i=e.state.camera.clone(),n=new ye(r);i.near=2,n.update(i);let o=r.getAltitude(t),s=e.spatialReference,l=i.eye,c=function(e){let{renderCoordsHelper:t,state:r}=e,i=Math.abs(t.getAltitude(r.camera.center));return Ze.radius=t.referenceEllipsoid.radius+i,r.camera.sphereFrustumCoverage(Ze,t)}(e),u=Le(e,t),d=i.aboveGround,h=n.planes[5],f=[],m=(0,re.O_)(T.uY,Ue,(0,re.vt)()),p=(0,re.O_)(T.uY,je,(0,re.vt)());(0,N.hZ)(qe,0,0,0,0);for(let e=0;e<4;e++){let t=1===e&&!d||3===e&&d?1-c:0,i=1===e&&d||3===e&&!d?c:1,s=n.lines[e],v=n.lines[3===e?0:e+1];for(let n=0;n<u;n++){let c=n/u,d=1===e?1-(1-c)**2:3===e?c**2:c,g=0===n?0:(0,a.Cc)(t,i,d),x=(0,M.Cc)(Ge,s.origin,v.origin,g),_=(0,Ie.nu)(s.direction,v.direction,g,ke);r.intersectManifoldClosestSilhouette((0,P.LV)(x,_),o,We),se(We,l,We,h),f.push((0,T.o8)(We)),0!==f.length&&(0,M.lo)(f.at(-1),We);let b=+!!(0,re.BX)(m,We)|((0,re.BX)(p,We)?2:0);qe[b]=1}}f.length>2&&(0,M.lo)(f[0],f.at(-1));let v=function(e,t,r){let i=2*(0,ge.FD)();return e.map(e=>{let n=[],o=!1;for(let a of e)t.fromRenderCoords(a,We,r),Math.abs(a[0])<i&&Math.abs(a[1])<i?(n.push([null,We[1]]),n.push([null,We[1]]),o=!0):n.push([We[0],We[1]]);if(o)for(let e=0;e<n.length;e++){let t=n[e];if(null!=t[0])continue;let r=n[e+1];t[0]=n.at(0===e?-1:e-1)[0],e++,r[0]=n.at(e===n.length-1?0:e+1)[0]}return n.push(n[0]),(0,J.$3)(n)||n.reverse(),n})}((0,N.m3)(qe)>1?function(e,t){let r=[];for(let i of e)r.push(...He(i,t));return r}(He(f,m),p):[f],r,s);return new X.A({rings:v,spatialReference:s})},toExtent:function(e,t,r,i,n){let o,s,l,c,u=t.latitude,d=(0,E.tO)(e.spatialReference).radius,h=t.longitude,f=function(e,t,r){let i=t/r,n=(0,a.kU)(e),o=Math.sin(i/2),s=Math.cos(n),l=2*(0,a.YN)(Math.sqrt(o*o/(s*s)));return(0,a.KJ)(l)}(u,r,d)/2;o=h-f,s=h+f;let m=(0,a.kU)(u),v=(1+Math.sin(m))/(1-Math.sin(m)),g=(v+1)*Math.tan(i/d/2),x=g*g;function _(e){let t=Math.PI/2;return(e=p.uC.normalize(e,-t))>t&&(e=Math.PI-e),e}if(l=1.5*Math.PI-2*Math.atan(.5*(g+Math.sqrt(4*v+x))),c=l+i/d,l=_(l),c=_(c),c<l){let e=c;c=l,l=e}if(l=Math.max((0,a.KJ)(l),-90),c=Math.min((0,a.KJ)(c),90),s=xe.Y_.monotonic(o,s),s-o>180){let e=(s-o-180)/2;o+=e,s-=e}let b=e.spatialReference&&e.spatialReference.isGeographic?e.spatialReference:S.A.WGS84;return n?(n.xmin=o,n.ymin=l,n.xmax=s,n.ymax=c,n.spatialReference=b):n=new Y.A(o,l,s,c,b),e.spatialReference&&e.spatialReference.isWebMercator&&(0,be.Gh)(n,!1,n),n}},Symbol.toStringTag,{value:"Module"}));const Ye="composite-color",Xe=["final-color",Ye,"opaque-color","transparent-color"],Je={ANTIALIASING:"antialiasing",CUTFILL:"cutfill",CUTFILL_COMPUTATION:"cutfill-computation",FOCUSAREA:"focusarea",FOCUSAREA_MASK:"focusarea-mask",GAUSSIAN_SPLAT:"gaussian",GAUSSIAN_SPLAT_DEPTH:"gaussian-depth",GROUND_DEPTH:"ground-depth",HIGHLIGHT:"highlight",LASERLINES:"laserlines",TRANSPARENT_NO_DEPTH:"transparent-no-depth",MAGNIFIER:"magnifier",OCCLUDED:"occluded",OPAQUE_OCCLUSION_QUERY:"opaque-occlusion-query",OPAQUE_ENVIRONMENT:"opaque-environment",TRANSPARENT_ENVIRONMENT:"transparent-environment",AMBIENT_ILLUMINATION:"ambient-illumination",SHADOW_ACCUMULATION:"shadow-accumulation",SHADOWMAP:"shadowmap",SHADOW_HIGHLIGHT:"shadow-highlight",VOXEL:"voxel",VIEWSHED:"viewshed",OBJECT_AND_LAYER_ID_COLOR:"olid"};Array.from(Object.values(Je)).concat(Xe),(0,T.vt)();var Ke=r(49186),Qe=r(10107),et=r(64108),tt=r(44208),rt=(r(17676),r(94656)),it=r(63907);r(93637),r(4576),"layout.centroid.smooth.case.mat2x2.mat2x3.mat2x4.mat3x2.mat3x3.mat3x4.mat4x2.mat4x3.mat4x4.uint.uvec2.uvec3.uvec4.samplerCubeShadow.sampler2DArray.sampler2DArrayShadow.isampler2D.isampler3D.isamplerCube.isampler2DArray.usampler2D.usampler3D.usamplerCube.usampler2DArray.coherent.restrict.readonly.writeonly.resource.atomic_uint.noperspective.patch.sample.subroutine.common.partition.active.filter.image1D.image2D.image3D.imageCube.iimage1D.iimage2D.iimage3D.iimageCube.uimage1D.uimage2D.uimage3D.uimageCube.image1DArray.image2DArray.iimage1DArray.iimage2DArray.uimage1DArray.uimage2DArray.image1DShadow.image2DShadow.image1DArrayShadow.image2DArrayShadow.imageBuffer.iimageBuffer.uimageBuffer.sampler1DArray.sampler1DArrayShadow.isampler1D.isampler1DArray.usampler1D.usampler1DArray.isampler2DRect.usampler2DRect.samplerBuffer.isamplerBuffer.usamplerBuffer.sampler2DMS.isampler2DMS.usampler2DMS.sampler2DMSArray.isampler2DMSArray.usampler2DMSArray.trunc.round.roundEven.isnan.isinf.floatBitsToInt.floatBitsToUint.intBitsToFloat.uintBitsToFloat.packSnorm2x16.unpackSnorm2x16.packUnorm2x16.unpackUnorm2x16.packHalf2x16.unpackHalf2x16.outerProduct.transpose.determinant.inverse.texture.textureSize.textureProj.textureLod.textureOffset.texelFetch.texelFetchOffset.textureProjOffset.textureLodOffset.textureProjLod.textureProjLodOffset.textureGrad.textureGradOffset.textureProjGrad.textureProjGradOffset".split("."),"precision.highp.mediump.lowp.attribute.const.uniform.varying.break.continue.do.for.while.if.else.in.out.inout.float.int.void.bool.true.false.discard.return.mat2.mat3.mat4.vec2.vec3.vec4.ivec2.ivec3.ivec4.uvec2.uvec3.uvec4.bvec2.bvec3.bvec4.sampler1D.sampler2D.sampler3D.usampler1D.usampler2D.usampler3D.samplerCube.sampler1DShadow.sampler2DShadow.struct.asm.class.union.enum.typedef.template.this.packed.goto.switch.default.inline.noinline.volatile.public.static.extern.external.interface.long.short.double.half.fixed.unsigned.input.output.hvec2.hvec3.hvec4.dvec2.dvec3.dvec4.fvec2.fvec3.fvec4.sampler2DRect.sampler3DRect.sampler2DRectShadow.sizeof.cast.namespace.using".split("."),"<<= >>= ++ -- << >> <= >= == != && || += -= *= /= %= &= ^^ ^= |= ( ) [ ] . ! ~ * / % + - < > & ^ | ? : = , ; { }".split(" "),"abs.acos.all.any.asin.atan.ceil.clamp.cos.cross.dFdx.dFdy.degrees.distance.dot.equal.exp.exp2.faceforward.floor.fract.gl_BackColor.gl_BackLightModelProduct.gl_BackLightProduct.gl_BackMaterial.gl_BackSecondaryColor.gl_ClipPlane.gl_ClipVertex.gl_Color.gl_DepthRange.gl_DepthRangeParameters.gl_EyePlaneQ.gl_EyePlaneR.gl_EyePlaneS.gl_EyePlaneT.gl_Fog.gl_FogCoord.gl_FogFragCoord.gl_FogParameters.gl_FragColor.gl_FragCoord.gl_FragData.gl_FragDepth.gl_FragDepthEXT.gl_FrontColor.gl_FrontFacing.gl_FrontLightModelProduct.gl_FrontLightProduct.gl_FrontMaterial.gl_FrontSecondaryColor.gl_LightModel.gl_LightModelParameters.gl_LightModelProducts.gl_LightProducts.gl_LightSource.gl_LightSourceParameters.gl_MaterialParameters.gl_MaxClipPlanes.gl_MaxCombinedTextureImageUnits.gl_MaxDrawBuffers.gl_MaxFragmentUniformComponents.gl_MaxLights.gl_MaxTextureCoords.gl_MaxTextureImageUnits.gl_MaxTextureUnits.gl_MaxVaryingFloats.gl_MaxVertexAttribs.gl_MaxVertexTextureImageUnits.gl_MaxVertexUniformComponents.gl_ModelViewMatrix.gl_ModelViewMatrixInverse.gl_ModelViewMatrixInverseTranspose.gl_ModelViewMatrixTranspose.gl_ModelViewProjectionMatrix.gl_ModelViewProjectionMatrixInverse.gl_ModelViewProjectionMatrixInverseTranspose.gl_ModelViewProjectionMatrixTranspose.gl_MultiTexCoord0.gl_MultiTexCoord1.gl_MultiTexCoord2.gl_MultiTexCoord3.gl_MultiTexCoord4.gl_MultiTexCoord5.gl_MultiTexCoord6.gl_MultiTexCoord7.gl_Normal.gl_NormalMatrix.gl_NormalScale.gl_ObjectPlaneQ.gl_ObjectPlaneR.gl_ObjectPlaneS.gl_ObjectPlaneT.gl_Point.gl_PointCoord.gl_PointParameters.gl_PointSize.gl_Position.gl_ProjectionMatrix.gl_ProjectionMatrixInverse.gl_ProjectionMatrixInverseTranspose.gl_ProjectionMatrixTranspose.gl_SecondaryColor.gl_TexCoord.gl_TextureEnvColor.gl_TextureMatrix.gl_TextureMatrixInverse.gl_TextureMatrixInverseTranspose.gl_TextureMatrixTranspose.gl_Vertex.greaterThan.greaterThanEqual.inversesqrt.length.lessThan.lessThanEqual.log.log2.matrixCompMult.max.min.mix.mod.normalize.not.notEqual.pow.radians.reflect.refract.sign.sin.smoothstep.sqrt.step.tan.texture2D.texture2DLod.texture2DProj.texture2DProjLod.textureCube.textureCubeLod.texture2DLodEXT.texture2DProjLodEXT.textureCubeLodEXT.texture2DGradEXT.texture2DProjGradEXT.textureCubeGradEXT.textureSize.texelFetch".split("."),new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]),new Map,(0,tt.A)("esri-tests-disable-gpu-memory-measurements"),(0,rt.en)();(0,rt.en)();var nt=r(90644),ot=r(21231),at=r(48852),st=r(42293);const lt=!!(0,tt.A)("esri-tests-disable-gpu-memory-measurements");class ct{constructor(e,t){this._context=e,this._descriptor=t,this.type=2,this._context.instanceCounter.increment(it.vt.Renderbuffer,this);let r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);let{width:i,height:n,internalFormat:o,multisampled:a}=t;a?r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,i,n):r.renderbufferStorage(r.RENDERBUFFER,o,i,n),this._context.bindRenderbuffer(null)}get descriptor(){return this._descriptor}get samples(){let e=this._descriptor.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}get usedMemory(){return lt?0:(e=this._descriptor).width<=0||e.height<=0||null==e.internalFormat?0:e.width*e.height*(0,st.MW)(e.internalFormat);var e}resize(e,t){let r=this._descriptor;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;let i=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height),this._context.bindRenderbuffer(null)}dispose(){this._context&&=(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(it.vt.Renderbuffer,this),null)}}class ut{constructor(e,t,r){if(this._context=e,this._level=0,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,e.instanceCounter.increment(it.vt.FramebufferObject,this),null!=t){let r=function(e,t){return dt(t)||ht(t)?t:ft(t)?new ot.g(e,t):function(e){return 3===mt(e)||null!=e&&"samples"in e}(t)?new ct(e,t):null}(e,t);null!=r&&(this._colorAttachments.set(36064,r),dt(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(36064)}if(null!=r)if(function(e){return dt(e)||ft(e)}(r))this._depthStencilTexture=dt(r)?r:new ot.g(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{let t=ht(r)?r:new ct(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}get glName(){return this._glName}get colorTexture(){let e=this._colorAttachments.get(36064);return dt(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){return(this._colorAttachments.get(36064)??this._depthStencilTexture??this._depthStencilBuffer)?.descriptor?.width??0}get height(){return(this._colorAttachments.get(36064)??this._depthStencilTexture??this._depthStencilBuffer)?.descriptor?.height??0}get usedMemory(){return this._colorAttachments.values().reduce((e,t)=>e+t.usedMemory,this.depthStencil?.usedMemory??0)}get level(){return this._level}set level(e){this._level!==e&&(this._level=e,this._glName&&this._context.temporaryBindFramebuffer(this,()=>this._initializeAttachments()))}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){let t=this._colorAttachments.get(e);return t&&dt(t)?t:null}get colorAttachments(){return Array.from(this._colorAttachments.keys())}attachColorTexture(e,t=36064){if(!e)return;this._validateColorAttachmentPoint(t);let{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._colorAttachments.set(t,e),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t))}detachColorTexture(e=36064){let t=this._colorAttachments.get(e);if(!t)return;let r=dt(t);return this._glName&&this._context.temporaryBindFramebuffer(this,()=>{if(r)this._framebufferTexture2D(null,e);else{let t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}detachColorTextures(...e){if(0!==e.length){if(this._glName){let t=this._context.gl;this._context.temporaryBindFramebuffer(this,()=>{e.forEach(e=>{dt(this._colorAttachments.get(e))?this._framebufferTexture2D(null,e):t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)})})}e.forEach(e=>this._colorAttachments.delete(e))}}setColorTextureTarget(e,t=36064,r=0){let i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,r):this._framebufferTexture2D(i.glName,t,e,36160))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;let{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041!==r&&6402!==r?console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"):34041===r&&i!==it.ld.UNSIGNED_INT_24_8?console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):6402===r&&i!==it.ld.UNSIGNED_INT&&i!==it.ld.UNSIGNED_SHORT?console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,gt(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e)}detachDepthStencilTexture(){let e=this._depthStencilTexture;return e&&this._glName&&this._context.temporaryBindFramebuffer(this,()=>{this._framebufferTexture2D(null,gt(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;let t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._glName){this._context.bindFramebuffer(this);let{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){let e=this._depthStencilBuffer;if(e&&this._glName){let{_context:t}=this,r=t.boundFramebuffer;t.bindFramebuffer(this);let{gl:i}=t,n=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,n,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){let{_context:t}=this;t.temporaryBindFramebuffer(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,n,o,a){(e<0||t<0||n<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");let s=a.descriptor;3553!==a.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==s?.width||null==s?.height||e+r>this.width||t+i>this.height||n+r>s.width||o+i>s.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");let l=this._context,c=l.bindTexture(a,ot.g.TEXTURE_UNIT_FOR_UPDATES);l.setActiveTexture(ot.g.TEXTURE_UNIT_FOR_UPDATES),l.bindFramebuffer(this),l.gl.copyTexSubImage2D(3553,0,n,o,e,t,r,i),l.bindTexture(c,ot.g.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,n,o,a){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,n,o,a)}async readPixelsAsync(e,t,r,i,n,o,a,s){let{gl:l}=this._context,c=at.g.createPixelPack(this._context,35041,a.byteLength);try{this._context.bindBuffer(c);let u=this._context.boundFramebuffer;try{this._context.bindFramebuffer(this),l.readPixels(e,t,r,i,n,o,0)}finally{this._context.unbindBuffer(35051),this._context.bindFramebuffer(u)}await c.getSubDataAsync(a,void 0,void 0,void 0,s)}finally{c.dispose()}}resize(e,t){if(this.width===e&&this.height===t)return;let r={width:e,height:t};if(pt(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._glName&&(pt(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),(0,rt.en)())){let{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){let{gl:t}=this._context;this._glName?t.bindFramebuffer(e,this._glName):(this._glName&&t.deleteFramebuffer(this._glName),this._glName=t.createFramebuffer(),t.bindFramebuffer(e,this._glName),this._initializeAttachments(e))}_initializeAttachments(e=36160){let{gl:t}=this._context;if(this._colorAttachments.forEach((t,r)=>{if(dt(t)){let i=vt(t);35866===i?this._framebufferTextureLayer(t.glName,r,e):this._framebufferTexture2D(t.glName,r,i,e)}else if(ht(t)){let i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){let r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){let t=gt(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,vt(this._depthStencilTexture),e)}(0,rt.en)()&&t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}_framebufferTexture2D(e,t=36064,r=3553,i=36160){this._context.gl.framebufferTexture2D(i,t,r,e,this._level)}_framebufferTextureLayer(e,t=36064,r=36160,i=0){this._context.gl.framebufferTextureLayer(r,t,e,this._level,i)}_disposeDepthStencilAttachments(){let e=this._context.gl;if(this._depthStencilBuffer){if(this._glName){this._context.bindFramebuffer(this);let t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=(0,s.WD)(this._depthStencilBuffer)}this._depthStencilTexture&&=(this._glName&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,gt(this._depthStencilTexture.descriptor.pixelFormat))),(0,s.WD)(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),pt(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){pt(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width!==e.width||this.height!==e.height)&&console.error("Attachment size must match framebuffer size!")}_getGLAttachmentPoint(e){switch(e.internalFormat){case it.SB.DEPTH_COMPONENT16:case it.SB.DEPTH_COMPONENT24:case it.SB.DEPTH_COMPONENT32F:return 36096;case it.iE.DEPTH24_STENCIL8:case it.iE.DEPTH32F_STENCIL8:return 33306;case 36168:return 36128;default:return 36064}}_validateColorAttachmentPoint(e){if(-1===ut._MAX_COLOR_ATTACHMENTS){let{gl:e}=this._context;ut._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}let t=e-36064;t+1>ut._MAX_COLOR_ATTACHMENTS&&R.A.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${ut._MAX_COLOR_ATTACHMENTS} color attachments`)}}function dt(e){return 1===mt(e)}function ht(e){return 2===mt(e)}function ft(e){return 0===mt(e)}function mt(e){return null!=e&&"type"in e?e.type:null}function pt(e,t){let r=Math.max(e.width,e.height);if(r>t){R.A.getLogger("esri.views.webgl.FramebufferObject").warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);let i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function vt(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function gt(e){return 6402===e?36096:33306}var xt=r(67171),_t=(r(21818),r(69397),r(85079));const bt=[new(r(74038)._)("position",2,it.pe.UNSIGNED_SHORT,0,4)];(0,_t.Xk)(bt),r(66289);const yt=new Image;yt.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",yt.width=5,yt.height=5,yt.decode();let wt=class extends D.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=Ye,this._dirty=!0}initialize(){this.addHandles([(0,l.wB)(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},l.Vh)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new Ke.A("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view.stage.renderView.renderingContext.gl}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){let e=this._frameBuffer?.getTexture()?.descriptor,t=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return this._bind(t),t}bindRenderTarget(){return this._bind(this._frameBuffer),this._frameBuffer}_bind({fbo:e}){e.initializeAndBind(),this.gl.drawBuffers(function(e){return e?e.colorAttachments.length>0?e.colorAttachments:[0]:[1029]}(e))}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0:this._dirty=!0}}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view.stage.renderer.fboCache}get bindParameters(){return this.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}get requireGeometryDepth(){return!1}queryDepthRange(e){return null}get input(){return this._frameBuffer}};(0,o.Cg)([(0,Qe.MZ)({constructOnly:!0})],wt.prototype,"view",void 0),(0,o.Cg)([(0,Qe.MZ)({constructOnly:!0})],wt.prototype,"consumes",void 0),(0,o.Cg)([(0,Qe.MZ)()],wt.prototype,"produces",void 0),(0,o.Cg)([(0,Qe.MZ)({readOnly:!0})],wt.prototype,"techniques",null),wt=(0,o.Cg)([(0,et.$)("esri.views.3d.webgl.RenderNode")],wt);let Mt=class extends wt{constructor(){super(...arguments),this.consumes={required:["normals"]},this.produces="disabled"}get enabled(){return!this.destroying&&!this.destroyed&&this.produces===Je.AMBIENT_ILLUMINATION}get _belowMaxElevation(){return(this.view.state.camera.relativeElevation??1/0)<5e5}get _useGlobalIllumination(){return this._belowMaxElevation&&this.view.stage.renderer.isFeatureEnabled(11)}get _useSSAO(){return this._belowMaxElevation&&this.view.stage.renderer.isFeatureEnabled(3)}_enable(){this.produces=Je.AMBIENT_ILLUMINATION,this.requestRender(1)}_disable(){this.produces="disabled",this.requestRender(1)}};(0,o.Cg)([(0,u.MZ)()],Mt.prototype,"consumes",void 0),(0,o.Cg)([(0,u.MZ)()],Mt.prototype,"produces",void 0),Mt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.AmbientIllumination")],Mt);var Tt=r(15581),St=r(13840),Ct=r(42958),At=r(95774);let Et=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(At.S,()=>r.e(1285).then(()=>r(91285)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};Et=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],Et);var It=r(65786);class Ot extends It.Y{constructor(){super(...arguments),this.projScale=1}}class Pt extends Ot{constructor(){super(...arguments),this.intensity=1}}class Dt extends It.Y{}class Rt extends Dt{constructor(){super(...arguments),this.blurSize=(0,B.vt)()}}let Ft=class extends Ct.w{constructor(){super(...arguments),this.shader=new St.r(Tt.S,()=>r.e(6122).then(()=>r(86122)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};Ft=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],Ft);let Bt=class extends Mt{constructor(e){super(e),this._enableTime=(0,c.l5)(0),this._passParameters=new Pt,this._drawParameters=new Rt}initialize(){let e=Uint8Array.from(atob("eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM"),e=>e.charCodeAt(0)),t=new xt.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new ot.g(this.renderingContext,t,e),this.addHandles((0,l.wB)(()=>this._useSSAO,e=>{this._enableTime=(0,c.l5)(0),e?this._enable():this._disable()},l.pc))}destroy(){this._passParameters.noiseTexture=(0,s.WD)(this._passParameters.noiseTexture)}render(e){let t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),i=t?.getTexture(33306);if(!r||!i)return;let n=this.techniques.getCompiled(Ft),o=this.techniques.getCompiled(Et);if(!n||!o)return this._enableTime=(0,c.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,c.l5)(performance.now()));let s=this.renderingContext,l=this.view.qualitySettings.fadeDuration,u=this.bindParameters,h=u.camera,f=h.relativeElevation,m=(0,a.qE)((5e5-f)/2e5,0,1),p=l>0?Math.min(l,performance.now()-this._enableTime)/l:1,v=p*m;this._passParameters.normalTexture=r,this._passParameters.depthTexture=i,this._passParameters.projScale=1/h.computeScreenPixelSizeAtDistance(1),this._passParameters.intensity=4*Nt/(0,Tt.g)(h)**6*v;let g=h.fullViewport[2],x=h.fullViewport[3],_=this.fboCache.acquire(g,x,"ssao input",2);s.bindFramebuffer(_.fbo),s.setViewport(0,0,g,x),s.bindTechnique(n,u,this._passParameters,this._drawParameters),s.screen.draw();let b=Math.round(g/2),y=Math.round(x/2),w=this.fboCache.acquire(b,y,"ssao blur",0);s.bindFramebuffer(w.fbo),this._drawParameters.colorTexture=_.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,0,2/x),s.bindTechnique(o,u,this._passParameters,this._drawParameters),s.setViewport(0,0,b,y),s.screen.draw(),_.release();let M=this.fboCache.acquire(b,y,Je.AMBIENT_ILLUMINATION,0);return s.bindFramebuffer(M.fbo),s.setViewport(0,0,g,x),s.setClearColor(1,1,1,0),s.clear(16384),this._drawParameters.colorTexture=w.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,2/g,0),s.bindTechnique(o,u,this._passParameters,this._drawParameters),s.setViewport(0,0,b,y),s.screen.draw(),s.setViewport4fv(h.fullViewport),w.release(),p<1&&this.requestRender(2),M}};Bt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],Bt);const Nt=.5;function zt(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new n.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(i.H`float evaluateAmbientOcclusionInverse() {
604
604
  vec2 ssaoTextureSizeInverse = 1.0 / vec2(textureSize(ssaoTex, 0));
605
605
  return texture(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).r;
606
606
  }
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6319],{4341(e,t,r){r.d(t,{I:()=>a});var i=r(26390);class a{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,i.d)(()=>this._reset()),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){let e=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*s);this._items.length=Math.min(e,this._items.length),this._itemsPtr=0}_grow(){for(let e=0;e<Math.max(8,Math.min(this._items.length,s));e++)this._items.push(this._allocator())}}const s=1024},80754(e,t,r){r.d(t,{kS:()=>h,kd:()=>l});var i=r(82799),a=r(16930),s=r(60408),n=r(52006);const o={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new i.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:a.A.WebMercator}),minus180Line:new i.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:a.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new i.A({paths:[[[180,-180],[180,180]]],spatialReference:a.A.WGS84}),minus180Line:new i.A({paths:[[[-180,-180],[-180,180]]],spatialReference:a.A.WGS84})}};function l(e,t){return Math.ceil((e-t)/(2*t))}function h(e,t){if((0,n.Ed)(e))for(let r of function(e){return(0,s.Bi)(e)?e.curveRings:e.curvePaths}(e))for(let e of r)if((0,n.aO)(e)){let[r,i]=e.c;r[0]+=t,i[0]+=t}else if((0,n.FG)(e)){let[r,i]=e.a;r[0]+=t,i[0]+=t}else if((0,n.n1)(e)){let[r,i,a]=e.b;r[0]+=t,i[0]+=t,a[0]+=t}else e[0]+=t;for(let r of function(e){return(0,s.Bi)(e)?e.rings:e.paths}(e))for(let e of r)e[0]+=t;return e}r.d(t,["j7",0,o])},71351(e,t,r){r.d(t,{C:()=>u,Cr:()=>c,LV:()=>h,fA:()=>m,vt:()=>o});var i=r(4341),a=(r(77690),r(29242)),s=r(35522),n=r(51850);function o(e){return e?l((0,n.o8)(e.origin),(0,n.o8)(e.direction)):l((0,n.vt)(),(0,n.vt)())}function l(e,t){return{origin:e,direction:t}}function h(e,t){let r=d.get();return r.origin=e,r.direction=t,r}function u(e,t=o()){return m(e.origin,e.direction,t)}function c(e,t,r=o()){return(0,s.C)(r.origin,e),(0,s.Re)(r.direction,t,e),r}function m(e,t,r=o()){return(0,s.C)(r.origin,e),(0,s.C)(r.direction,t),r}r(32114);const d=new i.I(()=>o());(0,n.vt)(),(0,n.vt)(),(0,n.vt)(),(0,a.vt)()},28540(e,t,r){r.d(t,{i:()=>d});var i=r(34727),a=r(34304),s=r(58083),n=r(35522),o=r(51850),l=r(91829),h=r(34275);var u=r(71351),c=r(44280),m=r(32114);class d{constructor(e=0,t=0,r=0,i=0){this.radius=i,"number"==typeof e?this._center=(0,o.fA)(e,t,r):function(e){return t=e,(0,h.vZ)(t)&&t.length>=3||function(e){return((0,h.aI)(e)||Array.isArray(e))&&e.length>=3}(e);var t}(e)||function(e){return(t=e)instanceof Float32Array&&t.length>=4||function(e){return Array.isArray(e)&&e.length>=4}(e);var t}(e)?(this._center=(0,o.ci)(e),this.radius=4===e.length?e[3]:t):(this._center=(0,o.o8)(e.center),this.radius=e.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(e){(0,n.C)(this.center,e)}exactEquals(e){return(0,n.aI)(this._center,e.center)&&this.radius===e.radius}copyFrom(e){return e!==this&&((0,n.C)(this._center,e.center),this.radius=e.radius),this}clone(){return new d(this.center,this.radius)}toVec4(){return(0,l.fA)(this.center[0],this.center[1],this.center[2],this.radius)}contains(e){return(0,n.hG)(this.center,e)<=this.radius**2}intersects(e){let t=this.radius+e.radius;return(0,n.hG)(this.center,e.center)<=t*t}intersectRay(e,t){if(null==e||!this._intersect(e,p))return!1;let{t0:r,t1:i}=p;if((r<0||i<r&&i>0)&&(r=i),r<0)return!1;if(t){let{origin:i,direction:a}=e;t[0]=i[0]+a[0]*r,t[1]=i[1]+a[1]*r,t[2]=i[2]+a[2]*r}return!0}intersectLine(e,t){let r=(0,u.Cr)(e,t);if(!this._intersect(r,p))return[];let{origin:i,direction:s}=r,{t0:l,t1:h}=p,c=e=>{let t=(0,o.vt)();return(0,n.Ln)(t,i,s,e),this.projectPoint(t,t)};return Math.abs(l-h)<(0,a.FD)()?[c(l)]:[c(l),c(h)]}_intersect(e,t){let{origin:r,direction:i}=e,a=_;a[0]=r[0]-this.center[0],a[1]=r[1]-this.center[1],a[2]=r[2]-this.center[2];let s=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(0===s)return!1;let n=2*(i[0]*a[0]+i[1]*a[1]+i[2]*a[2]),o=n*n-4*s*(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]-this.radius**2);if(o<0)return!1;let l=Math.sqrt(o);return t.t0=(-n-l)/(2*s),t.t1=(-n+l)/(2*s),!0}projectPoint(e,t){let r=(0,n.Re)(m.rq.get(),e,this.center),i=(0,n.hs)(m.rq.get(),r,this.radius/(0,n.Bw)(r));return(0,n.WQ)(t,i,this.center)}closestPointOnSilhouette(e,t){let r=m.rq.get(),i=m.Rc.get();(0,n.$A)(r,e.origin,e.direction),(0,n.$A)(t,r,e.origin),(0,n.hs)(t,t,1/(0,n.Bw)(t)*this.radius);let a=this._angleToSilhouette(e.origin),o=(0,c.g7)(e.origin,t);return(0,s.$0)(i,o+a,r),(0,n.Z0)(t,t,i),t}distanceToSilhouette(e){let t=(0,n.Re)(m.rq.get(),e,this.center),r=(0,n.m3)(t),i=this.radius**2;return Math.sqrt(Math.abs(r-i))}frustumCoverage(e,t,r){let i=this.radius,a=i*i,s=e+.5*Math.PI,n=t*t+a-2*Math.cos(s)*t*i,o=Math.sqrt(n),l=n-a;if(l<=0)return.5;let h=Math.acos(Math.sqrt(l)/o)-Math.asin(i/(o/Math.sin(s)));return Math.min(1,(h+.5*r)/r)}_angleToSilhouette(e){let t=(0,n.Re)(m.rq.get(),e,this.center),r=(0,n.Bw)(t),a=this.radius,s=a+Math.abs(a-r);return(0,i.XM)(a/s)}union(e){let t=(0,n.Io)(this._center,e.center),r=this.radius,i=e.radius;return t+i<r?this:t+r<i?(this.copyFrom(e),this):((0,n.Cc)(this._center,this._center,e.center,(t+i-r)/(2*t)),this.radius=(t+r+i)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}signedDistanceToPlane(e){let{center:t,radius:r}=this,i=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3];return i<0?Math.min(i+r,0):Math.max(i-r,0)}}new d;const p={t0:0,t1:0},_=(0,o.vt)()},38969(e,t,r){r.d(t,{i:()=>a});var i=r(37955);function a(e,t){return new Promise((r,a)=>{e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?r():(t((0,i.Oo)(e,"canplay",r)),t((0,i.Oo)(e,"error",a)))})}},31217(e,t,r){r.d(t,{D:()=>a});var i=r(56507);async function a(e,t){return(await(0,i.A)(e,{responseType:"image",...t})).data}},76200(e,t,r){r.d(t,{h:()=>q});var i=r(49186),a=r(65529),s=r(44208),n=r(97768),o=r(17676),l=r(34275),h=r(24326),u=r(84952),c=r(38969),m=r(31217),d=r(95117),p=r(53966),_=r(2741);let g;const f=[171,75,84,88,32,50,48,187,13,10,26,10];function T(e){return ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function x(e,t){return e.getUint16(t,!0)+65536*e.getUint8(t+2)}function E(e,t,r){return t<=e.byteLength&&r<=e.byteLength-t}function A(e){return p.A.getLogger("esri.libs.basisu.textureMetadata").error(`Invalid or unsupported ${e} texture metadata`),null}var M=r(63907),R=r(21231),w=r(42293);const b=()=>p.A.getLogger("esri.views.3d.webgl-engine.lib.BasisUtil");let C=null,D=null;async function S(){return D??(g??=(async()=>{let e=await(await r.e(9321).then(()=>r(49321))).default({locateFile:e=>(0,_.s)(`esri/libs/basisu/${e}`)});return e.initializeBasis(),e})(),D=g,C=await D),D}function y(e,t){let r=function(e){let t=T(e);if(t.byteLength<77)return A("Basis");let r=t.getUint16(0,!0),i=t.getUint16(2,!0),a=t.getUint16(4,!0),s=t.getUint8(20);if(17011!==r||19!==i||77!==a||0!==s)return A("Basis");let n=t.getUint32(8,!0),o=x(t,14),l=x(t,17),h=t.getUint16(21,!0),u=!!(4&h),c=t.getUint32(65,!0);if(0===l||o<l||!(1&h)||u&&o%2!=0||!E(t,77,n)||c<77||!E(t,c,23*o))return A("Basis");let m=x(t,c),d=t.getUint8(c+3);if(0!==m||0!==d)return A("Basis");let p=t.getUint16(c+5,!0),_=t.getUint16(c+7,!0),g=1;for(let e=1;e<o;++e){let r=c+23*e;if(0!==x(t,r))break;let i=t.getUint8(r+3);g=Math.max(g,i+1)}return 0===p||0===_||g>16?A("Basis"):{width:p,height:_,levels:g,hasAlpha:u}}(e);return r?I(r,t):0}function F(e,t){let r=function(e){let t=T(e);if(t.byteLength<80||!f.every((e,r)=>t.getUint8(r)===e))return A("KTX2");let r=t.getUint32(12,!0),i=t.getUint32(16,!0),a=t.getUint32(20,!0),s=t.getUint32(24,!0),n=t.getUint32(28,!0),o=t.getUint32(36,!0),l=t.getUint32(40,!0),h=t.getUint32(44,!0),u=t.getUint32(48,!0),c=t.getUint32(52,!0);if(0!==r||1!==i||0===a||0===s||0!==n||1!==o&&6!==o||6===o&&a!==s||0===l||l>32||!E(t,80,24*l)||u<80||44!==c&&60!==c||!E(t,u,c))return A("KTX2");let m=t.getUint32(u,!0),d=t.getUint8(u+12),p=t.getUint8(u+14);if(m!==c||1!==p&&2!==p||163!==d&&166!==d||(163===d?1!==h:0!==h&&2!==h))return A("KTX2");for(let e=0;e<l;++e){let r=80+24*e,i=Number(t.getBigUint64(r,!0)),a=Number(t.getBigUint64(r+8,!0));if(i<80||0===a||!E(t,i,a))return A("KTX2")}let _=t.getUint32(56,!0),g=t.getUint32(60,!0),x=Number(t.getBigUint64(64,!0)),M=Number(t.getBigUint64(72,!0));if(g>0&&(_<80||!E(t,_,g))||1===h&&(x<80||!E(t,x,M)))return A("KTX2");let R=15&t.getUint8(u+31);return{width:a,height:s,levels:l,hasAlpha:163===d?60===c:3===R}}(e);return r?I(r,t):0}function I({levels:e,hasAlpha:t,width:r,height:i},a){let s=(0,w.MW)(t?M.CQ.COMPRESSED_RGBA8_ETC2_EAC:M.CQ.COMPRESSED_RGB8_ETC2),n=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*s*n)}function v(e,t,r,i,a,s,n,o,l=!1){let{compressedTextureETC:h,compressedTextureS3TC:u}=e.capabilities,{basisFormat:c,internalFormat:m}=function(e,t,r,i){return e?r?{basisFormat:1,internalFormat:i?M.CQ.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:M.CQ.COMPRESSED_RGBA8_ETC2_EAC}:{basisFormat:0,internalFormat:i?M.CQ.COMPRESSED_SRGB8_ETC2:M.CQ.COMPRESSED_RGB8_ETC2}:t?r?{basisFormat:3,internalFormat:M.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{basisFormat:2,internalFormat:M.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT}:{basisFormat:13,internalFormat:i?M.H0.SRGB8_ALPHA8:6408}}(null!=h,null!=u,i,l),d=t.hasMipmap?r:Math.min(1,r),p=[];for(let e=0;e<d;e++)p.push(new Uint8Array(n(e,c))),o(e,c,p[e]);return t.internalFormat=m,t.hasMipmap=p.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=a,t.height=s,new R.A(e,t,{type:"compressed",levels:p})}function U(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,16);if(1481919403!==r[0]||3140563232!==r[1]||169478669!==r[2])return b().error("Invalid magic number in KTX1 header"),null;if(67305985!==r[3]||1!==r[5]||r[7]!==M.CQ.COMPRESSED_RGB8_ETC2||6407!==r[8])return b().error("Unsupported KTX1 image"),null;let i=r[7],a=1,s=r[9],n=r[10];if(3&s||3&n)return null;let o=s,l=n;!1!==t&&(a=Math.max(1,r[14]));let h,u,c=e.byteOffset+64,m=[];for(let t=0;t<a;++t)u=(e[c]|e[c+1]<<8|e[c+2]<<16|e[c+3]<<24)>>>0,c+=4,h=new Uint8Array(e.buffer,c,u),m.push(h),c+=u,s=Math.max(1,s>>1),n=Math.max(1,n>>1);return{textureData:{type:"compressed",levels:m},internalFormat:i,width:o,height:l}}const P=()=>p.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function H(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const O=H("DXT1"),B=H("DXT3"),G=H("DXT5");function N(e,t){let r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return P().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return P().error("Unsupported format, must contain a FourCC code"),null;let i,a,s=r[21];switch(s){case O:i=8,a=M.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case B:i=16,a=M.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case G:i=16,a=M.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return P().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(s)),null}let n=1,o=r[4],l=r[3];(3&o||3&l)&&(P().warn("Rounding up compressed texture size to nearest multiple of 4."),o=o+3&-4,l=l+3&-4);let h=o,u=l;131072&r[2]&&!1!==t&&(n=Math.max(1,r[7]));let c,m,d=e.byteOffset+r[1]+4,p=[];for(let t=0;t<n;++t)m=(o+3>>2)*(l+3>>2)*i,c=new Uint8Array(e.buffer,d,m),p.push(c),d+=m,o=Math.max(1,o>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:p},internalFormat:a,width:h,height:u}}function L(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function X(e,t){let[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){let a=Math.max(e,t),s=e*t;if(a<=i&&s<=r)return[e,t];let n=Math.min(Math.sqrt(r/s),i/a);return[L(Math.round(e*n),i),L(Math.round(t*n),i)]}(e,t);return e.width===r&&e.height===i?e:Q(e,r,i)}function Q(e,t,r){if(e instanceof ImageData)return Q(function(e){let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");if(null==r)throw new i.A("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}(e),t,r);let a=document.createElement("canvas");return a.width=t,a.height=r,a.getContext("2d").drawImage(e,0,0,a.width,a.height),a}var W=r(620),V=r(67171),k=r(12541);const K=!!(0,s.A)("esri-tests-disable-gpu-memory-measurements");class q{constructor(e,t){this._data=e,this.id=(0,h.c)(),this.events=new a.bk,this._parameters={...Y,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(0,u.w8)(e.src)&&("auto"!==e.preload||!e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){let t=[];(0,c.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){(0,u.DB)(e.src)||(0,u.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){let t=new V.R;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t.isImmutable=!0===this._parameters.immutable&&function(e){return null!=e&&((0,k.tl)(e)||(0,k.tr)(e)||(0,k.CR)(e)||(0,k.QJ)(e))}(this._parameters.internalFormat),t}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return K?0:this._texture?.usedMemory??function(e,t){if(null==e)return 0;if((0,l.mw)(e)||(0,l.mg)(e))return"image/ktx2"===t.encoding?F(e,!!t.mipmap):"image/x.basis"===t.encoding?y(e,!!t.mipmap):e.byteLength;let{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?z(e):t,a=t.pixelFormat??6408,s=(0,w.wH)(a);return(t.mipmap?4/3:1)*r*i*s||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;let t=this._data;return null==t?(this._texture=new R.A(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):(0,l.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,l.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):(0,l.mg)(t)&&"image/ktx"===this._parameters.encoding?this._loadFromKTX1(e,t):(0,l.mw)(t)&&"image/ktx"===this._parameters.encoding?this._loadFromKTX1(e,new Uint8Array(t)):((0,l.mw)(t)||(0,l.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,l.mw)(t)||(0,l.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,l.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,l.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._texture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){let i=N(r,t.hasMipmap??!1);if(null==i)throw Error("DDS texture data is null");let{textureData:a,internalFormat:s,width:n,height:o}=i;return t.samplingMode=a.levels.length>1?9987:9729,t.hasMipmap=a.levels.length>1,t.internalFormat=s,t.width=n,t.height=o,new R.A(e,t,a)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX1(e,t){return this._texture=function(e,t,r){let i=U(r,t.hasMipmap??!1);if(null==i)throw Error("KTX1 texture data is null");let{textureData:a,internalFormat:s,width:n,height:o}=i;return t.samplingMode=a.levels.length>1?9987:9729,t.hasMipmap=a.levels.length>1,t.internalFormat=s,t.width=n,t.height=o,new R.A(e,t,a)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r,i=!1){C??=await S();let a=new C.KTX2File(new Uint8Array(r));if(!function(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}(a))return null;let s=i&&2===a.getDFDTransferFunc();a.startTranscoding();let n=v(e,t,a.getLevels(),a.getHasAlpha(),a.getWidth(),a.getHeight(),(e,t)=>a.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>a.transcodeImage(r,e,0,0,t,0,-1,-1),s);return a.close(),a.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){C??=await S();let i=new C.BasisFile(new Uint8Array(r));if(!function(e){return e.getNumImages()>=1&&!e.isUASTC()}(i))return null;i.startTranscoding();let a=v(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),(e,t)=>i.getImageTranscodedSizeInBytes(0,e,t),(e,t,r)=>i.transcodeImage(r,0,e,t,0,0));return i.close(),i.delete(),a}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,W.vA)(this._parameters.width>0&&this._parameters.height>0);let r=this._createDescriptor(e);return(6407===r.pixelFormat||6408===r.pixelFormat)&&(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new R.A(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{let i=await(0,m.D)(t,{signal:r});return(0,o.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{let i=await(0,d.y)(t,t.src,!1,r);return(0,o.Te)(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync(r=>new Promise((a,s)=>{let l=()=>{t.removeEventListener("loadeddata",h),t.removeEventListener("error",u),(0,n.xt)(c)},h=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),a(this._loadFromImage(e,t)))},u=e=>{l(),s(e||new i.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",h),t.addEventListener("error",u);let c=(0,o.u7)(r,()=>u((0,o.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=X(r,e.parameters));let i=z(r);this._parameters.width=i.width,this._parameters.height=i.height;let a=this._createDescriptor(e);return a.width=i.width,a.height=i.height,a.compress=this._parameters.compressionOptions,this._texture=new R.A(e,a,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){let t=new AbortController;this._loadingController=t;let r=e(t.signal);this._loadingPromise=r;let i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=(0,n.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){let e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function z(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const Y={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1}},58682(e,t,r){r.d(t,{Uy:()=>l,h7:()=>m});var i=r(35522),a=r(51850),s=r(70328);class n{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const o=(0,s.vt)();function l(e,t,r,a,s,o){if(!e.visible)return;let l=(0,i.jb)(M,a,r),{tolerance:h}=t,c=new n(h,!1,t.options.normalRequired);if(e.boundingInfo)u(e.readPrimitivePosition,e.boundingInfo,r,l,h,s,c,o);else{let t=e.readPrimitivePosition;!function(e,t,r,a,s,n,o,l){let h=t,u=R,c=Math.abs(h[0]),m=Math.abs(h[1]),d=Math.abs(h[2]),f=c>=m?c>=d?0:2:m>=d?1:2,x=f,E=h[x]<0?2:1,A=(f+E)%3,M=(f+(3-E))%3,w=h[A]/h[x],b=h[M]/h[x],C=1/h[x],D=p,S=_,y=g,{normalRequired:F}=o;for(let t=r;t<a;++t){let r=3*t;s(u[0],r),s(u[1],r+1),s(u[2],r+2),n&&(n.applyToVertex(u[0],u[0][0],u[0][1],u[0][2],t),n.applyToVertex(u[1],u[1][0],u[1][1],u[1][2],t),n.applyToVertex(u[2],u[2][0],u[2][1],u[2][2],t)),(0,i.jb)(D,u[0],e),(0,i.jb)(S,u[1],e),(0,i.jb)(y,u[2],e);let a=D[A]-w*D[x],o=D[M]-b*D[x],h=S[A]-w*S[x],c=S[M]-b*S[x],m=y[A]-w*y[x],d=y[M]-b*y[x],p=m*c-d*h,_=a*d-o*m,g=h*o-c*a;if((p<0||_<0||g<0)&&(p>0||_>0||g>0))continue;let f=p+_+g;if(0===f)continue;let E=p*(C*D[x])+_*(C*S[x])+g*(C*y[x]);if(E*Math.sign(f)<0)continue;let R=E/f;R>=0&&l(R,R,F?T(u):null,t)}}(r,l,0,e.faceCount,t,s,c,o)}}const h=(0,a.vt)();function u(e,t,r,a,n,l,c,m){if(null==t)return;let p=function(e,t){return(0,i.hZ)(t,1/e[0],1/e[1],1/e[2])}(a,h);if((0,s.C)(o,t.box),l?.applyToAabb(o),function(e,t,r,i){return function(e,t,r,i){let a=(e[0]-i-t[0])*r[0],s=(e[3]+i-t[0])*r[0],n=Math.min(a,s),o=Math.max(a,s),l=(e[1]-i-t[1])*r[1],h=(e[4]+i-t[1])*r[1];if(o=Math.min(o,Math.max(l,h)),o<0||(n=Math.max(n,Math.min(l,h)),n>o))return!1;let u=(e[2]-i-t[2])*r[2],c=(e[5]+i-t[2])*r[2];return o=Math.min(o,Math.max(u,c)),!(o<0||(n=Math.max(n,Math.min(u,c)),n>o))&&n<1/0}(e,t,r,i)}(o,r,p,n)){let{primitiveIndices:i}=t,s=i.length;if(s>1e3){let i=t.children;if(void 0!==i){for(let t of i)u(e,t,r,a,n,l,c,m);return}}d(r,a,0,s,e,i,l,c,m)}}const c=(0,a.vt)();function m(e,t,r,i,a,s,n,o,l,h=null,u=0){let m=e[0],d=e[1],p=e[2],_=t[0],g=t[1],T=t[2];for(let e=r;e<i;++e){let t=u+(h?.[e]??e),r=3*t,i=n*a[r],x=s[i],E=s[i+1],M=s[i+2],R=n*a[r+1],w=s[R],b=s[R+1],C=s[R+2],D=n*a[r+2],S=w-x,y=b-E,F=C-M,I=s[D]-x,v=s[D+1]-E,U=s[D+2]-M,P=g*U-v*T,H=T*I-U*_,O=_*v-I*g,B=S*P+y*H+F*O,G=B*B;if(G<=A)continue;let N=m-x,L=d-E,X=p-M,Q=(N*P+L*H+X*O)*B;if(Q<0||Q>G)continue;let W=L*F-y*X,V=X*S-F*N,k=N*y-S*L,K=(_*W+g*V+T*k)*B;if(K<0||Q+K>G)continue;let q=(I*W+v*V+U*k)/B;q>=0&&l(q,q,o?f(S,y,F,I,v,U,c):null,t)}}function d(e,t,r,i,a,s,n,o,l){let h=e[0],u=e[1],m=e[2],d=t[0],p=t[1],_=t[2],{normalRequired:g}=o;for(let e=r;e<i;++e){let t=s[e],r=3*t,[i,o,T]=a(b,r),[x,E,M]=a(b,r+1),[R,C,D]=a(b,r+2);null!=n&&([i,o,T]=n.applyToVertex(w,i,o,T,e),[x,E,M]=n.applyToVertex(w,x,E,M,e),[R,C,D]=n.applyToVertex(w,R,C,D,e));let S=x-i,y=E-o,F=M-T,I=R-i,v=C-o,U=D-T,P=p*U-v*_,H=_*I-U*d,O=d*v-I*p,B=S*P+y*H+F*O,G=B*B;if(G<=A)continue;let N=h-i,L=u-o,X=m-T,Q=(N*P+L*H+X*O)*B;if(Q<0||Q>G)continue;let W=L*F-y*X,V=X*S-F*N,k=N*y-S*L,K=(d*W+p*V+_*k)*B;if(K<0||Q+K>G)continue;let q=(I*W+v*V+U*k)/B;q>=0&&l(q,q,g?f(S,y,F,I,v,U,c):null,t)}}const p=(0,a.vt)(),_=(0,a.vt)(),g=(0,a.vt)();function f(e,t,r,a,s,n,o){return(0,i.hZ)(x,e,t,r),(0,i.hZ)(E,a,s,n),(0,i.$A)(o,x,E),(0,i.S8)(o,o),o}function T(e){return(0,i.jb)(x,e[1],e[0]),(0,i.jb)(E,e[2],e[0]),(0,i.$A)(c,x,E),(0,i.S8)(c,c),c}const x=(0,a.vt)(),E=(0,a.vt)(),A=1e-7*1e-7,M=(0,a.vt)(),R=[(0,a.vt)(),(0,a.vt)(),(0,a.vt)()],w=(0,a.vt)(),b=(0,a.vt)()},74810(e,t,r){r.d(t,{Jr:()=>s});var i=r(35522),a=r(51850);function s({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:s,emissiveTexture:n,emissiveFactor:o,occlusionTexture:l}){return null==e&&null==t&&null==n&&(null==o||(0,i.t2)(o,a.uY))&&null==l&&(null==s||1===s)&&(null==r||1===r)}const n=(0,a.CN)(1,1,.5),o=(0,a.CN)(0,.6,.2),l=(0,a.CN)(0,1,.2);r.d(t,["Bt",0,o,"SY",0,l,"mb",0,n])},21231(e,t,r){r.d(t,{A:()=>g});var i=r(49186),a=r(44208),s=r(53966),n=r(97768),o=r(93637),l=r(17676),h=r(94656),u=r(63907),c=r(67171),m=r(12541);class d extends c.R{constructor(e,t){switch(super(),this.context=e,Object.assign(this,t),this.internalFormat){case u.H0.R16F:case u.H0.R32F:case u.H0.R8_SNORM:case u.H0.R8:this.pixelFormat=6403;break;case u.H0.R8I:case u.H0.R8UI:case u.H0.R16I:case u.H0.R16UI:case u.H0.R32I:case u.H0.R32UI:this.pixelFormat=36244}}static validate(e,t){return new d(e,t)}}const p=!!(0,a.A)("esri-tests-disable-gpu-memory-measurements"),_=()=>s.A.getLogger("esri/views/webgl/Texture");class g{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,t=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=t;else{let r=d.validate(e,t);if(!r)throw new i.A("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return p?0:(0,c.e)(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(u.vt.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,t){let r=this._descriptor;if(r.width!==e||r.height!==t){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=t,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!(0,m.Qp)(e)&&this._descriptor.internalFormat&&(0,o.a4)(u.CQ,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!(0,m.Qp)(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(e,t,r,a,s,n,o=0){n||_().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||_().error("An attempt to update uninitialized texture!");let l=this._descriptor;l.internalFormat=(0,m.mq)(l);let{context:h,pixelFormat:u,dataType:c,target:d,isImmutable:p}=l;if(p&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");let f=h.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES,!0);(t<0||r<0||t+a>l.width||r+s>l.height)&&_().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();let{gl:T}=h;o&&(a&&s||_().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),T.pixelStorei(T.UNPACK_SKIP_ROWS,o)),(0,m.Kv)(n)?T.texSubImage2D(d,e,t,r,a,s,u,c,n):(0,m.Qp)(n)?T.compressedTexSubImage2D(d,e,t,r,a,s,l.internalFormat,n.levels[e]):T.texSubImage2D(d,e,t,r,a,s,u,c,n),o&&T.pixelStorei(T.UNPACK_SKIP_ROWS,0),h.bindTexture(f,g.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,t,r,a,s,n,o,l){l||_().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||_().error("An attempt to update an uninitialized texture!");let h=this._descriptor;h.internalFormat=(0,m.mq)(h);let{context:u,pixelFormat:c,dataType:d,isImmutable:p,target:f}=h;if(p&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");(0,m.re)(f)||_().warn("Attempting to set 3D texture data on a non-3D texture");let T=u.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES);u.setActiveTexture(g.TEXTURE_UNIT_FOR_UPDATES),(t<0||r<0||a<0||t+s>h.width||r+n>h.height||a+o>h.depth)&&_().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();let{gl:x}=u;if((0,m.Qp)(l))l=l.levels[e],x.compressedTexSubImage3D(f,e,t,r,a,s,n,o,h.internalFormat,l);else{let i=l;x.texSubImage3D(f,e,t,r,a,s,n,o,c,d,i)}u.bindTexture(T,g.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let e=this._descriptor;if(0===e.width||0===e.height)return;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,(0,m.QE)(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);let t=this._descriptor.context.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(g.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(t,g.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,(0,m.QE)(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,(0,m.QE)(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),(0,m.QE)(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=(0,n.DC)(this._compressionAbortController)}_setData(e,t){let r=this._descriptor,a=r.context?.gl;if(!a)return;(0,h.Y2)(a),this.hasWebGLTextureObject||(this._glName=a.createTexture(),r.context.instanceCounter.increment(u.vt.Texture,this)),(0,m.QE)(r);let s=r.context.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(g.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),(0,h.Y2)(a);let n=t??r.target,o=(0,m.re)(n);if((0,m.Kv)(e))this._setDataFromTexImageSource(e,n);else{let{width:t,height:s,depth:l}=r;if(null==t||null==s)throw new i.A("texture:missing-size","Width and height must be specified!");if(o&&null==l)throw new i.A("texture:missing-depth","Depth must be specified!");if(r.internalFormat=(0,m.mq)(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(n,r.internalFormat,r.hasMipmap,t,s,l),(0,m.Qp)(e)){if(!(0,m.tl)(r.internalFormat))throw new i.A("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,n)}else this._texImage(n,0,r.internalFormat,t,s,l,e),(0,h.Y2)(a),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),(0,h.Y2)(a),r.context.bindTexture(s,g.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:r,preMultiplyAlpha:i}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!i)}_setDataFromTexImageSource(e,t){let{gl:r}=this._descriptor.context,i=this._descriptor;i.internalFormat=(0,m.mq)(i);let a=(0,m.re)(t),{width:s,height:n,depth:o}=(0,m.Eo)(e);i.width&&i.height,i.width||=s,i.height||=n,a&&i.depth,a&&(i.depth=o),i.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,i.internalFormat,i.hasMipmap,s,n,o),this._texImage(t,0,i.internalFormat,s,n,o,e),(0,h.Y2)(r),i.hasMipmap&&(this.generateMipmap(),(0,h.Y2)(r))}_setDataFromCompressedSource(e,t,r){let i=this._descriptor,{width:a,height:s,depth:n}=i,o=e.levels,l=(0,m.FV)(r,a,s,n),h=Math.min(l,o.length)-1;this._descriptor.context.gl.texParameteri(i.target,33085,h),this._forEachMipmapLevel((e,i,a,s)=>{let n=o[Math.min(e,o.length-1)];this._compressedTexImage(r,e,t,i,a,s,n)},h)}_texStorage(e,t,r,a,s,n){let{gl:o}=this._descriptor.context;if(!(0,m.tr)(t)&&!(0,m.tl)(t))throw new i.A("texture:missing-format","Immutable textures must have a sized or compressed internal format");if(!this._descriptor.isImmutable)return;let l=r?(0,m.FV)(e,a,s,n):1;if((0,m.re)(e)){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");o.texStorage3D(e,l,t,a,s,n)}else o.texStorage2D(e,l,t,a,s);this._wasImmutablyAllocated=!0}_texImage(e,t,r,a,s,n,o){let l=this._descriptor.context.gl,h=(0,m.re)(e),{isImmutable:u,pixelFormat:c,dataType:d}=this._descriptor;if(u){if(null!=o){let r=o;if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texSubImage3D(e,t,0,0,0,a,s,n,c,d,r)}else l.texSubImage2D(e,t,0,0,a,s,c,d,r)}}else{let u=o;if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texImage3D(e,t,r,a,s,n,0,c,d,u)}else l.texImage2D(e,t,r,a,s,0,c,d,u)}}_compressedTexImage(e,t,r,a,s,n,o){let l=this._descriptor.context.gl,h=(0,m.re)(e);if(this._descriptor.isImmutable){if(null!=o)if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,t,0,0,0,a,s,n,r,o)}else l.compressedTexSubImage2D(e,t,0,0,a,s,r,o)}else if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,t,r,a,s,n,0,o)}else l.compressedTexImage2D(e,t,r,a,s,0,o)}async _compressOnWorker(e){let{width:t,height:r,context:i,flipped:a,preMultiplyAlpha:s,hasMipmap:n,compress:o}=this._descriptor;if(!o)return;let{compressionTracker:h,compressionCallback:u,preserveSourceBitmap:c}=o,{compressedTextureETC:m,compressedTextureS3TC:d}=i.capabilities;if(!g.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!m&&!d)return;this.abortCompression();let p=new AbortController;this._compressionAbortController=p,h?.increment();let f,T=!1,x=!1;try{e instanceof ImageBitmap?c?(f=await createImageBitmap(e),(0,l.Te)(p),x=!0):f=e:e instanceof Uint8Array?(f=e.buffer,T=this.descriptor.flipped):(f=await createImageBitmap(e,{imageOrientation:a?"flipY":"none"}),(0,l.Te)(p),x=!0);let i={data:f,width:t,height:r,needsFlip:T,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:n,hasETC:!!m,hasS3TC:!!d},o=await g.compressionWorkerHandle.invoke(i,p.signal,1);if((0,l.Te)(p),o.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=o.internalFormat,this._setData(o.compressedTexture),u?.(e-this.usedMemory)}}catch(e){(0,l.zf)(e)||_().error("Texture compression failed!")}finally{h?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),x&&f instanceof ImageBitmap&&f.close()}}_forEachMipmapLevel(e,t=1/0){let{width:r,height:a,depth:s,hasMipmap:n,target:o}=this._descriptor,l=32879===o;if(null==r||null==a||l&&null==s)throw new i.A("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let i=0;e(i,r,a,s),n&&(1!==r||1!==a||l&&1!==s)&&!(i>=t);++i)r=Math.max(1,r>>1),a=Math.max(1,a>>1),l&&(s=Math.max(1,s>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,r=e.samplingMode,i=e.samplingMode;9985===r||9987===r?(r=9729,e.hasMipmap||(i=9729)):(9984===r||9986===r)&&(r=9728,e.hasMipmap||(i=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,r),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,i),null!=e.maxMipLevel&&t.texParameteri(e.target,t.TEXTURE_MAX_LEVEL,e.maxMipLevel)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,r=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,r),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),(0,h.Y2)(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}},67171(e,t,r){r.d(t,{R:()=>s,e:()=>n});var i=r(63907),a=r(42293);class s{constructor(e=0,t=e){this.width=e,this.height=t,this.type=0,this.target=3553,this.pixelFormat=6408,this.dataType=i.ld.UNSIGNED_BYTE,this.samplingMode=9729,this.wrapMode=10497,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.compareEnabled=!1,this.linearFilterDepth=!1,this.depth=1,this.isImmutable=!1}}function n(e){return e.width<=0||e.height<=0||e.depth<=0?0:Math.round(e.width*e.height*e.depth*(e.hasMipmap?4/3:1)*(null==e.internalFormat?4:(0,a.MW)(e.internalFormat))*(34067===e.target?6:1))}},42293(e,t,r){r.d(t,{MW:()=>l,wH:()=>o,yu:()=>n});var i=r(94656),a=r(63907);const s=new Set([a.pe.BYTE,a.pe.SHORT,a.pe.INT,a.pe.UNSIGNED_BYTE,a.pe.UNSIGNED_SHORT,a.pe.UNSIGNED_INT]);function n(e,t,r,a=0){let n=e.gl;e.bindBuffer(r);for(let o of r.layout){let r=t.get(o.name);if(null==r){console.warn(`There is no location for vertex attribute '${o.name}' defined.`);continue}let l=a*o.stride;if(o.count<=4)o.integer&&s.has(o.type)?n.vertexAttribIPointer(r,o.count,o.type,o.stride,o.offset+l):n.vertexAttribPointer(r,o.count,o.type,o.normalized,o.stride,o.offset+l),n.enableVertexAttribArray(r),o.divisor>0&&n.vertexAttribDivisor(r,o.divisor);else if(9===o.count)for(let e=0;e<3;e++)n.vertexAttribPointer(r+e,3,o.type,o.normalized,o.stride,o.offset+12*e+l),n.enableVertexAttribArray(r+e),o.divisor>0&&n.vertexAttribDivisor(r+e,o.divisor);else if(16===o.count)for(let e=0;e<4;e++)n.vertexAttribPointer(r+e,4,o.type,o.normalized,o.stride,o.offset+16*e+l),n.enableVertexAttribArray(r+e),o.divisor>0&&n.vertexAttribDivisor(r+e,o.divisor);else console.error("Unsupported vertex attribute element count: "+o.count);if((0,i.en)()){let t=(0,i.u1)(e.gl);t&&console.error(`Unable to bind vertex attribute "${o.name}" with baseInstanceOffset ${l}:`,t,o)}}}function o(e){switch(e){case 6406:case 6409:case 6403:case 36244:case 6402:case 34041:return 1;case 6410:case 33319:case 33320:return 2;case 6407:case 36248:return 3;case 6408:case 36249:return 4}return 0}function l(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.H0.R8:case a.H0.R8I:case a.H0.R8UI:case a.H0.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.H0.RGBA4:case a.H0.R16F:case a.H0.R16I:case a.H0.R16UI:case a.H0.RG8:case a.H0.RG8I:case a.H0.RG8UI:case a.H0.RG8_SNORM:case a.H0.RGB565:case a.H0.RGB5_A1:case a.SB.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.H0.RGB8:case a.H0.RGB8I:case a.H0.RGB8UI:case a.H0.RGB8_SNORM:case a.H0.SRGB8:case a.SB.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.H0.RGBA8:case a.H0.R32F:case a.H0.R11F_G11F_B10F:case a.H0.RG16F:case a.H0.R32I:case a.H0.R32UI:case a.H0.RG16I:case a.H0.RG16UI:case a.H0.RGBA8I:case a.H0.RGBA8UI:case a.H0.RGBA8_SNORM:case a.H0.SRGB8_ALPHA8:case a.H0.RGB9_E5:case a.H0.RGB10_A2UI:case a.H0.RGB10_A2:case a.SB.DEPTH_COMPONENT32F:case a.iE.DEPTH24_STENCIL8:return 4;case a.iE.DEPTH32F_STENCIL8:return 5;case a.H0.RGB16F:case a.H0.RGB16I:case a.H0.RGB16UI:return 6;case a.H0.RG32F:case a.H0.RG32I:case a.H0.RG32UI:case a.H0.RGBA16F:case a.H0.RGBA16I:case a.H0.RGBA16UI:return 8;case a.H0.RGB32F:case a.H0.RGB32I:case a.H0.RGB32UI:return 12;case a.H0.RGBA32F:case a.H0.RGBA32I:case a.H0.RGBA32UI:return 16;case a.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT:case a.CQ.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case a.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT:case a.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case a.CQ.COMPRESSED_R11_EAC:case a.CQ.COMPRESSED_SIGNED_R11_EAC:case a.CQ.COMPRESSED_RGB8_ETC2:case a.CQ.COMPRESSED_SRGB8_ETC2:case a.CQ.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case a.CQ.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case a.CQ.COMPRESSED_RG11_EAC:case a.CQ.COMPRESSED_SIGNED_RG11_EAC:case a.CQ.COMPRESSED_RGBA8_ETC2_EAC:case a.CQ.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}},94656(e,t,r){r.d(t,{Y2:()=>h,en:()=>l,u1:()=>n});var i=r(49186),a=r(44208),s=r(53966);function n(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const o=!!(0,a.A)("enable-feature:webgl-debug");function l(){return o}function h(e,t=l()){if(t){let t=n(e);if(t){let e=Error().stack;s.A.getLogger("esri.views.webgl.checkWebGLError").error(new i.A("webgl-error","WebGL error occurred",{message:t,stack:e}))}}}},12541(e,t,r){r.d(t,{CR:()=>u,Eo:()=>T,FV:()=>g,Kv:()=>p,QE:()=>l,QJ:()=>c,Qp:()=>d,mq:()=>f,re:()=>_,tl:()=>m,tr:()=>h});var i=r(49186),a=r(53966),s=r(93637),n=r(63907);const o=()=>a.A.getLogger("esri/views/webgl/textureUtils");function l(e){let{width:t,height:r,depth:i}=e;(null!=t&&t<0||null!=r&&r<0||null!=i&&i<0)&&o().error("Negative dimension parameters are not allowed!");let{internalFormat:a}=e;if(a&&(u(a)||c(a))){let{linearFilterDepth:t,compareEnabled:r,samplingMode:i,hasMipmap:a}=e;a&&o().error("Depth textures cannot have mipmaps"),t?9729!==i&&9728!==i&&o().error("Depth textures cannot sample mipmaps"):(9728!==i&&o().error("Depth textures without filtering must use NEAREST filtering"),r&&o().error("Depth textures without filtering cannot use compare function"))}}function h(e){return function(e){return n.XN.includes(e)}(e)||u(e)||c(e)}function u(e){return(0,s.a4)(n.SB,e)}function c(e){return(0,s.a4)(n.iE,e)}function m(e){return null!=e&&(0,s.a4)(n.CQ,e)}function d(e){return null!=e&&"type"in e&&"compressed"===e.type}function p(e){return null!=e&&!d(e)&&!function(e){return null!=e&&"byteLength"in e}(e)}function _(e){return 32879===e||35866===e}function g(e,t,r,i=1){let a=Math.max(t,r);return 32879===e&&(a=Math.max(a,i)),Math.floor(Math.log2(a))+1}function f(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case n.ld.FLOAT:switch(e.pixelFormat){case 6408:return n.H0.RGBA32F;case 6407:return n.H0.RGB32F;default:throw new i.A("texture:unknown-format","Unable to derive format")}case n.ld.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return n.H0.RGBA8;case 6407:return n.H0.RGB8}}let{pixelFormat:t}=e;return e.internalFormat=34041===t?n.iE.DEPTH24_STENCIL8:6402===t?n.SB.DEPTH_COMPONENT24:t,e.internalFormat}function T(e){let t="width"in e?e.width:e.codedWidth,r="height"in e?e.height:e.codedHeight;return e instanceof HTMLVideoElement&&(t=e.videoWidth,r=e.videoHeight),{width:t,height:r,depth:1}}},49788(e,t,r){r.d(t,["Q",0,1/255.5,"v",0,.9960861056751468])}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6319],{4341(e,t,r){r.d(t,{I:()=>a});var i=r(26390);class a{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return 0===this._itemsPtr&&(0,i.d)(()=>this._reset()),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){let e=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*s);this._items.length=Math.min(e,this._items.length),this._itemsPtr=0}_grow(){for(let e=0;e<Math.max(8,Math.min(this._items.length,s));e++)this._items.push(this._allocator())}}const s=1024},80754(e,t,r){r.d(t,{kS:()=>h,kd:()=>l});var i=r(82799),a=r(16930),s=r(60408),n=r(52006);const o={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new i.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:a.A.WebMercator}),minus180Line:new i.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:a.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new i.A({paths:[[[180,-180],[180,180]]],spatialReference:a.A.WGS84}),minus180Line:new i.A({paths:[[[-180,-180],[-180,180]]],spatialReference:a.A.WGS84})}};function l(e,t){return Math.ceil((e-t)/(2*t))}function h(e,t){if((0,n.Ed)(e))for(let r of function(e){return(0,s.Bi)(e)?e.curveRings:e.curvePaths}(e))for(let e of r)if((0,n.aO)(e)){let[r,i]=e.c;r[0]+=t,i[0]+=t}else if((0,n.FG)(e)){let[r,i]=e.a;r[0]+=t,i[0]+=t}else if((0,n.n1)(e)){let[r,i,a]=e.b;r[0]+=t,i[0]+=t,a[0]+=t}else e[0]+=t;for(let r of function(e){return(0,s.Bi)(e)?e.rings:e.paths}(e))for(let e of r)e[0]+=t;return e}r.d(t,["j7",0,o])},71351(e,t,r){r.d(t,{C:()=>u,Cr:()=>c,LV:()=>h,fA:()=>m,vt:()=>o});var i=r(4341),a=(r(77690),r(29242)),s=r(35522),n=r(51850);function o(e){return e?l((0,n.o8)(e.origin),(0,n.o8)(e.direction)):l((0,n.vt)(),(0,n.vt)())}function l(e,t){return{origin:e,direction:t}}function h(e,t){let r=d.get();return r.origin=e,r.direction=t,r}function u(e,t=o()){return m(e.origin,e.direction,t)}function c(e,t,r=o()){return(0,s.C)(r.origin,e),(0,s.Re)(r.direction,t,e),r}function m(e,t,r=o()){return(0,s.C)(r.origin,e),(0,s.C)(r.direction,t),r}r(32114);const d=new i.I(()=>o());(0,n.vt)(),(0,n.vt)(),(0,n.vt)(),(0,a.vt)()},28540(e,t,r){r.d(t,{i:()=>d});var i=r(34727),a=r(34304),s=r(58083),n=r(35522),o=r(51850),l=r(91829),h=r(34275);var u=r(71351),c=r(44280),m=r(32114);class d{constructor(e=0,t=0,r=0,i=0){this.radius=i,"number"==typeof e?this._center=(0,o.fA)(e,t,r):function(e){return t=e,(0,h.vZ)(t)&&t.length>=3||function(e){return((0,h.aI)(e)||Array.isArray(e))&&e.length>=3}(e);var t}(e)||function(e){return(t=e)instanceof Float32Array&&t.length>=4||function(e){return Array.isArray(e)&&e.length>=4}(e);var t}(e)?(this._center=(0,o.ci)(e),this.radius=4===e.length?e[3]:t):(this._center=(0,o.o8)(e.center),this.radius=e.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(e){(0,n.C)(this.center,e)}exactEquals(e){return(0,n.aI)(this._center,e.center)&&this.radius===e.radius}copyFrom(e){return e!==this&&((0,n.C)(this._center,e.center),this.radius=e.radius),this}clone(){return new d(this.center,this.radius)}toVec4(){return(0,l.fA)(this.center[0],this.center[1],this.center[2],this.radius)}contains(e){return(0,n.hG)(this.center,e)<=this.radius**2}intersects(e){let t=this.radius+e.radius;return(0,n.hG)(this.center,e.center)<=t*t}intersectRay(e,t){if(null==e||!this._intersect(e,p))return!1;let{t0:r,t1:i}=p;if((r<0||i<r&&i>0)&&(r=i),r<0)return!1;if(t){let{origin:i,direction:a}=e;t[0]=i[0]+a[0]*r,t[1]=i[1]+a[1]*r,t[2]=i[2]+a[2]*r}return!0}intersectLine(e,t){let r=(0,u.Cr)(e,t);if(!this._intersect(r,p))return[];let{origin:i,direction:s}=r,{t0:l,t1:h}=p,c=e=>{let t=(0,o.vt)();return(0,n.Ln)(t,i,s,e),this.projectPoint(t,t)};return Math.abs(l-h)<(0,a.FD)()?[c(l)]:[c(l),c(h)]}_intersect(e,t){let{origin:r,direction:i}=e,a=_;a[0]=r[0]-this.center[0],a[1]=r[1]-this.center[1],a[2]=r[2]-this.center[2];let s=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(0===s)return!1;let n=2*(i[0]*a[0]+i[1]*a[1]+i[2]*a[2]),o=n*n-4*s*(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]-this.radius**2);if(o<0)return!1;let l=Math.sqrt(o);return t.t0=(-n-l)/(2*s),t.t1=(-n+l)/(2*s),!0}projectPoint(e,t){let r=(0,n.Re)(m.rq.get(),e,this.center),i=(0,n.hs)(m.rq.get(),r,this.radius/(0,n.Bw)(r));return(0,n.WQ)(t,i,this.center)}closestPointOnSilhouette(e,t){let r=m.rq.get(),i=m.Rc.get();(0,n.$A)(r,e.origin,e.direction),(0,n.$A)(t,r,e.origin),(0,n.hs)(t,t,1/(0,n.Bw)(t)*this.radius);let a=this._angleToSilhouette(e.origin),o=(0,c.g7)(e.origin,t);return(0,s.$0)(i,o+a,r),(0,n.Z0)(t,t,i),t}distanceToSilhouette(e){let t=(0,n.Re)(m.rq.get(),e,this.center),r=(0,n.m3)(t),i=this.radius**2;return Math.sqrt(Math.abs(r-i))}frustumCoverage(e,t,r){let i=this.radius,a=i*i,s=e+.5*Math.PI,n=t*t+a-2*Math.cos(s)*t*i,o=Math.sqrt(n),l=n-a;if(l<=0)return.5;let h=Math.acos(Math.sqrt(l)/o)-Math.asin(i/(o/Math.sin(s)));return Math.min(1,(h+.5*r)/r)}_angleToSilhouette(e){let t=(0,n.Re)(m.rq.get(),e,this.center),r=(0,n.Bw)(t),a=this.radius,s=a+Math.abs(a-r);return(0,i.XM)(a/s)}union(e){let t=(0,n.Io)(this._center,e.center),r=this.radius,i=e.radius;return t+i<r?this:t+r<i?(this.copyFrom(e),this):((0,n.Cc)(this._center,this._center,e.center,(t+i-r)/(2*t)),this.radius=(t+r+i)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}signedDistanceToPlane(e){let{center:t,radius:r}=this,i=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3];return i<0?Math.min(i+r,0):Math.max(i-r,0)}}new d;const p={t0:0,t1:0},_=(0,o.vt)()},38969(e,t,r){r.d(t,{i:()=>a});var i=r(37955);function a(e,t){return new Promise((r,a)=>{e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?r():(t((0,i.Oo)(e,"canplay",r)),t((0,i.Oo)(e,"error",a)))})}},31217(e,t,r){r.d(t,{D:()=>a});var i=r(56507);async function a(e,t){return(await(0,i.A)(e,{responseType:"image",...t})).data}},76200(e,t,r){r.d(t,{h:()=>q});var i=r(49186),a=r(65529),s=r(44208),n=r(97768),o=r(17676),l=r(34275),h=r(24326),u=r(84952),c=r(38969),m=r(31217),d=r(95117),p=r(53966),_=r(2741);let g;const f=[171,75,84,88,32,50,48,187,13,10,26,10];function T(e){return ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function x(e,t){return e.getUint16(t,!0)+65536*e.getUint8(t+2)}function E(e,t,r){return t<=e.byteLength&&r<=e.byteLength-t}function M(e){return p.A.getLogger("esri.libs.basisu.textureMetadata").error(`Invalid or unsupported ${e} texture metadata`),null}var A=r(63907),R=r(21231),w=r(42293);const b=()=>p.A.getLogger("esri.views.3d.webgl-engine.lib.BasisUtil");let C=null,D=null;async function S(){return D??(g??=(async()=>{let e=await(await r.e(9321).then(()=>r(49321))).default({locateFile:e=>(0,_.s)(`esri/libs/basisu/${e}`)});return e.initializeBasis(),e})(),D=g,C=await D),D}function y(e,t){let r=function(e){let t=T(e);if(t.byteLength<77)return M("Basis");let r=t.getUint16(0,!0),i=t.getUint16(2,!0),a=t.getUint16(4,!0),s=t.getUint8(20);if(17011!==r||19!==i||77!==a||0!==s)return M("Basis");let n=t.getUint32(8,!0),o=x(t,14),l=x(t,17),h=t.getUint16(21,!0),u=!!(4&h),c=t.getUint32(65,!0);if(0===l||o<l||!(1&h)||u&&o%2!=0||!E(t,77,n)||c<77||!E(t,c,23*o))return M("Basis");let m=x(t,c),d=t.getUint8(c+3);if(0!==m||0!==d)return M("Basis");let p=t.getUint16(c+5,!0),_=t.getUint16(c+7,!0),g=1;for(let e=1;e<o;++e){let r=c+23*e;if(0!==x(t,r))break;let i=t.getUint8(r+3);g=Math.max(g,i+1)}return 0===p||0===_||g>16?M("Basis"):{width:p,height:_,levels:g,hasAlpha:u}}(e);return r?I(r,t):0}function F(e,t){let r=function(e){let t=T(e);if(t.byteLength<80||!f.every((e,r)=>t.getUint8(r)===e))return M("KTX2");let r=t.getUint32(12,!0),i=t.getUint32(16,!0),a=t.getUint32(20,!0),s=t.getUint32(24,!0),n=t.getUint32(28,!0),o=t.getUint32(36,!0),l=t.getUint32(40,!0),h=t.getUint32(44,!0),u=t.getUint32(48,!0),c=t.getUint32(52,!0);if(0!==r||1!==i||0===a||0===s||0!==n||1!==o&&6!==o||6===o&&a!==s||0===l||l>32||!E(t,80,24*l)||u<80||44!==c&&60!==c||!E(t,u,c))return M("KTX2");let m=t.getUint32(u,!0),d=t.getUint8(u+12),p=t.getUint8(u+14);if(m!==c||1!==p&&2!==p||163!==d&&166!==d||(163===d?1!==h:0!==h&&2!==h))return M("KTX2");for(let e=0;e<l;++e){let r=80+24*e,i=Number(t.getBigUint64(r,!0)),a=Number(t.getBigUint64(r+8,!0));if(i<80||0===a||!E(t,i,a))return M("KTX2")}let _=t.getUint32(56,!0),g=t.getUint32(60,!0),x=Number(t.getBigUint64(64,!0)),A=Number(t.getBigUint64(72,!0));if(g>0&&(_<80||!E(t,_,g))||1===h&&(x<80||!E(t,x,A)))return M("KTX2");let R=15&t.getUint8(u+31);return{width:a,height:s,levels:l,hasAlpha:163===d?60===c:3===R}}(e);return r?I(r,t):0}function I({levels:e,hasAlpha:t,width:r,height:i},a){let s=(0,w.MW)(t?A.CQ.COMPRESSED_RGBA8_ETC2_EAC:A.CQ.COMPRESSED_RGB8_ETC2),n=a&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*s*n)}function v(e,t,r,i,a,s,n,o,l=!1){let{compressedTextureETC:h,compressedTextureS3TC:u}=e.capabilities,{basisFormat:c,internalFormat:m}=function(e,t,r,i){return e?r?{basisFormat:1,internalFormat:i?A.CQ.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:A.CQ.COMPRESSED_RGBA8_ETC2_EAC}:{basisFormat:0,internalFormat:i?A.CQ.COMPRESSED_SRGB8_ETC2:A.CQ.COMPRESSED_RGB8_ETC2}:t?r?{basisFormat:3,internalFormat:A.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{basisFormat:2,internalFormat:A.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT}:{basisFormat:13,internalFormat:i?A.H0.SRGB8_ALPHA8:6408}}(null!=h,null!=u,i,l),d=t.hasMipmap?r:Math.min(1,r),p=[];for(let e=0;e<d;e++)p.push(new Uint8Array(n(e,c))),o(e,c,p[e]);return t.internalFormat=m,t.hasMipmap=p.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=a,t.height=s,new R.g(e,t,{type:"compressed",levels:p})}function U(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,16);if(1481919403!==r[0]||3140563232!==r[1]||169478669!==r[2])return b().error("Invalid magic number in KTX1 header"),null;if(67305985!==r[3]||1!==r[5]||r[7]!==A.CQ.COMPRESSED_RGB8_ETC2||6407!==r[8])return b().error("Unsupported KTX1 image"),null;let i=r[7],a=1,s=r[9],n=r[10];if(3&s||3&n)return null;let o=s,l=n;!1!==t&&(a=Math.max(1,r[14]));let h,u,c=e.byteOffset+64,m=[];for(let t=0;t<a;++t)u=(e[c]|e[c+1]<<8|e[c+2]<<16|e[c+3]<<24)>>>0,c+=4,h=new Uint8Array(e.buffer,c,u),m.push(h),c+=u,s=Math.max(1,s>>1),n=Math.max(1,n>>1);return{textureData:{type:"compressed",levels:m},internalFormat:i,width:o,height:l}}const P=()=>p.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function H(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const O=H("DXT1"),B=H("DXT3"),G=H("DXT5");function N(e,t){let r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return P().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return P().error("Unsupported format, must contain a FourCC code"),null;let i,a,s=r[21];switch(s){case O:i=8,a=A.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case B:i=16,a=A.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case G:i=16,a=A.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return P().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(s)),null}let n=1,o=r[4],l=r[3];(3&o||3&l)&&(P().warn("Rounding up compressed texture size to nearest multiple of 4."),o=o+3&-4,l=l+3&-4);let h=o,u=l;131072&r[2]&&!1!==t&&(n=Math.max(1,r[7]));let c,m,d=e.byteOffset+r[1]+4,p=[];for(let t=0;t<n;++t)m=(o+3>>2)*(l+3>>2)*i,c=new Uint8Array(e.buffer,d,m),p.push(c),d+=m,o=Math.max(1,o>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:p},internalFormat:a,width:h,height:u}}function L(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function X(e,t){let[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){let a=Math.max(e,t),s=e*t;if(a<=i&&s<=r)return[e,t];let n=Math.min(Math.sqrt(r/s),i/a);return[L(Math.round(e*n),i),L(Math.round(t*n),i)]}(e,t);return e.width===r&&e.height===i?e:Q(e,r,i)}function Q(e,t,r){if(e instanceof ImageData)return Q(function(e){let t=document.createElement("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");if(null==r)throw new i.A("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}(e),t,r);let a=document.createElement("canvas");return a.width=t,a.height=r,a.getContext("2d").drawImage(e,0,0,a.width,a.height),a}var W=r(620),V=r(67171),k=r(12541);const K=!!(0,s.A)("esri-tests-disable-gpu-memory-measurements");class q{constructor(e,t){this._data=e,this.id=(0,h.c)(),this.events=new a.bk,this._parameters={...Y,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!(0,u.w8)(e.src)&&("auto"!==e.preload||!e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){let t=[];(0,c.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){(0,u.DB)(e.src)||(0,u.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){let t=new V.R;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t.isImmutable=!0===this._parameters.immutable&&function(e){return null!=e&&((0,k.tl)(e)||(0,k.tr)(e)||(0,k.CR)(e)||(0,k.QJ)(e))}(this._parameters.internalFormat),t}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return K?0:this._texture?.usedMemory??function(e,t){if(null==e)return 0;if((0,l.mw)(e)||(0,l.mg)(e))return"image/ktx2"===t.encoding?F(e,!!t.mipmap):"image/x.basis"===t.encoding?y(e,!!t.mipmap):e.byteLength;let{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?z(e):t,a=t.pixelFormat??6408,s=(0,w.wH)(a);return(t.mipmap?4/3:1)*r*i*s||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;let t=this._data;return null==t?(this._texture=new R.g(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):(0,l.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,l.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):(0,l.mg)(t)&&"image/ktx"===this._parameters.encoding?this._loadFromKTX1(e,t):(0,l.mw)(t)&&"image/ktx"===this._parameters.encoding?this._loadFromKTX1(e,new Uint8Array(t)):((0,l.mw)(t)||(0,l.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,l.mw)(t)||(0,l.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,l.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,l.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._texture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){let i=N(r,t.hasMipmap??!1);if(null==i)throw Error("DDS texture data is null");let{textureData:a,internalFormat:s,width:n,height:o}=i;return t.samplingMode=a.levels.length>1?9987:9729,t.hasMipmap=a.levels.length>1,t.internalFormat=s,t.width=n,t.height=o,new R.g(e,t,a)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX1(e,t){return this._texture=function(e,t,r){let i=U(r,t.hasMipmap??!1);if(null==i)throw Error("KTX1 texture data is null");let{textureData:a,internalFormat:s,width:n,height:o}=i;return t.samplingMode=a.levels.length>1?9987:9729,t.hasMipmap=a.levels.length>1,t.internalFormat=s,t.width=n,t.height=o,new R.g(e,t,a)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r,i=!1){C??=await S();let a=new C.KTX2File(new Uint8Array(r));if(!function(e){return e.getFaces()>=1&&(e.isETC1S()||e.isUASTC())}(a))return null;let s=i&&2===a.getDFDTransferFunc();a.startTranscoding();let n=v(e,t,a.getLevels(),a.getHasAlpha(),a.getWidth(),a.getHeight(),(e,t)=>a.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>a.transcodeImage(r,e,0,0,t,0,-1,-1),s);return a.close(),a.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){C??=await S();let i=new C.BasisFile(new Uint8Array(r));if(!function(e){return e.getNumImages()>=1&&!e.isUASTC()}(i))return null;i.startTranscoding();let a=v(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),(e,t)=>i.getImageTranscodedSizeInBytes(0,e,t),(e,t,r)=>i.transcodeImage(r,0,e,t,0,0));return i.close(),i.delete(),a}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,W.vA)(this._parameters.width>0&&this._parameters.height>0);let r=this._createDescriptor(e);return(6407===r.pixelFormat||6408===r.pixelFormat)&&(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new R.g(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{let i=await(0,m.D)(t,{signal:r});return(0,o.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{let i=await(0,d.y)(t,t.src,!1,r);return(0,o.Te)(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync(r=>new Promise((a,s)=>{let l=()=>{t.removeEventListener("loadeddata",h),t.removeEventListener("error",u),(0,n.xt)(c)},h=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),a(this._loadFromImage(e,t)))},u=e=>{l(),s(e||new i.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",h),t.addEventListener("error",u);let c=(0,o.u7)(r,()=>u((0,o.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=X(r,e.parameters));let i=z(r);this._parameters.width=i.width,this._parameters.height=i.height;let a=this._createDescriptor(e);return a.width=i.width,a.height=i.height,a.compress=this._parameters.compressionOptions,this._texture=new R.g(e,a,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){let t=new AbortController;this._loadingController=t;let r=e(t.signal);this._loadingPromise=r;let i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=(0,n.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){let e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function z(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const Y={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1}},58682(e,t,r){r.d(t,{Uy:()=>l,h7:()=>m});var i=r(35522),a=r(51850),s=r(70328);class n{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const o=(0,s.vt)();function l(e,t,r,a,s,o){if(!e.visible)return;let l=(0,i.jb)(A,a,r),{tolerance:h}=t,c=new n(h,!1,t.options.normalRequired);if(e.boundingInfo)u(e.readPrimitivePosition,e.boundingInfo,r,l,h,s,c,o);else{let t=e.readPrimitivePosition;!function(e,t,r,a,s,n,o,l){let h=t,u=R,c=Math.abs(h[0]),m=Math.abs(h[1]),d=Math.abs(h[2]),f=c>=m?c>=d?0:2:m>=d?1:2,x=f,E=h[x]<0?2:1,M=(f+E)%3,A=(f+(3-E))%3,w=h[M]/h[x],b=h[A]/h[x],C=1/h[x],D=p,S=_,y=g,{normalRequired:F}=o;for(let t=r;t<a;++t){let r=3*t;s(u[0],r),s(u[1],r+1),s(u[2],r+2),n&&(n.applyToVertex(u[0],u[0][0],u[0][1],u[0][2],t),n.applyToVertex(u[1],u[1][0],u[1][1],u[1][2],t),n.applyToVertex(u[2],u[2][0],u[2][1],u[2][2],t)),(0,i.jb)(D,u[0],e),(0,i.jb)(S,u[1],e),(0,i.jb)(y,u[2],e);let a=D[M]-w*D[x],o=D[A]-b*D[x],h=S[M]-w*S[x],c=S[A]-b*S[x],m=y[M]-w*y[x],d=y[A]-b*y[x],p=m*c-d*h,_=a*d-o*m,g=h*o-c*a;if((p<0||_<0||g<0)&&(p>0||_>0||g>0))continue;let f=p+_+g;if(0===f)continue;let E=p*(C*D[x])+_*(C*S[x])+g*(C*y[x]);if(E*Math.sign(f)<0)continue;let R=E/f;R>=0&&l(R,R,F?T(u):null,t)}}(r,l,0,e.faceCount,t,s,c,o)}}const h=(0,a.vt)();function u(e,t,r,a,n,l,c,m){if(null==t)return;let p=function(e,t){return(0,i.hZ)(t,1/e[0],1/e[1],1/e[2])}(a,h);if((0,s.C)(o,t.box),l?.applyToAabb(o),function(e,t,r,i){return function(e,t,r,i){let a=(e[0]-i-t[0])*r[0],s=(e[3]+i-t[0])*r[0],n=Math.min(a,s),o=Math.max(a,s),l=(e[1]-i-t[1])*r[1],h=(e[4]+i-t[1])*r[1];if(o=Math.min(o,Math.max(l,h)),o<0||(n=Math.max(n,Math.min(l,h)),n>o))return!1;let u=(e[2]-i-t[2])*r[2],c=(e[5]+i-t[2])*r[2];return o=Math.min(o,Math.max(u,c)),!(o<0||(n=Math.max(n,Math.min(u,c)),n>o))&&n<1/0}(e,t,r,i)}(o,r,p,n)){let{primitiveIndices:i}=t,s=i.length;if(s>1e3){let i=t.children;if(void 0!==i){for(let t of i)u(e,t,r,a,n,l,c,m);return}}d(r,a,0,s,e,i,l,c,m)}}const c=(0,a.vt)();function m(e,t,r,i,a,s,n,o,l,h=null,u=0){let m=e[0],d=e[1],p=e[2],_=t[0],g=t[1],T=t[2];for(let e=r;e<i;++e){let t=u+(h?.[e]??e),r=3*t,i=n*a[r],x=s[i],E=s[i+1],A=s[i+2],R=n*a[r+1],w=s[R],b=s[R+1],C=s[R+2],D=n*a[r+2],S=w-x,y=b-E,F=C-A,I=s[D]-x,v=s[D+1]-E,U=s[D+2]-A,P=g*U-v*T,H=T*I-U*_,O=_*v-I*g,B=S*P+y*H+F*O,G=B*B;if(G<=M)continue;let N=m-x,L=d-E,X=p-A,Q=(N*P+L*H+X*O)*B;if(Q<0||Q>G)continue;let W=L*F-y*X,V=X*S-F*N,k=N*y-S*L,K=(_*W+g*V+T*k)*B;if(K<0||Q+K>G)continue;let q=(I*W+v*V+U*k)/B;q>=0&&l(q,q,o?f(S,y,F,I,v,U,c):null,t)}}function d(e,t,r,i,a,s,n,o,l){let h=e[0],u=e[1],m=e[2],d=t[0],p=t[1],_=t[2],{normalRequired:g}=o;for(let e=r;e<i;++e){let t=s[e],r=3*t,[i,o,T]=a(b,r),[x,E,A]=a(b,r+1),[R,C,D]=a(b,r+2);null!=n&&([i,o,T]=n.applyToVertex(w,i,o,T,e),[x,E,A]=n.applyToVertex(w,x,E,A,e),[R,C,D]=n.applyToVertex(w,R,C,D,e));let S=x-i,y=E-o,F=A-T,I=R-i,v=C-o,U=D-T,P=p*U-v*_,H=_*I-U*d,O=d*v-I*p,B=S*P+y*H+F*O,G=B*B;if(G<=M)continue;let N=h-i,L=u-o,X=m-T,Q=(N*P+L*H+X*O)*B;if(Q<0||Q>G)continue;let W=L*F-y*X,V=X*S-F*N,k=N*y-S*L,K=(d*W+p*V+_*k)*B;if(K<0||Q+K>G)continue;let q=(I*W+v*V+U*k)/B;q>=0&&l(q,q,g?f(S,y,F,I,v,U,c):null,t)}}const p=(0,a.vt)(),_=(0,a.vt)(),g=(0,a.vt)();function f(e,t,r,a,s,n,o){return(0,i.hZ)(x,e,t,r),(0,i.hZ)(E,a,s,n),(0,i.$A)(o,x,E),(0,i.S8)(o,o),o}function T(e){return(0,i.jb)(x,e[1],e[0]),(0,i.jb)(E,e[2],e[0]),(0,i.$A)(c,x,E),(0,i.S8)(c,c),c}const x=(0,a.vt)(),E=(0,a.vt)(),M=1e-7*1e-7,A=(0,a.vt)(),R=[(0,a.vt)(),(0,a.vt)(),(0,a.vt)()],w=(0,a.vt)(),b=(0,a.vt)()},74810(e,t,r){r.d(t,{Jr:()=>s});var i=r(35522),a=r(51850);function s({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:s,emissiveTexture:n,emissiveFactor:o,occlusionTexture:l}){return null==e&&null==t&&null==n&&(null==o||(0,i.t2)(o,a.uY))&&null==l&&(null==s||1===s)&&(null==r||1===r)}const n=(0,a.CN)(1,1,.5),o=(0,a.CN)(0,.6,.2),l=(0,a.CN)(0,1,.2);r.d(t,["Bt",0,o,"SY",0,l,"mb",0,n])},21231(e,t,r){r.d(t,{g:()=>g});var i=r(49186),a=r(44208),s=r(53966),n=r(97768),o=r(93637),l=r(17676),h=r(94656),u=r(63907),c=r(67171),m=r(12541);class d extends c.R{constructor(e,t){switch(super(),this.context=e,Object.assign(this,t),this.internalFormat){case u.H0.R16F:case u.H0.R32F:case u.H0.R8_SNORM:case u.H0.R8:this.pixelFormat=6403;break;case u.H0.R8I:case u.H0.R8UI:case u.H0.R16I:case u.H0.R16UI:case u.H0.R32I:case u.H0.R32UI:this.pixelFormat=36244}}static validate(e,t){return new d(e,t)}}const p=!!(0,a.A)("esri-tests-disable-gpu-memory-measurements"),_=()=>s.A.getLogger("esri/views/webgl/Texture");class g{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,t=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=t;else{let r=d.validate(e,t);if(!r)throw new i.A("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return p?0:(0,c.e)(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(u.vt.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,t){let r=this._descriptor;if(r.width!==e||r.height!==t){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=t,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(e){this._descriptor.compress=e}disableCompression(){this._descriptor.compress=void 0}setData(e){this.abortCompression(),!(0,m.Qp)(e)&&this._descriptor.internalFormat&&(0,o.a4)(u.CQ,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!(0,m.Qp)(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(e,t,r,a,s,n,o=0){n||_().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||_().error("An attempt to update uninitialized texture!");let l=this._descriptor;l.internalFormat=(0,m.mq)(l);let{context:h,pixelFormat:u,dataType:c,target:d,isImmutable:p}=l;if(p&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");let f=h.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES,!0);(t<0||r<0||t+a>l.width||r+s>l.height)&&_().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();let{gl:T}=h;o&&(a&&s||_().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),T.pixelStorei(T.UNPACK_SKIP_ROWS,o)),(0,m.Kv)(n)?T.texSubImage2D(d,e,t,r,a,s,u,c,n):(0,m.Qp)(n)?T.compressedTexSubImage2D(d,e,t,r,a,s,l.internalFormat,n.levels[e]):T.texSubImage2D(d,e,t,r,a,s,u,c,n),o&&T.pixelStorei(T.UNPACK_SKIP_ROWS,0),h.bindTexture(f,g.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,t,r,a,s,n,o,l){l||_().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||_().error("An attempt to update an uninitialized texture!");let h=this._descriptor;h.internalFormat=(0,m.mq)(h);let{context:u,pixelFormat:c,dataType:d,isImmutable:p,target:f}=h;if(p&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");(0,m.re)(f)||_().warn("Attempting to set 3D texture data on a non-3D texture");let T=u.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES);u.setActiveTexture(g.TEXTURE_UNIT_FOR_UPDATES),(t<0||r<0||a<0||t+s>h.width||r+n>h.height||a+o>h.depth)&&_().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();let{gl:x}=u;if((0,m.Qp)(l))l=l.levels[e],x.compressedTexSubImage3D(f,e,t,r,a,s,n,o,h.internalFormat,l);else{let i=l;x.texSubImage3D(f,e,t,r,a,s,n,o,c,d,i)}u.bindTexture(T,g.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){let e=this._descriptor;if(0===e.width||0===e.height)return;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,(0,m.QE)(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);let t=this._descriptor.context.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(g.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(t,g.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){let e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,(0,m.QE)(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,(0,m.QE)(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),(0,m.QE)(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&=(this._applySamplingMode(),!1),this._wrapModeDirty&&=(this._applyWrapMode(),!1),this._shadowFilterDirty&&=(this._applyShadowMode(),!1)}abortCompression(){this._compressionAbortController=(0,n.DC)(this._compressionAbortController)}_setData(e,t){let r=this._descriptor,a=r.context?.gl;if(!a)return;(0,h.Y2)(a),this.hasWebGLTextureObject||(this._glName=a.createTexture(),r.context.instanceCounter.increment(u.vt.Texture,this)),(0,m.QE)(r);let s=r.context.bindTexture(this,g.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(g.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),(0,h.Y2)(a);let n=t??r.target,o=(0,m.re)(n);if((0,m.Kv)(e))this._setDataFromTexImageSource(e,n);else{let{width:t,height:s,depth:l}=r;if(null==t||null==s)throw new i.A("texture:missing-size","Width and height must be specified!");if(o&&null==l)throw new i.A("texture:missing-depth","Depth must be specified!");if(r.internalFormat=(0,m.mq)(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(n,r.internalFormat,r.hasMipmap,t,s,l),(0,m.Qp)(e)){if(!(0,m.tl)(r.internalFormat))throw new i.A("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,n)}else this._texImage(n,0,r.internalFormat,t,s,l,e),(0,h.Y2)(a),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),(0,h.Y2)(a),r.context.bindTexture(s,g.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){let e=this._descriptor.context.gl,{unpackAlignment:t,flipped:r,preMultiplyAlpha:i}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,t),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,+!!r),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,+!!i)}_setDataFromTexImageSource(e,t){let{gl:r}=this._descriptor.context,i=this._descriptor;i.internalFormat=(0,m.mq)(i);let a=(0,m.re)(t),{width:s,height:n,depth:o}=(0,m.Eo)(e);i.width&&i.height,i.width||=s,i.height||=n,a&&i.depth,a&&(i.depth=o),i.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,i.internalFormat,i.hasMipmap,s,n,o),this._texImage(t,0,i.internalFormat,s,n,o,e),(0,h.Y2)(r),i.hasMipmap&&(this.generateMipmap(),(0,h.Y2)(r))}_setDataFromCompressedSource(e,t,r){let i=this._descriptor,{width:a,height:s,depth:n}=i,o=e.levels,l=(0,m.FV)(r,a,s,n),h=Math.min(l,o.length)-1;this._descriptor.context.gl.texParameteri(i.target,33085,h),this._forEachMipmapLevel((e,i,a,s)=>{let n=o[Math.min(e,o.length-1)];this._compressedTexImage(r,e,t,i,a,s,n)},h)}_texStorage(e,t,r,a,s,n){let{gl:o}=this._descriptor.context;if(!(0,m.tr)(t)&&!(0,m.tl)(t))throw new i.A("texture:missing-format","Immutable textures must have a sized or compressed internal format");if(!this._descriptor.isImmutable)return;let l=r?(0,m.FV)(e,a,s,n):1;if((0,m.re)(e)){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");o.texStorage3D(e,l,t,a,s,n)}else o.texStorage2D(e,l,t,a,s);this._wasImmutablyAllocated=!0}_texImage(e,t,r,a,s,n,o){let l=this._descriptor.context.gl,h=(0,m.re)(e),{isImmutable:u,pixelFormat:c,dataType:d}=this._descriptor;if(u){if(null!=o){let r=o;if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texSubImage3D(e,t,0,0,0,a,s,n,c,d,r)}else l.texSubImage2D(e,t,0,0,a,s,c,d,r)}}else{let u=o;if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texImage3D(e,t,r,a,s,n,0,c,d,u)}else l.texImage2D(e,t,r,a,s,0,c,d,u)}}_compressedTexImage(e,t,r,a,s,n,o){let l=this._descriptor.context.gl,h=(0,m.re)(e);if(this._descriptor.isImmutable){if(null!=o)if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,t,0,0,0,a,s,n,r,o)}else l.compressedTexSubImage2D(e,t,0,0,a,s,r,o)}else if(h){if(null==n)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,t,r,a,s,n,0,o)}else l.compressedTexImage2D(e,t,r,a,s,0,o)}async _compressOnWorker(e){let{width:t,height:r,context:i,flipped:a,preMultiplyAlpha:s,hasMipmap:n,compress:o}=this._descriptor;if(!o)return;let{compressionTracker:h,compressionCallback:u,preserveSourceBitmap:c}=o,{compressedTextureETC:m,compressedTextureS3TC:d}=i.capabilities;if(!g.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!m&&!d)return;this.abortCompression();let p=new AbortController;this._compressionAbortController=p,h?.increment();let f,T=!1,x=!1;try{e instanceof ImageBitmap?c?(f=await createImageBitmap(e),(0,l.Te)(p),x=!0):f=e:e instanceof Uint8Array?(f=e.buffer,T=this.descriptor.flipped):(f=await createImageBitmap(e,{imageOrientation:a?"flipY":"none"}),(0,l.Te)(p),x=!0);let i={data:f,width:t,height:r,needsFlip:T,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:s,isOpaque:this._descriptor.isOpaque,hasMipmap:n,hasETC:!!m,hasS3TC:!!d},o=await g.compressionWorkerHandle.invoke(i,p.signal,1);if((0,l.Te)(p),o.compressedTexture&&this.hasWebGLTextureObject){let e=this.usedMemory;this._descriptor.internalFormat=o.internalFormat,this._setData(o.compressedTexture),u?.(e-this.usedMemory)}}catch(e){(0,l.zf)(e)||_().error("Texture compression failed!")}finally{h?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),x&&f instanceof ImageBitmap&&f.close()}}_forEachMipmapLevel(e,t=1/0){let{width:r,height:a,depth:s,hasMipmap:n,target:o}=this._descriptor,l=32879===o;if(null==r||null==a||l&&null==s)throw new i.A("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let i=0;e(i,r,a,s),n&&(1!==r||1!==a||l&&1!==s)&&!(i>=t);++i)r=Math.max(1,r>>1),a=Math.max(1,a>>1),l&&(s=Math.max(1,s>>1))}_applySamplingMode(){let e=this._descriptor,t=e.context?.gl,r=e.samplingMode,i=e.samplingMode;9985===r||9987===r?(r=9729,e.hasMipmap||(i=9729)):(9984===r||9986===r)&&(r=9728,e.hasMipmap||(i=9728)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,r),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,i),null!=e.maxMipLevel&&t.texParameteri(e.target,t.TEXTURE_MAX_LEVEL,e.maxMipLevel)}_applyWrapMode(){let e=this._descriptor,t=e.context?.gl;"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}_applyShadowMode(){let e=this._descriptor,t=e.context?.gl,r=e.compareEnabled?t.COMPARE_REF_TO_TEXTURE:t.NONE;t.texParameteri(e.target,t.TEXTURE_COMPARE_MODE,r),e.compareEnabled&&t.texParameteri(e.target,t.TEXTURE_COMPARE_FUNC,t.GREATER),(0,h.Y2)(t)}_applyAnisotropicFilteringParameters(){let e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}},67171(e,t,r){r.d(t,{R:()=>s,e:()=>n});var i=r(63907),a=r(42293);class s{constructor(e=0,t=e){this.width=e,this.height=t,this.type=0,this.target=3553,this.pixelFormat=6408,this.dataType=i.ld.UNSIGNED_BYTE,this.samplingMode=9729,this.wrapMode=10497,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.compareEnabled=!1,this.linearFilterDepth=!1,this.depth=1,this.isImmutable=!1}}function n(e){return e.width<=0||e.height<=0||e.depth<=0?0:Math.round(e.width*e.height*e.depth*(e.hasMipmap?4/3:1)*(null==e.internalFormat?4:(0,a.MW)(e.internalFormat))*(34067===e.target?6:1))}},42293(e,t,r){r.d(t,{MW:()=>l,wH:()=>o,yu:()=>n});var i=r(94656),a=r(63907);const s=new Set([a.pe.BYTE,a.pe.SHORT,a.pe.INT,a.pe.UNSIGNED_BYTE,a.pe.UNSIGNED_SHORT,a.pe.UNSIGNED_INT]);function n(e,t,r,a=0){let n=e.gl;e.bindBuffer(r);for(let o of r.layout){let r=t.get(o.name);if(null==r){console.warn(`There is no location for vertex attribute '${o.name}' defined.`);continue}let l=a*o.stride;if(o.count<=4)o.integer&&s.has(o.type)?n.vertexAttribIPointer(r,o.count,o.type,o.stride,o.offset+l):n.vertexAttribPointer(r,o.count,o.type,o.normalized,o.stride,o.offset+l),n.enableVertexAttribArray(r),o.divisor>0&&n.vertexAttribDivisor(r,o.divisor);else if(9===o.count)for(let e=0;e<3;e++)n.vertexAttribPointer(r+e,3,o.type,o.normalized,o.stride,o.offset+12*e+l),n.enableVertexAttribArray(r+e),o.divisor>0&&n.vertexAttribDivisor(r+e,o.divisor);else if(16===o.count)for(let e=0;e<4;e++)n.vertexAttribPointer(r+e,4,o.type,o.normalized,o.stride,o.offset+16*e+l),n.enableVertexAttribArray(r+e),o.divisor>0&&n.vertexAttribDivisor(r+e,o.divisor);else console.error("Unsupported vertex attribute element count: "+o.count);if((0,i.en)()){let t=(0,i.u1)(e.gl);t&&console.error(`Unable to bind vertex attribute "${o.name}" with baseInstanceOffset ${l}:`,t,o)}}}function o(e){switch(e){case 6406:case 6409:case 6403:case 36244:case 6402:case 34041:return 1;case 6410:case 33319:case 33320:return 2;case 6407:case 36248:return 3;case 6408:case 36249:return 4}return 0}function l(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.H0.R8:case a.H0.R8I:case a.H0.R8UI:case a.H0.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.H0.RGBA4:case a.H0.R16F:case a.H0.R16I:case a.H0.R16UI:case a.H0.RG8:case a.H0.RG8I:case a.H0.RG8UI:case a.H0.RG8_SNORM:case a.H0.RGB565:case a.H0.RGB5_A1:case a.SB.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.H0.RGB8:case a.H0.RGB8I:case a.H0.RGB8UI:case a.H0.RGB8_SNORM:case a.H0.SRGB8:case a.SB.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.H0.RGBA8:case a.H0.R32F:case a.H0.R11F_G11F_B10F:case a.H0.RG16F:case a.H0.R32I:case a.H0.R32UI:case a.H0.RG16I:case a.H0.RG16UI:case a.H0.RGBA8I:case a.H0.RGBA8UI:case a.H0.RGBA8_SNORM:case a.H0.SRGB8_ALPHA8:case a.H0.RGB9_E5:case a.H0.RGB10_A2UI:case a.H0.RGB10_A2:case a.SB.DEPTH_COMPONENT32F:case a.iE.DEPTH24_STENCIL8:return 4;case a.iE.DEPTH32F_STENCIL8:return 5;case a.H0.RGB16F:case a.H0.RGB16I:case a.H0.RGB16UI:return 6;case a.H0.RG32F:case a.H0.RG32I:case a.H0.RG32UI:case a.H0.RGBA16F:case a.H0.RGBA16I:case a.H0.RGBA16UI:return 8;case a.H0.RGB32F:case a.H0.RGB32I:case a.H0.RGB32UI:return 12;case a.H0.RGBA32F:case a.H0.RGBA32I:case a.H0.RGBA32UI:return 16;case a.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT:case a.CQ.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case a.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT:case a.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case a.CQ.COMPRESSED_R11_EAC:case a.CQ.COMPRESSED_SIGNED_R11_EAC:case a.CQ.COMPRESSED_RGB8_ETC2:case a.CQ.COMPRESSED_SRGB8_ETC2:case a.CQ.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case a.CQ.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case a.CQ.COMPRESSED_RG11_EAC:case a.CQ.COMPRESSED_SIGNED_RG11_EAC:case a.CQ.COMPRESSED_RGBA8_ETC2_EAC:case a.CQ.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}},94656(e,t,r){r.d(t,{Y2:()=>h,en:()=>l,u1:()=>n});var i=r(49186),a=r(44208),s=r(53966);function n(e){switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case e.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case e.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case e.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case e.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case e.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const o=!!(0,a.A)("enable-feature:webgl-debug");function l(){return o}function h(e,t=l()){if(t){let t=n(e);if(t){let e=Error().stack;s.A.getLogger("esri.views.webgl.checkWebGLError").error(new i.A("webgl-error","WebGL error occurred",{message:t,stack:e}))}}}},12541(e,t,r){r.d(t,{CR:()=>u,Eo:()=>T,FV:()=>g,Kv:()=>p,QE:()=>l,QJ:()=>c,Qp:()=>d,mq:()=>f,re:()=>_,tl:()=>m,tr:()=>h});var i=r(49186),a=r(53966),s=r(93637),n=r(63907);const o=()=>a.A.getLogger("esri/views/webgl/textureUtils");function l(e){let{width:t,height:r,depth:i}=e;(null!=t&&t<0||null!=r&&r<0||null!=i&&i<0)&&o().error("Negative dimension parameters are not allowed!");let{internalFormat:a}=e;if(a&&(u(a)||c(a))){let{linearFilterDepth:t,compareEnabled:r,samplingMode:i,hasMipmap:a}=e;a&&o().error("Depth textures cannot have mipmaps"),t?9729!==i&&9728!==i&&o().error("Depth textures cannot sample mipmaps"):(9728!==i&&o().error("Depth textures without filtering must use NEAREST filtering"),r&&o().error("Depth textures without filtering cannot use compare function"))}}function h(e){return function(e){return n.XN.includes(e)}(e)||u(e)||c(e)}function u(e){return(0,s.a4)(n.SB,e)}function c(e){return(0,s.a4)(n.iE,e)}function m(e){return null!=e&&(0,s.a4)(n.CQ,e)}function d(e){return null!=e&&"type"in e&&"compressed"===e.type}function p(e){return null!=e&&!d(e)&&!function(e){return null!=e&&"byteLength"in e}(e)}function _(e){return 32879===e||35866===e}function g(e,t,r,i=1){let a=Math.max(t,r);return 32879===e&&(a=Math.max(a,i)),Math.floor(Math.log2(a))+1}function f(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case n.ld.FLOAT:switch(e.pixelFormat){case 6408:return n.H0.RGBA32F;case 6407:return n.H0.RGB32F;default:throw new i.A("texture:unknown-format","Unable to derive format")}case n.ld.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return n.H0.RGBA8;case 6407:return n.H0.RGB8}}let{pixelFormat:t}=e;return e.internalFormat=34041===t?n.iE.DEPTH24_STENCIL8:6402===t?n.SB.DEPTH_COMPONENT24:t,e.internalFormat}function T(e){let t="width"in e?e.width:e.codedWidth,r="height"in e?e.height:e.codedHeight;return e instanceof HTMLVideoElement&&(t=e.videoWidth,r=e.videoHeight),{width:t,height:r,depth:1}}},49788(e,t,r){r.d(t,["Q",0,1/255.5,"v",0,.9960861056751468])}}]);