@arcgis/core 4.24.0-next.20220607 → 4.24.0-next.20220610
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.
- package/analysis/Analysis.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade.d.ts +4 -0
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{4d2181bde97983ecac8b.js → 03ddf44e6fb8bf9db3ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e2d7f5952934af43fd7.js → 04034dabc8e0a489b0f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7168ff8f26ca2537080.js → 0747c28fce0b344dc89b.js} +1 -1
- package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +1 -0
- package/assets/esri/core/workers/chunks/{cbe98327181d8d7ad9e5.js → 262fabdc409d55831ffa.js} +1 -1
- package/assets/esri/core/workers/chunks/2a52c2c6edd70432f4a5.js +1 -0
- package/assets/esri/core/workers/chunks/{71d445d1e6812e03a1d7.js → 3ce7adaefc9de28d9c87.js} +1 -1
- package/assets/esri/core/workers/chunks/{c165845a117c21246b1e.js → 42aa8ce4eb7bd851475e.js} +1 -1
- package/assets/esri/core/workers/chunks/{a9a4bb1d781b1a995fb3.js → 4824926501e11d04eb4a.js} +1 -1
- package/assets/esri/core/workers/chunks/{e51420d231c286b9c062.js → 540f1ed1ea9cddc739af.js} +1 -1
- package/assets/esri/core/workers/chunks/6196cfdeb91ceba52af3.js +1 -0
- package/assets/esri/core/workers/chunks/71a4618d959a09302c51.js +1 -0
- package/assets/esri/core/workers/chunks/76fbc8eaabba62fd4f9c.js +1 -0
- package/assets/esri/core/workers/chunks/{cb906a3f03dd0805c880.js → 7cc17b716b16a6684023.js} +1 -1
- package/assets/esri/core/workers/chunks/871681c1353026cb6d4b.js +1 -0
- package/assets/esri/core/workers/chunks/{13e9e6f0b4942d79b0eb.js → 88942e9f60687ac006dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c5b80ba3dbfe6f6cafb.js → acb1e649cda99d4f69a5.js} +1 -1
- package/assets/esri/core/workers/chunks/b71a0a8a2f446c671161.js +1 -0
- package/assets/esri/core/workers/chunks/b8002aaa665712299121.js +1 -0
- package/assets/esri/core/workers/chunks/{e4ca3f04ca7f71b46240.js → bb3480e231934b7bb34e.js} +1 -1
- package/assets/esri/core/workers/chunks/{185da42e7cc8e440c0f0.js → c157b46b0724f3f0947e.js} +1 -1
- package/assets/esri/core/workers/chunks/{1aba8c73c62a64e0658c.js → c6af8b0903d8d934d542.js} +1 -1
- package/assets/esri/core/workers/chunks/c8402e32307a7b7eaaeb.js +1 -0
- package/assets/esri/core/workers/chunks/c8e08a956b16034d9819.js +1 -0
- package/assets/esri/core/workers/chunks/d0d2566bedc493ed0a3b.js +1 -0
- package/assets/esri/core/workers/chunks/{8152cd26ebeae910b753.js → d3c73da9c2abb59e762a.js} +1 -1
- package/assets/esri/core/workers/chunks/d828a0656e7351a74fc4.js +1 -0
- package/assets/esri/core/workers/chunks/{172368d4eb6e6f8d2bdb.js → d8b9551df1bd196d0126.js} +1 -1
- package/assets/esri/core/workers/chunks/e5c8584ae764892c324d.js +1 -0
- package/assets/esri/core/workers/chunks/{1d893ebc6f203ff1fc3d.js → efe605ff4ba2a95c14c5.js} +1 -1
- package/assets/esri/core/workers/chunks/f54d5abbb9668c45bd19.js +1 -0
- package/assets/esri/core/workers/chunks/{bd2f4a01cb71e25837ba.js → f7ba74fc4eb541c424fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ebed6d6f561f926bd36.js → faf6e48f9f1205fb2e43.js} +1 -1
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BasemapToggle.scss +6 -23
- package/assets/esri/themes/base/widgets/_Directions.scss +0 -3
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +10 -2
- package/assets/esri/themes/base/widgets/_Slider.scss +8 -3
- package/assets/esri/themes/base/widgets/_Tooltip.scss +8 -8
- package/assets/esri/themes/base/widgets/_Weather.scss +5 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ar.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bg.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bs.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ca.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_cs.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_da.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_de.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_el.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_en.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_es.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_et.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fi.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_he.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hu.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_id.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_it.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ja.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ko.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lt.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lv.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nb.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-BR.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-PT.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ro.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ru.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sk.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sv.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_th.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_tr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_uk.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_vi.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-CN.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-HK.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
- package/chunks/RasterColorizer.glsl.js +22 -18
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/i3s.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/libtess-asm.js +1 -1
- package/chunks/libtess.js +1 -1
- package/chunks/pe-wasm.js +1 -1
- package/chunks/persistableUrlUtils.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/quantityUtils.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/interfaces.d.ts +471 -52
- package/layers/LineOfSightLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/layers/support/RasterInfo.js +1 -1
- package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
- package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/layers/support/rasterFormats/JpgPlus.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/package.json +1 -1
- package/portal/support/urlUtils.js +5 -0
- package/renderers/support/colorRampUtils.js +1 -1
- package/rest/imageService/fetchRasterInfo.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/persistableUrlUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/graphics/GraphicStoreItem.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionComputation.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/BlendOptions.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/tooltip/TranslateTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +1 -1
- package/views/support/areaMeasurementUtils.js +1 -1
- package/views/support/automaticLengthMeasurementUtils.js +5 -0
- package/views/support/euclideanLengthMeasurementUtils.js +5 -0
- package/views/support/geodesicLengthMeasurementUtils.js +5 -0
- package/views/support/measurementUtils.js +5 -0
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Daylight/DaylightViewModel.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/AnalysisViewModel.js +1 -1
- package/widgets/support/AnchorElementViewModel.js +1 -1
- package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/2ac6c99aacb873134f7c.js +0 -1
- package/assets/esri/core/workers/chunks/471beeb6924599209567.js +0 -1
- package/assets/esri/core/workers/chunks/5242c9badca17ba2ab25.js +0 -1
- package/assets/esri/core/workers/chunks/72c7d48408d1f8050026.js +0 -1
- package/assets/esri/core/workers/chunks/770cf0a66102100abe74.js +0 -1
- package/assets/esri/core/workers/chunks/96ff15d6c2bfca0c6061.js +0 -1
- package/assets/esri/core/workers/chunks/9c4c721d890b49697132.js +0 -1
- package/assets/esri/core/workers/chunks/af3766a2d27419c7766c.js +0 -1
- package/assets/esri/core/workers/chunks/b50bbfd75768d9a8de88.js +0 -1
- package/assets/esri/core/workers/chunks/b577ec80647cf2ece397.js +0 -1
- package/assets/esri/core/workers/chunks/c1653b6cb201ecbaabaa.js +0 -1
- package/assets/esri/core/workers/chunks/e99b58d07475bffce7ea.js +0 -1
- package/assets/esri/core/workers/chunks/f3d885aec4bca18928d4.js +0 -1
- package/assets/esri/core/workers/chunks/fc0da1dfeef041182ddf.js +0 -1
- package/views/support/lengthMeasurementUtils.js +0 -5
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
|
|
163
163
|
${e.transparencyPassType===D.Am.Color?O.H`gl_FragColor = premultiplyAlpha(gl_FragColor);`:O.H``}
|
|
164
164
|
}
|
|
165
|
-
`)),t.include(p.s,e),t}const B=Object.freeze(Object.defineProperty({__proto__:null,build:H},Symbol.toStringTag,{value:"Module"}))},21787:(e,t,r)=>{r.d(t,{a:()=>s,f:()=>n,i:()=>c,t:()=>o});var i=r(46851);function n(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function o(e,t){if(e===t){const r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function a(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=r[0],f=r[1],m=r[2],p=r[3],g=r[4],_=r[5],v=r[6],T=r[7],x=r[8];return e[0]=h*i+f*a+m*c,e[1]=h*n+f*s+m*u,e[2]=h*o+f*l+m*d,e[3]=p*i+g*a+_*c,e[4]=p*n+g*s+_*u,e[5]=p*o+g*l+_*d,e[6]=v*i+T*a+x*c,e[7]=v*n+T*s+x*u,e[8]=v*o+T*l+x*d,e}function s(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],h=t[10],f=t[11],m=t[12],p=t[13],g=t[14],_=t[15],v=r*s-i*a,T=r*l-n*a,x=r*c-o*a,b=i*l-n*s,A=i*c-o*s,E=n*c-o*l,S=u*p-d*m,M=u*g-h*m,R=u*_-f*m,C=d*g-h*p,w=d*_-f*p,y=h*_-f*g;let O=v*y-T*w+x*C+b*R-A*M+E*S;return O?(O=1/O,e[0]=(s*y-l*w+c*C)*O,e[1]=(l*R-a*y-c*M)*O,e[2]=(a*w-s*R+c*S)*O,e[3]=(n*w-i*y-o*C)*O,e[4]=(r*y-n*R+o*M)*O,e[5]=(i*R-r*w-o*S)*O,e[6]=(p*E-g*A+_*b)*O,e[7]=(g*x-m*E-_*T)*O,e[8]=(m*A-p*x+_*v)*O,e):null}function l(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function c(e){const t=i.E,r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8];return Math.abs(1-(r*r+a*a+c*c))<=t&&Math.abs(1-(n*n+s*s+u*u))<=t&&Math.abs(1-(o*o+l*l+d*d))<=t}const u=a,d=l;Object.freeze(Object.defineProperty({__proto__:null,fromMat4:n,copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},set:function(e,t,r,i,n,o,a,s,l,c){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=a,e[6]=s,e[7]=l,e[8]=c,e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},transpose:o,invert:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=u*a-s*c,h=-u*o+s*l,f=c*o-a*l;let m=r*d+i*h+n*f;return m?(m=1/m,e[0]=d*m,e[1]=(-u*i+n*c)*m,e[2]=(s*i-n*a)*m,e[3]=h*m,e[4]=(u*r-n*l)*m,e[5]=(-s*r+n*o)*m,e[6]=f*m,e[7]=(-c*r+i*l)*m,e[8]=(a*r-i*o)*m,e):null},adjoint:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=a*u-s*c,e[1]=n*c-i*u,e[2]=i*s-n*a,e[3]=s*l-o*u,e[4]=r*u-n*l,e[5]=n*o-r*s,e[6]=o*c-a*l,e[7]=i*l-r*c,e[8]=r*a-i*o,e},determinant:function(e){const t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*o-a*l)+r*(-c*n+a*s)+i*(l*n-o*s)},multiply:a,translate:function(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=r[0],f=r[1];return e[0]=i,e[1]=n,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=h*i+f*a+c,e[7]=h*n+f*s+u,e[8]=h*o+f*l+d,e},rotate:function(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=Math.sin(r),f=Math.cos(r);return e[0]=f*i+h*a,e[1]=f*n+h*s,e[2]=f*o+h*l,e[3]=f*a-h*i,e[4]=f*s-h*n,e[5]=f*l-h*o,e[6]=c,e[7]=u,e[8]=d,e},scale:function(e,t,r){const i=r[0],n=r[1],o=r[2];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=o*t[6],e[7]=o*t[7],e[8]=o*t[8],e},scaleByVec2:function(e,t,r){const i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e},fromTranslation:function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},fromRotation:function(e,t){const r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromScaling:function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromMat2d:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},fromQuat:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=r+r,s=i+i,l=n+n,c=r*a,u=i*a,d=i*s,h=n*a,f=n*s,m=n*l,p=o*a,g=o*s,_=o*l;return e[0]=1-d-m,e[3]=u-_,e[6]=h+g,e[1]=u+_,e[4]=1-c-m,e[7]=f-p,e[2]=h-g,e[5]=f+p,e[8]=1-c-d,e},normalFromMat4Legacy:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[4],a=t[5],s=t[6],l=t[8],c=t[9],u=t[10],d=u*a-s*c,h=-u*o+s*l,f=c*o-a*l,m=r*d+i*h+n*f;if(!m)return null;const p=1/m;return e[0]=d*p,e[1]=(-u*i+n*c)*p,e[2]=(s*i-n*a)*p,e[3]=h*p,e[4]=(u*r-n*l)*p,e[5]=(-s*r+n*o)*p,e[6]=f*p,e[7]=(-c*r+i*l)*p,e[8]=(a*r-i*o)*p,e},normalFromMat4:s,projection:function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},str:function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},frob:function(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2+e[3]**2+e[4]**2+e[5]**2+e[6]**2+e[7]**2+e[8]**2)},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},subtract:l,multiplyScalar:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},multiplyScalarAndAdd:function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e},exactEquals:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},equals:function(e,t){const r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1],m=t[2],p=t[3],g=t[4],_=t[5],v=t[6],T=t[7],x=t[8];return Math.abs(r-h)<=i.E*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(n-f)<=i.E*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-m)<=i.E*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(a-p)<=i.E*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(s-g)<=i.E*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=i.E*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(c-v)<=i.E*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(u-T)<=i.E*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(d-x)<=i.E*Math.max(1,Math.abs(d),Math.abs(x))},isOrthoNormal:c,mul:u,sub:d},Symbol.toStringTag,{value:"Module"}))},46521:(e,t,r)=>{function i(){return[1,0,0,0,1,0,0,0,1]}function n(e,t){return new Float64Array(e,t,9)}r.d(t,{a:()=>n,c:()=>i}),Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:function(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},fromValues:function(e,t,r,i,n,o,a,s,l){return[e,t,r,i,n,o,a,s,l]},createView:n},Symbol.toStringTag,{value:"Module"}))},13598:(e,t,r)=>{function i(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function n(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}function o(e,t){return new Float64Array(e,t,16)}r.d(t,{I:()=>a,a:()=>o,b:()=>n,c:()=>i});const a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:n,fromValues:function(e,t,r,i,n,o,a,s,l,c,u,d,h,f,m,p){return[e,t,r,i,n,o,a,s,l,c,u,d,h,f,m,p]},createView:o,IDENTITY:a},Symbol.toStringTag,{value:"Module"}))},51305:(e,t,r)=>{r.d(t,{c:()=>f,g:()=>u,j:()=>w,k:()=>p,m:()=>d,s:()=>c});var i=r(46521),n=r(94961),o=r(65617),a=r(46851),s=r(17896),l=r(98766);function c(e,t,r){r*=.5;const i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function u(e,t){const r=2*Math.acos(t[3]),i=Math.sin(r/2);return i>a.E?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=1,e[1]=0,e[2]=0),r}function d(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=r[0],l=r[1],c=r[2],u=r[3];return e[0]=i*u+a*s+n*c-o*l,e[1]=n*u+a*l+o*s-i*c,e[2]=o*u+a*c+i*l-n*s,e[3]=a*u-i*s-n*l-o*c,e}function h(e,t,r,i){const n=t[0],o=t[1],s=t[2],l=t[3];let c,u,d,h,f,m=r[0],p=r[1],g=r[2],_=r[3];return u=n*m+o*p+s*g+l*_,u<0&&(u=-u,m=-m,p=-p,g=-g,_=-_),1-u>a.E?(c=Math.acos(u),d=Math.sin(c),h=Math.sin((1-i)*c)/d,f=Math.sin(i*c)/d):(h=1-i,f=i),e[0]=h*n+f*m,e[1]=h*o+f*p,e[2]=h*s+f*g,e[3]=h*l+f*_,e}function f(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function m(e,t){const r=t[0]+t[4]+t[8];let i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);const n=(r+1)%3,o=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*n+n]-t[3*o+o]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*n+o]-t[3*o+n])*i,e[n]=(t[3*n+r]+t[3*r+n])*i,e[o]=(t[3*o+r]+t[3*r+o])*i}return e}function p(e,t,r,i){const n=.5*Math.PI/180;t*=n,r*=n,i*=n;const o=Math.sin(t),a=Math.cos(t),s=Math.sin(r),l=Math.cos(r),c=Math.sin(i),u=Math.cos(i);return e[0]=o*l*u-a*s*c,e[1]=a*s*u+o*l*c,e[2]=a*l*c-o*s*u,e[3]=a*l*u+o*s*c,e}const g=l.c,_=l.s,v=l.a,T=d,x=l.b,b=l.d,A=l.l,E=l.e,S=E,M=l.f,R=M,C=l.n,w=l.g,y=l.h,O=(0,o.c)(),P=(0,o.f)(1,0,0),N=(0,o.f)(0,1,0),I=(0,n.a)(),D=(0,n.a)(),L=(0,i.c)();Object.freeze(Object.defineProperty({__proto__:null,identity:function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},setAxisAngle:c,getAxisAngle:u,multiply:d,rotateX:function(e,t,r){r*=.5;const i=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=n*l+o*s,e[2]=o*l-n*s,e[3]=a*l-i*s,e},rotateY:function(e,t,r){r*=.5;const i=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-o*s,e[1]=n*l+a*s,e[2]=o*l+i*s,e[3]=a*l-n*s,e},rotateZ:function(e,t,r){r*=.5;const i=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=o*l+a*s,e[3]=a*l-o*s,e},calculateW:function(e,t){const r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e},slerp:h,random:function(e){const t=(0,a.R)(),r=(0,a.R)(),i=(0,a.R)(),n=Math.sqrt(1-t),o=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*r),e[1]=n*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*i),e[3]=o*Math.cos(2*Math.PI*i),e},invert:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=r*r+i*i+n*n+o*o,s=a?1/a:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=o*s,e},conjugate:f,fromMat3:m,fromEuler:p,str:function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},copy:g,set:_,add:v,mul:T,scale:x,dot:b,lerp:A,length:E,len:S,squaredLength:M,sqrLen:R,normalize:C,exactEquals:w,equals:y,rotationTo:function(e,t,r){const i=(0,s.e)(t,r);return i<-.999999?((0,s.f)(O,P,t),(0,s.u)(O)<1e-6&&(0,s.f)(O,N,t),(0,s.n)(O,O),c(e,O,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):((0,s.f)(O,t,r),e[0]=O[0],e[1]=O[1],e[2]=O[2],e[3]=1+i,C(e,e))},sqlerp:function(e,t,r,i,n,o){return h(I,t,n,o),h(D,r,i,o),h(e,I,D,2*o*(1-o)),e},setAxes:function(e,t,r,i){const n=L;return n[0]=r[0],n[3]=r[1],n[6]=r[2],n[1]=i[0],n[4]=i[1],n[7]=i[2],n[2]=-t[0],n[5]=-t[1],n[8]=-t[2],C(e,m(e,n))}},Symbol.toStringTag,{value:"Module"}))},94961:(e,t,r)=>{function i(){return[0,0,0,1]}function n(e){return[e[0],e[1],e[2],e[3]]}function o(e,t){return new Float64Array(e,t,4)}r.d(t,{I:()=>a,a:()=>i,b:()=>n,c:()=>o});const a=[0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:n,fromValues:function(e,t,r,i){return[e,t,r,i]},createView:o,IDENTITY:a},Symbol.toStringTag,{value:"Module"}))},2643:(e,t,r)=>{r.d(t,{b:()=>_,c:()=>g,d:()=>v,g:()=>T,i:()=>A,m:()=>y}),r(80442);var i,n,o=r(92604),a=r(22021),s=r(70586),l=r(52138),c=r(17896),u=r(65617),d=r(98766),h=r(88669);(n=i||(i={}))[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z";var f=r(78341);(0,u.c)(),(0,u.c)();var m=r(12981);const p=o.Z.getLogger("esri.geometry.support.sphere");function g(){return(0,h.c)()}function _(e,t=g()){return(0,d.c)(t,e)}function v(e){return e[3]}function T(e){return e}function x(e,t,r){if((0,s.Wi)(t))return!1;const{origin:i,direction:n}=t,o=b;o[0]=i[0]-e[0],o[1]=i[1]-e[1],o[2]=i[2]-e[2];const a=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],l=2*(n[0]*o[0]+n[1]*o[1]+n[2]*o[2]),c=l*l-4*a*(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]-e[3]*e[3]);if(c<0)return!1;const u=Math.sqrt(c);let d=(-l-u)/(2*a);const h=(-l+u)/(2*a);return(d<0||h<d&&h>0)&&(d=h),!(d<0||(r&&(r[0]=i[0]+n[0]*d,r[1]=i[1]+n[1]*d,r[2]=i[2]+n[2]*d),0))}const b=(0,u.c)();function A(e,t){return x(e,t,null)}function E(e,t,r){const i=m.WM.get(),n=m.MP.get();(0,c.f)(i,t.origin,t.direction);const o=v(e);(0,c.f)(r,i,t.origin),(0,c.g)(r,r,1/(0,c.l)(r)*o);const s=M(e,t.origin),u=function(e,t){const r=(0,c.e)(e,t)/((0,c.l)(e)*(0,c.l)(t));return-(0,a.ZF)(r)}(t.origin,r);return(0,l.d)(n,u+s,i),(0,c.m)(r,r,n),r}function S(e,t,r){const i=(0,c.b)(m.WM.get(),t,e),n=(0,c.g)(m.WM.get(),i,e[3]/(0,c.l)(i));return(0,c.a)(r,n,e)}function M(e,t){const r=(0,c.b)(m.WM.get(),t,e),i=(0,c.l)(r),n=v(e),o=n+Math.abs(n-i);return(0,a.ZF)(n/o)}const R=(0,u.c)();function C(e,t,r,n){const o=(0,c.b)(R,t,e);switch(r){case i.X:{const e=(0,a.jE)(o,R)[2];return(0,c.s)(n,-Math.sin(e),Math.cos(e),0)}case i.Y:{const e=(0,a.jE)(o,R),t=e[1],r=e[2],i=Math.sin(t);return(0,c.s)(n,-i*Math.cos(r),-i*Math.sin(r),Math.cos(t))}case i.Z:return(0,c.n)(n,o);default:return}}function w(e,t){const r=(0,c.b)(O,t,e);return(0,c.l)(r)-e[3]}function y(e,t){const r=(0,c.d)(e,t),i=v(e);return r<=i*i}const O=(0,u.c)(),P=g();Object.freeze(Object.defineProperty({__proto__:null,create:g,copy:_,fromCenterAndRadius:function(e,t){return(0,h.f)(e[0],e[1],e[2],t)},wrap:function(e){return e},clear:function(e){e[0]=e[1]=e[2]=e[3]=0},fromRadius:function(e,t){return e[0]=e[1]=e[2]=0,e[3]=t,e},getRadius:v,getCenter:T,fromValues:function(e,t,r,i){return(0,h.f)(e,t,r,i)},elevate:function(e,t,r){return e!==r&&(0,c.c)(r,e),r[3]=e[3]+t,r},setExtent:function(e,t,r){return p.error("sphere.setExtent is not yet supported"),e===r?r:_(e,r)},intersectRay:x,intersectsRay:A,intersectRayClosestSilhouette:function(e,t,r){if(x(e,t,r))return r;const i=E(e,t,m.WM.get());return(0,c.a)(r,t.origin,(0,c.g)(m.WM.get(),t.direction,(0,c.i)(t.origin,i)/(0,c.l)(t.direction))),r},closestPointOnSilhouette:E,closestPoint:function(e,t,r){return x(e,t,r)?r:((0,f.JI)(t,e,r),S(e,r,r))},projectPoint:S,distanceToSilhouette:function(e,t){const r=(0,c.b)(m.WM.get(),t,e),i=(0,c.p)(r),n=e[3]*e[3];return Math.sqrt(Math.abs(i-n))},angleToSilhouette:M,axisAt:C,altitudeAt:w,setAltitudeAt:function(e,t,r,n){const o=w(e,t),a=C(e,t,i.Z,O),s=(0,c.g)(O,a,r-o);return(0,c.a)(n,t,s)},containsPoint:y,tmpSphere:P},Symbol.toStringTag,{value:"Module"}))},20773:(e,t,r)=>{r.d(t,{a:()=>o,b:()=>l,n:()=>s,s:()=>a,t:()=>n});var i=r(72220);function n(e,t,r){if(e.count!==t.count)return void i.c.error("source and destination buffers need to have the same number of elements");const n=e.count,o=r[0],a=r[1],s=r[2],l=r[4],c=r[5],u=r[6],d=r[8],h=r[9],f=r[10],m=r[12],p=r[13],g=r[14],_=e.typedBuffer,v=e.typedBufferStride,T=t.typedBuffer,x=t.typedBufferStride;for(let e=0;e<n;e++){const t=e*v,r=e*x,i=T[r],n=T[r+1],b=T[r+2];_[t]=o*i+l*n+d*b+m,_[t+1]=a*i+c*n+h*b+p,_[t+2]=s*i+u*n+f*b+g}}function o(e,t,r){if(e.count!==t.count)return void i.c.error("source and destination buffers need to have the same number of elements");const n=e.count,o=r[0],a=r[1],s=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],f=r[8],m=e.typedBuffer,p=e.typedBufferStride,g=t.typedBuffer,_=t.typedBufferStride;for(let e=0;e<n;e++){const t=e*p,r=e*_,i=g[r],n=g[r+1],v=g[r+2];m[t]=o*i+l*n+d*v,m[t+1]=a*i+c*n+h*v,m[t+2]=s*i+u*n+f*v}}function a(e,t,r){const i=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*o,i=e*s;n[t]=r*a[i],n[t+1]=r*a[i+1],n[t+2]=r*a[i+2]}}function s(e,t){const r=Math.min(e.count,t.count),i=e.typedBuffer,n=e.typedBufferStride,o=t.typedBuffer,a=t.typedBufferStride;for(let e=0;e<r;e++){const t=e*n,r=e*a,s=o[r],l=o[r+1],c=o[r+2],u=s*s+l*l+c*c;if(u>0){const e=1/Math.sqrt(u);i[t]=e*s,i[t+1]=e*l,i[t+2]=e*c}}}function l(e,t,r){const i=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*o,i=e*s;n[t]=a[i]>>r,n[t+1]=a[i+1]>>r,n[t+2]=a[i+2]>>r}}Object.freeze(Object.defineProperty({__proto__:null,transformMat4:n,transformMat3:o,scale:a,normalize:s,shiftRight:l},Symbol.toStringTag,{value:"Module"}))},56067:(e,t,r)=>{function i(e,t,r){const i=e.typedBuffer,n=e.typedBufferStride,o=t.typedBuffer,a=t.typedBufferStride,s=r?r.count:t.count;let l=(r&&r.dstIndex?r.dstIndex:0)*n,c=(r&&r.srcIndex?r.srcIndex:0)*a;for(let e=0;e<s;++e)i[l]=o[c],i[l+1]=o[c+1],i[l+2]=o[c+2],l+=n,c+=a}function n(e,t,r,i,n){const o=e.typedBuffer,a=e.typedBufferStride,s=n?.count??e.count;let l=(n?.dstIndex??0)*a;for(let e=0;e<s;++e)o[l]=t,o[l+1]=r,o[l+2]=i,l+=a}r.d(t,{c:()=>i,f:()=>n}),Object.freeze(Object.defineProperty({__proto__:null,copy:i,fill:n},Symbol.toStringTag,{value:"Module"}))},72119:(e,t,r)=>{function i(){return new Float32Array(3)}function n(e,t,r){const i=new Float32Array(3);return i[0]=e,i[1]=t,i[2]=r,i}function o(){return i()}function a(){return n(1,1,1)}function s(){return n(1,0,0)}function l(){return n(0,1,0)}function c(){return n(0,0,1)}r.d(t,{c:()=>i,f:()=>n});const u=o(),d=a(),h=s(),f=l(),m=c();Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:function(e){const t=new Float32Array(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},fromValues:n,createView:function(e,t){return new Float32Array(e,t,3)},zeros:o,ones:a,unitX:s,unitY:l,unitZ:c,ZEROS:u,ONES:d,UNIT_X:h,UNIT_Y:f,UNIT_Z:m},Symbol.toStringTag,{value:"Module"}))},88669:(e,t,r)=>{function i(){return[0,0,0,0]}function n(e,t,r,i){return[e,t,r,i]}function o(e,t){return new Float64Array(e,t,4)}function a(){return n(1,1,1,1)}function s(){return n(1,0,0,0)}function l(){return n(0,1,0,0)}function c(){return n(0,0,1,0)}function u(){return n(0,0,0,1)}r.d(t,{a:()=>o,c:()=>i,f:()=>n});const d=a(),h=s(),f=l(),m=c(),p=u();Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:function(e){return[e[0],e[1],e[2],e[3]]},fromValues:n,fromArray:function(e){const t=[0,0,0,0],r=Math.min(4,e.length);for(let i=0;i<r;++i)t[i]=e[i];return t},createView:o,zeros:function(){return[0,0,0,0]},ones:a,unitX:s,unitY:l,unitZ:c,unitW:u,ZEROS:[0,0,0,0],ONES:d,UNIT_X:h,UNIT_Y:f,UNIT_Z:m,UNIT_W:p},Symbol.toStringTag,{value:"Module"}))},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>null!=e?.match(t)))}function n(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(o)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{XO:()=>i,pJ:()=>n});const o=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,o,a,/^jsapps.esri.com$/,s,l]},72220:(e,t,r)=>{r.d(t,{c:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},78341:(e,t,r)=>{r.d(t,{JI:()=>l,Ue:()=>a,re:()=>s}),r(67676);var i=r(22807),n=r(17896),o=r(65617);function a(e){return e?{origin:(0,o.a)(e.origin),direction:(0,o.a)(e.direction)}:{origin:(0,o.c)(),direction:(0,o.c)()}}function s(e,t){const r=c.get();return r.origin=e,r.direction=t,r}function l(e,t,r){const i=(0,n.e)(e.direction,(0,n.b)(r,t,e.origin));return(0,n.a)(r,e.origin,(0,n.g)(r,e.direction,i)),r}r(12981);const c=new i.x((function(){return{origin:null,direction:null}}))},90751:(e,t,r)=>{r.r(t),r.d(t,{fetch:()=>Hr,gltfToEngineResources:()=>Ur,parseUrl:()=>Br});var i=r(32243),n=r(70586),o=r(21787),a=r(46521),s=r(52138),l=r(13598),c=r(17896),u=r(65617),d=r(60437),h=r(56481),f=r(20773),m=r(11077),p=r(8323),g=r(40270),_=r(88246),v=r(91911),T=r(3172),x=r(66643),b=r(20102),A=r(92604),E=r(95330),S=r(23670);async function M(e,t){const{data:r}=await(0,T.default)(e,{responseType:"image",...t});return r}var R=r(47026),C=r(44553),w=r(11726);class y{constructor(e,t,r,i){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.indices=r,this.position=i,this.center=(0,u.c)(),(0,w.hu)(e.length>=1),(0,w.hu)(r.length%this._numIndexPerPrimitive==0),(0,w.hu)(r.length>=e.length*this._numIndexPerPrimitive),(0,w.hu)(3===i.size||4===i.size);const{data:n,size:o}=i,a=e.length;let s=o*r[this._numIndexPerPrimitive*e[0]];O.clear(),O.push(s),this.bbMin=(0,u.f)(n[s],n[s+1],n[s+2]),this.bbMax=(0,u.a)(this.bbMin);for(let t=0;t<a;++t){const i=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){s=o*r[i+e],O.push(s);let t=n[s];this.bbMin[0]=Math.min(t,this.bbMin[0]),this.bbMax[0]=Math.max(t,this.bbMax[0]),t=n[s+1],this.bbMin[1]=Math.min(t,this.bbMin[1]),this.bbMax[1]=Math.max(t,this.bbMax[1]),t=n[s+2],this.bbMin[2]=Math.min(t,this.bbMin[2]),this.bbMax[2]=Math.max(t,this.bbMax[2])}}(0,c.h)(this.center,this.bbMin,this.bbMax,.5),this.radius=.5*Math.max(Math.max(this.bbMax[0]-this.bbMin[0],this.bbMax[1]-this.bbMin[1]),this.bbMax[2]-this.bbMin[2]);let l=this.radius*this.radius;for(let e=0;e<O.length;++e){s=O.getItemAt(e);const t=n[s]-this.center[0],r=n[s+1]-this.center[1],i=n[s+2]-this.center[2],o=t*t+r*r+i*i;if(o<=l)continue;const a=Math.sqrt(o),c=.5*(a-this.radius);this.radius=this.radius+c,l=this.radius*this.radius;const u=c/a;this.center[0]+=t*u,this.center[1]+=r*u,this.center[2]+=i*u}O.clear()}getCenter(){return this.center}getBSRadius(){return this.radius}getBBMin(){return this.bbMin}getBBMax(){return this.bbMax}getChildren(){if(this._children)return this._children;if((0,c.d)(this.bbMin,this.bbMax)>1){const e=(0,c.h)((0,u.c)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:n,size:o}=this.position;for(let a=0;a<t;++a){let t=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[a];let l=o*this.indices[s],c=n[l],u=n[l+1],d=n[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){l=o*this.indices[s+e];const t=n[l],r=n[l+1],i=n[l+2];t<c&&(c=t),r<u&&(u=r),i<d&&(d=i)}c<e[0]&&(t|=1),u<e[1]&&(t|=2),d<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const s=new Array(8);for(let e=0;e<8;++e)s[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];s[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array(8);for(let e=0;e<8;++e)void 0!==s[e]&&(this._children[e]=new y(s[e],this._numIndexPerPrimitive,this.indices,this.position))}return this._children}static prune(){O.prune()}}const O=new C.Z({deallocator:null});var P=r(17662),N=r(4726),I=r(17753),D=r(35065);class L extends P.c{constructor(e,t=[],r=R.MX.Triangle,i=-1){super(),this._primitiveType=r,this.edgeIndicesLength=i,this.type=N.U.Geometry,this._vertexAttributes=new Map,this._indices=new Map,this._boundingInfo=null;for(const[t,r]of e)r&&this._vertexAttributes.set(t,{...r});if(null==t||0===t.length){const e=function(e){const t=e.values().next().value;return null==t?0:t.data.length/t.size}(this._vertexAttributes),t=(0,I.p)(e);this.edgeIndicesLength=this.edgeIndicesLength<0?e:this.edgeIndicesLength;for(const e of this._vertexAttributes.keys())this._indices.set(e,t)}else for(const[e,r]of t)r&&(this._indices.set(e,F(r)),e===D.T.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._indices.get(e).length:this.edgeIndicesLength))}cloneShallow(){const e=new L([],void 0,this._primitiveType,void 0),{_vertexAttributes:t,_indices:r}=e;return this._vertexAttributes.forEach(((e,r)=>{t.set(r,e)})),this._indices.forEach(((e,t)=>{r.set(t,e)})),e.screenToWorldRatio=this.screenToWorldRatio,e._boundingInfo=this._boundingInfo,e}get vertexAttributes(){return this._vertexAttributes}getMutableAttribute(e){const t=this._vertexAttributes.get(e);return t&&!t.exclusive&&(t.data=Array.from(t.data),t.exclusive=!0),t}get indices(){return this._indices}get indexCount(){const e=this._indices.values().next().value;return e?e.length:0}get primitiveType(){return this._primitiveType}get faceCount(){return this.indexCount/3}get boundingInfo(){return(0,n.Wi)(this._boundingInfo)&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return this.primitiveType===R.MX.Triangle?this._computeAttachmentOriginTriangles(e):this._computeAttachmentOriginPoints(e)}_computeAttachmentOriginTriangles(e){const t=this.indices.get(D.T.POSITION),r=this.vertexAttributes.get(D.T.POSITION);return(0,I.cM)(r,t,e)}_computeAttachmentOriginPoints(e){const t=this.indices.get(D.T.POSITION),r=this.vertexAttributes.get(D.T.POSITION);return(0,I.NO)(r,t,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.indices.get(D.T.POSITION);if(0===e.length)return null;const t=this.primitiveType===R.MX.Triangle?3:1;(0,w.hu)(e.length%t==0,"Indexing error: "+e.length+" not divisible by "+t);const r=(0,I.p)(e.length/t),i=this.vertexAttributes.get(D.T.POSITION);return new y(r,t,e,i)}}function F(e){if(e.BYTES_PER_ELEMENT===Uint16Array.BYTES_PER_ELEMENT)return e;for(const t of e)if(t>=65536)return e;return new Uint16Array(e)}var H=r(74085),B=r(32448),U=r(22021),z=r(1533),G=r(17452),V=r(85958),W=r(99880);let q;var k;!function(e){e[e.ETC1_RGB=0]="ETC1_RGB",e[e.ETC2_RGBA=1]="ETC2_RGBA",e[e.BC1_RGB=2]="BC1_RGB",e[e.BC3_RGBA=3]="BC3_RGBA",e[e.BC4_R=4]="BC4_R",e[e.BC5_RG=5]="BC5_RG",e[e.BC7_M6_RGB=6]="BC7_M6_RGB",e[e.BC7_M5_RGBA=7]="BC7_M5_RGBA",e[e.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",e[e.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",e[e.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",e[e.ATC_RGB=11]="ATC_RGB",e[e.ATC_RGBA=12]="ATC_RGBA",e[e.FXT1_RGB=17]="FXT1_RGB",e[e.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",e[e.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",e[e.ETC2_EAC_R11=20]="ETC2_EAC_R11",e[e.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",e[e.RGBA32=13]="RGBA32",e[e.RGB565=14]="RGB565",e[e.BGR565=15]="BGR565",e[e.RGBA4444=16]="RGBA4444"}(k||(k={}));var $=r(35371),X=r(75656);function j(e,t,r,i,n=0){const o=e.gl,a=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);void 0===r&&console.error(`There is no location for vertex attribute '${e.name}' defined.`);const i=n*e.stride;if(e.count<=4)o.vertexAttribPointer(r,e.count,e.type,e.normalized,e.stride,e.offset+i),o.enableVertexAttribArray(r),e.divisor>0&&a&&a.vertexAttribDivisor(r,e.divisor);else if(9===e.count)for(let t=0;t<3;t++)o.vertexAttribPointer(r+t,3,e.type,e.normalized,e.stride,e.offset+12*t+i),o.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else if(16===e.count)for(let t=0;t<4;t++)o.vertexAttribPointer(r+t,4,e.type,e.normalized,e.stride,e.offset+16*t+i),o.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else console.error("Unsupported vertex attribute element count: "+e.count)}}function J(e,t,r,i){const n=e.gl,o=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);if(e.count<=4)n.disableVertexAttribArray(r),e.divisor&&e.divisor>0&&o&&o.vertexAttribDivisor(r,0);else if(9===e.count)for(let t=0;t<3;t++)n.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&o&&o.vertexAttribDivisor(r+t,0);else if(16===e.count)for(let t=0;t<4;t++)n.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&o&&o.vertexAttribDivisor(r+t,0);else console.error("Unsupported vertex attribute element count: "+e.count)}e.unbindBuffer($.w0.ARRAY_BUFFER)}function Y(e){switch(e){case $.VI.ALPHA:case $.VI.LUMINANCE:case $.VI.RED:case $.VI.RED_INTEGER:case $.lP.R8:case $.lP.R8I:case $.lP.R8UI:case $.lP.R8_SNORM:case $.Tg.STENCIL_INDEX8:return 1;case $.VI.LUMINANCE_ALPHA:case $.VI.RG:case $.VI.RG_INTEGER:case $.lP.RGBA4:case $.lP.R16F:case $.lP.R16I:case $.lP.R16UI:case $.lP.RG8:case $.lP.RG8I:case $.lP.RG8UI:case $.lP.RG8_SNORM:case $.lP.RGB565:case $.lP.RGB5_A1:case $.Tg.DEPTH_COMPONENT16:return 2;case $.VI.DEPTH_COMPONENT:case $.VI.RGB:case $.VI.RGB_INTEGER:case $.lP.RGB8:case $.lP.RGB8I:case $.lP.RGB8UI:case $.lP.RGB8_SNORM:case $.lP.SRGB8:case $.Tg.DEPTH_COMPONENT24:return 3;case $.VI.DEPTH_STENCIL:case $.VI.RGBA:case $.VI.RGBA_INTEGER:case $.lP.RGBA8:case $.lP.R32F:case $.lP.R11F_G11F_B10F:case $.lP.RG16F:case $.lP.R32I:case $.lP.R32UI:case $.lP.RG16I:case $.lP.RG16UI:case $.lP.RGBA8I:case $.lP.RGBA8UI:case $.lP.RGBA8_SNORM:case $.lP.SRGB8_ALPHA8:case $.lP.RGB9_E5:case $.lP.RGB10_A2UI:case $.lP.RGB10_A2:case $.Tg.DEPTH_STENCIL:case $.Tg.DEPTH_COMPONENT32F:case $.Tg.DEPTH24_STENCIL8:return 4;case $.Tg.DEPTH32F_STENCIL8:return 5;case $.lP.RGB16F:case $.lP.RGB16I:case $.lP.RGB16UI:return 6;case $.lP.RG32F:case $.lP.RG32I:case $.lP.RG32UI:case $.lP.RGBA16F:case $.lP.RGBA16I:case $.lP.RGBA16UI:return 8;case $.lP.RGB32F:case $.lP.RGB32I:case $.lP.RGB32UI:return 12;case $.lP.RGBA32F:case $.lP.RGBA32I:case $.lP.RGBA32UI:return 16;case $.q_.COMPRESSED_RGB_S3TC_DXT1_EXT:case $.q_.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case $.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT:case $.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case $.q_.COMPRESSED_R11_EAC:case $.q_.COMPRESSED_SIGNED_R11_EAC:case $.q_.COMPRESSED_RGB8_ETC2:case $.q_.COMPRESSED_SRGB8_ETC2:case $.q_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case $.q_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case $.q_.COMPRESSED_RG11_EAC:case $.q_.COMPRESSED_SIGNED_RG11_EAC:case $.q_.COMPRESSED_RGBA8_ETC2_EAC:case $.q_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}function Z(e){if((0,n.Wi)(e))return 0;if("descriptor"in e)return e.glName?Z(e.descriptor):0;const t=e.internalFormat||"pixelFormat"in e&&e.pixelFormat;if(!t)return 0;const r="hasMipmap"in e&&e.hasMipmap?1.3:1,i=e.width*e.height;return Y(t)*i*r}r(80442);let K=null,Q=null;async function ee(){return(0,n.Wi)(Q)&&(Q=function(){if((0,n.Wi)(q)){const e=e=>(0,W.V)(`esri/libs/basisu/${e}`);q=r.e(1421).then(r.bind(r,21421)).then((e=>e.b)).then((({default:t})=>t({locateFile:e}).then((e=>(e.initializeBasis(),delete e.then,e)))))}return q}(),K=await Q),Q}function te(e,t,r,i,n){const o=Y(t?$.q_.COMPRESSED_RGBA8_ETC2_EAC:$.q_.COMPRESSED_RGB8_ETC2),a=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*a)}function re(e){return e.getNumImages()>=1&&!e.isUASTC()}function ie(e){return e.getFaces()>=1&&e.isETC1S()}function ne(e,t,r,i,n,o,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[u,d]=l?i?[k.ETC2_RGBA,$.q_.COMPRESSED_RGBA8_ETC2_EAC]:[k.ETC1_RGB,$.q_.COMPRESSED_RGB8_ETC2]:c?i?[k.BC3_RGBA,$.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[k.BC1_RGB,$.q_.COMPRESSED_RGB_S3TC_DXT1_EXT]:[k.RGBA32,$.VI.RGBA],h=t.hasMipmap?r:Math.min(1,r),f=[];for(let e=0;e<h;e++)f.push(new Uint8Array(a(e,u))),s(e,u,f[e]);const m=f.length>1,p=m?$.cw.LINEAR_MIPMAP_LINEAR:$.cw.LINEAR,g={...t,samplingMode:p,hasMipmap:m,internalFormat:d,width:n,height:o};return new X.x(e,g,{type:"compressed",levels:f})}const oe=A.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function ae(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const se=ae("DXT1"),le=ae("DXT3"),ce=ae("DXT5");var ue=r(83475),de=r(21968);new de.G(D.T.POSITION,3,$.g.FLOAT,0,12),new de.G(D.T.POSITION,3,$.g.FLOAT,0,20),new de.G(D.T.UV0,2,$.g.FLOAT,12,20),new de.G(D.T.POSITION,3,$.g.FLOAT,0,32),new de.G(D.T.NORMAL,3,$.g.FLOAT,12,32),new de.G(D.T.UV0,2,$.g.FLOAT,24,32),new de.G(D.T.POSITION,3,$.g.FLOAT,0,16),new de.G(D.T.COLOR,4,$.g.UNSIGNED_BYTE,12,16);const he=[new de.G(D.T.POSITION,2,$.g.FLOAT,0,8)],fe=[new de.G(D.T.POSITION,2,$.g.FLOAT,0,16),new de.G(D.T.UV0,2,$.g.FLOAT,8,16)];var me=r(67676),pe=r(49300),ge=r(54738);const _e=A.Z.getLogger("esri.views.webgl.BufferObject");class ve{constructor(e,t,r,i){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment($._g.BufferObject,this),this._glName=this._context.gl.createBuffer(),(0,pe.zu)(this._context.gl),i&&this.setData(i)}static createIndex(e,t,r){return new ve(e,$.w0.ELEMENT_ARRAY_BUFFER,t,r)}static createVertex(e,t,r){return new ve(e,$.w0.ARRAY_BUFFER,t,r)}static createUniform(e,t,r){if(e.type!==ge.zO.WEBGL2)throw new Error("Uniform buffers are supported in WebGL2 only!");return new ve(e,$.w0.UNIFORM_BUFFER,t,r)}static createPixelPack(e,t=$.l1.STREAM_READ,r){if(e.type!==ge.zO.WEBGL2)throw new Error("Pixel pack buffers are supported in WebGL2 only!");const i=new ve(e,$.w0.PIXEL_PACK_BUFFER,t);return r&&i.setSize(r),i}static createPixelUnpack(e,t=$.l1.STREAM_DRAW,r){if(e.type!==ge.zO.WEBGL2)throw new Error("Pixel unpack buffers are supported in WebGL2 only!");return new ve(e,$.w0.PIXEL_UNPACK_BUFFER,t,r)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteSize(){return this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER?this._indexType===$.g.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER||this.bufferType===$.w0.ARRAY_BUFFER}dispose(){this._context?.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement($._g.BufferObject,this),this._context=null):this._glName&&_e.warn("Leaked WebGL buffer object")}setSize(e,t=null){if(e<=0&&_e.error("Buffer size needs to be positive!"),this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER&&(0,n.pC)(t))switch(this._indexType=t,t){case $.g.UNSIGNED_SHORT:e*=2;break;case $.g.UNSIGNED_INT:e*=4}this._setBufferData(e)}setData(e){if(!e)return;let t=e.byteLength;this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER&&((0,z.Uc)(e)&&(t/=2,this._indexType=$.g.UNSIGNED_SHORT),(0,z.ZY)(e)&&(t/=4,this._indexType=$.g.UNSIGNED_INT)),this._setBufferData(t,e)}_setBufferData(e,t=null){this._size=e;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;(0,n.pC)(t)?i.bufferData(this.bufferType,t,this.usage):i.bufferData(this.bufferType,e,this.usage),(0,pe.zu)(i),this._isVAOAware&&this._context.bindVAO(r)}setSubData(e,t=0,r=0,i=e.byteLength){if(!e)return;(t<0||t>=this._size)&&_e.error("offset is out of range!");let n=t,o=r,a=i,s=e.byteLength;this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER&&((0,z.Uc)(e)?(s/=2,n*=2,o*=2,a*=2):(0,z.ZY)(e)&&(s/=4,n*=4,o*=4,a*=4)),void 0===i&&(i=s-1),r>=i&&_e.error("end must be bigger than start!"),t+r-i>this._size&&_e.error("An attempt to write beyond the end of the buffer!");const l=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const c=this._context.gl,u=ArrayBuffer.isView(e)?e.buffer:e,d=0===o&&a===e.byteLength?u:u.slice(o,a);c.bufferSubData(this.bufferType,n,d),(0,pe.zu)(c),this._isVAOAware&&this._context.bindVAO(l)}setSubDataFromView(e,t,r,i){if(!e)return;(t<0||t>=this._size)&&_e.error("offset is out of range!"),r>=i&&_e.error("end must be bigger than start!"),t+r-i>this._size&&_e.error("An attempt to write beyond the end of the buffer!");const n=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const o=this._context.gl;if(this._context.type===ge.zO.WEBGL2)o.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,e,r,i-r);else{const n=0===r&&i===e.length?e:e.subarray(r,i);o.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,n)}(0,pe.zu)(o),this._isVAOAware&&this._context.bindVAO(n)}getSubData(e,t=0,r,i){if(this._context.type!==ge.zO.WEBGL2)return void _e.error("Get buffer subdata is supported in WebGL2 only!");if(r<0||i<0)return void _e.error("Problem getting subdata: offset and length were less than zero!");const n=function(e){return(0,me.zG)(e)}(e)?e.BYTES_PER_ELEMENT:1;if(n*((r??0)+(i??0))>e.byteLength)return void _e.error("Problem getting subdata: offset and length exceeded destination size!");t+n*(i??0)>this.byteSize&&_e.warn("Potential problem getting subdata: requested data exceeds buffer size!");const o=this._context.gl;this._context.bindBuffer(this,$.w0.COPY_READ_BUFFER),o.getBufferSubData($.w0.COPY_READ_BUFFER,t,e,r,i),this._context.unbindBuffer($.w0.COPY_READ_BUFFER)}async getSubDataAsync(e,t=0,r,i){this._context.type===ge.zO.WEBGL2?(await this._context.clientWaitAsync(),this.getSubData(e,t,r,i)):_e.error("Get buffer subdata is supported in WebGL2 only!")}}const Te=A.Z.getLogger("esri.views.webgl.VertexArrayObject");class xe{constructor(e,t,r,i,n=null){this._context=e,this._locations=t,this._layout=r,this._buffers=i,this._indexBuffer=n,this._glName=null,this._initialized=!1,e.instanceCounter.increment($._g.VertexArrayObject,this)}get glName(){return this._glName}get context(){return this._context}get vertexBuffers(){return this._buffers}get indexBuffer(){return this._indexBuffer}get size(){return Object.keys(this._buffers).reduce(((e,t)=>e+this._buffers[t].size),(0,n.pC)(this._indexBuffer)?this._indexBuffer.size:0)}get layout(){return this._layout}get locations(){return this._locations}dispose(e=!0){if(this._context){if(this._glName){const e=this._context?.capabilities?.vao;e?(e.deleteVertexArray(this._glName),this._glName=null):Te.warn("Leaked WebGL VAO")}if(this._context.getBoundVAO()===this&&this._context.bindVAO(null),e){for(const e in this._buffers)this._buffers[e].dispose(),delete this._buffers[e];this._indexBuffer=(0,n.O3)(this._indexBuffer)}this._context.instanceCounter.decrement($._g.VertexArrayObject,this),this._context=null}else(this._glName||e&&Object.getOwnPropertyNames(this._buffers).length>0)&&Te.warn("Leaked WebGL VAO")}initialize(){if(this._initialized)return;const e=this._context.capabilities.vao;if(e){const t=e.createVertexArray();e.bindVertexArray(t),this._bindLayout(),e.bindVertexArray(null),this._glName=t}this._initialized=!0}bind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(this.glName):(this._context.bindVAO(null),this._bindLayout())}_bindLayout(){const{_buffers:e,_layout:t,_indexBuffer:r}=this;e||Te.error("Vertex buffer dictionary is empty!");const i=this._context.gl;for(const r in e){const i=e[r];i||Te.error("Vertex buffer is uninitialized!");const n=t[r];n||Te.error("Vertex element descriptor is empty!"),j(this._context,this._locations,i,n)}(0,n.pC)(r)&&(this._context.capabilities.vao?i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,r.glName):this._context.bindBuffer(r))}unbind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(null):this._unbindLayout()}_unbindLayout(){const{_buffers:e,_layout:t}=this;e||Te.error("Vertex buffer dictionary is empty!");for(const r in e){const i=e[r];i||Te.error("Vertex buffer is uninitialized!");const n=t[r];J(this._context,this._locations,i,n)}(0,n.pC)(this._indexBuffer)&&this._context.unbindBuffer(this._indexBuffer.bufferType)}}class be{constructor(e,t){this._context=e,this._desc=t,this.type="renderbuffer",this._context.instanceCounter.increment($._g.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:i,height:n,internalFormat:o,multisampled:a}=t;if(a){if(this._context.type!==ge.zO.WEBGL2)throw new Error("Multisampled renderbuffers are not supported in WebGL1!");r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,i,n)}else r.renderbufferStorage(r.RENDERBUFFER,o,i,n)}get descriptor(){return this._desc}get samples(){const e=this._desc.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}resize(e,t){const r=this._desc;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const i=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement($._g.Renderbuffer,this),this._context=null)}}const Ae=A.Z.getLogger("esri.views.webgl.FrameBufferObject");class Ee{constructor(e,t,r=null,i=null){if(this._context=e,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...t},e.instanceCounter.increment($._g.FramebufferObject,this),(0,n.pC)(r)){Array.isArray(r)||(r=[r]);for(let e=0;e<r.length;++e){const t=r[e],i=$.VY.COLOR_ATTACHMENT0+e;let n;Re(t)?(Se(t)?(n=t.descriptor,this._colorAttachments.set(i,t)):(n=t,this._colorAttachments.set(i,new X.x(this._context,n))),Ce(n,this._desc)):(Me(t)?(n=t.descriptor,this._colorAttachments.set(i,t)):(n=t,this._colorAttachments.set(i,new be(this._context,n))),we(n,this._desc)),this._validateColorAttachmentPoint(i)}}if((0,n.pC)(i)){let e,t;if(Re(i))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),Se(i)?(t=i.descriptor,this._depthStencilTexture=i):(t=i,this._depthStencilTexture=new X.x(this._context,t)),Ce(t,this._desc);else{Me(i)?(t=i.descriptor,e=i):(t=i,e=new be(this._context,t));const r=this._desc.depthStencilTarget??$.OU.DEPTH_STENCIL_RENDER_BUFFER;r===$.OU.STENCIL_RENDER_BUFFER?this._stencilAttachment=e:r===$.OU.DEPTH_RENDER_BUFFER||r===$.OU.DEPTH_STENCIL_RENDER_BUFFER?this._depthAttachment=e:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),we(t,this._desc)}}}dispose(){if(!this._desc)return;const e=this._context.getBoundFramebufferObject();this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName&&(this._context.gl.deleteFramebuffer(this._glName),this._glName=null),this._context.bindFramebuffer(e),this._context.instanceCounter.decrement($._g.FramebufferObject,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const e=this._colorAttachments.get($.VY.COLOR_ATTACHMENT0);return e&&Se(e)?e:null}get colorAttachment(){return this._colorAttachments.get($.VY.COLOR_ATTACHMENT0)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return[...this._colorAttachments].reduce(((e,[t,r])=>e+Z(r)),0)+Z(this.depthStencilAttachment)}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&Se(t)?t:null}attachColorTexture(e,t=$.VY.COLOR_ATTACHMENT0){e&&(this._validateColorAttachmentPoint(t),Ce(e.descriptor,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t)),this._colorAttachments.set(t,e))}detachColorTexture(e=$.VY.COLOR_ATTACHMENT0){const t=this._colorAttachments.get(e);if(Se(t)){const r=t;return this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e)),this._colorAttachments.delete(e),r}}setColorTextureTarget(e,t=$.VY.COLOR_ATTACHMENT0){const r=this._colorAttachments.get(t);Se(r)&&this._framebufferTexture2D(r.glName,t,e)}attachDepthStencilTexture(e){if((0,n.Wi)(e))return;const t=e.descriptor;t.pixelFormat!==$.VI.DEPTH_STENCIL&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),t.dataType!==$.Br.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),Ce(t,this._desc),this._desc.depthStencilTarget&&this._desc.depthStencilTarget!==$.OU.DEPTH_STENCIL_TEXTURE&&(this._desc.depthStencilTarget=$.OU.DEPTH_STENCIL_TEXTURE),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,$.Lu)),this._depthStencilTexture=e}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,$.Lu)),this._depthStencilTexture=null,e}attachDepthStencilBuffer(e){if((0,n.Wi)(e))return;const t=e.descriptor;if(t.internalFormat!==$.Tg.DEPTH_STENCIL&&t.internalFormat!==$.Tg.DEPTH_COMPONENT16&&console.error("Depth/Stencil buffer must have correct internalFormat"),we(t,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=t.internalFormat===$.Tg.DEPTH_STENCIL?$.OU.DEPTH_STENCIL_RENDER_BUFFER:$.OU.DEPTH_RENDER_BUFFER,this._initialized){this._context.bindFramebuffer(this);const t=this._context.gl,r=this._desc.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer($.qi.FRAMEBUFFER,r,t.RENDERBUFFER,e.glName)}this._depthAttachment=e}detachDepthStencilBuffer(){const e=this._context.gl,t=this._depthAttachment;if(t&&this._initialized){this._context.bindFramebuffer(this);const t=this._desc.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer($.qi.FRAMEBUFFER,t,e.RENDERBUFFER,null)}return this._depthAttachment=null,t}detachAll(){this._colorAttachments.forEach(((e,t)=>this._detachColorAttachment(t))),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(e,t,r,i,n,o,a){(e<0||t<0||n<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const s=this._desc,l=a.descriptor;a.descriptor.target!==$.No.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(e+r>s.width||t+i>s.height||n+r>l.width||o+i>l.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,u=c.bindTexture(a,X.x.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(X.x.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D($.No.TEXTURE_2D,0,n,o,e,t,r,i),c.bindTexture(u,X.x.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,n,o,a){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,n,o,a)}async readPixelsAsync(e,t,r,i,n,o,a){if(this._context.type!==ge.zO.WEBGL2)return(0,pe.hZ)()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(e,t,r,i,n,o,a);const s=this._context.gl,l=ve.createPixelPack(this._context,$.l1.STREAM_READ,a.byteLength);this._context.bindBuffer(l),this._context.bindFramebuffer(this),s.readPixels(e,t,r,i,n,o,0),this._context.unbindBuffer($.w0.PIXEL_PACK_BUFFER),await l.getSubDataAsync(a),l.dispose()}resize(e,t){const r=this._desc;if(r.width!==e||r.height!==t){if(!this._initialized)return r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(e,t));r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(e,t):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(e,t),this._stencilAttachment&&this._stencilAttachment.resize(e,t)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(e=$.qi.FRAMEBUFFER){const t=this._context.gl;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=this._context,i=t.createFramebuffer(),n=this._desc,o=n.colorTarget??$.Lm.RENDER_BUFFER,a=n.width??1,s=n.height??1;if(t.bindFramebuffer(e,i),0===this._colorAttachments.size)if(o===$.Lm.TEXTURE||o===$.Lm.CUBEMAP)this._colorAttachments.set($.VY.COLOR_ATTACHMENT0,function(e,t,r){return new X.x(e,{target:r,pixelFormat:$.VI.RGBA,dataType:$.Br.UNSIGNED_BYTE,samplingMode:$.cw.NEAREST,wrapMode:$.e8.CLAMP_TO_EDGE,width:t.width,height:t.height})}(r,n,this.descriptor.colorTarget===$.Lm.CUBEMAP?$.No.TEXTURE_CUBE_MAP:$.No.TEXTURE_2D));else{const e=new be(r,{internalFormat:$.lP.RGBA4,width:a,height:s});this._colorAttachments.set($.VY.COLOR_ATTACHMENT0,e)}this._colorAttachments.forEach(((r,i)=>{r&&(Se(r)?this._framebufferTexture2D(r.glName,i,ye(r),e):t.framebufferRenderbuffer(e,i,t.RENDERBUFFER,r.glName))}));const l=n.depthStencilTarget??$.OU.NONE;switch(l){case $.OU.DEPTH_RENDER_BUFFER:case $.OU.DEPTH_STENCIL_RENDER_BUFFER:{this._depthAttachment||(this._depthAttachment=new be(r,{internalFormat:n.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?$.Tg.DEPTH_COMPONENT16:$.Tg.DEPTH_STENCIL,width:a,height:s}));const i=l===$.OU.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(e,i,t.RENDERBUFFER,this._depthAttachment.glName);break}case $.OU.STENCIL_RENDER_BUFFER:this._stencilAttachment||(this._stencilAttachment=new be(r,{internalFormat:$.Tg.STENCIL_INDEX8,width:a,height:s})),t.framebufferRenderbuffer(e,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,this._stencilAttachment.glName);break;case $.OU.DEPTH_STENCIL_TEXTURE:if(!this._depthStencilTexture){r.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const e={target:$.No.TEXTURE_2D,pixelFormat:$.VI.DEPTH_STENCIL,dataType:$.Br.UNSIGNED_INT_24_8,samplingMode:$.cw.NEAREST,wrapMode:$.e8.CLAMP_TO_EDGE,width:a,height:s};this._depthStencilTexture=new X.x(r,e)}this._framebufferTexture2D(this._depthStencilTexture.glName,t.DEPTH_STENCIL_ATTACHMENT,ye(this._depthStencilTexture),e)}(0,pe.CG)()&&t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=i,this._initialized=!0}_framebufferTexture2D(e,t=$.VY.COLOR_ATTACHMENT0,r=$.No.TEXTURE_2D,i=$.qi.FRAMEBUFFER,n=0){this._context.gl.framebufferTexture2D(i,t,r,e,n)}_detachColorAttachment(e){(0,pe.hZ)()&&console.warn("Detaching an FBO attachment can be a slow due to invalidating framebuffer completeness!");const t=this._context.gl,r=this._colorAttachments.get(e);return Se(r)?this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e)):this._initialized&&(this._context.bindFramebuffer(this),t.framebufferRenderbuffer($.qi.FRAMEBUFFER,e,t.RENDERBUFFER,null)),this._colorAttachments.delete(e),r}_disposeColorAttachments(){this._colorAttachments.forEach(((e,t)=>{this._detachColorAttachment(t),e.dispose()})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const t=this._desc.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer($.qi.FRAMEBUFFER,t,e.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer($.qi.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateColorAttachmentPoint(e){if(-1===Ee._MAX_COLOR_ATTACHMENTS){const e=this._context.capabilities.drawBuffers;if(e){const t=this._context.gl;Ee._MAX_COLOR_ATTACHMENTS=t.getParameter(e.MAX_COLOR_ATTACHMENTS)}else Ee._MAX_COLOR_ATTACHMENTS=1}const t=e-$.VY.COLOR_ATTACHMENT0;t+1>Ee._MAX_COLOR_ATTACHMENTS&&Ae.error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${Ee._MAX_COLOR_ATTACHMENTS} color attachments`)}}function Se(e){return"type"in e&&"texture"===e.type}function Me(e){return"type"in e&&"renderbuffer"===e.type}function Re(e){return Se(e)||"pixelFormat"in e}function Ce(e,t){e.target!==$.No.TEXTURE_2D&&e.target!==$.No.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Color attachment texture must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}function we(e,t){void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}function ye(e){return e.descriptor.target===$.No.TEXTURE_CUBE_MAP?$.No.TEXTURE_CUBE_MAP_POSITIVE_X:$.No.TEXTURE_2D}Ee._MAX_COLOR_ATTACHMENTS=-1;var Oe,Pe,Ne=r(46314);class Ie extends P.c{constructor(e,t){super(),this.data=e,this.type=N.U.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new B.Z,this.params=t||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:$.e8.REPEAT,t:$.e8.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||R.CE.STRETCH,this.estimatedTexMemRequired=Ie._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const e=this.data;(0,n.Wi)(e)||(e instanceof HTMLVideoElement?this._startPreloadVideoElement(e):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!((0,G.jc)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,G.HK)(e.src)||(0,G.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}static _getDataDimensions(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}static _estimateTexMemRequired(e,t){if((0,n.Wi)(e))return 0;if((0,z.eP)(e)||(0,z.lq)(e))return t.encoding===Ie.KTX2_ENCODING?function(e,t){if((0,n.Wi)(K))return e.byteLength;const r=new K.KTX2File(new Uint8Array(e)),i=ie(r)?te(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,t.mipmap):t.encoding===Ie.BASIS_ENCODING?function(e,t){if((0,n.Wi)(K))return e.byteLength;const r=new K.BasisFile(new Uint8Array(e)),i=re(r)?te(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Ie._getDataDimensions(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(e){return{target:$.No.TEXTURE_2D,pixelFormat:$.VI.RGBA,dataType:$.Br.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?$.cw.LINEAR_MIPMAP_LINEAR:$.cw.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:this.params.maxAnisotropy??(this.params.mipmap?e.parameters.maxMaxAnisotropy:1)}}get glTexture(){return this._glTexture}load(e,t){if((0,n.pC)(this._glTexture))return this._glTexture;if((0,n.pC)(this._loadingPromise))return this._loadingPromise;const r=this.data;return(0,n.Wi)(r)?(this._glTexture=new X.x(e,this._createDescriptor(e),null),this._glTexture):"string"==typeof r?this._loadFromURL(e,t,r):r instanceof Image?this._loadFromImageElement(e,t,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(e,t,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(e,r,t):((0,z.eP)(r)||(0,z.lq)(r))&&this.params.encoding===Ie.DDS_ENCODING?(this.data=void 0,this._loadFromDDSData(e,r)):((0,z.eP)(r)||(0,z.lq)(r))&&this.params.encoding===Ie.KTX2_ENCODING?(this.data=void 0,this._loadFromKTX2(e,r)):((0,z.eP)(r)||(0,z.lq)(r))&&this.params.encoding===Ie.BASIS_ENCODING?(this.data=void 0,this._loadFromBasis(e,r)):(0,z.lq)(r)?this._loadFromPixelData(e,r):(0,z.eP)(r)?this._loadFromPixelData(e,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(e,t,r){if(!(this.data instanceof HTMLVideoElement)||(0,n.Wi)(this._glTexture))return r;if(this.data.readyState<Oe.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if((0,n.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:n}=this._powerOfTwoStretchInfo;n.setData(this.data),this._drawStretchedTexture(e,t,r,i,n,this._glTexture)}else{const{videoWidth:e,videoHeight:t}=this.data,{width:r,height:i}=this._glTexture.descriptor;e!==r||t!==i?this._glTexture.updateData(0,0,0,Math.min(e,r),Math.min(t,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.params.updateCallback&&this.params.updateCallback(),this.data.currentTime}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const{textureData:i,internalFormat:n,width:o,height:a}=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return oe.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return oe.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case se:n=8,o=$.q_.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case le:n=16,o=$.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case ce:n=16,o=$.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return oe.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];0==(3&s)&&0==(3&l)||(oe.warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,u=l;let d,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7])),1===a||(0,U.wt)(s)&&(0,U.wt)(l)||(oe.warn("Ignoring mipmaps of non power of two sized compressed texture."),a=1);let f=r[1]+4;const m=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*n,d=new Uint8Array(e,f,h),m.push(d),f+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:m},internalFormat:o,width:c,height:u}}(r,t.hasMipmap);return t.samplingMode=i.levels.length>1?$.cw.LINEAR_MIPMAP_LINEAR:$.cw.LINEAR,t.hasMipmap=i.levels.length>1,t.internalFormat=n,t.width=o,t.height=a,new X.x(e,t,i)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>async function(e,t,r){(0,n.Wi)(K)&&(K=await ee());const i=new K.KTX2File(new Uint8Array(r));if(!ie(i))return null;i.startTranscoding();const o=ne(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(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>async function(e,t,r){(0,n.Wi)(K)&&(K=await ee());const i=new K.BasisFile(new Uint8Array(r));if(!re(i))return null;i.startTranscoding();const o=ne(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(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){(0,w.hu)(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this.params.components?$.VI.LUMINANCE:3===this.params.components?$.VI.RGB:$.VI.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new X.x(e,r,t),this._glTexture}_loadFromURL(e,t,r){return this._loadAsync((async i=>{const n=await M(r,{signal:i});return(0,E.k_)(i),this._loadFromImage(e,n,t)}))}_loadFromImageElement(e,t,r){return r.complete?this._loadFromImage(e,r,t):this._loadAsync((async i=>{const n=await(0,V.fY)(r,r.src,!1,i);return(0,E.k_)(i),this._loadFromImage(e,n,t)}))}_loadFromVideoElement(e,t,r){return r.readyState>=Oe.HAVE_CURRENT_DATA?this._loadFromImage(e,r,t):this._loadFromVideoElementAsync(e,t,r)}_loadFromVideoElementAsync(e,t,r){return this._loadAsync((i=>new Promise(((o,a)=>{const s=()=>{r.removeEventListener("loadeddata",l),r.removeEventListener("error",c),(0,n.hw)(u)},l=()=>{r.readyState>=Oe.HAVE_CURRENT_DATA&&(s(),o(this._loadFromImage(e,r,t)))},c=e=>{s(),a(e||new b.Z("Failed to load video"))};r.addEventListener("loadeddata",l),r.addEventListener("error",c);const u=(0,E.fu)(i,(()=>c((0,E.zE)())))}))))}_loadFromImage(e,t,r){const i=Ie._getDataDimensions(t);this.params.width=i.width,this.params.height=i.height;const n=this._createDescriptor(e);return n.pixelFormat=3===this.params.components?$.VI.RGB:$.VI.RGBA,!this._requiresPowerOfTwo(e,n)||(0,U.wt)(i.width)&&(0,U.wt)(i.height)?(n.width=i.width,n.height=i.height,this._glTexture=new X.x(e,n,t),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(e,t,i,n,r),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)};return r.then(i,i),r}_requiresPowerOfTwo(e,t){const r=$.e8.CLAMP_TO_EDGE,i="number"==typeof t.wrapMode?t.wrapMode===r:t.wrapMode.s===r&&t.wrapMode.t===r;return!(0,Ne.Z)(e.gl)&&(t.hasMipmap||!i)}_makePowerOfTwoTexture(e,t,r,i,n){const{width:o,height:a}=r,s=(0,U.Sf)(o),l=(0,U.Sf)(a);let c;switch(i.width=s,i.height=l,this.params.powerOfTwoResizeMode){case R.CE.PAD:i.textureCoordinateScaleFactor=[o/s,a/l],c=new X.x(e,i),c.updateData(0,0,0,o,a,t);break;case R.CE.STRETCH:case null:case void 0:c=this._stretchToPowerOfTwo(e,t,i,n());break;default:(0,H.Bg)(this.params.powerOfTwoResizeMode)}return i.hasMipmap&&c.generateMipmap(),c}_stretchToPowerOfTwo(e,t,r,i){const n=new X.x(e,r),o=new Ee(e,{colorTarget:$.Lm.TEXTURE,depthStencilTarget:$.OU.NONE},n),a=new X.x(e,{target:$.No.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:$.Br.UNSIGNED_BYTE,wrapMode:$.e8.CLAMP_TO_EDGE,samplingMode:$.cw.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},t),s=function(e,t=he,r=ue.i,i=-1,n=1){let o=null;return o=t===fe?new Float32Array([i,i,0,0,n,i,1,0,i,n,0,1,n,n,1,1]):new Float32Array([i,i,n,i,i,n,n,n]),new xe(e,r,{geometry:t},{geometry:ve.createVertex(e,$.l1.STATIC_DRAW,o)})}(e),l=e.getBoundFramebufferObject();return this._drawStretchedTexture(e,i,o,s,a,n),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:s,sourceTexture:a,framebuffer:o}:(s.dispose(!0),a.dispose(),o.detachColorTexture(),o.dispose()),e.bindFramebuffer(l),n}_drawStretchedTexture(e,t,r,i,n,o){e.bindFramebuffer(r);const a=e.getViewport();e.setViewport(0,0,o.descriptor.width,o.descriptor.height);const s=e.bindTechnique(t);s.setUniform4f("uColor",1,1,1,1),s.bindTexture("tex",n),e.bindVAO(i),e.drawArrays($.MX.TRIANGLE_STRIP,0,function(e,t){return e.vertexBuffers[t].size/function(e){return e[0].stride}(e.layout[t])}(i,"geometry")),e.bindFramebuffer(null),e.setViewport(a.x,a.y,a.width,a.height)}unload(){if((0,n.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:e,vao:t,sourceTexture:r}=this._powerOfTwoStretchInfo;t.dispose(!0),r.dispose(),e.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if((0,n.pC)(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),(0,n.pC)(this._loadingController)){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}Ie.DDS_ENCODING="image/vnd-ms.dds",Ie.KTX2_ENCODING="image/ktx2",Ie.BASIS_ENCODING="image/x.basis",(Pe=Oe||(Oe={}))[Pe.HAVE_NOTHING=0]="HAVE_NOTHING",Pe[Pe.HAVE_METADATA=1]="HAVE_METADATA",Pe[Pe.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",Pe[Pe.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",Pe[Pe.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";var De=r(64822),Le=r(65576),Fe=r(18361),He=r(64267),Be=r(19419),Ue=r(85504),ze=r(60537),Ge=r(82791);function Ve(e,t,r=$.db.ADD,i=[0,0,0,0]){return{srcRgb:e,srcAlpha:e,dstRgb:t,dstAlpha:t,opRgb:r,opAlpha:r,color:{r:i[0],g:i[1],b:i[2],a:i[3]}}}const We={face:$.LR.BACK,mode:$.Wf.CCW},qe={face:$.LR.FRONT,mode:$.Wf.CCW},ke=e=>e===R.Vr.Back?We:e===R.Vr.Front?qe:null,$e={zNear:0,zFar:1},Xe={r:!0,g:!0,b:!0,a:!0};function je(e){return nt.intern(e)}function Je(e){return at.intern(e)}function Ye(e){return lt.intern(e)}function Ze(e){return ut.intern(e)}function Ke(e){return ht.intern(e)}function Qe(e){return mt.intern(e)}function et(e){return gt.intern(e)}function tt(e){return vt.intern(e)}class rt{constructor(e,t){this.makeKey=e,this.makeRef=t,this.interns=new Map}intern(e){if(!e)return null;const t=this.makeKey(e),r=this.interns;return r.has(t)||r.set(t,this.makeRef(e)),r.get(t)}}function it(e){return"["+e.join(",")+"]"}const nt=new rt(ot,(e=>({__tag:"Blending",...e})));function ot(e){return e?it([e.srcRgb,e.srcAlpha,e.dstRgb,e.dstAlpha,e.opRgb,e.opAlpha,e.color.r,e.color.g,e.color.b,e.color.a]):null}const at=new rt(st,(e=>({__tag:"Culling",...e})));function st(e){return e?it([e.face,e.mode]):null}const lt=new rt(ct,(e=>({__tag:"PolygonOffset",...e})));function ct(e){return e?it([e.factor,e.units]):null}const ut=new rt(dt,(e=>({__tag:"DepthTest",...e})));function dt(e){return e?it([e.func]):null}const ht=new rt(ft,(e=>({__tag:"StencilTest",...e})));function ft(e){return e?it([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const mt=new rt(pt,(e=>({__tag:"DepthWrite",...e})));function pt(e){return e?it([e.zNear,e.zFar]):null}const gt=new rt(_t,(e=>({__tag:"ColorWrite",...e})));function _t(e){return e?it([e.r,e.g,e.b,e.a]):null}const vt=new rt(Tt,(e=>({__tag:"StencilWrite",...e})));function Tt(e){return e?it([e.mask]):null}const xt=new rt((function(e){return e?it([ot(e.blending),st(e.culling),ct(e.polygonOffset),dt(e.depthTest),ft(e.stencilTest),pt(e.depthWrite),_t(e.colorWrite),Tt(e.stencilWrite)]):null}),(e=>({blending:je(e.blending),culling:Je(e.culling),polygonOffset:Ye(e.polygonOffset),depthTest:Ze(e.depthTest),stencilTest:Ke(e.stencilTest),depthWrite:Qe(e.depthWrite),colorWrite:et(e.colorWrite),stencilWrite:tt(e.stencilWrite)}))),bt=function(e,t,r,i,n=$.db.ADD,o=$.db.ADD,a=[0,0,0,0]){return{srcRgb:e,srcAlpha:t,dstRgb:r,dstAlpha:i,opRgb:n,opAlpha:o,color:{r:a[0],g:a[1],b:a[2],a:a[3]}}}($.zi.SRC_ALPHA,$.zi.ONE,$.zi.ONE_MINUS_SRC_ALPHA,$.zi.ONE_MINUS_SRC_ALPHA),At=Ve($.zi.ONE,$.zi.ONE),Et=Ve($.zi.ZERO,$.zi.ONE_MINUS_SRC_ALPHA);function St(e){return e===R.Am.FrontFace?null:e===R.Am.Alpha?Et:At}const Mt={factor:-1,units:-2};function Rt(e,t=$.wb.LESS){return e===R.Am.NONE||e===R.Am.FrontFace?t:$.wb.LEQUAL}var Ct,wt,yt,Ot;(Ot=Ct||(Ct={}))[Ot.MATERIAL=0]="MATERIAL",Ot[Ot.MATERIAL_ALPHA=1]="MATERIAL_ALPHA",Ot[Ot.MATERIAL_DEPTH=2]="MATERIAL_DEPTH",Ot[Ot.MATERIAL_NORMAL=3]="MATERIAL_NORMAL",Ot[Ot.MATERIAL_DEPTH_SHADOWMAP_ALL=4]="MATERIAL_DEPTH_SHADOWMAP_ALL",Ot[Ot.MATERIAL_HIGHLIGHT=5]="MATERIAL_HIGHLIGHT",Ot[Ot.MATERIAL_DEPTH_SHADOWMAP_DEFAULT=6]="MATERIAL_DEPTH_SHADOWMAP_DEFAULT",Ot[Ot.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT=7]="MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT",(yt=wt||(wt={}))[yt.INTEGRATED_MESH=0]="INTEGRATED_MESH",yt[yt.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",yt[yt.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",yt[yt.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",yt[yt.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",yt[yt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",yt[yt.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",yt[yt.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",yt[yt.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",yt[yt.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",yt[yt.POSTPROCESSING_ENVIRONMENT_OPAQUE=10]="POSTPROCESSING_ENVIRONMENT_OPAQUE",yt[yt.POSTPROCESSING_ENVIRONMENT_TRANSPARENT=11]="POSTPROCESSING_ENVIRONMENT_TRANSPARENT",yt[yt.LASERLINES=12]="LASERLINES",yt[yt.LASERLINES_CONTRAST_CONTROL=13]="LASERLINES_CONTRAST_CONTROL",yt[yt.HUD_MATERIAL=14]="HUD_MATERIAL",yt[yt.LABEL_MATERIAL=15]="LABEL_MATERIAL",yt[yt.LINE_CALLOUTS=16]="LINE_CALLOUTS",yt[yt.LINE_CALLOUTS_HUD_DEPTH=17]="LINE_CALLOUTS_HUD_DEPTH",yt[yt.DRAPED_MATERIAL=18]="DRAPED_MATERIAL",yt[yt.DRAPED_WATER=19]="DRAPED_WATER",yt[yt.VOXEL=20]="VOXEL",yt[yt.MAX_SLOTS=21]="MAX_SLOTS";var Pt=r(51305),Nt=r(94961),It=r(72119),Dt=r(2643);const Lt=(0,u.c)(),Ft=(0,u.c)(),Ht=(0,u.c)(),Bt=new class{constructor(e=0){this.offset=e,this.sphere=(0,Dt.c)(),this.tmpVertex=(0,u.c)()}applyToVertex(e,t,r){const i=this.objectTransform.transform;let n=i[0]*e+i[4]*t+i[8]*r+i[12],o=i[1]*e+i[5]*t+i[9]*r+i[13],a=i[2]*e+i[6]*t+i[10]*r+i[14];const s=this.offset/Math.sqrt(n*n+o*o+a*a);n+=n*s,o+=o*s,a+=a*s;const l=this.objectTransform.inverse;return this.tmpVertex[0]=l[0]*n+l[4]*o+l[8]*a+l[12],this.tmpVertex[1]=l[1]*n+l[5]*o+l[9]*a+l[13],this.tmpVertex[2]=l[2]*n+l[6]*o+l[10]*a+l[14],this.tmpVertex}applyToMinMax(e,t){const r=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*r,e[1]+=e[1]*r,e[2]+=e[2]*r;const i=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*i,t[1]+=t[1]*i,t[2]+=t[2]*i}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.sphere[0]=e[0]+e[0]*r,this.sphere[1]=e[1]+e[1]*r,this.sphere[2]=e[2]+e[2]*r,this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.componentLocalOriginLength=0,this._tmpVertex=(0,u.c)(),this._mbs=(0,Dt.c)(),this._obb={center:(0,u.c)(),halfSize:(0,It.c)(),quaternion:null},this._totalOffset=0,this._offset=0,this._resetOffset(e)}_resetOffset(e){this._offset=e,this._totalOffset=e}set offset(e){this._resetOffset(e)}get offset(){return this._offset}set componentOffset(e){this._totalOffset=this._offset+e}set localOrigin(e){this.componentLocalOriginLength=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}applyToVertex(e,t,r){const i=e,n=t,o=r+this.componentLocalOriginLength,a=this._totalOffset/Math.sqrt(i*i+n*n+o*o);return this._tmpVertex[0]=e+i*a,this._tmpVertex[1]=t+n*a,this._tmpVertex[2]=r+o*a,this._tmpVertex}applyToAabb(e){const t=e[0],r=e[1],i=e[2]+this.componentLocalOriginLength,n=e[3],o=e[4],a=e[5]+this.componentLocalOriginLength,s=this._totalOffset/Math.sqrt(t*t+r*r+i*i);e[0]+=t*s,e[1]+=r*s,e[2]+=i*s;const l=this._totalOffset/Math.sqrt(n*n+o*o+a*a);return e[3]+=n*l,e[4]+=o*l,e[5]+=a*l,e}applyToMbs(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this._totalOffset/t;return this._mbs[0]=e[0]+e[0]*r,this._mbs[1]=e[1]+e[1]*r,this._mbs[2]=e[2]+e[2]*r,this._mbs[3]=e[3]+e[3]*this._totalOffset/t,this._mbs}applyToObb(e){const t=e.center,r=this._totalOffset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this._obb.center[0]=t[0]+t[0]*r,this._obb.center[1]=t[1]+t[1]*r,this._obb.center[2]=t[2]+t[2]*r,(0,c.q)(this._obb.halfSize,e.halfSize,e.quaternion),(0,c.a)(this._obb.halfSize,this._obb.halfSize,e.center);const i=this._totalOffset/Math.sqrt(this._obb.halfSize[0]*this._obb.halfSize[0]+this._obb.halfSize[1]*this._obb.halfSize[1]+this._obb.halfSize[2]*this._obb.halfSize[2]);return this._obb.halfSize[0]+=this._obb.halfSize[0]*i,this._obb.halfSize[1]+=this._obb.halfSize[1]*i,this._obb.halfSize[2]+=this._obb.halfSize[2]*i,(0,c.b)(this._obb.halfSize,this._obb.halfSize,e.center),(0,Pt.c)(Ut,e.quaternion),(0,c.q)(this._obb.halfSize,this._obb.halfSize,Ut),this._obb.halfSize[0]*=this._obb.halfSize[0]<0?-1:1,this._obb.halfSize[1]*=this._obb.halfSize[1]<0?-1:1,this._obb.halfSize[2]*=this._obb.halfSize[2]<0?-1:1,this._obb.quaternion=e.quaternion,this._obb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,u.c)()}applyToVertex(e,t,r){const i=e+this.localOrigin[0],n=t+this.localOrigin[1],o=r+this.localOrigin[2],a=this.offset/Math.sqrt(i*i+n*n+o*o);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+n*a,this.tmpVertex[2]=r+o*a,this.tmpVertex}applyToAabb(e){for(let t=0;t<3;++t)Lt[t]=e[0+t]+this.localOrigin[t],Ft[t]=e[3+t]+this.localOrigin[t],Ht[t]=Lt[t];const t=this.applyToVertex(Lt[0],Lt[1],Lt[2]);for(let r=0;r<3;++r)e[r]=t[r],e[r+3]=t[r];const r=t=>{const r=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t+0]=Math.min(e[t+0],r[t]),e[t+3]=Math.max(e[t+3],r[t])};for(let e=1;e<8;++e){for(let t=0;t<3;++t)Ht[t]=0==(e&1<<t)?Lt[t]:Ft[t];r(Ht)}let i=0;for(let e=0;e<3;++e)Lt[e]*Ft[e]<0&&(i|=1<<e);if(0!==i&&7!==i)for(let e=0;e<8;++e)if(0==(i&e)){for(let t=0;t<3;++t)i[t]?Ht[t]=0:Ht[t]=0!=(e&1<<t)?Lt[t]:Ft[t];r(Ht)}for(let t=0;t<3;++t)e[t+0]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const Ut=(0,Nt.a)();function zt(e,t,r,i){const n=r.typedBuffer,o=r.typedBufferStride,a=e.length;i*=o;for(let r=0;r<a;++r){const a=2*e[r];n[i]=t[a],n[i+1]=t[a+1],i+=o}}function Gt(e,t,r,i,n){const o=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==n||1===n)for(let r=0;r<s;++r){const n=3*e[r];o[i]=t[n],o[i+1]=t[n+1],o[i+2]=t[n+2],i+=a}else for(let r=0;r<s;++r){const s=3*e[r];for(let e=0;e<n;++e)o[i]=t[s],o[i+1]=t[s+1],o[i+2]=t[s+2],i+=a}}function Vt(e,t,r,i,n,o=1){if(!r)return void Gt(e,t,i,n,o);const a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],u=r[1],d=r[2],h=r[4],f=r[5],m=r[6],p=r[8],g=r[9],_=r[10],v=r[12],T=r[13],x=r[14];if(n*=s,1===o)for(let r=0;r<l;++r){const i=3*e[r],o=t[i],l=t[i+1],b=t[i+2];a[n]=c*o+h*l+p*b+v,a[n+1]=u*o+f*l+g*b+T,a[n+2]=d*o+m*l+_*b+x,n+=s}else for(let r=0;r<l;++r){const i=3*e[r],l=t[i],b=t[i+1],A=t[i+2],E=c*l+h*b+p*A+v,S=u*l+f*b+g*A+T,M=d*l+m*b+_*A+x;for(let e=0;e<o;++e)a[n]=E,a[n+1]=S,a[n+2]=M,n+=s}}function Wt(e,t,r,i,n,o=1){if(!r)return void Gt(e,t,i,n,o);const a=r,l=i.typedBuffer,c=i.typedBufferStride,u=e.length,d=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],_=a[8],v=a[9],T=a[10],x=!(0,s.p)(a),b=1e-6,A=1-b;if(n*=c,1===o)for(let r=0;r<u;++r){const i=3*e[r],o=t[i],a=t[i+1],s=t[i+2];let u=d*o+m*a+_*s,E=h*o+p*a+v*s,S=f*o+g*a+T*s;if(x){const e=u*u+E*E+S*S;if(e<A&&e>b){const t=1/Math.sqrt(e);u*=t,E*=t,S*=t}}l[n+0]=u,l[n+1]=E,l[n+2]=S,n+=c}else for(let r=0;r<u;++r){const i=3*e[r],a=t[i],s=t[i+1],u=t[i+2];let E=d*a+m*s+_*u,S=h*a+p*s+v*u,M=f*a+g*s+T*u;if(x){const e=E*E+S*S+M*M;if(e<A&&e>b){const t=1/Math.sqrt(e);E*=t,S*=t,M*=t}}for(let e=0;e<o;++e)l[n+0]=E,l[n+1]=S,l[n+2]=M,n+=c}}function qt(e,t,r,i,n,o=1){if(!r)return void function(e,t,r,i,n=1){const o=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===n)for(let r=0;r<s;++r){const n=4*e[r];o[i]=t[n],o[i+1]=t[n+1],o[i+2]=t[n+2],o[i+3]=t[n+3],i+=a}else for(let r=0;r<s;++r){const s=4*e[r];for(let e=0;e<n;++e)o[i]=t[s],o[i+1]=t[s+1],o[i+2]=t[s+2],o[i+3]=t[s+3],i+=a}}(e,t,i,n,o);const a=r,l=i.typedBuffer,c=i.typedBufferStride,u=e.length,d=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],_=a[8],v=a[9],T=a[10],x=!(0,s.p)(a),b=1e-6,A=1-b;if(n*=c,1===o)for(let r=0;r<u;++r){const i=4*e[r],o=t[i],a=t[i+1],s=t[i+2],u=t[i+3];let E=d*o+m*a+_*s,S=h*o+p*a+v*s,M=f*o+g*a+T*s;if(x){const e=E*E+S*S+M*M;if(e<A&&e>b){const t=1/Math.sqrt(e);E*=t,S*=t,M*=t}}l[n+0]=E,l[n+1]=S,l[n+2]=M,l[n+3]=u,n+=c}else for(let r=0;r<u;++r){const i=4*e[r],a=t[i],s=t[i+1],u=t[i+2],E=t[i+3];let S=d*a+m*s+_*u,M=h*a+p*s+v*u,R=f*a+g*s+T*u;if(x){const e=S*S+M*M+R*R;if(e<A&&e>b){const t=1/Math.sqrt(e);S*=t,M*=t,R*=t}}for(let e=0;e<o;++e)l[n+0]=S,l[n+1]=M,l[n+2]=R,l[n+3]=E,n+=c}}function kt(e,t,r,i,n,o=1){const a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(n*=s,1===o){if(4===r)for(let r=0;r<l;++r){const i=4*e[r];a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=t[i+3],n+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=255,n+=s}}else if(4===r)for(let r=0;r<l;++r){const i=4*e[r];for(let e=0;e<o;++e)a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=t[i+3],n+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];for(let e=0;e<o;++e)a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=255,n+=s}}var $t=r(37782),Xt=r(88669),jt=r(135),Jt=r(15719),Yt=r(96310),Zt=r(89243);class Kt{constructor(e,t){this._module=e,this._loadModule=t}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}}var Qt=r(67498);class er{constructor(e,t,r){this._context=e,this._locations=r,this._textures=new Map,this._freeTextureUnits=new C.Z({deallocator:null}),this._glProgram=e.programCache.acquire(t.generate("vertex"),t.generate("fragment"),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=t.generateBind(Qt.P.Pass,this),this.bindDraw=t.generateBind(Qt.P.Draw,this),this._fragmentUniforms=(0,pe.hZ)()?t.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get isCompiled(){return this._glProgram.isCompiled}setUniform1b(e,t){this._glProgram.setUniform1i(e,t?1:0)}setUniform1i(e,t){this._glProgram.setUniform1i(e,t)}setUniform1f(e,t){this._glProgram.setUniform1f(e,t)}setUniform2f(e,t,r){this._glProgram.setUniform2f(e,t,r)}setUniform2fv(e,t){this._glProgram.setUniform2fv(e,t)}setUniform3f(e,t,r,i){this._glProgram.setUniform3f(e,t,r,i)}setUniform3fv(e,t){this._glProgram.setUniform3fv(e,t)}setUniform4f(e,t,r,i,n){this._glProgram.setUniform4f(e,t,r,i,n)}setUniform4fv(e,t){this._glProgram.setUniform4fv(e,t)}setUniformMatrix3fv(e,t){this._glProgram.setUniformMatrix3fv(e,t)}setUniformMatrix4fv(e,t){this._glProgram.setUniformMatrix4fv(e,t)}setUniform1fv(e,t){this._glProgram.setUniform1fv(e,t)}setUniform1iv(e,t){this._glProgram.setUniform1iv(e,t)}setUniform2iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform3iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform4iv(e,t){this._glProgram.setUniform4iv(e,t)}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,t){if((0,n.Wi)(t)||null==t.glName){const t=this._textures.get(e);return t&&(this._context.bindTexture(null,t.unit),this._freeTextureUnit(t),this._textures.delete(e)),null}let r=this._textures.get(e);return null==r?(r=this._allocTextureUnit(t),this._textures.set(e,r)):r.texture=t,this._context.useProgram(this),this.setUniform1i(e,r.unit),this._context.bindTexture(t,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach(((e,t)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(t,e.unit)})),(0,n.pC)(this._fragmentUniforms)&&this._fragmentUniforms.forEach((e=>{"sampler2D"!==e.type&&"samplerCube"!==e.type||this._textures.has(e.name)||console.error(`Texture sampler ${e.name} has no bound texture`)}))}_allocTextureUnit(e){return{texture:e,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}}$.wb.LESS,$.wb.ALWAYS;const tr={mask:255},rr={function:{func:$.wb.ALWAYS,ref:R.hU.OutlineVisualElementMask,mask:R.hU.OutlineVisualElementMask},operation:{fail:$.xS.KEEP,zFail:$.xS.KEEP,zPass:$.xS.ZERO}},ir={function:{func:$.wb.ALWAYS,ref:R.hU.OutlineVisualElementMask,mask:R.hU.OutlineVisualElementMask},operation:{fail:$.xS.KEEP,zFail:$.xS.KEEP,zPass:$.xS.REPLACE}};$.wb.EQUAL,R.hU.OutlineVisualElementMask,R.hU.OutlineVisualElementMask,$.xS.KEEP,$.xS.KEEP,$.xS.KEEP,$.wb.NOTEQUAL,R.hU.OutlineVisualElementMask,R.hU.OutlineVisualElementMask,$.xS.KEEP,$.xS.KEEP,$.xS.KEEP;var nr=r(32078);class or extends Jt.d4{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=(0,u.f)(0,1,.5),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=R.Vr.Back,this.emissiveFactor=(0,u.f)(0,0,0),this.instancedDoublePrecision=!1,this.normals="default",this.receiveSSAO=!0,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=(0,u.f)(.2,.2,.2),this.diffuse=(0,u.f)(.8,.8,.8),this.externalColor=(0,Xt.f)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,u.c)(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSizeEnabled=!1,this.vvSizeMinSize=[1,1,1],this.vvSizeMaxSize=[100,100,100],this.vvSizeOffset=[0,0,0],this.vvSizeFactor=[1,1,1],this.vvSizeValue=[1,1,1],this.vvColorEnabled=!1,this.vvColorValues=[0,0,0,0,0,0,0,0],this.vvColorColors=[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],this.vvSymbolAnchor=[0,0,0],this.vvSymbolRotationMatrix=(0,a.c)(),this.vvOpacityEnabled=!1,this.vvOpacityValues=[],this.vvOpacityOpacities=[],this.transparent=!1,this.writeDepth=!0,this.customDepthTest=R.Gv.Less,this.textureAlphaMode=R.JJ.Blend,this.textureAlphaCutoff=Yt.F,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=Ge.yD.Occlude}}class ar extends class{constructor(e,t,r){this.release=r,t&&(this.initializeConfiguration(e,t),this._configuration=t.snapshot()),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}destroy(){this._program=(0,n.O3)(this._program),this._pipeline=this._configuration=null}reload(e){(0,n.O3)(this._program),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}get program(){return this._program}get compiled(){return this.program.isCompiled}get key(){return this._configuration.key}get configuration(){return this._configuration}bindPass(e,t){this.program.bindPass(e,t)}bindDraw(e,t){this.program.bindDraw(e,t),this.program.rebindTextures()}bindPipelineState(e,t=null,r){e.setPipelineState(this.getPipelineState(t,r))}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return $.MX.TRIANGLES}getPipelineState(e,t){return this._pipeline}initializeConfiguration(e,t){}}{initializeConfiguration(e,t){t.spherical=e.viewingMode===De.JY.Global,t.doublePrecisionRequiresObfuscation=(0,Zt.I)(e.rctx),t.textureCoordinateType=t.hasColorTexture||t.hasMetalnessAndRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?jt.N.Default:jt.N.None}initializeProgram(e){return this._initializeProgram(e,ar.shader)}_initializeProgram(e,t){const r=t.get().build(this.configuration);return new er(e.rctx,r,ue.i)}_convertDepthTestFunction(e){return e===R.Gv.Lequal?$.wb.LEQUAL:$.wb.LESS}_setPipeline(e,t){const r=this.configuration,i=e===R.Am.NONE,n=e===R.Am.FrontFace;return function(e){return xt.intern(e)}({blending:r.output!==Fe.H.Color&&r.output!==Fe.H.Alpha||!r.transparent?null:i?bt:St(e),culling:sr(r)&&ke(r.cullFace),depthTest:{func:Rt(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:i||n?r.writeDepth&&$e:null,colorWrite:Xe,stencilWrite:r.hasOccludees?tr:null,stencilTest:r.hasOccludees?t?ir:rr:null,polygonOffset:i||n?null:(o=r.enableOffset,o?Mt:null)});var o}initializePipeline(){return this._occludeePipelineState=this._setPipeline(this.configuration.transparencyPassType,!0),this._setPipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}function sr(e){return e.cullFace!==R.Vr.None||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}ar.shader=new Kt(nr.D,(()=>r.e(9291).then(r.bind(r,79291))));var lr=r(43697);function cr(e={}){return(t,r)=>{if(t._parameterNames=t._parameterNames??[],t._parameterNames.push(r),null!=e.constValue)Object.defineProperty(t,r,{get:()=>e.constValue});else{const i=t._parameterNames.length-1,n=e.count||2,o=Math.ceil(Math.log2(n)),a=t._parameterBits??[0];let s=0;for(;a[s]+o>16;)s++,s>=a.length&&a.push(0);t._parameterBits=a;const l=a[s],c=(1<<o)-1<<l;a[s]+=o,Object.defineProperty(t,r,{get(){return this[i]},set(e){if(this[i]!==e&&(this[i]=e,this._keyDirty=!0,this._parameterBits[s]=this._parameterBits[s]&~c|+e<<l&c,"number"!=typeof e&&"boolean"!=typeof e))throw"Configuration value for "+r+" must be boolean or number, got "+typeof e}})}}}class ur extends class{constructor(){this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map((()=>0)):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,t={key:this.key};for(const r of e)t[r]=this[r];return t}}{}(0,lr._)([cr({constValue:!0})],ur.prototype,"hasSliceHighlight",void 0),(0,lr._)([cr({constValue:!1})],ur.prototype,"hasSliceInVertexProgram",void 0),(0,lr._)([cr({constValue:!1})],ur.prototype,"instancedDoublePrecision",void 0),(0,lr._)([cr({constValue:!1})],ur.prototype,"isGround",void 0),(0,lr._)([cr({constValue:Qt.P.Pass})],ur.prototype,"pbrTextureBindType",void 0);class dr extends ur{constructor(){super(...arguments),this.output=Fe.H.Color,this.alphaDiscardMode=R.JJ.Opaque,this.doubleSidedMode=Be.q.None,this.pbrMode=Ue.f7.Disabled,this.cullFace=R.Vr.None,this.transparencyPassType=R.Am.NONE,this.normalType=He.h.Attribute,this.textureCoordinateType=jt.N.None,this.customDepthTest=R.Gv.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetalnessAndRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.hasMultipassTerrain=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1}}(0,lr._)([cr({count:Fe.H.COUNT})],dr.prototype,"output",void 0),(0,lr._)([cr({count:R.JJ.COUNT})],dr.prototype,"alphaDiscardMode",void 0),(0,lr._)([cr({count:Be.q.COUNT})],dr.prototype,"doubleSidedMode",void 0),(0,lr._)([cr({count:Ue.f7.COUNT})],dr.prototype,"pbrMode",void 0),(0,lr._)([cr({count:R.Vr.COUNT})],dr.prototype,"cullFace",void 0),(0,lr._)([cr({count:R.Am.COUNT})],dr.prototype,"transparencyPassType",void 0),(0,lr._)([cr({count:He.h.COUNT})],dr.prototype,"normalType",void 0),(0,lr._)([cr({count:jt.N.COUNT})],dr.prototype,"textureCoordinateType",void 0),(0,lr._)([cr({count:R.Gv.COUNT})],dr.prototype,"customDepthTest",void 0),(0,lr._)([cr()],dr.prototype,"spherical",void 0),(0,lr._)([cr()],dr.prototype,"hasVertexColors",void 0),(0,lr._)([cr()],dr.prototype,"hasSymbolColors",void 0),(0,lr._)([cr()],dr.prototype,"hasVerticalOffset",void 0),(0,lr._)([cr()],dr.prototype,"hasSlicePlane",void 0),(0,lr._)([cr()],dr.prototype,"hasSliceHighlight",void 0),(0,lr._)([cr()],dr.prototype,"hasColorTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasMetalnessAndRoughnessTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasEmissionTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasOcclusionTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasNormalTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasScreenSizePerspective",void 0),(0,lr._)([cr()],dr.prototype,"hasVertexTangents",void 0),(0,lr._)([cr()],dr.prototype,"hasOccludees",void 0),(0,lr._)([cr()],dr.prototype,"hasMultipassTerrain",void 0),(0,lr._)([cr()],dr.prototype,"hasModelTransformation",void 0),(0,lr._)([cr()],dr.prototype,"offsetBackfaces",void 0),(0,lr._)([cr()],dr.prototype,"vvSize",void 0),(0,lr._)([cr()],dr.prototype,"vvColor",void 0),(0,lr._)([cr()],dr.prototype,"receiveShadows",void 0),(0,lr._)([cr()],dr.prototype,"receiveAmbientOcclusion",void 0),(0,lr._)([cr()],dr.prototype,"textureAlphaPremultiplied",void 0),(0,lr._)([cr()],dr.prototype,"instanced",void 0),(0,lr._)([cr()],dr.prototype,"instancedColor",void 0),(0,lr._)([cr()],dr.prototype,"instancedDoublePrecision",void 0),(0,lr._)([cr()],dr.prototype,"doublePrecisionRequiresObfuscation",void 0),(0,lr._)([cr()],dr.prototype,"writeDepth",void 0),(0,lr._)([cr()],dr.prototype,"transparent",void 0),(0,lr._)([cr()],dr.prototype,"enableOffset",void 0),(0,lr._)([cr()],dr.prototype,"cullAboveGround",void 0),(0,lr._)([cr()],dr.prototype,"snowCover",void 0),(0,lr._)([cr({constValue:!0})],dr.prototype,"hasVvInstancing",void 0),(0,lr._)([cr({constValue:!1})],dr.prototype,"useCustomDTRExponentForWater",void 0),(0,lr._)([cr({constValue:!1})],dr.prototype,"supportsTextureAtlas",void 0),(0,lr._)([cr({constValue:!0})],dr.prototype,"useFillLights",void 0);var hr=r(41846);class fr extends ar{initializeConfiguration(e,t){super.initializeConfiguration(e,t),t.hasMetalnessAndRoughnessTexture=!1,t.hasEmissionTexture=!1,t.hasOcclusionTexture=!1,t.hasNormalTexture=!1,t.hasModelTransformation=!1,t.normalType=He.h.Attribute,t.doubleSidedMode=Be.q.WindingOrder,t.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,fr.shader)}}fr.shader=new Kt(hr.R,(()=>r.e(8096).then(r.bind(r,38096))));class mr extends Ge.F5{constructor(e){super(e,gr),this.supportsEdges=!0,this.techniqueConfig=new dr,this.vertexBufferLayout=function(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=(0,Le.U$)().vec3f(D.T.POSITION).vec3f(D.T.NORMAL);return e.hasVertexTangents&&r.vec4f(D.T.TANGENT),t&&r.vec2f(D.T.UV0),e.hasVertexColors&&r.vec4u8(D.T.COLOR),e.hasSymbolColors&&r.vec4u8(D.T.SYMBOLCOLOR),r}(this.parameters),this.instanceBufferLayout=e.instanced?function(e){let t=(0,Le.U$)();return t=e.instancedDoublePrecision?t.vec3f(D.T.MODELORIGINHI).vec3f(D.T.MODELORIGINLO).mat3f(D.T.MODEL).mat3f(D.T.MODELNORMAL):t.mat4f(D.T.MODEL).mat4f(D.T.MODELNORMAL),(0,n.pC)(e.instanced)&&e.instanced.includes("color")&&(t=t.vec4f(D.T.INSTANCECOLOR)),(0,n.pC)(e.instanced)&&e.instanced.includes("featureAttribute")&&(t=t.vec4f(D.T.INSTANCEFEATUREATTRIBUTE)),t}(this.parameters):null}isVisibleInPass(e){return e!==Ct.MATERIAL_DEPTH_SHADOWMAP_ALL&&e!==Ct.MATERIAL_DEPTH_SHADOWMAP_DEFAULT&&e!==Ct.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{instanced:t,hasVertexColors:r,hasSymbolColors:i,vvColorEnabled:o}=e,a=(0,n.pC)(t)&&t.includes("color"),s="replace"===e.colorMixMode,l=e.opacity>0,c=e.externalColor&&e.externalColor[3]>0;return r&&(a||o||i)?!!s||l:r?s?c:l:a||o||i?!!s||l:s?c:l}getConfiguration(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.hasNormalTexture=!!this.parameters.normalTextureId,this.techniqueConfig.hasColorTexture=!!this.parameters.textureId,this.techniqueConfig.hasVertexTangents=this.parameters.hasVertexTangents,this.techniqueConfig.instanced=!!this.parameters.instanced,this.techniqueConfig.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.hasVerticalOffset=(0,n.pC)(this.parameters.verticalOffset),this.techniqueConfig.hasScreenSizePerspective=(0,n.pC)(this.parameters.screenSizePerspective),this.techniqueConfig.hasSlicePlane=this.parameters.hasSlicePlane,this.techniqueConfig.hasSliceHighlight=this.parameters.hasSliceHighlight,this.techniqueConfig.alphaDiscardMode=this.parameters.textureAlphaMode,this.techniqueConfig.normalType="screenDerivative"===this.parameters.normals?He.h.ScreenDerivative:He.h.Attribute,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,(0,n.pC)(this.parameters.customDepthTest)&&(this.techniqueConfig.customDepthTest=this.parameters.customDepthTest),this.techniqueConfig.hasOccludees=this.parameters.hasOccludees,this.techniqueConfig.cullFace=this.parameters.hasSlicePlane?R.Vr.None:this.parameters.cullFace,this.techniqueConfig.hasMultipassTerrain=t.multipassTerrain.enabled,this.techniqueConfig.cullAboveGround=t.multipassTerrain.cullAboveGround,this.techniqueConfig.hasModelTransformation=(0,n.pC)(this.parameters.modelTransformation),e!==Fe.H.Color&&e!==Fe.H.Alpha||(this.techniqueConfig.hasVertexColors=this.parameters.hasVertexColors,this.techniqueConfig.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this.techniqueConfig.doubleSidedMode=Be.q.WindingOrder:this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?Be.q.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?Be.q.WindingOrder:Be.q.None,this.techniqueConfig.instancedColor=(0,n.pC)(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this.techniqueConfig.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this.techniqueConfig.receiveAmbientOcclusion=!!t.ssaoHelper.ready&&this.parameters.receiveSSAO,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this.techniqueConfig.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?Ue.f7.Schematic:Ue.f7.Normal:Ue.f7.Disabled,this.techniqueConfig.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this.techniqueConfig.hasEmissionTexture=!!this.parameters.emissiveTextureId,this.techniqueConfig.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this.techniqueConfig.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<5e5,this.techniqueConfig.snowCover=this.hasSnowCover(t)),this.techniqueConfig}hasSnowCover(e){return(0,n.pC)(e.weather)&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,t,r,i,o,a,s){if((0,n.pC)(this.parameters.verticalOffset)){const e=i.camera;(0,c.s)(Er,r[12],r[13],r[14]);let t=null;switch(i.viewingMode){case De.JY.Global:t=(0,c.n)(br,Er);break;case De.JY.Local:t=(0,c.c)(br,xr)}let n=0;const s=(0,c.b)(Sr,Er,e.eye),l=(0,c.l)(s),u=(0,c.g)(s,s,1/l);let d=null;this.parameters.screenSizePerspective&&(d=(0,c.e)(t,u)),n+=(0,$t.Hx)(e,l,this.parameters.verticalOffset,d,this.parameters.screenSizePerspective),(0,c.g)(t,t,n),(0,c.t)(Ar,t,i.transform.inverseRotation),o=(0,c.b)(vr,o,Ar),a=(0,c.b)(Tr,a,Ar)}var l;(0,$t.Bw)(e,t,i,o,a,(l=i.verticalOffset,(0,n.pC)(l)?(Bt.offset=l,Bt):null),s)}requiresSlot(e){return e===(this.parameters.transparent?this.parameters.writeDepth?wt.TRANSPARENT_MATERIAL:wt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:wt.OPAQUE_MATERIAL)||e===wt.DRAPED_MATERIAL}createGLMaterial(e){return e.output===Fe.H.Color||e.output===Fe.H.Alpha||e.output===Fe.H.Depth||e.output===Fe.H.Normal||e.output===Fe.H.Shadow||e.output===Fe.H.Highlight?new pr(e):null}createBufferWriter(){return new _r(this.vertexBufferLayout,this.instanceBufferLayout)}}class pr extends ze.F{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,c.s)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(t.treeRendering?fr:ar,e)}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==Fe.H.Color&&this._output!==Fe.H.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this._updateParameters(e)}}const gr=new class extends or{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}};class _r{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(D.T.POSITION).length}write(e,t,r,i){!function(e,t,r,i,n,o){for(const a of t.fieldNames){const t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)switch(a){case D.T.POSITION:{(0,w.hu)(3===t.size);const e=n.getField(a,h.ct);e&&Vt(s,t.data,r,e,o);break}case D.T.NORMAL:{(0,w.hu)(3===t.size);const e=n.getField(a,h.ct);e&&Wt(s,t.data,i,e,o);break}case D.T.UV0:{(0,w.hu)(2===t.size);const e=n.getField(a,h.Eu);e&&zt(s,t.data,e,o);break}case D.T.COLOR:{(0,w.hu)(3===t.size||4===t.size);const e=n.getField(a,h.mc);e&&kt(s,t.data,t.size,e,o);break}case D.T.SYMBOLCOLOR:{(0,w.hu)(3===t.size||4===t.size);const e=n.getField(a,h.mc);e&&kt(s,t.data,t.size,e,o);break}case D.T.TANGENT:{(0,w.hu)(4===t.size);const e=n.getField(a,h.ek);e&&qt(s,t.data,i,e,o);break}}}}(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,i)}}const vr=(0,u.c)(),Tr=(0,u.c)(),xr=(0,u.f)(0,0,1),br=(0,u.c)(),Ar=(0,u.c)(),Er=(0,u.c)(),Sr=(0,u.c)(),Mr=A.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function Rr(e){throw new b.Z("",`Request for object resource failed: ${e}`)}function Cr(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(Mr.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(Mr.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(Mr.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(Mr.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else Mr.warn("Indexed geometries must specify faces"),i=!1;break}default:Mr.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(Mr.warn("Geometry requires material"),i=!1);const n=e.params.vertexAttributes;for(const e in n)n[e].values||(Mr.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function wr(e){const t=(0,d.cS)();return e.forEach((e=>{const r=e.boundingInfo;(0,n.pC)(r)&&((0,d.pp)(t,r.getBBMin()),(0,d.pp)(t,r.getBBMax()))})),t}async function yr(e,t){const r=[];for(const i in e){const o=e[i],a=o.images[0].data;if(!a){Mr.warn("Externally referenced texture data is not yet supported");continue}const s=o.encoding+";base64,"+a,l="/textureDefinitions/"+i,c="rgba"===o.channels?o.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:$.e8.REPEAT,t:$.e8.REPEAT},preMultiplyAlpha:Or(c)!==R.JJ.Opaque},d=(0,n.pC)(t)&&t.disableTextures?Promise.resolve(null):M(s,t);r.push(d.then((e=>({refId:l,image:e,params:u,alphaChannelUsage:c}))))}const i=await Promise.all(r),o={};for(const e of i)o[e.refId]=e;return o}function Or(e){switch(e){case"mask":return R.JJ.Mask;case"maskAndTransparency":return R.JJ.MaskBlend;case"none":return R.JJ.Opaque;default:return R.JJ.Blend}}function Pr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Nr=new S.G(1,2,"wosr");var Ir=r(57758),Dr=r(10816),Lr=r(75488),Fr=r(56067);async function Hr(e,t){const r=Br((0,i.pJ)(e));if("wosr"===r.fileType){const e=await(t.cache?t.cache.loadWOSR(r.url,t):async function(e,t){const r=await async function(e,t){const r=(0,n.pC)(t)&&t.streamDataRequester;if(r)return async function(e,t,r){const i=await(0,x.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,E.r9)(i.error),Rr(i.error.details.url)}(e,r,t);const i=await(0,x.q6)((0,T.default)(e,(0,n.Wg)(t)));if(!0===i.ok)return i.value.data;(0,E.r9)(i.error),Rr(i.error)}(e,t);return{resource:r,textures:await yr(r.textureDefinitions,t)}}(r.url,t)),i=function(e,t){const r=[],i=[],o=[],a=[],s=e.resource,l=S.G.parse(s.version||"1.0","wosr");Nr.validate(l);const c=s.model.name,d=s.model.geometries,h=s.materialDefinitions,f=e.textures;let m=0;const p=new Map;for(let e=0;e<d.length;e++){const s=d[e];if(!Cr(s))continue;const l=Pr(s),c=s.params.vertexAttributes,g=[];for(const e in c){const t=c[e],r=t.values;g.push([e,{data:r,size:t.valuesPerElement,exclusive:!0}])}const _=[];if("PerAttributeArray"!==s.params.topology){const e=s.params.faces;for(const t in e)_.push([t,new Uint32Array(e[t].values)])}const v=f&&f[l.texture];if(v&&!p.has(l.texture)){const{image:e,params:t}=v,r=new Ie(e,t);a.push(r),p.set(l.texture,r)}const T=p.get(l.texture),x=T?T.id:void 0;let b=o[l.material]?o[l.material][l.texture]:null;if(!b){const e=h[l.material.substring(l.material.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=v&&v.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,a=v?Or(v.alphaChannelUsage):void 0,s={ambient:(0,u.d)(e.diffuse),diffuse:(0,u.d)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:a,textureAlphaCutoff:.33,textureId:x,initTextureTransparent:!0,doubleSided:!0,cullFace:R.Vr.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:!!v&&!!v.params.preMultiplyAlpha};(0,n.pC)(t)&&t.materialParamsMixin&&Object.assign(s,t.materialParamsMixin),b=new mr(s),o[l.material]||(o[l.material]={}),o[l.material][l.texture]=b}i.push(b);const A=new L(g,_);m+=_.position?_.position.length:0,r.push(A)}return{name:c,stageResources:{textures:a,materials:i,geometries:r},pivotOffset:s.model.pivotOffset,boundingBox:wr(r),numberOfVertices:m,lodThreshold:null}}(e,t);return{lods:[i],referenceBoundingBox:i.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const o=await(t.cache?t.cache.loadGLTF(r.url,t,t.usePBR):(0,_.z)(new g.C(t.streamDataRequester),r.url,t,t.usePBR)),a=(0,n.U2)(o.model.meta,"ESRI_proxyEllipsoid");o.meta.isEsriSymbolResource&&(0,n.pC)(a)&&o.meta.uri.includes("/RealisticTrees/")&&function(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const o of i.parts){const i=o.attributes.normal;if((0,n.Wi)(i))return;const a=o.attributes.position,d=a.count,f=(0,u.c)(),m=(0,u.c)(),g=(0,u.c)(),_=(0,p.gS)(h.mc,d),v=(0,p.gS)(h.ct,d),T=(0,s.a)((0,l.c)(),o.transform);for(let n=0;n<d;n++){a.getVec(n,m),i.getVec(n,f),(0,c.m)(m,m,o.transform),(0,c.b)(g,m,t.center),(0,c.G)(g,g,t.radius);const s=g[2],l=(0,c.l)(g),u=Math.min(.45+.55*l*l,1);(0,c.G)(g,g,t.radius),(0,c.m)(g,g,T),(0,c.n)(g,g),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,c.h)(g,g,f,s>-1?.2:Math.min(-4*s-3.8,1)),v.setVec(n,g),_.set(n,0,255*u),_.set(n,1,255*u),_.set(n,2,255*u),_.set(n,3,255)}o.attributes.normal=v,o.attributes.color=_}}}(o,a);const d=o.meta.isEsriSymbolResource?{usePBR:t.usePBR,isSchematic:!1,treeRendering:!!o.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:t.usePBR,isSchematic:!1,treeRendering:!1,mrrFactors:[0,1,.5]},f={...t.materialParamsMixin,treeRendering:!!o.customMeta.esriTreeRendering};if(null!=r.specifiedLodIndex){const e=Ur(o,d,f,r.specifiedLodIndex);let t=e[0].boundingBox;return 0!==r.specifiedLodIndex&&(t=Ur(o,d,f,0)[0].boundingBox),{lods:e,referenceBoundingBox:t,isEsriSymbolResource:o.meta.isEsriSymbolResource,isWosr:!1,remove:o.remove}}const m=Ur(o,d,f);return{lods:m,referenceBoundingBox:m[0].boundingBox,isEsriSymbolResource:o.meta.isEsriSymbolResource,isWosr:!1,remove:o.remove}}function Br(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function Ur(e,t,r,i){const s=e.model,l=(0,a.c)(),c=new Array,u=new Map,g=new Map;return s.lods.forEach(((e,a)=>{if(void 0!==i&&a!==i)return;const _={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:(0,n.pC)(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:(0,d.cS)()};c.push(_),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=s.materials.get(e.material),c=(0,n.pC)(e.attributes.texCoord0),T=(0,n.pC)(e.attributes.normal),x=function(e){switch(e){case"BLEND":return R.JJ.Blend;case"MASK":return R.JJ.Mask;case"OPAQUE":case null:case void 0:return R.JJ.Opaque}}(a.alphaMode);if(!u.has(i)){if(c){if((0,n.pC)(a.textureColor)&&!g.has(a.textureColor)){const e=s.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:x!==R.JJ.Opaque};g.set(a.textureColor,new Ie(e.data,t))}if((0,n.pC)(a.textureNormal)&&!g.has(a.textureNormal)){const e=s.textures.get(a.textureNormal);g.set(a.textureNormal,new Ie(e.data,e.parameters))}if((0,n.pC)(a.textureOcclusion)&&!g.has(a.textureOcclusion)){const e=s.textures.get(a.textureOcclusion);g.set(a.textureOcclusion,new Ie(e.data,e.parameters))}if((0,n.pC)(a.textureEmissive)&&!g.has(a.textureEmissive)){const e=s.textures.get(a.textureEmissive);g.set(a.textureEmissive,new Ie(e.data,e.parameters))}if((0,n.pC)(a.textureMetallicRoughness)&&!g.has(a.textureMetallicRoughness)){const e=s.textures.get(a.textureMetallicRoughness);g.set(a.textureMetallicRoughness,new Ie(e.data,e.parameters))}}const o=a.color[0]**(1/Ir.K),l=a.color[1]**(1/Ir.K),d=a.color[2]**(1/Ir.K),h=a.emissiveFactor[0]**(1/Ir.K),f=a.emissiveFactor[1]**(1/Ir.K),m=a.emissiveFactor[2]**(1/Ir.K),p=(0,n.pC)(a.textureColor)&&c?g.get(a.textureColor):null;u.set(i,new mr({...t,transparent:x===R.JJ.Blend,customDepthTest:R.Gv.Lequal,textureAlphaMode:x,textureAlphaCutoff:a.alphaCutoff,diffuse:[o,l,d],ambient:[o,l,d],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?R.Vr.None:R.Vr.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normals:T?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:(0,n.pC)(p)?p.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:(0,n.pC)(a.textureNormal)&&c?g.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:(0,n.pC)(p)&&!!p.params.preMultiplyAlpha,occlusionTextureId:(0,n.pC)(a.textureOcclusion)&&c?g.get(a.textureOcclusion).id:void 0,emissiveTextureId:(0,n.pC)(a.textureEmissive)&&c?g.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:(0,n.pC)(a.textureMetallicRoughness)&&c?g.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[h,f,m],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...r}))}const b=function(e,t){switch(t){case $.MX.TRIANGLES:return(0,v.nh)(e);case $.MX.TRIANGLE_STRIP:return(0,v.DA)(e);case $.MX.TRIANGLE_FAN:return(0,v.jX)(e)}}(e.indices||e.attributes.position.count,e.primitiveType),A=e.attributes.position.count,E=(0,p.gS)(h.ct,A);(0,f.t)(E,e.attributes.position,e.transform);const S=[[D.T.POSITION,{data:E.typedBuffer,size:E.elementCount,exclusive:!0}]],M=[[D.T.POSITION,b]];if((0,n.pC)(e.attributes.normal)){const t=(0,p.gS)(h.ct,A);(0,o.a)(l,e.transform),(0,f.a)(t,e.attributes.normal,l),S.push([D.T.NORMAL,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.NORMAL,b])}if((0,n.pC)(e.attributes.tangent)){const t=(0,p.gS)(h.ek,A);(0,o.a)(l,e.transform),(0,m.t)(t,e.attributes.tangent,l),S.push([D.T.TANGENT,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.TANGENT,b])}if((0,n.pC)(e.attributes.texCoord0)){const t=(0,p.gS)(h.Eu,A);(0,Dr.n)(t,e.attributes.texCoord0),S.push([D.T.UV0,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.UV0,b])}if((0,n.pC)(e.attributes.color)){const t=(0,p.gS)(h.mc,A);if(4===e.attributes.color.elementCount)e.attributes.color instanceof h.ek?(0,m.s)(t,e.attributes.color,255):e.attributes.color instanceof h.mc?(0,Lr.c)(t,e.attributes.color):e.attributes.color instanceof h.v6&&(0,m.s)(t,e.attributes.color,1/256);else{(0,Lr.f)(t,255,255,255,255);const r=new h.ne(t.buffer,0,4);e.attributes.color instanceof h.ct?(0,f.s)(r,e.attributes.color,255):e.attributes.color instanceof h.ne?(0,Fr.c)(r,e.attributes.color):e.attributes.color instanceof h.mw&&(0,f.s)(r,e.attributes.color,1/256)}S.push([D.T.COLOR,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.COLOR,b])}const C=new L(S,M);_.stageResources.geometries.push(C),_.stageResources.materials.push(u.get(i)),c&&((0,n.pC)(a.textureColor)&&_.stageResources.textures.push(g.get(a.textureColor)),(0,n.pC)(a.textureNormal)&&_.stageResources.textures.push(g.get(a.textureNormal)),(0,n.pC)(a.textureOcclusion)&&_.stageResources.textures.push(g.get(a.textureOcclusion)),(0,n.pC)(a.textureEmissive)&&_.stageResources.textures.push(g.get(a.textureEmissive)),(0,n.pC)(a.textureMetallicRoughness)&&_.stageResources.textures.push(g.get(a.textureMetallicRoughness))),_.numberOfVertices+=A;const w=C.boundingInfo;(0,n.pC)(w)&&((0,d.pp)(_.boundingBox,w.getBBMin()),(0,d.pp)(_.boundingBox,w.getBBMax()))}))})),c}},6206:(e,t,r)=>{var i,n;r.d(t,{a9:()=>i}),r(22021),(n=i||(i={}))[n.Multiply=1]="Multiply",n[n.Ignore=2]="Ignore",n[n.Replace=3]="Replace",n[n.Tint=4]="Tint"},65576:(e,t,r)=>{r.d(t,{U$:()=>s});var i=r(56481),n=r(79583);class o{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fieldNames){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 o(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t,r,i){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)}}}class a{constructor(){this.stride=0,this.fields=new Map,this.fieldNames=[]}vec2f(e,t){return this._appendField(e,i.Eu,t),this}vec2f64(e,t){return this._appendField(e,i.q6,t),this}vec3f(e,t){return this._appendField(e,i.ct,t),this}vec3f64(e,t){return this._appendField(e,i.fP,t),this}vec4f(e,t){return this._appendField(e,i.ek,t),this}vec4f64(e,t){return this._appendField(e,i.Cd,t),this}mat3f(e,t){return this._appendField(e,i.gK,t),this}mat3f64(e,t){return this._appendField(e,i.ey,t),this}mat4f(e,t){return this._appendField(e,i.bj,t),this}mat4f64(e,t){return this._appendField(e,i.O1,t),this}vec4u8(e,t){return this._appendField(e,i.mc,t),this}f32(e,t){return this._appendField(e,i.ly,t),this}f64(e,t){return this._appendField(e,i.oS,t),this}u8(e,t){return this._appendField(e,i.D_,t),this}u16(e,t){return this._appendField(e,i.av,t),this}i8(e,t){return this._appendField(e,i.Hz,t),this}vec2i8(e,t){return this._appendField(e,i.Vs,t),this}vec2i16(e,t){return this._appendField(e,i.or,t),this}vec2u8(e,t){return this._appendField(e,i.xA,t),this}vec4u16(e,t){return this._appendField(e,i.v6,t),this}u32(e,t){return this._appendField(e,i.Nu,t),this}_appendField(e,t,r){const i=t.ElementCount*(0,n.n1)(t.ElementType),o=this.stride;this.fields.set(e,{size:i,constructor:t,offset:o,optional:r}),this.stride+=i,this.fieldNames.push(e)}alignTo(e){return this.stride=Math.floor((this.stride+e-1)/e)*e,this}hasField(e){return this.fieldNames.includes(e)}createBuffer(e){return new o(this,e)}createView(e){return new o(this,e)}clone(){const e=new a;return e.stride=this.stride,e.fields=new Map,this.fields.forEach(((t,r)=>e.fields.set(r,t))),e.fieldNames=this.fieldNames.slice(),e.BufferType=this.BufferType,e}}function s(){return new a}},1391:(e,t,r)=>{r.d(t,{q:()=>s});var i=r(18361),n=r(2095),o=r(19693),a=r(74709);function s(e,t){t.output===i.H.Color&&t.receiveShadows?(e.varyings.add("linearDepth","float"),e.vertex.code.add(a.H`void forwardLinearDepth() { linearDepth = gl_Position.w; }`)):t.output===i.H.Depth||t.output===i.H.Shadow?(e.include(n.up,t),e.varyings.add("linearDepth","float"),e.vertex.uniforms.add(new o.A("nearFar",((e,t)=>t.camera.nearFar))),e.vertex.code.add(a.H`void forwardLinearDepth() {
|
|
165
|
+
`)),t.include(p.s,e),t}const B=Object.freeze(Object.defineProperty({__proto__:null,build:H},Symbol.toStringTag,{value:"Module"}))},21787:(e,t,r)=>{r.d(t,{a:()=>s,f:()=>n,i:()=>c,t:()=>o});var i=r(46851);function n(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function o(e,t){if(e===t){const r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function a(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=r[0],f=r[1],m=r[2],p=r[3],g=r[4],_=r[5],v=r[6],T=r[7],x=r[8];return e[0]=h*i+f*a+m*c,e[1]=h*n+f*s+m*u,e[2]=h*o+f*l+m*d,e[3]=p*i+g*a+_*c,e[4]=p*n+g*s+_*u,e[5]=p*o+g*l+_*d,e[6]=v*i+T*a+x*c,e[7]=v*n+T*s+x*u,e[8]=v*o+T*l+x*d,e}function s(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=t[9],h=t[10],f=t[11],m=t[12],p=t[13],g=t[14],_=t[15],v=r*s-i*a,T=r*l-n*a,x=r*c-o*a,b=i*l-n*s,A=i*c-o*s,E=n*c-o*l,S=u*p-d*m,M=u*g-h*m,R=u*_-f*m,C=d*g-h*p,w=d*_-f*p,y=h*_-f*g;let O=v*y-T*w+x*C+b*R-A*M+E*S;return O?(O=1/O,e[0]=(s*y-l*w+c*C)*O,e[1]=(l*R-a*y-c*M)*O,e[2]=(a*w-s*R+c*S)*O,e[3]=(n*w-i*y-o*C)*O,e[4]=(r*y-n*R+o*M)*O,e[5]=(i*R-r*w-o*S)*O,e[6]=(p*E-g*A+_*b)*O,e[7]=(g*x-m*E-_*T)*O,e[8]=(m*A-p*x+_*v)*O,e):null}function l(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function c(e){const t=i.E,r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8];return Math.abs(1-(r*r+a*a+c*c))<=t&&Math.abs(1-(n*n+s*s+u*u))<=t&&Math.abs(1-(o*o+l*l+d*d))<=t}const u=a,d=l;Object.freeze(Object.defineProperty({__proto__:null,fromMat4:n,copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},set:function(e,t,r,i,n,o,a,s,l,c){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=o,e[5]=a,e[6]=s,e[7]=l,e[8]=c,e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},transpose:o,invert:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],d=u*a-s*c,h=-u*o+s*l,f=c*o-a*l;let m=r*d+i*h+n*f;return m?(m=1/m,e[0]=d*m,e[1]=(-u*i+n*c)*m,e[2]=(s*i-n*a)*m,e[3]=h*m,e[4]=(u*r-n*l)*m,e[5]=(-s*r+n*o)*m,e[6]=f*m,e[7]=(-c*r+i*l)*m,e[8]=(a*r-i*o)*m,e):null},adjoint:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8];return e[0]=a*u-s*c,e[1]=n*c-i*u,e[2]=i*s-n*a,e[3]=s*l-o*u,e[4]=r*u-n*l,e[5]=n*o-r*s,e[6]=o*c-a*l,e[7]=i*l-r*c,e[8]=r*a-i*o,e},determinant:function(e){const t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*(c*o-a*l)+r*(-c*n+a*s)+i*(l*n-o*s)},multiply:a,translate:function(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=r[0],f=r[1];return e[0]=i,e[1]=n,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=h*i+f*a+c,e[7]=h*n+f*s+u,e[8]=h*o+f*l+d,e},rotate:function(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=Math.sin(r),f=Math.cos(r);return e[0]=f*i+h*a,e[1]=f*n+h*s,e[2]=f*o+h*l,e[3]=f*a-h*i,e[4]=f*s-h*n,e[5]=f*l-h*o,e[6]=c,e[7]=u,e[8]=d,e},scale:function(e,t,r){const i=r[0],n=r[1],o=r[2];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=o*t[6],e[7]=o*t[7],e[8]=o*t[8],e},scaleByVec2:function(e,t,r){const i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e},fromTranslation:function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},fromRotation:function(e,t){const r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromScaling:function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},fromMat2d:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},fromQuat:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=r+r,s=i+i,l=n+n,c=r*a,u=i*a,d=i*s,h=n*a,f=n*s,m=n*l,p=o*a,g=o*s,_=o*l;return e[0]=1-d-m,e[3]=u-_,e[6]=h+g,e[1]=u+_,e[4]=1-c-m,e[7]=f-p,e[2]=h-g,e[5]=f+p,e[8]=1-c-d,e},normalFromMat4Legacy:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[4],a=t[5],s=t[6],l=t[8],c=t[9],u=t[10],d=u*a-s*c,h=-u*o+s*l,f=c*o-a*l,m=r*d+i*h+n*f;if(!m)return null;const p=1/m;return e[0]=d*p,e[1]=(-u*i+n*c)*p,e[2]=(s*i-n*a)*p,e[3]=h*p,e[4]=(u*r-n*l)*p,e[5]=(-s*r+n*o)*p,e[6]=f*p,e[7]=(-c*r+i*l)*p,e[8]=(a*r-i*o)*p,e},normalFromMat4:s,projection:function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},str:function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},frob:function(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2+e[3]**2+e[4]**2+e[5]**2+e[6]**2+e[7]**2+e[8]**2)},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},subtract:l,multiplyScalar:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},multiplyScalarAndAdd:function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e},exactEquals:function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},equals:function(e,t){const r=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=t[0],f=t[1],m=t[2],p=t[3],g=t[4],_=t[5],v=t[6],T=t[7],x=t[8];return Math.abs(r-h)<=i.E*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(n-f)<=i.E*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-m)<=i.E*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(a-p)<=i.E*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(s-g)<=i.E*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=i.E*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(c-v)<=i.E*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(u-T)<=i.E*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(d-x)<=i.E*Math.max(1,Math.abs(d),Math.abs(x))},isOrthoNormal:c,mul:u,sub:d},Symbol.toStringTag,{value:"Module"}))},46521:(e,t,r)=>{function i(){return[1,0,0,0,1,0,0,0,1]}function n(e,t){return new Float64Array(e,t,9)}r.d(t,{a:()=>n,c:()=>i}),Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:function(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},fromValues:function(e,t,r,i,n,o,a,s,l){return[e,t,r,i,n,o,a,s,l]},createView:n},Symbol.toStringTag,{value:"Module"}))},13598:(e,t,r)=>{function i(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function n(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}function o(e,t){return new Float64Array(e,t,16)}r.d(t,{I:()=>a,a:()=>o,b:()=>n,c:()=>i});const a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:n,fromValues:function(e,t,r,i,n,o,a,s,l,c,u,d,h,f,m,p){return[e,t,r,i,n,o,a,s,l,c,u,d,h,f,m,p]},createView:o,IDENTITY:a},Symbol.toStringTag,{value:"Module"}))},51305:(e,t,r)=>{r.d(t,{c:()=>f,g:()=>u,j:()=>w,k:()=>p,m:()=>d,s:()=>c});var i=r(46521),n=r(94961),o=r(65617),a=r(46851),s=r(17896),l=r(98766);function c(e,t,r){r*=.5;const i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function u(e,t){const r=2*Math.acos(t[3]),i=Math.sin(r/2);return i>a.E?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=1,e[1]=0,e[2]=0),r}function d(e,t,r){const i=t[0],n=t[1],o=t[2],a=t[3],s=r[0],l=r[1],c=r[2],u=r[3];return e[0]=i*u+a*s+n*c-o*l,e[1]=n*u+a*l+o*s-i*c,e[2]=o*u+a*c+i*l-n*s,e[3]=a*u-i*s-n*l-o*c,e}function h(e,t,r,i){const n=t[0],o=t[1],s=t[2],l=t[3];let c,u,d,h,f,m=r[0],p=r[1],g=r[2],_=r[3];return u=n*m+o*p+s*g+l*_,u<0&&(u=-u,m=-m,p=-p,g=-g,_=-_),1-u>a.E?(c=Math.acos(u),d=Math.sin(c),h=Math.sin((1-i)*c)/d,f=Math.sin(i*c)/d):(h=1-i,f=i),e[0]=h*n+f*m,e[1]=h*o+f*p,e[2]=h*s+f*g,e[3]=h*l+f*_,e}function f(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function m(e,t){const r=t[0]+t[4]+t[8];let i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);const n=(r+1)%3,o=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*n+n]-t[3*o+o]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*n+o]-t[3*o+n])*i,e[n]=(t[3*n+r]+t[3*r+n])*i,e[o]=(t[3*o+r]+t[3*r+o])*i}return e}function p(e,t,r,i){const n=.5*Math.PI/180;t*=n,r*=n,i*=n;const o=Math.sin(t),a=Math.cos(t),s=Math.sin(r),l=Math.cos(r),c=Math.sin(i),u=Math.cos(i);return e[0]=o*l*u-a*s*c,e[1]=a*s*u+o*l*c,e[2]=a*l*c-o*s*u,e[3]=a*l*u+o*s*c,e}const g=l.c,_=l.s,v=l.a,T=d,x=l.b,b=l.d,A=l.l,E=l.e,S=E,M=l.f,R=M,C=l.n,w=l.g,y=l.h,O=(0,o.c)(),P=(0,o.f)(1,0,0),N=(0,o.f)(0,1,0),I=(0,n.a)(),D=(0,n.a)(),L=(0,i.c)();Object.freeze(Object.defineProperty({__proto__:null,identity:function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},setAxisAngle:c,getAxisAngle:u,multiply:d,rotateX:function(e,t,r){r*=.5;const i=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+a*s,e[1]=n*l+o*s,e[2]=o*l-n*s,e[3]=a*l-i*s,e},rotateY:function(e,t,r){r*=.5;const i=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-o*s,e[1]=n*l+a*s,e[2]=o*l+i*s,e[3]=a*l-n*s,e},rotateZ:function(e,t,r){r*=.5;const i=t[0],n=t[1],o=t[2],a=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=o*l+a*s,e[3]=a*l-o*s,e},calculateW:function(e,t){const r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e},slerp:h,random:function(e){const t=(0,a.R)(),r=(0,a.R)(),i=(0,a.R)(),n=Math.sqrt(1-t),o=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*r),e[1]=n*Math.cos(2*Math.PI*r),e[2]=o*Math.sin(2*Math.PI*i),e[3]=o*Math.cos(2*Math.PI*i),e},invert:function(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=r*r+i*i+n*n+o*o,s=a?1/a:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=o*s,e},conjugate:f,fromMat3:m,fromEuler:p,str:function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},copy:g,set:_,add:v,mul:T,scale:x,dot:b,lerp:A,length:E,len:S,squaredLength:M,sqrLen:R,normalize:C,exactEquals:w,equals:y,rotationTo:function(e,t,r){const i=(0,s.e)(t,r);return i<-.999999?((0,s.f)(O,P,t),(0,s.u)(O)<1e-6&&(0,s.f)(O,N,t),(0,s.n)(O,O),c(e,O,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):((0,s.f)(O,t,r),e[0]=O[0],e[1]=O[1],e[2]=O[2],e[3]=1+i,C(e,e))},sqlerp:function(e,t,r,i,n,o){return h(I,t,n,o),h(D,r,i,o),h(e,I,D,2*o*(1-o)),e},setAxes:function(e,t,r,i){const n=L;return n[0]=r[0],n[3]=r[1],n[6]=r[2],n[1]=i[0],n[4]=i[1],n[7]=i[2],n[2]=-t[0],n[5]=-t[1],n[8]=-t[2],C(e,m(e,n))}},Symbol.toStringTag,{value:"Module"}))},94961:(e,t,r)=>{function i(){return[0,0,0,1]}function n(e){return[e[0],e[1],e[2],e[3]]}function o(e,t){return new Float64Array(e,t,4)}r.d(t,{I:()=>a,a:()=>i,b:()=>n,c:()=>o});const a=[0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:n,fromValues:function(e,t,r,i){return[e,t,r,i]},createView:o,IDENTITY:a},Symbol.toStringTag,{value:"Module"}))},29268:(e,t,r)=>{r.d(t,{b:()=>v,c:()=>_,d:()=>T,g:()=>x,i:()=>E,m:()=>O}),r(80442);var i,n,o=r(92604),a=r(22021),s=r(70586),l=r(52138),c=r(17896),u=r(65617),d=r(98766),h=r(88669);(n=i||(i={}))[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z";var f=r(78341),m=r(61277),p=r(12981);const g=o.Z.getLogger("esri.geometry.support.sphere");function _(){return(0,h.c)()}function v(e,t=_()){return(0,d.c)(t,e)}function T(e){return e[3]}function x(e){return e}function b(e,t,r){if((0,s.Wi)(t))return!1;const{origin:i,direction:n}=t,o=A;o[0]=i[0]-e[0],o[1]=i[1]-e[1],o[2]=i[2]-e[2];const a=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],l=2*(n[0]*o[0]+n[1]*o[1]+n[2]*o[2]),c=l*l-4*a*(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]-e[3]*e[3]);if(c<0)return!1;const u=Math.sqrt(c);let d=(-l-u)/(2*a);const h=(-l+u)/(2*a);return(d<0||h<d&&h>0)&&(d=h),!(d<0||(r&&(r[0]=i[0]+n[0]*d,r[1]=i[1]+n[1]*d,r[2]=i[2]+n[2]*d),0))}const A=(0,u.c)();function E(e,t){return b(e,t,null)}function S(e,t,r){const i=p.WM.get(),n=p.MP.get();(0,c.f)(i,t.origin,t.direction);const o=T(e);(0,c.f)(r,i,t.origin),(0,c.g)(r,r,1/(0,c.l)(r)*o);const a=R(e,t.origin),s=(0,m.EU)(t.origin,r);return(0,l.d)(n,s+a,i),(0,c.m)(r,r,n),r}function M(e,t,r){const i=(0,c.b)(p.WM.get(),t,e),n=(0,c.g)(p.WM.get(),i,e[3]/(0,c.l)(i));return(0,c.a)(r,n,e)}function R(e,t){const r=(0,c.b)(p.WM.get(),t,e),i=(0,c.l)(r),n=T(e),o=n+Math.abs(n-i);return(0,a.ZF)(n/o)}const C=(0,u.c)();function w(e,t,r,n){const o=(0,c.b)(C,t,e);switch(r){case i.X:{const e=(0,a.jE)(o,C)[2];return(0,c.s)(n,-Math.sin(e),Math.cos(e),0)}case i.Y:{const e=(0,a.jE)(o,C),t=e[1],r=e[2],i=Math.sin(t);return(0,c.s)(n,-i*Math.cos(r),-i*Math.sin(r),Math.cos(t))}case i.Z:return(0,c.n)(n,o);default:return}}function y(e,t){const r=(0,c.b)(P,t,e);return(0,c.l)(r)-e[3]}function O(e,t){const r=(0,c.d)(e,t),i=T(e);return r<=i*i}const P=(0,u.c)(),N=_();Object.freeze(Object.defineProperty({__proto__:null,create:_,copy:v,fromCenterAndRadius:function(e,t){return(0,h.f)(e[0],e[1],e[2],t)},wrap:function(e){return e},clear:function(e){e[0]=e[1]=e[2]=e[3]=0},fromRadius:function(e,t){return e[0]=e[1]=e[2]=0,e[3]=t,e},getRadius:T,getCenter:x,fromValues:function(e,t,r,i){return(0,h.f)(e,t,r,i)},elevate:function(e,t,r){return e!==r&&(0,c.c)(r,e),r[3]=e[3]+t,r},setExtent:function(e,t,r){return g.error("sphere.setExtent is not yet supported"),e===r?r:v(e,r)},intersectRay:b,intersectsRay:E,intersectRayClosestSilhouette:function(e,t,r){if(b(e,t,r))return r;const i=S(e,t,p.WM.get());return(0,c.a)(r,t.origin,(0,c.g)(p.WM.get(),t.direction,(0,c.i)(t.origin,i)/(0,c.l)(t.direction))),r},closestPointOnSilhouette:S,closestPoint:function(e,t,r){return b(e,t,r)?r:((0,f.JI)(t,e,r),M(e,r,r))},projectPoint:M,distanceToSilhouette:function(e,t){const r=(0,c.b)(p.WM.get(),t,e),i=(0,c.p)(r),n=e[3]*e[3];return Math.sqrt(Math.abs(i-n))},angleToSilhouette:R,axisAt:w,altitudeAt:y,setAltitudeAt:function(e,t,r,n){const o=y(e,t),a=w(e,t,i.Z,P),s=(0,c.g)(P,a,r-o);return(0,c.a)(n,t,s)},containsPoint:O,tmpSphere:N},Symbol.toStringTag,{value:"Module"}))},20773:(e,t,r)=>{r.d(t,{a:()=>o,b:()=>l,n:()=>s,s:()=>a,t:()=>n});var i=r(72220);function n(e,t,r){if(e.count!==t.count)return void i.c.error("source and destination buffers need to have the same number of elements");const n=e.count,o=r[0],a=r[1],s=r[2],l=r[4],c=r[5],u=r[6],d=r[8],h=r[9],f=r[10],m=r[12],p=r[13],g=r[14],_=e.typedBuffer,v=e.typedBufferStride,T=t.typedBuffer,x=t.typedBufferStride;for(let e=0;e<n;e++){const t=e*v,r=e*x,i=T[r],n=T[r+1],b=T[r+2];_[t]=o*i+l*n+d*b+m,_[t+1]=a*i+c*n+h*b+p,_[t+2]=s*i+u*n+f*b+g}}function o(e,t,r){if(e.count!==t.count)return void i.c.error("source and destination buffers need to have the same number of elements");const n=e.count,o=r[0],a=r[1],s=r[2],l=r[3],c=r[4],u=r[5],d=r[6],h=r[7],f=r[8],m=e.typedBuffer,p=e.typedBufferStride,g=t.typedBuffer,_=t.typedBufferStride;for(let e=0;e<n;e++){const t=e*p,r=e*_,i=g[r],n=g[r+1],v=g[r+2];m[t]=o*i+l*n+d*v,m[t+1]=a*i+c*n+h*v,m[t+2]=s*i+u*n+f*v}}function a(e,t,r){const i=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*o,i=e*s;n[t]=r*a[i],n[t+1]=r*a[i+1],n[t+2]=r*a[i+2]}}function s(e,t){const r=Math.min(e.count,t.count),i=e.typedBuffer,n=e.typedBufferStride,o=t.typedBuffer,a=t.typedBufferStride;for(let e=0;e<r;e++){const t=e*n,r=e*a,s=o[r],l=o[r+1],c=o[r+2],u=s*s+l*l+c*c;if(u>0){const e=1/Math.sqrt(u);i[t]=e*s,i[t+1]=e*l,i[t+2]=e*c}}}function l(e,t,r){const i=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,a=t.typedBuffer,s=t.typedBufferStride;for(let e=0;e<i;e++){const t=e*o,i=e*s;n[t]=a[i]>>r,n[t+1]=a[i+1]>>r,n[t+2]=a[i+2]>>r}}Object.freeze(Object.defineProperty({__proto__:null,transformMat4:n,transformMat3:o,scale:a,normalize:s,shiftRight:l},Symbol.toStringTag,{value:"Module"}))},56067:(e,t,r)=>{function i(e,t,r){const i=e.typedBuffer,n=e.typedBufferStride,o=t.typedBuffer,a=t.typedBufferStride,s=r?r.count:t.count;let l=(r&&r.dstIndex?r.dstIndex:0)*n,c=(r&&r.srcIndex?r.srcIndex:0)*a;for(let e=0;e<s;++e)i[l]=o[c],i[l+1]=o[c+1],i[l+2]=o[c+2],l+=n,c+=a}function n(e,t,r,i,n){const o=e.typedBuffer,a=e.typedBufferStride,s=n?.count??e.count;let l=(n?.dstIndex??0)*a;for(let e=0;e<s;++e)o[l]=t,o[l+1]=r,o[l+2]=i,l+=a}r.d(t,{c:()=>i,f:()=>n}),Object.freeze(Object.defineProperty({__proto__:null,copy:i,fill:n},Symbol.toStringTag,{value:"Module"}))},72119:(e,t,r)=>{function i(){return new Float32Array(3)}function n(e,t,r){const i=new Float32Array(3);return i[0]=e,i[1]=t,i[2]=r,i}function o(){return i()}function a(){return n(1,1,1)}function s(){return n(1,0,0)}function l(){return n(0,1,0)}function c(){return n(0,0,1)}r.d(t,{c:()=>i,f:()=>n});const u=o(),d=a(),h=s(),f=l(),m=c();Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:function(e){const t=new Float32Array(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},fromValues:n,createView:function(e,t){return new Float32Array(e,t,3)},zeros:o,ones:a,unitX:s,unitY:l,unitZ:c,ZEROS:u,ONES:d,UNIT_X:h,UNIT_Y:f,UNIT_Z:m},Symbol.toStringTag,{value:"Module"}))},88669:(e,t,r)=>{function i(){return[0,0,0,0]}function n(e,t,r,i){return[e,t,r,i]}function o(e,t){return new Float64Array(e,t,4)}function a(){return n(1,1,1,1)}function s(){return n(1,0,0,0)}function l(){return n(0,1,0,0)}function c(){return n(0,0,1,0)}function u(){return n(0,0,0,1)}r.d(t,{a:()=>o,c:()=>i,f:()=>n});const d=a(),h=s(),f=l(),m=c(),p=u();Object.freeze(Object.defineProperty({__proto__:null,create:i,clone:function(e){return[e[0],e[1],e[2],e[3]]},fromValues:n,fromArray:function(e){const t=[0,0,0,0],r=Math.min(4,e.length);for(let i=0;i<r;++i)t[i]=e[i];return t},createView:o,zeros:function(){return[0,0,0,0]},ones:a,unitX:s,unitY:l,unitZ:c,unitW:u,ZEROS:[0,0,0,0],ONES:d,UNIT_X:h,UNIT_Y:f,UNIT_Z:m,UNIT_W:p},Symbol.toStringTag,{value:"Module"}))},32243:(e,t,r)=>{function i(e){return e=e||globalThis.location.hostname,c.some((t=>null!=e?.match(t)))}function n(e,t){return e&&(t=t||globalThis.location.hostname)?null!=t.match(o)||null!=t.match(s)?e.replace("static.arcgis.com","staticdev.arcgis.com"):null!=t.match(a)||null!=t.match(l)?e.replace("static.arcgis.com","staticqa.arcgis.com"):e:e}r.d(t,{XO:()=>i,pJ:()=>n});const o=/^devext.arcgis.com$/,a=/^qaext.arcgis.com$/,s=/^[\w-]*\.mapsdevext.arcgis.com$/,l=/^[\w-]*\.mapsqa.arcgis.com$/,c=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,o,a,/^jsapps.esri.com$/,s,l]},72220:(e,t,r)=>{r.d(t,{c:()=>i});const i=r(92604).Z.getLogger("esri.views.3d.support.buffer.math")},78341:(e,t,r)=>{r.d(t,{JI:()=>l,Ue:()=>a,re:()=>s}),r(67676);var i=r(22807),n=r(17896),o=r(65617);function a(e){return e?{origin:(0,o.a)(e.origin),direction:(0,o.a)(e.direction)}:{origin:(0,o.c)(),direction:(0,o.c)()}}function s(e,t){const r=c.get();return r.origin=e,r.direction=t,r}function l(e,t,r){const i=(0,n.e)(e.direction,(0,n.b)(r,t,e.origin));return(0,n.a)(r,e.origin,(0,n.g)(r,e.direction,i)),r}r(12981);const c=new i.x((function(){return{origin:null,direction:null}}))},61277:(e,t,r)=>{r.d(t,{EU:()=>a});var i=r(22021),n=r(17896),o=r(65617);function a(e,t){const r=(0,n.e)(e,t)/((0,n.l)(e)*(0,n.l)(t));return-(0,i.ZF)(r)}(0,o.c)(),(0,o.c)()},90751:(e,t,r)=>{r.r(t),r.d(t,{fetch:()=>Hr,gltfToEngineResources:()=>Ur,parseUrl:()=>Br});var i=r(32243),n=r(70586),o=r(21787),a=r(46521),s=r(52138),l=r(13598),c=r(17896),u=r(65617),d=r(60437),h=r(56481),f=r(20773),m=r(11077),p=r(8323),g=r(40270),_=r(88246),v=r(91911),T=r(3172),x=r(66643),b=r(20102),A=r(92604),E=r(95330),S=r(23670);async function M(e,t){const{data:r}=await(0,T.default)(e,{responseType:"image",...t});return r}var R=r(47026),C=r(44553),w=r(11726);class y{constructor(e,t,r,i){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.indices=r,this.position=i,this.center=(0,u.c)(),(0,w.hu)(e.length>=1),(0,w.hu)(r.length%this._numIndexPerPrimitive==0),(0,w.hu)(r.length>=e.length*this._numIndexPerPrimitive),(0,w.hu)(3===i.size||4===i.size);const{data:n,size:o}=i,a=e.length;let s=o*r[this._numIndexPerPrimitive*e[0]];O.clear(),O.push(s),this.bbMin=(0,u.f)(n[s],n[s+1],n[s+2]),this.bbMax=(0,u.a)(this.bbMin);for(let t=0;t<a;++t){const i=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){s=o*r[i+e],O.push(s);let t=n[s];this.bbMin[0]=Math.min(t,this.bbMin[0]),this.bbMax[0]=Math.max(t,this.bbMax[0]),t=n[s+1],this.bbMin[1]=Math.min(t,this.bbMin[1]),this.bbMax[1]=Math.max(t,this.bbMax[1]),t=n[s+2],this.bbMin[2]=Math.min(t,this.bbMin[2]),this.bbMax[2]=Math.max(t,this.bbMax[2])}}(0,c.h)(this.center,this.bbMin,this.bbMax,.5),this.radius=.5*Math.max(Math.max(this.bbMax[0]-this.bbMin[0],this.bbMax[1]-this.bbMin[1]),this.bbMax[2]-this.bbMin[2]);let l=this.radius*this.radius;for(let e=0;e<O.length;++e){s=O.getItemAt(e);const t=n[s]-this.center[0],r=n[s+1]-this.center[1],i=n[s+2]-this.center[2],o=t*t+r*r+i*i;if(o<=l)continue;const a=Math.sqrt(o),c=.5*(a-this.radius);this.radius=this.radius+c,l=this.radius*this.radius;const u=c/a;this.center[0]+=t*u,this.center[1]+=r*u,this.center[2]+=i*u}O.clear()}getCenter(){return this.center}getBSRadius(){return this.radius}getBBMin(){return this.bbMin}getBBMax(){return this.bbMax}getChildren(){if(this._children)return this._children;if((0,c.d)(this.bbMin,this.bbMax)>1){const e=(0,c.h)((0,u.c)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:n,size:o}=this.position;for(let a=0;a<t;++a){let t=0;const s=this._numIndexPerPrimitive*this.primitiveIndices[a];let l=o*this.indices[s],c=n[l],u=n[l+1],d=n[l+2];for(let e=1;e<this._numIndexPerPrimitive;++e){l=o*this.indices[s+e];const t=n[l],r=n[l+1],i=n[l+2];t<c&&(c=t),r<u&&(u=r),i<d&&(d=i)}c<e[0]&&(t|=1),u<e[1]&&(t|=2),d<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const s=new Array(8);for(let e=0;e<8;++e)s[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];s[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array(8);for(let e=0;e<8;++e)void 0!==s[e]&&(this._children[e]=new y(s[e],this._numIndexPerPrimitive,this.indices,this.position))}return this._children}static prune(){O.prune()}}const O=new C.Z({deallocator:null});var P=r(17662),N=r(4726),I=r(17753),D=r(35065);class L extends P.c{constructor(e,t=[],r=R.MX.Triangle,i=-1){super(),this._primitiveType=r,this.edgeIndicesLength=i,this.type=N.U.Geometry,this._vertexAttributes=new Map,this._indices=new Map,this._boundingInfo=null;for(const[t,r]of e)r&&this._vertexAttributes.set(t,{...r});if(null==t||0===t.length){const e=function(e){const t=e.values().next().value;return null==t?0:t.data.length/t.size}(this._vertexAttributes),t=(0,I.p)(e);this.edgeIndicesLength=this.edgeIndicesLength<0?e:this.edgeIndicesLength;for(const e of this._vertexAttributes.keys())this._indices.set(e,t)}else for(const[e,r]of t)r&&(this._indices.set(e,F(r)),e===D.T.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._indices.get(e).length:this.edgeIndicesLength))}cloneShallow(){const e=new L([],void 0,this._primitiveType,void 0),{_vertexAttributes:t,_indices:r}=e;return this._vertexAttributes.forEach(((e,r)=>{t.set(r,e)})),this._indices.forEach(((e,t)=>{r.set(t,e)})),e.screenToWorldRatio=this.screenToWorldRatio,e._boundingInfo=this._boundingInfo,e}get vertexAttributes(){return this._vertexAttributes}getMutableAttribute(e){const t=this._vertexAttributes.get(e);return t&&!t.exclusive&&(t.data=Array.from(t.data),t.exclusive=!0),t}get indices(){return this._indices}get indexCount(){const e=this._indices.values().next().value;return e?e.length:0}get primitiveType(){return this._primitiveType}get faceCount(){return this.indexCount/3}get boundingInfo(){return(0,n.Wi)(this._boundingInfo)&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return this.primitiveType===R.MX.Triangle?this._computeAttachmentOriginTriangles(e):this._computeAttachmentOriginPoints(e)}_computeAttachmentOriginTriangles(e){const t=this.indices.get(D.T.POSITION),r=this.vertexAttributes.get(D.T.POSITION);return(0,I.cM)(r,t,e)}_computeAttachmentOriginPoints(e){const t=this.indices.get(D.T.POSITION),r=this.vertexAttributes.get(D.T.POSITION);return(0,I.NO)(r,t,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.indices.get(D.T.POSITION);if(0===e.length)return null;const t=this.primitiveType===R.MX.Triangle?3:1;(0,w.hu)(e.length%t==0,"Indexing error: "+e.length+" not divisible by "+t);const r=(0,I.p)(e.length/t),i=this.vertexAttributes.get(D.T.POSITION);return new y(r,t,e,i)}}function F(e){if(e.BYTES_PER_ELEMENT===Uint16Array.BYTES_PER_ELEMENT)return e;for(const t of e)if(t>=65536)return e;return new Uint16Array(e)}var H=r(74085),B=r(32448),U=r(22021),z=r(1533),G=r(17452),V=r(85958),W=r(99880);let q;var k;!function(e){e[e.ETC1_RGB=0]="ETC1_RGB",e[e.ETC2_RGBA=1]="ETC2_RGBA",e[e.BC1_RGB=2]="BC1_RGB",e[e.BC3_RGBA=3]="BC3_RGBA",e[e.BC4_R=4]="BC4_R",e[e.BC5_RG=5]="BC5_RG",e[e.BC7_M6_RGB=6]="BC7_M6_RGB",e[e.BC7_M5_RGBA=7]="BC7_M5_RGBA",e[e.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",e[e.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",e[e.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",e[e.ATC_RGB=11]="ATC_RGB",e[e.ATC_RGBA=12]="ATC_RGBA",e[e.FXT1_RGB=17]="FXT1_RGB",e[e.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",e[e.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",e[e.ETC2_EAC_R11=20]="ETC2_EAC_R11",e[e.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",e[e.RGBA32=13]="RGBA32",e[e.RGB565=14]="RGB565",e[e.BGR565=15]="BGR565",e[e.RGBA4444=16]="RGBA4444"}(k||(k={}));var $=r(35371),X=r(75656);function j(e,t,r,i,n=0){const o=e.gl,a=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);void 0===r&&console.error(`There is no location for vertex attribute '${e.name}' defined.`);const i=n*e.stride;if(e.count<=4)o.vertexAttribPointer(r,e.count,e.type,e.normalized,e.stride,e.offset+i),o.enableVertexAttribArray(r),e.divisor>0&&a&&a.vertexAttribDivisor(r,e.divisor);else if(9===e.count)for(let t=0;t<3;t++)o.vertexAttribPointer(r+t,3,e.type,e.normalized,e.stride,e.offset+12*t+i),o.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else if(16===e.count)for(let t=0;t<4;t++)o.vertexAttribPointer(r+t,4,e.type,e.normalized,e.stride,e.offset+16*t+i),o.enableVertexAttribArray(r+t),e.divisor>0&&a&&a.vertexAttribDivisor(r+t,e.divisor);else console.error("Unsupported vertex attribute element count: "+e.count)}}function J(e,t,r,i){const n=e.gl,o=e.capabilities.instancing;e.bindBuffer(r);for(const e of i){const r=t.get(e.name);if(e.count<=4)n.disableVertexAttribArray(r),e.divisor&&e.divisor>0&&o&&o.vertexAttribDivisor(r,0);else if(9===e.count)for(let t=0;t<3;t++)n.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&o&&o.vertexAttribDivisor(r+t,0);else if(16===e.count)for(let t=0;t<4;t++)n.disableVertexAttribArray(r+t),e.divisor&&e.divisor>0&&o&&o.vertexAttribDivisor(r+t,0);else console.error("Unsupported vertex attribute element count: "+e.count)}e.unbindBuffer($.w0.ARRAY_BUFFER)}function Y(e){switch(e){case $.VI.ALPHA:case $.VI.LUMINANCE:case $.VI.RED:case $.VI.RED_INTEGER:case $.lP.R8:case $.lP.R8I:case $.lP.R8UI:case $.lP.R8_SNORM:case $.Tg.STENCIL_INDEX8:return 1;case $.VI.LUMINANCE_ALPHA:case $.VI.RG:case $.VI.RG_INTEGER:case $.lP.RGBA4:case $.lP.R16F:case $.lP.R16I:case $.lP.R16UI:case $.lP.RG8:case $.lP.RG8I:case $.lP.RG8UI:case $.lP.RG8_SNORM:case $.lP.RGB565:case $.lP.RGB5_A1:case $.Tg.DEPTH_COMPONENT16:return 2;case $.VI.DEPTH_COMPONENT:case $.VI.RGB:case $.VI.RGB_INTEGER:case $.lP.RGB8:case $.lP.RGB8I:case $.lP.RGB8UI:case $.lP.RGB8_SNORM:case $.lP.SRGB8:case $.Tg.DEPTH_COMPONENT24:return 3;case $.VI.DEPTH_STENCIL:case $.VI.RGBA:case $.VI.RGBA_INTEGER:case $.lP.RGBA8:case $.lP.R32F:case $.lP.R11F_G11F_B10F:case $.lP.RG16F:case $.lP.R32I:case $.lP.R32UI:case $.lP.RG16I:case $.lP.RG16UI:case $.lP.RGBA8I:case $.lP.RGBA8UI:case $.lP.RGBA8_SNORM:case $.lP.SRGB8_ALPHA8:case $.lP.RGB9_E5:case $.lP.RGB10_A2UI:case $.lP.RGB10_A2:case $.Tg.DEPTH_STENCIL:case $.Tg.DEPTH_COMPONENT32F:case $.Tg.DEPTH24_STENCIL8:return 4;case $.Tg.DEPTH32F_STENCIL8:return 5;case $.lP.RGB16F:case $.lP.RGB16I:case $.lP.RGB16UI:return 6;case $.lP.RG32F:case $.lP.RG32I:case $.lP.RG32UI:case $.lP.RGBA16F:case $.lP.RGBA16I:case $.lP.RGBA16UI:return 8;case $.lP.RGB32F:case $.lP.RGB32I:case $.lP.RGB32UI:return 12;case $.lP.RGBA32F:case $.lP.RGBA32I:case $.lP.RGBA32UI:return 16;case $.q_.COMPRESSED_RGB_S3TC_DXT1_EXT:case $.q_.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case $.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT:case $.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case $.q_.COMPRESSED_R11_EAC:case $.q_.COMPRESSED_SIGNED_R11_EAC:case $.q_.COMPRESSED_RGB8_ETC2:case $.q_.COMPRESSED_SRGB8_ETC2:case $.q_.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case $.q_.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case $.q_.COMPRESSED_RG11_EAC:case $.q_.COMPRESSED_SIGNED_RG11_EAC:case $.q_.COMPRESSED_RGBA8_ETC2_EAC:case $.q_.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}function Z(e){if((0,n.Wi)(e))return 0;if("descriptor"in e)return e.glName?Z(e.descriptor):0;const t=e.internalFormat||"pixelFormat"in e&&e.pixelFormat;if(!t)return 0;const r="hasMipmap"in e&&e.hasMipmap?1.3:1,i=e.width*e.height;return Y(t)*i*r}r(80442);let K=null,Q=null;async function ee(){return(0,n.Wi)(Q)&&(Q=function(){if((0,n.Wi)(q)){const e=e=>(0,W.V)(`esri/libs/basisu/${e}`);q=r.e(1421).then(r.bind(r,21421)).then((e=>e.b)).then((({default:t})=>t({locateFile:e}).then((e=>(e.initializeBasis(),delete e.then,e)))))}return q}(),K=await Q),Q}function te(e,t,r,i,n){const o=Y(t?$.q_.COMPRESSED_RGBA8_ETC2_EAC:$.q_.COMPRESSED_RGB8_ETC2),a=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*a)}function re(e){return e.getNumImages()>=1&&!e.isUASTC()}function ie(e){return e.getFaces()>=1&&e.isETC1S()}function ne(e,t,r,i,n,o,a,s){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[u,d]=l?i?[k.ETC2_RGBA,$.q_.COMPRESSED_RGBA8_ETC2_EAC]:[k.ETC1_RGB,$.q_.COMPRESSED_RGB8_ETC2]:c?i?[k.BC3_RGBA,$.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[k.BC1_RGB,$.q_.COMPRESSED_RGB_S3TC_DXT1_EXT]:[k.RGBA32,$.VI.RGBA],h=t.hasMipmap?r:Math.min(1,r),f=[];for(let e=0;e<h;e++)f.push(new Uint8Array(a(e,u))),s(e,u,f[e]);const m=f.length>1,p=m?$.cw.LINEAR_MIPMAP_LINEAR:$.cw.LINEAR,g={...t,samplingMode:p,hasMipmap:m,internalFormat:d,width:n,height:o};return new X.x(e,g,{type:"compressed",levels:f})}const oe=A.Z.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function ae(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const se=ae("DXT1"),le=ae("DXT3"),ce=ae("DXT5");var ue=r(83475),de=r(21968);new de.G(D.T.POSITION,3,$.g.FLOAT,0,12),new de.G(D.T.POSITION,3,$.g.FLOAT,0,20),new de.G(D.T.UV0,2,$.g.FLOAT,12,20),new de.G(D.T.POSITION,3,$.g.FLOAT,0,32),new de.G(D.T.NORMAL,3,$.g.FLOAT,12,32),new de.G(D.T.UV0,2,$.g.FLOAT,24,32),new de.G(D.T.POSITION,3,$.g.FLOAT,0,16),new de.G(D.T.COLOR,4,$.g.UNSIGNED_BYTE,12,16);const he=[new de.G(D.T.POSITION,2,$.g.FLOAT,0,8)],fe=[new de.G(D.T.POSITION,2,$.g.FLOAT,0,16),new de.G(D.T.UV0,2,$.g.FLOAT,8,16)];var me=r(67676),pe=r(49300),ge=r(54738);const _e=A.Z.getLogger("esri.views.webgl.BufferObject");class ve{constructor(e,t,r,i){this._context=e,this.bufferType=t,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment($._g.BufferObject,this),this._glName=this._context.gl.createBuffer(),(0,pe.zu)(this._context.gl),i&&this.setData(i)}static createIndex(e,t,r){return new ve(e,$.w0.ELEMENT_ARRAY_BUFFER,t,r)}static createVertex(e,t,r){return new ve(e,$.w0.ARRAY_BUFFER,t,r)}static createUniform(e,t,r){if(e.type!==ge.zO.WEBGL2)throw new Error("Uniform buffers are supported in WebGL2 only!");return new ve(e,$.w0.UNIFORM_BUFFER,t,r)}static createPixelPack(e,t=$.l1.STREAM_READ,r){if(e.type!==ge.zO.WEBGL2)throw new Error("Pixel pack buffers are supported in WebGL2 only!");const i=new ve(e,$.w0.PIXEL_PACK_BUFFER,t);return r&&i.setSize(r),i}static createPixelUnpack(e,t=$.l1.STREAM_DRAW,r){if(e.type!==ge.zO.WEBGL2)throw new Error("Pixel unpack buffers are supported in WebGL2 only!");return new ve(e,$.w0.PIXEL_UNPACK_BUFFER,t,r)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteSize(){return this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER?this._indexType===$.g.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER||this.bufferType===$.w0.ARRAY_BUFFER}dispose(){this._context?.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement($._g.BufferObject,this),this._context=null):this._glName&&_e.warn("Leaked WebGL buffer object")}setSize(e,t=null){if(e<=0&&_e.error("Buffer size needs to be positive!"),this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER&&(0,n.pC)(t))switch(this._indexType=t,t){case $.g.UNSIGNED_SHORT:e*=2;break;case $.g.UNSIGNED_INT:e*=4}this._setBufferData(e)}setData(e){if(!e)return;let t=e.byteLength;this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER&&((0,z.Uc)(e)&&(t/=2,this._indexType=$.g.UNSIGNED_SHORT),(0,z.ZY)(e)&&(t/=4,this._indexType=$.g.UNSIGNED_INT)),this._setBufferData(t,e)}_setBufferData(e,t=null){this._size=e;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const i=this._context.gl;(0,n.pC)(t)?i.bufferData(this.bufferType,t,this.usage):i.bufferData(this.bufferType,e,this.usage),(0,pe.zu)(i),this._isVAOAware&&this._context.bindVAO(r)}setSubData(e,t=0,r=0,i=e.byteLength){if(!e)return;(t<0||t>=this._size)&&_e.error("offset is out of range!");let n=t,o=r,a=i,s=e.byteLength;this.bufferType===$.w0.ELEMENT_ARRAY_BUFFER&&((0,z.Uc)(e)?(s/=2,n*=2,o*=2,a*=2):(0,z.ZY)(e)&&(s/=4,n*=4,o*=4,a*=4)),void 0===i&&(i=s-1),r>=i&&_e.error("end must be bigger than start!"),t+r-i>this._size&&_e.error("An attempt to write beyond the end of the buffer!");const l=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const c=this._context.gl,u=ArrayBuffer.isView(e)?e.buffer:e,d=0===o&&a===e.byteLength?u:u.slice(o,a);c.bufferSubData(this.bufferType,n,d),(0,pe.zu)(c),this._isVAOAware&&this._context.bindVAO(l)}setSubDataFromView(e,t,r,i){if(!e)return;(t<0||t>=this._size)&&_e.error("offset is out of range!"),r>=i&&_e.error("end must be bigger than start!"),t+r-i>this._size&&_e.error("An attempt to write beyond the end of the buffer!");const n=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const o=this._context.gl;if(this._context.type===ge.zO.WEBGL2)o.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,e,r,i-r);else{const n=0===r&&i===e.length?e:e.subarray(r,i);o.bufferSubData(this.bufferType,t*e.BYTES_PER_ELEMENT,n)}(0,pe.zu)(o),this._isVAOAware&&this._context.bindVAO(n)}getSubData(e,t=0,r,i){if(this._context.type!==ge.zO.WEBGL2)return void _e.error("Get buffer subdata is supported in WebGL2 only!");if(r<0||i<0)return void _e.error("Problem getting subdata: offset and length were less than zero!");const n=function(e){return(0,me.zG)(e)}(e)?e.BYTES_PER_ELEMENT:1;if(n*((r??0)+(i??0))>e.byteLength)return void _e.error("Problem getting subdata: offset and length exceeded destination size!");t+n*(i??0)>this.byteSize&&_e.warn("Potential problem getting subdata: requested data exceeds buffer size!");const o=this._context.gl;this._context.bindBuffer(this,$.w0.COPY_READ_BUFFER),o.getBufferSubData($.w0.COPY_READ_BUFFER,t,e,r,i),this._context.unbindBuffer($.w0.COPY_READ_BUFFER)}async getSubDataAsync(e,t=0,r,i){this._context.type===ge.zO.WEBGL2?(await this._context.clientWaitAsync(),this.getSubData(e,t,r,i)):_e.error("Get buffer subdata is supported in WebGL2 only!")}}const Te=A.Z.getLogger("esri.views.webgl.VertexArrayObject");class xe{constructor(e,t,r,i,n=null){this._context=e,this._locations=t,this._layout=r,this._buffers=i,this._indexBuffer=n,this._glName=null,this._initialized=!1,e.instanceCounter.increment($._g.VertexArrayObject,this)}get glName(){return this._glName}get context(){return this._context}get vertexBuffers(){return this._buffers}get indexBuffer(){return this._indexBuffer}get size(){return Object.keys(this._buffers).reduce(((e,t)=>e+this._buffers[t].size),(0,n.pC)(this._indexBuffer)?this._indexBuffer.size:0)}get layout(){return this._layout}get locations(){return this._locations}dispose(e=!0){if(this._context){if(this._glName){const e=this._context?.capabilities?.vao;e?(e.deleteVertexArray(this._glName),this._glName=null):Te.warn("Leaked WebGL VAO")}if(this._context.getBoundVAO()===this&&this._context.bindVAO(null),e){for(const e in this._buffers)this._buffers[e].dispose(),delete this._buffers[e];this._indexBuffer=(0,n.O3)(this._indexBuffer)}this._context.instanceCounter.decrement($._g.VertexArrayObject,this),this._context=null}else(this._glName||e&&Object.getOwnPropertyNames(this._buffers).length>0)&&Te.warn("Leaked WebGL VAO")}initialize(){if(this._initialized)return;const e=this._context.capabilities.vao;if(e){const t=e.createVertexArray();e.bindVertexArray(t),this._bindLayout(),e.bindVertexArray(null),this._glName=t}this._initialized=!0}bind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(this.glName):(this._context.bindVAO(null),this._bindLayout())}_bindLayout(){const{_buffers:e,_layout:t,_indexBuffer:r}=this;e||Te.error("Vertex buffer dictionary is empty!");const i=this._context.gl;for(const r in e){const i=e[r];i||Te.error("Vertex buffer is uninitialized!");const n=t[r];n||Te.error("Vertex element descriptor is empty!"),j(this._context,this._locations,i,n)}(0,n.pC)(r)&&(this._context.capabilities.vao?i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,r.glName):this._context.bindBuffer(r))}unbind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(null):this._unbindLayout()}_unbindLayout(){const{_buffers:e,_layout:t}=this;e||Te.error("Vertex buffer dictionary is empty!");for(const r in e){const i=e[r];i||Te.error("Vertex buffer is uninitialized!");const n=t[r];J(this._context,this._locations,i,n)}(0,n.pC)(this._indexBuffer)&&this._context.unbindBuffer(this._indexBuffer.bufferType)}}class be{constructor(e,t){this._context=e,this._desc=t,this.type="renderbuffer",this._context.instanceCounter.increment($._g.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:i,height:n,internalFormat:o,multisampled:a}=t;if(a){if(this._context.type!==ge.zO.WEBGL2)throw new Error("Multisampled renderbuffers are not supported in WebGL1!");r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,i,n)}else r.renderbufferStorage(r.RENDERBUFFER,o,i,n)}get descriptor(){return this._desc}get samples(){const e=this._desc.samples,t=this._context.parameters.maxSamples;return e?Math.min(e,t):t}resize(e,t){const r=this._desc;if(r.width===e&&r.height===t)return;r.width=e,r.height=t;const i=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?i.renderbufferStorageMultisample(i.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):i.renderbufferStorage(i.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement($._g.Renderbuffer,this),this._context=null)}}const Ae=A.Z.getLogger("esri.views.webgl.FrameBufferObject");class Ee{constructor(e,t,r=null,i=null){if(this._context=e,this._glName=null,this._depthAttachment=null,this._stencilAttachment=null,this._colorAttachments=new Map,this._initialized=!1,this._desc={...t},e.instanceCounter.increment($._g.FramebufferObject,this),(0,n.pC)(r)){Array.isArray(r)||(r=[r]);for(let e=0;e<r.length;++e){const t=r[e],i=$.VY.COLOR_ATTACHMENT0+e;let n;Re(t)?(Se(t)?(n=t.descriptor,this._colorAttachments.set(i,t)):(n=t,this._colorAttachments.set(i,new X.x(this._context,n))),Ce(n,this._desc)):(Me(t)?(n=t.descriptor,this._colorAttachments.set(i,t)):(n=t,this._colorAttachments.set(i,new be(this._context,n))),we(n,this._desc)),this._validateColorAttachmentPoint(i)}}if((0,n.pC)(i)){let e,t;if(Re(i))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),Se(i)?(t=i.descriptor,this._depthStencilTexture=i):(t=i,this._depthStencilTexture=new X.x(this._context,t)),Ce(t,this._desc);else{Me(i)?(t=i.descriptor,e=i):(t=i,e=new be(this._context,t));const r=this._desc.depthStencilTarget??$.OU.DEPTH_STENCIL_RENDER_BUFFER;r===$.OU.STENCIL_RENDER_BUFFER?this._stencilAttachment=e:r===$.OU.DEPTH_RENDER_BUFFER||r===$.OU.DEPTH_STENCIL_RENDER_BUFFER?this._depthAttachment=e:console.error('If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER'),we(t,this._desc)}}}dispose(){if(!this._desc)return;const e=this._context.getBoundFramebufferObject();this._disposeColorAttachments(),this._disposeDepthStencilAttachments(),this._glName&&(this._context.gl.deleteFramebuffer(this._glName),this._glName=null),this._context.bindFramebuffer(e),this._context.instanceCounter.decrement($._g.FramebufferObject,this),this._desc=null}get glName(){return this._glName}get descriptor(){return this._desc}get colorTexture(){const e=this._colorAttachments.get($.VY.COLOR_ATTACHMENT0);return e&&Se(e)?e:null}get colorAttachment(){return this._colorAttachments.get($.VY.COLOR_ATTACHMENT0)}get depthStencilAttachment(){return this._depthStencilTexture||this._depthAttachment||this._stencilAttachment}get depthStencilTexture(){return this._depthStencilTexture}get width(){return this._desc.width}get height(){return this._desc.height}get gpuMemoryUsage(){return[...this._colorAttachments].reduce(((e,[t,r])=>e+Z(r)),0)+Z(this.depthStencilAttachment)}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&Se(t)?t:null}attachColorTexture(e,t=$.VY.COLOR_ATTACHMENT0){e&&(this._validateColorAttachmentPoint(t),Ce(e.descriptor,this._desc),this._disposeColorAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t)),this._colorAttachments.set(t,e))}detachColorTexture(e=$.VY.COLOR_ATTACHMENT0){const t=this._colorAttachments.get(e);if(Se(t)){const r=t;return this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e)),this._colorAttachments.delete(e),r}}setColorTextureTarget(e,t=$.VY.COLOR_ATTACHMENT0){const r=this._colorAttachments.get(t);Se(r)&&this._framebufferTexture2D(r.glName,t,e)}attachDepthStencilTexture(e){if((0,n.Wi)(e))return;const t=e.descriptor;t.pixelFormat!==$.VI.DEPTH_STENCIL&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),t.dataType!==$.Br.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),Ce(t,this._desc),this._desc.depthStencilTarget&&this._desc.depthStencilTarget!==$.OU.DEPTH_STENCIL_TEXTURE&&(this._desc.depthStencilTarget=$.OU.DEPTH_STENCIL_TEXTURE),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,$.Lu)),this._depthStencilTexture=e}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,$.Lu)),this._depthStencilTexture=null,e}attachDepthStencilBuffer(e){if((0,n.Wi)(e))return;const t=e.descriptor;if(t.internalFormat!==$.Tg.DEPTH_STENCIL&&t.internalFormat!==$.Tg.DEPTH_COMPONENT16&&console.error("Depth/Stencil buffer must have correct internalFormat"),we(t,this._desc),this._disposeDepthStencilAttachments(),this._desc.depthStencilTarget=t.internalFormat===$.Tg.DEPTH_STENCIL?$.OU.DEPTH_STENCIL_RENDER_BUFFER:$.OU.DEPTH_RENDER_BUFFER,this._initialized){this._context.bindFramebuffer(this);const t=this._context.gl,r=this._desc.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer($.qi.FRAMEBUFFER,r,t.RENDERBUFFER,e.glName)}this._depthAttachment=e}detachDepthStencilBuffer(){const e=this._context.gl,t=this._depthAttachment;if(t&&this._initialized){this._context.bindFramebuffer(this);const t=this._desc.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer($.qi.FRAMEBUFFER,t,e.RENDERBUFFER,null)}return this._depthAttachment=null,t}detachAll(){this._colorAttachments.forEach(((e,t)=>this._detachColorAttachment(t))),this.detachDepthStencilBuffer(),this.detachDepthStencilTexture()}copyToTexture(e,t,r,i,n,o,a){(e<0||t<0||n<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const s=this._desc,l=a.descriptor;a.descriptor.target!==$.No.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),(e+r>s.width||t+i>s.height||n+r>l.width||o+i>l.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,u=c.bindTexture(a,X.x.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(X.x.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D($.No.TEXTURE_2D,0,n,o,e,t,r,i),c.bindTexture(u,X.x.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,n,o,a){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,n,o,a)}async readPixelsAsync(e,t,r,i,n,o,a){if(this._context.type!==ge.zO.WEBGL2)return(0,pe.hZ)()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(e,t,r,i,n,o,a);const s=this._context.gl,l=ve.createPixelPack(this._context,$.l1.STREAM_READ,a.byteLength);this._context.bindBuffer(l),this._context.bindFramebuffer(this),s.readPixels(e,t,r,i,n,o,0),this._context.unbindBuffer($.w0.PIXEL_PACK_BUFFER),await l.getSubDataAsync(a),l.dispose()}resize(e,t){const r=this._desc;if(r.width!==e||r.height!==t){if(!this._initialized)return r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),void(this._depthStencilTexture&&this._depthStencilTexture.resize(e,t));r.width=e,r.height=t,this._colorAttachments.forEach((r=>{r&&r.resize(e,t)})),null!=this._depthStencilTexture?this._depthStencilTexture.resize(e,t):(this._depthAttachment||this._stencilAttachment)&&(this._depthAttachment&&this._depthAttachment.resize(e,t),this._stencilAttachment&&this._stencilAttachment.resize(e,t)),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1}}initializeAndBind(e=$.qi.FRAMEBUFFER){const t=this._context.gl;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=this._context,i=t.createFramebuffer(),n=this._desc,o=n.colorTarget??$.Lm.RENDER_BUFFER,a=n.width??1,s=n.height??1;if(t.bindFramebuffer(e,i),0===this._colorAttachments.size)if(o===$.Lm.TEXTURE||o===$.Lm.CUBEMAP)this._colorAttachments.set($.VY.COLOR_ATTACHMENT0,function(e,t,r){return new X.x(e,{target:r,pixelFormat:$.VI.RGBA,dataType:$.Br.UNSIGNED_BYTE,samplingMode:$.cw.NEAREST,wrapMode:$.e8.CLAMP_TO_EDGE,width:t.width,height:t.height})}(r,n,this.descriptor.colorTarget===$.Lm.CUBEMAP?$.No.TEXTURE_CUBE_MAP:$.No.TEXTURE_2D));else{const e=new be(r,{internalFormat:$.lP.RGBA4,width:a,height:s});this._colorAttachments.set($.VY.COLOR_ATTACHMENT0,e)}this._colorAttachments.forEach(((r,i)=>{r&&(Se(r)?this._framebufferTexture2D(r.glName,i,ye(r),e):t.framebufferRenderbuffer(e,i,t.RENDERBUFFER,r.glName))}));const l=n.depthStencilTarget??$.OU.NONE;switch(l){case $.OU.DEPTH_RENDER_BUFFER:case $.OU.DEPTH_STENCIL_RENDER_BUFFER:{this._depthAttachment||(this._depthAttachment=new be(r,{internalFormat:n.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?$.Tg.DEPTH_COMPONENT16:$.Tg.DEPTH_STENCIL,width:a,height:s}));const i=l===$.OU.DEPTH_RENDER_BUFFER?t.DEPTH_ATTACHMENT:t.DEPTH_STENCIL_ATTACHMENT;t.framebufferRenderbuffer(e,i,t.RENDERBUFFER,this._depthAttachment.glName);break}case $.OU.STENCIL_RENDER_BUFFER:this._stencilAttachment||(this._stencilAttachment=new be(r,{internalFormat:$.Tg.STENCIL_INDEX8,width:a,height:s})),t.framebufferRenderbuffer(e,t.STENCIL_ATTACHMENT,t.RENDERBUFFER,this._stencilAttachment.glName);break;case $.OU.DEPTH_STENCIL_TEXTURE:if(!this._depthStencilTexture){r.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!");const e={target:$.No.TEXTURE_2D,pixelFormat:$.VI.DEPTH_STENCIL,dataType:$.Br.UNSIGNED_INT_24_8,samplingMode:$.cw.NEAREST,wrapMode:$.e8.CLAMP_TO_EDGE,width:a,height:s};this._depthStencilTexture=new X.x(r,e)}this._framebufferTexture2D(this._depthStencilTexture.glName,t.DEPTH_STENCIL_ATTACHMENT,ye(this._depthStencilTexture),e)}(0,pe.CG)()&&t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=i,this._initialized=!0}_framebufferTexture2D(e,t=$.VY.COLOR_ATTACHMENT0,r=$.No.TEXTURE_2D,i=$.qi.FRAMEBUFFER,n=0){this._context.gl.framebufferTexture2D(i,t,r,e,n)}_detachColorAttachment(e){(0,pe.hZ)()&&console.warn("Detaching an FBO attachment can be a slow due to invalidating framebuffer completeness!");const t=this._context.gl,r=this._colorAttachments.get(e);return Se(r)?this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e)):this._initialized&&(this._context.bindFramebuffer(this),t.framebufferRenderbuffer($.qi.FRAMEBUFFER,e,t.RENDERBUFFER,null)),this._colorAttachments.delete(e),r}_disposeColorAttachments(){this._colorAttachments.forEach(((e,t)=>{this._detachColorAttachment(t),e.dispose()})),this._colorAttachments.clear()}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthAttachment){if(this._initialized){this._context.bindFramebuffer(this);const t=this._desc.depthStencilTarget===$.OU.DEPTH_RENDER_BUFFER?e.DEPTH_ATTACHMENT:e.DEPTH_STENCIL_ATTACHMENT;e.framebufferRenderbuffer($.qi.FRAMEBUFFER,t,e.RENDERBUFFER,null)}this._depthAttachment.dispose(),this._depthAttachment=null}this._stencilAttachment&&(this._initialized&&(this._context.bindFramebuffer(this),e.framebufferRenderbuffer($.qi.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,null)),this._stencilAttachment.dispose(),this._stencilAttachment=null),this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture.dispose(),this._depthStencilTexture=null)}_validateColorAttachmentPoint(e){if(-1===Ee._MAX_COLOR_ATTACHMENTS){const e=this._context.capabilities.drawBuffers;if(e){const t=this._context.gl;Ee._MAX_COLOR_ATTACHMENTS=t.getParameter(e.MAX_COLOR_ATTACHMENTS)}else Ee._MAX_COLOR_ATTACHMENTS=1}const t=e-$.VY.COLOR_ATTACHMENT0;t+1>Ee._MAX_COLOR_ATTACHMENTS&&Ae.error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${t+1}. Implementation supports up to ${Ee._MAX_COLOR_ATTACHMENTS} color attachments`)}}function Se(e){return"type"in e&&"texture"===e.type}function Me(e){return"type"in e&&"renderbuffer"===e.type}function Re(e){return Se(e)||"pixelFormat"in e}function Ce(e,t){e.target!==$.No.TEXTURE_2D&&e.target!==$.No.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Color attachment texture must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}function we(e,t){void 0!==t.width&&t.width>=0&&void 0!==t.height&&t.height>=0?t.width===e.width&&t.height===e.height||console.error("Renderbuffer dimensions must match the framebuffer's!"):(t.width=e.width,t.height=e.height)}function ye(e){return e.descriptor.target===$.No.TEXTURE_CUBE_MAP?$.No.TEXTURE_CUBE_MAP_POSITIVE_X:$.No.TEXTURE_2D}Ee._MAX_COLOR_ATTACHMENTS=-1;var Oe,Pe,Ne=r(46314);class Ie extends P.c{constructor(e,t){super(),this.data=e,this.type=N.U.Texture,this._glTexture=null,this._powerOfTwoStretchInfo=null,this._loadingPromise=null,this._loadingController=null,this.events=new B.Z,this.params=t||{},this.params.mipmap=!1!==this.params.mipmap,this.params.noUnpackFlip=this.params.noUnpackFlip||!1,this.params.preMultiplyAlpha=this.params.preMultiplyAlpha||!1,this.params.wrap=this.params.wrap||{s:$.e8.REPEAT,t:$.e8.REPEAT},this.params.powerOfTwoResizeMode=this.params.powerOfTwoResizeMode||R.CE.STRETCH,this.estimatedTexMemRequired=Ie._estimateTexMemRequired(this.data,this.params),this._startPreload()}_startPreload(){const e=this.data;(0,n.Wi)(e)||(e instanceof HTMLVideoElement?this._startPreloadVideoElement(e):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!((0,G.jc)(e.src)||"auto"===e.preload&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const t=!e.paused;if(e.src=e.src,t&&e.autoplay){const t=()=>{e.removeEventListener("canplay",t),e.play()};e.addEventListener("canplay",t)}}}_startPreloadImageElement(e){(0,G.HK)(e.src)||(0,G.jc)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}static _getDataDimensions(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}static _estimateTexMemRequired(e,t){if((0,n.Wi)(e))return 0;if((0,z.eP)(e)||(0,z.lq)(e))return t.encoding===Ie.KTX2_ENCODING?function(e,t){if((0,n.Wi)(K))return e.byteLength;const r=new K.KTX2File(new Uint8Array(e)),i=ie(r)?te(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,t.mipmap):t.encoding===Ie.BASIS_ENCODING?function(e,t){if((0,n.Wi)(K))return e.byteLength;const r=new K.BasisFile(new Uint8Array(e)),i=re(r)?te(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Ie._getDataDimensions(e):t;return(t.mipmap?4/3:1)*r*i*(t.components||4)||0}dispose(){this.data=void 0}get width(){return this.params.width}get height(){return this.params.height}_createDescriptor(e){return{target:$.No.TEXTURE_2D,pixelFormat:$.VI.RGBA,dataType:$.Br.UNSIGNED_BYTE,wrapMode:this.params.wrap,flipped:!this.params.noUnpackFlip,samplingMode:this.params.mipmap?$.cw.LINEAR_MIPMAP_LINEAR:$.cw.LINEAR,hasMipmap:this.params.mipmap,preMultiplyAlpha:this.params.preMultiplyAlpha,maxAnisotropy:this.params.maxAnisotropy??(this.params.mipmap?e.parameters.maxMaxAnisotropy:1)}}get glTexture(){return this._glTexture}load(e,t){if((0,n.pC)(this._glTexture))return this._glTexture;if((0,n.pC)(this._loadingPromise))return this._loadingPromise;const r=this.data;return(0,n.Wi)(r)?(this._glTexture=new X.x(e,this._createDescriptor(e),null),this._glTexture):"string"==typeof r?this._loadFromURL(e,t,r):r instanceof Image?this._loadFromImageElement(e,t,r):r instanceof HTMLVideoElement?this._loadFromVideoElement(e,t,r):r instanceof ImageData||r instanceof HTMLCanvasElement?this._loadFromImage(e,r,t):((0,z.eP)(r)||(0,z.lq)(r))&&this.params.encoding===Ie.DDS_ENCODING?(this.data=void 0,this._loadFromDDSData(e,r)):((0,z.eP)(r)||(0,z.lq)(r))&&this.params.encoding===Ie.KTX2_ENCODING?(this.data=void 0,this._loadFromKTX2(e,r)):((0,z.eP)(r)||(0,z.lq)(r))&&this.params.encoding===Ie.BASIS_ENCODING?(this.data=void 0,this._loadFromBasis(e,r)):(0,z.lq)(r)?this._loadFromPixelData(e,r):(0,z.eP)(r)?this._loadFromPixelData(e,new Uint8Array(r)):null}get requiresFrameUpdates(){return this.data instanceof HTMLVideoElement}frameUpdate(e,t,r){if(!(this.data instanceof HTMLVideoElement)||(0,n.Wi)(this._glTexture))return r;if(this.data.readyState<Oe.HAVE_CURRENT_DATA||r===this.data.currentTime)return r;if((0,n.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:r,vao:i,sourceTexture:n}=this._powerOfTwoStretchInfo;n.setData(this.data),this._drawStretchedTexture(e,t,r,i,n,this._glTexture)}else{const{videoWidth:e,videoHeight:t}=this.data,{width:r,height:i}=this._glTexture.descriptor;e!==r||t!==i?this._glTexture.updateData(0,0,0,Math.min(e,r),Math.min(t,i),this.data):this._glTexture.setData(this.data)}return this._glTexture.descriptor.hasMipmap&&this._glTexture.generateMipmap(),this.params.updateCallback&&this.params.updateCallback(),this.data.currentTime}_loadFromDDSData(e,t){return this._glTexture=function(e,t,r){const{textureData:i,internalFormat:n,width:o,height:a}=function(e,t){const r=new Int32Array(e,0,31);if(542327876!==r[0])return oe.error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return oe.error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case se:n=8,o=$.q_.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case le:n=16,o=$.q_.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case ce:n=16,o=$.q_.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return oe.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];0==(3&s)&&0==(3&l)||(oe.warn("Rounding up compressed texture size to nearest multiple of 4."),s=s+3&-4,l=l+3&-4);const c=s,u=l;let d,h;131072&r[2]&&!1!==t&&(a=Math.max(1,r[7])),1===a||(0,U.wt)(s)&&(0,U.wt)(l)||(oe.warn("Ignoring mipmaps of non power of two sized compressed texture."),a=1);let f=r[1]+4;const m=[];for(let t=0;t<a;++t)h=(s+3>>2)*(l+3>>2)*n,d=new Uint8Array(e,f,h),m.push(d),f+=h,s=Math.max(1,s>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:m},internalFormat:o,width:c,height:u}}(r,t.hasMipmap);return t.samplingMode=i.levels.length>1?$.cw.LINEAR_MIPMAP_LINEAR:$.cw.LINEAR,t.hasMipmap=i.levels.length>1,t.internalFormat=n,t.width=o,t.height=a,new X.x(e,t,i)}(e,this._createDescriptor(e),t),this._glTexture}_loadFromKTX2(e,t){return this._loadAsync((()=>async function(e,t,r){(0,n.Wi)(K)&&(K=await ee());const i=new K.KTX2File(new Uint8Array(r));if(!ie(i))return null;i.startTranscoding();const o=ne(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(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromBasis(e,t){return this._loadAsync((()=>async function(e,t,r){(0,n.Wi)(K)&&(K=await ee());const i=new K.BasisFile(new Uint8Array(r));if(!re(i))return null;i.startTranscoding();const o=ne(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(),o}(e,this._createDescriptor(e),t).then((e=>(this._glTexture=e,e)))))}_loadFromPixelData(e,t){(0,w.hu)(this.params.width>0&&this.params.height>0);const r=this._createDescriptor(e);return r.pixelFormat=1===this.params.components?$.VI.LUMINANCE:3===this.params.components?$.VI.RGB:$.VI.RGBA,r.width=this.params.width,r.height=this.params.height,this._glTexture=new X.x(e,r,t),this._glTexture}_loadFromURL(e,t,r){return this._loadAsync((async i=>{const n=await M(r,{signal:i});return(0,E.k_)(i),this._loadFromImage(e,n,t)}))}_loadFromImageElement(e,t,r){return r.complete?this._loadFromImage(e,r,t):this._loadAsync((async i=>{const n=await(0,V.fY)(r,r.src,!1,i);return(0,E.k_)(i),this._loadFromImage(e,n,t)}))}_loadFromVideoElement(e,t,r){return r.readyState>=Oe.HAVE_CURRENT_DATA?this._loadFromImage(e,r,t):this._loadFromVideoElementAsync(e,t,r)}_loadFromVideoElementAsync(e,t,r){return this._loadAsync((i=>new Promise(((o,a)=>{const s=()=>{r.removeEventListener("loadeddata",l),r.removeEventListener("error",c),(0,n.hw)(u)},l=()=>{r.readyState>=Oe.HAVE_CURRENT_DATA&&(s(),o(this._loadFromImage(e,r,t)))},c=e=>{s(),a(e||new b.Z("Failed to load video"))};r.addEventListener("loadeddata",l),r.addEventListener("error",c);const u=(0,E.fu)(i,(()=>c((0,E.zE)())))}))))}_loadFromImage(e,t,r){const i=Ie._getDataDimensions(t);this.params.width=i.width,this.params.height=i.height;const n=this._createDescriptor(e);return n.pixelFormat=3===this.params.components?$.VI.RGB:$.VI.RGBA,!this._requiresPowerOfTwo(e,n)||(0,U.wt)(i.width)&&(0,U.wt)(i.height)?(n.width=i.width,n.height=i.height,this._glTexture=new X.x(e,n,t),this._glTexture):(this._glTexture=this._makePowerOfTwoTexture(e,t,i,n,r),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)};return r.then(i,i),r}_requiresPowerOfTwo(e,t){const r=$.e8.CLAMP_TO_EDGE,i="number"==typeof t.wrapMode?t.wrapMode===r:t.wrapMode.s===r&&t.wrapMode.t===r;return!(0,Ne.Z)(e.gl)&&(t.hasMipmap||!i)}_makePowerOfTwoTexture(e,t,r,i,n){const{width:o,height:a}=r,s=(0,U.Sf)(o),l=(0,U.Sf)(a);let c;switch(i.width=s,i.height=l,this.params.powerOfTwoResizeMode){case R.CE.PAD:i.textureCoordinateScaleFactor=[o/s,a/l],c=new X.x(e,i),c.updateData(0,0,0,o,a,t);break;case R.CE.STRETCH:case null:case void 0:c=this._stretchToPowerOfTwo(e,t,i,n());break;default:(0,H.Bg)(this.params.powerOfTwoResizeMode)}return i.hasMipmap&&c.generateMipmap(),c}_stretchToPowerOfTwo(e,t,r,i){const n=new X.x(e,r),o=new Ee(e,{colorTarget:$.Lm.TEXTURE,depthStencilTarget:$.OU.NONE},n),a=new X.x(e,{target:$.No.TEXTURE_2D,pixelFormat:r.pixelFormat,dataType:$.Br.UNSIGNED_BYTE,wrapMode:$.e8.CLAMP_TO_EDGE,samplingMode:$.cw.LINEAR,flipped:!!r.flipped,maxAnisotropy:8,preMultiplyAlpha:r.preMultiplyAlpha},t),s=function(e,t=he,r=ue.i,i=-1,n=1){let o=null;return o=t===fe?new Float32Array([i,i,0,0,n,i,1,0,i,n,0,1,n,n,1,1]):new Float32Array([i,i,n,i,i,n,n,n]),new xe(e,r,{geometry:t},{geometry:ve.createVertex(e,$.l1.STATIC_DRAW,o)})}(e),l=e.getBoundFramebufferObject();return this._drawStretchedTexture(e,i,o,s,a,n),this.requiresFrameUpdates?this._powerOfTwoStretchInfo={vao:s,sourceTexture:a,framebuffer:o}:(s.dispose(!0),a.dispose(),o.detachColorTexture(),o.dispose()),e.bindFramebuffer(l),n}_drawStretchedTexture(e,t,r,i,n,o){e.bindFramebuffer(r);const a=e.getViewport();e.setViewport(0,0,o.descriptor.width,o.descriptor.height);const s=e.bindTechnique(t);s.setUniform4f("uColor",1,1,1,1),s.bindTexture("tex",n),e.bindVAO(i),e.drawArrays($.MX.TRIANGLE_STRIP,0,function(e,t){return e.vertexBuffers[t].size/function(e){return e[0].stride}(e.layout[t])}(i,"geometry")),e.bindFramebuffer(null),e.setViewport(a.x,a.y,a.width,a.height)}unload(){if((0,n.pC)(this._powerOfTwoStretchInfo)){const{framebuffer:e,vao:t,sourceTexture:r}=this._powerOfTwoStretchInfo;t.dispose(!0),r.dispose(),e.dispose(),this._glTexture=null,this._powerOfTwoStretchInfo=null}if((0,n.pC)(this._glTexture)&&(this._glTexture.dispose(),this._glTexture=null),(0,n.pC)(this._loadingController)){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}}Ie.DDS_ENCODING="image/vnd-ms.dds",Ie.KTX2_ENCODING="image/ktx2",Ie.BASIS_ENCODING="image/x.basis",(Pe=Oe||(Oe={}))[Pe.HAVE_NOTHING=0]="HAVE_NOTHING",Pe[Pe.HAVE_METADATA=1]="HAVE_METADATA",Pe[Pe.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",Pe[Pe.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",Pe[Pe.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA";var De=r(64822),Le=r(65576),Fe=r(18361),He=r(64267),Be=r(19419),Ue=r(85504),ze=r(60537),Ge=r(82791);function Ve(e,t,r=$.db.ADD,i=[0,0,0,0]){return{srcRgb:e,srcAlpha:e,dstRgb:t,dstAlpha:t,opRgb:r,opAlpha:r,color:{r:i[0],g:i[1],b:i[2],a:i[3]}}}const We={face:$.LR.BACK,mode:$.Wf.CCW},qe={face:$.LR.FRONT,mode:$.Wf.CCW},ke=e=>e===R.Vr.Back?We:e===R.Vr.Front?qe:null,$e={zNear:0,zFar:1},Xe={r:!0,g:!0,b:!0,a:!0};function je(e){return nt.intern(e)}function Je(e){return at.intern(e)}function Ye(e){return lt.intern(e)}function Ze(e){return ut.intern(e)}function Ke(e){return ht.intern(e)}function Qe(e){return mt.intern(e)}function et(e){return gt.intern(e)}function tt(e){return vt.intern(e)}class rt{constructor(e,t){this.makeKey=e,this.makeRef=t,this.interns=new Map}intern(e){if(!e)return null;const t=this.makeKey(e),r=this.interns;return r.has(t)||r.set(t,this.makeRef(e)),r.get(t)}}function it(e){return"["+e.join(",")+"]"}const nt=new rt(ot,(e=>({__tag:"Blending",...e})));function ot(e){return e?it([e.srcRgb,e.srcAlpha,e.dstRgb,e.dstAlpha,e.opRgb,e.opAlpha,e.color.r,e.color.g,e.color.b,e.color.a]):null}const at=new rt(st,(e=>({__tag:"Culling",...e})));function st(e){return e?it([e.face,e.mode]):null}const lt=new rt(ct,(e=>({__tag:"PolygonOffset",...e})));function ct(e){return e?it([e.factor,e.units]):null}const ut=new rt(dt,(e=>({__tag:"DepthTest",...e})));function dt(e){return e?it([e.func]):null}const ht=new rt(ft,(e=>({__tag:"StencilTest",...e})));function ft(e){return e?it([e.function.func,e.function.ref,e.function.mask,e.operation.fail,e.operation.zFail,e.operation.zPass]):null}const mt=new rt(pt,(e=>({__tag:"DepthWrite",...e})));function pt(e){return e?it([e.zNear,e.zFar]):null}const gt=new rt(_t,(e=>({__tag:"ColorWrite",...e})));function _t(e){return e?it([e.r,e.g,e.b,e.a]):null}const vt=new rt(Tt,(e=>({__tag:"StencilWrite",...e})));function Tt(e){return e?it([e.mask]):null}const xt=new rt((function(e){return e?it([ot(e.blending),st(e.culling),ct(e.polygonOffset),dt(e.depthTest),ft(e.stencilTest),pt(e.depthWrite),_t(e.colorWrite),Tt(e.stencilWrite)]):null}),(e=>({blending:je(e.blending),culling:Je(e.culling),polygonOffset:Ye(e.polygonOffset),depthTest:Ze(e.depthTest),stencilTest:Ke(e.stencilTest),depthWrite:Qe(e.depthWrite),colorWrite:et(e.colorWrite),stencilWrite:tt(e.stencilWrite)}))),bt=function(e,t,r,i,n=$.db.ADD,o=$.db.ADD,a=[0,0,0,0]){return{srcRgb:e,srcAlpha:t,dstRgb:r,dstAlpha:i,opRgb:n,opAlpha:o,color:{r:a[0],g:a[1],b:a[2],a:a[3]}}}($.zi.SRC_ALPHA,$.zi.ONE,$.zi.ONE_MINUS_SRC_ALPHA,$.zi.ONE_MINUS_SRC_ALPHA),At=Ve($.zi.ONE,$.zi.ONE),Et=Ve($.zi.ZERO,$.zi.ONE_MINUS_SRC_ALPHA);function St(e){return e===R.Am.FrontFace?null:e===R.Am.Alpha?Et:At}const Mt={factor:-1,units:-2};function Rt(e,t=$.wb.LESS){return e===R.Am.NONE||e===R.Am.FrontFace?t:$.wb.LEQUAL}var Ct,wt,yt,Ot;(Ot=Ct||(Ct={}))[Ot.MATERIAL=0]="MATERIAL",Ot[Ot.MATERIAL_ALPHA=1]="MATERIAL_ALPHA",Ot[Ot.MATERIAL_DEPTH=2]="MATERIAL_DEPTH",Ot[Ot.MATERIAL_NORMAL=3]="MATERIAL_NORMAL",Ot[Ot.MATERIAL_DEPTH_SHADOWMAP_ALL=4]="MATERIAL_DEPTH_SHADOWMAP_ALL",Ot[Ot.MATERIAL_HIGHLIGHT=5]="MATERIAL_HIGHLIGHT",Ot[Ot.MATERIAL_DEPTH_SHADOWMAP_DEFAULT=6]="MATERIAL_DEPTH_SHADOWMAP_DEFAULT",Ot[Ot.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT=7]="MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT",(yt=wt||(wt={}))[yt.INTEGRATED_MESH=0]="INTEGRATED_MESH",yt[yt.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",yt[yt.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",yt[yt.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",yt[yt.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",yt[yt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",yt[yt.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",yt[yt.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",yt[yt.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",yt[yt.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",yt[yt.POSTPROCESSING_ENVIRONMENT_OPAQUE=10]="POSTPROCESSING_ENVIRONMENT_OPAQUE",yt[yt.POSTPROCESSING_ENVIRONMENT_TRANSPARENT=11]="POSTPROCESSING_ENVIRONMENT_TRANSPARENT",yt[yt.LASERLINES=12]="LASERLINES",yt[yt.LASERLINES_CONTRAST_CONTROL=13]="LASERLINES_CONTRAST_CONTROL",yt[yt.HUD_MATERIAL=14]="HUD_MATERIAL",yt[yt.LABEL_MATERIAL=15]="LABEL_MATERIAL",yt[yt.LINE_CALLOUTS=16]="LINE_CALLOUTS",yt[yt.LINE_CALLOUTS_HUD_DEPTH=17]="LINE_CALLOUTS_HUD_DEPTH",yt[yt.DRAPED_MATERIAL=18]="DRAPED_MATERIAL",yt[yt.DRAPED_WATER=19]="DRAPED_WATER",yt[yt.VOXEL=20]="VOXEL",yt[yt.MAX_SLOTS=21]="MAX_SLOTS";var Pt=r(51305),Nt=r(94961),It=r(72119),Dt=r(29268);const Lt=(0,u.c)(),Ft=(0,u.c)(),Ht=(0,u.c)(),Bt=new class{constructor(e=0){this.offset=e,this.sphere=(0,Dt.c)(),this.tmpVertex=(0,u.c)()}applyToVertex(e,t,r){const i=this.objectTransform.transform;let n=i[0]*e+i[4]*t+i[8]*r+i[12],o=i[1]*e+i[5]*t+i[9]*r+i[13],a=i[2]*e+i[6]*t+i[10]*r+i[14];const s=this.offset/Math.sqrt(n*n+o*o+a*a);n+=n*s,o+=o*s,a+=a*s;const l=this.objectTransform.inverse;return this.tmpVertex[0]=l[0]*n+l[4]*o+l[8]*a+l[12],this.tmpVertex[1]=l[1]*n+l[5]*o+l[9]*a+l[13],this.tmpVertex[2]=l[2]*n+l[6]*o+l[10]*a+l[14],this.tmpVertex}applyToMinMax(e,t){const r=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*r,e[1]+=e[1]*r,e[2]+=e[2]*r;const i=this.offset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]+=t[0]*i,t[1]+=t[1]*i,t[2]+=t[2]*i}applyToAabb(e){const t=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*t,e[1]+=e[1]*t,e[2]+=e[2]*t;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this.offset/t;return this.sphere[0]=e[0]+e[0]*r,this.sphere[1]=e[1]+e[1]*r,this.sphere[2]=e[2]+e[2]*r,this.sphere[3]=e[3]+e[3]*this.offset/t,this.sphere}};new class{constructor(e=0){this.componentLocalOriginLength=0,this._tmpVertex=(0,u.c)(),this._mbs=(0,Dt.c)(),this._obb={center:(0,u.c)(),halfSize:(0,It.c)(),quaternion:null},this._totalOffset=0,this._offset=0,this._resetOffset(e)}_resetOffset(e){this._offset=e,this._totalOffset=e}set offset(e){this._resetOffset(e)}get offset(){return this._offset}set componentOffset(e){this._totalOffset=this._offset+e}set localOrigin(e){this.componentLocalOriginLength=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])}applyToVertex(e,t,r){const i=e,n=t,o=r+this.componentLocalOriginLength,a=this._totalOffset/Math.sqrt(i*i+n*n+o*o);return this._tmpVertex[0]=e+i*a,this._tmpVertex[1]=t+n*a,this._tmpVertex[2]=r+o*a,this._tmpVertex}applyToAabb(e){const t=e[0],r=e[1],i=e[2]+this.componentLocalOriginLength,n=e[3],o=e[4],a=e[5]+this.componentLocalOriginLength,s=this._totalOffset/Math.sqrt(t*t+r*r+i*i);e[0]+=t*s,e[1]+=r*s,e[2]+=i*s;const l=this._totalOffset/Math.sqrt(n*n+o*o+a*a);return e[3]+=n*l,e[4]+=o*l,e[5]+=a*l,e}applyToMbs(e){const t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=this._totalOffset/t;return this._mbs[0]=e[0]+e[0]*r,this._mbs[1]=e[1]+e[1]*r,this._mbs[2]=e[2]+e[2]*r,this._mbs[3]=e[3]+e[3]*this._totalOffset/t,this._mbs}applyToObb(e){const t=e.center,r=this._totalOffset/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this._obb.center[0]=t[0]+t[0]*r,this._obb.center[1]=t[1]+t[1]*r,this._obb.center[2]=t[2]+t[2]*r,(0,c.q)(this._obb.halfSize,e.halfSize,e.quaternion),(0,c.a)(this._obb.halfSize,this._obb.halfSize,e.center);const i=this._totalOffset/Math.sqrt(this._obb.halfSize[0]*this._obb.halfSize[0]+this._obb.halfSize[1]*this._obb.halfSize[1]+this._obb.halfSize[2]*this._obb.halfSize[2]);return this._obb.halfSize[0]+=this._obb.halfSize[0]*i,this._obb.halfSize[1]+=this._obb.halfSize[1]*i,this._obb.halfSize[2]+=this._obb.halfSize[2]*i,(0,c.b)(this._obb.halfSize,this._obb.halfSize,e.center),(0,Pt.c)(Ut,e.quaternion),(0,c.q)(this._obb.halfSize,this._obb.halfSize,Ut),this._obb.halfSize[0]*=this._obb.halfSize[0]<0?-1:1,this._obb.halfSize[1]*=this._obb.halfSize[1]<0?-1:1,this._obb.halfSize[2]*=this._obb.halfSize[2]<0?-1:1,this._obb.quaternion=e.quaternion,this._obb}},new class{constructor(e=0){this.offset=e,this.tmpVertex=(0,u.c)()}applyToVertex(e,t,r){const i=e+this.localOrigin[0],n=t+this.localOrigin[1],o=r+this.localOrigin[2],a=this.offset/Math.sqrt(i*i+n*n+o*o);return this.tmpVertex[0]=e+i*a,this.tmpVertex[1]=t+n*a,this.tmpVertex[2]=r+o*a,this.tmpVertex}applyToAabb(e){for(let t=0;t<3;++t)Lt[t]=e[0+t]+this.localOrigin[t],Ft[t]=e[3+t]+this.localOrigin[t],Ht[t]=Lt[t];const t=this.applyToVertex(Lt[0],Lt[1],Lt[2]);for(let r=0;r<3;++r)e[r]=t[r],e[r+3]=t[r];const r=t=>{const r=this.applyToVertex(t[0],t[1],t[2]);for(let t=0;t<3;++t)e[t+0]=Math.min(e[t+0],r[t]),e[t+3]=Math.max(e[t+3],r[t])};for(let e=1;e<8;++e){for(let t=0;t<3;++t)Ht[t]=0==(e&1<<t)?Lt[t]:Ft[t];r(Ht)}let i=0;for(let e=0;e<3;++e)Lt[e]*Ft[e]<0&&(i|=1<<e);if(0!==i&&7!==i)for(let e=0;e<8;++e)if(0==(i&e)){for(let t=0;t<3;++t)i[t]?Ht[t]=0:Ht[t]=0!=(e&1<<t)?Lt[t]:Ft[t];r(Ht)}for(let t=0;t<3;++t)e[t+0]-=this.localOrigin[t],e[t+3]-=this.localOrigin[t];return e}};const Ut=(0,Nt.a)();function zt(e,t,r,i){const n=r.typedBuffer,o=r.typedBufferStride,a=e.length;i*=o;for(let r=0;r<a;++r){const a=2*e[r];n[i]=t[a],n[i+1]=t[a+1],i+=o}}function Gt(e,t,r,i,n){const o=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,null==n||1===n)for(let r=0;r<s;++r){const n=3*e[r];o[i]=t[n],o[i+1]=t[n+1],o[i+2]=t[n+2],i+=a}else for(let r=0;r<s;++r){const s=3*e[r];for(let e=0;e<n;++e)o[i]=t[s],o[i+1]=t[s+1],o[i+2]=t[s+2],i+=a}}function Vt(e,t,r,i,n,o=1){if(!r)return void Gt(e,t,i,n,o);const a=i.typedBuffer,s=i.typedBufferStride,l=e.length,c=r[0],u=r[1],d=r[2],h=r[4],f=r[5],m=r[6],p=r[8],g=r[9],_=r[10],v=r[12],T=r[13],x=r[14];if(n*=s,1===o)for(let r=0;r<l;++r){const i=3*e[r],o=t[i],l=t[i+1],b=t[i+2];a[n]=c*o+h*l+p*b+v,a[n+1]=u*o+f*l+g*b+T,a[n+2]=d*o+m*l+_*b+x,n+=s}else for(let r=0;r<l;++r){const i=3*e[r],l=t[i],b=t[i+1],A=t[i+2],E=c*l+h*b+p*A+v,S=u*l+f*b+g*A+T,M=d*l+m*b+_*A+x;for(let e=0;e<o;++e)a[n]=E,a[n+1]=S,a[n+2]=M,n+=s}}function Wt(e,t,r,i,n,o=1){if(!r)return void Gt(e,t,i,n,o);const a=r,l=i.typedBuffer,c=i.typedBufferStride,u=e.length,d=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],_=a[8],v=a[9],T=a[10],x=!(0,s.p)(a),b=1e-6,A=1-b;if(n*=c,1===o)for(let r=0;r<u;++r){const i=3*e[r],o=t[i],a=t[i+1],s=t[i+2];let u=d*o+m*a+_*s,E=h*o+p*a+v*s,S=f*o+g*a+T*s;if(x){const e=u*u+E*E+S*S;if(e<A&&e>b){const t=1/Math.sqrt(e);u*=t,E*=t,S*=t}}l[n+0]=u,l[n+1]=E,l[n+2]=S,n+=c}else for(let r=0;r<u;++r){const i=3*e[r],a=t[i],s=t[i+1],u=t[i+2];let E=d*a+m*s+_*u,S=h*a+p*s+v*u,M=f*a+g*s+T*u;if(x){const e=E*E+S*S+M*M;if(e<A&&e>b){const t=1/Math.sqrt(e);E*=t,S*=t,M*=t}}for(let e=0;e<o;++e)l[n+0]=E,l[n+1]=S,l[n+2]=M,n+=c}}function qt(e,t,r,i,n,o=1){if(!r)return void function(e,t,r,i,n=1){const o=r.typedBuffer,a=r.typedBufferStride,s=e.length;if(i*=a,1===n)for(let r=0;r<s;++r){const n=4*e[r];o[i]=t[n],o[i+1]=t[n+1],o[i+2]=t[n+2],o[i+3]=t[n+3],i+=a}else for(let r=0;r<s;++r){const s=4*e[r];for(let e=0;e<n;++e)o[i]=t[s],o[i+1]=t[s+1],o[i+2]=t[s+2],o[i+3]=t[s+3],i+=a}}(e,t,i,n,o);const a=r,l=i.typedBuffer,c=i.typedBufferStride,u=e.length,d=a[0],h=a[1],f=a[2],m=a[4],p=a[5],g=a[6],_=a[8],v=a[9],T=a[10],x=!(0,s.p)(a),b=1e-6,A=1-b;if(n*=c,1===o)for(let r=0;r<u;++r){const i=4*e[r],o=t[i],a=t[i+1],s=t[i+2],u=t[i+3];let E=d*o+m*a+_*s,S=h*o+p*a+v*s,M=f*o+g*a+T*s;if(x){const e=E*E+S*S+M*M;if(e<A&&e>b){const t=1/Math.sqrt(e);E*=t,S*=t,M*=t}}l[n+0]=E,l[n+1]=S,l[n+2]=M,l[n+3]=u,n+=c}else for(let r=0;r<u;++r){const i=4*e[r],a=t[i],s=t[i+1],u=t[i+2],E=t[i+3];let S=d*a+m*s+_*u,M=h*a+p*s+v*u,R=f*a+g*s+T*u;if(x){const e=S*S+M*M+R*R;if(e<A&&e>b){const t=1/Math.sqrt(e);S*=t,M*=t,R*=t}}for(let e=0;e<o;++e)l[n+0]=S,l[n+1]=M,l[n+2]=R,l[n+3]=E,n+=c}}function kt(e,t,r,i,n,o=1){const a=i.typedBuffer,s=i.typedBufferStride,l=e.length;if(n*=s,1===o){if(4===r)for(let r=0;r<l;++r){const i=4*e[r];a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=t[i+3],n+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=255,n+=s}}else if(4===r)for(let r=0;r<l;++r){const i=4*e[r];for(let e=0;e<o;++e)a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=t[i+3],n+=s}else if(3===r)for(let r=0;r<l;++r){const i=3*e[r];for(let e=0;e<o;++e)a[n]=t[i],a[n+1]=t[i+1],a[n+2]=t[i+2],a[n+3]=255,n+=s}}var $t=r(37782),Xt=r(88669),jt=r(135),Jt=r(15719),Yt=r(96310),Zt=r(89243);class Kt{constructor(e,t){this._module=e,this._loadModule=t}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}}var Qt=r(67498);class er{constructor(e,t,r){this._context=e,this._locations=r,this._textures=new Map,this._freeTextureUnits=new C.Z({deallocator:null}),this._glProgram=e.programCache.acquire(t.generate("vertex"),t.generate("fragment"),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=t.generateBind(Qt.P.Pass,this),this.bindDraw=t.generateBind(Qt.P.Draw,this),this._fragmentUniforms=(0,pe.hZ)()?t.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get isCompiled(){return this._glProgram.isCompiled}setUniform1b(e,t){this._glProgram.setUniform1i(e,t?1:0)}setUniform1i(e,t){this._glProgram.setUniform1i(e,t)}setUniform1f(e,t){this._glProgram.setUniform1f(e,t)}setUniform2f(e,t,r){this._glProgram.setUniform2f(e,t,r)}setUniform2fv(e,t){this._glProgram.setUniform2fv(e,t)}setUniform3f(e,t,r,i){this._glProgram.setUniform3f(e,t,r,i)}setUniform3fv(e,t){this._glProgram.setUniform3fv(e,t)}setUniform4f(e,t,r,i,n){this._glProgram.setUniform4f(e,t,r,i,n)}setUniform4fv(e,t){this._glProgram.setUniform4fv(e,t)}setUniformMatrix3fv(e,t){this._glProgram.setUniformMatrix3fv(e,t)}setUniformMatrix4fv(e,t){this._glProgram.setUniformMatrix4fv(e,t)}setUniform1fv(e,t){this._glProgram.setUniform1fv(e,t)}setUniform1iv(e,t){this._glProgram.setUniform1iv(e,t)}setUniform2iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform3iv(e,t){this._glProgram.setUniform3iv(e,t)}setUniform4iv(e,t){this._glProgram.setUniform4iv(e,t)}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,t){if((0,n.Wi)(t)||null==t.glName){const t=this._textures.get(e);return t&&(this._context.bindTexture(null,t.unit),this._freeTextureUnit(t),this._textures.delete(e)),null}let r=this._textures.get(e);return null==r?(r=this._allocTextureUnit(t),this._textures.set(e,r)):r.texture=t,this._context.useProgram(this),this.setUniform1i(e,r.unit),this._context.bindTexture(t,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach(((e,t)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(t,e.unit)})),(0,n.pC)(this._fragmentUniforms)&&this._fragmentUniforms.forEach((e=>{"sampler2D"!==e.type&&"samplerCube"!==e.type||this._textures.has(e.name)||console.error(`Texture sampler ${e.name} has no bound texture`)}))}_allocTextureUnit(e){return{texture:e,unit:0===this._freeTextureUnits.length?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}}$.wb.LESS,$.wb.ALWAYS;const tr={mask:255},rr={function:{func:$.wb.ALWAYS,ref:R.hU.OutlineVisualElementMask,mask:R.hU.OutlineVisualElementMask},operation:{fail:$.xS.KEEP,zFail:$.xS.KEEP,zPass:$.xS.ZERO}},ir={function:{func:$.wb.ALWAYS,ref:R.hU.OutlineVisualElementMask,mask:R.hU.OutlineVisualElementMask},operation:{fail:$.xS.KEEP,zFail:$.xS.KEEP,zPass:$.xS.REPLACE}};$.wb.EQUAL,R.hU.OutlineVisualElementMask,R.hU.OutlineVisualElementMask,$.xS.KEEP,$.xS.KEEP,$.xS.KEEP,$.wb.NOTEQUAL,R.hU.OutlineVisualElementMask,R.hU.OutlineVisualElementMask,$.xS.KEEP,$.xS.KEEP,$.xS.KEEP;var nr=r(32078);class or extends Jt.d4{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=(0,u.f)(0,1,.5),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=R.Vr.Back,this.emissiveFactor=(0,u.f)(0,0,0),this.instancedDoublePrecision=!1,this.normals="default",this.receiveSSAO=!0,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=(0,u.f)(.2,.2,.2),this.diffuse=(0,u.f)(.8,.8,.8),this.externalColor=(0,Xt.f)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,u.c)(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSizeEnabled=!1,this.vvSizeMinSize=[1,1,1],this.vvSizeMaxSize=[100,100,100],this.vvSizeOffset=[0,0,0],this.vvSizeFactor=[1,1,1],this.vvSizeValue=[1,1,1],this.vvColorEnabled=!1,this.vvColorValues=[0,0,0,0,0,0,0,0],this.vvColorColors=[1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0],this.vvSymbolAnchor=[0,0,0],this.vvSymbolRotationMatrix=(0,a.c)(),this.vvOpacityEnabled=!1,this.vvOpacityValues=[],this.vvOpacityOpacities=[],this.transparent=!1,this.writeDepth=!0,this.customDepthTest=R.Gv.Less,this.textureAlphaMode=R.JJ.Blend,this.textureAlphaCutoff=Yt.F,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=Ge.yD.Occlude}}class ar extends class{constructor(e,t,r){this.release=r,t&&(this.initializeConfiguration(e,t),this._configuration=t.snapshot()),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}destroy(){this._program=(0,n.O3)(this._program),this._pipeline=this._configuration=null}reload(e){(0,n.O3)(this._program),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}get program(){return this._program}get compiled(){return this.program.isCompiled}get key(){return this._configuration.key}get configuration(){return this._configuration}bindPass(e,t){this.program.bindPass(e,t)}bindDraw(e,t){this.program.bindDraw(e,t),this.program.rebindTextures()}bindPipelineState(e,t=null,r){e.setPipelineState(this.getPipelineState(t,r))}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return $.MX.TRIANGLES}getPipelineState(e,t){return this._pipeline}initializeConfiguration(e,t){}}{initializeConfiguration(e,t){t.spherical=e.viewingMode===De.JY.Global,t.doublePrecisionRequiresObfuscation=(0,Zt.I)(e.rctx),t.textureCoordinateType=t.hasColorTexture||t.hasMetalnessAndRoughnessTexture||t.hasEmissionTexture||t.hasOcclusionTexture||t.hasNormalTexture?jt.N.Default:jt.N.None}initializeProgram(e){return this._initializeProgram(e,ar.shader)}_initializeProgram(e,t){const r=t.get().build(this.configuration);return new er(e.rctx,r,ue.i)}_convertDepthTestFunction(e){return e===R.Gv.Lequal?$.wb.LEQUAL:$.wb.LESS}_setPipeline(e,t){const r=this.configuration,i=e===R.Am.NONE,n=e===R.Am.FrontFace;return function(e){return xt.intern(e)}({blending:r.output!==Fe.H.Color&&r.output!==Fe.H.Alpha||!r.transparent?null:i?bt:St(e),culling:sr(r)&&ke(r.cullFace),depthTest:{func:Rt(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:i||n?r.writeDepth&&$e:null,colorWrite:Xe,stencilWrite:r.hasOccludees?tr:null,stencilTest:r.hasOccludees?t?ir:rr:null,polygonOffset:i||n?null:(o=r.enableOffset,o?Mt:null)});var o}initializePipeline(){return this._occludeePipelineState=this._setPipeline(this.configuration.transparencyPassType,!0),this._setPipeline(this.configuration.transparencyPassType,!1)}getPipelineState(e,t){return t?this._occludeePipelineState:super.getPipelineState(e,t)}}function sr(e){return e.cullFace!==R.Vr.None||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}ar.shader=new Kt(nr.D,(()=>r.e(9291).then(r.bind(r,79291))));var lr=r(43697);function cr(e={}){return(t,r)=>{if(t._parameterNames=t._parameterNames??[],t._parameterNames.push(r),null!=e.constValue)Object.defineProperty(t,r,{get:()=>e.constValue});else{const i=t._parameterNames.length-1,n=e.count||2,o=Math.ceil(Math.log2(n)),a=t._parameterBits??[0];let s=0;for(;a[s]+o>16;)s++,s>=a.length&&a.push(0);t._parameterBits=a;const l=a[s],c=(1<<o)-1<<l;a[s]+=o,Object.defineProperty(t,r,{get(){return this[i]},set(e){if(this[i]!==e&&(this[i]=e,this._keyDirty=!0,this._parameterBits[s]=this._parameterBits[s]&~c|+e<<l&c,"number"!=typeof e&&"boolean"!=typeof e))throw"Configuration value for "+r+" must be boolean or number, got "+typeof e}})}}}class ur extends class{constructor(){this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map((()=>0)):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,t={key:this.key};for(const r of e)t[r]=this[r];return t}}{}(0,lr._)([cr({constValue:!0})],ur.prototype,"hasSliceHighlight",void 0),(0,lr._)([cr({constValue:!1})],ur.prototype,"hasSliceInVertexProgram",void 0),(0,lr._)([cr({constValue:!1})],ur.prototype,"instancedDoublePrecision",void 0),(0,lr._)([cr({constValue:!1})],ur.prototype,"isGround",void 0),(0,lr._)([cr({constValue:Qt.P.Pass})],ur.prototype,"pbrTextureBindType",void 0);class dr extends ur{constructor(){super(...arguments),this.output=Fe.H.Color,this.alphaDiscardMode=R.JJ.Opaque,this.doubleSidedMode=Be.q.None,this.pbrMode=Ue.f7.Disabled,this.cullFace=R.Vr.None,this.transparencyPassType=R.Am.NONE,this.normalType=He.h.Attribute,this.textureCoordinateType=jt.N.None,this.customDepthTest=R.Gv.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetalnessAndRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.hasMultipassTerrain=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1}}(0,lr._)([cr({count:Fe.H.COUNT})],dr.prototype,"output",void 0),(0,lr._)([cr({count:R.JJ.COUNT})],dr.prototype,"alphaDiscardMode",void 0),(0,lr._)([cr({count:Be.q.COUNT})],dr.prototype,"doubleSidedMode",void 0),(0,lr._)([cr({count:Ue.f7.COUNT})],dr.prototype,"pbrMode",void 0),(0,lr._)([cr({count:R.Vr.COUNT})],dr.prototype,"cullFace",void 0),(0,lr._)([cr({count:R.Am.COUNT})],dr.prototype,"transparencyPassType",void 0),(0,lr._)([cr({count:He.h.COUNT})],dr.prototype,"normalType",void 0),(0,lr._)([cr({count:jt.N.COUNT})],dr.prototype,"textureCoordinateType",void 0),(0,lr._)([cr({count:R.Gv.COUNT})],dr.prototype,"customDepthTest",void 0),(0,lr._)([cr()],dr.prototype,"spherical",void 0),(0,lr._)([cr()],dr.prototype,"hasVertexColors",void 0),(0,lr._)([cr()],dr.prototype,"hasSymbolColors",void 0),(0,lr._)([cr()],dr.prototype,"hasVerticalOffset",void 0),(0,lr._)([cr()],dr.prototype,"hasSlicePlane",void 0),(0,lr._)([cr()],dr.prototype,"hasSliceHighlight",void 0),(0,lr._)([cr()],dr.prototype,"hasColorTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasMetalnessAndRoughnessTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasEmissionTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasOcclusionTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasNormalTexture",void 0),(0,lr._)([cr()],dr.prototype,"hasScreenSizePerspective",void 0),(0,lr._)([cr()],dr.prototype,"hasVertexTangents",void 0),(0,lr._)([cr()],dr.prototype,"hasOccludees",void 0),(0,lr._)([cr()],dr.prototype,"hasMultipassTerrain",void 0),(0,lr._)([cr()],dr.prototype,"hasModelTransformation",void 0),(0,lr._)([cr()],dr.prototype,"offsetBackfaces",void 0),(0,lr._)([cr()],dr.prototype,"vvSize",void 0),(0,lr._)([cr()],dr.prototype,"vvColor",void 0),(0,lr._)([cr()],dr.prototype,"receiveShadows",void 0),(0,lr._)([cr()],dr.prototype,"receiveAmbientOcclusion",void 0),(0,lr._)([cr()],dr.prototype,"textureAlphaPremultiplied",void 0),(0,lr._)([cr()],dr.prototype,"instanced",void 0),(0,lr._)([cr()],dr.prototype,"instancedColor",void 0),(0,lr._)([cr()],dr.prototype,"instancedDoublePrecision",void 0),(0,lr._)([cr()],dr.prototype,"doublePrecisionRequiresObfuscation",void 0),(0,lr._)([cr()],dr.prototype,"writeDepth",void 0),(0,lr._)([cr()],dr.prototype,"transparent",void 0),(0,lr._)([cr()],dr.prototype,"enableOffset",void 0),(0,lr._)([cr()],dr.prototype,"cullAboveGround",void 0),(0,lr._)([cr()],dr.prototype,"snowCover",void 0),(0,lr._)([cr({constValue:!0})],dr.prototype,"hasVvInstancing",void 0),(0,lr._)([cr({constValue:!1})],dr.prototype,"useCustomDTRExponentForWater",void 0),(0,lr._)([cr({constValue:!1})],dr.prototype,"supportsTextureAtlas",void 0),(0,lr._)([cr({constValue:!0})],dr.prototype,"useFillLights",void 0);var hr=r(41846);class fr extends ar{initializeConfiguration(e,t){super.initializeConfiguration(e,t),t.hasMetalnessAndRoughnessTexture=!1,t.hasEmissionTexture=!1,t.hasOcclusionTexture=!1,t.hasNormalTexture=!1,t.hasModelTransformation=!1,t.normalType=He.h.Attribute,t.doubleSidedMode=Be.q.WindingOrder,t.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,fr.shader)}}fr.shader=new Kt(hr.R,(()=>r.e(8096).then(r.bind(r,38096))));class mr extends Ge.F5{constructor(e){super(e,gr),this.supportsEdges=!0,this.techniqueConfig=new dr,this.vertexBufferLayout=function(e){const t=e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId,r=(0,Le.U$)().vec3f(D.T.POSITION).vec3f(D.T.NORMAL);return e.hasVertexTangents&&r.vec4f(D.T.TANGENT),t&&r.vec2f(D.T.UV0),e.hasVertexColors&&r.vec4u8(D.T.COLOR),e.hasSymbolColors&&r.vec4u8(D.T.SYMBOLCOLOR),r}(this.parameters),this.instanceBufferLayout=e.instanced?function(e){let t=(0,Le.U$)();return t=e.instancedDoublePrecision?t.vec3f(D.T.MODELORIGINHI).vec3f(D.T.MODELORIGINLO).mat3f(D.T.MODEL).mat3f(D.T.MODELNORMAL):t.mat4f(D.T.MODEL).mat4f(D.T.MODELNORMAL),(0,n.pC)(e.instanced)&&e.instanced.includes("color")&&(t=t.vec4f(D.T.INSTANCECOLOR)),(0,n.pC)(e.instanced)&&e.instanced.includes("featureAttribute")&&(t=t.vec4f(D.T.INSTANCEFEATUREATTRIBUTE)),t}(this.parameters):null}isVisibleInPass(e){return e!==Ct.MATERIAL_DEPTH_SHADOWMAP_ALL&&e!==Ct.MATERIAL_DEPTH_SHADOWMAP_DEFAULT&&e!==Ct.MATERIAL_DEPTH_SHADOWMAP_HIGHLIGHT||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||0===e.layerOpacity)return!1;const{instanced:t,hasVertexColors:r,hasSymbolColors:i,vvColorEnabled:o}=e,a=(0,n.pC)(t)&&t.includes("color"),s="replace"===e.colorMixMode,l=e.opacity>0,c=e.externalColor&&e.externalColor[3]>0;return r&&(a||o||i)?!!s||l:r?s?c:l:a||o||i?!!s||l:s?c:l}getConfiguration(e,t){return this.techniqueConfig.output=e,this.techniqueConfig.hasNormalTexture=!!this.parameters.normalTextureId,this.techniqueConfig.hasColorTexture=!!this.parameters.textureId,this.techniqueConfig.hasVertexTangents=this.parameters.hasVertexTangents,this.techniqueConfig.instanced=!!this.parameters.instanced,this.techniqueConfig.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this.techniqueConfig.vvSize=this.parameters.vvSizeEnabled,this.techniqueConfig.hasVerticalOffset=(0,n.pC)(this.parameters.verticalOffset),this.techniqueConfig.hasScreenSizePerspective=(0,n.pC)(this.parameters.screenSizePerspective),this.techniqueConfig.hasSlicePlane=this.parameters.hasSlicePlane,this.techniqueConfig.hasSliceHighlight=this.parameters.hasSliceHighlight,this.techniqueConfig.alphaDiscardMode=this.parameters.textureAlphaMode,this.techniqueConfig.normalType="screenDerivative"===this.parameters.normals?He.h.ScreenDerivative:He.h.Attribute,this.techniqueConfig.transparent=this.parameters.transparent,this.techniqueConfig.writeDepth=this.parameters.writeDepth,(0,n.pC)(this.parameters.customDepthTest)&&(this.techniqueConfig.customDepthTest=this.parameters.customDepthTest),this.techniqueConfig.hasOccludees=this.parameters.hasOccludees,this.techniqueConfig.cullFace=this.parameters.hasSlicePlane?R.Vr.None:this.parameters.cullFace,this.techniqueConfig.hasMultipassTerrain=t.multipassTerrain.enabled,this.techniqueConfig.cullAboveGround=t.multipassTerrain.cullAboveGround,this.techniqueConfig.hasModelTransformation=(0,n.pC)(this.parameters.modelTransformation),e!==Fe.H.Color&&e!==Fe.H.Alpha||(this.techniqueConfig.hasVertexColors=this.parameters.hasVertexColors,this.techniqueConfig.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this.techniqueConfig.doubleSidedMode=Be.q.WindingOrder:this.techniqueConfig.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?Be.q.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?Be.q.WindingOrder:Be.q.None,this.techniqueConfig.instancedColor=(0,n.pC)(this.parameters.instanced)&&this.parameters.instanced.includes("color"),this.techniqueConfig.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this.techniqueConfig.receiveAmbientOcclusion=!!t.ssaoHelper.ready&&this.parameters.receiveSSAO,this.techniqueConfig.vvColor=this.parameters.vvColorEnabled,this.techniqueConfig.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this.techniqueConfig.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?Ue.f7.Schematic:Ue.f7.Normal:Ue.f7.Disabled,this.techniqueConfig.hasMetalnessAndRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this.techniqueConfig.hasEmissionTexture=!!this.parameters.emissiveTextureId,this.techniqueConfig.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this.techniqueConfig.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this.techniqueConfig.transparencyPassType=t.transparencyPassType,this.techniqueConfig.enableOffset=t.camera.relativeElevation<5e5,this.techniqueConfig.snowCover=this.hasSnowCover(t)),this.techniqueConfig}hasSnowCover(e){return(0,n.pC)(e.weather)&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(e,t,r,i,o,a,s){if((0,n.pC)(this.parameters.verticalOffset)){const e=i.camera;(0,c.s)(Er,r[12],r[13],r[14]);let t=null;switch(i.viewingMode){case De.JY.Global:t=(0,c.n)(br,Er);break;case De.JY.Local:t=(0,c.c)(br,xr)}let n=0;const s=(0,c.b)(Sr,Er,e.eye),l=(0,c.l)(s),u=(0,c.g)(s,s,1/l);let d=null;this.parameters.screenSizePerspective&&(d=(0,c.e)(t,u)),n+=(0,$t.Hx)(e,l,this.parameters.verticalOffset,d,this.parameters.screenSizePerspective),(0,c.g)(t,t,n),(0,c.t)(Ar,t,i.transform.inverseRotation),o=(0,c.b)(vr,o,Ar),a=(0,c.b)(Tr,a,Ar)}var l;(0,$t.Bw)(e,t,i,o,a,(l=i.verticalOffset,(0,n.pC)(l)?(Bt.offset=l,Bt):null),s)}requiresSlot(e){return e===(this.parameters.transparent?this.parameters.writeDepth?wt.TRANSPARENT_MATERIAL:wt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:wt.OPAQUE_MATERIAL)||e===wt.DRAPED_MATERIAL}createGLMaterial(e){return e.output===Fe.H.Color||e.output===Fe.H.Alpha||e.output===Fe.H.Depth||e.output===Fe.H.Normal||e.output===Fe.H.Shadow||e.output===Fe.H.Highlight?new pr(e):null}createBufferWriter(){return new _r(this.vertexBufferLayout,this.instanceBufferLayout)}}class pr extends ze.F{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,c.s)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(t.treeRendering?fr:ar,e)}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==Fe.H.Color&&this._output!==Fe.H.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this._updateParameters(e)}}const gr=new class extends or{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}};class _r{constructor(e,t){this.vertexBufferLayout=e,this.instanceBufferLayout=t}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){return e.indices.get(D.T.POSITION).length}write(e,t,r,i){!function(e,t,r,i,n,o){for(const a of t.fieldNames){const t=e.vertexAttributes.get(a),s=e.indices.get(a);if(t&&s)switch(a){case D.T.POSITION:{(0,w.hu)(3===t.size);const e=n.getField(a,h.ct);e&&Vt(s,t.data,r,e,o);break}case D.T.NORMAL:{(0,w.hu)(3===t.size);const e=n.getField(a,h.ct);e&&Wt(s,t.data,i,e,o);break}case D.T.UV0:{(0,w.hu)(2===t.size);const e=n.getField(a,h.Eu);e&&zt(s,t.data,e,o);break}case D.T.COLOR:{(0,w.hu)(3===t.size||4===t.size);const e=n.getField(a,h.mc);e&&kt(s,t.data,t.size,e,o);break}case D.T.SYMBOLCOLOR:{(0,w.hu)(3===t.size||4===t.size);const e=n.getField(a,h.mc);e&&kt(s,t.data,t.size,e,o);break}case D.T.TANGENT:{(0,w.hu)(4===t.size);const e=n.getField(a,h.ek);e&&qt(s,t.data,i,e,o);break}}}}(t,this.vertexBufferLayout,e.transformation,e.invTranspTransformation,r,i)}}const vr=(0,u.c)(),Tr=(0,u.c)(),xr=(0,u.f)(0,0,1),br=(0,u.c)(),Ar=(0,u.c)(),Er=(0,u.c)(),Sr=(0,u.c)(),Mr=A.Z.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");function Rr(e){throw new b.Z("",`Request for object resource failed: ${e}`)}function Cr(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(Mr.warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t&&t.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(Mr.warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(Mr.warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(Mr.warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else Mr.warn("Indexed geometries must specify faces"),i=!1;break}default:Mr.warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(Mr.warn("Geometry requires material"),i=!1);const n=e.params.vertexAttributes;for(const e in n)n[e].values||(Mr.warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function wr(e){const t=(0,d.cS)();return e.forEach((e=>{const r=e.boundingInfo;(0,n.pC)(r)&&((0,d.pp)(t,r.getBBMin()),(0,d.pp)(t,r.getBBMax()))})),t}async function yr(e,t){const r=[];for(const i in e){const o=e[i],a=o.images[0].data;if(!a){Mr.warn("Externally referenced texture data is not yet supported");continue}const s=o.encoding+";base64,"+a,l="/textureDefinitions/"+i,c="rgba"===o.channels?o.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:$.e8.REPEAT,t:$.e8.REPEAT},preMultiplyAlpha:Or(c)!==R.JJ.Opaque},d=(0,n.pC)(t)&&t.disableTextures?Promise.resolve(null):M(s,t);r.push(d.then((e=>({refId:l,image:e,params:u,alphaChannelUsage:c}))))}const i=await Promise.all(r),o={};for(const e of i)o[e.refId]=e;return o}function Or(e){switch(e){case"mask":return R.JJ.Mask;case"maskAndTransparency":return R.JJ.MaskBlend;case"none":return R.JJ.Opaque;default:return R.JJ.Blend}}function Pr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const Nr=new S.G(1,2,"wosr");var Ir=r(57758),Dr=r(10816),Lr=r(75488),Fr=r(56067);async function Hr(e,t){const r=Br((0,i.pJ)(e));if("wosr"===r.fileType){const e=await(t.cache?t.cache.loadWOSR(r.url,t):async function(e,t){const r=await async function(e,t){const r=(0,n.pC)(t)&&t.streamDataRequester;if(r)return async function(e,t,r){const i=await(0,x.q6)(t.request(e,"json",r));if(!0===i.ok)return i.value;(0,E.r9)(i.error),Rr(i.error.details.url)}(e,r,t);const i=await(0,x.q6)((0,T.default)(e,(0,n.Wg)(t)));if(!0===i.ok)return i.value.data;(0,E.r9)(i.error),Rr(i.error)}(e,t);return{resource:r,textures:await yr(r.textureDefinitions,t)}}(r.url,t)),i=function(e,t){const r=[],i=[],o=[],a=[],s=e.resource,l=S.G.parse(s.version||"1.0","wosr");Nr.validate(l);const c=s.model.name,d=s.model.geometries,h=s.materialDefinitions,f=e.textures;let m=0;const p=new Map;for(let e=0;e<d.length;e++){const s=d[e];if(!Cr(s))continue;const l=Pr(s),c=s.params.vertexAttributes,g=[];for(const e in c){const t=c[e],r=t.values;g.push([e,{data:r,size:t.valuesPerElement,exclusive:!0}])}const _=[];if("PerAttributeArray"!==s.params.topology){const e=s.params.faces;for(const t in e)_.push([t,new Uint32Array(e[t].values)])}const v=f&&f[l.texture];if(v&&!p.has(l.texture)){const{image:e,params:t}=v,r=new Ie(e,t);a.push(r),p.set(l.texture,r)}const T=p.get(l.texture),x=T?T.id:void 0;let b=o[l.material]?o[l.material][l.texture]:null;if(!b){const e=h[l.material.substring(l.material.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=v&&v.alphaChannelUsage,i=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,a=v?Or(v.alphaChannelUsage):void 0,s={ambient:(0,u.d)(e.diffuse),diffuse:(0,u.d)(e.diffuse),opacity:1-(e.transparency||0),transparent:i,textureAlphaMode:a,textureAlphaCutoff:.33,textureId:x,initTextureTransparent:!0,doubleSided:!0,cullFace:R.Vr.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:!!v&&!!v.params.preMultiplyAlpha};(0,n.pC)(t)&&t.materialParamsMixin&&Object.assign(s,t.materialParamsMixin),b=new mr(s),o[l.material]||(o[l.material]={}),o[l.material][l.texture]=b}i.push(b);const A=new L(g,_);m+=_.position?_.position.length:0,r.push(A)}return{name:c,stageResources:{textures:a,materials:i,geometries:r},pivotOffset:s.model.pivotOffset,boundingBox:wr(r),numberOfVertices:m,lodThreshold:null}}(e,t);return{lods:[i],referenceBoundingBox:i.boundingBox,isEsriSymbolResource:!1,isWosr:!0,remove:e.remove}}const o=await(t.cache?t.cache.loadGLTF(r.url,t,t.usePBR):(0,_.z)(new g.C(t.streamDataRequester),r.url,t,t.usePBR)),a=(0,n.U2)(o.model.meta,"ESRI_proxyEllipsoid");o.meta.isEsriSymbolResource&&(0,n.pC)(a)&&o.meta.uri.includes("/RealisticTrees/")&&function(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];e.customMeta.esriTreeRendering=!0;for(const o of i.parts){const i=o.attributes.normal;if((0,n.Wi)(i))return;const a=o.attributes.position,d=a.count,f=(0,u.c)(),m=(0,u.c)(),g=(0,u.c)(),_=(0,p.gS)(h.mc,d),v=(0,p.gS)(h.ct,d),T=(0,s.a)((0,l.c)(),o.transform);for(let n=0;n<d;n++){a.getVec(n,m),i.getVec(n,f),(0,c.m)(m,m,o.transform),(0,c.b)(g,m,t.center),(0,c.G)(g,g,t.radius);const s=g[2],l=(0,c.l)(g),u=Math.min(.45+.55*l*l,1);(0,c.G)(g,g,t.radius),(0,c.m)(g,g,T),(0,c.n)(g,g),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,c.h)(g,g,f,s>-1?.2:Math.min(-4*s-3.8,1)),v.setVec(n,g),_.set(n,0,255*u),_.set(n,1,255*u),_.set(n,2,255*u),_.set(n,3,255)}o.attributes.normal=v,o.attributes.color=_}}}(o,a);const d=o.meta.isEsriSymbolResource?{usePBR:t.usePBR,isSchematic:!1,treeRendering:!!o.customMeta.esriTreeRendering,mrrFactors:[0,1,.2]}:{usePBR:t.usePBR,isSchematic:!1,treeRendering:!1,mrrFactors:[0,1,.5]},f={...t.materialParamsMixin,treeRendering:!!o.customMeta.esriTreeRendering};if(null!=r.specifiedLodIndex){const e=Ur(o,d,f,r.specifiedLodIndex);let t=e[0].boundingBox;return 0!==r.specifiedLodIndex&&(t=Ur(o,d,f,0)[0].boundingBox),{lods:e,referenceBoundingBox:t,isEsriSymbolResource:o.meta.isEsriSymbolResource,isWosr:!1,remove:o.remove}}const m=Ur(o,d,f);return{lods:m,referenceBoundingBox:m[0].boundingBox,isEsriSymbolResource:o.meta.isEsriSymbolResource,isWosr:!1,remove:o.remove}}function Br(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function Ur(e,t,r,i){const s=e.model,l=(0,a.c)(),c=new Array,u=new Map,g=new Map;return s.lods.forEach(((e,a)=>{if(void 0!==i&&a!==i)return;const _={name:e.name,stageResources:{textures:new Array,materials:new Array,geometries:new Array},lodThreshold:(0,n.pC)(e.lodThreshold)?e.lodThreshold:null,pivotOffset:[0,0,0],numberOfVertices:0,boundingBox:(0,d.cS)()};c.push(_),e.parts.forEach((e=>{const i=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),a=s.materials.get(e.material),c=(0,n.pC)(e.attributes.texCoord0),T=(0,n.pC)(e.attributes.normal),x=function(e){switch(e){case"BLEND":return R.JJ.Blend;case"MASK":return R.JJ.Mask;case"OPAQUE":case null:case void 0:return R.JJ.Opaque}}(a.alphaMode);if(!u.has(i)){if(c){if((0,n.pC)(a.textureColor)&&!g.has(a.textureColor)){const e=s.textures.get(a.textureColor),t={...e.parameters,preMultiplyAlpha:x!==R.JJ.Opaque};g.set(a.textureColor,new Ie(e.data,t))}if((0,n.pC)(a.textureNormal)&&!g.has(a.textureNormal)){const e=s.textures.get(a.textureNormal);g.set(a.textureNormal,new Ie(e.data,e.parameters))}if((0,n.pC)(a.textureOcclusion)&&!g.has(a.textureOcclusion)){const e=s.textures.get(a.textureOcclusion);g.set(a.textureOcclusion,new Ie(e.data,e.parameters))}if((0,n.pC)(a.textureEmissive)&&!g.has(a.textureEmissive)){const e=s.textures.get(a.textureEmissive);g.set(a.textureEmissive,new Ie(e.data,e.parameters))}if((0,n.pC)(a.textureMetallicRoughness)&&!g.has(a.textureMetallicRoughness)){const e=s.textures.get(a.textureMetallicRoughness);g.set(a.textureMetallicRoughness,new Ie(e.data,e.parameters))}}const o=a.color[0]**(1/Ir.K),l=a.color[1]**(1/Ir.K),d=a.color[2]**(1/Ir.K),h=a.emissiveFactor[0]**(1/Ir.K),f=a.emissiveFactor[1]**(1/Ir.K),m=a.emissiveFactor[2]**(1/Ir.K),p=(0,n.pC)(a.textureColor)&&c?g.get(a.textureColor):null;u.set(i,new mr({...t,transparent:x===R.JJ.Blend,customDepthTest:R.Gv.Lequal,textureAlphaMode:x,textureAlphaCutoff:a.alphaCutoff,diffuse:[o,l,d],ambient:[o,l,d],opacity:a.opacity,doubleSided:a.doubleSided,doubleSidedType:"winding-order",cullFace:a.doubleSided?R.Vr.None:R.Vr.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normals:T?"default":"screenDerivative",castShadows:!0,receiveSSAO:!0,textureId:(0,n.pC)(p)?p.id:void 0,colorMixMode:a.colorMixMode,normalTextureId:(0,n.pC)(a.textureNormal)&&c?g.get(a.textureNormal).id:void 0,textureAlphaPremultiplied:(0,n.pC)(p)&&!!p.params.preMultiplyAlpha,occlusionTextureId:(0,n.pC)(a.textureOcclusion)&&c?g.get(a.textureOcclusion).id:void 0,emissiveTextureId:(0,n.pC)(a.textureEmissive)&&c?g.get(a.textureEmissive).id:void 0,metallicRoughnessTextureId:(0,n.pC)(a.textureMetallicRoughness)&&c?g.get(a.textureMetallicRoughness).id:void 0,emissiveFactor:[h,f,m],mrrFactors:[a.metallicFactor,a.roughnessFactor,t.mrrFactors[2]],isSchematic:!1,...r}))}const b=function(e,t){switch(t){case $.MX.TRIANGLES:return(0,v.nh)(e);case $.MX.TRIANGLE_STRIP:return(0,v.DA)(e);case $.MX.TRIANGLE_FAN:return(0,v.jX)(e)}}(e.indices||e.attributes.position.count,e.primitiveType),A=e.attributes.position.count,E=(0,p.gS)(h.ct,A);(0,f.t)(E,e.attributes.position,e.transform);const S=[[D.T.POSITION,{data:E.typedBuffer,size:E.elementCount,exclusive:!0}]],M=[[D.T.POSITION,b]];if((0,n.pC)(e.attributes.normal)){const t=(0,p.gS)(h.ct,A);(0,o.a)(l,e.transform),(0,f.a)(t,e.attributes.normal,l),S.push([D.T.NORMAL,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.NORMAL,b])}if((0,n.pC)(e.attributes.tangent)){const t=(0,p.gS)(h.ek,A);(0,o.a)(l,e.transform),(0,m.t)(t,e.attributes.tangent,l),S.push([D.T.TANGENT,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.TANGENT,b])}if((0,n.pC)(e.attributes.texCoord0)){const t=(0,p.gS)(h.Eu,A);(0,Dr.n)(t,e.attributes.texCoord0),S.push([D.T.UV0,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.UV0,b])}if((0,n.pC)(e.attributes.color)){const t=(0,p.gS)(h.mc,A);if(4===e.attributes.color.elementCount)e.attributes.color instanceof h.ek?(0,m.s)(t,e.attributes.color,255):e.attributes.color instanceof h.mc?(0,Lr.c)(t,e.attributes.color):e.attributes.color instanceof h.v6&&(0,m.s)(t,e.attributes.color,1/256);else{(0,Lr.f)(t,255,255,255,255);const r=new h.ne(t.buffer,0,4);e.attributes.color instanceof h.ct?(0,f.s)(r,e.attributes.color,255):e.attributes.color instanceof h.ne?(0,Fr.c)(r,e.attributes.color):e.attributes.color instanceof h.mw&&(0,f.s)(r,e.attributes.color,1/256)}S.push([D.T.COLOR,{data:t.typedBuffer,size:t.elementCount,exclusive:!0}]),M.push([D.T.COLOR,b])}const C=new L(S,M);_.stageResources.geometries.push(C),_.stageResources.materials.push(u.get(i)),c&&((0,n.pC)(a.textureColor)&&_.stageResources.textures.push(g.get(a.textureColor)),(0,n.pC)(a.textureNormal)&&_.stageResources.textures.push(g.get(a.textureNormal)),(0,n.pC)(a.textureOcclusion)&&_.stageResources.textures.push(g.get(a.textureOcclusion)),(0,n.pC)(a.textureEmissive)&&_.stageResources.textures.push(g.get(a.textureEmissive)),(0,n.pC)(a.textureMetallicRoughness)&&_.stageResources.textures.push(g.get(a.textureMetallicRoughness))),_.numberOfVertices+=A;const w=C.boundingInfo;(0,n.pC)(w)&&((0,d.pp)(_.boundingBox,w.getBBMin()),(0,d.pp)(_.boundingBox,w.getBBMax()))}))})),c}},6206:(e,t,r)=>{var i,n;r.d(t,{a9:()=>i}),r(22021),(n=i||(i={}))[n.Multiply=1]="Multiply",n[n.Ignore=2]="Ignore",n[n.Replace=3]="Replace",n[n.Tint=4]="Tint"},65576:(e,t,r)=>{r.d(t,{U$:()=>s});var i=r(56481),n=r(79583);class o{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const t of e.fieldNames){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 o(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t,r,i){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)}}}class a{constructor(){this.stride=0,this.fields=new Map,this.fieldNames=[]}vec2f(e,t){return this._appendField(e,i.Eu,t),this}vec2f64(e,t){return this._appendField(e,i.q6,t),this}vec3f(e,t){return this._appendField(e,i.ct,t),this}vec3f64(e,t){return this._appendField(e,i.fP,t),this}vec4f(e,t){return this._appendField(e,i.ek,t),this}vec4f64(e,t){return this._appendField(e,i.Cd,t),this}mat3f(e,t){return this._appendField(e,i.gK,t),this}mat3f64(e,t){return this._appendField(e,i.ey,t),this}mat4f(e,t){return this._appendField(e,i.bj,t),this}mat4f64(e,t){return this._appendField(e,i.O1,t),this}vec4u8(e,t){return this._appendField(e,i.mc,t),this}f32(e,t){return this._appendField(e,i.ly,t),this}f64(e,t){return this._appendField(e,i.oS,t),this}u8(e,t){return this._appendField(e,i.D_,t),this}u16(e,t){return this._appendField(e,i.av,t),this}i8(e,t){return this._appendField(e,i.Hz,t),this}vec2i8(e,t){return this._appendField(e,i.Vs,t),this}vec2i16(e,t){return this._appendField(e,i.or,t),this}vec2u8(e,t){return this._appendField(e,i.xA,t),this}vec4u16(e,t){return this._appendField(e,i.v6,t),this}u32(e,t){return this._appendField(e,i.Nu,t),this}_appendField(e,t,r){const i=t.ElementCount*(0,n.n1)(t.ElementType),o=this.stride;this.fields.set(e,{size:i,constructor:t,offset:o,optional:r}),this.stride+=i,this.fieldNames.push(e)}alignTo(e){return this.stride=Math.floor((this.stride+e-1)/e)*e,this}hasField(e){return this.fieldNames.includes(e)}createBuffer(e){return new o(this,e)}createView(e){return new o(this,e)}clone(){const e=new a;return e.stride=this.stride,e.fields=new Map,this.fields.forEach(((t,r)=>e.fields.set(r,t))),e.fieldNames=this.fieldNames.slice(),e.BufferType=this.BufferType,e}}function s(){return new a}},1391:(e,t,r)=>{r.d(t,{q:()=>s});var i=r(18361),n=r(2095),o=r(19693),a=r(74709);function s(e,t){t.output===i.H.Color&&t.receiveShadows?(e.varyings.add("linearDepth","float"),e.vertex.code.add(a.H`void forwardLinearDepth() { linearDepth = gl_Position.w; }`)):t.output===i.H.Depth||t.output===i.H.Shadow?(e.include(n.up,t),e.varyings.add("linearDepth","float"),e.vertex.uniforms.add(new o.A("nearFar",((e,t)=>t.camera.nearFar))),e.vertex.code.add(a.H`void forwardLinearDepth() {
|
|
166
166
|
linearDepth = (-vPosition_view.z - nearFar[0]) / (nearFar[1] - nearFar[0]);
|
|
167
167
|
}`)):e.vertex.code.add(a.H`void forwardLinearDepth() {}`)}},62707:(e,t,r)=>{r.d(t,{w:()=>n});var i=r(74709);function n(e){e.vertex.code.add(i.H`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) {
|
|
168
168
|
vec3 camToVert = posWorld - camPosWorld;
|