@arcgis/core 5.0.0-next.17 → 5.0.0-next.19

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 (192) hide show
  1. package/AttributeBinsGraphic.js +1 -1
  2. package/analysis/ElevationProfile/ElevationProfileLineGround.js +1 -1
  3. package/analysis/ElevationProfile/ElevationProfileLineInput.js +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileLineQuery.js +1 -1
  5. package/analysis/ElevationProfile/ElevationProfileLineScene.js +1 -1
  6. package/arcade/featureSetUtils.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  9. package/arcade/featureset/sources/FeatureLayerOGC.js +5 -0
  10. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  11. package/arcade/featureset/support/FeatureSet.js +1 -1
  12. package/arcade/featureset/support/shared.js +1 -1
  13. package/assets/esri/core/workers/RemoteClient.js +1 -1
  14. package/assets/esri/core/workers/chunks/057d59ee6144e5890780.js +1 -0
  15. package/assets/esri/core/workers/chunks/{adf7ccf4ef629211c7ee.js → 08aacbfb651cc2e1c054.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{31b5900119dd7cd9e7d3.js → 0a6ad58ca4ca0cba2fa0.js} +1 -1
  17. package/assets/esri/core/workers/chunks/0d8d3d0de49064971874.js +1 -0
  18. package/assets/esri/core/workers/chunks/{b87bc987983b31c13f64.js → 0f1b9d69961dad0b922f.js} +1 -1
  19. package/assets/esri/core/workers/chunks/110cc01dd6af7ee125d4.js +1 -0
  20. package/assets/esri/core/workers/chunks/11687718c8635eb7bf37.js +1 -0
  21. package/assets/esri/core/workers/chunks/{5f6df4a3376b52ead53f.js → 14f994b1dd682bf2d61a.js} +1 -1
  22. package/assets/esri/core/workers/chunks/3538eb39ebb58acedd67.js +1 -0
  23. package/assets/esri/core/workers/chunks/{658cd45b5fb304fd840a.js → 3aa77696c5ea54a238da.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{49571d6875de1f2e7e25.js → 4b9dfdc23ba3d6ebcc1b.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{02a22dd6d208a925cc5a.js → 52cf643621662712dc85.js} +1 -1
  26. package/assets/esri/core/workers/chunks/5755b11272b777507612.js +1 -0
  27. package/assets/esri/core/workers/chunks/{d69265ceabfa92b40bb7.js → 58969dde8c3d0b2a9829.js} +1 -1
  28. package/assets/esri/core/workers/chunks/6e4829b52ade3e41ccc4.js +1 -0
  29. package/assets/esri/core/workers/chunks/{4a89e120be142ab58a27.js → 7224b321606116fd691c.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{888f188541f8bd68e33e.js → 72f1c3d97e7b9546c113.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{a4518f25b9f8fe704286.js → 76e945da8f30d8641c3d.js} +4 -4
  32. package/assets/esri/core/workers/chunks/{257f17b3836a623a9dbe.js → 795b09ff7a8f4e91f4dc.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{3ac7562ea90f91a9f30c.js → 82b2741e75c2e9b88252.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{5d2e5774768d8f290343.js → b656e8fd374113523404.js} +1 -1
  35. package/assets/esri/core/workers/chunks/bccb9ac572bc093fb177.js +1 -0
  36. package/assets/esri/core/workers/chunks/{79dbfa2b9b332ca0002f.js → c52161b94c0fb071747e.js} +1 -1
  37. package/assets/esri/core/workers/chunks/db76958fd9f54b6bd324.js +1 -0
  38. package/assets/esri/core/workers/chunks/e61d7762b56e36dc7e8a.js +1 -0
  39. package/assets/esri/core/workers/chunks/{b30897952494a3e5b9fe.js → e69c2b613bd0210e25ba.js} +1 -1
  40. package/assets/esri/core/workers/chunks/f43e1e1a1b2eb737e00c.js +1 -0
  41. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  42. package/chunks/GlowComposition.glsl.js +46 -46
  43. package/chunks/ImageMaterial.glsl.js +1 -1
  44. package/chunks/ShadedColorMaterial.glsl.js +10 -10
  45. package/config.js +1 -1
  46. package/editing/templateUtils.js +1 -1
  47. package/interfaces.d.ts +167 -51
  48. package/intl/locale.js +1 -1
  49. package/kernel.js +1 -1
  50. package/layers/BingMapsLayer.js +1 -1
  51. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  52. package/layers/PointCloudLayer.js +1 -1
  53. package/layers/SceneLayer.js +1 -1
  54. package/layers/VideoLayer.js +1 -1
  55. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  56. package/layers/mixins/SceneService.js +1 -1
  57. package/layers/ogc/ogcFeatureUtils.js +1 -1
  58. package/libs/parquet/parquet.js +1 -1
  59. package/package.json +1 -1
  60. package/renderers/support/RasterSymbolizer.js +1 -1
  61. package/rest/support/QueryMixin.js +1 -1
  62. package/support/revision.js +1 -1
  63. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  64. package/symbols/cim/cimAnalyzer.js +1 -1
  65. package/undoredo/support/ServiceVersionInfo.js +1 -1
  66. package/undoredo/support/Services.js +1 -1
  67. package/views/2d/LabelManager.js +1 -1
  68. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  69. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  70. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  71. package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
  72. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  73. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  74. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  75. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  76. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  77. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  78. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  79. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +5 -0
  80. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +5 -0
  82. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
  84. package/views/2d/engine/webgl/textureUtils.js +1 -1
  85. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  86. package/views/2d/layers/features/FeatureContainer.js +1 -1
  87. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  88. package/views/3d/GroundView3D.js +1 -1
  89. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  90. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  91. package/views/3d/analysis/images/Factory.js +1 -1
  92. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  93. package/views/3d/environment/EnvironmentManager.js +1 -1
  94. package/views/3d/environment/SceneViewEnvironment.js +1 -1
  95. package/views/3d/environment/SunLighting.js +1 -1
  96. package/views/3d/environment/VirtualLighting.js +1 -1
  97. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  98. package/views/3d/layers/DrapedSubView3D.js +1 -1
  99. package/views/3d/layers/FlowSubView3D.js +1 -1
  100. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  101. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  102. package/views/3d/layers/MediaLayerView3D.js +1 -1
  103. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  104. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  105. package/views/3d/layers/SceneLayerView3D.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  108. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  109. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  110. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  111. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  112. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  113. package/views/3d/support/QualityProfile.js +5 -0
  114. package/views/3d/support/QualitySettings.js +1 -1
  115. package/views/3d/support/StreamTextureCollection.js +1 -1
  116. package/views/3d/support/TextureCollection.js +1 -1
  117. package/views/3d/support/engineContent/marker.js +1 -1
  118. package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
  119. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  120. package/views/3d/terrain/OverlayRenderer.js +1 -1
  121. package/views/3d/terrain/TerrainSurface.js +1 -1
  122. package/views/3d/terrain/TileCompositor.js +1 -1
  123. package/views/3d/webgl-engine/Stage.js +1 -1
  124. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  125. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  126. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  127. package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
  128. package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
  129. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  130. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  131. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  132. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  133. package/views/3d/webgl-engine/lib/AnimationTimeStep.js +1 -1
  134. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  135. package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
  136. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  137. package/views/3d/webgl-engine/lib/ManagedTexture.js +5 -0
  138. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  139. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  140. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  141. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  142. package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
  143. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  144. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  145. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  146. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  148. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  149. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  150. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  151. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  152. package/views/GroundView.js +1 -1
  153. package/views/SceneView.js +1 -1
  154. package/views/support/layerViewUtils.js +1 -1
  155. package/views/webgl/Texture.js +1 -1
  156. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  157. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  158. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  159. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  160. package/widgets/Editor/VisibleElements.js +1 -1
  161. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  162. package/widgets/Editor/workflowUtils.js +1 -1
  163. package/widgets/Editor.js +1 -1
  164. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  165. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  166. package/widgets/FeatureTable/FieldColumn.js +1 -1
  167. package/widgets/FeatureTable/Grid/Column.js +1 -1
  168. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  169. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  170. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  171. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  172. package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
  173. package/widgets/OrientedImageryViewer.js +1 -1
  174. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  175. package/widgets/smartMapping/SizeSlider.js +1 -1
  176. package/widgets/support/SelectionList/VisibleElements.js +1 -1
  177. package/widgets/support/SelectionList.js +1 -1
  178. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  179. package/assets/esri/core/workers/chunks/080268f78436a2f0d996.js +0 -1
  180. package/assets/esri/core/workers/chunks/18474c017ddacd1d3d2c.js +0 -1
  181. package/assets/esri/core/workers/chunks/27e6a6c5610007ac6a54.js +0 -1
  182. package/assets/esri/core/workers/chunks/5415fbcc7ed203fc5575.js +0 -1
  183. package/assets/esri/core/workers/chunks/631fb2e62e48f8be4051.js +0 -1
  184. package/assets/esri/core/workers/chunks/722da7a39a0ad9300752.js +0 -1
  185. package/assets/esri/core/workers/chunks/9595aabbaf411eceea1e.js +0 -1
  186. package/assets/esri/core/workers/chunks/a470f662d73aa8d5d90f.js +0 -1
  187. package/assets/esri/core/workers/chunks/a57751f3d78524c876cd.js +0 -1
  188. package/assets/esri/core/workers/chunks/ac366221e8636b60aee5.js +0 -1
  189. package/assets/esri/core/workers/chunks/dec336700cfb83abbbeb.js +0 -1
  190. package/views/3d/support/DisplayQualityProfile.js +0 -5
  191. package/views/3d/webgl-engine/lib/Texture.js +0 -5
  192. /package/views/3d/webgl-engine/lib/{ITexture.js → IManagedTexture.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2883],{1843:(e,t,r)=>{r.d(t,{BP:()=>u,l5:()=>h});var i=r(20498),n=r(13030),o=r(90239),a=r(4431),s=r(620),l=r(85079);class c{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fields.keys()){const r=e.fields.get(t);this[t]=new r.constructor(this.buffer,r.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new c(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,r=0,i=e.count){const n=this.stride;if(n%4==0){const o=new Uint32Array(e.buffer,t*n,i*n/4);new Uint32Array(this.buffer,r*n,i*n/4).set(o)}else{const o=new Uint8Array(e.buffer,t*n,i*n);new Uint8Array(this.buffer,r*n,i*n).set(o)}return this}get usedMemory(){return this.byteLength}dispose(){}}class d{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(e=>this._fields.set(e[0],{...e[1],constructor:f(e[1].constructor)})))}freeze(){return this}get locations(){return(0,l.Xk)((0,a.U)(this))}vec2f16(e,t){return this._appendField(e,i.SX?n.ZD:n.gH,t),this}vec2f(e,t){return this._appendField(e,n.gH,t),this}vec2f64(e,t){return this._appendField(e,n.si,t),this}vec3f16(e,t){return this._appendField(e,i.SX?n.EC:n.xs,t),this}vec3f(e,t){return this._appendField(e,n.xs,t),this}vec3f64(e,t){return this._appendField(e,n.Xm,t),this}vec4f16(e,t){return this._appendField(e,i.SX?n.jz:n.Eq,t),this}vec4f(e,t){return this._appendField(e,n.Eq,t),this}vec4f64(e,t){return this._appendField(e,n.Aj,t),this}mat3f(e,t){return this._appendField(e,n.jZ,t),this}mat3f64(e,t){return this._appendField(e,n.j0,t),this}mat4f(e,t){return this._appendField(e,n.Sx,t),this}mat4f64(e,t){return this._appendField(e,n.E$,t),this}vec4u8(e,t){return this._appendField(e,n.XP,t),this}f16(e,t){return this._appendField(e,i.SX?n.XW:n.Y$,t),this}f32(e,t){return this._appendField(e,n.Y$,t),this}f64(e,t){return this._appendField(e,n.qB,t),this}u8(e,t){return this._appendField(e,n.SL,t),this}u16(e,t){return this._appendField(e,n.h,t),this}i8(e,t){return this._appendField(e,n.bf,t),this}vec2i8(e,t){return this._appendField(e,n.D6,t),this}vec2i16(e,t){return this._appendField(e,n.mJ,t),this}vec2u8(e,t){return this._appendField(e,n.LC,t),this}vec2u16(e,t){return this._appendField(e,n.Yi,t),this}vec4u16(e,t){return this._appendField(e,n.Uz,t),this}vec4i16(e,t){return this._appendField(e,n.E7,t),this}u32(e,t){return this._appendField(e,n.P,t),this}_appendField(e,t,r){this._fields.has(e)&&(0,s.vA)(!1,`${e} already added to vertex buffer layout`);const i=t.ElementCount*(0,o.GJ)(t.ElementType),n=this._stride;this._fields.set(e,{constructor:t,size:i,offset:n,optional:r}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach(r=>{const i=(0,o.GJ)(r.constructor.ElementType);e=Math.floor((e+i-1)/i)*i,r.offset=e,e+=r.size,t=Math.max(t,i)}),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new c(this,e)}createView(e){return new c(this,e)}clone(){const e=new d;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((t,r)=>e._fields.set(r,t)),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function u(){return new d}class h{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const r={...e,constructor:m(e.constructor)};this.fields.push([t,r])}),this.stride=e.stride}}const p=[n.Y$,n.gH,n.xs,n.Eq,n.jZ,n.Sx,n.qB,n.si,n.Xm,n.Aj,n.j0,n.E$,n.SL,n.LC,n.eI,n.XP,n.h,n.Yi,n.nS,n.Uz,n.P,n.An,n.H$,n.ml,n.bf,n.D6,n.m8,n.TX,n.Qt,n.mJ,n.Vp,n.E7,n.My,n.UL,n.zD,n.Y4];function m(e){return`${e.ElementType}_${e.ElementCount}`}function f(e){return g.get(e)}const g=new Map;p.forEach(e=>g.set(m(e),e))},2495:(e,t,r)=>{r.d(t,{$U:()=>Ee,fs:()=>Re,ty:()=>Ie});var i=r(38954),n=r(51850),o=r(49255),a=r(25634),s=r(11725),l=r(33524),c=r(70328),d=r(620);class u{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const h=(0,c.vt)(),p=(0,n.vt)();function m(e,t,r,n,o,a,s){if(null==e)return;const l=function(e,t){return(0,i.j)(t,1/e[0],1/e[1],1/e[2])}(r,p);if((0,c.Ne)(h,e.bbMin),(0,c.vI)(h,e.bbMax),null!=o&&o.applyToAabb(h),function(e,t,r,i){return function(e,t,r,i){const n=(e[0]-i-t[0])*r[0],o=(e[3]+i-t[0])*r[0];let a=Math.min(n,o),s=Math.max(n,o);const l=(e[1]-i-t[1])*r[1],c=(e[4]+i-t[1])*r[1];if(s=Math.min(s,Math.max(l,c)),s<0)return!1;if(a=Math.max(a,Math.min(l,c)),a>s)return!1;const d=(e[2]-i-t[2])*r[2],u=(e[5]+i-t[2])*r[2];return s=Math.min(s,Math.max(d,u)),!(s<0)&&(a=Math.max(a,Math.min(d,u)),!(a>s)&&a<1/0)}(e,t,r,i)}(h,t,l,n)){const{primitiveIndices:i,position:l}=e,c=i?i.length:l.indices.length/3;if(c>T){const i=e.getChildren();if(void 0!==i){for(const e of i)m(e,t,r,n,o,a,s);return}}!function(e,t,r,i,n,o,a,s,l,c,d){const u=e[0],h=e[1],p=e[2],m=t[0],g=t[1],v=t[2],{normalRequired:_}=c;for(let e=0;e<i;++e){const t=s[e],r=3*t,i=a*n[r];let c=o[i],x=o[i+1],y=o[i+2];const b=a*n[r+1];let M=o[b],T=o[b+1],S=o[b+2];const E=a*n[r+2];let A=o[E],R=o[E+1],I=o[E+2];null!=l&&([c,x,y]=l.applyToVertex(c,x,y,e),[M,T,S]=l.applyToVertex(M,T,S,e),[A,R,I]=l.applyToVertex(A,R,I,e));const F=M-c,O=T-x,P=S-y,D=A-c,N=R-x,H=I-y,L=g*H-N*v,z=v*D-H*m,B=m*N-D*g,G=F*L+O*z+P*B;if(Math.abs(G)<=C)continue;const U=u-c,V=h-x,j=p-y,W=U*L+V*z+j*B;if(G>0){if(W<0||W>G)continue}else if(W>0||W<G)continue;const k=V*P-O*j,$=j*F-P*U,Z=U*O-F*V,q=m*k+g*$+v*Z;if(G>0){if(q<0||W+q>G)continue}else if(q>0||W+q<G)continue;const Y=(D*k+N*$+H*Z)/G;Y>=0&&d(Y,t,_?w(F,O,P,D,N,H,f):null)}}(t,r,0,c,l.indices,l.data,l.stride,i,o,a,s)}}const f=(0,n.vt)();function g(e,t,r,i,n,o,a,s){const l=e[0],c=e[1],d=e[2],u=t[0],h=t[1],p=t[2];for(let e=r;e<i;++e){const t=3*e,r=t+1,i=t+2,m=o*t,g=n[m],v=n[m+1],_=n[m+2],x=o*r,y=o*i,b=n[x]-g,M=n[x+1]-v,T=n[x+2]-_,S=n[y]-g,E=n[y+1]-v,A=n[y+2]-_,R=h*A-E*p,I=p*S-A*u,F=u*E-S*h,O=b*R+M*I+T*F;if(Math.abs(O)<=C)continue;const P=l-g,D=c-v,N=d-_,H=P*R+D*I+N*F;if(O>0){if(H<0||H>O)continue}else if(H>0||H<O)continue;const L=D*T-M*N,z=N*b-T*P,B=P*M-b*D,G=u*L+h*z+p*B;if(O>0){if(G<0||H+G>O)continue}else if(G>0||H+G<O)continue;const U=(S*L+E*z+A*B)/O;U>=0&&s(U,e,a?w(b,M,T,S,E,A,f):null)}}const v=(0,n.vt)(),_=(0,n.vt)(),x=(0,n.vt)();function w(e,t,r,n,o,a,s){return(0,i.j)(b,e,t,r),(0,i.j)(M,n,o,a),(0,i.i)(s,b,M),(0,i.n)(s,s),s}function y(e){return(0,i.a)(b,e[1],e[0]),(0,i.a)(M,e[2],e[0]),(0,i.i)(f,b,M),(0,i.n)(f,f),f}const b=(0,n.vt)(),M=(0,n.vt)(),T=1e3,C=1e-7,S=(0,n.vt)(),E=[(0,n.vt)(),(0,n.vt)(),(0,n.vt)()];var A=r(16396),R=r(13030),I=r(59907);class F{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,i,n,o){return(0,I.vJ)(r,i,this.layout,e,t,n,o)}intersect(e,t,r,n,o,a,s){const l=this.layout.createView(e).getField("position",R.xs);if(null==l)return;const c=(0,i.a)(O,a,o),d=l.count/3,u=n.options.normalRequired;g(o,c,0,d,l.typedBuffer,l.typedBufferStride,u,(e,t,r)=>s(e,r,t))}}const O=(0,n.vt)();var P=r(43616),D=r(31635),N=(r(53966),r(44208)),H=(r(87811),r(49186),r(64108)),L=r(91829),z=r(4431),B=r(1843),G=r(72824),U=r(13840),V=r(42958),j=r(16943);const W={mask:255},k={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},$={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Z=r(4576);r(34275),r(94656),r(63907),(0,N.A)("esri-tests-disable-gpu-memory-measurements");var q=r(69622),Y=r(65529),X=r(10107),J=r(77690),K=r(29242),Q=r(58083),ee=r(9093),te=r(32728);class re{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",R.Eq),this.color=e.getField("instanceColor",R.XP),this.olidColor=e.getField("instanceOlidColor",R.XP),this.state=e.getField("state",R.SL),this.lodLevel=e.getField("lodLevel",R.SL)}}let ie=class extends q.A{constructor(e,t){super(e),this.events=new Y.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return oe(ne.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=de,this._buffer=this._layout.createBuffer(this._capacity),this._view=new re(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,d.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,d.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,r=!0){this._view.localTransform.setMat(e,t),r&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,r=!0){this._view.globalTransform.setMat(e,t),r&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,r=ae,n=se;t.localTransform.getMat(e,le),t.globalTransform.getMat(e,ce);const o=(0,Q.lw)(ce,ce,le);(0,i.j)(r,o[12],o[13],o[14]),t.modelOrigin.setVec(e,r),(0,J.z0)(n,o),t.model.setMat(e,n);const a=(0,te.wp)(ae,o);a.sort(),t.modelScaleFactors.set(e,0,a[1]),t.modelScaleFactors.set(e,1,a[2]),(0,J.B8)(n,n),(0,J.mg)(n,n),t.modelNormal.setMat(e,n),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const r=this._view;r.model.getMat(e,se),r.modelOrigin.getVec(e,ae),t[0]=se[0],t[1]=se[1],t[2]=se[2],t[3]=0,t[4]=se[3],t[5]=se[4],t[6]=se[5],t[7]=0,t[8]=se[6],t[9]=se[7],t[10]=se[8],t[11]=0,t[12]=ae[0],t[13]=ae[1],t[14]=ae[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(ae,this,e),t*=Math.max(ae[0],ae[1],ae[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(ae,this,e),t*=function(e,t,r){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),r))}(ae[0],ae[1],ae[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:r}=this,i=r.get(e);t?t!==i&&(r.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):i&&(r.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let r=0;r<this._capacity;++r)this.getState(r)&e&&++t;return t}_setStateFlags(e,t){const r=this._view.state;t=r.get(e)|t,r.set(e,t)}_clearStateFlags(e,t){const r=this._view.state;t=r.get(e)&~t,r.set(e,t)}_setStateFlag(e,t,r){r?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max(de,Math.floor(this._capacity*Z.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new re(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,D.Cg)([(0,X.MZ)({constructOnly:!0})],ie.prototype,"shaderTransformation",void 0),(0,D.Cg)([(0,X.MZ)()],ie.prototype,"_size",void 0),(0,D.Cg)([(0,X.MZ)({readOnly:!0})],ie.prototype,"size",null),ie=(0,D.Cg)([(0,H.$)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],ie);const ne=(0,B.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function oe(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,j.E)()&&e.vec4u8("instanceOlidColor"),e}const ae=(0,n.vt)(),se=(0,K.vt)(),le=(0,ee.vt)(),ce=(0,ee.vt)(),de=64,ue=(0,B.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var he=r(74810),pe=r(28491),me=r(90644),fe=r(85079),ge=r(49788);class ve extends G.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=he.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrength=0,this.emissiveSource=1,this.emissiveBaseColor=n.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,n.CN)(.2,.2,.2),this.diffuse=(0,n.CN)(.8,.8,.8),this.externalColor=(0,L.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,n.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=ge.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}G.gy;let _e=class extends V.w{constructor(e,t){const i=[(0,z.U)(ye(t))];t.instanced&&t.instancedDoublePrecision&&i.push((0,z.U)(function(e){return oe(ue.clone(),e)}(t))),super(e,t,(0,fe._u)(i)),this.shader=new U.r(pe.D,()=>r.e(5141).then(r.bind(r,5141)))}_makePipeline(e,t){const{oitPass:r,output:i,transparent:n,cullFace:a,customDepthTest:s,hasOccludees:c}=e;return(0,me.Ey)({blending:(0,o.RN)(i)&&n?(0,l.Yf)(r):null,culling:we(e)?(0,me.Xt)(a):null,depthTest:{func:(0,l.K_)(r,xe(s))},depthWrite:(0,l.z5)(e),drawBuffers:(0,V.L)(i,(0,l.m6)(r,i)),colorWrite:me.kn,stencilWrite:c?W:null,stencilTest:c?t?$:k:null,polygonOffset:(0,l.mE)(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};function xe(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function we(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function ye(e){const t=(0,B.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color"),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,j.E)()&&t.vec4u8("olidColor"),t}_e=(0,D.Cg)([(0,H.$)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],_e);var be=r(51976),Me=r(35256);class Te extends Me.E{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.occlusionPass=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}(0,D.Cg)([(0,be.W)({count:4})],Te.prototype,"alphaDiscardMode",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"doubleSidedMode",void 0),(0,D.Cg)([(0,be.W)({count:7})],Te.prototype,"pbrMode",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"cullFace",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"normalType",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"customDepthTest",void 0),(0,D.Cg)([(0,be.W)({count:8})],Te.prototype,"emissionSource",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVertexColors",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasSymbolColors",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVerticalOffset",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasColorTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasMetallicRoughnessTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasOcclusionTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasNormalTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasScreenSizePerspective",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVertexTangents",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasOccludees",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instanced",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instancedDoublePrecision",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasModelTransformation",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"offsetBackfaces",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVVSize",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVVColor",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"receiveShadows",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"receiveAmbientOcclusion",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"textureAlphaPremultiplied",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instancedFeatureAttribute",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instancedColor",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"writeDepth",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"transparent",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"enableOffset",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"terrainDepthTest",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"cullAboveTerrain",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"snowCover",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasColorTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasEmissionTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasNormalTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasOcclusionTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasMetallicRoughnessTextureTransform",void 0);var Ce=r(57323);let Se=class extends _e{constructor(){super(...arguments),this.shader=new U.r(Ce.R,()=>r.e(2314).then(r.bind(r,39933)))}};Se=(0,D.Cg)([(0,H.$)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],Se);class Ee extends s.i{constructor(e,t){super(e,Re),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>((0,o.iq)(e)||(0,o.Bf)(e))&&!this.transparent],[4,e=>((0,o.iq)(e)||(0,o.Bf)(e))&&this.transparent&&this.parameters.writeDepth],[8,e=>((0,o.iq)(e)||(0,o.Bf)(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=ye(this.parameters),this._configuration=new Te(t.spherical)}isVisibleForOutput(e){return 4!==e&&6!==e&&5!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(i[3])?1:i[3])>=ge.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,i.q)(this.parameters.emissiveBaseColor,n.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,t){const{parameters:r,_configuration:i}=this,{treeRendering:n,doubleSided:a,doubleSidedType:s}=r;return super.getConfiguration(e,t,this._configuration),i.hasNormalTexture=r.hasNormalTexture,i.hasColorTexture=r.hasColorTexture,i.hasMetallicRoughnessTexture=r.hasMetallicRoughnessTexture,i.hasOcclusionTexture=r.hasOcclusionTexture,i.hasVertexTangents=!n&&r.hasVertexTangents,i.instanced=r.instanced,i.instancedDoublePrecision=r.instancedDoublePrecision,i.hasVVColor=!!r.vvColor,i.hasVVSize=!!r.vvSize,i.hasVerticalOffset=null!=r.verticalOffset,i.hasScreenSizePerspective=null!=r.screenSizePerspective,i.hasSlicePlane=r.hasSlicePlane,i.alphaDiscardMode=r.textureAlphaMode,i.normalType=n?0:r.normalType,i.transparent=this.transparent,i.writeDepth=r.writeDepth,i.customDepthTest=r.customDepthTest??0,i.hasOccludees=t.hasOccludees,i.cullFace=r.hasSlicePlane?0:r.cullFace,i.cullAboveTerrain=t.cullAboveTerrain,i.hasModelTransformation=!n&&null!=r.modelTransformation,i.hasVertexColors=r.hasVertexColors,i.hasSymbolColors=r.hasSymbolColors,i.doubleSidedMode=n?2:a&&"normal"===s?1:a&&"winding-order"===s?2:0,i.instancedFeatureAttribute=r.instancedFeatureAttribute,i.instancedColor=r.instancedColor,(0,o.RN)(e)?(i.terrainDepthTest=t.terrainDepthTest,i.receiveShadows=r.receiveShadows,i.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(i.terrainDepthTest=!1,i.receiveShadows=i.receiveAmbientOcclusion=!1),i.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,i.pbrMode=r.usePBR?r.isSchematic?2:1:0,i.emissionSource=r.emissionSource,i.offsetBackfaces=!(!this.transparent||!r.offsetTransparentBackfaces),i.oitPass=t.oitPass,i.enableOffset=t.camera.relativeElevation<l.xt,i.snowCover=t.snowCover>0,i.hasColorTextureTransform=!!r.colorTextureTransformMatrix,i.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,i.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,i.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,i.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,i}intersect(e,t,r,n,o,a){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,i.j)(He,t[12],t[13],t[14]);let a=null;switch(r.viewingMode){case 1:a=(0,i.n)(De,He);break;case 2:a=(0,i.d)(De,Pe)}let s=0;const l=(0,i.e)(Le,He,e.eye),c=(0,i.b)(l),d=(0,i.h)(l,l,1/c);let u=null;this.parameters.screenSizePerspective&&(u=(0,i.f)(a,d)),s+=(0,P.kE)(e,c,this.parameters.verticalOffset,u??0,this.parameters.screenSizePerspective,null),(0,i.h)(a,a,s),(0,i.o)(Ne,a,r.transform.inverseRotation),n=(0,i.e)(Fe,n,Ne),o=(0,i.e)(Oe,o,Ne)}!function(e,t,r,n,o,a){if(!e.visible)return;const s=(0,i.a)(S,n,r),l=(e,t,r)=>a(e,r,t),{tolerance:c}=t,h=new u(c,!1,t.options.normalRequired);if(e.boundingInfo)(0,d.vA)(0===e.type),m(e.boundingInfo,r,s,c,o,h,l);else{const t=e.positionAttribute,n=t.indices;!function(e,t,r,n,o,a,s,l,c,d){const u=t,h=E,p=Math.abs(u[0]),m=Math.abs(u[1]),f=Math.abs(u[2]),g=p>=m?p>=f?0:2:m>=f?1:2,w=g,b=u[w]<0?2:1,M=(g+b)%3,T=(g+(3-b))%3,C=u[M]/u[w],S=u[T]/u[w],A=1/u[w],R=v,I=_,F=x,{normalRequired:O}=c;for(let t=r;t<n;++t){const r=3*t,n=s*o[r];(0,i.j)(h[0],a[n+0],a[n+1],a[n+2]);const c=s*o[r+1];(0,i.j)(h[1],a[c+0],a[c+1],a[c+2]);const u=s*o[r+2];(0,i.j)(h[2],a[u+0],a[u+1],a[u+2]),l&&((0,i.d)(h[0],l.applyToVertex(h[0][0],h[0][1],h[0][2],t)),(0,i.d)(h[1],l.applyToVertex(h[1][0],h[1][1],h[1][2],t)),(0,i.d)(h[2],l.applyToVertex(h[2][0],h[2][1],h[2][2],t))),(0,i.a)(R,h[0],e),(0,i.a)(I,h[1],e),(0,i.a)(F,h[2],e);const p=R[M]-C*R[w],m=R[T]-S*R[w],f=I[M]-C*I[w],g=I[T]-S*I[w],v=F[M]-C*F[w],_=F[T]-S*F[w],x=v*g-_*f,b=p*_-m*v,E=f*m-g*p;if((x<0||b<0||E<0)&&(x>0||b>0||E>0))continue;const P=x+b+E;if(0===P)continue;const D=x*(A*R[w])+b*(A*I[w])+E*(A*F[w]);if(D*Math.sign(P)<0)continue;const N=D/P;N>=0&&d(N,t,O?y(h):null)}}(r,s,0,n.length/3,n,t.data,t.stride,o,h,l)}}(e,r,n,o,(0,A.ou)(r.verticalOffset),a)}createGLMaterial(e){return new Ae(e)}createBufferWriter(){return new F(this._layout)}get transparent(){return Ie(this.parameters)}}class Ae extends a.m8{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,i.j)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?Se:_e,e)}}class Re extends ve{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:this.usePBR?0===this.emissiveSource?2:1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function Ie(e){const{drivenOpacity:t,opacity:r,externalColor:i,layerOpacity:n,texture:o,textureId:a,textureAlphaMode:s,colorMixMode:l}=e,c=i[3];return t||r<1&&"replace"!==l||c<1&&"ignore"!==l||n<1||(null!=o||null!=a)&&1!==s&&2!==s&&"replace"!==l}const Fe=(0,n.vt)(),Oe=(0,n.vt)(),Pe=(0,n.fA)(0,0,1),De=(0,n.vt)(),Ne=(0,n.vt)(),He=(0,n.vt)(),Le=(0,n.vt)()},4431:(e,t,r)=>{r.d(t,{U:()=>o}),r(44208);var i=r(63907),n=r(74038);function o(e,t=0){const r=e.stride;return Array.from(e.fields.keys()).map(o=>{const a=e.fields.get(o),s=a.constructor.ElementCount,l=function(e){switch(e){case"u8":return i.pe.UNSIGNED_BYTE;case"u16":return i.pe.UNSIGNED_SHORT;case"u32":return i.pe.UNSIGNED_INT;case"i8":return i.pe.BYTE;case"i16":return i.pe.SHORT;case"i32":return i.pe.INT;case"f16":return i.pe.HALF_FLOAT;case"f32":return i.pe.FLOAT;default:throw new Error("BufferType not supported in WebGL")}}(a.constructor.ElementType),c=a.offset,d=a.optional?.glNormalized??!1;return new n._(o,s,l,c,r,d,t)})}},6867:(e,t,r)=>{r.d(t,{i:()=>d});var i=r(58083),n=r(9093),o=r(38954),a=r(51850),s=r(87317),l=r(91829),c=r(71351);class d{get ray(){return this._ray}get distanceInRenderSpace(){return null==this.distance?null:((0,o.h)(h,this.ray.direction,this.distance),(0,o.b)(h))}withinDistance(e){return!!u(this)&&this.distanceInRenderSpace<=e}getIntersectionPoint(e){return!!u(this)&&((0,o.h)(h,this.ray.direction,this.distance),(0,o.g)(e,this.ray.origin,h),!0)}getTransformedNormal(e){return(0,o.d)(p,this.normal),p[3]=0,(0,s.t)(p,p,this.transformation),(0,o.d)(e,p),(0,o.n)(e,e)}constructor(e){this.intersector=4,this.normal=(0,a.vt)(),this.transformation=(0,n.vt)(),this._ray=(0,c.vt)(),this.init(e)}init(e){this.distance=this.target=this.drapedLayerOrder=this.renderPriority=null,this.intersector=4,(0,c.C)(e,this._ray)}set(e,t,r,s,l,c,d){this.intersector=e,this.distance=r,(0,o.d)(this.normal,s??a.Cb),(0,i.C)(this.transformation,l??n.zK),this.target=t,this.drapedLayerOrder=c,this.renderPriority=d}copy(e){(0,c.C)(e.ray,this._ray),this.intersector=e.intersector,this.distance=e.distance,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.renderPriority=e.renderPriority,(0,o.d)(this.normal,e.normal),(0,i.C)(this.transformation,e.transformation)}}function u(e){return null!=e?.distance}const h=(0,a.vt)(),p=(0,l.vt)()},10906:(e,t,r)=>{r.d(t,{b:()=>o});var i=r(33094),n=r(31821);function o(e,t){t.snowCover&&(e.uniforms.add(new i.U("snowCover",e=>e.snowCover)).code.add(n.H`float getSnow(vec3 normal, vec3 groundNormal) {
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1145],{1843:(e,t,r)=>{r.d(t,{BP:()=>u,l5:()=>h});var i=r(20498),n=r(13030),o=r(90239),a=r(4431),s=r(620),l=r(85079);class c{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fields.keys()){const r=e.fields.get(t);this[t]=new r.constructor(this.buffer,r.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const r=this[e];return r&&r.elementCount===t.ElementCount&&r.elementType===t.ElementType?r:null}slice(e,t){return new c(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,r=0,i=e.count){const n=this.stride;if(n%4==0){const o=new Uint32Array(e.buffer,t*n,i*n/4);new Uint32Array(this.buffer,r*n,i*n/4).set(o)}else{const o=new Uint8Array(e.buffer,t*n,i*n);new Uint8Array(this.buffer,r*n,i*n).set(o)}return this}get usedMemory(){return this.byteLength}dispose(){}}class d{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(e=>this._fields.set(e[0],{...e[1],constructor:f(e[1].constructor)})))}freeze(){return this}get locations(){return(0,l.Xk)((0,a.U)(this))}vec2f16(e,t){return this._appendField(e,i.SX?n.ZD:n.gH,t),this}vec2f(e,t){return this._appendField(e,n.gH,t),this}vec2f64(e,t){return this._appendField(e,n.si,t),this}vec3f16(e,t){return this._appendField(e,i.SX?n.EC:n.xs,t),this}vec3f(e,t){return this._appendField(e,n.xs,t),this}vec3f64(e,t){return this._appendField(e,n.Xm,t),this}vec4f16(e,t){return this._appendField(e,i.SX?n.jz:n.Eq,t),this}vec4f(e,t){return this._appendField(e,n.Eq,t),this}vec4f64(e,t){return this._appendField(e,n.Aj,t),this}mat3f(e,t){return this._appendField(e,n.jZ,t),this}mat3f64(e,t){return this._appendField(e,n.j0,t),this}mat4f(e,t){return this._appendField(e,n.Sx,t),this}mat4f64(e,t){return this._appendField(e,n.E$,t),this}vec4u8(e,t){return this._appendField(e,n.XP,t),this}f16(e,t){return this._appendField(e,i.SX?n.XW:n.Y$,t),this}f32(e,t){return this._appendField(e,n.Y$,t),this}f64(e,t){return this._appendField(e,n.qB,t),this}u8(e,t){return this._appendField(e,n.SL,t),this}u16(e,t){return this._appendField(e,n.h,t),this}i8(e,t){return this._appendField(e,n.bf,t),this}vec2i8(e,t){return this._appendField(e,n.D6,t),this}vec2i16(e,t){return this._appendField(e,n.mJ,t),this}vec2u8(e,t){return this._appendField(e,n.LC,t),this}vec2u16(e,t){return this._appendField(e,n.Yi,t),this}vec4u16(e,t){return this._appendField(e,n.Uz,t),this}vec4i16(e,t){return this._appendField(e,n.E7,t),this}u32(e,t){return this._appendField(e,n.P,t),this}_appendField(e,t,r){this._fields.has(e)&&(0,s.vA)(!1,`${e} already added to vertex buffer layout`);const i=t.ElementCount*(0,o.GJ)(t.ElementType),n=this._stride;this._fields.set(e,{constructor:t,size:i,offset:n,optional:r}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach(r=>{const i=(0,o.GJ)(r.constructor.ElementType);e=Math.floor((e+i-1)/i)*i,r.offset=e,e+=r.size,t=Math.max(t,i)}),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new c(this,e)}createView(e){return new c(this,e)}clone(){const e=new d;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((t,r)=>e._fields.set(r,t)),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function u(){return new d}class h{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const r={...e,constructor:m(e.constructor)};this.fields.push([t,r])}),this.stride=e.stride}}const p=[n.Y$,n.gH,n.xs,n.Eq,n.jZ,n.Sx,n.qB,n.si,n.Xm,n.Aj,n.j0,n.E$,n.SL,n.LC,n.eI,n.XP,n.h,n.Yi,n.nS,n.Uz,n.P,n.An,n.H$,n.ml,n.bf,n.D6,n.m8,n.TX,n.Qt,n.mJ,n.Vp,n.E7,n.My,n.UL,n.zD,n.Y4];function m(e){return`${e.ElementType}_${e.ElementCount}`}function f(e){return g.get(e)}const g=new Map;p.forEach(e=>g.set(m(e),e))},2495:(e,t,r)=>{r.d(t,{$U:()=>Ee,fs:()=>Re,ty:()=>Ie});var i=r(38954),n=r(51850),o=r(49255),a=r(25634),s=r(11725),l=r(33524),c=r(70328),d=r(620);class u{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const h=(0,c.vt)(),p=(0,n.vt)();function m(e,t,r,n,o,a,s){if(null==e)return;const l=function(e,t){return(0,i.j)(t,1/e[0],1/e[1],1/e[2])}(r,p);if((0,c.Ne)(h,e.bbMin),(0,c.vI)(h,e.bbMax),null!=o&&o.applyToAabb(h),function(e,t,r,i){return function(e,t,r,i){const n=(e[0]-i-t[0])*r[0],o=(e[3]+i-t[0])*r[0];let a=Math.min(n,o),s=Math.max(n,o);const l=(e[1]-i-t[1])*r[1],c=(e[4]+i-t[1])*r[1];if(s=Math.min(s,Math.max(l,c)),s<0)return!1;if(a=Math.max(a,Math.min(l,c)),a>s)return!1;const d=(e[2]-i-t[2])*r[2],u=(e[5]+i-t[2])*r[2];return s=Math.min(s,Math.max(d,u)),!(s<0)&&(a=Math.max(a,Math.min(d,u)),!(a>s)&&a<1/0)}(e,t,r,i)}(h,t,l,n)){const{primitiveIndices:i,position:l}=e,c=i?i.length:l.indices.length/3;if(c>T){const i=e.getChildren();if(void 0!==i){for(const e of i)m(e,t,r,n,o,a,s);return}}!function(e,t,r,i,n,o,a,s,l,c,d){const u=e[0],h=e[1],p=e[2],m=t[0],g=t[1],v=t[2],{normalRequired:_}=c;for(let e=0;e<i;++e){const t=s[e],r=3*t,i=a*n[r];let c=o[i],x=o[i+1],y=o[i+2];const b=a*n[r+1];let M=o[b],T=o[b+1],S=o[b+2];const E=a*n[r+2];let A=o[E],R=o[E+1],I=o[E+2];null!=l&&([c,x,y]=l.applyToVertex(c,x,y,e),[M,T,S]=l.applyToVertex(M,T,S,e),[A,R,I]=l.applyToVertex(A,R,I,e));const F=M-c,O=T-x,P=S-y,D=A-c,N=R-x,H=I-y,L=g*H-N*v,z=v*D-H*m,B=m*N-D*g,G=F*L+O*z+P*B;if(Math.abs(G)<=C)continue;const U=u-c,V=h-x,j=p-y,W=U*L+V*z+j*B;if(G>0){if(W<0||W>G)continue}else if(W>0||W<G)continue;const k=V*P-O*j,$=j*F-P*U,Z=U*O-F*V,q=m*k+g*$+v*Z;if(G>0){if(q<0||W+q>G)continue}else if(q>0||W+q<G)continue;const Y=(D*k+N*$+H*Z)/G;Y>=0&&d(Y,t,_?w(F,O,P,D,N,H,f):null)}}(t,r,0,c,l.indices,l.data,l.stride,i,o,a,s)}}const f=(0,n.vt)();function g(e,t,r,i,n,o,a,s){const l=e[0],c=e[1],d=e[2],u=t[0],h=t[1],p=t[2];for(let e=r;e<i;++e){const t=3*e,r=t+1,i=t+2,m=o*t,g=n[m],v=n[m+1],_=n[m+2],x=o*r,y=o*i,b=n[x]-g,M=n[x+1]-v,T=n[x+2]-_,S=n[y]-g,E=n[y+1]-v,A=n[y+2]-_,R=h*A-E*p,I=p*S-A*u,F=u*E-S*h,O=b*R+M*I+T*F;if(Math.abs(O)<=C)continue;const P=l-g,D=c-v,N=d-_,H=P*R+D*I+N*F;if(O>0){if(H<0||H>O)continue}else if(H>0||H<O)continue;const L=D*T-M*N,z=N*b-T*P,B=P*M-b*D,G=u*L+h*z+p*B;if(O>0){if(G<0||H+G>O)continue}else if(G>0||H+G<O)continue;const U=(S*L+E*z+A*B)/O;U>=0&&s(U,e,a?w(b,M,T,S,E,A,f):null)}}const v=(0,n.vt)(),_=(0,n.vt)(),x=(0,n.vt)();function w(e,t,r,n,o,a,s){return(0,i.j)(b,e,t,r),(0,i.j)(M,n,o,a),(0,i.i)(s,b,M),(0,i.n)(s,s),s}function y(e){return(0,i.a)(b,e[1],e[0]),(0,i.a)(M,e[2],e[0]),(0,i.i)(f,b,M),(0,i.n)(f,f),f}const b=(0,n.vt)(),M=(0,n.vt)(),T=1e3,C=1e-7,S=(0,n.vt)(),E=[(0,n.vt)(),(0,n.vt)(),(0,n.vt)()];var A=r(16396),R=r(13030),I=r(59907);class F{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,i,n,o){return(0,I.vJ)(r,i,this.layout,e,t,n,o)}intersect(e,t,r,n,o,a,s){const l=this.layout.createView(e).getField("position",R.xs);if(null==l)return;const c=(0,i.a)(O,a,o),d=l.count/3,u=n.options.normalRequired;g(o,c,0,d,l.typedBuffer,l.typedBufferStride,u,(e,t,r)=>s(e,r,t))}}const O=(0,n.vt)();var P=r(43616),D=r(31635),N=(r(53966),r(44208)),H=(r(87811),r(49186),r(64108)),L=r(91829),z=r(4431),B=r(1843),G=r(72824),U=r(13840),V=r(42958),j=r(16943);const W={mask:255},k={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},$={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Z=r(4576);r(34275),r(94656),r(63907),(0,N.A)("esri-tests-disable-gpu-memory-measurements");var q=r(69622),Y=r(65529),X=r(10107),J=r(77690),K=r(29242),Q=r(58083),ee=r(9093),te=r(32728);class re{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",R.Eq),this.color=e.getField("instanceColor",R.XP),this.olidColor=e.getField("instanceOlidColor",R.XP),this.state=e.getField("state",R.SL),this.lodLevel=e.getField("lodLevel",R.SL)}}let ie=class extends q.A{constructor(e,t){super(e),this.events=new Y.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return oe(ne.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=de,this._buffer=this._layout.createBuffer(this._capacity),this._view=new re(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,d.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,d.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,r=!0){this._view.localTransform.setMat(e,t),r&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,r=!0){this._view.globalTransform.setMat(e,t),r&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,r=ae,n=se;t.localTransform.getMat(e,le),t.globalTransform.getMat(e,ce);const o=(0,Q.lw)(ce,ce,le);(0,i.j)(r,o[12],o[13],o[14]),t.modelOrigin.setVec(e,r),(0,J.z0)(n,o),t.model.setMat(e,n);const a=(0,te.wp)(ae,o);a.sort(),t.modelScaleFactors.set(e,0,a[1]),t.modelScaleFactors.set(e,1,a[2]),(0,J.B8)(n,n),(0,J.mg)(n,n),t.modelNormal.setMat(e,n),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const r=this._view;r.model.getMat(e,se),r.modelOrigin.getVec(e,ae),t[0]=se[0],t[1]=se[1],t[2]=se[2],t[3]=0,t[4]=se[3],t[5]=se[4],t[6]=se[5],t[7]=0,t[8]=se[6],t[9]=se[7],t[10]=se[8],t[11]=0,t[12]=ae[0],t[13]=ae[1],t[14]=ae[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(ae,this,e),t*=Math.max(ae[0],ae[1],ae[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(ae,this,e),t*=function(e,t,r){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),r))}(ae[0],ae[1],ae[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:r}=this,i=r.get(e);t?t!==i&&(r.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):i&&(r.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let r=0;r<this._capacity;++r)this.getState(r)&e&&++t;return t}_setStateFlags(e,t){const r=this._view.state;t=r.get(e)|t,r.set(e,t)}_clearStateFlags(e,t){const r=this._view.state;t=r.get(e)&~t,r.set(e,t)}_setStateFlag(e,t,r){r?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max(de,Math.floor(this._capacity*Z.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new re(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,D.Cg)([(0,X.MZ)({constructOnly:!0})],ie.prototype,"shaderTransformation",void 0),(0,D.Cg)([(0,X.MZ)()],ie.prototype,"_size",void 0),(0,D.Cg)([(0,X.MZ)({readOnly:!0})],ie.prototype,"size",null),ie=(0,D.Cg)([(0,H.$)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],ie);const ne=(0,B.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function oe(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,j.E)()&&e.vec4u8("instanceOlidColor"),e}const ae=(0,n.vt)(),se=(0,K.vt)(),le=(0,ee.vt)(),ce=(0,ee.vt)(),de=64,ue=(0,B.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var he=r(74810),pe=r(28491),me=r(90644),fe=r(85079),ge=r(49788);class ve extends G.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=he.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrength=0,this.emissiveSource=1,this.emissiveBaseColor=n.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,n.CN)(.2,.2,.2),this.diffuse=(0,n.CN)(.8,.8,.8),this.externalColor=(0,L.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,n.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=ge.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}G.gy;let _e=class extends V.w{constructor(e,t){const i=[(0,z.U)(ye(t))];t.instanced&&t.instancedDoublePrecision&&i.push((0,z.U)(function(e){return oe(ue.clone(),e)}(t))),super(e,t,(0,fe._u)(i)),this.shader=new U.r(pe.D,()=>r.e(5141).then(r.bind(r,5141)))}_makePipeline(e,t){const{oitPass:r,output:i,transparent:n,cullFace:a,customDepthTest:s,hasOccludees:c}=e;return(0,me.Ey)({blending:(0,o.RN)(i)&&n?(0,l.Yf)(r):null,culling:we(e)?(0,me.Xt)(a):null,depthTest:{func:(0,l.K_)(r,xe(s))},depthWrite:(0,l.z5)(e),drawBuffers:(0,V.L)(i,(0,l.m6)(r,i)),colorWrite:me.kn,stencilWrite:c?W:null,stencilTest:c?t?$:k:null,polygonOffset:(0,l.mE)(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};function xe(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function we(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function ye(e){const t=(0,B.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color"),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,j.E)()&&t.vec4u8("olidColor"),t}_e=(0,D.Cg)([(0,H.$)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],_e);var be=r(51976),Me=r(35256);class Te extends Me.E{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.occlusionPass=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}(0,D.Cg)([(0,be.W)({count:4})],Te.prototype,"alphaDiscardMode",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"doubleSidedMode",void 0),(0,D.Cg)([(0,be.W)({count:7})],Te.prototype,"pbrMode",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"cullFace",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"normalType",void 0),(0,D.Cg)([(0,be.W)({count:3})],Te.prototype,"customDepthTest",void 0),(0,D.Cg)([(0,be.W)({count:8})],Te.prototype,"emissionSource",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVertexColors",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasSymbolColors",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVerticalOffset",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasColorTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasMetallicRoughnessTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasOcclusionTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasNormalTexture",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasScreenSizePerspective",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVertexTangents",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasOccludees",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instanced",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instancedDoublePrecision",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasModelTransformation",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"offsetBackfaces",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVVSize",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasVVColor",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"receiveShadows",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"receiveAmbientOcclusion",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"textureAlphaPremultiplied",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instancedFeatureAttribute",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"instancedColor",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"writeDepth",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"transparent",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"enableOffset",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"terrainDepthTest",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"cullAboveTerrain",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"snowCover",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasColorTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasEmissionTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasNormalTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasOcclusionTextureTransform",void 0),(0,D.Cg)([(0,be.W)()],Te.prototype,"hasMetallicRoughnessTextureTransform",void 0);var Ce=r(57323);let Se=class extends _e{constructor(){super(...arguments),this.shader=new U.r(Ce.R,()=>r.e(2314).then(r.bind(r,39933)))}};Se=(0,D.Cg)([(0,H.$)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],Se);class Ee extends s.i{constructor(e,t){super(e,Re),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>((0,o.iq)(e)||(0,o.Bf)(e))&&!this.transparent],[4,e=>((0,o.iq)(e)||(0,o.Bf)(e))&&this.transparent&&this.parameters.writeDepth],[8,e=>((0,o.iq)(e)||(0,o.Bf)(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=ye(this.parameters),this._configuration=new Te(t.spherical)}isVisibleForOutput(e){return 4!==e&&6!==e&&5!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(i[3])?1:i[3])>=ge.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,i.q)(this.parameters.emissiveBaseColor,n.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,t){const{parameters:r,_configuration:i}=this,{treeRendering:n,doubleSided:a,doubleSidedType:s}=r;return super.getConfiguration(e,t,this._configuration),i.hasNormalTexture=r.hasNormalTexture,i.hasColorTexture=r.hasColorTexture,i.hasMetallicRoughnessTexture=r.hasMetallicRoughnessTexture,i.hasOcclusionTexture=r.hasOcclusionTexture,i.hasVertexTangents=!n&&r.hasVertexTangents,i.instanced=r.instanced,i.instancedDoublePrecision=r.instancedDoublePrecision,i.hasVVColor=!!r.vvColor,i.hasVVSize=!!r.vvSize,i.hasVerticalOffset=null!=r.verticalOffset,i.hasScreenSizePerspective=null!=r.screenSizePerspective,i.hasSlicePlane=r.hasSlicePlane,i.alphaDiscardMode=r.textureAlphaMode,i.normalType=n?0:r.normalType,i.transparent=this.transparent,i.writeDepth=r.writeDepth,i.customDepthTest=r.customDepthTest??0,i.hasOccludees=t.hasOccludees,i.cullFace=r.hasSlicePlane?0:r.cullFace,i.cullAboveTerrain=t.cullAboveTerrain,i.hasModelTransformation=!n&&null!=r.modelTransformation,i.hasVertexColors=r.hasVertexColors,i.hasSymbolColors=r.hasSymbolColors,i.doubleSidedMode=n?2:a&&"normal"===s?1:a&&"winding-order"===s?2:0,i.instancedFeatureAttribute=r.instancedFeatureAttribute,i.instancedColor=r.instancedColor,(0,o.RN)(e)?(i.terrainDepthTest=t.terrainDepthTest,i.receiveShadows=r.receiveShadows,i.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(i.terrainDepthTest=!1,i.receiveShadows=i.receiveAmbientOcclusion=!1),i.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,i.pbrMode=r.usePBR?r.isSchematic?2:1:0,i.emissionSource=r.emissionSource,i.offsetBackfaces=!(!this.transparent||!r.offsetTransparentBackfaces),i.oitPass=t.oitPass,i.enableOffset=t.camera.relativeElevation<l.xt,i.snowCover=t.snowCover>0,i.hasColorTextureTransform=!!r.colorTextureTransformMatrix,i.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,i.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,i.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,i.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,i}intersect(e,t,r,n,o,a){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,i.j)(He,t[12],t[13],t[14]);let a=null;switch(r.viewingMode){case 1:a=(0,i.n)(De,He);break;case 2:a=(0,i.d)(De,Pe)}let s=0;const l=(0,i.e)(Le,He,e.eye),c=(0,i.b)(l),d=(0,i.h)(l,l,1/c);let u=null;this.parameters.screenSizePerspective&&(u=(0,i.f)(a,d)),s+=(0,P.kE)(e,c,this.parameters.verticalOffset,u??0,this.parameters.screenSizePerspective,null),(0,i.h)(a,a,s),(0,i.o)(Ne,a,r.transform.inverseRotation),n=(0,i.e)(Fe,n,Ne),o=(0,i.e)(Oe,o,Ne)}!function(e,t,r,n,o,a){if(!e.visible)return;const s=(0,i.a)(S,n,r),l=(e,t,r)=>a(e,r,t),{tolerance:c}=t,h=new u(c,!1,t.options.normalRequired);if(e.boundingInfo)(0,d.vA)(0===e.type),m(e.boundingInfo,r,s,c,o,h,l);else{const t=e.positionAttribute,n=t.indices;!function(e,t,r,n,o,a,s,l,c,d){const u=t,h=E,p=Math.abs(u[0]),m=Math.abs(u[1]),f=Math.abs(u[2]),g=p>=m?p>=f?0:2:m>=f?1:2,w=g,b=u[w]<0?2:1,M=(g+b)%3,T=(g+(3-b))%3,C=u[M]/u[w],S=u[T]/u[w],A=1/u[w],R=v,I=_,F=x,{normalRequired:O}=c;for(let t=r;t<n;++t){const r=3*t,n=s*o[r];(0,i.j)(h[0],a[n+0],a[n+1],a[n+2]);const c=s*o[r+1];(0,i.j)(h[1],a[c+0],a[c+1],a[c+2]);const u=s*o[r+2];(0,i.j)(h[2],a[u+0],a[u+1],a[u+2]),l&&((0,i.d)(h[0],l.applyToVertex(h[0][0],h[0][1],h[0][2],t)),(0,i.d)(h[1],l.applyToVertex(h[1][0],h[1][1],h[1][2],t)),(0,i.d)(h[2],l.applyToVertex(h[2][0],h[2][1],h[2][2],t))),(0,i.a)(R,h[0],e),(0,i.a)(I,h[1],e),(0,i.a)(F,h[2],e);const p=R[M]-C*R[w],m=R[T]-S*R[w],f=I[M]-C*I[w],g=I[T]-S*I[w],v=F[M]-C*F[w],_=F[T]-S*F[w],x=v*g-_*f,b=p*_-m*v,E=f*m-g*p;if((x<0||b<0||E<0)&&(x>0||b>0||E>0))continue;const P=x+b+E;if(0===P)continue;const D=x*(A*R[w])+b*(A*I[w])+E*(A*F[w]);if(D*Math.sign(P)<0)continue;const N=D/P;N>=0&&d(N,t,O?y(h):null)}}(r,s,0,n.length/3,n,t.data,t.stride,o,h,l)}}(e,r,n,o,(0,A.ou)(r.verticalOffset),a)}createGLMaterial(e){return new Ae(e)}createBufferWriter(){return new F(this._layout)}get transparent(){return Ie(this.parameters)}}class Ae extends a.m8{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,i.j)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?Se:_e,e)}}class Re extends ve{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:this.usePBR?0===this.emissiveSource?2:1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function Ie(e){const{drivenOpacity:t,opacity:r,externalColor:i,layerOpacity:n,texture:o,textureId:a,textureAlphaMode:s,colorMixMode:l}=e,c=i[3];return t||r<1&&"replace"!==l||c<1&&"ignore"!==l||n<1||(null!=o||null!=a)&&1!==s&&2!==s&&"replace"!==l}const Fe=(0,n.vt)(),Oe=(0,n.vt)(),Pe=(0,n.fA)(0,0,1),De=(0,n.vt)(),Ne=(0,n.vt)(),He=(0,n.vt)(),Le=(0,n.vt)()},4431:(e,t,r)=>{r.d(t,{U:()=>o}),r(44208);var i=r(63907),n=r(74038);function o(e,t=0){const r=e.stride;return Array.from(e.fields.keys()).map(o=>{const a=e.fields.get(o),s=a.constructor.ElementCount,l=function(e){switch(e){case"u8":return i.pe.UNSIGNED_BYTE;case"u16":return i.pe.UNSIGNED_SHORT;case"u32":return i.pe.UNSIGNED_INT;case"i8":return i.pe.BYTE;case"i16":return i.pe.SHORT;case"i32":return i.pe.INT;case"f16":return i.pe.HALF_FLOAT;case"f32":return i.pe.FLOAT;default:throw new Error("BufferType not supported in WebGL")}}(a.constructor.ElementType),c=a.offset,d=a.optional?.glNormalized??!1;return new n._(o,s,l,c,r,d,t)})}},6867:(e,t,r)=>{r.d(t,{i:()=>d});var i=r(58083),n=r(9093),o=r(38954),a=r(51850),s=r(87317),l=r(91829),c=r(71351);class d{get ray(){return this._ray}get distanceInRenderSpace(){return null==this.distance?null:((0,o.h)(h,this.ray.direction,this.distance),(0,o.b)(h))}withinDistance(e){return!!u(this)&&this.distanceInRenderSpace<=e}getIntersectionPoint(e){return!!u(this)&&((0,o.h)(h,this.ray.direction,this.distance),(0,o.g)(e,this.ray.origin,h),!0)}getTransformedNormal(e){return(0,o.d)(p,this.normal),p[3]=0,(0,s.t)(p,p,this.transformation),(0,o.d)(e,p),(0,o.n)(e,e)}constructor(e){this.intersector=4,this.normal=(0,a.vt)(),this.transformation=(0,n.vt)(),this._ray=(0,c.vt)(),this.init(e)}init(e){this.distance=this.target=this.drapedLayerOrder=this.renderPriority=null,this.intersector=4,(0,c.C)(e,this._ray)}set(e,t,r,s,l,c,d){this.intersector=e,this.distance=r,(0,o.d)(this.normal,s??a.Cb),(0,i.C)(this.transformation,l??n.zK),this.target=t,this.drapedLayerOrder=c,this.renderPriority=d}copy(e){(0,c.C)(e.ray,this._ray),this.intersector=e.intersector,this.distance=e.distance,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.renderPriority=e.renderPriority,(0,o.d)(this.normal,e.normal),(0,i.C)(this.transformation,e.transformation)}}function u(e){return null!=e?.distance}const h=(0,a.vt)(),p=(0,l.vt)()},10906:(e,t,r)=>{r.d(t,{b:()=>o});var i=r(33094),n=r(31821);function o(e,t){t.snowCover&&(e.uniforms.add(new i.U("snowCover",e=>e.snowCover)).code.add(n.H`float getSnow(vec3 normal, vec3 groundNormal) {
2
2
  return smoothstep(0.5, 0.55, dot(normal, groundNormal)) * snowCover;
3
3
  }
4
4
  float getRealisticTreeSnow(vec3 faceNormal, vec3 shadingNormal, vec3 groundNormal) {
@@ -311,7 +311,7 @@ posClip.z += 0.0000003 * posClip.w;
311
311
  return posClip;
312
312
  }`)}},32976:(e,t,r)=>{r.d(t,{o:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"bool",0,(r,i)=>r.setUniform1b(e,t(i)))}}},33094:(e,t,r)=>{r.d(t,{U:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",0,(i,n)=>i.setUniform1f(e,t(n),r))}}},33120:(e,t,r)=>{r.d(t,{i$:()=>a,xJ:()=>o}),r(46686),r(33752);var i=r(77108),n=r(31821);function o(e){e.vertex.uniforms.add(new i.E("nearFar",e=>e.camera.nearFar))}function a(e){e.vertex.code.add(n.H`float calculateLinearDepth(vec2 nearFar,float z) {
313
313
  return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]);
314
- }`)}},33524:(e,t,r)=>{r.d(t,{K_:()=>h,Yf:()=>s,m6:()=>p,mE:()=>u,xt:()=>c,z5:()=>l});var i=r(49255),n=r(63907),o=r(90644);const a=(0,o.p3)(1,0,1,771);function s(e,t=!1){switch(e){case 0:return t?o.RC:o.T8;case 1:return a;case 2:case 3:return null}}function l(e){if(e.draped)return null;switch(e.oitPass){case 0:case 2:return e.writeDepth?o.Uy:null;case 1:case 3:return null}}const c=5e5,d={factor:-1,units:-2};function u({oitPass:e,enableOffset:t}){return t&&1===e?d:null}function h(e,t=513){return 0===e||2===e?t:515}function p(e,t){const r=(0,i.LG)(t);return 1===e?r?{buffers:[n.r6,n.yI,n.Fq]}:{buffers:[n.r6,n.yI]}:r?{buffers:[n.r6,n.yI]}:null}},33752:(e,t,r)=>{r.d(t,{EM:()=>l,dO:()=>s});var i=r(29242),n=r(9093),o=r(51850),a=(r(26425),r(40710),r(33079),r(31821),r(98353),r(35644),r(40095),r(65786));class s extends a.Y{constructor(){super(...arguments),this.transformWorldFromViewTH=(0,o.vt)(),this.transformWorldFromViewTL=(0,o.vt)(),this.transformViewFromCameraRelativeRS=(0,i.vt)(),this.transformProjFromView=(0,n.vt)()}}class l extends a.Y{constructor(){super(...arguments),this.transformWorldFromModelRS=(0,i.vt)(),this.transformWorldFromModelTH=(0,o.vt)(),this.transformWorldFromModelTL=(0,o.vt)()}}},34845:(e,t,r)=>{r.d(t,{Ir:()=>d});var i=r(37585),n=r(48163),o=r(87317),a=r(91829),s=r(77108),l=r(14314),c=r(31821);function d(e){e.fragment.uniforms.add(new l.I("projInfo",e=>function(e){const t=e.projectionMatrix;return 0===t[11]?(0,o.s)(u,2/(e.fullWidth*t[0]),2/(e.fullHeight*t[5]),(1+t[12])/t[0],(1+t[13])/t[5]):(0,o.s)(u,-2/(e.fullWidth*t[0]),-2/(e.fullHeight*t[5]),(1-t[8])/t[0],(1-t[9])/t[5])}(e.camera))),e.fragment.uniforms.add(new s.E("zScale",e=>0===e.camera.projectionMatrix[11]?(0,i.hZ)(h,0,1):(0,i.hZ)(h,1,0))),e.fragment.code.add(c.H`vec3 reconstructPosition(vec2 fragCoord, float depth) {
314
+ }`)}},33524:(e,t,r)=>{r.d(t,{K_:()=>h,Yf:()=>s,m6:()=>p,mE:()=>u,xt:()=>d,z5:()=>l});var i=r(49255),n=r(63907),o=r(90644);const a=(0,o.p3)(1,0,1,771);function s(e,t=!1){switch(e){case 0:return t?o.RC:o.T8;case 1:return a;case 2:case 3:return null}}function l(e){if(e.draped)return null;switch(e.oitPass){case 0:case 2:return e.writeDepth?o.Uy:null;case 1:case 3:return null}}const c={factor:-1,units:-2},d=5e5;function u({oitPass:e,enableOffset:t}){return t&&1===e?c:null}function h(e,t=513){return 0===e||2===e?t:515}function p(e,t){const r=(0,i.LG)(t);return 1===e?r?{buffers:[n.r6,n.yI,n.Fq]}:{buffers:[n.r6,n.yI]}:r?{buffers:[n.r6,n.yI]}:null}},33752:(e,t,r)=>{r.d(t,{EM:()=>l,dO:()=>s});var i=r(29242),n=r(9093),o=r(51850),a=(r(26425),r(40710),r(33079),r(31821),r(98353),r(35644),r(40095),r(65786));class s extends a.Y{constructor(){super(...arguments),this.transformWorldFromViewTH=(0,o.vt)(),this.transformWorldFromViewTL=(0,o.vt)(),this.transformViewFromCameraRelativeRS=(0,i.vt)(),this.transformProjFromView=(0,n.vt)()}}class l extends a.Y{constructor(){super(...arguments),this.transformWorldFromModelRS=(0,i.vt)(),this.transformWorldFromModelTH=(0,o.vt)(),this.transformWorldFromModelTL=(0,o.vt)()}}},34845:(e,t,r)=>{r.d(t,{Ir:()=>d});var i=r(37585),n=r(48163),o=r(87317),a=r(91829),s=r(77108),l=r(14314),c=r(31821);function d(e){e.fragment.uniforms.add(new l.I("projInfo",e=>function(e){const t=e.projectionMatrix;return 0===t[11]?(0,o.s)(u,2/(e.fullWidth*t[0]),2/(e.fullHeight*t[5]),(1+t[12])/t[0],(1+t[13])/t[5]):(0,o.s)(u,-2/(e.fullWidth*t[0]),-2/(e.fullHeight*t[5]),(1-t[8])/t[0],(1-t[9])/t[5])}(e.camera))),e.fragment.uniforms.add(new s.E("zScale",e=>0===e.camera.projectionMatrix[11]?(0,i.hZ)(h,0,1):(0,i.hZ)(h,1,0))),e.fragment.code.add(c.H`vec3 reconstructPosition(vec2 fragCoord, float depth) {
315
315
  return vec3((fragCoord * projInfo.xy + projInfo.zw) * (zScale.x * depth + zScale.y), depth);
316
316
  }`)}const u=(0,a.vt)(),h=(0,n.vt)()},35256:(e,t,r)=>{r.d(t,{E:()=>a});var i=r(31635),n=r(51976);class o extends n.K{constructor(){super(...arguments),this.instancedDoublePrecision=!1,this.hasModelTransformation=!1}}class a extends o{constructor(){super(...arguments),this.output=0,this.oitPass=0,this.hasSlicePlane=!1,this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0}}(0,i.Cg)([(0,n.W)({count:11})],a.prototype,"output",void 0),(0,i.Cg)([(0,n.W)({count:3})],a.prototype,"oitPass",void 0),(0,i.Cg)([(0,n.W)()],a.prototype,"hasSlicePlane",void 0),(0,i.Cg)([(0,n.W)()],a.prototype,"hasHighlightMixTexture",void 0)},35640:(e,t,r)=>{r.d(t,{Ge:()=>c,VQ:()=>u});var i=r(87317),n=r(91829),o=r(52587),a=r(25178),s=r(71988),l=r(31821);function c(e,t){const r=e.vertex;t.hasVerticalOffset?(u(r),t.hasScreenSizePerspective&&(e.include(o.Y6),(0,o.OH)(r),(0,a.yu)(e.vertex,t)),r.code.add(l.H`
317
317
  vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
@@ -516,7 +516,7 @@ return MaskedColor(masked1 * masked2, bvec4(ivec4(color1.mask) & ivec4(color2.ma
516
516
  return MaskedColor(color, isnan(color));
517
517
  }`)}},43616:(e,t,r)=>{r.d(t,{MB:()=>l,Um:()=>c,kE:()=>a});var i=r(4576),n=r(34727),o=r(77194);function a(e,t,r,i,o,a){let s=r.screenLength*e.pixelRatio;null!=o&&(d.update(i,t,o,a),s=d.apply(s));const l=s*Math.tan(.5*e.fovY)/(.5*e.fullHeight);return(0,n.qE)(l*t,r.minWorldLength,r.maxWorldLength)}const s=(0,i.VO)();function l(e,t){let r=!1;for(const i in t){const n=t[i];void 0!==n&&(Array.isArray(n)?Array.isArray(e[i])&&s(n,e[i])||(e[i]=n.slice(),r=!0):e[i]!==n&&(r=!0,e[i]=n))}return r}const c={multiply:1,ignore:2,replace:3,tint:4},d=new o.PS},46686:(e,t,r)=>{r.d(t,{o:()=>n});var i=r(31821);function n(e,t){t&&e.varyings.add("linearDepth","float",{invariant:!0}),e.vertex.code.add(i.H`
518
518
  void forwardLinearDepth(float _linearDepth) { ${(0,i.If)(t,"linearDepth = _linearDepth;")} }
519
- `)}},47286:(e,t,r)=>{r.d(t,{G:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",1,(i,n,o)=>i.setUniform2fv(e,t(n,o),r))}}},48833:(e,t,r)=>{r.d(t,{g:()=>B}),r(44208);var i=r(49186),n=r(65529),o=r(97768),a=r(74887),s=r(34275),l=r(24326),c=r(84952),d=r(38969),u=r(31217),h=r(95117),p=r(2741);let m;var f=r(63907),g=r(76284),v=r(42293);let _=null,x=null;async function w(){return null==x&&(m??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,p.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),x=m,_=await x),x}function y(e,t){if(null==_)return e.byteLength;const r=new _.BasisFile(new Uint8Array(e)),i=T(r)?M(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}function b(e,t){if(null==_)return e.byteLength;const r=new _.KTX2File(new Uint8Array(e)),i=C(r)?M(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}function M(e,t,r,i,n){const o=(0,v.MW)(t?f.CQ.COMPRESSED_RGBA8_ETC2_EAC:f.CQ.COMPRESSED_RGB8_ETC2),a=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*a)}function T(e){return e.getNumImages()>=1&&!e.isUASTC()}function C(e){return e.getFaces()>=1&&e.isETC1S()}function S(e,t,r,i,n,o,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[1,f.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[0,f.CQ.COMPRESSED_RGB8_ETC2]:c?i?[3,f.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,f.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=t.hasMipmap?r:Math.min(1,r),p=[];for(let e=0;e<h;e++)p.push(new Uint8Array(a(e,d))),s(e,d,p[e]);return t.internalFormat=u,t.hasMipmap=p.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=n,t.height=o,new g.g(e,t,{type:"compressed",levels:p})}var E=r(53966);const A=()=>E.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function R(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const I=R("DXT1"),F=R("DXT3"),O=R("DXT5");function P(e,t){const r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return A().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return A().error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case I:n=8,o=f.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case F:n=16,o=f.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case O:n=16,o=f.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return A().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let a=1,s=r[4],l=r[3];(3&s||3&l)&&(A().warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7]));let p=e.byteOffset+r[1]+4;const m=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*n,u=new Uint8Array(e.buffer,p,h),m.push(u),p+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:m},internalFormat:o,width:c,height:d}}function D(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function N(e,t){const[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){const n=Math.max(e,t),o=e*t;if(n<=i&&o<=r)return[e,t];const a=Math.min(Math.sqrt(r/o),i/n);return[D(Math.round(e*a),i),D(Math.round(t*a),i)]}(e,t);return e.width===r&&e.height===i?e:H(e,r,i)}function H(e,t,r){if(e instanceof ImageData)return H(function(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const 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);const n=document.createElement("canvas");return n.width=t,n.height=r,n.getContext("2d").drawImage(e,0,0,n.width,n.height),n}var L=r(620),z=r(67171);class B{constructor(e,t){this._data=e,this.id=(0,l.c)(),this.events=new n.bk,this._parameters={...U,...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,c.w8)(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];(0,d.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){(0,c.DB)(e.src)||(0,c.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new z.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}get glTexture(){return this._glTexture??this._emptyTexture}get loaded(){return null!=this._glTexture}get usedMemory(){return this._glTexture?.usedMemory||function(e,t){if(null==e)return 0;if((0,s.mw)(e)||(0,s.mg)(e))return"image/ktx2"===t.encoding?b(e,!!t.mipmap):"image/x.basis"===t.encoding?y(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?G(e):t,n=t.pixelFormat??6408,o=(0,v.wH)(n);return(t.mipmap?4/3:1)*r*i*o||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._glTexture)return this._glTexture;const t=this._data;return null==t?(this._glTexture=new g.g(e,this._createDescriptor(e),null),this._glTexture):(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,s.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,s.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):((0,s.mw)(t)||(0,s.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,s.mw)(t)||(0,s.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,s.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,s.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._glTexture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._glTexture.setData(e),this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const i=P(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:o,width:a,height:s}=i;return t.samplingMode=n.levels.length>1?9987:9729,t.hasMipmap=n.levels.length>1,t.internalFormat=o,t.width=a,t.height=s,new g.g(e,t,n)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._glTexture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r){null==_&&(_=await w());const i=new _.KTX2File(new Uint8Array(r));if(!C(i))return null;i.startTranscoding();const n=S(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),(e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){null==_&&(_=await w());const i=new _.BasisFile(new Uint8Array(r));if(!T(i))return null;i.startTranscoding();const n=S(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(),n}(e,this._createDescriptor(e),t).then(e=>(this._glTexture=e,e)))}_loadFromPixelData(e,t){(0,L.vA)(this._parameters.width>0&&this._parameters.height>0);const 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._glTexture=new g.g(e,r,t),this._glTexture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await(0,u.D)(t,{signal:r});return(0,a.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await(0,h.y)(t,t.src,!1,r);return(0,a.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((n,s)=>{const l=()=>{t.removeEventListener("loadeddata",c),t.removeEventListener("error",d),(0,o.xt)(u)},c=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),n(this._loadFromImage(e,t)))},d=e=>{l(),s(e||new i.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",c),t.addEventListener("error",d);const u=(0,a.u7)(r,()=>d((0,a.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=N(r,e.parameters));const i=G(r);this._parameters.width=i.width,this._parameters.height=i.height;const n=this._createDescriptor(e);return n.width=i.width,n.height=i.height,n.compress=this._parameters.compressionOptions,this._glTexture=new g.g(e,n,r),this._emptyTexture=null,this.events.emit("loaded"),this._glTexture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const 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._glTexture=(0,o.WD)(this._glTexture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function G(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const U={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1}},49718:(e,t,r)=>{r(51850),r(6867).i},49788:(e,t,r)=>{r.d(t,{Q:()=>i});const i=1/255.5},51406:(e,t,r)=>{r.d(t,{MU:()=>l,O1:()=>c,QM:()=>d,Sx:()=>s,q2:()=>a});var i=r(29242),n=r(31821),o=r(35644);function a(e,t){t.hasColorTextureTransform?(e.varyings.add("colorUV","vec2"),e.vertex.uniforms.add(new o.k("colorTextureTransformMatrix",e=>e.colorTextureTransformMatrix??i.zK)).code.add(n.H`void forwardColorUV(){
519
+ `)}},46859:(e,t,r)=>{r.d(t,{h:()=>B}),r(44208);var i=r(49186),n=r(65529),o=r(97768),a=r(74887),s=r(34275),l=r(24326),c=r(84952),d=r(38969),u=r(31217),h=r(95117),p=r(2741);let m;var f=r(63907),g=r(76284),v=r(42293);let _=null,x=null;async function w(){return null==x&&(m??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,p.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),x=m,_=await x),x}function y(e,t){if(null==_)return e.byteLength;const r=new _.BasisFile(new Uint8Array(e)),i=T(r)?M(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}function b(e,t){if(null==_)return e.byteLength;const r=new _.KTX2File(new Uint8Array(e)),i=C(r)?M(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}function M(e,t,r,i,n){const o=(0,v.MW)(t?f.CQ.COMPRESSED_RGBA8_ETC2_EAC:f.CQ.COMPRESSED_RGB8_ETC2),a=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*a)}function T(e){return e.getNumImages()>=1&&!e.isUASTC()}function C(e){return e.getFaces()>=1&&e.isETC1S()}function S(e,t,r,i,n,o,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[d,u]=l?i?[1,f.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[0,f.CQ.COMPRESSED_RGB8_ETC2]:c?i?[3,f.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,f.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=t.hasMipmap?r:Math.min(1,r),p=[];for(let e=0;e<h;e++)p.push(new Uint8Array(a(e,d))),s(e,d,p[e]);return t.internalFormat=u,t.hasMipmap=p.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=n,t.height=o,new g.g(e,t,{type:"compressed",levels:p})}var E=r(53966);const A=()=>E.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function R(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const I=R("DXT1"),F=R("DXT3"),O=R("DXT5");function P(e,t){const r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return A().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return A().error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case I:n=8,o=f.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case F:n=16,o=f.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case O:n=16,o=f.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return A().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let a=1,s=r[4],l=r[3];(3&s||3&l)&&(A().warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,d=l;let u,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7]));let p=e.byteOffset+r[1]+4;const m=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*n,u=new Uint8Array(e.buffer,p,h),m.push(u),p+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:m},internalFormat:o,width:c,height:d}}function D(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function N(e,t){const[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){const n=Math.max(e,t),o=e*t;if(n<=i&&o<=r)return[e,t];const a=Math.min(Math.sqrt(r/o),i/n);return[D(Math.round(e*a),i),D(Math.round(t*a),i)]}(e,t);return e.width===r&&e.height===i?e:H(e,r,i)}function H(e,t,r){if(e instanceof ImageData)return H(function(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const 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);const n=document.createElement("canvas");return n.width=t,n.height=r,n.getContext("2d").drawImage(e,0,0,n.width,n.height),n}var L=r(620),z=r(67171);class B{constructor(e,t){this._data=e,this.id=(0,l.c)(),this.events=new n.bk,this._parameters={...U,...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,c.w8)(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];(0,d.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){(0,c.DB)(e.src)||(0,c.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new z.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}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||function(e,t){if(null==e)return 0;if((0,s.mw)(e)||(0,s.mg)(e))return"image/ktx2"===t.encoding?b(e,!!t.mipmap):"image/x.basis"===t.encoding?y(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?G(e):t,n=t.pixelFormat??6408,o=(0,v.wH)(n);return(t.mipmap?4/3:1)*r*i*o||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const t=this._data;return null==t?(this._texture=new g.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,s.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,s.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):((0,s.mw)(t)||(0,s.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,s.mw)(t)||(0,s.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,s.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,s.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._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){const i=P(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:o,width:a,height:s}=i;return t.samplingMode=n.levels.length>1?9987:9729,t.hasMipmap=n.levels.length>1,t.internalFormat=o,t.width=a,t.height=s,new g.g(e,t,n)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r){null==_&&(_=await w());const i=new _.KTX2File(new Uint8Array(r));if(!C(i))return null;i.startTranscoding();const n=S(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),(e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){null==_&&(_=await w());const i=new _.BasisFile(new Uint8Array(r));if(!T(i))return null;i.startTranscoding();const n=S(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(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,L.vA)(this._parameters.width>0&&this._parameters.height>0);const 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 g.g(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await(0,u.D)(t,{signal:r});return(0,a.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await(0,h.y)(t,t.src,!1,r);return(0,a.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((n,s)=>{const l=()=>{t.removeEventListener("loadeddata",c),t.removeEventListener("error",d),(0,o.xt)(u)},c=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(l(),n(this._loadFromImage(e,t)))},d=e=>{l(),s(e||new i.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",c),t.addEventListener("error",d);const u=(0,a.u7)(r,()=>d((0,a.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=N(r,e.parameters));const i=G(r);this._parameters.width=i.width,this._parameters.height=i.height;const n=this._createDescriptor(e);return n.width=i.width,n.height=i.height,n.compress=this._parameters.compressionOptions,this._texture=new g.g(e,n,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const 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,o.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function G(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const U={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1}},47286:(e,t,r)=>{r.d(t,{G:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",1,(i,n,o)=>i.setUniform2fv(e,t(n,o),r))}}},49718:(e,t,r)=>{r(51850),r(6867).i},49788:(e,t,r)=>{r.d(t,{Q:()=>i});const i=1/255.5},51406:(e,t,r)=>{r.d(t,{MU:()=>l,O1:()=>c,QM:()=>d,Sx:()=>s,q2:()=>a});var i=r(29242),n=r(31821),o=r(35644);function a(e,t){t.hasColorTextureTransform?(e.varyings.add("colorUV","vec2"),e.vertex.uniforms.add(new o.k("colorTextureTransformMatrix",e=>e.colorTextureTransformMatrix??i.zK)).code.add(n.H`void forwardColorUV(){
520
520
  colorUV = (colorTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
521
521
  }`)):e.vertex.code.add(n.H`void forwardColorUV(){}`)}function s(e,t){t.hasNormalTextureTransform&&0!==t.textureCoordinateType?(e.varyings.add("normalUV","vec2"),e.vertex.uniforms.add(new o.k("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix??i.zK)).code.add(n.H`void forwardNormalUV(){
522
522
  normalUV = (normalTextureTransformMatrix * vec3(vuv0, 1.0)).xy;
@@ -726,7 +726,7 @@ return color;
726
726
  `)}},71988:(e,t,r)=>{r.d(t,{E:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",1,(i,n,o)=>i.setUniform4fv(e,t(n,o),r))}}},72824:(e,t,r)=>{r.d(t,{Mh:()=>u,Zo:()=>h,gy:()=>p});var i=r(21818),n=r(29242),o=r(91829),a=r(96336),s=r(33752),l=r(31821),c=r(98353),d=r(35644);function u(e,t){switch(t.normalType){case 0:case 1:e.include(a.Y,t),e.varyings.add("vNormalWorld","vec3"),e.varyings.add("vNormalView","vec3"),e.vertex.uniforms.add(new c.h("transformNormalGlobalFromModel",e=>e.transformNormalGlobalFromModel),new d.k("transformNormalViewFromGlobal",e=>e.transformNormalViewFromGlobal)).code.add(l.H`void forwardNormal() {
727
727
  vNormalWorld = transformNormalGlobalFromModel * normalModel();
728
728
  vNormalView = transformNormalViewFromGlobal * vNormalWorld;
729
- }`);break;case 2:e.vertex.code.add(l.H`void forwardNormal() {}`);break;default:(0,i.Xb)(t.normalType);case 3:}}class h extends s.dO{constructor(){super(...arguments),this.transformNormalViewFromGlobal=(0,n.vt)()}}class p extends s.EM{constructor(){super(...arguments),this.transformNormalGlobalFromModel=(0,n.vt)(),this.toMapSpace=(0,o.vt)()}}},74038:(e,t,r)=>{r.d(t,{_:()=>i});class i{constructor(e,t,r,i,n,o=!1,a=0){this.name=e,this.count=t,this.type=r,this.offset=i,this.stride=n,this.normalized=o,this.divisor=a}}},74810:(e,t,r)=>{r.d(t,{Bt:()=>s,Jr:()=>o,SY:()=>l,mb:()=>a});var i=r(38954),n=r(51850);function o({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:o,emissiveTexture:a,emissiveFactor:s,occlusionTexture:l}){return null==e&&null==t&&null==a&&(null==s||(0,i.q)(s,n.uY))&&null==l&&(null==o||1===o)&&(null==r||1===r)}const a=(0,n.CN)(1,1,.5),s=(0,n.CN)(0,.6,.2),l=(0,n.CN)(0,1,.2)},76284:(e,t,r)=>{r.d(t,{g:()=>T});var i=r(49186),n=r(44208),o=r(53966),a=r(97768),s=r(93637),l=r(74887),c=r(94656),d=r(63907),u=r(67171);const h=()=>o.A.getLogger("esri/views/webgl/textureUtils");function p(e){const{width:t,height:r,depth:i}=e;(null!=t&&t<0||null!=r&&r<0||null!=i&&i<0)&&h().error("Negative dimension parameters are not allowed!");const{internalFormat:n}=e;if(n&&(m(n)||f(n))){const{linearFilterDepth:t,compareEnabled:r,samplingMode:i,hasMipmap:n}=e;n&&h().error("Depth textures cannot have mipmaps"),t?9729!==i&&9728!==i&&h().error("Depth textures cannot sample mipmaps"):(9728!==i&&h().error("Depth textures without filtering must use NEAREST filtering"),r&&h().error("Depth textures without filtering cannot use compare function"))}}function m(e){return(0,s.a4)(d.SB,e)}function f(e){return(0,s.a4)(d.iE,e)}function g(e){return null!=e&&"type"in e&&"compressed"===e.type}function v(e){return null!=e&&!g(e)&&!function(e){return null!=e&&"byteLength"in e}(e)}function _(e){return 32879===e||35866===e}function x(e,t,r,i=1){let n=Math.max(t,r);return 32879===e&&(n=Math.max(n,i)),Math.floor(Math.log2(n))+1}function w(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case d.ld.FLOAT:switch(e.pixelFormat){case 6408:return d.H0.RGBA32F;case 6407:return d.H0.RGB32F;default:throw new i.A("texture:unknown-format","Unable to derive format")}case d.ld.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return d.H0.RGBA8;case 6407:return d.H0.RGB8}}const{pixelFormat:t}=e;return e.internalFormat=34041===t?d.iE.DEPTH24_STENCIL8:6402===t?d.SB.DEPTH_COMPONENT24:t,e.internalFormat}class y extends u.R{constructor(e,t){switch(super(),this.context=e,Object.assign(this,t),this.internalFormat){case d.H0.R16F:case d.H0.R32F:case d.H0.R8_SNORM:case d.H0.R8:this.pixelFormat=6403;break;case d.H0.R8I:case d.H0.R8UI:case d.H0.R16I:case d.H0.R16UI:case d.H0.R32I:case d.H0.R32UI:this.pixelFormat=36244}}static validate(e,t){return new y(e,t)}}const b=!!(0,n.A)("esri-tests-disable-gpu-memory-measurements"),M=()=>o.A.getLogger("esri/views/webgl/Texture");let T=class e{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{const r=y.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 b?0:(0,u.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(d.vt.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,t){const 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(),!g(e)&&this._descriptor.internalFormat&&(0,s.a4)(d.CQ,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!g(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(t,r,n,o,a,s,l=0){s||M().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||M().error("An attempt to update uninitialized texture!");const c=this._descriptor;c.internalFormat=w(c);const{context:d,pixelFormat:u,dataType:h,target:p,isImmutable:m}=c;if(m&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");const f=d.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES,!0);(r<0||n<0||r+o>c.width||n+a>c.height)&&M().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:_}=d;l&&(o&&a||M().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),_.pixelStorei(_.UNPACK_SKIP_ROWS,l)),v(s)?_.texSubImage2D(p,t,r,n,o,a,u,h,s):g(s)?_.compressedTexSubImage2D(p,t,r,n,o,a,c.internalFormat,s.levels[t]):_.texSubImage2D(p,t,r,n,o,a,u,h,s),l&&_.pixelStorei(_.UNPACK_SKIP_ROWS,0),d.bindTexture(f,e.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(t,r,n,o,a,s,l,c){c||M().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||M().error("An attempt to update an uninitialized texture!");const d=this._descriptor;d.internalFormat=w(d);const{context:u,pixelFormat:h,dataType:p,isImmutable:m,target:f}=d;if(m&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");_(f)||M().warn("Attempting to set 3D texture data on a non-3D texture");const v=u.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);u.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),(r<0||n<0||o<0||r+a>d.width||n+s>d.height||o+l>d.depth)&&M().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:x}=u;if(g(c))c=c.levels[t],x.compressedTexSubImage3D(f,t,r,n,o,a,s,l,d.internalFormat,c);else{const e=c;x.texSubImage3D(f,t,r,n,o,a,s,l,h,p,e)}u.bindTexture(v,e.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const t=this._descriptor;if(0===t.width||0===t.height)return;if(!t.hasMipmap){if(this._wasImmutablyAllocated)throw new i.A("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");t.hasMipmap=!0,this._samplingModeDirty=!0,p(t)}9729===t.samplingMode?(this._samplingModeDirty=!0,t.samplingMode=9985):9728===t.samplingMode&&(this._samplingModeDirty=!0,t.samplingMode=9984);const r=this._descriptor.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(t.target),this._descriptor.context.bindTexture(r,e.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const 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,p(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,p(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),p(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=(0,a.DC)(this._compressionAbortController)}_setData(t,r){const n=this._descriptor,o=n.context?.gl;if(!o)return;(0,c.Y2)(o),this.hasWebGLTextureObject||(this._glName=o.createTexture(),n.context.instanceCounter.increment(d.vt.Texture,this)),p(n);const a=n.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);n.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),(0,c.Y2)(o);const l=r??n.target,u=_(l);if(v(t))this._setDataFromTexImageSource(t,l);else{const{width:e,height:r,depth:a}=n;if(null==e||null==r)throw new i.A("texture:missing-size","Width and height must be specified!");if(u&&null==a)throw new i.A("texture:missing-depth","Depth must be specified!");if(n.internalFormat=w(n),n.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(l,n.internalFormat,n.hasMipmap,e,r,a),g(t)){if(!function(e){return null!=e&&(0,s.a4)(d.CQ,e)}(n.internalFormat))throw new i.A("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(t,n.internalFormat,l)}else this._texImage(l,0,n.internalFormat,e,r,a,t),(0,c.Y2)(o),n.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),(0,c.Y2)(o),n.context.bindTexture(a,e.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){const 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?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i?1:0)}_setDataFromTexImageSource(e,t){const{gl:r}=this._descriptor.context,i=this._descriptor;i.internalFormat=w(i);const n=_(t),{width:o,height:a,depth:s}=function(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}}(e);i.width&&i.height,i.width||(i.width=o),i.height||(i.height=a),n&&i.depth,n&&(i.depth=s),i.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,i.internalFormat,i.hasMipmap,o,a,s),this._texImage(t,0,i.internalFormat,o,a,s,e),(0,c.Y2)(r),i.hasMipmap&&(this.generateMipmap(),(0,c.Y2)(r))}_setDataFromCompressedSource(e,t,r){const i=this._descriptor,{width:n,height:o,depth:a}=i,s=e.levels,l=x(r,n,o,a),c=Math.min(l,s.length)-1;this._descriptor.context.gl.texParameteri(i.target,33085,c),this._forEachMipmapLevel((e,i,n,o)=>{const a=s[Math.min(e,s.length-1)];this._compressedTexImage(r,e,t,i,n,o,a)},c)}_texStorage(e,t,r,n,o,a){const{gl:s}=this._descriptor.context;if(!function(e){return d.XN.includes(e)}(t)&&!m(t)&&!f(t))throw new i.A("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const l=r?x(e,n,o,a):1;if(_(e)){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");s.texStorage3D(e,l,t,n,o,a)}else s.texStorage2D(e,l,t,n,o);this._wasImmutablyAllocated=!0}_texImage(e,t,r,n,o,a,s){const l=this._descriptor.context.gl,c=_(e),{isImmutable:d,pixelFormat:u,dataType:h}=this._descriptor;if(d){if(null!=s){const r=s;if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texSubImage3D(e,t,0,0,0,n,o,a,u,h,r)}else l.texSubImage2D(e,t,0,0,n,o,u,h,r)}}else{const d=s;if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texImage3D(e,t,r,n,o,a,0,u,h,d)}else l.texImage2D(e,t,r,n,o,0,u,h,d)}}_compressedTexImage(e,t,r,n,o,a,s){const l=this._descriptor.context.gl,c=_(e);if(this._descriptor.isImmutable){if(null!=s)if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,t,0,0,0,n,o,a,r,s)}else l.compressedTexSubImage2D(e,t,0,0,n,o,r,s)}else if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,t,r,n,o,a,0,s)}else l.compressedTexImage2D(e,t,r,n,o,0,s)}async _compressOnWorker(t){const{width:r,height:i,context:n,flipped:o,preMultiplyAlpha:a,hasMipmap:s}=this._descriptor,c=this._descriptor.compress?.compressionTracker,d=this._descriptor.compress?.compressionCallback,{compressedTextureETC:u,compressedTextureS3TC:h}=n.capabilities;if(!e.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!u&&!h)return;this.abortCompression();const p=new AbortController;let m;this._compressionAbortController=p,c?.increment();try{t instanceof Uint8Array?m=t.buffer:(m=await createImageBitmap(t,{imageOrientation:o?"flipY":"none"}),(0,l.Te)(p));const n={data:m,width:r,height:i,needsFlip:t instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:a,hasMipmap:s,hasETC:!!u,hasS3TC:!!h},c=await e.compressionWorkerHandle.invoke(n,p.signal,1);if((0,l.Te)(p),c.compressedTexture&&this.hasWebGLTextureObject){const e=this.usedMemory;this._descriptor.internalFormat=c.internalFormat,this._setData(c.compressedTexture),d?.(e-this.usedMemory)}}catch(e){(0,l.zf)(e)||M().error("Texture compression failed!")}finally{c?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),m instanceof ImageBitmap&&m.close()}}_forEachMipmapLevel(e,t=1/0){let{width:r,height:n,depth:o,hasMipmap:a,target:s}=this._descriptor;const l=32879===s;if(null==r||null==n||l&&null==o)throw new i.A("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let i=0;e(i,r,n,o),a&&(1!==r||1!==n||l&&1!==o)&&!(i>=t);++i)r=Math.max(1,r>>1),n=Math.max(1,n>>1),l&&(o=Math.max(1,o>>1))}_applySamplingMode(){const e=this._descriptor,t=e.context?.gl;let 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)}_applyWrapMode(){const 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(){const 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,c.Y2)(t)}_applyAnisotropicFilteringParameters(){const e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}},76591:(e,t,r)=>{r.d(t,{HQ:()=>c,rA:()=>d});var i=r(58083),n=r(9093),o=r(38954),a=r(51850),s=r(40710),l=(r(33079),r(31821));function c(e,t){!function(e,t,...r){h(e,t,...r),t.hasSlicePlane?e.code.add("\n void discardBySlice(vec3 pos) {\n if (sliceByPlane(pos)) {\n discard;\n }\n }\n\n vec4 applySliceOutline(vec4 color, vec3 pos) {\n SliceFactors factors = calculateSliceFactors(pos);\n\n factors.front /= 2.0 * fwidth(factors.front);\n factors.side0 /= 2.0 * fwidth(factors.side0);\n factors.side1 /= 2.0 * fwidth(factors.side1);\n factors.side2 /= 2.0 * fwidth(factors.side2);\n factors.side3 /= 2.0 * fwidth(factors.side3);\n\n // return after calling fwidth, to avoid aliasing caused by discontinuities in the input to fwidth\n if (sliceByFactors(factors)) {\n return color;\n }\n\n float outlineFactor = (1.0 - step(0.5, factors.front))\n * (1.0 - step(0.5, factors.side0))\n * (1.0 - step(0.5, factors.side1))\n * (1.0 - step(0.5, factors.side2))\n * (1.0 - step(0.5, factors.side3));\n\n return mix(color, vec4(vec3(0.0), color.a), outlineFactor * 0.3);\n }\n\n vec4 applySlice(vec4 color, vec3 pos) {\n return sliceEnabled() ? applySliceOutline(color, pos) : color;\n }\n "):e.code.add(l.H`void discardBySlice(vec3 pos) { }
729
+ }`);break;case 2:e.vertex.code.add(l.H`void forwardNormal() {}`);break;default:(0,i.Xb)(t.normalType);case 3:}}class h extends s.dO{constructor(){super(...arguments),this.transformNormalViewFromGlobal=(0,n.vt)()}}class p extends s.EM{constructor(){super(...arguments),this.transformNormalGlobalFromModel=(0,n.vt)(),this.toMapSpace=(0,o.vt)()}}},74038:(e,t,r)=>{r.d(t,{_:()=>i});class i{constructor(e,t,r,i,n,o=!1,a=0){this.name=e,this.count=t,this.type=r,this.offset=i,this.stride=n,this.normalized=o,this.divisor=a}}},74810:(e,t,r)=>{r.d(t,{Bt:()=>s,Jr:()=>o,SY:()=>l,mb:()=>a});var i=r(38954),n=r(51850);function o({normalTexture:e,metallicRoughnessTexture:t,metallicFactor:r,roughnessFactor:o,emissiveTexture:a,emissiveFactor:s,occlusionTexture:l}){return null==e&&null==t&&null==a&&(null==s||(0,i.q)(s,n.uY))&&null==l&&(null==o||1===o)&&(null==r||1===r)}const a=(0,n.CN)(1,1,.5),s=(0,n.CN)(0,.6,.2),l=(0,n.CN)(0,1,.2)},76284:(e,t,r)=>{r.d(t,{g:()=>T});var i=r(49186),n=r(44208),o=r(53966),a=r(97768),s=r(93637),l=r(74887),c=r(94656),d=r(63907),u=r(67171);const h=()=>o.A.getLogger("esri/views/webgl/textureUtils");function p(e){const{width:t,height:r,depth:i}=e;(null!=t&&t<0||null!=r&&r<0||null!=i&&i<0)&&h().error("Negative dimension parameters are not allowed!");const{internalFormat:n}=e;if(n&&(m(n)||f(n))){const{linearFilterDepth:t,compareEnabled:r,samplingMode:i,hasMipmap:n}=e;n&&h().error("Depth textures cannot have mipmaps"),t?9729!==i&&9728!==i&&h().error("Depth textures cannot sample mipmaps"):(9728!==i&&h().error("Depth textures without filtering must use NEAREST filtering"),r&&h().error("Depth textures without filtering cannot use compare function"))}}function m(e){return(0,s.a4)(d.SB,e)}function f(e){return(0,s.a4)(d.iE,e)}function g(e){return null!=e&&"type"in e&&"compressed"===e.type}function v(e){return null!=e&&!g(e)&&!function(e){return null!=e&&"byteLength"in e}(e)}function _(e){return 32879===e||35866===e}function x(e,t,r,i=1){let n=Math.max(t,r);return 32879===e&&(n=Math.max(n,i)),Math.floor(Math.log2(n))+1}function w(e){if(null!=e.internalFormat)return e.internalFormat;switch(e.dataType){case d.ld.FLOAT:switch(e.pixelFormat){case 6408:return d.H0.RGBA32F;case 6407:return d.H0.RGB32F;default:throw new i.A("texture:unknown-format","Unable to derive format")}case d.ld.UNSIGNED_BYTE:switch(e.pixelFormat){case 6408:return d.H0.RGBA8;case 6407:return d.H0.RGB8}}const{pixelFormat:t}=e;return e.internalFormat=34041===t?d.iE.DEPTH24_STENCIL8:6402===t?d.SB.DEPTH_COMPONENT24:t,e.internalFormat}class y extends u.R{constructor(e,t){switch(super(),this.context=e,Object.assign(this,t),this.internalFormat){case d.H0.R16F:case d.H0.R32F:case d.H0.R8_SNORM:case d.H0.R8:this.pixelFormat=6403;break;case d.H0.R8I:case d.H0.R8UI:case d.H0.R16I:case d.H0.R16UI:case d.H0.R32I:case d.H0.R32UI:this.pixelFormat=36244}}static validate(e,t){return new y(e,t)}}const b=!!(0,n.A)("esri-tests-disable-gpu-memory-measurements"),M=()=>o.A.getLogger("esri/views/webgl/Texture");class T{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{const r=y.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 b?0:(0,u.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(d.vt.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,t){const 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(),!g(e)&&this._descriptor.internalFormat&&(0,s.a4)(d.CQ,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(e),!g(e)&&this._descriptor.compress&&this._compressOnWorker(e)}updateData(e,t,r,n,o,a,s=0){a||M().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||M().error("An attempt to update uninitialized texture!");const l=this._descriptor;l.internalFormat=w(l);const{context:c,pixelFormat:d,dataType:u,target:h,isImmutable:p}=l;if(p&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");const m=c.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES,!0);(t<0||r<0||t+n>l.width||r+o>l.height)&&M().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:f}=c;s&&(n&&o||M().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),f.pixelStorei(f.UNPACK_SKIP_ROWS,s)),v(a)?f.texSubImage2D(h,e,t,r,n,o,d,u,a):g(a)?f.compressedTexSubImage2D(h,e,t,r,n,o,l.internalFormat,a.levels[e]):f.texSubImage2D(h,e,t,r,n,o,d,u,a),s&&f.pixelStorei(f.UNPACK_SKIP_ROWS,0),c.bindTexture(m,T.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,t,r,n,o,a,s,l){l||M().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||M().error("An attempt to update an uninitialized texture!");const c=this._descriptor;c.internalFormat=w(c);const{context:d,pixelFormat:u,dataType:h,isImmutable:p,target:m}=c;if(p&&!this._wasImmutablyAllocated)throw new i.A("texture:uninitialized","Cannot update immutable texture before allocation!");_(m)||M().warn("Attempting to set 3D texture data on a non-3D texture");const f=d.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);d.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),(t<0||r<0||n<0||t+o>c.width||r+a>c.height||n+s>c.depth)&&M().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:v}=d;if(g(l))l=l.levels[e],v.compressedTexSubImage3D(m,e,t,r,n,o,a,s,c.internalFormat,l);else{const i=l;v.texSubImage3D(m,e,t,r,n,o,a,s,u,h,i)}d.bindTexture(f,T.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const 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,p(e)}9729===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9985):9728===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9984);const t=this._descriptor.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(t,T.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const 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,p(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,p(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(e){e!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=e,this.setSamplingMode(e?9729:9728),p(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=(0,a.DC)(this._compressionAbortController)}_setData(e,t){const r=this._descriptor,n=r.context?.gl;if(!n)return;(0,c.Y2)(n),this.hasWebGLTextureObject||(this._glName=n.createTexture(),r.context.instanceCounter.increment(d.vt.Texture,this)),p(r);const o=r.context.bindTexture(this,T.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(T.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),(0,c.Y2)(n);const a=t??r.target,l=_(a);if(v(e))this._setDataFromTexImageSource(e,a);else{const{width:t,height:o,depth:u}=r;if(null==t||null==o)throw new i.A("texture:missing-size","Width and height must be specified!");if(l&&null==u)throw new i.A("texture:missing-depth","Depth must be specified!");if(r.internalFormat=w(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(a,r.internalFormat,r.hasMipmap,t,o,u),g(e)){if(!function(e){return null!=e&&(0,s.a4)(d.CQ,e)}(r.internalFormat))throw new i.A("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(e,r.internalFormat,a)}else this._texImage(a,0,r.internalFormat,t,o,u,e),(0,c.Y2)(n),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),(0,c.Y2)(n),r.context.bindTexture(o,T.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(e=null){for(let t=34069;t<=34074;t++)this._setData(e,t)}_configurePixelStorage(){const 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?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i?1:0)}_setDataFromTexImageSource(e,t){const{gl:r}=this._descriptor.context,i=this._descriptor;i.internalFormat=w(i);const n=_(t),{width:o,height:a,depth:s}=function(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}}(e);i.width&&i.height,i.width||(i.width=o),i.height||(i.height=a),n&&i.depth,n&&(i.depth=s),i.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(t,i.internalFormat,i.hasMipmap,o,a,s),this._texImage(t,0,i.internalFormat,o,a,s,e),(0,c.Y2)(r),i.hasMipmap&&(this.generateMipmap(),(0,c.Y2)(r))}_setDataFromCompressedSource(e,t,r){const i=this._descriptor,{width:n,height:o,depth:a}=i,s=e.levels,l=x(r,n,o,a),c=Math.min(l,s.length)-1;this._descriptor.context.gl.texParameteri(i.target,33085,c),this._forEachMipmapLevel((e,i,n,o)=>{const a=s[Math.min(e,s.length-1)];this._compressedTexImage(r,e,t,i,n,o,a)},c)}_texStorage(e,t,r,n,o,a){const{gl:s}=this._descriptor.context;if(!function(e){return d.XN.includes(e)}(t)&&!m(t)&&!f(t))throw new i.A("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const l=r?x(e,n,o,a):1;if(_(e)){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");s.texStorage3D(e,l,t,n,o,a)}else s.texStorage2D(e,l,t,n,o);this._wasImmutablyAllocated=!0}_texImage(e,t,r,n,o,a,s){const l=this._descriptor.context.gl,c=_(e),{isImmutable:d,pixelFormat:u,dataType:h}=this._descriptor;if(d){if(null!=s){const r=s;if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texSubImage3D(e,t,0,0,0,n,o,a,u,h,r)}else l.texSubImage2D(e,t,0,0,n,o,u,h,r)}}else{const d=s;if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.texImage3D(e,t,r,n,o,a,0,u,h,d)}else l.texImage2D(e,t,r,n,o,0,u,h,d)}}_compressedTexImage(e,t,r,n,o,a,s){const l=this._descriptor.context.gl,c=_(e);if(this._descriptor.isImmutable){if(null!=s)if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,t,0,0,0,n,o,a,r,s)}else l.compressedTexSubImage2D(e,t,0,0,n,o,r,s)}else if(c){if(null==a)throw new i.A("texture:missing-depth","Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,t,r,n,o,a,0,s)}else l.compressedTexImage2D(e,t,r,n,o,0,s)}async _compressOnWorker(e){const{width:t,height:r,context:i,flipped:n,preMultiplyAlpha:o,hasMipmap:a}=this._descriptor,s=this._descriptor.compress?.compressionTracker,c=this._descriptor.compress?.compressionCallback,{compressedTextureETC:d,compressedTextureS3TC:u}=i.capabilities;if(!T.compressionWorkerHandle?.isCompressible(e,this._descriptor)||!d&&!u)return;this.abortCompression();const h=new AbortController;let p;this._compressionAbortController=h,s?.increment();try{e instanceof Uint8Array?p=e.buffer:(p=await createImageBitmap(e,{imageOrientation:n?"flipY":"none"}),(0,l.Te)(h));const i={data:p,width:t,height:r,needsFlip:e instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:o,hasMipmap:a,hasETC:!!d,hasS3TC:!!u},s=await T.compressionWorkerHandle.invoke(i,h.signal,1);if((0,l.Te)(h),s.compressedTexture&&this.hasWebGLTextureObject){const e=this.usedMemory;this._descriptor.internalFormat=s.internalFormat,this._setData(s.compressedTexture),c?.(e-this.usedMemory)}}catch(e){(0,l.zf)(e)||M().error("Texture compression failed!")}finally{s?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null),p instanceof ImageBitmap&&p.close()}}_forEachMipmapLevel(e,t=1/0){let{width:r,height:n,depth:o,hasMipmap:a,target:s}=this._descriptor;const l=32879===s;if(null==r||null==n||l&&null==o)throw new i.A("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let i=0;e(i,r,n,o),a&&(1!==r||1!==n||l&&1!==o)&&!(i>=t);++i)r=Math.max(1,r>>1),n=Math.max(1,n>>1),l&&(o=Math.max(1,o>>1))}_applySamplingMode(){const e=this._descriptor,t=e.context?.gl;let 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)}_applyWrapMode(){const 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(){const 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,c.Y2)(t)}_applyAnisotropicFilteringParameters(){const e=this._descriptor,t=e.context.capabilities.textureFilterAnisotropic;t&&e.context.gl.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}}},76591:(e,t,r)=>{r.d(t,{HQ:()=>c,rA:()=>d});var i=r(58083),n=r(9093),o=r(38954),a=r(51850),s=r(40710),l=(r(33079),r(31821));function c(e,t){!function(e,t,...r){h(e,t,...r),t.hasSlicePlane?e.code.add("\n void discardBySlice(vec3 pos) {\n if (sliceByPlane(pos)) {\n discard;\n }\n }\n\n vec4 applySliceOutline(vec4 color, vec3 pos) {\n SliceFactors factors = calculateSliceFactors(pos);\n\n factors.front /= 2.0 * fwidth(factors.front);\n factors.side0 /= 2.0 * fwidth(factors.side0);\n factors.side1 /= 2.0 * fwidth(factors.side1);\n factors.side2 /= 2.0 * fwidth(factors.side2);\n factors.side3 /= 2.0 * fwidth(factors.side3);\n\n // return after calling fwidth, to avoid aliasing caused by discontinuities in the input to fwidth\n if (sliceByFactors(factors)) {\n return color;\n }\n\n float outlineFactor = (1.0 - step(0.5, factors.front))\n * (1.0 - step(0.5, factors.side0))\n * (1.0 - step(0.5, factors.side1))\n * (1.0 - step(0.5, factors.side2))\n * (1.0 - step(0.5, factors.side3));\n\n return mix(color, vec4(vec3(0.0), color.a), outlineFactor * 0.3);\n }\n\n vec4 applySlice(vec4 color, vec3 pos) {\n return sliceEnabled() ? applySliceOutline(color, pos) : color;\n }\n "):e.code.add(l.H`void discardBySlice(vec3 pos) { }
730
730
  vec4 applySlice(vec4 color, vec3 pos) { return color; }`)}(e,t,new s.W("slicePlaneOrigin",(e,r)=>g(t,e,r)),new s.W("slicePlaneBasis1",(e,r)=>v(t,e,r,r.slicePlane?.basis1)),new s.W("slicePlaneBasis2",(e,r)=>v(t,e,r,r.slicePlane?.basis2)))}function d(e,t){h(e,t,new s.W("slicePlaneOrigin",(e,r)=>g(t,e,r)),new s.W("slicePlaneBasis1",(e,r)=>v(t,e,r,r.slicePlane?.basis1)),new s.W("slicePlaneBasis2",(e,r)=>v(t,e,r,r.slicePlane?.basis2)))}r(65786).Y;const u=l.H`struct SliceFactors {
731
731
  float front;
732
732
  float side0;