0?r.push(g):f.transparent===!0?a.push(g):n.push(g)}function c(m,p,f,y,v,b){const g=o(m,p,f,y,v,b);f.transmission>0?r.unshift(g):f.transparent===!0?a.unshift(g):n.unshift(g)}function d(m,p){n.length>1&&n.sort(m||M_e),r.length>1&&r.sort(p||lH),a.length>1&&a.sort(p||lH)}function u(){for(let m=e,p=t.length;m=s.length?(o=new cH,s.push(o)):o=s[a],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function j_e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Nt,color:new Xn};break;case"SpotLight":n={position:new Nt,direction:new Nt,color:new Xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Nt,color:new Xn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Nt,skyColor:new Xn,groundColor:new Xn};break;case"RectAreaLight":n={color:new Xn,position:new Nt,halfWidth:new Nt,halfHeight:new Nt};break}return t[e.id]=n,n}}}function D_e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wn};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let F_e=0;function R_e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function L_e(t){const e=new j_e,n=D_e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)r.probe.push(new Nt);const a=new Nt,s=new la,o=new la;function l(d){let u=0,m=0,p=0;for(let A=0;A<9;A++)r.probe[A].set(0,0,0);let f=0,y=0,v=0,b=0,g=0,_=0,k=0,C=0,N=0,P=0,T=0;d.sort(R_e);for(let A=0,F=d.length;A0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Xt.LTC_FLOAT_1,r.rectAreaLTC2=Xt.LTC_FLOAT_2):(r.rectAreaLTC1=Xt.LTC_HALF_1,r.rectAreaLTC2=Xt.LTC_HALF_2)),r.ambient[0]=u,r.ambient[1]=m,r.ambient[2]=p;const j=r.hash;(j.directionalLength!==f||j.pointLength!==y||j.spotLength!==v||j.rectAreaLength!==b||j.hemiLength!==g||j.numDirectionalShadows!==_||j.numPointShadows!==k||j.numSpotShadows!==C||j.numSpotMaps!==N||j.numLightProbes!==T)&&(r.directional.length=f,r.spot.length=v,r.rectArea.length=b,r.point.length=y,r.hemi.length=g,r.directionalShadow.length=_,r.directionalShadowMap.length=_,r.pointShadow.length=k,r.pointShadowMap.length=k,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=_,r.pointShadowMatrix.length=k,r.spotLightMatrix.length=C+N-P,r.spotLightMap.length=N,r.numSpotLightShadowsWithMaps=P,r.numLightProbes=T,j.directionalLength=f,j.pointLength=y,j.spotLength=v,j.rectAreaLength=b,j.hemiLength=g,j.numDirectionalShadows=_,j.numPointShadows=k,j.numSpotShadows=C,j.numSpotMaps=N,j.numLightProbes=T,r.version=F_e++)}function c(d,u){let m=0,p=0,f=0,y=0,v=0;const b=u.matrixWorldInverse;for(let g=0,_=d.length;g<_;g++){const k=d[g];if(k.isDirectionalLight){const C=r.directional[m];C.direction.setFromMatrixPosition(k.matrixWorld),a.setFromMatrixPosition(k.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(b),m++}else if(k.isSpotLight){const C=r.spot[f];C.position.setFromMatrixPosition(k.matrixWorld),C.position.applyMatrix4(b),C.direction.setFromMatrixPosition(k.matrixWorld),a.setFromMatrixPosition(k.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(b),f++}else if(k.isRectAreaLight){const C=r.rectArea[y];C.position.setFromMatrixPosition(k.matrixWorld),C.position.applyMatrix4(b),o.identity(),s.copy(k.matrixWorld),s.premultiply(b),o.extractRotation(s),C.halfWidth.set(k.width*.5,0,0),C.halfHeight.set(0,k.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),y++}else if(k.isPointLight){const C=r.point[p];C.position.setFromMatrixPosition(k.matrixWorld),C.position.applyMatrix4(b),p++}else if(k.isHemisphereLight){const C=r.hemi[v];C.direction.setFromMatrixPosition(k.matrixWorld),C.direction.transformDirection(b),v++}}}return{setup:l,setupView:c,state:r}}function dH(t){const e=new L_e(t),n=[],r=[];function a(u){d.camera=u,n.length=0,r.length=0}function s(u){n.push(u)}function o(u){r.push(u)}function l(){e.setup(n)}function c(u){e.setupView(n,u)}const d={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:a,state:d,setupLights:l,setupLightsView:c,pushLight:s,pushShadow:o}}function O_e(t){let e=new WeakMap;function n(a,s=0){const o=e.get(a);let l;return o===void 0?(l=new dH(t),e.set(a,[l])):s>=o.length?(l=new dH(t),o.push(l)):l=o[s],l}function r(){e=new WeakMap}return{get:n,dispose:r}}const I_e=`void main() {
+`+he+`
+`+K)}else ee!==""?En("WebGLProgram: Program Info Log:",ee):(ae===""||X==="")&&(ue=!1);ue&&(G.diagnostics={runnable:ce,programLog:ee,vertexShader:{log:ae,prefix:b},fragmentShader:{log:X,prefix:g}})}a.deleteShader(N),a.deleteShader(P),j=new dk(a,v),A=h_e(a,v)}let j;this.getUniforms=function(){return j===void 0&&T(this),j};let A;this.getAttributes=function(){return A===void 0&&T(this),A};let F=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return F===!1&&(F=a.getProgramParameter(v,i_e)),F},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=a_e++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=N,this.fragmentShader=P,this}let N_e=0,C_e=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,a=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(a)===!1&&(o.add(a),a.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new T_e(e),n.set(e,r)),r}},T_e=class{constructor(e){this.id=N_e++,this.code=e,this.usedTimes=0}};function A_e(t,e,n,r,a,s,o){const l=new OQ,c=new C_e,d=new Set,u=[],m=a.logarithmicDepthBuffer,p=a.vertexTextures;let f=a.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(A){return d.add(A),A===0?"uv":`uv${A}`}function b(A,F,G,z,Z){const I=z.fog,ee=Z.geometry,ae=A.isMeshStandardMaterial?z.environment:null,X=(A.isMeshStandardMaterial?n:e).get(A.envMap||ae),ce=X&&X.mapping===fT?X.image.height:null,ue=y[A.type];A.precision!==null&&(f=a.getMaxPrecision(A.precision),f!==A.precision&&En("WebGLProgram.getParameters:",A.precision,"not supported, using",f,"instead."));const he=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,K=he!==void 0?he.length:0;let se=0;ee.morphAttributes.position!==void 0&&(se=1),ee.morphAttributes.normal!==void 0&&(se=2),ee.morphAttributes.color!==void 0&&(se=3);let de,fe,Te,V;if(ue){const bt=rd[ue];de=bt.vertexShader,fe=bt.fragmentShader}else de=A.vertexShader,fe=A.fragmentShader,c.update(A),Te=c.getVertexShaderID(A),V=c.getFragmentShaderID(A);const J=t.getRenderTarget(),D=t.state.buffers.depth.getReversed(),E=Z.isInstancedMesh===!0,U=Z.isBatchedMesh===!0,W=!!A.map,B=!!A.matcap,ie=!!X,O=!!A.aoMap,$=!!A.lightMap,Y=!!A.bumpMap,q=!!A.normalMap,te=!!A.displacementMap,oe=!!A.emissiveMap,me=!!A.metalnessMap,pe=!!A.roughnessMap,re=A.anisotropy>0,L=A.clearcoat>0,R=A.dispersion>0,ne=A.iridescence>0,ye=A.sheen>0,ve=A.transmission>0,be=re&&!!A.anisotropyMap,Be=L&&!!A.clearcoatMap,we=L&&!!A.clearcoatNormalMap,Ae=L&&!!A.clearcoatRoughnessMap,Le=ne&&!!A.iridescenceMap,Ee=ne&&!!A.iridescenceThicknessMap,_e=ye&&!!A.sheenColorMap,Me=ye&&!!A.sheenRoughnessMap,He=!!A.specularMap,De=!!A.specularColorMap,Xe=!!A.specularIntensityMap,xe=ve&&!!A.transmissionMap,We=ve&&!!A.thicknessMap,Pe=!!A.gradientMap,Ke=!!A.alphaMap,Ve=A.alphaTest>0,Ne=!!A.alphaHash,Ce=!!A.extensions;let $e=Eh;A.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&($e=t.toneMapping);const nt={shaderID:ue,shaderType:A.type,shaderName:A.name,vertexShader:de,fragmentShader:fe,defines:A.defines,customVertexShaderID:Te,customFragmentShaderID:V,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:f,batching:U,batchingColor:U&&Z._colorsTexture!==null,instancing:E,instancingColor:E&&Z.instanceColor!==null,instancingMorph:E&&Z.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:J===null?t.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:yx,alphaToCoverage:!!A.alphaToCoverage,map:W,matcap:B,envMap:ie,envMapMode:ie&&X.mapping,envMapCubeUVHeight:ce,aoMap:O,lightMap:$,bumpMap:Y,normalMap:q,displacementMap:p&&te,emissiveMap:oe,normalMapObjectSpace:q&&A.normalMapType===hye,normalMapTangentSpace:q&&A.normalMapType===AQ,metalnessMap:me,roughnessMap:pe,anisotropy:re,anisotropyMap:be,clearcoat:L,clearcoatMap:Be,clearcoatNormalMap:we,clearcoatRoughnessMap:Ae,dispersion:R,iridescence:ne,iridescenceMap:Le,iridescenceThicknessMap:Ee,sheen:ye,sheenColorMap:_e,sheenRoughnessMap:Me,specularMap:He,specularColorMap:De,specularIntensityMap:Xe,transmission:ve,transmissionMap:xe,thicknessMap:We,gradientMap:Pe,opaque:A.transparent===!1&&A.blending===Zb&&A.alphaToCoverage===!1,alphaMap:Ke,alphaTest:Ve,alphaHash:Ne,combine:A.combine,mapUv:W&&v(A.map.channel),aoMapUv:O&&v(A.aoMap.channel),lightMapUv:$&&v(A.lightMap.channel),bumpMapUv:Y&&v(A.bumpMap.channel),normalMapUv:q&&v(A.normalMap.channel),displacementMapUv:te&&v(A.displacementMap.channel),emissiveMapUv:oe&&v(A.emissiveMap.channel),metalnessMapUv:me&&v(A.metalnessMap.channel),roughnessMapUv:pe&&v(A.roughnessMap.channel),anisotropyMapUv:be&&v(A.anisotropyMap.channel),clearcoatMapUv:Be&&v(A.clearcoatMap.channel),clearcoatNormalMapUv:we&&v(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ae&&v(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Le&&v(A.iridescenceMap.channel),iridescenceThicknessMapUv:Ee&&v(A.iridescenceThicknessMap.channel),sheenColorMapUv:_e&&v(A.sheenColorMap.channel),sheenRoughnessMapUv:Me&&v(A.sheenRoughnessMap.channel),specularMapUv:He&&v(A.specularMap.channel),specularColorMapUv:De&&v(A.specularColorMap.channel),specularIntensityMapUv:Xe&&v(A.specularIntensityMap.channel),transmissionMapUv:xe&&v(A.transmissionMap.channel),thicknessMapUv:We&&v(A.thicknessMap.channel),alphaMapUv:Ke&&v(A.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(q||re),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,pointsUvs:Z.isPoints===!0&&!!ee.attributes.uv&&(W||Ke),fog:!!I,useFog:A.fog===!0,fogExp2:!!I&&I.isFogExp2,flatShading:A.flatShading===!0&&A.wireframe===!1,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:m,reversedDepthBuffer:D,skinning:Z.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:K,morphTextureStride:se,numDirLights:F.directional.length,numPointLights:F.point.length,numSpotLights:F.spot.length,numSpotLightMaps:F.spotLightMap.length,numRectAreaLights:F.rectArea.length,numHemiLights:F.hemi.length,numDirLightShadows:F.directionalShadowMap.length,numPointLightShadows:F.pointShadowMap.length,numSpotLightShadows:F.spotShadowMap.length,numSpotLightShadowsWithMaps:F.numSpotLightShadowsWithMaps,numLightProbes:F.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:t.shadowMap.enabled&&G.length>0,shadowMapType:t.shadowMap.type,toneMapping:$e,decodeVideoTexture:W&&A.map.isVideoTexture===!0&&yr.getTransfer(A.map.colorSpace)===Ur,decodeVideoTextureEmissive:oe&&A.emissiveMap.isVideoTexture===!0&&yr.getTransfer(A.emissiveMap.colorSpace)===Ur,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ad,flipSided:A.side===_o,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:Ce&&A.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ce&&A.extensions.multiDraw===!0||U)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return nt.vertexUv1s=d.has(1),nt.vertexUv2s=d.has(2),nt.vertexUv3s=d.has(3),d.clear(),nt}function g(A){const F=[];if(A.shaderID?F.push(A.shaderID):(F.push(A.customVertexShaderID),F.push(A.customFragmentShaderID)),A.defines!==void 0)for(const G in A.defines)F.push(G),F.push(A.defines[G]);return A.isRawShaderMaterial===!1&&(_(F,A),k(F,A),F.push(t.outputColorSpace)),F.push(A.customProgramCacheKey),F.join()}function _(A,F){A.push(F.precision),A.push(F.outputColorSpace),A.push(F.envMapMode),A.push(F.envMapCubeUVHeight),A.push(F.mapUv),A.push(F.alphaMapUv),A.push(F.lightMapUv),A.push(F.aoMapUv),A.push(F.bumpMapUv),A.push(F.normalMapUv),A.push(F.displacementMapUv),A.push(F.emissiveMapUv),A.push(F.metalnessMapUv),A.push(F.roughnessMapUv),A.push(F.anisotropyMapUv),A.push(F.clearcoatMapUv),A.push(F.clearcoatNormalMapUv),A.push(F.clearcoatRoughnessMapUv),A.push(F.iridescenceMapUv),A.push(F.iridescenceThicknessMapUv),A.push(F.sheenColorMapUv),A.push(F.sheenRoughnessMapUv),A.push(F.specularMapUv),A.push(F.specularColorMapUv),A.push(F.specularIntensityMapUv),A.push(F.transmissionMapUv),A.push(F.thicknessMapUv),A.push(F.combine),A.push(F.fogExp2),A.push(F.sizeAttenuation),A.push(F.morphTargetsCount),A.push(F.morphAttributeCount),A.push(F.numDirLights),A.push(F.numPointLights),A.push(F.numSpotLights),A.push(F.numSpotLightMaps),A.push(F.numHemiLights),A.push(F.numRectAreaLights),A.push(F.numDirLightShadows),A.push(F.numPointLightShadows),A.push(F.numSpotLightShadows),A.push(F.numSpotLightShadowsWithMaps),A.push(F.numLightProbes),A.push(F.shadowMapType),A.push(F.toneMapping),A.push(F.numClippingPlanes),A.push(F.numClipIntersection),A.push(F.depthPacking)}function k(A,F){l.disableAll(),F.supportsVertexTextures&&l.enable(0),F.instancing&&l.enable(1),F.instancingColor&&l.enable(2),F.instancingMorph&&l.enable(3),F.matcap&&l.enable(4),F.envMap&&l.enable(5),F.normalMapObjectSpace&&l.enable(6),F.normalMapTangentSpace&&l.enable(7),F.clearcoat&&l.enable(8),F.iridescence&&l.enable(9),F.alphaTest&&l.enable(10),F.vertexColors&&l.enable(11),F.vertexAlphas&&l.enable(12),F.vertexUv1s&&l.enable(13),F.vertexUv2s&&l.enable(14),F.vertexUv3s&&l.enable(15),F.vertexTangents&&l.enable(16),F.anisotropy&&l.enable(17),F.alphaHash&&l.enable(18),F.batching&&l.enable(19),F.dispersion&&l.enable(20),F.batchingColor&&l.enable(21),F.gradientMap&&l.enable(22),A.push(l.mask),l.disableAll(),F.fog&&l.enable(0),F.useFog&&l.enable(1),F.flatShading&&l.enable(2),F.logarithmicDepthBuffer&&l.enable(3),F.reversedDepthBuffer&&l.enable(4),F.skinning&&l.enable(5),F.morphTargets&&l.enable(6),F.morphNormals&&l.enable(7),F.morphColors&&l.enable(8),F.premultipliedAlpha&&l.enable(9),F.shadowMapEnabled&&l.enable(10),F.doubleSided&&l.enable(11),F.flipSided&&l.enable(12),F.useDepthPacking&&l.enable(13),F.dithering&&l.enable(14),F.transmission&&l.enable(15),F.sheen&&l.enable(16),F.opaque&&l.enable(17),F.pointsUvs&&l.enable(18),F.decodeVideoTexture&&l.enable(19),F.decodeVideoTextureEmissive&&l.enable(20),F.alphaToCoverage&&l.enable(21),A.push(l.mask)}function C(A){const F=y[A.type];let G;if(F){const z=rd[F];G=$ye.clone(z.uniforms)}else G=A.uniforms;return G}function N(A,F){let G;for(let z=0,Z=u.length;z0?r.push(g):f.transparent===!0?a.push(g):n.push(g)}function c(m,p,f,y,v,b){const g=o(m,p,f,y,v,b);f.transmission>0?r.unshift(g):f.transparent===!0?a.unshift(g):n.unshift(g)}function d(m,p){n.length>1&&n.sort(m||M_e),r.length>1&&r.sort(p||lH),a.length>1&&a.sort(p||lH)}function u(){for(let m=e,p=t.length;m=s.length?(o=new cH,s.push(o)):o=s[a],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function j_e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Nt,color:new Xn};break;case"SpotLight":n={position:new Nt,direction:new Nt,color:new Xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Nt,color:new Xn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Nt,skyColor:new Xn,groundColor:new Xn};break;case"RectAreaLight":n={color:new Xn,position:new Nt,halfWidth:new Nt,halfHeight:new Nt};break}return t[e.id]=n,n}}}function D_e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wn};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Wn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let F_e=0;function R_e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function L_e(t){const e=new j_e,n=D_e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)r.probe.push(new Nt);const a=new Nt,s=new la,o=new la;function l(d){let u=0,m=0,p=0;for(let A=0;A<9;A++)r.probe[A].set(0,0,0);let f=0,y=0,v=0,b=0,g=0,_=0,k=0,C=0,N=0,P=0,T=0;d.sort(R_e);for(let A=0,F=d.length;A0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Xt.LTC_FLOAT_1,r.rectAreaLTC2=Xt.LTC_FLOAT_2):(r.rectAreaLTC1=Xt.LTC_HALF_1,r.rectAreaLTC2=Xt.LTC_HALF_2)),r.ambient[0]=u,r.ambient[1]=m,r.ambient[2]=p;const j=r.hash;(j.directionalLength!==f||j.pointLength!==y||j.spotLength!==v||j.rectAreaLength!==b||j.hemiLength!==g||j.numDirectionalShadows!==_||j.numPointShadows!==k||j.numSpotShadows!==C||j.numSpotMaps!==N||j.numLightProbes!==T)&&(r.directional.length=f,r.spot.length=v,r.rectArea.length=b,r.point.length=y,r.hemi.length=g,r.directionalShadow.length=_,r.directionalShadowMap.length=_,r.pointShadow.length=k,r.pointShadowMap.length=k,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=_,r.pointShadowMatrix.length=k,r.spotLightMatrix.length=C+N-P,r.spotLightMap.length=N,r.numSpotLightShadowsWithMaps=P,r.numLightProbes=T,j.directionalLength=f,j.pointLength=y,j.spotLength=v,j.rectAreaLength=b,j.hemiLength=g,j.numDirectionalShadows=_,j.numPointShadows=k,j.numSpotShadows=C,j.numSpotMaps=N,j.numLightProbes=T,r.version=F_e++)}function c(d,u){let m=0,p=0,f=0,y=0,v=0;const b=u.matrixWorldInverse;for(let g=0,_=d.length;g<_;g++){const k=d[g];if(k.isDirectionalLight){const C=r.directional[m];C.direction.setFromMatrixPosition(k.matrixWorld),a.setFromMatrixPosition(k.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(b),m++}else if(k.isSpotLight){const C=r.spot[f];C.position.setFromMatrixPosition(k.matrixWorld),C.position.applyMatrix4(b),C.direction.setFromMatrixPosition(k.matrixWorld),a.setFromMatrixPosition(k.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(b),f++}else if(k.isRectAreaLight){const C=r.rectArea[y];C.position.setFromMatrixPosition(k.matrixWorld),C.position.applyMatrix4(b),o.identity(),s.copy(k.matrixWorld),s.premultiply(b),o.extractRotation(s),C.halfWidth.set(k.width*.5,0,0),C.halfHeight.set(0,k.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),y++}else if(k.isPointLight){const C=r.point[p];C.position.setFromMatrixPosition(k.matrixWorld),C.position.applyMatrix4(b),p++}else if(k.isHemisphereLight){const C=r.hemi[v];C.direction.setFromMatrixPosition(k.matrixWorld),C.direction.transformDirection(b),v++}}}return{setup:l,setupView:c,state:r}}function dH(t){const e=new L_e(t),n=[],r=[];function a(u){d.camera=u,n.length=0,r.length=0}function s(u){n.push(u)}function o(u){r.push(u)}function l(){e.setup(n)}function c(u){e.setupView(n,u)}const d={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:a,state:d,setupLights:l,setupLightsView:c,pushLight:s,pushShadow:o}}function O_e(t){let e=new WeakMap;function n(a,s=0){const o=e.get(a);let l;return o===void 0?(l=new dH(t),e.set(a,[l])):s>=o.length?(l=new dH(t),o.push(l)):l=o[s],l}function r(){e=new WeakMap}return{get:n,dispose:r}}const I_e=`void main() {
gl_Position = vec4( position, 1.0 );
}`,z_e=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
@@ -3951,7 +3951,7 @@ void main() {
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
-}`;function U_e(t,e,n){let r=new bO;const a=new Wn,s=new Wn,o=new ia,l=new nve({depthPacking:mye}),c=new rve,d={},u=n.maxTextureSize,m={[Hh]:_o,[_o]:Hh,[ad]:ad},p=new Ku({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Wn},radius:{value:4}},vertexShader:I_e,fragmentShader:z_e}),f=p.clone();f.defines.HORIZONTAL_PASS=1;const y=new Kl;y.setAttribute("position",new Gs(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Yl(y,p),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=yQ;let g=this.type;this.render=function(P,T,j){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||P.length===0)return;const A=t.getRenderTarget(),F=t.getActiveCubeFace(),G=t.getActiveMipmapLevel(),z=t.state;z.setBlending(Ru),z.buffers.depth.getReversed()===!0?z.buffers.color.setClear(0,0,0,0):z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const Z=g!==fu&&this.type===fu,I=g===fu&&this.type!==fu;for(let ee=0,ae=P.length;eeu||a.y>u)&&(a.x>u&&(s.x=Math.floor(u/ue.x),a.x=s.x*ue.x,ce.mapSize.x=s.x),a.y>u&&(s.y=Math.floor(u/ue.y),a.y=s.y*ue.y,ce.mapSize.y=s.y)),ce.map===null||Z===!0||I===!0){const K=this.type!==fu?{minFilter:Zo,magFilter:Zo}:{};ce.map!==null&&ce.map.dispose(),ce.map=new zf(a.x,a.y,K),ce.map.texture.name=X.name+".shadowMap",ce.camera.updateProjectionMatrix()}t.setRenderTarget(ce.map),t.clear();const pe=ce.getViewportCount();for(let K=0;K0||T.map&&T.alphaTest>0||T.alphaToCoverage===!0){const z=F.uuid,Z=T.uuid;let I=d[z];I===void 0&&(I={},d[z]=I);let ee=I[Z];ee===void 0&&(ee=F.clone(),I[Z]=ee,T.addEventListener("dispose",N)),F=ee}if(F.visible=T.visible,F.wireframe=T.wireframe,A===fu?F.side=T.shadowSide!==null?T.shadowSide:T.side:F.side=T.shadowSide!==null?T.shadowSide:m[T.side],F.alphaMap=T.alphaMap,F.alphaTest=T.alphaToCoverage===!0?.5:T.alphaTest,F.map=T.map,F.clipShadows=T.clipShadows,F.clippingPlanes=T.clippingPlanes,F.clipIntersection=T.clipIntersection,F.displacementMap=T.displacementMap,F.displacementScale=T.displacementScale,F.displacementBias=T.displacementBias,F.wireframeLinewidth=T.wireframeLinewidth,F.linewidth=T.linewidth,j.isPointLight===!0&&F.isMeshDistanceMaterial===!0){const z=t.properties.get(F);z.light=j}return F}function C(P,T,j,A,F){if(P.visible===!1)return;if(P.layers.test(T.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&F===fu)&&(!P.frustumCulled||r.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,P.matrixWorld);const Z=e.update(P),I=P.material;if(Array.isArray(I)){const ee=Z.groups;for(let ae=0,X=ee.length;ae=1):ce.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),ae=X>=2);let ue=null,pe={};const K=t.getParameter(t.SCISSOR_BOX),se=t.getParameter(t.VIEWPORT),de=new ia().fromArray(K),ge=new ia().fromArray(se);function Te(ye,Ke,Pe,Ye){const Ve=new Uint8Array(4),Ne=t.createTexture();t.bindTexture(ye,Ne),t.texParameteri(ye,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ye,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ce=0;Ce"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new Wn,u=new WeakMap;let m;const p=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(L,R){return f?new OffscreenCanvas(L,R):Gk("canvas")}function v(L,R,ne){let ve=1;const we=re(L);if((we.width>ne||we.height>ne)&&(ve=ne/Math.max(we.width,we.height)),ve<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){const me=Math.floor(ve*we.width),Me=Math.floor(ve*we.height);m===void 0&&(m=y(me,Me));const xe=R?y(me,Me):m;return xe.width=me,xe.height=Me,xe.getContext("2d").drawImage(L,0,0,me,Me),En("WebGLRenderer: Texture has been resized from ("+we.width+"x"+we.height+") to ("+me+"x"+Me+")."),xe}else return"data"in L&&En("WebGLRenderer: Image in DataTexture is too big ("+we.width+"x"+we.height+")."),L;return L}function b(L){return L.generateMipmaps}function g(L){t.generateMipmap(L)}function _(L){return L.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:L.isWebGL3DRenderTarget?t.TEXTURE_3D:L.isWebGLArrayRenderTarget||L.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function k(L,R,ne,ve,we=!1){if(L!==null){if(t[L]!==void 0)return t[L];En("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let me=R;if(R===t.RED&&(ne===t.FLOAT&&(me=t.R32F),ne===t.HALF_FLOAT&&(me=t.R16F),ne===t.UNSIGNED_BYTE&&(me=t.R8)),R===t.RED_INTEGER&&(ne===t.UNSIGNED_BYTE&&(me=t.R8UI),ne===t.UNSIGNED_SHORT&&(me=t.R16UI),ne===t.UNSIGNED_INT&&(me=t.R32UI),ne===t.BYTE&&(me=t.R8I),ne===t.SHORT&&(me=t.R16I),ne===t.INT&&(me=t.R32I)),R===t.RG&&(ne===t.FLOAT&&(me=t.RG32F),ne===t.HALF_FLOAT&&(me=t.RG16F),ne===t.UNSIGNED_BYTE&&(me=t.RG8)),R===t.RG_INTEGER&&(ne===t.UNSIGNED_BYTE&&(me=t.RG8UI),ne===t.UNSIGNED_SHORT&&(me=t.RG16UI),ne===t.UNSIGNED_INT&&(me=t.RG32UI),ne===t.BYTE&&(me=t.RG8I),ne===t.SHORT&&(me=t.RG16I),ne===t.INT&&(me=t.RG32I)),R===t.RGB_INTEGER&&(ne===t.UNSIGNED_BYTE&&(me=t.RGB8UI),ne===t.UNSIGNED_SHORT&&(me=t.RGB16UI),ne===t.UNSIGNED_INT&&(me=t.RGB32UI),ne===t.BYTE&&(me=t.RGB8I),ne===t.SHORT&&(me=t.RGB16I),ne===t.INT&&(me=t.RGB32I)),R===t.RGBA_INTEGER&&(ne===t.UNSIGNED_BYTE&&(me=t.RGBA8UI),ne===t.UNSIGNED_SHORT&&(me=t.RGBA16UI),ne===t.UNSIGNED_INT&&(me=t.RGBA32UI),ne===t.BYTE&&(me=t.RGBA8I),ne===t.SHORT&&(me=t.RGBA16I),ne===t.INT&&(me=t.RGBA32I)),R===t.RGB&&(ne===t.UNSIGNED_INT_5_9_9_9_REV&&(me=t.RGB9_E5),ne===t.UNSIGNED_INT_10F_11F_11F_REV&&(me=t.R11F_G11F_B10F)),R===t.RGBA){const Me=we?qk:yr.getTransfer(ve);ne===t.FLOAT&&(me=t.RGBA32F),ne===t.HALF_FLOAT&&(me=t.RGBA16F),ne===t.UNSIGNED_BYTE&&(me=Me===Ur?t.SRGB8_ALPHA8:t.RGBA8),ne===t.UNSIGNED_SHORT_4_4_4_4&&(me=t.RGBA4),ne===t.UNSIGNED_SHORT_5_5_5_1&&(me=t.RGB5_A1)}return(me===t.R16F||me===t.R32F||me===t.RG16F||me===t.RG32F||me===t.RGBA16F||me===t.RGBA32F)&&e.get("EXT_color_buffer_float"),me}function C(L,R){let ne;return L?R===null||R===Of||R===A0?ne=t.DEPTH24_STENCIL8:R===Au?ne=t.DEPTH32F_STENCIL8:R===T0&&(ne=t.DEPTH24_STENCIL8,En("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):R===null||R===Of||R===A0?ne=t.DEPTH_COMPONENT24:R===Au?ne=t.DEPTH_COMPONENT32F:R===T0&&(ne=t.DEPTH_COMPONENT16),ne}function N(L,R){return b(L)===!0||L.isFramebufferTexture&&L.minFilter!==Zo&&L.minFilter!==zl?Math.log2(Math.max(R.width,R.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?R.mipmaps.length:1}function P(L){const R=L.target;R.removeEventListener("dispose",P),j(R),R.isVideoTexture&&u.delete(R)}function T(L){const R=L.target;R.removeEventListener("dispose",T),F(R)}function j(L){const R=r.get(L);if(R.__webglInit===void 0)return;const ne=L.source,ve=p.get(ne);if(ve){const we=ve[R.__cacheKey];we.usedTimes--,we.usedTimes===0&&A(L),Object.keys(ve).length===0&&p.delete(ne)}r.remove(L)}function A(L){const R=r.get(L);t.deleteTexture(R.__webglTexture);const ne=L.source,ve=p.get(ne);delete ve[R.__cacheKey],o.memory.textures--}function F(L){const R=r.get(L);if(L.depthTexture&&(L.depthTexture.dispose(),r.remove(L.depthTexture)),L.isWebGLCubeRenderTarget)for(let ve=0;ve<6;ve++){if(Array.isArray(R.__webglFramebuffer[ve]))for(let we=0;we